"use strict";const u=require("./main-2qH2bggR.cjs"),n=require("react"),y=require("./useKeysData-G9Mk3mA6.cjs");require("./css-CmXY6iPo.cjs");require("./jsx-runtime-CITbqOLs.cjs");const C=require("./eraser-C1jjA5cv.cjs");require("react-dom");const d=({retrieve:r,pageSize:e=10})=>{const c=n.useCallback(()=>{r(({offset:o=-e,searchTerm:a="",...m})=>({...m,offset:o+e,limit:e,searchTerm:a}),{mode:"append"})},[r,e]),l=n.useCallback(o=>r(a=>({...a,searchTerm:o,offset:0,limit:e})),[r,e]);return{fetchMore:c,search:l}},h=({first:r,second:e})=>{const c=n.useMemo(()=>[...r.data,...e.data],[r.data,e.data]),l=n.useCallback(a=>r.getItem?.(a)??e.getItem?.(a),[r.getItem,e.getItem]),o=n.useCallback((a,m)=>{const f=r.subscribe?.(a,m),I=e.subscribe?.(a,m);return()=>{f?.(),I?.()}},[r.subscribe,e.subscribe]);return{data:c,getItem:l,subscribe:o}},k=({initialData:r}={})=>{const e=u.useInitializerRef(()=>{const t=new Map;return r==null||r.forEach(s=>t.set(s.key,s)),t}),c=u.useInitializerRef(()=>new Map),l=n.useCallback(t=>{const s=new Set(t);c.current.forEach((i,b)=>{s.has(i)&&b()})},[]),o=n.useCallback(t=>{const s=C.t.toArray(t),i=s.map(b=>b.key);s.forEach(b=>e.current.set(b.key,b)),l(i)},[]),a=n.useCallback(t=>{const s=C.t.toArray(t);s.forEach(i=>e.current.delete(i)),l(s)},[]),m=n.useCallback((t,s)=>s==null?()=>{}:(c.current.set(t,s),()=>{c.current.delete(t)}),[c]),f=n.useCallback(t=>{if(t!=null)return Array.isArray(t)?t.map(s=>e.current.get(s)).filter(s=>s!=null):e.current.get(t)},[]),I=n.useCallback(t=>e.current.has(t),[]);return{setItem:o,deleteItem:a,subscribe:m,getItem:f,hasItem:I}},D=Object.freeze(Object.defineProperty({__proto__:null,CoreFrame:u.CoreFrame,Frame:u.Frame$2,Item:u.Item,Items:u.Items,useCombinedData:h,useData:u.useData,useItem:u.useItem,useKeysData:y.useKeysData,useMapData:k,usePager:d,useScroller:u.useScroller,useStaticData:u.useStaticData,useUtilContext:u.useUtilContext},Symbol.toStringTag,{value:"Module"}));exports.external=D;exports.usePager=d;
