@pdf-viewer/react 1.4.2 → 1.4.3-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/dist/Popover-b7402893.js +1445 -0
  2. package/dist/{RPDefaultLayout-e27ef121.js → RPDefaultLayout-b9f5eccb.js} +228 -228
  3. package/dist/component-1da194e8.js +337 -0
  4. package/dist/components/RPController.js +1 -1
  5. package/dist/components/RPPages.js +2 -2
  6. package/dist/components/RPProvider.js +12 -11
  7. package/dist/components/layout/LayoutContainer.js +3 -2
  8. package/dist/components/layout/RPDefaultLayout.js +1 -1
  9. package/dist/components/layout/sidebar/RPSidebar.js +1 -1
  10. package/dist/components/layout/sidebar/Thumbnail.js +1 -1
  11. package/dist/components/layout/sidebar/Thumbnails.js +1 -1
  12. package/dist/components/layout/toolbar/DocumentDialog.js +3 -2
  13. package/dist/components/layout/toolbar/FileDownloadTool.js +1 -1
  14. package/dist/components/layout/toolbar/MenuItem.js +1 -1
  15. package/dist/components/layout/toolbar/MenuSeparator.js +1 -1
  16. package/dist/components/layout/toolbar/MostPageTool.js +4 -3
  17. package/dist/components/layout/toolbar/OtherTool.js +2 -2
  18. package/dist/components/layout/toolbar/Paginate.js +1 -1
  19. package/dist/components/layout/toolbar/PrintTool.js +1 -1
  20. package/dist/components/layout/toolbar/RPToolbar.js +1 -1
  21. package/dist/components/layout/toolbar/RPToolbarEnd.js +1 -1
  22. package/dist/components/layout/toolbar/RotateTool.js +1 -1
  23. package/dist/components/layout/toolbar/ScrollModeTool.js +1 -1
  24. package/dist/components/layout/toolbar/SearchTool.js +4 -3
  25. package/dist/components/layout/toolbar/SelectionModeTool.js +1 -1
  26. package/dist/components/layout/toolbar/ViewModeTool.js +1 -1
  27. package/dist/components/layout/toolbar/ZoomTool.js +4 -3
  28. package/dist/components/page/AnnotationLayer.js +3 -2
  29. package/dist/components/page/CanvasLayer.js +3 -2
  30. package/dist/components/page/DualPage.js +1 -1
  31. package/dist/components/page/RPPage.js +3 -2
  32. package/dist/components/page/SinglePage.js +1 -1
  33. package/dist/components/page/TextHighlightLayer.js +3 -2
  34. package/dist/components/page/TextLayer.js +3 -2
  35. package/dist/components/ui/Checkbox.js +7 -6
  36. package/dist/components/ui/DropDown.js +1 -1
  37. package/dist/components/ui/LoadingIndicator.js +1 -1
  38. package/dist/components/ui/Popover.js +1 -1
  39. package/dist/components/ui/RPTooltip.js +687 -328
  40. package/dist/contexts/PaginationContext.js +1 -1
  41. package/dist/contexts/PrintContext.js +1 -1
  42. package/dist/contexts/SearchContext.js +1 -1
  43. package/dist/contexts/ThumbnailsContext.js +1 -1
  44. package/dist/floating-ui.react-dom-15b9b819.js +1310 -0
  45. package/dist/index-2e540713.js +23 -0
  46. package/dist/index-353ec0a6.js +172 -0
  47. package/dist/index-5ff5dbd0.js +1675 -0
  48. package/dist/index-71898eb9.js +139 -0
  49. package/dist/main.js +1 -1
  50. package/dist/types/utils/hooks/useWatermark.d.ts +1 -1
  51. package/dist/utils/hooks/useFileDownload.js +3 -2
  52. package/dist/utils/hooks/useLicense.js +1 -1
  53. package/dist/utils/hooks/usePaginate.js +3 -2
  54. package/dist/utils/hooks/usePrint.js +3 -2
  55. package/dist/utils/hooks/useScrollToPage.js +3 -2
  56. package/dist/utils/hooks/useSearch.js +3 -2
  57. package/dist/utils/hooks/useThumbnail.js +3 -2
  58. package/dist/utils/hooks/useVirtualReactWindow.js +3 -2
  59. package/dist/utils/hooks/useWatermark.js +59 -28
  60. package/package.json +1 -1
  61. package/dist/Popover-d11ec15c.js +0 -3061
  62. package/dist/floating-ui.react-dom-88a86594.js +0 -1447
  63. package/dist/index-48ca3f30.js +0 -307
  64. package/dist/index-4ba3ab9a.js +0 -1877
@@ -0,0 +1,1675 @@
1
+ import * as o from "react";
2
+ import z from "react";
3
+ import { u as L, S as xe, P as x, c as S, d as ct, a as Ce, b as it } from "./index-353ec0a6.js";
4
+ import { c as de, u as Y, d as Rn, a as De, b as ut } from "./index-71898eb9.js";
5
+ import { jsx as l } from "react/jsx-runtime";
6
+ import { u as Sn, a as Te } from "./index-2e540713.js";
7
+ import { u as Pn, a as _n, o as In, s as An, l as xn, f as Dn, b as Tn, c as Nn, h as On } from "./floating-ui.react-dom-15b9b819.js";
8
+ import Fn from "react-dom";
9
+ import { c as Ln, _ as kn, u as Kn, a as ne, f as Gn, z as Bn, s as Un, b as $n, R as Wn, e as Hn, h as Yn } from "./component-1da194e8.js";
10
+ function lt(e) {
11
+ const t = e + "CollectionProvider", [n, r] = de(t), [a, s] = n(
12
+ t,
13
+ { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
14
+ ), u = (E) => {
15
+ const { scope: v, children: i } = E, w = z.useRef(null), g = z.useRef(/* @__PURE__ */ new Map()).current;
16
+ return /* @__PURE__ */ l(a, { scope: v, itemMap: g, collectionRef: w, children: i });
17
+ };
18
+ u.displayName = t;
19
+ const c = e + "CollectionSlot", m = z.forwardRef(
20
+ (E, v) => {
21
+ const { scope: i, children: w } = E, g = s(c, i), C = L(v, g.collectionRef);
22
+ return /* @__PURE__ */ l(xe, { ref: C, children: w });
23
+ }
24
+ );
25
+ m.displayName = c;
26
+ const d = e + "CollectionItemSlot", p = "data-radix-collection-item", f = z.forwardRef(
27
+ (E, v) => {
28
+ const { scope: i, children: w, ...g } = E, C = z.useRef(null), y = L(v, C), M = s(d, i);
29
+ return z.useEffect(() => (M.itemMap.set(C, { ref: C, ...g }), () => void M.itemMap.delete(C))), /* @__PURE__ */ l(xe, { [p]: "", ref: y, children: w });
30
+ }
31
+ );
32
+ f.displayName = d;
33
+ function h(E) {
34
+ const v = s(e + "CollectionConsumer", E);
35
+ return z.useCallback(() => {
36
+ const w = v.collectionRef.current;
37
+ if (!w)
38
+ return [];
39
+ const g = Array.from(w.querySelectorAll(`[${p}]`));
40
+ return Array.from(v.itemMap.values()).sort(
41
+ (M, P) => g.indexOf(M.ref.current) - g.indexOf(P.ref.current)
42
+ );
43
+ }, [v.collectionRef, v.itemMap]);
44
+ }
45
+ return [
46
+ { Provider: u, Slot: m, ItemSlot: f },
47
+ h,
48
+ r
49
+ ];
50
+ }
51
+ var Xn = o.createContext(void 0);
52
+ function dt(e) {
53
+ const t = o.useContext(Xn);
54
+ return e || t || "ltr";
55
+ }
56
+ var Vn = "DismissableLayer", Ne = "dismissableLayer.update", zn = "dismissableLayer.pointerDownOutside", jn = "dismissableLayer.focusOutside", Ze, ft = o.createContext({
57
+ layers: /* @__PURE__ */ new Set(),
58
+ layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
59
+ branches: /* @__PURE__ */ new Set()
60
+ }), pt = o.forwardRef(
61
+ (e, t) => {
62
+ const {
63
+ disableOutsidePointerEvents: n = !1,
64
+ onEscapeKeyDown: r,
65
+ onPointerDownOutside: a,
66
+ onFocusOutside: s,
67
+ onInteractOutside: u,
68
+ onDismiss: c,
69
+ ...m
70
+ } = e, d = o.useContext(ft), [p, f] = o.useState(null), h = (p == null ? void 0 : p.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, E] = o.useState({}), v = L(t, (R) => f(R)), i = Array.from(d.layers), [w] = [...d.layersWithOutsidePointerEventsDisabled].slice(-1), g = i.indexOf(w), C = p ? i.indexOf(p) : -1, y = d.layersWithOutsidePointerEventsDisabled.size > 0, M = C >= g, P = Qn((R) => {
71
+ const _ = R.target, T = [...d.branches].some((O) => O.contains(_));
72
+ !M || T || (a == null || a(R), u == null || u(R), R.defaultPrevented || c == null || c());
73
+ }, h), I = Jn((R) => {
74
+ const _ = R.target;
75
+ [...d.branches].some((O) => O.contains(_)) || (s == null || s(R), u == null || u(R), R.defaultPrevented || c == null || c());
76
+ }, h);
77
+ return Sn((R) => {
78
+ C === d.layers.size - 1 && (r == null || r(R), !R.defaultPrevented && c && (R.preventDefault(), c()));
79
+ }, h), o.useEffect(() => {
80
+ if (p)
81
+ return n && (d.layersWithOutsidePointerEventsDisabled.size === 0 && (Ze = h.body.style.pointerEvents, h.body.style.pointerEvents = "none"), d.layersWithOutsidePointerEventsDisabled.add(p)), d.layers.add(p), qe(), () => {
82
+ n && d.layersWithOutsidePointerEventsDisabled.size === 1 && (h.body.style.pointerEvents = Ze);
83
+ };
84
+ }, [p, h, n, d]), o.useEffect(() => () => {
85
+ p && (d.layers.delete(p), d.layersWithOutsidePointerEventsDisabled.delete(p), qe());
86
+ }, [p, d]), o.useEffect(() => {
87
+ const R = () => E({});
88
+ return document.addEventListener(Ne, R), () => document.removeEventListener(Ne, R);
89
+ }, []), /* @__PURE__ */ l(
90
+ x.div,
91
+ {
92
+ ...m,
93
+ ref: v,
94
+ style: {
95
+ pointerEvents: y ? M ? "auto" : "none" : void 0,
96
+ ...e.style
97
+ },
98
+ onFocusCapture: S(e.onFocusCapture, I.onFocusCapture),
99
+ onBlurCapture: S(e.onBlurCapture, I.onBlurCapture),
100
+ onPointerDownCapture: S(
101
+ e.onPointerDownCapture,
102
+ P.onPointerDownCapture
103
+ )
104
+ }
105
+ );
106
+ }
107
+ );
108
+ pt.displayName = Vn;
109
+ var Zn = "DismissableLayerBranch", qn = o.forwardRef((e, t) => {
110
+ const n = o.useContext(ft), r = o.useRef(null), a = L(t, r);
111
+ return o.useEffect(() => {
112
+ const s = r.current;
113
+ if (s)
114
+ return n.branches.add(s), () => {
115
+ n.branches.delete(s);
116
+ };
117
+ }, [n.branches]), /* @__PURE__ */ l(x.div, { ...e, ref: a });
118
+ });
119
+ qn.displayName = Zn;
120
+ function Qn(e, t = globalThis == null ? void 0 : globalThis.document) {
121
+ const n = Y(e), r = o.useRef(!1), a = o.useRef(() => {
122
+ });
123
+ return o.useEffect(() => {
124
+ const s = (c) => {
125
+ if (c.target && !r.current) {
126
+ let m = function() {
127
+ vt(
128
+ zn,
129
+ n,
130
+ d,
131
+ { discrete: !0 }
132
+ );
133
+ };
134
+ const d = { originalEvent: c };
135
+ c.pointerType === "touch" ? (t.removeEventListener("click", a.current), a.current = m, t.addEventListener("click", a.current, { once: !0 })) : m();
136
+ } else
137
+ t.removeEventListener("click", a.current);
138
+ r.current = !1;
139
+ }, u = window.setTimeout(() => {
140
+ t.addEventListener("pointerdown", s);
141
+ }, 0);
142
+ return () => {
143
+ window.clearTimeout(u), t.removeEventListener("pointerdown", s), t.removeEventListener("click", a.current);
144
+ };
145
+ }, [t, n]), {
146
+ // ensures we check React component tree (not just DOM tree)
147
+ onPointerDownCapture: () => r.current = !0
148
+ };
149
+ }
150
+ function Jn(e, t = globalThis == null ? void 0 : globalThis.document) {
151
+ const n = Y(e), r = o.useRef(!1);
152
+ return o.useEffect(() => {
153
+ const a = (s) => {
154
+ s.target && !r.current && vt(jn, n, { originalEvent: s }, {
155
+ discrete: !1
156
+ });
157
+ };
158
+ return t.addEventListener("focusin", a), () => t.removeEventListener("focusin", a);
159
+ }, [t, n]), {
160
+ onFocusCapture: () => r.current = !0,
161
+ onBlurCapture: () => r.current = !1
162
+ };
163
+ }
164
+ function qe() {
165
+ const e = new CustomEvent(Ne);
166
+ document.dispatchEvent(e);
167
+ }
168
+ function vt(e, t, n, { discrete: r }) {
169
+ const a = n.originalEvent.target, s = new CustomEvent(e, { bubbles: !1, cancelable: !0, detail: n });
170
+ t && a.addEventListener(e, t, { once: !0 }), r ? ct(a, s) : a.dispatchEvent(s);
171
+ }
172
+ var Se = 0;
173
+ function er() {
174
+ o.useEffect(() => {
175
+ const e = document.querySelectorAll("[data-radix-focus-guard]");
176
+ return document.body.insertAdjacentElement("afterbegin", e[0] ?? Qe()), document.body.insertAdjacentElement("beforeend", e[1] ?? Qe()), Se++, () => {
177
+ Se === 1 && document.querySelectorAll("[data-radix-focus-guard]").forEach((t) => t.remove()), Se--;
178
+ };
179
+ }, []);
180
+ }
181
+ function Qe() {
182
+ const e = document.createElement("span");
183
+ 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;
184
+ }
185
+ var Pe = "focusScope.autoFocusOnMount", _e = "focusScope.autoFocusOnUnmount", Je = { bubbles: !1, cancelable: !0 }, tr = "FocusScope", mt = o.forwardRef((e, t) => {
186
+ const {
187
+ loop: n = !1,
188
+ trapped: r = !1,
189
+ onMountAutoFocus: a,
190
+ onUnmountAutoFocus: s,
191
+ ...u
192
+ } = e, [c, m] = o.useState(null), d = Y(a), p = Y(s), f = o.useRef(null), h = L(t, (i) => m(i)), E = o.useRef({
193
+ paused: !1,
194
+ pause() {
195
+ this.paused = !0;
196
+ },
197
+ resume() {
198
+ this.paused = !1;
199
+ }
200
+ }).current;
201
+ o.useEffect(() => {
202
+ if (r) {
203
+ let i = function(y) {
204
+ if (E.paused || !c)
205
+ return;
206
+ const M = y.target;
207
+ c.contains(M) ? f.current = M : H(f.current, { select: !0 });
208
+ }, w = function(y) {
209
+ if (E.paused || !c)
210
+ return;
211
+ const M = y.relatedTarget;
212
+ M !== null && (c.contains(M) || H(f.current, { select: !0 }));
213
+ }, g = function(y) {
214
+ if (document.activeElement === document.body)
215
+ for (const P of y)
216
+ P.removedNodes.length > 0 && H(c);
217
+ };
218
+ document.addEventListener("focusin", i), document.addEventListener("focusout", w);
219
+ const C = new MutationObserver(g);
220
+ return c && C.observe(c, { childList: !0, subtree: !0 }), () => {
221
+ document.removeEventListener("focusin", i), document.removeEventListener("focusout", w), C.disconnect();
222
+ };
223
+ }
224
+ }, [r, c, E.paused]), o.useEffect(() => {
225
+ if (c) {
226
+ tt.add(E);
227
+ const i = document.activeElement;
228
+ if (!c.contains(i)) {
229
+ const g = new CustomEvent(Pe, Je);
230
+ c.addEventListener(Pe, d), c.dispatchEvent(g), g.defaultPrevented || (nr(cr(ht(c)), { select: !0 }), document.activeElement === i && H(c));
231
+ }
232
+ return () => {
233
+ c.removeEventListener(Pe, d), setTimeout(() => {
234
+ const g = new CustomEvent(_e, Je);
235
+ c.addEventListener(_e, p), c.dispatchEvent(g), g.defaultPrevented || H(i ?? document.body, { select: !0 }), c.removeEventListener(_e, p), tt.remove(E);
236
+ }, 0);
237
+ };
238
+ }
239
+ }, [c, d, p, E]);
240
+ const v = o.useCallback(
241
+ (i) => {
242
+ if (!n && !r || E.paused)
243
+ return;
244
+ const w = i.key === "Tab" && !i.altKey && !i.ctrlKey && !i.metaKey, g = document.activeElement;
245
+ if (w && g) {
246
+ const C = i.currentTarget, [y, M] = rr(C);
247
+ y && M ? !i.shiftKey && g === M ? (i.preventDefault(), n && H(y, { select: !0 })) : i.shiftKey && g === y && (i.preventDefault(), n && H(M, { select: !0 })) : g === C && i.preventDefault();
248
+ }
249
+ },
250
+ [n, r, E.paused]
251
+ );
252
+ return /* @__PURE__ */ l(x.div, { tabIndex: -1, ...u, ref: h, onKeyDown: v });
253
+ });
254
+ mt.displayName = tr;
255
+ function nr(e, { select: t = !1 } = {}) {
256
+ const n = document.activeElement;
257
+ for (const r of e)
258
+ if (H(r, { select: t }), document.activeElement !== n)
259
+ return;
260
+ }
261
+ function rr(e) {
262
+ const t = ht(e), n = et(t, e), r = et(t.reverse(), e);
263
+ return [n, r];
264
+ }
265
+ function ht(e) {
266
+ const t = [], n = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
267
+ acceptNode: (r) => {
268
+ const a = r.tagName === "INPUT" && r.type === "hidden";
269
+ return r.disabled || r.hidden || a ? NodeFilter.FILTER_SKIP : r.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
270
+ }
271
+ });
272
+ for (; n.nextNode(); )
273
+ t.push(n.currentNode);
274
+ return t;
275
+ }
276
+ function et(e, t) {
277
+ for (const n of e)
278
+ if (!or(n, { upTo: t }))
279
+ return n;
280
+ }
281
+ function or(e, { upTo: t }) {
282
+ if (getComputedStyle(e).visibility === "hidden")
283
+ return !0;
284
+ for (; e; ) {
285
+ if (t !== void 0 && e === t)
286
+ return !1;
287
+ if (getComputedStyle(e).display === "none")
288
+ return !0;
289
+ e = e.parentElement;
290
+ }
291
+ return !1;
292
+ }
293
+ function ar(e) {
294
+ return e instanceof HTMLInputElement && "select" in e;
295
+ }
296
+ function H(e, { select: t = !1 } = {}) {
297
+ if (e && e.focus) {
298
+ const n = document.activeElement;
299
+ e.focus({ preventScroll: !0 }), e !== n && ar(e) && t && e.select();
300
+ }
301
+ }
302
+ var tt = sr();
303
+ function sr() {
304
+ let e = [];
305
+ return {
306
+ add(t) {
307
+ const n = e[0];
308
+ t !== n && (n == null || n.pause()), e = nt(e, t), e.unshift(t);
309
+ },
310
+ remove(t) {
311
+ var n;
312
+ e = nt(e, t), (n = e[0]) == null || n.resume();
313
+ }
314
+ };
315
+ }
316
+ function nt(e, t) {
317
+ const n = [...e], r = n.indexOf(t);
318
+ return r !== -1 && n.splice(r, 1), n;
319
+ }
320
+ function cr(e) {
321
+ return e.filter((t) => t.tagName !== "A");
322
+ }
323
+ var ir = "Arrow", gt = o.forwardRef((e, t) => {
324
+ const { children: n, width: r = 10, height: a = 5, ...s } = e;
325
+ return /* @__PURE__ */ l(
326
+ x.svg,
327
+ {
328
+ ...s,
329
+ ref: t,
330
+ width: r,
331
+ height: a,
332
+ viewBox: "0 0 30 10",
333
+ preserveAspectRatio: "none",
334
+ children: e.asChild ? n : /* @__PURE__ */ l("polygon", { points: "0,0 30,0 15,10" })
335
+ }
336
+ );
337
+ });
338
+ gt.displayName = ir;
339
+ var ur = gt, ke = "Popper", [wt, Et] = de(ke), [lr, Ct] = wt(ke), bt = (e) => {
340
+ const { __scopePopper: t, children: n } = e, [r, a] = o.useState(null);
341
+ return /* @__PURE__ */ l(lr, { scope: t, anchor: r, onAnchorChange: a, children: n });
342
+ };
343
+ bt.displayName = ke;
344
+ var yt = "PopperAnchor", Mt = o.forwardRef(
345
+ (e, t) => {
346
+ const { __scopePopper: n, virtualRef: r, ...a } = e, s = Ct(yt, n), u = o.useRef(null), c = L(t, u);
347
+ return o.useEffect(() => {
348
+ s.onAnchorChange((r == null ? void 0 : r.current) || u.current);
349
+ }), r ? null : /* @__PURE__ */ l(x.div, { ...a, ref: c });
350
+ }
351
+ );
352
+ Mt.displayName = yt;
353
+ var Ke = "PopperContent", [dr, fr] = wt(Ke), Rt = o.forwardRef(
354
+ (e, t) => {
355
+ var $, ae, k, se, Ve, ze;
356
+ const {
357
+ __scopePopper: n,
358
+ side: r = "bottom",
359
+ sideOffset: a = 0,
360
+ align: s = "center",
361
+ alignOffset: u = 0,
362
+ arrowPadding: c = 0,
363
+ avoidCollisions: m = !0,
364
+ collisionBoundary: d = [],
365
+ collisionPadding: p = 0,
366
+ sticky: f = "partial",
367
+ hideWhenDetached: h = !1,
368
+ updatePositionStrategy: E = "optimized",
369
+ onPlaced: v,
370
+ ...i
371
+ } = e, w = Ct(Ke, n), [g, C] = o.useState(null), y = L(t, (ce) => C(ce)), [M, P] = o.useState(null), I = Rn(M), R = (I == null ? void 0 : I.width) ?? 0, _ = (I == null ? void 0 : I.height) ?? 0, T = r + (s !== "center" ? "-" + s : ""), O = typeof p == "number" ? p : { top: 0, right: 0, bottom: 0, left: 0, ...p }, W = Array.isArray(d) ? d : [d], X = W.length > 0, U = {
372
+ padding: O,
373
+ boundary: W.filter(vr),
374
+ // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
375
+ altBoundary: X
376
+ }, { refs: q, floatingStyles: Q, placement: G, isPositioned: J, middlewareData: F } = Pn({
377
+ // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
378
+ strategy: "fixed",
379
+ placement: T,
380
+ whileElementsMounted: (...ce) => _n(...ce, {
381
+ animationFrame: E === "always"
382
+ }),
383
+ elements: {
384
+ reference: w.anchor
385
+ },
386
+ middleware: [
387
+ In({ mainAxis: a + _, alignmentAxis: u }),
388
+ m && An({
389
+ mainAxis: !0,
390
+ crossAxis: !1,
391
+ limiter: f === "partial" ? xn() : void 0,
392
+ ...U
393
+ }),
394
+ m && Dn({ ...U }),
395
+ Tn({
396
+ ...U,
397
+ apply: ({ elements: ce, rects: je, availableWidth: Cn, availableHeight: bn }) => {
398
+ const { width: yn, height: Mn } = je.reference, me = ce.floating.style;
399
+ me.setProperty("--radix-popper-available-width", `${Cn}px`), me.setProperty("--radix-popper-available-height", `${bn}px`), me.setProperty("--radix-popper-anchor-width", `${yn}px`), me.setProperty("--radix-popper-anchor-height", `${Mn}px`);
400
+ }
401
+ }),
402
+ M && Nn({ element: M, padding: c }),
403
+ mr({ arrowWidth: R, arrowHeight: _ }),
404
+ h && On({ strategy: "referenceHidden", ...U })
405
+ ]
406
+ }), [b, N] = _t(G), A = Y(v);
407
+ De(() => {
408
+ J && (A == null || A());
409
+ }, [J, A]);
410
+ const B = ($ = F.arrow) == null ? void 0 : $.x, re = (ae = F.arrow) == null ? void 0 : ae.y, oe = ((k = F.arrow) == null ? void 0 : k.centerOffset) !== 0, [ve, V] = o.useState();
411
+ return De(() => {
412
+ g && V(window.getComputedStyle(g).zIndex);
413
+ }, [g]), /* @__PURE__ */ l(
414
+ "div",
415
+ {
416
+ ref: q.setFloating,
417
+ "data-radix-popper-content-wrapper": "",
418
+ style: {
419
+ ...Q,
420
+ transform: J ? Q.transform : "translate(0, -200%)",
421
+ // keep off the page when measuring
422
+ minWidth: "max-content",
423
+ zIndex: ve,
424
+ "--radix-popper-transform-origin": [
425
+ (se = F.transformOrigin) == null ? void 0 : se.x,
426
+ (Ve = F.transformOrigin) == null ? void 0 : Ve.y
427
+ ].join(" "),
428
+ // hide the content if using the hide middleware and should be hidden
429
+ // set visibility to hidden and disable pointer events so the UI behaves
430
+ // as if the PopperContent isn't there at all
431
+ ...((ze = F.hide) == null ? void 0 : ze.referenceHidden) && {
432
+ visibility: "hidden",
433
+ pointerEvents: "none"
434
+ }
435
+ },
436
+ dir: e.dir,
437
+ children: /* @__PURE__ */ l(
438
+ dr,
439
+ {
440
+ scope: n,
441
+ placedSide: b,
442
+ onArrowChange: P,
443
+ arrowX: B,
444
+ arrowY: re,
445
+ shouldHideArrow: oe,
446
+ children: /* @__PURE__ */ l(
447
+ x.div,
448
+ {
449
+ "data-side": b,
450
+ "data-align": N,
451
+ ...i,
452
+ ref: y,
453
+ style: {
454
+ ...i.style,
455
+ // if the PopperContent hasn't been placed yet (not all measurements done)
456
+ // we prevent animations so that users's animation don't kick in too early referring wrong sides
457
+ animation: J ? void 0 : "none"
458
+ }
459
+ }
460
+ )
461
+ }
462
+ )
463
+ }
464
+ );
465
+ }
466
+ );
467
+ Rt.displayName = Ke;
468
+ var St = "PopperArrow", pr = {
469
+ top: "bottom",
470
+ right: "left",
471
+ bottom: "top",
472
+ left: "right"
473
+ }, Pt = o.forwardRef(function(t, n) {
474
+ const { __scopePopper: r, ...a } = t, s = fr(St, r), u = pr[s.placedSide];
475
+ return (
476
+ // we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
477
+ // doesn't report size as we'd expect on SVG elements.
478
+ // it reports their bounding box which is effectively the largest path inside the SVG.
479
+ /* @__PURE__ */ l(
480
+ "span",
481
+ {
482
+ ref: s.onArrowChange,
483
+ style: {
484
+ position: "absolute",
485
+ left: s.arrowX,
486
+ top: s.arrowY,
487
+ [u]: 0,
488
+ transformOrigin: {
489
+ top: "",
490
+ right: "0 0",
491
+ bottom: "center 0",
492
+ left: "100% 0"
493
+ }[s.placedSide],
494
+ transform: {
495
+ top: "translateY(100%)",
496
+ right: "translateY(50%) rotate(90deg) translateX(-50%)",
497
+ bottom: "rotate(180deg)",
498
+ left: "translateY(50%) rotate(-90deg) translateX(50%)"
499
+ }[s.placedSide],
500
+ visibility: s.shouldHideArrow ? "hidden" : void 0
501
+ },
502
+ children: /* @__PURE__ */ l(
503
+ ur,
504
+ {
505
+ ...a,
506
+ ref: n,
507
+ style: {
508
+ ...a.style,
509
+ // ensures the element can be measured correctly (mostly for if SVG)
510
+ display: "block"
511
+ }
512
+ }
513
+ )
514
+ }
515
+ )
516
+ );
517
+ });
518
+ Pt.displayName = St;
519
+ function vr(e) {
520
+ return e !== null;
521
+ }
522
+ var mr = (e) => ({
523
+ name: "transformOrigin",
524
+ options: e,
525
+ fn(t) {
526
+ var w, g, C;
527
+ const { placement: n, rects: r, middlewareData: a } = t, u = ((w = a.arrow) == null ? void 0 : w.centerOffset) !== 0, c = u ? 0 : e.arrowWidth, m = u ? 0 : e.arrowHeight, [d, p] = _t(n), f = { start: "0%", center: "50%", end: "100%" }[p], h = (((g = a.arrow) == null ? void 0 : g.x) ?? 0) + c / 2, E = (((C = a.arrow) == null ? void 0 : C.y) ?? 0) + m / 2;
528
+ let v = "", i = "";
529
+ return d === "bottom" ? (v = u ? f : `${h}px`, i = `${-m}px`) : d === "top" ? (v = u ? f : `${h}px`, i = `${r.floating.height + m}px`) : d === "right" ? (v = `${-m}px`, i = u ? f : `${E}px`) : d === "left" && (v = `${r.floating.width + m}px`, i = u ? f : `${E}px`), { data: { x: v, y: i } };
530
+ }
531
+ });
532
+ function _t(e) {
533
+ const [t, n = "center"] = e.split("-");
534
+ return [t, n];
535
+ }
536
+ var hr = bt, gr = Mt, wr = Rt, Er = Pt, Cr = "Portal", It = o.forwardRef((e, t) => {
537
+ var c;
538
+ const { container: n, ...r } = e, [a, s] = o.useState(!1);
539
+ De(() => s(!0), []);
540
+ const u = n || a && ((c = globalThis == null ? void 0 : globalThis.document) == null ? void 0 : c.body);
541
+ return u ? Fn.createPortal(/* @__PURE__ */ l(x.div, { ...r, ref: t }), u) : null;
542
+ });
543
+ It.displayName = Cr;
544
+ var Ie = "rovingFocusGroup.onEntryFocus", br = { bubbles: !1, cancelable: !0 }, be = "RovingFocusGroup", [Oe, At, yr] = lt(be), [Mr, xt] = de(
545
+ be,
546
+ [yr]
547
+ ), [Rr, Sr] = Mr(be), Dt = o.forwardRef(
548
+ (e, t) => /* @__PURE__ */ l(Oe.Provider, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ l(Oe.Slot, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ l(Pr, { ...e, ref: t }) }) })
549
+ );
550
+ Dt.displayName = be;
551
+ var Pr = o.forwardRef((e, t) => {
552
+ const {
553
+ __scopeRovingFocusGroup: n,
554
+ orientation: r,
555
+ loop: a = !1,
556
+ dir: s,
557
+ currentTabStopId: u,
558
+ defaultCurrentTabStopId: c,
559
+ onCurrentTabStopIdChange: m,
560
+ onEntryFocus: d,
561
+ preventScrollOnEntryFocus: p = !1,
562
+ ...f
563
+ } = e, h = o.useRef(null), E = L(t, h), v = dt(s), [i = null, w] = ut({
564
+ prop: u,
565
+ defaultProp: c,
566
+ onChange: m
567
+ }), [g, C] = o.useState(!1), y = Y(d), M = At(n), P = o.useRef(!1), [I, R] = o.useState(0);
568
+ return o.useEffect(() => {
569
+ const _ = h.current;
570
+ if (_)
571
+ return _.addEventListener(Ie, y), () => _.removeEventListener(Ie, y);
572
+ }, [y]), /* @__PURE__ */ l(
573
+ Rr,
574
+ {
575
+ scope: n,
576
+ orientation: r,
577
+ dir: v,
578
+ loop: a,
579
+ currentTabStopId: i,
580
+ onItemFocus: o.useCallback(
581
+ (_) => w(_),
582
+ [w]
583
+ ),
584
+ onItemShiftTab: o.useCallback(() => C(!0), []),
585
+ onFocusableItemAdd: o.useCallback(
586
+ () => R((_) => _ + 1),
587
+ []
588
+ ),
589
+ onFocusableItemRemove: o.useCallback(
590
+ () => R((_) => _ - 1),
591
+ []
592
+ ),
593
+ children: /* @__PURE__ */ l(
594
+ x.div,
595
+ {
596
+ tabIndex: g || I === 0 ? -1 : 0,
597
+ "data-orientation": r,
598
+ ...f,
599
+ ref: E,
600
+ style: { outline: "none", ...e.style },
601
+ onMouseDown: S(e.onMouseDown, () => {
602
+ P.current = !0;
603
+ }),
604
+ onFocus: S(e.onFocus, (_) => {
605
+ const T = !P.current;
606
+ if (_.target === _.currentTarget && T && !g) {
607
+ const O = new CustomEvent(Ie, br);
608
+ if (_.currentTarget.dispatchEvent(O), !O.defaultPrevented) {
609
+ const W = M().filter((G) => G.focusable), X = W.find((G) => G.active), U = W.find((G) => G.id === i), Q = [X, U, ...W].filter(
610
+ Boolean
611
+ ).map((G) => G.ref.current);
612
+ Ot(Q, p);
613
+ }
614
+ }
615
+ P.current = !1;
616
+ }),
617
+ onBlur: S(e.onBlur, () => C(!1))
618
+ }
619
+ )
620
+ }
621
+ );
622
+ }), Tt = "RovingFocusGroupItem", Nt = o.forwardRef(
623
+ (e, t) => {
624
+ const {
625
+ __scopeRovingFocusGroup: n,
626
+ focusable: r = !0,
627
+ active: a = !1,
628
+ tabStopId: s,
629
+ ...u
630
+ } = e, c = Te(), m = s || c, d = Sr(Tt, n), p = d.currentTabStopId === m, f = At(n), { onFocusableItemAdd: h, onFocusableItemRemove: E } = d;
631
+ return o.useEffect(() => {
632
+ if (r)
633
+ return h(), () => E();
634
+ }, [r, h, E]), /* @__PURE__ */ l(
635
+ Oe.ItemSlot,
636
+ {
637
+ scope: n,
638
+ id: m,
639
+ focusable: r,
640
+ active: a,
641
+ children: /* @__PURE__ */ l(
642
+ x.span,
643
+ {
644
+ tabIndex: p ? 0 : -1,
645
+ "data-orientation": d.orientation,
646
+ ...u,
647
+ ref: t,
648
+ onMouseDown: S(e.onMouseDown, (v) => {
649
+ r ? d.onItemFocus(m) : v.preventDefault();
650
+ }),
651
+ onFocus: S(e.onFocus, () => d.onItemFocus(m)),
652
+ onKeyDown: S(e.onKeyDown, (v) => {
653
+ if (v.key === "Tab" && v.shiftKey) {
654
+ d.onItemShiftTab();
655
+ return;
656
+ }
657
+ if (v.target !== v.currentTarget)
658
+ return;
659
+ const i = Ar(v, d.orientation, d.dir);
660
+ if (i !== void 0) {
661
+ if (v.metaKey || v.ctrlKey || v.altKey || v.shiftKey)
662
+ return;
663
+ v.preventDefault();
664
+ let g = f().filter((C) => C.focusable).map((C) => C.ref.current);
665
+ if (i === "last")
666
+ g.reverse();
667
+ else if (i === "prev" || i === "next") {
668
+ i === "prev" && g.reverse();
669
+ const C = g.indexOf(v.currentTarget);
670
+ g = d.loop ? xr(g, C + 1) : g.slice(C + 1);
671
+ }
672
+ setTimeout(() => Ot(g));
673
+ }
674
+ })
675
+ }
676
+ )
677
+ }
678
+ );
679
+ }
680
+ );
681
+ Nt.displayName = Tt;
682
+ var _r = {
683
+ ArrowLeft: "prev",
684
+ ArrowUp: "prev",
685
+ ArrowRight: "next",
686
+ ArrowDown: "next",
687
+ PageUp: "first",
688
+ Home: "first",
689
+ PageDown: "last",
690
+ End: "last"
691
+ };
692
+ function Ir(e, t) {
693
+ return t !== "rtl" ? e : e === "ArrowLeft" ? "ArrowRight" : e === "ArrowRight" ? "ArrowLeft" : e;
694
+ }
695
+ function Ar(e, t, n) {
696
+ const r = Ir(e.key, n);
697
+ if (!(t === "vertical" && ["ArrowLeft", "ArrowRight"].includes(r)) && !(t === "horizontal" && ["ArrowUp", "ArrowDown"].includes(r)))
698
+ return _r[r];
699
+ }
700
+ function Ot(e, t = !1) {
701
+ const n = document.activeElement;
702
+ for (const r of e)
703
+ if (r === n || (r.focus({ preventScroll: t }), document.activeElement !== n))
704
+ return;
705
+ }
706
+ function xr(e, t) {
707
+ return e.map((n, r) => e[(t + r) % e.length]);
708
+ }
709
+ var Dr = Dt, Tr = Nt, Ft = Ln(), Ae = function() {
710
+ }, ye = o.forwardRef(function(e, t) {
711
+ var n = o.useRef(null), r = o.useState({
712
+ onScrollCapture: Ae,
713
+ onWheelCapture: Ae,
714
+ onTouchMoveCapture: Ae
715
+ }), a = r[0], s = r[1], u = e.forwardProps, c = e.children, m = e.className, d = e.removeScrollBar, p = e.enabled, f = e.shards, h = e.sideCar, E = e.noIsolation, v = e.inert, i = e.allowPinchZoom, w = e.as, g = w === void 0 ? "div" : w, C = e.gapMode, y = kn(e, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]), M = h, P = Kn([n, t]), I = ne(ne({}, y), a);
716
+ return o.createElement(
717
+ o.Fragment,
718
+ null,
719
+ p && o.createElement(M, { sideCar: Ft, removeScrollBar: d, shards: f, noIsolation: E, inert: v, setCallbacks: s, allowPinchZoom: !!i, lockRef: n, gapMode: C }),
720
+ u ? o.cloneElement(o.Children.only(c), ne(ne({}, I), { ref: P })) : o.createElement(g, ne({}, I, { className: m, ref: P }), c)
721
+ );
722
+ });
723
+ ye.defaultProps = {
724
+ enabled: !0,
725
+ removeScrollBar: !0,
726
+ inert: !1
727
+ };
728
+ ye.classNames = {
729
+ fullWidth: Gn,
730
+ zeroRight: Bn
731
+ };
732
+ var Fe = !1;
733
+ if (typeof window < "u")
734
+ try {
735
+ var he = Object.defineProperty({}, "passive", {
736
+ get: function() {
737
+ return Fe = !0, !0;
738
+ }
739
+ });
740
+ window.addEventListener("test", he, he), window.removeEventListener("test", he, he);
741
+ } catch {
742
+ Fe = !1;
743
+ }
744
+ var ee = Fe ? { passive: !1 } : !1, Nr = function(e) {
745
+ return e.tagName === "TEXTAREA";
746
+ }, Lt = function(e, t) {
747
+ if (!(e instanceof Element))
748
+ return !1;
749
+ var n = window.getComputedStyle(e);
750
+ return (
751
+ // not-not-scrollable
752
+ n[t] !== "hidden" && // contains scroll inside self
753
+ !(n.overflowY === n.overflowX && !Nr(e) && n[t] === "visible")
754
+ );
755
+ }, Or = function(e) {
756
+ return Lt(e, "overflowY");
757
+ }, Fr = function(e) {
758
+ return Lt(e, "overflowX");
759
+ }, rt = function(e, t) {
760
+ var n = t.ownerDocument, r = t;
761
+ do {
762
+ typeof ShadowRoot < "u" && r instanceof ShadowRoot && (r = r.host);
763
+ var a = kt(e, r);
764
+ if (a) {
765
+ var s = Kt(e, r), u = s[1], c = s[2];
766
+ if (u > c)
767
+ return !0;
768
+ }
769
+ r = r.parentNode;
770
+ } while (r && r !== n.body);
771
+ return !1;
772
+ }, Lr = function(e) {
773
+ var t = e.scrollTop, n = e.scrollHeight, r = e.clientHeight;
774
+ return [
775
+ t,
776
+ n,
777
+ r
778
+ ];
779
+ }, kr = function(e) {
780
+ var t = e.scrollLeft, n = e.scrollWidth, r = e.clientWidth;
781
+ return [
782
+ t,
783
+ n,
784
+ r
785
+ ];
786
+ }, kt = function(e, t) {
787
+ return e === "v" ? Or(t) : Fr(t);
788
+ }, Kt = function(e, t) {
789
+ return e === "v" ? Lr(t) : kr(t);
790
+ }, Kr = function(e, t) {
791
+ return e === "h" && t === "rtl" ? -1 : 1;
792
+ }, Gr = function(e, t, n, r, a) {
793
+ var s = Kr(e, window.getComputedStyle(t).direction), u = s * r, c = n.target, m = t.contains(c), d = !1, p = u > 0, f = 0, h = 0;
794
+ do {
795
+ var E = Kt(e, c), v = E[0], i = E[1], w = E[2], g = i - w - s * v;
796
+ (v || g) && kt(e, c) && (f += g, h += v), c instanceof ShadowRoot ? c = c.host : c = c.parentNode;
797
+ } while (
798
+ // portaled content
799
+ !m && c !== document.body || // self content
800
+ m && (t.contains(c) || t === c)
801
+ );
802
+ return (p && (a && Math.abs(f) < 1 || !a && u > f) || !p && (a && Math.abs(h) < 1 || !a && -u > h)) && (d = !0), d;
803
+ }, ge = function(e) {
804
+ return "changedTouches" in e ? [e.changedTouches[0].clientX, e.changedTouches[0].clientY] : [0, 0];
805
+ }, ot = function(e) {
806
+ return [e.deltaX, e.deltaY];
807
+ }, at = function(e) {
808
+ return e && "current" in e ? e.current : e;
809
+ }, Br = function(e, t) {
810
+ return e[0] === t[0] && e[1] === t[1];
811
+ }, Ur = function(e) {
812
+ return `
813
+ .block-interactivity-`.concat(e, ` {pointer-events: none;}
814
+ .allow-interactivity-`).concat(e, ` {pointer-events: all;}
815
+ `);
816
+ }, $r = 0, te = [];
817
+ function Wr(e) {
818
+ var t = o.useRef([]), n = o.useRef([0, 0]), r = o.useRef(), a = o.useState($r++)[0], s = o.useState(Un)[0], u = o.useRef(e);
819
+ o.useEffect(function() {
820
+ u.current = e;
821
+ }, [e]), o.useEffect(function() {
822
+ if (e.inert) {
823
+ document.body.classList.add("block-interactivity-".concat(a));
824
+ var i = $n([e.lockRef.current], (e.shards || []).map(at), !0).filter(Boolean);
825
+ return i.forEach(function(w) {
826
+ return w.classList.add("allow-interactivity-".concat(a));
827
+ }), function() {
828
+ document.body.classList.remove("block-interactivity-".concat(a)), i.forEach(function(w) {
829
+ return w.classList.remove("allow-interactivity-".concat(a));
830
+ });
831
+ };
832
+ }
833
+ }, [e.inert, e.lockRef.current, e.shards]);
834
+ var c = o.useCallback(function(i, w) {
835
+ if ("touches" in i && i.touches.length === 2 || i.type === "wheel" && i.ctrlKey)
836
+ return !u.current.allowPinchZoom;
837
+ var g = ge(i), C = n.current, y = "deltaX" in i ? i.deltaX : C[0] - g[0], M = "deltaY" in i ? i.deltaY : C[1] - g[1], P, I = i.target, R = Math.abs(y) > Math.abs(M) ? "h" : "v";
838
+ if ("touches" in i && R === "h" && I.type === "range")
839
+ return !1;
840
+ var _ = rt(R, I);
841
+ if (!_)
842
+ return !0;
843
+ if (_ ? P = R : (P = R === "v" ? "h" : "v", _ = rt(R, I)), !_)
844
+ return !1;
845
+ if (!r.current && "changedTouches" in i && (y || M) && (r.current = P), !P)
846
+ return !0;
847
+ var T = r.current || P;
848
+ return Gr(T, w, i, T === "h" ? y : M, !0);
849
+ }, []), m = o.useCallback(function(i) {
850
+ var w = i;
851
+ if (!(!te.length || te[te.length - 1] !== s)) {
852
+ var g = "deltaY" in w ? ot(w) : ge(w), C = t.current.filter(function(P) {
853
+ return P.name === w.type && (P.target === w.target || w.target === P.shadowParent) && Br(P.delta, g);
854
+ })[0];
855
+ if (C && C.should) {
856
+ w.cancelable && w.preventDefault();
857
+ return;
858
+ }
859
+ if (!C) {
860
+ var y = (u.current.shards || []).map(at).filter(Boolean).filter(function(P) {
861
+ return P.contains(w.target);
862
+ }), M = y.length > 0 ? c(w, y[0]) : !u.current.noIsolation;
863
+ M && w.cancelable && w.preventDefault();
864
+ }
865
+ }
866
+ }, []), d = o.useCallback(function(i, w, g, C) {
867
+ var y = { name: i, delta: w, target: g, should: C, shadowParent: Hr(g) };
868
+ t.current.push(y), setTimeout(function() {
869
+ t.current = t.current.filter(function(M) {
870
+ return M !== y;
871
+ });
872
+ }, 1);
873
+ }, []), p = o.useCallback(function(i) {
874
+ n.current = ge(i), r.current = void 0;
875
+ }, []), f = o.useCallback(function(i) {
876
+ d(i.type, ot(i), i.target, c(i, e.lockRef.current));
877
+ }, []), h = o.useCallback(function(i) {
878
+ d(i.type, ge(i), i.target, c(i, e.lockRef.current));
879
+ }, []);
880
+ o.useEffect(function() {
881
+ return te.push(s), e.setCallbacks({
882
+ onScrollCapture: f,
883
+ onWheelCapture: f,
884
+ onTouchMoveCapture: h
885
+ }), document.addEventListener("wheel", m, ee), document.addEventListener("touchmove", m, ee), document.addEventListener("touchstart", p, ee), function() {
886
+ te = te.filter(function(i) {
887
+ return i !== s;
888
+ }), document.removeEventListener("wheel", m, ee), document.removeEventListener("touchmove", m, ee), document.removeEventListener("touchstart", p, ee);
889
+ };
890
+ }, []);
891
+ var E = e.removeScrollBar, v = e.inert;
892
+ return o.createElement(
893
+ o.Fragment,
894
+ null,
895
+ v ? o.createElement(s, { styles: Ur(a) }) : null,
896
+ E ? o.createElement(Wn, { gapMode: e.gapMode }) : null
897
+ );
898
+ }
899
+ function Hr(e) {
900
+ for (var t = null; e !== null; )
901
+ e instanceof ShadowRoot && (t = e.host, e = e.host), e = e.parentNode;
902
+ return t;
903
+ }
904
+ const Yr = Hn(Ft, Wr);
905
+ var Gt = o.forwardRef(function(e, t) {
906
+ return o.createElement(ye, ne({}, e, { ref: t, sideCar: Yr }));
907
+ });
908
+ Gt.classNames = ye.classNames;
909
+ const Xr = Gt;
910
+ var Le = ["Enter", " "], Vr = ["ArrowDown", "PageUp", "Home"], Bt = ["ArrowUp", "PageDown", "End"], zr = [...Vr, ...Bt], jr = {
911
+ ltr: [...Le, "ArrowRight"],
912
+ rtl: [...Le, "ArrowLeft"]
913
+ }, Zr = {
914
+ ltr: ["ArrowLeft"],
915
+ rtl: ["ArrowRight"]
916
+ }, fe = "Menu", [ue, qr, Qr] = lt(fe), [j, Ut] = de(fe, [
917
+ Qr,
918
+ Et,
919
+ xt
920
+ ]), Me = Et(), $t = xt(), [Jr, Z] = j(fe), [eo, pe] = j(fe), Wt = (e) => {
921
+ const { __scopeMenu: t, open: n = !1, children: r, dir: a, onOpenChange: s, modal: u = !0 } = e, c = Me(t), [m, d] = o.useState(null), p = o.useRef(!1), f = Y(s), h = dt(a);
922
+ return o.useEffect(() => {
923
+ const E = () => {
924
+ p.current = !0, document.addEventListener("pointerdown", v, { capture: !0, once: !0 }), document.addEventListener("pointermove", v, { capture: !0, once: !0 });
925
+ }, v = () => p.current = !1;
926
+ return document.addEventListener("keydown", E, { capture: !0 }), () => {
927
+ document.removeEventListener("keydown", E, { capture: !0 }), document.removeEventListener("pointerdown", v, { capture: !0 }), document.removeEventListener("pointermove", v, { capture: !0 });
928
+ };
929
+ }, []), /* @__PURE__ */ l(hr, { ...c, children: /* @__PURE__ */ l(
930
+ Jr,
931
+ {
932
+ scope: t,
933
+ open: n,
934
+ onOpenChange: f,
935
+ content: m,
936
+ onContentChange: d,
937
+ children: /* @__PURE__ */ l(
938
+ eo,
939
+ {
940
+ scope: t,
941
+ onClose: o.useCallback(() => f(!1), [f]),
942
+ isUsingKeyboardRef: p,
943
+ dir: h,
944
+ modal: u,
945
+ children: r
946
+ }
947
+ )
948
+ }
949
+ ) });
950
+ };
951
+ Wt.displayName = fe;
952
+ var to = "MenuAnchor", Ge = o.forwardRef(
953
+ (e, t) => {
954
+ const { __scopeMenu: n, ...r } = e, a = Me(n);
955
+ return /* @__PURE__ */ l(gr, { ...a, ...r, ref: t });
956
+ }
957
+ );
958
+ Ge.displayName = to;
959
+ var Be = "MenuPortal", [no, Ht] = j(Be, {
960
+ forceMount: void 0
961
+ }), Yt = (e) => {
962
+ const { __scopeMenu: t, forceMount: n, children: r, container: a } = e, s = Z(Be, t);
963
+ return /* @__PURE__ */ l(no, { scope: t, forceMount: n, children: /* @__PURE__ */ l(Ce, { present: n || s.open, children: /* @__PURE__ */ l(It, { asChild: !0, container: a, children: r }) }) });
964
+ };
965
+ Yt.displayName = Be;
966
+ var K = "MenuContent", [ro, Ue] = j(K), Xt = o.forwardRef(
967
+ (e, t) => {
968
+ const n = Ht(K, e.__scopeMenu), { forceMount: r = n.forceMount, ...a } = e, s = Z(K, e.__scopeMenu), u = pe(K, e.__scopeMenu);
969
+ return /* @__PURE__ */ l(ue.Provider, { scope: e.__scopeMenu, children: /* @__PURE__ */ l(Ce, { present: r || s.open, children: /* @__PURE__ */ l(ue.Slot, { scope: e.__scopeMenu, children: u.modal ? /* @__PURE__ */ l(oo, { ...a, ref: t }) : /* @__PURE__ */ l(ao, { ...a, ref: t }) }) }) });
970
+ }
971
+ ), oo = o.forwardRef(
972
+ (e, t) => {
973
+ const n = Z(K, e.__scopeMenu), r = o.useRef(null), a = L(t, r);
974
+ return o.useEffect(() => {
975
+ const s = r.current;
976
+ if (s)
977
+ return Yn(s);
978
+ }, []), /* @__PURE__ */ l(
979
+ $e,
980
+ {
981
+ ...e,
982
+ ref: a,
983
+ trapFocus: n.open,
984
+ disableOutsidePointerEvents: n.open,
985
+ disableOutsideScroll: !0,
986
+ onFocusOutside: S(
987
+ e.onFocusOutside,
988
+ (s) => s.preventDefault(),
989
+ { checkForDefaultPrevented: !1 }
990
+ ),
991
+ onDismiss: () => n.onOpenChange(!1)
992
+ }
993
+ );
994
+ }
995
+ ), ao = o.forwardRef((e, t) => {
996
+ const n = Z(K, e.__scopeMenu);
997
+ return /* @__PURE__ */ l(
998
+ $e,
999
+ {
1000
+ ...e,
1001
+ ref: t,
1002
+ trapFocus: !1,
1003
+ disableOutsidePointerEvents: !1,
1004
+ disableOutsideScroll: !1,
1005
+ onDismiss: () => n.onOpenChange(!1)
1006
+ }
1007
+ );
1008
+ }), $e = o.forwardRef(
1009
+ (e, t) => {
1010
+ const {
1011
+ __scopeMenu: n,
1012
+ loop: r = !1,
1013
+ trapFocus: a,
1014
+ onOpenAutoFocus: s,
1015
+ onCloseAutoFocus: u,
1016
+ disableOutsidePointerEvents: c,
1017
+ onEntryFocus: m,
1018
+ onEscapeKeyDown: d,
1019
+ onPointerDownOutside: p,
1020
+ onFocusOutside: f,
1021
+ onInteractOutside: h,
1022
+ onDismiss: E,
1023
+ disableOutsideScroll: v,
1024
+ ...i
1025
+ } = e, w = Z(K, n), g = pe(K, n), C = Me(n), y = $t(n), M = qr(n), [P, I] = o.useState(null), R = o.useRef(null), _ = L(t, R, w.onContentChange), T = o.useRef(0), O = o.useRef(""), W = o.useRef(0), X = o.useRef(null), U = o.useRef("right"), q = o.useRef(0), Q = v ? Xr : o.Fragment, G = v ? { as: xe, allowPinchZoom: !0 } : void 0, J = (b) => {
1026
+ var $, ae;
1027
+ const N = O.current + b, A = M().filter((k) => !k.disabled), B = document.activeElement, re = ($ = A.find((k) => k.ref.current === B)) == null ? void 0 : $.textValue, oe = A.map((k) => k.textValue), ve = wo(oe, N, re), V = (ae = A.find((k) => k.textValue === ve)) == null ? void 0 : ae.ref.current;
1028
+ (function k(se) {
1029
+ O.current = se, window.clearTimeout(T.current), se !== "" && (T.current = window.setTimeout(() => k(""), 1e3));
1030
+ })(N), V && setTimeout(() => V.focus());
1031
+ };
1032
+ o.useEffect(() => () => window.clearTimeout(T.current), []), er();
1033
+ const F = o.useCallback((b) => {
1034
+ var A, B;
1035
+ return U.current === ((A = X.current) == null ? void 0 : A.side) && Co(b, (B = X.current) == null ? void 0 : B.area);
1036
+ }, []);
1037
+ return /* @__PURE__ */ l(
1038
+ ro,
1039
+ {
1040
+ scope: n,
1041
+ searchRef: O,
1042
+ onItemEnter: o.useCallback(
1043
+ (b) => {
1044
+ F(b) && b.preventDefault();
1045
+ },
1046
+ [F]
1047
+ ),
1048
+ onItemLeave: o.useCallback(
1049
+ (b) => {
1050
+ var N;
1051
+ F(b) || ((N = R.current) == null || N.focus(), I(null));
1052
+ },
1053
+ [F]
1054
+ ),
1055
+ onTriggerLeave: o.useCallback(
1056
+ (b) => {
1057
+ F(b) && b.preventDefault();
1058
+ },
1059
+ [F]
1060
+ ),
1061
+ pointerGraceTimerRef: W,
1062
+ onPointerGraceIntentChange: o.useCallback((b) => {
1063
+ X.current = b;
1064
+ }, []),
1065
+ children: /* @__PURE__ */ l(Q, { ...G, children: /* @__PURE__ */ l(
1066
+ mt,
1067
+ {
1068
+ asChild: !0,
1069
+ trapped: a,
1070
+ onMountAutoFocus: S(s, (b) => {
1071
+ var N;
1072
+ b.preventDefault(), (N = R.current) == null || N.focus({ preventScroll: !0 });
1073
+ }),
1074
+ onUnmountAutoFocus: u,
1075
+ children: /* @__PURE__ */ l(
1076
+ pt,
1077
+ {
1078
+ asChild: !0,
1079
+ disableOutsidePointerEvents: c,
1080
+ onEscapeKeyDown: d,
1081
+ onPointerDownOutside: p,
1082
+ onFocusOutside: f,
1083
+ onInteractOutside: h,
1084
+ onDismiss: E,
1085
+ children: /* @__PURE__ */ l(
1086
+ Dr,
1087
+ {
1088
+ asChild: !0,
1089
+ ...y,
1090
+ dir: g.dir,
1091
+ orientation: "vertical",
1092
+ loop: r,
1093
+ currentTabStopId: P,
1094
+ onCurrentTabStopIdChange: I,
1095
+ onEntryFocus: S(m, (b) => {
1096
+ g.isUsingKeyboardRef.current || b.preventDefault();
1097
+ }),
1098
+ preventScrollOnEntryFocus: !0,
1099
+ children: /* @__PURE__ */ l(
1100
+ wr,
1101
+ {
1102
+ role: "menu",
1103
+ "aria-orientation": "vertical",
1104
+ "data-state": un(w.open),
1105
+ "data-radix-menu-content": "",
1106
+ dir: g.dir,
1107
+ ...C,
1108
+ ...i,
1109
+ ref: _,
1110
+ style: { outline: "none", ...i.style },
1111
+ onKeyDown: S(i.onKeyDown, (b) => {
1112
+ const A = b.target.closest("[data-radix-menu-content]") === b.currentTarget, B = b.ctrlKey || b.altKey || b.metaKey, re = b.key.length === 1;
1113
+ A && (b.key === "Tab" && b.preventDefault(), !B && re && J(b.key));
1114
+ const oe = R.current;
1115
+ if (b.target !== oe || !zr.includes(b.key))
1116
+ return;
1117
+ b.preventDefault();
1118
+ const V = M().filter(($) => !$.disabled).map(($) => $.ref.current);
1119
+ Bt.includes(b.key) && V.reverse(), ho(V);
1120
+ }),
1121
+ onBlur: S(e.onBlur, (b) => {
1122
+ b.currentTarget.contains(b.target) || (window.clearTimeout(T.current), O.current = "");
1123
+ }),
1124
+ onPointerMove: S(
1125
+ e.onPointerMove,
1126
+ le((b) => {
1127
+ const N = b.target, A = q.current !== b.clientX;
1128
+ if (b.currentTarget.contains(N) && A) {
1129
+ const B = b.clientX > q.current ? "right" : "left";
1130
+ U.current = B, q.current = b.clientX;
1131
+ }
1132
+ })
1133
+ )
1134
+ }
1135
+ )
1136
+ }
1137
+ )
1138
+ }
1139
+ )
1140
+ }
1141
+ ) })
1142
+ }
1143
+ );
1144
+ }
1145
+ );
1146
+ Xt.displayName = K;
1147
+ var so = "MenuGroup", We = o.forwardRef(
1148
+ (e, t) => {
1149
+ const { __scopeMenu: n, ...r } = e;
1150
+ return /* @__PURE__ */ l(x.div, { role: "group", ...r, ref: t });
1151
+ }
1152
+ );
1153
+ We.displayName = so;
1154
+ var co = "MenuLabel", Vt = o.forwardRef(
1155
+ (e, t) => {
1156
+ const { __scopeMenu: n, ...r } = e;
1157
+ return /* @__PURE__ */ l(x.div, { ...r, ref: t });
1158
+ }
1159
+ );
1160
+ Vt.displayName = co;
1161
+ var we = "MenuItem", st = "menu.itemSelect", Re = o.forwardRef(
1162
+ (e, t) => {
1163
+ const { disabled: n = !1, onSelect: r, ...a } = e, s = o.useRef(null), u = pe(we, e.__scopeMenu), c = Ue(we, e.__scopeMenu), m = L(t, s), d = o.useRef(!1), p = () => {
1164
+ const f = s.current;
1165
+ if (!n && f) {
1166
+ const h = new CustomEvent(st, { bubbles: !0, cancelable: !0 });
1167
+ f.addEventListener(st, (E) => r == null ? void 0 : r(E), { once: !0 }), ct(f, h), h.defaultPrevented ? d.current = !1 : u.onClose();
1168
+ }
1169
+ };
1170
+ return /* @__PURE__ */ l(
1171
+ zt,
1172
+ {
1173
+ ...a,
1174
+ ref: m,
1175
+ disabled: n,
1176
+ onClick: S(e.onClick, p),
1177
+ onPointerDown: (f) => {
1178
+ var h;
1179
+ (h = e.onPointerDown) == null || h.call(e, f), d.current = !0;
1180
+ },
1181
+ onPointerUp: S(e.onPointerUp, (f) => {
1182
+ var h;
1183
+ d.current || (h = f.currentTarget) == null || h.click();
1184
+ }),
1185
+ onKeyDown: S(e.onKeyDown, (f) => {
1186
+ const h = c.searchRef.current !== "";
1187
+ n || h && f.key === " " || Le.includes(f.key) && (f.currentTarget.click(), f.preventDefault());
1188
+ })
1189
+ }
1190
+ );
1191
+ }
1192
+ );
1193
+ Re.displayName = we;
1194
+ var zt = o.forwardRef(
1195
+ (e, t) => {
1196
+ const { __scopeMenu: n, disabled: r = !1, textValue: a, ...s } = e, u = Ue(we, n), c = $t(n), m = o.useRef(null), d = L(t, m), [p, f] = o.useState(!1), [h, E] = o.useState("");
1197
+ return o.useEffect(() => {
1198
+ const v = m.current;
1199
+ v && E((v.textContent ?? "").trim());
1200
+ }, [s.children]), /* @__PURE__ */ l(
1201
+ ue.ItemSlot,
1202
+ {
1203
+ scope: n,
1204
+ disabled: r,
1205
+ textValue: a ?? h,
1206
+ children: /* @__PURE__ */ l(Tr, { asChild: !0, ...c, focusable: !r, children: /* @__PURE__ */ l(
1207
+ x.div,
1208
+ {
1209
+ role: "menuitem",
1210
+ "data-highlighted": p ? "" : void 0,
1211
+ "aria-disabled": r || void 0,
1212
+ "data-disabled": r ? "" : void 0,
1213
+ ...s,
1214
+ ref: d,
1215
+ onPointerMove: S(
1216
+ e.onPointerMove,
1217
+ le((v) => {
1218
+ r ? u.onItemLeave(v) : (u.onItemEnter(v), v.defaultPrevented || v.currentTarget.focus({ preventScroll: !0 }));
1219
+ })
1220
+ ),
1221
+ onPointerLeave: S(
1222
+ e.onPointerLeave,
1223
+ le((v) => u.onItemLeave(v))
1224
+ ),
1225
+ onFocus: S(e.onFocus, () => f(!0)),
1226
+ onBlur: S(e.onBlur, () => f(!1))
1227
+ }
1228
+ ) })
1229
+ }
1230
+ );
1231
+ }
1232
+ ), io = "MenuCheckboxItem", jt = o.forwardRef(
1233
+ (e, t) => {
1234
+ const { checked: n = !1, onCheckedChange: r, ...a } = e;
1235
+ return /* @__PURE__ */ l(en, { scope: e.__scopeMenu, checked: n, children: /* @__PURE__ */ l(
1236
+ Re,
1237
+ {
1238
+ role: "menuitemcheckbox",
1239
+ "aria-checked": Ee(n) ? "mixed" : n,
1240
+ ...a,
1241
+ ref: t,
1242
+ "data-state": Ye(n),
1243
+ onSelect: S(
1244
+ a.onSelect,
1245
+ () => r == null ? void 0 : r(Ee(n) ? !0 : !n),
1246
+ { checkForDefaultPrevented: !1 }
1247
+ )
1248
+ }
1249
+ ) });
1250
+ }
1251
+ );
1252
+ jt.displayName = io;
1253
+ var Zt = "MenuRadioGroup", [uo, lo] = j(
1254
+ Zt,
1255
+ { value: void 0, onValueChange: () => {
1256
+ } }
1257
+ ), qt = o.forwardRef(
1258
+ (e, t) => {
1259
+ const { value: n, onValueChange: r, ...a } = e, s = Y(r);
1260
+ return /* @__PURE__ */ l(uo, { scope: e.__scopeMenu, value: n, onValueChange: s, children: /* @__PURE__ */ l(We, { ...a, ref: t }) });
1261
+ }
1262
+ );
1263
+ qt.displayName = Zt;
1264
+ var Qt = "MenuRadioItem", Jt = o.forwardRef(
1265
+ (e, t) => {
1266
+ const { value: n, ...r } = e, a = lo(Qt, e.__scopeMenu), s = n === a.value;
1267
+ return /* @__PURE__ */ l(en, { scope: e.__scopeMenu, checked: s, children: /* @__PURE__ */ l(
1268
+ Re,
1269
+ {
1270
+ role: "menuitemradio",
1271
+ "aria-checked": s,
1272
+ ...r,
1273
+ ref: t,
1274
+ "data-state": Ye(s),
1275
+ onSelect: S(
1276
+ r.onSelect,
1277
+ () => {
1278
+ var u;
1279
+ return (u = a.onValueChange) == null ? void 0 : u.call(a, n);
1280
+ },
1281
+ { checkForDefaultPrevented: !1 }
1282
+ )
1283
+ }
1284
+ ) });
1285
+ }
1286
+ );
1287
+ Jt.displayName = Qt;
1288
+ var He = "MenuItemIndicator", [en, fo] = j(
1289
+ He,
1290
+ { checked: !1 }
1291
+ ), tn = o.forwardRef(
1292
+ (e, t) => {
1293
+ const { __scopeMenu: n, forceMount: r, ...a } = e, s = fo(He, n);
1294
+ return /* @__PURE__ */ l(
1295
+ Ce,
1296
+ {
1297
+ present: r || Ee(s.checked) || s.checked === !0,
1298
+ children: /* @__PURE__ */ l(
1299
+ x.span,
1300
+ {
1301
+ ...a,
1302
+ ref: t,
1303
+ "data-state": Ye(s.checked)
1304
+ }
1305
+ )
1306
+ }
1307
+ );
1308
+ }
1309
+ );
1310
+ tn.displayName = He;
1311
+ var po = "MenuSeparator", nn = o.forwardRef(
1312
+ (e, t) => {
1313
+ const { __scopeMenu: n, ...r } = e;
1314
+ return /* @__PURE__ */ l(
1315
+ x.div,
1316
+ {
1317
+ role: "separator",
1318
+ "aria-orientation": "horizontal",
1319
+ ...r,
1320
+ ref: t
1321
+ }
1322
+ );
1323
+ }
1324
+ );
1325
+ nn.displayName = po;
1326
+ var vo = "MenuArrow", rn = o.forwardRef(
1327
+ (e, t) => {
1328
+ const { __scopeMenu: n, ...r } = e, a = Me(n);
1329
+ return /* @__PURE__ */ l(Er, { ...a, ...r, ref: t });
1330
+ }
1331
+ );
1332
+ rn.displayName = vo;
1333
+ var mo = "MenuSub", [fa, on] = j(mo), ie = "MenuSubTrigger", an = o.forwardRef(
1334
+ (e, t) => {
1335
+ const n = Z(ie, e.__scopeMenu), r = pe(ie, e.__scopeMenu), a = on(ie, e.__scopeMenu), s = Ue(ie, e.__scopeMenu), u = o.useRef(null), { pointerGraceTimerRef: c, onPointerGraceIntentChange: m } = s, d = { __scopeMenu: e.__scopeMenu }, p = o.useCallback(() => {
1336
+ u.current && window.clearTimeout(u.current), u.current = null;
1337
+ }, []);
1338
+ return o.useEffect(() => p, [p]), o.useEffect(() => {
1339
+ const f = c.current;
1340
+ return () => {
1341
+ window.clearTimeout(f), m(null);
1342
+ };
1343
+ }, [c, m]), /* @__PURE__ */ l(Ge, { asChild: !0, ...d, children: /* @__PURE__ */ l(
1344
+ zt,
1345
+ {
1346
+ id: a.triggerId,
1347
+ "aria-haspopup": "menu",
1348
+ "aria-expanded": n.open,
1349
+ "aria-controls": a.contentId,
1350
+ "data-state": un(n.open),
1351
+ ...e,
1352
+ ref: it(t, a.onTriggerChange),
1353
+ onClick: (f) => {
1354
+ var h;
1355
+ (h = e.onClick) == null || h.call(e, f), !(e.disabled || f.defaultPrevented) && (f.currentTarget.focus(), n.open || n.onOpenChange(!0));
1356
+ },
1357
+ onPointerMove: S(
1358
+ e.onPointerMove,
1359
+ le((f) => {
1360
+ s.onItemEnter(f), !f.defaultPrevented && !e.disabled && !n.open && !u.current && (s.onPointerGraceIntentChange(null), u.current = window.setTimeout(() => {
1361
+ n.onOpenChange(!0), p();
1362
+ }, 100));
1363
+ })
1364
+ ),
1365
+ onPointerLeave: S(
1366
+ e.onPointerLeave,
1367
+ le((f) => {
1368
+ var E, v;
1369
+ p();
1370
+ const h = (E = n.content) == null ? void 0 : E.getBoundingClientRect();
1371
+ if (h) {
1372
+ const i = (v = n.content) == null ? void 0 : v.dataset.side, w = i === "right", g = w ? -5 : 5, C = h[w ? "left" : "right"], y = h[w ? "right" : "left"];
1373
+ s.onPointerGraceIntentChange({
1374
+ area: [
1375
+ // Apply a bleed on clientX to ensure that our exit point is
1376
+ // consistently within polygon bounds
1377
+ { x: f.clientX + g, y: f.clientY },
1378
+ { x: C, y: h.top },
1379
+ { x: y, y: h.top },
1380
+ { x: y, y: h.bottom },
1381
+ { x: C, y: h.bottom }
1382
+ ],
1383
+ side: i
1384
+ }), window.clearTimeout(c.current), c.current = window.setTimeout(
1385
+ () => s.onPointerGraceIntentChange(null),
1386
+ 300
1387
+ );
1388
+ } else {
1389
+ if (s.onTriggerLeave(f), f.defaultPrevented)
1390
+ return;
1391
+ s.onPointerGraceIntentChange(null);
1392
+ }
1393
+ })
1394
+ ),
1395
+ onKeyDown: S(e.onKeyDown, (f) => {
1396
+ var E;
1397
+ const h = s.searchRef.current !== "";
1398
+ e.disabled || h && f.key === " " || jr[r.dir].includes(f.key) && (n.onOpenChange(!0), (E = n.content) == null || E.focus(), f.preventDefault());
1399
+ })
1400
+ }
1401
+ ) });
1402
+ }
1403
+ );
1404
+ an.displayName = ie;
1405
+ var sn = "MenuSubContent", cn = o.forwardRef(
1406
+ (e, t) => {
1407
+ const n = Ht(K, e.__scopeMenu), { forceMount: r = n.forceMount, ...a } = e, s = Z(K, e.__scopeMenu), u = pe(K, e.__scopeMenu), c = on(sn, e.__scopeMenu), m = o.useRef(null), d = L(t, m);
1408
+ return /* @__PURE__ */ l(ue.Provider, { scope: e.__scopeMenu, children: /* @__PURE__ */ l(Ce, { present: r || s.open, children: /* @__PURE__ */ l(ue.Slot, { scope: e.__scopeMenu, children: /* @__PURE__ */ l(
1409
+ $e,
1410
+ {
1411
+ id: c.contentId,
1412
+ "aria-labelledby": c.triggerId,
1413
+ ...a,
1414
+ ref: d,
1415
+ align: "start",
1416
+ side: u.dir === "rtl" ? "left" : "right",
1417
+ disableOutsidePointerEvents: !1,
1418
+ disableOutsideScroll: !1,
1419
+ trapFocus: !1,
1420
+ onOpenAutoFocus: (p) => {
1421
+ var f;
1422
+ u.isUsingKeyboardRef.current && ((f = m.current) == null || f.focus()), p.preventDefault();
1423
+ },
1424
+ onCloseAutoFocus: (p) => p.preventDefault(),
1425
+ onFocusOutside: S(e.onFocusOutside, (p) => {
1426
+ p.target !== c.trigger && s.onOpenChange(!1);
1427
+ }),
1428
+ onEscapeKeyDown: S(e.onEscapeKeyDown, (p) => {
1429
+ u.onClose(), p.preventDefault();
1430
+ }),
1431
+ onKeyDown: S(e.onKeyDown, (p) => {
1432
+ var E;
1433
+ const f = p.currentTarget.contains(p.target), h = Zr[u.dir].includes(p.key);
1434
+ f && h && (s.onOpenChange(!1), (E = c.trigger) == null || E.focus(), p.preventDefault());
1435
+ })
1436
+ }
1437
+ ) }) }) });
1438
+ }
1439
+ );
1440
+ cn.displayName = sn;
1441
+ function un(e) {
1442
+ return e ? "open" : "closed";
1443
+ }
1444
+ function Ee(e) {
1445
+ return e === "indeterminate";
1446
+ }
1447
+ function Ye(e) {
1448
+ return Ee(e) ? "indeterminate" : e ? "checked" : "unchecked";
1449
+ }
1450
+ function ho(e) {
1451
+ const t = document.activeElement;
1452
+ for (const n of e)
1453
+ if (n === t || (n.focus(), document.activeElement !== t))
1454
+ return;
1455
+ }
1456
+ function go(e, t) {
1457
+ return e.map((n, r) => e[(t + r) % e.length]);
1458
+ }
1459
+ function wo(e, t, n) {
1460
+ const a = t.length > 1 && Array.from(t).every((d) => d === t[0]) ? t[0] : t, s = n ? e.indexOf(n) : -1;
1461
+ let u = go(e, Math.max(s, 0));
1462
+ a.length === 1 && (u = u.filter((d) => d !== n));
1463
+ const m = u.find(
1464
+ (d) => d.toLowerCase().startsWith(a.toLowerCase())
1465
+ );
1466
+ return m !== n ? m : void 0;
1467
+ }
1468
+ function Eo(e, t) {
1469
+ const { x: n, y: r } = e;
1470
+ let a = !1;
1471
+ for (let s = 0, u = t.length - 1; s < t.length; u = s++) {
1472
+ const c = t[s].x, m = t[s].y, d = t[u].x, p = t[u].y;
1473
+ m > r != p > r && n < (d - c) * (r - m) / (p - m) + c && (a = !a);
1474
+ }
1475
+ return a;
1476
+ }
1477
+ function Co(e, t) {
1478
+ if (!t)
1479
+ return !1;
1480
+ const n = { x: e.clientX, y: e.clientY };
1481
+ return Eo(n, t);
1482
+ }
1483
+ function le(e) {
1484
+ return (t) => t.pointerType === "mouse" ? e(t) : void 0;
1485
+ }
1486
+ var bo = Wt, yo = Ge, Mo = Yt, Ro = Xt, So = We, Po = Vt, _o = Re, Io = jt, Ao = qt, xo = Jt, Do = tn, To = nn, No = rn, Oo = an, Fo = cn, Xe = "DropdownMenu", [Lo, pa] = de(
1487
+ Xe,
1488
+ [Ut]
1489
+ ), D = Ut(), [ko, ln] = Lo(Xe), dn = (e) => {
1490
+ const {
1491
+ __scopeDropdownMenu: t,
1492
+ children: n,
1493
+ dir: r,
1494
+ open: a,
1495
+ defaultOpen: s,
1496
+ onOpenChange: u,
1497
+ modal: c = !0
1498
+ } = e, m = D(t), d = o.useRef(null), [p = !1, f] = ut({
1499
+ prop: a,
1500
+ defaultProp: s,
1501
+ onChange: u
1502
+ });
1503
+ return /* @__PURE__ */ l(
1504
+ ko,
1505
+ {
1506
+ scope: t,
1507
+ triggerId: Te(),
1508
+ triggerRef: d,
1509
+ contentId: Te(),
1510
+ open: p,
1511
+ onOpenChange: f,
1512
+ onOpenToggle: o.useCallback(() => f((h) => !h), [f]),
1513
+ modal: c,
1514
+ children: /* @__PURE__ */ l(bo, { ...m, open: p, onOpenChange: f, dir: r, modal: c, children: n })
1515
+ }
1516
+ );
1517
+ };
1518
+ dn.displayName = Xe;
1519
+ var fn = "DropdownMenuTrigger", pn = o.forwardRef(
1520
+ (e, t) => {
1521
+ const { __scopeDropdownMenu: n, disabled: r = !1, ...a } = e, s = ln(fn, n), u = D(n);
1522
+ return /* @__PURE__ */ l(yo, { asChild: !0, ...u, children: /* @__PURE__ */ l(
1523
+ x.button,
1524
+ {
1525
+ type: "button",
1526
+ id: s.triggerId,
1527
+ "aria-haspopup": "menu",
1528
+ "aria-expanded": s.open,
1529
+ "aria-controls": s.open ? s.contentId : void 0,
1530
+ "data-state": s.open ? "open" : "closed",
1531
+ "data-disabled": r ? "" : void 0,
1532
+ disabled: r,
1533
+ ...a,
1534
+ ref: it(t, s.triggerRef),
1535
+ onPointerDown: S(e.onPointerDown, (c) => {
1536
+ !r && c.button === 0 && c.ctrlKey === !1 && (s.onOpenToggle(), s.open || c.preventDefault());
1537
+ }),
1538
+ onKeyDown: S(e.onKeyDown, (c) => {
1539
+ r || (["Enter", " "].includes(c.key) && s.onOpenToggle(), c.key === "ArrowDown" && s.onOpenChange(!0), ["Enter", " ", "ArrowDown"].includes(c.key) && c.preventDefault());
1540
+ })
1541
+ }
1542
+ ) });
1543
+ }
1544
+ );
1545
+ pn.displayName = fn;
1546
+ var Ko = "DropdownMenuPortal", vn = (e) => {
1547
+ const { __scopeDropdownMenu: t, ...n } = e, r = D(t);
1548
+ return /* @__PURE__ */ l(Mo, { ...r, ...n });
1549
+ };
1550
+ vn.displayName = Ko;
1551
+ var mn = "DropdownMenuContent", hn = o.forwardRef(
1552
+ (e, t) => {
1553
+ const { __scopeDropdownMenu: n, ...r } = e, a = ln(mn, n), s = D(n), u = o.useRef(!1);
1554
+ return /* @__PURE__ */ l(
1555
+ Ro,
1556
+ {
1557
+ id: a.contentId,
1558
+ "aria-labelledby": a.triggerId,
1559
+ ...s,
1560
+ ...r,
1561
+ ref: t,
1562
+ onCloseAutoFocus: S(e.onCloseAutoFocus, (c) => {
1563
+ var m;
1564
+ u.current || (m = a.triggerRef.current) == null || m.focus(), u.current = !1, c.preventDefault();
1565
+ }),
1566
+ onInteractOutside: S(e.onInteractOutside, (c) => {
1567
+ const m = c.detail.originalEvent, d = m.button === 0 && m.ctrlKey === !0, p = m.button === 2 || d;
1568
+ (!a.modal || p) && (u.current = !0);
1569
+ }),
1570
+ style: {
1571
+ ...e.style,
1572
+ "--radix-dropdown-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
1573
+ "--radix-dropdown-menu-content-available-width": "var(--radix-popper-available-width)",
1574
+ "--radix-dropdown-menu-content-available-height": "var(--radix-popper-available-height)",
1575
+ "--radix-dropdown-menu-trigger-width": "var(--radix-popper-anchor-width)",
1576
+ "--radix-dropdown-menu-trigger-height": "var(--radix-popper-anchor-height)"
1577
+ }
1578
+ }
1579
+ );
1580
+ }
1581
+ );
1582
+ hn.displayName = mn;
1583
+ var Go = "DropdownMenuGroup", gn = o.forwardRef(
1584
+ (e, t) => {
1585
+ const { __scopeDropdownMenu: n, ...r } = e, a = D(n);
1586
+ return /* @__PURE__ */ l(So, { ...a, ...r, ref: t });
1587
+ }
1588
+ );
1589
+ gn.displayName = Go;
1590
+ var Bo = "DropdownMenuLabel", Uo = o.forwardRef(
1591
+ (e, t) => {
1592
+ const { __scopeDropdownMenu: n, ...r } = e, a = D(n);
1593
+ return /* @__PURE__ */ l(Po, { ...a, ...r, ref: t });
1594
+ }
1595
+ );
1596
+ Uo.displayName = Bo;
1597
+ var $o = "DropdownMenuItem", wn = o.forwardRef(
1598
+ (e, t) => {
1599
+ const { __scopeDropdownMenu: n, ...r } = e, a = D(n);
1600
+ return /* @__PURE__ */ l(_o, { ...a, ...r, ref: t });
1601
+ }
1602
+ );
1603
+ wn.displayName = $o;
1604
+ var Wo = "DropdownMenuCheckboxItem", Ho = o.forwardRef((e, t) => {
1605
+ const { __scopeDropdownMenu: n, ...r } = e, a = D(n);
1606
+ return /* @__PURE__ */ l(Io, { ...a, ...r, ref: t });
1607
+ });
1608
+ Ho.displayName = Wo;
1609
+ var Yo = "DropdownMenuRadioGroup", Xo = o.forwardRef((e, t) => {
1610
+ const { __scopeDropdownMenu: n, ...r } = e, a = D(n);
1611
+ return /* @__PURE__ */ l(Ao, { ...a, ...r, ref: t });
1612
+ });
1613
+ Xo.displayName = Yo;
1614
+ var Vo = "DropdownMenuRadioItem", zo = o.forwardRef((e, t) => {
1615
+ const { __scopeDropdownMenu: n, ...r } = e, a = D(n);
1616
+ return /* @__PURE__ */ l(xo, { ...a, ...r, ref: t });
1617
+ });
1618
+ zo.displayName = Vo;
1619
+ var jo = "DropdownMenuItemIndicator", Zo = o.forwardRef((e, t) => {
1620
+ const { __scopeDropdownMenu: n, ...r } = e, a = D(n);
1621
+ return /* @__PURE__ */ l(Do, { ...a, ...r, ref: t });
1622
+ });
1623
+ Zo.displayName = jo;
1624
+ var qo = "DropdownMenuSeparator", En = o.forwardRef((e, t) => {
1625
+ const { __scopeDropdownMenu: n, ...r } = e, a = D(n);
1626
+ return /* @__PURE__ */ l(To, { ...a, ...r, ref: t });
1627
+ });
1628
+ En.displayName = qo;
1629
+ var Qo = "DropdownMenuArrow", Jo = o.forwardRef(
1630
+ (e, t) => {
1631
+ const { __scopeDropdownMenu: n, ...r } = e, a = D(n);
1632
+ return /* @__PURE__ */ l(No, { ...a, ...r, ref: t });
1633
+ }
1634
+ );
1635
+ Jo.displayName = Qo;
1636
+ var ea = "DropdownMenuSubTrigger", ta = o.forwardRef((e, t) => {
1637
+ const { __scopeDropdownMenu: n, ...r } = e, a = D(n);
1638
+ return /* @__PURE__ */ l(Oo, { ...a, ...r, ref: t });
1639
+ });
1640
+ ta.displayName = ea;
1641
+ var na = "DropdownMenuSubContent", ra = o.forwardRef((e, t) => {
1642
+ const { __scopeDropdownMenu: n, ...r } = e, a = D(n);
1643
+ return /* @__PURE__ */ l(
1644
+ Fo,
1645
+ {
1646
+ ...a,
1647
+ ...r,
1648
+ ref: t,
1649
+ style: {
1650
+ ...e.style,
1651
+ "--radix-dropdown-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
1652
+ "--radix-dropdown-menu-content-available-width": "var(--radix-popper-available-width)",
1653
+ "--radix-dropdown-menu-content-available-height": "var(--radix-popper-available-height)",
1654
+ "--radix-dropdown-menu-trigger-width": "var(--radix-popper-anchor-width)",
1655
+ "--radix-dropdown-menu-trigger-height": "var(--radix-popper-anchor-height)"
1656
+ }
1657
+ }
1658
+ );
1659
+ });
1660
+ ra.displayName = na;
1661
+ var va = dn, ma = pn, ha = vn, ga = hn, wa = gn, Ea = wn, Ca = En;
1662
+ export {
1663
+ ga as C,
1664
+ pt as D,
1665
+ mt as F,
1666
+ wa as G,
1667
+ Ea as I,
1668
+ ha as P,
1669
+ va as R,
1670
+ Ca as S,
1671
+ ma as T,
1672
+ Xr as a,
1673
+ It as b,
1674
+ er as u
1675
+ };