Loading
function(e,t,n){"use strict";n.d(t,{HG:()=>ne,Sk:()=>nr,C:()=>t9,v7:()=>nl,Zx:()=>t5,L0:()=>ni,N_:()=>nt,MD:()=>na,Ay:()=>nu,uW:()=>no,NO:()=>t8,ck:()=>ns,ml:()=>nn,Vu:()=>t7});var l=n(627968),i=n(64700),s=n(503698),r=n.n(s),a=n(143236),o=n(284009),u=n.n(o),c=n(942381),d=n(607399),m=n(136722),h=n(17928),p=n(192308),f=n(187322),g=n(511274),E=n(465532),A=n(765671),C=n(775602),x=n(793574),I=n(688810),_=n(177640),S=n(989837),y=n(289873),v=n(268218),T=n(750506),N=n(60809),j=n(375708),b=n(131552);let R={width:500,height:N.$V},P=(0,v.Fe)({createPromise:()=>Promise.all([n.e("99796"),n.e("61312"),n.e("89982"),n.e("76900"),n.e("88429"),n.e("42430"),n.e("38450"),n.e("94539"),n.e("10720"),n.e("38916"),n.e("93103"),n.e("34552"),n.e("71210"),n.e("88342"),n.e("71273"),n.e("89421"),n.e("37977"),n.e("98965"),n.e("43780"),n.e("80854"),n.e("35395"),n.e("35313"),n.e("8362"),n.e("52229"),n.e("61268"),n.e("18024"),n.e("22261"),n.e("78195"),n.e("41701"),n.e("74021"),n.e("83518"),n.e("37065"),n.e("22094"),n.e("61764"),n.e("59848"),n.e("68974"),n.e("56385"),n.e("59132"),n.e("89203"),n.e("35621")]).then(n.bind(n,854379)),webpackId:854379,renderLoader:()=>(0,l.jsx)("div",{className:b.R4,style:R,children:(0,l.jsx)(y.y,{})})}),L={height:N.$V},M=i.memo(function(e){let{positionTargetRef:t,align:n,...i}=e;return(0,l.jsx)("span",{style:N.sK,children:(0,l.jsx)(T.nE,{className:b.T8,targetRef:t,position:"top",align:n??"right",spacing:24,autoInvert:!0,nudgeAlignIntoViewport:!0,clickTrap:!0,children:e=>{let{isPositioned:t}=e;return(0,l.jsx)("section",{className:b.V6,role:"dialog",style:L,"aria-label":j.intl.string(j.t["3CNGLK"]),children:t&&(0,l.jsx)(P,{...i})})}})})});var O=n(861382),w=n(735438),k=n.n(w),D=n(537652),U=n(155718),G=n(95561),F=n(659280),V=n(579940),B=n(962125),H=n(915089),W=n(850992),K=n(464651),Y=n(286509),z=n(721768),Z=n(842209),q=n(210978),$=n(392054),J=n(168186),X=n(990078),Q=n(939249),ee=n(802019),et=n(664929),en=n(282214);let el=[16,8,8,8];function ei(e){let{className:t,channel:n,sections:s,activeCategoryIndex:a,filteredSectionId:o,onSectionClick:u,applicationCommandListRef:c}=e,d=i.useRef(null),m=i.useCallback((e,t)=>{let n=8;return s[t+1]?.type===$.Hf.BUILT_IN&&(n+=8),32+n},[s]),h=i.useCallback((e,t)=>t?8*(s[e+1]?.type!==$.Hf.BUILT_IN):8*(0!==e),[s]),p=i.useCallback((e,t)=>{let i=s[t];if(null==i)return;let r=(0,et.Rg)(i),c=4*(i.type===$.Hf.BUILT_IN),d=32-2*c,m=(0,l.jsx)(r,{channel:n,section:i,isSelected:null!=o?i.id===o:a===t,padding:c,width:d,height:d,selectable:!0}),h=i.type!==$.Hf.BUILT_IN&&t<s.length-1&&s[t+1].type===$.Hf.BUILT_IN;return(0,l.jsxs)("div",{className:en.uW,children:[(0,l.jsx)(X.m,{text:i.name,position:"right",asContainer:!0,children:(0,l.jsx)(Q.D,{"aria-label":i.name,onClick:()=>{u(i)},children:m})}),h?(0,l.jsx)("hr",{className:en.zQ}):null]},i.id)},[a,n,u,s,o]);return 0===s.length?null:(0,l.jsx)("div",{className:r()(t,en.iE),children:(0,l.jsx)(ee.A,{categoryListRef:d,expressionsListRef:c,store:W.LS,categories:s,className:en.p_,renderCategoryListItem:p,rowCount:s.length,categoryHeight:m,listPadding:el,getScrollOffsetForIndex:h})})}var es=n(746388),er=n(73510),ea=n(652215),eo=n(13297),eu=n(911385);let ec=[8,8,0,8],ed=k().debounce(()=>{(0,G.zV)(ea.HAw.APPLICATION_COMMAND_BROWSER_SCROLLED)},300),em=i.forwardRef(function(e,t){let{channel:n,canOnlyUseTextCommands:s}=e,a=i.useRef(!1),o=i.useRef(0),[u,c]=i.useState(0),d=i.useRef(null),[m,h]=i.useState(!1),p=W.LS.useStore(e=>e.activeCategoryIndex);i.useEffect(()=>{(0,G.zV)(ea.HAw.APPLICATION_COMMAND_BROWSER_OPENED)},[]);let{sectionDescriptors:f,activeSections:g,commandsByActiveSection:E,hasMoreAfter:A,commands:C,filteredSectionId:x,scrollDown:I,filterSection:_}=Z.cu({context:{channel:n,type:"channel"},filters:{commandTypes:[U.kc.CHAT],builtIns:s?q.n.ONLY_TEXT:q.n.ALLOW,applicationCommands:!s},options:{placeholderCount:7,limit:er.Hi,includeFrecency:!0},allowFetch:!0}),S=(0,K.Fk)({activeCategoryIndex:p,isScrolling:a,listRef:d,onActiveCategoryIndexChange:e=>{let t=g[e];if(null!=t){let e=f.findIndex(e=>e.id===t.id);W.LS.setActiveCategoryIndex(e)}},scrollOffset:20,searchQuery:""}),y=e=>{let t=g.length,n=E.reduce((e,t)=>e+t.data.length,0)-7*!!A;A&&e+420>48*t+56*n-512&&I(),S(e),ed(),o.current=e},v=i.useRef(y);i.useEffect(()=>{v.current=y}),i.useEffect(()=>{v.current(o.current)},[C]);let T=i.useCallback(e=>e!==g.length-1||A?16:0,[g.length,A]),N=E.map(e=>e.data.length);i.useEffect(()=>{null!=d.current&&m&&null!=u&&d.current.scrollRowIntoView(u)},[m,u]),i.useLayoutEffect(()=>{null!=x&&d.current?.scrollToSectionTop(0)},[C,x]);let b=i.useCallback(e=>{e.id===x||e.id===er.Ik.FRECENCY?(_(null),d.current?.scrollToSectionTop(0)):_(e.id)},[_,x]),R=i.useCallback((e,t,l)=>{z.Gf({channelId:n.id,command:e,section:t,location:$.Oh.DISCOVERY,triggerSection:l})},[n.id]);i.useImperativeHandle(t,()=>({onTabOrEnter:e=>{if(null==u)return!e&&(c(0),!0);if(null==u)return!1;let t=0,n=0;for(let e of E)if(t=n,u<(n+=e.data.length)){let n=e.data[u-t],l=f.find(e=>e.id===n.applicationId);R(n,l,(0,J.$S)(e.section));break}return!0},onMoveSelection:e=>{if(0===C.length)return!0;let t=7*!!A,n=C.length+t,l=null==u?0:u+e;return l>=n?l=n-1:l<0&&(l=0),c(l),h(!0),!0}}),[C.length,E,A,f,R,u]);let P=i.useCallback(e=>{let t=g[e];if(null==t)return null;let i=(0,et.Rg)(t),s=(0,l.jsx)(i,{channel:n,section:t,width:16,height:16,padding:0});return(0,l.jsx)(Y.A,{className:eo.Km,icon:s,children:t.name},e)},[n,g]),L=i.useCallback((e,t)=>{let n=e===g.length-1,i=g[e],{data:s}=E[e];return(0,l.jsxs)("ul",{role:"group","aria-label":i.name,className:r()(eo.Wy,{[eo.YD]:n}),children:[t,0===s.length&&(0,l.jsx)(D.A,{message:j.intl.format(j.t.WoQXT6,{applicationName:i.name}),noResultsImageURL:eu,className:eo.qK})]},e)},[g,E]),M=i.useCallback((e,t)=>{let i=E[t.sectionIndex],s=i.data[t.sectionRowIndex],r=`${i.section.id}:${s?.id??e}`;if(null==s||i.section.id!==s.applicationId&&i.section.id!==er.Ik.FRECENCY||s.inputType===$.y$.PLACEHOLDER)return(0,l.jsx)(es.A,{},r);let a=f.find(e=>e.id===s.applicationId);return(0,l.jsx)(F.Ay.NewCommand,{index:e,command:s,channel:n,className:eo.D5,selected:u===e,showImage:i.section.id!==s.applicationId,section:a,onClick:()=>R(s,a,(0,J.$S)(i.section)),onHover:()=>{c(null),h(!1)}},r)},[n,E,R,f,u]),O=(0,H.GV)();return(0,V.gf)(O,!0,(0,F.aI)(u)),i.useEffect(()=>()=>{(0,V.nQ)()},[]),(0,l.jsxs)(F.Ay,{id:O,className:eo.x9,innerClassName:eo.iE,onMouseDown:eh,children:[(0,l.jsx)(ei,{className:eo.H$,channel:n,sections:f,filteredSectionId:x,activeCategoryIndex:p,onSectionClick:b,applicationCommandListRef:d}),(0,l.jsx)(B.A,{role:"listbox",className:eo.p_,listPadding:ec,onScroll:y,renderRow:M,renderSection:L,renderSectionHeader:P,rowCount:g.length,rowCountBySection:N,rowHeight:56,sectionHeaderHeight:32,sectionMarginBottom:T,ref:d,stickyHeaders:!0})]})});function eh(e){e.preventDefault()}var ep=n(702841),ef=n(305070),eg=n(31498),eE=n(598071),eA=n(151271),eC=n(731231),ex=n(256265),eI=n(703244),e_=n(857071),eS=n(135621),ey=n(105330),ev=n(495544),eT=n(559908),eN=n(620141),ej=n(224964),eb=n(31408),eR=n(536283);function eP(e){let{editorHeight:t,textValue:n,channelId:l}=e,s=i.useRef(n),r=(0,ey.l)({editorHeight:t}),a=(0,ej.A)(),o=(0,h.bG)([eT.Ay,ev.default],()=>eT.Ay.isComboing(ev.default.getId(),l)),u=r?.left??0,c=(r?.top??0)-16,d=0===n.length,m=i.useMemo(()=>.05>Math.random(),[d]);return i.useEffect(()=>{0!==n.length&&n!==s.current&&o&&(a.fire(u,c,m?{sprite:eR.dR}:null),s.current=n)},[n,o,u,c,m,a]),null}function eL(e){return(0,l.jsx)(eN.A,{confettiLocation:eb.k.CHAT_INPUT,children:(0,l.jsx)(eP,{...e})})}var eM=n(931664),eO=n(631576),ew=n(68935),ek=n(406704),eD=n(885386),eU=n(951260),eG=n(696451),eF=n(576705),eV=n(309010),eB=n(638128),eH=n(522602),eW=n(287809),eK=n(821102),eY=n(174459),ez=n(234320),eZ=n(625494),eq=n(488926),e$=n(723702),eJ=n(486319),eX=n(355622),eQ=n(392553),e0=n(834730),e1=n(140735),e2=n(176781),e3=n(463930),e4=n(935063),e6=n(73392),e5=n(650019),e7=n(763754),e8=n(967144),e9=n(118517),te=n(976860),tt=n(747926),tn=n(232835),tl=n(285796),ti=n(630816);function ts(e){let{onClick:t,"aria-label":n}=e;return(0,l.jsx)(Q.D,{className:ti.b,onClick:t,"aria-label":n,children:(0,l.jsx)(tl.a,{size:"md",color:"currentColor",className:ti.u})})}var tr=n(1468);let ta="channel-reply-bar-a11y-description";function to(e){let{channel:t,message:n,replyChainLength:s}=e,r=i.useRef(s);return i.useEffect(()=>{r.current=s}),i.useEffect(()=>{(0,G.zV)(ea.HAw.THREAD_NUDGE_SHOWN,{type:"Reply Chain (3)",reply_chain_length:r.current+1,channel_id:t.id,guild_id:t.guild_id})},[t]),(0,l.jsxs)(Q.D,{onClick:function(){(0,e9.Jx)(t.id),(0,tt.Tv)(t,n,"Reply Chain Nudge")},className:tr._r,focusProps:{offset:{right:-4,left:-4}},children:[(0,l.jsx)(e0.E,{color:"text-default",className:tr.Qq,variant:"text-sm/normal",children:j.intl.format(j.t.B3V0FM,{count:Math.min(10,s+1)})}),(0,l.jsx)(e0.E,{color:"text-link",className:tr.NG,variant:"text-sm/semibold",children:j.intl.string(j.t.rBIGBL)})]})}function tu(e){let t,n,{reply:s,chatInputType:a}=e,{channel:o,message:u,shouldMention:c,showMentionToggle:d,mediaMention:m}=s,{guildId:p,nick:f,colorString:g,colorStrings:E,colorRoleName:A,authorId:C,displayNameStyles:x}=(0,e7.Ay)(u),I=(0,e8.gn)(p,C,E),_=(0,e6.a)({displayNameStyles:x}),S=(0,e5.A)(m,u.attachments),y=(t=o.id,n=u.id,(0,h.bG)([tn.A],()=>{let e=n;for(let n=0;n<10;n++){let l=tn.A.getMessage(t,e);if(l?.type!==ea.lAJ.REPLY||null==l.messageReference)return n;e=l.messageReference.message_id}return 10},[t,n])),v=(0,ek.n)(o,u),T=a.showThreadPromptOnReply&&y>=2&&v;return(0,l.jsx)("div",{className:tr.e1,children:(0,l.jsxs)("div",{className:tr.kL,children:[(0,l.jsxs)("div",{className:tr.eU,children:[(0,l.jsx)(e1.A,{id:ta,children:j.intl.formatToPlainString(j.t.EpJL4E,{username:f})}),(0,l.jsx)(Q.D,{onClick:function(){return(0,te.pX)(ea.BVt.CHANNEL(o.getGuildId(),o.id,u.id))},focusProps:{offset:{top:-8,right:-4,bottom:-8,left:-4}},children:(0,l.jsx)(e0.E,{color:"text-default",className:r()(tr.Qq,tr.Fn),variant:"text-sm/normal",children:j.intl.format(j.t["8E4GxS"],{userHook:(e,t)=>(0,l.jsxs)(i.Fragment,{children:["\xa0",S?.title!=null?(0,l.jsxs)("span",{className:tr.H8,children:[S.isClip&&(0,l.jsx)(e2.x,{size:"xs",color:"currentColor",className:tr.gS}),(0,l.jsx)(e0.E,{variant:"text-sm/semibold",color:"text-default",className:tr.NV,children:S.title}),(0,l.jsxs)(e0.E,{variant:"text-sm/normal",color:"text-link",children:["@",S.timestamp]})]}):(0,l.jsx)(e3.g,{className:tr.UU,name:f,colorString:g,colorStrings:I,roleName:A,displayNameStylesFont:_})]},t)})})}),(0,l.jsxs)("div",{className:tr.o1,children:[d&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(X.m,{asContainer:!0,text:c?j.intl.string(j.t.DH2o6R):j.intl.string(j.t.utGGIY),children:(0,l.jsx)(Q.D,{role:"switch","aria-checked":c,onClick:function(e){e.stopPropagation(),(0,e9.vz)(o.id,!c)},children:(0,l.jsxs)(e0.E,{variant:"text-sm/bold",color:c?"text-link":"text-muted",className:tr.Z4,children:[(0,l.jsx)(e4.X,{size:"md",color:"currentColor","aria-label":j.intl.string(j.t.P8tvKG),className:tr.mM}),c?j.intl.string(j.t.p9jC2r):j.intl.string(j.t.U7f3bK)]})})}),(0,l.jsx)("div",{className:tr.me,"aria-hidden":!0})]}),(0,l.jsx)(ts,{onClick:function(e){e.stopPropagation(),(0,e9.Jx)(o.id)},"aria-label":j.intl.string(j.t.jSnJGT)})]})]}),T&&(0,l.jsx)(to,{channel:o,message:u,replyChainLength:y})]})})}var tc=n(749314),td=n(148355),tm=n(74995);let th=i.memo(function(e){let{channelId:t,chatInputType:n}=e,[s,r]=i.useState(null),a=(0,h.bG)([eM.A],()=>eM.A.getStickerPreview(t,n.drafts.type));return n.stickers?.allowSending&&null!=a&&0!==a.length?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("div",{className:tm.Tz,children:a.map(e=>(0,l.jsxs)("div",{className:tm.dp,children:[(0,l.jsx)(Q.D,{onFocus:()=>r(e.id),onBlur:()=>r(null),className:tm.b,"aria-label":j.intl.formatToPlainString(j.t.BGAQRd,{name:e.name}),onClick:()=>(0,eO.x5)(t,n.drafts.type),children:(0,l.jsx)("div",{className:tm.Nk,children:(0,l.jsx)(tl.a,{size:"md",color:"currentColor",className:tm.ut})})}),(0,l.jsx)(td.A,{isInteracting:s===e.id,className:tm.UV,size:48,sticker:e})]},e.id))}),(0,l.jsx)(tc.A,{className:tm.R})]}):null});var tp=n(612394);n(321073);var tf=n(442433);n(827669);var tg=n(448702);function tE(e){let t,s,a,{className:o,activeCommand:u,activeOption:c,optionStates:d,channelId:m}=e,h=i.useCallback(e=>{let t=u?.rootCommand?.id;null==t?e.preventDefault():(0,tf.L3)(e,async()=>{let{default:e}=await n.e("15687").then(n.bind(n,646938));return n=>(0,l.jsx)(e,{...n,id:t,label:j.intl.string(j.t.oJ1Muw)})})},[u?.rootCommand?.id]),p=i.useCallback(()=>{z.Gf({channelId:m,command:null,section:null})},[m]);if(null==u)return null;if(null!=c){let e=d[c.name].lastValidationResult;t=c.displayName,s=c.displayDescription,a=e?.success?null:e?.error}else t=`/${u.displayName}`,s=u.displayDescription,a=null;return(0,l.jsxs)("div",{className:r()(o,tg.M0),onContextMenu:h,children:[(0,l.jsxs)("div",{className:tg.iz,children:[(0,l.jsx)("span",{className:tg.UU,children:t}),null!=a?(0,l.jsx)("span",{className:tg.z3,children:a}):(0,l.jsx)("span",{className:tg.h_,children:s})]}),(0,l.jsx)("div",{className:tg.o1,children:(0,l.jsx)(ts,{onClick:p,"aria-label":j.intl.string(j.t.cpT0Cq)})})]})}var tA=n(228366),tC=n(734057);let tx=new Set;class tI extends h.Ay.PersistedStore{static displayName="PTOStore";static persistKey="PTOStore";initialize(e){this.waitFor(tC.A,eG.Ay,eV.A,eW.default),null!=e&&(tx=new Set(e))}hasId(e){return tx.has(e)}getState(){return[...tx]}}let t_=new tI(tA.h,{});function tS(){let e=eV.A.getChannelId();if(null==e)return;let t=tC.A.getChannel(e);null!=t&&t.isPrivate()&&(tx.has(t.getRecipientId())||(tx.add(t.getRecipientId()),t_.emitChange()))}function ty(){return(0,l.jsxs)("div",{className:tr.eU,children:[(0,l.jsx)(e0.E,{variant:"text-sm/medium",className:r()(tr.Qq,tr.Fn),children:j.intl.string(j.t["2UvR1E"])}),(0,l.jsx)("div",{className:tr.o1,children:(0,l.jsx)(ts,{onClick:tS,"aria-label":j.intl.string(j.t.cpT0Cq)})})]})}var tv=n(278351);function tT(e){let{error:t}=e;return(0,l.jsxs)("div",{className:tv.M,children:[(0,l.jsx)(e0.E,{variant:"text-xs/bold",color:"text-strong",children:j.intl.string(j.t["4VDCG0"])}),t?(0,l.jsx)(e0.E,{variant:"text-xs/medium",className:tv.z,children:j.intl.string(j.t.qNorwt)}):(0,l.jsx)(e0.E,{variant:"text-xs/medium",color:"text-muted",children:j.intl.string(j.t["260qZS"])})]})}var tN=n(25201),tj=n(926321),tb=n(221933);function tR(e){var t,n;let{channelId:i}=e,s=(0,tN.vR)(i);if(null==s)return null;let a=s.rolling,o=(t=a,n=s.results,t?j.intl.string(j.t["x/FIRX"]):null==n?"":j.intl.formatToPlainString(j.t.xU4pF1,{total:n.reduce((e,t)=>e+t,0)}));return(0,l.jsx)("div",{className:r()(tb.kL,{[tb.Kd]:!s.dismissing}),children:(0,l.jsxs)("div",{className:tb.Qs,children:[(0,l.jsx)(tj.j,{size:"md",className:r()({[tb.su]:a})}),(0,l.jsx)(e0.E,{color:"text-default",variant:"text-sm/normal",children:o})]})})}var tP=n(575293),tL=n(151282),tM=n(1372);function tO(e){let{pendingScheduledMessage:t}=e,{channelId:n,scheduledTimestamp:i}=t;return(0,l.jsx)("div",{className:tM.e1,children:(0,l.jsx)("div",{className:tM.kL,children:(0,l.jsxs)("div",{className:tM.g3,children:[(0,l.jsx)(e0.E,{color:"text-default",className:r()(tM.Qq,tM.a3),variant:"text-sm/normal",children:j.intl.formatToPlainString(j.t["MQcRX/"],{timestamp:new Date(i).valueOf()})}),(0,l.jsx)("div",{className:tM.o1,children:(0,l.jsx)(ts,{onClick:function(e){e.stopPropagation(),(0,tL.Ps)(n)},"aria-label":j.intl.string(j.t.cpT0Cq)})})]})})})}var tw=n(266599);function tk(e){let{bars:t}=e,n=t.stacked.map((e,t)=>(0,l.jsx)("div",{children:e},t)),s=t.floating.map((e,t)=>(0,l.jsx)(i.Fragment,{children:e},t));return 0===n.length&&0===s.length?null:(0,l.jsxs)(i.Fragment,{children:[s.length>0&&(0,l.jsx)("div",{className:tw.Vq,children:s}),n.length>0&&(0,l.jsx)("div",{className:tw.MD,children:n})]})}var tD=n(123583),tU=n(562708),tG=n(150934),tF=n(139286),tV=n(47167),tB=n(713654),tH=n(252263),tW=n(8455),tK=n(67259),tY=n(355026);function tz(e){let{thread:t,pendingScheduledMessage:n}=e,s=(0,tW.Vp)({location:"ThreadsAlsoSendToChannelArea"}),[r,a]=(0,h.yK)([tC.A,tK.A],()=>[t.isThread()?tC.A.getChannel(t.parent_id):null,tK.A.getAlsoSendToChannel(t.id)]),o=(0,tV.Ay)(r),u=i.useCallback(e=>{eY.default.track(ea.HAw.MESSAGE_ALSO_SEND_TO_CHANNEL_TOGGLED,{value:e,guild_id:t.guild_id,channel_id:t.id}),(0,tH.B)({channelId:t.id,enabled:e})},[t]);if((0,tF.A)({name:tU.ImpressionNames.MESSAGE_ALSO_SEND_TO_CHANNEL,type:tU.ImpressionTypes.VIEW},{disableTrack:null==r||!s.enabled},[r,s.enabled]),!s.enabled||null==r)return null;let c=(0,tB.gU)(r),d=j.intl.format(j.t.UqL10G,{callToActionHook:(e,t)=>(0,l.jsx)(e0.E,{variant:"text-sm/normal",color:"text-subtle",lineClamp:1,className:tY.Pf,children:j.intl.string(j.t.Pi3JW7)},t),channelName:o,channelNameHook:(e,t)=>(0,l.jsxs)(e0.E,{variant:"text-sm/normal",color:"text-subtle",lineClamp:1,className:tY.Pf,children:[null==c?null:(0,l.jsx)(c,{color:"currentColor",className:tY.Kk},t),e]},t)});return(0,l.jsx)("div",{className:tY.kL,children:(0,l.jsx)(tG.S,{checked:a,disabled:null!=n,onChange:u,label:d,labelType:"secondary"})})}function tZ(e){let{channel:t,type:n,pendingScheduledMessage:i}=e,{shouldShow:s}=function(e){let{channel:t,type:n}=e,l=(0,h.bG)([tC.A],()=>{let e=tC.A.getChannel(t.parent_id);return e?.isForumLikeChannel()??!1}),i=[eX.oU.NORMAL,eX.oU.SIDEBAR].includes(n);return{shouldShow:t.isThread()&&!l&&i}}({channel:t,type:n});return s?(0,l.jsx)(tz,{thread:t,pendingScheduledMessage:i}):null}var tq=n(822610),t$=n(625928),tJ=n(135261),tX=n(820066),tQ=n(922016),t0=n(375499),t1=n(267889),t2=n(307731),t3=n(128934);function t4(e){let{getSlateEditor:t,onInsertEmoji:n,type:s,channel:r}=e,a=t(),o=i.useRef(null);return null==a?null:(0,l.jsxs)("div",{id:"slate-toolbar",className:t3.aL,children:[(0,l.jsx)("div",{className:t3.Wy,children:(0,l.jsx)(tJ.P,{slateEditor:a,options:s.markdown,iconClassName:t3.C7,dividerClassName:t3.us})}),(0,l.jsx)(tQ.Y,{targetElementRef:o,renderPopout:function(e){let{closePopout:t}=e;return(0,l.jsx)(t1.A,{persistSearch:!0,channel:r,closePopout:t,onSelectEmoji:e=>{let{emoji:l,willClose:i}=e;n({emoji:l,willClose:i}),i&&t()},pickerIntention:s.expressionPicker?.emojiIntention??t2.EmojiIntention.COMMUNITY_CONTENT})},position:"bottom",animation:tQ.Y.Animation.NONE,align:"left",children:(e,t)=>{let{isShown:n}=t;return(0,l.jsx)(t0.A,{...e,ref:o,active:n,className:t3.Z8,tabIndex:0})}})]})}var t6=n(698279);function t5(e,t,s,r,a){let[o,u]=i.useState(!1),c=i.useCallback((i,d,m,h,f,g)=>{if(o)return;u(!0);let A=eM.A.getStickerPreview(a,t.drafts.type)?.map(e=>e.id)??[],C=eH.A.getUploads(a,t.drafts.type)??[];if(null==d&&!h&&!f&&(0,ex.xz)(C,a)){u(!1),(0,p.openModalLazy)(async()=>{let{default:e}=await Promise.all([n.e("20469"),n.e("68316"),n.e("37502"),n.e("44667"),n.e("37634"),n.e("21194"),n.e("62279"),n.e("42157"),n.e("83314"),n.e("39328"),n.e("64801"),n.e("12815"),n.e("49681"),n.e("81647"),n.e("76602"),n.e("21921"),n.e("40402"),n.e("39970"),n.e("72789"),n.e("79049"),n.e("65437"),n.e("79745"),n.e("3332"),n.e("81314"),n.e("32209"),n.e("18997"),n.e("58337"),n.e("68763"),n.e("47177"),n.e("26437"),n.e("98972"),n.e("12682"),n.e("33097"),n.e("36150"),n.e("8371"),n.e("99011"),n.e("12743"),n.e("10014"),n.e("86861"),n.e("70961"),n.e("23685"),n.e("42516"),n.e("84688")]).then(n.bind(n,538899));return t=>(0,l.jsx)(e,{...t,threadId:a,attachments:C,sendMessage:()=>c(i,void 0,void 0,void 0,!0)})});return}e({value:i,uploads:C,stickers:A,command:d,commandOptionValues:m,isGif:h,gifMetadata:g}).then(e=>{let{shouldClear:n,shouldRefocus:l}=e,i=(n&&t.submit?.clearOnSubmit)??!1,o=null!=s.current;i&&(a!==eV.A.getChannelId()?E.A.saveDraft(a,"",t.drafts.type):o&&(s.current?.clearValue(),r.current?.hide())),o&&(u(!1),(0,eA.v8)(),l&&s.current?.focus())})},[s,r,e,o,t,a]);return{submitting:o,submit:c,handleSubmit:i.useCallback(e=>{s?.current?.submit(e)},[s])}}function t7(e,t,n){return i.useCallback(l=>{if(t===eX.oU.CREATE_FORUM_POST||t===eX.oU.CREATE_ANNOUNCEMENT_POST)n.current?.insertGIF(l);else{let t={gif_provider:l.provider??(0,eI.cf)(),load_id:eK.A.getAnalyticsID(),source_object:"GIF Picker",gif_url:l.url,gif_id:l.id};e(l.url,void 0,void 0,!0,void 0,t)}(0,eA.v8)(),n.current?.focus()},[n,e,t])}function t8(e){return i.useCallback(t=>{let{emoji:n,willClose:l}=t,i=e.current;null!=n&&null!=i&&i.insertEmoji({emoji:n,willClose:l}),l&&(0,eA.v8)()},[e])}function t9(e){let{editorRef:t,disabled:n,textValue:l,channelId:s,chatInputType:r,submit:a}=e,{analyticsLocations:o}=(0,I.Ay)();return i.useCallback((e,i)=>{n||(r===eX.oU.CREATE_ANNOUNCEMENT_POST||(0,ew.YS)(i,l,s,r.drafts.type)?((0,tp.fh)({sticker:e,stickerSelectLocation:i,isReplacement:null!=eM.A.getStickerPreview(s,r.drafts.type),analyticsLocations:o}),(0,eO.$x)(s,e,r.drafts.type)):(a({value:"",uploads:void 0,stickers:[e.id]}),t.current?.clearValue()),(0,eA.v8)(),t.current?.focus())},[n,l,s,t,o,a,r])}function ne(e){return i.useCallback(t=>{let n=e.current;null!=n&&n.insertKaomoji(t),(0,eA.v8)(),n?.focus()},[e])}function nt(e,t,n){let l=i.useCallback(()=>{t||(0,eA.r$)(t6.kx.EMOJI,e,n)},[t,e,n]),s=i.useCallback(()=>{!t&&e.gifs?.allowSending&&(0,eA.r$)(t6.kx.GIF,e,n)},[t,e,n]),r=i.useCallback(()=>{!t&&e.stickers?.allowSending&&(0,eA.r$)(t6.kx.STICKER,e,n)},[t,e,n]);(0,ez.Vo)({event:ea.jej.TOGGLE_EMOJI_POPOUT,handler:l}),(0,ez.Vo)({event:ea.jej.TOGGLE_GIF_PICKER,handler:s}),(0,ez.Vo)({event:ea.jej.TOGGLE_STICKER_PICKER,handler:r})}function nn(e,t,n){let[l]=i.useState(()=>new a.EventEmitter);return i.useEffect(()=>{l.emit("text-changed",t,n)},[t,n,l]),{eventEmitter:l,handleEditorSelectionChanged:function(t){null!=e.current&&l.emit("selection-changed",t)}}}function nl(){let e=i.useRef(null),t=i.useCallback(()=>{e.current?.onMaybeShowAutocomplete()},[]),n=i.useCallback(()=>{e.current?.onHideAutocomplete()},[]);return{autocompleteRef:e,handleMaybeShowAutocomplete:t,handleHideAutocomplete:n}}function ni(e){let t=i.useRef(null);if(null!=e&&"function"==typeof e)throw Error("Only Ref objects are supported");return null==e?t:e}function ns(e){let[t,n]=i.useState(0);return{editorHeight:t,handleResize:i.useCallback(t=>{n(t??0),e?.(t)},[e])}}function nr(e,t,n,l){let i=e.getGuildId(),s=(0,h.bG)([e_.A],()=>null!=i&&e_.A.isLurking(i),[i]),r=(0,h.bG)([eG.Ay,eW.default],()=>{let e=eW.default.getCurrentUser();return(null!=i&&null!=e?eG.Ay.getMember(i,e.id)?.isPending:null)??!1}),a=(0,h.cf)([eF.A],()=>{let i=e.isPrivate(),s=eF.A.computePermissions(e),a=m.zy(s,ea.xBc.CREATE_PUBLIC_THREADS)||m.zy(s,ea.xBc.CREATE_PRIVATE_THREADS),o=(!t.permissions?.requireCreateTherads||a)&&(!t.permissions?.requireSendMessages||m.zy(s,ea.xBc.SEND_MESSAGES)),u=o&&m.zy(s,ea.xBc.ATTACH_FILES),c=null!=n,d=(0,ek.UJ)(e);return{disabled:l||r||!i&&!o||d,canAttachFiles:!0===t.attachments&&(i||r||u||c),canCreateThreads:a,canEveryoneSendMessages:eq.MJ(ea.xBc.SEND_MESSAGES,e)}},[e,t.permissions.requireCreateTherads,t.permissions.requireSendMessages,t.attachments,n,l,r]);return{isLurking:s,isPendingMember:r,...a}}function na(e,t,n){let[l,s,r]=(0,eA.RQ)(e=>[e.activeView,e.activeViewType,e.activeChannelId],c.x),a=(0,h.bG)([S.A],()=>S.A.shouldShowPopup()&&S.A.activeViewType()===e&&S.A.activeChannelId()===n);i.useEffect(()=>()=>{(0,eA.v8)(e,n)},[e,n]);let o=i.useCallback(()=>{null!=l||a||t.current?.handleOuterClick()},[l,a,t]),u=null==l||null==s||s!==e||r!==n;return{expressionPickerView:l,shouldHideExpressionPicker:u,handleOuterClick:o}}function no(e,t){return{handleAutocompleteVisibilityChange:i.useCallback(n=>{n&&(0,eA.v8)(e,t)},[e,t])}}let nu=i.memo(i.forwardRef(function(e,t){let n,{textValue:s,richValue:a,className:o,innerClassName:c,editorClassName:m,id:p,required:E,disabled:y,placeholder:v,accessibilityLabel:T,channel:N,type:j,focused:b,error:R,renderAttachButton:P,renderApplicationCommandIcon:L,renderButtons:w,pendingReply:k,onChange:D,onResize:U,onBlur:G,onFocus:F,onKeyDown:V,onSubmit:B,promptToUpload:H,highlighted:W,canMentionRoles:K,canMentionChannels:Y,maxCharacterCount:z,showRemainingCharsAfterCount:Z,allowNewLines:q=!0,characterCountClassName:$,"aria-describedby":J,"aria-labelledby":X,setEditorRef:Q,autoCompletePosition:ee,children:et,disableThemedBackground:en=!1,emojiPickerCloseOnModalOuterClick:el,parentModalKey:ei,pendingScheduledMessage:es,showValueWhenDisabled:er=!1}=e;u()(null!=j,"chat input type must be set");let{analyticsLocations:eo}=(0,I.Ay)(x.A.CHANNEL_TEXT_AREA),eu=ni(t),ec=i.useRef(null),ed=i.useRef(null),eh=i.useRef(null),ex=i.useRef(null),eI=i.useRef(null),e_=i.useCallback(()=>eh.current?.getSlateEditor()??null,[]);Q?.(eh.current);let ey=(0,_.A)(N),ev=(0,eU.n)("ChannelTextAreaContainer"),eT=(0,h.cf)([C.Ay],()=>({expressionPickerFormat:C.Ay.expressionPickerFormat,condensePickerWhenNarrow:C.Ay.condensePickerWhenNarrow})),eN=ev?eT.expressionPickerFormat:C.IG.FLEXIBLE,ej=!ev||eT.condensePickerWhenNarrow,[eb,eR]=i.useState(!ey);(0,A.i4)(eu,e=>{let{width:t}=e;return eR(!ey&&(null==t||t>450))});let eP=eN===C.IG.HIDDEN,eM=eN===C.IG.CONDENSED||eN===C.IG.FLEXIBLE&&ej&&!eb,{activeCommand:eO,activeCommandSection:ew}=(0,h.cf)([O.A],()=>({activeCommand:j.commands?.enabled?O.A.getActiveCommand(N.id):null,activeCommandSection:j.commands?.enabled?O.A.getActiveCommandSection(N.id):null})),{isLurking:ek,isPendingMember:eF,disabled:eV,canAttachFiles:eH,canCreateThreads:eK,canEveryoneSendMessages:ez}=nr(N,j,eO,y),eq=j.toolbarType===eX.O1.STATIC,e0=!eD.D_.useSetting()&&!(0,e$.isAndroidWeb)()&&null!=window.ResizeObserver,e1=!e0||!j.commands?.enabled||!b||"/"!==s,e2=(0,eS.A)(),{fontSize:e3}=(0,h.cf)([C.Ay],()=>({fontSize:C.Ay.fontSize})),e4=(0,h.bG)([eB.A],()=>eB.A.isEnabled());nt(j,eV,N.id);let{eventEmitter:e6,handleEditorSelectionChanged:e5}=nn(eh,s,a),e7=i.useRef(s);e7.current=s;let e8=i.useCallback((e,t,n)=>{"/"===t&&""===e7.current&&j.commands?.enabled&&e6.emit("command-sentinel-typed"),D?.(e,t,n)},[D,j.commands?.enabled,e6]),{submitting:e9,submit:te,handleSubmit:tt}=t5(B,j,eh,eI,N.id),{autocompleteRef:tn,handleMaybeShowAutocomplete:tl,handleHideAutocomplete:ti}=nl(),ts=t7(te,j,eh),tr=t8(eh),to=t9({editorRef:eh,disabled:eV,textValue:s,channelId:N.id,chatInputType:j,submit:B}),tc=i.useCallback((e,t,n)=>{let l=eh.current;null!=e&&null!=l&&(eY.default.track(ea.HAw.SOUNDMOJI_SELECT,{channel_id:N.id,guild_id:N.guild_id,sound_guild_id:e.guildId,sound_id:e.soundId,source:t}),l.insertSound(e)),n&&(0,eA.v8)(),l?.focus()},[eh,N.id,N.guild_id]),td=ne(eh),tm=i.useCallback(()=>eI?.current?.hide(),[]),{editorHeight:tp,handleResize:tf}=ns(U),{handleTab:tg,handleEnter:tA,handleMoveSelection:tC}=(n=i.useCallback(()=>!!(!e1&&ec.current?.onTabOrEnter(!1))||tn.current?.onTabOrEnter(!1)||!1,[e1,ec,tn]),{handleTab:n,handleEnter:i.useCallback(()=>!!(!e1&&ec.current?.onTabOrEnter(!0))||tn.current?.onTabOrEnter(!0)||!1,[e1,ec,tn]),handleMoveSelection:i.useCallback(e=>!!(!e1&&ec.current?.onMoveSelection(e))||tn.current?.onMoveSelection(e)||!1,[e1,ec,tn])}),{expressionPickerView:tI,shouldHideExpressionPicker:tS,handleOuterClick:tv}=na(j,eh,N.id),{selectedAutocompleteInputType:tj,selectedAutocompleteInputError:tb}=function(e,t){let[n,l]=i.useState({selectedAutocompleteInputType:null,selectedAutocompleteInputError:!1}),s=i.useCallback(()=>{let e,n=t.current?.getSlateEditor();null!=n&&(e=tX.VW.getSelectedParentOfType(n,eg.mk)?.[0]),l({selectedAutocompleteInputType:e?.type??null,selectedAutocompleteInputError:e?.error??!1})},[t]);return i.useEffect(()=>(e.on("selection-changed",s),e.on("submit-failure",s),s(),()=>{e.off("selection-changed",s),e.on("submit-failure",s)}),[s,e]),n}(e6,eh),{handleAutocompleteVisibilityChange:tL}=no(j,N.id),tM=function(e){let{type:t,channelId:n}=e;return(0,ep.bG)([S.A],()=>{let e=S.A.activeViewType();return null!=e&&e===t&&S.A.activeChannelId()===n&&S.A.shouldShowPopup()},[t,n])}({type:j,channelId:N.id}),tU=i.useCallback(()=>{e6.emit("submit-failure")},[e6]);(0,eJ.R)(e6,N.guild_id,N.id);let tG=null!=k,tF=eV&&!((ek||eF)&&ez)||e9&&j.submit?.useDisabledStylesOnSubmit,tV=null;null!=eO?tV=L?.(eO,ew,tw.g$):(!eV||eK)&&(tV=P?.(tG,tw.g$));let tB=e0&&null!=a&&!eV&&j.showCharacterCount&&null==eO,tH=e0&&!__OVERLAY__&&null!=a&&null==eO&&j.toolbarType!==eX.O1.NONE&&!eV,tW=function(e){let{channel:t,type:n,activeCommand:s,pendingReply:r,pendingScheduledMessage:a,selectedAutocompleteInputType:o,selectedAutocompleteInputError:u}=e,{activeCommandOption:c,activeCommandOptionStates:d}=(0,h.cf)([O.A],()=>({activeCommandOption:O.A.getActiveOption(t.id),activeCommandOptionStates:O.A.getOptionStates(t.id)})),m=(0,h.bG)([eG.Ay,eW.default,t_],()=>{let e=eW.default.getCurrentUser();if(null==e||!e.isStaff()||!t.isDM())return!1;let n=eW.default.getUser(t.getRecipientId());if(!n?.isStaff())return!1;let l=eG.Ay.getNicknames(n.id).some(e=>e.endsWith("[PTO]")||e.endsWith("[OOO]"));return l?!t_.hasId(n.id)&&l:(tx.delete(n.id)&&t_.emitChange(),!1)}),p=(0,tN.Ay)(e=>e.channelId===t.id);return i.useMemo(()=>{let e=[],i=[];return null!=t.guild_id&&n===eX.oU.NORMAL&&i.push((0,l.jsx)(tP.A,{guildId:t.guild_id,channel:t,className:tw.UW})),null!=s&&e.push((0,l.jsx)(tE,{activeCommand:s,activeOption:c??null,optionStates:d,channelId:t.id})),null!=r&&e.push((0,l.jsx)(tu,{reply:r,chatInputType:n})),m&&e.push((0,l.jsx)(ty,{})),null!=a&&e.push((0,l.jsx)(tO,{pendingScheduledMessage:a})),"timestampMentionInput"===o&&i.push((0,l.jsx)(tT,{error:u??!1})),p&&e.push((0,l.jsx)(tR,{channelId:t.id})),{stacked:e,floating:i}},[s,c,d,t,p,r,m,n,a,o,u])}({channel:N,type:j,activeCommand:eO,pendingReply:k,pendingScheduledMessage:es,selectedAutocompleteInputType:tj,selectedAutocompleteInputError:tb}),tK=0===s.trim().length,tY=null!=k?[J,ta].filter(Boolean).join(" "):J,tz=j.layout===eX.wt.INLINE,tQ=j.layout===eX.wt.FLUSH,t0=(0,l.jsx)("div",{ref:ed,className:tw.BW}),t1=tM?(0,l.jsx)(M,{align:"right",positionTargetRef:ed,channel:N}):null,t2=null!=w?w():(0,l.jsx)(tD.A,{type:j,disabled:eV,channel:N,handleSubmit:tt,isEmpty:tK,showAllButtons:!eM&&!eP,expressionButtonsHidden:eP}),t3=tB?(0,l.jsx)(t$.A,{type:j,textValue:s,className:$,maxCharacterCount:z,showRemainingCharsAfterCount:Z}):null;return i.useEffect(()=>{b&&eZ._.dispatch(ea.jej.CHANNEL_TEXT_AREA_FOCUSED,{channelId:N.id})},[b,N.id]),(0,l.jsx)(eE.Sv,{value:e6,children:(0,l.jsxs)(I.f5,{value:eo,children:[tH&&eq?(0,l.jsx)(t4,{getSlateEditor:e_,onInsertEmoji:tr,type:j,channel:N}):tH?(0,l.jsx)(tJ.A,{ref:eI,getSlateEditor:e_,containerRef:ex,options:j.markdown}):null,(0,l.jsxs)("div",{ref:eu,className:r()(o,{[tw.gM]:!0,[tw.h9]:tF,[tw.mr]:W,[tw.Wn]:d.Fr,[tw.Ls]:tz,[tw.AH]:tQ,[tw.z3]:null!=R}),children:[tz||tQ?null:(0,l.jsx)(tk,{bars:tW}),(0,l.jsxs)("div",{ref:ex,onScroll:tm,className:r()(c,{[tw.xx]:!0,[tw.k6]:!en,[tw.Ri]:tW.stacked.length>0}),children:[(0,l.jsx)(th,{channelId:N.id,chatInputType:j}),j.hideAttachmentArea?null:(0,l.jsx)(tq.A,{channelId:N.id,type:j,canAttachFiles:eH}),(0,l.jsxs)("div",{className:r()(tw.vW,{[tw.BF]:tF,[tw.RL]:j!==eX.oU.EDIT&&(null!=tV||tF&&null==tV||ek),[tw.fk]:j===eX.oU.THREAD_CREATION,[tw.TZ]:j===eX.oU.CREATE_FORUM_POST||j===eX.oU.FORWARD_MESSAGE_INPUT,[tw.$i]:j===eX.oU.USER_PROFILE_REPLY}),onMouseDown:tv,children:[t1,tV,(0,l.jsx)(f.vN,{ringTarget:eu,ringClassName:tw.Rg,children:(0,l.jsx)(eQ.A,{ref:eh,id:p,focused:b,useSlate:e0,textValue:s,richValue:a,disabled:eV,placeholder:v,required:E,accessibilityLabel:T,isPreviewing:(ek||eF)&&ez,channel:N,type:j,canPasteFiles:eH,uploadPromptCharacterCount:ea.CS1,maxCharacterCount:z??e2,allowNewLines:q,"aria-describedby":tY,onChange:e8,onResize:tf,onBlur:G,onFocus:F,onKeyDown:V,onSubmit:te,onSubmitFailure:tU,onTab:tg,onEnter:tA,onMoveSelection:tC,onSelectionChanged:e5,onMaybeShowAutocomplete:tl,onHideAutocomplete:ti,promptToUpload:H,fontSize:e3,spellcheckEnabled:e4,canOnlyUseTextCommands:tG,className:r()({[tw.QI]:j===eX.oU.THREAD_CREATION,[tw.AV]:j===eX.oU.PROFILE_BIO_INPUT,[tw.GR]:j===eX.oU.OVERLAY_INLINE_REPLY},m),"aria-labelledby":X,showValueWhenDisabled:er})}),t2,t0]})]}),(0,l.jsx)(tZ,{channel:N,type:j,pendingScheduledMessage:es}),e1?null:(0,l.jsx)(em,{ref:ec,channel:N,canOnlyUseTextCommands:tG}),(0,l.jsx)(ef.A,{ref:tn,channel:N,canMentionRoles:K,canMentionChannels:Y,useNewSlashCommands:e0,canOnlyUseTextCommands:tG,canSendStickers:j.stickers?.allowSending,canSendSoundmoji:j.soundmoji?.allowSending,textValue:s,focused:b,expressionPickerView:tI,type:j,targetRef:eu,editorRef:eh,onSendMessage:te,onSendSticker:to,onVisibilityChange:tL,editorScrollerRef:ex,editorHeight:tp,barsHeight:40*tW.floating.length,setValue:(e,t)=>e8?.(null,e,t),position:ee}),(0,l.jsx)(eL,{textValue:s,editorHeight:tp,channelId:N.id}),t3,et]}),(0,l.jsx)(g.U,{error:R}),tS?null:(0,l.jsx)(eC.A,{positionTargetRef:eu,type:j,onSelectGIF:ts,onSelectEmoji:tr,onSelectSticker:to,onSelectSound:tc,onSelectKaomoji:td,channel:N,closeOnModalOuterClick:el,parentModalKey:ei,position:"top",align:"right",positionLayerClassName:tw.BD})]})})}))}