import { ag as I, ah as d, ai as h, aj as y, ak as A, al as S, am as M, an as C, ao as D, ap as E, aq as _, ar as j, as as w, at as x } from "./main-BINuQ9na.js";
import { useMemo as p, useCallback as n } from "react";
import { u as G } from "./useKeysData-DXXVQfXZ.js";
import { a as g } from "./css-BYwooBtA.js";
import "./jsx-runtime-OVHDjVDe.js";
import "./provider-CKYgKu3z.js";
import "react-dom";
const R = ({
  first: s,
  second: r
}) => {
  const o = p(
    () => [...s.data, ...r.data],
    [s.data, r.data]
  ), i = n(
    (a) => {
      if (Array.isArray(a)) {
        const u = s.getItem?.(a) ?? [], c = r.getItem?.(a) ?? [];
        return [...u, ...c];
      }
      return s.getItem?.(a) ?? r.getItem?.(a);
    },
    [s.getItem, r.getItem]
  ), l = n(
    (a, u) => {
      const c = s.subscribe?.(a, u), f = r.subscribe?.(a, u);
      return () => {
        c?.(), f?.();
      };
    },
    [s.subscribe, r.subscribe]
  );
  return p(() => ({ data: o, getItem: i, subscribe: l }), [o, i, l]);
}, U = ({ initialData: s } = {}) => {
  const r = I(() => {
    const t = /* @__PURE__ */ new Map();
    return s == null || s.forEach((e) => t.set(e.key, e)), t;
  }), o = I(() => /* @__PURE__ */ new Map()), i = n((t) => {
    const e = new Set(t);
    o.current.forEach((b, m) => {
      e.has(b) && m();
    });
  }, []), l = n((t) => {
    const e = g.toArray(t), b = e.map((m) => m.key);
    e.forEach((m) => r.current.set(m.key, m)), i(b);
  }, []), a = n((t) => {
    const e = g.toArray(t);
    e.forEach((b) => r.current.delete(b)), i(e);
  }, []), u = n(
    (t, e) => e == null ? () => {
    } : (o.current.set(t, e), () => {
      o.current.delete(t);
    }),
    [o]
  ), c = n(
    ((t) => {
      if (t != null)
        return Array.isArray(t) ? t.map((e) => r.current.get(e)).filter((e) => e != null) : r.current.get(t);
    }),
    []
  ), f = n((t) => r.current.has(t), []);
  return p(
    () => ({ setItem: l, deleteItem: a, subscribe: u, getItem: c, hasItem: f }),
    [l, a, u, c, f]
  );
}, L = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  CoreFrame: d,
  Frame: h,
  Item: y,
  Items: A,
  createGetItem: S,
  page: M,
  search: C,
  useCombinedData: R,
  useData: D,
  useItem: E,
  useKeysData: G,
  useMapData: U,
  usePager: _,
  useScroller: j,
  useStaticData: w,
  useUtilContext: x
}, Symbol.toStringTag, { value: "Module" }));
export {
  L as e
};
