1import{o as e}from"./chunk-CMxvf4Kt.js";import{n as t}from"./jsx-runtime-SsSjplwM.js";import{c as n,s as r}from"./react-intl-Cop388b4.js";import{Or as i}from"./render-CHiIZYnD.js";import{q as a}from"./accounts_typed-DlsCBf4c.js";import{t as o}from"./index.module-3tq1TBjm.js";var s=e(t()),c=r({addTag:{id:`account_edit_tags.add_tag`,defaultMessage:`Add #{tagName}`}}),l=({q:e,limit:t,signal:n})=>i({q:e,type:`hashtags`,limit:t},{signal:n});function u({query:e,limit:t=11,filterResults:r}={}){let i=n(),[u,d]=(0,s.useState)([]),[f,p]=(0,s.useState)(`idle`),m=(0,s.useRef)(null),h=o(e=>{m.current&&m.current.abort();let n=a(e.trim());if(n.length===0){d([]);return}p(`loading`),m.current=new AbortController,l({q:n,limit:t,signal:m.current.signal}).then(({hashtags:e})=>{d(r?e.filter(r):e),p(`idle`)}).catch(()=>{p(`error`)})},500,{leading:!0,trailing:!0}),g=(0,s.useCallback)(()=>{d([]),p(`idle`)},[]);return{tags:(0,s.useMemo)(()=>{let t=e?a(e.trim()):``;if(!t)return u;let n=[...u];return t.length>0&&n.every(e=>e.name.toLowerCase()!==t.toLowerCase())&&n.push({id:`new`,name:t,label:i.formatMessage(c.addTag,{tagName:t})}),n},[u,e,i]),searchTags:h,resetSearch:g,isLoading:f===`loading`,isError:f===`error`}}export{u as t}; 2//# sourceMappingURL=useSearchTags-CDYniXr4.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.