Module 976966

5,788 characters · in aca7018765200529.js
Dependencies
Source Raw
function(e,t,n){n.d(t,{A:()=>T});var i=n(627968),l=n(64700),s=n(503698),a=n.n(s),r=n(554146),o=n(342494),d=n(990078),c=n(397927),u=n(932001),h=n(93055),A=n(253932),_=n(975571),m=n(822382),p=n(753806),g=n(345859),f=n(145331),E=n(121806),x=n(652215),I=n(49999),C=n(985018),N=n(853279);function T(e){let{searchContext:t,searchMode:n,onSearchModeChange:s,totalResults:o,isIndexing:d,isSearching:A,documentsIndexed:_,selectedChannelId:f}=e,T=(0,g.H)(t),{totalFilters:b}=(0,E.vj)(T,t),y=l.useMemo(()=>{if(t.type===x.I4_.DMS){let e=(0,m.Zf)(T),t=e.channel_id?.length??0;return t>0?C.intl.format(C.t.A2dqWG,{filterCount:t}):C.intl.string(C.t.tc619d)}return null},[t.type,T]),[v,R]=l.useState(null),L=l.useMemo(()=>A?[]:[r.M.CROSS_DM_SEARCH_SETTING_EDUCATION_POPOVER],[A]),[M,D]=(0,u.kn)(L),U=M===r.M.CROSS_DM_SEARCH_SETTING_EDUCATION_POPOVER,G=l.useCallback(e=>{null!=e&&U&&D(I.i.USER_DISMISS),R(e)},[U,D,R]),P=l.useCallback(e=>{D("user:explicit"===e?I.i.USER_DISMISS:I.i.AUTO_DISMISS)},[D]),k=l.useCallback(()=>{G(null),p.A.openSearchFiltersModal(t)},[G,t]),w=l.useMemo(()=>b>0?C.intl.format(C.t.uaR4sI,{filterCount:b}):C.intl.string(C.t.UdhTtk),[b]),B=!(0,h.DZ)()&&(t.type===x.I4_.DMS||t.type===x.I4_.CHANNEL);return(0,i.jsxs)("header",{className:a()(N.wL,{[N.g$]:null!=y}),children:[(0,i.jsx)("div",{className:N.TN,role:"status",children:(0,i.jsx)(S,{totalResults:o,subtitle:y,isIndexing:d,isSearching:A,documentsIndexed:_})}),(0,i.jsxs)("div",{className:N.vd,children:[(0,i.jsx)(c.Button,{variant:"secondary",onClick:k,text:w,icon:c.RgP,size:"sm"}),(0,i.jsx)(O,{searchMode:n,onSearchModeChange:s,isPopoutOpen:"sort"===v,setOpenPopout:G}),B&&(0,i.jsx)(j,{searchContext:t,selectedChannelId:f,isPopoutOpen:"settings"===v,setOpenPopout:G,isPopoverVisible:U,onPopoverRequestClose:P})]})]})}function S(e){let{totalResults:t,subtitle:n,isSearching:l,isIndexing:s,documentsIndexed:a}=e;return s?(0,i.jsx)(y,{documentsIndexed:a}):l?(0,i.jsx)(v,{}):(0,i.jsx)(R,{totalResults:t,subtitle:n})}function b(){return(0,i.jsx)("div",{className:N.zp,children:(0,i.jsx)(c.y$y,{type:c.y$y.Type.SPINNING_CIRCLE,className:N.u1,itemClassName:N.pu})})}function y(e){let{documentsIndexed:t}=e;return(0,i.jsx)(d.m,{asContainer:!0,text:C.intl.formatToPlainString(C.t["4Y3O+O"],{count:t??""}),children:(0,i.jsxs)("div",{className:N.q_,children:[(0,i.jsx)(c.Text,{variant:"text-md/medium",color:"text-muted",children:(0,i.jsx)(c.MzZ,{className:N.Zd,href:_.A.getArticleURL(x.MVz.SEARCH_INDEXING),children:C.intl.string(C.t["G3EA+4"])})}),(0,i.jsx)(b,{})]})})}function v(){return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(c.Text,{variant:"text-md/medium",color:"text-default",children:C.intl.string(C.t.uixzLf)}),(0,i.jsx)(b,{})]})}function R(e){let{totalResults:t,subtitle:n}=e,l=(0,i.jsx)(c.Text,{variant:"text-md/medium",color:"text-strong",children:C.intl.format(C.t.ZGVL3g,{count:t})});return null!=n?(0,i.jsxs)("div",{className:N.hy,children:[l,(0,i.jsx)(c.Text,{variant:"text-xs/medium",color:"text-subtle",children:n})]}):l}function j(e){let{searchContext:t,selectedChannelId:n,isPopoutOpen:s,setOpenPopout:a,onPopoverRequestClose:r,isPopoverVisible:d}=e,u=l.useRef(null),h=A.Hu.useSetting(),_=l.useCallback(e=>{if(h!==e){if((0,f._k)({searchContext:t,prevIsCrossDMSettingEnabled:A.Hu.getSetting(),isCrossDMSettingEnabled:e,location:f.vy.SEARCH_HEADER}),e){let e={type:x.I4_.DMS};p.A.transitionStateToSearchContext(t,e,p.A.cleanUpPrivateChannelSearchState)}else{let e={type:x.I4_.CHANNEL,channelId:n};p.A.transitionStateToSearchContext(t,e)}a(null),A.Hu.updateSetting(e)}},[h,a,t,n]),[m,g]=l.useMemo(()=>[h?C.intl.string(C.t["8lklch"]):C.intl.string(C.t.ji3jTF),h?C.intl.string(C.t.RMQZCa):C.intl.string(C.t["v/PagC"])],[h]),E=l.useMemo(()=>({align:"end"}),[]);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(c.YNO,{targetElementRef:u,shouldShow:s,animation:c.YNO.Animation.NONE,position:"bottom",align:"right",onRequestClose:()=>a(null),renderPopout:e=>{let{closePopout:t}=e;return(0,i.jsx)(c.W1t,{"data-menu-migrated-auto":!0,navId:"search-settings-cog",onClose:t,"aria-label":C.intl.string(C.t.fb59v0),onSelect:()=>a(null),children:(0,i.jsxs)(c.rXV,{label:C.intl.string(C.t["/tMwrA"]),children:[(0,i.jsx)(c.iDA,{id:"xdm-search-disabled",group:"xdm-search-items",label:C.intl.string(C.t.jRkYAh),checked:!h,action:()=>_(!1)}),(0,i.jsx)(c.iDA,{id:"xdm-search-enabled",group:"xdm-search-items",label:C.intl.string(C.t["lWpJ/t"]),checked:h,action:()=>_(!0)})]},"xdm-search-items")})},children:e=>(0,i.jsx)(c.K0,{...e,buttonRef:u,variant:"secondary",icon:c.Zes,onClick:()=>{a(s?null:"settings")},"aria-label":C.intl.string(C.t["3D5yo/"]),size:"sm"})}),(0,i.jsx)(o.AM,{targetElementRef:u,shouldShow:d,onRequestClose:r,title:m,body:g,caretConfig:E,badge:"new"})]})}function O(e){let{searchMode:t,onSearchModeChange:n,isPopoutOpen:s,setOpenPopout:a}=e,r=l.useRef(null),o=l.useMemo(()=>[{label:C.intl.string(C.t.CbaapP),value:x.BBH.NEWEST},{label:C.intl.string(C.t.OukXZj),value:x.BBH.OLDEST},{label:C.intl.string(C.t.q8gB52),value:x.BBH.MOST_RELEVANT}],[]),d=l.useCallback(e=>{a(null),n(e)},[a,n]);return(0,i.jsx)(c.YNO,{targetElementRef:r,shouldShow:s,animation:c.YNO.Animation.NONE,position:"bottom",align:"right",onRequestClose:()=>a(null),renderPopout:e=>{let{closePopout:n}=e;return(0,i.jsx)(c.W1t,{"data-menu-migrated-auto":!0,navId:"search-result-sort-menu",onClose:n,"aria-label":C.intl.string(C.t.utp2hS),onSelect:()=>a(null),children:(0,i.jsx)(c.rXV,{children:o.map(e=>{let{label:n,value:l}=e;return(0,i.jsx)(c.iDA,{group:"sort-by",id:`sort-by-option-${l}`,label:n,action:()=>d(l),checked:t===l},l)})},"sort-by")})},children:e=>(0,i.jsx)(c.Button,{...e,buttonRef:r,variant:"secondary",icon:c.JNJ,onClick:()=>{a(s?null:"sort")},text:C.intl.string(C.t.XvNMNk),"aria-label":C.intl.string(C.t.XvNMNk),size:"sm"})})}}