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