import { n as e } from "./dist-DCjaNViz.js";
import { o as t } from "./dist-D-6_qntS.js";
import * as n from "react";
//#region node_modules/@radix-ui/react-presence/dist/index.mjs
function r(e, t) {
	return n.useReducer((e, n) => t[e][n] ?? e, e);
}
var i = (e) => {
	let { present: r, children: i } = e, o = a(r), c = typeof i == "function" ? i({ present: o.isPresent }) : n.Children.only(i), l = t(o.ref, s(c));
	return typeof i == "function" || o.isPresent ? n.cloneElement(c, { ref: l }) : null;
};
i.displayName = "Presence";
function a(t) {
	let [i, a] = n.useState(), s = n.useRef(null), c = n.useRef(t), l = n.useRef("none"), [u, d] = r(t ? "mounted" : "unmounted", {
		mounted: {
			UNMOUNT: "unmounted",
			ANIMATION_OUT: "unmountSuspended"
		},
		unmountSuspended: {
			MOUNT: "mounted",
			ANIMATION_END: "unmounted"
		},
		unmounted: { MOUNT: "mounted" }
	});
	return n.useEffect(() => {
		let e = o(s.current);
		l.current = u === "mounted" ? e : "none";
	}, [u]), e(() => {
		let e = s.current, n = c.current;
		if (n !== t) {
			let r = l.current, i = o(e);
			t ? d("MOUNT") : i === "none" || e?.display === "none" ? d("UNMOUNT") : d(n && r !== i ? "ANIMATION_OUT" : "UNMOUNT"), c.current = t;
		}
	}, [t, d]), e(() => {
		if (i) {
			let e, t = i.ownerDocument.defaultView ?? window, n = (n) => {
				let r = o(s.current).includes(CSS.escape(n.animationName));
				if (n.target === i && r && (d("ANIMATION_END"), !c.current)) {
					let n = i.style.animationFillMode;
					i.style.animationFillMode = "forwards", e = t.setTimeout(() => {
						i.style.animationFillMode === "forwards" && (i.style.animationFillMode = n);
					});
				}
			}, r = (e) => {
				e.target === i && (l.current = o(s.current));
			};
			return i.addEventListener("animationstart", r), i.addEventListener("animationcancel", n), i.addEventListener("animationend", n), () => {
				t.clearTimeout(e), i.removeEventListener("animationstart", r), i.removeEventListener("animationcancel", n), i.removeEventListener("animationend", n);
			};
		} else d("ANIMATION_END");
	}, [i, d]), {
		isPresent: ["mounted", "unmountSuspended"].includes(u),
		ref: n.useCallback((e) => {
			s.current = e ? getComputedStyle(e) : null, a(e);
		}, [])
	};
}
function o(e) {
	return e?.animationName || "none";
}
function s(e) {
	let t = Object.getOwnPropertyDescriptor(e.props, "ref")?.get, n = t && "isReactWarning" in t && t.isReactWarning;
	return n ? e.ref : (t = Object.getOwnPropertyDescriptor(e, "ref")?.get, n = t && "isReactWarning" in t && t.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
}
//#endregion
export { i as t };

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