mimir-ui-kit 1.38.1 → 1.38.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. package/dist/assets/SelectSearch.css +1 -1
  2. package/dist/{combobox-CVtJDVoZ.js → combobox-DgSZTriw.js} +254 -251
  3. package/dist/components/Accordion/Accordion.js +3 -3
  4. package/dist/components/CheckboxMimir/CheckboxMimir.js +4 -4
  5. package/dist/components/DatePicker/hooks.js +12 -12
  6. package/dist/components/Dropdown/Dropdown.js +32 -32
  7. package/dist/components/MultiSelectSearch/MultiSelectSearch.js +18 -18
  8. package/dist/components/RadioGroup/RadioGroup.js +3 -3
  9. package/dist/components/SelectSearch/SelectSearch.js +116 -116
  10. package/dist/components/Switcher/Switcher.js +4 -4
  11. package/dist/components/TabTrail/TabTrail.js +4 -4
  12. package/dist/components/UniversalUploader/UniversalUploader.js +56 -50
  13. package/dist/components/Uploader/Uploader.d.ts +12 -0
  14. package/dist/components/Uploader/Uploader.js +64 -59
  15. package/dist/components/UploaderFiles/UploaderFiles.d.ts +12 -0
  16. package/dist/components/UploaderFiles/UploaderFiles.js +45 -39
  17. package/dist/components/UploaderPhotos/UploaderPhotos.d.ts +12 -0
  18. package/dist/components/UploaderPhotos/UploaderPhotos.js +40 -34
  19. package/dist/{field-FJ34aSs4.js → field-C1kt7aNM.js} +2 -2
  20. package/dist/{focus-management-DE4t_lW3.js → focus-management-BtPpk3D1.js} +1 -1
  21. package/dist/{hidden-DbgtYPOH.js → hidden-PvGXrYUY.js} +1 -1
  22. package/dist/{keyboard-B0lm_zyn.js → keyboard-mgWkd2Vh.js} +114 -111
  23. package/dist/{label-y3ANLTNC.js → label-D4GFpe5F.js} +2 -2
  24. package/dist/open-closed-D2VjDhAN.js +86 -0
  25. package/dist/portal-DPqg52FR.js +1946 -0
  26. package/dist/{use-active-press-86hajhdd.js → use-active-press-CqLGIFz7.js} +1 -1
  27. package/package.json +1 -1
  28. package/dist/open-closed-CdldUPoq.js +0 -86
  29. package/dist/portal-WDFNoIMz.js +0 -1908
@@ -1,1908 +0,0 @@
1
- import * as v from "react";
2
- import He, { useReducer as $t, useMemo as _, useSyncExternalStore as Dt, useId as Ft, useEffect as Y, useCallback as st, useRef as oe, useLayoutEffect as ct, createContext as me, useContext as X, useState as te, Fragment as at } from "react";
3
- import { n as j, s as ge, d as Ne, u as Ht, o as ae, p as Nt, t as It, e as ce, W as Ie, y as We, T as Wt, H as ke } from "./keyboard-B0lm_zyn.js";
4
- import { A as kt, h as Vt } from "./focus-management-DE4t_lW3.js";
5
- import * as ue from "react-dom";
6
- import { createPortal as Bt } from "react-dom";
7
- function _t(e) {
8
- if (e === null) return { width: 0, height: 0 };
9
- let { width: t, height: o } = e.getBoundingClientRect();
10
- return { width: t, height: o };
11
- }
12
- function Oo(e, t = !1) {
13
- let [o, n] = $t(() => ({}), {}), r = _(() => _t(e), [e, o]);
14
- return j(() => {
15
- if (!e) return;
16
- let i = new ResizeObserver(n);
17
- return i.observe(e), () => {
18
- i.disconnect();
19
- };
20
- }, [e]), t ? { width: `${r.width}px`, height: `${r.height}px` } : r;
21
- }
22
- let Yt = class extends Map {
23
- constructor(t) {
24
- super(), this.factory = t;
25
- }
26
- get(t) {
27
- let o = super.get(t);
28
- return o === void 0 && (o = this.factory(t), this.set(t, o)), o;
29
- }
30
- };
31
- function ut(e, t) {
32
- let o = e(), n = /* @__PURE__ */ new Set();
33
- return { getSnapshot() {
34
- return o;
35
- }, subscribe(r) {
36
- return n.add(r), () => n.delete(r);
37
- }, dispatch(r, ...i) {
38
- let l = t[r].call(o, ...i);
39
- l && (o = l, n.forEach((c) => c()));
40
- } };
41
- }
42
- function ft(e) {
43
- return Dt(e.subscribe, e.getSnapshot, e.getSnapshot);
44
- }
45
- let jt = new Yt(() => ut(() => [], { ADD(e) {
46
- return this.includes(e) ? this : [...this, e];
47
- }, REMOVE(e) {
48
- let t = this.indexOf(e);
49
- if (t === -1) return this;
50
- let o = this.slice();
51
- return o.splice(t, 1), o;
52
- } }));
53
- function dt(e, t) {
54
- let o = jt.get(t), n = Ft(), r = ft(o);
55
- if (j(() => {
56
- if (e) return o.dispatch("ADD", n), () => o.dispatch("REMOVE", n);
57
- }, [o, e]), !e) return !1;
58
- let i = r.indexOf(n), l = r.length;
59
- return i === -1 && (i = l, l += 1), i === l - 1;
60
- }
61
- function Ao(e, t, o) {
62
- let n = ge((r) => {
63
- let i = r.getBoundingClientRect();
64
- i.x === 0 && i.y === 0 && i.width === 0 && i.height === 0 && o();
65
- });
66
- Y(() => {
67
- if (!e) return;
68
- let r = t === null ? null : t instanceof HTMLElement ? t : t.current;
69
- if (!r) return;
70
- let i = Ne();
71
- if (typeof ResizeObserver < "u") {
72
- let l = new ResizeObserver(() => n.current(r));
73
- l.observe(r), i.add(() => l.disconnect());
74
- }
75
- if (typeof IntersectionObserver < "u") {
76
- let l = new IntersectionObserver(() => n.current(r));
77
- l.observe(r), i.add(() => l.disconnect());
78
- }
79
- return () => i.dispose();
80
- }, [t, n, e]);
81
- }
82
- function mt() {
83
- return /iPhone/gi.test(window.navigator.platform) || /Mac/gi.test(window.navigator.platform) && window.navigator.maxTouchPoints > 0;
84
- }
85
- function zt() {
86
- return /Android/gi.test(window.navigator.userAgent);
87
- }
88
- function Ut() {
89
- return mt() || zt();
90
- }
91
- function se(e, t, o, n) {
92
- let r = ge(o);
93
- Y(() => {
94
- if (!e) return;
95
- function i(l) {
96
- r.current(l);
97
- }
98
- return document.addEventListener(t, i, n), () => document.removeEventListener(t, i, n);
99
- }, [e, t, n]);
100
- }
101
- function qt(e, t, o, n) {
102
- let r = ge(o);
103
- Y(() => {
104
- if (!e) return;
105
- function i(l) {
106
- r.current(l);
107
- }
108
- return window.addEventListener(t, i, n), () => window.removeEventListener(t, i, n);
109
- }, [e, t, n]);
110
- }
111
- const Ue = 30;
112
- function Po(e, t, o) {
113
- let n = dt(e, "outside-click"), r = ge(o), i = st(function(s, a) {
114
- if (s.defaultPrevented) return;
115
- let u = a(s);
116
- if (u === null || !u.getRootNode().contains(u) || !u.isConnected) return;
117
- let g = function h(f) {
118
- return typeof f == "function" ? h(f()) : Array.isArray(f) || f instanceof Set ? f : [f];
119
- }(t);
120
- for (let h of g) if (h !== null && (h.contains(u) || s.composed && s.composedPath().includes(h))) return;
121
- return !kt(u, Vt.Loose) && u.tabIndex !== -1 && s.preventDefault(), r.current(s, u);
122
- }, [r, t]), l = oe(null);
123
- se(n, "pointerdown", (s) => {
124
- var a, u;
125
- l.current = ((u = (a = s.composedPath) == null ? void 0 : a.call(s)) == null ? void 0 : u[0]) || s.target;
126
- }, !0), se(n, "mousedown", (s) => {
127
- var a, u;
128
- l.current = ((u = (a = s.composedPath) == null ? void 0 : a.call(s)) == null ? void 0 : u[0]) || s.target;
129
- }, !0), se(n, "click", (s) => {
130
- Ut() || l.current && (i(s, () => l.current), l.current = null);
131
- }, !0);
132
- let c = oe({ x: 0, y: 0 });
133
- se(n, "touchstart", (s) => {
134
- c.current.x = s.touches[0].clientX, c.current.y = s.touches[0].clientY;
135
- }, !0), se(n, "touchend", (s) => {
136
- let a = { x: s.changedTouches[0].clientX, y: s.changedTouches[0].clientY };
137
- if (!(Math.abs(a.x - c.current.x) >= Ue || Math.abs(a.y - c.current.y) >= Ue)) return i(s, () => s.target instanceof HTMLElement ? s.target : null);
138
- }, !0), qt(n, "blur", (s) => i(s, () => window.document.activeElement instanceof HTMLIFrameElement ? window.document.activeElement : null), !0);
139
- }
140
- function gt(...e) {
141
- return _(() => Ht(...e), [...e]);
142
- }
143
- function Mo(e, t, o, n) {
144
- let r = ge(o);
145
- Y(() => {
146
- e = e ?? window;
147
- function i(l) {
148
- r.current(l);
149
- }
150
- return e.addEventListener(t, i, n), () => e.removeEventListener(t, i, n);
151
- }, [e, t, n]);
152
- }
153
- function Xt() {
154
- let e;
155
- return { before({ doc: t }) {
156
- var o;
157
- let n = t.documentElement, r = (o = t.defaultView) != null ? o : window;
158
- e = Math.max(0, r.innerWidth - n.clientWidth);
159
- }, after({ doc: t, d: o }) {
160
- let n = t.documentElement, r = Math.max(0, n.clientWidth - n.offsetWidth), i = Math.max(0, e - r);
161
- o.style(n, "paddingRight", `${i}px`);
162
- } };
163
- }
164
- function Gt() {
165
- return mt() ? { before({ doc: e, d: t, meta: o }) {
166
- function n(r) {
167
- return o.containers.flatMap((i) => i()).some((i) => i.contains(r));
168
- }
169
- t.microTask(() => {
170
- var r;
171
- if (window.getComputedStyle(e.documentElement).scrollBehavior !== "auto") {
172
- let c = Ne();
173
- c.style(e.documentElement, "scrollBehavior", "auto"), t.add(() => t.microTask(() => c.dispose()));
174
- }
175
- let i = (r = window.scrollY) != null ? r : window.pageYOffset, l = null;
176
- t.addEventListener(e, "click", (c) => {
177
- if (c.target instanceof HTMLElement) try {
178
- let s = c.target.closest("a");
179
- if (!s) return;
180
- let { hash: a } = new URL(s.href), u = e.querySelector(a);
181
- u && !n(u) && (l = u);
182
- } catch {
183
- }
184
- }, !0), t.addEventListener(e, "touchstart", (c) => {
185
- if (c.target instanceof HTMLElement) if (n(c.target)) {
186
- let s = c.target;
187
- for (; s.parentElement && n(s.parentElement); ) s = s.parentElement;
188
- t.style(s, "overscrollBehavior", "contain");
189
- } else t.style(c.target, "touchAction", "none");
190
- }), t.addEventListener(e, "touchmove", (c) => {
191
- if (c.target instanceof HTMLElement) {
192
- if (c.target.tagName === "INPUT") return;
193
- if (n(c.target)) {
194
- let s = c.target;
195
- for (; s.parentElement && s.dataset.headlessuiPortal !== "" && !(s.scrollHeight > s.clientHeight || s.scrollWidth > s.clientWidth); ) s = s.parentElement;
196
- s.dataset.headlessuiPortal === "" && c.preventDefault();
197
- } else c.preventDefault();
198
- }
199
- }, { passive: !1 }), t.add(() => {
200
- var c;
201
- let s = (c = window.scrollY) != null ? c : window.pageYOffset;
202
- i !== s && window.scrollTo(0, i), l && l.isConnected && (l.scrollIntoView({ block: "nearest" }), l = null);
203
- });
204
- });
205
- } } : {};
206
- }
207
- function Kt() {
208
- return { before({ doc: e, d: t }) {
209
- t.style(e.documentElement, "overflow", "hidden");
210
- } };
211
- }
212
- function Jt(e) {
213
- let t = {};
214
- for (let o of e) Object.assign(t, o(t));
215
- return t;
216
- }
217
- let Q = ut(() => /* @__PURE__ */ new Map(), { PUSH(e, t) {
218
- var o;
219
- let n = (o = this.get(e)) != null ? o : { doc: e, count: 0, d: Ne(), meta: /* @__PURE__ */ new Set() };
220
- return n.count++, n.meta.add(t), this.set(e, n), this;
221
- }, POP(e, t) {
222
- let o = this.get(e);
223
- return o && (o.count--, o.meta.delete(t)), this;
224
- }, SCROLL_PREVENT({ doc: e, d: t, meta: o }) {
225
- let n = { doc: e, d: t, meta: Jt(o) }, r = [Gt(), Xt(), Kt()];
226
- r.forEach(({ before: i }) => i == null ? void 0 : i(n)), r.forEach(({ after: i }) => i == null ? void 0 : i(n));
227
- }, SCROLL_ALLOW({ d: e }) {
228
- e.dispose();
229
- }, TEARDOWN({ doc: e }) {
230
- this.delete(e);
231
- } });
232
- Q.subscribe(() => {
233
- let e = Q.getSnapshot(), t = /* @__PURE__ */ new Map();
234
- for (let [o] of e) t.set(o, o.documentElement.style.overflow);
235
- for (let o of e.values()) {
236
- let n = t.get(o.doc) === "hidden", r = o.count !== 0;
237
- (r && !n || !r && n) && Q.dispatch(o.count > 0 ? "SCROLL_PREVENT" : "SCROLL_ALLOW", o), o.count === 0 && Q.dispatch("TEARDOWN", o);
238
- }
239
- });
240
- function Qt(e, t, o = () => ({ containers: [] })) {
241
- let n = ft(Q), r = t ? n.get(t) : void 0, i = r ? r.count > 0 : !1;
242
- return j(() => {
243
- if (!(!t || !e)) return Q.dispatch("PUSH", t, o), () => Q.dispatch("POP", t, o);
244
- }, [e, t]), i;
245
- }
246
- function To(e, t, o = () => [document.body]) {
247
- let n = dt(e, "scroll-lock");
248
- Qt(n, t, (r) => {
249
- var i;
250
- return { containers: [...(i = r.containers) != null ? i : [], o] };
251
- });
252
- }
253
- function ie(e) {
254
- return ht(e) ? (e.nodeName || "").toLowerCase() : "#document";
255
- }
256
- function N(e) {
257
- var t;
258
- return (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) || window;
259
- }
260
- function z(e) {
261
- var t;
262
- return (t = (ht(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : t.documentElement;
263
- }
264
- function ht(e) {
265
- return e instanceof Node || e instanceof N(e).Node;
266
- }
267
- function M(e) {
268
- return e instanceof Element || e instanceof N(e).Element;
269
- }
270
- function B(e) {
271
- return e instanceof HTMLElement || e instanceof N(e).HTMLElement;
272
- }
273
- function qe(e) {
274
- return typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof N(e).ShadowRoot;
275
- }
276
- function he(e) {
277
- const {
278
- overflow: t,
279
- overflowX: o,
280
- overflowY: n,
281
- display: r
282
- } = V(e);
283
- return /auto|scroll|overlay|hidden|clip/.test(t + n + o) && !["inline", "contents"].includes(r);
284
- }
285
- function Zt(e) {
286
- return ["table", "td", "th"].includes(ie(e));
287
- }
288
- function Ce(e) {
289
- return [":popover-open", ":modal"].some((t) => {
290
- try {
291
- return e.matches(t);
292
- } catch {
293
- return !1;
294
- }
295
- });
296
- }
297
- function Ve(e) {
298
- const t = Be(), o = V(e);
299
- return o.transform !== "none" || o.perspective !== "none" || (o.containerType ? o.containerType !== "normal" : !1) || !t && (o.backdropFilter ? o.backdropFilter !== "none" : !1) || !t && (o.filter ? o.filter !== "none" : !1) || ["transform", "perspective", "filter"].some((n) => (o.willChange || "").includes(n)) || ["paint", "layout", "strict", "content"].some((n) => (o.contain || "").includes(n));
300
- }
301
- function en(e) {
302
- let t = G(e);
303
- for (; B(t) && !re(t); ) {
304
- if (Ce(t))
305
- return null;
306
- if (Ve(t))
307
- return t;
308
- t = G(t);
309
- }
310
- return null;
311
- }
312
- function Be() {
313
- return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
314
- }
315
- function re(e) {
316
- return ["html", "body", "#document"].includes(ie(e));
317
- }
318
- function V(e) {
319
- return N(e).getComputedStyle(e);
320
- }
321
- function Oe(e) {
322
- return M(e) ? {
323
- scrollLeft: e.scrollLeft,
324
- scrollTop: e.scrollTop
325
- } : {
326
- scrollLeft: e.scrollX,
327
- scrollTop: e.scrollY
328
- };
329
- }
330
- function G(e) {
331
- if (ie(e) === "html")
332
- return e;
333
- const t = (
334
- // Step into the shadow DOM of the parent of a slotted node.
335
- e.assignedSlot || // DOM Element detected.
336
- e.parentNode || // ShadowRoot detected.
337
- qe(e) && e.host || // Fallback.
338
- z(e)
339
- );
340
- return qe(t) ? t.host : t;
341
- }
342
- function pt(e) {
343
- const t = G(e);
344
- return re(t) ? e.ownerDocument ? e.ownerDocument.body : e.body : B(t) && he(t) ? t : pt(t);
345
- }
346
- function fe(e, t, o) {
347
- var n;
348
- t === void 0 && (t = []), o === void 0 && (o = !0);
349
- const r = pt(e), i = r === ((n = e.ownerDocument) == null ? void 0 : n.body), l = N(r);
350
- return i ? t.concat(l, l.visualViewport || [], he(r) ? r : [], l.frameElement && o ? fe(l.frameElement) : []) : t.concat(r, fe(r, [], o));
351
- }
352
- function tn() {
353
- const e = navigator.userAgentData;
354
- return e && Array.isArray(e.brands) ? e.brands.map((t) => {
355
- let {
356
- brand: o,
357
- version: n
358
- } = t;
359
- return o + "/" + n;
360
- }).join(" ") : navigator.userAgent;
361
- }
362
- const q = Math.min, H = Math.max, ye = Math.round, we = Math.floor, K = (e) => ({
363
- x: e,
364
- y: e
365
- }), nn = {
366
- left: "right",
367
- right: "left",
368
- bottom: "top",
369
- top: "bottom"
370
- }, on = {
371
- start: "end",
372
- end: "start"
373
- };
374
- function Xe(e, t, o) {
375
- return H(e, q(t, o));
376
- }
377
- function le(e, t) {
378
- return typeof e == "function" ? e(t) : e;
379
- }
380
- function J(e) {
381
- return e.split("-")[0];
382
- }
383
- function pe(e) {
384
- return e.split("-")[1];
385
- }
386
- function vt(e) {
387
- return e === "x" ? "y" : "x";
388
- }
389
- function wt(e) {
390
- return e === "y" ? "height" : "width";
391
- }
392
- function Z(e) {
393
- return ["top", "bottom"].includes(J(e)) ? "y" : "x";
394
- }
395
- function xt(e) {
396
- return vt(Z(e));
397
- }
398
- function rn(e, t, o) {
399
- o === void 0 && (o = !1);
400
- const n = pe(e), r = xt(e), i = wt(r);
401
- let l = r === "x" ? n === (o ? "end" : "start") ? "right" : "left" : n === "start" ? "bottom" : "top";
402
- return t.reference[i] > t.floating[i] && (l = be(l)), [l, be(l)];
403
- }
404
- function ln(e) {
405
- const t = be(e);
406
- return [$e(e), t, $e(t)];
407
- }
408
- function $e(e) {
409
- return e.replace(/start|end/g, (t) => on[t]);
410
- }
411
- function sn(e, t, o) {
412
- const n = ["left", "right"], r = ["right", "left"], i = ["top", "bottom"], l = ["bottom", "top"];
413
- switch (e) {
414
- case "top":
415
- case "bottom":
416
- return o ? t ? r : n : t ? n : r;
417
- case "left":
418
- case "right":
419
- return t ? i : l;
420
- default:
421
- return [];
422
- }
423
- }
424
- function cn(e, t, o, n) {
425
- const r = pe(e);
426
- let i = sn(J(e), o === "start", n);
427
- return r && (i = i.map((l) => l + "-" + r), t && (i = i.concat(i.map($e)))), i;
428
- }
429
- function be(e) {
430
- return e.replace(/left|right|bottom|top/g, (t) => nn[t]);
431
- }
432
- function an(e) {
433
- return {
434
- top: 0,
435
- right: 0,
436
- bottom: 0,
437
- left: 0,
438
- ...e
439
- };
440
- }
441
- function un(e) {
442
- return typeof e != "number" ? an(e) : {
443
- top: e,
444
- right: e,
445
- bottom: e,
446
- left: e
447
- };
448
- }
449
- function Re(e) {
450
- const {
451
- x: t,
452
- y: o,
453
- width: n,
454
- height: r
455
- } = e;
456
- return {
457
- width: n,
458
- height: r,
459
- top: o,
460
- left: t,
461
- right: t + n,
462
- bottom: o + r,
463
- x: t,
464
- y: o
465
- };
466
- }
467
- function Ge(e, t, o) {
468
- let {
469
- reference: n,
470
- floating: r
471
- } = e;
472
- const i = Z(t), l = xt(t), c = wt(l), s = J(t), a = i === "y", u = n.x + n.width / 2 - r.width / 2, g = n.y + n.height / 2 - r.height / 2, h = n[c] / 2 - r[c] / 2;
473
- let f;
474
- switch (s) {
475
- case "top":
476
- f = {
477
- x: u,
478
- y: n.y - r.height
479
- };
480
- break;
481
- case "bottom":
482
- f = {
483
- x: u,
484
- y: n.y + n.height
485
- };
486
- break;
487
- case "right":
488
- f = {
489
- x: n.x + n.width,
490
- y: g
491
- };
492
- break;
493
- case "left":
494
- f = {
495
- x: n.x - r.width,
496
- y: g
497
- };
498
- break;
499
- default:
500
- f = {
501
- x: n.x,
502
- y: n.y
503
- };
504
- }
505
- switch (pe(t)) {
506
- case "start":
507
- f[l] -= h * (o && a ? -1 : 1);
508
- break;
509
- case "end":
510
- f[l] += h * (o && a ? -1 : 1);
511
- break;
512
- }
513
- return f;
514
- }
515
- const fn = async (e, t, o) => {
516
- const {
517
- placement: n = "bottom",
518
- strategy: r = "absolute",
519
- middleware: i = [],
520
- platform: l
521
- } = o, c = i.filter(Boolean), s = await (l.isRTL == null ? void 0 : l.isRTL(t));
522
- let a = await l.getElementRects({
523
- reference: e,
524
- floating: t,
525
- strategy: r
526
- }), {
527
- x: u,
528
- y: g
529
- } = Ge(a, n, s), h = n, f = {}, d = 0;
530
- for (let m = 0; m < c.length; m++) {
531
- const {
532
- name: p,
533
- fn: x
534
- } = c[m], {
535
- x: y,
536
- y: w,
537
- data: b,
538
- reset: R
539
- } = await x({
540
- x: u,
541
- y: g,
542
- initialPlacement: n,
543
- placement: h,
544
- strategy: r,
545
- middlewareData: f,
546
- rects: a,
547
- platform: l,
548
- elements: {
549
- reference: e,
550
- floating: t
551
- }
552
- });
553
- u = y ?? u, g = w ?? g, f = {
554
- ...f,
555
- [p]: {
556
- ...f[p],
557
- ...b
558
- }
559
- }, R && d <= 50 && (d++, typeof R == "object" && (R.placement && (h = R.placement), R.rects && (a = R.rects === !0 ? await l.getElementRects({
560
- reference: e,
561
- floating: t,
562
- strategy: r
563
- }) : R.rects), {
564
- x: u,
565
- y: g
566
- } = Ge(a, h, s)), m = -1);
567
- }
568
- return {
569
- x: u,
570
- y: g,
571
- placement: h,
572
- strategy: r,
573
- middlewareData: f
574
- };
575
- };
576
- async function Se(e, t) {
577
- var o;
578
- t === void 0 && (t = {});
579
- const {
580
- x: n,
581
- y: r,
582
- platform: i,
583
- rects: l,
584
- elements: c,
585
- strategy: s
586
- } = e, {
587
- boundary: a = "clippingAncestors",
588
- rootBoundary: u = "viewport",
589
- elementContext: g = "floating",
590
- altBoundary: h = !1,
591
- padding: f = 0
592
- } = le(t, e), d = un(f), p = c[h ? g === "floating" ? "reference" : "floating" : g], x = Re(await i.getClippingRect({
593
- element: (o = await (i.isElement == null ? void 0 : i.isElement(p))) == null || o ? p : p.contextElement || await (i.getDocumentElement == null ? void 0 : i.getDocumentElement(c.floating)),
594
- boundary: a,
595
- rootBoundary: u,
596
- strategy: s
597
- })), y = g === "floating" ? {
598
- x: n,
599
- y: r,
600
- width: l.floating.width,
601
- height: l.floating.height
602
- } : l.reference, w = await (i.getOffsetParent == null ? void 0 : i.getOffsetParent(c.floating)), b = await (i.isElement == null ? void 0 : i.isElement(w)) ? await (i.getScale == null ? void 0 : i.getScale(w)) || {
603
- x: 1,
604
- y: 1
605
- } : {
606
- x: 1,
607
- y: 1
608
- }, R = Re(i.convertOffsetParentRelativeRectToViewportRelativeRect ? await i.convertOffsetParentRelativeRectToViewportRelativeRect({
609
- elements: c,
610
- rect: y,
611
- offsetParent: w,
612
- strategy: s
613
- }) : y);
614
- return {
615
- top: (x.top - R.top + d.top) / b.y,
616
- bottom: (R.bottom - x.bottom + d.bottom) / b.y,
617
- left: (x.left - R.left + d.left) / b.x,
618
- right: (R.right - x.right + d.right) / b.x
619
- };
620
- }
621
- const dn = function(e) {
622
- return e === void 0 && (e = {}), {
623
- name: "flip",
624
- options: e,
625
- async fn(t) {
626
- var o, n;
627
- const {
628
- placement: r,
629
- middlewareData: i,
630
- rects: l,
631
- initialPlacement: c,
632
- platform: s,
633
- elements: a
634
- } = t, {
635
- mainAxis: u = !0,
636
- crossAxis: g = !0,
637
- fallbackPlacements: h,
638
- fallbackStrategy: f = "bestFit",
639
- fallbackAxisSideDirection: d = "none",
640
- flipAlignment: m = !0,
641
- ...p
642
- } = le(e, t);
643
- if ((o = i.arrow) != null && o.alignmentOffset)
644
- return {};
645
- const x = J(r), y = Z(c), w = J(c) === c, b = await (s.isRTL == null ? void 0 : s.isRTL(a.floating)), R = h || (w || !m ? [be(c)] : ln(c)), O = d !== "none";
646
- !h && O && R.push(...cn(c, m, d, b));
647
- const L = [c, ...R], $ = await Se(t, p), W = [];
648
- let T = ((n = i.flip) == null ? void 0 : n.overflows) || [];
649
- if (u && W.push($[x]), g) {
650
- const A = rn(r, l, b);
651
- W.push($[A[0]], $[A[1]]);
652
- }
653
- if (T = [...T, {
654
- placement: r,
655
- overflows: W
656
- }], !W.every((A) => A <= 0)) {
657
- var S, D;
658
- const A = (((S = i.flip) == null ? void 0 : S.index) || 0) + 1, F = L[A];
659
- if (F)
660
- return {
661
- data: {
662
- index: A,
663
- overflows: T
664
- },
665
- reset: {
666
- placement: F
667
- }
668
- };
669
- let I = (D = T.filter((E) => E.overflows[0] <= 0).sort((E, P) => E.overflows[1] - P.overflows[1])[0]) == null ? void 0 : D.placement;
670
- if (!I)
671
- switch (f) {
672
- case "bestFit": {
673
- var k;
674
- const E = (k = T.filter((P) => {
675
- if (O) {
676
- const C = Z(P.placement);
677
- return C === y || // Create a bias to the `y` side axis due to horizontal
678
- // reading directions favoring greater width.
679
- C === "y";
680
- }
681
- return !0;
682
- }).map((P) => [P.placement, P.overflows.filter((C) => C > 0).reduce((C, U) => C + U, 0)]).sort((P, C) => P[1] - C[1])[0]) == null ? void 0 : k[0];
683
- E && (I = E);
684
- break;
685
- }
686
- case "initialPlacement":
687
- I = c;
688
- break;
689
- }
690
- if (r !== I)
691
- return {
692
- reset: {
693
- placement: I
694
- }
695
- };
696
- }
697
- return {};
698
- }
699
- };
700
- };
701
- async function mn(e, t) {
702
- const {
703
- placement: o,
704
- platform: n,
705
- elements: r
706
- } = e, i = await (n.isRTL == null ? void 0 : n.isRTL(r.floating)), l = J(o), c = pe(o), s = Z(o) === "y", a = ["left", "top"].includes(l) ? -1 : 1, u = i && s ? -1 : 1, g = le(t, e);
707
- let {
708
- mainAxis: h,
709
- crossAxis: f,
710
- alignmentAxis: d
711
- } = typeof g == "number" ? {
712
- mainAxis: g,
713
- crossAxis: 0,
714
- alignmentAxis: null
715
- } : {
716
- mainAxis: 0,
717
- crossAxis: 0,
718
- alignmentAxis: null,
719
- ...g
720
- };
721
- return c && typeof d == "number" && (f = c === "end" ? d * -1 : d), s ? {
722
- x: f * u,
723
- y: h * a
724
- } : {
725
- x: h * a,
726
- y: f * u
727
- };
728
- }
729
- const gn = function(e) {
730
- return e === void 0 && (e = 0), {
731
- name: "offset",
732
- options: e,
733
- async fn(t) {
734
- var o, n;
735
- const {
736
- x: r,
737
- y: i,
738
- placement: l,
739
- middlewareData: c
740
- } = t, s = await mn(t, e);
741
- return l === ((o = c.offset) == null ? void 0 : o.placement) && (n = c.arrow) != null && n.alignmentOffset ? {} : {
742
- x: r + s.x,
743
- y: i + s.y,
744
- data: {
745
- ...s,
746
- placement: l
747
- }
748
- };
749
- }
750
- };
751
- }, hn = function(e) {
752
- return e === void 0 && (e = {}), {
753
- name: "shift",
754
- options: e,
755
- async fn(t) {
756
- const {
757
- x: o,
758
- y: n,
759
- placement: r
760
- } = t, {
761
- mainAxis: i = !0,
762
- crossAxis: l = !1,
763
- limiter: c = {
764
- fn: (p) => {
765
- let {
766
- x,
767
- y
768
- } = p;
769
- return {
770
- x,
771
- y
772
- };
773
- }
774
- },
775
- ...s
776
- } = le(e, t), a = {
777
- x: o,
778
- y: n
779
- }, u = await Se(t, s), g = Z(J(r)), h = vt(g);
780
- let f = a[h], d = a[g];
781
- if (i) {
782
- const p = h === "y" ? "top" : "left", x = h === "y" ? "bottom" : "right", y = f + u[p], w = f - u[x];
783
- f = Xe(y, f, w);
784
- }
785
- if (l) {
786
- const p = g === "y" ? "top" : "left", x = g === "y" ? "bottom" : "right", y = d + u[p], w = d - u[x];
787
- d = Xe(y, d, w);
788
- }
789
- const m = c.fn({
790
- ...t,
791
- [h]: f,
792
- [g]: d
793
- });
794
- return {
795
- ...m,
796
- data: {
797
- x: m.x - o,
798
- y: m.y - n
799
- }
800
- };
801
- }
802
- };
803
- }, pn = function(e) {
804
- return e === void 0 && (e = {}), {
805
- name: "size",
806
- options: e,
807
- async fn(t) {
808
- const {
809
- placement: o,
810
- rects: n,
811
- platform: r,
812
- elements: i
813
- } = t, {
814
- apply: l = () => {
815
- },
816
- ...c
817
- } = le(e, t), s = await Se(t, c), a = J(o), u = pe(o), g = Z(o) === "y", {
818
- width: h,
819
- height: f
820
- } = n.floating;
821
- let d, m;
822
- a === "top" || a === "bottom" ? (d = a, m = u === (await (r.isRTL == null ? void 0 : r.isRTL(i.floating)) ? "start" : "end") ? "left" : "right") : (m = a, d = u === "end" ? "top" : "bottom");
823
- const p = f - s.top - s.bottom, x = h - s.left - s.right, y = q(f - s[d], p), w = q(h - s[m], x), b = !t.middlewareData.shift;
824
- let R = y, O = w;
825
- if (g ? O = u || b ? q(w, x) : x : R = u || b ? q(y, p) : p, b && !u) {
826
- const $ = H(s.left, 0), W = H(s.right, 0), T = H(s.top, 0), S = H(s.bottom, 0);
827
- g ? O = h - 2 * ($ !== 0 || W !== 0 ? $ + W : H(s.left, s.right)) : R = f - 2 * (T !== 0 || S !== 0 ? T + S : H(s.top, s.bottom));
828
- }
829
- await l({
830
- ...t,
831
- availableWidth: O,
832
- availableHeight: R
833
- });
834
- const L = await r.getDimensions(i.floating);
835
- return h !== L.width || f !== L.height ? {
836
- reset: {
837
- rects: !0
838
- }
839
- } : {};
840
- }
841
- };
842
- };
843
- function yt(e) {
844
- const t = V(e);
845
- let o = parseFloat(t.width) || 0, n = parseFloat(t.height) || 0;
846
- const r = B(e), i = r ? e.offsetWidth : o, l = r ? e.offsetHeight : n, c = ye(o) !== i || ye(n) !== l;
847
- return c && (o = i, n = l), {
848
- width: o,
849
- height: n,
850
- $: c
851
- };
852
- }
853
- function _e(e) {
854
- return M(e) ? e : e.contextElement;
855
- }
856
- function ne(e) {
857
- const t = _e(e);
858
- if (!B(t))
859
- return K(1);
860
- const o = t.getBoundingClientRect(), {
861
- width: n,
862
- height: r,
863
- $: i
864
- } = yt(t);
865
- let l = (i ? ye(o.width) : o.width) / n, c = (i ? ye(o.height) : o.height) / r;
866
- return (!l || !Number.isFinite(l)) && (l = 1), (!c || !Number.isFinite(c)) && (c = 1), {
867
- x: l,
868
- y: c
869
- };
870
- }
871
- const vn = /* @__PURE__ */ K(0);
872
- function bt(e) {
873
- const t = N(e);
874
- return !Be() || !t.visualViewport ? vn : {
875
- x: t.visualViewport.offsetLeft,
876
- y: t.visualViewport.offsetTop
877
- };
878
- }
879
- function wn(e, t, o) {
880
- return t === void 0 && (t = !1), !o || t && o !== N(e) ? !1 : t;
881
- }
882
- function ee(e, t, o, n) {
883
- t === void 0 && (t = !1), o === void 0 && (o = !1);
884
- const r = e.getBoundingClientRect(), i = _e(e);
885
- let l = K(1);
886
- t && (n ? M(n) && (l = ne(n)) : l = ne(e));
887
- const c = wn(i, o, n) ? bt(i) : K(0);
888
- let s = (r.left + c.x) / l.x, a = (r.top + c.y) / l.y, u = r.width / l.x, g = r.height / l.y;
889
- if (i) {
890
- const h = N(i), f = n && M(n) ? N(n) : n;
891
- let d = h, m = d.frameElement;
892
- for (; m && n && f !== d; ) {
893
- const p = ne(m), x = m.getBoundingClientRect(), y = V(m), w = x.left + (m.clientLeft + parseFloat(y.paddingLeft)) * p.x, b = x.top + (m.clientTop + parseFloat(y.paddingTop)) * p.y;
894
- s *= p.x, a *= p.y, u *= p.x, g *= p.y, s += w, a += b, d = N(m), m = d.frameElement;
895
- }
896
- }
897
- return Re({
898
- width: u,
899
- height: g,
900
- x: s,
901
- y: a
902
- });
903
- }
904
- function xn(e) {
905
- let {
906
- elements: t,
907
- rect: o,
908
- offsetParent: n,
909
- strategy: r
910
- } = e;
911
- const i = r === "fixed", l = z(n), c = t ? Ce(t.floating) : !1;
912
- if (n === l || c && i)
913
- return o;
914
- let s = {
915
- scrollLeft: 0,
916
- scrollTop: 0
917
- }, a = K(1);
918
- const u = K(0), g = B(n);
919
- if ((g || !g && !i) && ((ie(n) !== "body" || he(l)) && (s = Oe(n)), B(n))) {
920
- const h = ee(n);
921
- a = ne(n), u.x = h.x + n.clientLeft, u.y = h.y + n.clientTop;
922
- }
923
- return {
924
- width: o.width * a.x,
925
- height: o.height * a.y,
926
- x: o.x * a.x - s.scrollLeft * a.x + u.x,
927
- y: o.y * a.y - s.scrollTop * a.y + u.y
928
- };
929
- }
930
- function yn(e) {
931
- return Array.from(e.getClientRects());
932
- }
933
- function Rt(e) {
934
- return ee(z(e)).left + Oe(e).scrollLeft;
935
- }
936
- function bn(e) {
937
- const t = z(e), o = Oe(e), n = e.ownerDocument.body, r = H(t.scrollWidth, t.clientWidth, n.scrollWidth, n.clientWidth), i = H(t.scrollHeight, t.clientHeight, n.scrollHeight, n.clientHeight);
938
- let l = -o.scrollLeft + Rt(e);
939
- const c = -o.scrollTop;
940
- return V(n).direction === "rtl" && (l += H(t.clientWidth, n.clientWidth) - r), {
941
- width: r,
942
- height: i,
943
- x: l,
944
- y: c
945
- };
946
- }
947
- function Rn(e, t) {
948
- const o = N(e), n = z(e), r = o.visualViewport;
949
- let i = n.clientWidth, l = n.clientHeight, c = 0, s = 0;
950
- if (r) {
951
- i = r.width, l = r.height;
952
- const a = Be();
953
- (!a || a && t === "fixed") && (c = r.offsetLeft, s = r.offsetTop);
954
- }
955
- return {
956
- width: i,
957
- height: l,
958
- x: c,
959
- y: s
960
- };
961
- }
962
- function En(e, t) {
963
- const o = ee(e, !0, t === "fixed"), n = o.top + e.clientTop, r = o.left + e.clientLeft, i = B(e) ? ne(e) : K(1), l = e.clientWidth * i.x, c = e.clientHeight * i.y, s = r * i.x, a = n * i.y;
964
- return {
965
- width: l,
966
- height: c,
967
- x: s,
968
- y: a
969
- };
970
- }
971
- function Ke(e, t, o) {
972
- let n;
973
- if (t === "viewport")
974
- n = Rn(e, o);
975
- else if (t === "document")
976
- n = bn(z(e));
977
- else if (M(t))
978
- n = En(t, o);
979
- else {
980
- const r = bt(e);
981
- n = {
982
- ...t,
983
- x: t.x - r.x,
984
- y: t.y - r.y
985
- };
986
- }
987
- return Re(n);
988
- }
989
- function Et(e, t) {
990
- const o = G(e);
991
- return o === t || !M(o) || re(o) ? !1 : V(o).position === "fixed" || Et(o, t);
992
- }
993
- function Cn(e, t) {
994
- const o = t.get(e);
995
- if (o)
996
- return o;
997
- let n = fe(e, [], !1).filter((c) => M(c) && ie(c) !== "body"), r = null;
998
- const i = V(e).position === "fixed";
999
- let l = i ? G(e) : e;
1000
- for (; M(l) && !re(l); ) {
1001
- const c = V(l), s = Ve(l);
1002
- !s && c.position === "fixed" && (r = null), (i ? !s && !r : !s && c.position === "static" && !!r && ["absolute", "fixed"].includes(r.position) || he(l) && !s && Et(e, l)) ? n = n.filter((u) => u !== l) : r = c, l = G(l);
1003
- }
1004
- return t.set(e, n), n;
1005
- }
1006
- function On(e) {
1007
- let {
1008
- element: t,
1009
- boundary: o,
1010
- rootBoundary: n,
1011
- strategy: r
1012
- } = e;
1013
- const l = [...o === "clippingAncestors" ? Ce(t) ? [] : Cn(t, this._c) : [].concat(o), n], c = l[0], s = l.reduce((a, u) => {
1014
- const g = Ke(t, u, r);
1015
- return a.top = H(g.top, a.top), a.right = q(g.right, a.right), a.bottom = q(g.bottom, a.bottom), a.left = H(g.left, a.left), a;
1016
- }, Ke(t, c, r));
1017
- return {
1018
- width: s.right - s.left,
1019
- height: s.bottom - s.top,
1020
- x: s.left,
1021
- y: s.top
1022
- };
1023
- }
1024
- function Sn(e) {
1025
- const {
1026
- width: t,
1027
- height: o
1028
- } = yt(e);
1029
- return {
1030
- width: t,
1031
- height: o
1032
- };
1033
- }
1034
- function An(e, t, o) {
1035
- const n = B(t), r = z(t), i = o === "fixed", l = ee(e, !0, i, t);
1036
- let c = {
1037
- scrollLeft: 0,
1038
- scrollTop: 0
1039
- };
1040
- const s = K(0);
1041
- if (n || !n && !i)
1042
- if ((ie(t) !== "body" || he(r)) && (c = Oe(t)), n) {
1043
- const g = ee(t, !0, i, t);
1044
- s.x = g.x + t.clientLeft, s.y = g.y + t.clientTop;
1045
- } else r && (s.x = Rt(r));
1046
- const a = l.left + c.scrollLeft - s.x, u = l.top + c.scrollTop - s.y;
1047
- return {
1048
- x: a,
1049
- y: u,
1050
- width: l.width,
1051
- height: l.height
1052
- };
1053
- }
1054
- function Pe(e) {
1055
- return V(e).position === "static";
1056
- }
1057
- function Je(e, t) {
1058
- return !B(e) || V(e).position === "fixed" ? null : t ? t(e) : e.offsetParent;
1059
- }
1060
- function Ct(e, t) {
1061
- const o = N(e);
1062
- if (Ce(e))
1063
- return o;
1064
- if (!B(e)) {
1065
- let r = G(e);
1066
- for (; r && !re(r); ) {
1067
- if (M(r) && !Pe(r))
1068
- return r;
1069
- r = G(r);
1070
- }
1071
- return o;
1072
- }
1073
- let n = Je(e, t);
1074
- for (; n && Zt(n) && Pe(n); )
1075
- n = Je(n, t);
1076
- return n && re(n) && Pe(n) && !Ve(n) ? o : n || en(e) || o;
1077
- }
1078
- const Pn = async function(e) {
1079
- const t = this.getOffsetParent || Ct, o = this.getDimensions, n = await o(e.floating);
1080
- return {
1081
- reference: An(e.reference, await t(e.floating), e.strategy),
1082
- floating: {
1083
- x: 0,
1084
- y: 0,
1085
- width: n.width,
1086
- height: n.height
1087
- }
1088
- };
1089
- };
1090
- function Mn(e) {
1091
- return V(e).direction === "rtl";
1092
- }
1093
- const Tn = {
1094
- convertOffsetParentRelativeRectToViewportRelativeRect: xn,
1095
- getDocumentElement: z,
1096
- getClippingRect: On,
1097
- getOffsetParent: Ct,
1098
- getElementRects: Pn,
1099
- getClientRects: yn,
1100
- getDimensions: Sn,
1101
- getScale: ne,
1102
- isElement: M,
1103
- isRTL: Mn
1104
- };
1105
- function Ln(e, t) {
1106
- let o = null, n;
1107
- const r = z(e);
1108
- function i() {
1109
- var c;
1110
- clearTimeout(n), (c = o) == null || c.disconnect(), o = null;
1111
- }
1112
- function l(c, s) {
1113
- c === void 0 && (c = !1), s === void 0 && (s = 1), i();
1114
- const {
1115
- left: a,
1116
- top: u,
1117
- width: g,
1118
- height: h
1119
- } = e.getBoundingClientRect();
1120
- if (c || t(), !g || !h)
1121
- return;
1122
- const f = we(u), d = we(r.clientWidth - (a + g)), m = we(r.clientHeight - (u + h)), p = we(a), y = {
1123
- rootMargin: -f + "px " + -d + "px " + -m + "px " + -p + "px",
1124
- threshold: H(0, q(1, s)) || 1
1125
- };
1126
- let w = !0;
1127
- function b(R) {
1128
- const O = R[0].intersectionRatio;
1129
- if (O !== s) {
1130
- if (!w)
1131
- return l();
1132
- O ? l(!1, O) : n = setTimeout(() => {
1133
- l(!1, 1e-7);
1134
- }, 1e3);
1135
- }
1136
- w = !1;
1137
- }
1138
- try {
1139
- o = new IntersectionObserver(b, {
1140
- ...y,
1141
- // Handle <iframe>s
1142
- root: r.ownerDocument
1143
- });
1144
- } catch {
1145
- o = new IntersectionObserver(b, y);
1146
- }
1147
- o.observe(e);
1148
- }
1149
- return l(!0), i;
1150
- }
1151
- function $n(e, t, o, n) {
1152
- n === void 0 && (n = {});
1153
- const {
1154
- ancestorScroll: r = !0,
1155
- ancestorResize: i = !0,
1156
- elementResize: l = typeof ResizeObserver == "function",
1157
- layoutShift: c = typeof IntersectionObserver == "function",
1158
- animationFrame: s = !1
1159
- } = n, a = _e(e), u = r || i ? [...a ? fe(a) : [], ...fe(t)] : [];
1160
- u.forEach((x) => {
1161
- r && x.addEventListener("scroll", o, {
1162
- passive: !0
1163
- }), i && x.addEventListener("resize", o);
1164
- });
1165
- const g = a && c ? Ln(a, o) : null;
1166
- let h = -1, f = null;
1167
- l && (f = new ResizeObserver((x) => {
1168
- let [y] = x;
1169
- y && y.target === a && f && (f.unobserve(t), cancelAnimationFrame(h), h = requestAnimationFrame(() => {
1170
- var w;
1171
- (w = f) == null || w.observe(t);
1172
- })), o();
1173
- }), a && !s && f.observe(a), f.observe(t));
1174
- let d, m = s ? ee(e) : null;
1175
- s && p();
1176
- function p() {
1177
- const x = ee(e);
1178
- m && (x.x !== m.x || x.y !== m.y || x.width !== m.width || x.height !== m.height) && o(), m = x, d = requestAnimationFrame(p);
1179
- }
1180
- return o(), () => {
1181
- var x;
1182
- u.forEach((y) => {
1183
- r && y.removeEventListener("scroll", o), i && y.removeEventListener("resize", o);
1184
- }), g == null || g(), (x = f) == null || x.disconnect(), f = null, s && cancelAnimationFrame(d);
1185
- };
1186
- }
1187
- const Me = Se, Dn = gn, Fn = hn, Hn = dn, Nn = pn, In = (e, t, o) => {
1188
- const n = /* @__PURE__ */ new Map(), r = {
1189
- platform: Tn,
1190
- ...o
1191
- }, i = {
1192
- ...r.platform,
1193
- _c: n
1194
- };
1195
- return fn(e, t, {
1196
- ...r,
1197
- platform: i
1198
- });
1199
- };
1200
- var xe = typeof document < "u" ? ct : Y;
1201
- function Ee(e, t) {
1202
- if (e === t)
1203
- return !0;
1204
- if (typeof e != typeof t)
1205
- return !1;
1206
- if (typeof e == "function" && e.toString() === t.toString())
1207
- return !0;
1208
- let o, n, r;
1209
- if (e && t && typeof e == "object") {
1210
- if (Array.isArray(e)) {
1211
- if (o = e.length, o !== t.length) return !1;
1212
- for (n = o; n-- !== 0; )
1213
- if (!Ee(e[n], t[n]))
1214
- return !1;
1215
- return !0;
1216
- }
1217
- if (r = Object.keys(e), o = r.length, o !== Object.keys(t).length)
1218
- return !1;
1219
- for (n = o; n-- !== 0; )
1220
- if (!{}.hasOwnProperty.call(t, r[n]))
1221
- return !1;
1222
- for (n = o; n-- !== 0; ) {
1223
- const i = r[n];
1224
- if (!(i === "_owner" && e.$$typeof) && !Ee(e[i], t[i]))
1225
- return !1;
1226
- }
1227
- return !0;
1228
- }
1229
- return e !== e && t !== t;
1230
- }
1231
- function Ot(e) {
1232
- return typeof window > "u" ? 1 : (e.ownerDocument.defaultView || window).devicePixelRatio || 1;
1233
- }
1234
- function Qe(e, t) {
1235
- const o = Ot(e);
1236
- return Math.round(t * o) / o;
1237
- }
1238
- function Ze(e) {
1239
- const t = v.useRef(e);
1240
- return xe(() => {
1241
- t.current = e;
1242
- }), t;
1243
- }
1244
- function Wn(e) {
1245
- e === void 0 && (e = {});
1246
- const {
1247
- placement: t = "bottom",
1248
- strategy: o = "absolute",
1249
- middleware: n = [],
1250
- platform: r,
1251
- elements: {
1252
- reference: i,
1253
- floating: l
1254
- } = {},
1255
- transform: c = !0,
1256
- whileElementsMounted: s,
1257
- open: a
1258
- } = e, [u, g] = v.useState({
1259
- x: 0,
1260
- y: 0,
1261
- strategy: o,
1262
- placement: t,
1263
- middlewareData: {},
1264
- isPositioned: !1
1265
- }), [h, f] = v.useState(n);
1266
- Ee(h, n) || f(n);
1267
- const [d, m] = v.useState(null), [p, x] = v.useState(null), y = v.useCallback((E) => {
1268
- E !== O.current && (O.current = E, m(E));
1269
- }, []), w = v.useCallback((E) => {
1270
- E !== L.current && (L.current = E, x(E));
1271
- }, []), b = i || d, R = l || p, O = v.useRef(null), L = v.useRef(null), $ = v.useRef(u), W = s != null, T = Ze(s), S = Ze(r), D = v.useCallback(() => {
1272
- if (!O.current || !L.current)
1273
- return;
1274
- const E = {
1275
- placement: t,
1276
- strategy: o,
1277
- middleware: h
1278
- };
1279
- S.current && (E.platform = S.current), In(O.current, L.current, E).then((P) => {
1280
- const C = {
1281
- ...P,
1282
- isPositioned: !0
1283
- };
1284
- k.current && !Ee($.current, C) && ($.current = C, ue.flushSync(() => {
1285
- g(C);
1286
- }));
1287
- });
1288
- }, [h, t, o, S]);
1289
- xe(() => {
1290
- a === !1 && $.current.isPositioned && ($.current.isPositioned = !1, g((E) => ({
1291
- ...E,
1292
- isPositioned: !1
1293
- })));
1294
- }, [a]);
1295
- const k = v.useRef(!1);
1296
- xe(() => (k.current = !0, () => {
1297
- k.current = !1;
1298
- }), []), xe(() => {
1299
- if (b && (O.current = b), R && (L.current = R), b && R) {
1300
- if (T.current)
1301
- return T.current(b, R, D);
1302
- D();
1303
- }
1304
- }, [b, R, D, T, W]);
1305
- const A = v.useMemo(() => ({
1306
- reference: O,
1307
- floating: L,
1308
- setReference: y,
1309
- setFloating: w
1310
- }), [y, w]), F = v.useMemo(() => ({
1311
- reference: b,
1312
- floating: R
1313
- }), [b, R]), I = v.useMemo(() => {
1314
- const E = {
1315
- position: o,
1316
- left: 0,
1317
- top: 0
1318
- };
1319
- if (!F.floating)
1320
- return E;
1321
- const P = Qe(F.floating, u.x), C = Qe(F.floating, u.y);
1322
- return c ? {
1323
- ...E,
1324
- transform: "translate(" + P + "px, " + C + "px)",
1325
- ...Ot(F.floating) >= 1.5 && {
1326
- willChange: "transform"
1327
- }
1328
- } : {
1329
- position: o,
1330
- left: P,
1331
- top: C
1332
- };
1333
- }, [o, c, F.floating, u.x, u.y]);
1334
- return v.useMemo(() => ({
1335
- ...u,
1336
- update: D,
1337
- refs: A,
1338
- elements: F,
1339
- floatingStyles: I
1340
- }), [u, D, A, F, I]);
1341
- }
1342
- const St = (e, t) => ({
1343
- ...Dn(e),
1344
- options: [e, t]
1345
- }), kn = (e, t) => ({
1346
- ...Fn(e),
1347
- options: [e, t]
1348
- }), Vn = (e, t) => ({
1349
- ...Hn(e),
1350
- options: [e, t]
1351
- }), Bn = (e, t) => ({
1352
- ...Nn(e),
1353
- options: [e, t]
1354
- }), At = {
1355
- ...v
1356
- }, _n = At.useInsertionEffect, Yn = _n || ((e) => e());
1357
- function Pt(e) {
1358
- const t = v.useRef(() => {
1359
- if (process.env.NODE_ENV !== "production")
1360
- throw new Error("Cannot call an event handler while rendering.");
1361
- });
1362
- return Yn(() => {
1363
- t.current = e;
1364
- }), v.useCallback(function() {
1365
- for (var o = arguments.length, n = new Array(o), r = 0; r < o; r++)
1366
- n[r] = arguments[r];
1367
- return t.current == null ? void 0 : t.current(...n);
1368
- }, []);
1369
- }
1370
- var De = typeof document < "u" ? ct : Y;
1371
- let et = !1, jn = 0;
1372
- const tt = () => (
1373
- // Ensure the id is unique with multiple independent versions of Floating UI
1374
- // on <React 18
1375
- "floating-ui-" + Math.random().toString(36).slice(2, 6) + jn++
1376
- );
1377
- function zn() {
1378
- const [e, t] = v.useState(() => et ? tt() : void 0);
1379
- return De(() => {
1380
- e == null && t(tt());
1381
- }, []), v.useEffect(() => {
1382
- et = !0;
1383
- }, []), e;
1384
- }
1385
- const Un = At.useId, qn = Un || zn;
1386
- let de;
1387
- process.env.NODE_ENV !== "production" && (de = /* @__PURE__ */ new Set());
1388
- function Xn() {
1389
- for (var e, t = arguments.length, o = new Array(t), n = 0; n < t; n++)
1390
- o[n] = arguments[n];
1391
- const r = "Floating UI: " + o.join(" ");
1392
- if (!((e = de) != null && e.has(r))) {
1393
- var i;
1394
- (i = de) == null || i.add(r), console.warn(r);
1395
- }
1396
- }
1397
- function Gn() {
1398
- for (var e, t = arguments.length, o = new Array(t), n = 0; n < t; n++)
1399
- o[n] = arguments[n];
1400
- const r = "Floating UI: " + o.join(" ");
1401
- if (!((e = de) != null && e.has(r))) {
1402
- var i;
1403
- (i = de) == null || i.add(r), console.error(r);
1404
- }
1405
- }
1406
- function Kn() {
1407
- const e = /* @__PURE__ */ new Map();
1408
- return {
1409
- emit(t, o) {
1410
- var n;
1411
- (n = e.get(t)) == null || n.forEach((r) => r(o));
1412
- },
1413
- on(t, o) {
1414
- e.set(t, [...e.get(t) || [], o]);
1415
- },
1416
- off(t, o) {
1417
- var n;
1418
- e.set(t, ((n = e.get(t)) == null ? void 0 : n.filter((r) => r !== o)) || []);
1419
- }
1420
- };
1421
- }
1422
- const Jn = /* @__PURE__ */ v.createContext(null), Qn = /* @__PURE__ */ v.createContext(null), Zn = () => {
1423
- var e;
1424
- return ((e = v.useContext(Jn)) == null ? void 0 : e.id) || null;
1425
- }, eo = () => v.useContext(Qn);
1426
- function to(e) {
1427
- const {
1428
- open: t = !1,
1429
- onOpenChange: o,
1430
- elements: n
1431
- } = e, r = qn(), i = v.useRef({}), [l] = v.useState(() => Kn()), c = Zn() != null;
1432
- if (process.env.NODE_ENV !== "production") {
1433
- const f = n.reference;
1434
- f && !M(f) && Gn("Cannot pass a virtual element to the `elements.reference` option,", "as it must be a real DOM element. Use `refs.setPositionReference()`", "instead.");
1435
- }
1436
- const [s, a] = v.useState(n.reference), u = Pt((f, d, m) => {
1437
- i.current.openEvent = f ? d : void 0, l.emit("openchange", {
1438
- open: f,
1439
- event: d,
1440
- reason: m,
1441
- nested: c
1442
- }), o == null || o(f, d, m);
1443
- }), g = v.useMemo(() => ({
1444
- setPositionReference: a
1445
- }), []), h = v.useMemo(() => ({
1446
- reference: s || n.reference || null,
1447
- floating: n.floating || null,
1448
- domReference: n.reference
1449
- }), [s, n.reference, n.floating]);
1450
- return v.useMemo(() => ({
1451
- dataRef: i,
1452
- open: t,
1453
- onOpenChange: u,
1454
- elements: h,
1455
- events: l,
1456
- floatingId: r,
1457
- refs: g
1458
- }), [t, u, h, l, r, g]);
1459
- }
1460
- function no(e) {
1461
- e === void 0 && (e = {});
1462
- const {
1463
- nodeId: t
1464
- } = e, o = to({
1465
- ...e,
1466
- elements: {
1467
- reference: null,
1468
- floating: null,
1469
- ...e.elements
1470
- }
1471
- }), n = e.rootContext || o, r = n.elements, [i, l] = v.useState(null), [c, s] = v.useState(null), u = (r == null ? void 0 : r.reference) || i, g = v.useRef(null), h = eo();
1472
- De(() => {
1473
- u && (g.current = u);
1474
- }, [u]);
1475
- const f = Wn({
1476
- ...e,
1477
- elements: {
1478
- ...r,
1479
- ...c && {
1480
- reference: c
1481
- }
1482
- }
1483
- }), d = v.useCallback((w) => {
1484
- const b = M(w) ? {
1485
- getBoundingClientRect: () => w.getBoundingClientRect(),
1486
- contextElement: w
1487
- } : w;
1488
- s(b), f.refs.setReference(b);
1489
- }, [f.refs]), m = v.useCallback((w) => {
1490
- (M(w) || w === null) && (g.current = w, l(w)), (M(f.refs.reference.current) || f.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to
1491
- // `null` to support `positionReference` + an unstable `reference`
1492
- // callback ref.
1493
- w !== null && !M(w)) && f.refs.setReference(w);
1494
- }, [f.refs]), p = v.useMemo(() => ({
1495
- ...f.refs,
1496
- setReference: m,
1497
- setPositionReference: d,
1498
- domReference: g
1499
- }), [f.refs, m, d]), x = v.useMemo(() => ({
1500
- ...f.elements,
1501
- domReference: u
1502
- }), [f.elements, u]), y = v.useMemo(() => ({
1503
- ...f,
1504
- ...n,
1505
- refs: p,
1506
- elements: x,
1507
- nodeId: t
1508
- }), [f, p, x, t, n]);
1509
- return De(() => {
1510
- n.dataRef.current.floatingContext = y;
1511
- const w = h == null ? void 0 : h.nodesRef.current.find((b) => b.id === t);
1512
- w && (w.context = y);
1513
- }), v.useMemo(() => ({
1514
- ...f,
1515
- context: y,
1516
- refs: p,
1517
- elements: x
1518
- }), [f, p, x, y]);
1519
- }
1520
- const nt = "active", ot = "selected";
1521
- function Te(e, t, o) {
1522
- const n = /* @__PURE__ */ new Map(), r = o === "item";
1523
- let i = e;
1524
- if (r && e) {
1525
- const {
1526
- [nt]: l,
1527
- [ot]: c,
1528
- ...s
1529
- } = e;
1530
- i = s;
1531
- }
1532
- return {
1533
- ...o === "floating" && {
1534
- tabIndex: -1
1535
- },
1536
- ...i,
1537
- ...t.map((l) => {
1538
- const c = l ? l[o] : null;
1539
- return typeof c == "function" ? e ? c(e) : null : c;
1540
- }).concat(e).reduce((l, c) => (c && Object.entries(c).forEach((s) => {
1541
- let [a, u] = s;
1542
- if (!(r && [nt, ot].includes(a)))
1543
- if (a.indexOf("on") === 0) {
1544
- if (n.has(a) || n.set(a, []), typeof u == "function") {
1545
- var g;
1546
- (g = n.get(a)) == null || g.push(u), l[a] = function() {
1547
- for (var h, f = arguments.length, d = new Array(f), m = 0; m < f; m++)
1548
- d[m] = arguments[m];
1549
- return (h = n.get(a)) == null ? void 0 : h.map((p) => p(...d)).find((p) => p !== void 0);
1550
- };
1551
- }
1552
- } else
1553
- l[a] = u;
1554
- }), l), {})
1555
- };
1556
- }
1557
- function oo(e) {
1558
- e === void 0 && (e = []);
1559
- const t = e.map((c) => c == null ? void 0 : c.reference), o = e.map((c) => c == null ? void 0 : c.floating), n = e.map((c) => c == null ? void 0 : c.item), r = v.useCallback(
1560
- (c) => Te(c, e, "reference"),
1561
- // eslint-disable-next-line react-hooks/exhaustive-deps
1562
- t
1563
- ), i = v.useCallback(
1564
- (c) => Te(c, e, "floating"),
1565
- // eslint-disable-next-line react-hooks/exhaustive-deps
1566
- o
1567
- ), l = v.useCallback(
1568
- (c) => Te(c, e, "item"),
1569
- // eslint-disable-next-line react-hooks/exhaustive-deps
1570
- n
1571
- );
1572
- return v.useMemo(() => ({
1573
- getReferenceProps: r,
1574
- getFloatingProps: i,
1575
- getItemProps: l
1576
- }), [r, i, l]);
1577
- }
1578
- function rt(e, t) {
1579
- return {
1580
- ...e,
1581
- rects: {
1582
- ...e.rects,
1583
- floating: {
1584
- ...e.rects.floating,
1585
- height: t
1586
- }
1587
- }
1588
- };
1589
- }
1590
- const ro = (e) => ({
1591
- name: "inner",
1592
- options: e,
1593
- async fn(t) {
1594
- const {
1595
- listRef: o,
1596
- overflowRef: n,
1597
- onFallbackChange: r,
1598
- offset: i = 0,
1599
- index: l = 0,
1600
- minItemsVisible: c = 4,
1601
- referenceOverflowThreshold: s = 0,
1602
- scrollRef: a,
1603
- ...u
1604
- } = le(e, t), {
1605
- rects: g,
1606
- elements: {
1607
- floating: h
1608
- }
1609
- } = t, f = o.current[l];
1610
- if (process.env.NODE_ENV !== "production" && (t.placement.startsWith("bottom") || Xn('`placement` side must be "bottom" when using the `inner`', "middleware.")), !f)
1611
- return {};
1612
- const d = {
1613
- ...t,
1614
- ...await St(-f.offsetTop - h.clientTop - g.reference.height / 2 - f.offsetHeight / 2 - i).fn(t)
1615
- }, m = (a == null ? void 0 : a.current) || h, p = await Me(rt(d, m.scrollHeight), u), x = await Me(d, {
1616
- ...u,
1617
- elementContext: "reference"
1618
- }), y = Math.max(0, p.top), w = d.y + y, b = Math.max(0, m.scrollHeight - y - Math.max(0, p.bottom));
1619
- return m.style.maxHeight = b + "px", m.scrollTop = y, r && (m.offsetHeight < f.offsetHeight * Math.min(c, o.current.length - 1) - 1 || x.top >= -s || x.bottom >= -s ? ue.flushSync(() => r(!0)) : ue.flushSync(() => r(!1))), n && (n.current = await Me(rt({
1620
- ...d,
1621
- y: w
1622
- }, m.offsetHeight), u)), {
1623
- y: w
1624
- };
1625
- }
1626
- });
1627
- function io(e, t) {
1628
- const {
1629
- open: o,
1630
- elements: n
1631
- } = e, {
1632
- enabled: r = !0,
1633
- overflowRef: i,
1634
- scrollRef: l,
1635
- onChange: c
1636
- } = t, s = Pt(c), a = v.useRef(!1), u = v.useRef(null), g = v.useRef(null);
1637
- v.useEffect(() => {
1638
- if (!r) return;
1639
- function f(m) {
1640
- if (m.ctrlKey || !d || i.current == null)
1641
- return;
1642
- const p = m.deltaY, x = i.current.top >= -0.5, y = i.current.bottom >= -0.5, w = d.scrollHeight - d.clientHeight, b = p < 0 ? -1 : 1, R = p < 0 ? "max" : "min";
1643
- d.scrollHeight <= d.clientHeight || (!x && p > 0 || !y && p < 0 ? (m.preventDefault(), ue.flushSync(() => {
1644
- s((O) => O + Math[R](p, w * b));
1645
- })) : /firefox/i.test(tn()) && (d.scrollTop += p));
1646
- }
1647
- const d = (l == null ? void 0 : l.current) || n.floating;
1648
- if (o && d)
1649
- return d.addEventListener("wheel", f), requestAnimationFrame(() => {
1650
- u.current = d.scrollTop, i.current != null && (g.current = {
1651
- ...i.current
1652
- });
1653
- }), () => {
1654
- u.current = null, g.current = null, d.removeEventListener("wheel", f);
1655
- };
1656
- }, [r, o, n.floating, i, l, s]);
1657
- const h = v.useMemo(() => ({
1658
- onKeyDown() {
1659
- a.current = !0;
1660
- },
1661
- onWheel() {
1662
- a.current = !1;
1663
- },
1664
- onPointerMove() {
1665
- a.current = !1;
1666
- },
1667
- onScroll() {
1668
- const f = (l == null ? void 0 : l.current) || n.floating;
1669
- if (!(!i.current || !f || !a.current)) {
1670
- if (u.current !== null) {
1671
- const d = f.scrollTop - u.current;
1672
- (i.current.bottom < -0.5 && d < -1 || i.current.top < -0.5 && d > 1) && ue.flushSync(() => s((m) => m + d));
1673
- }
1674
- requestAnimationFrame(() => {
1675
- u.current = f.scrollTop;
1676
- });
1677
- }
1678
- }
1679
- }), [n.floating, s, i, l]);
1680
- return v.useMemo(() => r ? {
1681
- floating: h
1682
- } : {}, [r, h]);
1683
- }
1684
- let ve = me({ styles: void 0, setReference: () => {
1685
- }, setFloating: () => {
1686
- }, getReferenceProps: () => ({}), getFloatingProps: () => ({}), slot: {} });
1687
- ve.displayName = "FloatingContext";
1688
- let Ye = me(null);
1689
- Ye.displayName = "PlacementContext";
1690
- function Lo(e) {
1691
- return _(() => e ? typeof e == "string" ? { to: e } : e : null, [e]);
1692
- }
1693
- function $o() {
1694
- return X(ve).setReference;
1695
- }
1696
- function Do() {
1697
- let { getFloatingProps: e, slot: t } = X(ve);
1698
- return st((...o) => Object.assign({}, e(...o), { "data-anchor": t.anchor }), [e, t]);
1699
- }
1700
- function Fo(e = null) {
1701
- e === !1 && (e = null), typeof e == "string" && (e = { to: e });
1702
- let t = X(Ye), o = _(() => e, [JSON.stringify(e, typeof HTMLElement < "u" ? (r, i) => i instanceof HTMLElement ? i.outerHTML : i : void 0)]);
1703
- j(() => {
1704
- t == null || t(o ?? null);
1705
- }, [t, o]);
1706
- let n = X(ve);
1707
- return _(() => [n.setFloating, e ? n.styles : {}], [n.setFloating, e, n.styles]);
1708
- }
1709
- let it = 4;
1710
- function Ho({ children: e, enabled: t = !0 }) {
1711
- let [o, n] = te(null), [r, i] = te(0), l = oe(null), [c, s] = te(null);
1712
- lo(c);
1713
- let a = t && o !== null && c !== null, { to: u = "bottom", gap: g = 0, offset: h = 0, padding: f = 0, inner: d } = so(o, c), [m, p = "center"] = u.split(" ");
1714
- j(() => {
1715
- a && i(0);
1716
- }, [a]);
1717
- let { refs: x, floatingStyles: y, context: w } = no({ open: a, placement: m === "selection" ? p === "center" ? "bottom" : `bottom-${p}` : p === "center" ? `${m}` : `${m}-${p}`, strategy: "absolute", transform: !1, middleware: [St({ mainAxis: m === "selection" ? 0 : g, crossAxis: h }), kn({ padding: f }), m !== "selection" && Vn({ padding: f }), m === "selection" && d ? ro({ ...d, padding: f, overflowRef: l, offset: r, minItemsVisible: it, referenceOverflowThreshold: f, onFallbackChange(S) {
1718
- var D, k;
1719
- if (!S) return;
1720
- let A = w.elements.floating;
1721
- if (!A) return;
1722
- let F = parseFloat(getComputedStyle(A).scrollPaddingBottom) || 0, I = Math.min(it, A.childElementCount), E = 0, P = 0;
1723
- for (let C of (k = (D = w.elements.floating) == null ? void 0 : D.childNodes) != null ? k : []) if (C instanceof HTMLElement) {
1724
- let U = C.offsetTop, je = U + C.clientHeight + F, Ae = A.scrollTop, ze = Ae + A.clientHeight;
1725
- if (U >= Ae && je <= ze) I--;
1726
- else {
1727
- P = Math.max(0, Math.min(je, ze) - Math.max(U, Ae)), E = C.clientHeight;
1728
- break;
1729
- }
1730
- }
1731
- I >= 1 && i((C) => {
1732
- let U = E * I - P + F;
1733
- return C >= U ? C : U;
1734
- });
1735
- } }) : null, Bn({ padding: f, apply({ availableWidth: S, availableHeight: D, elements: k }) {
1736
- Object.assign(k.floating.style, { overflow: "auto", maxWidth: `${S}px`, maxHeight: `min(var(--anchor-max-height, 100vh), ${D}px)` });
1737
- } })].filter(Boolean), whileElementsMounted: $n }), [b = m, R = p] = w.placement.split("-");
1738
- m === "selection" && (b = "selection");
1739
- let O = _(() => ({ anchor: [b, R].filter(Boolean).join(" ") }), [b, R]), L = io(w, { overflowRef: l, onChange: i }), { getReferenceProps: $, getFloatingProps: W } = oo([L]), T = ae((S) => {
1740
- s(S), x.setFloating(S);
1741
- });
1742
- return v.createElement(Ye.Provider, { value: n }, v.createElement(ve.Provider, { value: { setFloating: T, setReference: x.setReference, styles: y, getReferenceProps: $, getFloatingProps: W, slot: O } }, e));
1743
- }
1744
- function lo(e) {
1745
- j(() => {
1746
- if (!e) return;
1747
- let t = new MutationObserver(() => {
1748
- let o = window.getComputedStyle(e).maxHeight, n = parseFloat(o);
1749
- if (isNaN(n)) return;
1750
- let r = parseInt(o);
1751
- isNaN(r) || n !== r && (e.style.maxHeight = `${Math.ceil(n)}px`);
1752
- });
1753
- return t.observe(e, { attributes: !0, attributeFilter: ["style"] }), () => {
1754
- t.disconnect();
1755
- };
1756
- }, [e]);
1757
- }
1758
- function so(e, t) {
1759
- var o, n, r;
1760
- let i = Le((o = e == null ? void 0 : e.gap) != null ? o : "var(--anchor-gap, 0)", t), l = Le((n = e == null ? void 0 : e.offset) != null ? n : "var(--anchor-offset, 0)", t), c = Le((r = e == null ? void 0 : e.padding) != null ? r : "var(--anchor-padding, 0)", t);
1761
- return { ...e, gap: i, offset: l, padding: c };
1762
- }
1763
- function Le(e, t, o = void 0) {
1764
- let n = Nt(), r = ae((s, a) => {
1765
- if (s == null) return [o, null];
1766
- if (typeof s == "number") return [s, null];
1767
- if (typeof s == "string") {
1768
- if (!a) return [o, null];
1769
- let u = lt(s, a);
1770
- return [u, (g) => {
1771
- let h = Mt(s);
1772
- {
1773
- let f = h.map((d) => window.getComputedStyle(a).getPropertyValue(d));
1774
- n.requestAnimationFrame(function d() {
1775
- n.nextFrame(d);
1776
- let m = !1;
1777
- for (let [x, y] of h.entries()) {
1778
- let w = window.getComputedStyle(a).getPropertyValue(y);
1779
- if (f[x] !== w) {
1780
- f[x] = w, m = !0;
1781
- break;
1782
- }
1783
- }
1784
- if (!m) return;
1785
- let p = lt(s, a);
1786
- u !== p && (g(p), u = p);
1787
- });
1788
- }
1789
- return n.dispose;
1790
- }];
1791
- }
1792
- return [o, null];
1793
- }), i = _(() => r(e, t)[0], [e, t]), [l = i, c] = te();
1794
- return j(() => {
1795
- let [s, a] = r(e, t);
1796
- if (c(s), !!a) return a(c);
1797
- }, [e, t]), l;
1798
- }
1799
- function Mt(e) {
1800
- let t = /var\((.*)\)/.exec(e);
1801
- if (t) {
1802
- let o = t[1].indexOf(",");
1803
- if (o === -1) return [t[1]];
1804
- let n = t[1].slice(0, o).trim(), r = t[1].slice(o + 1).trim();
1805
- return r ? [n, ...Mt(r)] : [n];
1806
- }
1807
- return [];
1808
- }
1809
- function lt(e, t) {
1810
- let o = document.createElement("div");
1811
- t.appendChild(o), o.style.setProperty("margin-top", "0px", "important"), o.style.setProperty("margin-top", e, "important");
1812
- let n = parseFloat(window.getComputedStyle(o).marginTop) || 0;
1813
- return t.removeChild(o), n;
1814
- }
1815
- function co(e) {
1816
- let t = ae(e), o = oe(!1);
1817
- Y(() => (o.current = !1, () => {
1818
- o.current = !0, It(() => {
1819
- o.current && t();
1820
- });
1821
- }), [t]);
1822
- }
1823
- function ao() {
1824
- let e = typeof document > "u";
1825
- return "useSyncExternalStore" in v ? ((t) => t.useSyncExternalStore)(v)(() => () => {
1826
- }, () => !1, () => !e) : !1;
1827
- }
1828
- function uo() {
1829
- let e = ao(), [t, o] = v.useState(ce.isHandoffComplete);
1830
- return t && ce.isHandoffComplete === !1 && o(!1), v.useEffect(() => {
1831
- t !== !0 && o(!0);
1832
- }, [t]), v.useEffect(() => ce.handoff(), []), e ? !1 : t;
1833
- }
1834
- let fo = me(!1);
1835
- function mo() {
1836
- return X(fo);
1837
- }
1838
- function go(e) {
1839
- let t = mo(), o = X(Lt), n = gt(e), [r, i] = te(() => {
1840
- var l;
1841
- if (!t && o !== null) return (l = o.current) != null ? l : null;
1842
- if (ce.isServer) return null;
1843
- let c = n == null ? void 0 : n.getElementById("headlessui-portal-root");
1844
- if (c) return c;
1845
- if (n === null) return null;
1846
- let s = n.createElement("div");
1847
- return s.setAttribute("id", "headlessui-portal-root"), n.body.appendChild(s);
1848
- });
1849
- return Y(() => {
1850
- r !== null && (n != null && n.body.contains(r) || n == null || n.body.appendChild(r));
1851
- }, [r, n]), Y(() => {
1852
- t || o !== null && i(o.current);
1853
- }, [o, i, t]), r;
1854
- }
1855
- let Tt = at, ho = Ie(function(e, t) {
1856
- let o = e, n = oe(null), r = We(Wt((u) => {
1857
- n.current = u;
1858
- }), t), i = gt(n), l = go(n), [c] = te(() => {
1859
- var u;
1860
- return ce.isServer ? null : (u = i == null ? void 0 : i.createElement("div")) != null ? u : null;
1861
- }), s = X(Fe), a = uo();
1862
- return j(() => {
1863
- !l || !c || l.contains(c) || (c.setAttribute("data-headlessui-portal", ""), l.appendChild(c));
1864
- }, [l, c]), j(() => {
1865
- if (c && s) return s.register(c);
1866
- }, [s, c]), co(() => {
1867
- var u;
1868
- !l || !c || (c instanceof Node && l.contains(c) && l.removeChild(c), l.childNodes.length <= 0 && ((u = l.parentElement) == null || u.removeChild(l)));
1869
- }), a ? !l || !c ? null : Bt(ke({ ourProps: { ref: r }, theirProps: o, slot: {}, defaultTag: Tt, name: "Portal" }), c) : null;
1870
- });
1871
- function po(e, t) {
1872
- let o = We(t), { enabled: n = !0, ...r } = e;
1873
- return n ? He.createElement(ho, { ...r, ref: o }) : ke({ ourProps: { ref: o }, theirProps: r, slot: {}, defaultTag: Tt, name: "Portal" });
1874
- }
1875
- let vo = at, Lt = me(null);
1876
- function wo(e, t) {
1877
- let { target: o, ...n } = e, r = { ref: We(t) };
1878
- return He.createElement(Lt.Provider, { value: o }, ke({ ourProps: r, theirProps: n, defaultTag: vo, name: "Popover.Group" }));
1879
- }
1880
- let Fe = me(null);
1881
- function No() {
1882
- let e = X(Fe), t = oe([]), o = ae((i) => (t.current.push(i), e && e.register(i), () => n(i))), n = ae((i) => {
1883
- let l = t.current.indexOf(i);
1884
- l !== -1 && t.current.splice(l, 1), e && e.unregister(i);
1885
- }), r = _(() => ({ register: o, unregister: n, portals: t }), [o, n, t]);
1886
- return [t, _(() => function({ children: i }) {
1887
- return He.createElement(Fe.Provider, { value: r }, i);
1888
- }, [r])];
1889
- }
1890
- let xo = Ie(po), yo = Ie(wo), Io = Object.assign(xo, { Group: yo });
1891
- export {
1892
- Mo as E,
1893
- Po as R,
1894
- Fo as a,
1895
- Do as b,
1896
- dt as c,
1897
- Oo as d,
1898
- No as e,
1899
- To as f,
1900
- Ut as g,
1901
- Ao as m,
1902
- gt as n,
1903
- qt as s,
1904
- Io as t,
1905
- Ho as v,
1906
- Lo as x,
1907
- $o as y
1908
- };