"use strict";(self.webpackChunkmattermost_webapp=self.webpackChunkmattermost_webapp||[]).push([[7884],{82262:(e,t,a)=>{a.r(t),a.d(t,{default:()=>y}),a(43617),a(81975);var i=a(36418),n=a.n(i),l=a(84402),c=a(37270),r=a(53442),s=a(8361),o=a(26614),f=a(69657);const u=(0,s.Mz)("getGiphyFetchInstance",(e=>(0,o.zj)(e).GiphySdkKey),(e=>e?new r.uK(e):null)),g=(0,s.Mz)("getGiphyLanguageCode",(e=>(0,f.k)(e)),(e=>e?.split("-")?.[0]??"en"));var m=a(60853),p=a(92243);const h="gifs";function d(e){const t=(0,c.useSelector)(u),a=(0,c.useSelector)(g),r=(0,i.useCallback)((async i=>t?e.filter.length>0?await t.search(e.filter,{offset:i,lang:a,sort:"relevant",limit:10,rating:"g",type:h}):await t.trending({offset:i,limit:10,rating:"g",type:h}):{}),[e.filter,a,t]);return n().createElement("div",{className:"emoji-picker__items gif-picker__items"},n().createElement(l.xA,{key:0===e.filter.length?"trending":e.filter,columns:2,gutter:8,hideAttribution:!0,width:e.width,noResultsMessage:n().createElement(m.A,{variant:p.L.Search,titleValues:{channelName:`${e.filter}`}}),fetchGifs:r,onGifClick:e.onClick}))}const k=(0,i.memo)(d);var C=a(14778),_=a(11038),b=a(77440);const v=a.p+"files/91a3a29ed2f93ba44792.png",w=a.p+"files/c01e2180eeaf3ec6fc96.png";function E(e){const t=(0,c.useSelector)(b.O4),{formatMessage:a}=(0,C.useIntl)(),l=(0,i.useCallback)((t=>{t.preventDefault();const a=t.target?.value?.replace(/^:|:$/g,"")??"";e.onChange(a)}),[e.onChange]),r=(0,i.useMemo)((()=>!!_.A.mostReadable(t.centerChannelBg,["#FFFFFF","#000000"],{includeFallbackColors:!1}).isLight()),[t.centerChannelBg]);return n().createElement("div",{className:"emoji-picker__search-container"},n().createElement("div",{className:"emoji-picker__text-container gif-picker__text-container"},n().createElement("span",{className:"icon-magnify icon emoji-picker__search-icon"}),n().createElement("input",{id:"emojiPickerSearch",className:"emoji-picker__search","aria-label":a({id:"gif_picker.input.label",defaultMessage:"Search for GIFs"}),placeholder:a({id:"gif_picker.input.placeholder",defaultMessage:"Search GIPHY"}),type:"text",autoFocus:!0,autoComplete:"off",onChange:l,value:e.value})),n().createElement("div",{className:"gif-attribution"},n().createElement("img",{src:r?w:v,alt:a({id:"gif_picker.attribution.alt",defaultMessage:"Powered by GIPHY"})})))}const F=(0,i.memo)(E),y=e=>{const t=(0,i.useCallback)(((t,a)=>{if(e.onGifClick){a.preventDefault();const i=`![${t.title}](${t.images.fixed_height.url})`;e.onGifClick(i)}}),[e.onGifClick]),a=(0,i.useMemo)((()=>(e.getRootPickerNode?.()?.getBoundingClientRect()?.width??350)-24),[e.getRootPickerNode]);return n().createElement(n().Fragment,null,n().createElement(F,{value:e.filter,onChange:e.handleFilterChange}),n().createElement(k,{width:a,filter:e.filter,onClick:t}))}}}]);
//# sourceMappingURL=7884.6e737155a4164e5f443c.js.map