UNPKG

@pdf-viewer/react

Version:

A react-pdf-viewer component for React and Next.js. Suitable for react-pdf document.

1,485 lines (1,480 loc) 56 kB
import * as a from "react"; import $, { useState as dn } from "react"; import { h as fn, P as O, c as he, u as G, i as xe, f as te, a as ut, b as y, d as ge, j as it, g as vn } from "./index-5908484b.js"; import { jsx as d } from "react/jsx-runtime"; import { u as Oe, c as st, A as pn, D as mn, C as hn, a as gn, R as wn } from "./index-18b0454c.js"; import Cn from "react-dom"; var Mn = "Portal", lt = a.forwardRef((e, t) => { var u; const { container: n, ...r } = e, [o, c] = a.useState(!1); fn(() => c(!0), []); const s = n || o && ((u = globalThis == null ? void 0 : globalThis.document) == null ? void 0 : u.body); return s ? Cn.createPortal(/* @__PURE__ */ d(O.div, { ...r, ref: t }), s) : null; }); lt.displayName = Mn; function dt(e) { const t = e + "CollectionProvider", [n, r] = he(t), [o, c] = n( t, { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() } ), s = (w) => { const { scope: p, children: l } = w, g = $.useRef(null), C = $.useRef(/* @__PURE__ */ new Map()).current; return /* @__PURE__ */ d(o, { scope: p, itemMap: C, collectionRef: g, children: l }); }; s.displayName = t; const u = e + "CollectionSlot", h = $.forwardRef( (w, p) => { const { scope: l, children: g } = w, C = c(u, l), E = G(p, C.collectionRef); return /* @__PURE__ */ d(xe, { ref: E, children: g }); } ); h.displayName = u; const m = e + "CollectionItemSlot", v = "data-radix-collection-item", i = $.forwardRef( (w, p) => { const { scope: l, children: g, ...C } = w, E = $.useRef(null), b = G(p, E), S = c(m, l); return $.useEffect(() => (S.itemMap.set(E, { ref: E, ...C }), () => void S.itemMap.delete(E))), /* @__PURE__ */ d(xe, { [v]: "", ref: b, children: g }); } ); i.displayName = m; function f(w) { const p = c(e + "CollectionConsumer", w); return $.useCallback(() => { const g = p.collectionRef.current; if (!g) return []; const C = Array.from(g.querySelectorAll(`[${v}]`)); return Array.from(p.itemMap.values()).sort( (S, R) => C.indexOf(S.ref.current) - C.indexOf(R.ref.current) ); }, [p.collectionRef, p.itemMap]); } return [ { Provider: s, Slot: h, ItemSlot: i }, f, r ]; } var En = a.createContext(void 0); function ft(e) { const t = a.useContext(En); return e || t || "ltr"; } var Re = 0; function bn() { a.useEffect(() => { const e = document.querySelectorAll("[data-radix-focus-guard]"); return document.body.insertAdjacentElement("afterbegin", e[0] ?? ze()), document.body.insertAdjacentElement("beforeend", e[1] ?? ze()), Re++, () => { Re === 1 && document.querySelectorAll("[data-radix-focus-guard]").forEach((t) => t.remove()), Re--; }; }, []); } function ze() { const e = document.createElement("span"); return e.setAttribute("data-radix-focus-guard", ""), e.tabIndex = 0, e.style.outline = "none", e.style.opacity = "0", e.style.position = "fixed", e.style.pointerEvents = "none", e; } var _e = "focusScope.autoFocusOnMount", Ie = "focusScope.autoFocusOnUnmount", Ze = { bubbles: !1, cancelable: !0 }, yn = "FocusScope", vt = a.forwardRef((e, t) => { const { loop: n = !1, trapped: r = !1, onMountAutoFocus: o, onUnmountAutoFocus: c, ...s } = e, [u, h] = a.useState(null), m = te(o), v = te(c), i = a.useRef(null), f = G(t, (l) => h(l)), w = a.useRef({ paused: !1, pause() { this.paused = !0; }, resume() { this.paused = !1; } }).current; a.useEffect(() => { if (r) { let l = function(b) { if (w.paused || !u) return; const S = b.target; u.contains(S) ? i.current = S : U(i.current, { select: !0 }); }, g = function(b) { if (w.paused || !u) return; const S = b.relatedTarget; S !== null && (u.contains(S) || U(i.current, { select: !0 })); }, C = function(b) { if (document.activeElement === document.body) for (const R of b) R.removedNodes.length > 0 && U(u); }; document.addEventListener("focusin", l), document.addEventListener("focusout", g); const E = new MutationObserver(C); return u && E.observe(u, { childList: !0, subtree: !0 }), () => { document.removeEventListener("focusin", l), document.removeEventListener("focusout", g), E.disconnect(); }; } }, [r, u, w.paused]), a.useEffect(() => { if (u) { Qe.add(w); const l = document.activeElement; if (!u.contains(l)) { const C = new CustomEvent(_e, Ze); u.addEventListener(_e, m), u.dispatchEvent(C), C.defaultPrevented || (Sn(Tn(pt(u)), { select: !0 }), document.activeElement === l && U(u)); } return () => { u.removeEventListener(_e, m), setTimeout(() => { const C = new CustomEvent(Ie, Ze); u.addEventListener(Ie, v), u.dispatchEvent(C), C.defaultPrevented || U(l ?? document.body, { select: !0 }), u.removeEventListener(Ie, v), Qe.remove(w); }, 0); }; } }, [u, m, v, w]); const p = a.useCallback( (l) => { if (!n && !r || w.paused) return; const g = l.key === "Tab" && !l.altKey && !l.ctrlKey && !l.metaKey, C = document.activeElement; if (g && C) { const E = l.currentTarget, [b, S] = Rn(E); b && S ? !l.shiftKey && C === S ? (l.preventDefault(), n && U(b, { select: !0 })) : l.shiftKey && C === b && (l.preventDefault(), n && U(S, { select: !0 })) : C === E && l.preventDefault(); } }, [n, r, w.paused] ); return /* @__PURE__ */ d(O.div, { tabIndex: -1, ...s, ref: f, onKeyDown: p }); }); vt.displayName = yn; function Sn(e, { select: t = !1 } = {}) { const n = document.activeElement; for (const r of e) if (U(r, { select: t }), document.activeElement !== n) return; } function Rn(e) { const t = pt(e), n = qe(t, e), r = qe(t.reverse(), e); return [n, r]; } function pt(e) { const t = [], n = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, { acceptNode: (r) => { const o = r.tagName === "INPUT" && r.type === "hidden"; return r.disabled || r.hidden || o ? NodeFilter.FILTER_SKIP : r.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP; } }); for (; n.nextNode(); ) t.push(n.currentNode); return t; } function qe(e, t) { for (const n of e) if (!_n(n, { upTo: t })) return n; } function _n(e, { upTo: t }) { if (getComputedStyle(e).visibility === "hidden") return !0; for (; e; ) { if (t !== void 0 && e === t) return !1; if (getComputedStyle(e).display === "none") return !0; e = e.parentElement; } return !1; } function In(e) { return e instanceof HTMLInputElement && "select" in e; } function U(e, { select: t = !1 } = {}) { if (e && e.focus) { const n = document.activeElement; e.focus({ preventScroll: !0 }), e !== n && In(e) && t && e.select(); } } var Qe = Pn(); function Pn() { let e = []; return { add(t) { const n = e[0]; t !== n && (n == null || n.pause()), e = Je(e, t), e.unshift(t); }, remove(t) { var n; e = Je(e, t), (n = e[0]) == null || n.resume(); } }; } function Je(e, t) { const n = [...e], r = n.indexOf(t); return r !== -1 && n.splice(r, 1), n; } function Tn(e) { return e.filter((t) => t.tagName !== "A"); } var Pe = "rovingFocusGroup.onEntryFocus", An = { bubbles: !1, cancelable: !0 }, we = "RovingFocusGroup", [Fe, mt, Dn] = dt(we), [Nn, ht] = he( we, [Dn] ), [xn, On] = Nn(we), gt = a.forwardRef( (e, t) => /* @__PURE__ */ d(Fe.Provider, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ d(Fe.Slot, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ d(Fn, { ...e, ref: t }) }) }) ); gt.displayName = we; var Fn = a.forwardRef((e, t) => { const { __scopeRovingFocusGroup: n, orientation: r, loop: o = !1, dir: c, currentTabStopId: s, defaultCurrentTabStopId: u, onCurrentTabStopIdChange: h, onEntryFocus: m, preventScrollOnEntryFocus: v = !1, ...i } = e, f = a.useRef(null), w = G(t, f), p = ft(c), [l = null, g] = ut({ prop: s, defaultProp: u, onChange: h }), [C, E] = a.useState(!1), b = te(m), S = mt(n), R = a.useRef(!1), [D, P] = a.useState(0); return a.useEffect(() => { const _ = f.current; if (_) return _.addEventListener(Pe, b), () => _.removeEventListener(Pe, b); }, [b]), /* @__PURE__ */ d( xn, { scope: n, orientation: r, dir: p, loop: o, currentTabStopId: l, onItemFocus: a.useCallback( (_) => g(_), [g] ), onItemShiftTab: a.useCallback(() => E(!0), []), onFocusableItemAdd: a.useCallback( () => P((_) => _ + 1), [] ), onFocusableItemRemove: a.useCallback( () => P((_) => _ - 1), [] ), children: /* @__PURE__ */ d( O.div, { tabIndex: C || D === 0 ? -1 : 0, "data-orientation": r, ...i, ref: w, style: { outline: "none", ...e.style }, onMouseDown: y(e.onMouseDown, () => { R.current = !0; }), onFocus: y(e.onFocus, (_) => { const F = !R.current; if (_.target === _.currentTarget && F && !C) { const B = new CustomEvent(Pe, An); if (_.currentTarget.dispatchEvent(B), !B.defaultPrevented) { const q = S().filter((k) => k.focusable), Q = q.find((k) => k.active), ce = q.find((k) => k.id === l), be = [Q, ce, ...q].filter( Boolean ).map((k) => k.ref.current); Mt(be, v); } } R.current = !1; }), onBlur: y(e.onBlur, () => E(!1)) } ) } ); }), wt = "RovingFocusGroupItem", Ct = a.forwardRef( (e, t) => { const { __scopeRovingFocusGroup: n, focusable: r = !0, active: o = !1, tabStopId: c, ...s } = e, u = Oe(), h = c || u, m = On(wt, n), v = m.currentTabStopId === h, i = mt(n), { onFocusableItemAdd: f, onFocusableItemRemove: w } = m; return a.useEffect(() => { if (r) return f(), () => w(); }, [r, f, w]), /* @__PURE__ */ d( Fe.ItemSlot, { scope: n, id: h, focusable: r, active: o, children: /* @__PURE__ */ d( O.span, { tabIndex: v ? 0 : -1, "data-orientation": m.orientation, ...s, ref: t, onMouseDown: y(e.onMouseDown, (p) => { r ? m.onItemFocus(h) : p.preventDefault(); }), onFocus: y(e.onFocus, () => m.onItemFocus(h)), onKeyDown: y(e.onKeyDown, (p) => { if (p.key === "Tab" && p.shiftKey) { m.onItemShiftTab(); return; } if (p.target !== p.currentTarget) return; const l = Gn(p, m.orientation, m.dir); if (l !== void 0) { if (p.metaKey || p.ctrlKey || p.altKey || p.shiftKey) return; p.preventDefault(); let C = i().filter((E) => E.focusable).map((E) => E.ref.current); if (l === "last") C.reverse(); else if (l === "prev" || l === "next") { l === "prev" && C.reverse(); const E = C.indexOf(p.currentTarget); C = m.loop ? Kn(C, E + 1) : C.slice(E + 1); } setTimeout(() => Mt(C)); } }) } ) } ); } ); Ct.displayName = wt; var kn = { ArrowLeft: "prev", ArrowUp: "prev", ArrowRight: "next", ArrowDown: "next", PageUp: "first", Home: "first", PageDown: "last", End: "last" }; function Ln(e, t) { return t !== "rtl" ? e : e === "ArrowLeft" ? "ArrowRight" : e === "ArrowRight" ? "ArrowLeft" : e; } function Gn(e, t, n) { const r = Ln(e.key, n); if (!(t === "vertical" && ["ArrowLeft", "ArrowRight"].includes(r)) && !(t === "horizontal" && ["ArrowUp", "ArrowDown"].includes(r))) return kn[r]; } function Mt(e, t = !1) { const n = document.activeElement; for (const r of e) if (r === n || (r.focus({ preventScroll: t }), document.activeElement !== n)) return; } function Kn(e, t) { return e.map((n, r) => e[(t + r) % e.length]); } var Un = gt, Bn = Ct, $n = function(e) { if (typeof document > "u") return null; var t = Array.isArray(e) ? e[0] : e; return t.ownerDocument.body; }, H = /* @__PURE__ */ new WeakMap(), ie = /* @__PURE__ */ new WeakMap(), se = {}, Te = 0, Et = function(e) { return e && (e.host || Et(e.parentNode)); }, Wn = function(e, t) { return t.map(function(n) { if (e.contains(n)) return n; var r = Et(n); return r && e.contains(r) ? r : (console.error("aria-hidden", n, "in not contained inside", e, ". Doing nothing"), null); }).filter(function(n) { return !!n; }); }, Vn = function(e, t, n, r) { var o = Wn(t, Array.isArray(e) ? e : [e]); se[n] || (se[n] = /* @__PURE__ */ new WeakMap()); var c = se[n], s = [], u = /* @__PURE__ */ new Set(), h = new Set(o), m = function(i) { !i || u.has(i) || (u.add(i), m(i.parentNode)); }; o.forEach(m); var v = function(i) { !i || h.has(i) || Array.prototype.forEach.call(i.children, function(f) { if (u.has(f)) v(f); else try { var w = f.getAttribute(r), p = w !== null && w !== "false", l = (H.get(f) || 0) + 1, g = (c.get(f) || 0) + 1; H.set(f, l), c.set(f, g), s.push(f), l === 1 && p && ie.set(f, !0), g === 1 && f.setAttribute(n, "true"), p || f.setAttribute(r, "true"); } catch (C) { console.error("aria-hidden: cannot operate on ", f, C); } }); }; return v(t), u.clear(), Te++, function() { s.forEach(function(i) { var f = H.get(i) - 1, w = c.get(i) - 1; H.set(i, f), c.set(i, w), f || (ie.has(i) || i.removeAttribute(r), ie.delete(i)), w || i.removeAttribute(n); }), Te--, Te || (H = /* @__PURE__ */ new WeakMap(), H = /* @__PURE__ */ new WeakMap(), ie = /* @__PURE__ */ new WeakMap(), se = {}); }; }, Yn = function(e, t, n) { n === void 0 && (n = "data-aria-hidden"); var r = Array.from(Array.isArray(e) ? e : [e]), o = t || $n(e); return o ? (r.push.apply(r, Array.from(o.querySelectorAll("[aria-live]"))), Vn(r, o, n, "aria-hidden")) : function() { return null; }; }, x = function() { return x = Object.assign || function(t) { for (var n, r = 1, o = arguments.length; r < o; r++) { n = arguments[r]; for (var c in n) Object.prototype.hasOwnProperty.call(n, c) && (t[c] = n[c]); } return t; }, x.apply(this, arguments); }; function bt(e, t) { var n = {}; for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && t.indexOf(r) < 0 && (n[r] = e[r]); if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var o = 0, r = Object.getOwnPropertySymbols(e); o < r.length; o++) t.indexOf(r[o]) < 0 && Object.prototype.propertyIsEnumerable.call(e, r[o]) && (n[r[o]] = e[r[o]]); return n; } function Xn(e, t, n) { if (n || arguments.length === 2) for (var r = 0, o = t.length, c; r < o; r++) (c || !(r in t)) && (c || (c = Array.prototype.slice.call(t, 0, r)), c[r] = t[r]); return e.concat(c || Array.prototype.slice.call(t)); } var fe = "right-scroll-bar-position", ve = "width-before-scroll-bar", Hn = "with-scroll-bars-hidden", jn = "--removed-body-scroll-bar-size"; function Ae(e, t) { return typeof e == "function" ? e(t) : e && (e.current = t), e; } function zn(e, t) { var n = dn(function() { return { // value value: e, // last callback callback: t, // "memoized" public interface facade: { get current() { return n.value; }, set current(r) { var o = n.value; o !== r && (n.value = r, n.callback(r, o)); } } }; })[0]; return n.callback = t, n.facade; } var Zn = typeof window < "u" ? a.useLayoutEffect : a.useEffect, et = /* @__PURE__ */ new WeakMap(); function qn(e, t) { var n = zn(t || null, function(r) { return e.forEach(function(o) { return Ae(o, r); }); }); return Zn(function() { var r = et.get(n); if (r) { var o = new Set(r), c = new Set(e), s = n.current; o.forEach(function(u) { c.has(u) || Ae(u, null); }), c.forEach(function(u) { o.has(u) || Ae(u, s); }); } et.set(n, e); }, [e]), n; } function Qn(e) { return e; } function Jn(e, t) { t === void 0 && (t = Qn); var n = [], r = !1, o = { read: function() { if (r) throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`."); return n.length ? n[n.length - 1] : e; }, useMedium: function(c) { var s = t(c, r); return n.push(s), function() { n = n.filter(function(u) { return u !== s; }); }; }, assignSyncMedium: function(c) { for (r = !0; n.length; ) { var s = n; n = [], s.forEach(c); } n = { push: function(u) { return c(u); }, filter: function() { return n; } }; }, assignMedium: function(c) { r = !0; var s = []; if (n.length) { var u = n; n = [], u.forEach(c), s = n; } var h = function() { var v = s; s = [], v.forEach(c); }, m = function() { return Promise.resolve().then(h); }; m(), n = { push: function(v) { s.push(v), m(); }, filter: function(v) { return s = s.filter(v), n; } }; } }; return o; } function er(e) { e === void 0 && (e = {}); var t = Jn(null); return t.options = x({ async: !0, ssr: !1 }, e), t; } var yt = function(e) { var t = e.sideCar, n = bt(e, ["sideCar"]); if (!t) throw new Error("Sidecar: please provide `sideCar` property to import the right car"); var r = t.read(); if (!r) throw new Error("Sidecar medium not found"); return a.createElement(r, x({}, n)); }; yt.isSideCarExport = !0; function tr(e, t) { return e.useMedium(t), yt; } var St = er(), De = function() { }, Ce = a.forwardRef(function(e, t) { var n = a.useRef(null), r = a.useState({ onScrollCapture: De, onWheelCapture: De, onTouchMoveCapture: De }), o = r[0], c = r[1], s = e.forwardProps, u = e.children, h = e.className, m = e.removeScrollBar, v = e.enabled, i = e.shards, f = e.sideCar, w = e.noIsolation, p = e.inert, l = e.allowPinchZoom, g = e.as, C = g === void 0 ? "div" : g, E = e.gapMode, b = bt(e, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]), S = f, R = qn([n, t]), D = x(x({}, b), o); return a.createElement( a.Fragment, null, v && a.createElement(S, { sideCar: St, removeScrollBar: m, shards: i, noIsolation: w, inert: p, setCallbacks: c, allowPinchZoom: !!l, lockRef: n, gapMode: E }), s ? a.cloneElement(a.Children.only(u), x(x({}, D), { ref: R })) : a.createElement(C, x({}, D, { className: h, ref: R }), u) ); }); Ce.defaultProps = { enabled: !0, removeScrollBar: !0, inert: !1 }; Ce.classNames = { fullWidth: ve, zeroRight: fe }; var tt, nr = function() { if (tt) return tt; if (typeof __webpack_nonce__ < "u") return __webpack_nonce__; }; function rr() { if (!document) return null; var e = document.createElement("style"); e.type = "text/css"; var t = nr(); return t && e.setAttribute("nonce", t), e; } function or(e, t) { e.styleSheet ? e.styleSheet.cssText = t : e.appendChild(document.createTextNode(t)); } function ar(e) { var t = document.head || document.getElementsByTagName("head")[0]; t.appendChild(e); } var cr = function() { var e = 0, t = null; return { add: function(n) { e == 0 && (t = rr()) && (or(t, n), ar(t)), e++; }, remove: function() { e--, !e && t && (t.parentNode && t.parentNode.removeChild(t), t = null); } }; }, ur = function() { var e = cr(); return function(t, n) { a.useEffect(function() { return e.add(t), function() { e.remove(); }; }, [t && n]); }; }, Rt = function() { var e = ur(), t = function(n) { var r = n.styles, o = n.dynamic; return e(r, o), null; }; return t; }, ir = { left: 0, top: 0, right: 0, gap: 0 }, Ne = function(e) { return parseInt(e || "", 10) || 0; }, sr = function(e) { var t = window.getComputedStyle(document.body), n = t[e === "padding" ? "paddingLeft" : "marginLeft"], r = t[e === "padding" ? "paddingTop" : "marginTop"], o = t[e === "padding" ? "paddingRight" : "marginRight"]; return [Ne(n), Ne(r), Ne(o)]; }, lr = function(e) { if (e === void 0 && (e = "margin"), typeof window > "u") return ir; var t = sr(e), n = document.documentElement.clientWidth, r = window.innerWidth; return { left: t[0], top: t[1], right: t[2], gap: Math.max(0, r - n + t[2] - t[0]) }; }, dr = Rt(), Z = "data-scroll-locked", fr = function(e, t, n, r) { var o = e.left, c = e.top, s = e.right, u = e.gap; return n === void 0 && (n = "margin"), ` .`.concat(Hn, ` { overflow: hidden `).concat(r, `; padding-right: `).concat(u, "px ").concat(r, `; } body[`).concat(Z, `] { overflow: hidden `).concat(r, `; overscroll-behavior: contain; `).concat([ t && "position: relative ".concat(r, ";"), n === "margin" && ` padding-left: `.concat(o, `px; padding-top: `).concat(c, `px; padding-right: `).concat(s, `px; margin-left:0; margin-top:0; margin-right: `).concat(u, "px ").concat(r, `; `), n === "padding" && "padding-right: ".concat(u, "px ").concat(r, ";") ].filter(Boolean).join(""), ` } .`).concat(fe, ` { right: `).concat(u, "px ").concat(r, `; } .`).concat(ve, ` { margin-right: `).concat(u, "px ").concat(r, `; } .`).concat(fe, " .").concat(fe, ` { right: 0 `).concat(r, `; } .`).concat(ve, " .").concat(ve, ` { margin-right: 0 `).concat(r, `; } body[`).concat(Z, `] { `).concat(jn, ": ").concat(u, `px; } `); }, nt = function() { var e = parseInt(document.body.getAttribute(Z) || "0", 10); return isFinite(e) ? e : 0; }, vr = function() { a.useEffect(function() { return document.body.setAttribute(Z, (nt() + 1).toString()), function() { var e = nt() - 1; e <= 0 ? document.body.removeAttribute(Z) : document.body.setAttribute(Z, e.toString()); }; }, []); }, pr = function(e) { var t = e.noRelative, n = e.noImportant, r = e.gapMode, o = r === void 0 ? "margin" : r; vr(); var c = a.useMemo(function() { return lr(o); }, [o]); return a.createElement(dr, { styles: fr(c, !t, o, n ? "" : "!important") }); }, ke = !1; if (typeof window < "u") try { var le = Object.defineProperty({}, "passive", { get: function() { return ke = !0, !0; } }); window.addEventListener("test", le, le), window.removeEventListener("test", le, le); } catch { ke = !1; } var j = ke ? { passive: !1 } : !1, mr = function(e) { return e.tagName === "TEXTAREA"; }, _t = function(e, t) { if (!(e instanceof Element)) return !1; var n = window.getComputedStyle(e); return ( // not-not-scrollable n[t] !== "hidden" && // contains scroll inside self !(n.overflowY === n.overflowX && !mr(e) && n[t] === "visible") ); }, hr = function(e) { return _t(e, "overflowY"); }, gr = function(e) { return _t(e, "overflowX"); }, rt = function(e, t) { var n = t.ownerDocument, r = t; do { typeof ShadowRoot < "u" && r instanceof ShadowRoot && (r = r.host); var o = It(e, r); if (o) { var c = Pt(e, r), s = c[1], u = c[2]; if (s > u) return !0; } r = r.parentNode; } while (r && r !== n.body); return !1; }, wr = function(e) { var t = e.scrollTop, n = e.scrollHeight, r = e.clientHeight; return [ t, n, r ]; }, Cr = function(e) { var t = e.scrollLeft, n = e.scrollWidth, r = e.clientWidth; return [ t, n, r ]; }, It = function(e, t) { return e === "v" ? hr(t) : gr(t); }, Pt = function(e, t) { return e === "v" ? wr(t) : Cr(t); }, Mr = function(e, t) { return e === "h" && t === "rtl" ? -1 : 1; }, Er = function(e, t, n, r, o) { var c = Mr(e, window.getComputedStyle(t).direction), s = c * r, u = n.target, h = t.contains(u), m = !1, v = s > 0, i = 0, f = 0; do { var w = Pt(e, u), p = w[0], l = w[1], g = w[2], C = l - g - c * p; (p || C) && It(e, u) && (i += C, f += p), u instanceof ShadowRoot ? u = u.host : u = u.parentNode; } while ( // portaled content !h && u !== document.body || // self content h && (t.contains(u) || t === u) ); return (v && (o && Math.abs(i) < 1 || !o && s > i) || !v && (o && Math.abs(f) < 1 || !o && -s > f)) && (m = !0), m; }, de = function(e) { return "changedTouches" in e ? [e.changedTouches[0].clientX, e.changedTouches[0].clientY] : [0, 0]; }, ot = function(e) { return [e.deltaX, e.deltaY]; }, at = function(e) { return e && "current" in e ? e.current : e; }, br = function(e, t) { return e[0] === t[0] && e[1] === t[1]; }, yr = function(e) { return ` .block-interactivity-`.concat(e, ` {pointer-events: none;} .allow-interactivity-`).concat(e, ` {pointer-events: all;} `); }, Sr = 0, z = []; function Rr(e) { var t = a.useRef([]), n = a.useRef([0, 0]), r = a.useRef(), o = a.useState(Sr++)[0], c = a.useState(Rt)[0], s = a.useRef(e); a.useEffect(function() { s.current = e; }, [e]), a.useEffect(function() { if (e.inert) { document.body.classList.add("block-interactivity-".concat(o)); var l = Xn([e.lockRef.current], (e.shards || []).map(at), !0).filter(Boolean); return l.forEach(function(g) { return g.classList.add("allow-interactivity-".concat(o)); }), function() { document.body.classList.remove("block-interactivity-".concat(o)), l.forEach(function(g) { return g.classList.remove("allow-interactivity-".concat(o)); }); }; } }, [e.inert, e.lockRef.current, e.shards]); var u = a.useCallback(function(l, g) { if ("touches" in l && l.touches.length === 2 || l.type === "wheel" && l.ctrlKey) return !s.current.allowPinchZoom; var C = de(l), E = n.current, b = "deltaX" in l ? l.deltaX : E[0] - C[0], S = "deltaY" in l ? l.deltaY : E[1] - C[1], R, D = l.target, P = Math.abs(b) > Math.abs(S) ? "h" : "v"; if ("touches" in l && P === "h" && D.type === "range") return !1; var _ = rt(P, D); if (!_) return !0; if (_ ? R = P : (R = P === "v" ? "h" : "v", _ = rt(P, D)), !_) return !1; if (!r.current && "changedTouches" in l && (b || S) && (r.current = R), !R) return !0; var F = r.current || R; return Er(F, g, l, F === "h" ? b : S, !0); }, []), h = a.useCallback(function(l) { var g = l; if (!(!z.length || z[z.length - 1] !== c)) { var C = "deltaY" in g ? ot(g) : de(g), E = t.current.filter(function(R) { return R.name === g.type && (R.target === g.target || g.target === R.shadowParent) && br(R.delta, C); })[0]; if (E && E.should) { g.cancelable && g.preventDefault(); return; } if (!E) { var b = (s.current.shards || []).map(at).filter(Boolean).filter(function(R) { return R.contains(g.target); }), S = b.length > 0 ? u(g, b[0]) : !s.current.noIsolation; S && g.cancelable && g.preventDefault(); } } }, []), m = a.useCallback(function(l, g, C, E) { var b = { name: l, delta: g, target: C, should: E, shadowParent: _r(C) }; t.current.push(b), setTimeout(function() { t.current = t.current.filter(function(S) { return S !== b; }); }, 1); }, []), v = a.useCallback(function(l) { n.current = de(l), r.current = void 0; }, []), i = a.useCallback(function(l) { m(l.type, ot(l), l.target, u(l, e.lockRef.current)); }, []), f = a.useCallback(function(l) { m(l.type, de(l), l.target, u(l, e.lockRef.current)); }, []); a.useEffect(function() { return z.push(c), e.setCallbacks({ onScrollCapture: i, onWheelCapture: i, onTouchMoveCapture: f }), document.addEventListener("wheel", h, j), document.addEventListener("touchmove", h, j), document.addEventListener("touchstart", v, j), function() { z = z.filter(function(l) { return l !== c; }), document.removeEventListener("wheel", h, j), document.removeEventListener("touchmove", h, j), document.removeEventListener("touchstart", v, j); }; }, []); var w = e.removeScrollBar, p = e.inert; return a.createElement( a.Fragment, null, p ? a.createElement(c, { styles: yr(o) }) : null, w ? a.createElement(pr, { gapMode: e.gapMode }) : null ); } function _r(e) { for (var t = null; e !== null; ) e instanceof ShadowRoot && (t = e.host, e = e.host), e = e.parentNode; return t; } const Ir = tr(St, Rr); var Tt = a.forwardRef(function(e, t) { return a.createElement(Ce, x({}, e, { ref: t, sideCar: Ir })); }); Tt.classNames = Ce.classNames; const Pr = Tt; var Le = ["Enter", " "], Tr = ["ArrowDown", "PageUp", "Home"], At = ["ArrowUp", "PageDown", "End"], Ar = [...Tr, ...At], Dr = { ltr: [...Le, "ArrowRight"], rtl: [...Le, "ArrowLeft"] }, Nr = { ltr: ["ArrowLeft"], rtl: ["ArrowRight"] }, oe = "Menu", [ne, xr, Or] = dt(oe), [W, Dt] = he(oe, [ Or, st, ht ]), Me = st(), Nt = ht(), [Fr, V] = W(oe), [kr, ae] = W(oe), xt = (e) => { const { __scopeMenu: t, open: n = !1, children: r, dir: o, onOpenChange: c, modal: s = !0 } = e, u = Me(t), [h, m] = a.useState(null), v = a.useRef(!1), i = te(c), f = ft(o); return a.useEffect(() => { const w = () => { v.current = !0, document.addEventListener("pointerdown", p, { capture: !0, once: !0 }), document.addEventListener("pointermove", p, { capture: !0, once: !0 }); }, p = () => v.current = !1; return document.addEventListener("keydown", w, { capture: !0 }), () => { document.removeEventListener("keydown", w, { capture: !0 }), document.removeEventListener("pointerdown", p, { capture: !0 }), document.removeEventListener("pointermove", p, { capture: !0 }); }; }, []), /* @__PURE__ */ d(wn, { ...u, children: /* @__PURE__ */ d( Fr, { scope: t, open: n, onOpenChange: i, content: h, onContentChange: m, children: /* @__PURE__ */ d( kr, { scope: t, onClose: a.useCallback(() => i(!1), [i]), isUsingKeyboardRef: v, dir: f, modal: s, children: r } ) } ) }); }; xt.displayName = oe; var Lr = "MenuAnchor", Ge = a.forwardRef( (e, t) => { const { __scopeMenu: n, ...r } = e, o = Me(n); return /* @__PURE__ */ d(pn, { ...o, ...r, ref: t }); } ); Ge.displayName = Lr; var Ke = "MenuPortal", [Gr, Ot] = W(Ke, { forceMount: void 0 }), Ft = (e) => { const { __scopeMenu: t, forceMount: n, children: r, container: o } = e, c = V(Ke, t); return /* @__PURE__ */ d(Gr, { scope: t, forceMount: n, children: /* @__PURE__ */ d(ge, { present: n || c.open, children: /* @__PURE__ */ d(lt, { asChild: !0, container: o, children: r }) }) }); }; Ft.displayName = Ke; var A = "MenuContent", [Kr, Ue] = W(A), kt = a.forwardRef( (e, t) => { const n = Ot(A, e.__scopeMenu), { forceMount: r = n.forceMount, ...o } = e, c = V(A, e.__scopeMenu), s = ae(A, e.__scopeMenu); return /* @__PURE__ */ d(ne.Provider, { scope: e.__scopeMenu, children: /* @__PURE__ */ d(ge, { present: r || c.open, children: /* @__PURE__ */ d(ne.Slot, { scope: e.__scopeMenu, children: s.modal ? /* @__PURE__ */ d(Ur, { ...o, ref: t }) : /* @__PURE__ */ d(Br, { ...o, ref: t }) }) }) }); } ), Ur = a.forwardRef( (e, t) => { const n = V(A, e.__scopeMenu), r = a.useRef(null), o = G(t, r); return a.useEffect(() => { const c = r.current; if (c) return Yn(c); }, []), /* @__PURE__ */ d( Be, { ...e, ref: o, trapFocus: n.open, disableOutsidePointerEvents: n.open, disableOutsideScroll: !0, onFocusOutside: y( e.onFocusOutside, (c) => c.preventDefault(), { checkForDefaultPrevented: !1 } ), onDismiss: () => n.onOpenChange(!1) } ); } ), Br = a.forwardRef((e, t) => { const n = V(A, e.__scopeMenu); return /* @__PURE__ */ d( Be, { ...e, ref: t, trapFocus: !1, disableOutsidePointerEvents: !1, disableOutsideScroll: !1, onDismiss: () => n.onOpenChange(!1) } ); }), Be = a.forwardRef( (e, t) => { const { __scopeMenu: n, loop: r = !1, trapFocus: o, onOpenAutoFocus: c, onCloseAutoFocus: s, disableOutsidePointerEvents: u, onEntryFocus: h, onEscapeKeyDown: m, onPointerDownOutside: v, onFocusOutside: i, onInteractOutside: f, onDismiss: w, disableOutsideScroll: p, ...l } = e, g = V(A, n), C = ae(A, n), E = Me(n), b = Nt(n), S = xr(n), [R, D] = a.useState(null), P = a.useRef(null), _ = G(t, P, g.onContentChange), F = a.useRef(0), B = a.useRef(""), q = a.useRef(0), Q = a.useRef(null), ce = a.useRef("right"), ue = a.useRef(0), be = p ? Pr : a.Fragment, k = p ? { as: xe, allowPinchZoom: !0 } : void 0, ln = (M) => { var X, He; const T = B.current + M, N = S().filter((L) => !L.disabled), K = document.activeElement, ye = (X = N.find((L) => L.ref.current === K)) == null ? void 0 : X.textValue, Se = N.map((L) => L.textValue), Xe = Jr(Se, T, ye), J = (He = N.find((L) => L.textValue === Xe)) == null ? void 0 : He.ref.current; (function L(je) { B.current = je, window.clearTimeout(F.current), je !== "" && (F.current = window.setTimeout(() => L(""), 1e3)); })(T), J && setTimeout(() => J.focus()); }; a.useEffect(() => () => window.clearTimeout(F.current), []), bn(); const Y = a.useCallback((M) => { var N, K; return ce.current === ((N = Q.current) == null ? void 0 : N.side) && to(M, (K = Q.current) == null ? void 0 : K.area); }, []); return /* @__PURE__ */ d( Kr, { scope: n, searchRef: B, onItemEnter: a.useCallback( (M) => { Y(M) && M.preventDefault(); }, [Y] ), onItemLeave: a.useCallback( (M) => { var T; Y(M) || ((T = P.current) == null || T.focus(), D(null)); }, [Y] ), onTriggerLeave: a.useCallback( (M) => { Y(M) && M.preventDefault(); }, [Y] ), pointerGraceTimerRef: q, onPointerGraceIntentChange: a.useCallback((M) => { Q.current = M; }, []), children: /* @__PURE__ */ d(be, { ...k, children: /* @__PURE__ */ d( vt, { asChild: !0, trapped: o, onMountAutoFocus: y(c, (M) => { var T; M.preventDefault(), (T = P.current) == null || T.focus({ preventScroll: !0 }); }), onUnmountAutoFocus: s, children: /* @__PURE__ */ d( mn, { asChild: !0, disableOutsidePointerEvents: u, onEscapeKeyDown: m, onPointerDownOutside: v, onFocusOutside: i, onInteractOutside: f, onDismiss: w, children: /* @__PURE__ */ d( Un, { asChild: !0, ...b, dir: C.dir, orientation: "vertical", loop: r, currentTabStopId: R, onCurrentTabStopIdChange: D, onEntryFocus: y(h, (M) => { C.isUsingKeyboardRef.current || M.preventDefault(); }), preventScrollOnEntryFocus: !0, children: /* @__PURE__ */ d( hn, { role: "menu", "aria-orientation": "vertical", "data-state": Qt(g.open), "data-radix-menu-content": "", dir: C.dir, ...E, ...l, ref: _, style: { outline: "none", ...l.style }, onKeyDown: y(l.onKeyDown, (M) => { const N = M.target.closest("[data-radix-menu-content]") === M.currentTarget, K = M.ctrlKey || M.altKey || M.metaKey, ye = M.key.length === 1; N && (M.key === "Tab" && M.preventDefault(), !K && ye && ln(M.key)); const Se = P.current; if (M.target !== Se || !Ar.includes(M.key)) return; M.preventDefault(); const J = S().filter((X) => !X.disabled).map((X) => X.ref.current); At.includes(M.key) && J.reverse(), qr(J); }), onBlur: y(e.onBlur, (M) => { M.currentTarget.contains(M.target) || (window.clearTimeout(F.current), B.current = ""); }), onPointerMove: y( e.onPointerMove, re((M) => { const T = M.target, N = ue.current !== M.clientX; if (M.currentTarget.contains(T) && N) { const K = M.clientX > ue.current ? "right" : "left"; ce.current = K, ue.current = M.clientX; } }) ) } ) } ) } ) } ) }) } ); } ); kt.displayName = A; var $r = "MenuGroup", $e = a.forwardRef( (e, t) => { const { __scopeMenu: n, ...r } = e; return /* @__PURE__ */ d(O.div, { role: "group", ...r, ref: t }); } ); $e.displayName = $r; var Wr = "MenuLabel", Lt = a.forwardRef( (e, t) => { const { __scopeMenu: n, ...r } = e; return /* @__PURE__ */ d(O.div, { ...r, ref: t }); } ); Lt.displayName = Wr; var pe = "MenuItem", ct = "menu.itemSelect", Ee = a.forwardRef( (e, t) => { const { disabled: n = !1, onSelect: r, ...o } = e, c = a.useRef(null), s = ae(pe, e.__scopeMenu), u = Ue(pe, e.__scopeMenu), h = G(t, c), m = a.useRef(!1), v = () => { const i = c.current; if (!n && i) { const f = new CustomEvent(ct, { bubbles: !0, cancelable: !0 }); i.addEventListener(ct, (w) => r == null ? void 0 : r(w), { once: !0 }), vn(i, f), f.defaultPrevented ? m.current = !1 : s.onClose(); } }; return /* @__PURE__ */ d( Gt, { ...o, ref: h, disabled: n, onClick: y(e.onClick, v), onPointerDown: (i) => { var f; (f = e.onPointerDown) == null || f.call(e, i), m.current = !0; }, onPointerUp: y(e.onPointerUp, (i) => { var f; m.current || (f = i.currentTarget) == null || f.click(); }), onKeyDown: y(e.onKeyDown, (i) => { const f = u.searchRef.current !== ""; n || f && i.key === " " || Le.includes(i.key) && (i.currentTarget.click(), i.preventDefault()); }) } ); } ); Ee.displayName = pe; var Gt = a.forwardRef( (e, t) => { const { __scopeMenu: n, disabled: r = !1, textValue: o, ...c } = e, s = Ue(pe, n), u = Nt(n), h = a.useRef(null), m = G(t, h), [v, i] = a.useState(!1), [f, w] = a.useState(""); return a.useEffect(() => { const p = h.current; p && w((p.textContent ?? "").trim()); }, [c.children]), /* @__PURE__ */ d( ne.ItemSlot, { scope: n, disabled: r, textValue: o ?? f, children: /* @__PURE__ */ d(Bn, { asChild: !0, ...u, focusable: !r, children: /* @__PURE__ */ d( O.div, { role: "menuitem", "data-highlighted": v ? "" : void 0, "aria-disabled": r || void 0, "data-disabled": r ? "" : void 0, ...c, ref: m, onPointerMove: y( e.onPointerMove, re((p) => { r ? s.onItemLeave(p) : (s.onItemEnter(p), p.defaultPrevented || p.currentTarget.focus({ preventScroll: !0 })); }) ), onPointerLeave: y( e.onPointerLeave, re((p) => s.onItemLeave(p)) ), onFocus: y(e.onFocus, () => i(!0)), onBlur: y(e.onBlur, () => i(!1)) } ) }) } ); } ), Vr = "MenuCheckboxItem", Kt = a.forwardRef( (e, t) => { const { checked: n = !1, onCheckedChange: r, ...o } = e; return /* @__PURE__ */ d(Vt, { scope: e.__scopeMenu, checked: n, children: /* @__PURE__ */ d( Ee, { role: "menuitemcheckbox", "aria-checked": me(n) ? "mixed" : n, ...o, ref: t, "data-state": Ve(n), onSelect: y( o.onSelect, () => r == null ? void 0 : r(me(n) ? !0 : !n), { checkForDefaultPrevented: !1 } ) } ) }); } ); Kt.displayName = Vr; var Ut = "MenuRadioGroup", [Yr, Xr] = W( Ut, { value: void 0, onValueChange: () => { } } ), Bt = a.forwardRef( (e, t) => { const { value: n, onValueChange: r, ...o } = e, c = te(r); return /* @__PURE__ */ d(Yr, { scope: e.__scopeMenu, value: n, onValueChange: c, children: /* @__PURE__ */ d($e, { ...o, ref: t }) }); } ); Bt.displayName = Ut; var $t = "MenuRadioItem", Wt = a.forwardRef( (e, t) => { const { value: n, ...r } = e, o = Xr($t, e.__scopeMenu), c = n === o.value; return /* @__PURE__ */ d(Vt, { scope: e.__scopeMenu, checked: c, children: /* @__PURE__ */ d( Ee, { role: "menuitemradio", "aria-checked": c, ...r, ref: t, "data-state": Ve(c), onSelect: y( r.onSelect, () => { var s; return (s = o.onValueChange) == null ? void 0 : s.call(o, n); }, { checkForDefaultPrevented: !1 } ) } ) }); } ); Wt.displayName = $t; var We = "MenuItemIndicator", [Vt, Hr] = W( We, { checked: !1 } ), Yt = a.forwardRef( (e, t) => { const { __scopeMenu: n, forceMount: r, ...o } = e, c = Hr(We, n); return /* @__PURE__ */ d( ge, { present: r || me(c.checked) || c.checked === !0, children: /* @__PURE__ */ d( O.span, { ...o, ref: t, "data-state": Ve(c.checked) } ) } ); } ); Yt.displayName = We; var jr = "MenuSeparator", Xt = a.forwardRef( (e, t) => { const { __scopeMenu: n, ...r } = e; return /* @__PURE__ */ d( O.div, { role: "separator", "aria-orientation": "horizontal", ...r, ref: t } ); } ); Xt.displayName = jr; var zr = "MenuArrow", Ht = a.forwardRef( (e, t) => { const { __scopeMenu: n, ...r } = e, o = Me(n); return /* @__PURE__ */ d(gn, { ...o, ...r, ref: t }); } ); Ht.displayName = zr; var Zr = "MenuSub", [Yo, jt] = W(Zr), ee = "MenuSubTrigger", zt = a.forwardRef( (e, t) => { const n = V(ee, e.__scopeMenu), r = ae(ee, e.__scopeMenu), o = jt(ee, e.__scopeMenu), c = Ue(ee, e.__scopeMenu), s = a.useRef(null), { pointerGraceTimerRef: u, onPointerGraceIntentChange: h } = c, m = { __scopeMenu: e.__scopeMenu }, v = a.useCallback(() => { s.current && window.clearTimeout(s.current), s.current = null; }, []); return a.useEffect(() => v, [v]), a.useEffect(() => { const i = u.current; return () => { window.clearTimeout(i), h(null); }; }, [u, h]), /* @__PURE__ */ d(Ge, { asChild: !0, ...m, children: /* @__PURE__ */ d( Gt, { id: o.triggerId, "aria-haspopup": "menu", "aria-expanded": n.open, "aria-controls": o.contentId, "data-state": Qt(n.open), ...e, ref: it(t, o.onTriggerChange), onClick: (i) => { var f; (f = e.onClick) == null || f.call(e, i), !(e.disabled || i.defaultPrevented) && (i.currentTarget.focus(), n.open || n.onOpenChange(!0)); }, onPointerMove: y( e.onPointerMove, re((i) => { c.onItemEnter(i), !i.defaultPrevented && !e.disabled && !n.open && !s.current && (c.onPointerGraceIntentChange(null), s.current = window.setTimeout(() => { n.onOpenChange(!0), v(); }, 100)); }) ), onPointerLeave: y( e.onPointerLeave, re((i) => { var w, p; v(); const f = (w = n.content) == null ? void 0 : w.getBoundingClientRect(); if (f) { const l = (p = n.content) == null ? void 0 : p.dataset.side, g = l === "right", C = g ? -5 : 5, E = f[g ? "left" : "right"], b = f[g ? "right" : "left"]; c.onPointerGraceIntentChange({ area: [ // Apply a bleed on clientX to ensure that our exit point is // consistently within polygon bounds { x: i.clientX + C, y: i.clientY }, { x: E, y: f.top }, { x: b, y: f.top }, { x: b, y: f.bottom }, { x: E, y: f.bottom } ], side: l }), window.clearTimeout(u.current), u.current = window.setTimeout( () => c.onPointerGraceIntentChange(null), 300 ); } else { if (c.onTriggerLeave(i), i.defaultPrevented) return; c.onPointerGraceIntentChange(null); } }) ), onKeyDown: y(e.onKeyDown, (i) => { var w; const f = c.searchRef.current !== ""; e.disabled || f && i.key === " " || Dr[r.dir].includes(i.key) && (n.onOpenChange(!0), (w = n.content) == null || w.focus(), i.preventDefault()); }) } ) }); } ); zt.displayName = ee; var Zt = "MenuSubContent", qt = a.forwardRef( (e, t) => { const n = Ot(A, e.__scopeMenu), { forceMount: r = n.forceMount, ...o } = e, c = V(A, e.__scopeMenu), s = ae(A, e.__scopeMenu), u = jt(Zt, e.__scopeMenu), h = a.useRef(null), m = G(t, h); return /* @__PURE__ */ d(ne.Provider, { scope: e.__scopeMenu, children: /* @__PURE__ */ d(ge, { present: r || c.open, children: /* @__PURE__ */ d(ne.Slot, { scope: e.__scopeMenu, children: /* @__PURE__ */ d( Be, { id: u.contentId, "aria-labelledby": u.triggerId, ...o, ref: m, align: "start", side: s.dir === "rtl" ? "left" : "right", disableOutsidePointerEvents: !1, disableOutsideScroll: !1, trapFocus: !1, onOpenAutoFocus: (v) => { var i; s.isUsingKeyboardRef.current && ((i = h.current) == null || i.focus()), v.preventDefault(); }, onCloseAutoFocus: (v) => v.preventDefault(), onFocusOutside: y(e.onFocusOutside, (v) => { v.target !== u.trigger && c.onOpenChange(!1); }), onEscapeKeyDown: y(e.onEscapeKeyDown, (v) => { s.onClose(), v.preventDefault(); }), onKeyDown: y(e.onKeyDown, (v) => { var w; const i = v.currentTarget.contains(v.target), f = Nr[s.dir].includes(v.key); i && f && (c.onOpenChange(!1), (w = u.trigger) == null || w.focus(), v.preventDefault()); }) } ) }) }) }); } ); qt.displayName = Zt; function Qt(e) { return e ? "open" : "closed"; } function me(e) { return e === "indeterminate"; } function Ve(e) { return me(e) ? "indeterminate" : e ? "checked" : "unchecked"; } function qr(e) { const t = document.activeElement; for (const n of e) if (n === t || (n.focus(), document.activeElement !== t)) return; } function Qr(e, t) { return e.map((n, r) => e[(t + r) % e.length]); } function Jr(e, t, n) { const o = t.length > 1 && Array.from(t).every((m) => m === t[0]) ? t[0] : t, c = n ? e.indexOf(n) : -1; let s = Qr(e, Math.max(c, 0)); o.length === 1 && (s = s.filter((m) => m !== n)); const h = s.find( (m) => m.toLowerCase().startsWith(o.toLowerCase()) ); return h !== n ? h : void 0; } function eo(e, t) { const { x: n, y: r } = e; let o = !1; for (let c = 0, s = t.length - 1; c < t.length; s = c++) { const u = t[c].x, h = t[c].y, m = t[s].x, v = t[s].y; h > r != v > r && n < (m - u) * (r - h) / (v - h) + u && (o = !o); } return o; } function to(e, t) { if (!t) return !1; const n = { x: e.clientX, y: e.clientY }; return eo(n, t); } function re(e) { return (t) => t.pointerType === "mouse" ? e(t) : void 0; } var no = xt, ro = Ge, oo = Ft, ao = kt, co = $e, uo = Lt, io = Ee, so = Kt, lo = Bt, fo = Wt, vo = Yt, po = Xt, mo = Ht, ho = zt, go = qt, Ye = "DropdownMenu", [wo, Xo] = he( Ye, [Dt] ), I = Dt(), [Co, Jt] = wo(Ye), en = (e) => { const { __scopeDropdownMenu: t, children: n, dir: r, open: o, defaultOpen: c, onO