import { n as e, r as t } from "./dist-DCjaNViz.js";
import { n, o as r, t as i } from "./dist-D-6_qntS.js";
import { t as a } from "./dist-C-DOdUAW.js";
import * as o from "react";
import { jsx as s } from "react/jsx-runtime";
import c from "react-dom";
//#region node_modules/@radix-ui/react-use-escape-keydown/dist/index.mjs
function l(e, t = globalThis?.document) {
	let n = a(e);
	o.useEffect(() => {
		let e = (e) => {
			e.key === "Escape" && n(e);
		};
		return t.addEventListener("keydown", e, { capture: !0 }), () => t.removeEventListener("keydown", e, { capture: !0 });
	}, [n, t]);
}
//#endregion
//#region node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs
var u = "DismissableLayer", d = "dismissableLayer.update", f = "dismissableLayer.pointerDownOutside", p = "dismissableLayer.focusOutside", m, h = o.createContext({
	layers: /* @__PURE__ */ new Set(),
	layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
	branches: /* @__PURE__ */ new Set()
}), g = o.forwardRef((e, n) => {
	let { disableOutsidePointerEvents: a = !1, onEscapeKeyDown: c, onPointerDownOutside: u, onFocusOutside: f, onInteractOutside: p, onDismiss: g, ..._ } = e, v = o.useContext(h), [S, C] = o.useState(null), w = S?.ownerDocument ?? globalThis?.document, [, T] = o.useState({}), E = r(n, (e) => C(e)), D = Array.from(v.layers), [O] = [...v.layersWithOutsidePointerEventsDisabled].slice(-1), k = D.indexOf(O), A = S ? D.indexOf(S) : -1, j = v.layersWithOutsidePointerEventsDisabled.size > 0, M = A >= k, N = y((e) => {
		let t = e.target, n = [...v.branches].some((e) => e.contains(t));
		!M || n || (u?.(e), p?.(e), e.defaultPrevented || g?.());
	}, w), P = b((e) => {
		let t = e.target;
		[...v.branches].some((e) => e.contains(t)) || (f?.(e), p?.(e), e.defaultPrevented || g?.());
	}, w);
	return l((e) => {
		A === v.layers.size - 1 && (c?.(e), !e.defaultPrevented && g && (e.preventDefault(), g()));
	}, w), o.useEffect(() => {
		if (S) return a && (v.layersWithOutsidePointerEventsDisabled.size === 0 && (m = w.body.style.pointerEvents, w.body.style.pointerEvents = "none"), v.layersWithOutsidePointerEventsDisabled.add(S)), v.layers.add(S), x(), () => {
			a && v.layersWithOutsidePointerEventsDisabled.size === 1 && (w.body.style.pointerEvents = m);
		};
	}, [
		S,
		w,
		a,
		v
	]), o.useEffect(() => () => {
		S && (v.layers.delete(S), v.layersWithOutsidePointerEventsDisabled.delete(S), x());
	}, [S, v]), o.useEffect(() => {
		let e = () => T({});
		return document.addEventListener(d, e), () => document.removeEventListener(d, e);
	}, []), /* @__PURE__ */ s(i.div, {
		..._,
		ref: E,
		style: {
			pointerEvents: j ? M ? "auto" : "none" : void 0,
			...e.style
		},
		onFocusCapture: t(e.onFocusCapture, P.onFocusCapture),
		onBlurCapture: t(e.onBlurCapture, P.onBlurCapture),
		onPointerDownCapture: t(e.onPointerDownCapture, N.onPointerDownCapture)
	});
});
g.displayName = u;
var _ = "DismissableLayerBranch", v = o.forwardRef((e, t) => {
	let n = o.useContext(h), a = o.useRef(null), c = r(t, a);
	return o.useEffect(() => {
		let e = a.current;
		if (e) return n.branches.add(e), () => {
			n.branches.delete(e);
		};
	}, [n.branches]), /* @__PURE__ */ s(i.div, {
		...e,
		ref: c
	});
});
v.displayName = _;
function y(e, t = globalThis?.document) {
	let n = a(e), r = o.useRef(!1), i = o.useRef(() => {});
	return o.useEffect(() => {
		let e = (e) => {
			if (e.target && !r.current) {
				let r = function() {
					S(f, n, a, { discrete: !0 });
				}, a = { originalEvent: e };
				e.pointerType === "touch" ? (t.removeEventListener("click", i.current), i.current = r, t.addEventListener("click", i.current, { once: !0 })) : r();
			} else t.removeEventListener("click", i.current);
			r.current = !1;
		}, a = window.setTimeout(() => {
			t.addEventListener("pointerdown", e);
		}, 0);
		return () => {
			window.clearTimeout(a), t.removeEventListener("pointerdown", e), t.removeEventListener("click", i.current);
		};
	}, [t, n]), { onPointerDownCapture: () => r.current = !0 };
}
function b(e, t = globalThis?.document) {
	let n = a(e), r = o.useRef(!1);
	return o.useEffect(() => {
		let e = (e) => {
			e.target && !r.current && S(p, n, { originalEvent: e }, { discrete: !1 });
		};
		return t.addEventListener("focusin", e), () => t.removeEventListener("focusin", e);
	}, [t, n]), {
		onFocusCapture: () => r.current = !0,
		onBlurCapture: () => r.current = !1
	};
}
function x() {
	let e = new CustomEvent(d);
	document.dispatchEvent(e);
}
function S(e, t, r, { discrete: i }) {
	let a = r.originalEvent.target, o = new CustomEvent(e, {
		bubbles: !1,
		cancelable: !0,
		detail: r
	});
	t && a.addEventListener(e, t, { once: !0 }), i ? n(a, o) : a.dispatchEvent(o);
}
var C = g, w = v, T = "Portal", E = o.forwardRef((t, n) => {
	let { container: r, ...a } = t, [l, u] = o.useState(!1);
	e(() => u(!0), []);
	let d = r || l && globalThis?.document?.body;
	return d ? c.createPortal(/* @__PURE__ */ s(i.div, {
		...a,
		ref: n
	}), d) : null;
});
E.displayName = T;
//#endregion
export { C as i, w as n, g as r, E as t };

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