@pdf-viewer/react 1.11.0-beta.2 → 1.11.0-rc.1

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