import{j as n}from"./@radix-D8tIKeo-.js";import{bG as S,a6 as x,I as g,aR as j}from"./index-B44sgOyQ.js";import{a as c}from"./@monaco-editor-CuNQBT0l.js";import{c as b,f as N}from"./@react-router-D1ODL_Ub.js";const P=["equals:","contains:","startswith:","endswith:","gte:","gt:","lte:","lt:"];function y(t){const a=P.find(s=>t.startsWith(s));return a?t.slice(a.length):t}const R=c.forwardRef(({searchParams:t,searchContains:a=!0,inMemoryHandler:s,...o},l)=>{const u=b(),[f]=N(),[m,p]=c.useState(y(t.name||"")||""),i=c.useMemo(()=>S(h,500),[]);c.useEffect(()=>()=>{i.cancel()},[i]);function h(r){if(s){s(r);return}const e=new URLSearchParams({...Object.fromEntries(f),...x(t)});e.delete("logical_operator"),r?(e.set("name",a?`contains:${r}`:`${r}`),e.set("operator","or"),e.set("page","1")):(e.delete("name"),e.delete("operator")),u(`?${e.toString()}`,{preventScrollReset:!0,replace:!0})}function d(r){const{value:e}=r.target;p(e),i(e)}return n.jsxs("div",{className:"relative",children:[n.jsx(g,{className:"pl-[36px]",...o,ref:l,value:m,onChange:d,placeholder:"Search...",inputSize:"md"}),n.jsx("div",{className:"absolute inset-y-0 left-0 flex items-center pl-1",children:n.jsx(j,{className:"size-4 fill-neutral-400"})})]})});R.displayName="SearchField";export{R as S};
