Build 562131stable
Module 860603
45,595 characters · in a7ba8883a66e7d1b.jsDependencies
Lazily required by (0)none
Requires (144)
234142891792822231303703258935956396194047443105471676470066834832579187195561108305123292125744136722137177139033143582147925150934155718157559159273174459174900179771184940192308200662235986237070261958264322282956287809289873292666308244310419314116317525320426320448321073323874331322338652342298349288351906375708376092381616398590400698404778406810408278417454427262429913430392442433451988452027458203462887468689485845486020488995503698514810526132528265534148534514542225542580573648576705592822595738607940625494627968633018633334636537636547638916652215663417691885696451709066713654732159735438736653746523765178767906778492783878788373803378808728818050821609824953825453830662834730836803837057854766858456866219870807881636885574887501889227892547935208935399936256939249950305957565964099964486968309975571989349990078993077994500
Source Raw
function(e,t,n){n.d(t,{A:()=>t8}),n(321073);var i,l=n(627968),s=n(64700),a=n(735438),r=n.n(a),o=n(17928),c=n(534514),d=n(40474),u=n(282956),m=n(83257),g=n(968309),h=n(235986),x=n(143582),A=n(607940),p=n(808728),b=n(576705),f=n(625494),j=n(975571),N=n(179771),E=n(732159),C=n(192308),v=n(406810),T=n(950305),I=n(993077),S=n(834730),y=n(404778),O=n(430392),k=n(39619),L=n(821609),w=n(157559),R=n(468689),M=n(633018),_=n(503698),P=n.n(_),W=n(542225);function G(e){let{children:t,icon:n,title:i}=e;return(0,l.jsxs)("header",{className:W.wx,children:[(0,l.jsxs)("div",{className:W.UU,children:[s.cloneElement(n,{className:P()(n.props.className,W.Kk),height:24,width:24}),(0,l.jsx)(c.D,{variant:"heading-md/semibold",className:W.DD,children:i})]}),t]})}var D=n(542580),U=n(803378),B=n(825453),H=n(892547),z=n(485845),V=n(155718),K=n(633334);function F(e){return{id:e.id,names:[e.displayName]}}var Y=n(261958),q=n(939249),Z=n(885574),Q=n(442433),J=n(200662),X=n(375708),$=n(870807);function ee(e){let{applicationIcon:t,applicationName:i,canNavigate:a,command:r,guildId:o}=e,c=s.useMemo(()=>0!==Object.keys(r.permissions??{}).length,[r.permissions]),d=s.useCallback(()=>{null!=r&&a()&&(0,C.openModalLazy)(async()=>{let{default:e}=await n.e("15946").then(n.bind(n,326993));return n=>(0,l.jsx)(e,{applicationIcon:t,applicationId:r.applicationId,applicationName:i,command:r,guildId:o,...n})})},[t,i,a,r,o]),u=s.useCallback(e=>{(0,Q.L3)(e,async()=>{let{default:e}=await n.e("15687").then(n.bind(n,646938));return t=>(0,l.jsx)(e,{...t,id:r.id,label:X.intl.string(X.t.oJ1Muw)})})},[r]),m=r.type===V.kc.CHAT?M.k:Y.u,g=(0,J.p6)(r.type,r.displayName);return(0,l.jsxs)(q.D,{onClick:d,className:$.AS,onContextMenu:u,children:[(0,l.jsxs)("div",{className:$.Cv,children:[(0,l.jsx)(m,{className:$.Kk,size:"md",color:"currentColor"}),(0,l.jsx)(S.E,{variant:"text-md/normal",children:g})]}),(0,l.jsx)("div",{className:$.II,children:c?(0,l.jsxs)("div",{className:$.Bs,children:[(0,l.jsx)(S.E,{variant:"text-md/normal",children:X.intl.string(X.t.jH4B9O)}),(0,l.jsx)(Z.m,{size:"sm",color:"currentColor",className:$.I8})]}):null})]})}var et=n(636547),en=n(746523);function ei(e){let{applicationIcon:t,applicationName:n,canNavigate:i,guildId:a}=e,{results:r,query:c,setQuery:d,unfilteredCount:u}=function(){let e=(0,o.cf)([U.A],()=>Object.values(U.A.getCommands()??{})),[t,n]=s.useState(""),i=s.useMemo(()=>e.filter(e=>(null==e.integration_types||e.integration_types.includes(z.b.GUILD_INSTALL))&&(null==e.contexts||e.contexts?.includes(V.OL.GUILD))),[e]),l=s.useMemo(()=>[...i].sort((e,t)=>{let n=V.kc.CHAT+1,i=(t.type>n?n:t.type)-(e.type>n?n:e.type);return 0!==i?i:e.untranslatedName.localeCompare(t.untranslatedName)}),[i]),a=s.useMemo(()=>t.startsWith("/")?l.filter(e=>e.type===V.kc.CHAT):l,[t,l]),r=s.useMemo(()=>t.startsWith("/")?t.substring(1):t,[t]);return{query:t,results:s.useMemo(()=>(0,K.I)(a,F,r),[a,r]),setQuery:n,unfilteredCount:e.length}}();return null!=r&&u>0?(0,l.jsx)(et.A,{bar:(0,l.jsx)(H.I,{size:"sm",query:c,onChange:d,onClear:()=>d("")}),inModal:!1,title:X.intl.string(X.t["0hKkS+"]),children:r.map((e,o)=>(0,l.jsxs)(s.Fragment,{children:[(0,l.jsx)(ee,{applicationIcon:t,applicationName:n,canNavigate:i,command:e,guildId:a}),o<r.length-1?(0,l.jsx)(y.c,{}):null]},e.id))}):(0,l.jsx)(I.Z,{className:en.a,editable:!0,children:(0,l.jsx)(S.E,{color:"text-muted",variant:"text-sm/normal",children:X.intl.string(X.t["x78c+J"])})})}var el=n(534148),es=n(830662);function ea(e){let{application:t,canNavigate:n,guildId:i}=e,a=(0,o.bG)([U.A],()=>U.A.isUnavailable());return(s.useEffect(()=>(D.hu(t.id),D.AL),[t.id]),s.useEffect(()=>{D.gV(t.id,i,t.id),D.Jw(i,t.id)},[t.id,i]),a)?null:(0,l.jsxs)(s.Fragment,{children:[(0,l.jsx)(G,{icon:(0,l.jsx)(M.k,{size:"md",color:"currentColor"}),title:X.intl.string(X.t.RGoJNN)}),(0,l.jsx)(S.E,{color:"text-muted",variant:"text-sm/normal",children:X.intl.string(X.t.sCkD3Z)}),(0,l.jsx)(er,{guildId:i,applicationId:t.id}),(0,l.jsx)(ei,{applicationIcon:t.icon,applicationName:t.name,canNavigate:n,guildId:i})]})}function er(e){let{applicationId:t,guildId:n}=e,{originalApplicationPermissions:i,editedTargetPermissions:s,selectedPermissionCount:a}=(0,B.A)(n,t);return(0,l.jsx)("div",{className:es.zi,children:(0,l.jsx)(el.A,{applicationId:t,guildId:n,inModal:!1,editedTargetPermissions:s,originalApplicationPermissions:i,selectedPermissionCount:a})})}var eo=n(308244),ec=n(486020),ed=n(935208),eu=n(427262),em=n(990078),eg=n(331322),eh=n(638916),ex=n(866219);function eA(e){let{name:t,description:n,icon:i,imageSrc:s,iconBackgroundColor:a,iconClassName:r,iconWrapperClassName:o,details:d,detailsClassName:u,isHeader:m,isPremium:g,children:h}=e;return(0,l.jsxs)(eg.B,{direction:"horizontal",fullWidth:!0,gap:16,children:[null!=i||null!=s?function(e,t,n,i,s){if(null!=t)return(0,l.jsx)("img",{alt:"",src:t,className:P()(ex.P0,i)});let a=null;return null!=e&&(a="string"==typeof e?(0,l.jsx)("img",{alt:"",src:e,className:P()(ex.Kk,i)}):(0,l.jsx)(e,{className:P()(ex.Kk,i),color:"currentColor"})),(0,l.jsx)("div",{style:{backgroundColor:n},className:P()(ex.P0,s),children:a})}(i,s,a,r,o):null,(0,l.jsxs)(eg.B,{justify:"center",children:[function(e){let{name:t,description:n,details:i,detailsClassName:s,isHeader:a,isPremium:r}=e,o=i?.map((e,t)=>{let{icon:n,text:i}=e;return(0,l.jsxs)("div",{className:P()(ex.yM,a?ex.Vw:null),children:[null!=n?(0,l.jsx)(n,{size:"xs",color:"currentColor",className:ex.Ul}):null,(0,l.jsx)(S.E,{variant:"text-xs/normal",color:"text-default",className:s,children:i})]},t)});return(0,l.jsxs)(eg.B,{gap:0,children:[(0,l.jsxs)(c.D,{variant:a?"heading-xl/semibold":"heading-md/medium",className:a?ex.wx:ex.K8,children:[t,r&&(0,l.jsx)(em.m,{text:X.intl.string(X.t.VFuFum),children:(0,l.jsx)(eh.q,{size:"xs",color:"currentColor",className:ex.PC})})]}),null!=n?(0,l.jsx)(S.E,{variant:"text-sm/normal",color:"text-default",children:n}):null,(0,l.jsx)(eg.B,{direction:"horizontal",children:o})]})}({name:t,description:n,details:d,detailsClassName:u,isHeader:m,isPremium:g}),h]})]})}var ep=n(136722),eb=n(452027),ef=n(66834),ej=n(417454),eN=n(595738),eE=n(709066),eC=n(376092),ev=n(889227),eT=n(696451),eI=n(317525),eS=n(592822);function ey(e){let{guild:t,applicationIntegration:n}=e,{application:i}=n,a=null!=i.bot?new ev.A(i.bot):null,r=(0,o.bG)([eT.Ay],()=>null!=a?eT.Ay.getMember(t.id,a.id):null,[a,t]),c=(0,o.bG)([eI.A],()=>eI.A.getEveryoneRole(t)),d=(0,o.yK)([eI.A],()=>eI.A.getManyRoles(t.id,r?.roles??[])),u=a?.id;s.useEffect(()=>{null!=u&&ef.A.requestMembersById(t.id,u)},[t.id,u]);let m=s.useMemo(()=>ep.kg(c.permissions,...d.map(e=>e.permissions)),[d,c]);if(null==a)return null;let g=ec.Ay.getApplicationIconURL({id:i.id,guildMember:r,bot:i.bot,icon:i.icon,size:32});return(0,l.jsx)(I.Z,{editable:!0,className:eS.Nr,children:(0,l.jsxs)(h.A,{direction:h.A.Direction.VERTICAL,children:[(0,l.jsxs)(h.A,{align:h.A.Align.CENTER,children:[(0,l.jsx)("img",{alt:"",src:g,className:eS.P0}),(0,l.jsx)(S.E,{color:"text-strong",variant:"text-sm/normal",children:X.intl.format(X.t.GyhzGw,{user:a.toString()})}),(0,l.jsx)(eE.A,{className:eS.Tc,verified:a.isVerifiedBot()})]}),function(e,t,n,i){let s=[],a=[];for(let e of eC.Q)ep.zy(i,e)?s.push(e):a.push(e);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(y.c,{className:eS.yF}),n.length>0?(0,l.jsx)(eb.D,{label:X.intl.format(X.t.PCs0oo,{numRoles:n.length}),children:(0,l.jsx)(ej.Ay,{className:eS.pf,user:e,guild:t,userRoleIds:n,wrap:!1,readOnly:!0})}):null,s.length>0||a.length>0?(0,l.jsx)(eN.A,{grantedPermissions:s,grantedPermissionsHeader:X.intl.string(X.t["hA4+su"]),disabledPermissions:a,disabledPermissionsHeader:X.intl.string(X.t["/rEZ2i"])}):null]})}(a,t,r?.roles??[],m)]})})}var eO=n(47167),ek=n(994500),eL=n(287809),ew=n(123292),eR=n(314116),eM=n(778492),e_=n(292666),eP=n(691885),eW=n(824953),eG=n(147925),eD=n(652215),eU=n(964099);function eB(e){let{webhook:t,editedWebhook:n,channelOptions:i,isExpanded:a,errors:r,onToggleExpand:o}=e,c=s.useMemo(()=>{var e;return null!=(e=t.avatar)&&/^data:/.test(e)?e:(0,ec.ku)({id:t.id,avatar:e,discriminator:eD.h3J})},[t]),d=s.useCallback(()=>{(0,eR.A)({title:X.intl.formatToPlainString(X.t.gBKqZ0,{name:t.name}),subtitle:X.intl.string(X.t.zO9jrD),confirmText:X.intl.string(X.t.CMy0Cj),onConfirm:()=>{eW.A.delete(t.guild_id,t.id).catch(()=>{w.A.show({title:X.intl.string(X.t.LpbaFV),body:X.intl.string(X.t["/4TwKf"])})})}})},[t.guild_id,t.id,t.name]),m=[];null!=t.source_channel&&null!=t.source_guild&&(m.push({icon:eM.k,text:t.source_channel.name}),m.push({text:(0,l.jsx)("span",{className:eU.lM,children:X.intl.format(X.t["H/jJ6R"],{guildHook:()=>(0,l.jsx)("span",{className:eU.VZ,children:t.source_guild.name},t.id)})},"guild-source")}));let g=null;return a&&null!=n&&(g=(0,l.jsxs)("div",{className:eU.rf,children:[(0,l.jsx)(y.c,{className:eU.fV}),(0,l.jsxs)(eg.B,{gap:24,children:[(0,l.jsxs)(eg.B,{direction:"horizontal",gap:16,children:[(0,l.jsx)(e_.k,{label:X.intl.string(X.t.I1o5gV),value:n.name,onChange:e=>{u.A.updateWebhook({name:e})},maxLength:80,error:r.name}),(0,l.jsx)(eP.l,{label:X.intl.string(X.t["4TuWfc"]),value:n.channel_id,options:i,onSelectionChange:e=>{u.A.updateWebhook({channelId:e})},selectionMode:"single",fullWidth:!0})]}),(0,l.jsx)(y.c,{className:eU.Bd}),(0,l.jsx)(ew.Q,{onClick:d,size:"sm",variant:"critical",text:X.intl.string(X.t.CMy0Cj)})]})]})),(0,l.jsx)(I.Z,{editable:!0,className:eU.Nr,children:(0,l.jsxs)(eg.B,{children:[(0,l.jsx)(q.D,{className:eU.wx,"aria-expanded":a,onClick:o,children:(0,l.jsxs)(eg.B,{direction:"horizontal",justify:"space-between",align:"center",children:[(0,l.jsx)(eA,{name:t.name,imageSrc:c,details:m}),(0,l.jsx)(eG.A,{className:eU.eO,expanded:a,"aria-hidden":!0})]})}),g]})})}var eH=n(935399),ez=n(636537),eV=n(451988),eK=n(783878),eF=n(765178),eY=n(342298),eq=n(957565),eZ=n(767906);function eQ(e,t){return null!=t&&/^data:/.test(t)?t:(0,ec.ku)({id:e.id,avatar:t,discriminator:eD.h3J})}function eJ(e){let{id:t,webhook:n,editedWebhook:i,channelOptions:a,isExpanded:r,isNew:o,errors:c,onToggleExpand:d}=e,[m,g]=s.useState(!1),[x]=s.useState(new eV.Ep);s.useEffect(()=>()=>x.stop(),[x]);let A=s.useRef(null);(0,eH.Ay)(()=>{!0===o&&(u.A.startEditingWebhook(n.id),A.current?.scrollIntoView({behavior:"smooth",block:"center"}))});let p=s.useMemo(()=>eQ(n,n.avatar),[n]),b=s.useCallback(()=>{let e=`${(0,ez.TP)(!1)}${eD.Rsh.WEBHOOK_INTEGRATION(n.id,n.token)}`;(0,eq.C)(e)},[n]),f=s.useCallback(()=>{(0,eR.A)({title:X.intl.formatToPlainString(X.t.QVFjHh,{name:n.name}),subtitle:X.intl.format(X.t["rIWe+5"],{name:n.name}),confirmText:X.intl.string(X.t["W+K1Fs"]),cancelText:X.intl.string(X.t.xNhj0O),onConfirm:()=>{eW.A.delete(n.guild_id,n.id).catch(e=>{let{status:t}=e;429===t?w.A.show({title:X.intl.string(X.t.N5riYn),body:X.intl.string(X.t.eAxcCc)}):w.A.show({title:X.intl.string(X.t.N5riYn),body:X.intl.string(X.t["/4TwKf"])})})}})},[n.guild_id,n.id,n.name]),j=[];null!=n.user?j.push({icon:v.O,text:X.intl.formatToPlainString(X.t["7EcUbr"],{user:(e=>{if(null==e)return null;let t=new ev.A(e);return eu.Ay.getUserTag(t)})(n.user),timestamp:ed.default.extractTimestamp(n.id)})}):j.push({icon:v.O,text:X.intl.formatToPlainString(X.t["7mv59O"],{timestamp:ed.default.extractTimestamp(n.id)})});let N=null;return r&&null!=i&&(N=(0,l.jsxs)("div",{className:eZ.rf,children:[(0,l.jsx)(y.c,{className:eZ.fV}),(0,l.jsxs)(h.A,{children:[(0,l.jsx)(h.A.Child,{shrink:1,grow:0,children:(0,l.jsxs)(h.A,{className:eZ.R3,direction:h.A.Direction.VERTICAL,children:[(0,l.jsx)(eY.A,{image:i.avatar,onChange:e=>{u.A.updateWebhook({avatar:e})},makeURL:e=>eQ(n,e),imageClassName:eZ.mr,showIcon:!0}),null!=c.avatar&&""!==c.avatar?(0,l.jsx)(S.E,{color:"text-feedback-critical",variant:"text-sm/normal",children:c.avatar}):null]})}),(0,l.jsxs)(h.A,{direction:h.A.Direction.VERTICAL,children:[(0,l.jsxs)(h.A,{children:[(0,l.jsx)(h.A.Child,{wrap:!0,basis:"50%",children:(0,l.jsx)(e_.k,{label:X.intl.string(X.t.ukdxuo),value:i.name,onChange:e=>{u.A.updateWebhook({name:e})},maxLength:80,error:c.name})}),(0,l.jsx)(h.A.Child,{basis:"50%",children:(0,l.jsx)("div",{children:(0,l.jsx)(eK.Z,{label:X.intl.string(X.t.GK18KJ),value:i.channel_id,options:a,formatOption:e=>{let{value:t,label:n}=e;return{id:t.toString(),value:t,label:n}},onSelectionChange:e=>{u.A.updateWebhook({channelId:e})},placeholder:X.intl.string(X.t.r2ptsz),selectionMode:"single"})})})]}),(0,l.jsx)(y.c,{className:eZ.Bd}),(0,l.jsxs)(h.A,{children:[(0,l.jsx)(em.m,{text:X.intl.string(X.t.wwdb3g),shouldShow:m,hideOnClick:!1,forceOpen:m,children:(0,l.jsx)("div",{"data-button-hoisted-classname-wrapper":!0,className:eZ.cL,children:(0,l.jsx)(L.$,{variant:"secondary",size:"sm",text:X.intl.string(X.t.Ae9rUW),"aria-label":"",onClick:()=>{g(!0),eF.O.announce(X.intl.string(X.t.wwdb3g)),x.start(1e3,()=>g(!1)),b()},disabled:null==n.token||""===n.token})})}),(0,l.jsx)(L.$,{variant:"critical-secondary",size:"sm",text:X.intl.string(X.t.jVrUnC),onClick:f})]})]})]})]})),(0,l.jsx)(I.Z,{ref:A,editable:!0,id:t,className:P()(eZ.Nr,o?eZ.U6:null),children:(0,l.jsxs)(h.A,{direction:h.A.Direction.VERTICAL,children:[(0,l.jsx)(q.D,{className:eZ.wx,"aria-expanded":r,onClick:d,children:(0,l.jsxs)(h.A,{align:h.A.Align.CENTER,children:[(0,l.jsx)(eA,{name:n.name,imageSrc:p,details:j}),(0,l.jsx)(eG.A,{className:eZ.eO,expanded:r,"aria-hidden":!0})]})}),N]})})}var eX=n(400698);function e$(e){let{webhooks:t,selectableWebhookChannels:n,lastCreatedWebhookId:i,editedWebhook:a,errors:r,canNavigate:o}=e,c=s.useMemo(()=>Object.values(n).map(e=>({id:e.id,value:e.id,label:(0,eO.m1)(e,eL.default,ek.A,!0)})),[n]),d=s.useMemo(()=>{let e={};for(let i of t)if(i.channel_id in e)e[i.channel_id].webhooks.push(i);else{let t=n[i.channel_id];null!=t&&(e[i.channel_id]={channel:t,webhooks:[i]})}return Object.values(e).sort((e,t)=>e.channel.name.localeCompare(t.channel.name))},[n,t]),m=s.useCallback(e=>{o()&&(e===a?.id?u.A.stopEditingWebhook():u.A.startEditingWebhook(e))},[o,a]);return(0,l.jsx)("div",{className:eX.__invalid_list,children:d.map(e=>{let{channel:t,webhooks:n}=e;return function(e){let{channel:t,webhooks:n,channelOptions:i,lastCreatedWebhookId:s,editedWebhook:a,errors:r,toggleWebhookExpand:o}=e;return(0,l.jsxs)("div",{children:[(0,l.jsx)(S.E,{variant:"text-md/medium",className:eX.x,children:X.intl.format(X.t.TKDIZg,{channelHook:()=>(0,l.jsx)("span",{className:eX.H,children:(0,eO.m1)(t,eL.default,ek.A,!0)},t.id)})}),n.map(e=>e.type===eD.NH1.CHANNEL_FOLLOWER?(0,l.jsx)(eB,{webhook:e,editedWebhook:a,channelOptions:i,isExpanded:a?.id===e.id,onToggleExpand:()=>o(e.id),errors:r},e.id):(0,l.jsx)(eJ,{webhook:e,editedWebhook:a,channelOptions:i,isExpanded:a?.id===e.id,isNew:s===e.id,onToggleExpand:()=>o(e.id),errors:r},e.id))]},t.id)}({channel:t,webhooks:n,channelOptions:c,lastCreatedWebhookId:i,editedWebhook:a,errors:r,toggleWebhookExpand:m})})})}var e0=n(234);function e2(e){let{application:t,guild:n,integration:i,...s}=e;return(0,l.jsx)(E.ConfirmModal,{...s,title:X.intl.formatToPlainString(X.t["rL9d/1"],{applicationName:t.name}),subtitle:X.intl.format(X.t.FGE8ya,{applicationName:t.name}),confirmText:X.intl.string(X.t.ebGf4m),onConfirm:()=>{R.A.disableIntegration(n.id,i.id).catch(()=>{w.A.show({title:X.intl.string(X.t.wYqMmI),body:X.intl.string(X.t.A4Mnst)})})}})}function e3(e){let{guild:t,applicationIntegration:n,selectableWebhookChannels:i,editedWebhook:a,errors:r,canNavigate:c}=e,{application:d,integration:u,webhooks:m}=n,[g,x]=(0,o.yK)([b.A],()=>[b.A.can(eD.xBc.MANAGE_ROLES,t),null==d.bot||b.A.canManageUser(eD.xBc.MANAGE_GUILD,d.bot.id,t)],[d.bot,t]),A=(0,o.bG)([b.A],()=>b.A.can(eD.xBc.MANAGE_WEBHOOKS,t),[t]),p=s.useCallback(()=>{c()&&(0,C.openModal)(e=>(0,l.jsx)(e2,{guild:t,application:d,integration:u,...e}))},[d,c,t,u]),f=s.useMemo(()=>{let e=[{icon:v.O,text:X.intl.formatToPlainString(X.t.gcdJ8J,{timestamp:ed.default.extractTimestamp(u.id)})}];return null!=u.user&&e.push({icon:T.n,text:X.intl.formatToPlainString(X.t.qE7oqs,{user:eu.Ay.getUserTag(u.user)})}),e},[u.id,u.user]),j=s.useMemo(()=>null!=d.bot&&u.scopes?.includes(N.F.BOT)?(0,l.jsx)(ey,{guild:t,applicationIntegration:n}):(0,l.jsx)(I.Z,{className:e0.aM,editable:!0,children:(0,l.jsx)(S.E,{color:"text-muted",variant:"text-sm/normal",children:X.intl.string(X.t.pfLnza)})}),[d.bot,n,t,u.scopes]);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(eA,{name:d.name,imageSrc:ec.Ay.getApplicationIconURL({id:d.id,icon:d.icon,size:32}),details:f,isHeader:!0}),d?.description!=null?(0,l.jsx)(eo.A,{userBio:d.description,className:e0.ux}):null,g?(0,l.jsx)(ea,{application:d,canNavigate:c,guildId:t.id}):null,(0,l.jsx)(y.c,{className:e0.zN}),null!=d.bot?(0,l.jsxs)("div",{className:e0.uW,children:[(0,l.jsx)(G,{icon:(0,l.jsx)(O.C,{size:"xs",color:"currentColor"}),title:X.intl.string(X.t.AOdOYr)}),j]}):null,(0,l.jsxs)("div",{className:e0.uW,children:[(0,l.jsx)(G,{icon:(0,l.jsx)(k.X,{size:"md",color:"currentColor"}),title:X.intl.string(X.t["t9ZX/I"])}),m.length>0?(0,l.jsx)(e$,{webhooks:m,editedWebhook:a,selectableWebhookChannels:i,errors:r,canNavigate:c}):(0,l.jsx)(I.Z,{className:e0.aM,editable:!0,children:(0,l.jsx)(S.E,{color:"text-muted",variant:"text-sm/normal",children:A?X.intl.string(X.t.ahPd2Y):X.intl.string(X.t.axqYMl)})})]}),(0,l.jsx)(y.c,{className:e0.zN}),(0,l.jsxs)(h.A,{className:e0.uW,justify:h.A.Justify.BETWEEN,align:h.A.Align.CENTER,children:[(0,l.jsx)(S.E,{color:"text-default",variant:"text-sm/normal",children:x?X.intl.string(X.t.hdneL4):X.intl.string(X.t.xRCMqx)}),(0,l.jsx)(h.A.Child,{grow:0,shrink:0,children:(0,l.jsx)(L.$,{variant:"critical-primary",size:"sm",text:X.intl.string(X.t.ebGf4m),disabled:!x,onClick:p})})]})]})}var e1=n(573648);n(323874),n(14289),n(35956);var e7=n(989349),e8=n.n(e7),e4=n(788373),e6=((i={})[i.ONE_DAY=1]="ONE_DAY",i[i.THREE_DAYS=3]="THREE_DAYS",i[i.SEVEN_DAYS=7]="SEVEN_DAYS",i[i.FOURTEEN_DAYS=14]="FOURTEEN_DAYS",i[i.THIRTY_DAYS=30]="THIRTY_DAYS",i),e5=n(125744),e9=n(139033),te=n(408278),tt=n(663417),tn=n(150934),ti=n(349288),tl=n(159273),ts=n(351906),ta=n(858456),tr=n(818050);function to(e){let t,{guild:n,integration:i,editedIntegration:a,isExpanded:r,onToggleExpand:d,onDisable:m,onEnable:g}=e,[x,A]=s.useState(!1),p=(0,o.bG)([ts.A],()=>ts.A.hidePersonalInformation),f=(0,o.bG)([b.A],()=>b.A.can(eD.xBc.KICK_MEMBERS,n)),j=s.useCallback(()=>{A(!0),g(i)},[i,g]),N=s.useCallback(()=>{if(!i.syncing)if(f||i.expire_behavior!==e4.F.KICK){let e=i.expire_behavior===e4.F.REMOVE_ROLE?X.intl.string(X.t["6kpw4i"]):X.intl.string(X.t.fQUQIJ);(0,eR.A)({title:X.intl.string(X.t.emx3lN),subtitle:i.type===e5.s.YOUTUBE?X.intl.string(X.t.anKQWU):X.intl.string(X.t["BW/xtn"]),confirmText:e,onConfirm:()=>m(i),variant:"critical"})}else(0,e9.A)({title:X.intl.string(X.t.emx3lN),subtitle:i.type===e5.s.YOUTUBE?X.intl.string(X.t.pDCiEf):X.intl.string(X.t.sQqHFk)})},[i,m,f]),E=s.useCallback(()=>{R.A.syncIntegration(n.id,i.id)},[n.id,i.id]),C=s.useCallback(()=>{null!=i.role_id&&(R.A.setSection(eD.BEX.ROLES),R.A.selectRole(i.role_id))},[i.role_id]),{serviceName:T,channelURL:O,expireBehaviorLabel:k,syncLabel:w,subscribersText:M}=s.useMemo(()=>{let e=e1.A.get(i.type)?.getPlatformUserUrl?.({id:i.account.id,name:i.account.name})??"";switch(i.type){case e5.s.YOUTUBE:return{serviceName:X.intl.string(X.t.aS6cK4),expireBehaviorLabel:X.intl.string(X.t.A5MiqO),syncLabel:X.intl.string(X.t["7vHKVe"]),subscribersText:X.intl.formatToPlainString(X.t["7lNtce"],{subscribers:i.subscriber_count??0}),channelURL:e};case e5.s.TWITCH:default:return{serviceName:X.intl.string(X.t.q4pBG3),expireBehaviorLabel:X.intl.string(X.t["S/WCrG"]),syncLabel:X.intl.string(X.t["0jbPK4"]),subscribersText:X.intl.formatToPlainString(X.t.RdUTrl,{subscribers:i.subscriber_count??0}),channelURL:e}}},[i.account,i.subscriber_count,i.type]),_=(0,o.bG)([eI.A],()=>null!=i.role_id?eI.A.getRole(n.id,i.role_id):void 0),{roleLink:W,syncDescriptionText:G}=s.useMemo(()=>{let e;e=null!=_?(0,l.jsx)(ti.Anchor,{onClick:C,children:_.name}):X.intl.string(X.t.PoWNfe);let t=e1.A.get(i.type);return{roleLink:e,syncDescriptionText:i.revoked&&null!=t?X.intl.formatToPlainString(X.t.G16Wji,{user:i.user,platformName:t.name}):X.intl.formatToPlainString(X.t.unl3AP,{datetime:e8()(i.synced_at).calendar()})}},[_,C,i.revoked,i.synced_at,i.type,i.user]),D=(0,o.bG)([eI.A],()=>eI.A.getSortedRoles(n.id)),U=s.useMemo(()=>{let e=tl.Ay.getGuildEmoji(n.id),t=D.filter(e=>null!=e.tags&&e.tags.integration_id===i.id).map(e=>e.id);return i.enable_emoticons?e.filter(e=>null!=i.role_id&&e?.roles.some(e=>t.includes(e))).sort((e,t)=>e.name.localeCompare(t.name)):[]},[n.id,D,i.enable_emoticons,i.id,i.role_id]);if(s.useEffect(()=>{a?.id===i.id&&a?.enabled===!0&&A(!1)},[a,i.id]),i.enabled&&null!=i.user)t=[{icon:v.O,text:p?X.intl.formatToPlainString(X.t.gcdJ8J,{timestamp:ed.default.extractTimestamp(i.id)}):X.intl.formatToPlainString(X.t.Nu9sat,{user:null!=i.user?new ev.A(i.user).tag:null,timestamp:ed.default.extractTimestamp(i.id)})}];else{let e=new URL(O);t=[{text:X.intl.format(X.t.BegylZ,{serviceName:T,accountUrl:O,accountUrlText:e.hostname+e.pathname})}]}let B=(0,l.jsxs)(h.A,{className:ta.wx,align:h.A.Align.CENTER,children:[(0,l.jsx)(eA,{name:`${i.name}`,detailsClassName:ta.h_,details:t}),i.enabled?(0,l.jsx)(h.A.Child,{shrink:0,grow:0,children:(0,l.jsx)(eG.A,{className:ta.eO,expanded:r&&!x,"aria-hidden":!0})}):(0,l.jsx)(h.A.Child,{shrink:0,grow:0,children:x?(0,l.jsx)(te.K,{variant:"primary",size:"sm",disabled:!0,icon:tt.f,"aria-label":X.intl.string(X.t["7sCN8m"])}):(0,l.jsx)(L.$,{variant:"primary",size:"sm",onClick:j,text:X.intl.string(X.t["7sCN8m"])})})]}),H=null;return r&&!x&&null!=a&&(H=(0,l.jsxs)(h.A,{className:ta.rf,direction:h.A.Direction.VERTICAL,children:[(0,l.jsx)(y.c,{className:ta.fV}),function(e){let{integration:t,labelText:n,subscribersText:i,descriptionText:s,roleLink:a,onSync:r}=e;return(0,l.jsxs)(h.A,{children:[(0,l.jsxs)(h.A.Child,{basis:"50%",children:[(0,l.jsx)(c.D,{variant:"heading-md/semibold",className:tr.QB,children:X.intl.string(X.t.eBtNBa)}),(0,l.jsx)(S.E,{className:ta.RZ,color:"text-strong",variant:"text-sm/normal",children:a})]}),(0,l.jsxs)(h.A.Child,{basis:"50%",children:[(0,l.jsx)(c.D,{variant:"heading-sm/semibold",className:tr.QB,children:n}),(0,l.jsxs)(h.A,{justify:h.A.Justify.BETWEEN,children:[(0,l.jsxs)(h.A,{direction:h.A.Direction.VERTICAL,children:[(0,l.jsx)(S.E,{color:"text-strong",variant:"text-sm/normal",children:i}),(0,l.jsx)(S.E,{color:"text-default",variant:"text-xs/normal",children:s})]}),t.syncing?(0,l.jsx)(te.K,{size:"sm",variant:"primary",icon:tt.f,"aria-label":X.intl.string(X.t.BkuOO6),disabled:!0}):(0,l.jsx)(L.$,{size:"sm",variant:"primary",text:X.intl.string(X.t.BkuOO6),disabled:t.revoked,onClick:r})]})]})]})}({integration:a,labelText:w,subscribersText:M,descriptionText:G,roleLink:W,onSync:E}),(0,l.jsx)(y.c,{className:ta.W7}),function(e){let{integration:t,labelText:n,onBehaviorChange:i,onGracePeriodChange:s}=e;return(0,l.jsxs)(h.A,{children:[(0,l.jsx)(h.A.Child,{basis:"50%",children:(0,l.jsx)(eP.l,{selectionMode:"single",label:n,placeholder:n,value:`${t.expire_behavior}`,options:[{id:"remove-role",value:e4.F.REMOVE_ROLE.toString(),label:X.intl.string(X.t["6kpw4i"])},{id:"kick",value:e4.F.KICK.toString(),label:X.intl.string(X.t.fQUQIJ)}],disabled:t.syncing,onSelectionChange:e=>i(parseInt(e))})}),(0,l.jsx)(h.A.Child,{basis:"50%",children:(0,l.jsx)(eP.l,{selectionMode:"single",label:X.intl.string(X.t.uiXMow),placeholder:X.intl.string(X.t.uiXMow),maxOptionsVisible:5,value:`${t.expire_grace_period}`,options:Object.values(e6).filter(Number.isInteger).map(e=>({id:`${e}`,value:`${e}`,label:X.intl.formatToPlainString(X.t.eGjmy5,{days:e})})),onSelectionChange:e=>s(parseInt(e)),disabled:t.syncing})})]})}({integration:a,labelText:k,onBehaviorChange:function(e){u.A.updateIntegration({expireBehavior:e})},onGracePeriodChange:function(e){u.A.updateIntegration({expireGracePeriod:e})}}),!f&&a.expire_behavior===e4.F.KICK&&(0,l.jsx)(S.E,{className:ta.Ce,color:"text-feedback-critical",variant:"text-sm/normal",children:X.intl.string(X.t.mThMlB)}),i.type===e5.s.TWITCH?function(e){let{integration:t,emojis:n,onToggle:i}=e;return(0,l.jsxs)(h.A,{direction:h.A.Direction.VERTICAL,children:[(0,l.jsx)("div",{className:P()(tr.QX,tr.QB),children:(0,l.jsx)(tn.S,{checked:!!t.enable_emoticons,disabled:t.syncing,onChange:e=>i(e),label:X.intl.string(X.t["7r4OKg"])})}),(0,l.jsx)(h.A,{wrap:h.A.Wrap.WRAP,className:ta.__invalid_twitchEmojis,children:n.map((e,t)=>(0,l.jsx)(em.m,{text:e.name,children:(0,l.jsx)("img",{alt:X.intl.formatToPlainString(X.t.n6ZZn4,{name:e.name}),draggable:!1,className:P()(ta.Zg,"emoji","jumboable"),src:ec.Ay.getEmojiURL({id:e.id,animated:e.animated,size:28})},e.name)},t))})]})}({integration:a,emojis:U,onToggle:function(e){u.A.updateIntegration({enableEmoticons:e})}}):null,(0,l.jsx)(y.c,{className:ta.Bd}),(0,l.jsx)(h.A,{children:(0,l.jsx)(L.$,{size:"sm",variant:"critical-secondary",text:X.intl.string(X.t.M6q6eX),onClick:N})})]})),(0,l.jsx)(I.Z,{editable:!0,className:ta.Nr,children:(0,l.jsxs)(h.A,{direction:h.A.Direction.VERTICAL,children:[i.enabled?(0,l.jsx)(q.D,{className:ta._S,"aria-expanded":r&&!x,onClick:d,children:B}):B,H]})})}var tc=n(836803);function td(e){let{integrations:t,editedIntegration:n,guild:i,platformType:a,labelText:r,descriptionText:o,helpText:c,errors:d,canNavigate:m}=e,g=e1.A.get(a),h=s.useCallback(async e=>{m()&&(await R.A.enableIntegration(i.id,e.type,e.id),u.A.startEditingIntegration(e.id))},[m,i.id]),x=s.useCallback(e=>{m()&&(e.id===n?.id&&u.A.stopEditingIntegration(),R.A.disableIntegration(i.id,e.id))},[m,n,i.id]),A=s.useCallback(e=>{m()&&(e===n?.id?u.A.stopEditingIntegration():u.A.startEditingIntegration(e))},[m,n]);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(eA,{name:r,icon:g?.icon.whiteSVG,iconBackgroundColor:g?.color,iconClassName:tc.tV,description:o,isHeader:!0}),(0,l.jsx)(y.c,{className:tc.zN}),"message"in d&&(0,l.jsx)(S.E,{className:tc.kc,color:"text-feedback-critical",variant:"text-sm/normal",children:d.message}),t.map(e=>(0,l.jsx)(to,{integration:e,editedIntegration:n,guild:i,isExpanded:n?.id===e.id,onEnable:h,onDisable:x,onToggleExpand:()=>A(e.id)},e.id)),(0,l.jsx)(S.E,{className:tc.BK,color:"text-muted",variant:"text-sm/normal",children:c})]})}var tu=n(462887),tm=n(736653),tg=n(936256);let th="/assets/a29cabf3e1357986.svg",tx="/assets/c733a28e6fcba3ef.svg";function tA(e){var t;let n,{followedChannelWebhooks:i,editedWebhook:s,selectableWebhookChannels:a,errors:r,canNavigate:o}=e,d=(0,tm.Ay)();return(0,l.jsxs)("div",{children:[(0,l.jsx)(S.E,{variant:"text-sm/normal",children:X.intl.format(X.t["5u+aV1"],{helpdeskArticle:j.A.getArticleURL(eD.MVz.CHANNEL_FOLLOWING)})}),(0,l.jsx)(y.c,{className:tg.zN}),i.length>0?(0,l.jsx)(e$,{webhooks:i,editedWebhook:s,selectableWebhookChannels:a,errors:r,canNavigate:o}):(t=()=>open(j.A.getArticleURL(eD.MVz.CHANNEL_FOLLOWING)),n=(0,tu.M)(d)?th:tx,(0,l.jsxs)(h.A,{direction:h.A.Direction.VERTICAL,align:h.A.Align.CENTER,children:[(0,l.jsx)("img",{alt:"",src:n,className:tg.QT}),(0,l.jsx)(c.D,{variant:"heading-md/semibold",children:X.intl.string(X.t.gzuVH0)}),(0,l.jsx)("div",{"data-button-hoisted-classname-wrapper":!0,className:tg.nM,children:(0,l.jsx)(L.$,{variant:"primary",text:X.intl.string(X.t["ZwSt+T"]),onClick:t})})]}))]})}var tp=n(22231),tb=n(429913),tf=n(713654),tj=n(137177),tN=n(887501),tE=n(514810),tC=n(43105),tv=n(528265),tT=n(320448),tI=n(95561),tS=n(264322),ty=n(174459),tO=n(320426),tk=n(338652);function tL(e){let{name:t,icon:n,imageSrc:i,iconBackgroundColor:a,iconClassName:r,iconWrapperClassName:c,details:d,integration:u,buttonText:m,buttonDisabled:g,hasNextSection:h,onButtonClick:x,guildId:p,isScrolling:b,canShowMigrationTooltip:f,trailing:j}=e,[E,C]=s.useState(!1),v=f&&!b&&!E&&void 0!==p&&null!=u,T=s.useRef(null),y=s.useRef(null),w=null==m||null==x?null:h?(0,l.jsxs)(eg.B,{direction:"horizontal",fullWidth:!1,align:"center",ref:y,children:[(0,l.jsx)(S.E,{variant:"text-sm/normal",children:m}),(0,l.jsx)(tT._,{size:"custom",color:"currentColor",width:10,height:10,className:tk.OW})]}):(0,l.jsx)(L.$,{size:"sm",buttonRef:T,disabled:g,onClick:x,text:m});s.useEffect(()=>{v&&ty.default.track(eD.HAw.COMMANDS_MIGRATION_TOOLTIP_VIEWED,{...(0,tI.H$)(p),application_id:u?.application.id,location:"overview"})},[p,u?.application.id,v]);let R=v&&(null!=y.current||null!=T.current)?(0,l.jsx)(tC.A,{targetElementRef:h?y:T,title:X.intl.string(X.t.ufFDiC),body:X.intl.string(X.t.TyMJwC),onRequestClose:()=>{C(!0),tO.A.dismissOverviewTooltip(p,u.integration)},position:"bottom",align:"center",caretConfig:{align:"center"}}):null,_=(0,o.yK)([A.A],()=>null!=u&&null!=p?A.A.getApplicationEntitlementsForGuild(u.application.id,p)??[]:[]),W=(0,tS.ON)(p,!0),G=u?.application!=null&&Object.keys(W.result?.sections[u.application.id]?.commands??{}).length>0,D=(0,l.jsxs)(eg.B,{direction:"horizontal",align:"center",children:[(0,l.jsx)(eA,{name:t,icon:n,imageSrc:i,iconBackgroundColor:a,iconClassName:r,iconWrapperClassName:c,details:d,isPremium:_.length>0,children:function(e,t){if(null==e)return null;let n=[],{application:i,integration:s,webhooks:a}=e;return null!=i.bot&&s?.scopes?.includes(N.F.BOT)&&n.push({id:"bot",label:new ev.A(i.bot).isVerifiedBot()?X.intl.string(X.t.xxcTGy):X.intl.string(X.t.AOdOYr),icon:O.C}),a.length>0&&n.push({id:"webhooks",label:X.intl.formatToPlainString(X.t["6HqDfT"],{count:a.length}),icon:k.X}),s?.scopes?.includes(N.F.APPLICATIONS_COMMANDS)===!0&&t&&n.push({id:"commands",label:X.intl.string(X.t["0hKkS+"]),icon:M.k}),(0,l.jsx)(eg.B,{direction:"horizontal",gap:4,children:(0,l.jsx)(tv.C,{label:X.intl.string(X.t.G8u3Jf),layout:"inline",items:n})})}(u,G)}),R,w,j]});return h?(0,l.jsx)(q.D,{onClick:()=>{f&&null!=p&&null!=u&&tO.A.dismissOverviewTooltip(p,u.integration),x?.()},children:(0,l.jsx)(I.Z,{editable:!0,className:P()(tk.Nr,tk.vk),children:D})}):(0,l.jsx)(I.Z,{editable:!0,className:tk.Nr,children:D})}function tw(e){let{channel:t,application:i,showApplicationImage:a,...r}=e,o=(0,tE.N)(t),c=s.useCallback(()=>(0,C.openModalLazy)(async()=>{let{default:e}=await Promise.all([n.e("10527"),n.e("73380")]).then(n.bind(n,106895));return n=>(0,l.jsx)(e,{...n,channel:t,application:i})}),[i,t]),d=a?i.getIconURL(48)??ec.vI["0"]:void 0;return(0,l.jsx)(tL,{imageSrc:d,onButtonClick:c,details:null!=o?[{text:o}]:void 0,...r})}var tR=n(108305);function tM(e){let{applicationId:t,channels:n}=e,i=(0,tb.h)(t);return 0===n.length||null==i?null:(0,l.jsxs)("div",{className:tR.kF,children:[(0,l.jsxs)("div",{className:tR.wx,children:[(0,l.jsx)(tj.A,{game:i,size:tj.M.XSMALL}),(0,l.jsx)(c.D,{variant:"heading-md/semibold",children:i?.name})]}),n.map(e=>(0,l.jsx)(tw,{channel:e,application:i,name:(0,eO.m1)(e,eL.default,ek.A),icon:(0,tf.gU)(e)??void 0,iconWrapperClassName:tR.N3,hasNextSection:!0,trailing:(0,l.jsx)(tp.R,{size:"xs"})},e.id))]})}function t_(e){let{guild:t}=e,n=(0,tN.A)(t.id),i=r().groupBy(n,e=>e.linkedLobby?.application_id),a=Object.keys(i);return s.useEffect(()=>{0===n.length&&u.A.setSection(eD.wLn.OVERVIEW)},[n]),(0,l.jsxs)("div",{children:[(0,l.jsx)(S.E,{variant:"text-sm/normal",children:X.intl.format(X.t["9gsSLu"],{helpdeskArticle:j.A.getArticleURL(eD.MVz.LINKED_LOBBIES)})}),(0,l.jsx)(y.c,{className:tR.zN}),a.map(e=>(0,l.jsx)(tM,{applicationId:e,channels:i[e]},e))]})}var tP=n(91871),tW=n.n(tP),tG=n(881636),tD=n(184940),tU=n(289873),tB=n(398590),tH=n(837057),tz=n(310419),tV=n(526132),tK=n(30370),tF=n(381616),tY=n(488995),tq=n(32589),tZ=n(854766),tQ=n(237070);function tJ(e,t){return t.includes(e)}function tX(e){let{query:t,setQuery:n}=e,i=s.useCallback(e=>{n(e)},[n]);return(0,l.jsx)("div",{className:tq.MT,children:(0,l.jsx)(H.I,{query:t,onChange:i,onClear:()=>n(""),placeholder:X.intl.string(X.t["5prvKe"]),"aria-label":X.intl.string(X.t["5prvKe"])})})}function t$(e){var t,n,i,a;let r,d,u,m,x,A,p,f,N,E,{guild:T,channel:O,applicationIntegrations:L,builtInIntegrations:w,customWebhooks:R,followedChannelWebhooks:M,isLoadingWebhooks:_,canCreateWebhook:W,onManageBuiltIn:G,onManageCustomWebhooks:D,onManageFollowedChannels:U,onManageApplication:B,onManageLobbiesLinked:H}=e,z=(0,tm.Ay)(),[V,K]=s.useState(""),{isFetchingConnections:F,accounts:Y}=(0,o.cf)([tK.A],()=>({isFetchingConnections:tK.A.isFetching(),accounts:tK.A.getAccounts()}),[]),{canManageWebhooks:q,canManageGuild:Z}=(0,o.cf)([b.A],()=>({canManageWebhooks:null!=T&&b.A.can(eD.xBc.MANAGE_WEBHOOKS,T)||null!=O&&b.A.can(eD.xBc.MANAGE_WEBHOOKS,O),canManageGuild:null!=T&&null==O&&b.A.can(eD.xBc.MANAGE_GUILD,T)}),[T,O]),Q=(0,tV.e)(O),J=(0,tb.h)(O?.linkedLobby?.application_id),$=(0,tN.A)(T?.id),{availableTwitchIntegrations:ee,availableYoutubeIntegrations:et,guildTwitchIntegrations:en,guildYoutubeIntegrations:ei}=s.useMemo(()=>({availableTwitchIntegrations:w.twitch?.length??0,availableYoutubeIntegrations:w.youtube?.length??0,guildTwitchIntegrations:w.twitch?.filter(e=>e.enabled).length??0,guildYoutubeIntegrations:w.youtube?.filter(e=>e.enabled).length??0}),[w.twitch,w.youtube]),{showTwitchCard:el,showYoutubeCard:es}=s.useMemo(()=>{if(F||!Z)return{showTwitchCard:!1,showYoutubeCard:!1};let e=T?.features.has(eD.GuildFeatures.COMMUNITY),t=Y.filter(e=>e.type===eD.fg2.TWITCH).length>0,n=Y.filter(e=>e.type===eD.fg2.YOUTUBE).length>0;return{showTwitchCard:ee>0||!t&&e,showYoutubeCard:et>0||!n&&e}},[F,Z,T,Y,ee,et]),ea=Object.values(L).length,er=s.useMemo(()=>{let e=ea>100?tJ:tW();return Object.values(L).filter(t=>{var n;let{application:i}=t;return!!(""===(n=(n=V).trim().toLowerCase())||i.id===n||e(n,i.name.toLowerCase())||null!=i.bot&&e(n,i.bot.username.toLowerCase()))})},[L,ea,V]),eo=(0,o.bG)([tF.A],()=>{if(null!=T)return er.find(e=>tF.A.canShowOverviewTooltip(T.id,e.integration.id))},[er,T]),em=s.useMemo(()=>void 0!==eo?[eo,...er.filter(e=>e.integration.id!==eo.integration.id)]:er,[er,eo]),eg=(0,C.useModalsStore)(C.hasAnyModalOpenSelector),[eh,ex]=s.useState(!1),eA=s.useRef(0),ep=()=>{ex(!0),clearTimeout(eA.current),eA.current=setTimeout(()=>{ex(!1)},200)};s.useEffect(()=>(window.addEventListener("scroll",ep,!0),()=>window.removeEventListener("scroll",ep)));let eb=em.map(e=>{let t=!eg&&e.integration.id===eo?.integration.id;return function(e,t,n,i,s){let{application:a,integration:r}=t,o=[];return null!=r.user?o.push({icon:v.O,text:X.intl.formatToPlainString(X.t.Nu9sat,{timestamp:ed.default.extractTimestamp(r.id),user:eu.Ay.getUserTag(r.user)})}):o.push({icon:v.O,text:X.intl.formatToPlainString(X.t.gcdJ8J,{timestamp:ed.default.extractTimestamp(r.id)})}),(0,l.jsx)(tL,{name:a.name,imageSrc:ec.Ay.getApplicationIconURL({id:a.id,icon:a.icon,size:48}),integration:t,buttonText:X.intl.string(X.t["Z/qRnM"]),hasNextSection:!0,onButtonClick:()=>{n(a.id),ty.default.track(eD.HAw.APP_MANAGE_CTA_CLICKED,{application_id:a.id,guild_id:e?.id,is_admin:null!=e?b.A.can(eD.xBc.ADMINISTRATOR,e):void 0})},details:o,guildId:e?.id,isScrolling:i,canShowMigrationTooltip:s},`integration-${r.id}`)}(T,e,B,eh,t)}),ef=(0,l.jsx)("div",{className:tq.Hw});if(0===eb.length&&Z){let e,n,i;t=T?.id,e=(0,tu.M)(z)?tZ:tQ,n=(0,l.jsxs)(h.A,{direction:h.A.Direction.VERTICAL,align:h.A.Align.CENTER,className:tq.Kl,children:[(0,l.jsx)("img",{alt:"",src:e,className:tq.s1}),(0,l.jsx)(I.Z,{editable:!0,className:tq.$N,children:(0,l.jsx)(S.E,{color:"text-muted",variant:"text-sm/normal",children:X.intl.string(X.t.EVWFNr)})})]}),i=(0,l.jsx)(I.Z,{editable:!0,className:tq.$N,children:(0,l.jsxs)("div",{className:tq.q6,children:[(0,l.jsx)("img",{alt:"",src:"/assets/48b60325911c81e0.svg",className:tq.QT}),(0,l.jsx)(c.D,{color:"text-default",variant:"heading-xl/bold",children:X.intl.string(X.t.nQQeFM)}),(0,l.jsx)(S.E,{color:"text-default",variant:"text-sm/normal",children:X.intl.format(X.t.snvKU3,{handleGoToAppDirectory:()=>{(0,tH.transitionToGlobalDiscovery)({tab:tY.GlobalDiscoveryTab.APPS,newSessionState:{entrypoint:{name:tz.sW.GUILD_INTEGRATION_SETTINGS},guildId:t}}),(0,tB.jH)()}})})]})}),eb=ea>0?n:i,ef=null}let ej=j.A.getArticleURL(eD.MVz.INTEGRATIONS),eN=null!=O?X.t.YV0vh6:X.t.FnZEJs,eE=[];if(q){let e,t,s,a,r;eE.push((n=R.length,n>0?t=(0,l.jsx)(tG.u,{size:"xs"}):e=X.intl.string(X.t.lOQqJK),(0,l.jsx)(tL,{name:X.intl.string(X.t.xOg4SP),icon:k.X,buttonText:e,buttonDisabled:!W,trailing:t,onButtonClick:D,hasNextSection:n>0,details:[{text:X.intl.formatToPlainString(X.t["6HqDfT"],{count:n})}]},"webhooks"))),O?.type===eD.rbe.GUILD_VOICE||O?.type!=null&&eD.kvI.GUILD_THREADS_ONLY.has(O.type)||eE.push((i=M.length,i>0?(r=(0,l.jsx)(tG.u,{size:"xs"}),a=U):(s=X.intl.string(X.t["ZwSt+T"]),a=()=>open(j.A.getArticleURL(eD.MVz.CHANNEL_FOLLOWING))),(0,l.jsx)(tL,{name:X.intl.string(X.t.OrV60r),icon:tD._,buttonText:s,onButtonClick:a,trailing:r,hasNextSection:i>0,details:[{text:X.intl.formatToPlainString(X.t.JUNGIZ,{count:i})}]},"channels-followed")))}null==O&&$.length>0&&eE.push((a=$.length,(0,l.jsx)(tL,{name:X.intl.string(X.t.tqtDXC),icon:tt.f,trailing:(0,l.jsx)(tG.u,{size:"xs"}),onButtonClick:H,hasNextSection:!0,details:[{text:X.intl.formatToPlainString(X.t["puxS4+"],{count:a})}]},"channels-syncing"))),el&&eE.push((x=e1.A.get(eD.fg2.TWITCH),ee>0?(m=(0,l.jsx)(tG.u,{size:"xs"}),d=X.intl.formatToPlainString(X.t.FFpnT8,{count:en}),u=()=>G(eD.fg2.TWITCH)):(r=X.intl.string(X.t.bkvGkn),d=X.intl.string(X.t.Qq3X2M),u=()=>(0,g.A)({platformType:eD.fg2.TWITCH,location:"Integration Settings"})),(0,l.jsx)(tL,{name:X.intl.string(X.t.q4pBG3),icon:x.icon.whiteSVG,iconBackgroundColor:x.color,iconClassName:tq.tV,buttonText:r,onButtonClick:u,trailing:m,hasNextSection:ee>0,details:[{text:d}]},"integrations-twitch"))),es&&eE.push((E=e1.A.get(eD.fg2.YOUTUBE),et>0?(N=(0,l.jsx)(tG.u,{size:"xs"}),p=X.intl.formatToPlainString(X.t.b2g5vC,{count:ei}),f=()=>G(eD.fg2.YOUTUBE)):(A=X.intl.string(X.t.xEyQ3X),p=X.intl.string(X.t.T0ivgQ),f=()=>(0,g.A)({platformType:eD.fg2.YOUTUBE,location:"Integration Settings"})),(0,l.jsx)(tL,{name:X.intl.string(X.t.aS6cK4),icon:E.icon.whiteSVG,iconBackgroundColor:E.color,iconClassName:tq.tV,buttonText:A,onButtonClick:f,trailing:N,hasNextSection:et>0,details:[{text:p}]},"integrations-youtube")));let eC=null!=O&&Q&&null!=J;return(0,l.jsxs)("div",{className:P()(null!=ef?tq.bg:null),children:[(0,l.jsx)(S.E,{variant:"text-sm/normal",children:X.intl.format(eN,{helpdeskArticle:ej})}),(0,l.jsx)(y.c,{className:tq.yF}),_||F||null==T?(0,l.jsx)(tU.y,{className:tq.__invalid_spinner,type:tU.y.Type.SPINNING_CIRCLE}):(0,l.jsxs)(l.Fragment,{children:[eE,eC&&(0,l.jsxs)(l.Fragment,{children:[eE.length>0?(0,l.jsx)(y.c,{className:tq.yF}):null,(0,l.jsx)(c.D,{variant:"heading-md/semibold",className:tq.bV,children:X.intl.string(X.t.oAvIAg)}),(0,l.jsx)(tw,{channel:O,application:J,showApplicationImage:!0,name:J.name,hasNextSection:!0,iconClassName:tq.d0,trailing:(0,l.jsx)(tp.R,{size:"xs"})})]}),Z?(0,l.jsxs)(l.Fragment,{children:[eE.length>0||eC?(0,l.jsx)(y.c,{className:tq.yF}):null,(0,l.jsx)(c.D,{variant:"heading-md/semibold",className:tq.bV,children:X.intl.string(X.t.pUBKht)}),ea>4?(0,l.jsx)(tX,{query:V,setQuery:K}):null,eb]}):null,ef]})]})}var t0=n(964486),t2=n(174900);function t3(e){let t,n,{guild:i,channel:a,customWebhooks:r,editedWebhook:o,selectableWebhookChannels:d,refToScroller:u,errors:m,canNavigate:g}=e,x=(0,tm.Ay)(),[A,p]=s.useState(null);if(null!=a)n=a;else{let e=Object.values(d);n=e.length>0?e[0]:null}let b=s.useCallback(async()=>{if(g()&&null!==n){let e=await eW.A.create(i.id,n.id).catch(e=>{let{body:t,status:n}=e;return t&&t.code===eD.t02.TOO_MANY_WEBHOOKS?w.A.show({title:X.intl.string(X.t.cCqsca),body:X.intl.string(X.t["w+QZoX"])}):429===n?w.A.show({title:X.intl.string(X.t.cCqsca),body:X.intl.string(X.t["YBM+UW"])}):w.A.show({title:X.intl.string(X.t.cCqsca),body:X.intl.string(X.t["/4TwKf"])}),null});null!=e&&p(e)}},[g,n,i]);(0,t0.Ay)(()=>{0===r.length&&b()});let f=null!==n;return(0,l.jsxs)("div",{children:[(0,l.jsx)(S.E,{variant:"text-sm/normal",children:X.intl.format(X.t.WL0d0e,{helpdeskArticle:j.A.getArticleURL(eD.MVz.WEBHOOKS),developersArticle:eD.X7G.API_DOCS_WEBHOOKS})}),(0,l.jsx)(y.c,{className:t2.zN}),r.length>0?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("div",{"data-button-hoisted-classname-wrapper":!0,className:t2.Tf,children:(0,l.jsx)(L.$,{variant:"primary",size:"sm",text:X.intl.string(X.t["nrO/HH"]),disabled:!f,onClick:b})}),(0,l.jsx)(e$,{webhooks:r,editedWebhook:o,selectableWebhookChannels:d,lastCreatedWebhookId:A?.id,errors:m,canNavigate:g})]}):(t=(0,tu.M)(x)?th:tx,(0,l.jsxs)(h.A,{direction:h.A.Direction.VERTICAL,align:h.A.Align.CENTER,children:[(0,l.jsx)("img",{alt:"",src:t,className:t2.QT}),(0,l.jsx)(c.D,{variant:"heading-md/semibold",children:X.intl.string(X.t.LzmsWl)}),(0,l.jsx)("div",{"data-button-hoisted-classname-wrapper":!0,className:t2.nM,children:(0,l.jsx)(L.$,{variant:"primary",text:X.intl.string(X.t.lOQqJK),disabled:!f,onClick:b})})]}))]})}var t1=n(458203);function t7(e,t){switch(e){case eD.wLn.APPLICATION:return t?.application.name??"";case eD.wLn.OVERVIEW:return X.intl.string(X.t.s69NLF);case eD.wLn.CHANNEL_FOLLOWING:return X.intl.string(X.t.OrV60r);case eD.wLn.TWITCH:return X.intl.string(X.t.q4pBG3);case eD.wLn.WEBHOOKS:return X.intl.string(X.t.xOg4SP);case eD.wLn.YOUTUBE:return X.intl.string(X.t.aS6cK4);case eD.wLn.LOBBIES_LINKED:return X.intl.string(X.t.tqtDXC);default:return""}}let t8=s.memo(function(e){let{section:t,sectionId:n,guild:i,channel:a,integrations:N,editedIntegration:E,webhooks:C,editedWebhook:v,isFetchingWebhooks:T,refToScroller:I,errors:S,hasChanges:y}=e,O=(0,o.bG)([p.Ay],()=>null!=i?p.Ay.getDefaultChannel(i.id):null),k=(0,o.cf)([p.Ay],()=>p.Ay.getChannels(i?.id)),L=(0,o.cf)([b.A],()=>r().keyBy(k.SELECTABLE.map(e=>e.channel).filter(e=>b.A.can(eD.xBc.MANAGE_WEBHOOKS,e)),"id")),w=(0,o.cf)([b.A],()=>r().keyBy(k.VOCAL.map(e=>e.channel).filter(e=>e.isGuildVocal()&&b.A.can(eD.xBc.MANAGE_WEBHOOKS,e)),"id")),R=a??O,M=t===eD.wLn.APPLICATION?n:null,[_,P]=s.useState(m.n3),W=s.useCallback(()=>y()?(f._.dispatch(eD.jej.SHAKE_APP,{duration:300,intensity:_}),P(Math.min(_+m.pe,m.OZ)),f._.dispatch(eD.jej.EMPHASIZE_NOTICE),!1):(P(m.n3),!0),[y,_]),G=s.useCallback(e=>!!W()&&(u.A.setSection(e),!0),[W]),{applicationIntegrations:D,applicationBotIds:U,builtInIntegrations:B,customWebhooks:H,followedChannelWebhooks:z}=s.useMemo(()=>{let e={},t={},n={},i=[],l=[];if(null!=N)for(let i of N)"discord"===i.type?null!=i.application&&(e[i.application.id]={application:i.application,integration:i,webhooks:[]},i.application.bot?.id!==void 0&&(t[i.application.bot.id]=i.application.id)):(i.type in n||(n[i.type]=[]),n[i.type].push(i));for(let t of C)(t.channel_id in L||t.channel_id in w)&&(null!=t.application_id&&t.application_id in e?e[t.application_id].webhooks.push(t):t.type===eD.NH1.CHANNEL_FOLLOWER?l.push(t):i.push(t));return{applicationIntegrations:e,applicationBotIds:t,builtInIntegrations:n,customWebhooks:i,followedChannelWebhooks:l}},[N,L,w,C]);s.useEffect(()=>{if(!T)switch(t){case eD.wLn.TWITCH:null==B[eD.fg2.TWITCH]&&u.A.setSection(eD.wLn.OVERVIEW);break;case eD.wLn.YOUTUBE:null==B[eD.fg2.YOUTUBE]&&u.A.setSection(eD.wLn.OVERVIEW);break;case eD.wLn.APPLICATION:null!=M&&(M in U||M in D)||u.A.setSection(eD.wLn.OVERVIEW)}},[D,U,B,M,t,T]),s.useEffect(()=>{i?.id==null||A.A.getEntitlementsForGuildFetchState(i.id)===A.e.NOT_FETCHED&&x.f5(i.id)},[i?.id]),s.useEffect(()=>()=>{u.A.setSection(eD.wLn.OVERVIEW,null)},[]);let V=null;switch(t){case eD.wLn.TWITCH:null!=B[eD.fg2.TWITCH]&&(V=(0,l.jsx)(td,{guild:i,integrations:B[eD.fg2.TWITCH],editedIntegration:E,labelText:X.intl.string(X.t.q4pBG3),platformType:eD.fg2.TWITCH,descriptionText:X.intl.string(X.t.V9kNqt),helpText:X.intl.format(X.t.ro1jEN,{connectAction:()=>(0,g.A)({platformType:eD.fg2.TWITCH,location:"Integration Settings"}),helpdeskArticle:j.A.getArticleURL(eD.MVz.TWITCH_INTEGRATION)}),errors:S,canNavigate:W}));break;case eD.wLn.YOUTUBE:null!=B[eD.fg2.YOUTUBE]&&(V=(0,l.jsx)(td,{guild:i,integrations:B[eD.fg2.YOUTUBE],editedIntegration:E,labelText:X.intl.string(X.t.aS6cK4),platformType:eD.fg2.YOUTUBE,descriptionText:X.intl.string(X.t["7Tv7JK"]),helpText:X.intl.format(X.t["4OSAQ9"],{connectAction:()=>(0,g.A)({platformType:eD.fg2.YOUTUBE}),helpdeskArticle:j.A.getArticleURL(eD.MVz.YOUTUBE_INTEGRATION)}),errors:S,canNavigate:W}));break;case eD.wLn.APPLICATION:let K=null!=M?D[U[M]]??D[M]:null;null!=K&&(V=(0,l.jsx)(e3,{guild:i,applicationIntegration:K,editedWebhook:v,selectableWebhookChannels:L,errors:S,canNavigate:W}));break;case eD.wLn.CHANNEL_FOLLOWING:V=(0,l.jsx)(tA,{followedChannelWebhooks:z,editedWebhook:v,selectableWebhookChannels:L,canNavigate:W,errors:S});break;case eD.wLn.WEBHOOKS:V=(0,l.jsx)(t3,{guild:i,channel:a,customWebhooks:H,editedWebhook:v,selectableWebhookChannels:{...L,...w},canNavigate:W,refToScroller:I,errors:S});break;case eD.wLn.LOBBIES_LINKED:V=(0,l.jsx)(t_,{guild:i});break;default:V=(0,l.jsx)(t$,{guild:i,channel:a,applicationIntegrations:D,builtInIntegrations:B,customWebhooks:H,followedChannelWebhooks:z,isLoadingWebhooks:T||null==i,canCreateWebhook:null!=R,onManageCustomWebhooks:()=>{u.A.setSection(eD.wLn.WEBHOOKS)},onManageFollowedChannels:()=>{u.A.setSection(eD.wLn.CHANNEL_FOLLOWING)},onManageApplication:e=>{u.A.setSection(eD.wLn.APPLICATION,e)},onManageBuiltIn:e=>{switch(e){case eD.fg2.TWITCH:u.A.setSection(eD.wLn.TWITCH);break;case eD.fg2.YOUTUBE:u.A.setSection(eD.wLn.YOUTUBE)}},onManageLobbiesLinked:()=>{u.A.setSection(eD.wLn.LOBBIES_LINKED)}})}return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(h.A,{align:h.A.Align.CENTER,className:t1.jD,children:t===eD.wLn.OVERVIEW?(0,l.jsx)(c.D,{variant:"heading-lg/semibold",children:t7(eD.wLn.OVERVIEW)}):(0,l.jsx)(d.A,{activeId:t.toString(),breadcrumbs:[eD.wLn.OVERVIEW,t].map(e=>({id:e.toString(),label:t7(e,D[M])})),onBreadcrumbClick:e=>{t!==parseInt(e.id)&&G(parseInt(e.id))},renderCustomBreadcrumb:(e,t)=>(0,l.jsx)(c.D,{variant:"heading-lg/semibold",className:t?t1.q3:t1.fd,children:e.label})})}),V]})})}