bg-editor 0.0.1

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.
Files changed (67) hide show
  1. package/LICENSE +8 -0
  2. package/README.md +51 -0
  3. package/README.zh-CN.md +51 -0
  4. package/dist/_basePickBy-4kmg42pS.js +158 -0
  5. package/dist/_baseUniq-WOvvCHTI.js +621 -0
  6. package/dist/arc-wItjmL5I.js +90 -0
  7. package/dist/architecture-U656AL7Q-FYDwFSxk.js +12 -0
  8. package/dist/architectureDiagram-VXUJARFQ-iG5MkBjx.js +4666 -0
  9. package/dist/blockDiagram-VD42YOAC-i2GlXmWy.js +2268 -0
  10. package/dist/c4Diagram-YG6GDRKO-IufO7T1R.js +1587 -0
  11. package/dist/channel-Dah4F59k.js +12 -0
  12. package/dist/chunk-4BX2VUAB-5_v9rnje.js +15 -0
  13. package/dist/chunk-55IACEB6-BDNtSypP.js +15 -0
  14. package/dist/chunk-B4BG7PRW-DzaYPsfW.js +1382 -0
  15. package/dist/chunk-DI55MBZ5-Buwrprkw.js +1377 -0
  16. package/dist/chunk-FMBD7UC4-BaEPEIWb.js +26 -0
  17. package/dist/chunk-QN33PNHL-DhbA7i5G.js +26 -0
  18. package/dist/chunk-QZHKN3VN-BAb_D1oz.js +22 -0
  19. package/dist/chunk-TZMSLE5B-OU1MJ2do.js +71 -0
  20. package/dist/classDiagram-2ON5EDUG-KStC8v09.js +23 -0
  21. package/dist/classDiagram-v2-WZHVMYZB-KStC8v09.js +23 -0
  22. package/dist/clone-C74UiRbr.js +15 -0
  23. package/dist/cose-bilkent-S5V4N54A-eRXCoix2.js +2612 -0
  24. package/dist/cytoscape.esm-BG3R4uVs.js +18738 -0
  25. package/dist/dagre-6UL2VRFP-Bi83jPQf.js +451 -0
  26. package/dist/defaultLocale-DgmhL6Re.js +178 -0
  27. package/dist/diagram-PSM6KHXK-aW98k2-4.js +539 -0
  28. package/dist/diagram-QEK2KX5R-BR--iNM5.js +224 -0
  29. package/dist/diagram-S2PKOQOG-NTnEy5_O.js +149 -0
  30. package/dist/erDiagram-Q2GNP2WA-C8oZ5c-S.js +848 -0
  31. package/dist/flowDiagram-NV44I4VS-DiKad3Bb.js +1627 -0
  32. package/dist/ganttDiagram-LVOFAZNH-CthzjjJq.js +2506 -0
  33. package/dist/gitGraph-F6HP7TQM-CuXAC0XT.js +12 -0
  34. package/dist/gitGraphDiagram-NY62KEGX-d4KszKqi.js +706 -0
  35. package/dist/graph-CnOTx4E0.js +254 -0
  36. package/dist/index-D6-Wf75-.js +122127 -0
  37. package/dist/info-NVLQJR56-Dhmtdc7O.js +12 -0
  38. package/dist/infoDiagram-ER5ION4S-DedidjTu.js +31 -0
  39. package/dist/init-d639unba.js +23 -0
  40. package/dist/journeyDiagram-XKPGCS4Q-BylvmUWL.js +843 -0
  41. package/dist/kanban-definition-3W4ZIXB7-DGV_aVgU.js +725 -0
  42. package/dist/layout-OXk4OSoz.js +1342 -0
  43. package/dist/linear-CO_vz87n.js +266 -0
  44. package/dist/mermaid-parser.core-CYtF6phW.js +12928 -0
  45. package/dist/mindmap-definition-VGOIOE7T-BU05Y6Vz.js +790 -0
  46. package/dist/ordinal-CofNqUw2.js +68 -0
  47. package/dist/packet-BFZMPI3H-D7H_8Q-U.js +12 -0
  48. package/dist/pie-7BOR55EZ-BNWNcO5Z.js +12 -0
  49. package/dist/pieDiagram-ADFJNKIX-reGTUsiW.js +168 -0
  50. package/dist/quadrantDiagram-AYHSOK5B-NeHOJ0lX.js +1029 -0
  51. package/dist/radar-NHE76QYJ-DrVEcvh1.js +12 -0
  52. package/dist/requirementDiagram-UZGBJVZJ-BE76XNaT.js +857 -0
  53. package/dist/sankeyDiagram-TZEHDZUN-UHfMLEKl.js +817 -0
  54. package/dist/sequenceDiagram-WL72ISMW-62KWnVbh.js +2518 -0
  55. package/dist/stateDiagram-FKZM4ZOC--_CkWvu6.js +270 -0
  56. package/dist/stateDiagram-v2-4FDKWEC3-Dj7ZjAmI.js +23 -0
  57. package/dist/style.css +1 -0
  58. package/dist/timeline-definition-IT6M3QCI-C3Wb0xMN.js +804 -0
  59. package/dist/treemap-KMMF4GRG-Bc8F2dFd.js +12 -0
  60. package/dist/umo-editor.js +16 -0
  61. package/dist/xychartDiagram-PRI3JC2R-D2J307cO.js +1347 -0
  62. package/package.json +200 -0
  63. package/types/index.d.ts +277 -0
  64. package/types/src/components/index.d.ts +9 -0
  65. package/types/src/components/menus/button.vue.d.ts +583 -0
  66. package/types/src/components/modal.vue.d.ts +2 -0
  67. package/types/src/components/tooltip.vue.d.ts +27 -0
@@ -0,0 +1,539 @@
1
+ import "./style.css";
2
+ import { _ as w, D as te, E as ae, H as he, e as ue, l as K, a$ as P, d as Y, b as pe, a as fe, p as ge, q as me, g as ye, s as Se, F as ve, b0 as xe, y as be } from "./index-D6-Wf75-.js";
3
+ import { s as we } from "./chunk-QN33PNHL-DhbA7i5G.js";
4
+ import { p as Ce } from "./chunk-4BX2VUAB-5_v9rnje.js";
5
+ import { p as Te } from "./mermaid-parser.core-CYtF6phW.js";
6
+ import { b as O } from "./defaultLocale-DgmhL6Re.js";
7
+ import { o as J } from "./ordinal-CofNqUw2.js";
8
+ /**
9
+ * @umoteam/editor 9.0.1
10
+ * @license MIT
11
+ * @author umodoc https://www.umodoc.com
12
+ * @see https://www.umodoc.com
13
+ **/
14
+ function Le(t) {
15
+ var a = 0, l = t.children, n = l && l.length;
16
+ if (!n) a = 1;
17
+ else for (; --n >= 0; ) a += l[n].value;
18
+ t.value = a;
19
+ }
20
+ function $e() {
21
+ return this.eachAfter(Le);
22
+ }
23
+ function Ae(t, a) {
24
+ let l = -1;
25
+ for (const n of this)
26
+ t.call(a, n, ++l, this);
27
+ return this;
28
+ }
29
+ function Fe(t, a) {
30
+ for (var l = this, n = [l], o, s, d = -1; l = n.pop(); )
31
+ if (t.call(a, l, ++d, this), o = l.children)
32
+ for (s = o.length - 1; s >= 0; --s)
33
+ n.push(o[s]);
34
+ return this;
35
+ }
36
+ function ke(t, a) {
37
+ for (var l = this, n = [l], o = [], s, d, h, g = -1; l = n.pop(); )
38
+ if (o.push(l), s = l.children)
39
+ for (d = 0, h = s.length; d < h; ++d)
40
+ n.push(s[d]);
41
+ for (; l = o.pop(); )
42
+ t.call(a, l, ++g, this);
43
+ return this;
44
+ }
45
+ function Ne(t, a) {
46
+ let l = -1;
47
+ for (const n of this)
48
+ if (t.call(a, n, ++l, this))
49
+ return n;
50
+ }
51
+ function Me(t) {
52
+ return this.eachAfter(function(a) {
53
+ for (var l = +t(a.data) || 0, n = a.children, o = n && n.length; --o >= 0; ) l += n[o].value;
54
+ a.value = l;
55
+ });
56
+ }
57
+ function _e(t) {
58
+ return this.eachBefore(function(a) {
59
+ a.children && a.children.sort(t);
60
+ });
61
+ }
62
+ function ze(t) {
63
+ for (var a = this, l = Ve(a, t), n = [a]; a !== l; )
64
+ a = a.parent, n.push(a);
65
+ for (var o = n.length; t !== l; )
66
+ n.splice(o, 0, t), t = t.parent;
67
+ return n;
68
+ }
69
+ function Ve(t, a) {
70
+ if (t === a) return t;
71
+ var l = t.ancestors(), n = a.ancestors(), o = null;
72
+ for (t = l.pop(), a = n.pop(); t === a; )
73
+ o = t, t = l.pop(), a = n.pop();
74
+ return o;
75
+ }
76
+ function De() {
77
+ for (var t = this, a = [t]; t = t.parent; )
78
+ a.push(t);
79
+ return a;
80
+ }
81
+ function Pe() {
82
+ return Array.from(this);
83
+ }
84
+ function Be() {
85
+ var t = [];
86
+ return this.eachBefore(function(a) {
87
+ a.children || t.push(a);
88
+ }), t;
89
+ }
90
+ function Ee() {
91
+ var t = this, a = [];
92
+ return t.each(function(l) {
93
+ l !== t && a.push({ source: l.parent, target: l });
94
+ }), a;
95
+ }
96
+ function* Re() {
97
+ var t = this, a, l = [t], n, o, s;
98
+ do
99
+ for (a = l.reverse(), l = []; t = a.pop(); )
100
+ if (yield t, n = t.children)
101
+ for (o = 0, s = n.length; o < s; ++o)
102
+ l.push(n[o]);
103
+ while (l.length);
104
+ }
105
+ function Q(t, a) {
106
+ t instanceof Map ? (t = [void 0, t], a === void 0 && (a = Ie)) : a === void 0 && (a = He);
107
+ for (var l = new U(t), n, o = [l], s, d, h, g; n = o.pop(); )
108
+ if ((d = a(n.data)) && (g = (d = Array.from(d)).length))
109
+ for (n.children = d, h = g - 1; h >= 0; --h)
110
+ o.push(s = d[h] = new U(d[h])), s.parent = n, s.depth = n.depth + 1;
111
+ return l.eachBefore(qe);
112
+ }
113
+ function We() {
114
+ return Q(this).eachBefore(Oe);
115
+ }
116
+ function He(t) {
117
+ return t.children;
118
+ }
119
+ function Ie(t) {
120
+ return Array.isArray(t) ? t[1] : null;
121
+ }
122
+ function Oe(t) {
123
+ t.data.value !== void 0 && (t.value = t.data.value), t.data = t.data.data;
124
+ }
125
+ function qe(t) {
126
+ var a = 0;
127
+ do
128
+ t.height = a;
129
+ while ((t = t.parent) && t.height < ++a);
130
+ }
131
+ function U(t) {
132
+ this.data = t, this.depth = this.height = 0, this.parent = null;
133
+ }
134
+ U.prototype = Q.prototype = {
135
+ constructor: U,
136
+ count: $e,
137
+ each: Ae,
138
+ eachAfter: ke,
139
+ eachBefore: Fe,
140
+ find: Ne,
141
+ sum: Me,
142
+ sort: _e,
143
+ path: ze,
144
+ ancestors: De,
145
+ descendants: Pe,
146
+ leaves: Be,
147
+ links: Ee,
148
+ copy: We,
149
+ [Symbol.iterator]: Re
150
+ };
151
+ function Ge(t) {
152
+ if (typeof t != "function") throw new Error();
153
+ return t;
154
+ }
155
+ function q() {
156
+ return 0;
157
+ }
158
+ function G(t) {
159
+ return function() {
160
+ return t;
161
+ };
162
+ }
163
+ function Xe(t) {
164
+ t.x0 = Math.round(t.x0), t.y0 = Math.round(t.y0), t.x1 = Math.round(t.x1), t.y1 = Math.round(t.y1);
165
+ }
166
+ function je(t, a, l, n, o) {
167
+ for (var s = t.children, d, h = -1, g = s.length, c = t.value && (n - a) / t.value; ++h < g; )
168
+ d = s[h], d.y0 = l, d.y1 = o, d.x0 = a, d.x1 = a += d.value * c;
169
+ }
170
+ function Ye(t, a, l, n, o) {
171
+ for (var s = t.children, d, h = -1, g = s.length, c = t.value && (o - l) / t.value; ++h < g; )
172
+ d = s[h], d.x0 = a, d.x1 = n, d.y0 = l, d.y1 = l += d.value * c;
173
+ }
174
+ var Ue = (1 + Math.sqrt(5)) / 2;
175
+ function Ze(t, a, l, n, o, s) {
176
+ for (var d = [], h = a.children, g, c, u = 0, b = 0, r = h.length, x, S, v = a.value, p, m, N, k, V, R, M; u < r; ) {
177
+ x = o - l, S = s - n;
178
+ do
179
+ p = h[b++].value;
180
+ while (!p && b < r);
181
+ for (m = N = p, R = Math.max(S / x, x / S) / (v * t), M = p * p * R, V = Math.max(N / M, M / m); b < r; ++b) {
182
+ if (p += c = h[b].value, c < m && (m = c), c > N && (N = c), M = p * p * R, k = Math.max(N / M, M / m), k > V) {
183
+ p -= c;
184
+ break;
185
+ }
186
+ V = k;
187
+ }
188
+ d.push(g = { value: p, dice: x < S, children: h.slice(u, b) }), g.dice ? je(g, l, n, o, v ? n += S * p / v : s) : Ye(g, l, n, v ? l += x * p / v : o, s), v -= p, u = b;
189
+ }
190
+ return d;
191
+ }
192
+ const Je = function t(a) {
193
+ function l(n, o, s, d, h) {
194
+ Ze(a, n, o, s, d, h);
195
+ }
196
+ return l.ratio = function(n) {
197
+ return t((n = +n) > 1 ? n : 1);
198
+ }, l;
199
+ }(Ue);
200
+ function Ke() {
201
+ var t = Je, a = !1, l = 1, n = 1, o = [0], s = q, d = q, h = q, g = q, c = q;
202
+ function u(r) {
203
+ return r.x0 = r.y0 = 0, r.x1 = l, r.y1 = n, r.eachBefore(b), o = [0], a && r.eachBefore(Xe), r;
204
+ }
205
+ function b(r) {
206
+ var x = o[r.depth], S = r.x0 + x, v = r.y0 + x, p = r.x1 - x, m = r.y1 - x;
207
+ p < S && (S = p = (S + p) / 2), m < v && (v = m = (v + m) / 2), r.x0 = S, r.y0 = v, r.x1 = p, r.y1 = m, r.children && (x = o[r.depth + 1] = s(r) / 2, S += c(r) - x, v += d(r) - x, p -= h(r) - x, m -= g(r) - x, p < S && (S = p = (S + p) / 2), m < v && (v = m = (v + m) / 2), t(r, S, v, p, m));
208
+ }
209
+ return u.round = function(r) {
210
+ return arguments.length ? (a = !!r, u) : a;
211
+ }, u.size = function(r) {
212
+ return arguments.length ? (l = +r[0], n = +r[1], u) : [l, n];
213
+ }, u.tile = function(r) {
214
+ return arguments.length ? (t = Ge(r), u) : t;
215
+ }, u.padding = function(r) {
216
+ return arguments.length ? u.paddingInner(r).paddingOuter(r) : u.paddingInner();
217
+ }, u.paddingInner = function(r) {
218
+ return arguments.length ? (s = typeof r == "function" ? r : G(+r), u) : s;
219
+ }, u.paddingOuter = function(r) {
220
+ return arguments.length ? u.paddingTop(r).paddingRight(r).paddingBottom(r).paddingLeft(r) : u.paddingTop();
221
+ }, u.paddingTop = function(r) {
222
+ return arguments.length ? (d = typeof r == "function" ? r : G(+r), u) : d;
223
+ }, u.paddingRight = function(r) {
224
+ return arguments.length ? (h = typeof r == "function" ? r : G(+r), u) : h;
225
+ }, u.paddingBottom = function(r) {
226
+ return arguments.length ? (g = typeof r == "function" ? r : G(+r), u) : g;
227
+ }, u.paddingLeft = function(r) {
228
+ return arguments.length ? (c = typeof r == "function" ? r : G(+r), u) : c;
229
+ }, u;
230
+ }
231
+ var E, ne = (E = class {
232
+ constructor() {
233
+ this.nodes = [], this.levels = /* @__PURE__ */ new Map(), this.outerNodes = [], this.classes = /* @__PURE__ */ new Map(), this.setAccTitle = pe, this.getAccTitle = fe, this.setDiagramTitle = ge, this.getDiagramTitle = me, this.getAccDescription = ye, this.setAccDescription = Se;
234
+ }
235
+ getNodes() {
236
+ return this.nodes;
237
+ }
238
+ getConfig() {
239
+ const a = ve, l = ae();
240
+ return te({
241
+ ...a.treemap,
242
+ ...l.treemap ?? {}
243
+ });
244
+ }
245
+ addNode(a, l) {
246
+ this.nodes.push(a), this.levels.set(a, l), l === 0 && (this.outerNodes.push(a), this.root ?? (this.root = a));
247
+ }
248
+ getRoot() {
249
+ return { name: "", children: this.outerNodes };
250
+ }
251
+ addClass(a, l) {
252
+ const n = this.classes.get(a) ?? { id: a, styles: [], textStyles: [] }, o = l.replace(/\\,/g, "§§§").replace(/,/g, ";").replace(/§§§/g, ",").split(";");
253
+ o && o.forEach((s) => {
254
+ xe(s) && (n?.textStyles ? n.textStyles.push(s) : n.textStyles = [s]), n?.styles ? n.styles.push(s) : n.styles = [s];
255
+ }), this.classes.set(a, n);
256
+ }
257
+ getClasses() {
258
+ return this.classes;
259
+ }
260
+ getStylesForClass(a) {
261
+ return this.classes.get(a)?.styles ?? [];
262
+ }
263
+ clear() {
264
+ be(), this.nodes = [], this.levels = /* @__PURE__ */ new Map(), this.outerNodes = [], this.classes = /* @__PURE__ */ new Map(), this.root = void 0;
265
+ }
266
+ }, w(E, "TreeMapDB"), E);
267
+ function le(t) {
268
+ if (!t.length)
269
+ return [];
270
+ const a = [], l = [];
271
+ return t.forEach((n) => {
272
+ const o = {
273
+ name: n.name,
274
+ children: n.type === "Leaf" ? void 0 : []
275
+ };
276
+ for (o.classSelector = n?.classSelector, n?.cssCompiledStyles && (o.cssCompiledStyles = [n.cssCompiledStyles]), n.type === "Leaf" && n.value !== void 0 && (o.value = n.value); l.length > 0 && l[l.length - 1].level >= n.level; )
277
+ l.pop();
278
+ if (l.length === 0)
279
+ a.push(o);
280
+ else {
281
+ const s = l[l.length - 1].node;
282
+ s.children ? s.children.push(o) : s.children = [o];
283
+ }
284
+ n.type !== "Leaf" && l.push({ node: o, level: n.level });
285
+ }), a;
286
+ }
287
+ w(le, "buildHierarchy");
288
+ var Qe = /* @__PURE__ */ w((t, a) => {
289
+ Ce(t, a);
290
+ const l = [];
291
+ for (const s of t.TreemapRows ?? [])
292
+ s.$type === "ClassDefStatement" && a.addClass(s.className ?? "", s.styleText ?? "");
293
+ for (const s of t.TreemapRows ?? []) {
294
+ const d = s.item;
295
+ if (!d)
296
+ continue;
297
+ const h = s.indent ? parseInt(s.indent) : 0, g = et(d), c = d.classSelector ? a.getStylesForClass(d.classSelector) : [], u = c.length > 0 ? c.join(";") : void 0, b = {
298
+ level: h,
299
+ name: g,
300
+ type: d.$type,
301
+ value: d.value,
302
+ classSelector: d.classSelector,
303
+ cssCompiledStyles: u
304
+ };
305
+ l.push(b);
306
+ }
307
+ const n = le(l), o = /* @__PURE__ */ w((s, d) => {
308
+ for (const h of s)
309
+ a.addNode(h, d), h.children && h.children.length > 0 && o(h.children, d + 1);
310
+ }, "addNodesRecursively");
311
+ o(n, 0);
312
+ }, "populate"), et = /* @__PURE__ */ w((t) => t.name ? String(t.name) : "", "getItemName"), re = {
313
+ // @ts-expect-error - TreeMapDB is not assignable to DiagramDB
314
+ parser: { yy: void 0 },
315
+ parse: /* @__PURE__ */ w(async (t) => {
316
+ try {
317
+ const l = await Te("treemap", t);
318
+ K.debug("Treemap AST:", l);
319
+ const n = re.parser?.yy;
320
+ if (!(n instanceof ne))
321
+ throw new Error(
322
+ "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."
323
+ );
324
+ Qe(l, n);
325
+ } catch (a) {
326
+ throw K.error("Error parsing treemap:", a), a;
327
+ }
328
+ }, "parse")
329
+ }, tt = 10, B = 10, X = 25, at = /* @__PURE__ */ w((t, a, l, n) => {
330
+ const o = n.db, s = o.getConfig(), d = s.padding ?? tt, h = o.getDiagramTitle(), g = o.getRoot(), { themeVariables: c } = ae();
331
+ if (!g)
332
+ return;
333
+ const u = h ? 30 : 0, b = he(a), r = s.nodeWidth ? s.nodeWidth * B : 960, x = s.nodeHeight ? s.nodeHeight * B : 500, S = r, v = x + u;
334
+ b.attr("viewBox", `0 0 ${S} ${v}`), ue(b, v, S, s.useMaxWidth);
335
+ let p;
336
+ try {
337
+ const e = s.valueFormat || ",";
338
+ if (e === "$0,0")
339
+ p = /* @__PURE__ */ w((i) => "$" + O(",")(i), "valueFormat");
340
+ else if (e.startsWith("$") && e.includes(",")) {
341
+ const i = /\.\d+/.exec(e), f = i ? i[0] : "";
342
+ p = /* @__PURE__ */ w((C) => "$" + O("," + f)(C), "valueFormat");
343
+ } else if (e.startsWith("$")) {
344
+ const i = e.substring(1);
345
+ p = /* @__PURE__ */ w((f) => "$" + O(i || "")(f), "valueFormat");
346
+ } else
347
+ p = O(e);
348
+ } catch (e) {
349
+ K.error("Error creating format function:", e), p = O(",");
350
+ }
351
+ const m = J().range([
352
+ "transparent",
353
+ c.cScale0,
354
+ c.cScale1,
355
+ c.cScale2,
356
+ c.cScale3,
357
+ c.cScale4,
358
+ c.cScale5,
359
+ c.cScale6,
360
+ c.cScale7,
361
+ c.cScale8,
362
+ c.cScale9,
363
+ c.cScale10,
364
+ c.cScale11
365
+ ]), N = J().range([
366
+ "transparent",
367
+ c.cScalePeer0,
368
+ c.cScalePeer1,
369
+ c.cScalePeer2,
370
+ c.cScalePeer3,
371
+ c.cScalePeer4,
372
+ c.cScalePeer5,
373
+ c.cScalePeer6,
374
+ c.cScalePeer7,
375
+ c.cScalePeer8,
376
+ c.cScalePeer9,
377
+ c.cScalePeer10,
378
+ c.cScalePeer11
379
+ ]), k = J().range([
380
+ c.cScaleLabel0,
381
+ c.cScaleLabel1,
382
+ c.cScaleLabel2,
383
+ c.cScaleLabel3,
384
+ c.cScaleLabel4,
385
+ c.cScaleLabel5,
386
+ c.cScaleLabel6,
387
+ c.cScaleLabel7,
388
+ c.cScaleLabel8,
389
+ c.cScaleLabel9,
390
+ c.cScaleLabel10,
391
+ c.cScaleLabel11
392
+ ]);
393
+ 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);
394
+ const V = b.append("g").attr("transform", `translate(0, ${u})`).attr("class", "treemapContainer"), R = Q(g).sum((e) => e.value ?? 0).sort((e, i) => (i.value ?? 0) - (e.value ?? 0)), ee = Ke().size([r, x]).paddingTop(
395
+ (e) => e.children && e.children.length > 0 ? X + B : 0
396
+ ).paddingInner(d).paddingLeft((e) => e.children && e.children.length > 0 ? B : 0).paddingRight((e) => e.children && e.children.length > 0 ? B : 0).paddingBottom((e) => e.children && e.children.length > 0 ? B : 0).round(!0)(R), se = ee.descendants().filter((e) => e.children && e.children.length > 0), W = V.selectAll(".treemapSection").data(se).enter().append("g").attr("class", "treemapSection").attr("transform", (e) => `translate(${e.x0},${e.y0})`);
397
+ 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, i) => `clip-section-${a}-${i}`).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, i) => `treemapSection section${i}`).attr("fill", (e) => m(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) => {
398
+ if (e.depth === 0)
399
+ return "display: none;";
400
+ const i = P({ cssCompiledStyles: e.data.cssCompiledStyles });
401
+ return i.nodeStyles + ";" + i.borderStyles.join(";");
402
+ }), 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) => {
403
+ if (e.depth === 0)
404
+ return "display: none;";
405
+ const i = "dominant-baseline: middle; font-size: 12px; fill:" + k(e.data.name) + "; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;", f = P({ cssCompiledStyles: e.data.cssCompiledStyles });
406
+ return i + f.labelStyles.replace("color:", "fill:");
407
+ }).each(function(e) {
408
+ if (e.depth === 0)
409
+ return;
410
+ const i = Y(this), f = e.data.name;
411
+ i.text(f);
412
+ const C = e.x1 - e.x0, $ = 6;
413
+ let A;
414
+ s.showValues !== !1 && e.value ? A = C - 10 - 30 - 10 - $ : A = C - $ - 6;
415
+ const F = Math.max(15, A), y = i.node();
416
+ if (y.getComputedTextLength() > F) {
417
+ const T = "...";
418
+ let L = f;
419
+ for (; L.length > 0; ) {
420
+ if (L = f.substring(0, L.length - 1), L.length === 0) {
421
+ i.text(T), y.getComputedTextLength() > F && i.text("");
422
+ break;
423
+ }
424
+ if (i.text(L + T), y.getComputedTextLength() <= F)
425
+ break;
426
+ }
427
+ }
428
+ }), 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) => {
429
+ if (e.depth === 0)
430
+ return "display: none;";
431
+ const i = "text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:" + k(e.data.name) + "; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;", f = P({ cssCompiledStyles: e.data.cssCompiledStyles });
432
+ return i + f.labelStyles.replace("color:", "fill:");
433
+ });
434
+ const ie = ee.leaves(), j = V.selectAll(".treemapLeafGroup").data(ie).enter().append("g").attr("class", (e, i) => `treemapNode treemapLeafGroup leaf${i}${e.data.classSelector ? ` ${e.data.classSelector}` : ""}x`).attr("transform", (e) => `translate(${e.x0},${e.y0})`);
435
+ j.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) => P({ 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), j.append("clipPath").attr("id", (e, i) => `clip-${a}-${i}`).append("rect").attr("width", (e) => Math.max(0, e.x1 - e.x0 - 4)).attr("height", (e) => Math.max(0, e.y1 - e.y0 - 4)), j.append("text").attr("class", "treemapLabel").attr("x", (e) => (e.x1 - e.x0) / 2).attr("y", (e) => (e.y1 - e.y0) / 2).attr("style", (e) => {
436
+ const i = "text-anchor: middle; dominant-baseline: middle; font-size: 38px;fill:" + k(e.data.name) + ";", f = P({ cssCompiledStyles: e.data.cssCompiledStyles });
437
+ return i + f.labelStyles.replace("color:", "fill:");
438
+ }).attr("clip-path", (e, i) => `url(#clip-${a}-${i})`).text((e) => e.data.name).each(function(e) {
439
+ const i = Y(this), f = e.x1 - e.x0, C = e.y1 - e.y0, $ = i.node(), A = 4, D = f - 2 * A, F = C - 2 * A;
440
+ if (D < 10 || F < 10) {
441
+ i.style("display", "none");
442
+ return;
443
+ }
444
+ let y = parseInt(i.style("font-size"), 10);
445
+ const _ = 8, T = 28, L = 0.6, z = 6, H = 2;
446
+ for (; $.getComputedTextLength() > D && y > _; )
447
+ y--, i.style("font-size", `${y}px`);
448
+ let I = Math.max(
449
+ z,
450
+ Math.min(T, Math.round(y * L))
451
+ ), Z = y + H + I;
452
+ for (; Z > F && y > _ && (y--, I = Math.max(
453
+ z,
454
+ Math.min(T, Math.round(y * L))
455
+ ), !(I < z && y === _)); )
456
+ i.style("font-size", `${y}px`), Z = y + H + I;
457
+ i.style("font-size", `${y}px`), ($.getComputedTextLength() > D || y < _ || F < y) && i.style("display", "none");
458
+ }), s.showValues !== !1 && j.append("text").attr("class", "treemapValue").attr("x", (i) => (i.x1 - i.x0) / 2).attr("y", function(i) {
459
+ return (i.y1 - i.y0) / 2;
460
+ }).attr("style", (i) => {
461
+ const f = "text-anchor: middle; dominant-baseline: hanging; font-size: 28px;fill:" + k(i.data.name) + ";", C = P({ cssCompiledStyles: i.data.cssCompiledStyles });
462
+ return f + C.labelStyles.replace("color:", "fill:");
463
+ }).attr("clip-path", (i, f) => `url(#clip-${a}-${f})`).text((i) => i.value ? p(i.value) : "").each(function(i) {
464
+ const f = Y(this), C = this.parentNode;
465
+ if (!C) {
466
+ f.style("display", "none");
467
+ return;
468
+ }
469
+ const $ = Y(C).select(".treemapLabel");
470
+ if ($.empty() || $.style("display") === "none") {
471
+ f.style("display", "none");
472
+ return;
473
+ }
474
+ const A = parseFloat($.style("font-size")), D = 28, F = 0.6, y = 6, _ = 2, T = Math.max(
475
+ y,
476
+ Math.min(D, Math.round(A * F))
477
+ );
478
+ f.style("font-size", `${T}px`);
479
+ const z = (i.y1 - i.y0) / 2 + A / 2 + _;
480
+ f.attr("y", z);
481
+ const H = i.x1 - i.x0, ce = i.y1 - i.y0 - 4, de = H - 2 * 4;
482
+ f.node().getComputedTextLength() > de || z + T > ce || T < y ? f.style("display", "none") : f.style("display", null);
483
+ });
484
+ const oe = s.diagramPadding ?? 8;
485
+ we(b, oe, "flowchart", s?.useMaxWidth || !1);
486
+ }, "draw"), nt = /* @__PURE__ */ w(function(t, a) {
487
+ return a.db.getClasses();
488
+ }, "getClasses"), lt = { draw: at, getClasses: nt }, rt = {
489
+ sectionStrokeColor: "black",
490
+ sectionStrokeWidth: "1",
491
+ sectionFillColor: "#efefef",
492
+ leafStrokeColor: "black",
493
+ leafStrokeWidth: "1",
494
+ leafFillColor: "#efefef",
495
+ labelColor: "black",
496
+ labelFontSize: "12px",
497
+ valueFontSize: "10px",
498
+ valueColor: "black",
499
+ titleColor: "black",
500
+ titleFontSize: "14px"
501
+ }, st = /* @__PURE__ */ w(({
502
+ treemap: t
503
+ } = {}) => {
504
+ const a = te(rt, t);
505
+ return `
506
+ .treemapNode.section {
507
+ stroke: ${a.sectionStrokeColor};
508
+ stroke-width: ${a.sectionStrokeWidth};
509
+ fill: ${a.sectionFillColor};
510
+ }
511
+ .treemapNode.leaf {
512
+ stroke: ${a.leafStrokeColor};
513
+ stroke-width: ${a.leafStrokeWidth};
514
+ fill: ${a.leafFillColor};
515
+ }
516
+ .treemapLabel {
517
+ fill: ${a.labelColor};
518
+ font-size: ${a.labelFontSize};
519
+ }
520
+ .treemapValue {
521
+ fill: ${a.valueColor};
522
+ font-size: ${a.valueFontSize};
523
+ }
524
+ .treemapTitle {
525
+ fill: ${a.titleColor};
526
+ font-size: ${a.titleFontSize};
527
+ }
528
+ `;
529
+ }, "getStyles"), it = st, mt = {
530
+ parser: re,
531
+ get db() {
532
+ return new ne();
533
+ },
534
+ renderer: lt,
535
+ styles: it
536
+ };
537
+ export {
538
+ mt as diagram
539
+ };