zombie-mermaid 2.2.2 → 2.2.3
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/dist/ascii.cjs +7 -7
- package/dist/ascii.cjs.map +1 -1
- package/dist/ascii.js +943 -913
- package/dist/ascii.js.map +1 -1
- package/dist/cli.js +3265 -3229
- package/dist/index.cjs +51 -51
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +191 -161
- package/dist/index.js.map +1 -1
- package/dist/mcp.cjs +84 -13
- package/dist/mcp.cjs.map +1 -1
- package/dist/mcp.js +84 -13
- package/dist/mcp.js.map +1 -1
- package/package.json +3 -3
- package/packages/ascii-renderer/src/class-diagram.ts +192 -12
- package/packages/ascii-renderer/src/sequence.ts +42 -8
- package/src/__tests__/ascii-class-box-occupancy.test.ts +82 -43
- package/src/__tests__/ascii-class-detour-label-routing-487.test.ts +8 -8
- package/src/__tests__/ascii-class-parent-alignment-971.test.ts +139 -0
- package/src/__tests__/ascii-class-parent-alignment-972.test.ts +208 -0
- package/src/__tests__/ascii-sequence-form-invariants.test.ts +51 -0
package/dist/index.js
CHANGED
|
@@ -412,7 +412,7 @@ var A = {
|
|
|
412
412
|
"m",
|
|
413
413
|
"@",
|
|
414
414
|
"%"
|
|
415
|
-
]),
|
|
415
|
+
]), te = /* @__PURE__ */ new Set(["W", "M"]), M = /* @__PURE__ */ new Set([
|
|
416
416
|
"(",
|
|
417
417
|
")",
|
|
418
418
|
"[",
|
|
@@ -459,18 +459,18 @@ function se(e) {
|
|
|
459
459
|
let e = A[n];
|
|
460
460
|
if (e !== void 0) return e;
|
|
461
461
|
}
|
|
462
|
-
return e === " " ? .3 :
|
|
462
|
+
return e === " " ? .3 : te.has(e) ? 1.5 : ee.has(e) ? 1.2 : j.has(e) ? .4 : M.has(e) ? .5 : e === "r" ? .8 : t >= 65 && t <= 90 ? 1.2 : 1;
|
|
463
463
|
}
|
|
464
|
-
var ce = .6,
|
|
465
|
-
function
|
|
464
|
+
var ce = .6, le = !1;
|
|
465
|
+
function ue(e) {
|
|
466
466
|
return /mono|consol|menlo|courier|\bcode\b/i.test(e);
|
|
467
467
|
}
|
|
468
|
-
function
|
|
469
|
-
|
|
468
|
+
function F(e) {
|
|
469
|
+
le = e;
|
|
470
470
|
}
|
|
471
471
|
function de(e, t, n) {
|
|
472
472
|
let r = t * .15;
|
|
473
|
-
if (
|
|
473
|
+
if (le) {
|
|
474
474
|
let n = 0;
|
|
475
475
|
for (let t of e) n += 1;
|
|
476
476
|
return n * t * ce + r;
|
|
@@ -509,7 +509,7 @@ function L(e) {
|
|
|
509
509
|
return e.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
510
510
|
}
|
|
511
511
|
var ge = /<(\/)?(?:(b|strong)|(i|em)|(u)|(s|del))\s*>/gi;
|
|
512
|
-
function
|
|
512
|
+
function _e(e) {
|
|
513
513
|
let t = [], n = !1, r = !1, i = !1, a = !1, o = 0;
|
|
514
514
|
ge.lastIndex = 0;
|
|
515
515
|
let s;
|
|
@@ -532,10 +532,10 @@ function R(e) {
|
|
|
532
532
|
strikethrough: a
|
|
533
533
|
}), t;
|
|
534
534
|
}
|
|
535
|
-
var
|
|
536
|
-
function
|
|
537
|
-
if (!
|
|
538
|
-
let t =
|
|
535
|
+
var ve = /<\/?(?:b|strong|i|em|u|s|del)\s*>/i;
|
|
536
|
+
function R(e) {
|
|
537
|
+
if (!ve.test(e)) return he(e);
|
|
538
|
+
let t = _e(e);
|
|
539
539
|
return t.length === 0 ? "" : t.every((e) => !e.bold && !e.italic && !e.underline && !e.strikethrough) ? t.map((e) => he(e.text)).join("") : t.map((e) => {
|
|
540
540
|
let t = he(e.text);
|
|
541
541
|
if (!e.bold && !e.italic && !e.underline && !e.strikethrough) return t;
|
|
@@ -547,9 +547,9 @@ function ve(e) {
|
|
|
547
547
|
}
|
|
548
548
|
function z(e, t, n, r, i, a = .35) {
|
|
549
549
|
let o = e.split("\n");
|
|
550
|
-
if (o.length === 1) return `<text x="${t}" y="${n}" ${i} dy="${r * a}">${
|
|
550
|
+
if (o.length === 1) return `<text x="${t}" y="${n}" ${i} dy="${r * a}">${R(e)}</text>`;
|
|
551
551
|
let s = r * fe, c = -((o.length - 1) / 2) * s + r * a;
|
|
552
|
-
return `<text x="${t}" y="${n}" ${i}>${o.map((e, n) => `<tspan x="${t}" dy="${n === 0 ? c : s}">${
|
|
552
|
+
return `<text x="${t}" y="${n}" ${i}>${o.map((e, n) => `<tspan x="${t}" dy="${n === 0 ? c : s}">${R(e)}</tspan>`).join("")}</text>`;
|
|
553
553
|
}
|
|
554
554
|
function ye(e, t, n, r, i, a, o, s, c) {
|
|
555
555
|
let l = r + o * 2, u = i + o * 2;
|
|
@@ -595,7 +595,7 @@ function Ce(e, t) {
|
|
|
595
595
|
}
|
|
596
596
|
return !0;
|
|
597
597
|
}
|
|
598
|
-
function
|
|
598
|
+
function we(e, t) {
|
|
599
599
|
let n = e.match(/^style\s+([\w,-]+)\s+(.+)$/);
|
|
600
600
|
if (!n) return !1;
|
|
601
601
|
let r = be(n[2]);
|
|
@@ -605,14 +605,14 @@ function B(e, t) {
|
|
|
605
605
|
});
|
|
606
606
|
return !0;
|
|
607
607
|
}
|
|
608
|
-
function
|
|
608
|
+
function Te(e) {
|
|
609
609
|
let t = e.match(/^(.+?):::([\w][\w-]*)$/);
|
|
610
610
|
return t ? {
|
|
611
611
|
id: t[1],
|
|
612
612
|
className: t[2]
|
|
613
613
|
} : { id: e };
|
|
614
614
|
}
|
|
615
|
-
function
|
|
615
|
+
function B(e, t) {
|
|
616
616
|
let n, r = t.classDefs.get("default");
|
|
617
617
|
r && (n = { ...r });
|
|
618
618
|
let i = t.classAssignments.get(e);
|
|
@@ -898,7 +898,7 @@ function Ge(e) {
|
|
|
898
898
|
});
|
|
899
899
|
continue;
|
|
900
900
|
}
|
|
901
|
-
if (xe(d, t) ||
|
|
901
|
+
if (xe(d, t) || we(d, t) || Ce(d, t) || Se(d, t)) continue;
|
|
902
902
|
let p = d.match(/^namespace\s+(\S+)\s*\{$/);
|
|
903
903
|
if (p) {
|
|
904
904
|
i = {
|
|
@@ -948,7 +948,7 @@ function Ge(e) {
|
|
|
948
948
|
if (a !== null) throw Error(`Line ${s}: Unclosed class body for "${a.id}" — expected a closing "}" before the diagram ends.`);
|
|
949
949
|
return t.classes = [...r.values()], t;
|
|
950
950
|
function c(e, n, a = !0) {
|
|
951
|
-
let { id: o, className: s } =
|
|
951
|
+
let { id: o, className: s } = Te(e), c = o, l = n;
|
|
952
952
|
if (!l) {
|
|
953
953
|
let e = o.match(/^(.+?)~(\w+)~$/);
|
|
954
954
|
e && (c = e[1], l = e[2]);
|
|
@@ -1800,7 +1800,7 @@ function Wt(e) {
|
|
|
1800
1800
|
}, a = [];
|
|
1801
1801
|
for (let t = 1; t < e.length; t++) {
|
|
1802
1802
|
let n = e[t].text;
|
|
1803
|
-
if (xe(n, i) || Se(n, i) ||
|
|
1803
|
+
if (xe(n, i) || Se(n, i) || we(n, i)) continue;
|
|
1804
1804
|
if (/^click\s+/i.test(n)) {
|
|
1805
1805
|
rn(n, i);
|
|
1806
1806
|
continue;
|
|
@@ -3021,7 +3021,7 @@ function Dr(e, t, n, r, i, a, o) {
|
|
|
3021
3021
|
} else {
|
|
3022
3022
|
let a = t.nodes.get(s.id);
|
|
3023
3023
|
if (a) {
|
|
3024
|
-
let n =
|
|
3024
|
+
let n = B(s.id, t), i = t.classAssignments.get(s.id);
|
|
3025
3025
|
r.push({
|
|
3026
3026
|
id: s.id,
|
|
3027
3027
|
label: a.label,
|
|
@@ -3802,7 +3802,7 @@ function $i(e, t, n, r) {
|
|
|
3802
3802
|
attrHeight: i.attrHeight,
|
|
3803
3803
|
methodHeight: i.methodHeight,
|
|
3804
3804
|
interaction: t.interactions.get(e.id),
|
|
3805
|
-
inlineStyle:
|
|
3805
|
+
inlineStyle: B(e.id, t),
|
|
3806
3806
|
className: t.classAssignments.get(e.id)
|
|
3807
3807
|
});
|
|
3808
3808
|
}
|
|
@@ -4488,9 +4488,9 @@ function Pa(e, t = {}) {
|
|
|
4488
4488
|
return r !== void 0 && (i.destroyed = !0), i;
|
|
4489
4489
|
});
|
|
4490
4490
|
for (let e of p) e.height = O - n.padding + n.boxPad - e.y;
|
|
4491
|
-
let
|
|
4491
|
+
let te = A + j + n.padding;
|
|
4492
4492
|
return {
|
|
4493
|
-
width: Math.max(
|
|
4493
|
+
width: Math.max(te, 200),
|
|
4494
4494
|
height: Math.max(O, 100),
|
|
4495
4495
|
actors: f,
|
|
4496
4496
|
lifelines: ee,
|
|
@@ -4654,7 +4654,7 @@ function Ja(e) {
|
|
|
4654
4654
|
x: u + f / 2,
|
|
4655
4655
|
y: h - U.padding
|
|
4656
4656
|
} } : {}
|
|
4657
|
-
},
|
|
4657
|
+
}, te = {
|
|
4658
4658
|
ticks: S,
|
|
4659
4659
|
line: j,
|
|
4660
4660
|
...e.yAxis.title ? { title: {
|
|
@@ -4673,7 +4673,7 @@ function Ja(e) {
|
|
|
4673
4673
|
y: U.padding + U.titleFontSize
|
|
4674
4674
|
} : void 0,
|
|
4675
4675
|
xAxis: ee,
|
|
4676
|
-
yAxis:
|
|
4676
|
+
yAxis: te,
|
|
4677
4677
|
plotArea: g,
|
|
4678
4678
|
bars: E,
|
|
4679
4679
|
lines: D,
|
|
@@ -4769,7 +4769,7 @@ function Ya(e) {
|
|
|
4769
4769
|
y1: u,
|
|
4770
4770
|
x2: f,
|
|
4771
4771
|
y2: u + h
|
|
4772
|
-
},
|
|
4772
|
+
}, te = {
|
|
4773
4773
|
ticks: S,
|
|
4774
4774
|
line: j,
|
|
4775
4775
|
...e.yAxis.title ? { title: {
|
|
@@ -4777,7 +4777,7 @@ function Ya(e) {
|
|
|
4777
4777
|
x: f + m / 2,
|
|
4778
4778
|
y: _ - U.padding
|
|
4779
4779
|
} } : {}
|
|
4780
|
-
},
|
|
4780
|
+
}, M = {
|
|
4781
4781
|
ticks: C,
|
|
4782
4782
|
line: ee,
|
|
4783
4783
|
...e.xAxis.title ? { title: {
|
|
@@ -4796,8 +4796,8 @@ function Ya(e) {
|
|
|
4796
4796
|
height: _,
|
|
4797
4797
|
horizontal: !0,
|
|
4798
4798
|
title: ne,
|
|
4799
|
-
xAxis:
|
|
4800
|
-
yAxis:
|
|
4799
|
+
xAxis: te,
|
|
4800
|
+
yAxis: M,
|
|
4801
4801
|
plotArea: v,
|
|
4802
4802
|
bars: D,
|
|
4803
4803
|
lines: O,
|
|
@@ -5730,12 +5730,12 @@ function Cs(e, t, n, r) {
|
|
|
5730
5730
|
}
|
|
5731
5731
|
}
|
|
5732
5732
|
}
|
|
5733
|
-
let
|
|
5734
|
-
for (let t = 0; t < e.series.length; t++) e.series[t].type === "line" &&
|
|
5733
|
+
let te = [];
|
|
5734
|
+
for (let t = 0; t < e.series.length; t++) e.series[t].type === "line" && te.push({
|
|
5735
5735
|
data: e.series[t].data,
|
|
5736
5736
|
globalIdx: t
|
|
5737
5737
|
});
|
|
5738
|
-
for (let e of
|
|
5738
|
+
for (let e of te) {
|
|
5739
5739
|
if (e.data.length === 0) continue;
|
|
5740
5740
|
let n = k[e.globalIdx];
|
|
5741
5741
|
Ts(E, D, e.data, j, A, v, u, b, d * i, t, O, n);
|
|
@@ -8755,11 +8755,11 @@ function wu(e, t, n, r) {
|
|
|
8755
8755
|
for (let r of j) if (Math.abs(r.x - e) === 1 && t <= r.yEnd && n >= r.yStart) return !0;
|
|
8756
8756
|
return !1;
|
|
8757
8757
|
}
|
|
8758
|
-
function
|
|
8758
|
+
function te(e, t, n) {
|
|
8759
8759
|
for (let r of j) if (!(Math.abs(r.x - e) > 1) && t <= r.yEnd && n >= r.yStart) return !0;
|
|
8760
8760
|
return !1;
|
|
8761
8761
|
}
|
|
8762
|
-
function
|
|
8762
|
+
function M(e, t, n) {
|
|
8763
8763
|
j.push({
|
|
8764
8764
|
x: e,
|
|
8765
8765
|
yStart: t,
|
|
@@ -8805,12 +8805,12 @@ function wu(e, t, n, r) {
|
|
|
8805
8805
|
if (Math.abs(c - d) < Math.max(t.height, n.height)) {
|
|
8806
8806
|
let [c, d] = o < u ? [t, n] : [n, t], [f, p] = o < u ? [e.cardinality1, e.cardinality2] : [e.cardinality2, e.cardinality1], m = c.x + c.width, h = d.x - 1, _ = c.y + Math.floor(c.height / 2), v;
|
|
8807
8807
|
for (let e of g.values()) e !== c && e !== d && e.y === c.y && e.x < h + 1 && e.x + e.width > m && (v = Math.max(v ?? 0, e.y + e.height));
|
|
8808
|
-
let y = h - m + 1, b = +(y >= l + 1), C = xu(f, a, !1), w = xu(p, a, !0), E = +(y >= 3 && C[0] === N), D = +(y >= 3 && w[w.length - 1] === N), j = m + E, ee = h - D,
|
|
8808
|
+
let y = h - m + 1, b = +(y >= l + 1), C = xu(f, a, !1), w = xu(p, a, !0), E = +(y >= 3 && C[0] === N), D = +(y >= 3 && w[w.length - 1] === N), j = m + E, ee = h - D, te;
|
|
8809
8809
|
if (v === void 0) {
|
|
8810
8810
|
for (let e = m; e <= h; e++) k(e, _, r, "line");
|
|
8811
|
-
if (
|
|
8811
|
+
if (te = _ + 1, e.label) {
|
|
8812
8812
|
let t = m + b, n = h - b, r = $(e.label).length, i = _ + 1 + Math.max(s - 1, 1);
|
|
8813
|
-
for (;
|
|
8813
|
+
for (; te < i && !A(t, n, te, te + r - 1);) te++;
|
|
8814
8814
|
}
|
|
8815
8815
|
} else {
|
|
8816
8816
|
let t = Math.max(c.y + c.height, d.y + d.height, v), n = e.label ? $(e.label).length : 0, a = t + 1, o = t + Math.max(s * 3, 4);
|
|
@@ -8818,14 +8818,14 @@ function wu(e, t, n, r) {
|
|
|
8818
8818
|
ns(x, h + 1, a + n + 1), $o(S, h + 1, a + n + 1);
|
|
8819
8819
|
for (let e = _; e <= a; e++) O(m, e, i, "line"), O(h, e, i, "line");
|
|
8820
8820
|
for (let e = m; e <= h; e++) k(e, a, r, "line");
|
|
8821
|
-
m !== h && (oe(m, a, "up", "right"), oe(h, a, "up", "left")),
|
|
8821
|
+
m !== h && (oe(m, a, "up", "right"), oe(h, a, "up", "left")), te = a + 1;
|
|
8822
8822
|
}
|
|
8823
8823
|
for (let e = 0; e < C.length; e++) O(j + e, _, C[e], "arrow");
|
|
8824
8824
|
for (let e = 0; e < w.length; e++) O(ee - w.length + 1 + e, _, w[e], "arrow");
|
|
8825
8825
|
if (e.label) {
|
|
8826
8826
|
let t = $(e.label), n = Math.floor((m + h) / 2), r = m + b, i = h - b;
|
|
8827
8827
|
for (let e = 0; e < t.length; e++) {
|
|
8828
|
-
let a = t[e], o = Yo(a), s = Math.max(r, n - Math.floor(o.length / 2)), c =
|
|
8828
|
+
let a = t[e], o = Yo(a), s = Math.max(r, n - Math.floor(o.length / 2)), c = te + e;
|
|
8829
8829
|
if (ns(x, Math.max(s + o.length, 1), Math.max(c + 1, 1)), $o(S, Math.max(s + o.length, 1), Math.max(c + 1, 1)), T(o, s, c, r, i)) for (let e = 0; e < o.length; e++) {
|
|
8830
8830
|
let t = s + e;
|
|
8831
8831
|
t >= r && t <= i && O(t, c, o[e], "text");
|
|
@@ -8845,44 +8845,44 @@ function wu(e, t, n, r) {
|
|
|
8845
8845
|
for (let r = T; r <= j; r++) if (A(e, t, r, r + n)) return r;
|
|
8846
8846
|
return r;
|
|
8847
8847
|
}
|
|
8848
|
-
let N = m !== h, re = Math.min(m, h), ie = Math.max(m, h), ae = N ? ne(re, ie, 0) : p,
|
|
8849
|
-
if (
|
|
8848
|
+
let N = m !== h, re = Math.min(m, h), ie = Math.max(m, h), ae = N ? ne(re, ie, 0) : p, le = N ? ae - 1 : p, ue = !_(m, T, j) || !_(h, T, j) || ee(m, f, N ? ae : p) || N && ee(h, ae, p), F = m;
|
|
8849
|
+
if (ue) {
|
|
8850
8850
|
let e = x.length, t;
|
|
8851
8851
|
for (let n = 0; n <= e; n++) {
|
|
8852
8852
|
let e = m + n;
|
|
8853
|
-
if (_(e, f, p) && !
|
|
8853
|
+
if (_(e, f, p) && !te(e, f, p)) {
|
|
8854
8854
|
t = e;
|
|
8855
8855
|
break;
|
|
8856
8856
|
}
|
|
8857
8857
|
let r = m - n;
|
|
8858
|
-
if (n > 0 && _(r, f, p) && !
|
|
8858
|
+
if (n > 0 && _(r, f, p) && !te(r, f, p)) {
|
|
8859
8859
|
t = r;
|
|
8860
8860
|
break;
|
|
8861
8861
|
}
|
|
8862
8862
|
}
|
|
8863
|
-
|
|
8863
|
+
F = t ?? m;
|
|
8864
8864
|
for (let e = f; e <= v; e++) O(m, e, i, "line");
|
|
8865
|
-
for (let e = Math.min(m,
|
|
8866
|
-
for (let e = v; e <= y; e++) O(
|
|
8867
|
-
for (let e = Math.min(
|
|
8865
|
+
for (let e = Math.min(m, F); e <= Math.max(m, F); e++) k(e, v, r, "line");
|
|
8866
|
+
for (let e = v; e <= y; e++) O(F, e, i, "line");
|
|
8867
|
+
for (let e = Math.min(F, h); e <= Math.max(F, h); e++) k(e, y, r, "line");
|
|
8868
8868
|
for (let e = y; e <= p; e++) O(h, e, i, "line");
|
|
8869
|
-
if (m !==
|
|
8870
|
-
let e =
|
|
8871
|
-
oe(m, v, "up", e), oe(
|
|
8869
|
+
if (m !== F) {
|
|
8870
|
+
let e = F > m ? "right" : "left", t = e === "right" ? "left" : "right";
|
|
8871
|
+
oe(m, v, "up", e), oe(F, v, "down", t);
|
|
8872
8872
|
}
|
|
8873
|
-
if (
|
|
8874
|
-
let e = h >
|
|
8875
|
-
oe(
|
|
8873
|
+
if (F !== h) {
|
|
8874
|
+
let e = h > F ? "right" : "left", t = e === "right" ? "left" : "right";
|
|
8875
|
+
oe(F, y, "up", e), oe(h, y, "down", t);
|
|
8876
8876
|
}
|
|
8877
|
-
|
|
8877
|
+
M(F, v, y);
|
|
8878
8878
|
} else {
|
|
8879
|
-
for (let e = f; e <=
|
|
8880
|
-
if (
|
|
8879
|
+
for (let e = f; e <= le; e++) O(m, e, i, "line");
|
|
8880
|
+
if (M(m, f, N ? ae : le), N) {
|
|
8881
8881
|
for (let e = re; e <= ie; e++) k(e, ae, r, "line");
|
|
8882
8882
|
for (let e = ae + 1; e <= p; e++) O(h, e, i, "line");
|
|
8883
|
-
|
|
8883
|
+
M(h, ae, p);
|
|
8884
8884
|
let e = h > m ? "right" : "left", t = e === "right" ? "left" : "right";
|
|
8885
|
-
oe(m, ae, "up", e), oe(h, ae, "down", t),
|
|
8885
|
+
oe(m, ae, "up", e), oe(h, ae, "down", t), F = h;
|
|
8886
8886
|
}
|
|
8887
8887
|
}
|
|
8888
8888
|
let de = xu(l, a, !1, !0);
|
|
@@ -8890,7 +8890,7 @@ function wu(e, t, n, r) {
|
|
|
8890
8890
|
let fe = m === h ? m : h, pe = xu(u, a, !0, !0);
|
|
8891
8891
|
for (let e = 0; e < pe.length; e++) O(fe - Math.floor(pe.length / 2) + e, y, pe[e], "arrow");
|
|
8892
8892
|
if (e.label) {
|
|
8893
|
-
let t = $(e.label), n = Math.max(de.length - 1 - Math.floor(de.length / 2), pe.length - 1 - Math.floor(pe.length / 2)), r =
|
|
8893
|
+
let t = $(e.label), n = Math.max(de.length - 1 - Math.floor(de.length / 2), pe.length - 1 - Math.floor(pe.length / 2)), r = F + n + 2, i = t.map((e) => Yo(e)), a = r + Math.max(...i.map((e) => e.length)) - 1, o = t.length, s = Math.floor((f + p) / 2) - Math.floor((o - 1) / 2);
|
|
8894
8894
|
a >= 0 && (ns(x, a + 1, p + 1), $o(S, a + 1, p + 1));
|
|
8895
8895
|
let c = null;
|
|
8896
8896
|
for (let e = 0; e <= p - f && c === null; e++) {
|
|
@@ -8950,14 +8950,14 @@ function Au(e, t, n, r) {
|
|
|
8950
8950
|
i.actors.forEach((e, t) => {
|
|
8951
8951
|
e.createdAt !== void 0 && A.set(e.createdAt, t), e.destroyedAt !== void 0 && j.set(e.destroyedAt, t);
|
|
8952
8952
|
});
|
|
8953
|
-
let ee = /* @__PURE__ */ new Map(),
|
|
8953
|
+
let ee = /* @__PURE__ */ new Map(), te = /* @__PURE__ */ new Map(), M = i.boxes.filter((e) => e.actorIds.length > 0).map((e) => {
|
|
8954
8954
|
let t = e.actorIds.map(_);
|
|
8955
8955
|
return {
|
|
8956
8956
|
label: e.label,
|
|
8957
8957
|
lo: Math.min(...t),
|
|
8958
8958
|
hi: Math.max(...t)
|
|
8959
8959
|
};
|
|
8960
|
-
}), ne =
|
|
8960
|
+
}), ne = M.length > 0, N = i.actors.map((e, t) => M.findIndex((e) => e.lo <= t && t <= e.hi)), re = +!!ne, ie = (e) => e === "" ? 0 : kc(e) + 6, ae = Array(Math.max(i.actors.length - 1, 0)).fill(0);
|
|
8961
8961
|
for (let e of i.messages) {
|
|
8962
8962
|
let t = _(e.from), n = _(e.to);
|
|
8963
8963
|
if (t === n) continue;
|
|
@@ -8968,21 +8968,23 @@ function Au(e, t, n, r) {
|
|
|
8968
8968
|
let t = $(e.text);
|
|
8969
8969
|
return Math.max(...t.map((e) => Jo(e))) + 2 + 2 * b;
|
|
8970
8970
|
}
|
|
8971
|
-
let P = Array(i.actors.length).fill(0), se = Array(i.actors.length).fill(0);
|
|
8972
|
-
for (let e of i.notes) {
|
|
8973
|
-
|
|
8974
|
-
let t = g.get(e.actorIds[0]) ?? 0, n = oe(e);
|
|
8971
|
+
let P = Array(i.actors.length).fill(0), se = Array(i.actors.length).fill(0), ce = Array(i.actors.length).fill(0), le = Array(i.actors.length).fill(0);
|
|
8972
|
+
for (let e of i.notes) if (e.position === "left" || e.position === "right") {
|
|
8973
|
+
let t = _(e.actorIds[0]), n = oe(e);
|
|
8975
8974
|
e.position === "left" ? P[t] = Math.max(P[t], n) : se[t] = Math.max(se[t], n);
|
|
8975
|
+
} else if (e.position === "over" && e.actorIds.length === 1) {
|
|
8976
|
+
let t = _(e.actorIds[0]), n = oe(e), r = Math.floor(n / 2), i = n - r;
|
|
8977
|
+
ce[t] = Math.max(ce[t], r), le[t] = Math.max(le[t], i);
|
|
8976
8978
|
}
|
|
8977
|
-
let
|
|
8979
|
+
let ue = qs(t.paddingX, 5, 10, 4), F = [Math.max(w[0] + (N[0] === -1 ? 0 : 2), P[0] + 1, ce[0])];
|
|
8978
8980
|
for (let e = 1; e < i.actors.length; e++) {
|
|
8979
|
-
let t = N[e - 1], n = N[e], r = t === n ? 0 : (t === -1 ? 0 : 1) + (n === -1 ? 0 : 1), i = r === 0 ? 0 : r * 2 - 1, a = Math.max(se[e - 1], P[e]) + 2, o = Math.max(w[e - 1] + w[e] + 2 + i, ae[e - 1] + 2, a,
|
|
8981
|
+
let t = N[e - 1], n = N[e], r = t === n ? 0 : (t === -1 ? 0 : 1) + (n === -1 ? 0 : 1), i = r === 0 ? 0 : r * 2 - 1, a = Math.max(se[e - 1], P[e], le[e - 1], ce[e]) + 2, o = Math.max(w[e - 1] + w[e] + 2 + i, ae[e - 1] + 2, a, ue);
|
|
8980
8982
|
F[e] = F[e - 1] + o;
|
|
8981
8983
|
}
|
|
8982
|
-
let
|
|
8983
|
-
for (let e of
|
|
8984
|
+
let de = (e) => D(e.lo, F[e.lo]) - 1 - 1, fe = (e) => Math.max(D(e.hi, F[e.hi]) + C[e.hi] - 1 + 1 + 1, de(e) + ie(e.label) - 1);
|
|
8985
|
+
for (let e of M) {
|
|
8984
8986
|
if (e.hi + 1 >= i.actors.length) continue;
|
|
8985
|
-
let t = D(e.hi + 1, F[e.hi + 1]), n = N[e.hi + 1] === -1 ? 0 : 2, r =
|
|
8987
|
+
let t = D(e.hi + 1, F[e.hi + 1]), n = N[e.hi + 1] === -1 ? 0 : 2, r = fe(e) + 1 + 1 + n - t;
|
|
8986
8988
|
if (r > 0) {
|
|
8987
8989
|
let t = F.slice(e.hi + 1).map((e) => e + r);
|
|
8988
8990
|
F.splice(e.hi + 1, t.length, ...t);
|
|
@@ -9004,10 +9006,10 @@ function Au(e, t, n, r) {
|
|
|
9004
9006
|
F.splice(n + 1, e.length, ...e);
|
|
9005
9007
|
}
|
|
9006
9008
|
}
|
|
9007
|
-
let
|
|
9009
|
+
let pe = [], I = [], me = /* @__PURE__ */ new Map(), he = /* @__PURE__ */ new Map(), L = /* @__PURE__ */ new Map(), ge = [], _e = re, ve = _e + E, R = ve + re, z = qs(t.paddingY, 5, 1, 0), ye = Math.max(z, 1);
|
|
9008
9010
|
for (let e of i.notes) {
|
|
9009
9011
|
if (e.afterIndex !== -1) continue;
|
|
9010
|
-
R +=
|
|
9012
|
+
R += z;
|
|
9011
9013
|
let t = $(e.text), n = oe(e), r = t.length + 2, i = g.get(e.actorIds[0]) ?? 0, a;
|
|
9012
9014
|
if (e.position === "left") a = F[i] - n - 1;
|
|
9013
9015
|
else if (e.position === "right") a = F[i] + 2;
|
|
@@ -9015,7 +9017,7 @@ function Au(e, t, n, r) {
|
|
|
9015
9017
|
let t = g.get(e.actorIds[1]) ?? i;
|
|
9016
9018
|
a = Math.floor((F[i] + F[t]) / 2) - Math.floor(n / 2);
|
|
9017
9019
|
} else a = F[i] - Math.floor(n / 2);
|
|
9018
|
-
a = Math.max(0, a),
|
|
9020
|
+
a = Math.max(0, a), ge.push({
|
|
9019
9021
|
x: a,
|
|
9020
9022
|
y: R,
|
|
9021
9023
|
width: n,
|
|
@@ -9024,18 +9026,18 @@ function Au(e, t, n, r) {
|
|
|
9024
9026
|
}), R += r;
|
|
9025
9027
|
}
|
|
9026
9028
|
for (let e = 0; e < i.messages.length; e++) {
|
|
9027
|
-
for (let t = 0; t < i.blocks.length; t++) i.blocks[t].startIndex === e && (R +=
|
|
9028
|
-
for (let t = 0; t < i.blocks.length; t++) for (let n = 0; n < i.blocks[t].dividers.length; n++) i.blocks[t].dividers[n].index === e && (R +=
|
|
9029
|
-
R +=
|
|
9029
|
+
for (let t = 0; t < i.blocks.length; t++) i.blocks[t].startIndex === e && (R += z + 1, me.set(t, R - 1));
|
|
9030
|
+
for (let t = 0; t < i.blocks.length; t++) for (let n = 0; n < i.blocks[t].dividers.length; n++) i.blocks[t].dividers[n].index === e && (R += z, L.set(`${t}:${n}`, R), R += ye);
|
|
9031
|
+
R += z;
|
|
9030
9032
|
let t = i.messages[e], n = t.from === t.to, r = Ac(t.label), a = n ? void 0 : A.get(e), o = j.get(e);
|
|
9031
|
-
if (n)
|
|
9033
|
+
if (n) I[e] = R + 1, pe[e] = R, R += 2 + r;
|
|
9032
9034
|
else {
|
|
9033
9035
|
let t = a === void 0 ? 0 : O, n = a === void 0 ? 0 : k;
|
|
9034
|
-
|
|
9036
|
+
I[e] = R, pe[e] = R + r + t, R += r + t + 1 + n, a !== void 0 && ee.set(a, pe[e] - t);
|
|
9035
9037
|
}
|
|
9036
|
-
o !== void 0 && (
|
|
9038
|
+
o !== void 0 && (te.set(o, R), R += 1);
|
|
9037
9039
|
for (let t = 0; t < i.notes.length; t++) if (i.notes[t].afterIndex === e) {
|
|
9038
|
-
R +=
|
|
9040
|
+
R += z;
|
|
9039
9041
|
let e = i.notes[t], n = $(e.text), r = oe(e), a = n.length + 2, o = g.get(e.actorIds[0]) ?? 0, s;
|
|
9040
9042
|
if (e.position === "left") s = F[o] - r - 1;
|
|
9041
9043
|
else if (e.position === "right") s = F[o] + 2;
|
|
@@ -9043,7 +9045,7 @@ function Au(e, t, n, r) {
|
|
|
9043
9045
|
let t = g.get(e.actorIds[1]) ?? o;
|
|
9044
9046
|
s = Math.floor((F[o] + F[t]) / 2) - Math.floor(r / 2);
|
|
9045
9047
|
} else s = F[o] - Math.floor(r / 2);
|
|
9046
|
-
s = Math.max(0, s),
|
|
9048
|
+
s = Math.max(0, s), ge.push({
|
|
9047
9049
|
x: s,
|
|
9048
9050
|
y: R,
|
|
9049
9051
|
width: r,
|
|
@@ -9051,27 +9053,27 @@ function Au(e, t, n, r) {
|
|
|
9051
9053
|
lines: n
|
|
9052
9054
|
}), R += a;
|
|
9053
9055
|
}
|
|
9054
|
-
for (let t = 0; t < i.blocks.length; t++) i.blocks[t].endIndex === e && (R +=
|
|
9056
|
+
for (let t = 0; t < i.blocks.length; t++) i.blocks[t].endIndex === e && (R += z, he.set(t, R), R += ye);
|
|
9055
9057
|
}
|
|
9056
|
-
R +=
|
|
9057
|
-
let
|
|
9058
|
-
for (let e of
|
|
9058
|
+
R += ye;
|
|
9059
|
+
let be = R, xe = be + re, Se = xe + E + re, Ce = (F[F.length - 1] ?? 0) + (w[w.length - 1] ?? 0) + 2;
|
|
9060
|
+
for (let e of M) Ce = Math.max(Ce, fe(e) + 2);
|
|
9059
9061
|
for (let e = 0; e < i.messages.length; e++) {
|
|
9060
9062
|
let t = i.messages[e];
|
|
9061
9063
|
if (t.from === t.to) {
|
|
9062
9064
|
let e = F[_(t.from)] + ku(t) + 2 + 2 + kc(t.label);
|
|
9063
|
-
|
|
9065
|
+
Ce = Math.max(Ce, e + 1);
|
|
9064
9066
|
}
|
|
9065
9067
|
}
|
|
9066
|
-
for (let e of
|
|
9067
|
-
let
|
|
9068
|
+
for (let e of ge) Ce = Math.max(Ce, e.x + e.width + 1);
|
|
9069
|
+
let we = Xo(Ce, Se - 1), Te = Qo(Ce, Se - 1);
|
|
9068
9070
|
function B(e, t, n, r) {
|
|
9069
|
-
q(
|
|
9071
|
+
q(we, e, t, n, {
|
|
9070
9072
|
role: r,
|
|
9071
|
-
roleCanvas:
|
|
9073
|
+
roleCanvas: Te
|
|
9072
9074
|
});
|
|
9073
9075
|
}
|
|
9074
|
-
function
|
|
9076
|
+
function Ee(e, t, n, r, i) {
|
|
9075
9077
|
let a = Yo(n);
|
|
9076
9078
|
for (let n = 0; n < a.length; n++) {
|
|
9077
9079
|
let o = e + n;
|
|
@@ -9079,7 +9081,7 @@ function Au(e, t, n, r) {
|
|
|
9079
9081
|
B(o, t, a[n], r);
|
|
9080
9082
|
}
|
|
9081
9083
|
}
|
|
9082
|
-
function
|
|
9084
|
+
function De(e, t, n, r, i) {
|
|
9083
9085
|
let a = r === "actor" ? Eu : [], f = [...a, ...$(n)], p = Math.max(kc(n), a.length > 0 ? Du : 0), m = p + 2 * b + 2, h = i, g = h - 2, _ = e - Math.floor(m / 2);
|
|
9084
9086
|
B(_, t, c, "border");
|
|
9085
9087
|
for (let e = 1; e < m - 1; e++) B(_ + e, t, o, "border");
|
|
@@ -9088,42 +9090,42 @@ function Au(e, t, n, r) {
|
|
|
9088
9090
|
let n = t + 1 + e;
|
|
9089
9091
|
B(_, n, s, "border"), B(_ + m - 1, n, s, "border");
|
|
9090
9092
|
let r = f[e];
|
|
9091
|
-
r !== void 0 &&
|
|
9093
|
+
r !== void 0 && Ee(_ + 1 + b + Math.floor((p - Jo(r)) / 2), n, r, "text");
|
|
9092
9094
|
}
|
|
9093
9095
|
let v = t + h - 1;
|
|
9094
9096
|
B(_, v, u, "border");
|
|
9095
9097
|
for (let e = 1; e < m - 1; e++) B(_ + e, v, o, "border");
|
|
9096
9098
|
B(_ + m - 1, v, d, "border");
|
|
9097
9099
|
}
|
|
9098
|
-
let
|
|
9100
|
+
let Oe = (e) => {
|
|
9099
9101
|
let t = ee.get(e);
|
|
9100
|
-
return t === void 0 ?
|
|
9101
|
-
},
|
|
9102
|
+
return t === void 0 ? ve : t + E;
|
|
9103
|
+
}, ke = (e) => te.get(e) ?? be;
|
|
9102
9104
|
for (let e = 0; e < i.actors.length; e++) {
|
|
9103
9105
|
let t = F[e];
|
|
9104
|
-
for (let n =
|
|
9106
|
+
for (let n = Oe(e); n <= ke(e); n++) B(t, n, s, "line");
|
|
9105
9107
|
}
|
|
9106
|
-
let
|
|
9107
|
-
function
|
|
9108
|
-
let r =
|
|
9108
|
+
let Ae = a ? "+" : "┼";
|
|
9109
|
+
function je(e, t, n) {
|
|
9110
|
+
let r = de(e), i = fe(e), a = t + E + 1;
|
|
9109
9111
|
B(r, t, c, "border"), B(i, t, l, "border"), B(r, a, u, "border"), B(i, a, d, "border");
|
|
9110
9112
|
for (let e = r + 1; e < i; e++) B(e, t, o, "border"), B(e, a, o, "border");
|
|
9111
9113
|
for (let e = t + 1; e < a; e++) B(r, e, s, "border"), B(i, e, s, "border");
|
|
9112
|
-
n !== "" &&
|
|
9114
|
+
n !== "" && Ee(r + 2, t, ` ${$(n)[0]} `, "text");
|
|
9113
9115
|
for (let n = e.lo; n <= e.hi; n++) {
|
|
9114
9116
|
let e = F[n];
|
|
9115
|
-
|
|
9117
|
+
Oe(n) <= t && t <= ke(n) && B(e, t, Ae, "junction"), Oe(n) <= a && a <= ke(n) && B(e, a, Ae, "junction");
|
|
9116
9118
|
}
|
|
9117
9119
|
}
|
|
9118
|
-
for (let e of
|
|
9120
|
+
for (let e of M) je(e, 0, e.label), je(e, be, "");
|
|
9119
9121
|
for (let e = 0; e < i.actors.length; e++) {
|
|
9120
|
-
let t = i.actors[e], n = ee.get(e) ??
|
|
9121
|
-
|
|
9122
|
+
let t = i.actors[e], n = ee.get(e) ?? _e, r = te.has(e);
|
|
9123
|
+
De(F[e], n, t.label, t.type, E), r || De(F[e], xe, t.label, t.type, E), a || (B(F[e], n + E - 1, f, "junction"), r || B(F[e], xe, p, "junction"));
|
|
9122
9124
|
}
|
|
9123
9125
|
for (let e = 0; e < i.messages.length; e++) {
|
|
9124
9126
|
let t = i.messages[e], n = _(t.from), r = _(t.to), c = F[n], l = F[r], u = n === r, d = t.lineStyle === "dashed", f = t.arrowHead === "filled", p = t.isLost === !0, h = a ? "x" : "✕", g = d ? a ? "." : "╌" : o;
|
|
9125
9127
|
if (u) {
|
|
9126
|
-
let n =
|
|
9128
|
+
let n = pe[e], r = ku(t), i = t.seqNumber === void 0 ? void 0 : String(t.seqNumber), o = $(t.label);
|
|
9127
9129
|
B(c, n, m, "junction");
|
|
9128
9130
|
let l = c + 1;
|
|
9129
9131
|
if (i !== void 0) {
|
|
@@ -9135,14 +9137,14 @@ function Au(e, t, n, r) {
|
|
|
9135
9137
|
let u = c + r + 2;
|
|
9136
9138
|
for (let e = 0; e < o.length; e++) {
|
|
9137
9139
|
let t = n + 1 + e;
|
|
9138
|
-
B(c + r, t, s, "line"),
|
|
9140
|
+
B(c + r, t, s, "line"), Ee(u, t, o[e], "text", Ce);
|
|
9139
9141
|
}
|
|
9140
9142
|
let d = n + 1 + o.length;
|
|
9141
9143
|
B(c, d, p ? h : f ? a ? "<" : "◀" : a ? "<" : "◁", "arrow");
|
|
9142
9144
|
for (let e = c + 1; e < c + r; e++) B(e, d, g, "line");
|
|
9143
9145
|
B(c + r, d, a ? "+" : "┘", "corner");
|
|
9144
9146
|
} else {
|
|
9145
|
-
let n =
|
|
9147
|
+
let n = I[e], i = pe[e], o = c < l, s = A.get(e) === r, u = l;
|
|
9146
9148
|
if (s) {
|
|
9147
9149
|
let e = D(r, l), t = e + C[r] - 1;
|
|
9148
9150
|
u = o ? e - 1 : t + 1;
|
|
@@ -9150,7 +9152,7 @@ function Au(e, t, n, r) {
|
|
|
9150
9152
|
let d = Math.floor((c + l) / 2), m = $(t.label);
|
|
9151
9153
|
for (let e = 0; e < m.length; e++) {
|
|
9152
9154
|
let t = m[e];
|
|
9153
|
-
|
|
9155
|
+
Ee(d - Math.floor(Jo(t) / 2), n + e, t, "text", Ce);
|
|
9154
9156
|
}
|
|
9155
9157
|
if (o) {
|
|
9156
9158
|
for (let e = c + 1; e < u; e++) B(e, i, g, "line");
|
|
@@ -9171,12 +9173,12 @@ function Au(e, t, n, r) {
|
|
|
9171
9173
|
}
|
|
9172
9174
|
}
|
|
9173
9175
|
}
|
|
9174
|
-
for (let [e, t] of
|
|
9175
|
-
let
|
|
9176
|
+
for (let [e, t] of te) B(F[e], t, a ? "x" : "✕", "arrow");
|
|
9177
|
+
let Me = Ce - 1;
|
|
9176
9178
|
for (let e = 0; e < i.blocks.length; e++) {
|
|
9177
|
-
let t = i.blocks[e], n =
|
|
9179
|
+
let t = i.blocks[e], n = me.get(e), r = he.get(e);
|
|
9178
9180
|
if (n === void 0 || r === void 0) continue;
|
|
9179
|
-
let a =
|
|
9181
|
+
let a = Ce, f = 0;
|
|
9180
9182
|
for (let e = t.startIndex; e <= t.endIndex && !(e >= i.messages.length); e++) {
|
|
9181
9183
|
let t = i.messages[e], n = g.get(t.from) ?? 0, r = g.get(t.to) ?? 0;
|
|
9182
9184
|
if (a = Math.min(a, F[Math.min(n, r)]), f = Math.max(f, F[Math.max(n, r)]), n === r) {
|
|
@@ -9186,57 +9188,57 @@ function Au(e, t, n, r) {
|
|
|
9186
9188
|
}
|
|
9187
9189
|
let p = a - Ou, _ = f + Ou, y = Infinity, b = -Infinity;
|
|
9188
9190
|
for (let e of F) e > f && e < y && (y = e), e < a && e > b && (b = e);
|
|
9189
|
-
_ >= y && (_ = Math.max(f, y - Ou)), p <= b && (p = Math.min(a, b + Ou)), p = Math.max(0, p), _ >
|
|
9191
|
+
_ >= y && (_ = Math.max(f, y - Ou)), p <= b && (p = Math.min(a, b + Ou)), p = Math.max(0, p), _ > Me && (ns(we, _ + 1, Se - 1), $o(Te, _ + 1, Se - 1), Me = _);
|
|
9190
9192
|
let x = t.label ? `${t.type} [${t.label}]` : t.type, S = p + 1 + v(t);
|
|
9191
9193
|
if (S > _) {
|
|
9192
9194
|
_ = S;
|
|
9193
|
-
let [e] = ts(
|
|
9194
|
-
_ > e && (ns(
|
|
9195
|
+
let [e] = ts(we);
|
|
9196
|
+
_ > e && (ns(we, _, Se - 1), $o(Te, _, Se - 1)), Ce = Math.max(Ce, _ + 1), Me = Math.max(Me, _);
|
|
9195
9197
|
}
|
|
9196
9198
|
B(p, n, c, "border");
|
|
9197
9199
|
for (let e = p + 1; e < _; e++) B(e, n, o, "border");
|
|
9198
9200
|
B(_, n, l, "border");
|
|
9199
9201
|
let C = $(x);
|
|
9200
|
-
for (let e = 0; e < C.length && n + e < r; e++)
|
|
9202
|
+
for (let e = 0; e < C.length && n + e < r; e++) Ee(p + 1, n + e, C[e], "text", _);
|
|
9201
9203
|
B(p, r, u, "border");
|
|
9202
9204
|
for (let e = p + 1; e < _; e++) B(e, r, o, "border");
|
|
9203
9205
|
B(_, r, d, "border");
|
|
9204
9206
|
for (let e = n + 1; e < r; e++) B(p, e, s, "border"), B(_, e, s, "border");
|
|
9205
9207
|
for (let n = 0; n < t.dividers.length; n++) {
|
|
9206
|
-
let r =
|
|
9208
|
+
let r = L.get(`${e}:${n}`);
|
|
9207
9209
|
if (r === void 0) continue;
|
|
9208
|
-
let i =
|
|
9210
|
+
let i = Ne();
|
|
9209
9211
|
B(p, r, m, "junction");
|
|
9210
9212
|
for (let e = p + 1; e < _; e++) B(e, r, i, "line");
|
|
9211
9213
|
B(_, r, h, "junction");
|
|
9212
9214
|
let a = t.dividers[n].label;
|
|
9213
9215
|
if (a) {
|
|
9214
9216
|
let e = `[${a}]`;
|
|
9215
|
-
|
|
9217
|
+
Ee(p + 1, r, e, "text", _);
|
|
9216
9218
|
}
|
|
9217
9219
|
}
|
|
9218
9220
|
}
|
|
9219
|
-
for (let e of
|
|
9220
|
-
ns(
|
|
9221
|
+
for (let e of ge) {
|
|
9222
|
+
ns(we, e.x + e.width, e.y + e.height), $o(Te, e.x + e.width, e.y + e.height), B(e.x, e.y, c, "border");
|
|
9221
9223
|
for (let t = 1; t < e.width - 1; t++) B(e.x + t, e.y, o, "border");
|
|
9222
9224
|
B(e.x + e.width - 1, e.y, l, "border");
|
|
9223
9225
|
for (let t = 0; t < e.lines.length; t++) {
|
|
9224
9226
|
let n = e.y + 1 + t;
|
|
9225
9227
|
B(e.x, n, s, "border"), B(e.x + e.width - 1, n, s, "border");
|
|
9226
9228
|
for (let t = e.x + 1; t < e.x + e.width - 1; t++) B(t, n, " ", "text");
|
|
9227
|
-
|
|
9229
|
+
Ee(e.x + 1 + b, n, e.lines[t], "text");
|
|
9228
9230
|
}
|
|
9229
9231
|
let t = e.y + e.height - 1;
|
|
9230
9232
|
B(e.x, t, u, "border");
|
|
9231
9233
|
for (let n = 1; n < e.width - 1; n++) B(e.x + n, t, o, "border");
|
|
9232
9234
|
B(e.x + e.width - 1, t, d, "border");
|
|
9233
9235
|
}
|
|
9234
|
-
return ls(
|
|
9235
|
-
roleCanvas:
|
|
9236
|
+
return ls(we, {
|
|
9237
|
+
roleCanvas: Te,
|
|
9236
9238
|
colorMode: n,
|
|
9237
9239
|
theme: r
|
|
9238
9240
|
});
|
|
9239
|
-
function
|
|
9241
|
+
function Ne() {
|
|
9240
9242
|
return a ? "-" : "╌";
|
|
9241
9243
|
}
|
|
9242
9244
|
}
|
|
@@ -9407,44 +9409,72 @@ function Ru(e, t, n, i, a = {}) {
|
|
|
9407
9409
|
let o = A.get(e.to);
|
|
9408
9410
|
o.left = Math.max(o.left, Math.floor(n / 2) - i), o.right = Math.max(o.right, i + n - 1 - Math.floor(n / 2));
|
|
9409
9411
|
});
|
|
9410
|
-
let j = /* @__PURE__ */ new Map(), ee = 0,
|
|
9412
|
+
let j = /* @__PURE__ */ new Map(), ee = 0, te = 0;
|
|
9411
9413
|
for (let e = 0; e <= S; e++) {
|
|
9412
9414
|
let t = C[e];
|
|
9413
9415
|
if (t.length === 0) continue;
|
|
9414
|
-
let n =
|
|
9416
|
+
let n = (e) => {
|
|
9417
|
+
let t = h.get(e);
|
|
9418
|
+
return t && t.size > 0 ? [...t].sort().join(",") : `root:${e}`;
|
|
9419
|
+
}, r = /* @__PURE__ */ new Map();
|
|
9415
9420
|
for (let e of t) {
|
|
9416
|
-
let t =
|
|
9421
|
+
let t = n(e), i = r.get(t);
|
|
9422
|
+
i || (i = [], r.set(t, i)), i.push(e);
|
|
9423
|
+
}
|
|
9424
|
+
let i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
|
|
9425
|
+
{
|
|
9426
|
+
let e = 0;
|
|
9427
|
+
for (let n of t) {
|
|
9428
|
+
let t = f.get(n), r = A.get(n), s = Math.max(0, r.left - Math.floor(t / 2)), c = Math.max(0, r.right - (t - 1 - Math.floor(t / 2)));
|
|
9429
|
+
i.set(n, e), a.set(n, s + t + c), o.set(n, s), e += s + t + c + l;
|
|
9430
|
+
}
|
|
9431
|
+
}
|
|
9432
|
+
let s = 0, c = 0, g = (e, t) => {
|
|
9433
|
+
let n = m.get(e), r = f.get(e), i = p.get(e), u = o.get(e), h = a.get(e);
|
|
9417
9434
|
j.set(e, {
|
|
9418
|
-
cls:
|
|
9435
|
+
cls: n,
|
|
9419
9436
|
sections: d.get(e),
|
|
9420
|
-
x:
|
|
9437
|
+
x: t + u,
|
|
9421
9438
|
y: ee,
|
|
9422
|
-
width:
|
|
9423
|
-
height:
|
|
9424
|
-
});
|
|
9425
|
-
|
|
9426
|
-
|
|
9427
|
-
|
|
9428
|
-
|
|
9429
|
-
|
|
9430
|
-
|
|
9431
|
-
|
|
9432
|
-
|
|
9433
|
-
|
|
9439
|
+
width: r,
|
|
9440
|
+
height: i
|
|
9441
|
+
}), te = Math.max(te, t + h), s = t + h + l, c = Math.max(c, i);
|
|
9442
|
+
}, v = /* @__PURE__ */ new Set();
|
|
9443
|
+
for (let c of t) {
|
|
9444
|
+
if (v.has(c)) continue;
|
|
9445
|
+
let t = n(c), u = h.get(c), d = u ? [...u].filter((t) => _.get(t) < e) : [];
|
|
9446
|
+
if (d.length === 0) {
|
|
9447
|
+
g(c, Math.max(i.get(c), s, 0)), v.add(c);
|
|
9448
|
+
continue;
|
|
9449
|
+
}
|
|
9450
|
+
let p = r.get(t), m = d.map((e) => {
|
|
9451
|
+
let t = j.get(e);
|
|
9452
|
+
return t.x + Math.floor(t.width / 2);
|
|
9453
|
+
}), y = Math.round(m.reduce((e, t) => e + t, 0) / m.length), b = 0;
|
|
9454
|
+
for (let e = 0; e < p.length; e++) b += a.get(p[e]), e < p.length - 1 && (b += l);
|
|
9455
|
+
let x = o.get(p[0]), S = p[p.length - 1], C = a.get(S) - o.get(S) - f.get(S), w = b - x - C, T = y - x - Math.floor(w / 2), E = Math.max(T, s, 0);
|
|
9456
|
+
for (let e of p) g(e, E), v.add(e), E = s;
|
|
9457
|
+
}
|
|
9458
|
+
ee += c + u;
|
|
9459
|
+
}
|
|
9460
|
+
let M = te, ne = 0;
|
|
9461
|
+
for (let e of j.values()) M = Math.max(M, e.x + e.width), ne = Math.max(ne, e.y + e.height);
|
|
9462
|
+
M += 4, ne += 2;
|
|
9463
|
+
let N = Xo(M - 1, ne - 1), re = Qo(M - 1, ne - 1);
|
|
9434
9464
|
function ie(e, t, n, r) {
|
|
9435
9465
|
q(N, e, t, n, {
|
|
9436
9466
|
role: r,
|
|
9437
9467
|
roleCanvas: re
|
|
9438
9468
|
});
|
|
9439
9469
|
}
|
|
9440
|
-
let ae = a.hyperlinks ? yo(
|
|
9470
|
+
let ae = a.hyperlinks ? yo(M - 1, ne - 1) : void 0;
|
|
9441
9471
|
for (let e of j.values()) {
|
|
9442
9472
|
let n = fu(e.sections, c, t.boxBorderPadding);
|
|
9443
9473
|
for (let t = 0; t < n.length; t++) for (let r = 0; r < n[0].length; r++) {
|
|
9444
9474
|
let i = n[t][r];
|
|
9445
9475
|
if (i !== " ") {
|
|
9446
9476
|
let n = e.x + t, a = e.y + r;
|
|
9447
|
-
n <
|
|
9477
|
+
n < M && a < ne && ie(n, a, i, uu(i));
|
|
9448
9478
|
}
|
|
9449
9479
|
}
|
|
9450
9480
|
if (ae) {
|
|
@@ -9471,12 +9501,12 @@ function Ru(e, t, n, i, a = {}) {
|
|
|
9471
9501
|
return !1;
|
|
9472
9502
|
}
|
|
9473
9503
|
function ce(e, t, n, r) {
|
|
9474
|
-
return vu(e, 0, e +
|
|
9504
|
+
return vu(e, 0, e + M + 9, (e) => {
|
|
9475
9505
|
for (let i = Math.min(t, n); i <= Math.max(t, n); i++) if (se(e, i, r)) return !1;
|
|
9476
9506
|
return !0;
|
|
9477
|
-
}) ??
|
|
9507
|
+
}) ?? M + 2;
|
|
9478
9508
|
}
|
|
9479
|
-
let
|
|
9509
|
+
let le = c ? "-" : "─", ue = c ? "|" : "│", F = c ? "." : "╌", de = c ? ":" : "┊";
|
|
9480
9510
|
function fe(e, t, n) {
|
|
9481
9511
|
let r = Math.floor(n / 2), i = n - 1 - r, a = t > r + i ? (r + i) / t : 1;
|
|
9482
9512
|
return Math.max(-r, Math.min(i, Math.round(e * a)));
|
|
@@ -9515,10 +9545,10 @@ function Ru(e, t, n, i, a = {}) {
|
|
|
9515
9545
|
o.relationships.forEach((e, t) => {
|
|
9516
9546
|
let n = j.get(e.from), r = j.get(e.to);
|
|
9517
9547
|
if (!n || !r) return;
|
|
9518
|
-
let i = Pu(e.type, e.markerAt), a = i.dashed ?
|
|
9548
|
+
let i = Pu(e.type, e.markerAt), a = i.dashed ? F : le, o = i.dashed ? de : ue, s = /* @__PURE__ */ new Set([e.from, e.to]), { fromCX: l, toCX: u, fromAnchorX: d, toAnchorX: f } = pe(t, n, r), p = n.y + n.height - 1, m = r.y;
|
|
9519
9549
|
if (p < m) {
|
|
9520
9550
|
let e = ce(l, p + 1, m - 1, s), n = e !== l;
|
|
9521
|
-
if (e >=
|
|
9551
|
+
if (e >= M && ns(N, e + 2, ne), n) {
|
|
9522
9552
|
let n = p + 1, r = m - 1;
|
|
9523
9553
|
he.set(t, {
|
|
9524
9554
|
routeX: e,
|
|
@@ -9583,7 +9613,7 @@ function Ru(e, t, n, i, a = {}) {
|
|
|
9583
9613
|
let s = r.y + r.height - 1, m = Math.min(l, u), h = Math.max(l, u), g = Math.max(p, s);
|
|
9584
9614
|
for (let [t, r] of j.entries()) t !== e.from && t !== e.to && r.y === n.y && r.x < h + 1 && r.x + r.width > m && (g = Math.max(g, r.y + r.height - 1));
|
|
9585
9615
|
let _ = g + 2;
|
|
9586
|
-
L.set(t, _), ns(N,
|
|
9616
|
+
L.set(t, _), ns(N, M, _ + 1), $o(re, M, _ + 1);
|
|
9587
9617
|
let v = l !== d, y = u !== f;
|
|
9588
9618
|
me(p + 1, d, l, a, !0);
|
|
9589
9619
|
for (let e = p + (v ? 2 : 1); e <= _; e++) P(l, e, o, "line");
|
|
@@ -9636,7 +9666,7 @@ function Ru(e, t, n, i, a = {}) {
|
|
|
9636
9666
|
baseMidY: L.get(e) ?? Math.max(o, n.y + n.height - 1) + 2
|
|
9637
9667
|
};
|
|
9638
9668
|
}
|
|
9639
|
-
function
|
|
9669
|
+
function _e(e, t, n, r, i, a, o) {
|
|
9640
9670
|
let s = r, c = Math.floor(a / 2), l = e.y + e.height - 1, u = t.y, d = !1;
|
|
9641
9671
|
for (let e = 0; e < a; e++) {
|
|
9642
9672
|
let t = s - c + e, r = n - Math.floor(i / 2), a = Math.max(0, r);
|
|
@@ -9662,15 +9692,15 @@ function Ru(e, t, n, i, a = {}) {
|
|
|
9662
9692
|
}
|
|
9663
9693
|
return s;
|
|
9664
9694
|
}
|
|
9665
|
-
let
|
|
9695
|
+
let ve = /* @__PURE__ */ new Map(), R = [];
|
|
9666
9696
|
for (let [e, t] of o.relationships.entries()) {
|
|
9667
9697
|
if (!t.label) continue;
|
|
9668
9698
|
let n = j.get(t.from), r = j.get(t.to);
|
|
9669
9699
|
if (!n || !r) continue;
|
|
9670
|
-
let i = $(t.label), a = Math.floor(i.length / 2), o = Math.max(...i.map(Jo)) + 2, { idealMidX: s, baseMidY: c } = ge(e, n, r, o), l = /* @__PURE__ */ new Set([t.from, t.to]), u =
|
|
9671
|
-
|
|
9700
|
+
let i = $(t.label), a = Math.floor(i.length / 2), o = Math.max(...i.map(Jo)) + 2, { idealMidX: s, baseMidY: c } = ge(e, n, r, o), l = /* @__PURE__ */ new Set([t.from, t.to]), u = _e(n, r, s, c, o, i.length, l);
|
|
9701
|
+
ve.set(t, u);
|
|
9672
9702
|
let d = Math.max(0, s - Math.floor(o / 2));
|
|
9673
|
-
|
|
9703
|
+
R.push({
|
|
9674
9704
|
rel: t,
|
|
9675
9705
|
idealMidX: s,
|
|
9676
9706
|
naturalStart: d,
|
|
@@ -9679,21 +9709,21 @@ function Ru(e, t, n, i, a = {}) {
|
|
|
9679
9709
|
rowEnd: u + a
|
|
9680
9710
|
});
|
|
9681
9711
|
}
|
|
9682
|
-
let z = Mu(
|
|
9712
|
+
let z = Mu(R, (e) => ({
|
|
9683
9713
|
idealMid: e.idealMidX,
|
|
9684
9714
|
start: e.naturalStart,
|
|
9685
9715
|
end: e.naturalEnd,
|
|
9686
9716
|
rowStart: e.rowStart,
|
|
9687
9717
|
rowEnd: e.rowEnd
|
|
9688
9718
|
})), ye = /* @__PURE__ */ new Map();
|
|
9689
|
-
for (let e of
|
|
9719
|
+
for (let e of R) {
|
|
9690
9720
|
let t = z.get(e);
|
|
9691
9721
|
t && ye.set(e.rel, t);
|
|
9692
9722
|
}
|
|
9693
9723
|
for (let [e, t] of o.relationships.entries()) {
|
|
9694
9724
|
let n = j.get(t.from), r = j.get(t.to);
|
|
9695
9725
|
if (!(!n || !r) && t.label) {
|
|
9696
|
-
let i = $(t.label), { idealMidX: a } = ge(e, n, r, Math.max(...i.map((e) => Jo(e))) + 2), o =
|
|
9726
|
+
let i = $(t.label), { idealMidX: a } = ge(e, n, r, Math.max(...i.map((e) => Jo(e))) + 2), o = ve.get(t) - Math.floor(i.length / 2), s = ye.get(t);
|
|
9697
9727
|
for (let e = 0; e < i.length; e++) {
|
|
9698
9728
|
let t = o + e, n = i[e], r = Yo(` ${n} `), { start: c, cells: l } = Iu(Math.max(0, a - Math.floor(r.length / 2)), r, n, Math.max(0, s.left), s.right), u = c + l.length;
|
|
9699
9729
|
u > 0 && t >= 0 && (ns(N, Math.max(u, 1), Math.max(t + 1, 1)), $o(re, Math.max(u, 1), Math.max(t + 1, 1)));
|
|
@@ -10073,7 +10103,7 @@ function dd(e, t = {}) {
|
|
|
10073
10103
|
}
|
|
10074
10104
|
function fd(e, n) {
|
|
10075
10105
|
let r = t(e), i = cd(n), a = n.font ?? "Inter";
|
|
10076
|
-
ue(
|
|
10106
|
+
F(ue(a));
|
|
10077
10107
|
let o = n.transparent ?? !1, s = Nn(n.fontSizes), c = b(r), l = n.embedSource ? e : void 0, u = n.title, d = n.decorative, f = ud(n), p = y(r), m = sd[c], h = m.parse(p, r), g = m.layoutForSvg(h, n), _ = {
|
|
10078
10108
|
colors: i,
|
|
10079
10109
|
font: a,
|