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