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