@life-exe/wiki-engine 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +180 -0
- package/dist/analytics/index.d.ts +10 -0
- package/dist/chunks/abnfDiagram-VCTEODGH-DyAP6Aua.js +87 -0
- package/dist/chunks/arc-OroUeRL_.js +83 -0
- package/dist/chunks/architectureDiagram-5GKGNRK7-FjmrDCl4.js +4784 -0
- package/dist/chunks/blockDiagram-I7D4REHJ-BF3oIDlI.js +1416 -0
- package/dist/chunks/c4Diagram-7LVT6UL2-Cmdq0LZr.js +1511 -0
- package/dist/chunks/channel-Bdy1QZHo.js +5 -0
- package/dist/chunks/chunk-2Q5K7J3B-BwxRSEKd.js +15 -0
- package/dist/chunks/chunk-5VM5RSS4-BtHwUU4T.js +19 -0
- package/dist/chunks/chunk-F27PBJKO-DF4TGftR.js +68 -0
- package/dist/chunks/chunk-IMKFNOWR-DkBQ-1aV.js +1421 -0
- package/dist/chunks/chunk-JWPE2WC7-BIokdAUW.js +9 -0
- package/dist/chunks/chunk-POPQ4Y6H-CcjOsf9X.js +20 -0
- package/dist/chunks/chunk-SHT3W25Y-lYp5BdEg.js +1695 -0
- package/dist/chunks/chunk-SVP7TREG-DN-ravNt.js +664 -0
- package/dist/chunks/chunk-TICWLB2K-CtTJ0xaY.js +1534 -0
- package/dist/chunks/chunk-XXDRQBXY-BovkWFC0.js +8 -0
- package/dist/chunks/classDiagram-ZZMXUADV-CMYS0pHw.js +16 -0
- package/dist/chunks/classDiagram-v2-VYDZK3BY-CMYS0pHw.js +16 -0
- package/dist/chunks/common-BJ4q25wy.js +12633 -0
- package/dist/chunks/cose-bilkent-JH36ORCC-CaMqpJY7.js +2608 -0
- package/dist/chunks/cynefin-OW5HDTMX-Bzjecpt-.js +23853 -0
- package/dist/chunks/cynefinDiagram-5FMLGOSQ-C0NuKLt0.js +299 -0
- package/dist/chunks/cytoscape.esm-DmPrb1GM.js +18787 -0
- package/dist/chunks/dagre-GXQ25YYZ-Ds09_NdN.js +461 -0
- package/dist/chunks/defaultLocale-BgPVtth8.js +171 -0
- package/dist/chunks/diagram-S7CK7UJ4-IvSazk1O.js +349 -0
- package/dist/chunks/diagram-UQ7AKVKN-58epdx5V.js +223 -0
- package/dist/chunks/diagram-VSXAHHWV-BrzRGMeV.js +466 -0
- package/dist/chunks/diagram-VX7I27RA-DPL0Nw6d.js +530 -0
- package/dist/chunks/diagram-Z3DM3KII-8VWVu0I5.js +143 -0
- package/dist/chunks/ebnfDiagram-PWID7BFC-DeByR_ze.js +109 -0
- package/dist/chunks/erDiagram-RLTQ6QDP-C9uo9iE1.js +1060 -0
- package/dist/chunks/flowDiagram-HODETNUW-BpoY3OMp.js +7 -0
- package/dist/chunks/ganttDiagram-EL5Y4UJY-psdwnC-T.js +2711 -0
- package/dist/chunks/gitGraphDiagram-WWUBYQGX-vsDfkn_Q.js +828 -0
- package/dist/chunks/index-f7Uzykhj.js +38262 -0
- package/dist/chunks/infoDiagram-27XIBGKW-8K-eQZiU.js +24 -0
- package/dist/chunks/init-DjUOC4st.js +16 -0
- package/dist/chunks/ishikawaDiagram-5VMMS53U-CuqR1k5i.js +622 -0
- package/dist/chunks/journeyDiagram-3NMN7TZE-BPW1nmwZ.js +834 -0
- package/dist/chunks/kanban-definition-UXKFOSKX-iY6-d6jO.js +726 -0
- package/dist/chunks/katex-jHfnQmlp.js +11682 -0
- package/dist/chunks/layout-CgV9vOdp.js +1704 -0
- package/dist/chunks/linear-BzcaSMTS.js +259 -0
- package/dist/chunks/mindmap-definition-YA3MSWOX-CaLfHyv0.js +831 -0
- package/dist/chunks/ordinal-DfAQgscy.js +61 -0
- package/dist/chunks/pegDiagram-XKGWAZYB-6Y28VvVh.js +95 -0
- package/dist/chunks/pieDiagram-E7YTZNPT-OrjeRxhs.js +209 -0
- package/dist/chunks/quadrantDiagram-AXDQQJYC-rgw2lV2J.js +1025 -0
- package/dist/chunks/railroadDiagram-O6MQD6OU-D6QNO5r1.js +77 -0
- package/dist/chunks/requirementDiagram-BXWQKSXE-a8tNRSuE.js +884 -0
- package/dist/chunks/sankeyDiagram-P5KCCOFB-CdaC8rLw.js +847 -0
- package/dist/chunks/sequenceDiagram-WJ2MYXX4-CGLi38Hj.js +2898 -0
- package/dist/chunks/sizeCapture-INFHLROL-g5RJXnik.js +47 -0
- package/dist/chunks/stateDiagram-D77RDMKH-Cou0eVl1.js +262 -0
- package/dist/chunks/stateDiagram-v2-MP3YSRHH-BHQspnUg.js +16 -0
- package/dist/chunks/swimlanes-42K2YHIH-BU7S1WgJ.js +5239 -0
- package/dist/chunks/swimlanesDiagram-VR7AAH4N-BsEplbno.js +13 -0
- package/dist/chunks/timeline-definition-24CTP7MA-BB-IyxWL.js +1066 -0
- package/dist/chunks/vennDiagram-4TSXK5OY-BToYolPI.js +1585 -0
- package/dist/chunks/wardleyDiagram-VM6X3IG4-BgoueOw_.js +684 -0
- package/dist/chunks/xychartDiagram-S5SC5T6Z-CF0fWv-W.js +1492 -0
- package/dist/components/CodeBlock.d.ts +5 -0
- package/dist/components/CommunityLinks.d.ts +21 -0
- package/dist/components/CookieConsent.d.ts +2 -0
- package/dist/components/DocLinkCard.d.ts +6 -0
- package/dist/components/LecturePageView.d.ts +3 -0
- package/dist/components/MermaidDiagram.d.ts +3 -0
- package/dist/components/SearchPopup.d.ts +6 -0
- package/dist/components/WikiApp.d.ts +9 -0
- package/dist/components/WikiLayout.d.ts +2 -0
- package/dist/components/WikiPageView.d.ts +6 -0
- package/dist/components/ZoomableImage.d.ts +2 -0
- package/dist/context/LangContext.d.ts +2 -0
- package/dist/context/WikiContext.d.ts +18 -0
- package/dist/data.d.ts +8 -0
- package/dist/hooks/useLanguage.d.ts +4 -0
- package/dist/hooks/useTheme.d.ts +5 -0
- package/dist/hooks/useWiki.d.ts +2 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.js +45 -0
- package/dist/languages/ue-cpp.d.ts +7 -0
- package/dist/languages/ue-cpp.js +21 -0
- package/dist/types.d.ts +119 -0
- package/dist/wiki-engine.css +1 -0
- package/package.json +76 -0
|
@@ -0,0 +1,530 @@
|
|
|
1
|
+
import { p as me } from "./chunk-JWPE2WC7-BIokdAUW.js";
|
|
2
|
+
import { _ as w, L as ye, E as ae, G as ee, K as Se, d as ve, l as te, bf as B, j as K, b as xe, a as be, q as we, t as Ce, g as Te, s as Le, H as $e, bg as Ae, A as Fe } from "./index-f7Uzykhj.js";
|
|
3
|
+
import { s as Ne } from "./chunk-POPQ4Y6H-CcjOsf9X.js";
|
|
4
|
+
import { p as Me } from "./cynefin-OW5HDTMX-Bzjecpt-.js";
|
|
5
|
+
import { b as O } from "./defaultLocale-BgPVtth8.js";
|
|
6
|
+
import { o as Q } from "./ordinal-DfAQgscy.js";
|
|
7
|
+
function _e(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 ke() {
|
|
14
|
+
return this.eachAfter(_e);
|
|
15
|
+
}
|
|
16
|
+
function ze(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 Ve(t, a) {
|
|
23
|
+
for (var l = this, n = [l], r, s, h = -1; l = n.pop(); )
|
|
24
|
+
if (t.call(a, l, ++h, this), r = l.children)
|
|
25
|
+
for (s = r.length - 1; s >= 0; --s)
|
|
26
|
+
n.push(r[s]);
|
|
27
|
+
return this;
|
|
28
|
+
}
|
|
29
|
+
function De(t, a) {
|
|
30
|
+
for (var l = this, n = [l], r = [], s, h, d, m = -1; l = n.pop(); )
|
|
31
|
+
if (r.push(l), s = l.children)
|
|
32
|
+
for (h = 0, d = s.length; h < d; ++h)
|
|
33
|
+
n.push(s[h]);
|
|
34
|
+
for (; l = r.pop(); )
|
|
35
|
+
t.call(a, l, ++m, this);
|
|
36
|
+
return this;
|
|
37
|
+
}
|
|
38
|
+
function Pe(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 Be(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 Ee(t) {
|
|
51
|
+
return this.eachBefore(function(a) {
|
|
52
|
+
a.children && a.children.sort(t);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
function Re(t) {
|
|
56
|
+
for (var a = this, l = We(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 We(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 He() {
|
|
70
|
+
for (var t = this, a = [t]; t = t.parent; )
|
|
71
|
+
a.push(t);
|
|
72
|
+
return a;
|
|
73
|
+
}
|
|
74
|
+
function Ie() {
|
|
75
|
+
return Array.from(this);
|
|
76
|
+
}
|
|
77
|
+
function Oe() {
|
|
78
|
+
var t = [];
|
|
79
|
+
return this.eachBefore(function(a) {
|
|
80
|
+
a.children || t.push(a);
|
|
81
|
+
}), t;
|
|
82
|
+
}
|
|
83
|
+
function Ge() {
|
|
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* qe() {
|
|
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 ne(t, a) {
|
|
99
|
+
t instanceof Map ? (t = [void 0, t], a === void 0 && (a = Ye)) : a === void 0 && (a = je);
|
|
100
|
+
for (var l = new U(t), n, r = [l], s, h, d, m; n = r.pop(); )
|
|
101
|
+
if ((h = a(n.data)) && (m = (h = Array.from(h)).length))
|
|
102
|
+
for (n.children = h, d = m - 1; d >= 0; --d)
|
|
103
|
+
r.push(s = h[d] = new U(h[d])), s.parent = n, s.depth = n.depth + 1;
|
|
104
|
+
return l.eachBefore(Ue);
|
|
105
|
+
}
|
|
106
|
+
function Xe() {
|
|
107
|
+
return ne(this).eachBefore(Ke);
|
|
108
|
+
}
|
|
109
|
+
function je(t) {
|
|
110
|
+
return t.children;
|
|
111
|
+
}
|
|
112
|
+
function Ye(t) {
|
|
113
|
+
return Array.isArray(t) ? t[1] : null;
|
|
114
|
+
}
|
|
115
|
+
function Ke(t) {
|
|
116
|
+
t.data.value !== void 0 && (t.value = t.data.value), t.data = t.data.data;
|
|
117
|
+
}
|
|
118
|
+
function Ue(t) {
|
|
119
|
+
var a = 0;
|
|
120
|
+
do
|
|
121
|
+
t.height = a;
|
|
122
|
+
while ((t = t.parent) && t.height < ++a);
|
|
123
|
+
}
|
|
124
|
+
function U(t) {
|
|
125
|
+
this.data = t, this.depth = this.height = 0, this.parent = null;
|
|
126
|
+
}
|
|
127
|
+
U.prototype = ne.prototype = {
|
|
128
|
+
constructor: U,
|
|
129
|
+
count: ke,
|
|
130
|
+
each: ze,
|
|
131
|
+
eachAfter: De,
|
|
132
|
+
eachBefore: Ve,
|
|
133
|
+
find: Pe,
|
|
134
|
+
sum: Be,
|
|
135
|
+
sort: Ee,
|
|
136
|
+
path: Re,
|
|
137
|
+
ancestors: He,
|
|
138
|
+
descendants: Ie,
|
|
139
|
+
leaves: Oe,
|
|
140
|
+
links: Ge,
|
|
141
|
+
copy: Xe,
|
|
142
|
+
[Symbol.iterator]: qe
|
|
143
|
+
};
|
|
144
|
+
function Ze(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 Je(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 Qe(t, a, l, n, r) {
|
|
160
|
+
for (var s = t.children, h, d = -1, m = s.length, c = t.value && (n - a) / t.value; ++d < m; )
|
|
161
|
+
h = s[d], h.y0 = l, h.y1 = r, h.x0 = a, h.x1 = a += h.value * c;
|
|
162
|
+
}
|
|
163
|
+
function et(t, a, l, n, r) {
|
|
164
|
+
for (var s = t.children, h, d = -1, m = s.length, c = t.value && (r - l) / t.value; ++d < m; )
|
|
165
|
+
h = s[d], h.x0 = a, h.x1 = n, h.y0 = l, h.y1 = l += h.value * c;
|
|
166
|
+
}
|
|
167
|
+
var tt = (1 + Math.sqrt(5)) / 2;
|
|
168
|
+
function at(t, a, l, n, r, s) {
|
|
169
|
+
for (var h = [], d = a.children, m, c, u = 0, b = 0, i = d.length, x, S, v = a.value, p, y, N, $, V, W, M; u < i; ) {
|
|
170
|
+
x = r - l, S = s - n;
|
|
171
|
+
do
|
|
172
|
+
p = d[b++].value;
|
|
173
|
+
while (!p && b < i);
|
|
174
|
+
for (y = N = p, W = Math.max(S / x, x / S) / (v * t), M = p * p * W, V = Math.max(N / M, M / y); b < i; ++b) {
|
|
175
|
+
if (p += c = d[b].value, c < y && (y = c), c > N && (N = c), M = p * p * W, $ = Math.max(N / M, M / y), $ > V) {
|
|
176
|
+
p -= c;
|
|
177
|
+
break;
|
|
178
|
+
}
|
|
179
|
+
V = $;
|
|
180
|
+
}
|
|
181
|
+
h.push(m = { value: p, dice: x < S, children: d.slice(u, b) }), m.dice ? Qe(m, l, n, r, v ? n += S * p / v : s) : et(m, l, n, v ? l += x * p / v : r, s), v -= p, u = b;
|
|
182
|
+
}
|
|
183
|
+
return h;
|
|
184
|
+
}
|
|
185
|
+
const nt = (function t(a) {
|
|
186
|
+
function l(n, r, s, h, d) {
|
|
187
|
+
at(a, n, r, s, h, d);
|
|
188
|
+
}
|
|
189
|
+
return l.ratio = function(n) {
|
|
190
|
+
return t((n = +n) > 1 ? n : 1);
|
|
191
|
+
}, l;
|
|
192
|
+
})(tt);
|
|
193
|
+
function lt() {
|
|
194
|
+
var t = nt, a = !1, l = 1, n = 1, r = [0], s = G, h = G, d = G, m = 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(Je), i;
|
|
197
|
+
}
|
|
198
|
+
function b(i) {
|
|
199
|
+
var x = r[i.depth], S = i.x0 + x, v = i.y0 + x, p = i.x1 - x, y = i.y1 - x;
|
|
200
|
+
p < S && (S = p = (S + p) / 2), y < v && (v = y = (v + y) / 2), i.x0 = S, i.y0 = v, i.x1 = p, i.y1 = y, i.children && (x = r[i.depth + 1] = s(i) / 2, S += c(i) - x, v += h(i) - x, p -= d(i) - x, y -= m(i) - x, p < S && (S = p = (S + p) / 2), y < v && (v = y = (v + y) / 2), t(i, S, v, p, y));
|
|
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 = Ze(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 ? (h = typeof i == "function" ? i : q(+i), u) : h;
|
|
216
|
+
}, u.paddingRight = function(i) {
|
|
217
|
+
return arguments.length ? (d = typeof i == "function" ? i : q(+i), u) : d;
|
|
218
|
+
}, u.paddingBottom = function(i) {
|
|
219
|
+
return arguments.length ? (m = typeof i == "function" ? i : q(+i), u) : m;
|
|
220
|
+
}, u.paddingLeft = function(i) {
|
|
221
|
+
return arguments.length ? (c = typeof i == "function" ? i : q(+i), u) : c;
|
|
222
|
+
}, u;
|
|
223
|
+
}
|
|
224
|
+
var R, oe = (R = class {
|
|
225
|
+
constructor() {
|
|
226
|
+
this.nodes = [], this.levels = /* @__PURE__ */ new Map(), this.outerNodes = [], this.classes = /* @__PURE__ */ new Map(), this.setAccTitle = xe, this.getAccTitle = be, this.setDiagramTitle = we, this.getDiagramTitle = Ce, this.getAccDescription = Te, this.setAccDescription = Le;
|
|
227
|
+
}
|
|
228
|
+
getNodes() {
|
|
229
|
+
return this.nodes;
|
|
230
|
+
}
|
|
231
|
+
getConfig() {
|
|
232
|
+
const a = $e, l = ae();
|
|
233
|
+
return ee({
|
|
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
|
+
Ae(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
|
+
Fe(), this.nodes = [], this.levels = /* @__PURE__ */ new Map(), this.outerNodes = [], this.classes = /* @__PURE__ */ new Map(), this.root = void 0;
|
|
259
|
+
}
|
|
260
|
+
}, w(R, "TreeMapDB"), R);
|
|
261
|
+
function ce(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(ce, "buildHierarchy");
|
|
282
|
+
var rt = /* @__PURE__ */ w((t, a) => {
|
|
283
|
+
me(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 h = s.item;
|
|
289
|
+
if (!h)
|
|
290
|
+
continue;
|
|
291
|
+
const d = s.indent ? parseInt(s.indent) : 0, m = st(h), c = h.classSelector ? a.getStylesForClass(h.classSelector) : [], u = c.length > 0 ? c : void 0, b = {
|
|
292
|
+
level: d,
|
|
293
|
+
name: m,
|
|
294
|
+
type: h.$type,
|
|
295
|
+
value: h.value,
|
|
296
|
+
classSelector: h.classSelector,
|
|
297
|
+
cssCompiledStyles: u
|
|
298
|
+
};
|
|
299
|
+
l.push(b);
|
|
300
|
+
}
|
|
301
|
+
const n = ce(l), r = /* @__PURE__ */ w((s, h) => {
|
|
302
|
+
for (const d of s)
|
|
303
|
+
a.addNode(d, h), d.children && d.children.length > 0 && r(d.children, h + 1);
|
|
304
|
+
}, "addNodesRecursively");
|
|
305
|
+
r(n, 0);
|
|
306
|
+
}, "populate"), st = /* @__PURE__ */ w((t) => t.name ? String(t.name) : "", "getItemName"), he = {
|
|
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 Me("treemap", t);
|
|
313
|
+
te.debug("Treemap AST:", n);
|
|
314
|
+
const r = (a = he.parser) == null ? void 0 : a.yy;
|
|
315
|
+
if (!(r instanceof oe))
|
|
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
|
+
rt(n, r);
|
|
320
|
+
} catch (l) {
|
|
321
|
+
throw te.error("Error parsing treemap:", l), l;
|
|
322
|
+
}
|
|
323
|
+
}, "parse")
|
|
324
|
+
}, it = 10, E = 10, X = 25, ot = /* @__PURE__ */ w((t, a, l, n) => {
|
|
325
|
+
const r = n.db, s = r.getConfig(), h = s.padding ?? it, d = r.getDiagramTitle(), m = r.getRoot(), { themeVariables: c } = ae();
|
|
326
|
+
if (!m)
|
|
327
|
+
return;
|
|
328
|
+
const u = d ? 30 : 0, b = Se(a), i = s.nodeWidth ? s.nodeWidth * E : 960, x = s.nodeHeight ? s.nodeHeight * E : 500, S = i, v = x + u;
|
|
329
|
+
b.attr("viewBox", `0 0 ${S} ${v}`), ve(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
|
+
te.error("Error creating format function:", e), p = O(",");
|
|
345
|
+
}
|
|
346
|
+
const y = Q().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
|
+
]), N = Q().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
|
+
]), $ = Q().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
|
+
d && b.append("text").attr("x", S / 2).attr("y", u / 2).attr("class", "treemapTitle").attr("text-anchor", "middle").attr("dominant-baseline", "middle").text(d);
|
|
389
|
+
const V = b.append("g").attr("transform", `translate(0, ${u})`).attr("class", "treemapContainer"), W = ne(m).sum((e) => e.value ?? 0).sort((e, o) => (o.value ?? 0) - (e.value ?? 0)), le = lt().size([i, x]).paddingTop(
|
|
390
|
+
(e) => e.children && e.children.length > 0 ? X + E : 0
|
|
391
|
+
).paddingInner(h).paddingLeft((e) => e.children && e.children.length > 0 ? E : 0).paddingRight((e) => e.children && e.children.length > 0 ? E : 0).paddingBottom((e) => e.children && e.children.length > 0 ? E : 0).round(!0)(W), de = le.descendants().filter((e) => e.children && e.children.length > 0), H = V.selectAll(".treemapSection").data(de).enter().append("g").attr("class", "treemapSection").attr("transform", (e) => `translate(${e.x0},${e.y0})`);
|
|
392
|
+
H.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;" : ""), H.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), H.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", 0.6).attr("stroke", (e) => N(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
|
+
}), H.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("clip-path", (e, o) => `url(#clip-section-${a}-${o})`).attr("style", (e) => {
|
|
398
|
+
if (e.depth === 0)
|
|
399
|
+
return "display: none;";
|
|
400
|
+
const o = "dominant-baseline: middle; font-size: 12px; fill:" + $(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 = K(this), f = e.data.name;
|
|
406
|
+
o.text(f);
|
|
407
|
+
const C = e.x1 - e.x0, L = 6;
|
|
408
|
+
let T;
|
|
409
|
+
s.showValues !== !1 && e.value ? T = C - 10 - 30 - 10 - L : T = C - L - 6;
|
|
410
|
+
const g = Math.max(15, T), _ = o.node();
|
|
411
|
+
if (_.getComputedTextLength() > g) {
|
|
412
|
+
let z = f;
|
|
413
|
+
for (; z.length > 0; ) {
|
|
414
|
+
if (z = f.substring(0, z.length - 1), z.length === 0) {
|
|
415
|
+
o.text("..."), _.getComputedTextLength() > g && o.text("");
|
|
416
|
+
break;
|
|
417
|
+
}
|
|
418
|
+
if (o.text(z + "..."), _.getComputedTextLength() <= g)
|
|
419
|
+
break;
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
}), s.showValues !== !1 && H.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) => {
|
|
423
|
+
if (e.depth === 0)
|
|
424
|
+
return "display: none;";
|
|
425
|
+
const o = "text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:" + $(e.data.name) + "; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;", f = B({ cssCompiledStyles: e.data.cssCompiledStyles });
|
|
426
|
+
return o + f.labelStyles.replace("color:", "fill:");
|
|
427
|
+
});
|
|
428
|
+
const re = le.leaves(), A = re.length > 20, ue = A ? 16 : 38, j = A ? 14 : 28, D = A ? 4 : 8, I = A ? 4 : 6, Z = A ? 2 : 4, se = A ? 8 : 10, J = A ? 1 : 2, Y = V.selectAll(".treemapLeafGroup").data(re).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})`);
|
|
429
|
+
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 ? y(e.parent.data.name) : y(e.data.name)).attr("style", (e) => B({ cssCompiledStyles: e.data.cssCompiledStyles }).nodeStyles).attr("fill-opacity", 0.3).attr("stroke", (e) => e.parent ? y(e.parent.data.name) : y(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) => {
|
|
430
|
+
const o = `text-anchor: middle; dominant-baseline: middle; font-size: ${ue}px;fill:` + $(e.data.name) + ";", f = B({ cssCompiledStyles: e.data.cssCompiledStyles });
|
|
431
|
+
return o + f.labelStyles.replace("color:", "fill:");
|
|
432
|
+
}).attr("clip-path", (e, o) => `url(#clip-${a}-${o})`).text((e) => e.data.name).each(function(e) {
|
|
433
|
+
const o = K(this), f = e.x1 - e.x0, C = e.y1 - e.y0, L = o.node(), T = f - 2 * Z, P = C - 2 * Z;
|
|
434
|
+
if (T < se || P < se) {
|
|
435
|
+
o.style("display", "none");
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
438
|
+
let g = parseInt(o.style("font-size"), 10);
|
|
439
|
+
const _ = 0.6;
|
|
440
|
+
for (; L.getComputedTextLength() > T && g > D; )
|
|
441
|
+
g--, o.style("font-size", `${g}px`);
|
|
442
|
+
let F = Math.max(
|
|
443
|
+
I,
|
|
444
|
+
Math.min(j, Math.round(g * _))
|
|
445
|
+
), k = g + J + F;
|
|
446
|
+
for (; k > P && g > D && (g--, F = Math.max(
|
|
447
|
+
I,
|
|
448
|
+
Math.min(j, Math.round(g * _))
|
|
449
|
+
), !(F < I && g === D)); )
|
|
450
|
+
o.style("font-size", `${g}px`), k = g + J + F;
|
|
451
|
+
o.style("font-size", `${g}px`), A ? (g < D || P < D) && o.style("display", "none") : (L.getComputedTextLength() > T || g < D || P < g) && o.style("display", "none");
|
|
452
|
+
}), s.showValues !== !1 && Y.append("text").attr("class", "treemapValue").attr("x", (o) => (o.x1 - o.x0) / 2).attr("y", function(o) {
|
|
453
|
+
return (o.y1 - o.y0) / 2;
|
|
454
|
+
}).attr("style", (o) => {
|
|
455
|
+
const f = `text-anchor: middle; dominant-baseline: hanging; font-size: ${j}px;fill:` + $(o.data.name) + ";", C = B({ cssCompiledStyles: o.data.cssCompiledStyles });
|
|
456
|
+
return f + C.labelStyles.replace("color:", "fill:");
|
|
457
|
+
}).attr("clip-path", (o, f) => `url(#clip-${a}-${f})`).text((o) => o.value ? p(o.value) : "").each(function(o) {
|
|
458
|
+
const f = K(this), C = this.parentNode;
|
|
459
|
+
if (!C) {
|
|
460
|
+
f.style("display", "none");
|
|
461
|
+
return;
|
|
462
|
+
}
|
|
463
|
+
const L = K(C).select(".treemapLabel");
|
|
464
|
+
if (L.empty() || L.style("display") === "none") {
|
|
465
|
+
f.style("display", "none");
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
468
|
+
const T = parseFloat(L.style("font-size")), g = Math.max(
|
|
469
|
+
I,
|
|
470
|
+
Math.min(j, Math.round(T * 0.6))
|
|
471
|
+
);
|
|
472
|
+
f.style("font-size", `${g}px`);
|
|
473
|
+
const F = (o.y1 - o.y0) / 2 + T / 2 + J;
|
|
474
|
+
f.attr("y", F);
|
|
475
|
+
const k = o.x1 - o.x0, ie = o.y1 - o.y0 - 4, ge = k - 2 * Z;
|
|
476
|
+
f.node().getComputedTextLength() > ge || F + g > ie || g < I ? f.style("display", "none") : f.style("display", null);
|
|
477
|
+
});
|
|
478
|
+
const pe = s.diagramPadding ?? 8;
|
|
479
|
+
Ne(b, pe, "flowchart", (s == null ? void 0 : s.useMaxWidth) || !1);
|
|
480
|
+
}, "draw"), ct = /* @__PURE__ */ w(function(t, a) {
|
|
481
|
+
return a.db.getClasses();
|
|
482
|
+
}, "getClasses"), ht = { draw: ot, getClasses: ct }, dt = {
|
|
483
|
+
sectionStrokeColor: "black",
|
|
484
|
+
sectionStrokeWidth: "1",
|
|
485
|
+
sectionFillColor: "#efefef",
|
|
486
|
+
leafStrokeColor: "black",
|
|
487
|
+
leafStrokeWidth: "1",
|
|
488
|
+
leafFillColor: "#efefef",
|
|
489
|
+
labelFontSize: "12px",
|
|
490
|
+
valueFontSize: "10px",
|
|
491
|
+
titleFontSize: "14px"
|
|
492
|
+
}, ut = /* @__PURE__ */ w(({
|
|
493
|
+
treemap: t
|
|
494
|
+
} = {}) => {
|
|
495
|
+
const a = ye(), l = ae(), n = ee(a, l.themeVariables), r = ee(dt, t), s = r.titleColor ?? n.titleColor, h = r.labelColor ?? n.textColor, d = r.valueColor ?? n.textColor;
|
|
496
|
+
return `
|
|
497
|
+
.treemapNode.section {
|
|
498
|
+
stroke: ${r.sectionStrokeColor};
|
|
499
|
+
stroke-width: ${r.sectionStrokeWidth};
|
|
500
|
+
fill: ${r.sectionFillColor};
|
|
501
|
+
}
|
|
502
|
+
.treemapNode.leaf {
|
|
503
|
+
stroke: ${r.leafStrokeColor};
|
|
504
|
+
stroke-width: ${r.leafStrokeWidth};
|
|
505
|
+
fill: ${r.leafFillColor};
|
|
506
|
+
}
|
|
507
|
+
.treemapLabel {
|
|
508
|
+
fill: ${h};
|
|
509
|
+
font-size: ${r.labelFontSize};
|
|
510
|
+
}
|
|
511
|
+
.treemapValue {
|
|
512
|
+
fill: ${d};
|
|
513
|
+
font-size: ${r.valueFontSize};
|
|
514
|
+
}
|
|
515
|
+
.treemapTitle {
|
|
516
|
+
fill: ${s};
|
|
517
|
+
font-size: ${r.titleFontSize};
|
|
518
|
+
}
|
|
519
|
+
`;
|
|
520
|
+
}, "getStyles"), pt = ut, bt = {
|
|
521
|
+
parser: he,
|
|
522
|
+
get db() {
|
|
523
|
+
return new oe();
|
|
524
|
+
},
|
|
525
|
+
renderer: ht,
|
|
526
|
+
styles: pt
|
|
527
|
+
};
|
|
528
|
+
export {
|
|
529
|
+
bt as diagram
|
|
530
|
+
};
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { p as B } from "./chunk-JWPE2WC7-BIokdAUW.js";
|
|
2
|
+
import { _ as b, G as m, K as C, d as S, l as w, b as D, a as T, q as E, t as P, g as z, s as A, E as F, H as W, A as _ } from "./index-f7Uzykhj.js";
|
|
3
|
+
import { p as N } from "./cynefin-OW5HDTMX-Bzjecpt-.js";
|
|
4
|
+
var L = W.packet, u, v = (u = class {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.packet = [], this.setAccTitle = D, this.getAccTitle = T, this.setDiagramTitle = E, this.getDiagramTitle = P, this.getAccDescription = z, this.setAccDescription = A;
|
|
7
|
+
}
|
|
8
|
+
getConfig() {
|
|
9
|
+
const t = m({
|
|
10
|
+
...L,
|
|
11
|
+
...F().packet
|
|
12
|
+
});
|
|
13
|
+
return t.showBits && (t.paddingY += 10), t;
|
|
14
|
+
}
|
|
15
|
+
getPacket() {
|
|
16
|
+
return this.packet;
|
|
17
|
+
}
|
|
18
|
+
pushWord(t) {
|
|
19
|
+
t.length > 0 && this.packet.push(t);
|
|
20
|
+
}
|
|
21
|
+
clear() {
|
|
22
|
+
_(), this.packet = [];
|
|
23
|
+
}
|
|
24
|
+
}, b(u, "PacketDB"), u), M = 1e4, Y = /* @__PURE__ */ b((e, t) => {
|
|
25
|
+
B(e, t);
|
|
26
|
+
let s = -1, r = [], n = 1;
|
|
27
|
+
const { bitsPerRow: l } = t.getConfig();
|
|
28
|
+
for (let { start: a, end: i, bits: d, label: c } of e.blocks) {
|
|
29
|
+
if (a !== void 0 && i !== void 0 && i < a)
|
|
30
|
+
throw new Error(`Packet block ${a} - ${i} is invalid. End must be greater than start.`);
|
|
31
|
+
if (a ?? (a = s + 1), a !== s + 1)
|
|
32
|
+
throw new Error(
|
|
33
|
+
`Packet block ${a} - ${i ?? a} is not contiguous. It should start from ${s + 1}.`
|
|
34
|
+
);
|
|
35
|
+
if (d === 0)
|
|
36
|
+
throw new Error(`Packet block ${a} is invalid. Cannot have a zero bit field.`);
|
|
37
|
+
for (i ?? (i = a + (d ?? 1) - 1), d ?? (d = i - a + 1), s = i, w.debug(`Packet block ${a} - ${s} with label ${c}`); r.length <= l + 1 && t.getPacket().length < M; ) {
|
|
38
|
+
const [p, o] = G({ start: a, end: i, bits: d, label: c }, n, l);
|
|
39
|
+
if (r.push(p), p.end + 1 === n * l && (t.pushWord(r), r = [], n++), !o)
|
|
40
|
+
break;
|
|
41
|
+
({ start: a, end: i, bits: d, label: c } = o);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
t.pushWord(r);
|
|
45
|
+
}, "populate"), G = /* @__PURE__ */ b((e, t, s) => {
|
|
46
|
+
if (e.start === void 0)
|
|
47
|
+
throw new Error("start should have been set during first phase");
|
|
48
|
+
if (e.end === void 0)
|
|
49
|
+
throw new Error("end should have been set during first phase");
|
|
50
|
+
if (e.start > e.end)
|
|
51
|
+
throw new Error(`Block start ${e.start} is greater than block end ${e.end}.`);
|
|
52
|
+
if (e.end + 1 <= t * s)
|
|
53
|
+
return [e, void 0];
|
|
54
|
+
const r = t * s - 1, n = t * s;
|
|
55
|
+
return [
|
|
56
|
+
{
|
|
57
|
+
start: e.start,
|
|
58
|
+
end: r,
|
|
59
|
+
label: e.label,
|
|
60
|
+
bits: r - e.start
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
start: n,
|
|
64
|
+
end: e.end,
|
|
65
|
+
label: e.label,
|
|
66
|
+
bits: e.end - n
|
|
67
|
+
}
|
|
68
|
+
];
|
|
69
|
+
}, "getNextFittingBlock"), x = {
|
|
70
|
+
// @ts-expect-error - PacketDB is not assignable to DiagramDB
|
|
71
|
+
parser: { yy: void 0 },
|
|
72
|
+
parse: /* @__PURE__ */ b(async (e) => {
|
|
73
|
+
var r;
|
|
74
|
+
const t = await N("packet", e), s = (r = x.parser) == null ? void 0 : r.yy;
|
|
75
|
+
if (!(s instanceof v))
|
|
76
|
+
throw new Error(
|
|
77
|
+
"parser.parser?.yy was not a PacketDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues."
|
|
78
|
+
);
|
|
79
|
+
w.debug(t), Y(t, s);
|
|
80
|
+
}, "parse")
|
|
81
|
+
}, H = /* @__PURE__ */ b((e, t, s, r) => {
|
|
82
|
+
const n = r.db, l = n.getConfig(), { rowHeight: a, paddingY: i, bitWidth: d, bitsPerRow: c } = l, p = n.getPacket(), o = n.getDiagramTitle(), h = a + i, g = h * (p.length + 1) - (o ? 0 : a), k = d * c + 2, f = C(t);
|
|
83
|
+
f.attr("viewBox", `0 0 ${k} ${g}`), S(f, g, k, l.useMaxWidth);
|
|
84
|
+
for (const [y, $] of p.entries())
|
|
85
|
+
I(f, $, y, l);
|
|
86
|
+
f.append("text").text(o).attr("x", k / 2).attr("y", g - h / 2).attr("dominant-baseline", "middle").attr("text-anchor", "middle").attr("class", "packetTitle");
|
|
87
|
+
}, "draw"), I = /* @__PURE__ */ b((e, t, s, { rowHeight: r, paddingX: n, paddingY: l, bitWidth: a, bitsPerRow: i, showBits: d }) => {
|
|
88
|
+
const c = e.append("g"), p = s * (r + l) + l;
|
|
89
|
+
for (const o of t) {
|
|
90
|
+
const h = o.start % i * a + 1, g = (o.end - o.start + 1) * a - n;
|
|
91
|
+
if (c.append("rect").attr("x", h).attr("y", p).attr("width", g).attr("height", r).attr("class", "packetBlock"), c.append("text").attr("x", h + g / 2).attr("y", p + r / 2).attr("class", "packetLabel").attr("dominant-baseline", "middle").attr("text-anchor", "middle").text(o.label), !d)
|
|
92
|
+
continue;
|
|
93
|
+
const k = o.end === o.start, f = p - 2;
|
|
94
|
+
c.append("text").attr("x", h + (k ? g / 2 : 0)).attr("y", f).attr("class", "packetByte start").attr("dominant-baseline", "auto").attr("text-anchor", k ? "middle" : "start").text(o.start), k || c.append("text").attr("x", h + g).attr("y", f).attr("class", "packetByte end").attr("dominant-baseline", "auto").attr("text-anchor", "end").text(o.end);
|
|
95
|
+
}
|
|
96
|
+
}, "drawWord"), K = { draw: H }, O = {
|
|
97
|
+
byteFontSize: "10px",
|
|
98
|
+
startByteColor: "black",
|
|
99
|
+
endByteColor: "black",
|
|
100
|
+
labelColor: "black",
|
|
101
|
+
labelFontSize: "12px",
|
|
102
|
+
titleColor: "black",
|
|
103
|
+
titleFontSize: "14px",
|
|
104
|
+
blockStrokeColor: "black",
|
|
105
|
+
blockStrokeWidth: "1",
|
|
106
|
+
blockFillColor: "#efefef"
|
|
107
|
+
}, j = /* @__PURE__ */ b(({ packet: e } = {}) => {
|
|
108
|
+
const t = m(O, e);
|
|
109
|
+
return `
|
|
110
|
+
.packetByte {
|
|
111
|
+
font-size: ${t.byteFontSize};
|
|
112
|
+
}
|
|
113
|
+
.packetByte.start {
|
|
114
|
+
fill: ${t.startByteColor};
|
|
115
|
+
}
|
|
116
|
+
.packetByte.end {
|
|
117
|
+
fill: ${t.endByteColor};
|
|
118
|
+
}
|
|
119
|
+
.packetLabel {
|
|
120
|
+
fill: ${t.labelColor};
|
|
121
|
+
font-size: ${t.labelFontSize};
|
|
122
|
+
}
|
|
123
|
+
.packetTitle {
|
|
124
|
+
fill: ${t.titleColor};
|
|
125
|
+
font-size: ${t.titleFontSize};
|
|
126
|
+
}
|
|
127
|
+
.packetBlock {
|
|
128
|
+
stroke: ${t.blockStrokeColor};
|
|
129
|
+
stroke-width: ${t.blockStrokeWidth};
|
|
130
|
+
fill: ${t.blockFillColor};
|
|
131
|
+
}
|
|
132
|
+
`;
|
|
133
|
+
}, "styles"), X = {
|
|
134
|
+
parser: x,
|
|
135
|
+
get db() {
|
|
136
|
+
return new v();
|
|
137
|
+
},
|
|
138
|
+
renderer: K,
|
|
139
|
+
styles: j
|
|
140
|
+
};
|
|
141
|
+
export {
|
|
142
|
+
X as diagram
|
|
143
|
+
};
|