import{r as a,x as p,j as f,t as m,f as d,i as x,aj as F,au as g}from"./index-B-YXshIJ.js";import{b as C}from"./query-hooks-C0Pc4MKj.js";import{M as j}from"./MultiSelectDropdown-B42s6W_W.js";const y=()=>{var e;const l=C(),u=m.workItems.getPageConfig.useQuery({queryContext:l},{keepPreviousData:!0}),[s,t]=d("filter",x),o=a.useCallback(r=>{t(F(r),!0)},[t]),c=a.useMemo(()=>g(s),[s]);return{filters:(e=u.data)==null?void 0:e.filters,selectedFilters:c,setSelectedFilters:o}},w=a.forwardRef(({setRenderCount:l},u)=>{const{filters:s,selectedFilters:t,setSelectedFilters:o}=y(),c=a.useCallback(e=>r=>o([...t.filter(i=>i.label!==e),{label:e,tags:r}]),[t,o]);return a.useLayoutEffect(()=>{l(p(1))},[l,s]),f.jsx("div",{className:"flex flex-wrap gap-4",ref:u,children:Object.entries(s||{}).map(([e,r])=>{var i;return f.jsx(j,{label:e,options:r.map(n=>({label:n,value:n})),value:((i=t.find(n=>n.label===e))==null?void 0:i.tags)||[],onChange:c(e)},e)})})});export{w as F,y as u};
