@spear-ai/spectral 1.3.10 → 1.3.11

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