v-float 0.10.0 → 0.11.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 (50) hide show
  1. package/README.md +44 -175
  2. package/dist/index.d.mts +688 -0
  3. package/dist/index.d.mts.map +1 -0
  4. package/dist/index.mjs +2038 -0
  5. package/dist/index.mjs.map +1 -0
  6. package/package.json +74 -75
  7. package/dist/composables/index.d.ts +0 -4
  8. package/dist/composables/index.d.ts.map +0 -1
  9. package/dist/composables/interactions/index.d.ts +0 -7
  10. package/dist/composables/interactions/index.d.ts.map +0 -1
  11. package/dist/composables/interactions/polygon.d.ts +0 -38
  12. package/dist/composables/interactions/polygon.d.ts.map +0 -1
  13. package/dist/composables/interactions/use-click.d.ts +0 -120
  14. package/dist/composables/interactions/use-click.d.ts.map +0 -1
  15. package/dist/composables/interactions/use-escape-key.d.ts +0 -57
  16. package/dist/composables/interactions/use-escape-key.d.ts.map +0 -1
  17. package/dist/composables/interactions/use-focus-trap.d.ts +0 -78
  18. package/dist/composables/interactions/use-focus-trap.d.ts.map +0 -1
  19. package/dist/composables/interactions/use-focus.d.ts +0 -60
  20. package/dist/composables/interactions/use-focus.d.ts.map +0 -1
  21. package/dist/composables/interactions/use-hover.d.ts +0 -78
  22. package/dist/composables/interactions/use-hover.d.ts.map +0 -1
  23. package/dist/composables/interactions/use-list-navigation.d.ts +0 -144
  24. package/dist/composables/interactions/use-list-navigation.d.ts.map +0 -1
  25. package/dist/composables/middlewares/arrow.d.ts +0 -25
  26. package/dist/composables/middlewares/arrow.d.ts.map +0 -1
  27. package/dist/composables/middlewares/index.d.ts +0 -4
  28. package/dist/composables/middlewares/index.d.ts.map +0 -1
  29. package/dist/composables/positioning/index.d.ts +0 -5
  30. package/dist/composables/positioning/index.d.ts.map +0 -1
  31. package/dist/composables/positioning/use-arrow.d.ts +0 -55
  32. package/dist/composables/positioning/use-arrow.d.ts.map +0 -1
  33. package/dist/composables/positioning/use-client-point.d.ts +0 -218
  34. package/dist/composables/positioning/use-client-point.d.ts.map +0 -1
  35. package/dist/composables/positioning/use-floating-tree.d.ts +0 -240
  36. package/dist/composables/positioning/use-floating-tree.d.ts.map +0 -1
  37. package/dist/composables/positioning/use-floating.d.ts +0 -162
  38. package/dist/composables/positioning/use-floating.d.ts.map +0 -1
  39. package/dist/composables/utils/is-using-keyboard.d.ts +0 -2
  40. package/dist/composables/utils/is-using-keyboard.d.ts.map +0 -1
  41. package/dist/composables/utils/use-active-descendant.d.ts +0 -8
  42. package/dist/composables/utils/use-active-descendant.d.ts.map +0 -1
  43. package/dist/index.d.ts +0 -2
  44. package/dist/index.d.ts.map +0 -1
  45. package/dist/types.d.ts +0 -18
  46. package/dist/types.d.ts.map +0 -1
  47. package/dist/utils.d.ts +0 -92
  48. package/dist/utils.d.ts.map +0 -1
  49. package/dist/v-float.es.js +0 -3827
  50. package/dist/v-float.umd.js +0 -8
@@ -1,3827 +0,0 @@
1
- var On = Object.defineProperty;
2
- var An = (t, e, n) => e in t ? On(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var Pe = (t, e, n) => An(t, typeof e != "symbol" ? e + "" : e, n);
4
- import { watch as ae, computed as W, toValue as N, useId as Dn, ref as te, watchEffect as Pn, onWatcherCleanup as ge, readonly as en, shallowRef as qe, onScopeDispose as Oe, shallowReactive as Nn, getCurrentScope as Fn, unref as Ln, watchPostEffect as Ce } from "vue";
5
- function Wr(t, e, n = {}) {
6
- const { offset: o = "-4px" } = n, { middlewareData: r, placement: s, refs: i } = e;
7
- ae(t, (d) => {
8
- i.arrowEl.value = d;
9
- });
10
- const l = W(() => {
11
- var d;
12
- return ((d = r.value.arrow) == null ? void 0 : d.x) ?? 0;
13
- }), f = W(() => {
14
- var d;
15
- return ((d = r.value.arrow) == null ? void 0 : d.y) ?? 0;
16
- }), a = W(() => {
17
- if (!(t.value || i.arrowEl.value) || !r.value.arrow)
18
- return {};
19
- const u = N(s).split("-")[0], v = l.value, h = f.value;
20
- return u === "bottom" ? {
21
- "inset-inline-start": `${v}px`,
22
- "inset-block-start": o
23
- } : u === "top" ? {
24
- "inset-inline-start": `${v}px`,
25
- "inset-block-end": o
26
- } : u === "right" ? {
27
- "inset-block-start": `${h}px`,
28
- "inset-inline-start": o
29
- } : u === "left" ? {
30
- "inset-block-start": `${h}px`,
31
- "inset-inline-end": o
32
- } : {};
33
- });
34
- return {
35
- arrowX: l,
36
- arrowY: f,
37
- arrowStyles: a
38
- };
39
- }
40
- let Rn = 0;
41
- function tn() {
42
- return Dn() || `id-${++Rn}`;
43
- }
44
- function pt(t) {
45
- return t instanceof Element && t instanceof HTMLElement;
46
- }
47
- function kn() {
48
- return typeof navigator > "u" ? !1 : navigator.platform.toUpperCase().indexOf("MAC") >= 0;
49
- }
50
- function Mn() {
51
- return typeof navigator > "u" ? !1 : /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
52
- }
53
- function In(t) {
54
- return typeof (t == null ? void 0 : t.matches) != "function" ? !1 : t.matches(":focus-visible");
55
- }
56
- function nn(t, e) {
57
- if (t === void 0) return !1;
58
- const n = t === "mouse";
59
- return e ? n : n || t === "pen";
60
- }
61
- function Et(t) {
62
- return !t || !(t instanceof HTMLElement) ? !1 : t instanceof HTMLInputElement || t instanceof HTMLTextAreaElement || t.isContentEditable && t.contentEditable !== "false";
63
- }
64
- function Dt(t) {
65
- const e = t.target;
66
- return e instanceof HTMLElement ? e.tagName === "BUTTON" || e.tagName === "INPUT" && e.getAttribute("type") === "button" || e.getAttribute("role") === "button" : !1;
67
- }
68
- function Pt(t) {
69
- return Et(t);
70
- }
71
- function Nt(t, e) {
72
- return e ? "composedPath" in t && typeof t.composedPath == "function" ? t.composedPath().includes(e) : e.contains(t.target) : !1;
73
- }
74
- function Bn(t, e) {
75
- const n = e.getBoundingClientRect(), o = e.offsetWidth - e.clientWidth, r = e.offsetHeight - e.clientHeight, s = t.clientX - n.left, i = t.clientY - n.top;
76
- if (o > 0) {
77
- const l = e.clientWidth;
78
- if (s >= l && s <= e.offsetWidth)
79
- return !0;
80
- }
81
- if (r > 0) {
82
- const l = e.clientHeight;
83
- if (i >= l && i <= e.offsetHeight)
84
- return !0;
85
- }
86
- return !1;
87
- }
88
- function ct(t, e) {
89
- return t.contains(e);
90
- }
91
- function Hn(t) {
92
- return t.target;
93
- }
94
- function Ft() {
95
- return typeof performance < "u" ? performance.now() : Date.now();
96
- }
97
- function Lt(t) {
98
- t !== -1 && clearTimeout(t);
99
- }
100
- function Wn(t) {
101
- return t !== null && typeof t == "object" && "data" in t && "id" in t && "children" in t && "parent" in t;
102
- }
103
- function Ke(t) {
104
- return Wn(t) ? {
105
- floatingContext: t.data,
106
- treeContext: t
107
- } : {
108
- floatingContext: t,
109
- treeContext: null
110
- };
111
- }
112
- function se(t, e) {
113
- if (!e) return !1;
114
- if (typeof e == "object" && e !== null && "contextElement" in e) {
115
- const n = e.contextElement;
116
- return n instanceof Element ? n.contains(t) : !1;
117
- }
118
- return e instanceof Element ? e.contains(t) : !1;
119
- }
120
- function xt(t, e) {
121
- for (const n of t.children.value)
122
- if (n.data.open.value) {
123
- if (se(e, n.data.refs.anchorEl.value) || se(e, n.data.refs.floatingEl.value))
124
- return n;
125
- const o = xt(n, e);
126
- if (o) return o;
127
- }
128
- return null;
129
- }
130
- const Ye = (t) => typeof t == "number" && Number.isFinite(t) ? t : null, Te = class Te {
131
- /**
132
- * Create a virtual anchor element
133
- */
134
- create(e) {
135
- const n = this.buildConfiguration(e);
136
- return {
137
- contextElement: n.referenceElement || void 0,
138
- getBoundingClientRect: () => this.buildBoundingRect(n)
139
- };
140
- }
141
- /**
142
- * Build configuration from options with defaults
143
- */
144
- buildConfiguration(e) {
145
- return {
146
- coordinates: e.coordinates,
147
- referenceElement: e.referenceElement ?? null,
148
- baselineCoordinates: e.baselineCoordinates ?? null,
149
- axis: e.axis ?? "both"
150
- };
151
- }
152
- /**
153
- * Build the bounding rectangle for the virtual element
154
- */
155
- buildBoundingRect(e) {
156
- const n = this.getReferenceRect(e.referenceElement), o = this.resolvePosition(e, n), r = this.calculateSize(e.axis, n);
157
- return this.buildDOMRect({
158
- x: o.x,
159
- y: o.y,
160
- width: r.width,
161
- height: r.height
162
- });
163
- }
164
- /**
165
- * Get reference element bounds with fallback
166
- */
167
- getReferenceRect(e) {
168
- if (e)
169
- try {
170
- return e.getBoundingClientRect();
171
- } catch (n) {
172
- console.warn("VirtualElementFactory: Failed to get element bounds", { element: e, error: n });
173
- }
174
- return this.buildDOMRect({
175
- x: 0,
176
- y: 0,
177
- width: Te.DEFAULT_DIMENSIONS.width,
178
- height: Te.DEFAULT_DIMENSIONS.height
179
- });
180
- }
181
- /**
182
- * Resolve final position from coordinate sources
183
- */
184
- resolvePosition(e, n) {
185
- var o, r;
186
- return {
187
- x: this.resolveAxisCoordinate({
188
- current: e.coordinates.x,
189
- baseline: ((o = e.baselineCoordinates) == null ? void 0 : o.x) ?? null,
190
- fallback: n.x,
191
- isAxisEnabled: e.axis === "x" || e.axis === "both"
192
- }),
193
- y: this.resolveAxisCoordinate({
194
- current: e.coordinates.y,
195
- baseline: ((r = e.baselineCoordinates) == null ? void 0 : r.y) ?? null,
196
- fallback: n.y,
197
- isAxisEnabled: e.axis === "y" || e.axis === "both"
198
- })
199
- };
200
- }
201
- /**
202
- * Resolve coordinate for a single axis with clear precedence
203
- */
204
- resolveAxisCoordinate(e) {
205
- const { current: n, baseline: o, fallback: r, isAxisEnabled: s } = e;
206
- return s && n !== null ? n : o !== null ? o : r;
207
- }
208
- /**
209
- * Calculate virtual element size based on axis constraints
210
- */
211
- calculateSize(e, n) {
212
- const o = (r, s) => Math.max(0, r || s);
213
- switch (e) {
214
- case "both":
215
- return { width: 0, height: 0 };
216
- case "x":
217
- return {
218
- width: o(
219
- n.width,
220
- Te.DEFAULT_DIMENSIONS.width
221
- ),
222
- height: 0
223
- };
224
- case "y":
225
- return {
226
- width: 0,
227
- height: o(
228
- n.height,
229
- Te.DEFAULT_DIMENSIONS.height
230
- )
231
- };
232
- }
233
- }
234
- /**
235
- * Build a DOMRect object
236
- */
237
- buildDOMRect(e) {
238
- const { x: n, y: o, width: r, height: s } = e, i = Math.max(0, r), l = Math.max(0, s);
239
- return {
240
- x: n,
241
- y: o,
242
- width: i,
243
- height: l,
244
- top: o,
245
- right: n + i,
246
- bottom: o + l,
247
- left: n,
248
- toJSON: () => ({ x: n, y: o, width: i, height: l })
249
- };
250
- }
251
- };
252
- Pe(Te, "DEFAULT_DIMENSIONS", { width: 100, height: 30 });
253
- let mt = Te;
254
- class on {
255
- constructor() {
256
- // The core state every strategy needs: the last known good coordinates
257
- Pe(this, "lastKnownCoordinates", null);
258
- }
259
- /**
260
- * Get coordinates to use when the floating element opens
261
- * This lets each strategy decide its opening behavior without client code needing to know the details
262
- */
263
- getCoordinatesForOpening() {
264
- return this.lastKnownCoordinates;
265
- }
266
- /**
267
- * Called when the floating element closes
268
- * This is where strategies should clean up any temporary state
269
- */
270
- onClose() {
271
- this.lastKnownCoordinates = null;
272
- }
273
- /**
274
- * Reset all strategy state - used when the composable is disabled or reset
275
- */
276
- reset() {
277
- this.lastKnownCoordinates = null;
278
- }
279
- }
280
- class Kn extends on {
281
- constructor() {
282
- super(...arguments);
283
- Pe(this, "name", "follow");
284
- }
285
- /**
286
- * Follow strategy needs all pointer events for continuous tracking
287
- */
288
- getRequiredEvents() {
289
- return ["pointerdown", "pointermove", "pointerenter"];
290
- }
291
- /**
292
- * Follow strategy: always update coordinates based on the current pointer position
293
- * This creates smooth, continuous tracking behavior
294
- */
295
- process(n, o) {
296
- const r = n.coordinates;
297
- switch (this.lastKnownCoordinates = r, n.type) {
298
- case "pointerdown":
299
- return r;
300
- case "pointermove":
301
- return o.isOpen && nn(n.originalEvent.pointerType, !0) ? r : null;
302
- case "pointerenter":
303
- return r;
304
- default:
305
- return null;
306
- }
307
- }
308
- }
309
- class $n extends on {
310
- constructor() {
311
- super(...arguments);
312
- Pe(this, "name", "static");
313
- // Static strategy needs to remember the "trigger" coordinates from clicks
314
- // These take priority over hover coordinates for positioning
315
- Pe(this, "triggerCoordinates", null);
316
- }
317
- /**
318
- * Static strategy only needs click events, not hover or continuous movement
319
- * This optimization avoids registering unnecessary pointer events
320
- */
321
- getRequiredEvents() {
322
- return ["pointerdown"];
323
- }
324
- /**
325
- * Static strategy: capture coordinates from trigger events, ignore movement
326
- * This creates stable positioning that doesn't jump around
327
- */
328
- process(n, o) {
329
- const r = n.coordinates;
330
- return this.triggerCoordinates = r, this.lastKnownCoordinates = r, o.isOpen ? r : null;
331
- }
332
- /**
333
- * Get coordinates to use when floating element opens
334
- */
335
- getCoordinatesForOpening() {
336
- return this.triggerCoordinates ? this.triggerCoordinates : this.lastKnownCoordinates;
337
- }
338
- /**
339
- * Reset tracking state
340
- */
341
- reset() {
342
- super.reset(), this.triggerCoordinates = null;
343
- }
344
- onClose() {
345
- this.triggerCoordinates = null;
346
- }
347
- }
348
- function Kr(t, e, n = {}) {
349
- const { open: o, refs: r } = e, s = new mt(), i = te({ x: null, y: null }), l = te(null), f = W(() => N(n.axis ?? "both")), a = W(() => N(n.enabled ?? !0)), d = W(() => Ye(N(n.x ?? null))), u = W(() => Ye(N(n.y ?? null))), v = W(
350
- () => d.value !== null && u.value !== null
351
- ), h = W(() => v.value ? {
352
- x: d.value,
353
- y: u.value
354
- } : i.value), b = W(() => {
355
- const C = h.value;
356
- switch (f.value) {
357
- case "x":
358
- return { x: C.x, y: null };
359
- case "y":
360
- return { x: null, y: C.y };
361
- case "both":
362
- return C;
363
- }
364
- }), x = (n.trackingMode ?? "follow") === "follow" ? new Kn() : new $n(), w = (C, P) => {
365
- v.value || (i.value = {
366
- x: Ye(C),
367
- y: Ye(P)
368
- });
369
- }, p = () => {
370
- v.value || (i.value = { x: null, y: null });
371
- }, T = (C, P) => {
372
- const $ = {
373
- type: P,
374
- coordinates: { x: C.clientX, y: C.clientY },
375
- originalEvent: C
376
- }, B = x.process($, {
377
- isOpen: o.value
378
- });
379
- B && w(B.x, B.y);
380
- };
381
- ae(
382
- [b, l, f, t],
383
- () => {
384
- r.anchorEl.value = s.create({
385
- coordinates: b.value,
386
- referenceElement: t.value,
387
- baselineCoordinates: l.value,
388
- axis: f.value
389
- });
390
- },
391
- { immediate: !0 }
392
- ), ae(o, (C) => {
393
- if (!(!a.value || v.value))
394
- if (C) {
395
- const P = x.getCoordinatesForOpening();
396
- P ? (w(P.x, P.y), l.value = { ...P }) : l.value = { ...i.value };
397
- } else
398
- x.onClose(), p(), l.value = null;
399
- });
400
- const D = (C) => {
401
- T(C, "pointerdown");
402
- }, A = (C) => {
403
- T(C, "pointerenter");
404
- }, F = (C) => {
405
- T(C, "pointermove");
406
- };
407
- return Pn(() => {
408
- if (v.value || !a.value) return;
409
- const C = t.value;
410
- if (!C) return;
411
- const P = x.getRequiredEvents(), $ = {
412
- pointerenter: A,
413
- pointerdown: D,
414
- pointermove: F
415
- };
416
- P.forEach((B) => {
417
- const k = $[B];
418
- k && C.addEventListener(B, k);
419
- }), ge(() => {
420
- P.forEach((B) => {
421
- const k = $[B];
422
- k && C.removeEventListener(B, k);
423
- });
424
- });
425
- }), {
426
- coordinates: en(b),
427
- updatePosition: (C, P) => w(C, P)
428
- };
429
- }
430
- const rn = ["top", "right", "bottom", "left"], Rt = ["start", "end"], kt = /* @__PURE__ */ rn.reduce((t, e) => t.concat(e, e + "-" + Rt[0], e + "-" + Rt[1]), []), be = Math.min, ne = Math.max, Ge = Math.round, ze = Math.floor, fe = (t) => ({
431
- x: t,
432
- y: t
433
- }), Vn = {
434
- left: "right",
435
- right: "left",
436
- bottom: "top",
437
- top: "bottom"
438
- }, jn = {
439
- start: "end",
440
- end: "start"
441
- };
442
- function gt(t, e, n) {
443
- return ne(t, be(e, n));
444
- }
445
- function ye(t, e) {
446
- return typeof t == "function" ? t(e) : t;
447
- }
448
- function de(t) {
449
- return t.split("-")[0];
450
- }
451
- function le(t) {
452
- return t.split("-")[1];
453
- }
454
- function an(t) {
455
- return t === "x" ? "y" : "x";
456
- }
457
- function Tt(t) {
458
- return t === "y" ? "height" : "width";
459
- }
460
- const _n = /* @__PURE__ */ new Set(["top", "bottom"]);
461
- function pe(t) {
462
- return _n.has(de(t)) ? "y" : "x";
463
- }
464
- function Ct(t) {
465
- return an(pe(t));
466
- }
467
- function sn(t, e, n) {
468
- n === void 0 && (n = !1);
469
- const o = le(t), r = Ct(t), s = Tt(r);
470
- let i = r === "x" ? o === (n ? "end" : "start") ? "right" : "left" : o === "start" ? "bottom" : "top";
471
- return e.reference[s] > e.floating[s] && (i = Je(i)), [i, Je(i)];
472
- }
473
- function Yn(t) {
474
- const e = Je(t);
475
- return [Ze(t), e, Ze(e)];
476
- }
477
- function Ze(t) {
478
- return t.replace(/start|end/g, (e) => jn[e]);
479
- }
480
- const Mt = ["left", "right"], It = ["right", "left"], zn = ["top", "bottom"], Xn = ["bottom", "top"];
481
- function Un(t, e, n) {
482
- switch (t) {
483
- case "top":
484
- case "bottom":
485
- return n ? e ? It : Mt : e ? Mt : It;
486
- case "left":
487
- case "right":
488
- return e ? zn : Xn;
489
- default:
490
- return [];
491
- }
492
- }
493
- function qn(t, e, n, o) {
494
- const r = le(t);
495
- let s = Un(de(t), n === "start", o);
496
- return r && (s = s.map((i) => i + "-" + r), e && (s = s.concat(s.map(Ze)))), s;
497
- }
498
- function Je(t) {
499
- return t.replace(/left|right|bottom|top/g, (e) => Vn[e]);
500
- }
501
- function Gn(t) {
502
- return {
503
- top: 0,
504
- right: 0,
505
- bottom: 0,
506
- left: 0,
507
- ...t
508
- };
509
- }
510
- function ln(t) {
511
- return typeof t != "number" ? Gn(t) : {
512
- top: t,
513
- right: t,
514
- bottom: t,
515
- left: t
516
- };
517
- }
518
- function Qe(t) {
519
- const {
520
- x: e,
521
- y: n,
522
- width: o,
523
- height: r
524
- } = t;
525
- return {
526
- width: o,
527
- height: r,
528
- top: n,
529
- left: e,
530
- right: e + o,
531
- bottom: n + r,
532
- x: e,
533
- y: n
534
- };
535
- }
536
- function Bt(t, e, n) {
537
- let {
538
- reference: o,
539
- floating: r
540
- } = t;
541
- const s = pe(e), i = Ct(e), l = Tt(i), f = de(e), a = s === "y", d = o.x + o.width / 2 - r.width / 2, u = o.y + o.height / 2 - r.height / 2, v = o[l] / 2 - r[l] / 2;
542
- let h;
543
- switch (f) {
544
- case "top":
545
- h = {
546
- x: d,
547
- y: o.y - r.height
548
- };
549
- break;
550
- case "bottom":
551
- h = {
552
- x: d,
553
- y: o.y + o.height
554
- };
555
- break;
556
- case "right":
557
- h = {
558
- x: o.x + o.width,
559
- y: u
560
- };
561
- break;
562
- case "left":
563
- h = {
564
- x: o.x - r.width,
565
- y: u
566
- };
567
- break;
568
- default:
569
- h = {
570
- x: o.x,
571
- y: o.y
572
- };
573
- }
574
- switch (le(e)) {
575
- case "start":
576
- h[i] -= v * (n && a ? -1 : 1);
577
- break;
578
- case "end":
579
- h[i] += v * (n && a ? -1 : 1);
580
- break;
581
- }
582
- return h;
583
- }
584
- const Zn = async (t, e, n) => {
585
- const {
586
- placement: o = "bottom",
587
- strategy: r = "absolute",
588
- middleware: s = [],
589
- platform: i
590
- } = n, l = s.filter(Boolean), f = await (i.isRTL == null ? void 0 : i.isRTL(e));
591
- let a = await i.getElementRects({
592
- reference: t,
593
- floating: e,
594
- strategy: r
595
- }), {
596
- x: d,
597
- y: u
598
- } = Bt(a, o, f), v = o, h = {}, b = 0;
599
- for (let x = 0; x < l.length; x++) {
600
- const {
601
- name: w,
602
- fn: p
603
- } = l[x], {
604
- x: T,
605
- y: D,
606
- data: A,
607
- reset: F
608
- } = await p({
609
- x: d,
610
- y: u,
611
- initialPlacement: o,
612
- placement: v,
613
- strategy: r,
614
- middlewareData: h,
615
- rects: a,
616
- platform: i,
617
- elements: {
618
- reference: t,
619
- floating: e
620
- }
621
- });
622
- d = T ?? d, u = D ?? u, h = {
623
- ...h,
624
- [w]: {
625
- ...h[w],
626
- ...A
627
- }
628
- }, F && b <= 50 && (b++, typeof F == "object" && (F.placement && (v = F.placement), F.rects && (a = F.rects === !0 ? await i.getElementRects({
629
- reference: t,
630
- floating: e,
631
- strategy: r
632
- }) : F.rects), {
633
- x: d,
634
- y: u
635
- } = Bt(a, v, f)), x = -1);
636
- }
637
- return {
638
- x: d,
639
- y: u,
640
- placement: v,
641
- strategy: r,
642
- middlewareData: h
643
- };
644
- };
645
- async function Le(t, e) {
646
- var n;
647
- e === void 0 && (e = {});
648
- const {
649
- x: o,
650
- y: r,
651
- platform: s,
652
- rects: i,
653
- elements: l,
654
- strategy: f
655
- } = t, {
656
- boundary: a = "clippingAncestors",
657
- rootBoundary: d = "viewport",
658
- elementContext: u = "floating",
659
- altBoundary: v = !1,
660
- padding: h = 0
661
- } = ye(e, t), b = ln(h), w = l[v ? u === "floating" ? "reference" : "floating" : u], p = Qe(await s.getClippingRect({
662
- element: (n = await (s.isElement == null ? void 0 : s.isElement(w))) == null || n ? w : w.contextElement || await (s.getDocumentElement == null ? void 0 : s.getDocumentElement(l.floating)),
663
- boundary: a,
664
- rootBoundary: d,
665
- strategy: f
666
- })), T = u === "floating" ? {
667
- x: o,
668
- y: r,
669
- width: i.floating.width,
670
- height: i.floating.height
671
- } : i.reference, D = await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(l.floating)), A = await (s.isElement == null ? void 0 : s.isElement(D)) ? await (s.getScale == null ? void 0 : s.getScale(D)) || {
672
- x: 1,
673
- y: 1
674
- } : {
675
- x: 1,
676
- y: 1
677
- }, F = Qe(s.convertOffsetParentRelativeRectToViewportRelativeRect ? await s.convertOffsetParentRelativeRectToViewportRelativeRect({
678
- elements: l,
679
- rect: T,
680
- offsetParent: D,
681
- strategy: f
682
- }) : T);
683
- return {
684
- top: (p.top - F.top + b.top) / A.y,
685
- bottom: (F.bottom - p.bottom + b.bottom) / A.y,
686
- left: (p.left - F.left + b.left) / A.x,
687
- right: (F.right - p.right + b.right) / A.x
688
- };
689
- }
690
- const Jn = (t) => ({
691
- name: "arrow",
692
- options: t,
693
- async fn(e) {
694
- const {
695
- x: n,
696
- y: o,
697
- placement: r,
698
- rects: s,
699
- platform: i,
700
- elements: l,
701
- middlewareData: f
702
- } = e, {
703
- element: a,
704
- padding: d = 0
705
- } = ye(t, e) || {};
706
- if (a == null)
707
- return {};
708
- const u = ln(d), v = {
709
- x: n,
710
- y: o
711
- }, h = Ct(r), b = Tt(h), x = await i.getDimensions(a), w = h === "y", p = w ? "top" : "left", T = w ? "bottom" : "right", D = w ? "clientHeight" : "clientWidth", A = s.reference[b] + s.reference[h] - v[h] - s.floating[b], F = v[h] - s.reference[h], C = await (i.getOffsetParent == null ? void 0 : i.getOffsetParent(a));
712
- let P = C ? C[D] : 0;
713
- (!P || !await (i.isElement == null ? void 0 : i.isElement(C))) && (P = l.floating[D] || s.floating[b]);
714
- const $ = A / 2 - F / 2, B = P / 2 - x[b] / 2 - 1, k = be(u[p], B), V = be(u[T], B), I = k, g = P - x[b] - V, m = P / 2 - x[b] / 2 + $, y = gt(I, m, g), c = !f.arrow && le(r) != null && m !== y && s.reference[b] / 2 - (m < I ? k : V) - x[b] / 2 < 0, M = c ? m < I ? m - I : m - g : 0;
715
- return {
716
- [h]: v[h] + M,
717
- data: {
718
- [h]: y,
719
- centerOffset: m - y - M,
720
- ...c && {
721
- alignmentOffset: M
722
- }
723
- },
724
- reset: c
725
- };
726
- }
727
- });
728
- function Qn(t, e, n) {
729
- return (t ? [...n.filter((r) => le(r) === t), ...n.filter((r) => le(r) !== t)] : n.filter((r) => de(r) === r)).filter((r) => t ? le(r) === t || (e ? Ze(r) !== r : !1) : !0);
730
- }
731
- const eo = function(t) {
732
- return t === void 0 && (t = {}), {
733
- name: "autoPlacement",
734
- options: t,
735
- async fn(e) {
736
- var n, o, r;
737
- const {
738
- rects: s,
739
- middlewareData: i,
740
- placement: l,
741
- platform: f,
742
- elements: a
743
- } = e, {
744
- crossAxis: d = !1,
745
- alignment: u,
746
- allowedPlacements: v = kt,
747
- autoAlignment: h = !0,
748
- ...b
749
- } = ye(t, e), x = u !== void 0 || v === kt ? Qn(u || null, h, v) : v, w = await Le(e, b), p = ((n = i.autoPlacement) == null ? void 0 : n.index) || 0, T = x[p];
750
- if (T == null)
751
- return {};
752
- const D = sn(T, s, await (f.isRTL == null ? void 0 : f.isRTL(a.floating)));
753
- if (l !== T)
754
- return {
755
- reset: {
756
- placement: x[0]
757
- }
758
- };
759
- const A = [w[de(T)], w[D[0]], w[D[1]]], F = [...((o = i.autoPlacement) == null ? void 0 : o.overflows) || [], {
760
- placement: T,
761
- overflows: A
762
- }], C = x[p + 1];
763
- if (C)
764
- return {
765
- data: {
766
- index: p + 1,
767
- overflows: F
768
- },
769
- reset: {
770
- placement: C
771
- }
772
- };
773
- const P = F.map((k) => {
774
- const V = le(k.placement);
775
- return [k.placement, V && d ? (
776
- // Check along the mainAxis and main crossAxis side.
777
- k.overflows.slice(0, 2).reduce((I, g) => I + g, 0)
778
- ) : (
779
- // Check only the mainAxis.
780
- k.overflows[0]
781
- ), k.overflows];
782
- }).sort((k, V) => k[1] - V[1]), B = ((r = P.filter((k) => k[2].slice(
783
- 0,
784
- // Aligned placements should not check their opposite crossAxis
785
- // side.
786
- le(k[0]) ? 2 : 3
787
- ).every((V) => V <= 0))[0]) == null ? void 0 : r[0]) || P[0][0];
788
- return B !== l ? {
789
- data: {
790
- index: p + 1,
791
- overflows: F
792
- },
793
- reset: {
794
- placement: B
795
- }
796
- } : {};
797
- }
798
- };
799
- }, to = function(t) {
800
- return t === void 0 && (t = {}), {
801
- name: "flip",
802
- options: t,
803
- async fn(e) {
804
- var n, o;
805
- const {
806
- placement: r,
807
- middlewareData: s,
808
- rects: i,
809
- initialPlacement: l,
810
- platform: f,
811
- elements: a
812
- } = e, {
813
- mainAxis: d = !0,
814
- crossAxis: u = !0,
815
- fallbackPlacements: v,
816
- fallbackStrategy: h = "bestFit",
817
- fallbackAxisSideDirection: b = "none",
818
- flipAlignment: x = !0,
819
- ...w
820
- } = ye(t, e);
821
- if ((n = s.arrow) != null && n.alignmentOffset)
822
- return {};
823
- const p = de(r), T = pe(l), D = de(l) === l, A = await (f.isRTL == null ? void 0 : f.isRTL(a.floating)), F = v || (D || !x ? [Je(l)] : Yn(l)), C = b !== "none";
824
- !v && C && F.push(...qn(l, x, b, A));
825
- const P = [l, ...F], $ = await Le(e, w), B = [];
826
- let k = ((o = s.flip) == null ? void 0 : o.overflows) || [];
827
- if (d && B.push($[p]), u) {
828
- const m = sn(r, i, A);
829
- B.push($[m[0]], $[m[1]]);
830
- }
831
- if (k = [...k, {
832
- placement: r,
833
- overflows: B
834
- }], !B.every((m) => m <= 0)) {
835
- var V, I;
836
- const m = (((V = s.flip) == null ? void 0 : V.index) || 0) + 1, y = P[m];
837
- if (y && (!(u === "alignment" ? T !== pe(y) : !1) || // We leave the current main axis only if every placement on that axis
838
- // overflows the main axis.
839
- k.every((E) => pe(E.placement) === T ? E.overflows[0] > 0 : !0)))
840
- return {
841
- data: {
842
- index: m,
843
- overflows: k
844
- },
845
- reset: {
846
- placement: y
847
- }
848
- };
849
- let c = (I = k.filter((M) => M.overflows[0] <= 0).sort((M, E) => M.overflows[1] - E.overflows[1])[0]) == null ? void 0 : I.placement;
850
- if (!c)
851
- switch (h) {
852
- case "bestFit": {
853
- var g;
854
- const M = (g = k.filter((E) => {
855
- if (C) {
856
- const R = pe(E.placement);
857
- return R === T || // Create a bias to the `y` side axis due to horizontal
858
- // reading directions favoring greater width.
859
- R === "y";
860
- }
861
- return !0;
862
- }).map((E) => [E.placement, E.overflows.filter((R) => R > 0).reduce((R, Y) => R + Y, 0)]).sort((E, R) => E[1] - R[1])[0]) == null ? void 0 : g[0];
863
- M && (c = M);
864
- break;
865
- }
866
- case "initialPlacement":
867
- c = l;
868
- break;
869
- }
870
- if (r !== c)
871
- return {
872
- reset: {
873
- placement: c
874
- }
875
- };
876
- }
877
- return {};
878
- }
879
- };
880
- };
881
- function Ht(t, e) {
882
- return {
883
- top: t.top - e.height,
884
- right: t.right - e.width,
885
- bottom: t.bottom - e.height,
886
- left: t.left - e.width
887
- };
888
- }
889
- function Wt(t) {
890
- return rn.some((e) => t[e] >= 0);
891
- }
892
- const no = function(t) {
893
- return t === void 0 && (t = {}), {
894
- name: "hide",
895
- options: t,
896
- async fn(e) {
897
- const {
898
- rects: n
899
- } = e, {
900
- strategy: o = "referenceHidden",
901
- ...r
902
- } = ye(t, e);
903
- switch (o) {
904
- case "referenceHidden": {
905
- const s = await Le(e, {
906
- ...r,
907
- elementContext: "reference"
908
- }), i = Ht(s, n.reference);
909
- return {
910
- data: {
911
- referenceHiddenOffsets: i,
912
- referenceHidden: Wt(i)
913
- }
914
- };
915
- }
916
- case "escaped": {
917
- const s = await Le(e, {
918
- ...r,
919
- altBoundary: !0
920
- }), i = Ht(s, n.floating);
921
- return {
922
- data: {
923
- escapedOffsets: i,
924
- escaped: Wt(i)
925
- }
926
- };
927
- }
928
- default:
929
- return {};
930
- }
931
- }
932
- };
933
- }, oo = /* @__PURE__ */ new Set(["left", "top"]);
934
- async function ro(t, e) {
935
- const {
936
- placement: n,
937
- platform: o,
938
- elements: r
939
- } = t, s = await (o.isRTL == null ? void 0 : o.isRTL(r.floating)), i = de(n), l = le(n), f = pe(n) === "y", a = oo.has(i) ? -1 : 1, d = s && f ? -1 : 1, u = ye(e, t);
940
- let {
941
- mainAxis: v,
942
- crossAxis: h,
943
- alignmentAxis: b
944
- } = typeof u == "number" ? {
945
- mainAxis: u,
946
- crossAxis: 0,
947
- alignmentAxis: null
948
- } : {
949
- mainAxis: u.mainAxis || 0,
950
- crossAxis: u.crossAxis || 0,
951
- alignmentAxis: u.alignmentAxis
952
- };
953
- return l && typeof b == "number" && (h = l === "end" ? b * -1 : b), f ? {
954
- x: h * d,
955
- y: v * a
956
- } : {
957
- x: v * a,
958
- y: h * d
959
- };
960
- }
961
- const io = function(t) {
962
- return t === void 0 && (t = 0), {
963
- name: "offset",
964
- options: t,
965
- async fn(e) {
966
- var n, o;
967
- const {
968
- x: r,
969
- y: s,
970
- placement: i,
971
- middlewareData: l
972
- } = e, f = await ro(e, t);
973
- return i === ((n = l.offset) == null ? void 0 : n.placement) && (o = l.arrow) != null && o.alignmentOffset ? {} : {
974
- x: r + f.x,
975
- y: s + f.y,
976
- data: {
977
- ...f,
978
- placement: i
979
- }
980
- };
981
- }
982
- };
983
- }, ao = function(t) {
984
- return t === void 0 && (t = {}), {
985
- name: "shift",
986
- options: t,
987
- async fn(e) {
988
- const {
989
- x: n,
990
- y: o,
991
- placement: r
992
- } = e, {
993
- mainAxis: s = !0,
994
- crossAxis: i = !1,
995
- limiter: l = {
996
- fn: (w) => {
997
- let {
998
- x: p,
999
- y: T
1000
- } = w;
1001
- return {
1002
- x: p,
1003
- y: T
1004
- };
1005
- }
1006
- },
1007
- ...f
1008
- } = ye(t, e), a = {
1009
- x: n,
1010
- y: o
1011
- }, d = await Le(e, f), u = pe(de(r)), v = an(u);
1012
- let h = a[v], b = a[u];
1013
- if (s) {
1014
- const w = v === "y" ? "top" : "left", p = v === "y" ? "bottom" : "right", T = h + d[w], D = h - d[p];
1015
- h = gt(T, h, D);
1016
- }
1017
- if (i) {
1018
- const w = u === "y" ? "top" : "left", p = u === "y" ? "bottom" : "right", T = b + d[w], D = b - d[p];
1019
- b = gt(T, b, D);
1020
- }
1021
- const x = l.fn({
1022
- ...e,
1023
- [v]: h,
1024
- [u]: b
1025
- });
1026
- return {
1027
- ...x,
1028
- data: {
1029
- x: x.x - n,
1030
- y: x.y - o,
1031
- enabled: {
1032
- [v]: s,
1033
- [u]: i
1034
- }
1035
- }
1036
- };
1037
- }
1038
- };
1039
- }, so = function(t) {
1040
- return t === void 0 && (t = {}), {
1041
- name: "size",
1042
- options: t,
1043
- async fn(e) {
1044
- var n, o;
1045
- const {
1046
- placement: r,
1047
- rects: s,
1048
- platform: i,
1049
- elements: l
1050
- } = e, {
1051
- apply: f = () => {
1052
- },
1053
- ...a
1054
- } = ye(t, e), d = await Le(e, a), u = de(r), v = le(r), h = pe(r) === "y", {
1055
- width: b,
1056
- height: x
1057
- } = s.floating;
1058
- let w, p;
1059
- u === "top" || u === "bottom" ? (w = u, p = v === (await (i.isRTL == null ? void 0 : i.isRTL(l.floating)) ? "start" : "end") ? "left" : "right") : (p = u, w = v === "end" ? "top" : "bottom");
1060
- const T = x - d.top - d.bottom, D = b - d.left - d.right, A = be(x - d[w], T), F = be(b - d[p], D), C = !e.middlewareData.shift;
1061
- let P = A, $ = F;
1062
- if ((n = e.middlewareData.shift) != null && n.enabled.x && ($ = D), (o = e.middlewareData.shift) != null && o.enabled.y && (P = T), C && !v) {
1063
- const k = ne(d.left, 0), V = ne(d.right, 0), I = ne(d.top, 0), g = ne(d.bottom, 0);
1064
- h ? $ = b - 2 * (k !== 0 || V !== 0 ? k + V : ne(d.left, d.right)) : P = x - 2 * (I !== 0 || g !== 0 ? I + g : ne(d.top, d.bottom));
1065
- }
1066
- await f({
1067
- ...e,
1068
- availableWidth: $,
1069
- availableHeight: P
1070
- });
1071
- const B = await i.getDimensions(l.floating);
1072
- return b !== B.width || x !== B.height ? {
1073
- reset: {
1074
- rects: !0
1075
- }
1076
- } : {};
1077
- }
1078
- };
1079
- };
1080
- function rt() {
1081
- return typeof window < "u";
1082
- }
1083
- function ke(t) {
1084
- return cn(t) ? (t.nodeName || "").toLowerCase() : "#document";
1085
- }
1086
- function oe(t) {
1087
- var e;
1088
- return (t == null || (e = t.ownerDocument) == null ? void 0 : e.defaultView) || window;
1089
- }
1090
- function he(t) {
1091
- var e;
1092
- return (e = (cn(t) ? t.ownerDocument : t.document) || window.document) == null ? void 0 : e.documentElement;
1093
- }
1094
- function cn(t) {
1095
- return rt() ? t instanceof Node || t instanceof oe(t).Node : !1;
1096
- }
1097
- function ce(t) {
1098
- return rt() ? t instanceof Element || t instanceof oe(t).Element : !1;
1099
- }
1100
- function ve(t) {
1101
- return rt() ? t instanceof HTMLElement || t instanceof oe(t).HTMLElement : !1;
1102
- }
1103
- function Kt(t) {
1104
- return !rt() || typeof ShadowRoot > "u" ? !1 : t instanceof ShadowRoot || t instanceof oe(t).ShadowRoot;
1105
- }
1106
- const lo = /* @__PURE__ */ new Set(["inline", "contents"]);
1107
- function $e(t) {
1108
- const {
1109
- overflow: e,
1110
- overflowX: n,
1111
- overflowY: o,
1112
- display: r
1113
- } = ue(t);
1114
- return /auto|scroll|overlay|hidden|clip/.test(e + o + n) && !lo.has(r);
1115
- }
1116
- const co = /* @__PURE__ */ new Set(["table", "td", "th"]);
1117
- function uo(t) {
1118
- return co.has(ke(t));
1119
- }
1120
- const fo = [":popover-open", ":modal"];
1121
- function it(t) {
1122
- return fo.some((e) => {
1123
- try {
1124
- return t.matches(e);
1125
- } catch {
1126
- return !1;
1127
- }
1128
- });
1129
- }
1130
- const vo = ["transform", "translate", "scale", "rotate", "perspective"], ho = ["transform", "translate", "scale", "rotate", "perspective", "filter"], po = ["paint", "layout", "strict", "content"];
1131
- function St(t) {
1132
- const e = Ot(), n = ce(t) ? ue(t) : t;
1133
- return vo.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) || ho.some((o) => (n.willChange || "").includes(o)) || po.some((o) => (n.contain || "").includes(o));
1134
- }
1135
- function mo(t) {
1136
- let e = we(t);
1137
- for (; ve(e) && !Re(e); ) {
1138
- if (St(e))
1139
- return e;
1140
- if (it(e))
1141
- return null;
1142
- e = we(e);
1143
- }
1144
- return null;
1145
- }
1146
- function Ot() {
1147
- return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
1148
- }
1149
- const go = /* @__PURE__ */ new Set(["html", "body", "#document"]);
1150
- function Re(t) {
1151
- return go.has(ke(t));
1152
- }
1153
- function ue(t) {
1154
- return oe(t).getComputedStyle(t);
1155
- }
1156
- function at(t) {
1157
- return ce(t) ? {
1158
- scrollLeft: t.scrollLeft,
1159
- scrollTop: t.scrollTop
1160
- } : {
1161
- scrollLeft: t.scrollX,
1162
- scrollTop: t.scrollY
1163
- };
1164
- }
1165
- function we(t) {
1166
- if (ke(t) === "html")
1167
- return t;
1168
- const e = (
1169
- // Step into the shadow DOM of the parent of a slotted node.
1170
- t.assignedSlot || // DOM Element detected.
1171
- t.parentNode || // ShadowRoot detected.
1172
- Kt(t) && t.host || // Fallback.
1173
- he(t)
1174
- );
1175
- return Kt(e) ? e.host : e;
1176
- }
1177
- function un(t) {
1178
- const e = we(t);
1179
- return Re(e) ? t.ownerDocument ? t.ownerDocument.body : t.body : ve(e) && $e(e) ? e : un(e);
1180
- }
1181
- function He(t, e, n) {
1182
- var o;
1183
- e === void 0 && (e = []), n === void 0 && (n = !0);
1184
- const r = un(t), s = r === ((o = t.ownerDocument) == null ? void 0 : o.body), i = oe(r);
1185
- if (s) {
1186
- const l = bt(i);
1187
- return e.concat(i, i.visualViewport || [], $e(r) ? r : [], l && n ? He(l) : []);
1188
- }
1189
- return e.concat(r, He(r, [], n));
1190
- }
1191
- function bt(t) {
1192
- return t.parent && Object.getPrototypeOf(t.parent) ? t.frameElement : null;
1193
- }
1194
- function fn(t) {
1195
- const e = ue(t);
1196
- let n = parseFloat(e.width) || 0, o = parseFloat(e.height) || 0;
1197
- const r = ve(t), s = r ? t.offsetWidth : n, i = r ? t.offsetHeight : o, l = Ge(n) !== s || Ge(o) !== i;
1198
- return l && (n = s, o = i), {
1199
- width: n,
1200
- height: o,
1201
- $: l
1202
- };
1203
- }
1204
- function At(t) {
1205
- return ce(t) ? t : t.contextElement;
1206
- }
1207
- function Fe(t) {
1208
- const e = At(t);
1209
- if (!ve(e))
1210
- return fe(1);
1211
- const n = e.getBoundingClientRect(), {
1212
- width: o,
1213
- height: r,
1214
- $: s
1215
- } = fn(e);
1216
- let i = (s ? Ge(n.width) : n.width) / o, l = (s ? Ge(n.height) : n.height) / r;
1217
- return (!i || !Number.isFinite(i)) && (i = 1), (!l || !Number.isFinite(l)) && (l = 1), {
1218
- x: i,
1219
- y: l
1220
- };
1221
- }
1222
- const bo = /* @__PURE__ */ fe(0);
1223
- function dn(t) {
1224
- const e = oe(t);
1225
- return !Ot() || !e.visualViewport ? bo : {
1226
- x: e.visualViewport.offsetLeft,
1227
- y: e.visualViewport.offsetTop
1228
- };
1229
- }
1230
- function wo(t, e, n) {
1231
- return e === void 0 && (e = !1), !n || e && n !== oe(t) ? !1 : e;
1232
- }
1233
- function Ae(t, e, n, o) {
1234
- e === void 0 && (e = !1), n === void 0 && (n = !1);
1235
- const r = t.getBoundingClientRect(), s = At(t);
1236
- let i = fe(1);
1237
- e && (o ? ce(o) && (i = Fe(o)) : i = Fe(t));
1238
- const l = wo(s, n, o) ? dn(s) : fe(0);
1239
- let f = (r.left + l.x) / i.x, a = (r.top + l.y) / i.y, d = r.width / i.x, u = r.height / i.y;
1240
- if (s) {
1241
- const v = oe(s), h = o && ce(o) ? oe(o) : o;
1242
- let b = v, x = bt(b);
1243
- for (; x && o && h !== b; ) {
1244
- const w = Fe(x), p = x.getBoundingClientRect(), T = ue(x), D = p.left + (x.clientLeft + parseFloat(T.paddingLeft)) * w.x, A = p.top + (x.clientTop + parseFloat(T.paddingTop)) * w.y;
1245
- f *= w.x, a *= w.y, d *= w.x, u *= w.y, f += D, a += A, b = oe(x), x = bt(b);
1246
- }
1247
- }
1248
- return Qe({
1249
- width: d,
1250
- height: u,
1251
- x: f,
1252
- y: a
1253
- });
1254
- }
1255
- function st(t, e) {
1256
- const n = at(t).scrollLeft;
1257
- return e ? e.left + n : Ae(he(t)).left + n;
1258
- }
1259
- function vn(t, e) {
1260
- const n = t.getBoundingClientRect(), o = n.left + e.scrollLeft - st(t, n), r = n.top + e.scrollTop;
1261
- return {
1262
- x: o,
1263
- y: r
1264
- };
1265
- }
1266
- function yo(t) {
1267
- let {
1268
- elements: e,
1269
- rect: n,
1270
- offsetParent: o,
1271
- strategy: r
1272
- } = t;
1273
- const s = r === "fixed", i = he(o), l = e ? it(e.floating) : !1;
1274
- if (o === i || l && s)
1275
- return n;
1276
- let f = {
1277
- scrollLeft: 0,
1278
- scrollTop: 0
1279
- }, a = fe(1);
1280
- const d = fe(0), u = ve(o);
1281
- if ((u || !u && !s) && ((ke(o) !== "body" || $e(i)) && (f = at(o)), ve(o))) {
1282
- const h = Ae(o);
1283
- a = Fe(o), d.x = h.x + o.clientLeft, d.y = h.y + o.clientTop;
1284
- }
1285
- const v = i && !u && !s ? vn(i, f) : fe(0);
1286
- return {
1287
- width: n.width * a.x,
1288
- height: n.height * a.y,
1289
- x: n.x * a.x - f.scrollLeft * a.x + d.x + v.x,
1290
- y: n.y * a.y - f.scrollTop * a.y + d.y + v.y
1291
- };
1292
- }
1293
- function Eo(t) {
1294
- return Array.from(t.getClientRects());
1295
- }
1296
- function xo(t) {
1297
- const e = he(t), n = at(t), o = t.ownerDocument.body, r = ne(e.scrollWidth, e.clientWidth, o.scrollWidth, o.clientWidth), s = ne(e.scrollHeight, e.clientHeight, o.scrollHeight, o.clientHeight);
1298
- let i = -n.scrollLeft + st(t);
1299
- const l = -n.scrollTop;
1300
- return ue(o).direction === "rtl" && (i += ne(e.clientWidth, o.clientWidth) - r), {
1301
- width: r,
1302
- height: s,
1303
- x: i,
1304
- y: l
1305
- };
1306
- }
1307
- const $t = 25;
1308
- function To(t, e) {
1309
- const n = oe(t), o = he(t), r = n.visualViewport;
1310
- let s = o.clientWidth, i = o.clientHeight, l = 0, f = 0;
1311
- if (r) {
1312
- s = r.width, i = r.height;
1313
- const d = Ot();
1314
- (!d || d && e === "fixed") && (l = r.offsetLeft, f = r.offsetTop);
1315
- }
1316
- const a = st(o);
1317
- if (a <= 0) {
1318
- const d = o.ownerDocument, u = d.body, v = getComputedStyle(u), h = d.compatMode === "CSS1Compat" && parseFloat(v.marginLeft) + parseFloat(v.marginRight) || 0, b = Math.abs(o.clientWidth - u.clientWidth - h);
1319
- b <= $t && (s -= b);
1320
- } else a <= $t && (s += a);
1321
- return {
1322
- width: s,
1323
- height: i,
1324
- x: l,
1325
- y: f
1326
- };
1327
- }
1328
- const Co = /* @__PURE__ */ new Set(["absolute", "fixed"]);
1329
- function So(t, e) {
1330
- const n = Ae(t, !0, e === "fixed"), o = n.top + t.clientTop, r = n.left + t.clientLeft, s = ve(t) ? Fe(t) : fe(1), i = t.clientWidth * s.x, l = t.clientHeight * s.y, f = r * s.x, a = o * s.y;
1331
- return {
1332
- width: i,
1333
- height: l,
1334
- x: f,
1335
- y: a
1336
- };
1337
- }
1338
- function Vt(t, e, n) {
1339
- let o;
1340
- if (e === "viewport")
1341
- o = To(t, n);
1342
- else if (e === "document")
1343
- o = xo(he(t));
1344
- else if (ce(e))
1345
- o = So(e, n);
1346
- else {
1347
- const r = dn(t);
1348
- o = {
1349
- x: e.x - r.x,
1350
- y: e.y - r.y,
1351
- width: e.width,
1352
- height: e.height
1353
- };
1354
- }
1355
- return Qe(o);
1356
- }
1357
- function hn(t, e) {
1358
- const n = we(t);
1359
- return n === e || !ce(n) || Re(n) ? !1 : ue(n).position === "fixed" || hn(n, e);
1360
- }
1361
- function Oo(t, e) {
1362
- const n = e.get(t);
1363
- if (n)
1364
- return n;
1365
- let o = He(t, [], !1).filter((l) => ce(l) && ke(l) !== "body"), r = null;
1366
- const s = ue(t).position === "fixed";
1367
- let i = s ? we(t) : t;
1368
- for (; ce(i) && !Re(i); ) {
1369
- const l = ue(i), f = St(i);
1370
- !f && l.position === "fixed" && (r = null), (s ? !f && !r : !f && l.position === "static" && !!r && Co.has(r.position) || $e(i) && !f && hn(t, i)) ? o = o.filter((d) => d !== i) : r = l, i = we(i);
1371
- }
1372
- return e.set(t, o), o;
1373
- }
1374
- function Ao(t) {
1375
- let {
1376
- element: e,
1377
- boundary: n,
1378
- rootBoundary: o,
1379
- strategy: r
1380
- } = t;
1381
- const i = [...n === "clippingAncestors" ? it(e) ? [] : Oo(e, this._c) : [].concat(n), o], l = i[0], f = i.reduce((a, d) => {
1382
- const u = Vt(e, d, r);
1383
- return a.top = ne(u.top, a.top), a.right = be(u.right, a.right), a.bottom = be(u.bottom, a.bottom), a.left = ne(u.left, a.left), a;
1384
- }, Vt(e, l, r));
1385
- return {
1386
- width: f.right - f.left,
1387
- height: f.bottom - f.top,
1388
- x: f.left,
1389
- y: f.top
1390
- };
1391
- }
1392
- function Do(t) {
1393
- const {
1394
- width: e,
1395
- height: n
1396
- } = fn(t);
1397
- return {
1398
- width: e,
1399
- height: n
1400
- };
1401
- }
1402
- function Po(t, e, n) {
1403
- const o = ve(e), r = he(e), s = n === "fixed", i = Ae(t, !0, s, e);
1404
- let l = {
1405
- scrollLeft: 0,
1406
- scrollTop: 0
1407
- };
1408
- const f = fe(0);
1409
- function a() {
1410
- f.x = st(r);
1411
- }
1412
- if (o || !o && !s)
1413
- if ((ke(e) !== "body" || $e(r)) && (l = at(e)), o) {
1414
- const h = Ae(e, !0, s, e);
1415
- f.x = h.x + e.clientLeft, f.y = h.y + e.clientTop;
1416
- } else r && a();
1417
- s && !o && r && a();
1418
- const d = r && !o && !s ? vn(r, l) : fe(0), u = i.left + l.scrollLeft - f.x - d.x, v = i.top + l.scrollTop - f.y - d.y;
1419
- return {
1420
- x: u,
1421
- y: v,
1422
- width: i.width,
1423
- height: i.height
1424
- };
1425
- }
1426
- function ut(t) {
1427
- return ue(t).position === "static";
1428
- }
1429
- function jt(t, e) {
1430
- if (!ve(t) || ue(t).position === "fixed")
1431
- return null;
1432
- if (e)
1433
- return e(t);
1434
- let n = t.offsetParent;
1435
- return he(t) === n && (n = n.ownerDocument.body), n;
1436
- }
1437
- function pn(t, e) {
1438
- const n = oe(t);
1439
- if (it(t))
1440
- return n;
1441
- if (!ve(t)) {
1442
- let r = we(t);
1443
- for (; r && !Re(r); ) {
1444
- if (ce(r) && !ut(r))
1445
- return r;
1446
- r = we(r);
1447
- }
1448
- return n;
1449
- }
1450
- let o = jt(t, e);
1451
- for (; o && uo(o) && ut(o); )
1452
- o = jt(o, e);
1453
- return o && Re(o) && ut(o) && !St(o) ? n : o || mo(t) || n;
1454
- }
1455
- const No = async function(t) {
1456
- const e = this.getOffsetParent || pn, n = this.getDimensions, o = await n(t.floating);
1457
- return {
1458
- reference: Po(t.reference, await e(t.floating), t.strategy),
1459
- floating: {
1460
- x: 0,
1461
- y: 0,
1462
- width: o.width,
1463
- height: o.height
1464
- }
1465
- };
1466
- };
1467
- function Fo(t) {
1468
- return ue(t).direction === "rtl";
1469
- }
1470
- const Lo = {
1471
- convertOffsetParentRelativeRectToViewportRelativeRect: yo,
1472
- getDocumentElement: he,
1473
- getClippingRect: Ao,
1474
- getOffsetParent: pn,
1475
- getElementRects: No,
1476
- getClientRects: Eo,
1477
- getDimensions: Do,
1478
- getScale: Fe,
1479
- isElement: ce,
1480
- isRTL: Fo
1481
- };
1482
- function mn(t, e) {
1483
- return t.x === e.x && t.y === e.y && t.width === e.width && t.height === e.height;
1484
- }
1485
- function Ro(t, e) {
1486
- let n = null, o;
1487
- const r = he(t);
1488
- function s() {
1489
- var l;
1490
- clearTimeout(o), (l = n) == null || l.disconnect(), n = null;
1491
- }
1492
- function i(l, f) {
1493
- l === void 0 && (l = !1), f === void 0 && (f = 1), s();
1494
- const a = t.getBoundingClientRect(), {
1495
- left: d,
1496
- top: u,
1497
- width: v,
1498
- height: h
1499
- } = a;
1500
- if (l || e(), !v || !h)
1501
- return;
1502
- const b = ze(u), x = ze(r.clientWidth - (d + v)), w = ze(r.clientHeight - (u + h)), p = ze(d), D = {
1503
- rootMargin: -b + "px " + -x + "px " + -w + "px " + -p + "px",
1504
- threshold: ne(0, be(1, f)) || 1
1505
- };
1506
- let A = !0;
1507
- function F(C) {
1508
- const P = C[0].intersectionRatio;
1509
- if (P !== f) {
1510
- if (!A)
1511
- return i();
1512
- P ? i(!1, P) : o = setTimeout(() => {
1513
- i(!1, 1e-7);
1514
- }, 1e3);
1515
- }
1516
- P === 1 && !mn(a, t.getBoundingClientRect()) && i(), A = !1;
1517
- }
1518
- try {
1519
- n = new IntersectionObserver(F, {
1520
- ...D,
1521
- // Handle <iframe>s
1522
- root: r.ownerDocument
1523
- });
1524
- } catch {
1525
- n = new IntersectionObserver(F, D);
1526
- }
1527
- n.observe(t);
1528
- }
1529
- return i(!0), s;
1530
- }
1531
- function ko(t, e, n, o) {
1532
- o === void 0 && (o = {});
1533
- const {
1534
- ancestorScroll: r = !0,
1535
- ancestorResize: s = !0,
1536
- elementResize: i = typeof ResizeObserver == "function",
1537
- layoutShift: l = typeof IntersectionObserver == "function",
1538
- animationFrame: f = !1
1539
- } = o, a = At(t), d = r || s ? [...a ? He(a) : [], ...He(e)] : [];
1540
- d.forEach((p) => {
1541
- r && p.addEventListener("scroll", n, {
1542
- passive: !0
1543
- }), s && p.addEventListener("resize", n);
1544
- });
1545
- const u = a && l ? Ro(a, n) : null;
1546
- let v = -1, h = null;
1547
- i && (h = new ResizeObserver((p) => {
1548
- let [T] = p;
1549
- T && T.target === a && h && (h.unobserve(e), cancelAnimationFrame(v), v = requestAnimationFrame(() => {
1550
- var D;
1551
- (D = h) == null || D.observe(e);
1552
- })), n();
1553
- }), a && !f && h.observe(a), h.observe(e));
1554
- let b, x = f ? Ae(t) : null;
1555
- f && w();
1556
- function w() {
1557
- const p = Ae(t);
1558
- x && !mn(x, p) && n(), x = p, b = requestAnimationFrame(w);
1559
- }
1560
- return n(), () => {
1561
- var p;
1562
- d.forEach((T) => {
1563
- r && T.removeEventListener("scroll", n), s && T.removeEventListener("resize", n);
1564
- }), u == null || u(), (p = h) == null || p.disconnect(), h = null, f && cancelAnimationFrame(b);
1565
- };
1566
- }
1567
- const $r = io, Vr = eo, jr = ao, _r = to, Yr = so, zr = no, Mo = Jn, Io = (t, e, n) => {
1568
- const o = /* @__PURE__ */ new Map(), r = {
1569
- platform: Lo,
1570
- ...n
1571
- }, s = {
1572
- ...r.platform,
1573
- _c: o
1574
- };
1575
- return Zn(t, e, {
1576
- ...r,
1577
- platform: s
1578
- });
1579
- };
1580
- function Bo(t) {
1581
- return {
1582
- name: "arrow",
1583
- options: t,
1584
- fn(e) {
1585
- const n = N(t.element);
1586
- return n == null ? {} : Mo({ element: n, padding: t.padding }).fn(e);
1587
- }
1588
- };
1589
- }
1590
- function Ho(t, e, n = {}) {
1591
- const {
1592
- transform: o = !0,
1593
- middlewares: r,
1594
- autoUpdate: s = !0,
1595
- open: i = te(!1),
1596
- onOpenChange: l
1597
- } = n, f = (C, P, $) => {
1598
- if (i.value === C) return;
1599
- i.value = C;
1600
- const B = P ?? "programmatic";
1601
- l == null || l(C, B, $);
1602
- }, a = W(() => N(n.placement) ?? "bottom"), d = W(() => N(n.strategy) ?? "absolute"), u = te(0), v = te(0), h = te(a.value), b = te(d.value), x = qe({}), w = te(!1), p = te(null), T = W(() => {
1603
- const C = N(r) || [];
1604
- return p.value && !C.some(($) => $.name === "arrow") ? [...C, Bo({ element: p })] : C;
1605
- }), D = async () => {
1606
- if (!(!t.value || !e.value))
1607
- try {
1608
- const C = await Io(t.value, e.value, {
1609
- placement: a.value,
1610
- strategy: d.value,
1611
- middleware: T.value
1612
- });
1613
- u.value = C.x, v.value = C.y, h.value = C.placement, b.value = C.strategy, x.value = C.middlewareData, w.value = i.value;
1614
- } catch {
1615
- }
1616
- };
1617
- ae([a, d, T], () => {
1618
- i.value && D();
1619
- });
1620
- let A;
1621
- ae(
1622
- [t, e, i],
1623
- ([C, P, $]) => {
1624
- !$ || !C || !P || (s && (A = ko(
1625
- C,
1626
- P,
1627
- D,
1628
- typeof s == "object" ? s : void 0
1629
- )), ge(() => {
1630
- A == null || A(), A = void 0;
1631
- }));
1632
- },
1633
- { immediate: !0 }
1634
- ), Oe(() => A == null ? void 0 : A()), ae(i, (C) => {
1635
- C || (w.value = !1);
1636
- });
1637
- const F = te({
1638
- position: d.value,
1639
- left: "0",
1640
- top: "0"
1641
- });
1642
- return ae(
1643
- [u, v, () => N(o)],
1644
- ([C, P, $]) => {
1645
- const B = e.value;
1646
- if (!B) return;
1647
- const k = {
1648
- position: b.value,
1649
- left: "0",
1650
- top: "0"
1651
- }, V = _t(B, C), I = _t(B, P);
1652
- $ ? F.value = {
1653
- ...k,
1654
- transform: `translate(${V}px, ${I}px)`,
1655
- ...gn(B) >= 1.5 && {
1656
- "will-change": "transform"
1657
- }
1658
- } : F.value = {
1659
- ...k,
1660
- left: `${V}px`,
1661
- top: `${I}px`
1662
- };
1663
- },
1664
- { immediate: !0 }
1665
- ), {
1666
- id: n.id,
1667
- x: u,
1668
- y: v,
1669
- strategy: b,
1670
- placement: h,
1671
- middlewareData: x,
1672
- isPositioned: w,
1673
- floatingStyles: F,
1674
- update: D,
1675
- refs: {
1676
- anchorEl: t,
1677
- floatingEl: e,
1678
- arrowEl: p
1679
- },
1680
- open: i,
1681
- setOpen: f
1682
- };
1683
- }
1684
- function _t(t, e) {
1685
- const n = gn(t);
1686
- return Math.round(e * n) / n;
1687
- }
1688
- function gn(t) {
1689
- return typeof window > "u" ? 1 : (t.ownerDocument.defaultView || window).devicePixelRatio || 1;
1690
- }
1691
- function Xr(t = {}) {
1692
- let e;
1693
- return e = Wo(t), {
1694
- ...e,
1695
- get root() {
1696
- return e.root;
1697
- },
1698
- addNode: (i, l, f = {}) => {
1699
- const { parentId: a, ...d } = f, u = tn(), v = d.onOpenChange, h = Ho(i, l, {
1700
- ...d,
1701
- id: u,
1702
- onOpenChange: (x, w, p) => {
1703
- if (v == null || v(x, w, p), !x) {
1704
- const T = e.findNodeById(u);
1705
- if (T) {
1706
- const D = T.children.value;
1707
- for (const A of D)
1708
- A.data.open.value && A.data.setOpen(!1, "tree-ancestor-close", p);
1709
- }
1710
- }
1711
- }
1712
- });
1713
- return e.addNode(h, a, { id: u });
1714
- },
1715
- getAllOpenNodes: () => {
1716
- const i = [];
1717
- for (const l of e.nodeMap.values())
1718
- l.data.open.value && i.push(l);
1719
- return i;
1720
- },
1721
- getDeepestOpenNode: () => {
1722
- let i = null, l = -1;
1723
- for (const f of e.nodeMap.values())
1724
- if (f.data.open.value) {
1725
- const a = f.getPath().length;
1726
- a > l && (l = a, i = f);
1727
- }
1728
- return i;
1729
- },
1730
- applyToNodes: (i, l, f = {}) => {
1731
- const { relationship: a = "self-and-children", applyToMatching: d = !0 } = f, u = e.findNodeById(i);
1732
- if (!u)
1733
- return;
1734
- const v = [], h = /* @__PURE__ */ new Set(), b = (w) => {
1735
- w && !h.has(w.id) && (v.push(w), h.add(w.id));
1736
- }, x = (w) => {
1737
- for (const p of w)
1738
- b(p);
1739
- };
1740
- if (a === "ancestors-only")
1741
- for (const w of u.getPath())
1742
- w.id !== u.id && b(w);
1743
- else if (a === "siblings-only") {
1744
- if (u.parent.value)
1745
- for (const w of u.parent.value.children.value)
1746
- w.id !== u.id && b(w);
1747
- } else if (a === "descendants-only")
1748
- for (const w of e.traverse("dfs", u))
1749
- w.id !== u.id && b(w);
1750
- else if (a === "children-only")
1751
- x(u.children.value);
1752
- else if (a === "self-and-ancestors")
1753
- x(u.getPath());
1754
- else if (a === "self-and-children")
1755
- b(u), x(u.children.value);
1756
- else if (a === "self-and-descendants")
1757
- x(e.traverse("dfs", u));
1758
- else if (a === "self-and-siblings")
1759
- b(u), u.parent.value && x(u.parent.value.children.value);
1760
- else if (a === "self-ancestors-and-children")
1761
- x(u.getPath()), x(u.children.value);
1762
- else if (a === "full-branch")
1763
- x(u.getPath()), x(e.traverse("dfs", u));
1764
- else if (a === "all-except-branch") {
1765
- const w = /* @__PURE__ */ new Set();
1766
- for (const p of u.getPath())
1767
- w.add(p.id);
1768
- for (const p of e.traverse("dfs", u))
1769
- w.add(p.id);
1770
- for (const p of e.nodeMap.values())
1771
- !w.has(p.id) === d && l(p);
1772
- return;
1773
- } else {
1774
- console.warn(`applyToNodes: Unknown relationship "${a}".`);
1775
- return;
1776
- }
1777
- if (d)
1778
- for (const w of v)
1779
- l(w);
1780
- else
1781
- for (const w of e.nodeMap.values())
1782
- h.has(w.id) || l(w);
1783
- }
1784
- };
1785
- }
1786
- function Yt(t, e = null, n = {}, o = !1) {
1787
- const r = n.id ?? tn(), s = qe(e), i = qe([]), l = W(() => i.value.length === 0), f = {
1788
- id: r,
1789
- data: t,
1790
- parent: s,
1791
- children: i,
1792
- isRoot: o,
1793
- isLeaf: l,
1794
- addChild: (a) => {
1795
- i.value = [...i.value, a];
1796
- },
1797
- _removeChildInstance: (a) => i.value.includes(a) ? (i.value = i.value.filter((d) => d.id !== a.id), a.parent.value = null, !0) : !1,
1798
- findChild: (a) => i.value.find(a) ?? null,
1799
- findDescendant: (a) => {
1800
- const d = [f];
1801
- for (; d.length > 0; ) {
1802
- const u = d.pop();
1803
- if (a(u))
1804
- return u;
1805
- for (let v = u.children.value.length - 1; v >= 0; v--)
1806
- d.push(u.children.value[v]);
1807
- }
1808
- return null;
1809
- },
1810
- isDescendantOf: (a) => {
1811
- let d = s.value;
1812
- for (; d; ) {
1813
- if (d.id === a.id)
1814
- return !0;
1815
- d = d.parent.value;
1816
- }
1817
- return !1;
1818
- },
1819
- getPath: () => {
1820
- const a = [];
1821
- let d = f;
1822
- for (; d; )
1823
- a.push(d), d = d.parent.value;
1824
- return a.reverse();
1825
- }
1826
- };
1827
- return Object.freeze(f);
1828
- }
1829
- function Wo(t) {
1830
- const e = (t == null ? void 0 : t.deleteStrategy) ?? "recursive", n = Nn(/* @__PURE__ */ new Map());
1831
- let o = null;
1832
- const r = (u) => n.get(u) ?? null, s = (u, v = null, h = {}) => {
1833
- if (!o) {
1834
- if (v != null)
1835
- return console.error(
1836
- `Tree addNode: Cannot add a non-root node before a root exists. Received parentId=${v}.`
1837
- ), null;
1838
- const w = Yt(u, null, h, !0);
1839
- return n.set(w.id, w), o = w, w;
1840
- }
1841
- const b = v ? r(v) : o;
1842
- if (!b)
1843
- return console.error(`Tree addNode: Parent node with ID ${v} not found.`), null;
1844
- h.id && n.has(h.id) && (h.id = void 0);
1845
- const x = Yt(u, b, h);
1846
- return n.set(x.id, x), b.addChild(x), x;
1847
- }, i = (u, v) => {
1848
- const h = v ?? e, b = r(u);
1849
- if (!b)
1850
- return !1;
1851
- if (b.isRoot)
1852
- return console.error("Tree removeNode: Cannot remove the root node."), !1;
1853
- const x = b.parent.value;
1854
- if (h === "recursive")
1855
- d(b);
1856
- else {
1857
- for (const w of b.children.value)
1858
- w.parent.value = null;
1859
- b.children.value = [], n.delete(b.id);
1860
- }
1861
- return x._removeChildInstance(b);
1862
- }, l = (u, v) => {
1863
- const h = r(u);
1864
- if (!h)
1865
- return console.error(`Tree moveNode: Node with ID ${u} not found.`), !1;
1866
- if (h.isRoot)
1867
- return console.error("Tree moveNode: Cannot move the root node."), !1;
1868
- if (u === v)
1869
- return console.error("Tree moveNode: Cannot move a node to be a child of itself."), !1;
1870
- const b = v ? r(v) : o;
1871
- if (!b)
1872
- return console.error(`Tree moveNode: New parent node with ID ${v} not found.`), !1;
1873
- if (b.isDescendantOf(h))
1874
- return console.error("Tree moveNode: Cannot move a node to become its own descendant."), !1;
1875
- const x = h.parent.value;
1876
- if (x) {
1877
- if (!x._removeChildInstance(h))
1878
- return console.error("Tree moveNode: Failed to remove node from its original parent."), !1;
1879
- } else if (h.isRoot) {
1880
- if (h.isRoot)
1881
- return console.error("Tree moveNode: Attempting to move the root node, which is not allowed."), !1;
1882
- }
1883
- return b.addChild(h), h.parent.value = b, !0;
1884
- }, f = (u = "dfs", v = o) => {
1885
- const h = [];
1886
- if (!v)
1887
- return console.warn("Tree traverse: Start node is null, returning empty array."), h;
1888
- if (u === "dfs") {
1889
- const b = [v];
1890
- for (; b.length > 0; ) {
1891
- const x = b.pop();
1892
- h.push(x);
1893
- for (let w = x.children.value.length - 1; w >= 0; w--)
1894
- b.push(x.children.value[w]);
1895
- }
1896
- } else {
1897
- const b = [v];
1898
- for (; b.length > 0; ) {
1899
- const x = b.shift();
1900
- h.push(x);
1901
- for (const w of x.children.value)
1902
- b.push(w);
1903
- }
1904
- }
1905
- return h;
1906
- }, a = () => {
1907
- n.clear();
1908
- }, d = (u) => {
1909
- const v = [...u.children.value];
1910
- for (const h of v)
1911
- d(h);
1912
- n.delete(u.id), u.children.value = [];
1913
- };
1914
- return Object.freeze({
1915
- get root() {
1916
- return o;
1917
- },
1918
- get nodeMap() {
1919
- return n;
1920
- },
1921
- findNodeById: r,
1922
- addNode: s,
1923
- removeNode: i,
1924
- moveNode: l,
1925
- traverse: f,
1926
- dispose: a
1927
- });
1928
- }
1929
- function Ko(t) {
1930
- return Fn() ? (Oe(t), !0) : !1;
1931
- }
1932
- const $o = typeof window < "u" && typeof document < "u";
1933
- typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
1934
- const Vo = Object.prototype.toString, jo = (t) => Vo.call(t) === "[object Object]";
1935
- function ft(t) {
1936
- return Array.isArray(t) ? t : [t];
1937
- }
1938
- function _o(t, e, n) {
1939
- return ae(
1940
- t,
1941
- e,
1942
- {
1943
- ...n,
1944
- immediate: !0
1945
- }
1946
- );
1947
- }
1948
- const Yo = $o ? window : void 0;
1949
- function zo(t) {
1950
- var e;
1951
- const n = N(t);
1952
- return (e = n == null ? void 0 : n.$el) != null ? e : n;
1953
- }
1954
- function Q(...t) {
1955
- const e = [], n = () => {
1956
- e.forEach((l) => l()), e.length = 0;
1957
- }, o = (l, f, a, d) => (l.addEventListener(f, a, d), () => l.removeEventListener(f, a, d)), r = W(() => {
1958
- const l = ft(N(t[0])).filter((f) => f != null);
1959
- return l.every((f) => typeof f != "string") ? l : void 0;
1960
- }), s = _o(
1961
- () => {
1962
- var l, f;
1963
- return [
1964
- (f = (l = r.value) == null ? void 0 : l.map((a) => zo(a))) != null ? f : [Yo].filter((a) => a != null),
1965
- ft(N(r.value ? t[1] : t[0])),
1966
- ft(Ln(r.value ? t[2] : t[1])),
1967
- // @ts-expect-error - TypeScript gets the correct types, but somehow still complains
1968
- N(r.value ? t[3] : t[2])
1969
- ];
1970
- },
1971
- ([l, f, a, d]) => {
1972
- if (n(), !(l != null && l.length) || !(f != null && f.length) || !(a != null && a.length))
1973
- return;
1974
- const u = jo(d) ? { ...d } : d;
1975
- e.push(
1976
- ...l.flatMap(
1977
- (v) => f.flatMap(
1978
- (h) => a.map((b) => o(v, h, b, u))
1979
- )
1980
- )
1981
- );
1982
- },
1983
- { flush: "post" }
1984
- ), i = () => {
1985
- s(), n();
1986
- };
1987
- return Ko(n), i;
1988
- }
1989
- function Ur(t, e = {}) {
1990
- const { floatingContext: n, treeContext: o } = Ke(t), { open: r, setOpen: s, refs: i } = n, {
1991
- enabled: l = !0,
1992
- event: f = "click",
1993
- toggle: a = !0,
1994
- ignoreMouse: d = !1,
1995
- ignoreKeyboard: u = !1,
1996
- ignoreTouch: v = !1,
1997
- // Outside click options
1998
- outsideClick: h = !1,
1999
- outsideEvent: b = "pointerdown",
2000
- outsideCapture: x = !0,
2001
- onOutsideClick: w,
2002
- preventScrollbarClick: p = !0,
2003
- handleDragEvents: T = !0
2004
- } = e;
2005
- let D, A = !1, F = !1, C = !1;
2006
- const P = W(() => N(l)), $ = W(() => N(h)), B = W(() => {
2007
- const S = i.anchorEl.value;
2008
- return S instanceof HTMLElement ? S : null;
2009
- }), k = W(() => i.floatingEl.value);
2010
- function V(S, z) {
2011
- C = !0;
2012
- try {
2013
- r.value ? N(a) && s(!1, S, z) : s(!0, S, z);
2014
- } finally {
2015
- Promise.resolve().then(() => {
2016
- C = !1;
2017
- });
2018
- }
2019
- }
2020
- function I() {
2021
- D = void 0, A = !1, F = !1;
2022
- }
2023
- function g(S) {
2024
- D = S.pointerType;
2025
- }
2026
- function m(S) {
2027
- S.button === 0 && N(f) !== "click" && (j(D) || V("anchor-click", S));
2028
- }
2029
- function y(S) {
2030
- if (N(u) && S.detail === 0) {
2031
- I();
2032
- return;
2033
- }
2034
- if (N(f) === "mousedown" && D) {
2035
- I();
2036
- return;
2037
- }
2038
- if (j(D)) {
2039
- I();
2040
- return;
2041
- }
2042
- V("anchor-click", S), I();
2043
- }
2044
- function c(S) {
2045
- if (D = void 0, S.defaultPrevented || N(u) || Dt(S))
2046
- return;
2047
- const z = B.value;
2048
- z && (S.key === " " && !Pt(z) && (S.preventDefault(), A = !0), S.key === "Enter" && V("keyboard-activate", S));
2049
- }
2050
- function M(S) {
2051
- const z = B.value;
2052
- z && (S.defaultPrevented || N(u) || Dt(S) || Pt(z) || S.key === " " && A && (A = !1, V("keyboard-activate", S)));
2053
- }
2054
- function E(S) {
2055
- if (!P.value || !$.value || !r.value)
2056
- return;
2057
- if (N(b) === "click" && N(T) && F) {
2058
- F = !1;
2059
- return;
2060
- }
2061
- if (C)
2062
- return;
2063
- const z = S.target;
2064
- if (z && !(N(p) && pt(z) && k.value && Bn(S, z))) {
2065
- if (o) {
2066
- if (!Xo(o, z))
2067
- return;
2068
- } else if (Nt(S, B.value) || Nt(S, k.value))
2069
- return;
2070
- w ? w(S, n) : s(!1, "outside-pointer", S);
2071
- }
2072
- }
2073
- function R() {
2074
- F = !0;
2075
- }
2076
- function Y() {
2077
- setTimeout(() => {
2078
- F = !1;
2079
- }, 0);
2080
- }
2081
- function j(S) {
2082
- return !!(nn(S, !0) && N(d) || S === "touch" && N(v));
2083
- }
2084
- Ce(() => {
2085
- const S = B.value;
2086
- !P.value || !S || (S.addEventListener("pointerdown", g), S.addEventListener("mousedown", m), S.addEventListener("click", y), S.addEventListener("keydown", c), S.addEventListener("keyup", M), ge(() => {
2087
- S.removeEventListener("pointerdown", g), S.removeEventListener("mousedown", m), S.removeEventListener("click", y), S.removeEventListener("keydown", c), S.removeEventListener("keyup", M), I();
2088
- }));
2089
- }), Q(
2090
- () => P.value && $.value ? document : null,
2091
- () => N(b),
2092
- E,
2093
- { capture: N(x) }
2094
- ), Q(
2095
- () => P.value && $.value && N(T) ? k.value : null,
2096
- "mousedown",
2097
- R,
2098
- { capture: !0 }
2099
- ), Q(
2100
- () => P.value && $.value && N(T) ? k.value : null,
2101
- "mouseup",
2102
- Y,
2103
- { capture: !0 }
2104
- );
2105
- }
2106
- function Xo(t, e) {
2107
- return !(se(e, t.data.refs.anchorEl.value) || se(e, t.data.refs.floatingEl.value) || xt(t, e));
2108
- }
2109
- function qr(t, e = {}) {
2110
- const { floatingContext: n, treeContext: o } = Ke(t), { enabled: r = !0, capture: s = !1, onEscape: i } = e, { isComposing: l } = qo();
2111
- Q(document, "keydown", (a) => {
2112
- if (!(a.key !== "Escape" || !N(r) || l())) {
2113
- if (i) {
2114
- i(a);
2115
- return;
2116
- }
2117
- if (o) {
2118
- const d = Uo(o);
2119
- d && d.data.setOpen(!1, "escape-key", a);
2120
- } else
2121
- n.setOpen(!1, "escape-key", a);
2122
- }
2123
- }, s);
2124
- }
2125
- function Uo(t) {
2126
- var s;
2127
- let e = t;
2128
- for (; (s = e.parent) != null && s.value && !e.isRoot; )
2129
- e = e.parent.value;
2130
- let n = null, o = -1;
2131
- const r = (i) => {
2132
- var f;
2133
- if (i.data.open.value) {
2134
- const a = i.getPath().length;
2135
- a > o && (o = a, n = i);
2136
- }
2137
- const l = ((f = i.children) == null ? void 0 : f.value) ?? [];
2138
- for (const a of l)
2139
- r(a);
2140
- };
2141
- return r(e), n;
2142
- }
2143
- function qo() {
2144
- const t = te(!1);
2145
- return Q(document, "compositionstart", () => {
2146
- t.value = !0;
2147
- }), Q(document, "compositionend", () => {
2148
- t.value = !1;
2149
- }), {
2150
- isComposing: () => t.value
2151
- };
2152
- }
2153
- const Ue = te(!1);
2154
- typeof window < "u" && (Q(
2155
- window,
2156
- "keydown",
2157
- () => {
2158
- Ue.value = !0;
2159
- },
2160
- { capture: !0 }
2161
- ), Q(
2162
- window,
2163
- "pointerdown",
2164
- () => {
2165
- Ue.value = !1;
2166
- },
2167
- { capture: !0 }
2168
- ), Q(
2169
- window,
2170
- "pointermove",
2171
- () => {
2172
- Ue.value = !1;
2173
- },
2174
- { capture: !0 }
2175
- ));
2176
- const bn = en(Ue), Go = 0;
2177
- function Gr(t, e = {}) {
2178
- const {
2179
- open: n,
2180
- setOpen: o,
2181
- refs: { floatingEl: r, anchorEl: s }
2182
- } = t, { enabled: i = !0, requireFocusVisible: l = !0, tree: f } = e, a = W(() => s.value ? s.value instanceof HTMLElement ? s.value : s.value.contextElement : null);
2183
- let d = !1;
2184
- const u = kn() && Mn();
2185
- let v, h = new Zo(r);
2186
- if (f) {
2187
- let p = null;
2188
- if (t.id && (p = f.findNodeById(t.id)), !p) {
2189
- for (const T of f.nodeMap.values())
2190
- if (T.data === t) {
2191
- p = T;
2192
- break;
2193
- }
2194
- }
2195
- p && (h = new Jo(p));
2196
- }
2197
- Q(window, "blur", () => {
2198
- !n.value && a.value && a.value === document.activeElement && (d = !0);
2199
- }), Q(window, "focus", () => {
2200
- d = !1;
2201
- });
2202
- function b(p) {
2203
- if (d) {
2204
- d = !1;
2205
- return;
2206
- }
2207
- const T = p.target instanceof Element ? p.target : null;
2208
- if (N(l) && T) {
2209
- if (u && !p.relatedTarget) {
2210
- if (!bn.value && !Et(T))
2211
- return;
2212
- } else if (!In(T))
2213
- return;
2214
- }
2215
- try {
2216
- o(!0, "focus", p);
2217
- } catch (D) {
2218
- console.error("[useFocus] Error in onFocus handler:", D);
2219
- }
2220
- }
2221
- function x(p) {
2222
- clearTimeout(v), v = window.setTimeout(() => {
2223
- var A;
2224
- const D = (((A = a.value) == null ? void 0 : A.ownerDocument) ?? document).activeElement;
2225
- if (!(!p.relatedTarget && D === a.value) && !h.shouldRemainOpen(D))
2226
- try {
2227
- if (D instanceof Element) {
2228
- const F = h.getAncestorsToClose(D);
2229
- for (const C of F)
2230
- try {
2231
- C.data.setOpen(!1, "tree-ancestor-close", p);
2232
- } catch (P) {
2233
- console.error("[useFocus] Error closing ancestor on blur:", P);
2234
- }
2235
- }
2236
- o(!1, "blur", p);
2237
- } catch (F) {
2238
- console.error("[useFocus] Error in onBlur handler:", F);
2239
- }
2240
- }, Go);
2241
- }
2242
- Q(
2243
- document,
2244
- "focusin",
2245
- (p) => {
2246
- if (!N(i)) return;
2247
- const T = p.target;
2248
- if (!(T instanceof Element)) return;
2249
- const D = a.value;
2250
- if (!(D && se(T, D)) && !h.shouldRemainOpen(T))
2251
- try {
2252
- const A = h.getAncestorsToClose(T);
2253
- for (const F of A)
2254
- try {
2255
- F.data.setOpen(!1, "tree-ancestor-close", p);
2256
- } catch (C) {
2257
- console.error("[useFocus] Error closing ancestor on focusin:", C);
2258
- }
2259
- o(!1, "blur", p);
2260
- } catch (A) {
2261
- console.error("[useFocus] Error in document focusin handler:", A);
2262
- }
2263
- },
2264
- { capture: !0 }
2265
- );
2266
- const w = Ce(() => {
2267
- if (!N(i)) return;
2268
- const p = a.value;
2269
- !p || !(p instanceof HTMLElement) || (p.addEventListener("focus", b), p.addEventListener("blur", x), ge(() => {
2270
- p.removeEventListener("focus", b), p.removeEventListener("blur", x);
2271
- }));
2272
- });
2273
- return Oe(() => {
2274
- clearTimeout(v);
2275
- }), {
2276
- /**
2277
- * Cleanup function that removes all event listeners and clears pending timeouts.
2278
- * Useful for manual cleanup in testing scenarios.
2279
- */
2280
- cleanup: () => {
2281
- clearTimeout(v), w();
2282
- }
2283
- };
2284
- }
2285
- class Zo {
2286
- constructor(e) {
2287
- this.floatingEl = e;
2288
- }
2289
- shouldRemainOpen(e) {
2290
- return !e || !this.floatingEl.value ? !1 : this.floatingEl.value.contains(e);
2291
- }
2292
- getAncestorsToClose(e) {
2293
- return [];
2294
- }
2295
- }
2296
- class Jo {
2297
- constructor(e) {
2298
- this.treeContext = e;
2299
- }
2300
- shouldRemainOpen(e) {
2301
- return e ? this.isFocusWithinNodeHierarchy(this.treeContext, e) : !1;
2302
- }
2303
- /**
2304
- * Returns a list of ancestors (starting from the immediate parent upward) that do not
2305
- * contain the provided target within their subtree. Useful for closing ancestors when
2306
- * focus moves outside the current branch.
2307
- */
2308
- getAncestorsToClose(e) {
2309
- const n = [];
2310
- let o = this.treeContext.parent.value;
2311
- for (; o; ) {
2312
- if (!this.isFocusWithinNodeHierarchy(o, e)) {
2313
- n.push(o), o = o.parent.value;
2314
- continue;
2315
- }
2316
- break;
2317
- }
2318
- return n;
2319
- }
2320
- isFocusWithinNodeHierarchy(e, n) {
2321
- return se(n, e.data.refs.anchorEl.value) || se(n, e.data.refs.floatingEl.value) ? !0 : this.findDescendantContainingFocus(e, n) !== null;
2322
- }
2323
- findDescendantContainingFocus(e, n) {
2324
- for (const o of e.children.value)
2325
- if (o.data.open.value) {
2326
- if (se(n, o.data.refs.anchorEl.value) || se(n, o.data.refs.floatingEl.value))
2327
- return o;
2328
- const r = this.findDescendantContainingFocus(o, n);
2329
- if (r) return r;
2330
- }
2331
- return null;
2332
- }
2333
- }
2334
- function wn(t) {
2335
- return t.children.value.some(
2336
- (e) => e.data.open.value || wn(e)
2337
- );
2338
- }
2339
- function Qo(t, e) {
2340
- return t[0] >= e.x && t[0] <= e.x + e.width && t[1] >= e.y && t[1] <= e.y + e.height;
2341
- }
2342
- function zt(t, e) {
2343
- const [n, o] = t;
2344
- let r = !1;
2345
- const s = e.length;
2346
- for (let i = 0, l = s - 1; i < s; l = i++) {
2347
- const [f, a] = e[i] || [0, 0], [d, u] = e[l] || [0, 0];
2348
- a >= o != u >= o && n <= (d - f) * (o - a) / (u - a) + f && (r = !r);
2349
- }
2350
- return r;
2351
- }
2352
- function er(t = {}) {
2353
- const { blockPointerEvents: e = !1, requireIntent: n = !0 } = t;
2354
- let o = -1, r = !1;
2355
- function s(l, f, a, d, u) {
2356
- const v = Ft(), h = v - u;
2357
- if (a === null || d === null || h === 0)
2358
- return {
2359
- speed: null,
2360
- lastX: l,
2361
- lastY: f,
2362
- lastCursorTime: v
2363
- };
2364
- const b = l - a, x = f - d;
2365
- return {
2366
- speed: Math.sqrt(b * b + x * x) / h,
2367
- lastX: l,
2368
- lastY: f,
2369
- lastCursorTime: v
2370
- };
2371
- }
2372
- const i = function(f) {
2373
- const { x: a, y: d, placement: u, elements: v, buffer: h, onClose: b, nodeId: x, tree: w } = f, p = W(() => {
2374
- const F = v.domReference;
2375
- return pt(F) ? F : (F == null ? void 0 : F.contextElement) ?? null;
2376
- });
2377
- let T = null, D = null, A = Ft();
2378
- return function(C) {
2379
- var Ee, Ve, je, Me, _e, L, K;
2380
- function P() {
2381
- Lt(o), o = -1, b();
2382
- }
2383
- if (Lt(o), o = -1, !v.domReference || !v.floating || u == null || a == null || d == null)
2384
- return;
2385
- const { clientX: $, clientY: B } = C, k = [$, B], V = Hn(C), I = C.type === "mouseleave", g = v.floating && ct(v.floating, V), m = p.value && ct(p.value, V), y = (Ee = p.value) == null ? void 0 : Ee.getBoundingClientRect(), c = (Ve = v.floating) == null ? void 0 : Ve.getBoundingClientRect(), M = u.split("-")[0], E = a > ((c == null ? void 0 : c.right) ?? 0) - ((c == null ? void 0 : c.width) ?? 0) / 2, R = d > ((c == null ? void 0 : c.bottom) ?? 0) - ((c == null ? void 0 : c.height) ?? 0) / 2, Y = y ? Qo(k, y) : !1, j = ((c == null ? void 0 : c.width) ?? 0) > ((y == null ? void 0 : y.width) ?? 0), S = ((c == null ? void 0 : c.height) ?? 0) > ((y == null ? void 0 : y.height) ?? 0), z = ((je = j ? y : c) == null ? void 0 : je.left) ?? 0, G = ((Me = j ? y : c) == null ? void 0 : Me.right) ?? 0, U = ((_e = S ? y : c) == null ? void 0 : _e.top) ?? 0, re = ((L = S ? y : c) == null ? void 0 : L.bottom) ?? 0;
2386
- if (g && (r = !0, !I))
2387
- return;
2388
- if (m && (r = !1), m && !I) {
2389
- r = !0;
2390
- return;
2391
- }
2392
- if (I && pt(C.relatedTarget) && v.floating && ct(v.floating, C.relatedTarget))
2393
- return;
2394
- if (w && x) {
2395
- const H = w.nodes.get(x);
2396
- if (H && wn(H))
2397
- return;
2398
- }
2399
- if (M === "top" && d >= ((y == null ? void 0 : y.bottom) ?? 0) - 1 || M === "bottom" && d <= ((y == null ? void 0 : y.top) ?? 0) + 1 || M === "left" && a >= ((y == null ? void 0 : y.right) ?? 0) - 1 || M === "right" && a <= ((y == null ? void 0 : y.left) ?? 0) + 1)
2400
- return P();
2401
- let J = [];
2402
- switch (M) {
2403
- case "top":
2404
- J = [
2405
- [z, ((y == null ? void 0 : y.top) ?? 0) + 1],
2406
- [z, ((c == null ? void 0 : c.bottom) ?? 0) - 1],
2407
- [G, ((c == null ? void 0 : c.bottom) ?? 0) - 1],
2408
- [G, ((y == null ? void 0 : y.top) ?? 0) + 1]
2409
- ];
2410
- break;
2411
- case "bottom":
2412
- J = [
2413
- [z, ((c == null ? void 0 : c.top) ?? 0) + 1],
2414
- [z, ((y == null ? void 0 : y.bottom) ?? 0) - 1],
2415
- [G, ((y == null ? void 0 : y.bottom) ?? 0) - 1],
2416
- [G, ((c == null ? void 0 : c.top) ?? 0) + 1]
2417
- ];
2418
- break;
2419
- case "left":
2420
- J = [
2421
- [((c == null ? void 0 : c.right) ?? 0) - 1, re],
2422
- [((c == null ? void 0 : c.right) ?? 0) - 1, U],
2423
- [((y == null ? void 0 : y.left) ?? 0) + 1, U],
2424
- [((y == null ? void 0 : y.left) ?? 0) + 1, re]
2425
- ];
2426
- break;
2427
- case "right":
2428
- J = [
2429
- [((y == null ? void 0 : y.right) ?? 0) - 1, re],
2430
- [((y == null ? void 0 : y.right) ?? 0) - 1, U],
2431
- [((c == null ? void 0 : c.left) ?? 0) + 1, U],
2432
- [((c == null ? void 0 : c.left) ?? 0) + 1, re]
2433
- ];
2434
- break;
2435
- }
2436
- function ee([H, _]) {
2437
- const O = h;
2438
- switch (M) {
2439
- case "top": {
2440
- const X = [
2441
- j ? H + O / 2 : E ? H + O * 4 : H - O * 4,
2442
- _ + O + 1
2443
- ], Z = [
2444
- j ? H - O / 2 : E ? H + O * 4 : H - O * 4,
2445
- _ + O + 1
2446
- ], q = [
2447
- [
2448
- (c == null ? void 0 : c.left) ?? 0,
2449
- E || j ? ((c == null ? void 0 : c.bottom) ?? 0) - O : (c == null ? void 0 : c.top) ?? 0
2450
- ],
2451
- [
2452
- (c == null ? void 0 : c.right) ?? 0,
2453
- E ? j ? ((c == null ? void 0 : c.bottom) ?? 0) - O : (c == null ? void 0 : c.top) ?? 0 : ((c == null ? void 0 : c.bottom) ?? 0) - O
2454
- ]
2455
- ];
2456
- return [X, Z, ...q];
2457
- }
2458
- case "bottom": {
2459
- const X = [
2460
- j ? H + O / 2 : E ? H + O * 4 : H - O * 4,
2461
- _ - O
2462
- ], Z = [
2463
- j ? H - O / 2 : E ? H + O * 4 : H - O * 4,
2464
- _ - O
2465
- ], q = [
2466
- [
2467
- (c == null ? void 0 : c.left) ?? 0,
2468
- E || j ? ((c == null ? void 0 : c.top) ?? 0) + O : (c == null ? void 0 : c.bottom) ?? 0
2469
- ],
2470
- [
2471
- (c == null ? void 0 : c.right) ?? 0,
2472
- E ? j ? ((c == null ? void 0 : c.top) ?? 0) + O : (c == null ? void 0 : c.bottom) ?? 0 : ((c == null ? void 0 : c.top) ?? 0) + O
2473
- ]
2474
- ];
2475
- return [X, Z, ...q];
2476
- }
2477
- case "left": {
2478
- const X = [
2479
- H + O + 1,
2480
- S ? _ + O / 2 : R ? _ + O * 4 : _ - O * 4
2481
- ], Z = [
2482
- H + O + 1,
2483
- S ? _ - O / 2 : R ? _ + O * 4 : _ - O * 4
2484
- ];
2485
- return [...[
2486
- [
2487
- R || S ? ((c == null ? void 0 : c.right) ?? 0) - O : (c == null ? void 0 : c.left) ?? 0,
2488
- (c == null ? void 0 : c.top) ?? 0
2489
- ],
2490
- [
2491
- R ? S ? ((c == null ? void 0 : c.right) ?? 0) - O : (c == null ? void 0 : c.left) ?? 0 : ((c == null ? void 0 : c.right) ?? 0) - O,
2492
- (c == null ? void 0 : c.bottom) ?? 0
2493
- ]
2494
- ], X, Z];
2495
- }
2496
- case "right": {
2497
- const X = [
2498
- H - O,
2499
- S ? _ + O / 2 : R ? _ + O * 4 : _ - O * 4
2500
- ], Z = [
2501
- H - O,
2502
- S ? _ - O / 2 : R ? _ + O * 4 : _ - O * 4
2503
- ], q = [
2504
- [
2505
- R || S ? ((c == null ? void 0 : c.left) ?? 0) + O : (c == null ? void 0 : c.right) ?? 0,
2506
- (c == null ? void 0 : c.top) ?? 0
2507
- ],
2508
- [
2509
- R ? S ? ((c == null ? void 0 : c.left) ?? 0) + O : (c == null ? void 0 : c.right) ?? 0 : ((c == null ? void 0 : c.left) ?? 0) + O,
2510
- (c == null ? void 0 : c.bottom) ?? 0
2511
- ]
2512
- ];
2513
- return [X, Z, ...q];
2514
- }
2515
- }
2516
- }
2517
- const me = ee([a, d]);
2518
- if ((K = t.onPolygonChange) == null || K.call(t, me), !zt(k, J)) {
2519
- if (zt(k, me)) {
2520
- if (!r && n) {
2521
- const H = s(
2522
- C.clientX,
2523
- C.clientY,
2524
- T,
2525
- D,
2526
- A
2527
- );
2528
- T = H.lastX, D = H.lastY, A = H.lastCursorTime, H.speed !== null && H.speed < 0.1 && (o = window.setTimeout(P, 40));
2529
- }
2530
- return;
2531
- }
2532
- if (r && !Y)
2533
- return P();
2534
- P();
2535
- }
2536
- };
2537
- };
2538
- return i.__options = {
2539
- blockPointerEvents: e
2540
- }, i;
2541
- }
2542
- const Xt = 10;
2543
- function tr(t, e, n) {
2544
- const { delay: o } = n, r = W(() => {
2545
- const a = N(o);
2546
- return (typeof a == "number" ? a : a.open) ?? 0;
2547
- }), s = W(() => {
2548
- const a = N(o);
2549
- return (typeof a == "number" ? a : a.close) ?? 0;
2550
- });
2551
- let i, l;
2552
- const f = () => {
2553
- clearTimeout(i), clearTimeout(l);
2554
- };
2555
- return Oe(f), {
2556
- show: (a, d) => {
2557
- f();
2558
- const u = a ?? r.value;
2559
- u === 0 ? t(d) : i = setTimeout(() => t(d), u);
2560
- },
2561
- hide: (a, d) => {
2562
- f();
2563
- const u = a ?? s.value;
2564
- u === 0 ? e(d) : l = setTimeout(() => e(d), u);
2565
- },
2566
- showDelay: r,
2567
- hideDelay: s,
2568
- clearTimeouts: f
2569
- };
2570
- }
2571
- function Zr(t, e = {}) {
2572
- const { floatingContext: n, treeContext: o } = Ke(t), {
2573
- open: r,
2574
- setOpen: s,
2575
- refs: { anchorEl: i, floatingEl: l }
2576
- } = n, {
2577
- enabled: f = !0,
2578
- delay: a = 0,
2579
- restMs: d = 0,
2580
- mouseOnly: u = !1,
2581
- safePolygon: v = !1
2582
- } = e, h = W(() => N(f)), b = W(() => N(d)), x = W(() => {
2583
- const E = i.value;
2584
- return !E || E instanceof HTMLElement ? E : E.contextElement ?? null;
2585
- }), { hide: w, show: p, showDelay: T, clearTimeouts: D } = tr(
2586
- (E) => {
2587
- r.value || s(!0, "hover", E);
2588
- },
2589
- (E) => {
2590
- r.value && s(!1, "hover", E);
2591
- },
2592
- { delay: a }
2593
- );
2594
- let A = null, F;
2595
- const C = W(() => T.value === 0 && b.value > 0);
2596
- function P(E) {
2597
- if (!h.value || !k(E) || !C.value || !A) return;
2598
- const R = { x: E.clientX, y: E.clientY }, Y = Math.abs(R.x - A.x), j = Math.abs(R.y - A.y);
2599
- (Y > Xt || j > Xt) && (A = R, clearTimeout(F), F = setTimeout(() => {
2600
- p(0, E);
2601
- }, b.value));
2602
- }
2603
- function $(E) {
2604
- !h.value || !k(E) || !C.value || (A = { x: E.clientX, y: E.clientY }, F = setTimeout(() => {
2605
- p(0, E);
2606
- }, b.value));
2607
- }
2608
- function B() {
2609
- clearTimeout(F), A = null;
2610
- }
2611
- Ce(() => {
2612
- const E = x.value;
2613
- !E || !h.value || !C.value || (E.addEventListener("pointerenter", $), E.addEventListener("pointermove", P), E.addEventListener("pointerleave", B), ge(() => {
2614
- E.removeEventListener("pointerenter", $), E.removeEventListener("pointermove", P), E.removeEventListener("pointerleave", B);
2615
- }));
2616
- }), Oe(() => {
2617
- clearTimeout(F);
2618
- });
2619
- function k(E) {
2620
- return N(u) ? E.pointerType === "mouse" : !0;
2621
- }
2622
- function V(E) {
2623
- !h.value || !k(E) || C.value || (m(), p(void 0, E));
2624
- }
2625
- function I(E) {
2626
- !h.value || !k(E) || (D(), m());
2627
- }
2628
- let g = null;
2629
- function m() {
2630
- g && (document.removeEventListener("pointermove", g), g = null);
2631
- const E = c.value;
2632
- E != null && E.onPolygonChange && E.onPolygonChange([]);
2633
- }
2634
- const y = W(() => !!N(v)), c = W(() => {
2635
- const E = N(v);
2636
- if (typeof E == "object" && E) return E;
2637
- if (E === !0) return {};
2638
- });
2639
- function M(E) {
2640
- var S;
2641
- if (!h.value || !k(E)) return;
2642
- const { clientX: R, clientY: Y } = E, j = E.relatedTarget;
2643
- if (y.value)
2644
- setTimeout(() => {
2645
- var J;
2646
- m();
2647
- const z = x.value, G = l.value;
2648
- if (!z || !G) {
2649
- w(void 0, E);
2650
- return;
2651
- }
2652
- let U, re;
2653
- if (o) {
2654
- U = /* @__PURE__ */ new Map();
2655
- const ee = (me) => {
2656
- U == null || U.set(me.id, me);
2657
- for (const Ee of me.children.value)
2658
- ee(Ee);
2659
- };
2660
- ee(o), re = o.id;
2661
- }
2662
- g = er(c.value)({
2663
- x: R,
2664
- y: Y,
2665
- placement: n.placement.value,
2666
- elements: {
2667
- domReference: z,
2668
- floating: G
2669
- },
2670
- buffer: ((J = c.value) == null ? void 0 : J.buffer) ?? 1,
2671
- onClose: () => {
2672
- m(), w(void 0);
2673
- },
2674
- nodeId: re,
2675
- tree: U ? { nodes: U } : void 0
2676
- }), g && document.addEventListener("pointermove", g);
2677
- }, 0);
2678
- else {
2679
- if (o) {
2680
- if (!nr(o, j))
2681
- return;
2682
- } else if ((S = l.value) != null && S.contains(j))
2683
- return;
2684
- w(void 0, E);
2685
- }
2686
- }
2687
- Ce(() => {
2688
- const E = x.value;
2689
- !E || !h.value || (E.addEventListener("pointerenter", V), E.addEventListener("pointerleave", M), ge(() => {
2690
- E.removeEventListener("pointerenter", V), E.removeEventListener("pointerleave", M);
2691
- }));
2692
- }), Ce(() => {
2693
- const E = l.value;
2694
- !E || !h.value || (E.addEventListener("pointerenter", I), E.addEventListener("pointerleave", M), ge(() => {
2695
- E.removeEventListener("pointerenter", I), E.removeEventListener("pointerleave", M);
2696
- }));
2697
- }), Oe(() => {
2698
- m();
2699
- });
2700
- }
2701
- function nr(t, e) {
2702
- return e ? !(se(e, t.data.refs.anchorEl.value) || se(e, t.data.refs.floatingEl.value) || xt(t, e)) : !0;
2703
- }
2704
- function or(t, e, n, o) {
2705
- const r = W(() => !!N(o.virtual));
2706
- ae(
2707
- [r, o.open, W(() => N(n))],
2708
- ([s, i, l]) => {
2709
- const f = t.value;
2710
- if (!f) return;
2711
- if (!s || !i || l == null) {
2712
- f.removeAttribute("aria-activedescendant");
2713
- return;
2714
- }
2715
- const a = e.value[l];
2716
- a && (a.id || (a.id = `vfloat-option-${Math.random().toString(16).slice(2, 10)}`), f.setAttribute("aria-activedescendant", a.id), o.virtualItemRef && (o.virtualItemRef.value = a));
2717
- }
2718
- );
2719
- }
2720
- function Se(t, e, n) {
2721
- const {
2722
- items: o,
2723
- loop: r,
2724
- allowEscape: s,
2725
- isVirtual: i,
2726
- findNextEnabled: l,
2727
- getFirstEnabledIndex: f,
2728
- getLastEnabledIndex: a
2729
- } = n, d = o.length, u = t == null ? e === 1 ? 0 : d - 1 : t + e;
2730
- let v = l(u, e, r);
2731
- if (v == null && r) {
2732
- if (s && i)
2733
- return { type: "navigate", index: null };
2734
- v = e === 1 ? f() : a();
2735
- }
2736
- return v != null ? { type: "navigate", index: v } : null;
2737
- }
2738
- class rr {
2739
- handleKey(e, n) {
2740
- const { isRtl: o, nested: r } = n;
2741
- return e === "ArrowDown" ? Se(n.current, 1, n) : e === "ArrowUp" ? Se(n.current, -1, n) : r && e === (o ? "ArrowRight" : "ArrowLeft") ? { type: "close" } : null;
2742
- }
2743
- }
2744
- class ir {
2745
- handleKey(e, n) {
2746
- const { isRtl: o, nested: r } = n;
2747
- return e === "ArrowRight" ? Se(n.current, o ? -1 : 1, n) : e === "ArrowLeft" ? Se(n.current, o ? 1 : -1, n) : r && e === "ArrowUp" ? { type: "close" } : null;
2748
- }
2749
- }
2750
- class Ut {
2751
- constructor(e = !1, n = "row") {
2752
- this.fallbackToLinear = e, this.loopDirection = n;
2753
- }
2754
- handleKey(e, n) {
2755
- const {
2756
- current: o,
2757
- items: r,
2758
- isDisabled: s,
2759
- loop: i,
2760
- allowEscape: l,
2761
- isVirtual: f,
2762
- getFirstEnabledIndex: a,
2763
- getLastEnabledIndex: d,
2764
- cols: u
2765
- } = n;
2766
- if (e === "ArrowRight" || e === "ArrowLeft") {
2767
- const v = e === "ArrowRight" ? 1 : -1;
2768
- if (o === null)
2769
- return Se(o, v, n);
2770
- const h = o + v, b = Math.floor(o / u), x = Math.floor(h / u);
2771
- if (h >= 0 && h < r.length && b === x && !s(h))
2772
- return { type: "navigate", index: h };
2773
- if (i) {
2774
- if (l && f) {
2775
- const p = o === 0, T = o === r.length - 1;
2776
- if (v === -1 && p || v === 1 && T)
2777
- return { type: "navigate", index: null };
2778
- }
2779
- let w;
2780
- if (this.loopDirection === "next" ? v === 1 ? (w = o + 1, w >= r.length && (w = 0)) : (w = o - 1, w < 0 && (w = r.length - 1)) : v === 1 ? w = b * u : w = Math.min((b + 1) * u - 1, r.length - 1), this.loopDirection === "next") {
2781
- let p = w;
2782
- for (let T = 0; T < r.length; T++) {
2783
- if (!s(p))
2784
- return { type: "navigate", index: p };
2785
- if (p += v, p >= r.length && (p = 0), p < 0 && (p = r.length - 1), p === w) break;
2786
- }
2787
- } else {
2788
- const p = v, T = b * u, D = Math.min((b + 1) * u - 1, r.length - 1);
2789
- for (; w >= T && w <= D; ) {
2790
- if (!s(w))
2791
- return { type: "navigate", index: w };
2792
- if (w += p, w < T || w > D) break;
2793
- }
2794
- }
2795
- }
2796
- return Se(o, v, n);
2797
- }
2798
- if (e === "ArrowDown" || e === "ArrowUp") {
2799
- if (u <= 1) return null;
2800
- const v = e === "ArrowDown" ? u : -u, h = v > 0 ? u : -u;
2801
- let x = (o ?? (v > 0 ? -u : r.length)) + v;
2802
- for (; x >= 0 && x < r.length && s(x); )
2803
- x += h;
2804
- if (x >= 0 && x < r.length)
2805
- return { type: "navigate", index: x };
2806
- if (i) {
2807
- if (l && f)
2808
- return { type: "navigate", index: null };
2809
- if (o === null) {
2810
- const T = v > 0 ? a() : d();
2811
- return T != null ? { type: "navigate", index: T } : null;
2812
- }
2813
- const w = o % u;
2814
- let p;
2815
- for (v > 0 ? p = w : (p = (Math.ceil(r.length / u) - 1) * u + w, p >= r.length && (p -= u)); p >= 0 && p < r.length && s(p); )
2816
- p += h;
2817
- if (p >= 0 && p < r.length)
2818
- return { type: "navigate", index: p };
2819
- }
2820
- if (this.fallbackToLinear)
2821
- return Se(o, e === "ArrowDown" ? 1 : -1, n);
2822
- }
2823
- return null;
2824
- }
2825
- }
2826
- function Jr(t, e) {
2827
- const { floatingContext: n, treeContext: o } = Ke(t), { refs: r, open: s, setOpen: i } = n, {
2828
- listRef: l,
2829
- activeIndex: f,
2830
- onNavigate: a,
2831
- enabled: d = !0,
2832
- loop: u = !1,
2833
- orientation: v = "vertical",
2834
- disabledIndices: h,
2835
- focusItemOnHover: b = !0,
2836
- openOnArrowKeyDown: x = !0,
2837
- scrollItemIntoView: w = !0,
2838
- selectedIndex: p = null,
2839
- focusItemOnOpen: T = "auto",
2840
- nested: D = !1,
2841
- rtl: A = !1,
2842
- virtual: F = !1,
2843
- virtualItemRef: C,
2844
- cols: P = 1,
2845
- allowEscape: $ = !1
2846
- } = e, B = {
2847
- isEnabled: W(() => N(d)),
2848
- anchorEl: W(() => {
2849
- const L = r.anchorEl.value;
2850
- return L instanceof HTMLElement ? L : L && "contextElement" in L && L.contextElement instanceof HTMLElement ? L.contextElement : null;
2851
- }),
2852
- floatingEl: W(() => r.floatingEl.value),
2853
- isVirtual: W(() => !!N(F)),
2854
- isRtl: W(() => !!N(A)),
2855
- gridCols: W(() => Math.max(1, Number(N(P) ?? 1)))
2856
- }, { isEnabled: k, anchorEl: V, floatingEl: I, isVirtual: g, isRtl: m, gridCols: y } = B, c = () => f !== void 0 ? N(f) : null, M = (L) => h ? Array.isArray(h) ? h.includes(L) : !!h(L) : !1, E = () => {
2857
- const L = l.value;
2858
- for (let K = 0; K < L.length; K++)
2859
- if (L[K] && !M(K)) return K;
2860
- return null;
2861
- }, R = [], Y = (L) => (R.push(L), L), j = () => {
2862
- var L;
2863
- for (; R.length; )
2864
- (L = R.pop()) == null || L();
2865
- }, S = () => {
2866
- const L = l.value;
2867
- for (let K = L.length - 1; K >= 0; K--)
2868
- if (L[K] && !M(K)) return K;
2869
- return null;
2870
- };
2871
- function z(L, K, H) {
2872
- switch (L) {
2873
- case "vertical":
2874
- return K;
2875
- case "horizontal":
2876
- return H;
2877
- default:
2878
- return K || H;
2879
- }
2880
- }
2881
- function G(L, K) {
2882
- return z(K, L === "ArrowUp" || L === "ArrowDown", L === "ArrowLeft" || L === "ArrowRight");
2883
- }
2884
- function U(L, K, H) {
2885
- return z(K, L === "ArrowDown", H ? L === "ArrowLeft" : L === "ArrowRight") || L === "Enter" || L === " " || L === "";
2886
- }
2887
- const re = (L, K, H) => {
2888
- const _ = l.value, O = _.length;
2889
- let X = L;
2890
- for (let Z = 0; Z < O; Z++) {
2891
- if (X < 0 || X >= O) {
2892
- if (!H) return null;
2893
- X = (X + O) % O;
2894
- }
2895
- if (_[X] && !M(X)) return X;
2896
- X += K;
2897
- }
2898
- return null;
2899
- }, J = (L, K = !1) => {
2900
- var _;
2901
- if (L == null) return;
2902
- const H = l.value[L];
2903
- if (H && !g.value) {
2904
- H.focus({ preventScroll: !0 });
2905
- const O = w;
2906
- !!O && (K || bn.value) && ((_ = H.scrollIntoView) == null || _.call(
2907
- H,
2908
- typeof O == "boolean" ? { block: "nearest", inline: "nearest" } : O
2909
- ));
2910
- }
2911
- };
2912
- let ee = null;
2913
- const me = (L) => {
2914
- if (L.defaultPrevented) return;
2915
- const K = L.target;
2916
- if (K && Et(K) && K !== V.value) return;
2917
- const H = L.key, _ = N(v);
2918
- if (ee = H, s.value && g.value) {
2919
- Ee(L);
2920
- return;
2921
- }
2922
- if (!G(H, _) || s.value || !N(x)) return;
2923
- L.preventDefault(), i(!0, "keyboard-activate", L);
2924
- const X = (p !== void 0 ? N(p) : null) ?? (U(H, _, m.value) ? E() : S());
2925
- X != null && (a == null || a(X));
2926
- }, Ee = (L) => {
2927
- if (L.defaultPrevented) return;
2928
- const K = L.key, H = N(v), _ = l.value;
2929
- if (!_.length) return;
2930
- if (!g.value) {
2931
- if (K === "Home") {
2932
- L.preventDefault();
2933
- const q = E();
2934
- q != null && (a == null || a(q));
2935
- return;
2936
- }
2937
- if (K === "End") {
2938
- L.preventDefault();
2939
- const q = S();
2940
- q != null && (a == null || a(q));
2941
- return;
2942
- }
2943
- }
2944
- let O;
2945
- H === "vertical" ? O = new rr() : H === "horizontal" ? O = y.value > 1 ? new Ut(!1, N(e.gridLoopDirection) ?? "row") : new ir() : O = new Ut(!0, N(e.gridLoopDirection) ?? "row");
2946
- const X = {
2947
- current: c(),
2948
- items: _,
2949
- isRtl: m.value,
2950
- loop: !!N(u),
2951
- allowEscape: !!N($),
2952
- isVirtual: g.value,
2953
- cols: y.value,
2954
- nested: !!N(D),
2955
- isDisabled: M,
2956
- findNextEnabled: re,
2957
- getFirstEnabledIndex: E,
2958
- getLastEnabledIndex: S
2959
- }, Z = O.handleKey(K, X);
2960
- if (Z) {
2961
- if (Z.type === "navigate")
2962
- L.preventDefault(), a == null || a(Z.index);
2963
- else if (Z.type === "close") {
2964
- L.preventDefault(), i(!1, "programmatic", L);
2965
- const q = o == null ? void 0 : o.parent.value, ie = q == null ? void 0 : q.data.refs.anchorEl.value;
2966
- ie instanceof HTMLElement ? ie.focus({ preventScroll: !0 }) : ie && "contextElement" in ie && ie.contextElement instanceof HTMLElement && ie.contextElement.focus({ preventScroll: !0 });
2967
- }
2968
- }
2969
- }, Ve = ae(
2970
- [s, W(() => c())],
2971
- ([L, K]) => {
2972
- k.value && L && K != null && J(K);
2973
- },
2974
- { flush: "post" }
2975
- );
2976
- Y(Ve), Y(
2977
- Q(
2978
- () => k.value ? V.value : null,
2979
- "keydown",
2980
- me
2981
- )
2982
- ), Y(
2983
- Q(
2984
- () => k.value ? I.value : null,
2985
- "keydown",
2986
- Ee
2987
- )
2988
- );
2989
- const je = Ce(() => {
2990
- if (!k.value || !N(b)) return;
2991
- const L = I.value;
2992
- if (!L) return;
2993
- let K = null, H = null;
2994
- const _ = (O) => {
2995
- if (K === O.clientX && H === O.clientY) return;
2996
- K = O.clientX, H = O.clientY;
2997
- const X = O.target;
2998
- if (!X) return;
2999
- const Z = l.value;
3000
- let q = -1;
3001
- for (let ie = 0; ie < Z.length; ie++) {
3002
- const lt = Z[ie];
3003
- if (lt && (lt === X || lt.contains(X))) {
3004
- q = ie;
3005
- break;
3006
- }
3007
- }
3008
- q >= 0 && (a == null || a(q));
3009
- };
3010
- L.addEventListener("mousemove", _), ge(() => {
3011
- L.removeEventListener("mousemove", _);
3012
- });
3013
- });
3014
- Y(je);
3015
- const Me = te(!1), _e = ae(
3016
- () => s.value,
3017
- (L) => {
3018
- if (k.value) {
3019
- if (L && !Me.value) {
3020
- const K = N(T);
3021
- if (K === !0 || K === "auto" && ee != null) {
3022
- const _ = (p !== void 0 ? N(p) : null) ?? (ee && U(ee, N(v), m.value) ? E() : S());
3023
- _ != null && (a == null || a(_), J(_, !0));
3024
- }
3025
- }
3026
- Me.value = L;
3027
- }
3028
- },
3029
- { flush: "post", immediate: !0 }
3030
- );
3031
- return Y(_e), or(
3032
- V,
3033
- l,
3034
- W(() => c()),
3035
- { virtual: F, open: s, virtualItemRef: C }
3036
- ), { cleanup: j };
3037
- }
3038
- /*!
3039
- * tabbable 6.3.0
3040
- * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
3041
- */
3042
- var yn = ["input:not([inert])", "select:not([inert])", "textarea:not([inert])", "a[href]:not([inert])", "button:not([inert])", "[tabindex]:not(slot):not([inert])", "audio[controls]:not([inert])", "video[controls]:not([inert])", '[contenteditable]:not([contenteditable="false"]):not([inert])', "details>summary:first-of-type:not([inert])", "details:not([inert])"], et = /* @__PURE__ */ yn.join(","), En = typeof Element > "u", De = En ? function() {
3043
- } : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector, tt = !En && Element.prototype.getRootNode ? function(t) {
3044
- var e;
3045
- return t == null || (e = t.getRootNode) === null || e === void 0 ? void 0 : e.call(t);
3046
- } : function(t) {
3047
- return t == null ? void 0 : t.ownerDocument;
3048
- }, We = function(e, n) {
3049
- var o;
3050
- n === void 0 && (n = !0);
3051
- var r = e == null || (o = e.getAttribute) === null || o === void 0 ? void 0 : o.call(e, "inert"), s = r === "" || r === "true", i = s || n && e && We(e.parentNode);
3052
- return i;
3053
- }, ar = function(e) {
3054
- var n, o = e == null || (n = e.getAttribute) === null || n === void 0 ? void 0 : n.call(e, "contenteditable");
3055
- return o === "" || o === "true";
3056
- }, xn = function(e, n, o) {
3057
- if (We(e))
3058
- return [];
3059
- var r = Array.prototype.slice.apply(e.querySelectorAll(et));
3060
- return n && De.call(e, et) && r.unshift(e), r = r.filter(o), r;
3061
- }, nt = function(e, n, o) {
3062
- for (var r = [], s = Array.from(e); s.length; ) {
3063
- var i = s.shift();
3064
- if (!We(i, !1))
3065
- if (i.tagName === "SLOT") {
3066
- var l = i.assignedElements(), f = l.length ? l : i.children, a = nt(f, !0, o);
3067
- o.flatten ? r.push.apply(r, a) : r.push({
3068
- scopeParent: i,
3069
- candidates: a
3070
- });
3071
- } else {
3072
- var d = De.call(i, et);
3073
- d && o.filter(i) && (n || !e.includes(i)) && r.push(i);
3074
- var u = i.shadowRoot || // check for an undisclosed shadow
3075
- typeof o.getShadowRoot == "function" && o.getShadowRoot(i), v = !We(u, !1) && (!o.shadowRootFilter || o.shadowRootFilter(i));
3076
- if (u && v) {
3077
- var h = nt(u === !0 ? i.children : u.children, !0, o);
3078
- o.flatten ? r.push.apply(r, h) : r.push({
3079
- scopeParent: i,
3080
- candidates: h
3081
- });
3082
- } else
3083
- s.unshift.apply(s, i.children);
3084
- }
3085
- }
3086
- return r;
3087
- }, Tn = function(e) {
3088
- return !isNaN(parseInt(e.getAttribute("tabindex"), 10));
3089
- }, xe = function(e) {
3090
- if (!e)
3091
- throw new Error("No node provided");
3092
- return e.tabIndex < 0 && (/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName) || ar(e)) && !Tn(e) ? 0 : e.tabIndex;
3093
- }, sr = function(e, n) {
3094
- var o = xe(e);
3095
- return o < 0 && n && !Tn(e) ? 0 : o;
3096
- }, lr = function(e, n) {
3097
- return e.tabIndex === n.tabIndex ? e.documentOrder - n.documentOrder : e.tabIndex - n.tabIndex;
3098
- }, Cn = function(e) {
3099
- return e.tagName === "INPUT";
3100
- }, cr = function(e) {
3101
- return Cn(e) && e.type === "hidden";
3102
- }, ur = function(e) {
3103
- var n = e.tagName === "DETAILS" && Array.prototype.slice.apply(e.children).some(function(o) {
3104
- return o.tagName === "SUMMARY";
3105
- });
3106
- return n;
3107
- }, fr = function(e, n) {
3108
- for (var o = 0; o < e.length; o++)
3109
- if (e[o].checked && e[o].form === n)
3110
- return e[o];
3111
- }, dr = function(e) {
3112
- if (!e.name)
3113
- return !0;
3114
- var n = e.form || tt(e), o = function(l) {
3115
- return n.querySelectorAll('input[type="radio"][name="' + l + '"]');
3116
- }, r;
3117
- if (typeof window < "u" && typeof window.CSS < "u" && typeof window.CSS.escape == "function")
3118
- r = o(window.CSS.escape(e.name));
3119
- else
3120
- try {
3121
- r = o(e.name);
3122
- } catch (i) {
3123
- return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s", i.message), !1;
3124
- }
3125
- var s = fr(r, e.form);
3126
- return !s || s === e;
3127
- }, vr = function(e) {
3128
- return Cn(e) && e.type === "radio";
3129
- }, hr = function(e) {
3130
- return vr(e) && !dr(e);
3131
- }, pr = function(e) {
3132
- var n, o = e && tt(e), r = (n = o) === null || n === void 0 ? void 0 : n.host, s = !1;
3133
- if (o && o !== e) {
3134
- var i, l, f;
3135
- for (s = !!((i = r) !== null && i !== void 0 && (l = i.ownerDocument) !== null && l !== void 0 && l.contains(r) || e != null && (f = e.ownerDocument) !== null && f !== void 0 && f.contains(e)); !s && r; ) {
3136
- var a, d, u;
3137
- o = tt(r), r = (a = o) === null || a === void 0 ? void 0 : a.host, s = !!((d = r) !== null && d !== void 0 && (u = d.ownerDocument) !== null && u !== void 0 && u.contains(r));
3138
- }
3139
- }
3140
- return s;
3141
- }, qt = function(e) {
3142
- var n = e.getBoundingClientRect(), o = n.width, r = n.height;
3143
- return o === 0 && r === 0;
3144
- }, mr = function(e, n) {
3145
- var o = n.displayCheck, r = n.getShadowRoot;
3146
- if (o === "full-native" && "checkVisibility" in e) {
3147
- var s = e.checkVisibility({
3148
- // Checking opacity might be desirable for some use cases, but natively,
3149
- // opacity zero elements _are_ focusable and tabbable.
3150
- checkOpacity: !1,
3151
- opacityProperty: !1,
3152
- contentVisibilityAuto: !0,
3153
- visibilityProperty: !0,
3154
- // This is an alias for `visibilityProperty`. Contemporary browsers
3155
- // support both. However, this alias has wider browser support (Chrome
3156
- // >= 105 and Firefox >= 106, vs. Chrome >= 121 and Firefox >= 122), so
3157
- // we include it anyway.
3158
- checkVisibilityCSS: !0
3159
- });
3160
- return !s;
3161
- }
3162
- if (getComputedStyle(e).visibility === "hidden")
3163
- return !0;
3164
- var i = De.call(e, "details>summary:first-of-type"), l = i ? e.parentElement : e;
3165
- if (De.call(l, "details:not([open]) *"))
3166
- return !0;
3167
- if (!o || o === "full" || // full-native can run this branch when it falls through in case
3168
- // Element#checkVisibility is unsupported
3169
- o === "full-native" || o === "legacy-full") {
3170
- if (typeof r == "function") {
3171
- for (var f = e; e; ) {
3172
- var a = e.parentElement, d = tt(e);
3173
- if (a && !a.shadowRoot && r(a) === !0)
3174
- return qt(e);
3175
- e.assignedSlot ? e = e.assignedSlot : !a && d !== e.ownerDocument ? e = d.host : e = a;
3176
- }
3177
- e = f;
3178
- }
3179
- if (pr(e))
3180
- return !e.getClientRects().length;
3181
- if (o !== "legacy-full")
3182
- return !0;
3183
- } else if (o === "non-zero-area")
3184
- return qt(e);
3185
- return !1;
3186
- }, gr = function(e) {
3187
- if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))
3188
- for (var n = e.parentElement; n; ) {
3189
- if (n.tagName === "FIELDSET" && n.disabled) {
3190
- for (var o = 0; o < n.children.length; o++) {
3191
- var r = n.children.item(o);
3192
- if (r.tagName === "LEGEND")
3193
- return De.call(n, "fieldset[disabled] *") ? !0 : !r.contains(e);
3194
- }
3195
- return !0;
3196
- }
3197
- n = n.parentElement;
3198
- }
3199
- return !1;
3200
- }, ot = function(e, n) {
3201
- return !(n.disabled || // we must do an inert look up to filter out any elements inside an inert ancestor
3202
- // because we're limited in the type of selectors we can use in JSDom (see related
3203
- // note related to `candidateSelectors`)
3204
- We(n) || cr(n) || mr(n, e) || // For a details element with a summary, the summary element gets the focus
3205
- ur(n) || gr(n));
3206
- }, wt = function(e, n) {
3207
- return !(hr(n) || xe(n) < 0 || !ot(e, n));
3208
- }, br = function(e) {
3209
- var n = parseInt(e.getAttribute("tabindex"), 10);
3210
- return !!(isNaN(n) || n >= 0);
3211
- }, Sn = function(e) {
3212
- var n = [], o = [];
3213
- return e.forEach(function(r, s) {
3214
- var i = !!r.scopeParent, l = i ? r.scopeParent : r, f = sr(l, i), a = i ? Sn(r.candidates) : l;
3215
- f === 0 ? i ? n.push.apply(n, a) : n.push(l) : o.push({
3216
- documentOrder: s,
3217
- tabIndex: f,
3218
- item: r,
3219
- isScope: i,
3220
- content: a
3221
- });
3222
- }), o.sort(lr).reduce(function(r, s) {
3223
- return s.isScope ? r.push.apply(r, s.content) : r.push(s.content), r;
3224
- }, []).concat(n);
3225
- }, wr = function(e, n) {
3226
- n = n || {};
3227
- var o;
3228
- return n.getShadowRoot ? o = nt([e], n.includeContainer, {
3229
- filter: wt.bind(null, n),
3230
- flatten: !1,
3231
- getShadowRoot: n.getShadowRoot,
3232
- shadowRootFilter: br
3233
- }) : o = xn(e, n.includeContainer, wt.bind(null, n)), Sn(o);
3234
- }, yr = function(e, n) {
3235
- n = n || {};
3236
- var o;
3237
- return n.getShadowRoot ? o = nt([e], n.includeContainer, {
3238
- filter: ot.bind(null, n),
3239
- flatten: !0,
3240
- getShadowRoot: n.getShadowRoot
3241
- }) : o = xn(e, n.includeContainer, ot.bind(null, n)), o;
3242
- }, Ne = function(e, n) {
3243
- if (n = n || {}, !e)
3244
- throw new Error("No node provided");
3245
- return De.call(e, et) === !1 ? !1 : wt(n, e);
3246
- }, Er = /* @__PURE__ */ yn.concat("iframe").join(","), dt = function(e, n) {
3247
- if (n = n || {}, !e)
3248
- throw new Error("No node provided");
3249
- return De.call(e, Er) === !1 ? !1 : ot(n, e);
3250
- };
3251
- /*!
3252
- * focus-trap 7.6.6
3253
- * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
3254
- */
3255
- function yt(t, e) {
3256
- (e == null || e > t.length) && (e = t.length);
3257
- for (var n = 0, o = Array(e); n < e; n++) o[n] = t[n];
3258
- return o;
3259
- }
3260
- function xr(t) {
3261
- if (Array.isArray(t)) return yt(t);
3262
- }
3263
- function Tr(t, e, n) {
3264
- return (e = Dr(e)) in t ? Object.defineProperty(t, e, {
3265
- value: n,
3266
- enumerable: !0,
3267
- configurable: !0,
3268
- writable: !0
3269
- }) : t[e] = n, t;
3270
- }
3271
- function Cr(t) {
3272
- if (typeof Symbol < "u" && t[Symbol.iterator] != null || t["@@iterator"] != null) return Array.from(t);
3273
- }
3274
- function Sr() {
3275
- throw new TypeError(`Invalid attempt to spread non-iterable instance.
3276
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
3277
- }
3278
- function Gt(t, e) {
3279
- var n = Object.keys(t);
3280
- if (Object.getOwnPropertySymbols) {
3281
- var o = Object.getOwnPropertySymbols(t);
3282
- e && (o = o.filter(function(r) {
3283
- return Object.getOwnPropertyDescriptor(t, r).enumerable;
3284
- })), n.push.apply(n, o);
3285
- }
3286
- return n;
3287
- }
3288
- function Zt(t) {
3289
- for (var e = 1; e < arguments.length; e++) {
3290
- var n = arguments[e] != null ? arguments[e] : {};
3291
- e % 2 ? Gt(Object(n), !0).forEach(function(o) {
3292
- Tr(t, o, n[o]);
3293
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : Gt(Object(n)).forEach(function(o) {
3294
- Object.defineProperty(t, o, Object.getOwnPropertyDescriptor(n, o));
3295
- });
3296
- }
3297
- return t;
3298
- }
3299
- function Or(t) {
3300
- return xr(t) || Cr(t) || Pr(t) || Sr();
3301
- }
3302
- function Ar(t, e) {
3303
- if (typeof t != "object" || !t) return t;
3304
- var n = t[Symbol.toPrimitive];
3305
- if (n !== void 0) {
3306
- var o = n.call(t, e);
3307
- if (typeof o != "object") return o;
3308
- throw new TypeError("@@toPrimitive must return a primitive value.");
3309
- }
3310
- return (e === "string" ? String : Number)(t);
3311
- }
3312
- function Dr(t) {
3313
- var e = Ar(t, "string");
3314
- return typeof e == "symbol" ? e : e + "";
3315
- }
3316
- function Pr(t, e) {
3317
- if (t) {
3318
- if (typeof t == "string") return yt(t, e);
3319
- var n = {}.toString.call(t).slice(8, -1);
3320
- return n === "Object" && t.constructor && (n = t.constructor.name), n === "Map" || n === "Set" ? Array.from(t) : n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? yt(t, e) : void 0;
3321
- }
3322
- }
3323
- var Jt = {
3324
- activateTrap: function(e, n) {
3325
- if (e.length > 0) {
3326
- var o = e[e.length - 1];
3327
- o !== n && o._setPausedState(!0);
3328
- }
3329
- var r = e.indexOf(n);
3330
- r === -1 || e.splice(r, 1), e.push(n);
3331
- },
3332
- deactivateTrap: function(e, n) {
3333
- var o = e.indexOf(n);
3334
- o !== -1 && e.splice(o, 1), e.length > 0 && !e[e.length - 1]._isManuallyPaused() && e[e.length - 1]._setPausedState(!1);
3335
- }
3336
- }, Nr = function(e) {
3337
- return e.tagName && e.tagName.toLowerCase() === "input" && typeof e.select == "function";
3338
- }, Fr = function(e) {
3339
- return (e == null ? void 0 : e.key) === "Escape" || (e == null ? void 0 : e.key) === "Esc" || (e == null ? void 0 : e.keyCode) === 27;
3340
- }, Be = function(e) {
3341
- return (e == null ? void 0 : e.key) === "Tab" || (e == null ? void 0 : e.keyCode) === 9;
3342
- }, Lr = function(e) {
3343
- return Be(e) && !e.shiftKey;
3344
- }, Rr = function(e) {
3345
- return Be(e) && e.shiftKey;
3346
- }, Qt = function(e) {
3347
- return setTimeout(e, 0);
3348
- }, Ie = function(e) {
3349
- for (var n = arguments.length, o = new Array(n > 1 ? n - 1 : 0), r = 1; r < n; r++)
3350
- o[r - 1] = arguments[r];
3351
- return typeof e == "function" ? e.apply(void 0, o) : e;
3352
- }, Xe = function(e) {
3353
- return e.target.shadowRoot && typeof e.composedPath == "function" ? e.composedPath()[0] : e.target;
3354
- }, kr = [], Mr = function(e, n) {
3355
- var o = (n == null ? void 0 : n.document) || document, r = (n == null ? void 0 : n.trapStack) || kr, s = Zt({
3356
- returnFocusOnDeactivate: !0,
3357
- escapeDeactivates: !0,
3358
- delayInitialFocus: !0,
3359
- isKeyForward: Lr,
3360
- isKeyBackward: Rr
3361
- }, n), i = {
3362
- // containers given to createFocusTrap()
3363
- // @type {Array<HTMLElement>}
3364
- containers: [],
3365
- // list of objects identifying tabbable nodes in `containers` in the trap
3366
- // NOTE: it's possible that a group has no tabbable nodes if nodes get removed while the trap
3367
- // is active, but the trap should never get to a state where there isn't at least one group
3368
- // with at least one tabbable node in it (that would lead to an error condition that would
3369
- // result in an error being thrown)
3370
- // @type {Array<{
3371
- // container: HTMLElement,
3372
- // tabbableNodes: Array<HTMLElement>, // empty if none
3373
- // focusableNodes: Array<HTMLElement>, // empty if none
3374
- // posTabIndexesFound: boolean,
3375
- // firstTabbableNode: HTMLElement|undefined,
3376
- // lastTabbableNode: HTMLElement|undefined,
3377
- // firstDomTabbableNode: HTMLElement|undefined,
3378
- // lastDomTabbableNode: HTMLElement|undefined,
3379
- // nextTabbableNode: (node: HTMLElement, forward: boolean) => HTMLElement|undefined
3380
- // }>}
3381
- containerGroups: [],
3382
- // same order/length as `containers` list
3383
- // references to objects in `containerGroups`, but only those that actually have
3384
- // tabbable nodes in them
3385
- // NOTE: same order as `containers` and `containerGroups`, but __not necessarily__
3386
- // the same length
3387
- tabbableGroups: [],
3388
- nodeFocusedBeforeActivation: null,
3389
- mostRecentlyFocusedNode: null,
3390
- active: !1,
3391
- paused: !1,
3392
- manuallyPaused: !1,
3393
- // timer ID for when delayInitialFocus is true and initial focus in this trap
3394
- // has been delayed during activation
3395
- delayInitialFocusTimer: void 0,
3396
- // the most recent KeyboardEvent for the configured nav key (typically [SHIFT+]TAB), if any
3397
- recentNavEvent: void 0
3398
- }, l, f = function(g, m, y) {
3399
- return g && g[m] !== void 0 ? g[m] : s[y || m];
3400
- }, a = function(g, m) {
3401
- var y = typeof (m == null ? void 0 : m.composedPath) == "function" ? m.composedPath() : void 0;
3402
- return i.containerGroups.findIndex(function(c) {
3403
- var M = c.container, E = c.tabbableNodes;
3404
- return M.contains(g) || // fall back to explicit tabbable search which will take into consideration any
3405
- // web components if the `tabbableOptions.getShadowRoot` option was used for
3406
- // the trap, enabling shadow DOM support in tabbable (`Node.contains()` doesn't
3407
- // look inside web components even if open)
3408
- (y == null ? void 0 : y.includes(M)) || E.find(function(R) {
3409
- return R === g;
3410
- });
3411
- });
3412
- }, d = function(g) {
3413
- var m = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, y = m.hasFallback, c = y === void 0 ? !1 : y, M = m.params, E = M === void 0 ? [] : M, R = s[g];
3414
- if (typeof R == "function" && (R = R.apply(void 0, Or(E))), R === !0 && (R = void 0), !R) {
3415
- if (R === void 0 || R === !1)
3416
- return R;
3417
- throw new Error("`".concat(g, "` was specified but was not a node, or did not return a node"));
3418
- }
3419
- var Y = R;
3420
- if (typeof R == "string") {
3421
- try {
3422
- Y = o.querySelector(R);
3423
- } catch (j) {
3424
- throw new Error("`".concat(g, '` appears to be an invalid selector; error="').concat(j.message, '"'));
3425
- }
3426
- if (!Y && !c)
3427
- throw new Error("`".concat(g, "` as selector refers to no known node"));
3428
- }
3429
- return Y;
3430
- }, u = function() {
3431
- var g = d("initialFocus", {
3432
- hasFallback: !0
3433
- });
3434
- if (g === !1)
3435
- return !1;
3436
- if (g === void 0 || g && !dt(g, s.tabbableOptions))
3437
- if (a(o.activeElement) >= 0)
3438
- g = o.activeElement;
3439
- else {
3440
- var m = i.tabbableGroups[0], y = m && m.firstTabbableNode;
3441
- g = y || d("fallbackFocus");
3442
- }
3443
- else g === null && (g = d("fallbackFocus"));
3444
- if (!g)
3445
- throw new Error("Your focus-trap needs to have at least one focusable element");
3446
- return g;
3447
- }, v = function() {
3448
- if (i.containerGroups = i.containers.map(function(g) {
3449
- var m = wr(g, s.tabbableOptions), y = yr(g, s.tabbableOptions), c = m.length > 0 ? m[0] : void 0, M = m.length > 0 ? m[m.length - 1] : void 0, E = y.find(function(j) {
3450
- return Ne(j);
3451
- }), R = y.slice().reverse().find(function(j) {
3452
- return Ne(j);
3453
- }), Y = !!m.find(function(j) {
3454
- return xe(j) > 0;
3455
- });
3456
- return {
3457
- container: g,
3458
- tabbableNodes: m,
3459
- focusableNodes: y,
3460
- /** True if at least one node with positive `tabindex` was found in this container. */
3461
- posTabIndexesFound: Y,
3462
- /** First tabbable node in container, __tabindex__ order; `undefined` if none. */
3463
- firstTabbableNode: c,
3464
- /** Last tabbable node in container, __tabindex__ order; `undefined` if none. */
3465
- lastTabbableNode: M,
3466
- // NOTE: DOM order is NOT NECESSARILY "document position" order, but figuring that out
3467
- // would require more than just https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition
3468
- // because that API doesn't work with Shadow DOM as well as it should (@see
3469
- // https://github.com/whatwg/dom/issues/320) and since this first/last is only needed, so far,
3470
- // to address an edge case related to positive tabindex support, this seems like a much easier,
3471
- // "close enough most of the time" alternative for positive tabindexes which should generally
3472
- // be avoided anyway...
3473
- /** First tabbable node in container, __DOM__ order; `undefined` if none. */
3474
- firstDomTabbableNode: E,
3475
- /** Last tabbable node in container, __DOM__ order; `undefined` if none. */
3476
- lastDomTabbableNode: R,
3477
- /**
3478
- * Finds the __tabbable__ node that follows the given node in the specified direction,
3479
- * in this container, if any.
3480
- * @param {HTMLElement} node
3481
- * @param {boolean} [forward] True if going in forward tab order; false if going
3482
- * in reverse.
3483
- * @returns {HTMLElement|undefined} The next tabbable node, if any.
3484
- */
3485
- nextTabbableNode: function(S) {
3486
- var z = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0, G = m.indexOf(S);
3487
- return G < 0 ? z ? y.slice(y.indexOf(S) + 1).find(function(U) {
3488
- return Ne(U);
3489
- }) : y.slice(0, y.indexOf(S)).reverse().find(function(U) {
3490
- return Ne(U);
3491
- }) : m[G + (z ? 1 : -1)];
3492
- }
3493
- };
3494
- }), i.tabbableGroups = i.containerGroups.filter(function(g) {
3495
- return g.tabbableNodes.length > 0;
3496
- }), i.tabbableGroups.length <= 0 && !d("fallbackFocus"))
3497
- throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");
3498
- if (i.containerGroups.find(function(g) {
3499
- return g.posTabIndexesFound;
3500
- }) && i.containerGroups.length > 1)
3501
- throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.");
3502
- }, h = function(g) {
3503
- var m = g.activeElement;
3504
- if (m)
3505
- return m.shadowRoot && m.shadowRoot.activeElement !== null ? h(m.shadowRoot) : m;
3506
- }, b = function(g) {
3507
- if (g !== !1 && g !== h(document)) {
3508
- if (!g || !g.focus) {
3509
- b(u());
3510
- return;
3511
- }
3512
- g.focus({
3513
- preventScroll: !!s.preventScroll
3514
- }), i.mostRecentlyFocusedNode = g, Nr(g) && g.select();
3515
- }
3516
- }, x = function(g) {
3517
- var m = d("setReturnFocus", {
3518
- params: [g]
3519
- });
3520
- return m || (m === !1 ? !1 : g);
3521
- }, w = function(g) {
3522
- var m = g.target, y = g.event, c = g.isBackward, M = c === void 0 ? !1 : c;
3523
- m = m || Xe(y), v();
3524
- var E = null;
3525
- if (i.tabbableGroups.length > 0) {
3526
- var R = a(m, y), Y = R >= 0 ? i.containerGroups[R] : void 0;
3527
- if (R < 0)
3528
- M ? E = i.tabbableGroups[i.tabbableGroups.length - 1].lastTabbableNode : E = i.tabbableGroups[0].firstTabbableNode;
3529
- else if (M) {
3530
- var j = i.tabbableGroups.findIndex(function(J) {
3531
- var ee = J.firstTabbableNode;
3532
- return m === ee;
3533
- });
3534
- if (j < 0 && (Y.container === m || dt(m, s.tabbableOptions) && !Ne(m, s.tabbableOptions) && !Y.nextTabbableNode(m, !1)) && (j = R), j >= 0) {
3535
- var S = j === 0 ? i.tabbableGroups.length - 1 : j - 1, z = i.tabbableGroups[S];
3536
- E = xe(m) >= 0 ? z.lastTabbableNode : z.lastDomTabbableNode;
3537
- } else Be(y) || (E = Y.nextTabbableNode(m, !1));
3538
- } else {
3539
- var G = i.tabbableGroups.findIndex(function(J) {
3540
- var ee = J.lastTabbableNode;
3541
- return m === ee;
3542
- });
3543
- if (G < 0 && (Y.container === m || dt(m, s.tabbableOptions) && !Ne(m, s.tabbableOptions) && !Y.nextTabbableNode(m)) && (G = R), G >= 0) {
3544
- var U = G === i.tabbableGroups.length - 1 ? 0 : G + 1, re = i.tabbableGroups[U];
3545
- E = xe(m) >= 0 ? re.firstTabbableNode : re.firstDomTabbableNode;
3546
- } else Be(y) || (E = Y.nextTabbableNode(m));
3547
- }
3548
- } else
3549
- E = d("fallbackFocus");
3550
- return E;
3551
- }, p = function(g) {
3552
- var m = Xe(g);
3553
- if (!(a(m, g) >= 0)) {
3554
- if (Ie(s.clickOutsideDeactivates, g)) {
3555
- l.deactivate({
3556
- // NOTE: by setting `returnFocus: false`, deactivate() will do nothing,
3557
- // which will result in the outside click setting focus to the node
3558
- // that was clicked (and if not focusable, to "nothing"); by setting
3559
- // `returnFocus: true`, we'll attempt to re-focus the node originally-focused
3560
- // on activation (or the configured `setReturnFocus` node), whether the
3561
- // outside click was on a focusable node or not
3562
- returnFocus: s.returnFocusOnDeactivate
3563
- });
3564
- return;
3565
- }
3566
- Ie(s.allowOutsideClick, g) || g.preventDefault();
3567
- }
3568
- }, T = function(g) {
3569
- var m = Xe(g), y = a(m, g) >= 0;
3570
- if (y || m instanceof Document)
3571
- y && (i.mostRecentlyFocusedNode = m);
3572
- else {
3573
- g.stopImmediatePropagation();
3574
- var c, M = !0;
3575
- if (i.mostRecentlyFocusedNode)
3576
- if (xe(i.mostRecentlyFocusedNode) > 0) {
3577
- var E = a(i.mostRecentlyFocusedNode), R = i.containerGroups[E].tabbableNodes;
3578
- if (R.length > 0) {
3579
- var Y = R.findIndex(function(j) {
3580
- return j === i.mostRecentlyFocusedNode;
3581
- });
3582
- Y >= 0 && (s.isKeyForward(i.recentNavEvent) ? Y + 1 < R.length && (c = R[Y + 1], M = !1) : Y - 1 >= 0 && (c = R[Y - 1], M = !1));
3583
- }
3584
- } else
3585
- i.containerGroups.some(function(j) {
3586
- return j.tabbableNodes.some(function(S) {
3587
- return xe(S) > 0;
3588
- });
3589
- }) || (M = !1);
3590
- else
3591
- M = !1;
3592
- M && (c = w({
3593
- // move FROM the MRU node, not event-related node (which will be the node that is
3594
- // outside the trap causing the focus escape we're trying to fix)
3595
- target: i.mostRecentlyFocusedNode,
3596
- isBackward: s.isKeyBackward(i.recentNavEvent)
3597
- })), b(c || i.mostRecentlyFocusedNode || u());
3598
- }
3599
- i.recentNavEvent = void 0;
3600
- }, D = function(g) {
3601
- var m = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
3602
- i.recentNavEvent = g;
3603
- var y = w({
3604
- event: g,
3605
- isBackward: m
3606
- });
3607
- y && (Be(g) && g.preventDefault(), b(y));
3608
- }, A = function(g) {
3609
- (s.isKeyForward(g) || s.isKeyBackward(g)) && D(g, s.isKeyBackward(g));
3610
- }, F = function(g) {
3611
- Fr(g) && Ie(s.escapeDeactivates, g) !== !1 && (g.preventDefault(), l.deactivate());
3612
- }, C = function(g) {
3613
- var m = Xe(g);
3614
- a(m, g) >= 0 || Ie(s.clickOutsideDeactivates, g) || Ie(s.allowOutsideClick, g) || (g.preventDefault(), g.stopImmediatePropagation());
3615
- }, P = function() {
3616
- if (i.active)
3617
- return Jt.activateTrap(r, l), i.delayInitialFocusTimer = s.delayInitialFocus ? Qt(function() {
3618
- b(u());
3619
- }) : b(u()), o.addEventListener("focusin", T, !0), o.addEventListener("mousedown", p, {
3620
- capture: !0,
3621
- passive: !1
3622
- }), o.addEventListener("touchstart", p, {
3623
- capture: !0,
3624
- passive: !1
3625
- }), o.addEventListener("click", C, {
3626
- capture: !0,
3627
- passive: !1
3628
- }), o.addEventListener("keydown", A, {
3629
- capture: !0,
3630
- passive: !1
3631
- }), o.addEventListener("keydown", F), l;
3632
- }, $ = function() {
3633
- if (i.active)
3634
- return o.removeEventListener("focusin", T, !0), o.removeEventListener("mousedown", p, !0), o.removeEventListener("touchstart", p, !0), o.removeEventListener("click", C, !0), o.removeEventListener("keydown", A, !0), o.removeEventListener("keydown", F), l;
3635
- }, B = function(g) {
3636
- var m = g.some(function(y) {
3637
- var c = Array.from(y.removedNodes);
3638
- return c.some(function(M) {
3639
- return M === i.mostRecentlyFocusedNode;
3640
- });
3641
- });
3642
- m && b(u());
3643
- }, k = typeof window < "u" && "MutationObserver" in window ? new MutationObserver(B) : void 0, V = function() {
3644
- k && (k.disconnect(), i.active && !i.paused && i.containers.map(function(g) {
3645
- k.observe(g, {
3646
- subtree: !0,
3647
- childList: !0
3648
- });
3649
- }));
3650
- };
3651
- return l = {
3652
- get active() {
3653
- return i.active;
3654
- },
3655
- get paused() {
3656
- return i.paused;
3657
- },
3658
- activate: function(g) {
3659
- if (i.active)
3660
- return this;
3661
- var m = f(g, "onActivate"), y = f(g, "onPostActivate"), c = f(g, "checkCanFocusTrap");
3662
- c || v(), i.active = !0, i.paused = !1, i.nodeFocusedBeforeActivation = h(o), m == null || m();
3663
- var M = function() {
3664
- c && v(), P(), V(), y == null || y();
3665
- };
3666
- return c ? (c(i.containers.concat()).then(M, M), this) : (M(), this);
3667
- },
3668
- deactivate: function(g) {
3669
- if (!i.active)
3670
- return this;
3671
- var m = Zt({
3672
- onDeactivate: s.onDeactivate,
3673
- onPostDeactivate: s.onPostDeactivate,
3674
- checkCanReturnFocus: s.checkCanReturnFocus
3675
- }, g);
3676
- clearTimeout(i.delayInitialFocusTimer), i.delayInitialFocusTimer = void 0, $(), i.active = !1, i.paused = !1, V(), Jt.deactivateTrap(r, l);
3677
- var y = f(m, "onDeactivate"), c = f(m, "onPostDeactivate"), M = f(m, "checkCanReturnFocus"), E = f(m, "returnFocus", "returnFocusOnDeactivate");
3678
- y == null || y();
3679
- var R = function() {
3680
- Qt(function() {
3681
- E && b(x(i.nodeFocusedBeforeActivation)), c == null || c();
3682
- });
3683
- };
3684
- return E && M ? (M(x(i.nodeFocusedBeforeActivation)).then(R, R), this) : (R(), this);
3685
- },
3686
- pause: function(g) {
3687
- return i.active ? (i.manuallyPaused = !0, this._setPausedState(!0, g)) : this;
3688
- },
3689
- unpause: function(g) {
3690
- return i.active ? (i.manuallyPaused = !1, r[r.length - 1] !== this ? this : this._setPausedState(!1, g)) : this;
3691
- },
3692
- updateContainerElements: function(g) {
3693
- var m = [].concat(g).filter(Boolean);
3694
- return i.containers = m.map(function(y) {
3695
- return typeof y == "string" ? o.querySelector(y) : y;
3696
- }), i.active && v(), V(), this;
3697
- }
3698
- }, Object.defineProperties(l, {
3699
- _isManuallyPaused: {
3700
- value: function() {
3701
- return i.manuallyPaused;
3702
- }
3703
- },
3704
- _setPausedState: {
3705
- value: function(g, m) {
3706
- if (i.paused === g)
3707
- return this;
3708
- if (i.paused = g, g) {
3709
- var y = f(m, "onPause"), c = f(m, "onPostPause");
3710
- y == null || y(), $(), V(), c == null || c();
3711
- } else {
3712
- var M = f(m, "onUnpause"), E = f(m, "onPostUnpause");
3713
- M == null || M(), v(), P(), V(), E == null || E();
3714
- }
3715
- return this;
3716
- }
3717
- }
3718
- }), l.updateContainerElements(e), l;
3719
- };
3720
- const vt = /* @__PURE__ */ new WeakMap(), ht = /* @__PURE__ */ new WeakMap(), Ir = typeof HTMLElement < "u" && "inert" in HTMLElement.prototype;
3721
- function Qr(t, e = {}) {
3722
- const { floatingContext: n } = Ke(t), {
3723
- refs: { floatingEl: o },
3724
- open: r,
3725
- setOpen: s
3726
- } = n, {
3727
- enabled: i = !0,
3728
- modal: l = !1,
3729
- initialFocus: f,
3730
- returnFocus: a = !0,
3731
- closeOnFocusOut: d = !1,
3732
- preventScroll: u = !0,
3733
- outsideElementsInert: v = !1,
3734
- onError: h
3735
- } = e, b = W(() => !!N(i)), x = W(() => !!N(l)), w = W(() => !x.value && !!N(d)), p = W(() => !!N(v)), T = qe(null), D = W(() => T.value !== null);
3736
- let A = null, F = !1;
3737
- function C(B) {
3738
- if (!x.value) return () => {
3739
- };
3740
- const k = (B.ownerDocument ?? document).body, I = Array.from(k.children).filter((m) => !(m === B || B.contains(m) || m.contains(B))), g = p.value && Ir;
3741
- for (const m of I)
3742
- g ? (ht.set(m, m.inert ?? null), m.inert = !0) : (vt.set(m, m.getAttribute("aria-hidden")), m.setAttribute("aria-hidden", "true"));
3743
- return () => {
3744
- for (const m of I)
3745
- if (g) {
3746
- const y = ht.get(m);
3747
- m.inert = y ?? !1, ht.delete(m);
3748
- } else {
3749
- const y = vt.get(m);
3750
- y == null ? m.removeAttribute("aria-hidden") : m.setAttribute("aria-hidden", y), vt.delete(m);
3751
- }
3752
- };
3753
- }
3754
- const P = () => {
3755
- if (!(F || !T.value)) {
3756
- F = !0;
3757
- try {
3758
- T.value.deactivate(), T.value = null;
3759
- } finally {
3760
- F = !1;
3761
- }
3762
- }
3763
- }, $ = () => {
3764
- P();
3765
- const B = o.value;
3766
- if (B) {
3767
- T.value = Mr(B, {
3768
- onActivate: () => {
3769
- A = C(B);
3770
- },
3771
- onDeactivate: () => {
3772
- A && (A(), A = null), w.value && s(!1);
3773
- },
3774
- initialFocus: () => typeof f == "function" ? f() : f,
3775
- fallbackFocus: () => B,
3776
- returnFocusOnDeactivate: N(a),
3777
- clickOutsideDeactivates: w.value,
3778
- allowOutsideClick: !x.value,
3779
- escapeDeactivates: !1,
3780
- preventScroll: N(u),
3781
- tabbableOptions: { displayCheck: "none" }
3782
- });
3783
- try {
3784
- T.value.activate();
3785
- } catch (k) {
3786
- A && (A(), A = null), T.value = null, h && h(k);
3787
- }
3788
- }
3789
- };
3790
- return Ce(() => {
3791
- b.value && r.value && o.value ? $() : P();
3792
- }), Oe(() => {
3793
- P();
3794
- }), {
3795
- isActive: D,
3796
- activate: $,
3797
- deactivate: P
3798
- };
3799
- }
3800
- export {
3801
- Kn as FollowTracker,
3802
- Ut as GridNavigationStrategy,
3803
- ir as HorizontalNavigationStrategy,
3804
- $n as StaticTracker,
3805
- on as TrackingStrategy,
3806
- rr as VerticalNavigationStrategy,
3807
- mt as VirtualElementFactory,
3808
- Bo as arrow,
3809
- Vr as autoPlacement,
3810
- Wo as createTree,
3811
- Yt as createTreeNode,
3812
- _r as flip,
3813
- zr as hide,
3814
- $r as offset,
3815
- jr as shift,
3816
- Yr as size,
3817
- Wr as useArrow,
3818
- Ur as useClick,
3819
- Kr as useClientPoint,
3820
- qr as useEscapeKey,
3821
- Ho as useFloating,
3822
- Xr as useFloatingTree,
3823
- Gr as useFocus,
3824
- Qr as useFocusTrap,
3825
- Zr as useHover,
3826
- Jr as useListNavigation
3827
- };