@zenuml/core 3.32.2 → 3.32.4

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.
@@ -1,1856 +0,0 @@
1
- import { c as P, u as H, r as R, s as We, w as k, g as lt, o as at, a as Q, F as Ie, m as pe, t as Re, b as Ve, n as ct, p as ut, d as ft, e as dt, h as ne, U as mt, f as ve, T as pt, i as vt, S as gt, j as ht, k as wt, l as yt, q as xt, v as bt, P as Ct, x as Pe, y as Ot, z as At, A as ge, B as Tt, C as St, D as Et, E as Rt, G as Pt, H as Ft, I as Lt } from "./core-0a4e98be.js";
2
- const ze = ["top", "right", "bottom", "left"], Fe = ["start", "end"], Le = /* @__PURE__ */ ze.reduce((e, t) => e.concat(t, t + "-" + Fe[0], t + "-" + Fe[1]), []), Z = Math.min, q = Math.max, ae = Math.round, le = Math.floor, X = (e) => ({
3
- x: e,
4
- y: e
5
- }), Bt = {
6
- left: "right",
7
- right: "left",
8
- bottom: "top",
9
- top: "bottom"
10
- }, Dt = {
11
- start: "end",
12
- end: "start"
13
- };
14
- function ye(e, t, n) {
15
- return q(e, Z(t, n));
16
- }
17
- function K(e, t) {
18
- return typeof e == "function" ? e(t) : e;
19
- }
20
- function z(e) {
21
- return e.split("-")[0];
22
- }
23
- function M(e) {
24
- return e.split("-")[1];
25
- }
26
- function Ue(e) {
27
- return e === "x" ? "y" : "x";
28
- }
29
- function be(e) {
30
- return e === "y" ? "height" : "width";
31
- }
32
- function de(e) {
33
- return ["top", "bottom"].includes(z(e)) ? "y" : "x";
34
- }
35
- function Ce(e) {
36
- return Ue(de(e));
37
- }
38
- function Xe(e, t, n) {
39
- n === void 0 && (n = !1);
40
- const i = M(e), o = Ce(e), r = be(o);
41
- let s = o === "x" ? i === (n ? "end" : "start") ? "right" : "left" : i === "start" ? "bottom" : "top";
42
- return t.reference[r] > t.floating[r] && (s = ue(s)), [s, ue(s)];
43
- }
44
- function Nt(e) {
45
- const t = ue(e);
46
- return [ce(e), t, ce(t)];
47
- }
48
- function ce(e) {
49
- return e.replace(/start|end/g, (t) => Dt[t]);
50
- }
51
- function $t(e, t, n) {
52
- const i = ["left", "right"], o = ["right", "left"], r = ["top", "bottom"], s = ["bottom", "top"];
53
- switch (e) {
54
- case "top":
55
- case "bottom":
56
- return n ? t ? o : i : t ? i : o;
57
- case "left":
58
- case "right":
59
- return t ? r : s;
60
- default:
61
- return [];
62
- }
63
- }
64
- function kt(e, t, n, i) {
65
- const o = M(e);
66
- let r = $t(z(e), n === "start", i);
67
- return o && (r = r.map((s) => s + "-" + o), t && (r = r.concat(r.map(ce)))), r;
68
- }
69
- function ue(e) {
70
- return e.replace(/left|right|bottom|top/g, (t) => Bt[t]);
71
- }
72
- function jt(e) {
73
- return {
74
- top: 0,
75
- right: 0,
76
- bottom: 0,
77
- left: 0,
78
- ...e
79
- };
80
- }
81
- function Ye(e) {
82
- return typeof e != "number" ? jt(e) : {
83
- top: e,
84
- right: e,
85
- bottom: e,
86
- left: e
87
- };
88
- }
89
- function fe(e) {
90
- const {
91
- x: t,
92
- y: n,
93
- width: i,
94
- height: o
95
- } = e;
96
- return {
97
- width: i,
98
- height: o,
99
- top: n,
100
- left: t,
101
- right: t + i,
102
- bottom: n + o,
103
- x: t,
104
- y: n
105
- };
106
- }
107
- function Be(e, t, n) {
108
- let {
109
- reference: i,
110
- floating: o
111
- } = e;
112
- const r = de(t), s = Ce(t), l = be(s), u = z(t), c = r === "y", f = i.x + i.width / 2 - o.width / 2, m = i.y + i.height / 2 - o.height / 2, w = i[l] / 2 - o[l] / 2;
113
- let d;
114
- switch (u) {
115
- case "top":
116
- d = {
117
- x: f,
118
- y: i.y - o.height
119
- };
120
- break;
121
- case "bottom":
122
- d = {
123
- x: f,
124
- y: i.y + i.height
125
- };
126
- break;
127
- case "right":
128
- d = {
129
- x: i.x + i.width,
130
- y: m
131
- };
132
- break;
133
- case "left":
134
- d = {
135
- x: i.x - o.width,
136
- y: m
137
- };
138
- break;
139
- default:
140
- d = {
141
- x: i.x,
142
- y: i.y
143
- };
144
- }
145
- switch (M(t)) {
146
- case "start":
147
- d[s] -= w * (n && c ? -1 : 1);
148
- break;
149
- case "end":
150
- d[s] += w * (n && c ? -1 : 1);
151
- break;
152
- }
153
- return d;
154
- }
155
- const _t = async (e, t, n) => {
156
- const {
157
- placement: i = "bottom",
158
- strategy: o = "absolute",
159
- middleware: r = [],
160
- platform: s
161
- } = n, l = r.filter(Boolean), u = await (s.isRTL == null ? void 0 : s.isRTL(t));
162
- let c = await s.getElementRects({
163
- reference: e,
164
- floating: t,
165
- strategy: o
166
- }), {
167
- x: f,
168
- y: m
169
- } = Be(c, i, u), w = i, d = {}, a = 0;
170
- for (let v = 0; v < l.length; v++) {
171
- const {
172
- name: g,
173
- fn: h
174
- } = l[v], {
175
- x: y,
176
- y: b,
177
- data: C,
178
- reset: O
179
- } = await h({
180
- x: f,
181
- y: m,
182
- initialPlacement: i,
183
- placement: w,
184
- strategy: o,
185
- middlewareData: d,
186
- rects: c,
187
- platform: s,
188
- elements: {
189
- reference: e,
190
- floating: t
191
- }
192
- });
193
- f = y ?? f, m = b ?? m, d = {
194
- ...d,
195
- [g]: {
196
- ...d[g],
197
- ...C
198
- }
199
- }, O && a <= 50 && (a++, typeof O == "object" && (O.placement && (w = O.placement), O.rects && (c = O.rects === !0 ? await s.getElementRects({
200
- reference: e,
201
- floating: t,
202
- strategy: o
203
- }) : O.rects), {
204
- x: f,
205
- y: m
206
- } = Be(c, w, u)), v = -1);
207
- }
208
- return {
209
- x: f,
210
- y: m,
211
- placement: w,
212
- strategy: o,
213
- middlewareData: d
214
- };
215
- };
216
- async function oe(e, t) {
217
- var n;
218
- t === void 0 && (t = {});
219
- const {
220
- x: i,
221
- y: o,
222
- platform: r,
223
- rects: s,
224
- elements: l,
225
- strategy: u
226
- } = e, {
227
- boundary: c = "clippingAncestors",
228
- rootBoundary: f = "viewport",
229
- elementContext: m = "floating",
230
- altBoundary: w = !1,
231
- padding: d = 0
232
- } = K(t, e), a = Ye(d), g = l[w ? m === "floating" ? "reference" : "floating" : m], h = fe(await r.getClippingRect({
233
- element: (n = await (r.isElement == null ? void 0 : r.isElement(g))) == null || n ? g : g.contextElement || await (r.getDocumentElement == null ? void 0 : r.getDocumentElement(l.floating)),
234
- boundary: c,
235
- rootBoundary: f,
236
- strategy: u
237
- })), y = m === "floating" ? {
238
- x: i,
239
- y: o,
240
- width: s.floating.width,
241
- height: s.floating.height
242
- } : s.reference, b = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(l.floating)), C = await (r.isElement == null ? void 0 : r.isElement(b)) ? await (r.getScale == null ? void 0 : r.getScale(b)) || {
243
- x: 1,
244
- y: 1
245
- } : {
246
- x: 1,
247
- y: 1
248
- }, O = fe(r.convertOffsetParentRelativeRectToViewportRelativeRect ? await r.convertOffsetParentRelativeRectToViewportRelativeRect({
249
- elements: l,
250
- rect: y,
251
- offsetParent: b,
252
- strategy: u
253
- }) : y);
254
- return {
255
- top: (h.top - O.top + a.top) / C.y,
256
- bottom: (O.bottom - h.bottom + a.bottom) / C.y,
257
- left: (h.left - O.left + a.left) / C.x,
258
- right: (O.right - h.right + a.right) / C.x
259
- };
260
- }
261
- const Ht = (e) => ({
262
- name: "arrow",
263
- options: e,
264
- async fn(t) {
265
- const {
266
- x: n,
267
- y: i,
268
- placement: o,
269
- rects: r,
270
- platform: s,
271
- elements: l,
272
- middlewareData: u
273
- } = t, {
274
- element: c,
275
- padding: f = 0
276
- } = K(e, t) || {};
277
- if (c == null)
278
- return {};
279
- const m = Ye(f), w = {
280
- x: n,
281
- y: i
282
- }, d = Ce(o), a = be(d), v = await s.getDimensions(c), g = d === "y", h = g ? "top" : "left", y = g ? "bottom" : "right", b = g ? "clientHeight" : "clientWidth", C = r.reference[a] + r.reference[d] - w[d] - r.floating[a], O = w[d] - r.reference[d], A = await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(c));
283
- let p = A ? A[b] : 0;
284
- (!p || !await (s.isElement == null ? void 0 : s.isElement(A))) && (p = l.floating[b] || r.floating[a]);
285
- const T = C / 2 - O / 2, F = p / 2 - v[a] / 2 - 1, E = Z(m[h], F), B = Z(m[y], F), S = E, D = p - v[a] - B, L = p / 2 - v[a] / 2 + T, $ = ye(S, L, D), _ = !u.arrow && M(o) != null && L !== $ && r.reference[a] / 2 - (L < S ? E : B) - v[a] / 2 < 0, V = _ ? L < S ? L - S : L - D : 0;
286
- return {
287
- [d]: w[d] + V,
288
- data: {
289
- [d]: $,
290
- centerOffset: L - $ - V,
291
- ..._ && {
292
- alignmentOffset: V
293
- }
294
- },
295
- reset: _
296
- };
297
- }
298
- });
299
- function Mt(e, t, n) {
300
- return (e ? [...n.filter((o) => M(o) === e), ...n.filter((o) => M(o) !== e)] : n.filter((o) => z(o) === o)).filter((o) => e ? M(o) === e || (t ? ce(o) !== o : !1) : !0);
301
- }
302
- const Wt = function(e) {
303
- return e === void 0 && (e = {}), {
304
- name: "autoPlacement",
305
- options: e,
306
- async fn(t) {
307
- var n, i, o;
308
- const {
309
- rects: r,
310
- middlewareData: s,
311
- placement: l,
312
- platform: u,
313
- elements: c
314
- } = t, {
315
- crossAxis: f = !1,
316
- alignment: m,
317
- allowedPlacements: w = Le,
318
- autoAlignment: d = !0,
319
- ...a
320
- } = K(e, t), v = m !== void 0 || w === Le ? Mt(m || null, d, w) : w, g = await oe(t, a), h = ((n = s.autoPlacement) == null ? void 0 : n.index) || 0, y = v[h];
321
- if (y == null)
322
- return {};
323
- const b = Xe(y, r, await (u.isRTL == null ? void 0 : u.isRTL(c.floating)));
324
- if (l !== y)
325
- return {
326
- reset: {
327
- placement: v[0]
328
- }
329
- };
330
- const C = [g[z(y)], g[b[0]], g[b[1]]], O = [...((i = s.autoPlacement) == null ? void 0 : i.overflows) || [], {
331
- placement: y,
332
- overflows: C
333
- }], A = v[h + 1];
334
- if (A)
335
- return {
336
- data: {
337
- index: h + 1,
338
- overflows: O
339
- },
340
- reset: {
341
- placement: A
342
- }
343
- };
344
- const p = O.map((E) => {
345
- const B = M(E.placement);
346
- return [E.placement, B && f ? (
347
- // Check along the mainAxis and main crossAxis side.
348
- E.overflows.slice(0, 2).reduce((S, D) => S + D, 0)
349
- ) : (
350
- // Check only the mainAxis.
351
- E.overflows[0]
352
- ), E.overflows];
353
- }).sort((E, B) => E[1] - B[1]), F = ((o = p.filter((E) => E[2].slice(
354
- 0,
355
- // Aligned placements should not check their opposite crossAxis
356
- // side.
357
- M(E[0]) ? 2 : 3
358
- ).every((B) => B <= 0))[0]) == null ? void 0 : o[0]) || p[0][0];
359
- return F !== l ? {
360
- data: {
361
- index: h + 1,
362
- overflows: O
363
- },
364
- reset: {
365
- placement: F
366
- }
367
- } : {};
368
- }
369
- };
370
- }, It = function(e) {
371
- return e === void 0 && (e = {}), {
372
- name: "flip",
373
- options: e,
374
- async fn(t) {
375
- var n, i;
376
- const {
377
- placement: o,
378
- middlewareData: r,
379
- rects: s,
380
- initialPlacement: l,
381
- platform: u,
382
- elements: c
383
- } = t, {
384
- mainAxis: f = !0,
385
- crossAxis: m = !0,
386
- fallbackPlacements: w,
387
- fallbackStrategy: d = "bestFit",
388
- fallbackAxisSideDirection: a = "none",
389
- flipAlignment: v = !0,
390
- ...g
391
- } = K(e, t);
392
- if ((n = r.arrow) != null && n.alignmentOffset)
393
- return {};
394
- const h = z(o), y = z(l) === l, b = await (u.isRTL == null ? void 0 : u.isRTL(c.floating)), C = w || (y || !v ? [ue(l)] : Nt(l));
395
- !w && a !== "none" && C.push(...kt(l, v, a, b));
396
- const O = [l, ...C], A = await oe(t, g), p = [];
397
- let T = ((i = r.flip) == null ? void 0 : i.overflows) || [];
398
- if (f && p.push(A[h]), m) {
399
- const S = Xe(o, s, b);
400
- p.push(A[S[0]], A[S[1]]);
401
- }
402
- if (T = [...T, {
403
- placement: o,
404
- overflows: p
405
- }], !p.every((S) => S <= 0)) {
406
- var F, E;
407
- const S = (((F = r.flip) == null ? void 0 : F.index) || 0) + 1, D = O[S];
408
- if (D)
409
- return {
410
- data: {
411
- index: S,
412
- overflows: T
413
- },
414
- reset: {
415
- placement: D
416
- }
417
- };
418
- let L = (E = T.filter(($) => $.overflows[0] <= 0).sort(($, _) => $.overflows[1] - _.overflows[1])[0]) == null ? void 0 : E.placement;
419
- if (!L)
420
- switch (d) {
421
- case "bestFit": {
422
- var B;
423
- const $ = (B = T.map((_) => [_.placement, _.overflows.filter((V) => V > 0).reduce((V, st) => V + st, 0)]).sort((_, V) => _[1] - V[1])[0]) == null ? void 0 : B[0];
424
- $ && (L = $);
425
- break;
426
- }
427
- case "initialPlacement":
428
- L = l;
429
- break;
430
- }
431
- if (o !== L)
432
- return {
433
- reset: {
434
- placement: L
435
- }
436
- };
437
- }
438
- return {};
439
- }
440
- };
441
- };
442
- function De(e, t) {
443
- return {
444
- top: e.top - t.height,
445
- right: e.right - t.width,
446
- bottom: e.bottom - t.height,
447
- left: e.left - t.width
448
- };
449
- }
450
- function Ne(e) {
451
- return ze.some((t) => e[t] >= 0);
452
- }
453
- const Vt = function(e) {
454
- return e === void 0 && (e = {}), {
455
- name: "hide",
456
- options: e,
457
- async fn(t) {
458
- const {
459
- rects: n
460
- } = t, {
461
- strategy: i = "referenceHidden",
462
- ...o
463
- } = K(e, t);
464
- switch (i) {
465
- case "referenceHidden": {
466
- const r = await oe(t, {
467
- ...o,
468
- elementContext: "reference"
469
- }), s = De(r, n.reference);
470
- return {
471
- data: {
472
- referenceHiddenOffsets: s,
473
- referenceHidden: Ne(s)
474
- }
475
- };
476
- }
477
- case "escaped": {
478
- const r = await oe(t, {
479
- ...o,
480
- altBoundary: !0
481
- }), s = De(r, n.floating);
482
- return {
483
- data: {
484
- escapedOffsets: s,
485
- escaped: Ne(s)
486
- }
487
- };
488
- }
489
- default:
490
- return {};
491
- }
492
- }
493
- };
494
- };
495
- async function zt(e, t) {
496
- const {
497
- placement: n,
498
- platform: i,
499
- elements: o
500
- } = e, r = await (i.isRTL == null ? void 0 : i.isRTL(o.floating)), s = z(n), l = M(n), u = de(n) === "y", c = ["left", "top"].includes(s) ? -1 : 1, f = r && u ? -1 : 1, m = K(t, e);
501
- let {
502
- mainAxis: w,
503
- crossAxis: d,
504
- alignmentAxis: a
505
- } = typeof m == "number" ? {
506
- mainAxis: m,
507
- crossAxis: 0,
508
- alignmentAxis: null
509
- } : {
510
- mainAxis: 0,
511
- crossAxis: 0,
512
- alignmentAxis: null,
513
- ...m
514
- };
515
- return l && typeof a == "number" && (d = l === "end" ? a * -1 : a), u ? {
516
- x: d * f,
517
- y: w * c
518
- } : {
519
- x: w * c,
520
- y: d * f
521
- };
522
- }
523
- const Ut = function(e) {
524
- return e === void 0 && (e = 0), {
525
- name: "offset",
526
- options: e,
527
- async fn(t) {
528
- var n, i;
529
- const {
530
- x: o,
531
- y: r,
532
- placement: s,
533
- middlewareData: l
534
- } = t, u = await zt(t, e);
535
- return s === ((n = l.offset) == null ? void 0 : n.placement) && (i = l.arrow) != null && i.alignmentOffset ? {} : {
536
- x: o + u.x,
537
- y: r + u.y,
538
- data: {
539
- ...u,
540
- placement: s
541
- }
542
- };
543
- }
544
- };
545
- }, Xt = function(e) {
546
- return e === void 0 && (e = {}), {
547
- name: "shift",
548
- options: e,
549
- async fn(t) {
550
- const {
551
- x: n,
552
- y: i,
553
- placement: o
554
- } = t, {
555
- mainAxis: r = !0,
556
- crossAxis: s = !1,
557
- limiter: l = {
558
- fn: (g) => {
559
- let {
560
- x: h,
561
- y
562
- } = g;
563
- return {
564
- x: h,
565
- y
566
- };
567
- }
568
- },
569
- ...u
570
- } = K(e, t), c = {
571
- x: n,
572
- y: i
573
- }, f = await oe(t, u), m = de(z(o)), w = Ue(m);
574
- let d = c[w], a = c[m];
575
- if (r) {
576
- const g = w === "y" ? "top" : "left", h = w === "y" ? "bottom" : "right", y = d + f[g], b = d - f[h];
577
- d = ye(y, d, b);
578
- }
579
- if (s) {
580
- const g = m === "y" ? "top" : "left", h = m === "y" ? "bottom" : "right", y = a + f[g], b = a - f[h];
581
- a = ye(y, a, b);
582
- }
583
- const v = l.fn({
584
- ...t,
585
- [w]: d,
586
- [m]: a
587
- });
588
- return {
589
- ...v,
590
- data: {
591
- x: v.x - n,
592
- y: v.y - i
593
- }
594
- };
595
- }
596
- };
597
- };
598
- function te(e) {
599
- return qe(e) ? (e.nodeName || "").toLowerCase() : "#document";
600
- }
601
- function N(e) {
602
- var t;
603
- return (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) || window;
604
- }
605
- function U(e) {
606
- var t;
607
- return (t = (qe(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : t.documentElement;
608
- }
609
- function qe(e) {
610
- return e instanceof Node || e instanceof N(e).Node;
611
- }
612
- function W(e) {
613
- return e instanceof Element || e instanceof N(e).Element;
614
- }
615
- function I(e) {
616
- return e instanceof HTMLElement || e instanceof N(e).HTMLElement;
617
- }
618
- function $e(e) {
619
- return typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof N(e).ShadowRoot;
620
- }
621
- function se(e) {
622
- const {
623
- overflow: t,
624
- overflowX: n,
625
- overflowY: i,
626
- display: o
627
- } = j(e);
628
- return /auto|scroll|overlay|hidden|clip/.test(t + i + n) && !["inline", "contents"].includes(o);
629
- }
630
- function Yt(e) {
631
- return ["table", "td", "th"].includes(te(e));
632
- }
633
- function Oe(e) {
634
- const t = Ae(), n = j(e);
635
- return n.transform !== "none" || n.perspective !== "none" || (n.containerType ? n.containerType !== "normal" : !1) || !t && (n.backdropFilter ? n.backdropFilter !== "none" : !1) || !t && (n.filter ? n.filter !== "none" : !1) || ["transform", "perspective", "filter"].some((i) => (n.willChange || "").includes(i)) || ["paint", "layout", "strict", "content"].some((i) => (n.contain || "").includes(i));
636
- }
637
- function qt(e) {
638
- let t = Y(e);
639
- for (; I(t) && !ee(t); ) {
640
- if (Oe(t))
641
- return t;
642
- t = Y(t);
643
- }
644
- return null;
645
- }
646
- function Ae() {
647
- return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
648
- }
649
- function ee(e) {
650
- return ["html", "body", "#document"].includes(te(e));
651
- }
652
- function j(e) {
653
- return N(e).getComputedStyle(e);
654
- }
655
- function me(e) {
656
- return W(e) ? {
657
- scrollLeft: e.scrollLeft,
658
- scrollTop: e.scrollTop
659
- } : {
660
- scrollLeft: e.pageXOffset,
661
- scrollTop: e.pageYOffset
662
- };
663
- }
664
- function Y(e) {
665
- if (te(e) === "html")
666
- return e;
667
- const t = (
668
- // Step into the shadow DOM of the parent of a slotted node.
669
- e.assignedSlot || // DOM Element detected.
670
- e.parentNode || // ShadowRoot detected.
671
- $e(e) && e.host || // Fallback.
672
- U(e)
673
- );
674
- return $e(t) ? t.host : t;
675
- }
676
- function Ge(e) {
677
- const t = Y(e);
678
- return ee(t) ? e.ownerDocument ? e.ownerDocument.body : e.body : I(t) && se(t) ? t : Ge(t);
679
- }
680
- function ie(e, t, n) {
681
- var i;
682
- t === void 0 && (t = []), n === void 0 && (n = !0);
683
- const o = Ge(e), r = o === ((i = e.ownerDocument) == null ? void 0 : i.body), s = N(o);
684
- return r ? t.concat(s, s.visualViewport || [], se(o) ? o : [], s.frameElement && n ? ie(s.frameElement) : []) : t.concat(o, ie(o, [], n));
685
- }
686
- function Ke(e) {
687
- const t = j(e);
688
- let n = parseFloat(t.width) || 0, i = parseFloat(t.height) || 0;
689
- const o = I(e), r = o ? e.offsetWidth : n, s = o ? e.offsetHeight : i, l = ae(n) !== r || ae(i) !== s;
690
- return l && (n = r, i = s), {
691
- width: n,
692
- height: i,
693
- $: l
694
- };
695
- }
696
- function Te(e) {
697
- return W(e) ? e : e.contextElement;
698
- }
699
- function J(e) {
700
- const t = Te(e);
701
- if (!I(t))
702
- return X(1);
703
- const n = t.getBoundingClientRect(), {
704
- width: i,
705
- height: o,
706
- $: r
707
- } = Ke(t);
708
- let s = (r ? ae(n.width) : n.width) / i, l = (r ? ae(n.height) : n.height) / o;
709
- return (!s || !Number.isFinite(s)) && (s = 1), (!l || !Number.isFinite(l)) && (l = 1), {
710
- x: s,
711
- y: l
712
- };
713
- }
714
- const Gt = /* @__PURE__ */ X(0);
715
- function Qe(e) {
716
- const t = N(e);
717
- return !Ae() || !t.visualViewport ? Gt : {
718
- x: t.visualViewport.offsetLeft,
719
- y: t.visualViewport.offsetTop
720
- };
721
- }
722
- function Kt(e, t, n) {
723
- return t === void 0 && (t = !1), !n || t && n !== N(e) ? !1 : t;
724
- }
725
- function G(e, t, n, i) {
726
- t === void 0 && (t = !1), n === void 0 && (n = !1);
727
- const o = e.getBoundingClientRect(), r = Te(e);
728
- let s = X(1);
729
- t && (i ? W(i) && (s = J(i)) : s = J(e));
730
- const l = Kt(r, n, i) ? Qe(r) : X(0);
731
- let u = (o.left + l.x) / s.x, c = (o.top + l.y) / s.y, f = o.width / s.x, m = o.height / s.y;
732
- if (r) {
733
- const w = N(r), d = i && W(i) ? N(i) : i;
734
- let a = w, v = a.frameElement;
735
- for (; v && i && d !== a; ) {
736
- const g = J(v), h = v.getBoundingClientRect(), y = j(v), b = h.left + (v.clientLeft + parseFloat(y.paddingLeft)) * g.x, C = h.top + (v.clientTop + parseFloat(y.paddingTop)) * g.y;
737
- u *= g.x, c *= g.y, f *= g.x, m *= g.y, u += b, c += C, a = N(v), v = a.frameElement;
738
- }
739
- }
740
- return fe({
741
- width: f,
742
- height: m,
743
- x: u,
744
- y: c
745
- });
746
- }
747
- const Qt = [":popover-open", ":modal"];
748
- function Se(e) {
749
- return Qt.some((t) => {
750
- try {
751
- return e.matches(t);
752
- } catch {
753
- return !1;
754
- }
755
- });
756
- }
757
- function Jt(e) {
758
- let {
759
- elements: t,
760
- rect: n,
761
- offsetParent: i,
762
- strategy: o
763
- } = e;
764
- const r = o === "fixed", s = U(i), l = t ? Se(t.floating) : !1;
765
- if (i === s || l && r)
766
- return n;
767
- let u = {
768
- scrollLeft: 0,
769
- scrollTop: 0
770
- }, c = X(1);
771
- const f = X(0), m = I(i);
772
- if ((m || !m && !r) && ((te(i) !== "body" || se(s)) && (u = me(i)), I(i))) {
773
- const w = G(i);
774
- c = J(i), f.x = w.x + i.clientLeft, f.y = w.y + i.clientTop;
775
- }
776
- return {
777
- width: n.width * c.x,
778
- height: n.height * c.y,
779
- x: n.x * c.x - u.scrollLeft * c.x + f.x,
780
- y: n.y * c.y - u.scrollTop * c.y + f.y
781
- };
782
- }
783
- function Zt(e) {
784
- return Array.from(e.getClientRects());
785
- }
786
- function Je(e) {
787
- return G(U(e)).left + me(e).scrollLeft;
788
- }
789
- function en(e) {
790
- const t = U(e), n = me(e), i = e.ownerDocument.body, o = q(t.scrollWidth, t.clientWidth, i.scrollWidth, i.clientWidth), r = q(t.scrollHeight, t.clientHeight, i.scrollHeight, i.clientHeight);
791
- let s = -n.scrollLeft + Je(e);
792
- const l = -n.scrollTop;
793
- return j(i).direction === "rtl" && (s += q(t.clientWidth, i.clientWidth) - o), {
794
- width: o,
795
- height: r,
796
- x: s,
797
- y: l
798
- };
799
- }
800
- function tn(e, t) {
801
- const n = N(e), i = U(e), o = n.visualViewport;
802
- let r = i.clientWidth, s = i.clientHeight, l = 0, u = 0;
803
- if (o) {
804
- r = o.width, s = o.height;
805
- const c = Ae();
806
- (!c || c && t === "fixed") && (l = o.offsetLeft, u = o.offsetTop);
807
- }
808
- return {
809
- width: r,
810
- height: s,
811
- x: l,
812
- y: u
813
- };
814
- }
815
- function nn(e, t) {
816
- const n = G(e, !0, t === "fixed"), i = n.top + e.clientTop, o = n.left + e.clientLeft, r = I(e) ? J(e) : X(1), s = e.clientWidth * r.x, l = e.clientHeight * r.y, u = o * r.x, c = i * r.y;
817
- return {
818
- width: s,
819
- height: l,
820
- x: u,
821
- y: c
822
- };
823
- }
824
- function ke(e, t, n) {
825
- let i;
826
- if (t === "viewport")
827
- i = tn(e, n);
828
- else if (t === "document")
829
- i = en(U(e));
830
- else if (W(t))
831
- i = nn(t, n);
832
- else {
833
- const o = Qe(e);
834
- i = {
835
- ...t,
836
- x: t.x - o.x,
837
- y: t.y - o.y
838
- };
839
- }
840
- return fe(i);
841
- }
842
- function Ze(e, t) {
843
- const n = Y(e);
844
- return n === t || !W(n) || ee(n) ? !1 : j(n).position === "fixed" || Ze(n, t);
845
- }
846
- function on(e, t) {
847
- const n = t.get(e);
848
- if (n)
849
- return n;
850
- let i = ie(e, [], !1).filter((l) => W(l) && te(l) !== "body"), o = null;
851
- const r = j(e).position === "fixed";
852
- let s = r ? Y(e) : e;
853
- for (; W(s) && !ee(s); ) {
854
- const l = j(s), u = Oe(s);
855
- !u && l.position === "fixed" && (o = null), (r ? !u && !o : !u && l.position === "static" && !!o && ["absolute", "fixed"].includes(o.position) || se(s) && !u && Ze(e, s)) ? i = i.filter((f) => f !== s) : o = l, s = Y(s);
856
- }
857
- return t.set(e, i), i;
858
- }
859
- function rn(e) {
860
- let {
861
- element: t,
862
- boundary: n,
863
- rootBoundary: i,
864
- strategy: o
865
- } = e;
866
- const s = [...n === "clippingAncestors" ? Se(t) ? [] : on(t, this._c) : [].concat(n), i], l = s[0], u = s.reduce((c, f) => {
867
- const m = ke(t, f, o);
868
- return c.top = q(m.top, c.top), c.right = Z(m.right, c.right), c.bottom = Z(m.bottom, c.bottom), c.left = q(m.left, c.left), c;
869
- }, ke(t, l, o));
870
- return {
871
- width: u.right - u.left,
872
- height: u.bottom - u.top,
873
- x: u.left,
874
- y: u.top
875
- };
876
- }
877
- function sn(e) {
878
- const {
879
- width: t,
880
- height: n
881
- } = Ke(e);
882
- return {
883
- width: t,
884
- height: n
885
- };
886
- }
887
- function ln(e, t, n) {
888
- const i = I(t), o = U(t), r = n === "fixed", s = G(e, !0, r, t);
889
- let l = {
890
- scrollLeft: 0,
891
- scrollTop: 0
892
- };
893
- const u = X(0);
894
- if (i || !i && !r)
895
- if ((te(t) !== "body" || se(o)) && (l = me(t)), i) {
896
- const m = G(t, !0, r, t);
897
- u.x = m.x + t.clientLeft, u.y = m.y + t.clientTop;
898
- } else
899
- o && (u.x = Je(o));
900
- const c = s.left + l.scrollLeft - u.x, f = s.top + l.scrollTop - u.y;
901
- return {
902
- x: c,
903
- y: f,
904
- width: s.width,
905
- height: s.height
906
- };
907
- }
908
- function he(e) {
909
- return j(e).position === "static";
910
- }
911
- function je(e, t) {
912
- return !I(e) || j(e).position === "fixed" ? null : t ? t(e) : e.offsetParent;
913
- }
914
- function et(e, t) {
915
- const n = N(e);
916
- if (Se(e))
917
- return n;
918
- if (!I(e)) {
919
- let o = Y(e);
920
- for (; o && !ee(o); ) {
921
- if (W(o) && !he(o))
922
- return o;
923
- o = Y(o);
924
- }
925
- return n;
926
- }
927
- let i = je(e, t);
928
- for (; i && Yt(i) && he(i); )
929
- i = je(i, t);
930
- return i && ee(i) && he(i) && !Oe(i) ? n : i || qt(e) || n;
931
- }
932
- const an = async function(e) {
933
- const t = this.getOffsetParent || et, n = this.getDimensions, i = await n(e.floating);
934
- return {
935
- reference: ln(e.reference, await t(e.floating), e.strategy),
936
- floating: {
937
- x: 0,
938
- y: 0,
939
- width: i.width,
940
- height: i.height
941
- }
942
- };
943
- };
944
- function cn(e) {
945
- return j(e).direction === "rtl";
946
- }
947
- const un = {
948
- convertOffsetParentRelativeRectToViewportRelativeRect: Jt,
949
- getDocumentElement: U,
950
- getClippingRect: rn,
951
- getOffsetParent: et,
952
- getElementRects: an,
953
- getClientRects: Zt,
954
- getDimensions: sn,
955
- getScale: J,
956
- isElement: W,
957
- isRTL: cn
958
- };
959
- function fn(e, t) {
960
- let n = null, i;
961
- const o = U(e);
962
- function r() {
963
- var l;
964
- clearTimeout(i), (l = n) == null || l.disconnect(), n = null;
965
- }
966
- function s(l, u) {
967
- l === void 0 && (l = !1), u === void 0 && (u = 1), r();
968
- const {
969
- left: c,
970
- top: f,
971
- width: m,
972
- height: w
973
- } = e.getBoundingClientRect();
974
- if (l || t(), !m || !w)
975
- return;
976
- const d = le(f), a = le(o.clientWidth - (c + m)), v = le(o.clientHeight - (f + w)), g = le(c), y = {
977
- rootMargin: -d + "px " + -a + "px " + -v + "px " + -g + "px",
978
- threshold: q(0, Z(1, u)) || 1
979
- };
980
- let b = !0;
981
- function C(O) {
982
- const A = O[0].intersectionRatio;
983
- if (A !== u) {
984
- if (!b)
985
- return s();
986
- A ? s(!1, A) : i = setTimeout(() => {
987
- s(!1, 1e-7);
988
- }, 1e3);
989
- }
990
- b = !1;
991
- }
992
- try {
993
- n = new IntersectionObserver(C, {
994
- ...y,
995
- // Handle <iframe>s
996
- root: o.ownerDocument
997
- });
998
- } catch {
999
- n = new IntersectionObserver(C, y);
1000
- }
1001
- n.observe(e);
1002
- }
1003
- return s(!0), r;
1004
- }
1005
- function dn(e, t, n, i) {
1006
- i === void 0 && (i = {});
1007
- const {
1008
- ancestorScroll: o = !0,
1009
- ancestorResize: r = !0,
1010
- elementResize: s = typeof ResizeObserver == "function",
1011
- layoutShift: l = typeof IntersectionObserver == "function",
1012
- animationFrame: u = !1
1013
- } = i, c = Te(e), f = o || r ? [...c ? ie(c) : [], ...ie(t)] : [];
1014
- f.forEach((h) => {
1015
- o && h.addEventListener("scroll", n, {
1016
- passive: !0
1017
- }), r && h.addEventListener("resize", n);
1018
- });
1019
- const m = c && l ? fn(c, n) : null;
1020
- let w = -1, d = null;
1021
- s && (d = new ResizeObserver((h) => {
1022
- let [y] = h;
1023
- y && y.target === c && d && (d.unobserve(t), cancelAnimationFrame(w), w = requestAnimationFrame(() => {
1024
- var b;
1025
- (b = d) == null || b.observe(t);
1026
- })), n();
1027
- }), c && !u && d.observe(c), d.observe(t));
1028
- let a, v = u ? G(e) : null;
1029
- u && g();
1030
- function g() {
1031
- const h = G(e);
1032
- v && (h.x !== v.x || h.y !== v.y || h.width !== v.width || h.height !== v.height) && n(), v = h, a = requestAnimationFrame(g);
1033
- }
1034
- return n(), () => {
1035
- var h;
1036
- f.forEach((y) => {
1037
- o && y.removeEventListener("scroll", n), r && y.removeEventListener("resize", n);
1038
- }), m == null || m(), (h = d) == null || h.disconnect(), d = null, u && cancelAnimationFrame(a);
1039
- };
1040
- }
1041
- const mn = Ut, pn = Wt, vn = Xt, gn = It, hn = Vt, wn = Ht, yn = (e, t, n) => {
1042
- const i = /* @__PURE__ */ new Map(), o = {
1043
- platform: un,
1044
- ...n
1045
- }, r = {
1046
- ...o.platform,
1047
- _c: i
1048
- };
1049
- return _t(e, t, {
1050
- ...o,
1051
- platform: r
1052
- });
1053
- };
1054
- function xn(e) {
1055
- return tt(e) ? (e.nodeName || "").toLowerCase() : "#document";
1056
- }
1057
- function bn(e) {
1058
- var t;
1059
- return (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) || window;
1060
- }
1061
- function tt(e) {
1062
- return e instanceof Node || e instanceof bn(e).Node;
1063
- }
1064
- function Cn(e) {
1065
- return e != null && typeof e == "object" && "$el" in e;
1066
- }
1067
- function xe(e) {
1068
- if (Cn(e)) {
1069
- const t = e.$el;
1070
- return tt(t) && xn(t) === "#comment" ? null : t;
1071
- }
1072
- return e;
1073
- }
1074
- function On(e) {
1075
- return {
1076
- name: "arrow",
1077
- options: e,
1078
- fn(t) {
1079
- const n = xe(H(e.element));
1080
- return n == null ? {} : wn({
1081
- element: n,
1082
- padding: e.padding
1083
- }).fn(t);
1084
- }
1085
- };
1086
- }
1087
- function nt(e) {
1088
- return typeof window > "u" ? 1 : (e.ownerDocument.defaultView || window).devicePixelRatio || 1;
1089
- }
1090
- function _e(e, t) {
1091
- const n = nt(e);
1092
- return Math.round(t * n) / n;
1093
- }
1094
- function An(e, t, n) {
1095
- n === void 0 && (n = {});
1096
- const i = n.whileElementsMounted, o = P(() => {
1097
- var p;
1098
- return (p = H(n.open)) != null ? p : !0;
1099
- }), r = P(() => H(n.middleware)), s = P(() => {
1100
- var p;
1101
- return (p = H(n.placement)) != null ? p : "bottom";
1102
- }), l = P(() => {
1103
- var p;
1104
- return (p = H(n.strategy)) != null ? p : "absolute";
1105
- }), u = P(() => {
1106
- var p;
1107
- return (p = H(n.transform)) != null ? p : !0;
1108
- }), c = P(() => xe(e.value)), f = P(() => xe(t.value)), m = R(0), w = R(0), d = R(l.value), a = R(s.value), v = We({}), g = R(!1), h = P(() => {
1109
- const p = {
1110
- position: d.value,
1111
- left: "0",
1112
- top: "0"
1113
- };
1114
- if (!f.value)
1115
- return p;
1116
- const T = _e(f.value, m.value), F = _e(f.value, w.value);
1117
- return u.value ? {
1118
- ...p,
1119
- transform: "translate(" + T + "px, " + F + "px)",
1120
- ...nt(f.value) >= 1.5 && {
1121
- willChange: "transform"
1122
- }
1123
- } : {
1124
- position: d.value,
1125
- left: T + "px",
1126
- top: F + "px"
1127
- };
1128
- });
1129
- let y;
1130
- function b() {
1131
- c.value == null || f.value == null || yn(c.value, f.value, {
1132
- middleware: r.value,
1133
- placement: s.value,
1134
- strategy: l.value
1135
- }).then((p) => {
1136
- m.value = p.x, w.value = p.y, d.value = p.strategy, a.value = p.placement, v.value = p.middlewareData, g.value = !0;
1137
- });
1138
- }
1139
- function C() {
1140
- typeof y == "function" && (y(), y = void 0);
1141
- }
1142
- function O() {
1143
- if (C(), i === void 0) {
1144
- b();
1145
- return;
1146
- }
1147
- if (c.value != null && f.value != null) {
1148
- y = i(c.value, f.value, b);
1149
- return;
1150
- }
1151
- }
1152
- function A() {
1153
- o.value || (g.value = !1);
1154
- }
1155
- return k([r, s, l], b, {
1156
- flush: "sync"
1157
- }), k([c, f], O, {
1158
- flush: "sync"
1159
- }), k(o, A, {
1160
- flush: "sync"
1161
- }), lt() && at(C), {
1162
- x: Q(m),
1163
- y: Q(w),
1164
- strategy: Q(d),
1165
- placement: Q(a),
1166
- middlewareData: Q(v),
1167
- isPositioned: Q(g),
1168
- floatingStyles: h,
1169
- update: b
1170
- };
1171
- }
1172
- var Tn = Object.defineProperty, Sn = (e, t, n) => t in e ? Tn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, En = (e, t, n) => (Sn(e, typeof t != "symbol" ? t + "" : t, n), n);
1173
- function re(e) {
1174
- return e == null || e.value == null ? null : e.value instanceof Node ? e.value : "$el" in e.value && e.value.$el ? re(R(e.value.$el)) : "getBoundingClientRect" in e.value ? e.value : null;
1175
- }
1176
- function ot(e) {
1177
- return e.reduce((t, n) => n.type === Ie ? t.concat(ot(n.children)) : t.concat(n), []);
1178
- }
1179
- function Rn(e) {
1180
- return e == null ? !1 : typeof e.type == "string" || typeof e.type == "object" || typeof e.type == "function";
1181
- }
1182
- function He(e) {
1183
- return e = H(e), e && (e == null ? void 0 : e.nodeType) !== Node.COMMENT_NODE;
1184
- }
1185
- class Pn {
1186
- constructor() {
1187
- En(this, "current", this.detect());
1188
- }
1189
- set(t) {
1190
- this.current !== t && (this.current = t);
1191
- }
1192
- reset() {
1193
- this.set(this.detect());
1194
- }
1195
- get isServer() {
1196
- return this.current === "server";
1197
- }
1198
- get isClient() {
1199
- return this.current === "client";
1200
- }
1201
- detect() {
1202
- return typeof window > "u" || typeof document > "u" ? "server" : "client";
1203
- }
1204
- }
1205
- const Ee = new Pn();
1206
- function Fn(e) {
1207
- if (Ee.isServer)
1208
- return null;
1209
- if (e instanceof Node)
1210
- return e.ownerDocument;
1211
- if (Object.prototype.hasOwnProperty.call(e, "value")) {
1212
- const t = re(e);
1213
- if (t)
1214
- return t.ownerDocument;
1215
- }
1216
- return document;
1217
- }
1218
- function Ln(e, t) {
1219
- !t.vueTransition && (t.transitionName || t.transitionType) && console.warn(`[headlessui-float]: <${e} /> pass "transition-name" or "transition-type" prop, must be set "vue-transition" prop.`);
1220
- }
1221
- function Bn(e, t, n, i, o) {
1222
- k([
1223
- () => o.offset,
1224
- () => o.flip,
1225
- () => o.shift,
1226
- () => o.autoPlacement,
1227
- () => o.arrow,
1228
- () => o.hide,
1229
- () => o.middleware
1230
- ], () => {
1231
- const r = [];
1232
- (typeof o.offset == "number" || typeof o.offset == "object" || typeof o.offset == "function") && r.push(mn(o.offset)), (o.flip === !0 || typeof o.flip == "number" || typeof o.flip == "object") && r.push(gn({
1233
- padding: typeof o.flip == "number" ? o.flip : void 0,
1234
- ...typeof o.flip == "object" ? o.flip : {}
1235
- })), (o.shift === !0 || typeof o.shift == "number" || typeof o.shift == "object") && r.push(vn({
1236
- padding: typeof o.shift == "number" ? o.shift : void 0,
1237
- ...typeof o.shift == "object" ? o.shift : {}
1238
- })), (o.autoPlacement === !0 || typeof o.autoPlacement == "object") && r.push(pn(
1239
- typeof o.autoPlacement == "object" ? o.autoPlacement : void 0
1240
- )), r.push(...typeof o.middleware == "function" ? o.middleware({
1241
- referenceEl: t,
1242
- floatingEl: n
1243
- }) : o.middleware || []), (o.arrow === !0 || typeof o.arrow == "number") && r.push(On({
1244
- element: i,
1245
- padding: o.arrow === !0 ? 0 : o.arrow
1246
- })), (o.hide === !0 || typeof o.hide == "object" || Array.isArray(o.hide)) && (Array.isArray(o.hide) ? o.hide : [o.hide]).forEach((s) => {
1247
- r.push(hn(
1248
- typeof s == "object" ? s : void 0
1249
- ));
1250
- }), e.value = r;
1251
- }, { immediate: !0 });
1252
- }
1253
- function Dn(e, t, n) {
1254
- let i = () => {
1255
- };
1256
- Ve(() => {
1257
- if (e && Ee.isClient && typeof ResizeObserver < "u" && t.value && t.value instanceof Element) {
1258
- const o = new ResizeObserver(([r]) => {
1259
- n.value = r.borderBoxSize.reduce((s, { inlineSize: l }) => s + l, 0);
1260
- });
1261
- o.observe(t.value), i = () => {
1262
- o.disconnect(), n.value = null;
1263
- };
1264
- }
1265
- }), ft(() => {
1266
- i();
1267
- });
1268
- }
1269
- const Nn = (e) => {
1270
- switch (e) {
1271
- case "top":
1272
- return "origin-bottom";
1273
- case "bottom":
1274
- return "origin-top";
1275
- case "left":
1276
- return "origin-right";
1277
- case "right":
1278
- return "origin-left";
1279
- case "top-start":
1280
- case "right-end":
1281
- return "origin-bottom-left";
1282
- case "top-end":
1283
- case "left-end":
1284
- return "origin-bottom-right";
1285
- case "right-start":
1286
- case "bottom-start":
1287
- return "origin-top-left";
1288
- case "left-start":
1289
- case "bottom-end":
1290
- return "origin-top-right";
1291
- default:
1292
- return "origin-center";
1293
- }
1294
- };
1295
- function $n(e, t) {
1296
- const n = P(() => {
1297
- if (typeof e.originClass == "function")
1298
- return e.originClass(t.value);
1299
- if (typeof e.originClass == "string")
1300
- return e.originClass;
1301
- if (e.tailwindcssOriginClass)
1302
- return Nn(t.value);
1303
- }), i = P(
1304
- () => e.enter || n.value ? `${e.enter || ""} ${n.value || ""}` : void 0
1305
- ), o = P(
1306
- () => e.leave || n.value ? `${e.leave || ""} ${n.value || ""}` : void 0
1307
- );
1308
- return { originClassRef: n, enterActiveClassRef: i, leaveActiveClassRef: o };
1309
- }
1310
- function it(e, t, ...n) {
1311
- if (e in t) {
1312
- const o = t[e];
1313
- return typeof o == "function" ? o(...n) : o;
1314
- }
1315
- const i = new Error(
1316
- `Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(
1317
- t
1318
- ).map((o) => `"${o}"`).join(", ")}.`
1319
- );
1320
- throw Error.captureStackTrace && Error.captureStackTrace(i, it), i;
1321
- }
1322
- const Me = [
1323
- "[contentEditable=true]",
1324
- "[tabindex]",
1325
- "a[href]",
1326
- "area[href]",
1327
- "button:not([disabled])",
1328
- "iframe",
1329
- "input:not([disabled])",
1330
- "select:not([disabled])",
1331
- "textarea:not([disabled])"
1332
- ].map(
1333
- // TODO: Remove this once JSDOM fixes the issue where an element that is
1334
- // "hidden" can be the document.activeElement, because this is not possible
1335
- // in real browsers.
1336
- (e) => `${e}:not([tabindex='-1'])`
1337
- ).join(",");
1338
- var rt = /* @__PURE__ */ ((e) => (e[e.Strict = 0] = "Strict", e[e.Loose = 1] = "Loose", e))(rt || {});
1339
- function kn(e, t = 0) {
1340
- var n;
1341
- return e === ((n = Fn(e)) == null ? void 0 : n.body) ? !1 : it(t, {
1342
- 0() {
1343
- return e.matches(Me);
1344
- },
1345
- 1() {
1346
- let i = e;
1347
- for (; i !== null; ) {
1348
- if (i.matches(Me))
1349
- return !0;
1350
- i = i.parentElement;
1351
- }
1352
- return !1;
1353
- }
1354
- });
1355
- }
1356
- function we(e, t, n) {
1357
- Ee.isServer || dt((i) => {
1358
- document.addEventListener(e, t, n), i(() => document.removeEventListener(e, t, n));
1359
- });
1360
- }
1361
- function jn(e, t, n = P(() => !0)) {
1362
- function i(r, s) {
1363
- if (!n.value || r.defaultPrevented)
1364
- return;
1365
- const l = s(r);
1366
- if (l === null || !l.getRootNode().contains(l))
1367
- return;
1368
- const u = function c(f) {
1369
- return typeof f == "function" ? c(f()) : Array.isArray(f) || f instanceof Set ? f : [f];
1370
- }(e);
1371
- for (const c of u) {
1372
- if (c === null)
1373
- continue;
1374
- const f = c instanceof HTMLElement ? c : re(c);
1375
- if (f != null && f.contains(l) || r.composed && r.composedPath().includes(f))
1376
- return;
1377
- }
1378
- return (
1379
- // This check alllows us to know whether or not we clicked on a "focusable" element like a
1380
- // button or an input. This is a backwards compatibility check so that you can open a <Menu
1381
- // /> and click on another <Menu /> which should close Menu A and open Menu B. We might
1382
- // revisit that so that you will require 2 clicks instead.
1383
- !kn(l, rt.Loose) && // This could be improved, but the `Combobox.Button` adds tabIndex={-1} to make it
1384
- // unfocusable via the keyboard so that tabbing to the next item from the input doesn't
1385
- // first go to the button.
1386
- l.tabIndex !== -1 && r.preventDefault(), t(r, l)
1387
- );
1388
- }
1389
- const o = R(null);
1390
- we("mousedown", (r) => {
1391
- var s, l;
1392
- n.value && (o.value = ((l = (s = r.composedPath) == null ? void 0 : s.call(r)) == null ? void 0 : l[0]) || r.target);
1393
- }, !0), we(
1394
- "click",
1395
- (r) => {
1396
- o.value && (i(r, () => o.value), o.value = null);
1397
- },
1398
- // We will use the `capture` phase so that layers in between with `event.stopPropagation()`
1399
- // don't "cancel" this outside click check. E.g.: A `Menu` inside a `DialogPanel` if the `Menu`
1400
- // is open, and you click outside of it in the `DialogPanel` the `Menu` should close. However,
1401
- // the `DialogPanel` has a `onClick(e) { e.stopPropagation() }` which would cancel this.
1402
- !0
1403
- ), we("blur", (r) => i(
1404
- r,
1405
- () => window.document.activeElement instanceof HTMLIFrameElement ? window.document.activeElement : null
1406
- ), !0);
1407
- }
1408
- const _n = Symbol("ArrowContext"), x = {
1409
- as: {
1410
- type: [String, Function],
1411
- default: "template"
1412
- },
1413
- floatingAs: {
1414
- type: [String, Function],
1415
- default: "div"
1416
- },
1417
- show: {
1418
- type: Boolean,
1419
- default: null
1420
- },
1421
- placement: {
1422
- type: String,
1423
- default: "bottom-start"
1424
- },
1425
- strategy: {
1426
- type: String,
1427
- default: "absolute"
1428
- },
1429
- offset: [Number, Function, Object],
1430
- shift: {
1431
- type: [Boolean, Number, Object],
1432
- default: !1
1433
- },
1434
- flip: {
1435
- type: [Boolean, Number, Object],
1436
- default: !1
1437
- },
1438
- arrow: {
1439
- type: [Boolean, Number],
1440
- default: !1
1441
- },
1442
- autoPlacement: {
1443
- type: [Boolean, Object],
1444
- default: !1
1445
- },
1446
- hide: {
1447
- type: [Boolean, Object, Array],
1448
- default: !1
1449
- },
1450
- referenceHiddenClass: String,
1451
- escapedClass: String,
1452
- autoUpdate: {
1453
- type: [Boolean, Object],
1454
- default: !0
1455
- },
1456
- zIndex: {
1457
- type: [Number, String],
1458
- default: 9999
1459
- },
1460
- vueTransition: {
1461
- type: Boolean,
1462
- default: !1
1463
- },
1464
- transitionName: String,
1465
- transitionType: String,
1466
- enter: String,
1467
- enterFrom: String,
1468
- enterTo: String,
1469
- leave: String,
1470
- leaveFrom: String,
1471
- leaveTo: String,
1472
- originClass: [String, Function],
1473
- tailwindcssOriginClass: {
1474
- type: Boolean,
1475
- default: !1
1476
- },
1477
- portal: {
1478
- type: Boolean,
1479
- default: !1
1480
- },
1481
- transform: {
1482
- type: Boolean,
1483
- default: !1
1484
- },
1485
- adaptiveWidth: {
1486
- type: [Boolean, Object],
1487
- default: !1
1488
- },
1489
- composable: {
1490
- type: Boolean,
1491
- default: !1
1492
- },
1493
- dialog: {
1494
- type: Boolean,
1495
- default: !1
1496
- },
1497
- middleware: {
1498
- type: [Array, Function],
1499
- default: () => []
1500
- }
1501
- };
1502
- function Hn(e, t, n, i) {
1503
- const { floatingRef: o, props: r, mounted: s, show: l, referenceHidden: u, escaped: c, placement: f, floatingStyles: m, referenceElWidth: w, updateFloating: d } = i, a = pe(
1504
- { ...r, as: r.floatingAs },
1505
- t
1506
- ), { enterActiveClassRef: v, leaveActiveClassRef: g } = $n(a, f), h = {
1507
- show: s.value ? a.show : !1,
1508
- enter: v.value,
1509
- enterFrom: a.enterFrom,
1510
- enterTo: a.enterTo,
1511
- leave: g.value,
1512
- leaveFrom: a.leaveFrom,
1513
- leaveTo: a.leaveTo,
1514
- onBeforeEnter() {
1515
- l.value = !0;
1516
- },
1517
- onAfterLeave() {
1518
- l.value = !1;
1519
- }
1520
- }, y = {
1521
- name: a.transitionName,
1522
- type: a.transitionType,
1523
- appear: !0,
1524
- ...a.transitionName ? {} : {
1525
- enterActiveClass: v.value,
1526
- enterFromClass: a.enterFrom,
1527
- enterToClass: a.enterTo,
1528
- leaveActiveClass: g.value,
1529
- leaveFromClass: a.leaveFrom,
1530
- leaveToClass: a.leaveTo
1531
- },
1532
- onBeforeEnter() {
1533
- l.value = !0;
1534
- },
1535
- onAfterLeave() {
1536
- l.value = !1;
1537
- }
1538
- }, b = {
1539
- class: [
1540
- u.value ? a.referenceHiddenClass : void 0,
1541
- c.value ? a.escapedClass : void 0
1542
- ].filter((p) => !!p).join(" "),
1543
- style: {
1544
- ...m.value,
1545
- zIndex: a.zIndex
1546
- }
1547
- };
1548
- if (a.adaptiveWidth && typeof w.value == "number") {
1549
- const p = {
1550
- attribute: "width",
1551
- ...typeof a.adaptiveWidth == "object" ? a.adaptiveWidth : {}
1552
- };
1553
- b.style[p.attribute] = `${w.value}px`;
1554
- }
1555
- function C(p) {
1556
- return a.portal ? s.value ? ne(mt, () => p) : ve() : p;
1557
- }
1558
- function O(p) {
1559
- const T = pe(
1560
- b,
1561
- n,
1562
- a.dialog ? {} : { ref: o }
1563
- );
1564
- return a.as === "template" ? p : typeof a.as == "string" ? ne(a.as, T, p) : ne(a.as, T, () => p);
1565
- }
1566
- function A() {
1567
- function p() {
1568
- var T;
1569
- const F = a.as === "template" ? pe(
1570
- b,
1571
- n,
1572
- a.dialog ? {} : { ref: o }
1573
- ) : null, E = ht(e, F);
1574
- return ((T = e.props) == null ? void 0 : T.unmount) === !1 ? (d(), E) : a.vueTransition && a.show === !1 ? ve() : E;
1575
- }
1576
- return s.value ? a.vueTransition ? ne(pt, {
1577
- ...a.dialog ? { ref: o } : {},
1578
- ...y
1579
- }, p) : ne(a.transitionChild ? vt : gt, {
1580
- key: `placement-${f.value}`,
1581
- ...a.dialog ? { ref: o } : {},
1582
- as: "template",
1583
- ...h
1584
- }, p) : ve();
1585
- }
1586
- return C(
1587
- O(
1588
- A()
1589
- )
1590
- );
1591
- }
1592
- function Mn(e, t, n, i, o) {
1593
- const r = R(!1), s = Re(i, "placement"), l = Re(i, "strategy"), u = We({}), c = R(void 0), f = R(void 0), m = R(null), w = R(void 0), d = R(void 0), a = P(() => re(t)), v = P(() => re(n)), g = P(
1594
- () => He(a) && He(v)
1595
- ), { placement: h, middlewareData: y, isPositioned: b, floatingStyles: C, update: O } = An(a, v, {
1596
- placement: s,
1597
- strategy: l,
1598
- middleware: u,
1599
- // If enable dialog mode, then set `transform` to false.
1600
- transform: i.dialog ? !1 : i.transform,
1601
- // Fix transition not smooth bug when dialog mode enabled.
1602
- whileElementsMounted: i.dialog ? () => () => {
1603
- } : void 0
1604
- }), A = R(null);
1605
- Ve(() => {
1606
- r.value = !0;
1607
- }), k(e, (S, D) => {
1608
- S && !D ? o("show") : !S && D && o("hide");
1609
- }, { immediate: !0 });
1610
- function p() {
1611
- g.value && (O(), o("update"));
1612
- }
1613
- k([s, l, u], p, { flush: "sync" }), Bn(
1614
- u,
1615
- a,
1616
- v,
1617
- m,
1618
- i
1619
- ), k([y, () => i.hide, b], () => {
1620
- var S, D;
1621
- (i.hide === !0 || typeof i.hide == "object" || Array.isArray(i.hide)) && (c.value = ((S = y.value.hide) == null ? void 0 : S.referenceHidden) || !b.value, f.value = (D = y.value.hide) == null ? void 0 : D.escaped);
1622
- }), k(y, () => {
1623
- const S = y.value.arrow;
1624
- w.value = S == null ? void 0 : S.x, d.value = S == null ? void 0 : S.y;
1625
- }), Dn(!!i.adaptiveWidth, a, A), k([e, g], async (S, D, L) => {
1626
- if (await ct(), e.value && g.value && i.autoUpdate) {
1627
- const $ = dn(
1628
- a.value,
1629
- v.value,
1630
- p,
1631
- typeof i.autoUpdate == "object" ? i.autoUpdate : void 0
1632
- );
1633
- L($);
1634
- }
1635
- }, { flush: "post", immediate: !0 });
1636
- const T = R(!0);
1637
- k(a, () => {
1638
- !(a.value instanceof Element) && g.value && T.value && (T.value = !1, window.requestAnimationFrame(() => {
1639
- T.value = !0, p();
1640
- }));
1641
- }, { flush: "sync" });
1642
- const F = {
1643
- referenceRef: t,
1644
- placement: h
1645
- }, E = {
1646
- floatingRef: n,
1647
- props: i,
1648
- mounted: r,
1649
- show: e,
1650
- referenceHidden: c,
1651
- escaped: f,
1652
- placement: h,
1653
- floatingStyles: C,
1654
- referenceElWidth: A,
1655
- updateFloating: p
1656
- }, B = {
1657
- ref: m,
1658
- placement: h,
1659
- x: w,
1660
- y: d
1661
- };
1662
- return ut(_n, B), { referenceApi: F, floatingApi: E, arrowApi: B, placement: h, referenceEl: a, floatingEl: v, middlewareData: y, update: p };
1663
- }
1664
- ({
1665
- ...x.as
1666
- });
1667
- const Wn = {
1668
- as: x.as,
1669
- show: x.show,
1670
- placement: x.placement,
1671
- strategy: x.strategy,
1672
- offset: x.offset,
1673
- shift: x.shift,
1674
- flip: x.flip,
1675
- arrow: x.arrow,
1676
- autoPlacement: x.autoPlacement,
1677
- autoUpdate: x.autoUpdate,
1678
- zIndex: x.zIndex,
1679
- vueTransition: x.vueTransition,
1680
- transitionName: x.transitionName,
1681
- transitionType: x.transitionType,
1682
- enter: x.enter,
1683
- enterFrom: x.enterFrom,
1684
- enterTo: x.enterTo,
1685
- leave: x.leave,
1686
- leaveFrom: x.leaveFrom,
1687
- leaveTo: x.leaveTo,
1688
- originClass: x.originClass,
1689
- tailwindcssOriginClass: x.tailwindcssOriginClass,
1690
- portal: x.portal,
1691
- transform: x.transform,
1692
- middleware: x.middleware
1693
- }, In = {
1694
- name: "FloatVirtual",
1695
- inheritAttrs: !1,
1696
- props: Wn,
1697
- emits: ["initial", "show", "hide", "update"],
1698
- setup(e, { emit: t, slots: n, attrs: i }) {
1699
- Ln("FloatVirtual", e);
1700
- const o = R(e.show ?? !1), r = R({
1701
- getBoundingClientRect() {
1702
- return {
1703
- x: 0,
1704
- y: 0,
1705
- top: 0,
1706
- left: 0,
1707
- bottom: 0,
1708
- right: 0,
1709
- width: 0,
1710
- height: 0
1711
- };
1712
- }
1713
- }), s = R(null), {
1714
- floatingApi: l,
1715
- placement: u
1716
- } = Mn(o, r, s, e, t);
1717
- k(() => e.show, () => {
1718
- o.value = e.show ?? !1;
1719
- });
1720
- function c() {
1721
- o.value = !1;
1722
- }
1723
- return t("initial", {
1724
- show: o,
1725
- placement: u,
1726
- reference: r,
1727
- floating: s
1728
- }), () => {
1729
- if (!n.default)
1730
- return;
1731
- const f = {
1732
- placement: u.value,
1733
- close: c
1734
- }, [m] = ot(n.default(f)).filter(Rn);
1735
- return Hn(
1736
- m,
1737
- {
1738
- as: e.as,
1739
- show: o.value
1740
- },
1741
- i,
1742
- l
1743
- );
1744
- };
1745
- }
1746
- };
1747
- x.as, x.placement, x.strategy, x.offset, x.shift, {
1748
- ...x.flip
1749
- }, x.arrow, x.autoPlacement, x.autoUpdate, x.zIndex, x.vueTransition, x.transitionName, x.transitionType, x.enter, x.enterFrom, x.enterTo, x.leave, x.leaveFrom, x.leaveTo, x.originClass, x.tailwindcssOriginClass, x.transform, x.middleware;
1750
- const Vn = { class: "flex bg-white shadow-md z-10 rounded-md p-1" }, zn = ["onClick"], Xn = /* @__PURE__ */ wt({
1751
- __name: "StylePanel",
1752
- setup(e) {
1753
- yt({ WATCH_ARRAY: !1 });
1754
- const t = R({ value: null }), n = xt(), i = P(
1755
- () => n.getters.onContentChange || (() => {
1756
- })
1757
- ), o = P(
1758
- () => bt(n.getters.diagramElement) + Ct
1759
- ), r = P(() => n.getters.code), s = (m) => {
1760
- n.dispatch("updateCode", { code: m }), i.value(m);
1761
- }, l = R([]);
1762
- let u;
1763
- const c = ({ show: m, reference: w, floating: d }) => {
1764
- let a, v, g, h, y, b;
1765
- n.commit("onMessageClick", (C, O) => {
1766
- var A;
1767
- if (a = C.value.start.start, v = Pt(r.value, a), g = Ft(r.value, a), h = ((A = r.value.slice(v).match(/^\s*/)) == null ? void 0 : A[0]) || "", y = g.trim().startsWith("//"), y) {
1768
- const p = g.trimStart().slice(2).trimStart(), T = p.indexOf("["), F = p.indexOf("]");
1769
- b = !!(T === 0 && F), b ? l.value = p.slice(T + 1, F).split(",").map((E) => E.trim()) : l.value = [];
1770
- }
1771
- w.value = {
1772
- getBoundingClientRect: () => O.getBoundingClientRect()
1773
- }, t.value = C, m.value = !0;
1774
- }), jn(
1775
- d,
1776
- () => {
1777
- m.value = !1, l.value = [];
1778
- },
1779
- P(() => m.value)
1780
- ), u = (C) => {
1781
- var O;
1782
- if (m.value = !1, !!t.value.value)
1783
- if (y) {
1784
- let A = "";
1785
- if (b) {
1786
- let p;
1787
- l.value.includes(C) ? p = l.value.filter((T) => T !== C) : p = [...l.value, C], A = `${h}// [${p.filter(Boolean).join(", ")}] ${g.slice(g.indexOf("]") + 1).trimStart()}`;
1788
- } else
1789
- A = `${h}// [${C}] ${g.slice((((O = g.match(/\/\/*/)) == null ? void 0 : O.index) || -2) + 2).trimStart()}`;
1790
- A.endsWith(`
1791
- `) || (A += `
1792
- `), s(
1793
- r.value.slice(0, Lt(r.value, a)) + A + r.value.slice(v)
1794
- );
1795
- } else
1796
- s(
1797
- r.value.slice(0, v) + `${h}// [${C}]
1798
- ` + r.value.slice(v)
1799
- );
1800
- };
1801
- }, f = [
1802
- {
1803
- name: "bold",
1804
- content: "B",
1805
- class: "font-bold"
1806
- },
1807
- {
1808
- name: "italic",
1809
- content: "I",
1810
- class: "italic"
1811
- },
1812
- {
1813
- name: "underline",
1814
- content: "U",
1815
- class: "underline"
1816
- },
1817
- {
1818
- name: "strikethrough",
1819
- content: "S",
1820
- class: "line-through"
1821
- }
1822
- ];
1823
- return (m, w) => (Pe(), Ot(H(In), {
1824
- "vue-transition": "",
1825
- id: "style-panel",
1826
- key: "tool",
1827
- onInitial: c,
1828
- placement: "top",
1829
- offset: 5,
1830
- flip: { padding: H(o) },
1831
- shift: "",
1832
- zIndex: "30"
1833
- }, {
1834
- default: At(() => [
1835
- ge("div", Vn, [
1836
- (Pe(), Tt(Ie, null, St(f, (d) => ge("div", {
1837
- onClick: () => H(u)(d.class),
1838
- key: d.name
1839
- }, [
1840
- ge("div", {
1841
- class: Et(["w-6 mx-1 py-1 rounded-md text-black text-center cursor-pointer hover:bg-gray-200", [
1842
- d.class,
1843
- { "bg-gray-100": l.value.includes(d.class) }
1844
- ]])
1845
- }, Rt(d.content), 3)
1846
- ], 8, zn)), 64))
1847
- ])
1848
- ], void 0, !0),
1849
- _: 1
1850
- }, 8, ["flip"]));
1851
- }
1852
- });
1853
- export {
1854
- Xn as default
1855
- };
1856
- //# sourceMappingURL=StylePanel-2e273819.js.map