@wandox/sdk 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +59 -0
- package/dist/arc-BJMRTG9S.cjs +1 -0
- package/dist/arc-Vdco0qfw.js +83 -0
- package/dist/architectureDiagram-3BPJPVTR-BjEqcvey.js +4695 -0
- package/dist/architectureDiagram-3BPJPVTR-BvjJfAkh.cjs +36 -0
- package/dist/blockDiagram-GPEHLZMM-B1xf7RE9.js +2427 -0
- package/dist/blockDiagram-GPEHLZMM-B5VqovGY.cjs +132 -0
- package/dist/c4Diagram-AAUBKEIU-C4kjMRea.js +1578 -0
- package/dist/c4Diagram-AAUBKEIU-Ck5uEnJI.cjs +10 -0
- package/dist/channel-DlRtLuYv.js +5 -0
- package/dist/channel-Dm_yrRYJ.cjs +1 -0
- package/dist/chunk-2J33WTMH-CG2n_n4y.cjs +1 -0
- package/dist/chunk-2J33WTMH-CWvmGb4H.js +20 -0
- package/dist/chunk-4BX2VUAB-Bq3GzsD8.js +9 -0
- package/dist/chunk-4BX2VUAB-CdMctZeT.cjs +1 -0
- package/dist/chunk-55IACEB6-BdJhzL0d.js +8 -0
- package/dist/chunk-55IACEB6-sHyHtvg8.cjs +1 -0
- package/dist/chunk-727SXJPM-D-Vmam30.cjs +206 -0
- package/dist/chunk-727SXJPM-DmruCqjM.js +1529 -0
- package/dist/chunk-AQP2D5EJ-CWhKjcV3.cjs +231 -0
- package/dist/chunk-AQP2D5EJ-Ca0ak6w7.js +1399 -0
- package/dist/chunk-FMBD7UC4-CqV0NWQQ.js +19 -0
- package/dist/chunk-FMBD7UC4-DOxtd0OO.cjs +15 -0
- package/dist/chunk-ND2GUHAM-6EMX5Mu8.js +68 -0
- package/dist/chunk-ND2GUHAM-BXeDBtSC.cjs +1 -0
- package/dist/chunk-QZHKN3VN-B7FSI55w.js +15 -0
- package/dist/chunk-QZHKN3VN-CbbdNKnD.cjs +1 -0
- package/dist/classDiagram-4FO5ZUOK-0Kaf7WfA.js +16 -0
- package/dist/classDiagram-4FO5ZUOK-C4it2xBI.cjs +1 -0
- package/dist/classDiagram-v2-Q7XG4LA2-Byom5adL.js +16 -0
- package/dist/classDiagram-v2-Q7XG4LA2-C4it2xBI.cjs +1 -0
- package/dist/cose-bilkent-S5V4N54A-CuUv9oIm.js +2606 -0
- package/dist/cose-bilkent-S5V4N54A-Dh6nTopA.cjs +1 -0
- package/dist/cytoscape.esm-Cp8cXbK2.js +18729 -0
- package/dist/cytoscape.esm-fcqEUasK.cjs +331 -0
- package/dist/dagre-BM42HDAG-CwxJjZ2n.cjs +4 -0
- package/dist/dagre-BM42HDAG-DMBidMxP.js +448 -0
- package/dist/defaultLocale-BDVPUiG2.js +171 -0
- package/dist/defaultLocale-k2G_58r6.cjs +1 -0
- package/dist/diagram-2AECGRRQ-B2a4nXgJ.js +221 -0
- package/dist/diagram-2AECGRRQ-r7De7taS.cjs +43 -0
- package/dist/diagram-5GNKFQAL-CDiO79WC.cjs +10 -0
- package/dist/diagram-5GNKFQAL-DrHBNZzF.js +123 -0
- package/dist/diagram-KO2AKTUF-BcjWCXZr.js +466 -0
- package/dist/diagram-KO2AKTUF-CDlJCxVO.cjs +3 -0
- package/dist/diagram-LMA3HP47-BXFSAyNV.cjs +24 -0
- package/dist/diagram-LMA3HP47-DJxmyqn0.js +143 -0
- package/dist/diagram-OG6HWLK6-ATK__ca8.js +531 -0
- package/dist/diagram-OG6HWLK6-CgIyEO8_.cjs +24 -0
- package/dist/erDiagram-TEJ5UH35-D4baWNzQ.js +900 -0
- package/dist/erDiagram-TEJ5UH35-Dyuc5EB6.cjs +85 -0
- package/dist/flowDiagram-I6XJVG4X-BMZOncyU.js +1635 -0
- package/dist/flowDiagram-I6XJVG4X-C45fICr4.cjs +162 -0
- package/dist/ganttDiagram-6RSMTGT7-CiYZmmke.js +2526 -0
- package/dist/ganttDiagram-6RSMTGT7-Cxoj6IK8.cjs +292 -0
- package/dist/gitGraphDiagram-PVQCEYII-CQ9bNuwN.js +828 -0
- package/dist/gitGraphDiagram-PVQCEYII-rlaY9dfj.cjs +106 -0
- package/dist/graph-CBizzZ7K.js +1545 -0
- package/dist/graph-V5BNIbHU.cjs +1 -0
- package/dist/index-jBRold1l.js +173159 -0
- package/dist/index-sFrjovbM.cjs +804 -0
- package/dist/index.d.ts +54 -0
- package/dist/infoDiagram-5YYISTIA-CAzYIvUX.js +24 -0
- package/dist/infoDiagram-5YYISTIA-zX5rQglQ.cjs +2 -0
- package/dist/init-CHZsXQcr.cjs +1 -0
- package/dist/init-DjUOC4st.js +16 -0
- package/dist/ishikawaDiagram-YF4QCWOH-09prKBsn.cjs +70 -0
- package/dist/ishikawaDiagram-YF4QCWOH-Co8BnN24.js +622 -0
- package/dist/journeyDiagram-JHISSGLW-DkdWRF_-.cjs +139 -0
- package/dist/journeyDiagram-JHISSGLW-riCLiMCC.js +836 -0
- package/dist/kanban-definition-UN3LZRKU-DWipOCsx.cjs +89 -0
- package/dist/kanban-definition-UN3LZRKU-SRyCSn2H.js +725 -0
- package/dist/katex-Cf_UVKIT.cjs +257 -0
- package/dist/katex-RNjvZ8pg.js +11681 -0
- package/dist/layout-CbksXFOD.js +1728 -0
- package/dist/layout-Dh52gsIJ.cjs +1 -0
- package/dist/linear-C3xSMJV8.cjs +1 -0
- package/dist/linear-CmUCzX9U.js +259 -0
- package/dist/mermaid.core-BzNKr-OJ.cjs +308 -0
- package/dist/mermaid.core-CdBIz6FY.js +15475 -0
- package/dist/mindmap-definition-RKZ34NQL-Cs63oyIX.cjs +96 -0
- package/dist/mindmap-definition-RKZ34NQL-Gcma5iTd.js +830 -0
- package/dist/ordinal-CagbB1m8.cjs +1 -0
- package/dist/ordinal-DfAQgscy.js +61 -0
- package/dist/pieDiagram-4H26LBE5-CBGkD8dp.cjs +30 -0
- package/dist/pieDiagram-4H26LBE5-DSL8cVK1.js +164 -0
- package/dist/quadrantDiagram-W4KKPZXB-D3nCWRjF.cjs +7 -0
- package/dist/quadrantDiagram-W4KKPZXB-uod6bhUy.js +1026 -0
- package/dist/requirementDiagram-4Y6WPE33-Bc_6y7SM.js +884 -0
- package/dist/requirementDiagram-4Y6WPE33-D2mHlh5i.cjs +84 -0
- package/dist/sankeyDiagram-5OEKKPKP-DL_kXejW.cjs +40 -0
- package/dist/sankeyDiagram-5OEKKPKP-DMsjY4G4.js +847 -0
- package/dist/sequenceDiagram-3UESZ5HK-CBGalGOV.cjs +162 -0
- package/dist/sequenceDiagram-3UESZ5HK-CH2Z-Pis.js +2901 -0
- package/dist/stateDiagram-AJRCARHV-gEqlAI6t.js +263 -0
- package/dist/stateDiagram-AJRCARHV-rNMrAI-A.cjs +1 -0
- package/dist/stateDiagram-v2-BHNVJYJU-CDj7L1wi.js +16 -0
- package/dist/stateDiagram-v2-BHNVJYJU-LLlFJ1GM.cjs +1 -0
- package/dist/timeline-definition-PNZ67QCA-Bbuv3uu-.cjs +120 -0
- package/dist/timeline-definition-PNZ67QCA-DrGFbQdC.js +1068 -0
- package/dist/types.d.ts +295 -0
- package/dist/vennDiagram-CIIHVFJN-CGcAwVxU.js +1564 -0
- package/dist/vennDiagram-CIIHVFJN-DsSjXluJ.cjs +34 -0
- package/dist/wandox.cjs +1 -0
- package/dist/wandox.css +1 -0
- package/dist/wandox.js +6 -0
- package/dist/wandox.umd.js +4172 -0
- package/dist/wardley-L42UT6IY-DUnkyH_z.js +22539 -0
- package/dist/wardley-L42UT6IY-tDp0NbFW.cjs +165 -0
- package/dist/wardleyDiagram-YWT4CUSO-CB_Qa4lR.js +684 -0
- package/dist/wardleyDiagram-YWT4CUSO-D0BUmvVW.cjs +78 -0
- package/dist/xychartDiagram-2RQKCTM6-Bcq-ACuw.js +1342 -0
- package/dist/xychartDiagram-2RQKCTM6-BjeAPKLo.cjs +7 -0
- package/package.json +42 -0
|
@@ -0,0 +1,531 @@
|
|
|
1
|
+
import { b as w, ac as he, a1 as ee, s as J, a_ as ue, E as pe, aB as K, ba as B, aZ as j, b0 as fe, a0 as ge, b2 as me, a3 as ye, $ as Se, a$ as ve, Q as xe, at as be, t as we } from "./mermaid.core-CdBIz6FY.js";
|
|
2
|
+
import { s as Ce } from "./chunk-2J33WTMH-CWvmGb4H.js";
|
|
3
|
+
import { p as Te } from "./chunk-4BX2VUAB-Bq3GzsD8.js";
|
|
4
|
+
import { p as $e } from "./wardley-L42UT6IY-DUnkyH_z.js";
|
|
5
|
+
import { f as O } from "./defaultLocale-BDVPUiG2.js";
|
|
6
|
+
import { o as U } from "./ordinal-DfAQgscy.js";
|
|
7
|
+
function Le(t) {
|
|
8
|
+
var a = 0, l = t.children, n = l && l.length;
|
|
9
|
+
if (!n) a = 1;
|
|
10
|
+
else for (; --n >= 0; ) a += l[n].value;
|
|
11
|
+
t.value = a;
|
|
12
|
+
}
|
|
13
|
+
function Ae() {
|
|
14
|
+
return this.eachAfter(Le);
|
|
15
|
+
}
|
|
16
|
+
function Fe(t, a) {
|
|
17
|
+
let l = -1;
|
|
18
|
+
for (const n of this)
|
|
19
|
+
t.call(a, n, ++l, this);
|
|
20
|
+
return this;
|
|
21
|
+
}
|
|
22
|
+
function Ne(t, a) {
|
|
23
|
+
for (var l = this, n = [l], r, s, d = -1; l = n.pop(); )
|
|
24
|
+
if (t.call(a, l, ++d, this), r = l.children)
|
|
25
|
+
for (s = r.length - 1; s >= 0; --s)
|
|
26
|
+
n.push(r[s]);
|
|
27
|
+
return this;
|
|
28
|
+
}
|
|
29
|
+
function Me(t, a) {
|
|
30
|
+
for (var l = this, n = [l], r = [], s, d, h, g = -1; l = n.pop(); )
|
|
31
|
+
if (r.push(l), s = l.children)
|
|
32
|
+
for (d = 0, h = s.length; d < h; ++d)
|
|
33
|
+
n.push(s[d]);
|
|
34
|
+
for (; l = r.pop(); )
|
|
35
|
+
t.call(a, l, ++g, this);
|
|
36
|
+
return this;
|
|
37
|
+
}
|
|
38
|
+
function Ve(t, a) {
|
|
39
|
+
let l = -1;
|
|
40
|
+
for (const n of this)
|
|
41
|
+
if (t.call(a, n, ++l, this))
|
|
42
|
+
return n;
|
|
43
|
+
}
|
|
44
|
+
function _e(t) {
|
|
45
|
+
return this.eachAfter(function(a) {
|
|
46
|
+
for (var l = +t(a.data) || 0, n = a.children, r = n && n.length; --r >= 0; ) l += n[r].value;
|
|
47
|
+
a.value = l;
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
function ke(t) {
|
|
51
|
+
return this.eachBefore(function(a) {
|
|
52
|
+
a.children && a.children.sort(t);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
function ze(t) {
|
|
56
|
+
for (var a = this, l = De(a, t), n = [a]; a !== l; )
|
|
57
|
+
a = a.parent, n.push(a);
|
|
58
|
+
for (var r = n.length; t !== l; )
|
|
59
|
+
n.splice(r, 0, t), t = t.parent;
|
|
60
|
+
return n;
|
|
61
|
+
}
|
|
62
|
+
function De(t, a) {
|
|
63
|
+
if (t === a) return t;
|
|
64
|
+
var l = t.ancestors(), n = a.ancestors(), r = null;
|
|
65
|
+
for (t = l.pop(), a = n.pop(); t === a; )
|
|
66
|
+
r = t, t = l.pop(), a = n.pop();
|
|
67
|
+
return r;
|
|
68
|
+
}
|
|
69
|
+
function Be() {
|
|
70
|
+
for (var t = this, a = [t]; t = t.parent; )
|
|
71
|
+
a.push(t);
|
|
72
|
+
return a;
|
|
73
|
+
}
|
|
74
|
+
function Pe() {
|
|
75
|
+
return Array.from(this);
|
|
76
|
+
}
|
|
77
|
+
function Ee() {
|
|
78
|
+
var t = [];
|
|
79
|
+
return this.eachBefore(function(a) {
|
|
80
|
+
a.children || t.push(a);
|
|
81
|
+
}), t;
|
|
82
|
+
}
|
|
83
|
+
function Re() {
|
|
84
|
+
var t = this, a = [];
|
|
85
|
+
return t.each(function(l) {
|
|
86
|
+
l !== t && a.push({ source: l.parent, target: l });
|
|
87
|
+
}), a;
|
|
88
|
+
}
|
|
89
|
+
function* We() {
|
|
90
|
+
var t = this, a, l = [t], n, r, s;
|
|
91
|
+
do
|
|
92
|
+
for (a = l.reverse(), l = []; t = a.pop(); )
|
|
93
|
+
if (yield t, n = t.children)
|
|
94
|
+
for (r = 0, s = n.length; r < s; ++r)
|
|
95
|
+
l.push(n[r]);
|
|
96
|
+
while (l.length);
|
|
97
|
+
}
|
|
98
|
+
function te(t, a) {
|
|
99
|
+
t instanceof Map ? (t = [void 0, t], a === void 0 && (a = Oe)) : a === void 0 && (a = Ie);
|
|
100
|
+
for (var l = new Z(t), n, r = [l], s, d, h, g; n = r.pop(); )
|
|
101
|
+
if ((d = a(n.data)) && (g = (d = Array.from(d)).length))
|
|
102
|
+
for (n.children = d, h = g - 1; h >= 0; --h)
|
|
103
|
+
r.push(s = d[h] = new Z(d[h])), s.parent = n, s.depth = n.depth + 1;
|
|
104
|
+
return l.eachBefore(qe);
|
|
105
|
+
}
|
|
106
|
+
function He() {
|
|
107
|
+
return te(this).eachBefore(Ge);
|
|
108
|
+
}
|
|
109
|
+
function Ie(t) {
|
|
110
|
+
return t.children;
|
|
111
|
+
}
|
|
112
|
+
function Oe(t) {
|
|
113
|
+
return Array.isArray(t) ? t[1] : null;
|
|
114
|
+
}
|
|
115
|
+
function Ge(t) {
|
|
116
|
+
t.data.value !== void 0 && (t.value = t.data.value), t.data = t.data.data;
|
|
117
|
+
}
|
|
118
|
+
function qe(t) {
|
|
119
|
+
var a = 0;
|
|
120
|
+
do
|
|
121
|
+
t.height = a;
|
|
122
|
+
while ((t = t.parent) && t.height < ++a);
|
|
123
|
+
}
|
|
124
|
+
function Z(t) {
|
|
125
|
+
this.data = t, this.depth = this.height = 0, this.parent = null;
|
|
126
|
+
}
|
|
127
|
+
Z.prototype = te.prototype = {
|
|
128
|
+
constructor: Z,
|
|
129
|
+
count: Ae,
|
|
130
|
+
each: Fe,
|
|
131
|
+
eachAfter: Me,
|
|
132
|
+
eachBefore: Ne,
|
|
133
|
+
find: Ve,
|
|
134
|
+
sum: _e,
|
|
135
|
+
sort: ke,
|
|
136
|
+
path: ze,
|
|
137
|
+
ancestors: Be,
|
|
138
|
+
descendants: Pe,
|
|
139
|
+
leaves: Ee,
|
|
140
|
+
links: Re,
|
|
141
|
+
copy: He,
|
|
142
|
+
[Symbol.iterator]: We
|
|
143
|
+
};
|
|
144
|
+
function Xe(t) {
|
|
145
|
+
if (typeof t != "function") throw new Error();
|
|
146
|
+
return t;
|
|
147
|
+
}
|
|
148
|
+
function G() {
|
|
149
|
+
return 0;
|
|
150
|
+
}
|
|
151
|
+
function q(t) {
|
|
152
|
+
return function() {
|
|
153
|
+
return t;
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
function Ye(t) {
|
|
157
|
+
t.x0 = Math.round(t.x0), t.y0 = Math.round(t.y0), t.x1 = Math.round(t.x1), t.y1 = Math.round(t.y1);
|
|
158
|
+
}
|
|
159
|
+
function je(t, a, l, n, r) {
|
|
160
|
+
for (var s = t.children, d, h = -1, g = s.length, c = t.value && (n - a) / t.value; ++h < g; )
|
|
161
|
+
d = s[h], d.y0 = l, d.y1 = r, d.x0 = a, d.x1 = a += d.value * c;
|
|
162
|
+
}
|
|
163
|
+
function Ze(t, a, l, n, r) {
|
|
164
|
+
for (var s = t.children, d, h = -1, g = s.length, c = t.value && (r - l) / t.value; ++h < g; )
|
|
165
|
+
d = s[h], d.x0 = a, d.x1 = n, d.y0 = l, d.y1 = l += d.value * c;
|
|
166
|
+
}
|
|
167
|
+
var Qe = (1 + Math.sqrt(5)) / 2;
|
|
168
|
+
function Ue(t, a, l, n, r, s) {
|
|
169
|
+
for (var d = [], h = a.children, g, c, u = 0, b = 0, i = h.length, x, S, v = a.value, p, m, M, N, z, R, V; u < i; ) {
|
|
170
|
+
x = r - l, S = s - n;
|
|
171
|
+
do
|
|
172
|
+
p = h[b++].value;
|
|
173
|
+
while (!p && b < i);
|
|
174
|
+
for (m = M = p, R = Math.max(S / x, x / S) / (v * t), V = p * p * R, z = Math.max(M / V, V / m); b < i; ++b) {
|
|
175
|
+
if (p += c = h[b].value, c < m && (m = c), c > M && (M = c), V = p * p * R, N = Math.max(M / V, V / m), N > z) {
|
|
176
|
+
p -= c;
|
|
177
|
+
break;
|
|
178
|
+
}
|
|
179
|
+
z = N;
|
|
180
|
+
}
|
|
181
|
+
d.push(g = { value: p, dice: x < S, children: h.slice(u, b) }), g.dice ? je(g, l, n, r, v ? n += S * p / v : s) : Ze(g, l, n, v ? l += x * p / v : r, s), v -= p, u = b;
|
|
182
|
+
}
|
|
183
|
+
return d;
|
|
184
|
+
}
|
|
185
|
+
const Je = function t(a) {
|
|
186
|
+
function l(n, r, s, d, h) {
|
|
187
|
+
Ue(a, n, r, s, d, h);
|
|
188
|
+
}
|
|
189
|
+
return l.ratio = function(n) {
|
|
190
|
+
return t((n = +n) > 1 ? n : 1);
|
|
191
|
+
}, l;
|
|
192
|
+
}(Qe);
|
|
193
|
+
function Ke() {
|
|
194
|
+
var t = Je, a = !1, l = 1, n = 1, r = [0], s = G, d = G, h = G, g = G, c = G;
|
|
195
|
+
function u(i) {
|
|
196
|
+
return i.x0 = i.y0 = 0, i.x1 = l, i.y1 = n, i.eachBefore(b), r = [0], a && i.eachBefore(Ye), i;
|
|
197
|
+
}
|
|
198
|
+
function b(i) {
|
|
199
|
+
var x = r[i.depth], S = i.x0 + x, v = i.y0 + x, p = i.x1 - x, m = i.y1 - x;
|
|
200
|
+
p < S && (S = p = (S + p) / 2), m < v && (v = m = (v + m) / 2), i.x0 = S, i.y0 = v, i.x1 = p, i.y1 = m, i.children && (x = r[i.depth + 1] = s(i) / 2, S += c(i) - x, v += d(i) - x, p -= h(i) - x, m -= g(i) - x, p < S && (S = p = (S + p) / 2), m < v && (v = m = (v + m) / 2), t(i, S, v, p, m));
|
|
201
|
+
}
|
|
202
|
+
return u.round = function(i) {
|
|
203
|
+
return arguments.length ? (a = !!i, u) : a;
|
|
204
|
+
}, u.size = function(i) {
|
|
205
|
+
return arguments.length ? (l = +i[0], n = +i[1], u) : [l, n];
|
|
206
|
+
}, u.tile = function(i) {
|
|
207
|
+
return arguments.length ? (t = Xe(i), u) : t;
|
|
208
|
+
}, u.padding = function(i) {
|
|
209
|
+
return arguments.length ? u.paddingInner(i).paddingOuter(i) : u.paddingInner();
|
|
210
|
+
}, u.paddingInner = function(i) {
|
|
211
|
+
return arguments.length ? (s = typeof i == "function" ? i : q(+i), u) : s;
|
|
212
|
+
}, u.paddingOuter = function(i) {
|
|
213
|
+
return arguments.length ? u.paddingTop(i).paddingRight(i).paddingBottom(i).paddingLeft(i) : u.paddingTop();
|
|
214
|
+
}, u.paddingTop = function(i) {
|
|
215
|
+
return arguments.length ? (d = typeof i == "function" ? i : q(+i), u) : d;
|
|
216
|
+
}, u.paddingRight = function(i) {
|
|
217
|
+
return arguments.length ? (h = typeof i == "function" ? i : q(+i), u) : h;
|
|
218
|
+
}, u.paddingBottom = function(i) {
|
|
219
|
+
return arguments.length ? (g = typeof i == "function" ? i : q(+i), u) : g;
|
|
220
|
+
}, u.paddingLeft = function(i) {
|
|
221
|
+
return arguments.length ? (c = typeof i == "function" ? i : q(+i), u) : c;
|
|
222
|
+
}, u;
|
|
223
|
+
}
|
|
224
|
+
var E, ne = (E = class {
|
|
225
|
+
constructor() {
|
|
226
|
+
this.nodes = [], this.levels = /* @__PURE__ */ new Map(), this.outerNodes = [], this.classes = /* @__PURE__ */ new Map(), this.setAccTitle = fe, this.getAccTitle = ge, this.setDiagramTitle = me, this.getDiagramTitle = ye, this.getAccDescription = Se, this.setAccDescription = ve;
|
|
227
|
+
}
|
|
228
|
+
getNodes() {
|
|
229
|
+
return this.nodes;
|
|
230
|
+
}
|
|
231
|
+
getConfig() {
|
|
232
|
+
const a = xe, l = ee();
|
|
233
|
+
return J({
|
|
234
|
+
...a.treemap,
|
|
235
|
+
...l.treemap ?? {}
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
addNode(a, l) {
|
|
239
|
+
this.nodes.push(a), this.levels.set(a, l), l === 0 && (this.outerNodes.push(a), this.root ?? (this.root = a));
|
|
240
|
+
}
|
|
241
|
+
getRoot() {
|
|
242
|
+
return { name: "", children: this.outerNodes };
|
|
243
|
+
}
|
|
244
|
+
addClass(a, l) {
|
|
245
|
+
const n = this.classes.get(a) ?? { id: a, styles: [], textStyles: [] }, r = l.replace(/\\,/g, "§§§").replace(/,/g, ";").replace(/§§§/g, ",").split(";");
|
|
246
|
+
r && r.forEach((s) => {
|
|
247
|
+
be(s) && (n != null && n.textStyles ? n.textStyles.push(s) : n.textStyles = [s]), n != null && n.styles ? n.styles.push(s) : n.styles = [s];
|
|
248
|
+
}), this.classes.set(a, n);
|
|
249
|
+
}
|
|
250
|
+
getClasses() {
|
|
251
|
+
return this.classes;
|
|
252
|
+
}
|
|
253
|
+
getStylesForClass(a) {
|
|
254
|
+
var l;
|
|
255
|
+
return ((l = this.classes.get(a)) == null ? void 0 : l.styles) ?? [];
|
|
256
|
+
}
|
|
257
|
+
clear() {
|
|
258
|
+
we(), this.nodes = [], this.levels = /* @__PURE__ */ new Map(), this.outerNodes = [], this.classes = /* @__PURE__ */ new Map(), this.root = void 0;
|
|
259
|
+
}
|
|
260
|
+
}, w(E, "TreeMapDB"), E);
|
|
261
|
+
function le(t) {
|
|
262
|
+
if (!t.length)
|
|
263
|
+
return [];
|
|
264
|
+
const a = [], l = [];
|
|
265
|
+
return t.forEach((n) => {
|
|
266
|
+
const r = {
|
|
267
|
+
name: n.name,
|
|
268
|
+
children: n.type === "Leaf" ? void 0 : []
|
|
269
|
+
};
|
|
270
|
+
for (r.classSelector = n == null ? void 0 : n.classSelector, n != null && n.cssCompiledStyles && (r.cssCompiledStyles = n.cssCompiledStyles), n.type === "Leaf" && n.value !== void 0 && (r.value = n.value); l.length > 0 && l[l.length - 1].level >= n.level; )
|
|
271
|
+
l.pop();
|
|
272
|
+
if (l.length === 0)
|
|
273
|
+
a.push(r);
|
|
274
|
+
else {
|
|
275
|
+
const s = l[l.length - 1].node;
|
|
276
|
+
s.children ? s.children.push(r) : s.children = [r];
|
|
277
|
+
}
|
|
278
|
+
n.type !== "Leaf" && l.push({ node: r, level: n.level });
|
|
279
|
+
}), a;
|
|
280
|
+
}
|
|
281
|
+
w(le, "buildHierarchy");
|
|
282
|
+
var et = /* @__PURE__ */ w((t, a) => {
|
|
283
|
+
Te(t, a);
|
|
284
|
+
const l = [];
|
|
285
|
+
for (const s of t.TreemapRows ?? [])
|
|
286
|
+
s.$type === "ClassDefStatement" && a.addClass(s.className ?? "", s.styleText ?? "");
|
|
287
|
+
for (const s of t.TreemapRows ?? []) {
|
|
288
|
+
const d = s.item;
|
|
289
|
+
if (!d)
|
|
290
|
+
continue;
|
|
291
|
+
const h = s.indent ? parseInt(s.indent) : 0, g = tt(d), c = d.classSelector ? a.getStylesForClass(d.classSelector) : [], u = c.length > 0 ? c : void 0, b = {
|
|
292
|
+
level: h,
|
|
293
|
+
name: g,
|
|
294
|
+
type: d.$type,
|
|
295
|
+
value: d.value,
|
|
296
|
+
classSelector: d.classSelector,
|
|
297
|
+
cssCompiledStyles: u
|
|
298
|
+
};
|
|
299
|
+
l.push(b);
|
|
300
|
+
}
|
|
301
|
+
const n = le(l), r = /* @__PURE__ */ w((s, d) => {
|
|
302
|
+
for (const h of s)
|
|
303
|
+
a.addNode(h, d), h.children && h.children.length > 0 && r(h.children, d + 1);
|
|
304
|
+
}, "addNodesRecursively");
|
|
305
|
+
r(n, 0);
|
|
306
|
+
}, "populate"), tt = /* @__PURE__ */ w((t) => t.name ? String(t.name) : "", "getItemName"), re = {
|
|
307
|
+
// @ts-expect-error - TreeMapDB is not assignable to DiagramDB
|
|
308
|
+
parser: { yy: void 0 },
|
|
309
|
+
parse: /* @__PURE__ */ w(async (t) => {
|
|
310
|
+
var a;
|
|
311
|
+
try {
|
|
312
|
+
const n = await $e("treemap", t);
|
|
313
|
+
K.debug("Treemap AST:", n);
|
|
314
|
+
const r = (a = re.parser) == null ? void 0 : a.yy;
|
|
315
|
+
if (!(r instanceof ne))
|
|
316
|
+
throw new Error(
|
|
317
|
+
"parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues."
|
|
318
|
+
);
|
|
319
|
+
et(n, r);
|
|
320
|
+
} catch (l) {
|
|
321
|
+
throw K.error("Error parsing treemap:", l), l;
|
|
322
|
+
}
|
|
323
|
+
}, "parse")
|
|
324
|
+
}, at = 10, P = 10, X = 25, nt = /* @__PURE__ */ w((t, a, l, n) => {
|
|
325
|
+
const r = n.db, s = r.getConfig(), d = s.padding ?? at, h = r.getDiagramTitle(), g = r.getRoot(), { themeVariables: c } = ee();
|
|
326
|
+
if (!g)
|
|
327
|
+
return;
|
|
328
|
+
const u = h ? 30 : 0, b = ue(a), i = s.nodeWidth ? s.nodeWidth * P : 960, x = s.nodeHeight ? s.nodeHeight * P : 500, S = i, v = x + u;
|
|
329
|
+
b.attr("viewBox", `0 0 ${S} ${v}`), pe(b, v, S, s.useMaxWidth);
|
|
330
|
+
let p;
|
|
331
|
+
try {
|
|
332
|
+
const e = s.valueFormat || ",";
|
|
333
|
+
if (e === "$0,0")
|
|
334
|
+
p = /* @__PURE__ */ w((o) => "$" + O(",")(o), "valueFormat");
|
|
335
|
+
else if (e.startsWith("$") && e.includes(",")) {
|
|
336
|
+
const o = /\.\d+/.exec(e), f = o ? o[0] : "";
|
|
337
|
+
p = /* @__PURE__ */ w((C) => "$" + O("," + f)(C), "valueFormat");
|
|
338
|
+
} else if (e.startsWith("$")) {
|
|
339
|
+
const o = e.substring(1);
|
|
340
|
+
p = /* @__PURE__ */ w((f) => "$" + O(o || "")(f), "valueFormat");
|
|
341
|
+
} else
|
|
342
|
+
p = O(e);
|
|
343
|
+
} catch (e) {
|
|
344
|
+
K.error("Error creating format function:", e), p = O(",");
|
|
345
|
+
}
|
|
346
|
+
const m = U().range([
|
|
347
|
+
"transparent",
|
|
348
|
+
c.cScale0,
|
|
349
|
+
c.cScale1,
|
|
350
|
+
c.cScale2,
|
|
351
|
+
c.cScale3,
|
|
352
|
+
c.cScale4,
|
|
353
|
+
c.cScale5,
|
|
354
|
+
c.cScale6,
|
|
355
|
+
c.cScale7,
|
|
356
|
+
c.cScale8,
|
|
357
|
+
c.cScale9,
|
|
358
|
+
c.cScale10,
|
|
359
|
+
c.cScale11
|
|
360
|
+
]), M = U().range([
|
|
361
|
+
"transparent",
|
|
362
|
+
c.cScalePeer0,
|
|
363
|
+
c.cScalePeer1,
|
|
364
|
+
c.cScalePeer2,
|
|
365
|
+
c.cScalePeer3,
|
|
366
|
+
c.cScalePeer4,
|
|
367
|
+
c.cScalePeer5,
|
|
368
|
+
c.cScalePeer6,
|
|
369
|
+
c.cScalePeer7,
|
|
370
|
+
c.cScalePeer8,
|
|
371
|
+
c.cScalePeer9,
|
|
372
|
+
c.cScalePeer10,
|
|
373
|
+
c.cScalePeer11
|
|
374
|
+
]), N = U().range([
|
|
375
|
+
c.cScaleLabel0,
|
|
376
|
+
c.cScaleLabel1,
|
|
377
|
+
c.cScaleLabel2,
|
|
378
|
+
c.cScaleLabel3,
|
|
379
|
+
c.cScaleLabel4,
|
|
380
|
+
c.cScaleLabel5,
|
|
381
|
+
c.cScaleLabel6,
|
|
382
|
+
c.cScaleLabel7,
|
|
383
|
+
c.cScaleLabel8,
|
|
384
|
+
c.cScaleLabel9,
|
|
385
|
+
c.cScaleLabel10,
|
|
386
|
+
c.cScaleLabel11
|
|
387
|
+
]);
|
|
388
|
+
h && b.append("text").attr("x", S / 2).attr("y", u / 2).attr("class", "treemapTitle").attr("text-anchor", "middle").attr("dominant-baseline", "middle").text(h);
|
|
389
|
+
const z = b.append("g").attr("transform", `translate(0, ${u})`).attr("class", "treemapContainer"), R = te(g).sum((e) => e.value ?? 0).sort((e, o) => (o.value ?? 0) - (e.value ?? 0)), ae = Ke().size([i, x]).paddingTop(
|
|
390
|
+
(e) => e.children && e.children.length > 0 ? X + P : 0
|
|
391
|
+
).paddingInner(d).paddingLeft((e) => e.children && e.children.length > 0 ? P : 0).paddingRight((e) => e.children && e.children.length > 0 ? P : 0).paddingBottom((e) => e.children && e.children.length > 0 ? P : 0).round(!0)(R), se = ae.descendants().filter((e) => e.children && e.children.length > 0), W = z.selectAll(".treemapSection").data(se).enter().append("g").attr("class", "treemapSection").attr("transform", (e) => `translate(${e.x0},${e.y0})`);
|
|
392
|
+
W.append("rect").attr("width", (e) => e.x1 - e.x0).attr("height", X).attr("class", "treemapSectionHeader").attr("fill", "none").attr("fill-opacity", 0.6).attr("stroke-width", 0.6).attr("style", (e) => e.depth === 0 ? "display: none;" : ""), W.append("clipPath").attr("id", (e, o) => `clip-section-${a}-${o}`).append("rect").attr("width", (e) => Math.max(0, e.x1 - e.x0 - 12)).attr("height", X), W.append("rect").attr("width", (e) => e.x1 - e.x0).attr("height", (e) => e.y1 - e.y0).attr("class", (e, o) => `treemapSection section${o}`).attr("fill", (e) => m(e.data.name)).attr("fill-opacity", 0.6).attr("stroke", (e) => M(e.data.name)).attr("stroke-width", 2).attr("stroke-opacity", 0.4).attr("style", (e) => {
|
|
393
|
+
if (e.depth === 0)
|
|
394
|
+
return "display: none;";
|
|
395
|
+
const o = B({ cssCompiledStyles: e.data.cssCompiledStyles });
|
|
396
|
+
return o.nodeStyles + ";" + o.borderStyles.join(";");
|
|
397
|
+
}), W.append("text").attr("class", "treemapSectionLabel").attr("x", 6).attr("y", X / 2).attr("dominant-baseline", "middle").text((e) => e.depth === 0 ? "" : e.data.name).attr("font-weight", "bold").attr("style", (e) => {
|
|
398
|
+
if (e.depth === 0)
|
|
399
|
+
return "display: none;";
|
|
400
|
+
const o = "dominant-baseline: middle; font-size: 12px; fill:" + N(e.data.name) + "; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;", f = B({ cssCompiledStyles: e.data.cssCompiledStyles });
|
|
401
|
+
return o + f.labelStyles.replace("color:", "fill:");
|
|
402
|
+
}).each(function(e) {
|
|
403
|
+
if (e.depth === 0)
|
|
404
|
+
return;
|
|
405
|
+
const o = j(this), f = e.data.name;
|
|
406
|
+
o.text(f);
|
|
407
|
+
const C = e.x1 - e.x0, L = 6;
|
|
408
|
+
let A;
|
|
409
|
+
s.showValues !== !1 && e.value ? A = C - 10 - 30 - 10 - L : A = C - L - 6;
|
|
410
|
+
const F = Math.max(15, A), y = o.node();
|
|
411
|
+
if (y.getComputedTextLength() > F) {
|
|
412
|
+
const T = "...";
|
|
413
|
+
let $ = f;
|
|
414
|
+
for (; $.length > 0; ) {
|
|
415
|
+
if ($ = f.substring(0, $.length - 1), $.length === 0) {
|
|
416
|
+
o.text(T), y.getComputedTextLength() > F && o.text("");
|
|
417
|
+
break;
|
|
418
|
+
}
|
|
419
|
+
if (o.text($ + T), y.getComputedTextLength() <= F)
|
|
420
|
+
break;
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
}), s.showValues !== !1 && W.append("text").attr("class", "treemapSectionValue").attr("x", (e) => e.x1 - e.x0 - 10).attr("y", X / 2).attr("text-anchor", "end").attr("dominant-baseline", "middle").text((e) => e.value ? p(e.value) : "").attr("font-style", "italic").attr("style", (e) => {
|
|
424
|
+
if (e.depth === 0)
|
|
425
|
+
return "display: none;";
|
|
426
|
+
const o = "text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:" + N(e.data.name) + "; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;", f = B({ cssCompiledStyles: e.data.cssCompiledStyles });
|
|
427
|
+
return o + f.labelStyles.replace("color:", "fill:");
|
|
428
|
+
});
|
|
429
|
+
const ie = ae.leaves(), Y = z.selectAll(".treemapLeafGroup").data(ie).enter().append("g").attr("class", (e, o) => `treemapNode treemapLeafGroup leaf${o}${e.data.classSelector ? ` ${e.data.classSelector}` : ""}x`).attr("transform", (e) => `translate(${e.x0},${e.y0})`);
|
|
430
|
+
Y.append("rect").attr("width", (e) => e.x1 - e.x0).attr("height", (e) => e.y1 - e.y0).attr("class", "treemapLeaf").attr("fill", (e) => e.parent ? m(e.parent.data.name) : m(e.data.name)).attr("style", (e) => B({ cssCompiledStyles: e.data.cssCompiledStyles }).nodeStyles).attr("fill-opacity", 0.3).attr("stroke", (e) => e.parent ? m(e.parent.data.name) : m(e.data.name)).attr("stroke-width", 3), Y.append("clipPath").attr("id", (e, o) => `clip-${a}-${o}`).append("rect").attr("width", (e) => Math.max(0, e.x1 - e.x0 - 4)).attr("height", (e) => Math.max(0, e.y1 - e.y0 - 4)), Y.append("text").attr("class", "treemapLabel").attr("x", (e) => (e.x1 - e.x0) / 2).attr("y", (e) => (e.y1 - e.y0) / 2).attr("style", (e) => {
|
|
431
|
+
const o = "text-anchor: middle; dominant-baseline: middle; font-size: 38px;fill:" + N(e.data.name) + ";", f = B({ cssCompiledStyles: e.data.cssCompiledStyles });
|
|
432
|
+
return o + f.labelStyles.replace("color:", "fill:");
|
|
433
|
+
}).attr("clip-path", (e, o) => `url(#clip-${a}-${o})`).text((e) => e.data.name).each(function(e) {
|
|
434
|
+
const o = j(this), f = e.x1 - e.x0, C = e.y1 - e.y0, L = o.node(), A = 4, D = f - 2 * A, F = C - 2 * A;
|
|
435
|
+
if (D < 10 || F < 10) {
|
|
436
|
+
o.style("display", "none");
|
|
437
|
+
return;
|
|
438
|
+
}
|
|
439
|
+
let y = parseInt(o.style("font-size"), 10);
|
|
440
|
+
const _ = 8, T = 28, $ = 0.6, k = 6, H = 2;
|
|
441
|
+
for (; L.getComputedTextLength() > D && y > _; )
|
|
442
|
+
y--, o.style("font-size", `${y}px`);
|
|
443
|
+
let I = Math.max(
|
|
444
|
+
k,
|
|
445
|
+
Math.min(T, Math.round(y * $))
|
|
446
|
+
), Q = y + H + I;
|
|
447
|
+
for (; Q > F && y > _ && (y--, I = Math.max(
|
|
448
|
+
k,
|
|
449
|
+
Math.min(T, Math.round(y * $))
|
|
450
|
+
), !(I < k && y === _)); )
|
|
451
|
+
o.style("font-size", `${y}px`), Q = y + H + I;
|
|
452
|
+
o.style("font-size", `${y}px`), (L.getComputedTextLength() > D || y < _ || F < y) && o.style("display", "none");
|
|
453
|
+
}), s.showValues !== !1 && Y.append("text").attr("class", "treemapValue").attr("x", (o) => (o.x1 - o.x0) / 2).attr("y", function(o) {
|
|
454
|
+
return (o.y1 - o.y0) / 2;
|
|
455
|
+
}).attr("style", (o) => {
|
|
456
|
+
const f = "text-anchor: middle; dominant-baseline: hanging; font-size: 28px;fill:" + N(o.data.name) + ";", C = B({ cssCompiledStyles: o.data.cssCompiledStyles });
|
|
457
|
+
return f + C.labelStyles.replace("color:", "fill:");
|
|
458
|
+
}).attr("clip-path", (o, f) => `url(#clip-${a}-${f})`).text((o) => o.value ? p(o.value) : "").each(function(o) {
|
|
459
|
+
const f = j(this), C = this.parentNode;
|
|
460
|
+
if (!C) {
|
|
461
|
+
f.style("display", "none");
|
|
462
|
+
return;
|
|
463
|
+
}
|
|
464
|
+
const L = j(C).select(".treemapLabel");
|
|
465
|
+
if (L.empty() || L.style("display") === "none") {
|
|
466
|
+
f.style("display", "none");
|
|
467
|
+
return;
|
|
468
|
+
}
|
|
469
|
+
const A = parseFloat(L.style("font-size")), D = 28, F = 0.6, y = 6, _ = 2, T = Math.max(
|
|
470
|
+
y,
|
|
471
|
+
Math.min(D, Math.round(A * F))
|
|
472
|
+
);
|
|
473
|
+
f.style("font-size", `${T}px`);
|
|
474
|
+
const k = (o.y1 - o.y0) / 2 + A / 2 + _;
|
|
475
|
+
f.attr("y", k);
|
|
476
|
+
const H = o.x1 - o.x0, ce = o.y1 - o.y0 - 4, de = H - 2 * 4;
|
|
477
|
+
f.node().getComputedTextLength() > de || k + T > ce || T < y ? f.style("display", "none") : f.style("display", null);
|
|
478
|
+
});
|
|
479
|
+
const oe = s.diagramPadding ?? 8;
|
|
480
|
+
Ce(b, oe, "flowchart", (s == null ? void 0 : s.useMaxWidth) || !1);
|
|
481
|
+
}, "draw"), lt = /* @__PURE__ */ w(function(t, a) {
|
|
482
|
+
return a.db.getClasses();
|
|
483
|
+
}, "getClasses"), rt = { draw: nt, getClasses: lt }, st = {
|
|
484
|
+
sectionStrokeColor: "black",
|
|
485
|
+
sectionStrokeWidth: "1",
|
|
486
|
+
sectionFillColor: "#efefef",
|
|
487
|
+
leafStrokeColor: "black",
|
|
488
|
+
leafStrokeWidth: "1",
|
|
489
|
+
leafFillColor: "#efefef",
|
|
490
|
+
labelFontSize: "12px",
|
|
491
|
+
valueFontSize: "10px",
|
|
492
|
+
titleFontSize: "14px"
|
|
493
|
+
}, it = /* @__PURE__ */ w(({
|
|
494
|
+
treemap: t
|
|
495
|
+
} = {}) => {
|
|
496
|
+
const a = he(), l = ee(), n = J(a, l.themeVariables), r = J(st, t), s = r.titleColor ?? n.titleColor, d = r.labelColor ?? n.textColor, h = r.valueColor ?? n.textColor;
|
|
497
|
+
return `
|
|
498
|
+
.treemapNode.section {
|
|
499
|
+
stroke: ${r.sectionStrokeColor};
|
|
500
|
+
stroke-width: ${r.sectionStrokeWidth};
|
|
501
|
+
fill: ${r.sectionFillColor};
|
|
502
|
+
}
|
|
503
|
+
.treemapNode.leaf {
|
|
504
|
+
stroke: ${r.leafStrokeColor};
|
|
505
|
+
stroke-width: ${r.leafStrokeWidth};
|
|
506
|
+
fill: ${r.leafFillColor};
|
|
507
|
+
}
|
|
508
|
+
.treemapLabel {
|
|
509
|
+
fill: ${d};
|
|
510
|
+
font-size: ${r.labelFontSize};
|
|
511
|
+
}
|
|
512
|
+
.treemapValue {
|
|
513
|
+
fill: ${h};
|
|
514
|
+
font-size: ${r.valueFontSize};
|
|
515
|
+
}
|
|
516
|
+
.treemapTitle {
|
|
517
|
+
fill: ${s};
|
|
518
|
+
font-size: ${r.titleFontSize};
|
|
519
|
+
}
|
|
520
|
+
`;
|
|
521
|
+
}, "getStyles"), ot = it, mt = {
|
|
522
|
+
parser: re,
|
|
523
|
+
get db() {
|
|
524
|
+
return new ne();
|
|
525
|
+
},
|
|
526
|
+
renderer: rt,
|
|
527
|
+
styles: ot
|
|
528
|
+
};
|
|
529
|
+
export {
|
|
530
|
+
mt as diagram
|
|
531
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./mermaid.core-BzNKr-OJ.cjs"),se=require("./chunk-2J33WTMH-CG2n_n4y.cjs"),ie=require("./chunk-4BX2VUAB-CdMctZeT.cjs"),oe=require("./wardley-L42UT6IY-tDp0NbFW.cjs"),I=require("./defaultLocale-k2G_58r6.cjs"),U=require("./ordinal-CagbB1m8.cjs");function ce(t){var a=0,l=t.children,n=l&&l.length;if(!n)a=1;else for(;--n>=0;)a+=l[n].value;t.value=a}function de(){return this.eachAfter(ce)}function he(t,a){let l=-1;for(const n of this)t.call(a,n,++l,this);return this}function ue(t,a){for(var l=this,n=[l],r,s,d=-1;l=n.pop();)if(t.call(a,l,++d,this),r=l.children)for(s=r.length-1;s>=0;--s)n.push(r[s]);return this}function pe(t,a){for(var l=this,n=[l],r=[],s,d,u,m=-1;l=n.pop();)if(r.push(l),s=l.children)for(d=0,u=s.length;d<u;++d)n.push(s[d]);for(;l=r.pop();)t.call(a,l,++m,this);return this}function fe(t,a){let l=-1;for(const n of this)if(t.call(a,n,++l,this))return n}function ge(t){return this.eachAfter(function(a){for(var l=+t(a.data)||0,n=a.children,r=n&&n.length;--r>=0;)l+=n[r].value;a.value=l})}function me(t){return this.eachBefore(function(a){a.children&&a.children.sort(t)})}function ye(t){for(var a=this,l=Se(a,t),n=[a];a!==l;)a=a.parent,n.push(a);for(var r=n.length;t!==l;)n.splice(r,0,t),t=t.parent;return n}function Se(t,a){if(t===a)return t;var l=t.ancestors(),n=a.ancestors(),r=null;for(t=l.pop(),a=n.pop();t===a;)r=t,t=l.pop(),a=n.pop();return r}function ve(){for(var t=this,a=[t];t=t.parent;)a.push(t);return a}function xe(){return Array.from(this)}function be(){var t=[];return this.eachBefore(function(a){a.children||t.push(a)}),t}function we(){var t=this,a=[];return t.each(function(l){l!==t&&a.push({source:l.parent,target:l})}),a}function*Ce(){var t=this,a,l=[t],n,r,s;do for(a=l.reverse(),l=[];t=a.pop();)if(yield t,n=t.children)for(r=0,s=n.length;r<s;++r)l.push(n[r]);while(l.length)}function J(t,a){t instanceof Map?(t=[void 0,t],a===void 0&&(a=Le)):a===void 0&&(a=_e);for(var l=new Y(t),n,r=[l],s,d,u,m;n=r.pop();)if((d=a(n.data))&&(m=(d=Array.from(d)).length))for(n.children=d,u=m-1;u>=0;--u)r.push(s=d[u]=new Y(d[u])),s.parent=n,s.depth=n.depth+1;return l.eachBefore(Ae)}function Te(){return J(this).eachBefore($e)}function _e(t){return t.children}function Le(t){return Array.isArray(t)?t[1]:null}function $e(t){t.data.value!==void 0&&(t.value=t.data.value),t.data=t.data.data}function Ae(t){var a=0;do t.height=a;while((t=t.parent)&&t.height<++a)}function Y(t){this.data=t,this.depth=this.height=0,this.parent=null}Y.prototype=J.prototype={constructor:Y,count:de,each:he,eachAfter:pe,eachBefore:ue,find:fe,sum:ge,sort:me,path:ye,ancestors:ve,descendants:xe,leaves:be,links:we,copy:Te,[Symbol.iterator]:Ce};function Me(t){if(typeof t!="function")throw new Error;return t}function q(){return 0}function O(t){return function(){return t}}function Fe(t){t.x0=Math.round(t.x0),t.y0=Math.round(t.y0),t.x1=Math.round(t.x1),t.y1=Math.round(t.y1)}function Ne(t,a,l,n,r){for(var s=t.children,d,u=-1,m=s.length,c=t.value&&(n-a)/t.value;++u<m;)d=s[u],d.y0=l,d.y1=r,d.x0=a,d.x1=a+=d.value*c}function ke(t,a,l,n,r){for(var s=t.children,d,u=-1,m=s.length,c=t.value&&(r-l)/t.value;++u<m;)d=s[u],d.x0=a,d.x1=n,d.y0=l,d.y1=l+=d.value*c}var Ve=(1+Math.sqrt(5))/2;function ze(t,a,l,n,r,s){for(var d=[],u=a.children,m,c,p=0,w=0,i=u.length,b,v,x=a.value,f,y,F,M,z,R,N;p<i;){b=r-l,v=s-n;do f=u[w++].value;while(!f&&w<i);for(y=F=f,R=Math.max(v/b,b/v)/(x*t),N=f*f*R,z=Math.max(F/N,N/y);w<i;++w){if(f+=c=u[w].value,c<y&&(y=c),c>F&&(F=c),N=f*f*R,M=Math.max(F/N,N/y),M>z){f-=c;break}z=M}d.push(m={value:f,dice:b<v,children:u.slice(p,w)}),m.dice?Ne(m,l,n,r,x?n+=v*f/x:s):ke(m,l,n,x?l+=b*f/x:r,s),x-=f,p=w}return d}const Be=function t(a){function l(n,r,s,d,u){ze(a,n,r,s,d,u)}return l.ratio=function(n){return t((n=+n)>1?n:1)},l}(Ve);function De(){var t=Be,a=!1,l=1,n=1,r=[0],s=q,d=q,u=q,m=q,c=q;function p(i){return i.x0=i.y0=0,i.x1=l,i.y1=n,i.eachBefore(w),r=[0],a&&i.eachBefore(Fe),i}function w(i){var b=r[i.depth],v=i.x0+b,x=i.y0+b,f=i.x1-b,y=i.y1-b;f<v&&(v=f=(v+f)/2),y<x&&(x=y=(x+y)/2),i.x0=v,i.y0=x,i.x1=f,i.y1=y,i.children&&(b=r[i.depth+1]=s(i)/2,v+=c(i)-b,x+=d(i)-b,f-=u(i)-b,y-=m(i)-b,f<v&&(v=f=(v+f)/2),y<x&&(x=y=(x+y)/2),t(i,v,x,f,y))}return p.round=function(i){return arguments.length?(a=!!i,p):a},p.size=function(i){return arguments.length?(l=+i[0],n=+i[1],p):[l,n]},p.tile=function(i){return arguments.length?(t=Me(i),p):t},p.padding=function(i){return arguments.length?p.paddingInner(i).paddingOuter(i):p.paddingInner()},p.paddingInner=function(i){return arguments.length?(s=typeof i=="function"?i:O(+i),p):s},p.paddingOuter=function(i){return arguments.length?p.paddingTop(i).paddingRight(i).paddingBottom(i).paddingLeft(i):p.paddingTop()},p.paddingTop=function(i){return arguments.length?(d=typeof i=="function"?i:O(+i),p):d},p.paddingRight=function(i){return arguments.length?(u=typeof i=="function"?i:O(+i),p):u},p.paddingBottom=function(i){return arguments.length?(m=typeof i=="function"?i:O(+i),p):m},p.paddingLeft=function(i){return arguments.length?(c=typeof i=="function"?i:O(+i),p):c},p}var P,K=(P=class{constructor(){this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.setAccTitle=h.setAccTitle,this.getAccTitle=h.getAccTitle,this.setDiagramTitle=h.setDiagramTitle,this.getDiagramTitle=h.getDiagramTitle,this.getAccDescription=h.getAccDescription,this.setAccDescription=h.setAccDescription}getNodes(){return this.nodes}getConfig(){const a=h.defaultConfig_default,l=h.getConfig();return h.cleanAndMerge({...a.treemap,...l.treemap??{}})}addNode(a,l){this.nodes.push(a),this.levels.set(a,l),l===0&&(this.outerNodes.push(a),this.root??(this.root=a))}getRoot(){return{name:"",children:this.outerNodes}}addClass(a,l){const n=this.classes.get(a)??{id:a,styles:[],textStyles:[]},r=l.replace(/\\,/g,"§§§").replace(/,/g,";").replace(/§§§/g,",").split(";");r&&r.forEach(s=>{h.isLabelStyle(s)&&(n!=null&&n.textStyles?n.textStyles.push(s):n.textStyles=[s]),n!=null&&n.styles?n.styles.push(s):n.styles=[s]}),this.classes.set(a,n)}getClasses(){return this.classes}getStylesForClass(a){var l;return((l=this.classes.get(a))==null?void 0:l.styles)??[]}clear(){h.clear(),this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.root=void 0}},h.__name(P,"TreeMapDB"),P);function Q(t){if(!t.length)return[];const a=[],l=[];return t.forEach(n=>{const r={name:n.name,children:n.type==="Leaf"?void 0:[]};for(r.classSelector=n==null?void 0:n.classSelector,n!=null&&n.cssCompiledStyles&&(r.cssCompiledStyles=n.cssCompiledStyles),n.type==="Leaf"&&n.value!==void 0&&(r.value=n.value);l.length>0&&l[l.length-1].level>=n.level;)l.pop();if(l.length===0)a.push(r);else{const s=l[l.length-1].node;s.children?s.children.push(r):s.children=[r]}n.type!=="Leaf"&&l.push({node:r,level:n.level})}),a}h.__name(Q,"buildHierarchy");var Pe=h.__name((t,a)=>{ie.populateCommonDb(t,a);const l=[];for(const s of t.TreemapRows??[])s.$type==="ClassDefStatement"&&a.addClass(s.className??"",s.styleText??"");for(const s of t.TreemapRows??[]){const d=s.item;if(!d)continue;const u=s.indent?parseInt(s.indent):0,m=Re(d),c=d.classSelector?a.getStylesForClass(d.classSelector):[],p=c.length>0?c:void 0,w={level:u,name:m,type:d.$type,value:d.value,classSelector:d.classSelector,cssCompiledStyles:p};l.push(w)}const n=Q(l),r=h.__name((s,d)=>{for(const u of s)a.addNode(u,d),u.children&&u.children.length>0&&r(u.children,d+1)},"addNodesRecursively");r(n,0)},"populate"),Re=h.__name(t=>t.name?String(t.name):"","getItemName"),ee={parser:{yy:void 0},parse:h.__name(async t=>{var a;try{const l=oe.parse,n=await l("treemap",t);h.log.debug("Treemap AST:",n);const r=(a=ee.parser)==null?void 0:a.yy;if(!(r instanceof K))throw new Error("parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Pe(n,r)}catch(l){throw h.log.error("Error parsing treemap:",l),l}},"parse")},We=10,D=10,G=25,Ee=h.__name((t,a,l,n)=>{const r=n.db,s=r.getConfig(),d=s.padding??We,u=r.getDiagramTitle(),m=r.getRoot(),{themeVariables:c}=h.getConfig();if(!m)return;const p=u?30:0,w=h.selectSvgElement(a),i=s.nodeWidth?s.nodeWidth*D:960,b=s.nodeHeight?s.nodeHeight*D:500,v=i,x=b+p;w.attr("viewBox",`0 0 ${v} ${x}`),h.configureSvgSize(w,x,v,s.useMaxWidth);let f;try{const e=s.valueFormat||",";if(e==="$0,0")f=h.__name(o=>"$"+I.format(",")(o),"valueFormat");else if(e.startsWith("$")&&e.includes(",")){const o=/\.\d+/.exec(e),g=o?o[0]:"";f=h.__name(C=>"$"+I.format(","+g)(C),"valueFormat")}else if(e.startsWith("$")){const o=e.substring(1);f=h.__name(g=>"$"+I.format(o||"")(g),"valueFormat")}else f=I.format(e)}catch(e){h.log.error("Error creating format function:",e),f=I.format(",")}const y=U.ordinal().range(["transparent",c.cScale0,c.cScale1,c.cScale2,c.cScale3,c.cScale4,c.cScale5,c.cScale6,c.cScale7,c.cScale8,c.cScale9,c.cScale10,c.cScale11]),F=U.ordinal().range(["transparent",c.cScalePeer0,c.cScalePeer1,c.cScalePeer2,c.cScalePeer3,c.cScalePeer4,c.cScalePeer5,c.cScalePeer6,c.cScalePeer7,c.cScalePeer8,c.cScalePeer9,c.cScalePeer10,c.cScalePeer11]),M=U.ordinal().range([c.cScaleLabel0,c.cScaleLabel1,c.cScaleLabel2,c.cScaleLabel3,c.cScaleLabel4,c.cScaleLabel5,c.cScaleLabel6,c.cScaleLabel7,c.cScaleLabel8,c.cScaleLabel9,c.cScaleLabel10,c.cScaleLabel11]);u&&w.append("text").attr("x",v/2).attr("y",p/2).attr("class","treemapTitle").attr("text-anchor","middle").attr("dominant-baseline","middle").text(u);const z=w.append("g").attr("transform",`translate(0, ${p})`).attr("class","treemapContainer"),R=J(m).sum(e=>e.value??0).sort((e,o)=>(o.value??0)-(e.value??0)),Z=De().size([i,b]).paddingTop(e=>e.children&&e.children.length>0?G+D:0).paddingInner(d).paddingLeft(e=>e.children&&e.children.length>0?D:0).paddingRight(e=>e.children&&e.children.length>0?D:0).paddingBottom(e=>e.children&&e.children.length>0?D:0).round(!0)(R),te=Z.descendants().filter(e=>e.children&&e.children.length>0),W=z.selectAll(".treemapSection").data(te).enter().append("g").attr("class","treemapSection").attr("transform",e=>`translate(${e.x0},${e.y0})`);W.append("rect").attr("width",e=>e.x1-e.x0).attr("height",G).attr("class","treemapSectionHeader").attr("fill","none").attr("fill-opacity",.6).attr("stroke-width",.6).attr("style",e=>e.depth===0?"display: none;":""),W.append("clipPath").attr("id",(e,o)=>`clip-section-${a}-${o}`).append("rect").attr("width",e=>Math.max(0,e.x1-e.x0-12)).attr("height",G),W.append("rect").attr("width",e=>e.x1-e.x0).attr("height",e=>e.y1-e.y0).attr("class",(e,o)=>`treemapSection section${o}`).attr("fill",e=>y(e.data.name)).attr("fill-opacity",.6).attr("stroke",e=>F(e.data.name)).attr("stroke-width",2).attr("stroke-opacity",.4).attr("style",e=>{if(e.depth===0)return"display: none;";const o=h.styles2String({cssCompiledStyles:e.data.cssCompiledStyles});return o.nodeStyles+";"+o.borderStyles.join(";")}),W.append("text").attr("class","treemapSectionLabel").attr("x",6).attr("y",G/2).attr("dominant-baseline","middle").text(e=>e.depth===0?"":e.data.name).attr("font-weight","bold").attr("style",e=>{if(e.depth===0)return"display: none;";const o="dominant-baseline: middle; font-size: 12px; fill:"+M(e.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",g=h.styles2String({cssCompiledStyles:e.data.cssCompiledStyles});return o+g.labelStyles.replace("color:","fill:")}).each(function(e){if(e.depth===0)return;const o=h.select(this),g=e.data.name;o.text(g);const C=e.x1-e.x0,L=6;let $;s.showValues!==!1&&e.value?$=C-10-30-10-L:$=C-L-6;const A=Math.max(15,$),S=o.node();if(S.getComputedTextLength()>A){const T="...";let _=g;for(;_.length>0;){if(_=g.substring(0,_.length-1),_.length===0){o.text(T),S.getComputedTextLength()>A&&o.text("");break}if(o.text(_+T),S.getComputedTextLength()<=A)break}}}),s.showValues!==!1&&W.append("text").attr("class","treemapSectionValue").attr("x",e=>e.x1-e.x0-10).attr("y",G/2).attr("text-anchor","end").attr("dominant-baseline","middle").text(e=>e.value?f(e.value):"").attr("font-style","italic").attr("style",e=>{if(e.depth===0)return"display: none;";const o="text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:"+M(e.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",g=h.styles2String({cssCompiledStyles:e.data.cssCompiledStyles});return o+g.labelStyles.replace("color:","fill:")});const ae=Z.leaves(),X=z.selectAll(".treemapLeafGroup").data(ae).enter().append("g").attr("class",(e,o)=>`treemapNode treemapLeafGroup leaf${o}${e.data.classSelector?` ${e.data.classSelector}`:""}x`).attr("transform",e=>`translate(${e.x0},${e.y0})`);X.append("rect").attr("width",e=>e.x1-e.x0).attr("height",e=>e.y1-e.y0).attr("class","treemapLeaf").attr("fill",e=>e.parent?y(e.parent.data.name):y(e.data.name)).attr("style",e=>h.styles2String({cssCompiledStyles:e.data.cssCompiledStyles}).nodeStyles).attr("fill-opacity",.3).attr("stroke",e=>e.parent?y(e.parent.data.name):y(e.data.name)).attr("stroke-width",3),X.append("clipPath").attr("id",(e,o)=>`clip-${a}-${o}`).append("rect").attr("width",e=>Math.max(0,e.x1-e.x0-4)).attr("height",e=>Math.max(0,e.y1-e.y0-4)),X.append("text").attr("class","treemapLabel").attr("x",e=>(e.x1-e.x0)/2).attr("y",e=>(e.y1-e.y0)/2).attr("style",e=>{const o="text-anchor: middle; dominant-baseline: middle; font-size: 38px;fill:"+M(e.data.name)+";",g=h.styles2String({cssCompiledStyles:e.data.cssCompiledStyles});return o+g.labelStyles.replace("color:","fill:")}).attr("clip-path",(e,o)=>`url(#clip-${a}-${o})`).text(e=>e.data.name).each(function(e){const o=h.select(this),g=e.x1-e.x0,C=e.y1-e.y0,L=o.node(),$=4,B=g-2*$,A=C-2*$;if(B<10||A<10){o.style("display","none");return}let S=parseInt(o.style("font-size"),10);const k=8,T=28,_=.6,V=6,E=2;for(;L.getComputedTextLength()>B&&S>k;)S--,o.style("font-size",`${S}px`);let H=Math.max(V,Math.min(T,Math.round(S*_))),j=S+E+H;for(;j>A&&S>k&&(S--,H=Math.max(V,Math.min(T,Math.round(S*_))),!(H<V&&S===k));)o.style("font-size",`${S}px`),j=S+E+H;o.style("font-size",`${S}px`),(L.getComputedTextLength()>B||S<k||A<S)&&o.style("display","none")}),s.showValues!==!1&&X.append("text").attr("class","treemapValue").attr("x",o=>(o.x1-o.x0)/2).attr("y",function(o){return(o.y1-o.y0)/2}).attr("style",o=>{const g="text-anchor: middle; dominant-baseline: hanging; font-size: 28px;fill:"+M(o.data.name)+";",C=h.styles2String({cssCompiledStyles:o.data.cssCompiledStyles});return g+C.labelStyles.replace("color:","fill:")}).attr("clip-path",(o,g)=>`url(#clip-${a}-${g})`).text(o=>o.value?f(o.value):"").each(function(o){const g=h.select(this),C=this.parentNode;if(!C){g.style("display","none");return}const L=h.select(C).select(".treemapLabel");if(L.empty()||L.style("display")==="none"){g.style("display","none");return}const $=parseFloat(L.style("font-size")),B=28,A=.6,S=6,k=2,T=Math.max(S,Math.min(B,Math.round($*A)));g.style("font-size",`${T}px`);const V=(o.y1-o.y0)/2+$/2+k;g.attr("y",V);const E=o.x1-o.x0,le=o.y1-o.y0-4,re=E-2*4;g.node().getComputedTextLength()>re||V+T>le||T<S?g.style("display","none"):g.style("display",null)});const ne=s.diagramPadding??8;se.setupViewPortForSVG(w,ne,"flowchart",(s==null?void 0:s.useMaxWidth)||!1)},"draw"),He=h.__name(function(t,a){return a.db.getClasses()},"getClasses"),Ie={draw:Ee,getClasses:He},qe={sectionStrokeColor:"black",sectionStrokeWidth:"1",sectionFillColor:"#efefef",leafStrokeColor:"black",leafStrokeWidth:"1",leafFillColor:"#efefef",labelFontSize:"12px",valueFontSize:"10px",titleFontSize:"14px"},Oe=h.__name(({treemap:t}={})=>{const a=h.getThemeVariables3(),l=h.getConfig(),n=h.cleanAndMerge(a,l.themeVariables),r=h.cleanAndMerge(qe,t),s=r.titleColor??n.titleColor,d=r.labelColor??n.textColor,u=r.valueColor??n.textColor;return`
|
|
2
|
+
.treemapNode.section {
|
|
3
|
+
stroke: ${r.sectionStrokeColor};
|
|
4
|
+
stroke-width: ${r.sectionStrokeWidth};
|
|
5
|
+
fill: ${r.sectionFillColor};
|
|
6
|
+
}
|
|
7
|
+
.treemapNode.leaf {
|
|
8
|
+
stroke: ${r.leafStrokeColor};
|
|
9
|
+
stroke-width: ${r.leafStrokeWidth};
|
|
10
|
+
fill: ${r.leafFillColor};
|
|
11
|
+
}
|
|
12
|
+
.treemapLabel {
|
|
13
|
+
fill: ${d};
|
|
14
|
+
font-size: ${r.labelFontSize};
|
|
15
|
+
}
|
|
16
|
+
.treemapValue {
|
|
17
|
+
fill: ${u};
|
|
18
|
+
font-size: ${r.valueFontSize};
|
|
19
|
+
}
|
|
20
|
+
.treemapTitle {
|
|
21
|
+
fill: ${s};
|
|
22
|
+
font-size: ${r.titleFontSize};
|
|
23
|
+
}
|
|
24
|
+
`},"getStyles"),Ge=Oe,Xe={parser:ee,get db(){return new K},renderer:Ie,styles:Ge};exports.diagram=Xe;
|