@alixpartners/ui-components 2.1.2 → 2.2.0

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