v-float 0.9.1 → 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 (52) 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 -74
  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/navigation-strategies.d.ts +0 -36
  12. package/dist/composables/interactions/navigation-strategies.d.ts.map +0 -1
  13. package/dist/composables/interactions/polygon.d.ts +0 -38
  14. package/dist/composables/interactions/polygon.d.ts.map +0 -1
  15. package/dist/composables/interactions/use-click.d.ts +0 -120
  16. package/dist/composables/interactions/use-click.d.ts.map +0 -1
  17. package/dist/composables/interactions/use-escape-key.d.ts +0 -57
  18. package/dist/composables/interactions/use-escape-key.d.ts.map +0 -1
  19. package/dist/composables/interactions/use-focus-trap.d.ts +0 -41
  20. package/dist/composables/interactions/use-focus-trap.d.ts.map +0 -1
  21. package/dist/composables/interactions/use-focus.d.ts +0 -60
  22. package/dist/composables/interactions/use-focus.d.ts.map +0 -1
  23. package/dist/composables/interactions/use-hover.d.ts +0 -78
  24. package/dist/composables/interactions/use-hover.d.ts.map +0 -1
  25. package/dist/composables/interactions/use-list-navigation.d.ts +0 -109
  26. package/dist/composables/interactions/use-list-navigation.d.ts.map +0 -1
  27. package/dist/composables/middlewares/arrow.d.ts +0 -25
  28. package/dist/composables/middlewares/arrow.d.ts.map +0 -1
  29. package/dist/composables/middlewares/index.d.ts +0 -4
  30. package/dist/composables/middlewares/index.d.ts.map +0 -1
  31. package/dist/composables/positioning/index.d.ts +0 -5
  32. package/dist/composables/positioning/index.d.ts.map +0 -1
  33. package/dist/composables/positioning/use-arrow.d.ts +0 -55
  34. package/dist/composables/positioning/use-arrow.d.ts.map +0 -1
  35. package/dist/composables/positioning/use-client-point.d.ts +0 -218
  36. package/dist/composables/positioning/use-client-point.d.ts.map +0 -1
  37. package/dist/composables/positioning/use-floating-tree.d.ts +0 -240
  38. package/dist/composables/positioning/use-floating-tree.d.ts.map +0 -1
  39. package/dist/composables/positioning/use-floating.d.ts +0 -162
  40. package/dist/composables/positioning/use-floating.d.ts.map +0 -1
  41. package/dist/composables/utils/is-using-keyboard.d.ts +0 -2
  42. package/dist/composables/utils/is-using-keyboard.d.ts.map +0 -1
  43. package/dist/composables/utils/use-active-descendant.d.ts +0 -8
  44. package/dist/composables/utils/use-active-descendant.d.ts.map +0 -1
  45. package/dist/index.d.ts +0 -2
  46. package/dist/index.d.ts.map +0 -1
  47. package/dist/types.d.ts +0 -18
  48. package/dist/types.d.ts.map +0 -1
  49. package/dist/utils.d.ts +0 -92
  50. package/dist/utils.d.ts.map +0 -1
  51. package/dist/v-float.es.js +0 -3520
  52. package/dist/v-float.umd.js +0 -4
@@ -1,3520 +0,0 @@
1
- var wn = Object.defineProperty;
2
- var bn = (t, e, n) => e in t ? wn(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var Be = (t, e, n) => bn(t, typeof e != "symbol" ? e + "" : e, n);
4
- import { watch as de, computed as F, toValue as T, useId as yn, ref as ie, watchEffect as xn, onWatcherCleanup as Te, readonly as _t, shallowRef as dt, onScopeDispose as Ie, shallowReactive as En, getCurrentScope as Cn, unref as Tn, watchPostEffect as Me } from "vue";
5
- function gr(t, e, n = {}) {
6
- const { offset: o = "-4px" } = n, { middlewareData: r, placement: l, refs: i } = e;
7
- de(t, (f) => {
8
- i.arrowEl.value = f;
9
- });
10
- const a = F(() => {
11
- var f;
12
- return ((f = r.value.arrow) == null ? void 0 : f.x) ?? 0;
13
- }), d = F(() => {
14
- var f;
15
- return ((f = r.value.arrow) == null ? void 0 : f.y) ?? 0;
16
- }), s = F(() => {
17
- if (!(t.value || i.arrowEl.value) || !r.value.arrow)
18
- return {};
19
- const u = T(l).split("-")[0], h = a.value, v = d.value;
20
- return u === "bottom" ? {
21
- "inset-inline-start": `${h}px`,
22
- "inset-block-start": o
23
- } : u === "top" ? {
24
- "inset-inline-start": `${h}px`,
25
- "inset-block-end": o
26
- } : u === "right" ? {
27
- "inset-block-start": `${v}px`,
28
- "inset-inline-start": o
29
- } : u === "left" ? {
30
- "inset-block-start": `${v}px`,
31
- "inset-inline-end": o
32
- } : {};
33
- });
34
- return {
35
- arrowX: a,
36
- arrowY: d,
37
- arrowStyles: s
38
- };
39
- }
40
- let An = 0;
41
- function jt() {
42
- return yn() || `id-${++An}`;
43
- }
44
- function Xe(t) {
45
- return t instanceof Element && t instanceof HTMLElement;
46
- }
47
- function Sn() {
48
- return typeof navigator > "u" ? !1 : navigator.platform.toUpperCase().indexOf("MAC") >= 0;
49
- }
50
- function On() {
51
- return typeof navigator > "u" ? !1 : /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
52
- }
53
- function Ln(t) {
54
- return typeof (t == null ? void 0 : t.matches) != "function" ? !1 : t.matches(":focus-visible");
55
- }
56
- function qt(t, e) {
57
- if (t === void 0) return !1;
58
- const n = t === "mouse";
59
- return e ? n : n || t === "pen";
60
- }
61
- function wt(t) {
62
- return !t || !(t instanceof HTMLElement) ? !1 : t instanceof HTMLInputElement || t instanceof HTMLTextAreaElement || t.isContentEditable && t.contentEditable !== "false";
63
- }
64
- function Tt(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 At(t) {
69
- return wt(t);
70
- }
71
- function St(t, e) {
72
- return e ? "composedPath" in t && typeof t.composedPath == "function" ? t.composedPath().includes(e) : e.contains(t.target) : !1;
73
- }
74
- function Dn(t, e) {
75
- const n = e.getBoundingClientRect(), o = e.offsetWidth - e.clientWidth, r = e.offsetHeight - e.clientHeight, l = t.clientX - n.left, i = t.clientY - n.top;
76
- if (o > 0) {
77
- const a = e.clientWidth;
78
- if (l >= a && l <= e.offsetWidth)
79
- return !0;
80
- }
81
- if (r > 0) {
82
- const a = e.clientHeight;
83
- if (i >= a && i <= e.offsetHeight)
84
- return !0;
85
- }
86
- return !1;
87
- }
88
- function ut(t, e) {
89
- return t.contains(e);
90
- }
91
- function Pn(t) {
92
- return t.target;
93
- }
94
- function Ot() {
95
- return typeof performance < "u" ? performance.now() : Date.now();
96
- }
97
- function Lt(t) {
98
- t !== -1 && clearTimeout(t);
99
- }
100
- function Rn(t) {
101
- return t !== null && typeof t == "object" && "data" in t && "id" in t && "children" in t && "parent" in t;
102
- }
103
- function je(t) {
104
- return Rn(t) ? {
105
- floatingContext: t.data,
106
- treeContext: t
107
- } : {
108
- floatingContext: t,
109
- treeContext: null
110
- };
111
- }
112
- function ue(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 rt(t, e) {
121
- for (const n of t.children.value)
122
- if (n.data.open.value) {
123
- if (ue(e, n.data.refs.anchorEl.value) || ue(e, n.data.refs.floatingEl.value))
124
- return n;
125
- const o = rt(n, e);
126
- if (o) return o;
127
- }
128
- return null;
129
- }
130
- const Ge = (t) => typeof t == "number" && Number.isFinite(t) ? t : null, Re = class Re {
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: Re.DEFAULT_DIMENSIONS.width,
178
- height: Re.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: l } = e;
206
- return l && 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, l) => Math.max(0, r || l);
213
- switch (e) {
214
- case "both":
215
- return { width: 0, height: 0 };
216
- case "x":
217
- return {
218
- width: o(
219
- n.width,
220
- Re.DEFAULT_DIMENSIONS.width
221
- ),
222
- height: 0
223
- };
224
- case "y":
225
- return {
226
- width: 0,
227
- height: o(
228
- n.height,
229
- Re.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: l } = e, i = Math.max(0, r), a = Math.max(0, l);
239
- return {
240
- x: n,
241
- y: o,
242
- width: i,
243
- height: a,
244
- top: o,
245
- right: n + i,
246
- bottom: o + a,
247
- left: n,
248
- toJSON: () => ({ x: n, y: o, width: i, height: a })
249
- };
250
- }
251
- };
252
- Be(Re, "DEFAULT_DIMENSIONS", { width: 100, height: 30 });
253
- let ht = Re;
254
- class Gt {
255
- constructor() {
256
- // The core state every strategy needs: the last known good coordinates
257
- Be(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 Mn extends Gt {
281
- constructor() {
282
- super(...arguments);
283
- Be(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 && qt(n.originalEvent.pointerType, !0) ? r : null;
302
- case "pointerenter":
303
- return r;
304
- default:
305
- return null;
306
- }
307
- }
308
- }
309
- class Nn extends Gt {
310
- constructor() {
311
- super(...arguments);
312
- Be(this, "name", "static");
313
- // Static strategy needs to remember the "trigger" coordinates from clicks
314
- // These take priority over hover coordinates for positioning
315
- Be(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 wr(t, e, n = {}) {
349
- const { open: o, refs: r } = e, l = new ht(), i = ie({ x: null, y: null }), a = ie(null), d = F(() => T(n.axis ?? "both")), s = F(() => T(n.enabled ?? !0)), f = F(() => Ge(T(n.x ?? null))), u = F(() => Ge(T(n.y ?? null))), h = F(
350
- () => f.value !== null && u.value !== null
351
- ), v = F(() => h.value ? {
352
- x: f.value,
353
- y: u.value
354
- } : i.value), g = F(() => {
355
- const E = v.value;
356
- switch (d.value) {
357
- case "x":
358
- return { x: E.x, y: null };
359
- case "y":
360
- return { x: null, y: E.y };
361
- case "both":
362
- return E;
363
- }
364
- }), w = (n.trackingMode ?? "follow") === "follow" ? new Mn() : new Nn(), m = (E, P) => {
365
- h.value || (i.value = {
366
- x: Ge(E),
367
- y: Ge(P)
368
- });
369
- }, p = () => {
370
- h.value || (i.value = { x: null, y: null });
371
- }, y = (E, P) => {
372
- const z = {
373
- type: P,
374
- coordinates: { x: E.clientX, y: E.clientY },
375
- originalEvent: E
376
- }, k = w.process(z, {
377
- isOpen: o.value
378
- });
379
- k && m(k.x, k.y);
380
- };
381
- de(
382
- [g, a, d, t],
383
- () => {
384
- r.anchorEl.value = l.create({
385
- coordinates: g.value,
386
- referenceElement: t.value,
387
- baselineCoordinates: a.value,
388
- axis: d.value
389
- });
390
- },
391
- { immediate: !0 }
392
- ), de(o, (E) => {
393
- if (!(!s.value || h.value))
394
- if (E) {
395
- const P = w.getCoordinatesForOpening();
396
- P ? (m(P.x, P.y), a.value = { ...P }) : a.value = { ...i.value };
397
- } else
398
- w.onClose(), p(), a.value = null;
399
- });
400
- const L = (E) => {
401
- y(E, "pointerdown");
402
- }, R = (E) => {
403
- y(E, "pointerenter");
404
- }, D = (E) => {
405
- y(E, "pointermove");
406
- };
407
- return xn(() => {
408
- if (h.value || !s.value) return;
409
- const E = t.value;
410
- if (!E) return;
411
- const P = w.getRequiredEvents(), z = {
412
- pointerenter: R,
413
- pointerdown: L,
414
- pointermove: D
415
- };
416
- P.forEach((k) => {
417
- const N = z[k];
418
- N && E.addEventListener(k, N);
419
- }), Te(() => {
420
- P.forEach((k) => {
421
- const N = z[k];
422
- N && E.removeEventListener(k, N);
423
- });
424
- });
425
- }), {
426
- coordinates: _t(g),
427
- updatePosition: (E, P) => m(E, P)
428
- };
429
- }
430
- const Zt = ["top", "right", "bottom", "left"], Dt = ["start", "end"], Pt = /* @__PURE__ */ Zt.reduce((t, e) => t.concat(e, e + "-" + Dt[0], e + "-" + Dt[1]), []), Oe = Math.min, ae = Math.max, Qe = Math.round, Ze = Math.floor, be = (t) => ({
431
- x: t,
432
- y: t
433
- }), In = {
434
- left: "right",
435
- right: "left",
436
- bottom: "top",
437
- top: "bottom"
438
- }, Fn = {
439
- start: "end",
440
- end: "start"
441
- };
442
- function vt(t, e, n) {
443
- return ae(t, Oe(e, n));
444
- }
445
- function De(t, e) {
446
- return typeof t == "function" ? t(e) : t;
447
- }
448
- function ye(t) {
449
- return t.split("-")[0];
450
- }
451
- function pe(t) {
452
- return t.split("-")[1];
453
- }
454
- function Jt(t) {
455
- return t === "x" ? "y" : "x";
456
- }
457
- function bt(t) {
458
- return t === "y" ? "height" : "width";
459
- }
460
- const kn = /* @__PURE__ */ new Set(["top", "bottom"]);
461
- function Ce(t) {
462
- return kn.has(ye(t)) ? "y" : "x";
463
- }
464
- function yt(t) {
465
- return Jt(Ce(t));
466
- }
467
- function Qt(t, e, n) {
468
- n === void 0 && (n = !1);
469
- const o = pe(t), r = yt(t), l = bt(r);
470
- let i = r === "x" ? o === (n ? "end" : "start") ? "right" : "left" : o === "start" ? "bottom" : "top";
471
- return e.reference[l] > e.floating[l] && (i = tt(i)), [i, tt(i)];
472
- }
473
- function Hn(t) {
474
- const e = tt(t);
475
- return [et(t), e, et(e)];
476
- }
477
- function et(t) {
478
- return t.replace(/start|end/g, (e) => Fn[e]);
479
- }
480
- const Rt = ["left", "right"], Mt = ["right", "left"], Bn = ["top", "bottom"], Wn = ["bottom", "top"];
481
- function Vn(t, e, n) {
482
- switch (t) {
483
- case "top":
484
- case "bottom":
485
- return n ? e ? Mt : Rt : e ? Rt : Mt;
486
- case "left":
487
- case "right":
488
- return e ? Bn : Wn;
489
- default:
490
- return [];
491
- }
492
- }
493
- function $n(t, e, n, o) {
494
- const r = pe(t);
495
- let l = Vn(ye(t), n === "start", o);
496
- return r && (l = l.map((i) => i + "-" + r), e && (l = l.concat(l.map(et)))), l;
497
- }
498
- function tt(t) {
499
- return t.replace(/left|right|bottom|top/g, (e) => In[e]);
500
- }
501
- function Kn(t) {
502
- return {
503
- top: 0,
504
- right: 0,
505
- bottom: 0,
506
- left: 0,
507
- ...t
508
- };
509
- }
510
- function en(t) {
511
- return typeof t != "number" ? Kn(t) : {
512
- top: t,
513
- right: t,
514
- bottom: t,
515
- left: t
516
- };
517
- }
518
- function nt(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 Nt(t, e, n) {
537
- let {
538
- reference: o,
539
- floating: r
540
- } = t;
541
- const l = Ce(e), i = yt(e), a = bt(i), d = ye(e), s = l === "y", f = o.x + o.width / 2 - r.width / 2, u = o.y + o.height / 2 - r.height / 2, h = o[a] / 2 - r[a] / 2;
542
- let v;
543
- switch (d) {
544
- case "top":
545
- v = {
546
- x: f,
547
- y: o.y - r.height
548
- };
549
- break;
550
- case "bottom":
551
- v = {
552
- x: f,
553
- y: o.y + o.height
554
- };
555
- break;
556
- case "right":
557
- v = {
558
- x: o.x + o.width,
559
- y: u
560
- };
561
- break;
562
- case "left":
563
- v = {
564
- x: o.x - r.width,
565
- y: u
566
- };
567
- break;
568
- default:
569
- v = {
570
- x: o.x,
571
- y: o.y
572
- };
573
- }
574
- switch (pe(e)) {
575
- case "start":
576
- v[i] -= h * (n && s ? -1 : 1);
577
- break;
578
- case "end":
579
- v[i] += h * (n && s ? -1 : 1);
580
- break;
581
- }
582
- return v;
583
- }
584
- const zn = async (t, e, n) => {
585
- const {
586
- placement: o = "bottom",
587
- strategy: r = "absolute",
588
- middleware: l = [],
589
- platform: i
590
- } = n, a = l.filter(Boolean), d = await (i.isRTL == null ? void 0 : i.isRTL(e));
591
- let s = await i.getElementRects({
592
- reference: t,
593
- floating: e,
594
- strategy: r
595
- }), {
596
- x: f,
597
- y: u
598
- } = Nt(s, o, d), h = o, v = {}, g = 0;
599
- for (let w = 0; w < a.length; w++) {
600
- const {
601
- name: m,
602
- fn: p
603
- } = a[w], {
604
- x: y,
605
- y: L,
606
- data: R,
607
- reset: D
608
- } = await p({
609
- x: f,
610
- y: u,
611
- initialPlacement: o,
612
- placement: h,
613
- strategy: r,
614
- middlewareData: v,
615
- rects: s,
616
- platform: i,
617
- elements: {
618
- reference: t,
619
- floating: e
620
- }
621
- });
622
- f = y ?? f, u = L ?? u, v = {
623
- ...v,
624
- [m]: {
625
- ...v[m],
626
- ...R
627
- }
628
- }, D && g <= 50 && (g++, typeof D == "object" && (D.placement && (h = D.placement), D.rects && (s = D.rects === !0 ? await i.getElementRects({
629
- reference: t,
630
- floating: e,
631
- strategy: r
632
- }) : D.rects), {
633
- x: f,
634
- y: u
635
- } = Nt(s, h, d)), w = -1);
636
- }
637
- return {
638
- x: f,
639
- y: u,
640
- placement: h,
641
- strategy: r,
642
- middlewareData: v
643
- };
644
- };
645
- async function Ve(t, e) {
646
- var n;
647
- e === void 0 && (e = {});
648
- const {
649
- x: o,
650
- y: r,
651
- platform: l,
652
- rects: i,
653
- elements: a,
654
- strategy: d
655
- } = t, {
656
- boundary: s = "clippingAncestors",
657
- rootBoundary: f = "viewport",
658
- elementContext: u = "floating",
659
- altBoundary: h = !1,
660
- padding: v = 0
661
- } = De(e, t), g = en(v), m = a[h ? u === "floating" ? "reference" : "floating" : u], p = nt(await l.getClippingRect({
662
- element: (n = await (l.isElement == null ? void 0 : l.isElement(m))) == null || n ? m : m.contextElement || await (l.getDocumentElement == null ? void 0 : l.getDocumentElement(a.floating)),
663
- boundary: s,
664
- rootBoundary: f,
665
- strategy: d
666
- })), y = u === "floating" ? {
667
- x: o,
668
- y: r,
669
- width: i.floating.width,
670
- height: i.floating.height
671
- } : i.reference, L = await (l.getOffsetParent == null ? void 0 : l.getOffsetParent(a.floating)), R = await (l.isElement == null ? void 0 : l.isElement(L)) ? await (l.getScale == null ? void 0 : l.getScale(L)) || {
672
- x: 1,
673
- y: 1
674
- } : {
675
- x: 1,
676
- y: 1
677
- }, D = nt(l.convertOffsetParentRelativeRectToViewportRelativeRect ? await l.convertOffsetParentRelativeRectToViewportRelativeRect({
678
- elements: a,
679
- rect: y,
680
- offsetParent: L,
681
- strategy: d
682
- }) : y);
683
- return {
684
- top: (p.top - D.top + g.top) / R.y,
685
- bottom: (D.bottom - p.bottom + g.bottom) / R.y,
686
- left: (p.left - D.left + g.left) / R.x,
687
- right: (D.right - p.right + g.right) / R.x
688
- };
689
- }
690
- const Xn = (t) => ({
691
- name: "arrow",
692
- options: t,
693
- async fn(e) {
694
- const {
695
- x: n,
696
- y: o,
697
- placement: r,
698
- rects: l,
699
- platform: i,
700
- elements: a,
701
- middlewareData: d
702
- } = e, {
703
- element: s,
704
- padding: f = 0
705
- } = De(t, e) || {};
706
- if (s == null)
707
- return {};
708
- const u = en(f), h = {
709
- x: n,
710
- y: o
711
- }, v = yt(r), g = bt(v), w = await i.getDimensions(s), m = v === "y", p = m ? "top" : "left", y = m ? "bottom" : "right", L = m ? "clientHeight" : "clientWidth", R = l.reference[g] + l.reference[v] - h[v] - l.floating[g], D = h[v] - l.reference[v], E = await (i.getOffsetParent == null ? void 0 : i.getOffsetParent(s));
712
- let P = E ? E[L] : 0;
713
- (!P || !await (i.isElement == null ? void 0 : i.isElement(E))) && (P = a.floating[L] || l.floating[g]);
714
- const z = R / 2 - D / 2, k = P / 2 - w[g] / 2 - 1, N = Oe(u[p], k), W = Oe(u[y], k), Y = N, X = P - w[g] - W, $ = P / 2 - w[g] / 2 + z, C = vt(Y, $, X), c = !d.arrow && pe(r) != null && $ !== C && l.reference[g] / 2 - ($ < Y ? N : W) - w[g] / 2 < 0, V = c ? $ < Y ? $ - Y : $ - X : 0;
715
- return {
716
- [v]: h[v] + V,
717
- data: {
718
- [v]: C,
719
- centerOffset: $ - C - V,
720
- ...c && {
721
- alignmentOffset: V
722
- }
723
- },
724
- reset: c
725
- };
726
- }
727
- });
728
- function Yn(t, e, n) {
729
- return (t ? [...n.filter((r) => pe(r) === t), ...n.filter((r) => pe(r) !== t)] : n.filter((r) => ye(r) === r)).filter((r) => t ? pe(r) === t || (e ? et(r) !== r : !1) : !0);
730
- }
731
- const Un = 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: l,
739
- middlewareData: i,
740
- placement: a,
741
- platform: d,
742
- elements: s
743
- } = e, {
744
- crossAxis: f = !1,
745
- alignment: u,
746
- allowedPlacements: h = Pt,
747
- autoAlignment: v = !0,
748
- ...g
749
- } = De(t, e), w = u !== void 0 || h === Pt ? Yn(u || null, v, h) : h, m = await Ve(e, g), p = ((n = i.autoPlacement) == null ? void 0 : n.index) || 0, y = w[p];
750
- if (y == null)
751
- return {};
752
- const L = Qt(y, l, await (d.isRTL == null ? void 0 : d.isRTL(s.floating)));
753
- if (a !== y)
754
- return {
755
- reset: {
756
- placement: w[0]
757
- }
758
- };
759
- const R = [m[ye(y)], m[L[0]], m[L[1]]], D = [...((o = i.autoPlacement) == null ? void 0 : o.overflows) || [], {
760
- placement: y,
761
- overflows: R
762
- }], E = w[p + 1];
763
- if (E)
764
- return {
765
- data: {
766
- index: p + 1,
767
- overflows: D
768
- },
769
- reset: {
770
- placement: E
771
- }
772
- };
773
- const P = D.map((N) => {
774
- const W = pe(N.placement);
775
- return [N.placement, W && f ? (
776
- // Check along the mainAxis and main crossAxis side.
777
- N.overflows.slice(0, 2).reduce((Y, X) => Y + X, 0)
778
- ) : (
779
- // Check only the mainAxis.
780
- N.overflows[0]
781
- ), N.overflows];
782
- }).sort((N, W) => N[1] - W[1]), k = ((r = P.filter((N) => N[2].slice(
783
- 0,
784
- // Aligned placements should not check their opposite crossAxis
785
- // side.
786
- pe(N[0]) ? 2 : 3
787
- ).every((W) => W <= 0))[0]) == null ? void 0 : r[0]) || P[0][0];
788
- return k !== a ? {
789
- data: {
790
- index: p + 1,
791
- overflows: D
792
- },
793
- reset: {
794
- placement: k
795
- }
796
- } : {};
797
- }
798
- };
799
- }, _n = 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: l,
808
- rects: i,
809
- initialPlacement: a,
810
- platform: d,
811
- elements: s
812
- } = e, {
813
- mainAxis: f = !0,
814
- crossAxis: u = !0,
815
- fallbackPlacements: h,
816
- fallbackStrategy: v = "bestFit",
817
- fallbackAxisSideDirection: g = "none",
818
- flipAlignment: w = !0,
819
- ...m
820
- } = De(t, e);
821
- if ((n = l.arrow) != null && n.alignmentOffset)
822
- return {};
823
- const p = ye(r), y = Ce(a), L = ye(a) === a, R = await (d.isRTL == null ? void 0 : d.isRTL(s.floating)), D = h || (L || !w ? [tt(a)] : Hn(a)), E = g !== "none";
824
- !h && E && D.push(...$n(a, w, g, R));
825
- const P = [a, ...D], z = await Ve(e, m), k = [];
826
- let N = ((o = l.flip) == null ? void 0 : o.overflows) || [];
827
- if (f && k.push(z[p]), u) {
828
- const $ = Qt(r, i, R);
829
- k.push(z[$[0]], z[$[1]]);
830
- }
831
- if (N = [...N, {
832
- placement: r,
833
- overflows: k
834
- }], !k.every(($) => $ <= 0)) {
835
- var W, Y;
836
- const $ = (((W = l.flip) == null ? void 0 : W.index) || 0) + 1, C = P[$];
837
- if (C && (!(u === "alignment" ? y !== Ce(C) : !1) || // We leave the current main axis only if every placement on that axis
838
- // overflows the main axis.
839
- N.every((b) => Ce(b.placement) === y ? b.overflows[0] > 0 : !0)))
840
- return {
841
- data: {
842
- index: $,
843
- overflows: N
844
- },
845
- reset: {
846
- placement: C
847
- }
848
- };
849
- let c = (Y = N.filter((V) => V.overflows[0] <= 0).sort((V, b) => V.overflows[1] - b.overflows[1])[0]) == null ? void 0 : Y.placement;
850
- if (!c)
851
- switch (v) {
852
- case "bestFit": {
853
- var X;
854
- const V = (X = N.filter((b) => {
855
- if (E) {
856
- const U = Ce(b.placement);
857
- return U === y || // Create a bias to the `y` side axis due to horizontal
858
- // reading directions favoring greater width.
859
- U === "y";
860
- }
861
- return !0;
862
- }).map((b) => [b.placement, b.overflows.filter((U) => U > 0).reduce((U, te) => U + te, 0)]).sort((b, U) => b[1] - U[1])[0]) == null ? void 0 : X[0];
863
- V && (c = V);
864
- break;
865
- }
866
- case "initialPlacement":
867
- c = a;
868
- break;
869
- }
870
- if (r !== c)
871
- return {
872
- reset: {
873
- placement: c
874
- }
875
- };
876
- }
877
- return {};
878
- }
879
- };
880
- };
881
- function It(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 Ft(t) {
890
- return Zt.some((e) => t[e] >= 0);
891
- }
892
- const jn = 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
- } = De(t, e);
903
- switch (o) {
904
- case "referenceHidden": {
905
- const l = await Ve(e, {
906
- ...r,
907
- elementContext: "reference"
908
- }), i = It(l, n.reference);
909
- return {
910
- data: {
911
- referenceHiddenOffsets: i,
912
- referenceHidden: Ft(i)
913
- }
914
- };
915
- }
916
- case "escaped": {
917
- const l = await Ve(e, {
918
- ...r,
919
- altBoundary: !0
920
- }), i = It(l, n.floating);
921
- return {
922
- data: {
923
- escapedOffsets: i,
924
- escaped: Ft(i)
925
- }
926
- };
927
- }
928
- default:
929
- return {};
930
- }
931
- }
932
- };
933
- }, qn = /* @__PURE__ */ new Set(["left", "top"]);
934
- async function Gn(t, e) {
935
- const {
936
- placement: n,
937
- platform: o,
938
- elements: r
939
- } = t, l = await (o.isRTL == null ? void 0 : o.isRTL(r.floating)), i = ye(n), a = pe(n), d = Ce(n) === "y", s = qn.has(i) ? -1 : 1, f = l && d ? -1 : 1, u = De(e, t);
940
- let {
941
- mainAxis: h,
942
- crossAxis: v,
943
- alignmentAxis: g
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 a && typeof g == "number" && (v = a === "end" ? g * -1 : g), d ? {
954
- x: v * f,
955
- y: h * s
956
- } : {
957
- x: h * s,
958
- y: v * f
959
- };
960
- }
961
- const Zn = 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: l,
970
- placement: i,
971
- middlewareData: a
972
- } = e, d = await Gn(e, t);
973
- return i === ((n = a.offset) == null ? void 0 : n.placement) && (o = a.arrow) != null && o.alignmentOffset ? {} : {
974
- x: r + d.x,
975
- y: l + d.y,
976
- data: {
977
- ...d,
978
- placement: i
979
- }
980
- };
981
- }
982
- };
983
- }, Jn = 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: l = !0,
994
- crossAxis: i = !1,
995
- limiter: a = {
996
- fn: (m) => {
997
- let {
998
- x: p,
999
- y
1000
- } = m;
1001
- return {
1002
- x: p,
1003
- y
1004
- };
1005
- }
1006
- },
1007
- ...d
1008
- } = De(t, e), s = {
1009
- x: n,
1010
- y: o
1011
- }, f = await Ve(e, d), u = Ce(ye(r)), h = Jt(u);
1012
- let v = s[h], g = s[u];
1013
- if (l) {
1014
- const m = h === "y" ? "top" : "left", p = h === "y" ? "bottom" : "right", y = v + f[m], L = v - f[p];
1015
- v = vt(y, v, L);
1016
- }
1017
- if (i) {
1018
- const m = u === "y" ? "top" : "left", p = u === "y" ? "bottom" : "right", y = g + f[m], L = g - f[p];
1019
- g = vt(y, g, L);
1020
- }
1021
- const w = a.fn({
1022
- ...e,
1023
- [h]: v,
1024
- [u]: g
1025
- });
1026
- return {
1027
- ...w,
1028
- data: {
1029
- x: w.x - n,
1030
- y: w.y - o,
1031
- enabled: {
1032
- [h]: l,
1033
- [u]: i
1034
- }
1035
- }
1036
- };
1037
- }
1038
- };
1039
- }, Qn = 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: l,
1048
- platform: i,
1049
- elements: a
1050
- } = e, {
1051
- apply: d = () => {
1052
- },
1053
- ...s
1054
- } = De(t, e), f = await Ve(e, s), u = ye(r), h = pe(r), v = Ce(r) === "y", {
1055
- width: g,
1056
- height: w
1057
- } = l.floating;
1058
- let m, p;
1059
- u === "top" || u === "bottom" ? (m = u, p = h === (await (i.isRTL == null ? void 0 : i.isRTL(a.floating)) ? "start" : "end") ? "left" : "right") : (p = u, m = h === "end" ? "top" : "bottom");
1060
- const y = w - f.top - f.bottom, L = g - f.left - f.right, R = Oe(w - f[m], y), D = Oe(g - f[p], L), E = !e.middlewareData.shift;
1061
- let P = R, z = D;
1062
- if ((n = e.middlewareData.shift) != null && n.enabled.x && (z = L), (o = e.middlewareData.shift) != null && o.enabled.y && (P = y), E && !h) {
1063
- const N = ae(f.left, 0), W = ae(f.right, 0), Y = ae(f.top, 0), X = ae(f.bottom, 0);
1064
- v ? z = g - 2 * (N !== 0 || W !== 0 ? N + W : ae(f.left, f.right)) : P = w - 2 * (Y !== 0 || X !== 0 ? Y + X : ae(f.top, f.bottom));
1065
- }
1066
- await d({
1067
- ...e,
1068
- availableWidth: z,
1069
- availableHeight: P
1070
- });
1071
- const k = await i.getDimensions(a.floating);
1072
- return g !== k.width || w !== k.height ? {
1073
- reset: {
1074
- rects: !0
1075
- }
1076
- } : {};
1077
- }
1078
- };
1079
- };
1080
- function it() {
1081
- return typeof window < "u";
1082
- }
1083
- function Ke(t) {
1084
- return tn(t) ? (t.nodeName || "").toLowerCase() : "#document";
1085
- }
1086
- function ce(t) {
1087
- var e;
1088
- return (t == null || (e = t.ownerDocument) == null ? void 0 : e.defaultView) || window;
1089
- }
1090
- function Ee(t) {
1091
- var e;
1092
- return (e = (tn(t) ? t.ownerDocument : t.document) || window.document) == null ? void 0 : e.documentElement;
1093
- }
1094
- function tn(t) {
1095
- return it() ? t instanceof Node || t instanceof ce(t).Node : !1;
1096
- }
1097
- function me(t) {
1098
- return it() ? t instanceof Element || t instanceof ce(t).Element : !1;
1099
- }
1100
- function xe(t) {
1101
- return it() ? t instanceof HTMLElement || t instanceof ce(t).HTMLElement : !1;
1102
- }
1103
- function kt(t) {
1104
- return !it() || typeof ShadowRoot > "u" ? !1 : t instanceof ShadowRoot || t instanceof ce(t).ShadowRoot;
1105
- }
1106
- const eo = /* @__PURE__ */ new Set(["inline", "contents"]);
1107
- function qe(t) {
1108
- const {
1109
- overflow: e,
1110
- overflowX: n,
1111
- overflowY: o,
1112
- display: r
1113
- } = ge(t);
1114
- return /auto|scroll|overlay|hidden|clip/.test(e + o + n) && !eo.has(r);
1115
- }
1116
- const to = /* @__PURE__ */ new Set(["table", "td", "th"]);
1117
- function no(t) {
1118
- return to.has(Ke(t));
1119
- }
1120
- const oo = [":popover-open", ":modal"];
1121
- function st(t) {
1122
- return oo.some((e) => {
1123
- try {
1124
- return t.matches(e);
1125
- } catch {
1126
- return !1;
1127
- }
1128
- });
1129
- }
1130
- const ro = ["transform", "translate", "scale", "rotate", "perspective"], io = ["transform", "translate", "scale", "rotate", "perspective", "filter"], so = ["paint", "layout", "strict", "content"];
1131
- function xt(t) {
1132
- const e = Et(), n = me(t) ? ge(t) : t;
1133
- return ro.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) || io.some((o) => (n.willChange || "").includes(o)) || so.some((o) => (n.contain || "").includes(o));
1134
- }
1135
- function lo(t) {
1136
- let e = Le(t);
1137
- for (; xe(e) && !$e(e); ) {
1138
- if (xt(e))
1139
- return e;
1140
- if (st(e))
1141
- return null;
1142
- e = Le(e);
1143
- }
1144
- return null;
1145
- }
1146
- function Et() {
1147
- return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
1148
- }
1149
- const ao = /* @__PURE__ */ new Set(["html", "body", "#document"]);
1150
- function $e(t) {
1151
- return ao.has(Ke(t));
1152
- }
1153
- function ge(t) {
1154
- return ce(t).getComputedStyle(t);
1155
- }
1156
- function lt(t) {
1157
- return me(t) ? {
1158
- scrollLeft: t.scrollLeft,
1159
- scrollTop: t.scrollTop
1160
- } : {
1161
- scrollLeft: t.scrollX,
1162
- scrollTop: t.scrollY
1163
- };
1164
- }
1165
- function Le(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
- Ee(t)
1174
- );
1175
- return kt(e) ? e.host : e;
1176
- }
1177
- function nn(t) {
1178
- const e = Le(t);
1179
- return $e(e) ? t.ownerDocument ? t.ownerDocument.body : t.body : xe(e) && qe(e) ? e : nn(e);
1180
- }
1181
- function Ye(t, e, n) {
1182
- var o;
1183
- e === void 0 && (e = []), n === void 0 && (n = !0);
1184
- const r = nn(t), l = r === ((o = t.ownerDocument) == null ? void 0 : o.body), i = ce(r);
1185
- if (l) {
1186
- const a = pt(i);
1187
- return e.concat(i, i.visualViewport || [], qe(r) ? r : [], a && n ? Ye(a) : []);
1188
- }
1189
- return e.concat(r, Ye(r, [], n));
1190
- }
1191
- function pt(t) {
1192
- return t.parent && Object.getPrototypeOf(t.parent) ? t.frameElement : null;
1193
- }
1194
- function on(t) {
1195
- const e = ge(t);
1196
- let n = parseFloat(e.width) || 0, o = parseFloat(e.height) || 0;
1197
- const r = xe(t), l = r ? t.offsetWidth : n, i = r ? t.offsetHeight : o, a = Qe(n) !== l || Qe(o) !== i;
1198
- return a && (n = l, o = i), {
1199
- width: n,
1200
- height: o,
1201
- $: a
1202
- };
1203
- }
1204
- function Ct(t) {
1205
- return me(t) ? t : t.contextElement;
1206
- }
1207
- function We(t) {
1208
- const e = Ct(t);
1209
- if (!xe(e))
1210
- return be(1);
1211
- const n = e.getBoundingClientRect(), {
1212
- width: o,
1213
- height: r,
1214
- $: l
1215
- } = on(e);
1216
- let i = (l ? Qe(n.width) : n.width) / o, a = (l ? Qe(n.height) : n.height) / r;
1217
- return (!i || !Number.isFinite(i)) && (i = 1), (!a || !Number.isFinite(a)) && (a = 1), {
1218
- x: i,
1219
- y: a
1220
- };
1221
- }
1222
- const uo = /* @__PURE__ */ be(0);
1223
- function rn(t) {
1224
- const e = ce(t);
1225
- return !Et() || !e.visualViewport ? uo : {
1226
- x: e.visualViewport.offsetLeft,
1227
- y: e.visualViewport.offsetTop
1228
- };
1229
- }
1230
- function co(t, e, n) {
1231
- return e === void 0 && (e = !1), !n || e && n !== ce(t) ? !1 : e;
1232
- }
1233
- function Fe(t, e, n, o) {
1234
- e === void 0 && (e = !1), n === void 0 && (n = !1);
1235
- const r = t.getBoundingClientRect(), l = Ct(t);
1236
- let i = be(1);
1237
- e && (o ? me(o) && (i = We(o)) : i = We(t));
1238
- const a = co(l, n, o) ? rn(l) : be(0);
1239
- let d = (r.left + a.x) / i.x, s = (r.top + a.y) / i.y, f = r.width / i.x, u = r.height / i.y;
1240
- if (l) {
1241
- const h = ce(l), v = o && me(o) ? ce(o) : o;
1242
- let g = h, w = pt(g);
1243
- for (; w && o && v !== g; ) {
1244
- const m = We(w), p = w.getBoundingClientRect(), y = ge(w), L = p.left + (w.clientLeft + parseFloat(y.paddingLeft)) * m.x, R = p.top + (w.clientTop + parseFloat(y.paddingTop)) * m.y;
1245
- d *= m.x, s *= m.y, f *= m.x, u *= m.y, d += L, s += R, g = ce(w), w = pt(g);
1246
- }
1247
- }
1248
- return nt({
1249
- width: f,
1250
- height: u,
1251
- x: d,
1252
- y: s
1253
- });
1254
- }
1255
- function at(t, e) {
1256
- const n = lt(t).scrollLeft;
1257
- return e ? e.left + n : Fe(Ee(t)).left + n;
1258
- }
1259
- function sn(t, e) {
1260
- const n = t.getBoundingClientRect(), o = n.left + e.scrollLeft - at(t, n), r = n.top + e.scrollTop;
1261
- return {
1262
- x: o,
1263
- y: r
1264
- };
1265
- }
1266
- function fo(t) {
1267
- let {
1268
- elements: e,
1269
- rect: n,
1270
- offsetParent: o,
1271
- strategy: r
1272
- } = t;
1273
- const l = r === "fixed", i = Ee(o), a = e ? st(e.floating) : !1;
1274
- if (o === i || a && l)
1275
- return n;
1276
- let d = {
1277
- scrollLeft: 0,
1278
- scrollTop: 0
1279
- }, s = be(1);
1280
- const f = be(0), u = xe(o);
1281
- if ((u || !u && !l) && ((Ke(o) !== "body" || qe(i)) && (d = lt(o)), xe(o))) {
1282
- const v = Fe(o);
1283
- s = We(o), f.x = v.x + o.clientLeft, f.y = v.y + o.clientTop;
1284
- }
1285
- const h = i && !u && !l ? sn(i, d) : be(0);
1286
- return {
1287
- width: n.width * s.x,
1288
- height: n.height * s.y,
1289
- x: n.x * s.x - d.scrollLeft * s.x + f.x + h.x,
1290
- y: n.y * s.y - d.scrollTop * s.y + f.y + h.y
1291
- };
1292
- }
1293
- function ho(t) {
1294
- return Array.from(t.getClientRects());
1295
- }
1296
- function vo(t) {
1297
- const e = Ee(t), n = lt(t), o = t.ownerDocument.body, r = ae(e.scrollWidth, e.clientWidth, o.scrollWidth, o.clientWidth), l = ae(e.scrollHeight, e.clientHeight, o.scrollHeight, o.clientHeight);
1298
- let i = -n.scrollLeft + at(t);
1299
- const a = -n.scrollTop;
1300
- return ge(o).direction === "rtl" && (i += ae(e.clientWidth, o.clientWidth) - r), {
1301
- width: r,
1302
- height: l,
1303
- x: i,
1304
- y: a
1305
- };
1306
- }
1307
- const Ht = 25;
1308
- function po(t, e) {
1309
- const n = ce(t), o = Ee(t), r = n.visualViewport;
1310
- let l = o.clientWidth, i = o.clientHeight, a = 0, d = 0;
1311
- if (r) {
1312
- l = r.width, i = r.height;
1313
- const f = Et();
1314
- (!f || f && e === "fixed") && (a = r.offsetLeft, d = r.offsetTop);
1315
- }
1316
- const s = at(o);
1317
- if (s <= 0) {
1318
- const f = o.ownerDocument, u = f.body, h = getComputedStyle(u), v = f.compatMode === "CSS1Compat" && parseFloat(h.marginLeft) + parseFloat(h.marginRight) || 0, g = Math.abs(o.clientWidth - u.clientWidth - v);
1319
- g <= Ht && (l -= g);
1320
- } else s <= Ht && (l += s);
1321
- return {
1322
- width: l,
1323
- height: i,
1324
- x: a,
1325
- y: d
1326
- };
1327
- }
1328
- const mo = /* @__PURE__ */ new Set(["absolute", "fixed"]);
1329
- function go(t, e) {
1330
- const n = Fe(t, !0, e === "fixed"), o = n.top + t.clientTop, r = n.left + t.clientLeft, l = xe(t) ? We(t) : be(1), i = t.clientWidth * l.x, a = t.clientHeight * l.y, d = r * l.x, s = o * l.y;
1331
- return {
1332
- width: i,
1333
- height: a,
1334
- x: d,
1335
- y: s
1336
- };
1337
- }
1338
- function Bt(t, e, n) {
1339
- let o;
1340
- if (e === "viewport")
1341
- o = po(t, n);
1342
- else if (e === "document")
1343
- o = vo(Ee(t));
1344
- else if (me(e))
1345
- o = go(e, n);
1346
- else {
1347
- const r = rn(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 nt(o);
1356
- }
1357
- function ln(t, e) {
1358
- const n = Le(t);
1359
- return n === e || !me(n) || $e(n) ? !1 : ge(n).position === "fixed" || ln(n, e);
1360
- }
1361
- function wo(t, e) {
1362
- const n = e.get(t);
1363
- if (n)
1364
- return n;
1365
- let o = Ye(t, [], !1).filter((a) => me(a) && Ke(a) !== "body"), r = null;
1366
- const l = ge(t).position === "fixed";
1367
- let i = l ? Le(t) : t;
1368
- for (; me(i) && !$e(i); ) {
1369
- const a = ge(i), d = xt(i);
1370
- !d && a.position === "fixed" && (r = null), (l ? !d && !r : !d && a.position === "static" && !!r && mo.has(r.position) || qe(i) && !d && ln(t, i)) ? o = o.filter((f) => f !== i) : r = a, i = Le(i);
1371
- }
1372
- return e.set(t, o), o;
1373
- }
1374
- function bo(t) {
1375
- let {
1376
- element: e,
1377
- boundary: n,
1378
- rootBoundary: o,
1379
- strategy: r
1380
- } = t;
1381
- const i = [...n === "clippingAncestors" ? st(e) ? [] : wo(e, this._c) : [].concat(n), o], a = i[0], d = i.reduce((s, f) => {
1382
- const u = Bt(e, f, r);
1383
- return s.top = ae(u.top, s.top), s.right = Oe(u.right, s.right), s.bottom = Oe(u.bottom, s.bottom), s.left = ae(u.left, s.left), s;
1384
- }, Bt(e, a, r));
1385
- return {
1386
- width: d.right - d.left,
1387
- height: d.bottom - d.top,
1388
- x: d.left,
1389
- y: d.top
1390
- };
1391
- }
1392
- function yo(t) {
1393
- const {
1394
- width: e,
1395
- height: n
1396
- } = on(t);
1397
- return {
1398
- width: e,
1399
- height: n
1400
- };
1401
- }
1402
- function xo(t, e, n) {
1403
- const o = xe(e), r = Ee(e), l = n === "fixed", i = Fe(t, !0, l, e);
1404
- let a = {
1405
- scrollLeft: 0,
1406
- scrollTop: 0
1407
- };
1408
- const d = be(0);
1409
- function s() {
1410
- d.x = at(r);
1411
- }
1412
- if (o || !o && !l)
1413
- if ((Ke(e) !== "body" || qe(r)) && (a = lt(e)), o) {
1414
- const v = Fe(e, !0, l, e);
1415
- d.x = v.x + e.clientLeft, d.y = v.y + e.clientTop;
1416
- } else r && s();
1417
- l && !o && r && s();
1418
- const f = r && !o && !l ? sn(r, a) : be(0), u = i.left + a.scrollLeft - d.x - f.x, h = i.top + a.scrollTop - d.y - f.y;
1419
- return {
1420
- x: u,
1421
- y: h,
1422
- width: i.width,
1423
- height: i.height
1424
- };
1425
- }
1426
- function ct(t) {
1427
- return ge(t).position === "static";
1428
- }
1429
- function Wt(t, e) {
1430
- if (!xe(t) || ge(t).position === "fixed")
1431
- return null;
1432
- if (e)
1433
- return e(t);
1434
- let n = t.offsetParent;
1435
- return Ee(t) === n && (n = n.ownerDocument.body), n;
1436
- }
1437
- function an(t, e) {
1438
- const n = ce(t);
1439
- if (st(t))
1440
- return n;
1441
- if (!xe(t)) {
1442
- let r = Le(t);
1443
- for (; r && !$e(r); ) {
1444
- if (me(r) && !ct(r))
1445
- return r;
1446
- r = Le(r);
1447
- }
1448
- return n;
1449
- }
1450
- let o = Wt(t, e);
1451
- for (; o && no(o) && ct(o); )
1452
- o = Wt(o, e);
1453
- return o && $e(o) && ct(o) && !xt(o) ? n : o || lo(t) || n;
1454
- }
1455
- const Eo = async function(t) {
1456
- const e = this.getOffsetParent || an, n = this.getDimensions, o = await n(t.floating);
1457
- return {
1458
- reference: xo(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 Co(t) {
1468
- return ge(t).direction === "rtl";
1469
- }
1470
- const To = {
1471
- convertOffsetParentRelativeRectToViewportRelativeRect: fo,
1472
- getDocumentElement: Ee,
1473
- getClippingRect: bo,
1474
- getOffsetParent: an,
1475
- getElementRects: Eo,
1476
- getClientRects: ho,
1477
- getDimensions: yo,
1478
- getScale: We,
1479
- isElement: me,
1480
- isRTL: Co
1481
- };
1482
- function un(t, e) {
1483
- return t.x === e.x && t.y === e.y && t.width === e.width && t.height === e.height;
1484
- }
1485
- function Ao(t, e) {
1486
- let n = null, o;
1487
- const r = Ee(t);
1488
- function l() {
1489
- var a;
1490
- clearTimeout(o), (a = n) == null || a.disconnect(), n = null;
1491
- }
1492
- function i(a, d) {
1493
- a === void 0 && (a = !1), d === void 0 && (d = 1), l();
1494
- const s = t.getBoundingClientRect(), {
1495
- left: f,
1496
- top: u,
1497
- width: h,
1498
- height: v
1499
- } = s;
1500
- if (a || e(), !h || !v)
1501
- return;
1502
- const g = Ze(u), w = Ze(r.clientWidth - (f + h)), m = Ze(r.clientHeight - (u + v)), p = Ze(f), L = {
1503
- rootMargin: -g + "px " + -w + "px " + -m + "px " + -p + "px",
1504
- threshold: ae(0, Oe(1, d)) || 1
1505
- };
1506
- let R = !0;
1507
- function D(E) {
1508
- const P = E[0].intersectionRatio;
1509
- if (P !== d) {
1510
- if (!R)
1511
- return i();
1512
- P ? i(!1, P) : o = setTimeout(() => {
1513
- i(!1, 1e-7);
1514
- }, 1e3);
1515
- }
1516
- P === 1 && !un(s, t.getBoundingClientRect()) && i(), R = !1;
1517
- }
1518
- try {
1519
- n = new IntersectionObserver(D, {
1520
- ...L,
1521
- // Handle <iframe>s
1522
- root: r.ownerDocument
1523
- });
1524
- } catch {
1525
- n = new IntersectionObserver(D, L);
1526
- }
1527
- n.observe(t);
1528
- }
1529
- return i(!0), l;
1530
- }
1531
- function So(t, e, n, o) {
1532
- o === void 0 && (o = {});
1533
- const {
1534
- ancestorScroll: r = !0,
1535
- ancestorResize: l = !0,
1536
- elementResize: i = typeof ResizeObserver == "function",
1537
- layoutShift: a = typeof IntersectionObserver == "function",
1538
- animationFrame: d = !1
1539
- } = o, s = Ct(t), f = r || l ? [...s ? Ye(s) : [], ...Ye(e)] : [];
1540
- f.forEach((p) => {
1541
- r && p.addEventListener("scroll", n, {
1542
- passive: !0
1543
- }), l && p.addEventListener("resize", n);
1544
- });
1545
- const u = s && a ? Ao(s, n) : null;
1546
- let h = -1, v = null;
1547
- i && (v = new ResizeObserver((p) => {
1548
- let [y] = p;
1549
- y && y.target === s && v && (v.unobserve(e), cancelAnimationFrame(h), h = requestAnimationFrame(() => {
1550
- var L;
1551
- (L = v) == null || L.observe(e);
1552
- })), n();
1553
- }), s && !d && v.observe(s), v.observe(e));
1554
- let g, w = d ? Fe(t) : null;
1555
- d && m();
1556
- function m() {
1557
- const p = Fe(t);
1558
- w && !un(w, p) && n(), w = p, g = requestAnimationFrame(m);
1559
- }
1560
- return n(), () => {
1561
- var p;
1562
- f.forEach((y) => {
1563
- r && y.removeEventListener("scroll", n), l && y.removeEventListener("resize", n);
1564
- }), u == null || u(), (p = v) == null || p.disconnect(), v = null, d && cancelAnimationFrame(g);
1565
- };
1566
- }
1567
- const br = Zn, yr = Un, xr = Jn, Er = _n, Cr = Qn, Tr = jn, Oo = Xn, Lo = (t, e, n) => {
1568
- const o = /* @__PURE__ */ new Map(), r = {
1569
- platform: To,
1570
- ...n
1571
- }, l = {
1572
- ...r.platform,
1573
- _c: o
1574
- };
1575
- return zn(t, e, {
1576
- ...r,
1577
- platform: l
1578
- });
1579
- };
1580
- function Do(t) {
1581
- return {
1582
- name: "arrow",
1583
- options: t,
1584
- fn(e) {
1585
- const n = T(t.element);
1586
- return n == null ? {} : Oo({ element: n, padding: t.padding }).fn(e);
1587
- }
1588
- };
1589
- }
1590
- function Po(t, e, n = {}) {
1591
- const {
1592
- transform: o = !0,
1593
- middlewares: r,
1594
- autoUpdate: l = !0,
1595
- open: i = ie(!1),
1596
- onOpenChange: a
1597
- } = n, d = (E, P, z) => {
1598
- if (i.value === E) return;
1599
- i.value = E;
1600
- const k = P ?? "programmatic";
1601
- a == null || a(E, k, z);
1602
- }, s = F(() => T(n.placement) ?? "bottom"), f = F(() => T(n.strategy) ?? "absolute"), u = ie(0), h = ie(0), v = ie(s.value), g = ie(f.value), w = dt({}), m = ie(!1), p = ie(null), y = F(() => {
1603
- const E = T(r) || [];
1604
- return p.value && !E.some((z) => z.name === "arrow") ? [...E, Do({ element: p })] : E;
1605
- }), L = async () => {
1606
- if (!(!t.value || !e.value))
1607
- try {
1608
- const E = await Lo(t.value, e.value, {
1609
- placement: s.value,
1610
- strategy: f.value,
1611
- middleware: y.value
1612
- });
1613
- u.value = E.x, h.value = E.y, v.value = E.placement, g.value = E.strategy, w.value = E.middlewareData, m.value = i.value;
1614
- } catch {
1615
- }
1616
- };
1617
- de([s, f, y], () => {
1618
- i.value && L();
1619
- });
1620
- let R;
1621
- de(
1622
- [t, e, i],
1623
- ([E, P, z]) => {
1624
- !z || !E || !P || (l && (R = So(
1625
- E,
1626
- P,
1627
- L,
1628
- typeof l == "object" ? l : void 0
1629
- )), Te(() => {
1630
- R == null || R(), R = void 0;
1631
- }));
1632
- },
1633
- { immediate: !0 }
1634
- ), Ie(() => R == null ? void 0 : R()), de(i, (E) => {
1635
- E || (m.value = !1);
1636
- });
1637
- const D = ie({
1638
- position: f.value,
1639
- left: "0",
1640
- top: "0"
1641
- });
1642
- return de(
1643
- [u, h, () => T(o)],
1644
- ([E, P, z]) => {
1645
- const k = e.value;
1646
- if (!k) return;
1647
- const N = {
1648
- position: g.value,
1649
- left: "0",
1650
- top: "0"
1651
- }, W = Vt(k, E), Y = Vt(k, P);
1652
- z ? D.value = {
1653
- ...N,
1654
- transform: `translate(${W}px, ${Y}px)`,
1655
- ...cn(k) >= 1.5 && {
1656
- "will-change": "transform"
1657
- }
1658
- } : D.value = {
1659
- ...N,
1660
- left: `${W}px`,
1661
- top: `${Y}px`
1662
- };
1663
- },
1664
- { immediate: !0 }
1665
- ), {
1666
- id: n.id,
1667
- x: u,
1668
- y: h,
1669
- strategy: g,
1670
- placement: v,
1671
- middlewareData: w,
1672
- isPositioned: m,
1673
- floatingStyles: D,
1674
- update: L,
1675
- refs: {
1676
- anchorEl: t,
1677
- floatingEl: e,
1678
- arrowEl: p
1679
- },
1680
- open: i,
1681
- setOpen: d
1682
- };
1683
- }
1684
- function Vt(t, e) {
1685
- const n = cn(t);
1686
- return Math.round(e * n) / n;
1687
- }
1688
- function cn(t) {
1689
- return typeof window > "u" ? 1 : (t.ownerDocument.defaultView || window).devicePixelRatio || 1;
1690
- }
1691
- function Ar(t = {}) {
1692
- let e;
1693
- return e = Ro(t), {
1694
- ...e,
1695
- get root() {
1696
- return e.root;
1697
- },
1698
- addNode: (i, a, d = {}) => {
1699
- const { parentId: s, ...f } = d, u = jt(), h = f.onOpenChange, v = Po(i, a, {
1700
- ...f,
1701
- id: u,
1702
- onOpenChange: (w, m, p) => {
1703
- if (h == null || h(w, m, p), !w) {
1704
- const y = e.findNodeById(u);
1705
- if (y) {
1706
- const L = y.children.value;
1707
- for (const R of L)
1708
- R.data.open.value && R.data.setOpen(!1, "tree-ancestor-close", p);
1709
- }
1710
- }
1711
- }
1712
- });
1713
- return e.addNode(v, s, { id: u });
1714
- },
1715
- getAllOpenNodes: () => {
1716
- const i = [];
1717
- for (const a of e.nodeMap.values())
1718
- a.data.open.value && i.push(a);
1719
- return i;
1720
- },
1721
- getDeepestOpenNode: () => {
1722
- let i = null, a = -1;
1723
- for (const d of e.nodeMap.values())
1724
- if (d.data.open.value) {
1725
- const s = d.getPath().length;
1726
- s > a && (a = s, i = d);
1727
- }
1728
- return i;
1729
- },
1730
- applyToNodes: (i, a, d = {}) => {
1731
- const { relationship: s = "self-and-children", applyToMatching: f = !0 } = d, u = e.findNodeById(i);
1732
- if (!u)
1733
- return;
1734
- const h = [], v = /* @__PURE__ */ new Set(), g = (m) => {
1735
- m && !v.has(m.id) && (h.push(m), v.add(m.id));
1736
- }, w = (m) => {
1737
- for (const p of m)
1738
- g(p);
1739
- };
1740
- if (s === "ancestors-only")
1741
- for (const m of u.getPath())
1742
- m.id !== u.id && g(m);
1743
- else if (s === "siblings-only") {
1744
- if (u.parent.value)
1745
- for (const m of u.parent.value.children.value)
1746
- m.id !== u.id && g(m);
1747
- } else if (s === "descendants-only")
1748
- for (const m of e.traverse("dfs", u))
1749
- m.id !== u.id && g(m);
1750
- else if (s === "children-only")
1751
- w(u.children.value);
1752
- else if (s === "self-and-ancestors")
1753
- w(u.getPath());
1754
- else if (s === "self-and-children")
1755
- g(u), w(u.children.value);
1756
- else if (s === "self-and-descendants")
1757
- w(e.traverse("dfs", u));
1758
- else if (s === "self-and-siblings")
1759
- g(u), u.parent.value && w(u.parent.value.children.value);
1760
- else if (s === "self-ancestors-and-children")
1761
- w(u.getPath()), w(u.children.value);
1762
- else if (s === "full-branch")
1763
- w(u.getPath()), w(e.traverse("dfs", u));
1764
- else if (s === "all-except-branch") {
1765
- const m = /* @__PURE__ */ new Set();
1766
- for (const p of u.getPath())
1767
- m.add(p.id);
1768
- for (const p of e.traverse("dfs", u))
1769
- m.add(p.id);
1770
- for (const p of e.nodeMap.values())
1771
- !m.has(p.id) === f && a(p);
1772
- return;
1773
- } else {
1774
- console.warn(`applyToNodes: Unknown relationship "${s}".`);
1775
- return;
1776
- }
1777
- if (f)
1778
- for (const m of h)
1779
- a(m);
1780
- else
1781
- for (const m of e.nodeMap.values())
1782
- v.has(m.id) || a(m);
1783
- }
1784
- };
1785
- }
1786
- function $t(t, e = null, n = {}, o = !1) {
1787
- const r = n.id ?? jt(), l = dt(e), i = dt([]), a = F(() => i.value.length === 0), d = {
1788
- id: r,
1789
- data: t,
1790
- parent: l,
1791
- children: i,
1792
- isRoot: o,
1793
- isLeaf: a,
1794
- addChild: (s) => {
1795
- i.value = [...i.value, s];
1796
- },
1797
- _removeChildInstance: (s) => i.value.includes(s) ? (i.value = i.value.filter((f) => f.id !== s.id), s.parent.value = null, !0) : !1,
1798
- findChild: (s) => i.value.find(s) ?? null,
1799
- findDescendant: (s) => {
1800
- const f = [d];
1801
- for (; f.length > 0; ) {
1802
- const u = f.pop();
1803
- if (s(u))
1804
- return u;
1805
- for (let h = u.children.value.length - 1; h >= 0; h--)
1806
- f.push(u.children.value[h]);
1807
- }
1808
- return null;
1809
- },
1810
- isDescendantOf: (s) => {
1811
- let f = l.value;
1812
- for (; f; ) {
1813
- if (f.id === s.id)
1814
- return !0;
1815
- f = f.parent.value;
1816
- }
1817
- return !1;
1818
- },
1819
- getPath: () => {
1820
- const s = [];
1821
- let f = d;
1822
- for (; f; )
1823
- s.push(f), f = f.parent.value;
1824
- return s.reverse();
1825
- }
1826
- };
1827
- return Object.freeze(d);
1828
- }
1829
- function Ro(t) {
1830
- const e = (t == null ? void 0 : t.deleteStrategy) ?? "recursive", n = En(/* @__PURE__ */ new Map());
1831
- let o = null;
1832
- const r = (u) => n.get(u) ?? null, l = (u, h = null, v = {}) => {
1833
- if (!o) {
1834
- if (h != null)
1835
- return console.error(
1836
- `Tree addNode: Cannot add a non-root node before a root exists. Received parentId=${h}.`
1837
- ), null;
1838
- const m = $t(u, null, v, !0);
1839
- return n.set(m.id, m), o = m, m;
1840
- }
1841
- const g = h ? r(h) : o;
1842
- if (!g)
1843
- return console.error(`Tree addNode: Parent node with ID ${h} not found.`), null;
1844
- v.id && n.has(v.id) && (v.id = void 0);
1845
- const w = $t(u, g, v);
1846
- return n.set(w.id, w), g.addChild(w), w;
1847
- }, i = (u, h) => {
1848
- const v = h ?? e, g = r(u);
1849
- if (!g)
1850
- return !1;
1851
- if (g.isRoot)
1852
- return console.error("Tree removeNode: Cannot remove the root node."), !1;
1853
- const w = g.parent.value;
1854
- if (v === "recursive")
1855
- f(g);
1856
- else {
1857
- for (const m of g.children.value)
1858
- m.parent.value = null;
1859
- g.children.value = [], n.delete(g.id);
1860
- }
1861
- return w._removeChildInstance(g);
1862
- }, a = (u, h) => {
1863
- const v = r(u);
1864
- if (!v)
1865
- return console.error(`Tree moveNode: Node with ID ${u} not found.`), !1;
1866
- if (v.isRoot)
1867
- return console.error("Tree moveNode: Cannot move the root node."), !1;
1868
- if (u === h)
1869
- return console.error("Tree moveNode: Cannot move a node to be a child of itself."), !1;
1870
- const g = h ? r(h) : o;
1871
- if (!g)
1872
- return console.error(`Tree moveNode: New parent node with ID ${h} not found.`), !1;
1873
- if (g.isDescendantOf(v))
1874
- return console.error("Tree moveNode: Cannot move a node to become its own descendant."), !1;
1875
- const w = v.parent.value;
1876
- if (w) {
1877
- if (!w._removeChildInstance(v))
1878
- return console.error("Tree moveNode: Failed to remove node from its original parent."), !1;
1879
- } else if (v.isRoot) {
1880
- if (v.isRoot)
1881
- return console.error("Tree moveNode: Attempting to move the root node, which is not allowed."), !1;
1882
- }
1883
- return g.addChild(v), v.parent.value = g, !0;
1884
- }, d = (u = "dfs", h = o) => {
1885
- const v = [];
1886
- if (!h)
1887
- return console.warn("Tree traverse: Start node is null, returning empty array."), v;
1888
- if (u === "dfs") {
1889
- const g = [h];
1890
- for (; g.length > 0; ) {
1891
- const w = g.pop();
1892
- v.push(w);
1893
- for (let m = w.children.value.length - 1; m >= 0; m--)
1894
- g.push(w.children.value[m]);
1895
- }
1896
- } else {
1897
- const g = [h];
1898
- for (; g.length > 0; ) {
1899
- const w = g.shift();
1900
- v.push(w);
1901
- for (const m of w.children.value)
1902
- g.push(m);
1903
- }
1904
- }
1905
- return v;
1906
- }, s = () => {
1907
- n.clear();
1908
- }, f = (u) => {
1909
- const h = [...u.children.value];
1910
- for (const v of h)
1911
- f(v);
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: l,
1923
- removeNode: i,
1924
- moveNode: a,
1925
- traverse: d,
1926
- dispose: s
1927
- });
1928
- }
1929
- function Mo(t) {
1930
- return Cn() ? (Ie(t), !0) : !1;
1931
- }
1932
- const No = typeof window < "u" && typeof document < "u";
1933
- typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
1934
- const Io = Object.prototype.toString, Fo = (t) => Io.call(t) === "[object Object]";
1935
- function ft(t) {
1936
- return Array.isArray(t) ? t : [t];
1937
- }
1938
- function ko(t, e, n) {
1939
- return de(
1940
- t,
1941
- e,
1942
- {
1943
- ...n,
1944
- immediate: !0
1945
- }
1946
- );
1947
- }
1948
- const Ho = No ? window : void 0;
1949
- function Bo(t) {
1950
- var e;
1951
- const n = T(t);
1952
- return (e = n == null ? void 0 : n.$el) != null ? e : n;
1953
- }
1954
- function ne(...t) {
1955
- const e = [], n = () => {
1956
- e.forEach((a) => a()), e.length = 0;
1957
- }, o = (a, d, s, f) => (a.addEventListener(d, s, f), () => a.removeEventListener(d, s, f)), r = F(() => {
1958
- const a = ft(T(t[0])).filter((d) => d != null);
1959
- return a.every((d) => typeof d != "string") ? a : void 0;
1960
- }), l = ko(
1961
- () => {
1962
- var a, d;
1963
- return [
1964
- (d = (a = r.value) == null ? void 0 : a.map((s) => Bo(s))) != null ? d : [Ho].filter((s) => s != null),
1965
- ft(T(r.value ? t[1] : t[0])),
1966
- ft(Tn(r.value ? t[2] : t[1])),
1967
- // @ts-expect-error - TypeScript gets the correct types, but somehow still complains
1968
- T(r.value ? t[3] : t[2])
1969
- ];
1970
- },
1971
- ([a, d, s, f]) => {
1972
- if (n(), !(a != null && a.length) || !(d != null && d.length) || !(s != null && s.length))
1973
- return;
1974
- const u = Fo(f) ? { ...f } : f;
1975
- e.push(
1976
- ...a.flatMap(
1977
- (h) => d.flatMap(
1978
- (v) => s.map((g) => o(h, v, g, u))
1979
- )
1980
- )
1981
- );
1982
- },
1983
- { flush: "post" }
1984
- ), i = () => {
1985
- l(), n();
1986
- };
1987
- return Mo(n), i;
1988
- }
1989
- function Sr(t, e = {}) {
1990
- const { floatingContext: n, treeContext: o } = je(t), { open: r, setOpen: l, refs: i } = n, {
1991
- enabled: a = !0,
1992
- event: d = "click",
1993
- toggle: s = !0,
1994
- ignoreMouse: f = !1,
1995
- ignoreKeyboard: u = !1,
1996
- ignoreTouch: h = !1,
1997
- // Outside click options
1998
- outsideClick: v = !1,
1999
- outsideEvent: g = "pointerdown",
2000
- outsideCapture: w = !0,
2001
- onOutsideClick: m,
2002
- preventScrollbarClick: p = !0,
2003
- handleDragEvents: y = !0
2004
- } = e;
2005
- let L, R = !1, D = !1, E = !1;
2006
- const P = F(() => T(a)), z = F(() => T(v)), k = F(() => {
2007
- const S = i.anchorEl.value;
2008
- return S instanceof HTMLElement ? S : null;
2009
- }), N = F(() => i.floatingEl.value);
2010
- function W(S, j) {
2011
- E = !0;
2012
- try {
2013
- r.value ? T(s) && l(!1, S, j) : l(!0, S, j);
2014
- } finally {
2015
- Promise.resolve().then(() => {
2016
- E = !1;
2017
- });
2018
- }
2019
- }
2020
- function Y() {
2021
- L = void 0, R = !1, D = !1;
2022
- }
2023
- function X(S) {
2024
- L = S.pointerType;
2025
- }
2026
- function $(S) {
2027
- S.button === 0 && T(d) !== "click" && (J(L) || W("anchor-click", S));
2028
- }
2029
- function C(S) {
2030
- if (T(u) && S.detail === 0) {
2031
- Y();
2032
- return;
2033
- }
2034
- if (T(d) === "mousedown" && L) {
2035
- Y();
2036
- return;
2037
- }
2038
- if (J(L)) {
2039
- Y();
2040
- return;
2041
- }
2042
- W("anchor-click", S), Y();
2043
- }
2044
- function c(S) {
2045
- if (L = void 0, S.defaultPrevented || T(u) || Tt(S))
2046
- return;
2047
- const j = k.value;
2048
- j && (S.key === " " && !At(j) && (S.preventDefault(), R = !0), S.key === "Enter" && W("keyboard-activate", S));
2049
- }
2050
- function V(S) {
2051
- const j = k.value;
2052
- j && (S.defaultPrevented || T(u) || Tt(S) || At(j) || S.key === " " && R && (R = !1, W("keyboard-activate", S)));
2053
- }
2054
- function b(S) {
2055
- if (!P.value || !z.value || !r.value)
2056
- return;
2057
- if (T(g) === "click" && T(y) && D) {
2058
- D = !1;
2059
- return;
2060
- }
2061
- if (E)
2062
- return;
2063
- const j = S.target;
2064
- if (j && !(T(p) && Xe(j) && N.value && Dn(S, j))) {
2065
- if (o) {
2066
- if (!Wo(o, j))
2067
- return;
2068
- } else if (St(S, k.value) || St(S, N.value))
2069
- return;
2070
- m ? m(S, n) : l(!1, "outside-pointer", S);
2071
- }
2072
- }
2073
- function U() {
2074
- D = !0;
2075
- }
2076
- function te() {
2077
- setTimeout(() => {
2078
- D = !1;
2079
- }, 0);
2080
- }
2081
- function J(S) {
2082
- return !!(qt(S, !0) && T(f) || S === "touch" && T(h));
2083
- }
2084
- Me(() => {
2085
- const S = k.value;
2086
- !P.value || !S || (S.addEventListener("pointerdown", X), S.addEventListener("mousedown", $), S.addEventListener("click", C), S.addEventListener("keydown", c), S.addEventListener("keyup", V), Te(() => {
2087
- S.removeEventListener("pointerdown", X), S.removeEventListener("mousedown", $), S.removeEventListener("click", C), S.removeEventListener("keydown", c), S.removeEventListener("keyup", V), Y();
2088
- }));
2089
- }), ne(
2090
- () => P.value && z.value ? document : null,
2091
- () => T(g),
2092
- b,
2093
- { capture: T(w) }
2094
- ), ne(
2095
- () => P.value && z.value && T(y) ? N.value : null,
2096
- "mousedown",
2097
- U,
2098
- { capture: !0 }
2099
- ), ne(
2100
- () => P.value && z.value && T(y) ? N.value : null,
2101
- "mouseup",
2102
- te,
2103
- { capture: !0 }
2104
- );
2105
- }
2106
- function Wo(t, e) {
2107
- return !(ue(e, t.data.refs.anchorEl.value) || ue(e, t.data.refs.floatingEl.value) || rt(t, e));
2108
- }
2109
- function Or(t, e = {}) {
2110
- const { floatingContext: n, treeContext: o } = je(t), { enabled: r = !0, capture: l = !1, onEscape: i } = e, { isComposing: a } = $o();
2111
- ne(document, "keydown", (s) => {
2112
- if (!(s.key !== "Escape" || !T(r) || a())) {
2113
- if (i) {
2114
- i(s);
2115
- return;
2116
- }
2117
- if (o) {
2118
- const f = Vo(o);
2119
- f && f.data.setOpen(!1, "escape-key", s);
2120
- } else
2121
- n.setOpen(!1, "escape-key", s);
2122
- }
2123
- }, l);
2124
- }
2125
- function Vo(t) {
2126
- var l;
2127
- let e = t;
2128
- for (; (l = e.parent) != null && l.value && !e.isRoot; )
2129
- e = e.parent.value;
2130
- let n = null, o = -1;
2131
- const r = (i) => {
2132
- var d;
2133
- if (i.data.open.value) {
2134
- const s = i.getPath().length;
2135
- s > o && (o = s, n = i);
2136
- }
2137
- const a = ((d = i.children) == null ? void 0 : d.value) ?? [];
2138
- for (const s of a)
2139
- r(s);
2140
- };
2141
- return r(e), n;
2142
- }
2143
- function $o() {
2144
- const t = ie(!1);
2145
- return ne(document, "compositionstart", () => {
2146
- t.value = !0;
2147
- }), ne(document, "compositionend", () => {
2148
- t.value = !1;
2149
- }), {
2150
- isComposing: () => t.value
2151
- };
2152
- }
2153
- const Je = ie(!1);
2154
- typeof window < "u" && (ne(
2155
- window,
2156
- "keydown",
2157
- () => {
2158
- Je.value = !0;
2159
- },
2160
- { capture: !0 }
2161
- ), ne(
2162
- window,
2163
- "pointerdown",
2164
- () => {
2165
- Je.value = !1;
2166
- },
2167
- { capture: !0 }
2168
- ), ne(
2169
- window,
2170
- "pointermove",
2171
- () => {
2172
- Je.value = !1;
2173
- },
2174
- { capture: !0 }
2175
- ));
2176
- const fn = _t(Je), Ko = 0;
2177
- function Lr(t, e = {}) {
2178
- const {
2179
- open: n,
2180
- setOpen: o,
2181
- refs: { floatingEl: r, anchorEl: l }
2182
- } = t, { enabled: i = !0, requireFocusVisible: a = !0, tree: d } = e, s = F(() => l.value ? l.value instanceof HTMLElement ? l.value : l.value.contextElement : null);
2183
- let f = !1;
2184
- const u = Sn() && On();
2185
- let h, v = new zo(r);
2186
- if (d) {
2187
- let p = null;
2188
- if (t.id && (p = d.findNodeById(t.id)), !p) {
2189
- for (const y of d.nodeMap.values())
2190
- if (y.data === t) {
2191
- p = y;
2192
- break;
2193
- }
2194
- }
2195
- p && (v = new Xo(p));
2196
- }
2197
- ne(window, "blur", () => {
2198
- !n.value && s.value && s.value === document.activeElement && (f = !0);
2199
- }), ne(window, "focus", () => {
2200
- f = !1;
2201
- });
2202
- function g(p) {
2203
- if (f) {
2204
- f = !1;
2205
- return;
2206
- }
2207
- const y = p.target instanceof Element ? p.target : null;
2208
- if (T(a) && y) {
2209
- if (u && !p.relatedTarget) {
2210
- if (!fn.value && !wt(y))
2211
- return;
2212
- } else if (!Ln(y))
2213
- return;
2214
- }
2215
- try {
2216
- o(!0, "focus", p);
2217
- } catch (L) {
2218
- console.error("[useFocus] Error in onFocus handler:", L);
2219
- }
2220
- }
2221
- function w(p) {
2222
- clearTimeout(h), h = window.setTimeout(() => {
2223
- var R;
2224
- const L = (((R = s.value) == null ? void 0 : R.ownerDocument) ?? document).activeElement;
2225
- if (!(!p.relatedTarget && L === s.value) && !v.shouldRemainOpen(L))
2226
- try {
2227
- if (L instanceof Element) {
2228
- const D = v.getAncestorsToClose(L);
2229
- for (const E of D)
2230
- try {
2231
- E.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 (D) {
2238
- console.error("[useFocus] Error in onBlur handler:", D);
2239
- }
2240
- }, Ko);
2241
- }
2242
- ne(
2243
- document,
2244
- "focusin",
2245
- (p) => {
2246
- if (!T(i)) return;
2247
- const y = p.target;
2248
- if (!(y instanceof Element)) return;
2249
- const L = s.value;
2250
- if (!(L && ue(y, L)) && !v.shouldRemainOpen(y))
2251
- try {
2252
- const R = v.getAncestorsToClose(y);
2253
- for (const D of R)
2254
- try {
2255
- D.data.setOpen(!1, "tree-ancestor-close", p);
2256
- } catch (E) {
2257
- console.error("[useFocus] Error closing ancestor on focusin:", E);
2258
- }
2259
- o(!1, "blur", p);
2260
- } catch (R) {
2261
- console.error("[useFocus] Error in document focusin handler:", R);
2262
- }
2263
- },
2264
- { capture: !0 }
2265
- );
2266
- const m = Me(() => {
2267
- if (!T(i)) return;
2268
- const p = s.value;
2269
- !p || !(p instanceof HTMLElement) || (p.addEventListener("focus", g), p.addEventListener("blur", w), Te(() => {
2270
- p.removeEventListener("focus", g), p.removeEventListener("blur", w);
2271
- }));
2272
- });
2273
- return Ie(() => {
2274
- clearTimeout(h);
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(h), m();
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 Xo {
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 ue(n, e.data.refs.anchorEl.value) || ue(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 (ue(n, o.data.refs.anchorEl.value) || ue(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 dn(t) {
2335
- return t.children.value.some(
2336
- (e) => e.data.open.value || dn(e)
2337
- );
2338
- }
2339
- function Yo(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 Kt(t, e) {
2343
- const [n, o] = t;
2344
- let r = !1;
2345
- const l = e.length;
2346
- for (let i = 0, a = l - 1; i < l; a = i++) {
2347
- const [d, s] = e[i] || [0, 0], [f, u] = e[a] || [0, 0];
2348
- s >= o != u >= o && n <= (f - d) * (o - s) / (u - s) + d && (r = !r);
2349
- }
2350
- return r;
2351
- }
2352
- function Uo(t = {}) {
2353
- const { blockPointerEvents: e = !1, requireIntent: n = !0 } = t;
2354
- let o = -1, r = !1;
2355
- function l(a, d, s, f, u) {
2356
- const h = Ot(), v = h - u;
2357
- if (s === null || f === null || v === 0)
2358
- return {
2359
- speed: null,
2360
- lastX: a,
2361
- lastY: d,
2362
- lastCursorTime: h
2363
- };
2364
- const g = a - s, w = d - f;
2365
- return {
2366
- speed: Math.sqrt(g * g + w * w) / v,
2367
- lastX: a,
2368
- lastY: d,
2369
- lastCursorTime: h
2370
- };
2371
- }
2372
- const i = function(d) {
2373
- const { x: s, y: f, placement: u, elements: h, buffer: v, onClose: g, nodeId: w, tree: m } = d, p = F(() => {
2374
- const D = h.domReference;
2375
- return Xe(D) ? D : (D == null ? void 0 : D.contextElement) ?? null;
2376
- });
2377
- let y = null, L = null, R = Ot();
2378
- return function(E) {
2379
- var we, ke, Ae, Se, He, O, M;
2380
- function P() {
2381
- Lt(o), o = -1, g();
2382
- }
2383
- if (Lt(o), o = -1, !h.domReference || !h.floating || u == null || s == null || f == null)
2384
- return;
2385
- const { clientX: z, clientY: k } = E, N = [z, k], W = Pn(E), Y = E.type === "mouseleave", X = h.floating && ut(h.floating, W), $ = p.value && ut(p.value, W), C = (we = p.value) == null ? void 0 : we.getBoundingClientRect(), c = (ke = h.floating) == null ? void 0 : ke.getBoundingClientRect(), V = u.split("-")[0], b = s > ((c == null ? void 0 : c.right) ?? 0) - ((c == null ? void 0 : c.width) ?? 0) / 2, U = f > ((c == null ? void 0 : c.bottom) ?? 0) - ((c == null ? void 0 : c.height) ?? 0) / 2, te = C ? Yo(N, C) : !1, J = ((c == null ? void 0 : c.width) ?? 0) > ((C == null ? void 0 : C.width) ?? 0), S = ((c == null ? void 0 : c.height) ?? 0) > ((C == null ? void 0 : C.height) ?? 0), j = ((Ae = J ? C : c) == null ? void 0 : Ae.left) ?? 0, he = ((Se = J ? C : c) == null ? void 0 : Se.right) ?? 0, oe = ((He = S ? C : c) == null ? void 0 : He.top) ?? 0, ve = ((O = S ? C : c) == null ? void 0 : O.bottom) ?? 0;
2386
- if (X && (r = !0, !Y))
2387
- return;
2388
- if ($ && (r = !1), $ && !Y) {
2389
- r = !0;
2390
- return;
2391
- }
2392
- if (Y && Xe(E.relatedTarget) && h.floating && ut(h.floating, E.relatedTarget))
2393
- return;
2394
- if (m && w) {
2395
- const I = m.nodes.get(w);
2396
- if (I && dn(I))
2397
- return;
2398
- }
2399
- if (V === "top" && f >= ((C == null ? void 0 : C.bottom) ?? 0) - 1 || V === "bottom" && f <= ((C == null ? void 0 : C.top) ?? 0) + 1 || V === "left" && s >= ((C == null ? void 0 : C.right) ?? 0) - 1 || V === "right" && s <= ((C == null ? void 0 : C.left) ?? 0) + 1)
2400
- return P();
2401
- let se = [];
2402
- switch (V) {
2403
- case "top":
2404
- se = [
2405
- [j, ((C == null ? void 0 : C.top) ?? 0) + 1],
2406
- [j, ((c == null ? void 0 : c.bottom) ?? 0) - 1],
2407
- [he, ((c == null ? void 0 : c.bottom) ?? 0) - 1],
2408
- [he, ((C == null ? void 0 : C.top) ?? 0) + 1]
2409
- ];
2410
- break;
2411
- case "bottom":
2412
- se = [
2413
- [j, ((c == null ? void 0 : c.top) ?? 0) + 1],
2414
- [j, ((C == null ? void 0 : C.bottom) ?? 0) - 1],
2415
- [he, ((C == null ? void 0 : C.bottom) ?? 0) - 1],
2416
- [he, ((c == null ? void 0 : c.top) ?? 0) + 1]
2417
- ];
2418
- break;
2419
- case "left":
2420
- se = [
2421
- [((c == null ? void 0 : c.right) ?? 0) - 1, ve],
2422
- [((c == null ? void 0 : c.right) ?? 0) - 1, oe],
2423
- [((C == null ? void 0 : C.left) ?? 0) + 1, oe],
2424
- [((C == null ? void 0 : C.left) ?? 0) + 1, ve]
2425
- ];
2426
- break;
2427
- case "right":
2428
- se = [
2429
- [((C == null ? void 0 : C.right) ?? 0) - 1, ve],
2430
- [((C == null ? void 0 : C.right) ?? 0) - 1, oe],
2431
- [((c == null ? void 0 : c.left) ?? 0) + 1, oe],
2432
- [((c == null ? void 0 : c.left) ?? 0) + 1, ve]
2433
- ];
2434
- break;
2435
- }
2436
- function re([I, K]) {
2437
- const A = v;
2438
- switch (V) {
2439
- case "top": {
2440
- const q = [
2441
- J ? I + A / 2 : b ? I + A * 4 : I - A * 4,
2442
- K + A + 1
2443
- ], ee = [
2444
- J ? I - A / 2 : b ? I + A * 4 : I - A * 4,
2445
- K + A + 1
2446
- ], Q = [
2447
- [
2448
- (c == null ? void 0 : c.left) ?? 0,
2449
- b || J ? ((c == null ? void 0 : c.bottom) ?? 0) - A : (c == null ? void 0 : c.top) ?? 0
2450
- ],
2451
- [
2452
- (c == null ? void 0 : c.right) ?? 0,
2453
- b ? J ? ((c == null ? void 0 : c.bottom) ?? 0) - A : (c == null ? void 0 : c.top) ?? 0 : ((c == null ? void 0 : c.bottom) ?? 0) - A
2454
- ]
2455
- ];
2456
- return [q, ee, ...Q];
2457
- }
2458
- case "bottom": {
2459
- const q = [
2460
- J ? I + A / 2 : b ? I + A * 4 : I - A * 4,
2461
- K - A
2462
- ], ee = [
2463
- J ? I - A / 2 : b ? I + A * 4 : I - A * 4,
2464
- K - A
2465
- ], Q = [
2466
- [
2467
- (c == null ? void 0 : c.left) ?? 0,
2468
- b || J ? ((c == null ? void 0 : c.top) ?? 0) + A : (c == null ? void 0 : c.bottom) ?? 0
2469
- ],
2470
- [
2471
- (c == null ? void 0 : c.right) ?? 0,
2472
- b ? J ? ((c == null ? void 0 : c.top) ?? 0) + A : (c == null ? void 0 : c.bottom) ?? 0 : ((c == null ? void 0 : c.top) ?? 0) + A
2473
- ]
2474
- ];
2475
- return [q, ee, ...Q];
2476
- }
2477
- case "left": {
2478
- const q = [
2479
- I + A + 1,
2480
- S ? K + A / 2 : U ? K + A * 4 : K - A * 4
2481
- ], ee = [
2482
- I + A + 1,
2483
- S ? K - A / 2 : U ? K + A * 4 : K - A * 4
2484
- ];
2485
- return [...[
2486
- [
2487
- U || S ? ((c == null ? void 0 : c.right) ?? 0) - A : (c == null ? void 0 : c.left) ?? 0,
2488
- (c == null ? void 0 : c.top) ?? 0
2489
- ],
2490
- [
2491
- U ? S ? ((c == null ? void 0 : c.right) ?? 0) - A : (c == null ? void 0 : c.left) ?? 0 : ((c == null ? void 0 : c.right) ?? 0) - A,
2492
- (c == null ? void 0 : c.bottom) ?? 0
2493
- ]
2494
- ], q, ee];
2495
- }
2496
- case "right": {
2497
- const q = [
2498
- I - A,
2499
- S ? K + A / 2 : U ? K + A * 4 : K - A * 4
2500
- ], ee = [
2501
- I - A,
2502
- S ? K - A / 2 : U ? K + A * 4 : K - A * 4
2503
- ], Q = [
2504
- [
2505
- U || S ? ((c == null ? void 0 : c.left) ?? 0) + A : (c == null ? void 0 : c.right) ?? 0,
2506
- (c == null ? void 0 : c.top) ?? 0
2507
- ],
2508
- [
2509
- U ? S ? ((c == null ? void 0 : c.left) ?? 0) + A : (c == null ? void 0 : c.right) ?? 0 : ((c == null ? void 0 : c.left) ?? 0) + A,
2510
- (c == null ? void 0 : c.bottom) ?? 0
2511
- ]
2512
- ];
2513
- return [q, ee, ...Q];
2514
- }
2515
- }
2516
- }
2517
- const fe = re([s, f]);
2518
- if ((M = t.onPolygonChange) == null || M.call(t, fe), !Kt(N, se)) {
2519
- if (Kt(N, fe)) {
2520
- if (!r && n) {
2521
- const I = l(
2522
- E.clientX,
2523
- E.clientY,
2524
- y,
2525
- L,
2526
- R
2527
- );
2528
- y = I.lastX, L = I.lastY, R = I.lastCursorTime, I.speed !== null && I.speed < 0.1 && (o = window.setTimeout(P, 40));
2529
- }
2530
- return;
2531
- }
2532
- if (r && !te)
2533
- return P();
2534
- P();
2535
- }
2536
- };
2537
- };
2538
- return i.__options = {
2539
- blockPointerEvents: e
2540
- }, i;
2541
- }
2542
- const zt = 10;
2543
- function _o(t, e, n) {
2544
- const { delay: o } = n, r = F(() => {
2545
- const s = T(o);
2546
- return (typeof s == "number" ? s : s.open) ?? 0;
2547
- }), l = F(() => {
2548
- const s = T(o);
2549
- return (typeof s == "number" ? s : s.close) ?? 0;
2550
- });
2551
- let i, a;
2552
- const d = () => {
2553
- clearTimeout(i), clearTimeout(a);
2554
- };
2555
- return Ie(d), {
2556
- show: (s, f) => {
2557
- d();
2558
- const u = s ?? r.value;
2559
- u === 0 ? t(f) : i = setTimeout(() => t(f), u);
2560
- },
2561
- hide: (s, f) => {
2562
- d();
2563
- const u = s ?? l.value;
2564
- u === 0 ? e(f) : a = setTimeout(() => e(f), u);
2565
- },
2566
- showDelay: r,
2567
- hideDelay: l,
2568
- clearTimeouts: d
2569
- };
2570
- }
2571
- function Dr(t, e = {}) {
2572
- const { floatingContext: n, treeContext: o } = je(t), {
2573
- open: r,
2574
- setOpen: l,
2575
- refs: { anchorEl: i, floatingEl: a }
2576
- } = n, {
2577
- enabled: d = !0,
2578
- delay: s = 0,
2579
- restMs: f = 0,
2580
- mouseOnly: u = !1,
2581
- safePolygon: h = !1
2582
- } = e, v = F(() => T(d)), g = F(() => T(f)), w = F(() => {
2583
- const b = i.value;
2584
- return !b || b instanceof HTMLElement ? b : b.contextElement ?? null;
2585
- }), { hide: m, show: p, showDelay: y, clearTimeouts: L } = _o(
2586
- (b) => {
2587
- r.value || l(!0, "hover", b);
2588
- },
2589
- (b) => {
2590
- r.value && l(!1, "hover", b);
2591
- },
2592
- { delay: s }
2593
- );
2594
- let R = null, D;
2595
- const E = F(() => y.value === 0 && g.value > 0);
2596
- function P(b) {
2597
- if (!v.value || !N(b) || !E.value || !R) return;
2598
- const U = { x: b.clientX, y: b.clientY }, te = Math.abs(U.x - R.x), J = Math.abs(U.y - R.y);
2599
- (te > zt || J > zt) && (R = U, clearTimeout(D), D = setTimeout(() => {
2600
- p(0, b);
2601
- }, g.value));
2602
- }
2603
- function z(b) {
2604
- !v.value || !N(b) || !E.value || (R = { x: b.clientX, y: b.clientY }, D = setTimeout(() => {
2605
- p(0, b);
2606
- }, g.value));
2607
- }
2608
- function k() {
2609
- clearTimeout(D), R = null;
2610
- }
2611
- Me(() => {
2612
- const b = w.value;
2613
- !b || !v.value || !E.value || (b.addEventListener("pointerenter", z), b.addEventListener("pointermove", P), b.addEventListener("pointerleave", k), Te(() => {
2614
- b.removeEventListener("pointerenter", z), b.removeEventListener("pointermove", P), b.removeEventListener("pointerleave", k);
2615
- }));
2616
- }), Ie(() => {
2617
- clearTimeout(D);
2618
- });
2619
- function N(b) {
2620
- return T(u) ? b.pointerType === "mouse" : !0;
2621
- }
2622
- function W(b) {
2623
- !v.value || !N(b) || E.value || ($(), p(void 0, b));
2624
- }
2625
- function Y(b) {
2626
- !v.value || !N(b) || (L(), $());
2627
- }
2628
- let X = null;
2629
- function $() {
2630
- X && (document.removeEventListener("pointermove", X), X = null);
2631
- const b = c.value;
2632
- b != null && b.onPolygonChange && b.onPolygonChange([]);
2633
- }
2634
- const C = F(() => !!T(h)), c = F(() => {
2635
- const b = T(h);
2636
- if (typeof b == "object" && b) return b;
2637
- if (b === !0) return {};
2638
- });
2639
- function V(b) {
2640
- var S;
2641
- if (!v.value || !N(b)) return;
2642
- const { clientX: U, clientY: te } = b, J = b.relatedTarget;
2643
- if (C.value)
2644
- setTimeout(() => {
2645
- var se;
2646
- $();
2647
- const j = w.value, he = a.value;
2648
- if (!j || !he) {
2649
- m(void 0, b);
2650
- return;
2651
- }
2652
- let oe, ve;
2653
- if (o) {
2654
- oe = /* @__PURE__ */ new Map();
2655
- const re = (fe) => {
2656
- oe == null || oe.set(fe.id, fe);
2657
- for (const we of fe.children.value)
2658
- re(we);
2659
- };
2660
- re(o), ve = o.id;
2661
- }
2662
- X = Uo(c.value)({
2663
- x: U,
2664
- y: te,
2665
- placement: n.placement.value,
2666
- elements: {
2667
- domReference: j,
2668
- floating: he
2669
- },
2670
- buffer: ((se = c.value) == null ? void 0 : se.buffer) ?? 1,
2671
- onClose: () => {
2672
- $(), m(void 0);
2673
- },
2674
- nodeId: ve,
2675
- tree: oe ? { nodes: oe } : void 0
2676
- }), X && document.addEventListener("pointermove", X);
2677
- }, 0);
2678
- else {
2679
- if (o) {
2680
- if (!jo(o, J))
2681
- return;
2682
- } else if ((S = a.value) != null && S.contains(J))
2683
- return;
2684
- m(void 0, b);
2685
- }
2686
- }
2687
- Me(() => {
2688
- const b = w.value;
2689
- !b || !v.value || (b.addEventListener("pointerenter", W), b.addEventListener("pointerleave", V), Te(() => {
2690
- b.removeEventListener("pointerenter", W), b.removeEventListener("pointerleave", V);
2691
- }));
2692
- }), Me(() => {
2693
- const b = a.value;
2694
- !b || !v.value || (b.addEventListener("pointerenter", Y), b.addEventListener("pointerleave", V), Te(() => {
2695
- b.removeEventListener("pointerenter", Y), b.removeEventListener("pointerleave", V);
2696
- }));
2697
- }), Ie(() => {
2698
- $();
2699
- });
2700
- }
2701
- function jo(t, e) {
2702
- return e ? !(ue(e, t.data.refs.anchorEl.value) || ue(e, t.data.refs.floatingEl.value) || rt(t, e)) : !0;
2703
- }
2704
- function qo(t, e, n, o) {
2705
- const r = F(() => !!T(o.virtual));
2706
- de(
2707
- [r, o.open, F(() => T(n))],
2708
- ([l, i, a]) => {
2709
- const d = t.value;
2710
- if (!d) return;
2711
- if (!l || !i || a == null) {
2712
- d.removeAttribute("aria-activedescendant");
2713
- return;
2714
- }
2715
- const s = e.value[a];
2716
- s && (s.id || (s.id = `vfloat-option-${Math.random().toString(16).slice(2, 10)}`), d.setAttribute("aria-activedescendant", s.id), o.virtualItemRef && (o.virtualItemRef.value = s));
2717
- }
2718
- );
2719
- }
2720
- function Ne(t, e, n) {
2721
- const {
2722
- items: o,
2723
- loop: r,
2724
- allowEscape: l,
2725
- isVirtual: i,
2726
- findNextEnabled: a,
2727
- getFirstEnabledIndex: d,
2728
- getLastEnabledIndex: s
2729
- } = n, f = o.length, u = t == null ? e === 1 ? 0 : f - 1 : t + e;
2730
- let h = a(u, e, r);
2731
- if (h == null && r) {
2732
- if (l && i)
2733
- return { type: "navigate", index: null };
2734
- h = e === 1 ? d() : s();
2735
- }
2736
- return h != null ? { type: "navigate", index: h } : null;
2737
- }
2738
- class Go {
2739
- handleKey(e, n) {
2740
- const { isRtl: o, nested: r } = n;
2741
- return e === "ArrowDown" ? Ne(n.current, 1, n) : e === "ArrowUp" ? Ne(n.current, -1, n) : r && e === (o ? "ArrowRight" : "ArrowLeft") ? { type: "close" } : null;
2742
- }
2743
- }
2744
- class Zo {
2745
- handleKey(e, n) {
2746
- const { isRtl: o, nested: r } = n;
2747
- return e === "ArrowRight" ? Ne(n.current, o ? -1 : 1, n) : e === "ArrowLeft" ? Ne(n.current, o ? 1 : -1, n) : r && e === "ArrowUp" ? { type: "close" } : null;
2748
- }
2749
- }
2750
- class Xt {
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: l,
2759
- loop: i,
2760
- allowEscape: a,
2761
- isVirtual: d,
2762
- getFirstEnabledIndex: s,
2763
- getLastEnabledIndex: f,
2764
- cols: u
2765
- } = n;
2766
- if (e === "ArrowRight" || e === "ArrowLeft") {
2767
- const h = e === "ArrowRight" ? 1 : -1;
2768
- if (o === null)
2769
- return Ne(o, h, n);
2770
- const v = o + h, g = Math.floor(o / u), w = Math.floor(v / u);
2771
- if (v >= 0 && v < r.length && g === w && !l(v))
2772
- return { type: "navigate", index: v };
2773
- if (i) {
2774
- if (a && d) {
2775
- const p = o === 0, y = o === r.length - 1;
2776
- if (h === -1 && p || h === 1 && y)
2777
- return { type: "navigate", index: null };
2778
- }
2779
- let m;
2780
- if (this.loopDirection === "next" ? h === 1 ? (m = o + 1, m >= r.length && (m = 0)) : (m = o - 1, m < 0 && (m = r.length - 1)) : h === 1 ? m = g * u : m = Math.min((g + 1) * u - 1, r.length - 1), this.loopDirection === "next") {
2781
- let p = m;
2782
- for (let y = 0; y < r.length; y++) {
2783
- if (!l(p))
2784
- return { type: "navigate", index: p };
2785
- if (p += h, p >= r.length && (p = 0), p < 0 && (p = r.length - 1), p === m) break;
2786
- }
2787
- } else {
2788
- const p = h, y = g * u, L = Math.min((g + 1) * u - 1, r.length - 1);
2789
- for (; m >= y && m <= L; ) {
2790
- if (!l(m))
2791
- return { type: "navigate", index: m };
2792
- if (m += p, m < y || m > L) break;
2793
- }
2794
- }
2795
- }
2796
- return Ne(o, h, n);
2797
- }
2798
- if (e === "ArrowDown" || e === "ArrowUp") {
2799
- if (u <= 1) return null;
2800
- const h = e === "ArrowDown" ? u : -u, v = h > 0 ? u : -u;
2801
- let w = (o ?? (h > 0 ? -u : r.length)) + h;
2802
- for (; w >= 0 && w < r.length && l(w); )
2803
- w += v;
2804
- if (w >= 0 && w < r.length)
2805
- return { type: "navigate", index: w };
2806
- if (i) {
2807
- if (a && d)
2808
- return { type: "navigate", index: null };
2809
- if (o === null) {
2810
- const y = h > 0 ? s() : f();
2811
- return y != null ? { type: "navigate", index: y } : null;
2812
- }
2813
- const m = o % u;
2814
- let p;
2815
- for (h > 0 ? p = m : (p = (Math.ceil(r.length / u) - 1) * u + m, p >= r.length && (p -= u)); p >= 0 && p < r.length && l(p); )
2816
- p += v;
2817
- if (p >= 0 && p < r.length)
2818
- return { type: "navigate", index: p };
2819
- }
2820
- if (this.fallbackToLinear)
2821
- return Ne(o, e === "ArrowDown" ? 1 : -1, n);
2822
- }
2823
- return null;
2824
- }
2825
- }
2826
- function Pr(t, e) {
2827
- const { floatingContext: n, treeContext: o } = je(t), { refs: r, open: l, setOpen: i } = n, {
2828
- listRef: a,
2829
- activeIndex: d,
2830
- onNavigate: s,
2831
- enabled: f = !0,
2832
- loop: u = !1,
2833
- orientation: h = "vertical",
2834
- disabledIndices: v,
2835
- focusItemOnHover: g = !0,
2836
- openOnArrowKeyDown: w = !0,
2837
- scrollItemIntoView: m = !0,
2838
- selectedIndex: p = null,
2839
- focusItemOnOpen: y = "auto",
2840
- nested: L = !1,
2841
- rtl: R = !1,
2842
- virtual: D = !1,
2843
- virtualItemRef: E,
2844
- cols: P = 1,
2845
- allowEscape: z = !1
2846
- } = e, k = {
2847
- isEnabled: F(() => T(f)),
2848
- anchorEl: F(() => {
2849
- const O = r.anchorEl.value;
2850
- return O instanceof HTMLElement ? O : O && "contextElement" in O && O.contextElement instanceof HTMLElement ? O.contextElement : null;
2851
- }),
2852
- floatingEl: F(() => r.floatingEl.value),
2853
- isVirtual: F(() => !!T(D)),
2854
- isRtl: F(() => !!T(R)),
2855
- gridCols: F(() => Math.max(1, Number(T(P) ?? 1)))
2856
- }, { isEnabled: N, anchorEl: W, floatingEl: Y, isVirtual: X, isRtl: $, gridCols: C } = k, c = () => d !== void 0 ? T(d) : null, V = (O) => v ? Array.isArray(v) ? v.includes(O) : !!v(O) : !1, b = () => {
2857
- const O = a.value;
2858
- for (let M = 0; M < O.length; M++)
2859
- if (O[M] && !V(M)) return M;
2860
- return null;
2861
- }, U = [], te = (O) => (U.push(O), O), J = () => {
2862
- var O;
2863
- for (; U.length; )
2864
- (O = U.pop()) == null || O();
2865
- }, S = () => {
2866
- const O = a.value;
2867
- for (let M = O.length - 1; M >= 0; M--)
2868
- if (O[M] && !V(M)) return M;
2869
- return null;
2870
- };
2871
- function j(O, M, I) {
2872
- switch (O) {
2873
- case "vertical":
2874
- return M;
2875
- case "horizontal":
2876
- return I;
2877
- default:
2878
- return M || I;
2879
- }
2880
- }
2881
- function he(O, M) {
2882
- return j(M, O === "ArrowUp" || O === "ArrowDown", O === "ArrowLeft" || O === "ArrowRight");
2883
- }
2884
- function oe(O, M, I) {
2885
- return j(M, O === "ArrowDown", I ? O === "ArrowLeft" : O === "ArrowRight") || O === "Enter" || O === " " || O === "";
2886
- }
2887
- const ve = (O, M, I) => {
2888
- const K = a.value, A = K.length;
2889
- let q = O;
2890
- for (let ee = 0; ee < A; ee++) {
2891
- if (q < 0 || q >= A) {
2892
- if (!I) return null;
2893
- q = (q + A) % A;
2894
- }
2895
- if (K[q] && !V(q)) return q;
2896
- q += M;
2897
- }
2898
- return null;
2899
- }, se = (O, M = !1) => {
2900
- var K;
2901
- if (O == null) return;
2902
- const I = a.value[O];
2903
- if (I && !X.value) {
2904
- I.focus({ preventScroll: !0 });
2905
- const A = m;
2906
- !!A && (M || fn.value) && ((K = I.scrollIntoView) == null || K.call(
2907
- I,
2908
- typeof A == "boolean" ? { block: "nearest", inline: "nearest" } : A
2909
- ));
2910
- }
2911
- };
2912
- let re = null;
2913
- const fe = (O) => {
2914
- if (O.defaultPrevented) return;
2915
- const M = O.target;
2916
- if (M && wt(M) && M !== W.value) return;
2917
- const I = O.key, K = T(h);
2918
- if (re = I, l.value && X.value) {
2919
- we(O);
2920
- return;
2921
- }
2922
- if (!he(I, K) || l.value || !T(w)) return;
2923
- O.preventDefault(), i(!0, "keyboard-activate", O);
2924
- const q = (p !== void 0 ? T(p) : null) ?? (oe(I, K, $.value) ? b() : S());
2925
- q != null && (s == null || s(q));
2926
- }, we = (O) => {
2927
- if (O.defaultPrevented) return;
2928
- const M = O.key, I = T(h), K = a.value;
2929
- if (!K.length) return;
2930
- if (!X.value) {
2931
- if (M === "Home") {
2932
- O.preventDefault();
2933
- const Q = b();
2934
- Q != null && (s == null || s(Q));
2935
- return;
2936
- }
2937
- if (M === "End") {
2938
- O.preventDefault();
2939
- const Q = S();
2940
- Q != null && (s == null || s(Q));
2941
- return;
2942
- }
2943
- }
2944
- let A;
2945
- I === "vertical" ? A = new Go() : I === "horizontal" ? A = C.value > 1 ? new Xt(!1, T(e.gridLoopDirection) ?? "row") : new Zo() : A = new Xt(!0, T(e.gridLoopDirection) ?? "row");
2946
- const q = {
2947
- current: c(),
2948
- items: K,
2949
- isRtl: $.value,
2950
- loop: !!T(u),
2951
- allowEscape: !!T(z),
2952
- isVirtual: X.value,
2953
- cols: C.value,
2954
- nested: !!T(L),
2955
- isDisabled: V,
2956
- findNextEnabled: ve,
2957
- getFirstEnabledIndex: b,
2958
- getLastEnabledIndex: S
2959
- }, ee = A.handleKey(M, q);
2960
- if (ee) {
2961
- if (ee.type === "navigate")
2962
- O.preventDefault(), s == null || s(ee.index);
2963
- else if (ee.type === "close") {
2964
- O.preventDefault(), i(!1, "programmatic", O);
2965
- const Q = o == null ? void 0 : o.parent.value, le = Q == null ? void 0 : Q.data.refs.anchorEl.value;
2966
- le instanceof HTMLElement ? le.focus({ preventScroll: !0 }) : le && "contextElement" in le && le.contextElement instanceof HTMLElement && le.contextElement.focus({ preventScroll: !0 });
2967
- }
2968
- }
2969
- }, ke = de(
2970
- [l, F(() => c())],
2971
- ([O, M]) => {
2972
- N.value && O && M != null && se(M);
2973
- },
2974
- { flush: "post" }
2975
- );
2976
- te(ke), te(
2977
- ne(
2978
- () => N.value ? W.value : null,
2979
- "keydown",
2980
- fe
2981
- )
2982
- ), te(
2983
- ne(
2984
- () => N.value ? Y.value : null,
2985
- "keydown",
2986
- we
2987
- )
2988
- );
2989
- const Ae = Me(() => {
2990
- if (!N.value || !T(g)) return;
2991
- const O = Y.value;
2992
- if (!O) return;
2993
- let M = null, I = null;
2994
- const K = (A) => {
2995
- if (M === A.clientX && I === A.clientY) return;
2996
- M = A.clientX, I = A.clientY;
2997
- const q = A.target;
2998
- if (!q) return;
2999
- const ee = a.value;
3000
- let Q = -1;
3001
- for (let le = 0; le < ee.length; le++) {
3002
- const x = ee[le];
3003
- if (x && (x === q || x.contains(q))) {
3004
- Q = le;
3005
- break;
3006
- }
3007
- }
3008
- Q >= 0 && (s == null || s(Q));
3009
- };
3010
- O.addEventListener("mousemove", K), Te(() => {
3011
- O.removeEventListener("mousemove", K);
3012
- });
3013
- });
3014
- te(Ae);
3015
- const Se = ie(!1), He = de(
3016
- () => l.value,
3017
- (O) => {
3018
- if (N.value) {
3019
- if (O && !Se.value) {
3020
- const M = T(y);
3021
- if (M === !0 || M === "auto" && re != null) {
3022
- const K = (p !== void 0 ? T(p) : null) ?? (re && oe(re, T(h), $.value) ? b() : S());
3023
- K != null && (s == null || s(K), se(K, !0));
3024
- }
3025
- }
3026
- Se.value = O;
3027
- }
3028
- },
3029
- { flush: "post", immediate: !0 }
3030
- );
3031
- return te(He), qo(
3032
- W,
3033
- a,
3034
- F(() => c()),
3035
- { virtual: D, open: l, virtualItemRef: E }
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 Jo = ["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])"], mt = /* @__PURE__ */ Jo.join(","), hn = typeof Element > "u", Ue = hn ? function() {
3043
- } : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector, ot = !hn && 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
- }, _e = 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"), l = r === "" || r === "true", i = l || n && e && _e(e.parentNode);
3052
- return i;
3053
- }, Qo = 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
- }, er = function(e, n, o) {
3057
- if (_e(e))
3058
- return [];
3059
- var r = Array.prototype.slice.apply(e.querySelectorAll(mt));
3060
- return n && Ue.call(e, mt) && r.unshift(e), r = r.filter(o), r;
3061
- }, gt = function(e, n, o) {
3062
- for (var r = [], l = Array.from(e); l.length; ) {
3063
- var i = l.shift();
3064
- if (!_e(i, !1))
3065
- if (i.tagName === "SLOT") {
3066
- var a = i.assignedElements(), d = a.length ? a : i.children, s = gt(d, !0, o);
3067
- o.flatten ? r.push.apply(r, s) : r.push({
3068
- scopeParent: i,
3069
- candidates: s
3070
- });
3071
- } else {
3072
- var f = Ue.call(i, mt);
3073
- f && 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), h = !_e(u, !1) && (!o.shadowRootFilter || o.shadowRootFilter(i));
3076
- if (u && h) {
3077
- var v = gt(u === !0 ? i.children : u.children, !0, o);
3078
- o.flatten ? r.push.apply(r, v) : r.push({
3079
- scopeParent: i,
3080
- candidates: v
3081
- });
3082
- } else
3083
- l.unshift.apply(l, i.children);
3084
- }
3085
- }
3086
- return r;
3087
- }, vn = function(e) {
3088
- return !isNaN(parseInt(e.getAttribute("tabindex"), 10));
3089
- }, pn = function(e) {
3090
- if (!e)
3091
- throw new Error("No node provided");
3092
- return e.tabIndex < 0 && (/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName) || Qo(e)) && !vn(e) ? 0 : e.tabIndex;
3093
- }, tr = function(e, n) {
3094
- var o = pn(e);
3095
- return o < 0 && n && !vn(e) ? 0 : o;
3096
- }, nr = function(e, n) {
3097
- return e.tabIndex === n.tabIndex ? e.documentOrder - n.documentOrder : e.tabIndex - n.tabIndex;
3098
- }, mn = function(e) {
3099
- return e.tagName === "INPUT";
3100
- }, or = function(e) {
3101
- return mn(e) && e.type === "hidden";
3102
- }, rr = 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
- }, ir = 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
- }, sr = function(e) {
3112
- if (!e.name)
3113
- return !0;
3114
- var n = e.form || ot(e), o = function(a) {
3115
- return n.querySelectorAll('input[type="radio"][name="' + a + '"]');
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 l = ir(r, e.form);
3126
- return !l || l === e;
3127
- }, lr = function(e) {
3128
- return mn(e) && e.type === "radio";
3129
- }, ar = function(e) {
3130
- return lr(e) && !sr(e);
3131
- }, ur = function(e) {
3132
- var n, o = e && ot(e), r = (n = o) === null || n === void 0 ? void 0 : n.host, l = !1;
3133
- if (o && o !== e) {
3134
- var i, a, d;
3135
- for (l = !!((i = r) !== null && i !== void 0 && (a = i.ownerDocument) !== null && a !== void 0 && a.contains(r) || e != null && (d = e.ownerDocument) !== null && d !== void 0 && d.contains(e)); !l && r; ) {
3136
- var s, f, u;
3137
- o = ot(r), r = (s = o) === null || s === void 0 ? void 0 : s.host, l = !!((f = r) !== null && f !== void 0 && (u = f.ownerDocument) !== null && u !== void 0 && u.contains(r));
3138
- }
3139
- }
3140
- return l;
3141
- }, Yt = function(e) {
3142
- var n = e.getBoundingClientRect(), o = n.width, r = n.height;
3143
- return o === 0 && r === 0;
3144
- }, cr = function(e, n) {
3145
- var o = n.displayCheck, r = n.getShadowRoot;
3146
- if (o === "full-native" && "checkVisibility" in e) {
3147
- var l = 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 !l;
3161
- }
3162
- if (getComputedStyle(e).visibility === "hidden")
3163
- return !0;
3164
- var i = Ue.call(e, "details>summary:first-of-type"), a = i ? e.parentElement : e;
3165
- if (Ue.call(a, "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 d = e; e; ) {
3172
- var s = e.parentElement, f = ot(e);
3173
- if (s && !s.shadowRoot && r(s) === !0)
3174
- return Yt(e);
3175
- e.assignedSlot ? e = e.assignedSlot : !s && f !== e.ownerDocument ? e = f.host : e = s;
3176
- }
3177
- e = d;
3178
- }
3179
- if (ur(e))
3180
- return !e.getClientRects().length;
3181
- if (o !== "legacy-full")
3182
- return !0;
3183
- } else if (o === "non-zero-area")
3184
- return Yt(e);
3185
- return !1;
3186
- }, fr = 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 Ue.call(n, "fieldset[disabled] *") ? !0 : !r.contains(e);
3194
- }
3195
- return !0;
3196
- }
3197
- n = n.parentElement;
3198
- }
3199
- return !1;
3200
- }, dr = 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
- _e(n) || or(n) || cr(n, e) || // For a details element with a summary, the summary element gets the focus
3205
- rr(n) || fr(n));
3206
- }, Ut = function(e, n) {
3207
- return !(ar(n) || pn(n) < 0 || !dr(e, n));
3208
- }, hr = function(e) {
3209
- var n = parseInt(e.getAttribute("tabindex"), 10);
3210
- return !!(isNaN(n) || n >= 0);
3211
- }, gn = function(e) {
3212
- var n = [], o = [];
3213
- return e.forEach(function(r, l) {
3214
- var i = !!r.scopeParent, a = i ? r.scopeParent : r, d = tr(a, i), s = i ? gn(r.candidates) : a;
3215
- d === 0 ? i ? n.push.apply(n, s) : n.push(a) : o.push({
3216
- documentOrder: l,
3217
- tabIndex: d,
3218
- item: r,
3219
- isScope: i,
3220
- content: s
3221
- });
3222
- }), o.sort(nr).reduce(function(r, l) {
3223
- return l.isScope ? r.push.apply(r, l.content) : r.push(l.content), r;
3224
- }, []).concat(n);
3225
- }, vr = function(e, n) {
3226
- n = n || {};
3227
- var o;
3228
- return n.getShadowRoot ? o = gt([e], n.includeContainer, {
3229
- filter: Ut.bind(null, n),
3230
- flatten: !1,
3231
- getShadowRoot: n.getShadowRoot,
3232
- shadowRootFilter: hr
3233
- }) : o = er(e, n.includeContainer, Ut.bind(null, n)), gn(o);
3234
- };
3235
- function Rr(t, e = {}) {
3236
- const { floatingContext: n, treeContext: o } = je(t), {
3237
- refs: { floatingEl: r, anchorEl: l },
3238
- open: i,
3239
- setOpen: a
3240
- } = n, {
3241
- enabled: d = !0,
3242
- modal: s = !1,
3243
- guards: f = !0,
3244
- order: u = ["content"],
3245
- initialFocus: h = "first",
3246
- returnFocus: v = !0,
3247
- restoreFocus: g = !1,
3248
- closeOnFocusOut: w = !1,
3249
- preventScroll: m = !0,
3250
- outsideElementsInert: p = !1
3251
- } = e, y = F(() => !!T(d)), L = F(() => !!T(s)), R = F(() => !!T(f)), D = F(
3252
- () => Array.isArray(T(u)) ? T(u) : ["content"]
3253
- ), E = F(() => !!T(v)), P = F(() => !!T(g)), z = F(() => !!T(w)), k = F(() => !!T(m)), N = F(() => !!T(p)), W = F(() => r.value), Y = ie(null);
3254
- let X = null, $ = null, C = null, c = null, V = null, b = null, U = null;
3255
- const te = ie(-1);
3256
- let J = !1;
3257
- const S = typeof HTMLElement < "u" && "inert" in HTMLElement.prototype, j = [];
3258
- function he(x) {
3259
- !x || !x.isConnected || x !== x.ownerDocument.body && (j.push(x), j.length > 20 && j.shift());
3260
- }
3261
- function oe() {
3262
- for (; j.length; ) {
3263
- const x = j.pop();
3264
- if (x.isConnected) return x;
3265
- }
3266
- return null;
3267
- }
3268
- function ve() {
3269
- if (!o) return !0;
3270
- const x = (H) => {
3271
- for (const B of H.children.value)
3272
- if (B.data.open.value || x(B)) return !0;
3273
- return !1;
3274
- };
3275
- return !x(o);
3276
- }
3277
- function se(x) {
3278
- const H = x.hasAttribute("tabindex"), B = x.getAttribute("tabindex");
3279
- return H || x.setAttribute("tabindex", "-1"), () => {
3280
- H ? B != null && x.setAttribute("tabindex", B) : x.removeAttribute("tabindex");
3281
- };
3282
- }
3283
- function re(x) {
3284
- try {
3285
- return vr(x, { displayCheck: "full", includeContainer: !1 });
3286
- } catch {
3287
- return [];
3288
- }
3289
- }
3290
- function fe(x) {
3291
- const H = re(x), B = l.value;
3292
- return D.value.map((_) => _ === "floating" ? x : _ === "reference" ? Xe(B) ? B : (B == null ? void 0 : B.contextElement) instanceof HTMLElement ? B.contextElement : null : H).flat().filter((_) => !!_);
3293
- }
3294
- function we() {
3295
- const x = document.createElement("div");
3296
- return x.setAttribute("tabindex", "0"), x.setAttribute("aria-hidden", "true"), x.style.cssText = "position:absolute;width:1px;height:1px;opacity:0;", x;
3297
- }
3298
- function ke(x) {
3299
- R.value && (c || V || (c = we(), V = we(), x.insertBefore(c, x.firstChild), x.appendChild(V), b = Se(c, "before", x), U = Se(V, "after", x)));
3300
- }
3301
- function Ae() {
3302
- b == null || b(), U == null || U(), b = null, U = null, c && c.parentNode && c.parentNode.removeChild(c), V && V.parentNode && V.parentNode.removeChild(V), c = null, V = null;
3303
- }
3304
- function Se(x, H, B) {
3305
- const _ = (G) => {
3306
- G.preventDefault();
3307
- const Z = fe(B);
3308
- if (!Z.length) {
3309
- M(B);
3310
- return;
3311
- }
3312
- M(H === "before" ? Z[Z.length - 1] : Z[0]);
3313
- };
3314
- return x.addEventListener("focus", _), () => x.removeEventListener("focus", _);
3315
- }
3316
- function He(x) {
3317
- if (!L.value) return () => {
3318
- };
3319
- const H = [], B = x.ownerDocument.body, _ = Array.from(B.children);
3320
- for (const G of _)
3321
- if (!G.contains(x)) {
3322
- const Z = G.getAttribute("aria-hidden");
3323
- H.push(G), G.setAttribute("aria-hidden", "true"), G.__prevAriaHidden = Z;
3324
- }
3325
- return () => {
3326
- for (const G of H) {
3327
- const Z = G.__prevAriaHidden;
3328
- Z == null ? G.removeAttribute("aria-hidden") : G.setAttribute("aria-hidden", Z), delete G.__prevAriaHidden;
3329
- }
3330
- };
3331
- }
3332
- function O(x) {
3333
- if (!L.value || !N.value) return () => {
3334
- };
3335
- const B = x.ownerDocument.body, G = Array.from(B.children).filter((Z) => !Z.contains(x)).map((Z) => ({
3336
- el: Z,
3337
- ariaHidden: Z.getAttribute("aria-hidden"),
3338
- inert: Z.inert ?? null
3339
- }));
3340
- for (const { el: Z } of G)
3341
- S ? Z.inert = !0 : Z.setAttribute("aria-hidden", "true");
3342
- return () => {
3343
- var Z;
3344
- for (const Pe of G) {
3345
- if (S) {
3346
- const ze = Pe.el;
3347
- Pe.inert == null ? (ze.inert = !1, (Z = ze.removeAttribute) == null || Z.call(ze, "inert")) : ze.inert = Pe.inert;
3348
- }
3349
- Pe.ariaHidden == null ? Pe.el.removeAttribute("aria-hidden") : Pe.el.setAttribute("aria-hidden", Pe.ariaHidden);
3350
- }
3351
- };
3352
- }
3353
- function M(x, H) {
3354
- if (x)
3355
- try {
3356
- x.focus(H ?? { preventScroll: k.value });
3357
- } catch {
3358
- }
3359
- }
3360
- function I(x) {
3361
- const H = T(h), B = re(x);
3362
- if (typeof H == "number") {
3363
- const _ = B[H] ?? null;
3364
- M(_);
3365
- return;
3366
- }
3367
- if (typeof H == "function") {
3368
- M(H(), { preventScroll: k.value });
3369
- return;
3370
- }
3371
- if (Xe(H)) {
3372
- M(H, { preventScroll: k.value });
3373
- return;
3374
- }
3375
- if (H === "last") {
3376
- M(B[B.length - 1] ?? null);
3377
- return;
3378
- }
3379
- B.length > 0 ? M(B[0]) : (X = se(x), M(x));
3380
- }
3381
- function K(x, H) {
3382
- if (x.key !== "Tab") return;
3383
- const B = fe(H);
3384
- if (!B.length) {
3385
- X ?? (X = se(H)), x.preventDefault(), M(H);
3386
- return;
3387
- }
3388
- const _ = document.activeElement, G = B[0], Z = B[B.length - 1];
3389
- x.shiftKey ? (!_ || _ === G) && (x.preventDefault(), M(Z)) : (!_ || _ === Z) && (x.preventDefault(), M(G));
3390
- }
3391
- function A(x) {
3392
- return o ? ue(x, o.data.refs.anchorEl.value) || ue(x, o.data.refs.floatingEl.value) ? !0 : !!rt(o, x) : !!W.value && W.value.contains(x);
3393
- }
3394
- const q = ne(
3395
- () => y.value && i.value ? W.value : null,
3396
- "keydown",
3397
- (x) => {
3398
- const H = W.value;
3399
- H && K(x, H);
3400
- },
3401
- { capture: !0 }
3402
- ), ee = ne(
3403
- () => y.value && i.value ? document : null,
3404
- "focusin",
3405
- (x) => {
3406
- const H = W.value, B = x.target;
3407
- if (!(!H || !B) && ve() && !H.contains(B) && !A(B)) {
3408
- if (L.value) {
3409
- const G = fe(H)[0] ?? H;
3410
- M(G);
3411
- } else if (z.value) {
3412
- J = !0;
3413
- try {
3414
- a(!1, "blur", x);
3415
- } catch (_) {
3416
- console.error("[useFocusTrap] Error closing on focus out:", _);
3417
- }
3418
- }
3419
- }
3420
- },
3421
- { capture: !0 }
3422
- );
3423
- ne(
3424
- () => y.value && i.value ? W.value : null,
3425
- "focusin",
3426
- (x) => {
3427
- const H = W.value;
3428
- if (!H) return;
3429
- const B = re(H), _ = x.target;
3430
- if (!(_ instanceof HTMLElement)) {
3431
- te.value = -1;
3432
- return;
3433
- }
3434
- te.value = B.indexOf(_);
3435
- }
3436
- ), ne(
3437
- () => y.value && i.value ? W.value : null,
3438
- "focusout",
3439
- (x) => {
3440
- if (!P.value) return;
3441
- const H = W.value;
3442
- H && queueMicrotask(() => {
3443
- const B = H.ownerDocument, _ = B.activeElement;
3444
- if (_ && H.contains(_) || _ && _ !== B.body) return;
3445
- const G = re(H), Z = G[te.value] ?? G[G.length - 1] ?? H;
3446
- M(Z);
3447
- });
3448
- }
3449
- ), ne(
3450
- () => y.value && i.value ? document : null,
3451
- "pointerdown",
3452
- () => {
3453
- queueMicrotask(() => {
3454
- });
3455
- },
3456
- { capture: !0 }
3457
- );
3458
- const Q = Me(() => {
3459
- if (!y.value || !i.value) return;
3460
- const x = W.value;
3461
- if (!x) return;
3462
- const B = x.ownerDocument.activeElement;
3463
- Y.value = B, he(B), ke(x), $ = He(x), C = O(x), queueMicrotask(() => I(x)), Te(() => {
3464
- Ae(), X && (X(), X = null), $ && ($(), $ = null), C && (C(), C = null);
3465
- });
3466
- });
3467
- de(
3468
- () => i.value,
3469
- (x, H) => {
3470
- if (!x && H) {
3471
- const B = Y.value;
3472
- if (Y.value = null, E.value && !J) {
3473
- const _ = oe() ?? B ?? le();
3474
- if (_) {
3475
- const G = re(_);
3476
- M(G[0] ?? _, { preventScroll: !0 });
3477
- }
3478
- }
3479
- J = !1;
3480
- }
3481
- },
3482
- { flush: "post" }
3483
- );
3484
- function le() {
3485
- const x = l.value;
3486
- return x instanceof HTMLElement ? x : (x == null ? void 0 : x.contextElement) instanceof HTMLElement ? x.contextElement : null;
3487
- }
3488
- return Ie(() => {
3489
- q(), ee(), Ae(), X && X(), $ && $(), C && C();
3490
- }), {
3491
- cleanup: () => {
3492
- q(), ee(), Q(), Ae(), X && X(), $ && $(), C && C();
3493
- }
3494
- };
3495
- }
3496
- export {
3497
- Mn as FollowTracker,
3498
- Nn as StaticTracker,
3499
- Gt as TrackingStrategy,
3500
- ht as VirtualElementFactory,
3501
- Do as arrow,
3502
- yr as autoPlacement,
3503
- Ro as createTree,
3504
- $t as createTreeNode,
3505
- Er as flip,
3506
- Tr as hide,
3507
- br as offset,
3508
- xr as shift,
3509
- Cr as size,
3510
- gr as useArrow,
3511
- Sr as useClick,
3512
- wr as useClientPoint,
3513
- Or as useEscapeKey,
3514
- Po as useFloating,
3515
- Ar as useFloatingTree,
3516
- Lr as useFocus,
3517
- Rr as useFocusTrap,
3518
- Dr as useHover,
3519
- Pr as useListNavigation
3520
- };