import { t as e } from "../../utils-B7XIe3qq.js";
import * as t from "react";
import { jsx as n } from "react/jsx-runtime";
//#region src/react/primitives/hover-card.tsx
var r = t.createContext({
	open: !1,
	openDelay: 300,
	closeDelay: 200,
	onOpenChange: () => {}
});
function i({ children: e, openDelay: i = 300, closeDelay: a = 200, open: o, onOpenChange: s }) {
	let [c, l] = t.useState(!1), u = o !== void 0, d = u ? o : c, f = u ? s ?? (() => {}) : l, p = t.useMemo(() => ({
		open: d,
		openDelay: i,
		closeDelay: a,
		onOpenChange: f
	}), [
		d,
		i,
		a,
		f
	]);
	return /* @__PURE__ */ n(r.Provider, {
		value: p,
		children: e
	});
}
function a({ className: i, children: a, ...o }) {
	let { openDelay: s, closeDelay: c, onOpenChange: l } = t.useContext(r), u = t.useRef(null), d = t.useRef(null), f = t.useCallback(() => {
		d.current !== null && (clearTimeout(d.current), d.current = null), u.current = setTimeout(() => {
			l(!0);
		}, s);
	}, [s, l]), p = t.useCallback(() => {
		u.current !== null && (clearTimeout(u.current), u.current = null), d.current = setTimeout(() => {
			l(!1);
		}, c);
	}, [c, l]);
	return t.useEffect(() => () => {
		u.current !== null && clearTimeout(u.current), d.current !== null && clearTimeout(d.current);
	}, []), /* @__PURE__ */ n("div", {
		"data-slot": "hover-card-trigger",
		"aria-haspopup": "dialog",
		onMouseEnter: f,
		onMouseLeave: p,
		className: e("inline-block", i),
		...o,
		children: a
	});
}
function o({ className: i, side: a = "bottom", align: o = "center", children: s, ...c }) {
	let { open: l, closeDelay: u, onOpenChange: d } = t.useContext(r), f = t.useRef(null), p = t.useCallback(() => {
		f.current !== null && (clearTimeout(f.current), f.current = null), d(!0);
	}, [d]), m = t.useCallback(() => {
		f.current = setTimeout(() => {
			d(!1);
		}, u);
	}, [u, d]);
	return t.useEffect(() => () => {
		f.current !== null && clearTimeout(f.current);
	}, []), l ? /* @__PURE__ */ n("div", {
		"data-slot": "hover-card-content",
		role: "dialog",
		onMouseEnter: p,
		onMouseLeave: m,
		className: e("absolute z-50 w-64 rounded-xl border border-border-glass bg-glass p-4 shadow-xl backdrop-blur-xl", "animate-in fade-in-0 zoom-in-95", a === "top" && "bottom-full mb-2", a === "bottom" && "top-full mt-2", o === "start" && "left-0", o === "center" && "left-1/2 -translate-x-1/2", o === "end" && "right-0", i),
		...c,
		children: s
	}) : null;
}
//#endregion
export { i as HoverCard, o as HoverCardContent, a as HoverCardTrigger };

//# sourceMappingURL=hover-card.js.map