"use strict";const l=require("./Items-DNcTFEUJ.cjs"),n=require("react"),h=require("./css-HnNQMUzV.cjs"),d=require("./Editable-BXFY3-UW.cjs");require("./Text-DECnk5vG.cjs");require("./jsx-runtime-Dszzpdy0.cjs");require("./types-D-yz1qsT.cjs");require("./Box-BvqALodh.cjs");require("./Provider-575hnWmi.cjs");require("./provider-lNhTlIWj.cjs");const M=require("./useStaticData-BTwIe0Il.cjs"),C=10,g=({offset:e,searchTerm:t="",...s},c=C)=>({...s,offset:(e??-c)+c,limit:c,searchTerm:t}),q=(e,t,s=C)=>({...e,searchTerm:t,offset:0,limit:s}),y=({retrieve:e,pageSize:t=C})=>{const s=n.useCallback(()=>{e(o=>g(o,t),{mode:"append"})},[e,t]),c=n.useCallback(o=>e(u=>q(u,o,t)),[e,t]);return n.useMemo(()=>({fetchMore:s,search:c}),[s,c])},D=({first:e,second:t})=>{const s=n.useMemo(()=>[...e.data,...t.data],[e.data,t.data]),c=n.useCallback(u=>{if(Array.isArray(u)){const m=e.getItem?.(u)??[],i=t.getItem?.(u)??[];return[...m,...i]}return e.getItem?.(u)??t.getItem?.(u)},[e.getItem,t.getItem]),o=n.useCallback((u,m)=>{const i=e.subscribe?.(u,m),f=t.subscribe?.(u,m);return()=>{i?.(),f?.()}},[e.subscribe,t.subscribe]);return n.useMemo(()=>({data:s,getItem:c,subscribe:o}),[s,c,o])},A=e=>{const t=n.useCallback((s=>{if(Array.isArray(s)){const o=new Set(s);return e.filter(u=>o.has(u)).map(u=>({key:u}))}const c=e.find(o=>o===s);return c?{key:c}:void 0}),[e]);return n.useMemo(()=>({data:e,getItem:t}),[e,t])},E=({initialData:e}={})=>{const t=d.useInitializerRef(()=>{const r=new Map;return e==null||e.forEach(a=>r.set(a.key,a)),r}),s=d.useInitializerRef(()=>new Map),c=n.useCallback(r=>{const a=new Set(r);s.current.forEach((I,b)=>{a.has(I)&&b()})},[]),o=n.useCallback(r=>{const a=h.a.toArray(r),I=a.map(b=>b.key);a.forEach(b=>t.current.set(b.key,b)),c(I)},[]),u=n.useCallback(r=>{const a=h.a.toArray(r);a.forEach(I=>t.current.delete(I)),c(a)},[]),m=n.useCallback((r,a)=>a==null?()=>{}:(s.current.set(r,a),()=>{s.current.delete(r)}),[s]),i=n.useCallback((r=>{if(r!=null)return Array.isArray(r)?r.map(a=>t.current.get(a)).filter(a=>a!=null):t.current.get(r)}),[]),f=n.useCallback(r=>t.current.has(r),[]);return n.useMemo(()=>({setItem:o,deleteItem:u,subscribe:m,getItem:i,hasItem:f}),[o,u,m,i,f])},k=Object.freeze(Object.defineProperty({__proto__:null,CoreFrame:l.CoreFrame,Frame:l.Frame,Item:l.Item,Items:l.Items,createGetItem:l.createGetItem,page:g,search:q,useCombinedData:D,useData:l.useData,useItem:l.useItem,useKeysData:A,useMapData:E,usePager:y,useScroller:l.useScroller,useStaticData:M.useStaticData,useUtilContext:l.useUtilContext},Symbol.toStringTag,{value:"Module"}));exports.external=k;exports.useKeysData=A;exports.usePager=y;
