UNPKG

@pdf-viewer/react

Version:

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

1,422 lines (1,421 loc) 55 kB
import * as o from "react"; import V from "react"; import { g as Te, P as D, c as de, u as G, i as Ne, d as gn, e as ot, a as S, b as Ee, j as at, f as wn } from "./index-6e0e48fa.js"; import { jsx as l } from "react/jsx-runtime"; import { u as ne, a as De, D as Cn } from "./index-e3a67935.js"; import { u as Mn, a as En, o as Rn, s as bn, l as Sn, f as yn, b as _n, c as Pn, h as In } from "./floating-ui.react-dom-4b1e2e46.js"; import An from "react-dom"; import { c as xn, _ as Tn, u as Nn, a as te, f as Dn, z as On, s as Fn, b as kn, R as Ln, e as Gn, h as Kn } from "./component-2aa6e53b.js"; var Un = "Portal", ct = o.forwardRef((e, t) => { var s; const { container: n, ...r } = e, [a, c] = o.useState(!1); Te(() => c(!0), []); const u = n || a && ((s = globalThis == null ? void 0 : globalThis.document) == null ? void 0 : s.body); return u ? An.createPortal(/* @__PURE__ */ l(D.div, { ...r, ref: t }), u) : null; }); ct.displayName = Un; function st(e) { const t = e + "CollectionProvider", [n, r] = de(t), [a, c] = n( t, { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() } ), u = (i) => { const { scope: p, children: g } = i, E = V.useRef(null), w = V.useRef(/* @__PURE__ */ new Map()).current; return /* @__PURE__ */ l(a, { scope: p, itemMap: w, collectionRef: E, children: g }); }; u.displayName = t; const s = e + "CollectionSlot", h = Ne(s), m = V.forwardRef( (i, p) => { const { scope: g, children: E } = i, w = c(s, g), R = G(p, w.collectionRef); return /* @__PURE__ */ l(h, { ref: R, children: E }); } ); m.displayName = s; const f = e + "CollectionItemSlot", d = "data-radix-collection-item", v = Ne(f), C = V.forwardRef( (i, p) => { const { scope: g, children: E, ...w } = i, R = V.useRef(null), y = G(p, R), _ = c(f, g); return V.useEffect(() => (_.itemMap.set(R, { ref: R, ...w }), () => void _.itemMap.delete(R))), /* @__PURE__ */ l(v, { [d]: "", ref: y, children: E }); } ); C.displayName = f; function M(i) { const p = c(e + "CollectionConsumer", i); return V.useCallback(() => { const E = p.collectionRef.current; if (!E) return []; const w = Array.from(E.querySelectorAll(`[${d}]`)); return Array.from(p.itemMap.values()).sort( (_, I) => w.indexOf(_.ref.current) - w.indexOf(I.ref.current) ); }, [p.collectionRef, p.itemMap]); } return [ { Provider: u, Slot: m, ItemSlot: C }, M, r ]; } var $n = o.createContext(void 0); function it(e) { const t = o.useContext($n); return e || t || "ltr"; } var _e = 0; function Bn() { o.useEffect(() => { const e = document.querySelectorAll("[data-radix-focus-guard]"); return document.body.insertAdjacentElement("afterbegin", e[0] ?? ze()), document.body.insertAdjacentElement("beforeend", e[1] ?? ze()), _e++, () => { _e === 1 && document.querySelectorAll("[data-radix-focus-guard]").forEach((t) => t.remove()), _e--; }; }, []); } 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 Pe = "focusScope.autoFocusOnMount", Ie = "focusScope.autoFocusOnUnmount", Ze = { bubbles: !1, cancelable: !0 }, Yn = "FocusScope", ut = o.forwardRef((e, t) => { const { loop: n = !1, trapped: r = !1, onMountAutoFocus: a, onUnmountAutoFocus: c, ...u } = e, [s, h] = o.useState(null), m = ne(a), f = ne(c), d = o.useRef(null), v = G(t, (i) => h(i)), C = o.useRef({ paused: !1, pause() { this.paused = !0; }, resume() { this.paused = !1; } }).current; o.useEffect(() => { if (r) { let i = function(w) { if (C.paused || !s) return; const R = w.target; s.contains(R) ? d.current = R : H(d.current, { select: !0 }); }, p = function(w) { if (C.paused || !s) return; const R = w.relatedTarget; R !== null && (s.contains(R) || H(d.current, { select: !0 })); }, g = function(w) { if (document.activeElement === document.body) for (const y of w) y.removedNodes.length > 0 && H(s); }; document.addEventListener("focusin", i), document.addEventListener("focusout", p); const E = new MutationObserver(g); return s && E.observe(s, { childList: !0, subtree: !0 }), () => { document.removeEventListener("focusin", i), document.removeEventListener("focusout", p), E.disconnect(); }; } }, [r, s, C.paused]), o.useEffect(() => { if (s) { Qe.add(C); const i = document.activeElement; if (!s.contains(i)) { const g = new CustomEvent(Pe, Ze); s.addEventListener(Pe, m), s.dispatchEvent(g), g.defaultPrevented || (Hn(zn(lt(s)), { select: !0 }), document.activeElement === i && H(s)); } return () => { s.removeEventListener(Pe, m), setTimeout(() => { const g = new CustomEvent(Ie, Ze); s.addEventListener(Ie, f), s.dispatchEvent(g), g.defaultPrevented || H(i ?? document.body, { select: !0 }), s.removeEventListener(Ie, f), Qe.remove(C); }, 0); }; } }, [s, m, f, C]); const M = o.useCallback( (i) => { if (!n && !r || C.paused) return; const p = i.key === "Tab" && !i.altKey && !i.ctrlKey && !i.metaKey, g = document.activeElement; if (p && g) { const E = i.currentTarget, [w, R] = Wn(E); w && R ? !i.shiftKey && g === R ? (i.preventDefault(), n && H(w, { select: !0 })) : i.shiftKey && g === w && (i.preventDefault(), n && H(R, { select: !0 })) : g === E && i.preventDefault(); } }, [n, r, C.paused] ); return /* @__PURE__ */ l(D.div, { tabIndex: -1, ...u, ref: v, onKeyDown: M }); }); ut.displayName = Yn; function Hn(e, { select: t = !1 } = {}) { const n = document.activeElement; for (const r of e) if (H(r, { select: t }), document.activeElement !== n) return; } function Wn(e) { const t = lt(e), n = qe(t, e), r = qe(t.reverse(), e); return [n, r]; } function lt(e) { const t = [], n = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, { acceptNode: (r) => { const a = r.tagName === "INPUT" && r.type === "hidden"; return r.disabled || r.hidden || a ? 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 (!Xn(n, { upTo: t })) return n; } function Xn(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 Vn(e) { return e instanceof HTMLInputElement && "select" in e; } function H(e, { select: t = !1 } = {}) { if (e && e.focus) { const n = document.activeElement; e.focus({ preventScroll: !0 }), e !== n && Vn(e) && t && e.select(); } } var Qe = jn(); function jn() { 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 zn(e) { return e.filter((t) => t.tagName !== "A"); } var Zn = "Arrow", dt = o.forwardRef((e, t) => { const { children: n, width: r = 10, height: a = 5, ...c } = e; return /* @__PURE__ */ l( D.svg, { ...c, ref: t, width: r, height: a, viewBox: "0 0 30 10", preserveAspectRatio: "none", children: e.asChild ? n : /* @__PURE__ */ l("polygon", { points: "0,0 30,0 15,10" }) } ); }); dt.displayName = Zn; var qn = dt, Le = "Popper", [ft, pt] = de(Le), [Qn, mt] = ft(Le), vt = (e) => { const { __scopePopper: t, children: n } = e, [r, a] = o.useState(null); return /* @__PURE__ */ l(Qn, { scope: t, anchor: r, onAnchorChange: a, children: n }); }; vt.displayName = Le; var ht = "PopperAnchor", gt = o.forwardRef( (e, t) => { const { __scopePopper: n, virtualRef: r, ...a } = e, c = mt(ht, n), u = o.useRef(null), s = G(t, u); return o.useEffect(() => { c.onAnchorChange((r == null ? void 0 : r.current) || u.current); }), r ? null : /* @__PURE__ */ l(D.div, { ...a, ref: s }); } ); gt.displayName = ht; var Ge = "PopperContent", [Jn, er] = ft(Ge), wt = o.forwardRef( (e, t) => { var B, ae, O, ce, Xe, Ve; const { __scopePopper: n, side: r = "bottom", sideOffset: a = 0, align: c = "center", alignOffset: u = 0, arrowPadding: s = 0, avoidCollisions: h = !0, collisionBoundary: m = [], collisionPadding: f = 0, sticky: d = "partial", hideWhenDetached: v = !1, updatePositionStrategy: C = "optimized", onPlaced: M, ...i } = e, p = mt(Ge, n), [g, E] = o.useState(null), w = G(t, (se) => E(se)), [R, y] = o.useState(null), _ = gn(R), I = (_ == null ? void 0 : _.width) ?? 0, P = (_ == null ? void 0 : _.height) ?? 0, k = r + (c !== "center" ? "-" + c : ""), U = typeof f == "number" ? f : { top: 0, right: 0, bottom: 0, left: 0, ...f }, Y = Array.isArray(m) ? m : [m], W = Y.length > 0, $ = { padding: U, boundary: Y.filter(nr), // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries altBoundary: W }, { refs: Z, floatingStyles: q, placement: L, isPositioned: Q, middlewareData: N } = Mn({ // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues strategy: "fixed", placement: k, whileElementsMounted: (...se) => En(...se, { animationFrame: C === "always" }), elements: { reference: p.anchor }, middleware: [ Rn({ mainAxis: a + P, alignmentAxis: u }), h && bn({ mainAxis: !0, crossAxis: !1, limiter: d === "partial" ? Sn() : void 0, ...$ }), h && yn({ ...$ }), _n({ ...$, apply: ({ elements: se, rects: je, availableWidth: pn, availableHeight: mn }) => { const { width: vn, height: hn } = je.reference, he = se.floating.style; he.setProperty("--radix-popper-available-width", `${pn}px`), he.setProperty("--radix-popper-available-height", `${mn}px`), he.setProperty("--radix-popper-anchor-width", `${vn}px`), he.setProperty("--radix-popper-anchor-height", `${hn}px`); } }), R && Pn({ element: R, padding: s }), rr({ arrowWidth: I, arrowHeight: P }), v && In({ strategy: "referenceHidden", ...$ }) ] }), [b, T] = Et(L), A = ne(M); Te(() => { Q && (A == null || A()); }, [Q, A]); const K = (B = N.arrow) == null ? void 0 : B.x, re = (ae = N.arrow) == null ? void 0 : ae.y, oe = ((O = N.arrow) == null ? void 0 : O.centerOffset) !== 0, [ve, X] = o.useState(); return Te(() => { g && X(window.getComputedStyle(g).zIndex); }, [g]), /* @__PURE__ */ l( "div", { ref: Z.setFloating, "data-radix-popper-content-wrapper": "", style: { ...q, transform: Q ? q.transform : "translate(0, -200%)", // keep off the page when measuring minWidth: "max-content", zIndex: ve, "--radix-popper-transform-origin": [ (ce = N.transformOrigin) == null ? void 0 : ce.x, (Xe = N.transformOrigin) == null ? void 0 : Xe.y ].join(" "), // hide the content if using the hide middleware and should be hidden // set visibility to hidden and disable pointer events so the UI behaves // as if the PopperContent isn't there at all ...((Ve = N.hide) == null ? void 0 : Ve.referenceHidden) && { visibility: "hidden", pointerEvents: "none" } }, dir: e.dir, children: /* @__PURE__ */ l( Jn, { scope: n, placedSide: b, onArrowChange: y, arrowX: K, arrowY: re, shouldHideArrow: oe, children: /* @__PURE__ */ l( D.div, { "data-side": b, "data-align": T, ...i, ref: w, style: { ...i.style, // if the PopperContent hasn't been placed yet (not all measurements done) // we prevent animations so that users's animation don't kick in too early referring wrong sides animation: Q ? void 0 : "none" } } ) } ) } ); } ); wt.displayName = Ge; var Ct = "PopperArrow", tr = { top: "bottom", right: "left", bottom: "top", left: "right" }, Mt = o.forwardRef(function(t, n) { const { __scopePopper: r, ...a } = t, c = er(Ct, r), u = tr[c.placedSide]; return ( // we have to use an extra wrapper because `ResizeObserver` (used by `useSize`) // doesn't report size as we'd expect on SVG elements. // it reports their bounding box which is effectively the largest path inside the SVG. /* @__PURE__ */ l( "span", { ref: c.onArrowChange, style: { position: "absolute", left: c.arrowX, top: c.arrowY, [u]: 0, transformOrigin: { top: "", right: "0 0", bottom: "center 0", left: "100% 0" }[c.placedSide], transform: { top: "translateY(100%)", right: "translateY(50%) rotate(90deg) translateX(-50%)", bottom: "rotate(180deg)", left: "translateY(50%) rotate(-90deg) translateX(50%)" }[c.placedSide], visibility: c.shouldHideArrow ? "hidden" : void 0 }, children: /* @__PURE__ */ l( qn, { ...a, ref: n, style: { ...a.style, // ensures the element can be measured correctly (mostly for if SVG) display: "block" } } ) } ) ); }); Mt.displayName = Ct; function nr(e) { return e !== null; } var rr = (e) => ({ name: "transformOrigin", options: e, fn(t) { var p, g, E; const { placement: n, rects: r, middlewareData: a } = t, u = ((p = a.arrow) == null ? void 0 : p.centerOffset) !== 0, s = u ? 0 : e.arrowWidth, h = u ? 0 : e.arrowHeight, [m, f] = Et(n), d = { start: "0%", center: "50%", end: "100%" }[f], v = (((g = a.arrow) == null ? void 0 : g.x) ?? 0) + s / 2, C = (((E = a.arrow) == null ? void 0 : E.y) ?? 0) + h / 2; let M = "", i = ""; return m === "bottom" ? (M = u ? d : `${v}px`, i = `${-h}px`) : m === "top" ? (M = u ? d : `${v}px`, i = `${r.floating.height + h}px`) : m === "right" ? (M = `${-h}px`, i = u ? d : `${C}px`) : m === "left" && (M = `${r.floating.width + h}px`, i = u ? d : `${C}px`), { data: { x: M, y: i } }; } }); function Et(e) { const [t, n = "center"] = e.split("-"); return [t, n]; } var or = vt, ar = gt, cr = wt, sr = Mt, Ae = "rovingFocusGroup.onEntryFocus", ir = { bubbles: !1, cancelable: !0 }, fe = "RovingFocusGroup", [Oe, Rt, ur] = st(fe), [lr, bt] = de( fe, [ur] ), [dr, fr] = lr(fe), St = o.forwardRef( (e, t) => /* @__PURE__ */ l(Oe.Provider, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ l(Oe.Slot, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ l(pr, { ...e, ref: t }) }) }) ); St.displayName = fe; var pr = o.forwardRef((e, t) => { const { __scopeRovingFocusGroup: n, orientation: r, loop: a = !1, dir: c, currentTabStopId: u, defaultCurrentTabStopId: s, onCurrentTabStopIdChange: h, onEntryFocus: m, preventScrollOnEntryFocus: f = !1, ...d } = e, v = o.useRef(null), C = G(t, v), M = it(c), [i, p] = ot({ prop: u, defaultProp: s ?? null, onChange: h, caller: fe }), [g, E] = o.useState(!1), w = ne(m), R = Rt(n), y = o.useRef(!1), [_, I] = o.useState(0); return o.useEffect(() => { const P = v.current; if (P) return P.addEventListener(Ae, w), () => P.removeEventListener(Ae, w); }, [w]), /* @__PURE__ */ l( dr, { scope: n, orientation: r, dir: M, loop: a, currentTabStopId: i, onItemFocus: o.useCallback( (P) => p(P), [p] ), onItemShiftTab: o.useCallback(() => E(!0), []), onFocusableItemAdd: o.useCallback( () => I((P) => P + 1), [] ), onFocusableItemRemove: o.useCallback( () => I((P) => P - 1), [] ), children: /* @__PURE__ */ l( D.div, { tabIndex: g || _ === 0 ? -1 : 0, "data-orientation": r, ...d, ref: C, style: { outline: "none", ...e.style }, onMouseDown: S(e.onMouseDown, () => { y.current = !0; }), onFocus: S(e.onFocus, (P) => { const k = !y.current; if (P.target === P.currentTarget && k && !g) { const U = new CustomEvent(Ae, ir); if (P.currentTarget.dispatchEvent(U), !U.defaultPrevented) { const Y = R().filter((L) => L.focusable), W = Y.find((L) => L.active), $ = Y.find((L) => L.id === i), q = [W, $, ...Y].filter( Boolean ).map((L) => L.ref.current); Pt(q, f); } } y.current = !1; }), onBlur: S(e.onBlur, () => E(!1)) } ) } ); }), yt = "RovingFocusGroupItem", _t = o.forwardRef( (e, t) => { const { __scopeRovingFocusGroup: n, focusable: r = !0, active: a = !1, tabStopId: c, children: u, ...s } = e, h = De(), m = c || h, f = fr(yt, n), d = f.currentTabStopId === m, v = Rt(n), { onFocusableItemAdd: C, onFocusableItemRemove: M, currentTabStopId: i } = f; return o.useEffect(() => { if (r) return C(), () => M(); }, [r, C, M]), /* @__PURE__ */ l( Oe.ItemSlot, { scope: n, id: m, focusable: r, active: a, children: /* @__PURE__ */ l( D.span, { tabIndex: d ? 0 : -1, "data-orientation": f.orientation, ...s, ref: t, onMouseDown: S(e.onMouseDown, (p) => { r ? f.onItemFocus(m) : p.preventDefault(); }), onFocus: S(e.onFocus, () => f.onItemFocus(m)), onKeyDown: S(e.onKeyDown, (p) => { if (p.key === "Tab" && p.shiftKey) { f.onItemShiftTab(); return; } if (p.target !== p.currentTarget) return; const g = hr(p, f.orientation, f.dir); if (g !== void 0) { if (p.metaKey || p.ctrlKey || p.altKey || p.shiftKey) return; p.preventDefault(); let w = v().filter((R) => R.focusable).map((R) => R.ref.current); if (g === "last") w.reverse(); else if (g === "prev" || g === "next") { g === "prev" && w.reverse(); const R = w.indexOf(p.currentTarget); w = f.loop ? gr(w, R + 1) : w.slice(R + 1); } setTimeout(() => Pt(w)); } }), children: typeof u == "function" ? u({ isCurrentTabStop: d, hasTabStop: i != null }) : u } ) } ); } ); _t.displayName = yt; var mr = { ArrowLeft: "prev", ArrowUp: "prev", ArrowRight: "next", ArrowDown: "next", PageUp: "first", Home: "first", PageDown: "last", End: "last" }; function vr(e, t) { return t !== "rtl" ? e : e === "ArrowLeft" ? "ArrowRight" : e === "ArrowRight" ? "ArrowLeft" : e; } function hr(e, t, n) { const r = vr(e.key, n); if (!(t === "vertical" && ["ArrowLeft", "ArrowRight"].includes(r)) && !(t === "horizontal" && ["ArrowUp", "ArrowDown"].includes(r))) return mr[r]; } function Pt(e, t = !1) { const n = document.activeElement; for (const r of e) if (r === n || (r.focus({ preventScroll: t }), document.activeElement !== n)) return; } function gr(e, t) { return e.map((n, r) => e[(t + r) % e.length]); } var wr = St, Cr = _t, It = xn(), xe = function() { }, Re = o.forwardRef(function(e, t) { var n = o.useRef(null), r = o.useState({ onScrollCapture: xe, onWheelCapture: xe, onTouchMoveCapture: xe }), a = r[0], c = r[1], u = e.forwardProps, s = e.children, h = e.className, m = e.removeScrollBar, f = e.enabled, d = e.shards, v = e.sideCar, C = e.noRelative, M = e.noIsolation, i = e.inert, p = e.allowPinchZoom, g = e.as, E = g === void 0 ? "div" : g, w = e.gapMode, R = Tn(e, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noRelative", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]), y = v, _ = Nn([n, t]), I = te(te({}, R), a); return o.createElement( o.Fragment, null, f && o.createElement(y, { sideCar: It, removeScrollBar: m, shards: d, noRelative: C, noIsolation: M, inert: i, setCallbacks: c, allowPinchZoom: !!p, lockRef: n, gapMode: w }), u ? o.cloneElement(o.Children.only(s), te(te({}, I), { ref: _ })) : o.createElement(E, te({}, I, { className: h, ref: _ }), s) ); }); Re.defaultProps = { enabled: !0, removeScrollBar: !0, inert: !1 }; Re.classNames = { fullWidth: Dn, zeroRight: On }; var Fe = !1; if (typeof window < "u") try { var ge = Object.defineProperty({}, "passive", { get: function() { return Fe = !0, !0; } }); window.addEventListener("test", ge, ge), window.removeEventListener("test", ge, ge); } catch { Fe = !1; } var J = Fe ? { passive: !1 } : !1, Mr = function(e) { return e.tagName === "TEXTAREA"; }, At = 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") ); }, Er = function(e) { return At(e, "overflowY"); }, Rr = function(e) { return At(e, "overflowX"); }, et = function(e, t) { var n = t.ownerDocument, r = t; do { typeof ShadowRoot < "u" && r instanceof ShadowRoot && (r = r.host); var a = xt(e, r); if (a) { var c = Tt(e, r), u = c[1], s = c[2]; if (u > s) return !0; } r = r.parentNode; } while (r && r !== n.body); return !1; }, br = function(e) { var t = e.scrollTop, n = e.scrollHeight, r = e.clientHeight; return [ t, n, r ]; }, Sr = function(e) { var t = e.scrollLeft, n = e.scrollWidth, r = e.clientWidth; return [ t, n, r ]; }, xt = function(e, t) { return e === "v" ? Er(t) : Rr(t); }, Tt = function(e, t) { return e === "v" ? br(t) : Sr(t); }, yr = function(e, t) { return e === "h" && t === "rtl" ? -1 : 1; }, _r = function(e, t, n, r, a) { var c = yr(e, window.getComputedStyle(t).direction), u = c * r, s = n.target, h = t.contains(s), m = !1, f = u > 0, d = 0, v = 0; do { if (!s) break; var C = Tt(e, s), M = C[0], i = C[1], p = C[2], g = i - p - c * M; (M || g) && xt(e, s) && (d += g, v += M); var E = s.parentNode; s = E && E.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? E.host : E; } while ( // portaled content !h && s !== document.body || // self content h && (t.contains(s) || t === s) ); return (f && (a && Math.abs(d) < 1 || !a && u > d) || !f && (a && Math.abs(v) < 1 || !a && -u > v)) && (m = !0), m; }, we = function(e) { return "changedTouches" in e ? [e.changedTouches[0].clientX, e.changedTouches[0].clientY] : [0, 0]; }, tt = function(e) { return [e.deltaX, e.deltaY]; }, nt = function(e) { return e && "current" in e ? e.current : e; }, Pr = function(e, t) { return e[0] === t[0] && e[1] === t[1]; }, Ir = function(e) { return ` .block-interactivity-`.concat(e, ` {pointer-events: none;} .allow-interactivity-`).concat(e, ` {pointer-events: all;} `); }, Ar = 0, ee = []; function xr(e) { var t = o.useRef([]), n = o.useRef([0, 0]), r = o.useRef(), a = o.useState(Ar++)[0], c = o.useState(Fn)[0], u = o.useRef(e); o.useEffect(function() { u.current = e; }, [e]), o.useEffect(function() { if (e.inert) { document.body.classList.add("block-interactivity-".concat(a)); var i = kn([e.lockRef.current], (e.shards || []).map(nt), !0).filter(Boolean); return i.forEach(function(p) { return p.classList.add("allow-interactivity-".concat(a)); }), function() { document.body.classList.remove("block-interactivity-".concat(a)), i.forEach(function(p) { return p.classList.remove("allow-interactivity-".concat(a)); }); }; } }, [e.inert, e.lockRef.current, e.shards]); var s = o.useCallback(function(i, p) { if ("touches" in i && i.touches.length === 2 || i.type === "wheel" && i.ctrlKey) return !u.current.allowPinchZoom; var g = we(i), E = n.current, w = "deltaX" in i ? i.deltaX : E[0] - g[0], R = "deltaY" in i ? i.deltaY : E[1] - g[1], y, _ = i.target, I = Math.abs(w) > Math.abs(R) ? "h" : "v"; if ("touches" in i && I === "h" && _.type === "range") return !1; var P = et(I, _); if (!P) return !0; if (P ? y = I : (y = I === "v" ? "h" : "v", P = et(I, _)), !P) return !1; if (!r.current && "changedTouches" in i && (w || R) && (r.current = y), !y) return !0; var k = r.current || y; return _r(k, p, i, k === "h" ? w : R, !0); }, []), h = o.useCallback(function(i) { var p = i; if (!(!ee.length || ee[ee.length - 1] !== c)) { var g = "deltaY" in p ? tt(p) : we(p), E = t.current.filter(function(y) { return y.name === p.type && (y.target === p.target || p.target === y.shadowParent) && Pr(y.delta, g); })[0]; if (E && E.should) { p.cancelable && p.preventDefault(); return; } if (!E) { var w = (u.current.shards || []).map(nt).filter(Boolean).filter(function(y) { return y.contains(p.target); }), R = w.length > 0 ? s(p, w[0]) : !u.current.noIsolation; R && p.cancelable && p.preventDefault(); } } }, []), m = o.useCallback(function(i, p, g, E) { var w = { name: i, delta: p, target: g, should: E, shadowParent: Tr(g) }; t.current.push(w), setTimeout(function() { t.current = t.current.filter(function(R) { return R !== w; }); }, 1); }, []), f = o.useCallback(function(i) { n.current = we(i), r.current = void 0; }, []), d = o.useCallback(function(i) { m(i.type, tt(i), i.target, s(i, e.lockRef.current)); }, []), v = o.useCallback(function(i) { m(i.type, we(i), i.target, s(i, e.lockRef.current)); }, []); o.useEffect(function() { return ee.push(c), e.setCallbacks({ onScrollCapture: d, onWheelCapture: d, onTouchMoveCapture: v }), document.addEventListener("wheel", h, J), document.addEventListener("touchmove", h, J), document.addEventListener("touchstart", f, J), function() { ee = ee.filter(function(i) { return i !== c; }), document.removeEventListener("wheel", h, J), document.removeEventListener("touchmove", h, J), document.removeEventListener("touchstart", f, J); }; }, []); var C = e.removeScrollBar, M = e.inert; return o.createElement( o.Fragment, null, M ? o.createElement(c, { styles: Ir(a) }) : null, C ? o.createElement(Ln, { noRelative: e.noRelative, gapMode: e.gapMode }) : null ); } function Tr(e) { for (var t = null; e !== null; ) e instanceof ShadowRoot && (t = e.host, e = e.host), e = e.parentNode; return t; } const Nr = Gn(It, xr); var Nt = o.forwardRef(function(e, t) { return o.createElement(Re, te({}, e, { ref: t, sideCar: Nr })); }); Nt.classNames = Re.classNames; const Dr = Nt; var ke = ["Enter", " "], Or = ["ArrowDown", "PageUp", "Home"], Dt = ["ArrowUp", "PageDown", "End"], Fr = [...Or, ...Dt], kr = { ltr: [...ke, "ArrowRight"], rtl: [...ke, "ArrowLeft"] }, Lr = { ltr: ["ArrowLeft"], rtl: ["ArrowRight"] }, pe = "Menu", [ue, Gr, Kr] = st(pe), [j, Ot] = de(pe, [ Kr, pt, bt ]), be = pt(), Ft = bt(), [Ur, z] = j(pe), [$r, me] = j(pe), kt = (e) => { const { __scopeMenu: t, open: n = !1, children: r, dir: a, onOpenChange: c, modal: u = !0 } = e, s = be(t), [h, m] = o.useState(null), f = o.useRef(!1), d = ne(c), v = it(a); return o.useEffect(() => { const C = () => { f.current = !0, document.addEventListener("pointerdown", M, { capture: !0, once: !0 }), document.addEventListener("pointermove", M, { capture: !0, once: !0 }); }, M = () => f.current = !1; return document.addEventListener("keydown", C, { capture: !0 }), () => { document.removeEventListener("keydown", C, { capture: !0 }), document.removeEventListener("pointerdown", M, { capture: !0 }), document.removeEventListener("pointermove", M, { capture: !0 }); }; }, []), /* @__PURE__ */ l(or, { ...s, children: /* @__PURE__ */ l( Ur, { scope: t, open: n, onOpenChange: d, content: h, onContentChange: m, children: /* @__PURE__ */ l( $r, { scope: t, onClose: o.useCallback(() => d(!1), [d]), isUsingKeyboardRef: f, dir: v, modal: u, children: r } ) } ) }); }; kt.displayName = pe; var Br = "MenuAnchor", Ke = o.forwardRef( (e, t) => { const { __scopeMenu: n, ...r } = e, a = be(n); return /* @__PURE__ */ l(ar, { ...a, ...r, ref: t }); } ); Ke.displayName = Br; var Ue = "MenuPortal", [Yr, Lt] = j(Ue, { forceMount: void 0 }), Gt = (e) => { const { __scopeMenu: t, forceMount: n, children: r, container: a } = e, c = z(Ue, t); return /* @__PURE__ */ l(Yr, { scope: t, forceMount: n, children: /* @__PURE__ */ l(Ee, { present: n || c.open, children: /* @__PURE__ */ l(ct, { asChild: !0, container: a, children: r }) }) }); }; Gt.displayName = Ue; var F = "MenuContent", [Hr, $e] = j(F), Kt = o.forwardRef( (e, t) => { const n = Lt(F, e.__scopeMenu), { forceMount: r = n.forceMount, ...a } = e, c = z(F, e.__scopeMenu), u = me(F, e.__scopeMenu); return /* @__PURE__ */ l(ue.Provider, { scope: e.__scopeMenu, children: /* @__PURE__ */ l(Ee, { present: r || c.open, children: /* @__PURE__ */ l(ue.Slot, { scope: e.__scopeMenu, children: u.modal ? /* @__PURE__ */ l(Wr, { ...a, ref: t }) : /* @__PURE__ */ l(Xr, { ...a, ref: t }) }) }) }); } ), Wr = o.forwardRef( (e, t) => { const n = z(F, e.__scopeMenu), r = o.useRef(null), a = G(t, r); return o.useEffect(() => { const c = r.current; if (c) return Kn(c); }, []), /* @__PURE__ */ l( Be, { ...e, ref: a, trapFocus: n.open, disableOutsidePointerEvents: n.open, disableOutsideScroll: !0, onFocusOutside: S( e.onFocusOutside, (c) => c.preventDefault(), { checkForDefaultPrevented: !1 } ), onDismiss: () => n.onOpenChange(!1) } ); } ), Xr = o.forwardRef((e, t) => { const n = z(F, e.__scopeMenu); return /* @__PURE__ */ l( Be, { ...e, ref: t, trapFocus: !1, disableOutsidePointerEvents: !1, disableOutsideScroll: !1, onDismiss: () => n.onOpenChange(!1) } ); }), Vr = Ne("MenuContent.ScrollLock"), Be = o.forwardRef( (e, t) => { const { __scopeMenu: n, loop: r = !1, trapFocus: a, onOpenAutoFocus: c, onCloseAutoFocus: u, disableOutsidePointerEvents: s, onEntryFocus: h, onEscapeKeyDown: m, onPointerDownOutside: f, onFocusOutside: d, onInteractOutside: v, onDismiss: C, disableOutsideScroll: M, ...i } = e, p = z(F, n), g = me(F, n), E = be(n), w = Ft(n), R = Gr(n), [y, _] = o.useState(null), I = o.useRef(null), P = G(t, I, p.onContentChange), k = o.useRef(0), U = o.useRef(""), Y = o.useRef(0), W = o.useRef(null), $ = o.useRef("right"), Z = o.useRef(0), q = M ? Dr : o.Fragment, L = M ? { as: Vr, allowPinchZoom: !0 } : void 0, Q = (b) => { var B, ae; const T = U.current + b, A = R().filter((O) => !O.disabled), K = document.activeElement, re = (B = A.find((O) => O.ref.current === K)) == null ? void 0 : B.textValue, oe = A.map((O) => O.textValue), ve = ao(oe, T, re), X = (ae = A.find((O) => O.textValue === ve)) == null ? void 0 : ae.ref.current; (function O(ce) { U.current = ce, window.clearTimeout(k.current), ce !== "" && (k.current = window.setTimeout(() => O(""), 1e3)); })(T), X && setTimeout(() => X.focus()); }; o.useEffect(() => () => window.clearTimeout(k.current), []), Bn(); const N = o.useCallback((b) => { var A, K; return $.current === ((A = W.current) == null ? void 0 : A.side) && so(b, (K = W.current) == null ? void 0 : K.area); }, []); return /* @__PURE__ */ l( Hr, { scope: n, searchRef: U, onItemEnter: o.useCallback( (b) => { N(b) && b.preventDefault(); }, [N] ), onItemLeave: o.useCallback( (b) => { var T; N(b) || ((T = I.current) == null || T.focus(), _(null)); }, [N] ), onTriggerLeave: o.useCallback( (b) => { N(b) && b.preventDefault(); }, [N] ), pointerGraceTimerRef: Y, onPointerGraceIntentChange: o.useCallback((b) => { W.current = b; }, []), children: /* @__PURE__ */ l(q, { ...L, children: /* @__PURE__ */ l( ut, { asChild: !0, trapped: a, onMountAutoFocus: S(c, (b) => { var T; b.preventDefault(), (T = I.current) == null || T.focus({ preventScroll: !0 }); }), onUnmountAutoFocus: u, children: /* @__PURE__ */ l( Cn, { asChild: !0, disableOutsidePointerEvents: s, onEscapeKeyDown: m, onPointerDownOutside: f, onFocusOutside: d, onInteractOutside: v, onDismiss: C, children: /* @__PURE__ */ l( wr, { asChild: !0, ...w, dir: g.dir, orientation: "vertical", loop: r, currentTabStopId: y, onCurrentTabStopIdChange: _, onEntryFocus: S(h, (b) => { g.isUsingKeyboardRef.current || b.preventDefault(); }), preventScrollOnEntryFocus: !0, children: /* @__PURE__ */ l( cr, { role: "menu", "aria-orientation": "vertical", "data-state": tn(p.open), "data-radix-menu-content": "", dir: g.dir, ...E, ...i, ref: P, style: { outline: "none", ...i.style }, onKeyDown: S(i.onKeyDown, (b) => { const A = b.target.closest("[data-radix-menu-content]") === b.currentTarget, K = b.ctrlKey || b.altKey || b.metaKey, re = b.key.length === 1; A && (b.key === "Tab" && b.preventDefault(), !K && re && Q(b.key)); const oe = I.current; if (b.target !== oe || !Fr.includes(b.key)) return; b.preventDefault(); const X = R().filter((B) => !B.disabled).map((B) => B.ref.current); Dt.includes(b.key) && X.reverse(), ro(X); }), onBlur: S(e.onBlur, (b) => { b.currentTarget.contains(b.target) || (window.clearTimeout(k.current), U.current = ""); }), onPointerMove: S( e.onPointerMove, le((b) => { const T = b.target, A = Z.current !== b.clientX; if (b.currentTarget.contains(T) && A) { const K = b.clientX > Z.current ? "right" : "left"; $.current = K, Z.current = b.clientX; } }) ) } ) } ) } ) } ) }) } ); } ); Kt.displayName = F; var jr = "MenuGroup", Ye = o.forwardRef( (e, t) => { const { __scopeMenu: n, ...r } = e; return /* @__PURE__ */ l(D.div, { role: "group", ...r, ref: t }); } ); Ye.displayName = jr; var zr = "MenuLabel", Ut = o.forwardRef( (e, t) => { const { __scopeMenu: n, ...r } = e; return /* @__PURE__ */ l(D.div, { ...r, ref: t }); } ); Ut.displayName = zr; var Ce = "MenuItem", rt = "menu.itemSelect", Se = o.forwardRef( (e, t) => { const { disabled: n = !1, onSelect: r, ...a } = e, c = o.useRef(null), u = me(Ce, e.__scopeMenu), s = $e(Ce, e.__scopeMenu), h = G(t, c), m = o.useRef(!1), f = () => { const d = c.current; if (!n && d) { const v = new CustomEvent(rt, { bubbles: !0, cancelable: !0 }); d.addEventListener(rt, (C) => r == null ? void 0 : r(C), { once: !0 }), wn(d, v), v.defaultPrevented ? m.current = !1 : u.onClose(); } }; return /* @__PURE__ */ l( $t, { ...a, ref: h, disabled: n, onClick: S(e.onClick, f), onPointerDown: (d) => { var v; (v = e.onPointerDown) == null || v.call(e, d), m.current = !0; }, onPointerUp: S(e.onPointerUp, (d) => { var v; m.current || (v = d.currentTarget) == null || v.click(); }), onKeyDown: S(e.onKeyDown, (d) => { const v = s.searchRef.current !== ""; n || v && d.key === " " || ke.includes(d.key) && (d.currentTarget.click(), d.preventDefault()); }) } ); } ); Se.displayName = Ce; var $t = o.forwardRef( (e, t) => { const { __scopeMenu: n, disabled: r = !1, textValue: a, ...c } = e, u = $e(Ce, n), s = Ft(n), h = o.useRef(null), m = G(t, h), [f, d] = o.useState(!1), [v, C] = o.useState(""); return o.useEffect(() => { const M = h.current; M && C((M.textContent ?? "").trim()); }, [c.children]), /* @__PURE__ */ l( ue.ItemSlot, { scope: n, disabled: r, textValue: a ?? v, children: /* @__PURE__ */ l(Cr, { asChild: !0, ...s, focusable: !r, children: /* @__PURE__ */ l( D.div, { role: "menuitem", "data-highlighted": f ? "" : void 0, "aria-disabled": r || void 0, "data-disabled": r ? "" : void 0, ...c, ref: m, onPointerMove: S( e.onPointerMove, le((M) => { r ? u.onItemLeave(M) : (u.onItemEnter(M), M.defaultPrevented || M.currentTarget.focus({ preventScroll: !0 })); }) ), onPointerLeave: S( e.onPointerLeave, le((M) => u.onItemLeave(M)) ), onFocus: S(e.onFocus, () => d(!0)), onBlur: S(e.onBlur, () => d(!1)) } ) }) } ); } ), Zr = "MenuCheckboxItem", Bt = o.forwardRef( (e, t) => { const { checked: n = !1, onCheckedChange: r, ...a } = e; return /* @__PURE__ */ l(Vt, { scope: e.__scopeMenu, checked: n, children: /* @__PURE__ */ l( Se, { role: "menuitemcheckbox", "aria-checked": Me(n) ? "mixed" : n, ...a, ref: t, "data-state": We(n), onSelect: S( a.onSelect, () => r == null ? void 0 : r(Me(n) ? !0 : !n), { checkForDefaultPrevented: !1 } ) } ) }); } ); Bt.displayName = Zr; var Yt = "MenuRadioGroup", [qr, Qr] = j( Yt, { value: void 0, onValueChange: () => { } } ), Ht = o.forwardRef( (e, t) => { const { value: n, onValueChange: r, ...a } = e, c = ne(r); return /* @__PURE__ */ l(qr, { scope: e.__scopeMenu, value: n, onValueChange: c, children: /* @__PURE__ */ l(Ye, { ...a, ref: t }) }); } ); Ht.displayName = Yt; var Wt = "MenuRadioItem", Xt = o.forwardRef( (e, t) => { const { value: n, ...r } = e, a = Qr(Wt, e.__scopeMenu), c = n === a.value; return /* @__PURE__ */ l(Vt, { scope: e.__scopeMenu, checked: c, children: /* @__PURE__ */ l( Se, { role: "menuitemradio", "aria-checked": c, ...r, ref: t, "data-state": We(c), onSelect: S( r.onSelect, () => { var u; return (u = a.onValueChange) == null ? void 0 : u.call(a, n); }, { checkForDefaultPrevented: !1 } ) } ) }); } ); Xt.displayName = Wt; var He = "MenuItemIndicator", [Vt, Jr] = j( He, { checked: !1 } ), jt = o.forwardRef( (e, t) => { const { __scopeMenu: n, forceMount: r, ...a } = e, c = Jr(He, n); return /* @__PURE__ */ l( Ee, { present: r || Me(c.checked) || c.checked === !0, children: /* @__PURE__ */ l( D.span, { ...a, ref: t, "data-state": We(c.checked) } ) } ); } ); jt.displayName = He; var eo = "MenuSeparator", zt = o.forwardRef( (e, t) => { const { __scopeMenu: n, ...r } = e; return /* @__PURE__ */ l( D.div, { role: "separator", "aria-orientation": "horizontal", ...r, ref: t } ); } ); zt.displayName = eo; var to = "MenuArrow", Zt = o.forwardRef( (e, t) => { const { __scopeMenu: n, ...r } = e, a = be(n); return /* @__PURE__ */ l(sr, { ...a, ...r, ref: t }); } ); Zt.displayName = to; var no = "MenuSub", [Jo, qt] = j(no), ie = "MenuSubTrigger", Qt = o.forwardRef( (e, t) => { const n = z(ie, e.__scopeMenu), r = me(ie, e.__scopeMenu), a = qt(ie, e.__scopeMenu), c = $e(ie, e.__scopeMenu), u = o.useRef(null), { pointerGraceTimerRef: s, onPointerGraceIntentChange: h } = c, m = { __scopeMenu: e.__scopeMenu }, f = o.useCallback(() => { u.current && window.clearTimeout(u.current), u.current = null; }, []); return o.useEffect(() => f, [f]), o.useEffect(() => { const d = s.current; return () => { window.clearTimeout(d), h(null); }; }, [s, h]), /* @__PURE__ */ l(Ke, { asChild: !0, ...m, children: /* @__PURE__ */ l( $t, { id: a.triggerId, "aria-haspopup": "menu", "aria-expanded": n.open, "aria-controls": a.contentId, "data-state": tn(n.open), ...e, ref: at(t, a.onTriggerChange), onClick: (d) => { var v; (v = e.onClick) == null || v.call(e, d), !(e.disabled || d.defaultPrevented) && (d.currentTarget.focus(), n.open || n.onOpenChange(!0)); }, onPointerMove: S( e.onPointerMove, le((d) => { c.onItemEnter(d), !d.defaultPrevented && !e.disabled && !n.open && !u.current && (c.onPointerGraceIntentChange(null), u.current = window.setTimeout(() => { n.onOpenChange(!0), f(); }, 100)); }) ), onPointerLeave: S( e.onPointerLeave, le((d) => { var C, M; f(); const v = (C = n.content) == null ? void 0 : C.getBoundingClientRect(); if (v) { const i = (M = n.content) == null ? void 0 : M.dataset.side, p = i === "right", g = p ? -5 : 5, E = v[p ? "left" : "right"], w = v[p ? "right" : "left"]; c.onPointerGraceIntentChange({ area: [ // Apply a bleed on clientX to ensure that our exit point is // consistently within polygon bounds { x: d.clientX + g, y: d.clientY }, { x: E, y: v.top }, { x: w, y: v.top }, { x: w, y: v.bottom }, { x: E, y: v.bottom } ], side: i }), window.clearTimeout(s.current), s.current = window.setTimeout( () => c.onPointerGraceIntentChange(null), 300 ); } else { if (c.onTriggerLeave(d), d.defaultPrevented) return; c.onPointerGraceIntentChange(null); } }) ), onKeyDown: S(e.onKeyDown, (d) => { var C; const v = c.searchRef.current !== ""; e.disabled || v && d.key === " " || kr[r.dir].includes(d.key) && (n.onOpenChange(!0), (C = n.content) == null || C.focus(), d.preventDefault()); }) } ) }); } ); Qt.displayName = ie; var Jt = "MenuSubContent", en = o.forwardRef( (e, t) => { const n = Lt(F, e.__scopeMenu), { forceMount: r = n.forceMount, ...a } = e, c = z(F, e.__scopeMenu), u = me(F, e.__scopeMenu), s = qt(Jt, e.__scopeMenu), h = o.useRef(null), m = G(t, h); return /* @__PURE__ */ l(ue.Provider, { scope: e.__scopeMenu, children: /* @__PURE__ */ l(Ee, { present: r || c.open, children: /* @__PURE__ */ l(ue.Slot, { scope: e.__scopeMenu, children: /* @__PURE__ */ l( Be, { id: s.contentId, "aria-labelledby": s.triggerId, ...a, ref: m, align: "start", side: u.dir === "rtl" ? "left" : "right", disableOutsidePointerEvents: !1, disableOutsideScroll: !1, trapFocus: !1, onOpenAutoFocus: (f) => { var d; u.isUsingKeyboardRef.current && ((d = h.current) == null || d.focus()), f.preventDefault(); }, onCloseAutoFocus: (f) => f.preventDefault(), onFocusOutside: S(e.onFocusOutside, (f) => { f.target !== s.trigger && c.onOpenChange(!1); }), onEscapeKeyDown: S(e.onEscapeKeyDown, (f) => { u.onClose(), f.preventDefault(); }), onKeyDown: S(e.onKeyDown, (f) => { var C; const d = f.currentTarget.contains(f.target), v = Lr[u.dir].includes(f.key); d && v && (c.onOpenChange(!1), (C = s.trigger) == null || C.focus(), f.preventDefault()); }) } ) }) }) }); } ); en.displayName = Jt; function tn(e) { return e ? "open" : "closed"; } function Me(e) { return e === "indeterminate"; } function We(e) { return Me(e) ? "indeterminate" : e ? "checked" : "unchecked"; } function ro(e) { const t = document.activeElement; for (const n of e) if (n === t || (n.focus(), document.activeElement !== t)) return; } function oo(e, t) { return e.map((n, r) => e[(t + r) % e.length]); } function ao(e, t, n) { const a = t.length > 1 && Array.from(t).every((m) => m === t[0]) ? t[0] : t, c = n ? e.indexOf(n) : -1; let u = oo(e, Math.max(c, 0)); a.length === 1 && (u = u.filter((m) => m !== n)); const h = u.find( (m) => m.toLowerCase().startsWith(a.toLowerCase()) ); return h !== n ? h : void 0; } function co(e, t) { const { x: n, y: r } = e; let a = !1; for (let c = 0, u = t.length - 1; c < t.length; u = c++) { const s = t[c], h = t[u], m = s.x, f = s.y, d = h.x, v = h.y; f > r != v > r && n < (d - m) * (r - f) / (v - f) + m && (a = !a); } return a; } function so(e, t) { if (!t) return !1; const n = { x: e.clientX, y: e.clientY }; return co(n, t); } function le(e) { return (t) => t.pointerType === "mouse" ? e(t) : void 0; } var io = kt, uo = Ke, lo = Gt, fo = Kt, po = Ye, mo = Ut, vo = Se, ho = Bt, go = Ht, wo = Xt, Co = jt, Mo = zt, Eo = Zt, Ro = Qt, bo = en, ye = "DropdownMenu", [So, ea] = de( ye, [Ot] ), x = Ot(), [yo, nn] = So(ye), rn = (e) => { const { __scopeDropdownMenu: t, children: n, dir: r, open: a, defaultOpen: c, onOpenChange: u, modal: s = !0 } = e, h = x(t), m = o.useRef(null), [f, d] = ot({ prop: a, defaultProp: c ?? !1, onChange: u, caller: ye }); return /* @__PURE__ */ l( yo, { scope: t, triggerId: De(), triggerRef: m, contentId: De(), open: f, onOpenChange: d, onOpenToggle: o.useCallback(() => d((v) => !v), [d]), modal: s, children: /* @__PURE__ */ l(io, { ...h, open: f, onOpenChange: d, dir: r, modal: s, children: n }) } ); }; rn.displayName = ye; var on = "DropdownMenuTrigger", an = o.forwardRef( (e, t) => { const { __scopeDropdownMenu: n, disabled: r = !1, ...a } = e, c = nn(on, n), u = x(n); return /* @__PURE__ */ l(uo, { asChild: !0, ...u, children: /* @__PURE__ */ l( D.button, { type: "button", id: c.triggerId, "aria-haspopup": "menu", "aria-expanded": c.open, "aria-controls": c.open ? c.contentId : void 0, "data-state": c.open ? "open" : "closed",