import{aC as f,dN as F,aI as o}from"./app-k0jcl5PQ.js";const q=50;function I(e,c){const i=f.chunk(e,q).map(a=>c(f.uniq(a))),s=F(i),u=f.flatten(s.data),t=s.data.length?u.reduce((a,d)=>({...a,[d.id]:d}),{}):null;return{itemsArr:u,items:t,isFetching:s.isFetching,hasCompleted:s.hasCompleted}}function k(e,c,r){const i=r??(t=>typeof t=="object"?t.id:t),{fetchItems:s,...u}=y({getRequest:c,_getKey:r});return o.useEffect(()=>{e!=null&&e.length&&s(e)},[e==null?void 0:e.map(i).join(",")]),u}function y(e){var m,p;const c=e._getKey??(n=>typeof n=="object"?n.id:n),r=o.useRef(new Set),[i,s]=o.useState([]);function u(n){if(!(n!=null&&n.length))return;const h=[];n.forEach(l=>{const g=c(l);r.current.has(g)||(h.push(l),r.current.add(g))}),h.length&&s(l=>[...l,...f.chunk(h,q).map(e.getRequest)])}const t=F(i),a=f.flatten(t.data),d=t.data.length?a.reduce((n,h)=>({...n,[c(h)]:h}),{}):null;return{hasFirstRequestCompleted:!!((p=(m=t.responses)==null?void 0:m[0])!=null&&p.hasCompleted),itemsArr:a,items:d,isFetching:t.isFetching,fetchItems:u}}export{I as a,y as b,k as u};
//# sourceMappingURL=BAuuQuuB.chunk.js.map
