Loading
function(e,n,t){t.d(n,{A:()=>C});var i=t(477900),l=t(582128),o=t(855986),s=t(452027),a=t(265872),r=t(862301),u=t(834730),d=t(565645),m=t(414079),c=t(713517),j=t(375499),p=t(863576),h=t(808728),f=t(284009),A=t.n(f),N=t(121681),x=t(7584),E=t(307731),g=t(792996),v=t(411559);function C(e){let{className:n,guildId:t,error:f,emojiId:C,emojiName:b,isRequiredField:I=!0,shouldUpdateBothEmojiFields:y=!1,setEmojiId:D,setEmojiName:k}=e,B=function(e){let{emojiId:n,emojiName:t}=e,i=(0,o.bG)([N.Ay],()=>null!=n?N.Ay.getCustomEmojiById(n):null);if(null!=i||null!=t)if(null==n)return A()(null!=t,"emojiName must be defined if emojiId is not defined"),x.Ay.convertSurrogateToName(t,!1);else return i?.name}({emojiId:C,emojiName:b}),S=(0,o.bG)([h.A],()=>null!=t?h.A.getDefaultChannel(t):null),w=l.useRef(null),{isHoveringOrFocusing:M}=(0,c.A)(w);function O(){k(void 0),D(void 0)}function P(e){e.stopPropagation(),O()}let R=l.useMemo(()=>{let e=null!=C&&""!==C,n=null!=b&&""!==b,t=null!=B&&""!==B,i=n&&!Number.isNaN(parseInt(b))&&!t&&!e;return{hasEmojiId:e,hasEmojiName:n,hasEmojiDisplayName:t,isDeletedCustomEmoji:i}},[C,b,B]),T=!R.isDeletedCustomEmoji&&R.hasEmojiDisplayName;return(0,i.jsx)("div",{className:n,children:(0,i.jsx)(s.D,{required:I,label:g.intl.string(g.t["3BQmiC"]),errorMessage:f??void 0,children:(0,i.jsx)(a.Y,{targetElementRef:w,animation:a.Y.Animation.NONE,position:"top",renderPopout:e=>{let{closePopout:n}=e;return(0,i.jsx)(p.A,{closePopout:n,pickerIntention:E.EmojiIntention.SOUNDBOARD,onNavigateAway:n,onSelectEmoji:e=>{let{emoji:t,willClose:i}=e,l=t?.id==null;O(),l?k(t?.optionallyDiverseSequence):(y&&k(t?.name),D(t?.id)),i&&n()},guildId:t,channel:S})},children:(e,n)=>{let{isShown:t}=n;return(0,i.jsxs)(r.F,{...e,className:v.LM,ref:w,children:[(0,i.jsx)(j.A,{active:t,tabIndex:0,renderButtonContents:!R.isDeletedCustomEmoji&&(R.hasEmojiId||R.hasEmojiName)?()=>(0,i.jsx)(d.A,{emojiName:b,emojiId:C}):null}),(0,i.jsx)(u.E,{variant:"body-md/normal",lineClamp:1,color:T?"text-default":"text-muted",children:T?`:${B}:`:g.intl.string(g.t.QTK0TJ)}),T&&M&&(0,i.jsx)(m.A,{...e,onClick:P})]})}})})})}}