import { a as e } from "./dist-DCjaNViz.js";
import { o as t, r as n } from "./dist-D-6_qntS.js";
import r from "react";
import { jsx as i } from "react/jsx-runtime";
//#region node_modules/@radix-ui/react-collection/dist/index.mjs
function a(a) {
	let o = a + "CollectionProvider", [s, c] = e(o), [l, u] = s(o, {
		collectionRef: { current: null },
		itemMap: /* @__PURE__ */ new Map()
	}), d = (e) => {
		let { scope: t, children: n } = e, a = r.useRef(null), o = r.useRef(/* @__PURE__ */ new Map()).current;
		return /* @__PURE__ */ i(l, {
			scope: t,
			itemMap: o,
			collectionRef: a,
			children: n
		});
	};
	d.displayName = o;
	let f = a + "CollectionSlot", p = n(f), m = r.forwardRef((e, n) => {
		let { scope: r, children: a } = e;
		return /* @__PURE__ */ i(p, {
			ref: t(n, u(f, r).collectionRef),
			children: a
		});
	});
	m.displayName = f;
	let h = a + "CollectionItemSlot", g = "data-radix-collection-item", _ = n(h), v = r.forwardRef((e, n) => {
		let { scope: a, children: o, ...s } = e, c = r.useRef(null), l = t(n, c), d = u(h, a);
		return r.useEffect(() => (d.itemMap.set(c, {
			ref: c,
			...s
		}), () => void d.itemMap.delete(c))), /* @__PURE__ */ i(_, {
			[g]: "",
			ref: l,
			children: o
		});
	});
	v.displayName = h;
	function y(e) {
		let t = u(a + "CollectionConsumer", e);
		return r.useCallback(() => {
			let e = t.collectionRef.current;
			if (!e) return [];
			let n = Array.from(e.querySelectorAll(`[${g}]`));
			return Array.from(t.itemMap.values()).sort((e, t) => n.indexOf(e.ref.current) - n.indexOf(t.ref.current));
		}, [t.collectionRef, t.itemMap]);
	}
	return [
		{
			Provider: d,
			Slot: m,
			ItemSlot: v
		},
		y,
		c
	];
}
//#endregion
export { a as t };

//# sourceMappingURL=dist-DjSP8Xx2.js.map