@pdf-viewer/react 1.11.0-beta.0 → 1.11.0-beta.2

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