UNPKG

@stihl-design-system/components

Version:

Welcome to the STIHL Design System react component library.

1,794 lines (1,793 loc) 89.3 kB
"use client"; import * as f from "react"; import { useLayoutEffect as En } from "react"; import { jsxs as It, jsx as re, Fragment as Gn } from "react/jsx-runtime"; import * as kt from "react-dom"; function it() { return typeof window < "u"; } function xe(e) { return Dt(e) ? (e.nodeName || "").toLowerCase() : "#document"; } function ee(e) { var t; return (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) || window; } function le(e) { var t; return (t = (Dt(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : t.documentElement; } function Dt(e) { return it() ? e instanceof Node || e instanceof ee(e).Node : !1; } function K(e) { return it() ? e instanceof Element || e instanceof ee(e).Element : !1; } function X(e) { return it() ? e instanceof HTMLElement || e instanceof ee(e).HTMLElement : !1; } function Ge(e) { return !it() || typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof ee(e).ShadowRoot; } function Be(e) { const { overflow: t, overflowX: n, overflowY: r, display: o } = oe(e); return /auto|scroll|overlay|hidden|clip/.test(t + r + n) && o !== "inline" && o !== "contents"; } function Zn(e) { return /^(table|td|th)$/.test(xe(e)); } function st(e) { try { if (e.matches(":popover-open")) return !0; } catch { } try { return e.matches(":modal"); } catch { return !1; } } const Jn = /transform|translate|scale|rotate|perspective|filter/, Qn = /paint|layout|strict|content/, Te = (e) => !!e && e !== "none"; let pt; function Ft(e) { const t = K(e) ? oe(e) : e; return Te(t.transform) || Te(t.translate) || Te(t.scale) || Te(t.rotate) || Te(t.perspective) || !ct() && (Te(t.backdropFilter) || Te(t.filter)) || Jn.test(t.willChange || "") || Qn.test(t.contain || ""); } function er(e) { let t = ge(e); for (; X(t) && !me(t); ) { if (Ft(t)) return t; if (st(t)) return null; t = ge(t); } return null; } function ct() { return pt == null && (pt = typeof CSS < "u" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none")), pt; } function me(e) { return /^(html|body|#document)$/.test(xe(e)); } function oe(e) { return ee(e).getComputedStyle(e); } function ut(e) { return K(e) ? { scrollLeft: e.scrollLeft, scrollTop: e.scrollTop } : { scrollLeft: e.scrollX, scrollTop: e.scrollY }; } function ge(e) { if (xe(e) === "html") return e; const t = ( // Step into the shadow DOM of the parent of a slotted node. e.assignedSlot || // DOM Element detected. e.parentNode || // ShadowRoot detected. Ge(e) && e.host || // Fallback. le(e) ); return Ge(t) ? t.host : t; } function Tn(e) { const t = ge(e); return me(t) ? e.ownerDocument ? e.ownerDocument.body : e.body : X(t) && Be(t) ? t : Tn(t); } function Re(e, t, n) { var r; t === void 0 && (t = []), n === void 0 && (n = !0); const o = Tn(e), i = o === ((r = e.ownerDocument) == null ? void 0 : r.body), s = ee(o); if (i) { const c = Ct(s); return t.concat(s, s.visualViewport || [], Be(o) ? o : [], c && n ? Re(c) : []); } else return t.concat(o, Re(o, [], n)); } function Ct(e) { return e.parent && Object.getPrototypeOf(e.parent) ? e.frameElement : null; } const De = Math.min, Se = Math.max, Ze = Math.round, qe = Math.floor, ue = (e) => ({ x: e, y: e }), tr = { left: "right", right: "left", bottom: "top", top: "bottom" }; function St(e, t, n) { return Se(e, De(t, n)); } function _e(e, t) { return typeof e == "function" ? e(t) : e; } function Ae(e) { return e.split("-")[0]; } function Ve(e) { return e.split("-")[1]; } function Cn(e) { return e === "x" ? "y" : "x"; } function Nt(e) { return e === "y" ? "height" : "width"; } function ye(e) { const t = e[0]; return t === "t" || t === "b" ? "y" : "x"; } function Wt(e) { return Cn(ye(e)); } function nr(e, t, n) { n === void 0 && (n = !1); const r = Ve(e), o = Wt(e), i = Nt(o); let s = o === "x" ? r === (n ? "end" : "start") ? "right" : "left" : r === "start" ? "bottom" : "top"; return t.reference[i] > t.floating[i] && (s = Je(s)), [s, Je(s)]; } function rr(e) { const t = Je(e); return [At(e), t, At(t)]; } function At(e) { return e.includes("start") ? e.replace("start", "end") : e.replace("end", "start"); } const qt = ["left", "right"], Ut = ["right", "left"], or = ["top", "bottom"], ir = ["bottom", "top"]; function sr(e, t, n) { switch (e) { case "top": case "bottom": return n ? t ? Ut : qt : t ? qt : Ut; case "left": case "right": return t ? or : ir; default: return []; } } function cr(e, t, n, r) { const o = Ve(e); let i = sr(Ae(e), n === "start", r); return o && (i = i.map((s) => s + "-" + o), t && (i = i.concat(i.map(At)))), i; } function Je(e) { const t = Ae(e); return tr[t] + e.slice(t.length); } function ur(e) { return { top: 0, right: 0, bottom: 0, left: 0, ...e }; } function Sn(e) { return typeof e != "number" ? ur(e) : { top: e, right: e, bottom: e, left: e }; } function Qe(e) { const { x: t, y: n, width: r, height: o } = e; return { width: r, height: o, top: n, left: t, right: t + r, bottom: n + o, x: t, y: n }; } var lr = ["input:not([inert])", "select:not([inert])", "textarea:not([inert])", "a[href]:not([inert])", "button:not([inert])", "[tabindex]:not(slot):not([inert])", "audio[controls]:not([inert])", "video[controls]:not([inert])", '[contenteditable]:not([contenteditable="false"]):not([inert])', "details>summary:first-of-type:not([inert])", "details:not([inert])"], et = /* @__PURE__ */ lr.join(","), An = typeof Element > "u", Fe = An ? function() { } : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector, tt = !An && Element.prototype.getRootNode ? function(e) { var t; return e == null || (t = e.getRootNode) === null || t === void 0 ? void 0 : t.call(e); } : function(e) { return e?.ownerDocument; }, nt = function e(t, n) { var r; n === void 0 && (n = !0); var o = t == null || (r = t.getAttribute) === null || r === void 0 ? void 0 : r.call(t, "inert"), i = o === "" || o === "true", s = i || n && t && e(t.parentNode); return s; }, ar = function(t) { var n, r = t == null || (n = t.getAttribute) === null || n === void 0 ? void 0 : n.call(t, "contenteditable"); return r === "" || r === "true"; }, On = function(t, n, r) { if (nt(t)) return []; var o = Array.prototype.slice.apply(t.querySelectorAll(et)); return n && Fe.call(t, et) && o.unshift(t), o = o.filter(r), o; }, Mn = function e(t, n, r) { for (var o = [], i = Array.from(t); i.length; ) { var s = i.shift(); if (!nt(s, !1)) if (s.tagName === "SLOT") { var c = s.assignedElements(), u = c.length ? c : s.children, a = e(u, !0, r); r.flatten ? o.push.apply(o, a) : o.push({ scopeParent: s, candidates: a }); } else { var m = Fe.call(s, et); m && r.filter(s) && (n || !t.includes(s)) && o.push(s); var g = s.shadowRoot || // check for an undisclosed shadow typeof r.getShadowRoot == "function" && r.getShadowRoot(s), v = !nt(g, !1) && (!r.shadowRootFilter || r.shadowRootFilter(s)); if (g && v) { var l = e(g === !0 ? s.children : g.children, !0, r); r.flatten ? o.push.apply(o, l) : o.push({ scopeParent: s, candidates: l }); } else i.unshift.apply(i, s.children); } } return o; }, Pn = function(t) { return !isNaN(parseInt(t.getAttribute("tabindex"), 10)); }, Ln = function(t) { if (!t) throw new Error("No node provided"); return t.tabIndex < 0 && (/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName) || ar(t)) && !Pn(t) ? 0 : t.tabIndex; }, fr = function(t, n) { var r = Ln(t); return r < 0 && n && !Pn(t) ? 0 : r; }, dr = function(t, n) { return t.tabIndex === n.tabIndex ? t.documentOrder - n.documentOrder : t.tabIndex - n.tabIndex; }, In = function(t) { return t.tagName === "INPUT"; }, mr = function(t) { return In(t) && t.type === "hidden"; }, gr = function(t) { var n = t.tagName === "DETAILS" && Array.prototype.slice.apply(t.children).some(function(r) { return r.tagName === "SUMMARY"; }); return n; }, pr = function(t, n) { for (var r = 0; r < t.length; r++) if (t[r].checked && t[r].form === n) return t[r]; }, vr = function(t) { if (!t.name) return !0; var n = t.form || tt(t), r = function(c) { return n.querySelectorAll('input[type="radio"][name="' + c + '"]'); }, o; if (typeof window < "u" && typeof window.CSS < "u" && typeof window.CSS.escape == "function") o = r(window.CSS.escape(t.name)); else try { o = r(t.name); } catch (s) { return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s", s.message), !1; } var i = pr(o, t.form); return !i || i === t; }, hr = function(t) { return In(t) && t.type === "radio"; }, br = function(t) { return hr(t) && !vr(t); }, yr = function(t) { var n, r = t && tt(t), o = (n = r) === null || n === void 0 ? void 0 : n.host, i = !1; if (r && r !== t) { var s, c, u; for (i = !!((s = o) !== null && s !== void 0 && (c = s.ownerDocument) !== null && c !== void 0 && c.contains(o) || t != null && (u = t.ownerDocument) !== null && u !== void 0 && u.contains(t)); !i && o; ) { var a, m, g; r = tt(o), o = (a = r) === null || a === void 0 ? void 0 : a.host, i = !!((m = o) !== null && m !== void 0 && (g = m.ownerDocument) !== null && g !== void 0 && g.contains(o)); } } return i; }, Xt = function(t) { var n = t.getBoundingClientRect(), r = n.width, o = n.height; return r === 0 && o === 0; }, wr = function(t, n) { var r = n.displayCheck, o = n.getShadowRoot; if (getComputedStyle(t).visibility === "hidden") return !0; var i = Fe.call(t, "details>summary:first-of-type"), s = i ? t.parentElement : t; if (Fe.call(s, "details:not([open]) *")) return !0; if (!r || r === "full" || r === "legacy-full") { if (typeof o == "function") { for (var c = t; t; ) { var u = t.parentElement, a = tt(t); if (u && !u.shadowRoot && o(u) === !0) return Xt(t); t.assignedSlot ? t = t.assignedSlot : !u && a !== t.ownerDocument ? t = a.host : t = u; } t = c; } if (yr(t)) return !t.getClientRects().length; if (r !== "legacy-full") return !0; } else if (r === "non-zero-area") return Xt(t); return !1; }, Rr = function(t) { if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName)) for (var n = t.parentElement; n; ) { if (n.tagName === "FIELDSET" && n.disabled) { for (var r = 0; r < n.children.length; r++) { var o = n.children.item(r); if (o.tagName === "LEGEND") return Fe.call(n, "fieldset[disabled] *") ? !0 : !o.contains(t); } return !0; } n = n.parentElement; } return !1; }, Ot = function(t, n) { return !(n.disabled || // we must do an inert look up to filter out any elements inside an inert ancestor // because we're limited in the type of selectors we can use in JSDom (see related // note related to `candidateSelectors`) nt(n) || mr(n) || wr(n, t) || // For a details element with a summary, the summary element gets the focus gr(n) || Rr(n)); }, Mt = function(t, n) { return !(br(n) || Ln(n) < 0 || !Ot(t, n)); }, xr = function(t) { var n = parseInt(t.getAttribute("tabindex"), 10); return !!(isNaN(n) || n >= 0); }, Er = function e(t) { var n = [], r = []; return t.forEach(function(o, i) { var s = !!o.scopeParent, c = s ? o.scopeParent : o, u = fr(c, s), a = s ? e(o.candidates) : c; u === 0 ? s ? n.push.apply(n, a) : n.push(c) : r.push({ documentOrder: i, tabIndex: u, item: o, isScope: s, content: a }); }), r.sort(dr).reduce(function(o, i) { return i.isScope ? o.push.apply(o, i.content) : o.push(i.content), o; }, []).concat(n); }, lt = function(t, n) { n = n || {}; var r; return n.getShadowRoot ? r = Mn([t], n.includeContainer, { filter: Mt.bind(null, n), flatten: !1, getShadowRoot: n.getShadowRoot, shadowRootFilter: xr }) : r = On(t, n.includeContainer, Mt.bind(null, n)), Er(r); }, Tr = function(t, n) { n = n || {}; var r; return n.getShadowRoot ? r = Mn([t], n.includeContainer, { filter: Ot.bind(null, n), flatten: !0, getShadowRoot: n.getShadowRoot }) : r = On(t, n.includeContainer, Ot.bind(null, n)), r; }, kn = function(t, n) { if (n = n || {}, !t) throw new Error("No node provided"); return Fe.call(t, et) === !1 ? !1 : Mt(n, t); }; function $t() { const e = navigator.userAgentData; return e != null && e.platform ? e.platform : navigator.platform; } function Dn() { const e = navigator.userAgentData; return e && Array.isArray(e.brands) ? e.brands.map((t) => { let { brand: n, version: r } = t; return n + "/" + r; }).join(" ") : navigator.userAgent; } function Fn() { return /apple/i.test(navigator.vendor); } function Pt() { const e = /android/i; return e.test($t()) || e.test(Dn()); } function Cr() { return $t().toLowerCase().startsWith("mac") && !navigator.maxTouchPoints; } function Nn() { return Dn().includes("jsdom/"); } const Yt = "data-floating-ui-focusable", Sr = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])"; function be(e) { let t = e.activeElement; for (; ((n = t) == null || (n = n.shadowRoot) == null ? void 0 : n.activeElement) != null; ) { var n; t = t.shadowRoot.activeElement; } return t; } function Z(e, t) { if (!e || !t) return !1; const n = t.getRootNode == null ? void 0 : t.getRootNode(); if (e.contains(t)) return !0; if (n && Ge(n)) { let r = t; for (; r; ) { if (e === r) return !0; r = r.parentNode || r.host; } } return !1; } function de(e) { return "composedPath" in e ? e.composedPath()[0] : e.target; } function vt(e, t) { if (t == null) return !1; if ("composedPath" in e) return e.composedPath().includes(t); const n = e; return n.target != null && t.contains(n.target); } function Ar(e) { return e.matches("html,body"); } function J(e) { return e?.ownerDocument || document; } function Bt(e) { return X(e) && e.matches(Sr); } function zt(e) { return e ? e.getAttribute("role") === "combobox" && Bt(e) : !1; } function Or(e) { if (!e || Nn()) return !0; try { return e.matches(":focus-visible"); } catch { return !0; } } function Lt(e) { return e ? e.hasAttribute(Yt) ? e : e.querySelector("[" + Yt + "]") || e : null; } function Le(e, t, n) { return n === void 0 && (n = !0), e.filter((o) => { var i; return o.parentId === t && (!n || ((i = o.context) == null ? void 0 : i.open)); }).flatMap((o) => [o, ...Le(e, o.id, n)]); } function Gt(e, t) { var n; let r = [], o = (n = e.find((i) => i.id === t)) == null ? void 0 : n.parentId; for (; o; ) { const i = e.find((s) => s.id === o); o = i?.parentId, i && (r = r.concat(i)); } return r; } function ht(e) { e.preventDefault(), e.stopPropagation(); } function Mr(e) { return "nativeEvent" in e; } function Pr(e) { return e.mozInputSource === 0 && e.isTrusted ? !0 : Pt() && e.pointerType ? e.type === "click" && e.buttons === 1 : e.detail === 0 && !e.pointerType; } function Lr(e) { return Nn() ? !1 : !Pt() && e.width === 0 && e.height === 0 || Pt() && e.width === 1 && e.height === 1 && e.pressure === 0 && e.detail === 0 && e.pointerType === "mouse" || // iOS VoiceOver returns 0.333• for width/height. e.width < 1 && e.height < 1 && e.pressure === 0 && e.detail === 0 && e.pointerType === "touch"; } function We(e, t) { const n = ["mouse", "pen"]; return t || n.push("", void 0), n.includes(e); } var Ir = typeof document < "u", kr = function() { }, G = Ir ? En : kr; const Dr = { ...f }; function Ce(e) { const t = f.useRef(e); return G(() => { t.current = e; }), t; } const Fr = Dr.useInsertionEffect, Nr = Fr || ((e) => e()); function Q(e) { const t = f.useRef(() => { if (process.env.NODE_ENV !== "production") throw new Error("Cannot call an event handler while rendering."); }); return Nr(() => { t.current = e; }), f.useCallback(function() { for (var n = arguments.length, r = new Array(n), o = 0; o < n; o++) r[o] = arguments[o]; return t.current == null ? void 0 : t.current(...r); }, []); } const He = () => ({ getShadowRoot: !0, displayCheck: ( // JSDOM does not support the `tabbable` library. To solve this we can // check if `ResizeObserver` is a real function (not polyfilled), which // determines if the current environment is JSDOM-like. typeof ResizeObserver == "function" && ResizeObserver.toString().includes("[native code]") ? "full" : "none" ) }); function Wn(e, t) { const n = lt(e, He()), r = n.length; if (r === 0) return; const o = be(J(e)), i = n.indexOf(o), s = i === -1 ? t === 1 ? 0 : r - 1 : i + t; return n[s]; } function $n(e) { return Wn(J(e).body, 1) || e; } function Bn(e) { return Wn(J(e).body, -1) || e; } function Ne(e, t) { const n = t || e.currentTarget, r = e.relatedTarget; return !r || !Z(n, r); } function Wr(e) { lt(e, He()).forEach((n) => { n.dataset.tabindex = n.getAttribute("tabindex") || "", n.setAttribute("tabindex", "-1"); }); } function Zt(e) { e.querySelectorAll("[data-tabindex]").forEach((n) => { const r = n.dataset.tabindex; delete n.dataset.tabindex, r ? n.setAttribute("tabindex", r) : n.removeAttribute("tabindex"); }); } function Jt(e, t, n) { let { reference: r, floating: o } = e; const i = ye(t), s = Wt(t), c = Nt(s), u = Ae(t), a = i === "y", m = r.x + r.width / 2 - o.width / 2, g = r.y + r.height / 2 - o.height / 2, v = r[c] / 2 - o[c] / 2; let l; switch (u) { case "top": l = { x: m, y: r.y - o.height }; break; case "bottom": l = { x: m, y: r.y + r.height }; break; case "right": l = { x: r.x + r.width, y: g }; break; case "left": l = { x: r.x - o.width, y: g }; break; default: l = { x: r.x, y: r.y }; } switch (Ve(t)) { case "start": l[s] -= v * (n && a ? -1 : 1); break; case "end": l[s] += v * (n && a ? -1 : 1); break; } return l; } async function $r(e, t) { var n; t === void 0 && (t = {}); const { x: r, y: o, platform: i, rects: s, elements: c, strategy: u } = e, { boundary: a = "clippingAncestors", rootBoundary: m = "viewport", elementContext: g = "floating", altBoundary: v = !1, padding: l = 0 } = _e(t, e), p = Sn(l), w = c[v ? g === "floating" ? "reference" : "floating" : g], R = Qe(await i.getClippingRect({ element: (n = await (i.isElement == null ? void 0 : i.isElement(w))) == null || n ? w : w.contextElement || await (i.getDocumentElement == null ? void 0 : i.getDocumentElement(c.floating)), boundary: a, rootBoundary: m, strategy: u })), b = g === "floating" ? { x: r, y: o, width: s.floating.width, height: s.floating.height } : s.reference, y = await (i.getOffsetParent == null ? void 0 : i.getOffsetParent(c.floating)), C = await (i.isElement == null ? void 0 : i.isElement(y)) ? await (i.getScale == null ? void 0 : i.getScale(y)) || { x: 1, y: 1 } : { x: 1, y: 1 }, P = Qe(i.convertOffsetParentRelativeRectToViewportRelativeRect ? await i.convertOffsetParentRelativeRectToViewportRelativeRect({ elements: c, rect: b, offsetParent: y, strategy: u }) : b); return { top: (R.top - P.top + p.top) / C.y, bottom: (P.bottom - R.bottom + p.bottom) / C.y, left: (R.left - P.left + p.left) / C.x, right: (P.right - R.right + p.right) / C.x }; } const Br = 50, _r = async (e, t, n) => { const { placement: r = "bottom", strategy: o = "absolute", middleware: i = [], platform: s } = n, c = s.detectOverflow ? s : { ...s, detectOverflow: $r }, u = await (s.isRTL == null ? void 0 : s.isRTL(t)); let a = await s.getElementRects({ reference: e, floating: t, strategy: o }), { x: m, y: g } = Jt(a, r, u), v = r, l = 0; const p = {}; for (let d = 0; d < i.length; d++) { const w = i[d]; if (!w) continue; const { name: R, fn: b } = w, { x: y, y: C, data: P, reset: O } = await b({ x: m, y: g, initialPlacement: r, placement: v, strategy: o, middlewareData: p, rects: a, platform: c, elements: { reference: e, floating: t } }); m = y ?? m, g = C ?? g, p[R] = { ...p[R], ...P }, O && l < Br && (l++, typeof O == "object" && (O.placement && (v = O.placement), O.rects && (a = O.rects === !0 ? await s.getElementRects({ reference: e, floating: t, strategy: o }) : O.rects), { x: m, y: g } = Jt(a, v, u)), d = -1); } return { x: m, y: g, placement: v, strategy: o, middlewareData: p }; }, Vr = (e) => ({ name: "arrow", options: e, async fn(t) { const { x: n, y: r, placement: o, rects: i, platform: s, elements: c, middlewareData: u } = t, { element: a, padding: m = 0 } = _e(e, t) || {}; if (a == null) return {}; const g = Sn(m), v = { x: n, y: r }, l = Wt(o), p = Nt(l), d = await s.getDimensions(a), w = l === "y", R = w ? "top" : "left", b = w ? "bottom" : "right", y = w ? "clientHeight" : "clientWidth", C = i.reference[p] + i.reference[l] - v[l] - i.floating[p], P = v[l] - i.reference[l], O = await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(a)); let M = O ? O[y] : 0; (!M || !await (s.isElement == null ? void 0 : s.isElement(O))) && (M = c.floating[y] || i.floating[p]); const D = C / 2 - P / 2, j = M / 2 - d[p] / 2 - 1, $ = De(g[R], j), W = De(g[b], j), B = $, _ = M - d[p] - W, x = M / 2 - d[p] / 2 + D, E = St(B, x, _), L = !u.arrow && Ve(o) != null && x !== E && i.reference[p] / 2 - (x < B ? $ : W) - d[p] / 2 < 0, T = L ? x < B ? x - B : x - _ : 0; return { [l]: v[l] + T, data: { [l]: E, centerOffset: x - E - T, ...L && { alignmentOffset: T } }, reset: L }; } }), Hr = function(e) { return e === void 0 && (e = {}), { name: "flip", options: e, async fn(t) { var n, r; const { placement: o, middlewareData: i, rects: s, initialPlacement: c, platform: u, elements: a } = t, { mainAxis: m = !0, crossAxis: g = !0, fallbackPlacements: v, fallbackStrategy: l = "bestFit", fallbackAxisSideDirection: p = "none", flipAlignment: d = !0, ...w } = _e(e, t); if ((n = i.arrow) != null && n.alignmentOffset) return {}; const R = Ae(o), b = ye(c), y = Ae(c) === c, C = await (u.isRTL == null ? void 0 : u.isRTL(a.floating)), P = v || (y || !d ? [Je(c)] : rr(c)), O = p !== "none"; !v && O && P.push(...cr(c, d, p, C)); const M = [c, ...P], D = await u.detectOverflow(t, w), j = []; let $ = ((r = i.flip) == null ? void 0 : r.overflows) || []; if (m && j.push(D[R]), g) { const x = nr(o, s, C); j.push(D[x[0]], D[x[1]]); } if ($ = [...$, { placement: o, overflows: j }], !j.every((x) => x <= 0)) { var W, B; const x = (((W = i.flip) == null ? void 0 : W.index) || 0) + 1, E = M[x]; if (E && (!(g === "alignment" ? b !== ye(E) : !1) || // We leave the current main axis only if every placement on that axis // overflows the main axis. $.every((h) => ye(h.placement) === b ? h.overflows[0] > 0 : !0))) return { data: { index: x, overflows: $ }, reset: { placement: E } }; let L = (B = $.filter((T) => T.overflows[0] <= 0).sort((T, h) => T.overflows[1] - h.overflows[1])[0]) == null ? void 0 : B.placement; if (!L) switch (l) { case "bestFit": { var _; const T = (_ = $.filter((h) => { if (O) { const S = ye(h.placement); return S === b || // Create a bias to the `y` side axis due to horizontal // reading directions favoring greater width. S === "y"; } return !0; }).map((h) => [h.placement, h.overflows.filter((S) => S > 0).reduce((S, I) => S + I, 0)]).sort((h, S) => h[1] - S[1])[0]) == null ? void 0 : _[0]; T && (L = T); break; } case "initialPlacement": L = c; break; } if (o !== L) return { reset: { placement: L } }; } return {}; } }; }, Kr = /* @__PURE__ */ new Set(["left", "top"]); async function jr(e, t) { const { placement: n, platform: r, elements: o } = e, i = await (r.isRTL == null ? void 0 : r.isRTL(o.floating)), s = Ae(n), c = Ve(n), u = ye(n) === "y", a = Kr.has(s) ? -1 : 1, m = i && u ? -1 : 1, g = _e(t, e); let { mainAxis: v, crossAxis: l, alignmentAxis: p } = typeof g == "number" ? { mainAxis: g, crossAxis: 0, alignmentAxis: null } : { mainAxis: g.mainAxis || 0, crossAxis: g.crossAxis || 0, alignmentAxis: g.alignmentAxis }; return c && typeof p == "number" && (l = c === "end" ? p * -1 : p), u ? { x: l * m, y: v * a } : { x: v * a, y: l * m }; } const qr = function(e) { return e === void 0 && (e = 0), { name: "offset", options: e, async fn(t) { var n, r; const { x: o, y: i, placement: s, middlewareData: c } = t, u = await jr(t, e); return s === ((n = c.offset) == null ? void 0 : n.placement) && (r = c.arrow) != null && r.alignmentOffset ? {} : { x: o + u.x, y: i + u.y, data: { ...u, placement: s } }; } }; }, Ur = function(e) { return e === void 0 && (e = {}), { name: "shift", options: e, async fn(t) { const { x: n, y: r, placement: o, platform: i } = t, { mainAxis: s = !0, crossAxis: c = !1, limiter: u = { fn: (R) => { let { x: b, y } = R; return { x: b, y }; } }, ...a } = _e(e, t), m = { x: n, y: r }, g = await i.detectOverflow(t, a), v = ye(Ae(o)), l = Cn(v); let p = m[l], d = m[v]; if (s) { const R = l === "y" ? "top" : "left", b = l === "y" ? "bottom" : "right", y = p + g[R], C = p - g[b]; p = St(y, p, C); } if (c) { const R = v === "y" ? "top" : "left", b = v === "y" ? "bottom" : "right", y = d + g[R], C = d - g[b]; d = St(y, d, C); } const w = u.fn({ ...t, [l]: p, [v]: d }); return { ...w, data: { x: w.x - n, y: w.y - r, enabled: { [l]: s, [v]: c } } }; } }; }; function _n(e) { const t = oe(e); let n = parseFloat(t.width) || 0, r = parseFloat(t.height) || 0; const o = X(e), i = o ? e.offsetWidth : n, s = o ? e.offsetHeight : r, c = Ze(n) !== i || Ze(r) !== s; return c && (n = i, r = s), { width: n, height: r, $: c }; } function _t(e) { return K(e) ? e : e.contextElement; } function Ie(e) { const t = _t(e); if (!X(t)) return ue(1); const n = t.getBoundingClientRect(), { width: r, height: o, $: i } = _n(t); let s = (i ? Ze(n.width) : n.width) / r, c = (i ? Ze(n.height) : n.height) / o; return (!s || !Number.isFinite(s)) && (s = 1), (!c || !Number.isFinite(c)) && (c = 1), { x: s, y: c }; } const Xr = /* @__PURE__ */ ue(0); function Vn(e) { const t = ee(e); return !ct() || !t.visualViewport ? Xr : { x: t.visualViewport.offsetLeft, y: t.visualViewport.offsetTop }; } function Yr(e, t, n) { return t === void 0 && (t = !1), !n || t && n !== ee(e) ? !1 : t; } function Oe(e, t, n, r) { t === void 0 && (t = !1), n === void 0 && (n = !1); const o = e.getBoundingClientRect(), i = _t(e); let s = ue(1); t && (r ? K(r) && (s = Ie(r)) : s = Ie(e)); const c = Yr(i, n, r) ? Vn(i) : ue(0); let u = (o.left + c.x) / s.x, a = (o.top + c.y) / s.y, m = o.width / s.x, g = o.height / s.y; if (i) { const v = ee(i), l = r && K(r) ? ee(r) : r; let p = v, d = Ct(p); for (; d && r && l !== p; ) { const w = Ie(d), R = d.getBoundingClientRect(), b = oe(d), y = R.left + (d.clientLeft + parseFloat(b.paddingLeft)) * w.x, C = R.top + (d.clientTop + parseFloat(b.paddingTop)) * w.y; u *= w.x, a *= w.y, m *= w.x, g *= w.y, u += y, a += C, p = ee(d), d = Ct(p); } } return Qe({ width: m, height: g, x: u, y: a }); } function at(e, t) { const n = ut(e).scrollLeft; return t ? t.left + n : Oe(le(e)).left + n; } function Hn(e, t) { const n = e.getBoundingClientRect(), r = n.left + t.scrollLeft - at(e, n), o = n.top + t.scrollTop; return { x: r, y: o }; } function zr(e) { let { elements: t, rect: n, offsetParent: r, strategy: o } = e; const i = o === "fixed", s = le(r), c = t ? st(t.floating) : !1; if (r === s || c && i) return n; let u = { scrollLeft: 0, scrollTop: 0 }, a = ue(1); const m = ue(0), g = X(r); if ((g || !g && !i) && ((xe(r) !== "body" || Be(s)) && (u = ut(r)), g)) { const l = Oe(r); a = Ie(r), m.x = l.x + r.clientLeft, m.y = l.y + r.clientTop; } const v = s && !g && !i ? Hn(s, u) : ue(0); return { width: n.width * a.x, height: n.height * a.y, x: n.x * a.x - u.scrollLeft * a.x + m.x + v.x, y: n.y * a.y - u.scrollTop * a.y + m.y + v.y }; } function Gr(e) { return Array.from(e.getClientRects()); } function Zr(e) { const t = le(e), n = ut(e), r = e.ownerDocument.body, o = Se(t.scrollWidth, t.clientWidth, r.scrollWidth, r.clientWidth), i = Se(t.scrollHeight, t.clientHeight, r.scrollHeight, r.clientHeight); let s = -n.scrollLeft + at(e); const c = -n.scrollTop; return oe(r).direction === "rtl" && (s += Se(t.clientWidth, r.clientWidth) - o), { width: o, height: i, x: s, y: c }; } const Qt = 25; function Jr(e, t) { const n = ee(e), r = le(e), o = n.visualViewport; let i = r.clientWidth, s = r.clientHeight, c = 0, u = 0; if (o) { i = o.width, s = o.height; const m = ct(); (!m || m && t === "fixed") && (c = o.offsetLeft, u = o.offsetTop); } const a = at(r); if (a <= 0) { const m = r.ownerDocument, g = m.body, v = getComputedStyle(g), l = m.compatMode === "CSS1Compat" && parseFloat(v.marginLeft) + parseFloat(v.marginRight) || 0, p = Math.abs(r.clientWidth - g.clientWidth - l); p <= Qt && (i -= p); } else a <= Qt && (i += a); return { width: i, height: s, x: c, y: u }; } function Qr(e, t) { const n = Oe(e, !0, t === "fixed"), r = n.top + e.clientTop, o = n.left + e.clientLeft, i = X(e) ? Ie(e) : ue(1), s = e.clientWidth * i.x, c = e.clientHeight * i.y, u = o * i.x, a = r * i.y; return { width: s, height: c, x: u, y: a }; } function en(e, t, n) { let r; if (t === "viewport") r = Jr(e, n); else if (t === "document") r = Zr(le(e)); else if (K(t)) r = Qr(t, n); else { const o = Vn(e); r = { x: t.x - o.x, y: t.y - o.y, width: t.width, height: t.height }; } return Qe(r); } function Kn(e, t) { const n = ge(e); return n === t || !K(n) || me(n) ? !1 : oe(n).position === "fixed" || Kn(n, t); } function eo(e, t) { const n = t.get(e); if (n) return n; let r = Re(e, [], !1).filter((c) => K(c) && xe(c) !== "body"), o = null; const i = oe(e).position === "fixed"; let s = i ? ge(e) : e; for (; K(s) && !me(s); ) { const c = oe(s), u = Ft(s); !u && c.position === "fixed" && (o = null), (i ? !u && !o : !u && c.position === "static" && !!o && (o.position === "absolute" || o.position === "fixed") || Be(s) && !u && Kn(e, s)) ? r = r.filter((m) => m !== s) : o = c, s = ge(s); } return t.set(e, r), r; } function to(e) { let { element: t, boundary: n, rootBoundary: r, strategy: o } = e; const s = [...n === "clippingAncestors" ? st(t) ? [] : eo(t, this._c) : [].concat(n), r], c = en(t, s[0], o); let u = c.top, a = c.right, m = c.bottom, g = c.left; for (let v = 1; v < s.length; v++) { const l = en(t, s[v], o); u = Se(l.top, u), a = De(l.right, a), m = De(l.bottom, m), g = Se(l.left, g); } return { width: a - g, height: m - u, x: g, y: u }; } function no(e) { const { width: t, height: n } = _n(e); return { width: t, height: n }; } function ro(e, t, n) { const r = X(t), o = le(t), i = n === "fixed", s = Oe(e, !0, i, t); let c = { scrollLeft: 0, scrollTop: 0 }; const u = ue(0); function a() { u.x = at(o); } if (r || !r && !i) if ((xe(t) !== "body" || Be(o)) && (c = ut(t)), r) { const l = Oe(t, !0, i, t); u.x = l.x + t.clientLeft, u.y = l.y + t.clientTop; } else o && a(); i && !r && o && a(); const m = o && !r && !i ? Hn(o, c) : ue(0), g = s.left + c.scrollLeft - u.x - m.x, v = s.top + c.scrollTop - u.y - m.y; return { x: g, y: v, width: s.width, height: s.height }; } function bt(e) { return oe(e).position === "static"; } function tn(e, t) { if (!X(e) || oe(e).position === "fixed") return null; if (t) return t(e); let n = e.offsetParent; return le(e) === n && (n = n.ownerDocument.body), n; } function jn(e, t) { const n = ee(e); if (st(e)) return n; if (!X(e)) { let o = ge(e); for (; o && !me(o); ) { if (K(o) && !bt(o)) return o; o = ge(o); } return n; } let r = tn(e, t); for (; r && Zn(r) && bt(r); ) r = tn(r, t); return r && me(r) && bt(r) && !Ft(r) ? n : r || er(e) || n; } const oo = async function(e) { const t = this.getOffsetParent || jn, n = this.getDimensions, r = await n(e.floating); return { reference: ro(e.reference, await t(e.floating), e.strategy), floating: { x: 0, y: 0, width: r.width, height: r.height } }; }; function io(e) { return oe(e).direction === "rtl"; } const so = { convertOffsetParentRelativeRectToViewportRelativeRect: zr, getDocumentElement: le, getClippingRect: to, getOffsetParent: jn, getElementRects: oo, getClientRects: Gr, getDimensions: no, getScale: Ie, isElement: K, isRTL: io }; function qn(e, t) { return e.x === t.x && e.y === t.y && e.width === t.width && e.height === t.height; } function co(e, t) { let n = null, r; const o = le(e); function i() { var c; clearTimeout(r), (c = n) == null || c.disconnect(), n = null; } function s(c, u) { c === void 0 && (c = !1), u === void 0 && (u = 1), i(); const a = e.getBoundingClientRect(), { left: m, top: g, width: v, height: l } = a; if (c || t(), !v || !l) return; const p = qe(g), d = qe(o.clientWidth - (m + v)), w = qe(o.clientHeight - (g + l)), R = qe(m), y = { rootMargin: -p + "px " + -d + "px " + -w + "px " + -R + "px", threshold: Se(0, De(1, u)) || 1 }; let C = !0; function P(O) { const M = O[0].intersectionRatio; if (M !== u) { if (!C) return s(); M ? s(!1, M) : r = setTimeout(() => { s(!1, 1e-7); }, 1e3); } M === 1 && !qn(a, e.getBoundingClientRect()) && s(), C = !1; } try { n = new IntersectionObserver(P, { ...y, // Handle <iframe>s root: o.ownerDocument }); } catch { n = new IntersectionObserver(P, y); } n.observe(e); } return s(!0), i; } function qo(e, t, n, r) { r === void 0 && (r = {}); const { ancestorScroll: o = !0, ancestorResize: i = !0, elementResize: s = typeof ResizeObserver == "function", layoutShift: c = typeof IntersectionObserver == "function", animationFrame: u = !1 } = r, a = _t(e), m = o || i ? [...a ? Re(a) : [], ...t ? Re(t) : []] : []; m.forEach((R) => { o && R.addEventListener("scroll", n, { passive: !0 }), i && R.addEventListener("resize", n); }); const g = a && c ? co(a, n) : null; let v = -1, l = null; s && (l = new ResizeObserver((R) => { let [b] = R; b && b.target === a && l && t && (l.unobserve(t), cancelAnimationFrame(v), v = requestAnimationFrame(() => { var y; (y = l) == null || y.observe(t); })), n(); }), a && !u && l.observe(a), t && l.observe(t)); let p, d = u ? Oe(e) : null; u && w(); function w() { const R = Oe(e); d && !qn(d, R) && n(), d = R, p = requestAnimationFrame(w); } return n(), () => { var R; m.forEach((b) => { o && b.removeEventListener("scroll", n), i && b.removeEventListener("resize", n); }), g?.(), (R = l) == null || R.disconnect(), l = null, u && cancelAnimationFrame(p); }; } const uo = qr, lo = Ur, ao = Hr, nn = Vr, fo = (e, t, n) => { const r = /* @__PURE__ */ new Map(), o = { platform: so, ...n }, i = { ...o.platform, _c: r }; return _r(e, t, { ...o, platform: i }); }; var mo = typeof document < "u", go = function() { }, ze = mo ? En : go; function rt(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, o; 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 (!rt(e[r], t[r])) return !1; return !0; } if (o = Object.keys(e), n = o.length, n !== Object.keys(t).length) return !1; for (r = n; r-- !== 0; ) if (!{}.hasOwnProperty.call(t, o[r])) return !1; for (r = n; r-- !== 0; ) { const i = o[r]; if (!(i === "_owner" && e.$$typeof) && !rt(e[i], t[i])) return !1; } return !0; } return e !== e && t !== t; } function Un(e) { return typeof window > "u" ? 1 : (e.ownerDocument.defaultView || window).devicePixelRatio || 1; } function rn(e, t) { const n = Un(e); return Math.round(t * n) / n; } function yt(e) { const t = f.useRef(e); return ze(() => { t.current = e; }), t; } function po(e) { e === void 0 && (e = {}); const { placement: t = "bottom", strategy: n = "absolute", middleware: r = [], platform: o, elements: { reference: i, floating: s } = {}, transform: c = !0, whileElementsMounted: u, open: a } = e, [m, g] = f.useState({ x: 0, y: 0, strategy: n, placement: t, middlewareData: {}, isPositioned: !1 }), [v, l] = f.useState(r); rt(v, r) || l(r); const [p, d] = f.useState(null), [w, R] = f.useState(null), b = f.useCallback((h) => { h !== O.current && (O.current = h, d(h)); }, []), y = f.useCallback((h) => { h !== M.current && (M.current = h, R(h)); }, []), C = i || p, P = s || w, O = f.useRef(null), M = f.useRef(null), D = f.useRef(m), j = u != null, $ = yt(u), W = yt(o), B = yt(a), _ = f.useCallback(() => { if (!O.current || !M.current) return; const h = { placement: t, strategy: n, middleware: v }; W.current && (h.platform = W.current), fo(O.current, M.current, h).then((S) => { const I = { ...S, // The floating element's position may be recomputed while it's closed // but still mounted (such as when transitioning out). To ensure // `isPositioned` will be `false` initially on the next open, avoid // setting it to `true` when `open === false` (must be specified). isPositioned: B.current !== !1 }; x.current && !rt(D.current, I) && (D.current = I, kt.flushSync(() => { g(I); })); }); }, [v, t, n, W, B]); ze(() => { a === !1 && D.current.isPositioned && (D.current.isPositioned = !1, g((h) => ({ ...h, isPositioned: !1 }))); }, [a]); const x = f.useRef(!1); ze(() => (x.current = !0, () => { x.current = !1; }), []), ze(() => { if (C && (O.current = C), P && (M.current = P), C && P) { if ($.current) return $.current(C, P, _); _(); } }, [C, P, _, $, j]); const E = f.useMemo(() => ({ reference: O, floating: M, setReference: b, setFloating: y }), [b, y]), L = f.useMemo(() => ({ reference: C, floating: P }), [C, P]), T = f.useMemo(() => { const h = { position: n, left: 0, top: 0 }; if (!L.floating) return h; const S = rn(L.floating, m.x), I = rn(L.floating, m.y); return c ? { ...h, transform: "translate(" + S + "px, " + I + "px)", ...Un(L.floating) >= 1.5 && { willChange: "transform" } } : { position: n, left: S, top: I }; }, [n, c, L.floating, m.x, m.y]); return f.useMemo(() => ({ ...m, update: _, refs: E, elements: L, floatingStyles: T }), [m, _, E, L, T]); } const vo = (e) => { function t(n) { return {}.hasOwnProperty.call(n, "current"); } return { name: "arrow", options: e, fn(n) { const { element: r, padding: o } = typeof e == "function" ? e(n) : e; return r && t(r) ? r.current != null ? nn({ element: r.current, padding: o }).fn(n) : {} : r ? nn({ element: r, padding: o }).fn(n) : {}; } }; }, Uo = (e, t) => { const n = uo(e); return { name: n.name, fn: n.fn, options: [e, t] }; }, Xo = (e, t) => { const n = lo(e); return { name: n.name, fn: n.fn, options: [e, t] }; }, Yo = (e, t) => { const n = ao(e); return { name: n.name, fn: n.fn, options: [e, t] }; }, zo = (e, t) => { const n = vo(e); return { name: n.name, fn: n.fn, options: [e, t] }; }; function Go(e) { const t = f.useRef(void 0), n = f.useCallback((r) => { const o = e.map((i) => { if (i != null) { if (typeof i == "function") { const s = i, c = s(r); return typeof c == "function" ? c : () => { s(null); }; } return i.current = r, () => { i.current = null; }; } }); return () => { o.forEach((i) => i?.()); }; }, e); return f.useMemo(() => e.every((r) => r == null) ? null : (r) => { t.current && (t.current(), t.current = void 0), r != null && (t.current = n(r)); }, e); } const ho = "data-floating-ui-focusable", on = "active", sn = "selected", bo = { ...f }; let cn = !1, yo = 0; const un = () => ( // Ensure the id is unique with multiple independent versions of Floating UI // on <React 18 "floating-ui-" + Math.random().toString(36).slice(2, 6) + yo++ ); function wo() { const [e, t] = f.useState(() => cn ? un() : void 0); return G(() => { e == null && t(un()); }, []), f.useEffect(() => { cn = !0; }, []), e; } const Ro = bo.useId, ft = Ro || wo; let $e; process.env.NODE_ENV !== "production" && ($e = /* @__PURE__ */ new Set()); function xo() { for (var e, t = arguments.length, n = new Array(t), r = 0; r < t; r++) n[r] = arguments[r]; const o = "Floating UI: " + n.join(" "); if (!((e = $e) != null && e.has(o))) { var i; (i = $e) == null || i.add(o), console.warn(o); } } function Eo() { for (var e, t = arguments.length, n = new Array(t), r = 0; r < t; r++) n[r] = arguments[r]; const o = "Floating UI: " + n.join(" "); if (!((e = $e) != null && e.has(o))) { var i; (i = $e) == null || i.add(o), console.error(o); } } const Zo = /* @__PURE__ */ f.forwardRef(function(t, n) { const { context: { placement: r, elements: { floating: o }, middlewareData: { arrow: i, shift: s } }, width: c = 14, height: u = 7, tipRadius: a = 0, strokeWidth: m = 0, staticOffset: g, stroke: v, d: l, style: { transform: p, ...d } = {}, ...w } = t; process.env.NODE_ENV !== "production" && (n || xo("The `ref` prop is required for `FloatingArrow`.")); const R = ft(), [b, y] = f.useState(!1); if (G(() => { if (!o) return; oe(o).direction === "rtl" && y(!0); }, [o]), !o) return null; const [C, P] = r.split("-"), O = C === "top" || C === "bottom"; let M = g; (O && s != null && s.x || !O && s != null && s.y) && (M = null); const D = m * 2, j = D / 2, $ = c / 2 * (a / -8 + 1), W = u / 2 * a / 4, B = !!l, _ = M && P === "end" ? "bottom" : "top"; let x = M && P === "end" ? "right" : "left"; M && b && (x = P === "end" ? "left" : "right"); const E = i?.x != null ? M || i.x : "", L = i?.y != null ? M || i.y : "", T = l || "M0,0" + (" H" + c) + (" L" + (c - $) + "," + (u - W)) + (" Q" + c / 2 + "," + u + " " + $ + "," + (u - W)) + " Z", h = { top: B ? "rotate(180deg)" : "", left: B ? "rotate(90deg)" : "rotate(-90deg)", bottom: B ? "" : "rotate(180deg)", right: B ? "rotate(-90deg)" : "rotate(90deg)" }[C]; return /* @__PURE__ */ It("svg", { ...w, "aria-hidden": !0, ref: n, width: B ? c : c + D, height: c, viewBox: "0 0 " + c + " " + (u > c ? u : c), style: { position: "absolute", pointerEvents: "none", [x]: E, [_]: L, [C]: O || B ? "100%" : "calc(100% - " + D / 2 + "px)", transform: [h, p].filter((S) => !!S).join(" "), ...d }, children: [D > 0 && /* @__PURE__ */ re("path", { clipPath: "url(#" + R + ")", fill: "none", stroke: v, strokeWidth: D + (l ? 0 : 1), d: T }), /* @__PURE__ */ re("path", { stroke: D && !l ? w.fill : "none", d: T }), /* @__PURE__ */ re("clipPath", { id: R, children: /* @__PURE__ */ re("rect", { x: -j, y: j * (B ? -1 : 1), width: c + D, height: c }) })] }); }); function To() { const e = /* @__PURE__ */ new Map(); return { emit(t, n) { var r; (r = e.get(t)) == null || r.forEach((o) => o(n)); }, on(t, n) { e.has(t) || e.set(t, /* @__PURE__ */ new Set()), e.get(t).add(n); }, off(t, n) { var r; (r = e.get(t)) == null || r.delete(n); } }; } const Co = /* @__PURE__ */ f.createContext(null), So = /* @__PURE__ */ f.createContext(null), Vt = () => { var e; return ((e = f.useContext(Co)) == null ? void 0 : e.id) || null; }, dt = () => f.useContext(So); function Me(e) { return "data-floating-ui-" + e; } function ne(e) { e.current !== -1 && (clearTimeout(e.current), e.current = -1); } const ln = /* @__PURE__ */ Me("safe-polygon"); function wt(e, t, n) { if (n && !We(n)) return 0; if (typeof e == "number") return e; if (typeof e == "function") { const r = e(); return typeof r == "number" ? r : r?.[t]; } return e?.[t]; } function Rt(e) { return typeof e == "function" ? e() : e; } function Jo(e, t) { t === void 0 && (t = {}); const { open: n, onOpenChange: r, dataRef: o, events: i, elements: s } = e, { enabled: c = !0, delay: u = 0, handleClose: a = null, mouseOnly: m = !1, restMs: g = 0, move: v = !0 } = t, l = dt(), p = Vt(), d = Ce(a), w = Ce(u), R = Ce(n), b = Ce(g), y = f.useRef(), C = f.useRef(-1), P = f.useRef(), O = f.useRef(-1), M = f.useRef(!0), D = f.useRef(!1), j = f.useRef(() => { }), $ = f.useRef(!1), W = Q(() => { var T; const h = (T = o.current.openEvent) == null ? void 0 : T.type; return h?.includes("mouse") && h !== "mousedown"; }); f.useEffect(() => { if (!c) return; function T(h) { let { open: S } = h; S || (ne(C), ne(O), M.current = !0, $.current = !1); } return i.on("openchange", T), () => { i.off("openchange", T); }; }, [c, i]), f.useEffect(() => { if (!c || !d.current || !n) return; function T(S) { W() && r(!1, S, "hover"); } const h = J(s.floating).documentElement; return h.addEventListener("mouseleave", T), () => { h.removeEventListener("mouseleave", T); }; }, [s.floating, n, r, c, d, W]); const B = f.useCallback(function(T, h, S) { h === void 0 && (h = !0), S === void 0 && (S = "hover"); const I = wt(w.current, "close", y.current); I && !P.current ? (ne(C), C.current = window.setTimeout(() => r(!1, T, S), I)) : h && (ne(C), r(!1, T, S)); }, [w, r]), _ = Q(() => { j.current(), P.current = void 0; }), x = Q(() => { if (D.current) { const T = J(s.floating).body; T.style.pointerEvents = "", T.removeAttribute(ln), D.current = !1; } }), E = Q(() => o.current.openEvent ? ["click", "mousedown"].includes(o.current.openEvent.type) : !1); f.useEffect(() => {