@airalogy/aimd-recorder 1.17.0 → 1.19.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.
Files changed (112) hide show
  1. package/README.md +42 -10
  2. package/README.zh-CN.md +42 -10
  3. package/dist/AimdCodeField-BQUuM-EF.js +182 -0
  4. package/dist/{AimdDnaSequenceField-D6ZgCDpp.js → AimdDnaSequenceField-TBKunqU_.js} +2 -2
  5. package/dist/{AimdEditor.vue_vue_type_style_index_0_lang-B5Tq4zPV.js → AimdEditor.vue_vue_type_style_index_0_lang-tdh0dJNa.js} +3922 -3829
  6. package/dist/AimdMarkdownField-DmNX2g4j.js +254 -0
  7. package/dist/AimdMarkdownNoteField-B5ruzmwS.js +259 -0
  8. package/dist/{_commonjsHelpers-CZXJ37nu.js → _commonjsHelpers-B5RozER-.js} +2 -2
  9. package/dist/aimd-recorder.css +1 -1
  10. package/dist/arc-B-vsgEXF.js +83 -0
  11. package/dist/architectureDiagram-3BPJPVTR-BwPNOtNH.js +4692 -0
  12. package/dist/blockDiagram-GPEHLZMM-CMUI4kKc.js +2425 -0
  13. package/dist/c4Diagram-AAUBKEIU-Cpmfsy_s.js +1577 -0
  14. package/dist/channel-DlMAXHQK.js +5 -0
  15. package/dist/chunk-2J33WTMH-DP9BS2ux.js +19 -0
  16. package/dist/chunk-4BX2VUAB-ncsOeLMb.js +8 -0
  17. package/dist/chunk-55IACEB6-C7wHk4B7.js +8 -0
  18. package/dist/chunk-727SXJPM-Caa5aVUO.js +1528 -0
  19. package/dist/chunk-AQP2D5EJ-CL8egKqD.js +1387 -0
  20. package/dist/chunk-FMBD7UC4-heVR6BSA.js +19 -0
  21. package/dist/chunk-ND2GUHAM-BYH-wC2J.js +68 -0
  22. package/dist/chunk-QZHKN3VN-Bx2K7vkq.js +15 -0
  23. package/dist/classDiagram-4FO5ZUOK-BLLfLYy0.js +16 -0
  24. package/dist/classDiagram-v2-Q7XG4LA2-BLLfLYy0.js +16 -0
  25. package/dist/components.js +3776 -2247
  26. package/dist/composables.js +96 -70
  27. package/dist/cose-bilkent-S5V4N54A-E1YmM_xr.js +2609 -0
  28. package/dist/cytoscape.esm-r59gEWFs.js +18710 -0
  29. package/dist/dagre-BM42HDAG-BsXpQirH.js +445 -0
  30. package/dist/defaultLocale-BgPVtth8.js +171 -0
  31. package/dist/diagram-2AECGRRQ-CamqbWlY.js +217 -0
  32. package/dist/diagram-5GNKFQAL-DZyRFcOC.js +123 -0
  33. package/dist/diagram-KO2AKTUF-CmkGcy7R.js +461 -0
  34. package/dist/diagram-LMA3HP47-IdDwQPZ-.js +142 -0
  35. package/dist/diagram-OG6HWLK6-t0LBcUIU.js +528 -0
  36. package/dist/erDiagram-TEJ5UH35-DJBY2iZG.js +899 -0
  37. package/dist/flowDiagram-I6XJVG4X-DE4MzPPk.js +1628 -0
  38. package/dist/ganttDiagram-6RSMTGT7-CmAc35Yw.js +2707 -0
  39. package/dist/gitGraphDiagram-PVQCEYII-DDQZ5flw.js +815 -0
  40. package/dist/graph-BsJ8-1Pq.js +1510 -0
  41. package/dist/index.js +110 -83
  42. package/dist/infoDiagram-5YYISTIA-DSZjFR5g.js +24 -0
  43. package/dist/init-DjUOC4st.js +16 -0
  44. package/dist/ishikawaDiagram-YF4QCWOH-DCO9dx2L.js +621 -0
  45. package/dist/journeyDiagram-JHISSGLW-b-PpuBqg.js +834 -0
  46. package/dist/kanban-definition-UN3LZRKU-BjclDuJZ.js +724 -0
  47. package/dist/katex-DNob3HGn.js +11690 -0
  48. package/dist/layout-D4wqKu72.js +1703 -0
  49. package/dist/linear-Voc3BJib.js +259 -0
  50. package/dist/mermaid.core-Dt_VbeGP.js +15940 -0
  51. package/dist/mindmap-definition-RKZ34NQL-B3vrXRVY.js +827 -0
  52. package/dist/ordinal-B6-f3MAq.js +61 -0
  53. package/dist/pieDiagram-4H26LBE5-DFpWxSxk.js +163 -0
  54. package/dist/quadrantDiagram-W4KKPZXB-BYHcrGoB.js +1024 -0
  55. package/dist/record.js +1199 -0
  56. package/dist/requirementDiagram-4Y6WPE33-C-FgWrRz.js +882 -0
  57. package/dist/sankeyDiagram-5OEKKPKP-IwN0Evji.js +847 -0
  58. package/dist/sequenceDiagram-3UESZ5HK-_OnqhBO2.js +2891 -0
  59. package/dist/stateDiagram-AJRCARHV-BRLv0Zcw.js +263 -0
  60. package/dist/stateDiagram-v2-BHNVJYJU-BofX0AdS.js +16 -0
  61. package/dist/timeline-definition-PNZ67QCA-C-DpPLpw.js +1055 -0
  62. package/dist/{useFieldRendering-xLajJhyA.js → useCodeBlockRendering-DoTZaJTW.js} +1528 -1725
  63. package/dist/useMonacoAutoHeight-D4T-El3J.js +66 -0
  64. package/dist/vennDiagram-CIIHVFJN-zTHQR9Oq.js +1557 -0
  65. package/dist/wardley-L42UT6IY-D7b2ujEZ.js +22512 -0
  66. package/dist/wardleyDiagram-YWT4CUSO-au5koizO.js +675 -0
  67. package/dist/xychartDiagram-2RQKCTM6-BNf12P8z.js +1342 -0
  68. package/package.json +13 -8
  69. package/src/__tests__/assigner-graph.test.ts +82 -0
  70. package/src/__tests__/assigner-runner-dependent-data.test.ts +32 -0
  71. package/src/__tests__/markdown-field.test.ts +150 -1
  72. package/src/__tests__/markdown-note-field.test.ts +86 -3
  73. package/src/__tests__/recorder-assigner-control.test.ts +993 -0
  74. package/src/__tests__/recorder-editor.test.ts +17 -0
  75. package/src/__tests__/recorder-markdown-assigner-integration.test.ts +49 -0
  76. package/src/__tests__/step-field.test.ts +47 -1
  77. package/src/__tests__/type-plugins.test.ts +1 -0
  78. package/src/__tests__/var-field-render.test.ts +806 -1
  79. package/src/components/AimdAssignerGraph.vue +816 -0
  80. package/src/components/AimdCodeField.vue +24 -5
  81. package/src/components/AimdMarkdownField.vue +556 -11
  82. package/src/components/AimdMarkdownNoteField.vue +241 -30
  83. package/src/components/AimdRecorder.vue +1619 -99
  84. package/src/components/AimdRecorderEditor.vue +276 -8
  85. package/src/components/AimdRecorderWysiwygFieldHost.vue +6 -0
  86. package/src/components/AimdRecorderWysiwygSurface.vue +32 -0
  87. package/src/components/AimdStepCheckField.vue +82 -18
  88. package/src/components/AimdVarField.vue +694 -25
  89. package/src/components/AimdVarTableField.vue +325 -138
  90. package/src/components/icons/AimdAssignerCalculatorIcon.vue +18 -0
  91. package/src/components/icons/AimdAssignerCloudStatusIcon.vue +22 -0
  92. package/src/components/index.ts +9 -1
  93. package/src/components/recorderMilkdownPlugin.ts +14 -0
  94. package/src/composables/__tests__/useRecordState.test.ts +86 -0
  95. package/src/composables/__tests__/useVarHelpers.test.ts +175 -0
  96. package/src/composables/index.ts +28 -1
  97. package/src/composables/useAssignerRunner.ts +376 -0
  98. package/src/composables/useCodeBlockRendering.ts +51 -0
  99. package/src/composables/useFieldRendering.ts +32 -4
  100. package/src/composables/useMonacoAutoHeight.ts +127 -0
  101. package/src/composables/useRecordState.ts +22 -3
  102. package/src/composables/useVarHelpers.ts +237 -32
  103. package/src/index.ts +20 -1
  104. package/src/locales.ts +45 -0
  105. package/src/record/index.ts +120 -0
  106. package/src/styles/aimd.css +216 -1
  107. package/src/type-plugins.ts +7 -0
  108. package/src/type-utils.ts +1 -3
  109. package/src/types.ts +130 -2
  110. package/dist/AimdCodeField-DC3DPvgc.js +0 -172
  111. package/dist/AimdMarkdownField-BJ20QtO8.js +0 -67
  112. package/dist/AimdMarkdownNoteField-DwAQhoyk.js +0 -186
@@ -0,0 +1,528 @@
1
+ import { _ as w, a1 as he, F as ee, H as K, L as ue, e as pe, l as Q, bc as P, d as j, b as fe, a as me, q as ge, t as ye, g as Se, s as ve, I as xe, bd as be, A as we } from "./mermaid.core-Dt_VbeGP.js";
2
+ import { s as Ce } from "./chunk-2J33WTMH-DP9BS2ux.js";
3
+ import { p as Te } from "./chunk-4BX2VUAB-ncsOeLMb.js";
4
+ import { p as Le } from "./wardley-L42UT6IY-D7b2ujEZ.js";
5
+ import { b as O } from "./defaultLocale-BgPVtth8.js";
6
+ import { o as J } from "./ordinal-B6-f3MAq.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 Ae() {
14
+ return this.eachAfter($e);
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, i, d = -1; l = n.pop(); )
24
+ if (t.call(a, l, ++d, this), r = l.children)
25
+ for (i = r.length - 1; i >= 0; --i)
26
+ n.push(r[i]);
27
+ return this;
28
+ }
29
+ function Me(t, a) {
30
+ for (var l = this, n = [l], r = [], i, d, h, m = -1; l = n.pop(); )
31
+ if (r.push(l), i = l.children)
32
+ for (d = 0, h = i.length; d < h; ++d)
33
+ n.push(i[d]);
34
+ for (; l = r.pop(); )
35
+ t.call(a, l, ++m, 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 Pe() {
70
+ for (var t = this, a = [t]; t = t.parent; )
71
+ a.push(t);
72
+ return a;
73
+ }
74
+ function Be() {
75
+ return Array.from(this);
76
+ }
77
+ function Re() {
78
+ var t = [];
79
+ return this.eachBefore(function(a) {
80
+ a.children || t.push(a);
81
+ }), t;
82
+ }
83
+ function Ee() {
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, i;
91
+ do
92
+ for (a = l.reverse(), l = []; t = a.pop(); )
93
+ if (yield t, n = t.children)
94
+ for (r = 0, i = n.length; r < i; ++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 U(t), n, r = [l], i, d, h, m; n = r.pop(); )
101
+ if ((d = a(n.data)) && (m = (d = Array.from(d)).length))
102
+ for (n.children = d, h = m - 1; h >= 0; --h)
103
+ r.push(i = d[h] = new U(d[h])), i.parent = n, i.depth = n.depth + 1;
104
+ return l.eachBefore(Ge);
105
+ }
106
+ function He() {
107
+ return te(this).eachBefore(qe);
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 qe(t) {
116
+ t.data.value !== void 0 && (t.value = t.data.value), t.data = t.data.data;
117
+ }
118
+ function Ge(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 = te.prototype = {
128
+ constructor: U,
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: Pe,
138
+ descendants: Be,
139
+ leaves: Re,
140
+ links: Ee,
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 q() {
149
+ return 0;
150
+ }
151
+ function G(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 i = t.children, d, h = -1, m = i.length, c = t.value && (n - a) / t.value; ++h < m; )
161
+ d = i[h], d.y0 = l, d.y1 = r, d.x0 = a, d.x1 = a += d.value * c;
162
+ }
163
+ function Ue(t, a, l, n, r) {
164
+ for (var i = t.children, d, h = -1, m = i.length, c = t.value && (r - l) / t.value; ++h < m; )
165
+ d = i[h], d.x0 = a, d.x1 = n, d.y0 = l, d.y1 = l += d.value * c;
166
+ }
167
+ var Ze = (1 + Math.sqrt(5)) / 2;
168
+ function Je(t, a, l, n, r, i) {
169
+ for (var d = [], h = a.children, m, c, u = 0, b = 0, s = h.length, x, S, v = a.value, p, g, M, N, z, E, V; u < s; ) {
170
+ x = r - l, S = i - n;
171
+ do
172
+ p = h[b++].value;
173
+ while (!p && b < s);
174
+ for (g = M = p, E = Math.max(S / x, x / S) / (v * t), V = p * p * E, z = Math.max(M / V, V / g); b < s; ++b) {
175
+ if (p += c = h[b].value, c < g && (g = c), c > M && (M = c), V = p * p * E, N = Math.max(M / V, V / g), N > z) {
176
+ p -= c;
177
+ break;
178
+ }
179
+ z = N;
180
+ }
181
+ d.push(m = { value: p, dice: x < S, children: h.slice(u, b) }), m.dice ? je(m, l, n, r, v ? n += S * p / v : i) : Ue(m, l, n, v ? l += x * p / v : r, i), v -= p, u = b;
182
+ }
183
+ return d;
184
+ }
185
+ const Ke = (function t(a) {
186
+ function l(n, r, i, d, h) {
187
+ Je(a, n, r, i, d, h);
188
+ }
189
+ return l.ratio = function(n) {
190
+ return t((n = +n) > 1 ? n : 1);
191
+ }, l;
192
+ })(Ze);
193
+ function Qe() {
194
+ var t = Ke, a = !1, l = 1, n = 1, r = [0], i = q, d = q, h = q, m = q, c = q;
195
+ function u(s) {
196
+ return s.x0 = s.y0 = 0, s.x1 = l, s.y1 = n, s.eachBefore(b), r = [0], a && s.eachBefore(Ye), s;
197
+ }
198
+ function b(s) {
199
+ var x = r[s.depth], S = s.x0 + x, v = s.y0 + x, p = s.x1 - x, g = s.y1 - x;
200
+ p < S && (S = p = (S + p) / 2), g < v && (v = g = (v + g) / 2), s.x0 = S, s.y0 = v, s.x1 = p, s.y1 = g, s.children && (x = r[s.depth + 1] = i(s) / 2, S += c(s) - x, v += d(s) - x, p -= h(s) - x, g -= m(s) - x, p < S && (S = p = (S + p) / 2), g < v && (v = g = (v + g) / 2), t(s, S, v, p, g));
201
+ }
202
+ return u.round = function(s) {
203
+ return arguments.length ? (a = !!s, u) : a;
204
+ }, u.size = function(s) {
205
+ return arguments.length ? (l = +s[0], n = +s[1], u) : [l, n];
206
+ }, u.tile = function(s) {
207
+ return arguments.length ? (t = Xe(s), u) : t;
208
+ }, u.padding = function(s) {
209
+ return arguments.length ? u.paddingInner(s).paddingOuter(s) : u.paddingInner();
210
+ }, u.paddingInner = function(s) {
211
+ return arguments.length ? (i = typeof s == "function" ? s : G(+s), u) : i;
212
+ }, u.paddingOuter = function(s) {
213
+ return arguments.length ? u.paddingTop(s).paddingRight(s).paddingBottom(s).paddingLeft(s) : u.paddingTop();
214
+ }, u.paddingTop = function(s) {
215
+ return arguments.length ? (d = typeof s == "function" ? s : G(+s), u) : d;
216
+ }, u.paddingRight = function(s) {
217
+ return arguments.length ? (h = typeof s == "function" ? s : G(+s), u) : h;
218
+ }, u.paddingBottom = function(s) {
219
+ return arguments.length ? (m = typeof s == "function" ? s : G(+s), u) : m;
220
+ }, u.paddingLeft = function(s) {
221
+ return arguments.length ? (c = typeof s == "function" ? s : G(+s), u) : c;
222
+ }, u;
223
+ }
224
+ var R, ne = (R = class {
225
+ constructor() {
226
+ this.nodes = [], this.levels = /* @__PURE__ */ new Map(), this.outerNodes = [], this.classes = /* @__PURE__ */ new Map(), this.setAccTitle = fe, this.getAccTitle = me, this.setDiagramTitle = ge, 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 K({
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 ??= 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((i) => {
247
+ be(i) && (n?.textStyles ? n.textStyles.push(i) : n.textStyles = [i]), n?.styles ? n.styles.push(i) : n.styles = [i];
248
+ }), this.classes.set(a, n);
249
+ }
250
+ getClasses() {
251
+ return this.classes;
252
+ }
253
+ getStylesForClass(a) {
254
+ return this.classes.get(a)?.styles ?? [];
255
+ }
256
+ clear() {
257
+ we(), this.nodes = [], this.levels = /* @__PURE__ */ new Map(), this.outerNodes = [], this.classes = /* @__PURE__ */ new Map(), this.root = void 0;
258
+ }
259
+ }, w(R, "TreeMapDB"), R);
260
+ function le(t) {
261
+ if (!t.length)
262
+ return [];
263
+ const a = [], l = [];
264
+ return t.forEach((n) => {
265
+ const r = {
266
+ name: n.name,
267
+ children: n.type === "Leaf" ? void 0 : []
268
+ };
269
+ for (r.classSelector = n?.classSelector, 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; )
270
+ l.pop();
271
+ if (l.length === 0)
272
+ a.push(r);
273
+ else {
274
+ const i = l[l.length - 1].node;
275
+ i.children ? i.children.push(r) : i.children = [r];
276
+ }
277
+ n.type !== "Leaf" && l.push({ node: r, level: n.level });
278
+ }), a;
279
+ }
280
+ w(le, "buildHierarchy");
281
+ var et = /* @__PURE__ */ w((t, a) => {
282
+ Te(t, a);
283
+ const l = [];
284
+ for (const i of t.TreemapRows ?? [])
285
+ i.$type === "ClassDefStatement" && a.addClass(i.className ?? "", i.styleText ?? "");
286
+ for (const i of t.TreemapRows ?? []) {
287
+ const d = i.item;
288
+ if (!d)
289
+ continue;
290
+ const h = i.indent ? parseInt(i.indent) : 0, m = tt(d), c = d.classSelector ? a.getStylesForClass(d.classSelector) : [], u = c.length > 0 ? c : void 0, b = {
291
+ level: h,
292
+ name: m,
293
+ type: d.$type,
294
+ value: d.value,
295
+ classSelector: d.classSelector,
296
+ cssCompiledStyles: u
297
+ };
298
+ l.push(b);
299
+ }
300
+ const n = le(l), r = /* @__PURE__ */ w((i, d) => {
301
+ for (const h of i)
302
+ a.addNode(h, d), h.children && h.children.length > 0 && r(h.children, d + 1);
303
+ }, "addNodesRecursively");
304
+ r(n, 0);
305
+ }, "populate"), tt = /* @__PURE__ */ w((t) => t.name ? String(t.name) : "", "getItemName"), re = {
306
+ // @ts-expect-error - TreeMapDB is not assignable to DiagramDB
307
+ parser: { yy: void 0 },
308
+ parse: /* @__PURE__ */ w(async (t) => {
309
+ try {
310
+ const l = await Le("treemap", t);
311
+ Q.debug("Treemap AST:", l);
312
+ const n = re.parser?.yy;
313
+ if (!(n instanceof ne))
314
+ throw new Error(
315
+ "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."
316
+ );
317
+ et(l, n);
318
+ } catch (a) {
319
+ throw Q.error("Error parsing treemap:", a), a;
320
+ }
321
+ }, "parse")
322
+ }, at = 10, B = 10, X = 25, nt = /* @__PURE__ */ w((t, a, l, n) => {
323
+ const r = n.db, i = r.getConfig(), d = i.padding ?? at, h = r.getDiagramTitle(), m = r.getRoot(), { themeVariables: c } = ee();
324
+ if (!m)
325
+ return;
326
+ const u = h ? 30 : 0, b = ue(a), s = i.nodeWidth ? i.nodeWidth * B : 960, x = i.nodeHeight ? i.nodeHeight * B : 500, S = s, v = x + u;
327
+ b.attr("viewBox", `0 0 ${S} ${v}`), pe(b, v, S, i.useMaxWidth);
328
+ let p;
329
+ try {
330
+ const e = i.valueFormat || ",";
331
+ if (e === "$0,0")
332
+ p = /* @__PURE__ */ w((o) => "$" + O(",")(o), "valueFormat");
333
+ else if (e.startsWith("$") && e.includes(",")) {
334
+ const o = /\.\d+/.exec(e), f = o ? o[0] : "";
335
+ p = /* @__PURE__ */ w((C) => "$" + O("," + f)(C), "valueFormat");
336
+ } else if (e.startsWith("$")) {
337
+ const o = e.substring(1);
338
+ p = /* @__PURE__ */ w((f) => "$" + O(o || "")(f), "valueFormat");
339
+ } else
340
+ p = O(e);
341
+ } catch (e) {
342
+ Q.error("Error creating format function:", e), p = O(",");
343
+ }
344
+ const g = J().range([
345
+ "transparent",
346
+ c.cScale0,
347
+ c.cScale1,
348
+ c.cScale2,
349
+ c.cScale3,
350
+ c.cScale4,
351
+ c.cScale5,
352
+ c.cScale6,
353
+ c.cScale7,
354
+ c.cScale8,
355
+ c.cScale9,
356
+ c.cScale10,
357
+ c.cScale11
358
+ ]), M = J().range([
359
+ "transparent",
360
+ c.cScalePeer0,
361
+ c.cScalePeer1,
362
+ c.cScalePeer2,
363
+ c.cScalePeer3,
364
+ c.cScalePeer4,
365
+ c.cScalePeer5,
366
+ c.cScalePeer6,
367
+ c.cScalePeer7,
368
+ c.cScalePeer8,
369
+ c.cScalePeer9,
370
+ c.cScalePeer10,
371
+ c.cScalePeer11
372
+ ]), N = J().range([
373
+ c.cScaleLabel0,
374
+ c.cScaleLabel1,
375
+ c.cScaleLabel2,
376
+ c.cScaleLabel3,
377
+ c.cScaleLabel4,
378
+ c.cScaleLabel5,
379
+ c.cScaleLabel6,
380
+ c.cScaleLabel7,
381
+ c.cScaleLabel8,
382
+ c.cScaleLabel9,
383
+ c.cScaleLabel10,
384
+ c.cScaleLabel11
385
+ ]);
386
+ 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);
387
+ const z = b.append("g").attr("transform", `translate(0, ${u})`).attr("class", "treemapContainer"), E = te(m).sum((e) => e.value ?? 0).sort((e, o) => (o.value ?? 0) - (e.value ?? 0)), ae = Qe().size([s, x]).paddingTop(
388
+ (e) => e.children && e.children.length > 0 ? X + B : 0
389
+ ).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)(E), 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})`);
390
+ 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) => g(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) => {
391
+ if (e.depth === 0)
392
+ return "display: none;";
393
+ const o = P({ cssCompiledStyles: e.data.cssCompiledStyles });
394
+ return o.nodeStyles + ";" + o.borderStyles.join(";");
395
+ }), 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) => {
396
+ if (e.depth === 0)
397
+ return "display: none;";
398
+ const o = "dominant-baseline: middle; font-size: 12px; fill:" + N(e.data.name) + "; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;", f = P({ cssCompiledStyles: e.data.cssCompiledStyles });
399
+ return o + f.labelStyles.replace("color:", "fill:");
400
+ }).each(function(e) {
401
+ if (e.depth === 0)
402
+ return;
403
+ const o = j(this), f = e.data.name;
404
+ o.text(f);
405
+ const C = e.x1 - e.x0, L = 6;
406
+ let $;
407
+ i.showValues !== !1 && e.value ? $ = C - 10 - 30 - 10 - L : $ = C - L - 6;
408
+ const A = Math.max(15, $), y = o.node();
409
+ if (y.getComputedTextLength() > A) {
410
+ let T = f;
411
+ for (; T.length > 0; ) {
412
+ if (T = f.substring(0, T.length - 1), T.length === 0) {
413
+ o.text("..."), y.getComputedTextLength() > A && o.text("");
414
+ break;
415
+ }
416
+ if (o.text(T + "..."), y.getComputedTextLength() <= A)
417
+ break;
418
+ }
419
+ }
420
+ }), i.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) => {
421
+ if (e.depth === 0)
422
+ return "display: none;";
423
+ 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 = P({ cssCompiledStyles: e.data.cssCompiledStyles });
424
+ return o + f.labelStyles.replace("color:", "fill:");
425
+ });
426
+ 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})`);
427
+ 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 ? g(e.parent.data.name) : g(e.data.name)).attr("style", (e) => P({ cssCompiledStyles: e.data.cssCompiledStyles }).nodeStyles).attr("fill-opacity", 0.3).attr("stroke", (e) => e.parent ? g(e.parent.data.name) : g(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) => {
428
+ const o = "text-anchor: middle; dominant-baseline: middle; font-size: 38px;fill:" + N(e.data.name) + ";", f = P({ cssCompiledStyles: e.data.cssCompiledStyles });
429
+ return o + f.labelStyles.replace("color:", "fill:");
430
+ }).attr("clip-path", (e, o) => `url(#clip-${a}-${o})`).text((e) => e.data.name).each(function(e) {
431
+ const o = j(this), f = e.x1 - e.x0, C = e.y1 - e.y0, L = o.node(), $ = 4, D = f - 2 * $, A = C - 2 * $;
432
+ if (D < 10 || A < 10) {
433
+ o.style("display", "none");
434
+ return;
435
+ }
436
+ let y = parseInt(o.style("font-size"), 10);
437
+ const _ = 8, F = 28, T = 0.6, k = 6, H = 2;
438
+ for (; L.getComputedTextLength() > D && y > _; )
439
+ y--, o.style("font-size", `${y}px`);
440
+ let I = Math.max(
441
+ k,
442
+ Math.min(F, Math.round(y * T))
443
+ ), Z = y + H + I;
444
+ for (; Z > A && y > _ && (y--, I = Math.max(
445
+ k,
446
+ Math.min(F, Math.round(y * T))
447
+ ), !(I < k && y === _)); )
448
+ o.style("font-size", `${y}px`), Z = y + H + I;
449
+ o.style("font-size", `${y}px`), (L.getComputedTextLength() > D || y < _ || A < y) && o.style("display", "none");
450
+ }), i.showValues !== !1 && Y.append("text").attr("class", "treemapValue").attr("x", (o) => (o.x1 - o.x0) / 2).attr("y", function(o) {
451
+ return (o.y1 - o.y0) / 2;
452
+ }).attr("style", (o) => {
453
+ const f = "text-anchor: middle; dominant-baseline: hanging; font-size: 28px;fill:" + N(o.data.name) + ";", C = P({ cssCompiledStyles: o.data.cssCompiledStyles });
454
+ return f + C.labelStyles.replace("color:", "fill:");
455
+ }).attr("clip-path", (o, f) => `url(#clip-${a}-${f})`).text((o) => o.value ? p(o.value) : "").each(function(o) {
456
+ const f = j(this), C = this.parentNode;
457
+ if (!C) {
458
+ f.style("display", "none");
459
+ return;
460
+ }
461
+ const L = j(C).select(".treemapLabel");
462
+ if (L.empty() || L.style("display") === "none") {
463
+ f.style("display", "none");
464
+ return;
465
+ }
466
+ const $ = parseFloat(L.style("font-size")), D = 28, A = 0.6, y = 6, _ = 2, F = Math.max(
467
+ y,
468
+ Math.min(D, Math.round($ * A))
469
+ );
470
+ f.style("font-size", `${F}px`);
471
+ const k = (o.y1 - o.y0) / 2 + $ / 2 + _;
472
+ f.attr("y", k);
473
+ const H = o.x1 - o.x0, ce = o.y1 - o.y0 - 4, de = H - 8;
474
+ f.node().getComputedTextLength() > de || k + F > ce || F < y ? f.style("display", "none") : f.style("display", null);
475
+ });
476
+ const oe = i.diagramPadding ?? 8;
477
+ Ce(b, oe, "flowchart", i?.useMaxWidth || !1);
478
+ }, "draw"), lt = /* @__PURE__ */ w(function(t, a) {
479
+ return a.db.getClasses();
480
+ }, "getClasses"), rt = { draw: nt, getClasses: lt }, st = {
481
+ sectionStrokeColor: "black",
482
+ sectionStrokeWidth: "1",
483
+ sectionFillColor: "#efefef",
484
+ leafStrokeColor: "black",
485
+ leafStrokeWidth: "1",
486
+ leafFillColor: "#efefef",
487
+ labelFontSize: "12px",
488
+ valueFontSize: "10px",
489
+ titleFontSize: "14px"
490
+ }, it = /* @__PURE__ */ w(({
491
+ treemap: t
492
+ } = {}) => {
493
+ const a = he(), l = ee(), n = K(a, l.themeVariables), r = K(st, t), i = r.titleColor ?? n.titleColor, d = r.labelColor ?? n.textColor, h = r.valueColor ?? n.textColor;
494
+ return `
495
+ .treemapNode.section {
496
+ stroke: ${r.sectionStrokeColor};
497
+ stroke-width: ${r.sectionStrokeWidth};
498
+ fill: ${r.sectionFillColor};
499
+ }
500
+ .treemapNode.leaf {
501
+ stroke: ${r.leafStrokeColor};
502
+ stroke-width: ${r.leafStrokeWidth};
503
+ fill: ${r.leafFillColor};
504
+ }
505
+ .treemapLabel {
506
+ fill: ${d};
507
+ font-size: ${r.labelFontSize};
508
+ }
509
+ .treemapValue {
510
+ fill: ${h};
511
+ font-size: ${r.valueFontSize};
512
+ }
513
+ .treemapTitle {
514
+ fill: ${i};
515
+ font-size: ${r.titleFontSize};
516
+ }
517
+ `;
518
+ }, "getStyles"), ot = it, gt = {
519
+ parser: re,
520
+ get db() {
521
+ return new ne();
522
+ },
523
+ renderer: rt,
524
+ styles: ot
525
+ };
526
+ export {
527
+ gt as diagram
528
+ };