import * as e from "react";
import { jsx as t } from "react/jsx-runtime";
//#region node_modules/@radix-ui/react-context/dist/index.mjs
function n(n, r) {
	let i = e.createContext(r), a = (n) => {
		let { children: r, ...a } = n, o = e.useMemo(() => a, Object.values(a));
		return /* @__PURE__ */ t(i.Provider, {
			value: o,
			children: r
		});
	};
	a.displayName = n + "Provider";
	function o(t) {
		let a = e.useContext(i);
		if (a) return a;
		if (r !== void 0) return r;
		throw Error(`\`${t}\` must be used within \`${n}\``);
	}
	return [a, o];
}
function r(n, r = []) {
	let a = [];
	function o(r, i) {
		let o = e.createContext(i), s = a.length;
		a = [...a, i];
		let c = (r) => {
			let { scope: i, children: a, ...c } = r, l = i?.[n]?.[s] || o, u = e.useMemo(() => c, Object.values(c));
			return /* @__PURE__ */ t(l.Provider, {
				value: u,
				children: a
			});
		};
		c.displayName = r + "Provider";
		function l(t, a) {
			let c = a?.[n]?.[s] || o, l = e.useContext(c);
			if (l) return l;
			if (i !== void 0) return i;
			throw Error(`\`${t}\` must be used within \`${r}\``);
		}
		return [c, l];
	}
	let s = () => {
		let t = a.map((t) => e.createContext(t));
		return function(r) {
			let i = r?.[n] || t;
			return e.useMemo(() => ({ [`__scope${n}`]: {
				...r,
				[n]: i
			} }), [r, i]);
		};
	};
	return s.scopeName = n, [o, i(s, ...r)];
}
function i(...t) {
	let n = t[0];
	if (t.length === 1) return n;
	let r = () => {
		let r = t.map((e) => ({
			useScope: e(),
			scopeName: e.scopeName
		}));
		return function(t) {
			let i = r.reduce((e, { useScope: n, scopeName: r }) => {
				let i = n(t)[`__scope${r}`];
				return {
					...e,
					...i
				};
			}, {});
			return e.useMemo(() => ({ [`__scope${n.scopeName}`]: i }), [i]);
		};
	};
	return r.scopeName = n.scopeName, r;
}
typeof window < "u" && window.document && window.document.createElement;
function a(e, t, { checkForDefaultPrevented: n = !0 } = {}) {
	return function(r) {
		if (e?.(r), n === !1 || !r.defaultPrevented) return t?.(r);
	};
}
//#endregion
//#region node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs
var o = globalThis?.document ? e.useLayoutEffect : () => {}, s = e.useInsertionEffect || o;
function c({ prop: t, defaultProp: n, onChange: r = () => {}, caller: i }) {
	let [a, o, s] = l({
		defaultProp: n,
		onChange: r
	}), c = t !== void 0, d = c ? t : a;
	{
		let n = e.useRef(t !== void 0);
		e.useEffect(() => {
			let e = n.current;
			e !== c && console.warn(`${i} is changing from ${e ? "controlled" : "uncontrolled"} to ${c ? "controlled" : "uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`), n.current = c;
		}, [c, i]);
	}
	return [d, e.useCallback((e) => {
		if (c) {
			let n = u(e) ? e(t) : e;
			n !== t && s.current?.(n);
		} else o(e);
	}, [
		c,
		t,
		o,
		s
	])];
}
function l({ defaultProp: t, onChange: n }) {
	let [r, i] = e.useState(t), a = e.useRef(r), o = e.useRef(n);
	return s(() => {
		o.current = n;
	}, [n]), e.useEffect(() => {
		a.current !== r && (o.current?.(r), a.current = r);
	}, [r, a]), [
		r,
		i,
		o
	];
}
function u(e) {
	return typeof e == "function";
}
//#endregion
export { r as a, n as i, o as n, a as r, c as t };

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