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