@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,1447 +0,0 @@
1
- import * as R from "react";
2
- import { useLayoutEffect as Zt, useEffect as te } from "react";
3
- import { f as vt, u as $t, P as Ht, b as mt, h as ee, g as ne } from "./index-48ca3f30.js";
4
- import { jsx as _t } from "react/jsx-runtime";
5
- import * as ie from "react-dom";
6
- function oe(t, e = globalThis == null ? void 0 : globalThis.document) {
7
- const n = vt(t);
8
- R.useEffect(() => {
9
- const i = (o) => {
10
- o.key === "Escape" && n(o);
11
- };
12
- return e.addEventListener("keydown", i, { capture: !0 }), () => e.removeEventListener("keydown", i, { capture: !0 });
13
- }, [n, e]);
14
- }
15
- var se = "DismissableLayer", pt = "dismissableLayer.update", re = "dismissableLayer.pointerDownOutside", ce = "dismissableLayer.focusOutside", Dt, Vt = R.createContext({
16
- layers: /* @__PURE__ */ new Set(),
17
- layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
18
- branches: /* @__PURE__ */ new Set()
19
- }), le = R.forwardRef(
20
- (t, e) => {
21
- const {
22
- disableOutsidePointerEvents: n = !1,
23
- onEscapeKeyDown: i,
24
- onPointerDownOutside: o,
25
- onFocusOutside: s,
26
- onInteractOutside: r,
27
- onDismiss: c,
28
- ...a
29
- } = t, l = R.useContext(Vt), [f, u] = R.useState(null), m = (f == null ? void 0 : f.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, d] = R.useState({}), h = $t(e, (w) => u(w)), g = Array.from(l.layers), [p] = [...l.layersWithOutsidePointerEventsDisabled].slice(-1), y = g.indexOf(p), v = f ? g.indexOf(f) : -1, b = l.layersWithOutsidePointerEventsDisabled.size > 0, E = v >= y, x = ue((w) => {
30
- const C = w.target, S = [...l.branches].some((P) => P.contains(C));
31
- !E || S || (o == null || o(w), r == null || r(w), w.defaultPrevented || c == null || c());
32
- }, m), O = de((w) => {
33
- const C = w.target;
34
- [...l.branches].some((P) => P.contains(C)) || (s == null || s(w), r == null || r(w), w.defaultPrevented || c == null || c());
35
- }, m);
36
- return oe((w) => {
37
- v === l.layers.size - 1 && (i == null || i(w), !w.defaultPrevented && c && (w.preventDefault(), c()));
38
- }, m), R.useEffect(() => {
39
- if (f)
40
- return n && (l.layersWithOutsidePointerEventsDisabled.size === 0 && (Dt = m.body.style.pointerEvents, m.body.style.pointerEvents = "none"), l.layersWithOutsidePointerEventsDisabled.add(f)), l.layers.add(f), Lt(), () => {
41
- n && l.layersWithOutsidePointerEventsDisabled.size === 1 && (m.body.style.pointerEvents = Dt);
42
- };
43
- }, [f, m, n, l]), R.useEffect(() => () => {
44
- f && (l.layers.delete(f), l.layersWithOutsidePointerEventsDisabled.delete(f), Lt());
45
- }, [f, l]), R.useEffect(() => {
46
- const w = () => d({});
47
- return document.addEventListener(pt, w), () => document.removeEventListener(pt, w);
48
- }, []), /* @__PURE__ */ _t(
49
- Ht.div,
50
- {
51
- ...a,
52
- ref: h,
53
- style: {
54
- pointerEvents: b ? E ? "auto" : "none" : void 0,
55
- ...t.style
56
- },
57
- onFocusCapture: mt(t.onFocusCapture, O.onFocusCapture),
58
- onBlurCapture: mt(t.onBlurCapture, O.onBlurCapture),
59
- onPointerDownCapture: mt(
60
- t.onPointerDownCapture,
61
- x.onPointerDownCapture
62
- )
63
- }
64
- );
65
- }
66
- );
67
- le.displayName = se;
68
- var fe = "DismissableLayerBranch", ae = R.forwardRef((t, e) => {
69
- const n = R.useContext(Vt), i = R.useRef(null), o = $t(e, i);
70
- return R.useEffect(() => {
71
- const s = i.current;
72
- if (s)
73
- return n.branches.add(s), () => {
74
- n.branches.delete(s);
75
- };
76
- }, [n.branches]), /* @__PURE__ */ _t(Ht.div, { ...t, ref: o });
77
- });
78
- ae.displayName = fe;
79
- function ue(t, e = globalThis == null ? void 0 : globalThis.document) {
80
- const n = vt(t), i = R.useRef(!1), o = R.useRef(() => {
81
- });
82
- return R.useEffect(() => {
83
- const s = (c) => {
84
- if (c.target && !i.current) {
85
- let a = function() {
86
- zt(
87
- re,
88
- n,
89
- l,
90
- { discrete: !0 }
91
- );
92
- };
93
- const l = { originalEvent: c };
94
- c.pointerType === "touch" ? (e.removeEventListener("click", o.current), o.current = a, e.addEventListener("click", o.current, { once: !0 })) : a();
95
- } else
96
- e.removeEventListener("click", o.current);
97
- i.current = !1;
98
- }, r = window.setTimeout(() => {
99
- e.addEventListener("pointerdown", s);
100
- }, 0);
101
- return () => {
102
- window.clearTimeout(r), e.removeEventListener("pointerdown", s), e.removeEventListener("click", o.current);
103
- };
104
- }, [e, n]), {
105
- // ensures we check React component tree (not just DOM tree)
106
- onPointerDownCapture: () => i.current = !0
107
- };
108
- }
109
- function de(t, e = globalThis == null ? void 0 : globalThis.document) {
110
- const n = vt(t), i = R.useRef(!1);
111
- return R.useEffect(() => {
112
- const o = (s) => {
113
- s.target && !i.current && zt(ce, n, { originalEvent: s }, {
114
- discrete: !1
115
- });
116
- };
117
- return e.addEventListener("focusin", o), () => e.removeEventListener("focusin", o);
118
- }, [e, n]), {
119
- onFocusCapture: () => i.current = !0,
120
- onBlurCapture: () => i.current = !1
121
- };
122
- }
123
- function Lt() {
124
- const t = new CustomEvent(pt);
125
- document.dispatchEvent(t);
126
- }
127
- function zt(t, e, n, { discrete: i }) {
128
- const o = n.originalEvent.target, s = new CustomEvent(t, { bubbles: !1, cancelable: !0, detail: n });
129
- e && o.addEventListener(t, e, { once: !0 }), i ? ee(o, s) : o.dispatchEvent(s);
130
- }
131
- var me = R["useId".toString()] || (() => {
132
- }), he = 0;
133
- function cn(t) {
134
- const [e, n] = R.useState(me());
135
- return ne(() => {
136
- t || n((i) => i ?? String(he++));
137
- }, [t]), t || (e ? `radix-${e}` : "");
138
- }
139
- const ge = ["top", "right", "bottom", "left"], q = Math.min, B = Math.max, rt = Math.round, ot = Math.floor, _ = (t) => ({
140
- x: t,
141
- y: t
142
- }), pe = {
143
- left: "right",
144
- right: "left",
145
- bottom: "top",
146
- top: "bottom"
147
- }, ye = {
148
- start: "end",
149
- end: "start"
150
- };
151
- function yt(t, e, n) {
152
- return B(t, q(e, n));
153
- }
154
- function j(t, e) {
155
- return typeof t == "function" ? t(e) : t;
156
- }
157
- function U(t) {
158
- return t.split("-")[0];
159
- }
160
- function Z(t) {
161
- return t.split("-")[1];
162
- }
163
- function bt(t) {
164
- return t === "x" ? "y" : "x";
165
- }
166
- function Et(t) {
167
- return t === "y" ? "height" : "width";
168
- }
169
- function X(t) {
170
- return ["top", "bottom"].includes(U(t)) ? "y" : "x";
171
- }
172
- function Rt(t) {
173
- return bt(X(t));
174
- }
175
- function we(t, e, n) {
176
- n === void 0 && (n = !1);
177
- const i = Z(t), o = Rt(t), s = Et(o);
178
- let r = o === "x" ? i === (n ? "end" : "start") ? "right" : "left" : i === "start" ? "bottom" : "top";
179
- return e.reference[s] > e.floating[s] && (r = ct(r)), [r, ct(r)];
180
- }
181
- function xe(t) {
182
- const e = ct(t);
183
- return [wt(t), e, wt(e)];
184
- }
185
- function wt(t) {
186
- return t.replace(/start|end/g, (e) => ye[e]);
187
- }
188
- function ve(t, e, n) {
189
- const i = ["left", "right"], o = ["right", "left"], s = ["top", "bottom"], r = ["bottom", "top"];
190
- switch (t) {
191
- case "top":
192
- case "bottom":
193
- return n ? e ? o : i : e ? i : o;
194
- case "left":
195
- case "right":
196
- return e ? s : r;
197
- default:
198
- return [];
199
- }
200
- }
201
- function be(t, e, n, i) {
202
- const o = Z(t);
203
- let s = ve(U(t), n === "start", i);
204
- return o && (s = s.map((r) => r + "-" + o), e && (s = s.concat(s.map(wt)))), s;
205
- }
206
- function ct(t) {
207
- return t.replace(/left|right|bottom|top/g, (e) => pe[e]);
208
- }
209
- function Ee(t) {
210
- return {
211
- top: 0,
212
- right: 0,
213
- bottom: 0,
214
- left: 0,
215
- ...t
216
- };
217
- }
218
- function It(t) {
219
- return typeof t != "number" ? Ee(t) : {
220
- top: t,
221
- right: t,
222
- bottom: t,
223
- left: t
224
- };
225
- }
226
- function lt(t) {
227
- const {
228
- x: e,
229
- y: n,
230
- width: i,
231
- height: o
232
- } = t;
233
- return {
234
- width: i,
235
- height: o,
236
- top: n,
237
- left: e,
238
- right: e + i,
239
- bottom: n + o,
240
- x: e,
241
- y: n
242
- };
243
- }
244
- function St(t, e, n) {
245
- let {
246
- reference: i,
247
- floating: o
248
- } = t;
249
- const s = X(e), r = Rt(e), c = Et(r), a = U(e), l = s === "y", f = i.x + i.width / 2 - o.width / 2, u = i.y + i.height / 2 - o.height / 2, m = i[c] / 2 - o[c] / 2;
250
- let d;
251
- switch (a) {
252
- case "top":
253
- d = {
254
- x: f,
255
- y: i.y - o.height
256
- };
257
- break;
258
- case "bottom":
259
- d = {
260
- x: f,
261
- y: i.y + i.height
262
- };
263
- break;
264
- case "right":
265
- d = {
266
- x: i.x + i.width,
267
- y: u
268
- };
269
- break;
270
- case "left":
271
- d = {
272
- x: i.x - o.width,
273
- y: u
274
- };
275
- break;
276
- default:
277
- d = {
278
- x: i.x,
279
- y: i.y
280
- };
281
- }
282
- switch (Z(e)) {
283
- case "start":
284
- d[r] -= m * (n && l ? -1 : 1);
285
- break;
286
- case "end":
287
- d[r] += m * (n && l ? -1 : 1);
288
- break;
289
- }
290
- return d;
291
- }
292
- const Re = async (t, e, n) => {
293
- const {
294
- placement: i = "bottom",
295
- strategy: o = "absolute",
296
- middleware: s = [],
297
- platform: r
298
- } = n, c = s.filter(Boolean), a = await (r.isRTL == null ? void 0 : r.isRTL(e));
299
- let l = await r.getElementRects({
300
- reference: t,
301
- floating: e,
302
- strategy: o
303
- }), {
304
- x: f,
305
- y: u
306
- } = St(l, i, a), m = i, d = {}, h = 0;
307
- for (let g = 0; g < c.length; g++) {
308
- const {
309
- name: p,
310
- fn: y
311
- } = c[g], {
312
- x: v,
313
- y: b,
314
- data: E,
315
- reset: x
316
- } = await y({
317
- x: f,
318
- y: u,
319
- initialPlacement: i,
320
- placement: m,
321
- strategy: o,
322
- middlewareData: d,
323
- rects: l,
324
- platform: r,
325
- elements: {
326
- reference: t,
327
- floating: e
328
- }
329
- });
330
- f = v ?? f, u = b ?? u, d = {
331
- ...d,
332
- [p]: {
333
- ...d[p],
334
- ...E
335
- }
336
- }, x && h <= 50 && (h++, typeof x == "object" && (x.placement && (m = x.placement), x.rects && (l = x.rects === !0 ? await r.getElementRects({
337
- reference: t,
338
- floating: e,
339
- strategy: o
340
- }) : x.rects), {
341
- x: f,
342
- y: u
343
- } = St(l, m, a)), g = -1);
344
- }
345
- return {
346
- x: f,
347
- y: u,
348
- placement: m,
349
- strategy: o,
350
- middlewareData: d
351
- };
352
- };
353
- async function et(t, e) {
354
- var n;
355
- e === void 0 && (e = {});
356
- const {
357
- x: i,
358
- y: o,
359
- platform: s,
360
- rects: r,
361
- elements: c,
362
- strategy: a
363
- } = t, {
364
- boundary: l = "clippingAncestors",
365
- rootBoundary: f = "viewport",
366
- elementContext: u = "floating",
367
- altBoundary: m = !1,
368
- padding: d = 0
369
- } = j(e, t), h = It(d), p = c[m ? u === "floating" ? "reference" : "floating" : u], y = lt(await s.getClippingRect({
370
- element: (n = await (s.isElement == null ? void 0 : s.isElement(p))) == null || n ? p : p.contextElement || await (s.getDocumentElement == null ? void 0 : s.getDocumentElement(c.floating)),
371
- boundary: l,
372
- rootBoundary: f,
373
- strategy: a
374
- })), v = u === "floating" ? {
375
- x: i,
376
- y: o,
377
- width: r.floating.width,
378
- height: r.floating.height
379
- } : r.reference, b = await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(c.floating)), E = await (s.isElement == null ? void 0 : s.isElement(b)) ? await (s.getScale == null ? void 0 : s.getScale(b)) || {
380
- x: 1,
381
- y: 1
382
- } : {
383
- x: 1,
384
- y: 1
385
- }, x = lt(s.convertOffsetParentRelativeRectToViewportRelativeRect ? await s.convertOffsetParentRelativeRectToViewportRelativeRect({
386
- elements: c,
387
- rect: v,
388
- offsetParent: b,
389
- strategy: a
390
- }) : v);
391
- return {
392
- top: (y.top - x.top + h.top) / E.y,
393
- bottom: (x.bottom - y.bottom + h.bottom) / E.y,
394
- left: (y.left - x.left + h.left) / E.x,
395
- right: (x.right - y.right + h.right) / E.x
396
- };
397
- }
398
- const Oe = (t) => ({
399
- name: "arrow",
400
- options: t,
401
- async fn(e) {
402
- const {
403
- x: n,
404
- y: i,
405
- placement: o,
406
- rects: s,
407
- platform: r,
408
- elements: c,
409
- middlewareData: a
410
- } = e, {
411
- element: l,
412
- padding: f = 0
413
- } = j(t, e) || {};
414
- if (l == null)
415
- return {};
416
- const u = It(f), m = {
417
- x: n,
418
- y: i
419
- }, d = Rt(o), h = Et(d), g = await r.getDimensions(l), p = d === "y", y = p ? "top" : "left", v = p ? "bottom" : "right", b = p ? "clientHeight" : "clientWidth", E = s.reference[h] + s.reference[d] - m[d] - s.floating[h], x = m[d] - s.reference[d], O = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(l));
420
- let w = O ? O[b] : 0;
421
- (!w || !await (r.isElement == null ? void 0 : r.isElement(O))) && (w = c.floating[b] || s.floating[h]);
422
- const C = E / 2 - x / 2, S = w / 2 - g[h] / 2 - 1, P = q(u[y], S), N = q(u[v], S), M = P, T = w - g[h] - N, D = w / 2 - g[h] / 2 + C, I = yt(M, D, T), L = !a.arrow && Z(o) != null && D !== I && s.reference[h] / 2 - (D < M ? P : N) - g[h] / 2 < 0, k = L ? D < M ? D - M : D - T : 0;
423
- return {
424
- [d]: m[d] + k,
425
- data: {
426
- [d]: I,
427
- centerOffset: D - I - k,
428
- ...L && {
429
- alignmentOffset: k
430
- }
431
- },
432
- reset: L
433
- };
434
- }
435
- }), Ae = function(t) {
436
- return t === void 0 && (t = {}), {
437
- name: "flip",
438
- options: t,
439
- async fn(e) {
440
- var n, i;
441
- const {
442
- placement: o,
443
- middlewareData: s,
444
- rects: r,
445
- initialPlacement: c,
446
- platform: a,
447
- elements: l
448
- } = e, {
449
- mainAxis: f = !0,
450
- crossAxis: u = !0,
451
- fallbackPlacements: m,
452
- fallbackStrategy: d = "bestFit",
453
- fallbackAxisSideDirection: h = "none",
454
- flipAlignment: g = !0,
455
- ...p
456
- } = j(t, e);
457
- if ((n = s.arrow) != null && n.alignmentOffset)
458
- return {};
459
- const y = U(o), v = X(c), b = U(c) === c, E = await (a.isRTL == null ? void 0 : a.isRTL(l.floating)), x = m || (b || !g ? [ct(c)] : xe(c)), O = h !== "none";
460
- !m && O && x.push(...be(c, g, h, E));
461
- const w = [c, ...x], C = await et(e, p), S = [];
462
- let P = ((i = s.flip) == null ? void 0 : i.overflows) || [];
463
- if (f && S.push(C[y]), u) {
464
- const D = we(o, r, E);
465
- S.push(C[D[0]], C[D[1]]);
466
- }
467
- if (P = [...P, {
468
- placement: o,
469
- overflows: S
470
- }], !S.every((D) => D <= 0)) {
471
- var N, M;
472
- const D = (((N = s.flip) == null ? void 0 : N.index) || 0) + 1, I = w[D];
473
- if (I)
474
- return {
475
- data: {
476
- index: D,
477
- overflows: P
478
- },
479
- reset: {
480
- placement: I
481
- }
482
- };
483
- let L = (M = P.filter((k) => k.overflows[0] <= 0).sort((k, A) => k.overflows[1] - A.overflows[1])[0]) == null ? void 0 : M.placement;
484
- if (!L)
485
- switch (d) {
486
- case "bestFit": {
487
- var T;
488
- const k = (T = P.filter((A) => {
489
- if (O) {
490
- const F = X(A.placement);
491
- return F === v || // Create a bias to the `y` side axis due to horizontal
492
- // reading directions favoring greater width.
493
- F === "y";
494
- }
495
- return !0;
496
- }).map((A) => [A.placement, A.overflows.filter((F) => F > 0).reduce((F, Y) => F + Y, 0)]).sort((A, F) => A[1] - F[1])[0]) == null ? void 0 : T[0];
497
- k && (L = k);
498
- break;
499
- }
500
- case "initialPlacement":
501
- L = c;
502
- break;
503
- }
504
- if (o !== L)
505
- return {
506
- reset: {
507
- placement: L
508
- }
509
- };
510
- }
511
- return {};
512
- }
513
- };
514
- };
515
- function Tt(t, e) {
516
- return {
517
- top: t.top - e.height,
518
- right: t.right - e.width,
519
- bottom: t.bottom - e.height,
520
- left: t.left - e.width
521
- };
522
- }
523
- function Mt(t) {
524
- return ge.some((e) => t[e] >= 0);
525
- }
526
- const Ce = function(t) {
527
- return t === void 0 && (t = {}), {
528
- name: "hide",
529
- options: t,
530
- async fn(e) {
531
- const {
532
- rects: n
533
- } = e, {
534
- strategy: i = "referenceHidden",
535
- ...o
536
- } = j(t, e);
537
- switch (i) {
538
- case "referenceHidden": {
539
- const s = await et(e, {
540
- ...o,
541
- elementContext: "reference"
542
- }), r = Tt(s, n.reference);
543
- return {
544
- data: {
545
- referenceHiddenOffsets: r,
546
- referenceHidden: Mt(r)
547
- }
548
- };
549
- }
550
- case "escaped": {
551
- const s = await et(e, {
552
- ...o,
553
- altBoundary: !0
554
- }), r = Tt(s, n.floating);
555
- return {
556
- data: {
557
- escapedOffsets: r,
558
- escaped: Mt(r)
559
- }
560
- };
561
- }
562
- default:
563
- return {};
564
- }
565
- }
566
- };
567
- };
568
- async function Pe(t, e) {
569
- const {
570
- placement: n,
571
- platform: i,
572
- elements: o
573
- } = t, s = await (i.isRTL == null ? void 0 : i.isRTL(o.floating)), r = U(n), c = Z(n), a = X(n) === "y", l = ["left", "top"].includes(r) ? -1 : 1, f = s && a ? -1 : 1, u = j(e, t);
574
- let {
575
- mainAxis: m,
576
- crossAxis: d,
577
- alignmentAxis: h
578
- } = typeof u == "number" ? {
579
- mainAxis: u,
580
- crossAxis: 0,
581
- alignmentAxis: null
582
- } : {
583
- mainAxis: u.mainAxis || 0,
584
- crossAxis: u.crossAxis || 0,
585
- alignmentAxis: u.alignmentAxis
586
- };
587
- return c && typeof h == "number" && (d = c === "end" ? h * -1 : h), a ? {
588
- x: d * f,
589
- y: m * l
590
- } : {
591
- x: m * l,
592
- y: d * f
593
- };
594
- }
595
- const De = function(t) {
596
- return t === void 0 && (t = 0), {
597
- name: "offset",
598
- options: t,
599
- async fn(e) {
600
- var n, i;
601
- const {
602
- x: o,
603
- y: s,
604
- placement: r,
605
- middlewareData: c
606
- } = e, a = await Pe(e, t);
607
- return r === ((n = c.offset) == null ? void 0 : n.placement) && (i = c.arrow) != null && i.alignmentOffset ? {} : {
608
- x: o + a.x,
609
- y: s + a.y,
610
- data: {
611
- ...a,
612
- placement: r
613
- }
614
- };
615
- }
616
- };
617
- }, Le = function(t) {
618
- return t === void 0 && (t = {}), {
619
- name: "shift",
620
- options: t,
621
- async fn(e) {
622
- const {
623
- x: n,
624
- y: i,
625
- placement: o
626
- } = e, {
627
- mainAxis: s = !0,
628
- crossAxis: r = !1,
629
- limiter: c = {
630
- fn: (p) => {
631
- let {
632
- x: y,
633
- y: v
634
- } = p;
635
- return {
636
- x: y,
637
- y: v
638
- };
639
- }
640
- },
641
- ...a
642
- } = j(t, e), l = {
643
- x: n,
644
- y: i
645
- }, f = await et(e, a), u = X(U(o)), m = bt(u);
646
- let d = l[m], h = l[u];
647
- if (s) {
648
- const p = m === "y" ? "top" : "left", y = m === "y" ? "bottom" : "right", v = d + f[p], b = d - f[y];
649
- d = yt(v, d, b);
650
- }
651
- if (r) {
652
- const p = u === "y" ? "top" : "left", y = u === "y" ? "bottom" : "right", v = h + f[p], b = h - f[y];
653
- h = yt(v, h, b);
654
- }
655
- const g = c.fn({
656
- ...e,
657
- [m]: d,
658
- [u]: h
659
- });
660
- return {
661
- ...g,
662
- data: {
663
- x: g.x - n,
664
- y: g.y - i,
665
- enabled: {
666
- [m]: s,
667
- [u]: r
668
- }
669
- }
670
- };
671
- }
672
- };
673
- }, Se = function(t) {
674
- return t === void 0 && (t = {}), {
675
- options: t,
676
- fn(e) {
677
- const {
678
- x: n,
679
- y: i,
680
- placement: o,
681
- rects: s,
682
- middlewareData: r
683
- } = e, {
684
- offset: c = 0,
685
- mainAxis: a = !0,
686
- crossAxis: l = !0
687
- } = j(t, e), f = {
688
- x: n,
689
- y: i
690
- }, u = X(o), m = bt(u);
691
- let d = f[m], h = f[u];
692
- const g = j(c, e), p = typeof g == "number" ? {
693
- mainAxis: g,
694
- crossAxis: 0
695
- } : {
696
- mainAxis: 0,
697
- crossAxis: 0,
698
- ...g
699
- };
700
- if (a) {
701
- const b = m === "y" ? "height" : "width", E = s.reference[m] - s.floating[b] + p.mainAxis, x = s.reference[m] + s.reference[b] - p.mainAxis;
702
- d < E ? d = E : d > x && (d = x);
703
- }
704
- if (l) {
705
- var y, v;
706
- const b = m === "y" ? "width" : "height", E = ["top", "left"].includes(U(o)), x = s.reference[u] - s.floating[b] + (E && ((y = r.offset) == null ? void 0 : y[u]) || 0) + (E ? 0 : p.crossAxis), O = s.reference[u] + s.reference[b] + (E ? 0 : ((v = r.offset) == null ? void 0 : v[u]) || 0) - (E ? p.crossAxis : 0);
707
- h < x ? h = x : h > O && (h = O);
708
- }
709
- return {
710
- [m]: d,
711
- [u]: h
712
- };
713
- }
714
- };
715
- }, Te = function(t) {
716
- return t === void 0 && (t = {}), {
717
- name: "size",
718
- options: t,
719
- async fn(e) {
720
- var n, i;
721
- const {
722
- placement: o,
723
- rects: s,
724
- platform: r,
725
- elements: c
726
- } = e, {
727
- apply: a = () => {
728
- },
729
- ...l
730
- } = j(t, e), f = await et(e, l), u = U(o), m = Z(o), d = X(o) === "y", {
731
- width: h,
732
- height: g
733
- } = s.floating;
734
- let p, y;
735
- u === "top" || u === "bottom" ? (p = u, y = m === (await (r.isRTL == null ? void 0 : r.isRTL(c.floating)) ? "start" : "end") ? "left" : "right") : (y = u, p = m === "end" ? "top" : "bottom");
736
- const v = g - f.top - f.bottom, b = h - f.left - f.right, E = q(g - f[p], v), x = q(h - f[y], b), O = !e.middlewareData.shift;
737
- let w = E, C = x;
738
- if ((n = e.middlewareData.shift) != null && n.enabled.x && (C = b), (i = e.middlewareData.shift) != null && i.enabled.y && (w = v), O && !m) {
739
- const P = B(f.left, 0), N = B(f.right, 0), M = B(f.top, 0), T = B(f.bottom, 0);
740
- d ? C = h - 2 * (P !== 0 || N !== 0 ? P + N : B(f.left, f.right)) : w = g - 2 * (M !== 0 || T !== 0 ? M + T : B(f.top, f.bottom));
741
- }
742
- await a({
743
- ...e,
744
- availableWidth: C,
745
- availableHeight: w
746
- });
747
- const S = await r.getDimensions(c.floating);
748
- return h !== S.width || g !== S.height ? {
749
- reset: {
750
- rects: !0
751
- }
752
- } : {};
753
- }
754
- };
755
- };
756
- function at() {
757
- return typeof window < "u";
758
- }
759
- function tt(t) {
760
- return jt(t) ? (t.nodeName || "").toLowerCase() : "#document";
761
- }
762
- function W(t) {
763
- var e;
764
- return (t == null || (e = t.ownerDocument) == null ? void 0 : e.defaultView) || window;
765
- }
766
- function z(t) {
767
- var e;
768
- return (e = (jt(t) ? t.ownerDocument : t.document) || window.document) == null ? void 0 : e.documentElement;
769
- }
770
- function jt(t) {
771
- return at() ? t instanceof Node || t instanceof W(t).Node : !1;
772
- }
773
- function $(t) {
774
- return at() ? t instanceof Element || t instanceof W(t).Element : !1;
775
- }
776
- function V(t) {
777
- return at() ? t instanceof HTMLElement || t instanceof W(t).HTMLElement : !1;
778
- }
779
- function kt(t) {
780
- return !at() || typeof ShadowRoot > "u" ? !1 : t instanceof ShadowRoot || t instanceof W(t).ShadowRoot;
781
- }
782
- function it(t) {
783
- const {
784
- overflow: e,
785
- overflowX: n,
786
- overflowY: i,
787
- display: o
788
- } = H(t);
789
- return /auto|scroll|overlay|hidden|clip/.test(e + i + n) && !["inline", "contents"].includes(o);
790
- }
791
- function Me(t) {
792
- return ["table", "td", "th"].includes(tt(t));
793
- }
794
- function ut(t) {
795
- return [":popover-open", ":modal"].some((e) => {
796
- try {
797
- return t.matches(e);
798
- } catch {
799
- return !1;
800
- }
801
- });
802
- }
803
- function Ot(t) {
804
- const e = At(), n = $(t) ? H(t) : t;
805
- return ["transform", "translate", "scale", "rotate", "perspective"].some((i) => n[i] ? n[i] !== "none" : !1) || (n.containerType ? n.containerType !== "normal" : !1) || !e && (n.backdropFilter ? n.backdropFilter !== "none" : !1) || !e && (n.filter ? n.filter !== "none" : !1) || ["transform", "translate", "scale", "rotate", "perspective", "filter"].some((i) => (n.willChange || "").includes(i)) || ["paint", "layout", "strict", "content"].some((i) => (n.contain || "").includes(i));
806
- }
807
- function ke(t) {
808
- let e = K(t);
809
- for (; V(e) && !Q(e); ) {
810
- if (Ot(e))
811
- return e;
812
- if (ut(e))
813
- return null;
814
- e = K(e);
815
- }
816
- return null;
817
- }
818
- function At() {
819
- return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
820
- }
821
- function Q(t) {
822
- return ["html", "body", "#document"].includes(tt(t));
823
- }
824
- function H(t) {
825
- return W(t).getComputedStyle(t);
826
- }
827
- function dt(t) {
828
- return $(t) ? {
829
- scrollLeft: t.scrollLeft,
830
- scrollTop: t.scrollTop
831
- } : {
832
- scrollLeft: t.scrollX,
833
- scrollTop: t.scrollY
834
- };
835
- }
836
- function K(t) {
837
- if (tt(t) === "html")
838
- return t;
839
- const e = (
840
- // Step into the shadow DOM of the parent of a slotted node.
841
- t.assignedSlot || // DOM Element detected.
842
- t.parentNode || // ShadowRoot detected.
843
- kt(t) && t.host || // Fallback.
844
- z(t)
845
- );
846
- return kt(e) ? e.host : e;
847
- }
848
- function Ut(t) {
849
- const e = K(t);
850
- return Q(e) ? t.ownerDocument ? t.ownerDocument.body : t.body : V(e) && it(e) ? e : Ut(e);
851
- }
852
- function nt(t, e, n) {
853
- var i;
854
- e === void 0 && (e = []), n === void 0 && (n = !0);
855
- const o = Ut(t), s = o === ((i = t.ownerDocument) == null ? void 0 : i.body), r = W(o);
856
- if (s) {
857
- const c = xt(r);
858
- return e.concat(r, r.visualViewport || [], it(o) ? o : [], c && n ? nt(c) : []);
859
- }
860
- return e.concat(o, nt(o, [], n));
861
- }
862
- function xt(t) {
863
- return t.parent && Object.getPrototypeOf(t.parent) ? t.frameElement : null;
864
- }
865
- function Yt(t) {
866
- const e = H(t);
867
- let n = parseFloat(e.width) || 0, i = parseFloat(e.height) || 0;
868
- const o = V(t), s = o ? t.offsetWidth : n, r = o ? t.offsetHeight : i, c = rt(n) !== s || rt(i) !== r;
869
- return c && (n = s, i = r), {
870
- width: n,
871
- height: i,
872
- $: c
873
- };
874
- }
875
- function Ct(t) {
876
- return $(t) ? t : t.contextElement;
877
- }
878
- function J(t) {
879
- const e = Ct(t);
880
- if (!V(e))
881
- return _(1);
882
- const n = e.getBoundingClientRect(), {
883
- width: i,
884
- height: o,
885
- $: s
886
- } = Yt(e);
887
- let r = (s ? rt(n.width) : n.width) / i, c = (s ? rt(n.height) : n.height) / o;
888
- return (!r || !Number.isFinite(r)) && (r = 1), (!c || !Number.isFinite(c)) && (c = 1), {
889
- x: r,
890
- y: c
891
- };
892
- }
893
- const Fe = /* @__PURE__ */ _(0);
894
- function qt(t) {
895
- const e = W(t);
896
- return !At() || !e.visualViewport ? Fe : {
897
- x: e.visualViewport.offsetLeft,
898
- y: e.visualViewport.offsetTop
899
- };
900
- }
901
- function Be(t, e, n) {
902
- return e === void 0 && (e = !1), !n || e && n !== W(t) ? !1 : e;
903
- }
904
- function G(t, e, n, i) {
905
- e === void 0 && (e = !1), n === void 0 && (n = !1);
906
- const o = t.getBoundingClientRect(), s = Ct(t);
907
- let r = _(1);
908
- e && (i ? $(i) && (r = J(i)) : r = J(t));
909
- const c = Be(s, n, i) ? qt(s) : _(0);
910
- let a = (o.left + c.x) / r.x, l = (o.top + c.y) / r.y, f = o.width / r.x, u = o.height / r.y;
911
- if (s) {
912
- const m = W(s), d = i && $(i) ? W(i) : i;
913
- let h = m, g = xt(h);
914
- for (; g && i && d !== h; ) {
915
- const p = J(g), y = g.getBoundingClientRect(), v = H(g), b = y.left + (g.clientLeft + parseFloat(v.paddingLeft)) * p.x, E = y.top + (g.clientTop + parseFloat(v.paddingTop)) * p.y;
916
- a *= p.x, l *= p.y, f *= p.x, u *= p.y, a += b, l += E, h = W(g), g = xt(h);
917
- }
918
- }
919
- return lt({
920
- width: f,
921
- height: u,
922
- x: a,
923
- y: l
924
- });
925
- }
926
- function Pt(t, e) {
927
- const n = dt(t).scrollLeft;
928
- return e ? e.left + n : G(z(t)).left + n;
929
- }
930
- function Xt(t, e, n) {
931
- n === void 0 && (n = !1);
932
- const i = t.getBoundingClientRect(), o = i.left + e.scrollLeft - (n ? 0 : (
933
- // RTL <body> scrollbar.
934
- Pt(t, i)
935
- )), s = i.top + e.scrollTop;
936
- return {
937
- x: o,
938
- y: s
939
- };
940
- }
941
- function We(t) {
942
- let {
943
- elements: e,
944
- rect: n,
945
- offsetParent: i,
946
- strategy: o
947
- } = t;
948
- const s = o === "fixed", r = z(i), c = e ? ut(e.floating) : !1;
949
- if (i === r || c && s)
950
- return n;
951
- let a = {
952
- scrollLeft: 0,
953
- scrollTop: 0
954
- }, l = _(1);
955
- const f = _(0), u = V(i);
956
- if ((u || !u && !s) && ((tt(i) !== "body" || it(r)) && (a = dt(i)), V(i))) {
957
- const d = G(i);
958
- l = J(i), f.x = d.x + i.clientLeft, f.y = d.y + i.clientTop;
959
- }
960
- const m = r && !u && !s ? Xt(r, a, !0) : _(0);
961
- return {
962
- width: n.width * l.x,
963
- height: n.height * l.y,
964
- x: n.x * l.x - a.scrollLeft * l.x + f.x + m.x,
965
- y: n.y * l.y - a.scrollTop * l.y + f.y + m.y
966
- };
967
- }
968
- function Ne(t) {
969
- return Array.from(t.getClientRects());
970
- }
971
- function $e(t) {
972
- const e = z(t), n = dt(t), i = t.ownerDocument.body, o = B(e.scrollWidth, e.clientWidth, i.scrollWidth, i.clientWidth), s = B(e.scrollHeight, e.clientHeight, i.scrollHeight, i.clientHeight);
973
- let r = -n.scrollLeft + Pt(t);
974
- const c = -n.scrollTop;
975
- return H(i).direction === "rtl" && (r += B(e.clientWidth, i.clientWidth) - o), {
976
- width: o,
977
- height: s,
978
- x: r,
979
- y: c
980
- };
981
- }
982
- function He(t, e) {
983
- const n = W(t), i = z(t), o = n.visualViewport;
984
- let s = i.clientWidth, r = i.clientHeight, c = 0, a = 0;
985
- if (o) {
986
- s = o.width, r = o.height;
987
- const l = At();
988
- (!l || l && e === "fixed") && (c = o.offsetLeft, a = o.offsetTop);
989
- }
990
- return {
991
- width: s,
992
- height: r,
993
- x: c,
994
- y: a
995
- };
996
- }
997
- function _e(t, e) {
998
- const n = G(t, !0, e === "fixed"), i = n.top + t.clientTop, o = n.left + t.clientLeft, s = V(t) ? J(t) : _(1), r = t.clientWidth * s.x, c = t.clientHeight * s.y, a = o * s.x, l = i * s.y;
999
- return {
1000
- width: r,
1001
- height: c,
1002
- x: a,
1003
- y: l
1004
- };
1005
- }
1006
- function Ft(t, e, n) {
1007
- let i;
1008
- if (e === "viewport")
1009
- i = He(t, n);
1010
- else if (e === "document")
1011
- i = $e(z(t));
1012
- else if ($(e))
1013
- i = _e(e, n);
1014
- else {
1015
- const o = qt(t);
1016
- i = {
1017
- x: e.x - o.x,
1018
- y: e.y - o.y,
1019
- width: e.width,
1020
- height: e.height
1021
- };
1022
- }
1023
- return lt(i);
1024
- }
1025
- function Kt(t, e) {
1026
- const n = K(t);
1027
- return n === e || !$(n) || Q(n) ? !1 : H(n).position === "fixed" || Kt(n, e);
1028
- }
1029
- function Ve(t, e) {
1030
- const n = e.get(t);
1031
- if (n)
1032
- return n;
1033
- let i = nt(t, [], !1).filter((c) => $(c) && tt(c) !== "body"), o = null;
1034
- const s = H(t).position === "fixed";
1035
- let r = s ? K(t) : t;
1036
- for (; $(r) && !Q(r); ) {
1037
- const c = H(r), a = Ot(r);
1038
- !a && c.position === "fixed" && (o = null), (s ? !a && !o : !a && c.position === "static" && !!o && ["absolute", "fixed"].includes(o.position) || it(r) && !a && Kt(t, r)) ? i = i.filter((f) => f !== r) : o = c, r = K(r);
1039
- }
1040
- return e.set(t, i), i;
1041
- }
1042
- function ze(t) {
1043
- let {
1044
- element: e,
1045
- boundary: n,
1046
- rootBoundary: i,
1047
- strategy: o
1048
- } = t;
1049
- const r = [...n === "clippingAncestors" ? ut(e) ? [] : Ve(e, this._c) : [].concat(n), i], c = r[0], a = r.reduce((l, f) => {
1050
- const u = Ft(e, f, o);
1051
- return l.top = B(u.top, l.top), l.right = q(u.right, l.right), l.bottom = q(u.bottom, l.bottom), l.left = B(u.left, l.left), l;
1052
- }, Ft(e, c, o));
1053
- return {
1054
- width: a.right - a.left,
1055
- height: a.bottom - a.top,
1056
- x: a.left,
1057
- y: a.top
1058
- };
1059
- }
1060
- function Ie(t) {
1061
- const {
1062
- width: e,
1063
- height: n
1064
- } = Yt(t);
1065
- return {
1066
- width: e,
1067
- height: n
1068
- };
1069
- }
1070
- function je(t, e, n) {
1071
- const i = V(e), o = z(e), s = n === "fixed", r = G(t, !0, s, e);
1072
- let c = {
1073
- scrollLeft: 0,
1074
- scrollTop: 0
1075
- };
1076
- const a = _(0);
1077
- if (i || !i && !s)
1078
- if ((tt(e) !== "body" || it(o)) && (c = dt(e)), i) {
1079
- const m = G(e, !0, s, e);
1080
- a.x = m.x + e.clientLeft, a.y = m.y + e.clientTop;
1081
- } else
1082
- o && (a.x = Pt(o));
1083
- const l = o && !i && !s ? Xt(o, c) : _(0), f = r.left + c.scrollLeft - a.x - l.x, u = r.top + c.scrollTop - a.y - l.y;
1084
- return {
1085
- x: f,
1086
- y: u,
1087
- width: r.width,
1088
- height: r.height
1089
- };
1090
- }
1091
- function ht(t) {
1092
- return H(t).position === "static";
1093
- }
1094
- function Bt(t, e) {
1095
- if (!V(t) || H(t).position === "fixed")
1096
- return null;
1097
- if (e)
1098
- return e(t);
1099
- let n = t.offsetParent;
1100
- return z(t) === n && (n = n.ownerDocument.body), n;
1101
- }
1102
- function Gt(t, e) {
1103
- const n = W(t);
1104
- if (ut(t))
1105
- return n;
1106
- if (!V(t)) {
1107
- let o = K(t);
1108
- for (; o && !Q(o); ) {
1109
- if ($(o) && !ht(o))
1110
- return o;
1111
- o = K(o);
1112
- }
1113
- return n;
1114
- }
1115
- let i = Bt(t, e);
1116
- for (; i && Me(i) && ht(i); )
1117
- i = Bt(i, e);
1118
- return i && Q(i) && ht(i) && !Ot(i) ? n : i || ke(t) || n;
1119
- }
1120
- const Ue = async function(t) {
1121
- const e = this.getOffsetParent || Gt, n = this.getDimensions, i = await n(t.floating);
1122
- return {
1123
- reference: je(t.reference, await e(t.floating), t.strategy),
1124
- floating: {
1125
- x: 0,
1126
- y: 0,
1127
- width: i.width,
1128
- height: i.height
1129
- }
1130
- };
1131
- };
1132
- function Ye(t) {
1133
- return H(t).direction === "rtl";
1134
- }
1135
- const qe = {
1136
- convertOffsetParentRelativeRectToViewportRelativeRect: We,
1137
- getDocumentElement: z,
1138
- getClippingRect: ze,
1139
- getOffsetParent: Gt,
1140
- getElementRects: Ue,
1141
- getClientRects: Ne,
1142
- getDimensions: Ie,
1143
- getScale: J,
1144
- isElement: $,
1145
- isRTL: Ye
1146
- };
1147
- function Jt(t, e) {
1148
- return t.x === e.x && t.y === e.y && t.width === e.width && t.height === e.height;
1149
- }
1150
- function Xe(t, e) {
1151
- let n = null, i;
1152
- const o = z(t);
1153
- function s() {
1154
- var c;
1155
- clearTimeout(i), (c = n) == null || c.disconnect(), n = null;
1156
- }
1157
- function r(c, a) {
1158
- c === void 0 && (c = !1), a === void 0 && (a = 1), s();
1159
- const l = t.getBoundingClientRect(), {
1160
- left: f,
1161
- top: u,
1162
- width: m,
1163
- height: d
1164
- } = l;
1165
- if (c || e(), !m || !d)
1166
- return;
1167
- const h = ot(u), g = ot(o.clientWidth - (f + m)), p = ot(o.clientHeight - (u + d)), y = ot(f), b = {
1168
- rootMargin: -h + "px " + -g + "px " + -p + "px " + -y + "px",
1169
- threshold: B(0, q(1, a)) || 1
1170
- };
1171
- let E = !0;
1172
- function x(O) {
1173
- const w = O[0].intersectionRatio;
1174
- if (w !== a) {
1175
- if (!E)
1176
- return r();
1177
- w ? r(!1, w) : i = setTimeout(() => {
1178
- r(!1, 1e-7);
1179
- }, 1e3);
1180
- }
1181
- w === 1 && !Jt(l, t.getBoundingClientRect()) && r(), E = !1;
1182
- }
1183
- try {
1184
- n = new IntersectionObserver(x, {
1185
- ...b,
1186
- // Handle <iframe>s
1187
- root: o.ownerDocument
1188
- });
1189
- } catch {
1190
- n = new IntersectionObserver(x, b);
1191
- }
1192
- n.observe(t);
1193
- }
1194
- return r(!0), s;
1195
- }
1196
- function ln(t, e, n, i) {
1197
- i === void 0 && (i = {});
1198
- const {
1199
- ancestorScroll: o = !0,
1200
- ancestorResize: s = !0,
1201
- elementResize: r = typeof ResizeObserver == "function",
1202
- layoutShift: c = typeof IntersectionObserver == "function",
1203
- animationFrame: a = !1
1204
- } = i, l = Ct(t), f = o || s ? [...l ? nt(l) : [], ...nt(e)] : [];
1205
- f.forEach((y) => {
1206
- o && y.addEventListener("scroll", n, {
1207
- passive: !0
1208
- }), s && y.addEventListener("resize", n);
1209
- });
1210
- const u = l && c ? Xe(l, n) : null;
1211
- let m = -1, d = null;
1212
- r && (d = new ResizeObserver((y) => {
1213
- let [v] = y;
1214
- v && v.target === l && d && (d.unobserve(e), cancelAnimationFrame(m), m = requestAnimationFrame(() => {
1215
- var b;
1216
- (b = d) == null || b.observe(e);
1217
- })), n();
1218
- }), l && !a && d.observe(l), d.observe(e));
1219
- let h, g = a ? G(t) : null;
1220
- a && p();
1221
- function p() {
1222
- const y = G(t);
1223
- g && !Jt(g, y) && n(), g = y, h = requestAnimationFrame(p);
1224
- }
1225
- return n(), () => {
1226
- var y;
1227
- f.forEach((v) => {
1228
- o && v.removeEventListener("scroll", n), s && v.removeEventListener("resize", n);
1229
- }), u == null || u(), (y = d) == null || y.disconnect(), d = null, a && cancelAnimationFrame(h);
1230
- };
1231
- }
1232
- const Ke = De, Ge = Le, Je = Ae, Qe = Te, Ze = Ce, Wt = Oe, tn = Se, en = (t, e, n) => {
1233
- const i = /* @__PURE__ */ new Map(), o = {
1234
- platform: qe,
1235
- ...n
1236
- }, s = {
1237
- ...o.platform,
1238
- _c: i
1239
- };
1240
- return Re(t, e, {
1241
- ...o,
1242
- platform: s
1243
- });
1244
- };
1245
- var st = typeof document < "u" ? Zt : te;
1246
- function ft(t, e) {
1247
- if (t === e)
1248
- return !0;
1249
- if (typeof t != typeof e)
1250
- return !1;
1251
- if (typeof t == "function" && t.toString() === e.toString())
1252
- return !0;
1253
- let n, i, o;
1254
- if (t && e && typeof t == "object") {
1255
- if (Array.isArray(t)) {
1256
- if (n = t.length, n !== e.length)
1257
- return !1;
1258
- for (i = n; i-- !== 0; )
1259
- if (!ft(t[i], e[i]))
1260
- return !1;
1261
- return !0;
1262
- }
1263
- if (o = Object.keys(t), n = o.length, n !== Object.keys(e).length)
1264
- return !1;
1265
- for (i = n; i-- !== 0; )
1266
- if (!{}.hasOwnProperty.call(e, o[i]))
1267
- return !1;
1268
- for (i = n; i-- !== 0; ) {
1269
- const s = o[i];
1270
- if (!(s === "_owner" && t.$$typeof) && !ft(t[s], e[s]))
1271
- return !1;
1272
- }
1273
- return !0;
1274
- }
1275
- return t !== t && e !== e;
1276
- }
1277
- function Qt(t) {
1278
- return typeof window > "u" ? 1 : (t.ownerDocument.defaultView || window).devicePixelRatio || 1;
1279
- }
1280
- function Nt(t, e) {
1281
- const n = Qt(t);
1282
- return Math.round(e * n) / n;
1283
- }
1284
- function gt(t) {
1285
- const e = R.useRef(t);
1286
- return st(() => {
1287
- e.current = t;
1288
- }), e;
1289
- }
1290
- function fn(t) {
1291
- t === void 0 && (t = {});
1292
- const {
1293
- placement: e = "bottom",
1294
- strategy: n = "absolute",
1295
- middleware: i = [],
1296
- platform: o,
1297
- elements: {
1298
- reference: s,
1299
- floating: r
1300
- } = {},
1301
- transform: c = !0,
1302
- whileElementsMounted: a,
1303
- open: l
1304
- } = t, [f, u] = R.useState({
1305
- x: 0,
1306
- y: 0,
1307
- strategy: n,
1308
- placement: e,
1309
- middlewareData: {},
1310
- isPositioned: !1
1311
- }), [m, d] = R.useState(i);
1312
- ft(m, i) || d(i);
1313
- const [h, g] = R.useState(null), [p, y] = R.useState(null), v = R.useCallback((A) => {
1314
- A !== O.current && (O.current = A, g(A));
1315
- }, []), b = R.useCallback((A) => {
1316
- A !== w.current && (w.current = A, y(A));
1317
- }, []), E = s || h, x = r || p, O = R.useRef(null), w = R.useRef(null), C = R.useRef(f), S = a != null, P = gt(a), N = gt(o), M = gt(l), T = R.useCallback(() => {
1318
- if (!O.current || !w.current)
1319
- return;
1320
- const A = {
1321
- placement: e,
1322
- strategy: n,
1323
- middleware: m
1324
- };
1325
- N.current && (A.platform = N.current), en(O.current, w.current, A).then((F) => {
1326
- const Y = {
1327
- ...F,
1328
- // The floating element's position may be recomputed while it's closed
1329
- // but still mounted (such as when transitioning out). To ensure
1330
- // `isPositioned` will be `false` initially on the next open, avoid
1331
- // setting it to `true` when `open === false` (must be specified).
1332
- isPositioned: M.current !== !1
1333
- };
1334
- D.current && !ft(C.current, Y) && (C.current = Y, ie.flushSync(() => {
1335
- u(Y);
1336
- }));
1337
- });
1338
- }, [m, e, n, N, M]);
1339
- st(() => {
1340
- l === !1 && C.current.isPositioned && (C.current.isPositioned = !1, u((A) => ({
1341
- ...A,
1342
- isPositioned: !1
1343
- })));
1344
- }, [l]);
1345
- const D = R.useRef(!1);
1346
- st(() => (D.current = !0, () => {
1347
- D.current = !1;
1348
- }), []), st(() => {
1349
- if (E && (O.current = E), x && (w.current = x), E && x) {
1350
- if (P.current)
1351
- return P.current(E, x, T);
1352
- T();
1353
- }
1354
- }, [E, x, T, P, S]);
1355
- const I = R.useMemo(() => ({
1356
- reference: O,
1357
- floating: w,
1358
- setReference: v,
1359
- setFloating: b
1360
- }), [v, b]), L = R.useMemo(() => ({
1361
- reference: E,
1362
- floating: x
1363
- }), [E, x]), k = R.useMemo(() => {
1364
- const A = {
1365
- position: n,
1366
- left: 0,
1367
- top: 0
1368
- };
1369
- if (!L.floating)
1370
- return A;
1371
- const F = Nt(L.floating, f.x), Y = Nt(L.floating, f.y);
1372
- return c ? {
1373
- ...A,
1374
- transform: "translate(" + F + "px, " + Y + "px)",
1375
- ...Qt(L.floating) >= 1.5 && {
1376
- willChange: "transform"
1377
- }
1378
- } : {
1379
- position: n,
1380
- left: F,
1381
- top: Y
1382
- };
1383
- }, [n, c, L.floating, f.x, f.y]);
1384
- return R.useMemo(() => ({
1385
- ...f,
1386
- update: T,
1387
- refs: I,
1388
- elements: L,
1389
- floatingStyles: k
1390
- }), [f, T, I, L, k]);
1391
- }
1392
- const nn = (t) => {
1393
- function e(n) {
1394
- return {}.hasOwnProperty.call(n, "current");
1395
- }
1396
- return {
1397
- name: "arrow",
1398
- options: t,
1399
- fn(n) {
1400
- const {
1401
- element: i,
1402
- padding: o
1403
- } = typeof t == "function" ? t(n) : t;
1404
- return i && e(i) ? i.current != null ? Wt({
1405
- element: i.current,
1406
- padding: o
1407
- }).fn(n) : {} : i ? Wt({
1408
- element: i,
1409
- padding: o
1410
- }).fn(n) : {};
1411
- }
1412
- };
1413
- }, an = (t, e) => ({
1414
- ...Ke(t),
1415
- options: [t, e]
1416
- }), un = (t, e) => ({
1417
- ...Ge(t),
1418
- options: [t, e]
1419
- }), dn = (t, e) => ({
1420
- ...tn(t),
1421
- options: [t, e]
1422
- }), mn = (t, e) => ({
1423
- ...Je(t),
1424
- options: [t, e]
1425
- }), hn = (t, e) => ({
1426
- ...Qe(t),
1427
- options: [t, e]
1428
- }), gn = (t, e) => ({
1429
- ...Ze(t),
1430
- options: [t, e]
1431
- }), pn = (t, e) => ({
1432
- ...nn(t),
1433
- options: [t, e]
1434
- });
1435
- export {
1436
- le as D,
1437
- ln as a,
1438
- hn as b,
1439
- pn as c,
1440
- cn as d,
1441
- mn as f,
1442
- gn as h,
1443
- dn as l,
1444
- an as o,
1445
- un as s,
1446
- fn as u
1447
- };