v-float 0.2.1 → 0.4.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 (39) hide show
  1. package/README.md +189 -83
  2. package/dist/composables/interactions/index.d.ts +2 -1
  3. package/dist/composables/interactions/index.d.ts.map +1 -1
  4. package/dist/composables/interactions/polygon.d.ts +12 -2
  5. package/dist/composables/interactions/polygon.d.ts.map +1 -1
  6. package/dist/composables/interactions/use-click.d.ts +78 -10
  7. package/dist/composables/interactions/use-click.d.ts.map +1 -1
  8. package/dist/composables/interactions/use-client-point.d.ts +1 -1
  9. package/dist/composables/interactions/use-client-point.d.ts.map +1 -1
  10. package/dist/composables/interactions/use-escape-key.d.ts +24 -0
  11. package/dist/composables/interactions/use-escape-key.d.ts.map +1 -0
  12. package/dist/composables/interactions/use-focus.d.ts +28 -3
  13. package/dist/composables/interactions/use-focus.d.ts.map +1 -1
  14. package/dist/composables/interactions/use-hover.d.ts +21 -3
  15. package/dist/composables/interactions/use-hover.d.ts.map +1 -1
  16. package/dist/composables/interactions/utils/browser-detection.d.ts +23 -0
  17. package/dist/composables/interactions/utils/browser-detection.d.ts.map +1 -0
  18. package/dist/composables/interactions/utils/element-detection.d.ts +53 -0
  19. package/dist/composables/interactions/utils/element-detection.d.ts.map +1 -0
  20. package/dist/composables/interactions/utils/event-utils.d.ts +30 -0
  21. package/dist/composables/interactions/utils/event-utils.d.ts.map +1 -0
  22. package/dist/composables/interactions/utils/index.d.ts +11 -0
  23. package/dist/composables/interactions/utils/index.d.ts.map +1 -0
  24. package/dist/composables/interactions/utils/tree-context.d.ts +32 -0
  25. package/dist/composables/interactions/utils/tree-context.d.ts.map +1 -0
  26. package/dist/composables/middlewares/index.d.ts +0 -1
  27. package/dist/composables/middlewares/index.d.ts.map +1 -1
  28. package/dist/composables/use-arrow.d.ts +10 -3
  29. package/dist/composables/use-arrow.d.ts.map +1 -1
  30. package/dist/composables/use-floating-tree.d.ts +13 -13
  31. package/dist/composables/use-floating-tree.d.ts.map +1 -1
  32. package/dist/composables/use-floating.d.ts +7 -0
  33. package/dist/composables/use-floating.d.ts.map +1 -1
  34. package/dist/composables/use-tree.d.ts.map +1 -1
  35. package/dist/v-float.es.js +1343 -1176
  36. package/dist/v-float.umd.js +1 -1
  37. package/package.json +31 -24
  38. package/dist/composables/interactions/use-dismiss.d.ts +0 -68
  39. package/dist/composables/interactions/use-dismiss.d.ts.map +0 -1
@@ -1,82 +1,83 @@
1
- var Nt = Object.defineProperty;
2
- var ot = (e) => {
1
+ var Qt = Object.defineProperty;
2
+ var mt = (e) => {
3
3
  throw TypeError(e);
4
4
  };
5
- var kt = (e, t, n) => t in e ? Nt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
6
- var z = (e, t, n) => kt(e, typeof t != "symbol" ? t + "" : t, n), Se = (e, t, n) => t.has(e) || ot("Cannot " + n);
7
- var Re = (e, t, n) => (Se(e, t, "read from private field"), n ? n.call(e) : t.get(e)), Te = (e, t, n) => t.has(e) ? ot("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, n), Ne = (e, t, n, o) => (Se(e, t, "write to private field"), o ? o.call(e, n) : t.set(e, n), n), ke = (e, t, n) => (Se(e, t, "access private method"), n);
8
- import { ref as G, computed as A, toValue as P, shallowRef as We, watch as pe, onWatcherCleanup as B, onScopeDispose as re, watchPostEffect as me, getCurrentScope as Ht, unref as Ft, onMounted as $t, watchEffect as Ve, readonly as It, shallowReactive as Wt } from "vue";
9
- const Vt = ["top", "right", "bottom", "left"], le = Math.min, ee = Math.max, Le = Math.round, xe = Math.floor, K = (e) => ({
5
+ var Zt = (e, t, n) => t in e ? Qt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
6
+ var ce = (e, t, n) => Zt(e, typeof t != "symbol" ? t + "" : t, n), $e = (e, t, n) => t.has(e) || mt("Cannot " + n);
7
+ var Xe = (e, t, n) => ($e(e, t, "read from private field"), n ? n.call(e) : t.get(e)), Ne = (e, t, n) => t.has(e) ? mt("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, n), Ye = (e, t, n, o) => ($e(e, t, "write to private field"), o ? o.call(e, n) : t.set(e, n), n), je = (e, t, n) => ($e(e, t, "access private method"), n);
8
+ import { toValue as S, ref as U, computed as I, shallowRef as qe, watch as pe, onWatcherCleanup as ue, onScopeDispose as ge, watchPostEffect as Te, getCurrentScope as en, unref as tn, onMounted as nn, watchEffect as pt, readonly as on, shallowReactive as rn } from "vue";
9
+ const sn = ["top", "right", "bottom", "left"], we = Math.min, fe = Math.max, Re = Math.round, De = Math.floor, K = (e) => ({
10
10
  x: e,
11
11
  y: e
12
- }), Yt = {
12
+ }), ln = {
13
13
  left: "right",
14
14
  right: "left",
15
15
  bottom: "top",
16
16
  top: "bottom"
17
- }, Xt = {
17
+ }, an = {
18
18
  start: "end",
19
19
  end: "start"
20
20
  };
21
- function Ye(e, t, n) {
22
- return ee(e, le(t, n));
21
+ function Ke(e, t, n) {
22
+ return fe(e, we(t, n));
23
23
  }
24
- function ue(e, t) {
24
+ function be(e, t) {
25
25
  return typeof e == "function" ? e(t) : e;
26
26
  }
27
- function te(e) {
27
+ function de(e) {
28
28
  return e.split("-")[0];
29
29
  }
30
- function ye(e) {
30
+ function Me(e) {
31
31
  return e.split("-")[1];
32
32
  }
33
- function Tt(e) {
33
+ function It(e) {
34
34
  return e === "x" ? "y" : "x";
35
35
  }
36
- function Ke(e) {
36
+ function et(e) {
37
37
  return e === "y" ? "height" : "width";
38
38
  }
39
- function ae(e) {
40
- return ["top", "bottom"].includes(te(e)) ? "y" : "x";
39
+ const cn = /* @__PURE__ */ new Set(["top", "bottom"]);
40
+ function ne(e) {
41
+ return cn.has(de(e)) ? "y" : "x";
41
42
  }
42
- function Ue(e) {
43
- return Tt(ae(e));
43
+ function tt(e) {
44
+ return It(ne(e));
44
45
  }
45
- function jt(e, t, n) {
46
+ function un(e, t, n) {
46
47
  n === void 0 && (n = !1);
47
- const o = ye(e), i = Ue(e), r = Ke(i);
48
- let s = i === "x" ? o === (n ? "end" : "start") ? "right" : "left" : o === "start" ? "bottom" : "top";
49
- return t.reference[r] > t.floating[r] && (s = Pe(s)), [s, Pe(s)];
48
+ const o = Me(e), i = tt(e), r = et(i);
49
+ let l = i === "x" ? o === (n ? "end" : "start") ? "right" : "left" : o === "start" ? "bottom" : "top";
50
+ return t.reference[r] > t.floating[r] && (l = ke(l)), [l, ke(l)];
50
51
  }
51
- function _t(e) {
52
- const t = Pe(e);
53
- return [Xe(e), t, Xe(t)];
52
+ function fn(e) {
53
+ const t = ke(e);
54
+ return [Ge(e), t, Ge(t)];
54
55
  }
55
- function Xe(e) {
56
- return e.replace(/start|end/g, (t) => Xt[t]);
56
+ function Ge(e) {
57
+ return e.replace(/start|end/g, (t) => an[t]);
57
58
  }
58
- function Kt(e, t, n) {
59
- const o = ["left", "right"], i = ["right", "left"], r = ["top", "bottom"], s = ["bottom", "top"];
59
+ const vt = ["left", "right"], gt = ["right", "left"], dn = ["top", "bottom"], hn = ["bottom", "top"];
60
+ function mn(e, t, n) {
60
61
  switch (e) {
61
62
  case "top":
62
63
  case "bottom":
63
- return n ? t ? i : o : t ? o : i;
64
+ return n ? t ? gt : vt : t ? vt : gt;
64
65
  case "left":
65
66
  case "right":
66
- return t ? r : s;
67
+ return t ? dn : hn;
67
68
  default:
68
69
  return [];
69
70
  }
70
71
  }
71
- function Ut(e, t, n, o) {
72
- const i = ye(e);
73
- let r = Kt(te(e), n === "start", o);
74
- return i && (r = r.map((s) => s + "-" + i), t && (r = r.concat(r.map(Xe)))), r;
72
+ function pn(e, t, n, o) {
73
+ const i = Me(e);
74
+ let r = mn(de(e), n === "start", o);
75
+ return i && (r = r.map((l) => l + "-" + i), t && (r = r.concat(r.map(Ge)))), r;
75
76
  }
76
- function Pe(e) {
77
- return e.replace(/left|right|bottom|top/g, (t) => Yt[t]);
77
+ function ke(e) {
78
+ return e.replace(/left|right|bottom|top/g, (t) => ln[t]);
78
79
  }
79
- function qt(e) {
80
+ function vn(e) {
80
81
  return {
81
82
  top: 0,
82
83
  right: 0,
@@ -85,15 +86,15 @@ function qt(e) {
85
86
  ...e
86
87
  };
87
88
  }
88
- function xt(e) {
89
- return typeof e != "number" ? qt(e) : {
89
+ function Wt(e) {
90
+ return typeof e != "number" ? vn(e) : {
90
91
  top: e,
91
92
  right: e,
92
93
  bottom: e,
93
94
  left: e
94
95
  };
95
96
  }
96
- function Oe(e) {
97
+ function Fe(e) {
97
98
  const {
98
99
  x: t,
99
100
  y: n,
@@ -111,161 +112,161 @@ function Oe(e) {
111
112
  y: n
112
113
  };
113
114
  }
114
- function it(e, t, n) {
115
+ function wt(e, t, n) {
115
116
  let {
116
117
  reference: o,
117
118
  floating: i
118
119
  } = e;
119
- const r = ae(t), s = Ue(t), c = Ke(s), f = te(t), a = r === "y", h = o.x + o.width / 2 - i.width / 2, d = o.y + o.height / 2 - i.height / 2, v = o[c] / 2 - i[c] / 2;
120
- let u;
121
- switch (f) {
120
+ const r = ne(t), l = tt(t), a = et(l), u = de(t), c = r === "y", h = o.x + o.width / 2 - i.width / 2, f = o.y + o.height / 2 - i.height / 2, p = o[a] / 2 - i[a] / 2;
121
+ let d;
122
+ switch (u) {
122
123
  case "top":
123
- u = {
124
+ d = {
124
125
  x: h,
125
126
  y: o.y - i.height
126
127
  };
127
128
  break;
128
129
  case "bottom":
129
- u = {
130
+ d = {
130
131
  x: h,
131
132
  y: o.y + o.height
132
133
  };
133
134
  break;
134
135
  case "right":
135
- u = {
136
+ d = {
136
137
  x: o.x + o.width,
137
- y: d
138
+ y: f
138
139
  };
139
140
  break;
140
141
  case "left":
141
- u = {
142
+ d = {
142
143
  x: o.x - i.width,
143
- y: d
144
+ y: f
144
145
  };
145
146
  break;
146
147
  default:
147
- u = {
148
+ d = {
148
149
  x: o.x,
149
150
  y: o.y
150
151
  };
151
152
  }
152
- switch (ye(t)) {
153
+ switch (Me(t)) {
153
154
  case "start":
154
- u[s] -= v * (n && a ? -1 : 1);
155
+ d[l] -= p * (n && c ? -1 : 1);
155
156
  break;
156
157
  case "end":
157
- u[s] += v * (n && a ? -1 : 1);
158
+ d[l] += p * (n && c ? -1 : 1);
158
159
  break;
159
160
  }
160
- return u;
161
+ return d;
161
162
  }
162
- const Gt = async (e, t, n) => {
163
+ const gn = async (e, t, n) => {
163
164
  const {
164
165
  placement: o = "bottom",
165
166
  strategy: i = "absolute",
166
167
  middleware: r = [],
167
- platform: s
168
- } = n, c = r.filter(Boolean), f = await (s.isRTL == null ? void 0 : s.isRTL(t));
169
- let a = await s.getElementRects({
168
+ platform: l
169
+ } = n, a = r.filter(Boolean), u = await (l.isRTL == null ? void 0 : l.isRTL(t));
170
+ let c = await l.getElementRects({
170
171
  reference: e,
171
172
  floating: t,
172
173
  strategy: i
173
174
  }), {
174
175
  x: h,
175
- y: d
176
- } = it(a, o, f), v = o, u = {}, g = 0;
177
- for (let p = 0; p < c.length; p++) {
176
+ y: f
177
+ } = wt(c, o, u), p = o, d = {}, g = 0;
178
+ for (let m = 0; m < a.length; m++) {
178
179
  const {
179
- name: m,
180
- fn: y
181
- } = c[p], {
182
- x,
183
- y: T,
184
- data: w,
185
- reset: L
186
- } = await y({
180
+ name: b,
181
+ fn: w
182
+ } = a[m], {
183
+ x: y,
184
+ y: C,
185
+ data: P,
186
+ reset: E
187
+ } = await w({
187
188
  x: h,
188
- y: d,
189
+ y: f,
189
190
  initialPlacement: o,
190
- placement: v,
191
+ placement: p,
191
192
  strategy: i,
192
- middlewareData: u,
193
- rects: a,
194
- platform: s,
193
+ middlewareData: d,
194
+ rects: c,
195
+ platform: l,
195
196
  elements: {
196
197
  reference: e,
197
198
  floating: t
198
199
  }
199
200
  });
200
- h = x ?? h, d = T ?? d, u = {
201
- ...u,
202
- [m]: {
203
- ...u[m],
204
- ...w
201
+ h = y ?? h, f = C ?? f, d = {
202
+ ...d,
203
+ [b]: {
204
+ ...d[b],
205
+ ...P
205
206
  }
206
- }, L && g <= 50 && (g++, typeof L == "object" && (L.placement && (v = L.placement), L.rects && (a = L.rects === !0 ? await s.getElementRects({
207
+ }, E && g <= 50 && (g++, typeof E == "object" && (E.placement && (p = E.placement), E.rects && (c = E.rects === !0 ? await l.getElementRects({
207
208
  reference: e,
208
209
  floating: t,
209
210
  strategy: i
210
- }) : L.rects), {
211
+ }) : E.rects), {
211
212
  x: h,
212
- y: d
213
- } = it(a, v, f)), p = -1);
213
+ y: f
214
+ } = wt(c, p, u)), m = -1);
214
215
  }
215
216
  return {
216
217
  x: h,
217
- y: d,
218
- placement: v,
218
+ y: f,
219
+ placement: p,
219
220
  strategy: i,
220
- middlewareData: u
221
+ middlewareData: d
221
222
  };
222
223
  };
223
- async function Ce(e, t) {
224
+ async function He(e, t) {
224
225
  var n;
225
226
  t === void 0 && (t = {});
226
227
  const {
227
228
  x: o,
228
229
  y: i,
229
230
  platform: r,
230
- rects: s,
231
- elements: c,
232
- strategy: f
231
+ rects: l,
232
+ elements: a,
233
+ strategy: u
233
234
  } = e, {
234
- boundary: a = "clippingAncestors",
235
+ boundary: c = "clippingAncestors",
235
236
  rootBoundary: h = "viewport",
236
- elementContext: d = "floating",
237
- altBoundary: v = !1,
238
- padding: u = 0
239
- } = ue(t, e), g = xt(u), m = c[v ? d === "floating" ? "reference" : "floating" : d], y = Oe(await r.getClippingRect({
240
- element: (n = await (r.isElement == null ? void 0 : r.isElement(m))) == null || n ? m : m.contextElement || await (r.getDocumentElement == null ? void 0 : r.getDocumentElement(c.floating)),
241
- boundary: a,
237
+ elementContext: f = "floating",
238
+ altBoundary: p = !1,
239
+ padding: d = 0
240
+ } = be(t, e), g = Wt(d), b = a[p ? f === "floating" ? "reference" : "floating" : f], w = Fe(await r.getClippingRect({
241
+ element: (n = await (r.isElement == null ? void 0 : r.isElement(b))) == null || n ? b : b.contextElement || await (r.getDocumentElement == null ? void 0 : r.getDocumentElement(a.floating)),
242
+ boundary: c,
242
243
  rootBoundary: h,
243
- strategy: f
244
- })), x = d === "floating" ? {
244
+ strategy: u
245
+ })), y = f === "floating" ? {
245
246
  x: o,
246
247
  y: i,
247
- width: s.floating.width,
248
- height: s.floating.height
249
- } : s.reference, T = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(c.floating)), w = await (r.isElement == null ? void 0 : r.isElement(T)) ? await (r.getScale == null ? void 0 : r.getScale(T)) || {
248
+ width: l.floating.width,
249
+ height: l.floating.height
250
+ } : l.reference, C = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(a.floating)), P = await (r.isElement == null ? void 0 : r.isElement(C)) ? await (r.getScale == null ? void 0 : r.getScale(C)) || {
250
251
  x: 1,
251
252
  y: 1
252
253
  } : {
253
254
  x: 1,
254
255
  y: 1
255
- }, L = Oe(r.convertOffsetParentRelativeRectToViewportRelativeRect ? await r.convertOffsetParentRelativeRectToViewportRelativeRect({
256
- elements: c,
257
- rect: x,
258
- offsetParent: T,
259
- strategy: f
260
- }) : x);
256
+ }, E = Fe(r.convertOffsetParentRelativeRectToViewportRelativeRect ? await r.convertOffsetParentRelativeRectToViewportRelativeRect({
257
+ elements: a,
258
+ rect: y,
259
+ offsetParent: C,
260
+ strategy: u
261
+ }) : y);
261
262
  return {
262
- top: (y.top - L.top + g.top) / w.y,
263
- bottom: (L.bottom - y.bottom + g.bottom) / w.y,
264
- left: (y.left - L.left + g.left) / w.x,
265
- right: (L.right - y.right + g.right) / w.x
263
+ top: (w.top - E.top + g.top) / P.y,
264
+ bottom: (E.bottom - w.bottom + g.bottom) / P.y,
265
+ left: (w.left - E.left + g.left) / P.x,
266
+ right: (E.right - w.right + g.right) / P.x
266
267
  };
267
268
  }
268
- const Jt = (e) => ({
269
+ const wn = (e) => ({
269
270
  name: "arrow",
270
271
  options: e,
271
272
  async fn(t) {
@@ -274,35 +275,35 @@ const Jt = (e) => ({
274
275
  y: o,
275
276
  placement: i,
276
277
  rects: r,
277
- platform: s,
278
- elements: c,
279
- middlewareData: f
278
+ platform: l,
279
+ elements: a,
280
+ middlewareData: u
280
281
  } = t, {
281
- element: a,
282
+ element: c,
282
283
  padding: h = 0
283
- } = ue(e, t) || {};
284
- if (a == null)
284
+ } = be(e, t) || {};
285
+ if (c == null)
285
286
  return {};
286
- const d = xt(h), v = {
287
+ const f = Wt(h), p = {
287
288
  x: n,
288
289
  y: o
289
- }, u = Ue(i), g = Ke(u), p = await s.getDimensions(a), m = u === "y", y = m ? "top" : "left", x = m ? "bottom" : "right", T = m ? "clientHeight" : "clientWidth", w = r.reference[g] + r.reference[u] - v[u] - r.floating[g], L = v[u] - r.reference[u], O = await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(a));
290
- let M = O ? O[T] : 0;
291
- (!M || !await (s.isElement == null ? void 0 : s.isElement(O))) && (M = c.floating[T] || r.floating[g]);
292
- const H = w / 2 - L / 2, b = M / 2 - p[g] / 2 - 1, l = le(d[y], b), k = le(d[x], b), S = l, W = M - p[g] - k, C = M / 2 - p[g] / 2 + H, D = Ye(S, C, W), E = !f.arrow && ye(i) != null && C !== D && r.reference[g] / 2 - (C < S ? l : k) - p[g] / 2 < 0, R = E ? C < S ? C - S : C - W : 0;
290
+ }, d = tt(i), g = et(d), m = await l.getDimensions(c), b = d === "y", w = b ? "top" : "left", y = b ? "bottom" : "right", C = b ? "clientHeight" : "clientWidth", P = r.reference[g] + r.reference[d] - p[d] - r.floating[g], E = p[d] - r.reference[d], T = await (l.getOffsetParent == null ? void 0 : l.getOffsetParent(c));
291
+ let A = T ? T[C] : 0;
292
+ (!A || !await (l.isElement == null ? void 0 : l.isElement(T))) && (A = a.floating[C] || r.floating[g]);
293
+ const D = P / 2 - E / 2, R = A / 2 - m[g] / 2 - 1, N = we(f[w], R), M = we(f[y], R), k = N, V = A - m[g] - M, F = A / 2 - m[g] / 2 + D, Y = Ke(k, F, V), x = !u.arrow && Me(i) != null && F !== Y && r.reference[g] / 2 - (F < k ? N : M) - m[g] / 2 < 0, s = x ? F < k ? F - k : F - V : 0;
293
294
  return {
294
- [u]: v[u] + R,
295
+ [d]: p[d] + s,
295
296
  data: {
296
- [u]: D,
297
- centerOffset: C - D - R,
298
- ...E && {
299
- alignmentOffset: R
297
+ [d]: Y,
298
+ centerOffset: F - Y - s,
299
+ ...x && {
300
+ alignmentOffset: s
300
301
  }
301
302
  },
302
- reset: E
303
+ reset: x
303
304
  };
304
305
  }
305
- }), Qt = function(e) {
306
+ }), yn = function(e) {
306
307
  return e === void 0 && (e = {}), {
307
308
  name: "flip",
308
309
  options: e,
@@ -311,70 +312,72 @@ const Jt = (e) => ({
311
312
  const {
312
313
  placement: i,
313
314
  middlewareData: r,
314
- rects: s,
315
- initialPlacement: c,
316
- platform: f,
317
- elements: a
315
+ rects: l,
316
+ initialPlacement: a,
317
+ platform: u,
318
+ elements: c
318
319
  } = t, {
319
320
  mainAxis: h = !0,
320
- crossAxis: d = !0,
321
- fallbackPlacements: v,
322
- fallbackStrategy: u = "bestFit",
321
+ crossAxis: f = !0,
322
+ fallbackPlacements: p,
323
+ fallbackStrategy: d = "bestFit",
323
324
  fallbackAxisSideDirection: g = "none",
324
- flipAlignment: p = !0,
325
- ...m
326
- } = ue(e, t);
325
+ flipAlignment: m = !0,
326
+ ...b
327
+ } = be(e, t);
327
328
  if ((n = r.arrow) != null && n.alignmentOffset)
328
329
  return {};
329
- const y = te(i), x = ae(c), T = te(c) === c, w = await (f.isRTL == null ? void 0 : f.isRTL(a.floating)), L = v || (T || !p ? [Pe(c)] : _t(c)), O = g !== "none";
330
- !v && O && L.push(...Ut(c, p, g, w));
331
- const M = [c, ...L], H = await Ce(t, m), b = [];
332
- let l = ((o = r.flip) == null ? void 0 : o.overflows) || [];
333
- if (h && b.push(H[y]), d) {
334
- const C = jt(i, s, w);
335
- b.push(H[C[0]], H[C[1]]);
330
+ const w = de(i), y = ne(a), C = de(a) === a, P = await (u.isRTL == null ? void 0 : u.isRTL(c.floating)), E = p || (C || !m ? [ke(a)] : fn(a)), T = g !== "none";
331
+ !p && T && E.push(...pn(a, m, g, P));
332
+ const A = [a, ...E], D = await He(t, b), R = [];
333
+ let N = ((o = r.flip) == null ? void 0 : o.overflows) || [];
334
+ if (h && R.push(D[w]), f) {
335
+ const F = un(i, l, P);
336
+ R.push(D[F[0]], D[F[1]]);
336
337
  }
337
- if (l = [...l, {
338
+ if (N = [...N, {
338
339
  placement: i,
339
- overflows: b
340
- }], !b.every((C) => C <= 0)) {
341
- var k, S;
342
- const C = (((k = r.flip) == null ? void 0 : k.index) || 0) + 1, D = M[C];
343
- if (D)
340
+ overflows: R
341
+ }], !R.every((F) => F <= 0)) {
342
+ var M, k;
343
+ const F = (((M = r.flip) == null ? void 0 : M.index) || 0) + 1, Y = A[F];
344
+ if (Y && (!(f === "alignment" ? y !== ne(Y) : !1) || // We leave the current main axis only if every placement on that axis
345
+ // overflows the main axis.
346
+ N.every((v) => ne(v.placement) === y ? v.overflows[0] > 0 : !0)))
344
347
  return {
345
348
  data: {
346
- index: C,
347
- overflows: l
349
+ index: F,
350
+ overflows: N
348
351
  },
349
352
  reset: {
350
- placement: D
353
+ placement: Y
351
354
  }
352
355
  };
353
- let E = (S = l.filter((R) => R.overflows[0] <= 0).sort((R, F) => R.overflows[1] - F.overflows[1])[0]) == null ? void 0 : S.placement;
354
- if (!E)
355
- switch (u) {
356
+ let x = (k = N.filter((s) => s.overflows[0] <= 0).sort((s, v) => s.overflows[1] - v.overflows[1])[0]) == null ? void 0 : k.placement;
357
+ if (!x)
358
+ switch (d) {
356
359
  case "bestFit": {
357
- var W;
358
- const R = (W = l.filter((F) => {
359
- if (O) {
360
- const $ = ae(F.placement);
361
- return $ === x || // Create a bias to the `y` side axis due to horizontal
360
+ var V;
361
+ const s = (V = N.filter((v) => {
362
+ if (T) {
363
+ const H = ne(v.placement);
364
+ return H === y || // Create a bias to the `y` side axis due to horizontal
362
365
  // reading directions favoring greater width.
363
- $ === "y";
366
+ H === "y";
364
367
  }
365
368
  return !0;
366
- }).map((F) => [F.placement, F.overflows.filter(($) => $ > 0).reduce(($, _) => $ + _, 0)]).sort((F, $) => F[1] - $[1])[0]) == null ? void 0 : W[0];
367
- R && (E = R);
369
+ }).map((v) => [v.placement, v.overflows.filter((H) => H > 0).reduce((H, X) => H + X, 0)]).sort((v, H) => v[1] - H[1])[0]) == null ? void 0 : V[0];
370
+ s && (x = s);
368
371
  break;
369
372
  }
370
373
  case "initialPlacement":
371
- E = c;
374
+ x = a;
372
375
  break;
373
376
  }
374
- if (i !== E)
377
+ if (i !== x)
375
378
  return {
376
379
  reset: {
377
- placement: E
380
+ placement: x
378
381
  }
379
382
  };
380
383
  }
@@ -382,7 +385,7 @@ const Jt = (e) => ({
382
385
  }
383
386
  };
384
387
  };
385
- function st(e, t) {
388
+ function yt(e, t) {
386
389
  return {
387
390
  top: e.top - t.height,
388
391
  right: e.right - t.width,
@@ -390,10 +393,10 @@ function st(e, t) {
390
393
  left: e.left - t.width
391
394
  };
392
395
  }
393
- function rt(e) {
394
- return Vt.some((t) => e[t] >= 0);
396
+ function bt(e) {
397
+ return sn.some((t) => e[t] >= 0);
395
398
  }
396
- const Zt = function(e) {
399
+ const bn = function(e) {
397
400
  return e === void 0 && (e = {}), {
398
401
  name: "hide",
399
402
  options: e,
@@ -403,29 +406,29 @@ const Zt = function(e) {
403
406
  } = t, {
404
407
  strategy: o = "referenceHidden",
405
408
  ...i
406
- } = ue(e, t);
409
+ } = be(e, t);
407
410
  switch (o) {
408
411
  case "referenceHidden": {
409
- const r = await Ce(t, {
412
+ const r = await He(t, {
410
413
  ...i,
411
414
  elementContext: "reference"
412
- }), s = st(r, n.reference);
415
+ }), l = yt(r, n.reference);
413
416
  return {
414
417
  data: {
415
- referenceHiddenOffsets: s,
416
- referenceHidden: rt(s)
418
+ referenceHiddenOffsets: l,
419
+ referenceHidden: bt(l)
417
420
  }
418
421
  };
419
422
  }
420
423
  case "escaped": {
421
- const r = await Ce(t, {
424
+ const r = await He(t, {
422
425
  ...i,
423
426
  altBoundary: !0
424
- }), s = st(r, n.floating);
427
+ }), l = yt(r, n.floating);
425
428
  return {
426
429
  data: {
427
- escapedOffsets: s,
428
- escaped: rt(s)
430
+ escapedOffsets: l,
431
+ escaped: bt(l)
429
432
  }
430
433
  };
431
434
  }
@@ -434,35 +437,35 @@ const Zt = function(e) {
434
437
  }
435
438
  }
436
439
  };
437
- };
438
- async function zt(e, t) {
440
+ }, xn = /* @__PURE__ */ new Set(["left", "top"]);
441
+ async function En(e, t) {
439
442
  const {
440
443
  placement: n,
441
444
  platform: o,
442
445
  elements: i
443
- } = e, r = await (o.isRTL == null ? void 0 : o.isRTL(i.floating)), s = te(n), c = ye(n), f = ae(n) === "y", a = ["left", "top"].includes(s) ? -1 : 1, h = r && f ? -1 : 1, d = ue(t, e);
446
+ } = e, r = await (o.isRTL == null ? void 0 : o.isRTL(i.floating)), l = de(n), a = Me(n), u = ne(n) === "y", c = xn.has(l) ? -1 : 1, h = r && u ? -1 : 1, f = be(t, e);
444
447
  let {
445
- mainAxis: v,
446
- crossAxis: u,
448
+ mainAxis: p,
449
+ crossAxis: d,
447
450
  alignmentAxis: g
448
- } = typeof d == "number" ? {
449
- mainAxis: d,
451
+ } = typeof f == "number" ? {
452
+ mainAxis: f,
450
453
  crossAxis: 0,
451
454
  alignmentAxis: null
452
455
  } : {
453
- mainAxis: d.mainAxis || 0,
454
- crossAxis: d.crossAxis || 0,
455
- alignmentAxis: d.alignmentAxis
456
+ mainAxis: f.mainAxis || 0,
457
+ crossAxis: f.crossAxis || 0,
458
+ alignmentAxis: f.alignmentAxis
456
459
  };
457
- return c && typeof g == "number" && (u = c === "end" ? g * -1 : g), f ? {
458
- x: u * h,
459
- y: v * a
460
+ return a && typeof g == "number" && (d = a === "end" ? g * -1 : g), u ? {
461
+ x: d * h,
462
+ y: p * c
460
463
  } : {
461
- x: v * a,
462
- y: u * h
464
+ x: p * c,
465
+ y: d * h
463
466
  };
464
467
  }
465
- const Bt = function(e) {
468
+ const Tn = function(e) {
466
469
  return e === void 0 && (e = 0), {
467
470
  name: "offset",
468
471
  options: e,
@@ -471,20 +474,20 @@ const Bt = function(e) {
471
474
  const {
472
475
  x: i,
473
476
  y: r,
474
- placement: s,
475
- middlewareData: c
476
- } = t, f = await zt(t, e);
477
- return s === ((n = c.offset) == null ? void 0 : n.placement) && (o = c.arrow) != null && o.alignmentOffset ? {} : {
478
- x: i + f.x,
479
- y: r + f.y,
477
+ placement: l,
478
+ middlewareData: a
479
+ } = t, u = await En(t, e);
480
+ return l === ((n = a.offset) == null ? void 0 : n.placement) && (o = a.arrow) != null && o.alignmentOffset ? {} : {
481
+ x: i + u.x,
482
+ y: r + u.y,
480
483
  data: {
481
- ...f,
482
- placement: s
484
+ ...u,
485
+ placement: l
483
486
  }
484
487
  };
485
488
  }
486
489
  };
487
- }, en = function(e) {
490
+ }, Cn = function(e) {
488
491
  return e === void 0 && (e = {}), {
489
492
  name: "shift",
490
493
  options: e,
@@ -495,92 +498,95 @@ const Bt = function(e) {
495
498
  placement: i
496
499
  } = t, {
497
500
  mainAxis: r = !0,
498
- crossAxis: s = !1,
499
- limiter: c = {
500
- fn: (m) => {
501
+ crossAxis: l = !1,
502
+ limiter: a = {
503
+ fn: (b) => {
501
504
  let {
502
- x: y,
503
- y: x
504
- } = m;
505
+ x: w,
506
+ y
507
+ } = b;
505
508
  return {
506
- x: y,
507
- y: x
509
+ x: w,
510
+ y
508
511
  };
509
512
  }
510
513
  },
511
- ...f
512
- } = ue(e, t), a = {
514
+ ...u
515
+ } = be(e, t), c = {
513
516
  x: n,
514
517
  y: o
515
- }, h = await Ce(t, f), d = ae(te(i)), v = Tt(d);
516
- let u = a[v], g = a[d];
518
+ }, h = await He(t, u), f = ne(de(i)), p = It(f);
519
+ let d = c[p], g = c[f];
517
520
  if (r) {
518
- const m = v === "y" ? "top" : "left", y = v === "y" ? "bottom" : "right", x = u + h[m], T = u - h[y];
519
- u = Ye(x, u, T);
521
+ const b = p === "y" ? "top" : "left", w = p === "y" ? "bottom" : "right", y = d + h[b], C = d - h[w];
522
+ d = Ke(y, d, C);
520
523
  }
521
- if (s) {
522
- const m = d === "y" ? "top" : "left", y = d === "y" ? "bottom" : "right", x = g + h[m], T = g - h[y];
523
- g = Ye(x, g, T);
524
+ if (l) {
525
+ const b = f === "y" ? "top" : "left", w = f === "y" ? "bottom" : "right", y = g + h[b], C = g - h[w];
526
+ g = Ke(y, g, C);
524
527
  }
525
- const p = c.fn({
528
+ const m = a.fn({
526
529
  ...t,
527
- [v]: u,
528
- [d]: g
530
+ [p]: d,
531
+ [f]: g
529
532
  });
530
533
  return {
531
- ...p,
534
+ ...m,
532
535
  data: {
533
- x: p.x - n,
534
- y: p.y - o,
536
+ x: m.x - n,
537
+ y: m.y - o,
535
538
  enabled: {
536
- [v]: r,
537
- [d]: s
539
+ [p]: r,
540
+ [f]: l
538
541
  }
539
542
  }
540
543
  };
541
544
  }
542
545
  };
543
546
  };
544
- function Me() {
547
+ function Be() {
545
548
  return typeof window < "u";
546
549
  }
547
- function fe(e) {
548
- return Lt(e) ? (e.nodeName || "").toLowerCase() : "#document";
550
+ function xe(e) {
551
+ return Vt(e) ? (e.nodeName || "").toLowerCase() : "#document";
549
552
  }
550
- function V(e) {
553
+ function j(e) {
551
554
  var t;
552
555
  return (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) || window;
553
556
  }
554
- function q(e) {
557
+ function Q(e) {
555
558
  var t;
556
- return (t = (Lt(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : t.documentElement;
559
+ return (t = (Vt(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : t.documentElement;
557
560
  }
558
- function Lt(e) {
559
- return Me() ? e instanceof Node || e instanceof V(e).Node : !1;
561
+ function Vt(e) {
562
+ return Be() ? e instanceof Node || e instanceof j(e).Node : !1;
560
563
  }
561
- function X(e) {
562
- return Me() ? e instanceof Element || e instanceof V(e).Element : !1;
564
+ function _(e) {
565
+ return Be() ? e instanceof Element || e instanceof j(e).Element : !1;
563
566
  }
564
- function U(e) {
565
- return Me() ? e instanceof HTMLElement || e instanceof V(e).HTMLElement : !1;
567
+ function G(e) {
568
+ return Be() ? e instanceof HTMLElement || e instanceof j(e).HTMLElement : !1;
566
569
  }
567
- function lt(e) {
568
- return !Me() || typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof V(e).ShadowRoot;
570
+ function xt(e) {
571
+ return !Be() || typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof j(e).ShadowRoot;
569
572
  }
570
- function be(e) {
573
+ const Ln = /* @__PURE__ */ new Set(["inline", "contents"]);
574
+ function Se(e) {
571
575
  const {
572
576
  overflow: t,
573
577
  overflowX: n,
574
578
  overflowY: o,
575
579
  display: i
576
- } = j(e);
577
- return /auto|scroll|overlay|hidden|clip/.test(t + o + n) && !["inline", "contents"].includes(i);
580
+ } = z(e);
581
+ return /auto|scroll|overlay|hidden|clip/.test(t + o + n) && !Ln.has(i);
578
582
  }
579
- function tn(e) {
580
- return ["table", "td", "th"].includes(fe(e));
583
+ const Pn = /* @__PURE__ */ new Set(["table", "td", "th"]);
584
+ function On(e) {
585
+ return Pn.has(xe(e));
581
586
  }
582
- function Ae(e) {
583
- return [":popover-open", ":modal"].some((t) => {
587
+ const Mn = [":popover-open", ":modal"];
588
+ function Ie(e) {
589
+ return Mn.some((t) => {
584
590
  try {
585
591
  return e.matches(t);
586
592
  } catch {
@@ -588,32 +594,34 @@ function Ae(e) {
588
594
  }
589
595
  });
590
596
  }
591
- function qe(e) {
592
- const t = Ge(), n = X(e) ? j(e) : e;
593
- return ["transform", "translate", "scale", "rotate", "perspective"].some((o) => n[o] ? n[o] !== "none" : !1) || (n.containerType ? n.containerType !== "normal" : !1) || !t && (n.backdropFilter ? n.backdropFilter !== "none" : !1) || !t && (n.filter ? n.filter !== "none" : !1) || ["transform", "translate", "scale", "rotate", "perspective", "filter"].some((o) => (n.willChange || "").includes(o)) || ["paint", "layout", "strict", "content"].some((o) => (n.contain || "").includes(o));
597
+ const Sn = ["transform", "translate", "scale", "rotate", "perspective"], An = ["transform", "translate", "scale", "rotate", "perspective", "filter"], Nn = ["paint", "layout", "strict", "content"];
598
+ function nt(e) {
599
+ const t = ot(), n = _(e) ? z(e) : e;
600
+ return Sn.some((o) => n[o] ? n[o] !== "none" : !1) || (n.containerType ? n.containerType !== "normal" : !1) || !t && (n.backdropFilter ? n.backdropFilter !== "none" : !1) || !t && (n.filter ? n.filter !== "none" : !1) || An.some((o) => (n.willChange || "").includes(o)) || Nn.some((o) => (n.contain || "").includes(o));
594
601
  }
595
- function nn(e) {
596
- let t = J(e);
597
- for (; U(t) && !ce(t); ) {
598
- if (qe(t))
602
+ function Dn(e) {
603
+ let t = oe(e);
604
+ for (; G(t) && !ye(t); ) {
605
+ if (nt(t))
599
606
  return t;
600
- if (Ae(t))
607
+ if (Ie(t))
601
608
  return null;
602
- t = J(t);
609
+ t = oe(t);
603
610
  }
604
611
  return null;
605
612
  }
606
- function Ge() {
613
+ function ot() {
607
614
  return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
608
615
  }
609
- function ce(e) {
610
- return ["html", "body", "#document"].includes(fe(e));
616
+ const Rn = /* @__PURE__ */ new Set(["html", "body", "#document"]);
617
+ function ye(e) {
618
+ return Rn.has(xe(e));
611
619
  }
612
- function j(e) {
613
- return V(e).getComputedStyle(e);
620
+ function z(e) {
621
+ return j(e).getComputedStyle(e);
614
622
  }
615
- function De(e) {
616
- return X(e) ? {
623
+ function We(e) {
624
+ return _(e) ? {
617
625
  scrollLeft: e.scrollLeft,
618
626
  scrollTop: e.scrollTop
619
627
  } : {
@@ -621,186 +629,189 @@ function De(e) {
621
629
  scrollTop: e.scrollY
622
630
  };
623
631
  }
624
- function J(e) {
625
- if (fe(e) === "html")
632
+ function oe(e) {
633
+ if (xe(e) === "html")
626
634
  return e;
627
635
  const t = (
628
636
  // Step into the shadow DOM of the parent of a slotted node.
629
637
  e.assignedSlot || // DOM Element detected.
630
638
  e.parentNode || // ShadowRoot detected.
631
- lt(e) && e.host || // Fallback.
632
- q(e)
639
+ xt(e) && e.host || // Fallback.
640
+ Q(e)
633
641
  );
634
- return lt(t) ? t.host : t;
642
+ return xt(t) ? t.host : t;
635
643
  }
636
- function Pt(e) {
637
- const t = J(e);
638
- return ce(t) ? e.ownerDocument ? e.ownerDocument.body : e.body : U(t) && be(t) ? t : Pt(t);
644
+ function $t(e) {
645
+ const t = oe(e);
646
+ return ye(t) ? e.ownerDocument ? e.ownerDocument.body : e.body : G(t) && Se(t) ? t : $t(t);
639
647
  }
640
- function ne(e, t, n) {
648
+ function Ce(e, t, n) {
641
649
  var o;
642
650
  t === void 0 && (t = []), n === void 0 && (n = !0);
643
- const i = Pt(e), r = i === ((o = e.ownerDocument) == null ? void 0 : o.body), s = V(i);
651
+ const i = $t(e), r = i === ((o = e.ownerDocument) == null ? void 0 : o.body), l = j(i);
644
652
  if (r) {
645
- const c = je(s);
646
- return t.concat(s, s.visualViewport || [], be(i) ? i : [], c && n ? ne(c) : []);
653
+ const a = Je(l);
654
+ return t.concat(l, l.visualViewport || [], Se(i) ? i : [], a && n ? Ce(a) : []);
647
655
  }
648
- return t.concat(i, ne(i, [], n));
656
+ return t.concat(i, Ce(i, [], n));
649
657
  }
650
- function je(e) {
658
+ function Je(e) {
651
659
  return e.parent && Object.getPrototypeOf(e.parent) ? e.frameElement : null;
652
660
  }
653
- function Ot(e) {
654
- const t = j(e);
661
+ function Xt(e) {
662
+ const t = z(e);
655
663
  let n = parseFloat(t.width) || 0, o = parseFloat(t.height) || 0;
656
- const i = U(e), r = i ? e.offsetWidth : n, s = i ? e.offsetHeight : o, c = Le(n) !== r || Le(o) !== s;
657
- return c && (n = r, o = s), {
664
+ const i = G(e), r = i ? e.offsetWidth : n, l = i ? e.offsetHeight : o, a = Re(n) !== r || Re(o) !== l;
665
+ return a && (n = r, o = l), {
658
666
  width: n,
659
667
  height: o,
660
- $: c
668
+ $: a
661
669
  };
662
670
  }
663
- function Je(e) {
664
- return X(e) ? e : e.contextElement;
671
+ function it(e) {
672
+ return _(e) ? e : e.contextElement;
665
673
  }
666
- function se(e) {
667
- const t = Je(e);
668
- if (!U(t))
674
+ function ve(e) {
675
+ const t = it(e);
676
+ if (!G(t))
669
677
  return K(1);
670
678
  const n = t.getBoundingClientRect(), {
671
679
  width: o,
672
680
  height: i,
673
681
  $: r
674
- } = Ot(t);
675
- let s = (r ? Le(n.width) : n.width) / o, c = (r ? Le(n.height) : n.height) / i;
676
- return (!s || !Number.isFinite(s)) && (s = 1), (!c || !Number.isFinite(c)) && (c = 1), {
677
- x: s,
678
- y: c
682
+ } = Xt(t);
683
+ let l = (r ? Re(n.width) : n.width) / o, a = (r ? Re(n.height) : n.height) / i;
684
+ return (!l || !Number.isFinite(l)) && (l = 1), (!a || !Number.isFinite(a)) && (a = 1), {
685
+ x: l,
686
+ y: a
679
687
  };
680
688
  }
681
- const on = /* @__PURE__ */ K(0);
682
- function Ct(e) {
683
- const t = V(e);
684
- return !Ge() || !t.visualViewport ? on : {
689
+ const kn = /* @__PURE__ */ K(0);
690
+ function Yt(e) {
691
+ const t = j(e);
692
+ return !ot() || !t.visualViewport ? kn : {
685
693
  x: t.visualViewport.offsetLeft,
686
694
  y: t.visualViewport.offsetTop
687
695
  };
688
696
  }
689
- function sn(e, t, n) {
690
- return t === void 0 && (t = !1), !n || t && n !== V(e) ? !1 : t;
697
+ function Fn(e, t, n) {
698
+ return t === void 0 && (t = !1), !n || t && n !== j(e) ? !1 : t;
691
699
  }
692
- function oe(e, t, n, o) {
700
+ function he(e, t, n, o) {
693
701
  t === void 0 && (t = !1), n === void 0 && (n = !1);
694
- const i = e.getBoundingClientRect(), r = Je(e);
695
- let s = K(1);
696
- t && (o ? X(o) && (s = se(o)) : s = se(e));
697
- const c = sn(r, n, o) ? Ct(r) : K(0);
698
- let f = (i.left + c.x) / s.x, a = (i.top + c.y) / s.y, h = i.width / s.x, d = i.height / s.y;
702
+ const i = e.getBoundingClientRect(), r = it(e);
703
+ let l = K(1);
704
+ t && (o ? _(o) && (l = ve(o)) : l = ve(e));
705
+ const a = Fn(r, n, o) ? Yt(r) : K(0);
706
+ let u = (i.left + a.x) / l.x, c = (i.top + a.y) / l.y, h = i.width / l.x, f = i.height / l.y;
699
707
  if (r) {
700
- const v = V(r), u = o && X(o) ? V(o) : o;
701
- let g = v, p = je(g);
702
- for (; p && o && u !== g; ) {
703
- const m = se(p), y = p.getBoundingClientRect(), x = j(p), T = y.left + (p.clientLeft + parseFloat(x.paddingLeft)) * m.x, w = y.top + (p.clientTop + parseFloat(x.paddingTop)) * m.y;
704
- f *= m.x, a *= m.y, h *= m.x, d *= m.y, f += T, a += w, g = V(p), p = je(g);
708
+ const p = j(r), d = o && _(o) ? j(o) : o;
709
+ let g = p, m = Je(g);
710
+ for (; m && o && d !== g; ) {
711
+ const b = ve(m), w = m.getBoundingClientRect(), y = z(m), C = w.left + (m.clientLeft + parseFloat(y.paddingLeft)) * b.x, P = w.top + (m.clientTop + parseFloat(y.paddingTop)) * b.y;
712
+ u *= b.x, c *= b.y, h *= b.x, f *= b.y, u += C, c += P, g = j(m), m = Je(g);
705
713
  }
706
714
  }
707
- return Oe({
715
+ return Fe({
708
716
  width: h,
709
- height: d,
710
- x: f,
711
- y: a
717
+ height: f,
718
+ x: u,
719
+ y: c
712
720
  });
713
721
  }
714
- function Qe(e, t) {
715
- const n = De(e).scrollLeft;
716
- return t ? t.left + n : oe(q(e)).left + n;
722
+ function Ve(e, t) {
723
+ const n = We(e).scrollLeft;
724
+ return t ? t.left + n : he(Q(e)).left + n;
717
725
  }
718
- function Mt(e, t, n) {
719
- n === void 0 && (n = !1);
720
- const o = e.getBoundingClientRect(), i = o.left + t.scrollLeft - (n ? 0 : (
721
- // RTL <body> scrollbar.
722
- Qe(e, o)
723
- )), r = o.top + t.scrollTop;
726
+ function jt(e, t) {
727
+ const n = e.getBoundingClientRect(), o = n.left + t.scrollLeft - Ve(e, n), i = n.top + t.scrollTop;
724
728
  return {
725
- x: i,
726
- y: r
729
+ x: o,
730
+ y: i
727
731
  };
728
732
  }
729
- function rn(e) {
733
+ function Hn(e) {
730
734
  let {
731
735
  elements: t,
732
736
  rect: n,
733
737
  offsetParent: o,
734
738
  strategy: i
735
739
  } = e;
736
- const r = i === "fixed", s = q(o), c = t ? Ae(t.floating) : !1;
737
- if (o === s || c && r)
740
+ const r = i === "fixed", l = Q(o), a = t ? Ie(t.floating) : !1;
741
+ if (o === l || a && r)
738
742
  return n;
739
- let f = {
743
+ let u = {
740
744
  scrollLeft: 0,
741
745
  scrollTop: 0
742
- }, a = K(1);
743
- const h = K(0), d = U(o);
744
- if ((d || !d && !r) && ((fe(o) !== "body" || be(s)) && (f = De(o)), U(o))) {
745
- const u = oe(o);
746
- a = se(o), h.x = u.x + o.clientLeft, h.y = u.y + o.clientTop;
746
+ }, c = K(1);
747
+ const h = K(0), f = G(o);
748
+ if ((f || !f && !r) && ((xe(o) !== "body" || Se(l)) && (u = We(o)), G(o))) {
749
+ const d = he(o);
750
+ c = ve(o), h.x = d.x + o.clientLeft, h.y = d.y + o.clientTop;
747
751
  }
748
- const v = s && !d && !r ? Mt(s, f, !0) : K(0);
752
+ const p = l && !f && !r ? jt(l, u) : K(0);
749
753
  return {
750
- width: n.width * a.x,
751
- height: n.height * a.y,
752
- x: n.x * a.x - f.scrollLeft * a.x + h.x + v.x,
753
- y: n.y * a.y - f.scrollTop * a.y + h.y + v.y
754
+ width: n.width * c.x,
755
+ height: n.height * c.y,
756
+ x: n.x * c.x - u.scrollLeft * c.x + h.x + p.x,
757
+ y: n.y * c.y - u.scrollTop * c.y + h.y + p.y
754
758
  };
755
759
  }
756
- function ln(e) {
760
+ function Bn(e) {
757
761
  return Array.from(e.getClientRects());
758
762
  }
759
- function an(e) {
760
- const t = q(e), n = De(e), o = e.ownerDocument.body, i = ee(t.scrollWidth, t.clientWidth, o.scrollWidth, o.clientWidth), r = ee(t.scrollHeight, t.clientHeight, o.scrollHeight, o.clientHeight);
761
- let s = -n.scrollLeft + Qe(e);
762
- const c = -n.scrollTop;
763
- return j(o).direction === "rtl" && (s += ee(t.clientWidth, o.clientWidth) - i), {
763
+ function In(e) {
764
+ const t = Q(e), n = We(e), o = e.ownerDocument.body, i = fe(t.scrollWidth, t.clientWidth, o.scrollWidth, o.clientWidth), r = fe(t.scrollHeight, t.clientHeight, o.scrollHeight, o.clientHeight);
765
+ let l = -n.scrollLeft + Ve(e);
766
+ const a = -n.scrollTop;
767
+ return z(o).direction === "rtl" && (l += fe(t.clientWidth, o.clientWidth) - i), {
764
768
  width: i,
765
769
  height: r,
766
- x: s,
767
- y: c
770
+ x: l,
771
+ y: a
768
772
  };
769
773
  }
770
- function cn(e, t) {
771
- const n = V(e), o = q(e), i = n.visualViewport;
772
- let r = o.clientWidth, s = o.clientHeight, c = 0, f = 0;
774
+ const Et = 25;
775
+ function Wn(e, t) {
776
+ const n = j(e), o = Q(e), i = n.visualViewport;
777
+ let r = o.clientWidth, l = o.clientHeight, a = 0, u = 0;
773
778
  if (i) {
774
- r = i.width, s = i.height;
775
- const a = Ge();
776
- (!a || a && t === "fixed") && (c = i.offsetLeft, f = i.offsetTop);
779
+ r = i.width, l = i.height;
780
+ const h = ot();
781
+ (!h || h && t === "fixed") && (a = i.offsetLeft, u = i.offsetTop);
777
782
  }
783
+ const c = Ve(o);
784
+ if (c <= 0) {
785
+ const h = o.ownerDocument, f = h.body, p = getComputedStyle(f), d = h.compatMode === "CSS1Compat" && parseFloat(p.marginLeft) + parseFloat(p.marginRight) || 0, g = Math.abs(o.clientWidth - f.clientWidth - d);
786
+ g <= Et && (r -= g);
787
+ } else c <= Et && (r += c);
778
788
  return {
779
789
  width: r,
780
- height: s,
781
- x: c,
782
- y: f
790
+ height: l,
791
+ x: a,
792
+ y: u
783
793
  };
784
794
  }
785
- function un(e, t) {
786
- const n = oe(e, !0, t === "fixed"), o = n.top + e.clientTop, i = n.left + e.clientLeft, r = U(e) ? se(e) : K(1), s = e.clientWidth * r.x, c = e.clientHeight * r.y, f = i * r.x, a = o * r.y;
795
+ const Vn = /* @__PURE__ */ new Set(["absolute", "fixed"]);
796
+ function $n(e, t) {
797
+ const n = he(e, !0, t === "fixed"), o = n.top + e.clientTop, i = n.left + e.clientLeft, r = G(e) ? ve(e) : K(1), l = e.clientWidth * r.x, a = e.clientHeight * r.y, u = i * r.x, c = o * r.y;
787
798
  return {
788
- width: s,
789
- height: c,
790
- x: f,
791
- y: a
799
+ width: l,
800
+ height: a,
801
+ x: u,
802
+ y: c
792
803
  };
793
804
  }
794
- function at(e, t, n) {
805
+ function Tt(e, t, n) {
795
806
  let o;
796
807
  if (t === "viewport")
797
- o = cn(e, n);
808
+ o = Wn(e, n);
798
809
  else if (t === "document")
799
- o = an(q(e));
800
- else if (X(t))
801
- o = un(t, n);
810
+ o = In(Q(e));
811
+ else if (_(t))
812
+ o = $n(t, n);
802
813
  else {
803
- const i = Ct(e);
814
+ const i = Yt(e);
804
815
  o = {
805
816
  x: t.x - i.x,
806
817
  y: t.y - i.y,
@@ -808,106 +819,110 @@ function at(e, t, n) {
808
819
  height: t.height
809
820
  };
810
821
  }
811
- return Oe(o);
822
+ return Fe(o);
812
823
  }
813
- function At(e, t) {
814
- const n = J(e);
815
- return n === t || !X(n) || ce(n) ? !1 : j(n).position === "fixed" || At(n, t);
824
+ function _t(e, t) {
825
+ const n = oe(e);
826
+ return n === t || !_(n) || ye(n) ? !1 : z(n).position === "fixed" || _t(n, t);
816
827
  }
817
- function fn(e, t) {
828
+ function Xn(e, t) {
818
829
  const n = t.get(e);
819
830
  if (n)
820
831
  return n;
821
- let o = ne(e, [], !1).filter((c) => X(c) && fe(c) !== "body"), i = null;
822
- const r = j(e).position === "fixed";
823
- let s = r ? J(e) : e;
824
- for (; X(s) && !ce(s); ) {
825
- const c = j(s), f = qe(s);
826
- !f && c.position === "fixed" && (i = null), (r ? !f && !i : !f && c.position === "static" && !!i && ["absolute", "fixed"].includes(i.position) || be(s) && !f && At(e, s)) ? o = o.filter((h) => h !== s) : i = c, s = J(s);
832
+ let o = Ce(e, [], !1).filter((a) => _(a) && xe(a) !== "body"), i = null;
833
+ const r = z(e).position === "fixed";
834
+ let l = r ? oe(e) : e;
835
+ for (; _(l) && !ye(l); ) {
836
+ const a = z(l), u = nt(l);
837
+ !u && a.position === "fixed" && (i = null), (r ? !u && !i : !u && a.position === "static" && !!i && Vn.has(i.position) || Se(l) && !u && _t(e, l)) ? o = o.filter((h) => h !== l) : i = a, l = oe(l);
827
838
  }
828
839
  return t.set(e, o), o;
829
840
  }
830
- function dn(e) {
841
+ function Yn(e) {
831
842
  let {
832
843
  element: t,
833
844
  boundary: n,
834
845
  rootBoundary: o,
835
846
  strategy: i
836
847
  } = e;
837
- const s = [...n === "clippingAncestors" ? Ae(t) ? [] : fn(t, this._c) : [].concat(n), o], c = s[0], f = s.reduce((a, h) => {
838
- const d = at(t, h, i);
839
- return a.top = ee(d.top, a.top), a.right = le(d.right, a.right), a.bottom = le(d.bottom, a.bottom), a.left = ee(d.left, a.left), a;
840
- }, at(t, c, i));
848
+ const l = [...n === "clippingAncestors" ? Ie(t) ? [] : Xn(t, this._c) : [].concat(n), o], a = l[0], u = l.reduce((c, h) => {
849
+ const f = Tt(t, h, i);
850
+ return c.top = fe(f.top, c.top), c.right = we(f.right, c.right), c.bottom = we(f.bottom, c.bottom), c.left = fe(f.left, c.left), c;
851
+ }, Tt(t, a, i));
841
852
  return {
842
- width: f.right - f.left,
843
- height: f.bottom - f.top,
844
- x: f.left,
845
- y: f.top
853
+ width: u.right - u.left,
854
+ height: u.bottom - u.top,
855
+ x: u.left,
856
+ y: u.top
846
857
  };
847
858
  }
848
- function hn(e) {
859
+ function jn(e) {
849
860
  const {
850
861
  width: t,
851
862
  height: n
852
- } = Ot(e);
863
+ } = Xt(e);
853
864
  return {
854
865
  width: t,
855
866
  height: n
856
867
  };
857
868
  }
858
- function pn(e, t, n) {
859
- const o = U(t), i = q(t), r = n === "fixed", s = oe(e, !0, r, t);
860
- let c = {
869
+ function _n(e, t, n) {
870
+ const o = G(t), i = Q(t), r = n === "fixed", l = he(e, !0, r, t);
871
+ let a = {
861
872
  scrollLeft: 0,
862
873
  scrollTop: 0
863
874
  };
864
- const f = K(0);
875
+ const u = K(0);
876
+ function c() {
877
+ u.x = Ve(i);
878
+ }
865
879
  if (o || !o && !r)
866
- if ((fe(t) !== "body" || be(i)) && (c = De(t)), o) {
867
- const v = oe(t, !0, r, t);
868
- f.x = v.x + t.clientLeft, f.y = v.y + t.clientTop;
869
- } else i && (f.x = Qe(i));
870
- const a = i && !o && !r ? Mt(i, c) : K(0), h = s.left + c.scrollLeft - f.x - a.x, d = s.top + c.scrollTop - f.y - a.y;
880
+ if ((xe(t) !== "body" || Se(i)) && (a = We(t)), o) {
881
+ const d = he(t, !0, r, t);
882
+ u.x = d.x + t.clientLeft, u.y = d.y + t.clientTop;
883
+ } else i && c();
884
+ r && !o && i && c();
885
+ const h = i && !o && !r ? jt(i, a) : K(0), f = l.left + a.scrollLeft - u.x - h.x, p = l.top + a.scrollTop - u.y - h.y;
871
886
  return {
872
- x: h,
873
- y: d,
874
- width: s.width,
875
- height: s.height
887
+ x: f,
888
+ y: p,
889
+ width: l.width,
890
+ height: l.height
876
891
  };
877
892
  }
878
- function He(e) {
879
- return j(e).position === "static";
893
+ function _e(e) {
894
+ return z(e).position === "static";
880
895
  }
881
- function ct(e, t) {
882
- if (!U(e) || j(e).position === "fixed")
896
+ function Ct(e, t) {
897
+ if (!G(e) || z(e).position === "fixed")
883
898
  return null;
884
899
  if (t)
885
900
  return t(e);
886
901
  let n = e.offsetParent;
887
- return q(e) === n && (n = n.ownerDocument.body), n;
902
+ return Q(e) === n && (n = n.ownerDocument.body), n;
888
903
  }
889
- function Dt(e, t) {
890
- const n = V(e);
891
- if (Ae(e))
904
+ function zt(e, t) {
905
+ const n = j(e);
906
+ if (Ie(e))
892
907
  return n;
893
- if (!U(e)) {
894
- let i = J(e);
895
- for (; i && !ce(i); ) {
896
- if (X(i) && !He(i))
908
+ if (!G(e)) {
909
+ let i = oe(e);
910
+ for (; i && !ye(i); ) {
911
+ if (_(i) && !_e(i))
897
912
  return i;
898
- i = J(i);
913
+ i = oe(i);
899
914
  }
900
915
  return n;
901
916
  }
902
- let o = ct(e, t);
903
- for (; o && tn(o) && He(o); )
904
- o = ct(o, t);
905
- return o && ce(o) && He(o) && !qe(o) ? n : o || nn(e) || n;
917
+ let o = Ct(e, t);
918
+ for (; o && On(o) && _e(o); )
919
+ o = Ct(o, t);
920
+ return o && ye(o) && _e(o) && !nt(o) ? n : o || Dn(e) || n;
906
921
  }
907
- const mn = async function(e) {
908
- const t = this.getOffsetParent || Dt, n = this.getDimensions, o = await n(e.floating);
922
+ const zn = async function(e) {
923
+ const t = this.getOffsetParent || zt, n = this.getDimensions, o = await n(e.floating);
909
924
  return {
910
- reference: pn(e.reference, await t(e.floating), e.strategy),
925
+ reference: _n(e.reference, await t(e.floating), e.strategy),
911
926
  floating: {
912
927
  x: 0,
913
928
  y: 0,
@@ -916,581 +931,733 @@ const mn = async function(e) {
916
931
  }
917
932
  };
918
933
  };
919
- function vn(e) {
920
- return j(e).direction === "rtl";
921
- }
922
- const gn = {
923
- convertOffsetParentRelativeRectToViewportRelativeRect: rn,
924
- getDocumentElement: q,
925
- getClippingRect: dn,
926
- getOffsetParent: Dt,
927
- getElementRects: mn,
928
- getClientRects: ln,
929
- getDimensions: hn,
930
- getScale: se,
931
- isElement: X,
932
- isRTL: vn
934
+ function Un(e) {
935
+ return z(e).direction === "rtl";
936
+ }
937
+ const qn = {
938
+ convertOffsetParentRelativeRectToViewportRelativeRect: Hn,
939
+ getDocumentElement: Q,
940
+ getClippingRect: Yn,
941
+ getOffsetParent: zt,
942
+ getElementRects: zn,
943
+ getClientRects: Bn,
944
+ getDimensions: jn,
945
+ getScale: ve,
946
+ isElement: _,
947
+ isRTL: Un
933
948
  };
934
- function St(e, t) {
949
+ function Ut(e, t) {
935
950
  return e.x === t.x && e.y === t.y && e.width === t.width && e.height === t.height;
936
951
  }
937
- function wn(e, t) {
952
+ function Kn(e, t) {
938
953
  let n = null, o;
939
- const i = q(e);
954
+ const i = Q(e);
940
955
  function r() {
941
- var c;
942
- clearTimeout(o), (c = n) == null || c.disconnect(), n = null;
956
+ var a;
957
+ clearTimeout(o), (a = n) == null || a.disconnect(), n = null;
943
958
  }
944
- function s(c, f) {
945
- c === void 0 && (c = !1), f === void 0 && (f = 1), r();
946
- const a = e.getBoundingClientRect(), {
959
+ function l(a, u) {
960
+ a === void 0 && (a = !1), u === void 0 && (u = 1), r();
961
+ const c = e.getBoundingClientRect(), {
947
962
  left: h,
948
- top: d,
949
- width: v,
950
- height: u
951
- } = a;
952
- if (c || t(), !v || !u)
963
+ top: f,
964
+ width: p,
965
+ height: d
966
+ } = c;
967
+ if (a || t(), !p || !d)
953
968
  return;
954
- const g = xe(d), p = xe(i.clientWidth - (h + v)), m = xe(i.clientHeight - (d + u)), y = xe(h), T = {
955
- rootMargin: -g + "px " + -p + "px " + -m + "px " + -y + "px",
956
- threshold: ee(0, le(1, f)) || 1
969
+ const g = De(f), m = De(i.clientWidth - (h + p)), b = De(i.clientHeight - (f + d)), w = De(h), C = {
970
+ rootMargin: -g + "px " + -m + "px " + -b + "px " + -w + "px",
971
+ threshold: fe(0, we(1, u)) || 1
957
972
  };
958
- let w = !0;
959
- function L(O) {
960
- const M = O[0].intersectionRatio;
961
- if (M !== f) {
962
- if (!w)
963
- return s();
964
- M ? s(!1, M) : o = setTimeout(() => {
965
- s(!1, 1e-7);
973
+ let P = !0;
974
+ function E(T) {
975
+ const A = T[0].intersectionRatio;
976
+ if (A !== u) {
977
+ if (!P)
978
+ return l();
979
+ A ? l(!1, A) : o = setTimeout(() => {
980
+ l(!1, 1e-7);
966
981
  }, 1e3);
967
982
  }
968
- M === 1 && !St(a, e.getBoundingClientRect()) && s(), w = !1;
983
+ A === 1 && !Ut(c, e.getBoundingClientRect()) && l(), P = !1;
969
984
  }
970
985
  try {
971
- n = new IntersectionObserver(L, {
972
- ...T,
986
+ n = new IntersectionObserver(E, {
987
+ ...C,
973
988
  // Handle <iframe>s
974
989
  root: i.ownerDocument
975
990
  });
976
991
  } catch {
977
- n = new IntersectionObserver(L, T);
992
+ n = new IntersectionObserver(E, C);
978
993
  }
979
994
  n.observe(e);
980
995
  }
981
- return s(!0), r;
996
+ return l(!0), r;
982
997
  }
983
- function yn(e, t, n, o) {
998
+ function Gn(e, t, n, o) {
984
999
  o === void 0 && (o = {});
985
1000
  const {
986
1001
  ancestorScroll: i = !0,
987
1002
  ancestorResize: r = !0,
988
- elementResize: s = typeof ResizeObserver == "function",
989
- layoutShift: c = typeof IntersectionObserver == "function",
990
- animationFrame: f = !1
991
- } = o, a = Je(e), h = i || r ? [...a ? ne(a) : [], ...ne(t)] : [];
992
- h.forEach((y) => {
993
- i && y.addEventListener("scroll", n, {
1003
+ elementResize: l = typeof ResizeObserver == "function",
1004
+ layoutShift: a = typeof IntersectionObserver == "function",
1005
+ animationFrame: u = !1
1006
+ } = o, c = it(e), h = i || r ? [...c ? Ce(c) : [], ...Ce(t)] : [];
1007
+ h.forEach((w) => {
1008
+ i && w.addEventListener("scroll", n, {
994
1009
  passive: !0
995
- }), r && y.addEventListener("resize", n);
1010
+ }), r && w.addEventListener("resize", n);
996
1011
  });
997
- const d = a && c ? wn(a, n) : null;
998
- let v = -1, u = null;
999
- s && (u = new ResizeObserver((y) => {
1000
- let [x] = y;
1001
- x && x.target === a && u && (u.unobserve(t), cancelAnimationFrame(v), v = requestAnimationFrame(() => {
1002
- var T;
1003
- (T = u) == null || T.observe(t);
1012
+ const f = c && a ? Kn(c, n) : null;
1013
+ let p = -1, d = null;
1014
+ l && (d = new ResizeObserver((w) => {
1015
+ let [y] = w;
1016
+ y && y.target === c && d && (d.unobserve(t), cancelAnimationFrame(p), p = requestAnimationFrame(() => {
1017
+ var C;
1018
+ (C = d) == null || C.observe(t);
1004
1019
  })), n();
1005
- }), a && !f && u.observe(a), u.observe(t));
1006
- let g, p = f ? oe(e) : null;
1007
- f && m();
1008
- function m() {
1009
- const y = oe(e);
1010
- p && !St(p, y) && n(), p = y, g = requestAnimationFrame(m);
1020
+ }), c && !u && d.observe(c), d.observe(t));
1021
+ let g, m = u ? he(e) : null;
1022
+ u && b();
1023
+ function b() {
1024
+ const w = he(e);
1025
+ m && !Ut(m, w) && n(), m = w, g = requestAnimationFrame(b);
1011
1026
  }
1012
1027
  return n(), () => {
1013
- var y;
1014
- h.forEach((x) => {
1015
- i && x.removeEventListener("scroll", n), r && x.removeEventListener("resize", n);
1016
- }), d == null || d(), (y = u) == null || y.disconnect(), u = null, f && cancelAnimationFrame(g);
1028
+ var w;
1029
+ h.forEach((y) => {
1030
+ i && y.removeEventListener("scroll", n), r && y.removeEventListener("resize", n);
1031
+ }), f == null || f(), (w = d) == null || w.disconnect(), d = null, u && cancelAnimationFrame(g);
1017
1032
  };
1018
1033
  }
1019
- const Un = Bt, qn = en, Gn = Qt, Jn = Zt, bn = Jt, En = (e, t, n) => {
1034
+ const Oo = Tn, Mo = Cn, So = yn, Ao = bn, Jn = wn, Qn = (e, t, n) => {
1020
1035
  const o = /* @__PURE__ */ new Map(), i = {
1021
- platform: gn,
1036
+ platform: qn,
1022
1037
  ...n
1023
1038
  }, r = {
1024
1039
  ...i.platform,
1025
1040
  _c: o
1026
1041
  };
1027
- return Gt(e, t, {
1042
+ return gn(e, t, {
1028
1043
  ...i,
1029
1044
  platform: r
1030
1045
  });
1031
1046
  };
1032
- function Qn(e, t, n = {}) {
1047
+ function Zn(e) {
1048
+ return {
1049
+ name: "arrow",
1050
+ options: e,
1051
+ fn(t) {
1052
+ const n = S(e.element);
1053
+ return n == null ? {} : Jn({ element: n, padding: e.padding }).fn(t);
1054
+ }
1055
+ };
1056
+ }
1057
+ function Lt(e, t, n = {}) {
1033
1058
  const {
1034
1059
  transform: o = !0,
1035
1060
  middlewares: i,
1036
1061
  autoUpdate: r = !0,
1037
- open: s = G(!1)
1038
- } = n, c = (T) => {
1039
- s.value = T;
1040
- }, f = A(() => P(n.placement) ?? "bottom"), a = A(() => P(n.strategy) ?? "absolute"), h = G(0), d = G(0), v = G(f.value), u = G(a.value), g = We({}), p = G(!1), m = async () => {
1062
+ open: l = U(!1)
1063
+ } = n, a = (E) => {
1064
+ l.value = E;
1065
+ }, u = I(() => S(n.placement) ?? "bottom"), c = I(() => S(n.strategy) ?? "absolute"), h = U(0), f = U(0), p = U(u.value), d = U(c.value), g = qe({}), m = U(!1), b = U(null), w = I(() => {
1066
+ const E = i || [];
1067
+ return b.value && !E.some((A) => A.name === "arrow") ? [...E, Zn({ element: b })] : E;
1068
+ }), y = async () => {
1041
1069
  if (!e.value || !t.value) return;
1042
- const T = await En(e.value, t.value, {
1043
- placement: f.value,
1044
- strategy: a.value,
1045
- middleware: i
1070
+ const E = await Qn(e.value, t.value, {
1071
+ placement: u.value,
1072
+ strategy: c.value,
1073
+ middleware: w.value
1046
1074
  });
1047
- h.value = T.x, d.value = T.y, v.value = T.placement, u.value = T.strategy, g.value = T.middlewareData, p.value = s.value;
1075
+ h.value = E.x, f.value = E.y, p.value = E.placement, d.value = E.strategy, g.value = E.middlewareData, m.value = l.value;
1048
1076
  };
1049
- pe([f, a], () => {
1050
- s.value && m();
1077
+ pe([u, c], () => {
1078
+ l.value && y();
1051
1079
  });
1052
- let y;
1080
+ let C;
1053
1081
  pe(
1054
- [e, t, s],
1055
- ([T, w, L]) => {
1056
- !L || !T || !w || (r && (y = yn(
1082
+ [e, t, l],
1083
+ ([E, T, A]) => {
1084
+ !A || !E || !T || (r && (C = Gn(
1085
+ E,
1057
1086
  T,
1058
- w,
1059
- m,
1087
+ y,
1060
1088
  typeof r == "object" ? r : void 0
1061
- )), B(() => {
1062
- y == null || y(), y = void 0;
1089
+ )), ue(() => {
1090
+ C == null || C(), C = void 0;
1063
1091
  }));
1064
1092
  },
1065
1093
  { immediate: !0 }
1066
- ), re(() => y == null ? void 0 : y()), pe(s, (T) => {
1067
- T || (p.value = !1);
1094
+ ), ge(() => C == null ? void 0 : C()), pe(l, (E) => {
1095
+ E || (m.value = !1);
1068
1096
  });
1069
- const x = G({
1070
- position: a.value,
1097
+ const P = U({
1098
+ position: c.value,
1071
1099
  left: "0",
1072
1100
  top: "0"
1073
1101
  });
1074
1102
  return pe(
1075
- [h, d, () => P(o)],
1076
- ([T, w, L]) => {
1077
- const O = t.value;
1078
- if (!O) return;
1079
- const M = {
1080
- position: u.value,
1103
+ [h, f, () => S(o)],
1104
+ ([E, T, A]) => {
1105
+ const D = t.value;
1106
+ if (!D) return;
1107
+ const R = {
1108
+ position: d.value,
1081
1109
  left: "0",
1082
1110
  top: "0"
1083
- }, H = ut(O, T), b = ut(O, w);
1084
- L ? x.value = {
1085
- ...M,
1086
- transform: `translate(${H}px, ${b}px)`,
1087
- ...Rt(O) >= 1.5 && {
1111
+ }, N = Pt(D, E), M = Pt(D, T);
1112
+ A ? P.value = {
1113
+ ...R,
1114
+ transform: `translate(${N}px, ${M}px)`,
1115
+ ...qt(D) >= 1.5 && {
1088
1116
  "will-change": "transform"
1089
1117
  }
1090
- } : x.value = {
1091
- ...M,
1092
- left: `${H}px`,
1093
- top: `${b}px`
1118
+ } : P.value = {
1119
+ ...R,
1120
+ left: `${N}px`,
1121
+ top: `${M}px`
1094
1122
  };
1095
1123
  },
1096
1124
  { immediate: !0 }
1097
1125
  ), {
1098
1126
  x: h,
1099
- y: d,
1100
- strategy: u,
1101
- placement: v,
1127
+ y: f,
1128
+ strategy: d,
1129
+ placement: p,
1102
1130
  middlewareData: g,
1103
- isPositioned: p,
1104
- floatingStyles: x,
1105
- update: m,
1131
+ isPositioned: m,
1132
+ floatingStyles: P,
1133
+ update: y,
1106
1134
  refs: {
1107
1135
  anchorEl: e,
1108
- floatingEl: t
1136
+ floatingEl: t,
1137
+ arrowEl: b
1109
1138
  },
1110
- open: s,
1111
- setOpen: c
1139
+ open: l,
1140
+ setOpen: a
1112
1141
  };
1113
1142
  }
1114
- function ut(e, t) {
1115
- const n = Rt(e);
1143
+ function Pt(e, t) {
1144
+ const n = qt(e);
1116
1145
  return Math.round(t * n) / n;
1117
1146
  }
1118
- function Rt(e) {
1147
+ function qt(e) {
1119
1148
  return typeof window > "u" ? 1 : (e.ownerDocument.defaultView || window).devicePixelRatio || 1;
1120
1149
  }
1121
- function Zn(e, t = {}) {
1122
- const { middlewareData: n, placement: o } = e, { offset: i = "-4px" } = t, r = A(() => {
1150
+ function No(e, t, n = {}) {
1151
+ const { offset: o = "-4px", padding: i } = n, { middlewareData: r, placement: l, refs: a } = t;
1152
+ pe(e, (f) => {
1153
+ a.arrowEl.value = f;
1154
+ });
1155
+ const u = I(() => {
1123
1156
  var f;
1124
- return ((f = n.value.arrow) == null ? void 0 : f.x) ?? 0;
1125
- }), s = A(() => {
1157
+ return ((f = r.value.arrow) == null ? void 0 : f.x) ?? 0;
1158
+ }), c = I(() => {
1126
1159
  var f;
1127
- return ((f = n.value.arrow) == null ? void 0 : f.y) ?? 0;
1128
- }), c = A(() => {
1129
- const f = P(o).split("-")[0], a = r.value, h = s.value;
1130
- return f === "bottom" ? {
1131
- "inset-inline-start": `${a}px`,
1132
- "inset-block-start": i
1133
- } : f === "top" ? {
1134
- "inset-inline-start": `${a}px`,
1135
- "inset-block-end": i
1136
- } : f === "right" ? {
1137
- "inset-block-start": `${h}px`,
1138
- "inset-inline-start": i
1139
- } : f === "left" ? {
1140
- "inset-block-start": `${h}px`,
1141
- "inset-inline-end": i
1160
+ return ((f = r.value.arrow) == null ? void 0 : f.y) ?? 0;
1161
+ }), h = I(() => {
1162
+ if (!(e.value || a.arrowEl.value) || !r.value.arrow)
1163
+ return {};
1164
+ const p = S(l).split("-")[0], d = u.value, g = c.value;
1165
+ return p === "bottom" ? {
1166
+ "inset-inline-start": `${d}px`,
1167
+ "inset-block-start": o
1168
+ } : p === "top" ? {
1169
+ "inset-inline-start": `${d}px`,
1170
+ "inset-block-end": o
1171
+ } : p === "right" ? {
1172
+ "inset-block-start": `${g}px`,
1173
+ "inset-inline-start": o
1174
+ } : p === "left" ? {
1175
+ "inset-block-start": `${g}px`,
1176
+ "inset-inline-end": o
1142
1177
  } : {};
1143
1178
  });
1144
1179
  return {
1145
- arrowX: r,
1146
- arrowY: s,
1147
- arrowStyles: c
1180
+ arrowX: u,
1181
+ arrowY: c,
1182
+ arrowStyles: h
1148
1183
  };
1149
1184
  }
1150
- let Tn = 0;
1151
- function xn() {
1152
- return `vfloat-id-${Tn++}`;
1185
+ let eo = 0;
1186
+ function to() {
1187
+ return `vfloat-id-${eo++}`;
1153
1188
  }
1154
- function ft(e) {
1189
+ function Ot(e) {
1155
1190
  return typeof e == "object" && e instanceof HTMLElement;
1156
1191
  }
1157
- function Fe(e, t) {
1192
+ function no(e) {
1193
+ return e !== null && typeof e == "object" && "data" in e && "id" in e && "children" in e && "parent" in e;
1194
+ }
1195
+ function rt(e) {
1196
+ return no(e) ? {
1197
+ floatingContext: e.data,
1198
+ treeContext: e
1199
+ } : {
1200
+ floatingContext: e,
1201
+ treeContext: null
1202
+ };
1203
+ }
1204
+ function J(e, t) {
1205
+ if (!t) return !1;
1206
+ if (typeof t == "object" && t !== null && "contextElement" in t) {
1207
+ const n = t.contextElement;
1208
+ return n instanceof Element ? n.contains(e) : !1;
1209
+ }
1210
+ return t instanceof Element ? t.contains(e) : !1;
1211
+ }
1212
+ function st(e, t) {
1213
+ for (const n of e.children.value)
1214
+ if (n.data.open.value) {
1215
+ if (J(t, n.data.refs.anchorEl.value) || J(t, n.data.refs.floatingEl.value))
1216
+ return n;
1217
+ const o = st(n, t);
1218
+ if (o) return o;
1219
+ }
1220
+ return null;
1221
+ }
1222
+ function Qe(e, t) {
1223
+ if (e === void 0) return !1;
1224
+ const n = e === "mouse";
1225
+ return t ? n : n || e === "pen";
1226
+ }
1227
+ function Kt(e) {
1228
+ return !e || !(e instanceof HTMLElement) ? !1 : e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e.isContentEditable && e.contentEditable !== "false";
1229
+ }
1230
+ function Mt(e) {
1231
+ const t = e.target;
1232
+ return t instanceof HTMLElement ? t.tagName === "BUTTON" || t.tagName === "INPUT" && t.getAttribute("type") === "button" || t.getAttribute("role") === "button" : !1;
1233
+ }
1234
+ function St(e) {
1235
+ return Kt(e);
1236
+ }
1237
+ function oo(e) {
1238
+ return e instanceof Element && e instanceof HTMLElement;
1239
+ }
1240
+ function io(e) {
1241
+ return typeof e == "object" && e !== null && "contextElement" in e;
1242
+ }
1243
+ function At(e, t) {
1244
+ return t ? "composedPath" in e && typeof e.composedPath == "function" ? e.composedPath().includes(t) : t.contains(e.target) : !1;
1245
+ }
1246
+ function ro(e, t) {
1247
+ const n = t.getBoundingClientRect(), o = t.offsetWidth - t.clientWidth, i = t.offsetHeight - t.clientHeight, r = e.clientX - n.left, l = e.clientY - n.top;
1248
+ if (o > 0) {
1249
+ const a = t.clientWidth;
1250
+ if (r >= a && r <= t.offsetWidth)
1251
+ return !0;
1252
+ }
1253
+ if (i > 0) {
1254
+ const a = t.clientHeight;
1255
+ if (l >= a && l <= t.offsetHeight)
1256
+ return !0;
1257
+ }
1258
+ return !1;
1259
+ }
1260
+ function Nt() {
1261
+ return typeof navigator > "u" ? !1 : navigator.platform.toUpperCase().indexOf("MAC") >= 0;
1262
+ }
1263
+ function Dt() {
1264
+ return typeof navigator > "u" ? !1 : /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
1265
+ }
1266
+ function so(e) {
1267
+ return typeof (e == null ? void 0 : e.matches) != "function" ? !1 : e.matches(":focus-visible");
1268
+ }
1269
+ function ze(e, t) {
1158
1270
  return e.contains(t);
1159
1271
  }
1160
- function Ln(e) {
1272
+ function lo(e) {
1161
1273
  return e.target;
1162
1274
  }
1163
- function dt(e, t) {
1275
+ function Rt() {
1276
+ return typeof performance < "u" ? performance.now() : Date.now();
1277
+ }
1278
+ function kt(e) {
1279
+ e !== -1 && clearTimeout(e);
1280
+ }
1281
+ function Gt(e) {
1282
+ return e.children.value.some(
1283
+ (t) => t.data.open.value || Gt(t)
1284
+ );
1285
+ }
1286
+ function ao(e, t) {
1287
+ return e[0] >= t.x && e[0] <= t.x + t.width && e[1] >= t.y && e[1] <= t.y + t.height;
1288
+ }
1289
+ function Ft(e, t) {
1164
1290
  const [n, o] = e;
1165
1291
  let i = !1;
1166
1292
  const r = t.length;
1167
- for (let s = 0, c = r - 1; s < r; c = s++) {
1168
- const [f, a] = t[s] || [0, 0], [h, d] = t[c] || [0, 0];
1169
- a >= o != d >= o && n <= (h - f) * (o - a) / (d - a) + f && (i = !i);
1293
+ for (let l = 0, a = r - 1; l < r; a = l++) {
1294
+ const [u, c] = t[l] || [0, 0], [h, f] = t[a] || [0, 0];
1295
+ c >= o != f >= o && n <= (h - u) * (o - c) / (f - c) + u && (i = !i);
1170
1296
  }
1171
1297
  return i;
1172
1298
  }
1173
- function Pn(e, t) {
1174
- return e[0] >= t.x && e[0] <= t.x + t.width && e[1] >= t.y && e[1] <= t.y + t.height;
1175
- }
1176
- function On(e = {}) {
1177
- const { requireIntent: t = !0 } = e;
1178
- let n, o = !1, i = null, r = null, s = performance.now();
1179
- function c(f, a) {
1180
- const h = performance.now(), d = h - s;
1181
- if (i === null || r === null || d === 0)
1182
- return i = f, r = a, s = h, null;
1183
- const v = f - i, u = a - r, p = Math.sqrt(v * v + u * u) / d;
1184
- return i = f, r = a, s = h, p;
1299
+ function co(e = {}) {
1300
+ const { buffer: t = 0.5, blockPointerEvents: n = !1, requireIntent: o = !0 } = e;
1301
+ let i = -1, r = !1;
1302
+ function l(u, c, h, f, p) {
1303
+ const d = Rt(), g = d - p;
1304
+ if (h === null || f === null || g === 0)
1305
+ return {
1306
+ speed: null,
1307
+ lastX: u,
1308
+ lastY: c,
1309
+ lastCursorTime: d
1310
+ };
1311
+ const m = u - h, b = c - f;
1312
+ return {
1313
+ speed: Math.sqrt(m * m + b * b) / g,
1314
+ lastX: u,
1315
+ lastY: c,
1316
+ lastCursorTime: d
1317
+ };
1185
1318
  }
1186
- return function({
1187
- x: a,
1188
- y: h,
1189
- placement: d,
1190
- elements: v,
1191
- buffer: u,
1192
- onClose: g
1193
- }) {
1194
- const p = A(() => {
1195
- const m = v.domReference;
1196
- return ft(m) ? m : (m == null ? void 0 : m.contextElement) ?? null;
1319
+ const a = function(c) {
1320
+ const { x: h, y: f, placement: p, elements: d, buffer: g, onClose: m, nodeId: b, tree: w } = c, y = I(() => {
1321
+ const T = d.domReference;
1322
+ return Ot(T) ? T : (T == null ? void 0 : T.contextElement) ?? null;
1197
1323
  });
1198
- return function(y) {
1199
- var he, Ze, ze, Be, et, tt, nt;
1200
- function x() {
1201
- clearTimeout(n), g();
1324
+ let C = null, P = null, E = Rt();
1325
+ return function(A) {
1326
+ var lt, at, ct, ut, ft, dt, ht;
1327
+ function D() {
1328
+ kt(i), i = -1, m();
1202
1329
  }
1203
- if (clearTimeout(n), !v.domReference || !v.floating || d == null || a == null || h == null)
1330
+ if (kt(i), i = -1, !d.domReference || !d.floating || p == null || h == null || f == null)
1204
1331
  return;
1205
- const { clientX: T, clientY: w } = y, L = Ln(y), O = y.type === "mouseleave", M = v.floating && Fe(v.floating, L), H = p.value && Fe(p.value, L), b = (he = p.value) == null ? void 0 : he.getBoundingClientRect(), l = (Ze = v.floating) == null ? void 0 : Ze.getBoundingClientRect(), k = d.split("-")[0], S = a > ((l == null ? void 0 : l.right) ?? 0) - ((l == null ? void 0 : l.width) ?? 0) / 2, W = h > ((l == null ? void 0 : l.bottom) ?? 0) - ((l == null ? void 0 : l.height) ?? 0) / 2, C = ((l == null ? void 0 : l.width) ?? 0) > ((b == null ? void 0 : b.width) ?? 0), D = ((l == null ? void 0 : l.height) ?? 0) > ((b == null ? void 0 : b.height) ?? 0), E = ((ze = C ? b : l) == null ? void 0 : ze.left) ?? 0, R = ((Be = C ? b : l) == null ? void 0 : Be.right) ?? 0, F = ((et = D ? b : l) == null ? void 0 : et.top) ?? 0, $ = ((tt = D ? b : l) == null ? void 0 : tt.bottom) ?? 0;
1206
- if (M && (o = !0, !O))
1332
+ const { clientX: R, clientY: N } = A, M = [R, N], k = lo(A), V = A.type === "mouseleave", F = d.floating && ze(d.floating, k), Y = y.value && ze(y.value, k), x = (lt = y.value) == null ? void 0 : lt.getBoundingClientRect(), s = (at = d.floating) == null ? void 0 : at.getBoundingClientRect(), v = p.split("-")[0], H = h > ((s == null ? void 0 : s.right) ?? 0) - ((s == null ? void 0 : s.width) ?? 0) / 2, X = f > ((s == null ? void 0 : s.bottom) ?? 0) - ((s == null ? void 0 : s.height) ?? 0) / 2, Z = x ? ao(M, x) : !1, L = ((s == null ? void 0 : s.width) ?? 0) > ((x == null ? void 0 : x.width) ?? 0), W = ((s == null ? void 0 : s.height) ?? 0) > ((x == null ? void 0 : x.height) ?? 0), ie = ((ct = L ? x : s) == null ? void 0 : ct.left) ?? 0, ee = ((ut = L ? x : s) == null ? void 0 : ut.right) ?? 0, re = ((ft = W ? x : s) == null ? void 0 : ft.top) ?? 0, se = ((dt = W ? x : s) == null ? void 0 : dt.bottom) ?? 0;
1333
+ if (F && (r = !0, !V))
1207
1334
  return;
1208
- if (H && (o = !1), H && !O) {
1209
- o = !0;
1335
+ if (Y && (r = !1), Y && !V) {
1336
+ r = !0;
1210
1337
  return;
1211
1338
  }
1212
- if (O && ft(y.relatedTarget) && v.floating && Fe(v.floating, y.relatedTarget))
1339
+ if (V && Ot(A.relatedTarget) && d.floating && ze(d.floating, A.relatedTarget))
1213
1340
  return;
1214
- if (k === "top" && h >= ((b == null ? void 0 : b.bottom) ?? 0) - 1 || k === "bottom" && h <= ((b == null ? void 0 : b.top) ?? 0) + 1 || k === "left" && a >= ((b == null ? void 0 : b.right) ?? 0) - 1 || k === "right" && a <= ((b == null ? void 0 : b.left) ?? 0) + 1)
1215
- return x();
1216
- let _ = [];
1217
- switch (k) {
1341
+ if (w && b) {
1342
+ const B = w.nodes.get(b);
1343
+ if (B && Gt(B))
1344
+ return;
1345
+ }
1346
+ if (v === "top" && f >= ((x == null ? void 0 : x.bottom) ?? 0) - 1 || v === "bottom" && f <= ((x == null ? void 0 : x.top) ?? 0) + 1 || v === "left" && h >= ((x == null ? void 0 : x.right) ?? 0) - 1 || v === "right" && h <= ((x == null ? void 0 : x.left) ?? 0) + 1)
1347
+ return D();
1348
+ let te = [];
1349
+ switch (v) {
1218
1350
  case "top":
1219
- _ = [
1220
- [E, ((b == null ? void 0 : b.top) ?? 0) + 1],
1221
- [E, ((l == null ? void 0 : l.bottom) ?? 0) - 1],
1222
- [R, ((l == null ? void 0 : l.bottom) ?? 0) - 1],
1223
- [R, ((b == null ? void 0 : b.top) ?? 0) + 1]
1351
+ te = [
1352
+ [ie, ((x == null ? void 0 : x.top) ?? 0) + 1],
1353
+ [ie, ((s == null ? void 0 : s.bottom) ?? 0) - 1],
1354
+ [ee, ((s == null ? void 0 : s.bottom) ?? 0) - 1],
1355
+ [ee, ((x == null ? void 0 : x.top) ?? 0) + 1]
1224
1356
  ];
1225
1357
  break;
1226
1358
  case "bottom":
1227
- _ = [
1228
- [E, ((l == null ? void 0 : l.top) ?? 0) + 1],
1229
- [E, ((b == null ? void 0 : b.bottom) ?? 0) - 1],
1230
- [R, ((b == null ? void 0 : b.bottom) ?? 0) - 1],
1231
- [R, ((l == null ? void 0 : l.top) ?? 0) + 1]
1359
+ te = [
1360
+ [ie, ((s == null ? void 0 : s.top) ?? 0) + 1],
1361
+ [ie, ((x == null ? void 0 : x.bottom) ?? 0) - 1],
1362
+ [ee, ((x == null ? void 0 : x.bottom) ?? 0) - 1],
1363
+ [ee, ((s == null ? void 0 : s.top) ?? 0) + 1]
1232
1364
  ];
1233
1365
  break;
1234
1366
  case "left":
1235
- _ = [
1236
- [((l == null ? void 0 : l.right) ?? 0) - 1, $],
1237
- [((l == null ? void 0 : l.right) ?? 0) - 1, F],
1238
- [((b == null ? void 0 : b.left) ?? 0) + 1, F],
1239
- [((b == null ? void 0 : b.left) ?? 0) + 1, $]
1367
+ te = [
1368
+ [((s == null ? void 0 : s.right) ?? 0) - 1, se],
1369
+ [((s == null ? void 0 : s.right) ?? 0) - 1, re],
1370
+ [((x == null ? void 0 : x.left) ?? 0) + 1, re],
1371
+ [((x == null ? void 0 : x.left) ?? 0) + 1, se]
1240
1372
  ];
1241
1373
  break;
1242
1374
  case "right":
1243
- _ = [
1244
- [((b == null ? void 0 : b.right) ?? 0) - 1, $],
1245
- [((b == null ? void 0 : b.right) ?? 0) - 1, F],
1246
- [((l == null ? void 0 : l.left) ?? 0) + 1, F],
1247
- [((l == null ? void 0 : l.left) ?? 0) + 1, $]
1375
+ te = [
1376
+ [((x == null ? void 0 : x.right) ?? 0) - 1, se],
1377
+ [((x == null ? void 0 : x.right) ?? 0) - 1, re],
1378
+ [((s == null ? void 0 : s.left) ?? 0) + 1, re],
1379
+ [((s == null ? void 0 : s.left) ?? 0) + 1, se]
1248
1380
  ];
1249
1381
  break;
1250
1382
  }
1251
- function Ee([N, I]) {
1252
- switch (k) {
1383
+ function Ee([B, $]) {
1384
+ const O = g;
1385
+ switch (v) {
1253
1386
  case "top": {
1254
- const Q = [
1255
- C ? N + u / 2 : S ? N + u * 4 : N - u * 4,
1256
- I + u + 1
1257
- ], Z = [
1258
- C ? N - u / 2 : S ? N + u * 4 : N - u * 4,
1259
- I + u + 1
1260
- ], ie = [
1387
+ const le = [
1388
+ L ? B + O / 2 : H ? B + O * 4 : B - O * 4,
1389
+ $ + O + 1
1390
+ ], ae = [
1391
+ L ? B - O / 2 : H ? B + O * 4 : B - O * 4,
1392
+ $ + O + 1
1393
+ ], me = [
1261
1394
  [
1262
- (l == null ? void 0 : l.left) ?? 0,
1263
- S || C ? ((l == null ? void 0 : l.bottom) ?? 0) - u : (l == null ? void 0 : l.top) ?? 0
1395
+ (s == null ? void 0 : s.left) ?? 0,
1396
+ H || L ? ((s == null ? void 0 : s.bottom) ?? 0) - O : (s == null ? void 0 : s.top) ?? 0
1264
1397
  ],
1265
1398
  [
1266
- (l == null ? void 0 : l.right) ?? 0,
1267
- S ? C ? ((l == null ? void 0 : l.bottom) ?? 0) - u : (l == null ? void 0 : l.top) ?? 0 : ((l == null ? void 0 : l.bottom) ?? 0) - u
1399
+ (s == null ? void 0 : s.right) ?? 0,
1400
+ H ? L ? ((s == null ? void 0 : s.bottom) ?? 0) - O : (s == null ? void 0 : s.top) ?? 0 : ((s == null ? void 0 : s.bottom) ?? 0) - O
1268
1401
  ]
1269
1402
  ];
1270
- return [Q, Z, ...ie];
1403
+ return [le, ae, ...me];
1271
1404
  }
1272
1405
  case "bottom": {
1273
- const Q = [
1274
- C ? N + u / 2 : S ? N + u * 4 : N - u * 4,
1275
- I - u
1276
- ], Z = [
1277
- C ? N - u / 2 : S ? N + u * 4 : N - u * 4,
1278
- I - u
1279
- ], ie = [
1406
+ const le = [
1407
+ L ? B + O / 2 : H ? B + O * 4 : B - O * 4,
1408
+ $ - O
1409
+ ], ae = [
1410
+ L ? B - O / 2 : H ? B + O * 4 : B - O * 4,
1411
+ $ - O
1412
+ ], me = [
1280
1413
  [
1281
- (l == null ? void 0 : l.left) ?? 0,
1282
- S || C ? ((l == null ? void 0 : l.top) ?? 0) + u : (l == null ? void 0 : l.bottom) ?? 0
1414
+ (s == null ? void 0 : s.left) ?? 0,
1415
+ H || L ? ((s == null ? void 0 : s.top) ?? 0) + O : (s == null ? void 0 : s.bottom) ?? 0
1283
1416
  ],
1284
1417
  [
1285
- (l == null ? void 0 : l.right) ?? 0,
1286
- S ? C ? ((l == null ? void 0 : l.top) ?? 0) + u : (l == null ? void 0 : l.bottom) ?? 0 : ((l == null ? void 0 : l.top) ?? 0) + u
1418
+ (s == null ? void 0 : s.right) ?? 0,
1419
+ H ? L ? ((s == null ? void 0 : s.top) ?? 0) + O : (s == null ? void 0 : s.bottom) ?? 0 : ((s == null ? void 0 : s.top) ?? 0) + O
1287
1420
  ]
1288
1421
  ];
1289
- return [Q, Z, ...ie];
1422
+ return [le, ae, ...me];
1290
1423
  }
1291
1424
  case "left": {
1292
- const Q = [
1293
- N + u + 1,
1294
- D ? I + u / 2 : W ? I + u * 4 : I - u * 4
1295
- ], Z = [
1296
- N + u + 1,
1297
- D ? I - u / 2 : W ? I + u * 4 : I - u * 4
1425
+ const le = [
1426
+ B + O + 1,
1427
+ W ? $ + O / 2 : X ? $ + O * 4 : $ - O * 4
1428
+ ], ae = [
1429
+ B + O + 1,
1430
+ W ? $ - O / 2 : X ? $ + O * 4 : $ - O * 4
1298
1431
  ];
1299
1432
  return [...[
1300
1433
  [
1301
- W || D ? ((l == null ? void 0 : l.right) ?? 0) - u : (l == null ? void 0 : l.left) ?? 0,
1302
- (l == null ? void 0 : l.top) ?? 0
1434
+ X || W ? ((s == null ? void 0 : s.right) ?? 0) - O : (s == null ? void 0 : s.left) ?? 0,
1435
+ (s == null ? void 0 : s.top) ?? 0
1303
1436
  ],
1304
1437
  [
1305
- W ? D ? ((l == null ? void 0 : l.right) ?? 0) - u : (l == null ? void 0 : l.left) ?? 0 : ((l == null ? void 0 : l.right) ?? 0) - u,
1306
- (l == null ? void 0 : l.bottom) ?? 0
1438
+ X ? W ? ((s == null ? void 0 : s.right) ?? 0) - O : (s == null ? void 0 : s.left) ?? 0 : ((s == null ? void 0 : s.right) ?? 0) - O,
1439
+ (s == null ? void 0 : s.bottom) ?? 0
1307
1440
  ]
1308
- ], Q, Z];
1441
+ ], le, ae];
1309
1442
  }
1310
1443
  case "right": {
1311
- const Q = [
1312
- N - u,
1313
- D ? I + u / 2 : W ? I + u * 4 : I - u * 4
1314
- ], Z = [
1315
- N - u,
1316
- D ? I - u / 2 : W ? I + u * 4 : I - u * 4
1317
- ], ie = [
1444
+ const le = [
1445
+ B - O,
1446
+ W ? $ + O / 2 : X ? $ + O * 4 : $ - O * 4
1447
+ ], ae = [
1448
+ B - O,
1449
+ W ? $ - O / 2 : X ? $ + O * 4 : $ - O * 4
1450
+ ], me = [
1318
1451
  [
1319
- W || D ? ((l == null ? void 0 : l.left) ?? 0) + u : (l == null ? void 0 : l.right) ?? 0,
1320
- (l == null ? void 0 : l.top) ?? 0
1452
+ X || W ? ((s == null ? void 0 : s.left) ?? 0) + O : (s == null ? void 0 : s.right) ?? 0,
1453
+ (s == null ? void 0 : s.top) ?? 0
1321
1454
  ],
1322
1455
  [
1323
- W ? D ? ((l == null ? void 0 : l.left) ?? 0) + u : (l == null ? void 0 : l.right) ?? 0 : ((l == null ? void 0 : l.left) ?? 0) + u,
1324
- (l == null ? void 0 : l.bottom) ?? 0
1456
+ X ? W ? ((s == null ? void 0 : s.left) ?? 0) + O : (s == null ? void 0 : s.right) ?? 0 : ((s == null ? void 0 : s.left) ?? 0) + O,
1457
+ (s == null ? void 0 : s.bottom) ?? 0
1325
1458
  ]
1326
1459
  ];
1327
- return [Q, Z, ...ie];
1460
+ return [le, ae, ...me];
1328
1461
  }
1329
1462
  }
1330
1463
  }
1331
- if (dt([T, w], _))
1332
- return;
1333
- if (o && b && !Pn([T, w], b))
1334
- return x();
1335
- if (!O && t) {
1336
- const N = c(y.clientX, y.clientY);
1337
- if (N !== null && N < 0.1)
1338
- return x();
1464
+ const Ae = Ee([h, f]);
1465
+ if ((ht = e.onPolygonChange) == null || ht.call(e, Ae), !Ft(M, te)) {
1466
+ if (Ft(M, Ae)) {
1467
+ if (!r && o) {
1468
+ const B = l(
1469
+ A.clientX,
1470
+ A.clientY,
1471
+ C,
1472
+ P,
1473
+ E
1474
+ );
1475
+ C = B.lastX, P = B.lastY, E = B.lastCursorTime, B.speed !== null && B.speed < 0.1 && (i = window.setTimeout(D, 40));
1476
+ }
1477
+ return;
1478
+ }
1479
+ if (r && !Z)
1480
+ return D();
1481
+ D();
1339
1482
  }
1340
- const de = Ee([a, h]);
1341
- (nt = e.onPolygonChange) == null || nt.call(e, de), dt([T, w], de) ? !o && t && (n = window.setTimeout(x, 40)) : x();
1342
1483
  };
1343
1484
  };
1344
- }
1345
- const ht = 10;
1346
- function Cn(e) {
1347
- return e === "mouse" || e === "pen";
1348
- }
1349
- function Mn(e, t, n) {
1350
- const { delay: o } = n, i = A(() => {
1351
- const a = P(o);
1352
- return (typeof a == "number" ? a : a.open) ?? 0;
1353
- }), r = A(() => {
1354
- const a = P(o);
1355
- return (typeof a == "number" ? a : a.close) ?? 0;
1485
+ return a.__options = {
1486
+ blockPointerEvents: n
1487
+ }, a;
1488
+ }
1489
+ const Ht = 10;
1490
+ function uo(e, t, n) {
1491
+ const { delay: o } = n, i = I(() => {
1492
+ const c = S(o);
1493
+ return (typeof c == "number" ? c : c.open) ?? 0;
1494
+ }), r = I(() => {
1495
+ const c = S(o);
1496
+ return (typeof c == "number" ? c : c.close) ?? 0;
1356
1497
  });
1357
- let s, c;
1358
- const f = () => {
1359
- clearTimeout(s), clearTimeout(c);
1498
+ let l, a;
1499
+ const u = () => {
1500
+ clearTimeout(l), clearTimeout(a);
1360
1501
  };
1361
- return re(f), {
1362
- show: (a) => {
1363
- f();
1364
- const h = a ?? i.value;
1365
- h === 0 ? e() : s = setTimeout(e, h);
1502
+ return ge(u), {
1503
+ show: (c) => {
1504
+ u();
1505
+ const h = c ?? i.value;
1506
+ h === 0 ? e() : l = setTimeout(e, h);
1366
1507
  },
1367
- hide: (a) => {
1368
- f();
1369
- const h = a ?? r.value;
1370
- h === 0 ? t() : c = setTimeout(t, h);
1508
+ hide: (c) => {
1509
+ u();
1510
+ const h = c ?? r.value;
1511
+ h === 0 ? t() : a = setTimeout(t, h);
1371
1512
  },
1372
1513
  showDelay: i,
1373
1514
  hideDelay: r,
1374
- clearTimeouts: f
1515
+ clearTimeouts: u
1375
1516
  };
1376
1517
  }
1377
- function zn(e, t = {}) {
1378
- const {
1379
- open: n,
1380
- setOpen: o,
1381
- refs: { anchorEl: i, floatingEl: r }
1382
- } = e, {
1383
- enabled: s = !0,
1518
+ function Do(e, t = {}) {
1519
+ const { floatingContext: n, treeContext: o } = rt(e), {
1520
+ open: i,
1521
+ setOpen: r,
1522
+ refs: { anchorEl: l, floatingEl: a }
1523
+ } = n, {
1524
+ enabled: u = !0,
1384
1525
  delay: c = 0,
1385
- restMs: f = 0,
1386
- mouseOnly: a = !1,
1387
- safePolygon: h = !1
1388
- } = t, d = A(() => P(s)), v = A(() => P(f)), u = A(() => {
1389
- const E = i.value;
1390
- return !E || E instanceof HTMLElement ? E : E.contextElement ?? null;
1391
- }), { hide: g, show: p, showDelay: m, clearTimeouts: y } = Mn(
1526
+ restMs: h = 0,
1527
+ mouseOnly: f = !1,
1528
+ safePolygon: p = !1
1529
+ } = t, d = I(() => S(u)), g = I(() => S(h)), m = I(() => {
1530
+ const v = l.value;
1531
+ return !v || v instanceof HTMLElement ? v : v.contextElement ?? null;
1532
+ }), { hide: b, show: w, showDelay: y, clearTimeouts: C } = uo(
1392
1533
  () => {
1393
- n.value || o(!0);
1534
+ i.value || r(!0);
1394
1535
  },
1395
1536
  () => {
1396
- n.value && o(!1);
1537
+ i.value && r(!1);
1397
1538
  },
1398
1539
  { delay: c }
1399
1540
  );
1400
- let x = null, T;
1401
- const w = A(() => m.value === 0 && v.value > 0);
1402
- function L(E) {
1403
- if (!d.value || !H(E) || !w.value || !x) return;
1404
- const R = { x: E.clientX, y: E.clientY }, F = Math.abs(R.x - x.x), $ = Math.abs(R.y - x.y);
1405
- (F > ht || $ > ht) && (x = R, clearTimeout(T), T = setTimeout(() => {
1406
- p(0);
1407
- }, v.value));
1541
+ let P = null, E;
1542
+ const T = I(() => y.value === 0 && g.value > 0);
1543
+ function A(v) {
1544
+ if (!d.value || !N(v) || !T.value || !P) return;
1545
+ const H = { x: v.clientX, y: v.clientY }, X = Math.abs(H.x - P.x), Z = Math.abs(H.y - P.y);
1546
+ (X > Ht || Z > Ht) && (P = H, clearTimeout(E), E = setTimeout(() => {
1547
+ w(0);
1548
+ }, g.value));
1408
1549
  }
1409
- function O(E) {
1410
- !d.value || !H(E) || !w.value || (x = { x: E.clientX, y: E.clientY }, T = setTimeout(() => {
1411
- p(0);
1412
- }, v.value));
1550
+ function D(v) {
1551
+ !d.value || !N(v) || !T.value || (P = { x: v.clientX, y: v.clientY }, E = setTimeout(() => {
1552
+ w(0);
1553
+ }, g.value));
1413
1554
  }
1414
- function M() {
1415
- clearTimeout(T), x = null;
1555
+ function R() {
1556
+ clearTimeout(E), P = null;
1416
1557
  }
1417
- me(() => {
1418
- const E = u.value;
1419
- !E || !d.value || !w.value || (E.addEventListener("pointerenter", O), E.addEventListener("pointermove", L), E.addEventListener("pointerleave", M), B(() => {
1420
- E.removeEventListener("pointerenter", O), E.removeEventListener("pointermove", L), E.removeEventListener("pointerleave", M);
1558
+ Te(() => {
1559
+ const v = m.value;
1560
+ !v || !d.value || !T.value || (v.addEventListener("pointerenter", D), v.addEventListener("pointermove", A), v.addEventListener("pointerleave", R), ue(() => {
1561
+ v.removeEventListener("pointerenter", D), v.removeEventListener("pointermove", A), v.removeEventListener("pointerleave", R);
1421
1562
  }));
1422
- }), re(() => {
1423
- clearTimeout(T);
1563
+ }), ge(() => {
1564
+ clearTimeout(E);
1424
1565
  });
1425
- function H(E) {
1426
- return !(P(a) && !Cn(E.pointerType));
1566
+ function N(v) {
1567
+ return S(f) ? v.pointerType === "mouse" : !0;
1427
1568
  }
1428
- function b(E) {
1429
- !d.value || !H(E) || w.value || p();
1569
+ function M(v) {
1570
+ !d.value || !N(v) || T.value || (F(), w());
1430
1571
  }
1431
- function l(E) {
1432
- !d.value || !H(E) || (y(), S());
1572
+ function k(v) {
1573
+ !d.value || !N(v) || (C(), F());
1433
1574
  }
1434
- let k = null;
1435
- function S() {
1436
- k && (document.removeEventListener("pointermove", k), k = null);
1575
+ let V = null;
1576
+ function F() {
1577
+ V && (document.removeEventListener("pointermove", V), V = null);
1578
+ const v = x.value;
1579
+ v != null && v.onPolygonChange && v.onPolygonChange([]);
1437
1580
  }
1438
- const W = A(() => !!P(h)), C = A(() => {
1439
- const E = P(h);
1440
- if (typeof E == "object" && E) return E;
1441
- if (E === !0) return {};
1581
+ const Y = I(() => !!S(p)), x = I(() => {
1582
+ const v = S(p);
1583
+ if (typeof v == "object" && v) return v;
1584
+ if (v === !0) return {};
1442
1585
  });
1443
- function D(E) {
1444
- var _;
1445
- if (!d.value || !H(E)) return;
1446
- const { clientX: R, clientY: F } = E, $ = E.relatedTarget;
1447
- W.value ? setTimeout(() => {
1448
- var he;
1449
- S();
1450
- const Ee = u.value, de = r.value;
1451
- if (!Ee || !de) {
1452
- g();
1453
- return;
1454
- }
1455
- k = On(C.value)({
1456
- x: R,
1457
- y: F,
1458
- placement: e.placement.value,
1459
- elements: {
1460
- domReference: Ee,
1461
- floating: de
1462
- },
1463
- buffer: ((he = C.value) == null ? void 0 : he.buffer) ?? 1,
1464
- onClose: () => {
1465
- S(), g();
1586
+ function s(v) {
1587
+ var L;
1588
+ if (!d.value || !N(v)) return;
1589
+ const { clientX: H, clientY: X } = v, Z = v.relatedTarget;
1590
+ if (Y.value)
1591
+ setTimeout(() => {
1592
+ var se;
1593
+ F();
1594
+ const W = m.value, ie = a.value;
1595
+ if (!W || !ie) {
1596
+ b();
1597
+ return;
1466
1598
  }
1467
- }), document.addEventListener("pointermove", k);
1468
- }, 0) : (_ = r.value) != null && _.contains($) || g();
1599
+ let ee, re;
1600
+ if (o) {
1601
+ ee = /* @__PURE__ */ new Map();
1602
+ const te = (Ee) => {
1603
+ ee.set(Ee.id, Ee);
1604
+ for (const Ae of Ee.children.value)
1605
+ te(Ae);
1606
+ };
1607
+ te(o), re = o.id;
1608
+ }
1609
+ V = co(x.value)({
1610
+ x: H,
1611
+ y: X,
1612
+ placement: n.placement.value,
1613
+ elements: {
1614
+ domReference: W,
1615
+ floating: ie
1616
+ },
1617
+ buffer: ((se = x.value) == null ? void 0 : se.buffer) ?? 1,
1618
+ onClose: () => {
1619
+ F(), b();
1620
+ },
1621
+ nodeId: re,
1622
+ tree: ee ? { nodes: ee } : void 0
1623
+ }), V && document.addEventListener("pointermove", V);
1624
+ }, 0);
1625
+ else {
1626
+ if (o) {
1627
+ if (!fo(o, Z))
1628
+ return;
1629
+ } else if ((L = a.value) != null && L.contains(Z))
1630
+ return;
1631
+ b();
1632
+ }
1469
1633
  }
1470
- me(() => {
1471
- const E = u.value;
1472
- !E || !d.value || (E.addEventListener("pointerenter", b), E.addEventListener("pointerleave", D), B(() => {
1473
- E.removeEventListener("pointerenter", b), E.removeEventListener("pointerleave", D);
1634
+ Te(() => {
1635
+ const v = m.value;
1636
+ !v || !d.value || (v.addEventListener("pointerenter", M), v.addEventListener("pointerleave", s), ue(() => {
1637
+ v.removeEventListener("pointerenter", M), v.removeEventListener("pointerleave", s);
1474
1638
  }));
1475
- }), me(() => {
1476
- const E = r.value;
1477
- !E || !d.value || (E.addEventListener("pointerenter", l), E.addEventListener("pointerleave", D), B(() => {
1478
- E.removeEventListener("pointerenter", l), E.removeEventListener("pointerleave", D);
1639
+ }), Te(() => {
1640
+ const v = a.value;
1641
+ !v || !d.value || (v.addEventListener("pointerenter", k), v.addEventListener("pointerleave", s), ue(() => {
1642
+ v.removeEventListener("pointerenter", k), v.removeEventListener("pointerleave", s);
1479
1643
  }));
1480
- }), re(() => {
1481
- S();
1644
+ }), ge(() => {
1645
+ F();
1482
1646
  });
1483
1647
  }
1484
- function An(e) {
1485
- return Ht() ? (re(e), !0) : !1;
1648
+ function fo(e, t) {
1649
+ return t ? !(J(t, e.data.refs.anchorEl.value) || J(t, e.data.refs.floatingEl.value) || st(e, t)) : !0;
1486
1650
  }
1487
- const Dn = typeof window < "u" && typeof document < "u";
1651
+ function ho(e) {
1652
+ return en() ? (ge(e), !0) : !1;
1653
+ }
1654
+ const mo = typeof window < "u" && typeof document < "u";
1488
1655
  typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
1489
- const Sn = Object.prototype.toString, Rn = (e) => Sn.call(e) === "[object Object]";
1490
- function $e(e) {
1656
+ const po = Object.prototype.toString, vo = (e) => po.call(e) === "[object Object]";
1657
+ function Ue(e) {
1491
1658
  return Array.isArray(e) ? e : [e];
1492
1659
  }
1493
- function Nn(e, t, n) {
1660
+ function go(e, t, n) {
1494
1661
  return pe(
1495
1662
  e,
1496
1663
  t,
@@ -1500,354 +1667,334 @@ function Nn(e, t, n) {
1500
1667
  }
1501
1668
  );
1502
1669
  }
1503
- const kn = Dn ? window : void 0;
1504
- function Hn(e) {
1670
+ const wo = mo ? window : void 0;
1671
+ function yo(e) {
1505
1672
  var t;
1506
- const n = P(e);
1673
+ const n = S(e);
1507
1674
  return (t = n == null ? void 0 : n.$el) != null ? t : n;
1508
1675
  }
1509
- function Y(...e) {
1676
+ function q(...e) {
1510
1677
  const t = [], n = () => {
1511
- t.forEach((c) => c()), t.length = 0;
1512
- }, o = (c, f, a, h) => (c.addEventListener(f, a, h), () => c.removeEventListener(f, a, h)), i = A(() => {
1513
- const c = $e(P(e[0])).filter((f) => f != null);
1514
- return c.every((f) => typeof f != "string") ? c : void 0;
1515
- }), r = Nn(
1678
+ t.forEach((a) => a()), t.length = 0;
1679
+ }, o = (a, u, c, h) => (a.addEventListener(u, c, h), () => a.removeEventListener(u, c, h)), i = I(() => {
1680
+ const a = Ue(S(e[0])).filter((u) => u != null);
1681
+ return a.every((u) => typeof u != "string") ? a : void 0;
1682
+ }), r = go(
1516
1683
  () => {
1517
- var c, f;
1684
+ var a, u;
1518
1685
  return [
1519
- (f = (c = i.value) == null ? void 0 : c.map((a) => Hn(a))) != null ? f : [kn].filter((a) => a != null),
1520
- $e(P(i.value ? e[1] : e[0])),
1521
- $e(Ft(i.value ? e[2] : e[1])),
1686
+ (u = (a = i.value) == null ? void 0 : a.map((c) => yo(c))) != null ? u : [wo].filter((c) => c != null),
1687
+ Ue(S(i.value ? e[1] : e[0])),
1688
+ Ue(tn(i.value ? e[2] : e[1])),
1522
1689
  // @ts-expect-error - TypeScript gets the correct types, but somehow still complains
1523
- P(i.value ? e[3] : e[2])
1690
+ S(i.value ? e[3] : e[2])
1524
1691
  ];
1525
1692
  },
1526
- ([c, f, a, h]) => {
1527
- if (n(), !(c != null && c.length) || !(f != null && f.length) || !(a != null && a.length))
1693
+ ([a, u, c, h]) => {
1694
+ if (n(), !(a != null && a.length) || !(u != null && u.length) || !(c != null && c.length))
1528
1695
  return;
1529
- const d = Rn(h) ? { ...h } : h;
1696
+ const f = vo(h) ? { ...h } : h;
1530
1697
  t.push(
1531
- ...c.flatMap(
1532
- (v) => f.flatMap(
1533
- (u) => a.map((g) => o(v, u, g, d))
1698
+ ...a.flatMap(
1699
+ (p) => u.flatMap(
1700
+ (d) => c.map((g) => o(p, d, g, f))
1534
1701
  )
1535
1702
  )
1536
1703
  );
1537
1704
  },
1538
1705
  { flush: "post" }
1539
- ), s = () => {
1706
+ ), l = () => {
1540
1707
  r(), n();
1541
1708
  };
1542
- return An(n), s;
1543
- }
1544
- function Bn(e, t = {}) {
1545
- const {
1546
- open: n,
1547
- setOpen: o,
1548
- refs: { floatingEl: i, anchorEl: r }
1549
- } = e, { enabled: s = !0, requireFocusVisible: c = !0 } = t, f = A(() => r.value ? r.value instanceof HTMLElement ? r.value : r.value.contextElement : null);
1550
- let a = !1, h = !0, d;
1551
- Y(window, "blur", () => {
1552
- !n.value && f.value && f.value === document.activeElement && (a = !0);
1553
- }), Y(window, "focus", () => {
1554
- a = !1;
1555
- }), $t(() => {
1556
- pt() && mt() && (Y(
1709
+ return ho(n), l;
1710
+ }
1711
+ function Ro(e, t = {}) {
1712
+ const { floatingContext: n, treeContext: o } = rt(e), {
1713
+ open: i,
1714
+ setOpen: r,
1715
+ refs: { floatingEl: l, anchorEl: a }
1716
+ } = n, { enabled: u = !0, requireFocusVisible: c = !0 } = t, h = I(() => a.value ? a.value instanceof HTMLElement ? a.value : a.value.contextElement : null);
1717
+ let f = !1, p = !0, d;
1718
+ q(window, "blur", () => {
1719
+ !i.value && h.value && h.value === document.activeElement && (f = !0);
1720
+ }), q(window, "focus", () => {
1721
+ f = !1;
1722
+ }), nn(() => {
1723
+ Nt() && Dt() && (q(
1557
1724
  window,
1558
1725
  "keydown",
1559
1726
  () => {
1560
- h = !0;
1727
+ p = !0;
1561
1728
  },
1562
1729
  { capture: !0 }
1563
- ), Y(
1730
+ ), q(
1564
1731
  window,
1565
1732
  "pointerdown",
1566
1733
  () => {
1567
- h = !1;
1734
+ p = !1;
1568
1735
  },
1569
1736
  { capture: !0 }
1570
1737
  ));
1571
1738
  });
1572
- function v(g) {
1573
- if (a) {
1574
- a = !1;
1739
+ function g(b) {
1740
+ if (f) {
1741
+ f = !1;
1575
1742
  return;
1576
1743
  }
1577
- const p = g.target;
1578
- if (P(c) && p) {
1579
- if (pt() && mt() && !g.relatedTarget) {
1580
- if (!h && !Fn(p))
1744
+ const w = b.target;
1745
+ if (S(c) && w) {
1746
+ if (Nt() && Dt() && !b.relatedTarget) {
1747
+ if (!p && !Kt(w))
1581
1748
  return;
1582
- } else if (!$n(p))
1749
+ } else if (!so(w))
1583
1750
  return;
1584
1751
  }
1585
- o(!0);
1752
+ r(!0);
1586
1753
  }
1587
- function u(g) {
1754
+ function m(b) {
1588
1755
  clearTimeout(d), d = window.setTimeout(() => {
1589
- var y;
1590
- const m = (((y = f.value) == null ? void 0 : y.ownerDocument) ?? document).activeElement;
1591
- !g.relatedTarget && m === f.value || i.value && m && i.value.contains(m) || o(!1);
1756
+ var C;
1757
+ const y = (((C = h.value) == null ? void 0 : C.ownerDocument) ?? document).activeElement;
1758
+ if (!(!b.relatedTarget && y === h.value)) {
1759
+ if (o) {
1760
+ if (y && bo(o, y))
1761
+ return;
1762
+ } else if (l.value && y && l.value.contains(y))
1763
+ return;
1764
+ r(!1);
1765
+ }
1592
1766
  }, 0);
1593
1767
  }
1594
- me(() => {
1595
- if (!P(s)) return;
1596
- const g = f.value;
1597
- !g || !(g instanceof HTMLElement) || (g.addEventListener("focus", v), g.addEventListener("blur", u), B(() => {
1598
- g.removeEventListener("focus", v), g.removeEventListener("blur", u);
1768
+ Te(() => {
1769
+ if (!S(u)) return;
1770
+ const b = h.value;
1771
+ !b || !(b instanceof HTMLElement) || (b.addEventListener("focus", g), b.addEventListener("blur", m), ue(() => {
1772
+ b.removeEventListener("focus", g), b.removeEventListener("blur", m);
1599
1773
  }));
1600
- }), re(() => {
1774
+ }), ge(() => {
1601
1775
  clearTimeout(d);
1602
1776
  });
1603
1777
  }
1604
- function pt() {
1605
- return navigator.platform.toUpperCase().indexOf("MAC") >= 0;
1778
+ function bo(e, t) {
1779
+ return J(t, e.data.refs.anchorEl.value) || J(t, e.data.refs.floatingEl.value) ? !0 : Jt(e, t) !== null;
1606
1780
  }
1607
- function mt() {
1608
- return /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
1609
- }
1610
- function Fn(e) {
1611
- return e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement;
1612
- }
1613
- function $n(e) {
1614
- return e.matches(":focus-visible");
1781
+ function Jt(e, t) {
1782
+ for (const n of e.children.value)
1783
+ if (n.data.open.value) {
1784
+ if (J(t, n.data.refs.anchorEl.value) || J(t, n.data.refs.floatingEl.value))
1785
+ return n;
1786
+ const o = Jt(n, t);
1787
+ if (o) return o;
1788
+ }
1789
+ return null;
1615
1790
  }
1616
- function eo(e, t = {}) {
1617
- const { open: n, setOpen: o, refs: i } = e, {
1618
- enabled: r = !0,
1619
- event: s = "click",
1791
+ function ko(e, t = {}) {
1792
+ const { floatingContext: n, treeContext: o } = rt(e), { open: i, setOpen: r, refs: l } = n, {
1793
+ enabled: a = !0,
1794
+ event: u = "click",
1620
1795
  toggle: c = !0,
1621
- ignoreMouse: f = !1,
1622
- keyboardHandlers: a = !0
1796
+ ignoreMouse: h = !1,
1797
+ ignoreKeyboard: f = !1,
1798
+ ignoreTouch: p = !1,
1799
+ // Outside click options
1800
+ outsideClick: d = !1,
1801
+ outsideEvent: g = "pointerdown",
1802
+ outsideCapture: m = !0,
1803
+ onOutsideClick: b,
1804
+ preventScrollbarClick: w = !0,
1805
+ handleDragEvents: y = !0
1623
1806
  } = t;
1624
- let h, d = !1;
1625
- const v = A(() => P(r)), u = A(
1626
- () => i.anchorEl.value instanceof HTMLElement ? i.anchorEl.value : null
1627
- );
1628
- function g() {
1629
- n.value ? P(c) && o(!1) : o(!0);
1807
+ let C, P = !1, E = !1, T = !1;
1808
+ const A = I(() => S(a)), D = I(() => S(d)), R = I(() => {
1809
+ const L = l.anchorEl.value;
1810
+ return L ? L instanceof HTMLElement ? L : io(L) && L.contextElement instanceof HTMLElement ? L.contextElement : null : null;
1811
+ }), N = I(() => l.floatingEl.value);
1812
+ function M() {
1813
+ T = !0;
1814
+ try {
1815
+ i.value ? S(c) && r(!1) : r(!0);
1816
+ } finally {
1817
+ Promise.resolve().then(() => {
1818
+ T = !1;
1819
+ });
1820
+ }
1630
1821
  }
1631
- function p(w) {
1632
- h = w.pointerType;
1822
+ function k() {
1823
+ C = void 0, P = !1, E = !1;
1633
1824
  }
1634
- function m(w) {
1635
- if (w.button !== 0 || P(s) === "click" || vt(h) && P(f)) return;
1636
- const L = w.target;
1637
- !n.value && L === u.value && w.preventDefault(), g();
1825
+ function V(L) {
1826
+ C = L.pointerType;
1638
1827
  }
1639
- function y() {
1640
- if (P(s) === "mousedown" && h) {
1641
- h = void 0;
1828
+ function F(L) {
1829
+ L.button === 0 && S(u) !== "click" && (Z(C) || M());
1830
+ }
1831
+ function Y() {
1832
+ if (S(u) === "mousedown" && C) {
1833
+ k();
1642
1834
  return;
1643
1835
  }
1644
- if (vt(h) && P(f)) {
1645
- h = void 0;
1836
+ if (Z(C)) {
1837
+ k();
1646
1838
  return;
1647
1839
  }
1648
- g(), h = void 0;
1840
+ M(), k();
1649
1841
  }
1650
- function x(w) {
1651
- if (h = void 0, w.defaultPrevented || !P(a) || gt(w))
1842
+ function x(L) {
1843
+ if (C = void 0, L.defaultPrevented || S(f) || Mt(L))
1652
1844
  return;
1653
- const L = u.value;
1654
- L && (w.key === " " && !wt(L) && (w.preventDefault(), d = !0), w.key === "Enter" && g());
1845
+ const W = R.value;
1846
+ W && (L.key === " " && !St(W) && (L.preventDefault(), P = !0), L.key === "Enter" && M());
1655
1847
  }
1656
- function T(w) {
1657
- const L = u.value;
1658
- L && (w.defaultPrevented || !P(a) || gt(w) || wt(L) || w.key === " " && d && (d = !1, g()));
1848
+ function s(L) {
1849
+ const W = R.value;
1850
+ W && (L.defaultPrevented || S(f) || Mt(L) || St(W) || L.key === " " && P && (P = !1, M()));
1659
1851
  }
1660
- me(() => {
1661
- const w = u.value;
1662
- !v.value || !w || (w.addEventListener("pointerdown", p), w.addEventListener("mousedown", m), w.addEventListener("click", y), w.addEventListener("keydown", x), w.addEventListener("keyup", T), B(() => {
1663
- w.removeEventListener("pointerdown", p), w.removeEventListener("mousedown", m), w.removeEventListener("click", y), w.removeEventListener("keydown", x), w.removeEventListener("keyup", T);
1664
- }));
1665
- });
1666
- }
1667
- function vt(e, t) {
1668
- return e === void 0 ? !1 : e === "mouse";
1669
- }
1670
- function gt(e) {
1671
- return e.target instanceof HTMLElement && e.target.tagName === "BUTTON";
1672
- }
1673
- function In(e) {
1674
- return e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLElement && e.isContentEditable;
1675
- }
1676
- function wt(e) {
1677
- return In(e);
1678
- }
1679
- function to(e, t = {}) {
1680
- const {
1681
- enabled: n = !0,
1682
- escapeKey: o = !0,
1683
- outsidePress: i = !0,
1684
- outsidePressEvent: r = "pointerdown",
1685
- anchorPress: s = !1,
1686
- anchorPressEvent: c = "pointerdown",
1687
- ancestorScroll: f = !1,
1688
- capture: a
1689
- } = t, h = A(() => P(n)), d = e.refs.floatingEl, v = A(() => {
1690
- const w = e.refs.anchorEl.value;
1691
- return w ? w instanceof HTMLElement ? w : w.contextElement instanceof HTMLElement ? w.contextElement : null : null;
1692
- }), { isComposing: u } = Yn(), { escapeKey: g, outsidePress: p } = Wn(a);
1693
- let m = !1;
1694
- const y = (w) => {
1695
- !h.value || !e.open.value || !P(o) || w.key !== "Escape" || u() || e.setOpen(!1);
1696
- }, x = (w) => {
1697
- if (!h.value || !e.open.value)
1852
+ function v(L) {
1853
+ if (!A.value || !D.value || !i.value)
1698
1854
  return;
1699
- if (r === "click" && m) {
1700
- m = !1;
1855
+ if (S(g) === "click" && S(y) && E) {
1856
+ E = !1;
1701
1857
  return;
1702
1858
  }
1703
- const L = P(i);
1704
- if (!L || typeof L == "function" && !L(w))
1705
- return;
1706
- const O = w.target;
1707
- O && (Ie(O) && d.value && Vn(w, O) || yt(w, v.value) || yt(w, d.value) || e.setOpen(!1));
1708
- }, T = () => {
1709
- h.value && e.open.value && P(s) && e.setOpen(!1);
1710
- };
1711
- Ve((w) => {
1712
- if (!h.value || !e.open.value || !P(f))
1859
+ if (T)
1713
1860
  return;
1714
- const L = () => {
1715
- e.open.value && e.setOpen(!1);
1716
- }, O = [];
1717
- v.value && O.push(...ne(v.value).filter(Ie)), d.value && O.push(...ne(d.value).filter(Ie));
1718
- for (const M of O)
1719
- M.addEventListener("scroll", L, { passive: !0 });
1720
- w(() => {
1721
- for (const M of O)
1722
- M.removeEventListener("scroll", L);
1723
- });
1724
- }), Y(document, "keydown", y, P(g)), Y(document, r, x, P(p)), Y(v, c, T), Y(
1725
- d,
1861
+ const W = L.target;
1862
+ if (W && !(S(w) && oo(W) && N.value && ro(L, W))) {
1863
+ if (o) {
1864
+ if (!xo(o, W))
1865
+ return;
1866
+ } else if (At(L, R.value) || At(L, N.value))
1867
+ return;
1868
+ b ? b(L, n) : r(!1);
1869
+ }
1870
+ }
1871
+ function H() {
1872
+ E = !0;
1873
+ }
1874
+ function X() {
1875
+ setTimeout(() => {
1876
+ E = !1;
1877
+ }, 0);
1878
+ }
1879
+ function Z(L) {
1880
+ return !!(Qe(L, !0) && S(h) || L === "touch" && S(p));
1881
+ }
1882
+ Te(() => {
1883
+ const L = R.value;
1884
+ !A.value || !L || (L.addEventListener("pointerdown", V), L.addEventListener("mousedown", F), L.addEventListener("click", Y), L.addEventListener("keydown", x), L.addEventListener("keyup", s), ue(() => {
1885
+ L.removeEventListener("pointerdown", V), L.removeEventListener("mousedown", F), L.removeEventListener("click", Y), L.removeEventListener("keydown", x), L.removeEventListener("keyup", s), k();
1886
+ }));
1887
+ }), q(
1888
+ () => A.value && D.value ? document : null,
1889
+ () => S(g),
1890
+ v,
1891
+ { capture: S(m) }
1892
+ ), q(
1893
+ () => A.value && D.value && S(y) ? N.value : null,
1726
1894
  "mousedown",
1727
- () => {
1728
- m = !0;
1729
- },
1895
+ H,
1730
1896
  { capture: !0 }
1731
- ), Y(
1732
- d,
1897
+ ), q(
1898
+ () => A.value && D.value && S(y) ? N.value : null,
1733
1899
  "mouseup",
1734
- () => {
1735
- m = !0;
1736
- },
1900
+ X,
1737
1901
  { capture: !0 }
1738
1902
  );
1739
1903
  }
1740
- function Wn(e) {
1741
- return {
1742
- escapeKey: typeof e == "boolean" ? e : (e == null ? void 0 : e.escapeKey) ?? !1,
1743
- outsidePress: typeof e == "boolean" ? e : (e == null ? void 0 : e.outsidePress) ?? !0
1744
- };
1745
- }
1746
- function Ie(e) {
1747
- return e instanceof Element && e instanceof HTMLElement;
1748
- }
1749
- function yt(e, t) {
1750
- return t ? "composedPath" in e && typeof e.composedPath == "function" ? e.composedPath().includes(t) : t.contains(e.target) : !1;
1751
- }
1752
- function Vn(e, t) {
1753
- const n = t.offsetWidth - t.clientWidth, o = t.offsetHeight - t.clientHeight;
1754
- return n > 0 && e.clientX > t.clientWidth || o > 0 && e.clientY > t.clientHeight;
1904
+ function xo(e, t) {
1905
+ return !(J(t, e.data.refs.anchorEl.value) || J(t, e.data.refs.floatingEl.value) || st(e, t));
1755
1906
  }
1756
- function Yn() {
1757
- const e = G(!1);
1758
- return Y(document, "compositionstart", () => {
1759
- e.value = !0;
1760
- }), Y(document, "compositionend", () => {
1761
- e.value = !1;
1762
- }), {
1763
- isComposing: () => e.value
1764
- };
1765
- }
1766
- function no(e, t, n = {}) {
1907
+ function Fo(e, t, n = {}) {
1767
1908
  const { open: o, refs: i } = t;
1768
1909
  let r;
1769
- const s = G({ x: null, y: null }), c = A(() => P(n.axis ?? "both")), f = A(() => P(n.enabled ?? !0)), a = A(() => P(n.x ?? null)), h = A(() => P(n.y ?? null)), d = (p, m) => {
1770
- s.value = {
1771
- x: p,
1772
- y: m
1773
- }, o.value && (i.anchorEl.value = Xn(
1910
+ const l = U({ x: null, y: null }), a = I(() => S(n.axis ?? "both")), u = I(() => S(n.enabled ?? !0)), c = I(() => S(n.x ?? null)), h = I(() => S(n.y ?? null)), f = (m, b) => {
1911
+ l.value = {
1912
+ x: m,
1913
+ y: b
1914
+ }, o.value && (i.anchorEl.value = Eo(
1774
1915
  e.value,
1775
- c.value,
1776
- s.value
1916
+ a.value,
1917
+ l.value
1777
1918
  ));
1778
1919
  };
1779
- Ve(() => {
1780
- const p = a.value, m = h.value;
1781
- f.value && p != null && m != null && d(p, m);
1920
+ pt(() => {
1921
+ const m = c.value, b = h.value;
1922
+ u.value && m != null && b != null && f(m, b);
1782
1923
  });
1783
- const v = (p) => {
1784
- r = p.pointerType, d(p.clientX, p.clientY);
1785
- }, u = (p) => {
1786
- r = p.pointerType, !o.value && bt(r, !0) && d(p.clientX, p.clientY);
1787
- }, g = (p) => {
1788
- o.value && bt(r, !0) && d(p.clientX, p.clientY);
1924
+ const p = (m) => {
1925
+ r = m.pointerType, f(m.clientX, m.clientY);
1926
+ }, d = (m) => {
1927
+ r = m.pointerType, !o.value && Qe(r, !0) && f(m.clientX, m.clientY);
1928
+ }, g = (m) => {
1929
+ o.value && Qe(r, !0) && f(m.clientX, m.clientY);
1789
1930
  };
1790
- return Ve(() => {
1791
- if (a.value != null || h.value != null) return;
1792
- const p = e.value;
1793
- !p || !f.value || (p.addEventListener("pointerenter", u), p.addEventListener("pointerdown", v), p.addEventListener("pointermove", g), B(() => {
1794
- p == null || p.removeEventListener("pointerenter", u), p == null || p.removeEventListener("pointerdown", v), p == null || p.removeEventListener("pointermove", g);
1931
+ return pt(() => {
1932
+ if (c.value != null || h.value != null) return;
1933
+ const m = e.value;
1934
+ !m || !u.value || (m.addEventListener("pointerenter", d), m.addEventListener("pointerdown", p), m.addEventListener("pointermove", g), ue(() => {
1935
+ m == null || m.removeEventListener("pointerenter", d), m == null || m.removeEventListener("pointerdown", p), m == null || m.removeEventListener("pointermove", g);
1795
1936
  }));
1796
1937
  }), {
1797
- coordinates: It(s),
1798
- updatePosition: d
1938
+ coordinates: on(l),
1939
+ updatePosition: f
1799
1940
  };
1800
1941
  }
1801
- function Xn(e, t, n) {
1942
+ function Eo(e, t, n) {
1802
1943
  let o = null, i = null;
1803
1944
  const r = e;
1804
1945
  return {
1805
1946
  contextElement: r || void 0,
1806
1947
  getBoundingClientRect: () => {
1807
- const s = (r == null ? void 0 : r.getBoundingClientRect()) ?? {
1948
+ const l = (r == null ? void 0 : r.getBoundingClientRect()) ?? {
1808
1949
  width: 0,
1809
1950
  height: 0,
1810
1951
  x: 0,
1811
1952
  y: 0
1812
- }, c = t === "x" || t === "both", f = t === "y" || t === "both";
1813
- let a = 0, h = 0, d = s.x, v = s.y;
1814
- return r && (o == null && n.x != null && c && (o = s.x - n.x), i == null && n.y != null && f && (i = s.y - n.y), d -= o || 0, v -= i || 0), c && n.x != null ? d = n.x : (o = null, a = s.width), f && n.y != null ? v = n.y : (i = null, h = s.height), t === "both" && (a = 0, h = 0), {
1815
- width: a,
1953
+ }, a = t === "x" || t === "both", u = t === "y" || t === "both";
1954
+ let c = 0, h = 0, f = l.x, p = l.y;
1955
+ return r && (o == null && n.x != null && a && (o = l.x - n.x), i == null && n.y != null && u && (i = l.y - n.y), f -= o || 0, p -= i || 0), a && n.x != null ? f = n.x : (o = null, c = l.width), u && n.y != null ? p = n.y : (i = null, h = l.height), t === "both" && (c = 0, h = 0), {
1956
+ width: c,
1816
1957
  height: h,
1817
- x: d,
1818
- y: v,
1819
- top: v,
1820
- right: d + a,
1821
- bottom: v + h,
1822
- left: d
1958
+ x: f,
1959
+ y: p,
1960
+ top: p,
1961
+ right: f + c,
1962
+ bottom: p + h,
1963
+ left: f
1823
1964
  };
1824
1965
  }
1825
1966
  };
1826
1967
  }
1827
- function bt(e, t) {
1828
- if (e === void 0) return !1;
1829
- const n = e === "mouse";
1830
- return t ? n : n || e === "pen";
1968
+ function Ho(e) {
1969
+ const { enabled: t = !0, onEscape: n, capture: o } = e, { isComposing: i } = To();
1970
+ q(
1971
+ document,
1972
+ "keydown",
1973
+ (r) => {
1974
+ r.key !== "Escape" || !S(t) || i() || n(r);
1975
+ },
1976
+ o
1977
+ );
1831
1978
  }
1832
- function oo(e) {
1833
- return {
1834
- name: "arrow",
1835
- options: e,
1836
- fn(t) {
1837
- const n = P(e.element);
1838
- return n == null ? {} : bn({ element: n, padding: e.padding }).fn(t);
1839
- }
1979
+ function To() {
1980
+ const e = U(!1);
1981
+ return q(document, "compositionstart", () => {
1982
+ e.value = !0;
1983
+ }), q(document, "compositionend", () => {
1984
+ e.value = !1;
1985
+ }), {
1986
+ isComposing: () => e.value
1840
1987
  };
1841
1988
  }
1842
- var ve;
1843
- class Et {
1989
+ var Le;
1990
+ class Bt {
1844
1991
  constructor(t, n = null, o = {}, i = !1) {
1845
- z(this, "id");
1846
- z(this, "data");
1847
- z(this, "parent");
1848
- z(this, "children");
1849
- Te(this, ve);
1850
- this.id = o.id ?? xn(), this.data = t, this.parent = We(n), this.children = We([]), Ne(this, ve, i);
1992
+ ce(this, "id");
1993
+ ce(this, "data");
1994
+ ce(this, "parent");
1995
+ ce(this, "children");
1996
+ Ne(this, Le);
1997
+ this.id = o.id ?? to(), this.data = t, this.parent = qe(n), this.children = qe([]), Ye(this, Le, i);
1851
1998
  }
1852
1999
  /**
1853
2000
  * Adds an existing node instance to this node's children array.
@@ -1918,16 +2065,16 @@ class Et {
1918
2065
  }
1919
2066
  /** Checks if the node is the true root of the tree, distinct from an orphaned node. */
1920
2067
  get isRoot() {
1921
- return Re(this, ve);
2068
+ return Xe(this, Le);
1922
2069
  }
1923
2070
  /** Checks if the node is a leaf node (has no children). */
1924
2071
  get isLeaf() {
1925
2072
  return this.children.value.length === 0;
1926
2073
  }
1927
2074
  }
1928
- ve = new WeakMap();
1929
- var ge, we, _e;
1930
- class jn {
2075
+ Le = new WeakMap();
2076
+ var Pe, Oe, Ze;
2077
+ class Co {
1931
2078
  /**
1932
2079
  * Creates a new Tree instance.
1933
2080
  * @param initialRootData Data for the root node.
@@ -1940,13 +2087,13 @@ class jn {
1940
2087
  * ```
1941
2088
  */
1942
2089
  constructor(t, n) {
1943
- Te(this, we);
2090
+ Ne(this, Oe);
1944
2091
  /** The root node of the tree. */
1945
- z(this, "root");
2092
+ ce(this, "root");
1946
2093
  /** Readonly reactive map of node IDs to TreeNode instances for quick lookups. */
1947
- z(this, "nodeMap");
1948
- Te(this, ge);
1949
- Ne(this, ge, (n == null ? void 0 : n.deleteStrategy) ?? "recursive"), this.nodeMap = Wt(/* @__PURE__ */ new Map()), this.root = new Et(t, null, {}, !0), this.nodeMap.set(this.root.id, this.root);
2094
+ ce(this, "nodeMap");
2095
+ Ne(this, Pe);
2096
+ Ye(this, Pe, (n == null ? void 0 : n.deleteStrategy) ?? "recursive"), this.nodeMap = rn(/* @__PURE__ */ new Map()), this.root = new Bt(t, null, {}, !0), this.nodeMap.set(this.root.id, this.root);
1950
2097
  }
1951
2098
  /**
1952
2099
  * Finds a node anywhere in the tree by its ID.
@@ -1968,7 +2115,7 @@ class jn {
1968
2115
  if (!i)
1969
2116
  return console.error(`Tree addNode: Parent node with ID ${n} not found.`), null;
1970
2117
  o.id && this.nodeMap.has(o.id) && (o.id = void 0);
1971
- const r = new Et(t, i, o);
2118
+ const r = new Bt(t, i, o);
1972
2119
  return this.nodeMap.set(r.id, r), i.addChild(r), r;
1973
2120
  }
1974
2121
  /**
@@ -1979,17 +2126,17 @@ class jn {
1979
2126
  * @returns True if the node was successfully removed, false otherwise.
1980
2127
  */
1981
2128
  removeNode(t, n) {
1982
- const o = n ?? Re(this, ge), i = this.findNodeById(t);
2129
+ const o = n ?? Xe(this, Pe), i = this.findNodeById(t);
1983
2130
  if (!i)
1984
2131
  return !1;
1985
2132
  if (i.isRoot)
1986
2133
  return console.error("Tree removeNode: Cannot remove the root node."), !1;
1987
2134
  const r = i.parent.value;
1988
2135
  if (o === "recursive")
1989
- ke(this, we, _e).call(this, i);
2136
+ je(this, Oe, Ze).call(this, i);
1990
2137
  else {
1991
- for (const s of i.children.value)
1992
- s.parent.value = null;
2138
+ for (const l of i.children.value)
2139
+ l.parent.value = null;
1993
2140
  i.children.value = [], this.nodeMap.delete(i.id);
1994
2141
  }
1995
2142
  return r._removeChildInstance(i);
@@ -2038,16 +2185,16 @@ class jn {
2038
2185
  for (; i.length > 0; ) {
2039
2186
  const r = i.pop();
2040
2187
  o.push(r);
2041
- for (let s = r.children.value.length - 1; s >= 0; s--)
2042
- i.push(r.children.value[s]);
2188
+ for (let l = r.children.value.length - 1; l >= 0; l--)
2189
+ i.push(r.children.value[l]);
2043
2190
  }
2044
2191
  } else {
2045
2192
  const i = [n];
2046
2193
  for (; i.length > 0; ) {
2047
2194
  const r = i.shift();
2048
2195
  o.push(r);
2049
- for (const s of r.children.value)
2050
- i.push(s);
2196
+ for (const l of r.children.value)
2197
+ i.push(l);
2051
2198
  }
2052
2199
  }
2053
2200
  return o;
@@ -2062,117 +2209,137 @@ class jn {
2062
2209
  this.nodeMap.clear();
2063
2210
  }
2064
2211
  }
2065
- ge = new WeakMap(), we = new WeakSet(), // --- Internal Recursive Helper for Deletion/Cleanup ---
2066
- _e = function(t) {
2212
+ Pe = new WeakMap(), Oe = new WeakSet(), // --- Internal Recursive Helper for Deletion/Cleanup ---
2213
+ Ze = function(t) {
2067
2214
  const n = [...t.children.value];
2068
2215
  for (const o of n)
2069
- ke(this, we, _e).call(this, o);
2216
+ je(this, Oe, Ze).call(this, o);
2070
2217
  this.nodeMap.delete(t.id), t.children.value = [];
2071
2218
  };
2072
- function io(e, t = {}) {
2073
- const n = new jn(e, t);
2219
+ function Bo(e, t, n = {}, o = {}) {
2220
+ const { parentId: i, ...r } = n, l = Lt(e, t, r), a = new Co(l, o);
2074
2221
  return {
2075
2222
  // Wrap original Tree methods in arrow functions to preserve context
2076
2223
  get nodeMap() {
2077
- return n.nodeMap;
2224
+ return a.nodeMap;
2078
2225
  },
2079
2226
  get root() {
2080
- return n.root;
2227
+ return a.root;
2081
2228
  },
2082
- findNodeById: (s) => n.findNodeById(s),
2083
- moveNode: (s, c) => n.moveNode(s, c),
2084
- dispose: () => n.dispose(),
2085
- addNode: (s, c) => n.addNode(s, c),
2086
- removeNode: (s, c) => n.removeNode(s, c),
2087
- traverse: (s, c) => n.traverse(s, c),
2088
- isTopmost: (s) => {
2089
- const c = n.findNodeById(s);
2090
- if (!c || !c.data.open.value)
2091
- return !1;
2092
- let f = c.parent.value;
2093
- for (; f; ) {
2094
- if (f.data.open.value)
2095
- return !1;
2096
- f = f.parent.value;
2097
- }
2098
- return !0;
2229
+ findNodeById: (w) => a.findNodeById(w),
2230
+ moveNode: (w, y) => a.moveNode(w, y),
2231
+ dispose: () => {
2232
+ a.dispose();
2099
2233
  },
2234
+ addNode: (w, y, C = {}) => {
2235
+ const { parentId: P, ...E } = C, T = Lt(w, y, E);
2236
+ return a.addNode(T, P);
2237
+ },
2238
+ removeNode: (w, y) => a.removeNode(w, y),
2239
+ traverse: (w, y) => a.traverse(w, y),
2100
2240
  getAllOpenNodes: () => {
2101
- const s = [];
2102
- for (const c of n.nodeMap.values())
2103
- c.data.open.value && s.push(c);
2104
- return s;
2241
+ const w = [];
2242
+ for (const y of a.nodeMap.values())
2243
+ y.data.open.value && w.push(y);
2244
+ return w;
2245
+ },
2246
+ getTopmostOpenNode: () => {
2247
+ let w = null, y = -1;
2248
+ for (const C of a.nodeMap.values())
2249
+ if (C.data.open.value) {
2250
+ const P = C.getPath().length;
2251
+ P > y && (y = P, w = C);
2252
+ }
2253
+ return w;
2105
2254
  },
2106
- forEach: (s, c, f = {}) => {
2107
- const { relationship: a = "self-and-children", applyToMatching: h = !0 } = f, d = n.findNodeById(s);
2108
- if (!d)
2255
+ forEach: (w, y, C = {}) => {
2256
+ const { relationship: P = "self-and-children", applyToMatching: E = !0 } = C, T = a.findNodeById(w);
2257
+ if (!T)
2109
2258
  return;
2110
- const v = [], u = /* @__PURE__ */ new Set(), g = (m) => {
2111
- m && !u.has(m.id) && (v.push(m), u.add(m.id));
2112
- }, p = (m) => {
2113
- for (const y of m)
2114
- g(y);
2259
+ const A = [], D = /* @__PURE__ */ new Set(), R = (M) => {
2260
+ M && !D.has(M.id) && (A.push(M), D.add(M.id));
2261
+ }, N = (M) => {
2262
+ for (const k of M)
2263
+ R(k);
2115
2264
  };
2116
- if (a === "ancestors-only")
2117
- for (const m of d.getPath())
2118
- m.id !== d.id && g(m);
2119
- else if (a === "siblings-only") {
2120
- if (d.parent.value)
2121
- for (const m of d.parent.value.children.value)
2122
- m.id !== d.id && g(m);
2123
- } else if (a === "descendants-only")
2124
- for (const m of n.traverse("dfs", d))
2125
- m.id !== d.id && g(m);
2126
- else if (a === "children-only")
2127
- p(d.children.value);
2128
- else if (a === "self-and-ancestors")
2129
- p(d.getPath());
2130
- else if (a === "self-and-children")
2131
- g(d), p(d.children.value);
2132
- else if (a === "self-and-descendants")
2133
- p(n.traverse("dfs", d));
2134
- else if (a === "self-and-siblings")
2135
- g(d), d.parent.value && p(d.parent.value.children.value);
2136
- else if (a === "self-ancestors-and-children")
2137
- p(d.getPath()), p(d.children.value);
2138
- else if (a === "full-branch")
2139
- p(d.getPath()), p(n.traverse("dfs", d));
2140
- else if (a === "all-except-branch") {
2141
- const m = /* @__PURE__ */ new Set();
2142
- for (const y of d.getPath())
2143
- m.add(y.id);
2144
- for (const y of n.traverse("dfs", d))
2145
- m.add(y.id);
2146
- for (const y of n.nodeMap.values())
2147
- !m.has(y.id) === h && c(y);
2265
+ if (P === "ancestors-only")
2266
+ for (const M of T.getPath())
2267
+ M.id !== T.id && R(M);
2268
+ else if (P === "siblings-only") {
2269
+ if (T.parent.value)
2270
+ for (const M of T.parent.value.children.value)
2271
+ M.id !== T.id && R(M);
2272
+ } else if (P === "descendants-only")
2273
+ for (const M of a.traverse("dfs", T))
2274
+ M.id !== T.id && R(M);
2275
+ else if (P === "children-only")
2276
+ N(T.children.value);
2277
+ else if (P === "self-and-ancestors")
2278
+ N(T.getPath());
2279
+ else if (P === "self-and-children")
2280
+ R(T), N(T.children.value);
2281
+ else if (P === "self-and-descendants")
2282
+ N(a.traverse("dfs", T));
2283
+ else if (P === "self-and-siblings")
2284
+ R(T), T.parent.value && N(T.parent.value.children.value);
2285
+ else if (P === "self-ancestors-and-children")
2286
+ N(T.getPath()), N(T.children.value);
2287
+ else if (P === "full-branch")
2288
+ N(T.getPath()), N(a.traverse("dfs", T));
2289
+ else if (P === "all-except-branch") {
2290
+ const M = /* @__PURE__ */ new Set();
2291
+ for (const k of T.getPath())
2292
+ M.add(k.id);
2293
+ for (const k of a.traverse("dfs", T))
2294
+ M.add(k.id);
2295
+ for (const k of a.nodeMap.values())
2296
+ !M.has(k.id) === E && y(k);
2148
2297
  return;
2149
2298
  } else {
2150
- console.warn(`forEach: Unknown relationship "${a}".`);
2299
+ console.warn(`forEach: Unknown relationship "${P}".`);
2151
2300
  return;
2152
2301
  }
2153
- if (h)
2154
- for (const m of v)
2155
- c(m);
2302
+ if (E)
2303
+ for (const M of A)
2304
+ y(M);
2156
2305
  else
2157
- for (const m of n.nodeMap.values())
2158
- u.has(m.id) || c(m);
2306
+ for (const M of a.nodeMap.values())
2307
+ D.has(M.id) || y(M);
2159
2308
  }
2160
2309
  };
2161
2310
  }
2162
2311
  export {
2163
- jn as Tree,
2164
- Et as TreeNode,
2165
- oo as arrow,
2166
- Gn as flip,
2167
- Jn as hide,
2168
- Un as offset,
2169
- qn as shift,
2170
- Zn as useArrow,
2171
- eo as useClick,
2172
- no as useClientPoint,
2173
- to as useDismiss,
2174
- Qn as useFloating,
2175
- io as useFloatingTree,
2176
- Bn as useFocus,
2177
- zn as useHover
2312
+ Co as Tree,
2313
+ Bt as TreeNode,
2314
+ kt as clearTimeoutIfSet,
2315
+ ze as contains,
2316
+ st as findDescendantContainingTarget,
2317
+ So as flip,
2318
+ rt as getContextFromParameter,
2319
+ Rt as getCurrentTime,
2320
+ lo as getTarget,
2321
+ Ao as hide,
2322
+ Mt as isButtonTarget,
2323
+ ro as isClickOnScrollbar,
2324
+ At as isEventTargetWithin,
2325
+ oo as isHTMLElement,
2326
+ Nt as isMac,
2327
+ Qe as isMouseLikePointerType,
2328
+ Dt as isSafari,
2329
+ St as isSpaceIgnored,
2330
+ J as isTargetWithinElement,
2331
+ no as isTreeNode,
2332
+ Kt as isTypeableElement,
2333
+ io as isVirtualElement,
2334
+ so as matchesFocusVisible,
2335
+ Oo as offset,
2336
+ Mo as shift,
2337
+ No as useArrow,
2338
+ ko as useClick,
2339
+ Fo as useClientPoint,
2340
+ Ho as useEscapeKey,
2341
+ Lt as useFloating,
2342
+ Bo as useFloatingTree,
2343
+ Ro as useFocus,
2344
+ Do as useHover
2178
2345
  };