import { a as e, n as t } from "./dist-DCjaNViz.js";
import { o as n, t as r } from "./dist-D-6_qntS.js";
import { t as i } from "./dist-CMeIjpjM.js";
import { t as a } from "./dist-C-DOdUAW.js";
import { a as o, c as s, i as c, l, n as u, o as d, r as f, s as p, t as m } from "./floating-ui.dom-mshPOzZ7.js";
import * as h from "react";
import { useLayoutEffect as g } from "react";
import { jsx as _ } from "react/jsx-runtime";
import * as v from "react-dom";
//#region node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs
var y = typeof document < "u" ? g : function() {};
function b(e, t) {
	if (e === t) return !0;
	if (typeof e != typeof t) return !1;
	if (typeof e == "function" && e.toString() === t.toString()) return !0;
	let n, r, i;
	if (e && t && typeof e == "object") {
		if (Array.isArray(e)) {
			if (n = e.length, n !== t.length) return !1;
			for (r = n; r-- !== 0;) if (!b(e[r], t[r])) return !1;
			return !0;
		}
		if (i = Object.keys(e), n = i.length, n !== Object.keys(t).length) return !1;
		for (r = n; r-- !== 0;) if (!{}.hasOwnProperty.call(t, i[r])) return !1;
		for (r = n; r-- !== 0;) {
			let n = i[r];
			if (!(n === "_owner" && e.$$typeof) && !b(e[n], t[n])) return !1;
		}
		return !0;
	}
	return e !== e && t !== t;
}
function x(e) {
	return typeof window > "u" ? 1 : (e.ownerDocument.defaultView || window).devicePixelRatio || 1;
}
function S(e, t) {
	let n = x(e);
	return Math.round(t * n) / n;
}
function C(e) {
	let t = h.useRef(e);
	return y(() => {
		t.current = e;
	}), t;
}
function ee(e) {
	e === void 0 && (e = {});
	let { placement: t = "bottom", strategy: n = "absolute", middleware: r = [], platform: i, elements: { reference: a, floating: o } = {}, transform: s = !0, whileElementsMounted: c, open: l } = e, [u, d] = h.useState({
		x: 0,
		y: 0,
		strategy: n,
		placement: t,
		middlewareData: {},
		isPositioned: !1
	}), [p, m] = h.useState(r);
	b(p, r) || m(r);
	let [g, _] = h.useState(null), [ee, w] = h.useState(null), T = h.useCallback((e) => {
		e !== k.current && (k.current = e, _(e));
	}, []), E = h.useCallback((e) => {
		e !== A.current && (A.current = e, w(e));
	}, []), D = a || g, O = o || ee, k = h.useRef(null), A = h.useRef(null), j = h.useRef(u), M = c != null, N = C(c), P = C(i), F = C(l), I = h.useCallback(() => {
		if (!k.current || !A.current) return;
		let e = {
			placement: t,
			strategy: n,
			middleware: p
		};
		P.current && (e.platform = P.current), f(k.current, A.current, e).then((e) => {
			let t = {
				...e,
				isPositioned: F.current !== !1
			};
			L.current && !b(j.current, t) && (j.current = t, v.flushSync(() => {
				d(t);
			}));
		});
	}, [
		p,
		t,
		n,
		P,
		F
	]);
	y(() => {
		l === !1 && j.current.isPositioned && (j.current.isPositioned = !1, d((e) => ({
			...e,
			isPositioned: !1
		})));
	}, [l]);
	let L = h.useRef(!1);
	y(() => (L.current = !0, () => {
		L.current = !1;
	}), []), y(() => {
		if (D && (k.current = D), O && (A.current = O), D && O) {
			if (N.current) return N.current(D, O, I);
			I();
		}
	}, [
		D,
		O,
		I,
		N,
		M
	]);
	let R = h.useMemo(() => ({
		reference: k,
		floating: A,
		setReference: T,
		setFloating: E
	}), [T, E]), z = h.useMemo(() => ({
		reference: D,
		floating: O
	}), [D, O]), B = h.useMemo(() => {
		let e = {
			position: n,
			left: 0,
			top: 0
		};
		if (!z.floating) return e;
		let t = S(z.floating, u.x), r = S(z.floating, u.y);
		return s ? {
			...e,
			transform: "translate(" + t + "px, " + r + "px)",
			...x(z.floating) >= 1.5 && { willChange: "transform" }
		} : {
			position: n,
			left: t,
			top: r
		};
	}, [
		n,
		s,
		z.floating,
		u.x,
		u.y
	]);
	return h.useMemo(() => ({
		...u,
		update: I,
		refs: R,
		elements: z,
		floatingStyles: B
	}), [
		u,
		I,
		R,
		z,
		B
	]);
}
var w = (e) => {
	function t(e) {
		return {}.hasOwnProperty.call(e, "current");
	}
	return {
		name: "arrow",
		options: e,
		fn(n) {
			let { element: r, padding: i } = typeof e == "function" ? e(n) : e;
			return r && t(r) ? r.current == null ? {} : m({
				element: r.current,
				padding: i
			}).fn(n) : r ? m({
				element: r,
				padding: i
			}).fn(n) : {};
		}
	};
}, T = (e, t) => ({
	...p(e),
	options: [e, t]
}), E = (e, t) => ({
	...s(e),
	options: [e, t]
}), D = (e, t) => ({
	...d(e),
	options: [e, t]
}), O = (e, t) => ({
	...c(e),
	options: [e, t]
}), k = (e, t) => ({
	...l(e),
	options: [e, t]
}), A = (e, t) => ({
	...o(e),
	options: [e, t]
}), j = (e, t) => ({
	...w(e),
	options: [e, t]
}), M = "Arrow", N = h.forwardRef((e, t) => {
	let { children: n, width: i = 10, height: a = 5, ...o } = e;
	return /* @__PURE__ */ _(r.svg, {
		...o,
		ref: t,
		width: i,
		height: a,
		viewBox: "0 0 30 10",
		preserveAspectRatio: "none",
		children: e.asChild ? n : /* @__PURE__ */ _("polygon", { points: "0,0 30,0 15,10" })
	});
});
N.displayName = M;
var P = N, F = "Popper", [I, L] = e(F), [R, z] = I(F), B = (e) => {
	let { __scopePopper: t, children: n } = e, [r, i] = h.useState(null);
	return /* @__PURE__ */ _(R, {
		scope: t,
		anchor: r,
		onAnchorChange: i,
		children: n
	});
};
B.displayName = F;
var V = "PopperAnchor", H = h.forwardRef((e, t) => {
	let { __scopePopper: i, virtualRef: a, ...o } = e, s = z(V, i), c = h.useRef(null), l = n(t, c), u = h.useRef(null);
	return h.useEffect(() => {
		let e = u.current;
		u.current = a?.current || c.current, e !== u.current && s.onAnchorChange(u.current);
	}), a ? null : /* @__PURE__ */ _(r.div, {
		...o,
		ref: l
	});
});
H.displayName = V;
var U = "PopperContent", [te, W] = I(U), G = h.forwardRef((e, o) => {
	let { __scopePopper: s, side: c = "bottom", sideOffset: l = 0, align: d = "center", alignOffset: f = 0, arrowPadding: p = 0, avoidCollisions: m = !0, collisionBoundary: g = [], collisionPadding: v = 0, sticky: y = "partial", hideWhenDetached: b = !1, updatePositionStrategy: x = "optimized", onPlaced: S, ...C } = e, w = z(U, s), [M, N] = h.useState(null), P = n(o, (e) => N(e)), [F, I] = h.useState(null), L = i(F), R = L?.width ?? 0, B = L?.height ?? 0, V = c + (d === "center" ? "" : "-" + d), H = typeof v == "number" ? v : {
		top: 0,
		right: 0,
		bottom: 0,
		left: 0,
		...v
	}, W = Array.isArray(g) ? g : [g], G = W.length > 0, K = {
		padding: H,
		boundary: W.filter(ne),
		altBoundary: G
	}, { refs: q, floatingStyles: J, placement: X, isPositioned: Z, middlewareData: Q } = ee({
		strategy: "fixed",
		placement: V,
		whileElementsMounted: (...e) => u(...e, { animationFrame: x === "always" }),
		elements: { reference: w.anchor },
		middleware: [
			T({
				mainAxis: l + B,
				alignmentAxis: f
			}),
			m && E({
				mainAxis: !0,
				crossAxis: !1,
				limiter: y === "partial" ? D() : void 0,
				...K
			}),
			m && O({ ...K }),
			k({
				...K,
				apply: ({ elements: e, rects: t, availableWidth: n, availableHeight: r }) => {
					let { width: i, height: a } = t.reference, o = e.floating.style;
					o.setProperty("--radix-popper-available-width", `${n}px`), o.setProperty("--radix-popper-available-height", `${r}px`), o.setProperty("--radix-popper-anchor-width", `${i}px`), o.setProperty("--radix-popper-anchor-height", `${a}px`);
				}
			}),
			F && j({
				element: F,
				padding: p
			}),
			re({
				arrowWidth: R,
				arrowHeight: B
			}),
			b && A({
				strategy: "referenceHidden",
				...K
			})
		]
	}), [$, ie] = Y(X), ae = a(S);
	t(() => {
		Z && ae?.();
	}, [Z, ae]);
	let oe = Q.arrow?.x, se = Q.arrow?.y, ce = Q.arrow?.centerOffset !== 0, [le, ue] = h.useState();
	return t(() => {
		M && ue(window.getComputedStyle(M).zIndex);
	}, [M]), /* @__PURE__ */ _("div", {
		ref: q.setFloating,
		"data-radix-popper-content-wrapper": "",
		style: {
			...J,
			transform: Z ? J.transform : "translate(0, -200%)",
			minWidth: "max-content",
			zIndex: le,
			"--radix-popper-transform-origin": [Q.transformOrigin?.x, Q.transformOrigin?.y].join(" "),
			...Q.hide?.referenceHidden && {
				visibility: "hidden",
				pointerEvents: "none"
			}
		},
		dir: e.dir,
		children: /* @__PURE__ */ _(te, {
			scope: s,
			placedSide: $,
			onArrowChange: I,
			arrowX: oe,
			arrowY: se,
			shouldHideArrow: ce,
			children: /* @__PURE__ */ _(r.div, {
				"data-side": $,
				"data-align": ie,
				...C,
				ref: P,
				style: {
					...C.style,
					animation: Z ? void 0 : "none"
				}
			})
		})
	});
});
G.displayName = U;
var K = "PopperArrow", q = {
	top: "bottom",
	right: "left",
	bottom: "top",
	left: "right"
}, J = h.forwardRef(function(e, t) {
	let { __scopePopper: n, ...r } = e, i = W(K, n), a = q[i.placedSide];
	return /* @__PURE__ */ _("span", {
		ref: i.onArrowChange,
		style: {
			position: "absolute",
			left: i.arrowX,
			top: i.arrowY,
			[a]: 0,
			transformOrigin: {
				top: "",
				right: "0 0",
				bottom: "center 0",
				left: "100% 0"
			}[i.placedSide],
			transform: {
				top: "translateY(100%)",
				right: "translateY(50%) rotate(90deg) translateX(-50%)",
				bottom: "rotate(180deg)",
				left: "translateY(50%) rotate(-90deg) translateX(50%)"
			}[i.placedSide],
			visibility: i.shouldHideArrow ? "hidden" : void 0
		},
		children: /* @__PURE__ */ _(P, {
			...r,
			ref: t,
			style: {
				...r.style,
				display: "block"
			}
		})
	});
});
J.displayName = K;
function ne(e) {
	return e !== null;
}
var re = (e) => ({
	name: "transformOrigin",
	options: e,
	fn(t) {
		let { placement: n, rects: r, middlewareData: i } = t, a = i.arrow?.centerOffset !== 0, o = a ? 0 : e.arrowWidth, s = a ? 0 : e.arrowHeight, [c, l] = Y(n), u = {
			start: "0%",
			center: "50%",
			end: "100%"
		}[l], d = (i.arrow?.x ?? 0) + o / 2, f = (i.arrow?.y ?? 0) + s / 2, p = "", m = "";
		return c === "bottom" ? (p = a ? u : `${d}px`, m = `${-s}px`) : c === "top" ? (p = a ? u : `${d}px`, m = `${r.floating.height + s}px`) : c === "right" ? (p = `${-s}px`, m = a ? u : `${f}px`) : c === "left" && (p = `${r.floating.width + s}px`, m = a ? u : `${f}px`), { data: {
			x: p,
			y: m
		} };
	}
});
function Y(e) {
	let [t, n = "center"] = e.split("-");
	return [t, n];
}
var X = B, Z = H, Q = G, $ = J;
//#endregion
export { L as a, X as i, $ as n, Q as r, Z as t };

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