@pdf-viewer/react 1.9.0-beta.2 → 1.9.0-beta.4

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 (98) hide show
  1. package/dist/RPLayout-5892502c.js +3494 -0
  2. package/dist/{SearchCloseButton-ddb9877e.js → SearchCloseButton-cbf182aa.js} +7 -6
  3. package/dist/assets/Checkbox.css +1 -1
  4. package/dist/assets/RPLayout.css +1 -1
  5. package/dist/components/RPConfig.js +691 -673
  6. package/dist/components/RPController.js +1 -1
  7. package/dist/components/RPPages.js +4 -5
  8. package/dist/components/layout/LayoutContainer.js +5 -5
  9. package/dist/components/layout/RPDefaultLayout.js +1 -1
  10. package/dist/components/layout/RPLayout.js +4 -5
  11. package/dist/components/layout/sidebar/RPSidebar.js +1 -1
  12. package/dist/components/layout/sidebar/Thumbnail.js +1 -1
  13. package/dist/components/layout/sidebar/Thumbnails.js +3 -2
  14. package/dist/components/layout/toolbar/DocumentDialog.js +4 -5
  15. package/dist/components/layout/toolbar/DocumentProperties.js +23 -19
  16. package/dist/components/layout/toolbar/FileDownloadTool.js +1 -1
  17. package/dist/components/layout/toolbar/MenuItem.js +1 -1
  18. package/dist/components/layout/toolbar/MenuSeparator.js +1 -1
  19. package/dist/components/layout/toolbar/MostPageTool.js +5 -6
  20. package/dist/components/layout/toolbar/OtherTool.js +2 -2
  21. package/dist/components/layout/toolbar/Paginate.js +1 -1
  22. package/dist/components/layout/toolbar/PrintTool.js +1 -1
  23. package/dist/components/layout/toolbar/RPToolbar.js +2 -2
  24. package/dist/components/layout/toolbar/RPToolbarEnd.js +1 -1
  25. package/dist/components/layout/toolbar/RotateTool.js +1 -1
  26. package/dist/components/layout/toolbar/ScrollModeTool.js +35 -37
  27. package/dist/components/layout/toolbar/SearchCloseButton.js +1 -1
  28. package/dist/components/layout/toolbar/SearchResultNavigator.js +2 -2
  29. package/dist/components/layout/toolbar/SearchTool.js +3 -4
  30. package/dist/components/layout/toolbar/SelectionModeTool.js +1 -1
  31. package/dist/components/layout/toolbar/ThumbnailTool.js +1 -1
  32. package/dist/components/layout/toolbar/ToolbarCustom.js +4 -5
  33. package/dist/components/layout/toolbar/ViewModeTool.js +1 -1
  34. package/dist/components/layout/toolbar/ZoomTool.js +4 -3
  35. package/dist/components/layout/toolbar/tools/FileDownloadTool.js +1 -1
  36. package/dist/components/layout/toolbar/tools/InputPageTool.js +1 -1
  37. package/dist/components/layout/toolbar/tools/NextPageTool.js +5 -6
  38. package/dist/components/layout/toolbar/tools/PreviousPageTool.js +1 -1
  39. package/dist/components/layout/toolbar/tools/PrintTool.js +1 -1
  40. package/dist/components/layout/toolbar/tools/ThumbnailTool.js +1 -1
  41. package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +2 -2
  42. package/dist/components/layout/toolbar/tools/defaults/TopbarDefaultTools.js +1 -1
  43. package/dist/components/page/AnnotationLayer.js +4 -5
  44. package/dist/components/page/CanvasLayer.js +4 -5
  45. package/dist/components/page/DualPage.js +1 -1
  46. package/dist/components/page/RPPage.js +4 -4
  47. package/dist/components/page/SinglePage.js +1 -1
  48. package/dist/components/page/TextHighlightLayer.js +4 -5
  49. package/dist/components/page/TextLayer.js +4 -5
  50. package/dist/components/ui/Button.js +8 -8
  51. package/dist/components/ui/Checkbox.js +243 -120
  52. package/dist/components/ui/DropDown.js +16 -16
  53. package/dist/components/ui/Input.js +11 -11
  54. package/dist/components/ui/LoadingIndicator.js +1 -1
  55. package/dist/components/ui/RPTooltip.js +211 -426
  56. package/dist/contexts/ElementPageContext.js +54 -43
  57. package/dist/contexts/PaginationContext.js +1 -1
  58. package/dist/contexts/PrintContext.js +1 -1
  59. package/dist/contexts/SearchContext.js +1 -1
  60. package/dist/contexts/ThumbnailsContext.js +1 -1
  61. package/dist/index-00f8683a.js +1672 -0
  62. package/dist/index-5f66a29f.js +1681 -0
  63. package/dist/index-6b37f504.js +332 -0
  64. package/dist/main.js +1 -1
  65. package/dist/types/components/layout/LayoutContainer.d.ts +5 -1
  66. package/dist/types/components/layout/sidebar/Thumbnails.d.ts +3 -1
  67. package/dist/types/components/layout/toolbar/RPToolbar.d.ts +3 -1
  68. package/dist/types/components/page/RPPage.d.ts +3 -1
  69. package/dist/types/components/ui/Button.d.ts +3 -1
  70. package/dist/types/components/ui/Checkbox.d.ts +1 -0
  71. package/dist/types/components/ui/DropDown.d.ts +2 -1
  72. package/dist/types/components/ui/Input.d.ts +3 -1
  73. package/dist/types/components/ui/RPTooltip.d.ts +3 -1
  74. package/dist/types/utils/types.d.ts +3 -1
  75. package/dist/types/utils/withRef.d.ts +4 -0
  76. package/dist/utils/hooks/useFileDownload.js +4 -5
  77. package/dist/utils/hooks/useLicense.js +26 -24
  78. package/dist/utils/hooks/usePageRotateContext.js +19 -20
  79. package/dist/utils/hooks/usePaginate.js +4 -5
  80. package/dist/utils/hooks/usePresentPage.js +4 -5
  81. package/dist/utils/hooks/usePrint.js +4 -5
  82. package/dist/utils/hooks/useScrollToPage.js +4 -5
  83. package/dist/utils/hooks/useSearch.js +4 -5
  84. package/dist/utils/hooks/useThumbnail.js +4 -5
  85. package/dist/utils/hooks/useVirtualReactWindow.js +4 -5
  86. package/dist/utils/types.js +6 -6
  87. package/dist/utils/withRef.js +8 -0
  88. package/package.json +1 -1
  89. package/dist/Popover-1faa77f6.js +0 -1445
  90. package/dist/RPLayout-81cd4970.js +0 -3393
  91. package/dist/assets/Popover.css +0 -1
  92. package/dist/component-1da194e8.js +0 -337
  93. package/dist/components/ui/Popover.js +0 -6
  94. package/dist/floating-ui.react-dom-15b9b819.js +0 -1310
  95. package/dist/index-1cb41342.js +0 -307
  96. package/dist/index-7279fb4e.js +0 -1557
  97. package/dist/index-aa2d3884.js +0 -140
  98. package/dist/types/components/ui/Popover.d.ts +0 -9
@@ -1,1445 +0,0 @@
1
- import { jsxs as _t, jsx as ie } from "react/jsx-runtime";
2
- import * as P from "react";
3
- import { useCallback as L, createContext as Y, useMemo as D, createElement as h, useContext as be, forwardRef as A, Children as _, isValidElement as k, cloneElement as V, Fragment as Be, useEffect as S, useRef as O, useState as N, useLayoutEffect as me, useReducer as Nt } from "react";
4
- import Tt, { flushSync as Ue } from "react-dom";
5
- import { u as Dt, a as Ft, o as Rt, s as It, l as Lt, f as kt, b as Mt, c as Bt, h as Ut } from "./floating-ui.react-dom-15b9b819.js";
6
- import { c as Wt, _ as zt, u as Ht, a as K, f as Kt, z as Xt, s as Yt, b as jt, R as Vt, e as Zt, h as Gt } from "./component-1da194e8.js";
7
- import { c as qt } from "./clsx-0c6e471a.js";
8
- import './assets/Popover.css';function x() {
9
- return x = Object.assign ? Object.assign.bind() : function(e) {
10
- for (var t = 1; t < arguments.length; t++) {
11
- var n = arguments[t];
12
- for (var o in n)
13
- ({}).hasOwnProperty.call(n, o) && (e[o] = n[o]);
14
- }
15
- return e;
16
- }, x.apply(null, arguments);
17
- }
18
- function B(e, t, { checkForDefaultPrevented: n = !0 } = {}) {
19
- return function(r) {
20
- if (e == null || e(r), n === !1 || !r.defaultPrevented)
21
- return t == null ? void 0 : t(r);
22
- };
23
- }
24
- function Qt(e, t) {
25
- typeof e == "function" ? e(t) : e != null && (e.current = t);
26
- }
27
- function We(...e) {
28
- return (t) => e.forEach(
29
- (n) => Qt(n, t)
30
- );
31
- }
32
- function Z(...e) {
33
- return L(We(...e), e);
34
- }
35
- function Jt(e, t = []) {
36
- let n = [];
37
- function o(a, i) {
38
- const c = /* @__PURE__ */ Y(i), s = n.length;
39
- n = [
40
- ...n,
41
- i
42
- ];
43
- function u(d) {
44
- const { scope: $, children: f, ...y } = d, l = ($ == null ? void 0 : $[e][s]) || c, p = D(
45
- () => y,
46
- Object.values(y)
47
- );
48
- return /* @__PURE__ */ h(l.Provider, {
49
- value: p
50
- }, f);
51
- }
52
- function v(d, $) {
53
- const f = ($ == null ? void 0 : $[e][s]) || c, y = be(f);
54
- if (y)
55
- return y;
56
- if (i !== void 0)
57
- return i;
58
- throw new Error(`\`${d}\` must be used within \`${a}\``);
59
- }
60
- return u.displayName = a + "Provider", [
61
- u,
62
- v
63
- ];
64
- }
65
- const r = () => {
66
- const a = n.map((i) => /* @__PURE__ */ Y(i));
67
- return function(c) {
68
- const s = (c == null ? void 0 : c[e]) || a;
69
- return D(
70
- () => ({
71
- [`__scope${e}`]: {
72
- ...c,
73
- [e]: s
74
- }
75
- }),
76
- [
77
- c,
78
- s
79
- ]
80
- );
81
- };
82
- };
83
- return r.scopeName = e, [
84
- o,
85
- en(r, ...t)
86
- ];
87
- }
88
- function en(...e) {
89
- const t = e[0];
90
- if (e.length === 1)
91
- return t;
92
- const n = () => {
93
- const o = e.map(
94
- (r) => ({
95
- useScope: r(),
96
- scopeName: r.scopeName
97
- })
98
- );
99
- return function(a) {
100
- const i = o.reduce((c, { useScope: s, scopeName: u }) => {
101
- const d = s(a)[`__scope${u}`];
102
- return {
103
- ...c,
104
- ...d
105
- };
106
- }, {});
107
- return D(
108
- () => ({
109
- [`__scope${t.scopeName}`]: i
110
- }),
111
- [
112
- i
113
- ]
114
- );
115
- };
116
- };
117
- return n.scopeName = t.scopeName, n;
118
- }
119
- const ge = /* @__PURE__ */ A((e, t) => {
120
- const { children: n, ...o } = e, r = _.toArray(n), a = r.find(nn);
121
- if (a) {
122
- const i = a.props.children, c = r.map((s) => s === a ? _.count(i) > 1 ? _.only(null) : /* @__PURE__ */ k(i) ? i.props.children : null : s);
123
- return /* @__PURE__ */ h(fe, x({}, o, {
124
- ref: t
125
- }), /* @__PURE__ */ k(i) ? /* @__PURE__ */ V(i, void 0, c) : null);
126
- }
127
- return /* @__PURE__ */ h(fe, x({}, o, {
128
- ref: t
129
- }), n);
130
- });
131
- ge.displayName = "Slot";
132
- const fe = /* @__PURE__ */ A((e, t) => {
133
- const { children: n, ...o } = e;
134
- return /* @__PURE__ */ k(n) ? /* @__PURE__ */ V(n, {
135
- ...on(o, n.props),
136
- ref: t ? We(t, n.ref) : n.ref
137
- }) : _.count(n) > 1 ? _.only(null) : null;
138
- });
139
- fe.displayName = "SlotClone";
140
- const tn = ({ children: e }) => /* @__PURE__ */ h(Be, null, e);
141
- function nn(e) {
142
- return /* @__PURE__ */ k(e) && e.type === tn;
143
- }
144
- function on(e, t) {
145
- const n = {
146
- ...t
147
- };
148
- for (const o in t) {
149
- const r = e[o], a = t[o];
150
- /^on[A-Z]/.test(o) ? r && a ? n[o] = (...c) => {
151
- a(...c), r(...c);
152
- } : r && (n[o] = r) : o === "style" ? n[o] = {
153
- ...r,
154
- ...a
155
- } : o === "className" && (n[o] = [
156
- r,
157
- a
158
- ].filter(Boolean).join(" "));
159
- }
160
- return {
161
- ...e,
162
- ...n
163
- };
164
- }
165
- const rn = [
166
- "a",
167
- "button",
168
- "div",
169
- "form",
170
- "h2",
171
- "h3",
172
- "img",
173
- "input",
174
- "label",
175
- "li",
176
- "nav",
177
- "ol",
178
- "p",
179
- "span",
180
- "svg",
181
- "ul"
182
- ], oe = rn.reduce((e, t) => {
183
- const n = /* @__PURE__ */ A((o, r) => {
184
- const { asChild: a, ...i } = o, c = a ? ge : t;
185
- return S(() => {
186
- window[Symbol.for("radix-ui")] = !0;
187
- }, []), /* @__PURE__ */ h(c, x({}, i, {
188
- ref: r
189
- }));
190
- });
191
- return n.displayName = `Primitive.${t}`, {
192
- ...e,
193
- [t]: n
194
- };
195
- }, {});
196
- function cn(e, t) {
197
- e && Ue(
198
- () => e.dispatchEvent(t)
199
- );
200
- }
201
- function Pe(e) {
202
- const t = O(e);
203
- return S(() => {
204
- t.current = e;
205
- }), D(
206
- () => (...n) => {
207
- var o;
208
- return (o = t.current) === null || o === void 0 ? void 0 : o.call(t, ...n);
209
- },
210
- []
211
- );
212
- }
213
- function an(e, t = globalThis == null ? void 0 : globalThis.document) {
214
- const n = Pe(e);
215
- S(() => {
216
- const o = (r) => {
217
- r.key === "Escape" && n(r);
218
- };
219
- return t.addEventListener("keydown", o), () => t.removeEventListener("keydown", o);
220
- }, [
221
- n,
222
- t
223
- ]);
224
- }
225
- const ve = "dismissableLayer.update", sn = "dismissableLayer.pointerDownOutside", ln = "dismissableLayer.focusOutside";
226
- let Oe;
227
- const un = /* @__PURE__ */ Y({
228
- layers: /* @__PURE__ */ new Set(),
229
- layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
230
- branches: /* @__PURE__ */ new Set()
231
- }), dn = /* @__PURE__ */ A((e, t) => {
232
- var n;
233
- const { disableOutsidePointerEvents: o = !1, onEscapeKeyDown: r, onPointerDownOutside: a, onFocusOutside: i, onInteractOutside: c, onDismiss: s, ...u } = e, v = be(un), [d, $] = N(null), f = (n = d == null ? void 0 : d.ownerDocument) !== null && n !== void 0 ? n : globalThis == null ? void 0 : globalThis.document, [, y] = N({}), l = Z(
234
- t,
235
- (w) => $(w)
236
- ), p = Array.from(v.layers), [b] = [
237
- ...v.layersWithOutsidePointerEventsDisabled
238
- ].slice(-1), E = p.indexOf(b), g = d ? p.indexOf(d) : -1, m = v.layersWithOutsidePointerEventsDisabled.size > 0, C = g >= E, R = fn((w) => {
239
- const F = w.target, G = [
240
- ...v.branches
241
- ].some(
242
- (M) => M.contains(F)
243
- );
244
- !C || G || (a == null || a(w), c == null || c(w), w.defaultPrevented || s == null || s());
245
- }, f), T = vn((w) => {
246
- const F = w.target;
247
- [
248
- ...v.branches
249
- ].some(
250
- (M) => M.contains(F)
251
- ) || (i == null || i(w), c == null || c(w), w.defaultPrevented || s == null || s());
252
- }, f);
253
- return an((w) => {
254
- g === v.layers.size - 1 && (r == null || r(w), !w.defaultPrevented && s && (w.preventDefault(), s()));
255
- }, f), S(() => {
256
- if (d)
257
- return o && (v.layersWithOutsidePointerEventsDisabled.size === 0 && (Oe = f.body.style.pointerEvents, f.body.style.pointerEvents = "none"), v.layersWithOutsidePointerEventsDisabled.add(d)), v.layers.add(d), Ae(), () => {
258
- o && v.layersWithOutsidePointerEventsDisabled.size === 1 && (f.body.style.pointerEvents = Oe);
259
- };
260
- }, [
261
- d,
262
- f,
263
- o,
264
- v
265
- ]), S(() => () => {
266
- d && (v.layers.delete(d), v.layersWithOutsidePointerEventsDisabled.delete(d), Ae());
267
- }, [
268
- d,
269
- v
270
- ]), S(() => {
271
- const w = () => y({});
272
- return document.addEventListener(ve, w), () => document.removeEventListener(ve, w);
273
- }, []), /* @__PURE__ */ h(oe.div, x({}, u, {
274
- ref: l,
275
- style: {
276
- pointerEvents: m ? C ? "auto" : "none" : void 0,
277
- ...e.style
278
- },
279
- onFocusCapture: B(e.onFocusCapture, T.onFocusCapture),
280
- onBlurCapture: B(e.onBlurCapture, T.onBlurCapture),
281
- onPointerDownCapture: B(e.onPointerDownCapture, R.onPointerDownCapture)
282
- }));
283
- });
284
- function fn(e, t = globalThis == null ? void 0 : globalThis.document) {
285
- const n = Pe(e), o = O(!1), r = O(() => {
286
- });
287
- return S(() => {
288
- const a = (c) => {
289
- if (c.target && !o.current) {
290
- let u = function() {
291
- ze(sn, n, s, {
292
- discrete: !0
293
- });
294
- };
295
- const s = {
296
- originalEvent: c
297
- };
298
- c.pointerType === "touch" ? (t.removeEventListener("click", r.current), r.current = u, t.addEventListener("click", r.current, {
299
- once: !0
300
- })) : u();
301
- }
302
- o.current = !1;
303
- }, i = window.setTimeout(() => {
304
- t.addEventListener("pointerdown", a);
305
- }, 0);
306
- return () => {
307
- window.clearTimeout(i), t.removeEventListener("pointerdown", a), t.removeEventListener("click", r.current);
308
- };
309
- }, [
310
- t,
311
- n
312
- ]), {
313
- // ensures we check React component tree (not just DOM tree)
314
- onPointerDownCapture: () => o.current = !0
315
- };
316
- }
317
- function vn(e, t = globalThis == null ? void 0 : globalThis.document) {
318
- const n = Pe(e), o = O(!1);
319
- return S(() => {
320
- const r = (a) => {
321
- a.target && !o.current && ze(ln, n, {
322
- originalEvent: a
323
- }, {
324
- discrete: !1
325
- });
326
- };
327
- return t.addEventListener("focusin", r), () => t.removeEventListener("focusin", r);
328
- }, [
329
- t,
330
- n
331
- ]), {
332
- onFocusCapture: () => o.current = !0,
333
- onBlurCapture: () => o.current = !1
334
- };
335
- }
336
- function Ae() {
337
- const e = new CustomEvent(ve);
338
- document.dispatchEvent(e);
339
- }
340
- function ze(e, t, n, { discrete: o }) {
341
- const r = n.originalEvent.target, a = new CustomEvent(e, {
342
- bubbles: !1,
343
- cancelable: !0,
344
- detail: n
345
- });
346
- t && r.addEventListener(e, t, {
347
- once: !0
348
- }), o ? cn(r, a) : r.dispatchEvent(a);
349
- }
350
- let se = 0;
351
- function pn() {
352
- S(() => {
353
- var e, t;
354
- const n = document.querySelectorAll("[data-radix-focus-guard]");
355
- return document.body.insertAdjacentElement("afterbegin", (e = n[0]) !== null && e !== void 0 ? e : _e()), document.body.insertAdjacentElement("beforeend", (t = n[1]) !== null && t !== void 0 ? t : _e()), se++, () => {
356
- se === 1 && document.querySelectorAll("[data-radix-focus-guard]").forEach(
357
- (o) => o.remove()
358
- ), se--;
359
- };
360
- }, []);
361
- }
362
- function _e() {
363
- const e = document.createElement("span");
364
- return e.setAttribute("data-radix-focus-guard", ""), e.tabIndex = 0, e.style.cssText = "outline: none; opacity: 0; position: fixed; pointer-events: none", e;
365
- }
366
- function Ne(e) {
367
- const t = O(e);
368
- return S(() => {
369
- t.current = e;
370
- }), D(
371
- () => (...n) => {
372
- var o;
373
- return (o = t.current) === null || o === void 0 ? void 0 : o.call(t, ...n);
374
- },
375
- []
376
- );
377
- }
378
- const le = "focusScope.autoFocusOnMount", ue = "focusScope.autoFocusOnUnmount", Te = {
379
- bubbles: !1,
380
- cancelable: !0
381
- }, $n = /* @__PURE__ */ A((e, t) => {
382
- const { loop: n = !1, trapped: o = !1, onMountAutoFocus: r, onUnmountAutoFocus: a, ...i } = e, [c, s] = N(null), u = Ne(r), v = Ne(a), d = O(null), $ = Z(
383
- t,
384
- (l) => s(l)
385
- ), f = O({
386
- paused: !1,
387
- pause() {
388
- this.paused = !0;
389
- },
390
- resume() {
391
- this.paused = !1;
392
- }
393
- }).current;
394
- S(() => {
395
- if (o) {
396
- let l = function(g) {
397
- if (f.paused || !c)
398
- return;
399
- const m = g.target;
400
- c.contains(m) ? d.current = m : I(d.current, {
401
- select: !0
402
- });
403
- }, p = function(g) {
404
- if (f.paused || !c)
405
- return;
406
- const m = g.relatedTarget;
407
- m !== null && (c.contains(m) || I(d.current, {
408
- select: !0
409
- }));
410
- }, b = function(g) {
411
- const m = document.activeElement;
412
- for (const C of g)
413
- C.removedNodes.length > 0 && (c != null && c.contains(m) || I(c));
414
- };
415
- document.addEventListener("focusin", l), document.addEventListener("focusout", p);
416
- const E = new MutationObserver(b);
417
- return c && E.observe(c, {
418
- childList: !0,
419
- subtree: !0
420
- }), () => {
421
- document.removeEventListener("focusin", l), document.removeEventListener("focusout", p), E.disconnect();
422
- };
423
- }
424
- }, [
425
- o,
426
- c,
427
- f.paused
428
- ]), S(() => {
429
- if (c) {
430
- Fe.add(f);
431
- const l = document.activeElement;
432
- if (!c.contains(l)) {
433
- const b = new CustomEvent(le, Te);
434
- c.addEventListener(le, u), c.dispatchEvent(b), b.defaultPrevented || (hn(yn(He(c)), {
435
- select: !0
436
- }), document.activeElement === l && I(c));
437
- }
438
- return () => {
439
- c.removeEventListener(le, u), setTimeout(() => {
440
- const b = new CustomEvent(ue, Te);
441
- c.addEventListener(ue, v), c.dispatchEvent(b), b.defaultPrevented || I(l ?? document.body, {
442
- select: !0
443
- }), c.removeEventListener(ue, v), Fe.remove(f);
444
- }, 0);
445
- };
446
- }
447
- }, [
448
- c,
449
- u,
450
- v,
451
- f
452
- ]);
453
- const y = L((l) => {
454
- if (!n && !o || f.paused)
455
- return;
456
- const p = l.key === "Tab" && !l.altKey && !l.ctrlKey && !l.metaKey, b = document.activeElement;
457
- if (p && b) {
458
- const E = l.currentTarget, [g, m] = bn(E);
459
- g && m ? !l.shiftKey && b === m ? (l.preventDefault(), n && I(g, {
460
- select: !0
461
- })) : l.shiftKey && b === g && (l.preventDefault(), n && I(m, {
462
- select: !0
463
- })) : b === E && l.preventDefault();
464
- }
465
- }, [
466
- n,
467
- o,
468
- f.paused
469
- ]);
470
- return /* @__PURE__ */ h(oe.div, x({
471
- tabIndex: -1
472
- }, i, {
473
- ref: $,
474
- onKeyDown: y
475
- }));
476
- });
477
- function hn(e, { select: t = !1 } = {}) {
478
- const n = document.activeElement;
479
- for (const o of e)
480
- if (I(o, {
481
- select: t
482
- }), document.activeElement !== n)
483
- return;
484
- }
485
- function bn(e) {
486
- const t = He(e), n = De(t, e), o = De(t.reverse(), e);
487
- return [
488
- n,
489
- o
490
- ];
491
- }
492
- function He(e) {
493
- const t = [], n = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
494
- acceptNode: (o) => {
495
- const r = o.tagName === "INPUT" && o.type === "hidden";
496
- return o.disabled || o.hidden || r ? NodeFilter.FILTER_SKIP : o.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
497
- }
498
- });
499
- for (; n.nextNode(); )
500
- t.push(n.currentNode);
501
- return t;
502
- }
503
- function De(e, t) {
504
- for (const n of e)
505
- if (!mn(n, {
506
- upTo: t
507
- }))
508
- return n;
509
- }
510
- function mn(e, { upTo: t }) {
511
- if (getComputedStyle(e).visibility === "hidden")
512
- return !0;
513
- for (; e; ) {
514
- if (t !== void 0 && e === t)
515
- return !1;
516
- if (getComputedStyle(e).display === "none")
517
- return !0;
518
- e = e.parentElement;
519
- }
520
- return !1;
521
- }
522
- function gn(e) {
523
- return e instanceof HTMLInputElement && "select" in e;
524
- }
525
- function I(e, { select: t = !1 } = {}) {
526
- if (e && e.focus) {
527
- const n = document.activeElement;
528
- e.focus({
529
- preventScroll: !0
530
- }), e !== n && gn(e) && t && e.select();
531
- }
532
- }
533
- const Fe = Pn();
534
- function Pn() {
535
- let e = [];
536
- return {
537
- add(t) {
538
- const n = e[0];
539
- t !== n && (n == null || n.pause()), e = Re(e, t), e.unshift(t);
540
- },
541
- remove(t) {
542
- var n;
543
- e = Re(e, t), (n = e[0]) === null || n === void 0 || n.resume();
544
- }
545
- };
546
- }
547
- function Re(e, t) {
548
- const n = [
549
- ...e
550
- ], o = n.indexOf(t);
551
- return o !== -1 && n.splice(o, 1), n;
552
- }
553
- function yn(e) {
554
- return e.filter(
555
- (t) => t.tagName !== "A"
556
- );
557
- }
558
- const wn = globalThis != null && globalThis.document ? me : () => {
559
- }, En = P["useId".toString()] || (() => {
560
- });
561
- let Cn = 0;
562
- function xn(e) {
563
- const [t, n] = P.useState(En());
564
- return wn(() => {
565
- e || n(
566
- (o) => o ?? String(Cn++)
567
- );
568
- }, [
569
- e
570
- ]), e || (t ? `radix-${t}` : "");
571
- }
572
- function Sn(e, t) {
573
- typeof e == "function" ? e(t) : e != null && (e.current = t);
574
- }
575
- function Ke(...e) {
576
- return (t) => e.forEach(
577
- (n) => Sn(n, t)
578
- );
579
- }
580
- function Xe(...e) {
581
- return L(Ke(...e), e);
582
- }
583
- function On(e, t = []) {
584
- let n = [];
585
- function o(a, i) {
586
- const c = /* @__PURE__ */ Y(i), s = n.length;
587
- n = [
588
- ...n,
589
- i
590
- ];
591
- function u(d) {
592
- const { scope: $, children: f, ...y } = d, l = ($ == null ? void 0 : $[e][s]) || c, p = D(
593
- () => y,
594
- Object.values(y)
595
- );
596
- return /* @__PURE__ */ h(l.Provider, {
597
- value: p
598
- }, f);
599
- }
600
- function v(d, $) {
601
- const f = ($ == null ? void 0 : $[e][s]) || c, y = be(f);
602
- if (y)
603
- return y;
604
- if (i !== void 0)
605
- return i;
606
- throw new Error(`\`${d}\` must be used within \`${a}\``);
607
- }
608
- return u.displayName = a + "Provider", [
609
- u,
610
- v
611
- ];
612
- }
613
- const r = () => {
614
- const a = n.map((i) => /* @__PURE__ */ Y(i));
615
- return function(c) {
616
- const s = (c == null ? void 0 : c[e]) || a;
617
- return D(
618
- () => ({
619
- [`__scope${e}`]: {
620
- ...c,
621
- [e]: s
622
- }
623
- }),
624
- [
625
- c,
626
- s
627
- ]
628
- );
629
- };
630
- };
631
- return r.scopeName = e, [
632
- o,
633
- An(r, ...t)
634
- ];
635
- }
636
- function An(...e) {
637
- const t = e[0];
638
- if (e.length === 1)
639
- return t;
640
- const n = () => {
641
- const o = e.map(
642
- (r) => ({
643
- useScope: r(),
644
- scopeName: r.scopeName
645
- })
646
- );
647
- return function(a) {
648
- const i = o.reduce((c, { useScope: s, scopeName: u }) => {
649
- const d = s(a)[`__scope${u}`];
650
- return {
651
- ...c,
652
- ...d
653
- };
654
- }, {});
655
- return D(
656
- () => ({
657
- [`__scope${t.scopeName}`]: i
658
- }),
659
- [
660
- i
661
- ]
662
- );
663
- };
664
- };
665
- return n.scopeName = t.scopeName, n;
666
- }
667
- const Ye = /* @__PURE__ */ A((e, t) => {
668
- const { children: n, ...o } = e, r = _.toArray(n), a = r.find(Nn);
669
- if (a) {
670
- const i = a.props.children, c = r.map((s) => s === a ? _.count(i) > 1 ? _.only(null) : /* @__PURE__ */ k(i) ? i.props.children : null : s);
671
- return /* @__PURE__ */ h(pe, x({}, o, {
672
- ref: t
673
- }), /* @__PURE__ */ k(i) ? /* @__PURE__ */ V(i, void 0, c) : null);
674
- }
675
- return /* @__PURE__ */ h(pe, x({}, o, {
676
- ref: t
677
- }), n);
678
- });
679
- Ye.displayName = "Slot";
680
- const pe = /* @__PURE__ */ A((e, t) => {
681
- const { children: n, ...o } = e;
682
- return /* @__PURE__ */ k(n) ? /* @__PURE__ */ V(n, {
683
- ...Tn(o, n.props),
684
- ref: t ? Ke(t, n.ref) : n.ref
685
- }) : _.count(n) > 1 ? _.only(null) : null;
686
- });
687
- pe.displayName = "SlotClone";
688
- const _n = ({ children: e }) => /* @__PURE__ */ h(Be, null, e);
689
- function Nn(e) {
690
- return /* @__PURE__ */ k(e) && e.type === _n;
691
- }
692
- function Tn(e, t) {
693
- const n = {
694
- ...t
695
- };
696
- for (const o in t) {
697
- const r = e[o], a = t[o];
698
- /^on[A-Z]/.test(o) ? r && a ? n[o] = (...c) => {
699
- a(...c), r(...c);
700
- } : r && (n[o] = r) : o === "style" ? n[o] = {
701
- ...r,
702
- ...a
703
- } : o === "className" && (n[o] = [
704
- r,
705
- a
706
- ].filter(Boolean).join(" "));
707
- }
708
- return {
709
- ...e,
710
- ...n
711
- };
712
- }
713
- const Dn = [
714
- "a",
715
- "button",
716
- "div",
717
- "form",
718
- "h2",
719
- "h3",
720
- "img",
721
- "input",
722
- "label",
723
- "li",
724
- "nav",
725
- "ol",
726
- "p",
727
- "span",
728
- "svg",
729
- "ul"
730
- ], je = Dn.reduce((e, t) => {
731
- const n = /* @__PURE__ */ A((o, r) => {
732
- const { asChild: a, ...i } = o, c = a ? Ye : t;
733
- return S(() => {
734
- window[Symbol.for("radix-ui")] = !0;
735
- }, []), /* @__PURE__ */ h(c, x({}, i, {
736
- ref: r
737
- }));
738
- });
739
- return n.displayName = `Primitive.${t}`, {
740
- ...e,
741
- [t]: n
742
- };
743
- }, {});
744
- function Fn(e) {
745
- const t = O(e);
746
- return S(() => {
747
- t.current = e;
748
- }), D(
749
- () => (...n) => {
750
- var o;
751
- return (o = t.current) === null || o === void 0 ? void 0 : o.call(t, ...n);
752
- },
753
- []
754
- );
755
- }
756
- const $e = globalThis != null && globalThis.document ? me : () => {
757
- };
758
- function Rn(e) {
759
- const [t, n] = N(void 0);
760
- return $e(() => {
761
- if (e) {
762
- n({
763
- width: e.offsetWidth,
764
- height: e.offsetHeight
765
- });
766
- const o = new ResizeObserver((r) => {
767
- if (!Array.isArray(r) || !r.length)
768
- return;
769
- const a = r[0];
770
- let i, c;
771
- if ("borderBoxSize" in a) {
772
- const s = a.borderBoxSize, u = Array.isArray(s) ? s[0] : s;
773
- i = u.inlineSize, c = u.blockSize;
774
- } else
775
- i = e.offsetWidth, c = e.offsetHeight;
776
- n({
777
- width: i,
778
- height: c
779
- });
780
- });
781
- return o.observe(e, {
782
- box: "border-box"
783
- }), () => o.unobserve(e);
784
- } else
785
- n(void 0);
786
- }, [
787
- e
788
- ]), t;
789
- }
790
- const Ve = "Popper", [Ze, Ge] = On(Ve), [In, qe] = Ze(Ve), Ln = (e) => {
791
- const { __scopePopper: t, children: n } = e, [o, r] = N(null);
792
- return /* @__PURE__ */ h(In, {
793
- scope: t,
794
- anchor: o,
795
- onAnchorChange: r
796
- }, n);
797
- }, kn = "PopperAnchor", Mn = /* @__PURE__ */ A((e, t) => {
798
- const { __scopePopper: n, virtualRef: o, ...r } = e, a = qe(kn, n), i = O(null), c = Xe(t, i);
799
- return S(() => {
800
- a.onAnchorChange((o == null ? void 0 : o.current) || i.current);
801
- }), o ? null : /* @__PURE__ */ h(je.div, x({}, r, {
802
- ref: c
803
- }));
804
- }), Qe = "PopperContent", [Bn, Lo] = Ze(Qe), Un = /* @__PURE__ */ A((e, t) => {
805
- var n, o, r, a, i, c, s, u;
806
- const { __scopePopper: v, side: d = "bottom", sideOffset: $ = 0, align: f = "center", alignOffset: y = 0, arrowPadding: l = 0, collisionBoundary: p = [], collisionPadding: b = 0, sticky: E = "partial", hideWhenDetached: g = !1, avoidCollisions: m = !0, onPlaced: C, ...R } = e, T = qe(Qe, v), [w, F] = N(null), G = Xe(
807
- t,
808
- (ae) => F(ae)
809
- ), [M, dt] = N(null), U = Rn(M), ft = (n = U == null ? void 0 : U.width) !== null && n !== void 0 ? n : 0, Ee = (o = U == null ? void 0 : U.height) !== null && o !== void 0 ? o : 0, vt = d + (f !== "center" ? "-" + f : ""), pt = typeof b == "number" ? b : {
810
- top: 0,
811
- right: 0,
812
- bottom: 0,
813
- left: 0,
814
- ...b
815
- }, Ce = Array.isArray(p) ? p : [
816
- p
817
- ], $t = Ce.length > 0, ce = {
818
- padding: pt,
819
- boundary: Ce.filter(Wn),
820
- // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
821
- altBoundary: $t
822
- }, { refs: ht, floatingStyles: xe, placement: bt, isPositioned: q, middlewareData: W } = Dt({
823
- // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
824
- strategy: "fixed",
825
- placement: vt,
826
- whileElementsMounted: Ft,
827
- elements: {
828
- reference: T.anchor
829
- },
830
- middleware: [
831
- Rt({
832
- mainAxis: $ + Ee,
833
- alignmentAxis: y
834
- }),
835
- m && It({
836
- mainAxis: !0,
837
- crossAxis: !1,
838
- limiter: E === "partial" ? Lt() : void 0,
839
- ...ce
840
- }),
841
- m && kt({
842
- ...ce
843
- }),
844
- Mt({
845
- ...ce,
846
- apply: ({ elements: ae, rects: Ct, availableWidth: xt, availableHeight: St }) => {
847
- const { width: Ot, height: At } = Ct.reference, J = ae.floating.style;
848
- J.setProperty("--radix-popper-available-width", `${xt}px`), J.setProperty("--radix-popper-available-height", `${St}px`), J.setProperty("--radix-popper-anchor-width", `${Ot}px`), J.setProperty("--radix-popper-anchor-height", `${At}px`);
849
- }
850
- }),
851
- M && Bt({
852
- element: M,
853
- padding: l
854
- }),
855
- zn({
856
- arrowWidth: ft,
857
- arrowHeight: Ee
858
- }),
859
- g && Ut({
860
- strategy: "referenceHidden"
861
- })
862
- ]
863
- }), [Se, mt] = Je(bt), Q = Fn(C);
864
- $e(() => {
865
- q && (Q == null || Q());
866
- }, [
867
- q,
868
- Q
869
- ]);
870
- const gt = (r = W.arrow) === null || r === void 0 ? void 0 : r.x, Pt = (a = W.arrow) === null || a === void 0 ? void 0 : a.y, yt = ((i = W.arrow) === null || i === void 0 ? void 0 : i.centerOffset) !== 0, [wt, Et] = N();
871
- return $e(() => {
872
- w && Et(window.getComputedStyle(w).zIndex);
873
- }, [
874
- w
875
- ]), /* @__PURE__ */ h("div", {
876
- ref: ht.setFloating,
877
- "data-radix-popper-content-wrapper": "",
878
- style: {
879
- ...xe,
880
- transform: q ? xe.transform : "translate(0, -200%)",
881
- // keep off the page when measuring
882
- minWidth: "max-content",
883
- zIndex: wt,
884
- "--radix-popper-transform-origin": [
885
- (c = W.transformOrigin) === null || c === void 0 ? void 0 : c.x,
886
- (s = W.transformOrigin) === null || s === void 0 ? void 0 : s.y
887
- ].join(" ")
888
- },
889
- dir: e.dir
890
- }, /* @__PURE__ */ h(Bn, {
891
- scope: v,
892
- placedSide: Se,
893
- onArrowChange: dt,
894
- arrowX: gt,
895
- arrowY: Pt,
896
- shouldHideArrow: yt
897
- }, /* @__PURE__ */ h(je.div, x({
898
- "data-side": Se,
899
- "data-align": mt
900
- }, R, {
901
- ref: G,
902
- style: {
903
- ...R.style,
904
- // if the PopperContent hasn't been placed yet (not all measurements done)
905
- // we prevent animations so that users's animation don't kick in too early referring wrong sides
906
- animation: q ? void 0 : "none",
907
- // hide the content if using the hide middleware and should be hidden
908
- opacity: (u = W.hide) !== null && u !== void 0 && u.referenceHidden ? 0 : void 0
909
- }
910
- }))));
911
- });
912
- function Wn(e) {
913
- return e !== null;
914
- }
915
- const zn = (e) => ({
916
- name: "transformOrigin",
917
- options: e,
918
- fn(t) {
919
- var n, o, r, a, i;
920
- const { placement: c, rects: s, middlewareData: u } = t, d = ((n = u.arrow) === null || n === void 0 ? void 0 : n.centerOffset) !== 0, $ = d ? 0 : e.arrowWidth, f = d ? 0 : e.arrowHeight, [y, l] = Je(c), p = {
921
- start: "0%",
922
- center: "50%",
923
- end: "100%"
924
- }[l], b = ((o = (r = u.arrow) === null || r === void 0 ? void 0 : r.x) !== null && o !== void 0 ? o : 0) + $ / 2, E = ((a = (i = u.arrow) === null || i === void 0 ? void 0 : i.y) !== null && a !== void 0 ? a : 0) + f / 2;
925
- let g = "", m = "";
926
- return y === "bottom" ? (g = d ? p : `${b}px`, m = `${-f}px`) : y === "top" ? (g = d ? p : `${b}px`, m = `${s.floating.height + f}px`) : y === "right" ? (g = `${-f}px`, m = d ? p : `${E}px`) : y === "left" && (g = `${s.floating.width + f}px`, m = d ? p : `${E}px`), {
927
- data: {
928
- x: g,
929
- y: m
930
- }
931
- };
932
- }
933
- });
934
- function Je(e) {
935
- const [t, n = "center"] = e.split("-");
936
- return [
937
- t,
938
- n
939
- ];
940
- }
941
- const Hn = Ln, Kn = Mn, Xn = Un, Yn = /* @__PURE__ */ A((e, t) => {
942
- var n;
943
- const { container: o = globalThis == null || (n = globalThis.document) === null || n === void 0 ? void 0 : n.body, ...r } = e;
944
- return o ? /* @__PURE__ */ Tt.createPortal(/* @__PURE__ */ h(oe.div, x({}, r, {
945
- ref: t
946
- })), o) : null;
947
- }), Ie = globalThis != null && globalThis.document ? me : () => {
948
- };
949
- function jn(e, t) {
950
- return Nt((n, o) => {
951
- const r = t[n][o];
952
- return r ?? n;
953
- }, e);
954
- }
955
- const ye = (e) => {
956
- const { present: t, children: n } = e, o = Vn(t), r = typeof n == "function" ? n({
957
- present: o.isPresent
958
- }) : _.only(n), a = Z(o.ref, r.ref);
959
- return typeof n == "function" || o.isPresent ? /* @__PURE__ */ V(r, {
960
- ref: a
961
- }) : null;
962
- };
963
- ye.displayName = "Presence";
964
- function Vn(e) {
965
- const [t, n] = N(), o = O({}), r = O(e), a = O("none"), i = e ? "mounted" : "unmounted", [c, s] = jn(i, {
966
- mounted: {
967
- UNMOUNT: "unmounted",
968
- ANIMATION_OUT: "unmountSuspended"
969
- },
970
- unmountSuspended: {
971
- MOUNT: "mounted",
972
- ANIMATION_END: "unmounted"
973
- },
974
- unmounted: {
975
- MOUNT: "mounted"
976
- }
977
- });
978
- return S(() => {
979
- const u = ee(o.current);
980
- a.current = c === "mounted" ? u : "none";
981
- }, [
982
- c
983
- ]), Ie(() => {
984
- const u = o.current, v = r.current;
985
- if (v !== e) {
986
- const $ = a.current, f = ee(u);
987
- e ? s("MOUNT") : f === "none" || (u == null ? void 0 : u.display) === "none" ? s("UNMOUNT") : s(v && $ !== f ? "ANIMATION_OUT" : "UNMOUNT"), r.current = e;
988
- }
989
- }, [
990
- e,
991
- s
992
- ]), Ie(() => {
993
- if (t) {
994
- const u = (d) => {
995
- const f = ee(o.current).includes(d.animationName);
996
- d.target === t && f && Ue(
997
- () => s("ANIMATION_END")
998
- );
999
- }, v = (d) => {
1000
- d.target === t && (a.current = ee(o.current));
1001
- };
1002
- return t.addEventListener("animationstart", v), t.addEventListener("animationcancel", u), t.addEventListener("animationend", u), () => {
1003
- t.removeEventListener("animationstart", v), t.removeEventListener("animationcancel", u), t.removeEventListener("animationend", u);
1004
- };
1005
- } else
1006
- s("ANIMATION_END");
1007
- }, [
1008
- t,
1009
- s
1010
- ]), {
1011
- isPresent: [
1012
- "mounted",
1013
- "unmountSuspended"
1014
- ].includes(c),
1015
- ref: L((u) => {
1016
- u && (o.current = getComputedStyle(u)), n(u);
1017
- }, [])
1018
- };
1019
- }
1020
- function ee(e) {
1021
- return (e == null ? void 0 : e.animationName) || "none";
1022
- }
1023
- function et(e) {
1024
- const t = O(e);
1025
- return S(() => {
1026
- t.current = e;
1027
- }), D(
1028
- () => (...n) => {
1029
- var o;
1030
- return (o = t.current) === null || o === void 0 ? void 0 : o.call(t, ...n);
1031
- },
1032
- []
1033
- );
1034
- }
1035
- function Zn({ prop: e, defaultProp: t, onChange: n = () => {
1036
- } }) {
1037
- const [o, r] = Gn({
1038
- defaultProp: t,
1039
- onChange: n
1040
- }), a = e !== void 0, i = a ? e : o, c = et(n), s = L((u) => {
1041
- if (a) {
1042
- const d = typeof u == "function" ? u(e) : u;
1043
- d !== e && c(d);
1044
- } else
1045
- r(u);
1046
- }, [
1047
- a,
1048
- e,
1049
- r,
1050
- c
1051
- ]);
1052
- return [
1053
- i,
1054
- s
1055
- ];
1056
- }
1057
- function Gn({ defaultProp: e, onChange: t }) {
1058
- const n = N(e), [o] = n, r = O(o), a = et(t);
1059
- return S(() => {
1060
- r.current !== o && (a(o), r.current = o);
1061
- }, [
1062
- o,
1063
- r,
1064
- a
1065
- ]), n;
1066
- }
1067
- var tt = Wt(), de = function() {
1068
- }, re = P.forwardRef(function(e, t) {
1069
- var n = P.useRef(null), o = P.useState({
1070
- onScrollCapture: de,
1071
- onWheelCapture: de,
1072
- onTouchMoveCapture: de
1073
- }), r = o[0], a = o[1], i = e.forwardProps, c = e.children, s = e.className, u = e.removeScrollBar, v = e.enabled, d = e.shards, $ = e.sideCar, f = e.noIsolation, y = e.inert, l = e.allowPinchZoom, p = e.as, b = p === void 0 ? "div" : p, E = zt(e, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noIsolation", "inert", "allowPinchZoom", "as"]), g = $, m = Ht([n, t]), C = K(K({}, E), r);
1074
- return P.createElement(
1075
- P.Fragment,
1076
- null,
1077
- v && P.createElement(g, { sideCar: tt, removeScrollBar: u, shards: d, noIsolation: f, inert: y, setCallbacks: a, allowPinchZoom: !!l, lockRef: n }),
1078
- i ? P.cloneElement(P.Children.only(c), K(K({}, C), { ref: m })) : P.createElement(b, K({}, C, { className: s, ref: m }), c)
1079
- );
1080
- });
1081
- re.defaultProps = {
1082
- enabled: !0,
1083
- removeScrollBar: !0,
1084
- inert: !1
1085
- };
1086
- re.classNames = {
1087
- fullWidth: Kt,
1088
- zeroRight: Xt
1089
- };
1090
- var he = !1;
1091
- if (typeof window < "u")
1092
- try {
1093
- var te = Object.defineProperty({}, "passive", {
1094
- get: function() {
1095
- return he = !0, !0;
1096
- }
1097
- });
1098
- window.addEventListener("test", te, te), window.removeEventListener("test", te, te);
1099
- } catch {
1100
- he = !1;
1101
- }
1102
- var z = he ? { passive: !1 } : !1, qn = function(e) {
1103
- return e.tagName === "TEXTAREA";
1104
- }, nt = function(e, t) {
1105
- var n = window.getComputedStyle(e);
1106
- return (
1107
- // not-not-scrollable
1108
- n[t] !== "hidden" && // contains scroll inside self
1109
- !(n.overflowY === n.overflowX && !qn(e) && n[t] === "visible")
1110
- );
1111
- }, Qn = function(e) {
1112
- return nt(e, "overflowY");
1113
- }, Jn = function(e) {
1114
- return nt(e, "overflowX");
1115
- }, Le = function(e, t) {
1116
- var n = t;
1117
- do {
1118
- typeof ShadowRoot < "u" && n instanceof ShadowRoot && (n = n.host);
1119
- var o = ot(e, n);
1120
- if (o) {
1121
- var r = rt(e, n), a = r[1], i = r[2];
1122
- if (a > i)
1123
- return !0;
1124
- }
1125
- n = n.parentNode;
1126
- } while (n && n !== document.body);
1127
- return !1;
1128
- }, eo = function(e) {
1129
- var t = e.scrollTop, n = e.scrollHeight, o = e.clientHeight;
1130
- return [
1131
- t,
1132
- n,
1133
- o
1134
- ];
1135
- }, to = function(e) {
1136
- var t = e.scrollLeft, n = e.scrollWidth, o = e.clientWidth;
1137
- return [
1138
- t,
1139
- n,
1140
- o
1141
- ];
1142
- }, ot = function(e, t) {
1143
- return e === "v" ? Qn(t) : Jn(t);
1144
- }, rt = function(e, t) {
1145
- return e === "v" ? eo(t) : to(t);
1146
- }, no = function(e, t) {
1147
- return e === "h" && t === "rtl" ? -1 : 1;
1148
- }, oo = function(e, t, n, o, r) {
1149
- var a = no(e, window.getComputedStyle(t).direction), i = a * o, c = n.target, s = t.contains(c), u = !1, v = i > 0, d = 0, $ = 0;
1150
- do {
1151
- var f = rt(e, c), y = f[0], l = f[1], p = f[2], b = l - p - a * y;
1152
- (y || b) && ot(e, c) && (d += b, $ += y), c = c.parentNode;
1153
- } while (
1154
- // portaled content
1155
- !s && c !== document.body || // self content
1156
- s && (t.contains(c) || t === c)
1157
- );
1158
- return (v && (r && d === 0 || !r && i > d) || !v && (r && $ === 0 || !r && -i > $)) && (u = !0), u;
1159
- }, ne = function(e) {
1160
- return "changedTouches" in e ? [e.changedTouches[0].clientX, e.changedTouches[0].clientY] : [0, 0];
1161
- }, ke = function(e) {
1162
- return [e.deltaX, e.deltaY];
1163
- }, Me = function(e) {
1164
- return e && "current" in e ? e.current : e;
1165
- }, ro = function(e, t) {
1166
- return e[0] === t[0] && e[1] === t[1];
1167
- }, co = function(e) {
1168
- return `
1169
- .block-interactivity-`.concat(e, ` {pointer-events: none;}
1170
- .allow-interactivity-`).concat(e, ` {pointer-events: all;}
1171
- `);
1172
- }, ao = 0, H = [];
1173
- function io(e) {
1174
- var t = P.useRef([]), n = P.useRef([0, 0]), o = P.useRef(), r = P.useState(ao++)[0], a = P.useState(function() {
1175
- return Yt();
1176
- })[0], i = P.useRef(e);
1177
- P.useEffect(function() {
1178
- i.current = e;
1179
- }, [e]), P.useEffect(function() {
1180
- if (e.inert) {
1181
- document.body.classList.add("block-interactivity-".concat(r));
1182
- var l = jt([e.lockRef.current], (e.shards || []).map(Me), !0).filter(Boolean);
1183
- return l.forEach(function(p) {
1184
- return p.classList.add("allow-interactivity-".concat(r));
1185
- }), function() {
1186
- document.body.classList.remove("block-interactivity-".concat(r)), l.forEach(function(p) {
1187
- return p.classList.remove("allow-interactivity-".concat(r));
1188
- });
1189
- };
1190
- }
1191
- }, [e.inert, e.lockRef.current, e.shards]);
1192
- var c = P.useCallback(function(l, p) {
1193
- if ("touches" in l && l.touches.length === 2)
1194
- return !i.current.allowPinchZoom;
1195
- var b = ne(l), E = n.current, g = "deltaX" in l ? l.deltaX : E[0] - b[0], m = "deltaY" in l ? l.deltaY : E[1] - b[1], C, R = l.target, T = Math.abs(g) > Math.abs(m) ? "h" : "v";
1196
- if ("touches" in l && T === "h" && R.type === "range")
1197
- return !1;
1198
- var w = Le(T, R);
1199
- if (!w)
1200
- return !0;
1201
- if (w ? C = T : (C = T === "v" ? "h" : "v", w = Le(T, R)), !w)
1202
- return !1;
1203
- if (!o.current && "changedTouches" in l && (g || m) && (o.current = C), !C)
1204
- return !0;
1205
- var F = o.current || C;
1206
- return oo(F, p, l, F === "h" ? g : m, !0);
1207
- }, []), s = P.useCallback(function(l) {
1208
- var p = l;
1209
- if (!(!H.length || H[H.length - 1] !== a)) {
1210
- var b = "deltaY" in p ? ke(p) : ne(p), E = t.current.filter(function(C) {
1211
- return C.name === p.type && C.target === p.target && ro(C.delta, b);
1212
- })[0];
1213
- if (E && E.should) {
1214
- p.cancelable && p.preventDefault();
1215
- return;
1216
- }
1217
- if (!E) {
1218
- var g = (i.current.shards || []).map(Me).filter(Boolean).filter(function(C) {
1219
- return C.contains(p.target);
1220
- }), m = g.length > 0 ? c(p, g[0]) : !i.current.noIsolation;
1221
- m && p.cancelable && p.preventDefault();
1222
- }
1223
- }
1224
- }, []), u = P.useCallback(function(l, p, b, E) {
1225
- var g = { name: l, delta: p, target: b, should: E };
1226
- t.current.push(g), setTimeout(function() {
1227
- t.current = t.current.filter(function(m) {
1228
- return m !== g;
1229
- });
1230
- }, 1);
1231
- }, []), v = P.useCallback(function(l) {
1232
- n.current = ne(l), o.current = void 0;
1233
- }, []), d = P.useCallback(function(l) {
1234
- u(l.type, ke(l), l.target, c(l, e.lockRef.current));
1235
- }, []), $ = P.useCallback(function(l) {
1236
- u(l.type, ne(l), l.target, c(l, e.lockRef.current));
1237
- }, []);
1238
- P.useEffect(function() {
1239
- return H.push(a), e.setCallbacks({
1240
- onScrollCapture: d,
1241
- onWheelCapture: d,
1242
- onTouchMoveCapture: $
1243
- }), document.addEventListener("wheel", s, z), document.addEventListener("touchmove", s, z), document.addEventListener("touchstart", v, z), function() {
1244
- H = H.filter(function(l) {
1245
- return l !== a;
1246
- }), document.removeEventListener("wheel", s, z), document.removeEventListener("touchmove", s, z), document.removeEventListener("touchstart", v, z);
1247
- };
1248
- }, []);
1249
- var f = e.removeScrollBar, y = e.inert;
1250
- return P.createElement(
1251
- P.Fragment,
1252
- null,
1253
- y ? P.createElement(a, { styles: co(r) }) : null,
1254
- f ? P.createElement(Vt, { gapMode: "margin" }) : null
1255
- );
1256
- }
1257
- const so = Zt(tt, io);
1258
- var ct = P.forwardRef(function(e, t) {
1259
- return P.createElement(re, K({}, e, { ref: t, sideCar: so }));
1260
- });
1261
- ct.classNames = re.classNames;
1262
- const lo = ct, at = "Popover", [it, ko] = Jt(at, [
1263
- Ge
1264
- ]), we = Ge(), [uo, X] = it(at), fo = (e) => {
1265
- const { __scopePopover: t, children: n, open: o, defaultOpen: r, onOpenChange: a, modal: i = !1 } = e, c = we(t), s = O(null), [u, v] = N(!1), [d = !1, $] = Zn({
1266
- prop: o,
1267
- defaultProp: r,
1268
- onChange: a
1269
- });
1270
- return /* @__PURE__ */ h(Hn, c, /* @__PURE__ */ h(uo, {
1271
- scope: t,
1272
- contentId: xn(),
1273
- triggerRef: s,
1274
- open: d,
1275
- onOpenChange: $,
1276
- onOpenToggle: L(
1277
- () => $(
1278
- (f) => !f
1279
- ),
1280
- [
1281
- $
1282
- ]
1283
- ),
1284
- hasCustomAnchor: u,
1285
- onCustomAnchorAdd: L(
1286
- () => v(!0),
1287
- []
1288
- ),
1289
- onCustomAnchorRemove: L(
1290
- () => v(!1),
1291
- []
1292
- ),
1293
- modal: i
1294
- }, n));
1295
- }, vo = "PopoverTrigger", po = /* @__PURE__ */ A((e, t) => {
1296
- const { __scopePopover: n, ...o } = e, r = X(vo, n), a = we(n), i = Z(t, r.triggerRef), c = /* @__PURE__ */ h(oe.button, x({
1297
- type: "button",
1298
- "aria-haspopup": "dialog",
1299
- "aria-expanded": r.open,
1300
- "aria-controls": r.contentId,
1301
- "data-state": ut(r.open)
1302
- }, o, {
1303
- ref: i,
1304
- onClick: B(e.onClick, r.onOpenToggle)
1305
- }));
1306
- return r.hasCustomAnchor ? c : /* @__PURE__ */ h(Kn, x({
1307
- asChild: !0
1308
- }, a), c);
1309
- }), st = "PopoverPortal", [$o, ho] = it(st, {
1310
- forceMount: void 0
1311
- }), bo = (e) => {
1312
- const { __scopePopover: t, forceMount: n, children: o, container: r } = e, a = X(st, t);
1313
- return /* @__PURE__ */ h($o, {
1314
- scope: t,
1315
- forceMount: n
1316
- }, /* @__PURE__ */ h(ye, {
1317
- present: n || a.open
1318
- }, /* @__PURE__ */ h(Yn, {
1319
- asChild: !0,
1320
- container: r
1321
- }, o)));
1322
- }, j = "PopoverContent", mo = /* @__PURE__ */ A((e, t) => {
1323
- const n = ho(j, e.__scopePopover), { forceMount: o = n.forceMount, ...r } = e, a = X(j, e.__scopePopover);
1324
- return /* @__PURE__ */ h(ye, {
1325
- present: o || a.open
1326
- }, a.modal ? /* @__PURE__ */ h(go, x({}, r, {
1327
- ref: t
1328
- })) : /* @__PURE__ */ h(Po, x({}, r, {
1329
- ref: t
1330
- })));
1331
- }), go = /* @__PURE__ */ A((e, t) => {
1332
- const n = X(j, e.__scopePopover), o = O(null), r = Z(t, o), a = O(!1);
1333
- return S(() => {
1334
- const i = o.current;
1335
- if (i)
1336
- return Gt(i);
1337
- }, []), /* @__PURE__ */ h(lo, {
1338
- as: ge,
1339
- allowPinchZoom: !0
1340
- }, /* @__PURE__ */ h(lt, x({}, e, {
1341
- ref: r,
1342
- trapFocus: n.open,
1343
- disableOutsidePointerEvents: !0,
1344
- onCloseAutoFocus: B(e.onCloseAutoFocus, (i) => {
1345
- var c;
1346
- i.preventDefault(), a.current || (c = n.triggerRef.current) === null || c === void 0 || c.focus();
1347
- }),
1348
- onPointerDownOutside: B(e.onPointerDownOutside, (i) => {
1349
- const c = i.detail.originalEvent, s = c.button === 0 && c.ctrlKey === !0, u = c.button === 2 || s;
1350
- a.current = u;
1351
- }, {
1352
- checkForDefaultPrevented: !1
1353
- }),
1354
- onFocusOutside: B(
1355
- e.onFocusOutside,
1356
- (i) => i.preventDefault(),
1357
- {
1358
- checkForDefaultPrevented: !1
1359
- }
1360
- )
1361
- })));
1362
- }), Po = /* @__PURE__ */ A((e, t) => {
1363
- const n = X(j, e.__scopePopover), o = O(!1), r = O(!1);
1364
- return /* @__PURE__ */ h(lt, x({}, e, {
1365
- ref: t,
1366
- trapFocus: !1,
1367
- disableOutsidePointerEvents: !1,
1368
- onCloseAutoFocus: (a) => {
1369
- var i;
1370
- if ((i = e.onCloseAutoFocus) === null || i === void 0 || i.call(e, a), !a.defaultPrevented) {
1371
- var c;
1372
- o.current || (c = n.triggerRef.current) === null || c === void 0 || c.focus(), a.preventDefault();
1373
- }
1374
- o.current = !1, r.current = !1;
1375
- },
1376
- onInteractOutside: (a) => {
1377
- var i, c;
1378
- (i = e.onInteractOutside) === null || i === void 0 || i.call(e, a), a.defaultPrevented || (o.current = !0, a.detail.originalEvent.type === "pointerdown" && (r.current = !0));
1379
- const s = a.target;
1380
- ((c = n.triggerRef.current) === null || c === void 0 ? void 0 : c.contains(s)) && a.preventDefault(), a.detail.originalEvent.type === "focusin" && r.current && a.preventDefault();
1381
- }
1382
- }));
1383
- }), lt = /* @__PURE__ */ A((e, t) => {
1384
- const { __scopePopover: n, trapFocus: o, onOpenAutoFocus: r, onCloseAutoFocus: a, disableOutsidePointerEvents: i, onEscapeKeyDown: c, onPointerDownOutside: s, onFocusOutside: u, onInteractOutside: v, ...d } = e, $ = X(j, n), f = we(n);
1385
- return pn(), /* @__PURE__ */ h($n, {
1386
- asChild: !0,
1387
- loop: !0,
1388
- trapped: o,
1389
- onMountAutoFocus: r,
1390
- onUnmountAutoFocus: a
1391
- }, /* @__PURE__ */ h(dn, {
1392
- asChild: !0,
1393
- disableOutsidePointerEvents: i,
1394
- onInteractOutside: v,
1395
- onEscapeKeyDown: c,
1396
- onPointerDownOutside: s,
1397
- onFocusOutside: u,
1398
- onDismiss: () => $.onOpenChange(!1)
1399
- }, /* @__PURE__ */ h(Xn, x({
1400
- "data-state": ut($.open),
1401
- role: "dialog",
1402
- id: $.contentId
1403
- }, f, d, {
1404
- ref: t,
1405
- style: {
1406
- ...d.style,
1407
- "--radix-popover-content-transform-origin": "var(--radix-popper-transform-origin)",
1408
- "--radix-popover-content-available-width": "var(--radix-popper-available-width)",
1409
- "--radix-popover-content-available-height": "var(--radix-popper-available-height)",
1410
- "--radix-popover-trigger-width": "var(--radix-popper-anchor-width)",
1411
- "--radix-popover-trigger-height": "var(--radix-popper-anchor-height)"
1412
- }
1413
- }))));
1414
- });
1415
- function ut(e) {
1416
- return e ? "open" : "closed";
1417
- }
1418
- const yo = fo, wo = po, Eo = bo, Co = mo, xo = "_slideDownAndFade_v492z_1", So = "_slideLeftAndFade_v492z_1", Oo = "_slideUpAndFade_v492z_1", Ao = "_slideRightAndFade_v492z_1", _o = {
1419
- "rp-popover-content": "_rp-popover-content_v492z_1",
1420
- slideDownAndFade: xo,
1421
- slideLeftAndFade: So,
1422
- slideUpAndFade: Oo,
1423
- slideRightAndFade: Ao,
1424
- "rp-popover-arrow": "_rp-popover-arrow_v492z_31"
1425
- }, Mo = (e) => {
1426
- const { triggerComponent: t, children: n, container: o, className: r, open: a, ...i } = e;
1427
- return /* @__PURE__ */ _t(yo, { modal: !1, open: a, children: [
1428
- /* @__PURE__ */ ie(wo, { asChild: !0, children: t }),
1429
- /* @__PURE__ */ ie(Eo, { container: o, children: /* @__PURE__ */ ie(
1430
- Co,
1431
- {
1432
- tabIndex: 0,
1433
- sideOffset: 8,
1434
- align: "start",
1435
- ...i,
1436
- className: qt(_o["rp-popover-content"], r),
1437
- children: n
1438
- }
1439
- ) })
1440
- ] });
1441
- };
1442
- export {
1443
- Mo as U,
1444
- x as _
1445
- };