bg-editor 0.0.7 → 0.0.9

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 (59) hide show
  1. package/dist/style.css +1 -1
  2. package/dist/umo-editor.js +90031 -7
  3. package/package.json +21 -1
  4. package/dist/_baseUniq-CK68Es8H.js +0 -473
  5. package/dist/arc-cD-4ba7d.js +0 -84
  6. package/dist/architecture-U656AL7Q-jxTBuJdN.js +0 -6
  7. package/dist/architectureDiagram-VXUJARFQ-D3XlpFhb.js +0 -4660
  8. package/dist/blockDiagram-VD42YOAC-BslbvMOG.js +0 -2262
  9. package/dist/c4Diagram-YG6GDRKO-DD3uWYPM.js +0 -1581
  10. package/dist/channel-DjTSKqWx.js +0 -6
  11. package/dist/chunk-4BX2VUAB-lfhsh4gk.js +0 -9
  12. package/dist/chunk-55IACEB6-O42zw0MT.js +0 -9
  13. package/dist/chunk-B4BG7PRW-CAose2Ox.js +0 -1376
  14. package/dist/chunk-DI55MBZ5-DkOlwdzs.js +0 -1371
  15. package/dist/chunk-FMBD7UC4-XviEvZms.js +0 -20
  16. package/dist/chunk-QN33PNHL-CNGSzgpw.js +0 -20
  17. package/dist/chunk-QZHKN3VN-CRgLUJXR.js +0 -16
  18. package/dist/chunk-TZMSLE5B-BkHNUxTN.js +0 -65
  19. package/dist/classDiagram-2ON5EDUG-Cakz_SCw.js +0 -17
  20. package/dist/classDiagram-v2-WZHVMYZB-Cakz_SCw.js +0 -17
  21. package/dist/clone-CIrbb4_D.js +0 -9
  22. package/dist/cose-bilkent-S5V4N54A-EoSlB5N_.js +0 -2606
  23. package/dist/cytoscape.esm-DoU_GB5M.js +0 -18732
  24. package/dist/dagre-6UL2VRFP-BPH1NIvl.js +0 -444
  25. package/dist/defaultLocale-DEnRyJdC.js +0 -172
  26. package/dist/diagram-PSM6KHXK-DCRoLhFv.js +0 -396
  27. package/dist/diagram-QEK2KX5R-2gxFpsCA.js +0 -218
  28. package/dist/diagram-S2PKOQOG-BIPpN2G8.js +0 -143
  29. package/dist/erDiagram-Q2GNP2WA-pfb2dpnp.js +0 -842
  30. package/dist/flowDiagram-NV44I4VS-Dv631-Fh.js +0 -1621
  31. package/dist/ganttDiagram-LVOFAZNH-BOKYXijK.js +0 -2500
  32. package/dist/gitGraph-F6HP7TQM-CRerkbyh.js +0 -6
  33. package/dist/gitGraphDiagram-NY62KEGX-CgO9x7O1.js +0 -700
  34. package/dist/graph-CG-rVaun.js +0 -382
  35. package/dist/index-LPeu-5gp.js +0 -164788
  36. package/dist/info-NVLQJR56-CZcMDuD4.js +0 -6
  37. package/dist/infoDiagram-ER5ION4S-CpfjxDXT.js +0 -25
  38. package/dist/init-Dbt-6wo9.js +0 -17
  39. package/dist/journeyDiagram-XKPGCS4Q-D4m1xk_j.js +0 -837
  40. package/dist/kanban-definition-3W4ZIXB7-GUMW-GDO.js +0 -719
  41. package/dist/layout-C7pGfQvF.js +0 -1416
  42. package/dist/linear-CQdBpz9H.js +0 -260
  43. package/dist/mermaid-parser.core-C3Lk4un7.js +0 -14143
  44. package/dist/min-D7xNMq31.js +0 -39
  45. package/dist/mindmap-definition-VGOIOE7T-GfQh2q9s.js +0 -784
  46. package/dist/ordinal-mgyNSFm_.js +0 -62
  47. package/dist/packet-BFZMPI3H-DughJE3g.js +0 -6
  48. package/dist/pie-7BOR55EZ-B1py7mee.js +0 -6
  49. package/dist/pieDiagram-ADFJNKIX-DENmX4xL.js +0 -162
  50. package/dist/quadrantDiagram-AYHSOK5B-BFVycH-W.js +0 -1023
  51. package/dist/radar-NHE76QYJ-DuTW4rXt.js +0 -6
  52. package/dist/requirementDiagram-UZGBJVZJ-f8rb43Mp.js +0 -851
  53. package/dist/sankeyDiagram-TZEHDZUN-CUN0tZ5p.js +0 -811
  54. package/dist/sequenceDiagram-WL72ISMW-7X4nul9T.js +0 -2512
  55. package/dist/stateDiagram-FKZM4ZOC-CypL793K.js +0 -264
  56. package/dist/stateDiagram-v2-4FDKWEC3-D5vS5FM5.js +0 -17
  57. package/dist/timeline-definition-IT6M3QCI-B_WOoOGO.js +0 -798
  58. package/dist/treemap-KMMF4GRG-BzINyJBJ.js +0 -6
  59. package/dist/xychartDiagram-PRI3JC2R-Llw16NDY.js +0 -1341
@@ -1,2262 +0,0 @@
1
- import "./style.css";
2
- import { g as oe } from "./chunk-FMBD7UC4-XviEvZms.js";
3
- import { _ as d, E as rt, d as O, e as he, l as L, y as de, A as ge, c as R, ai as ue, R as pe, S as fe, O as xe, aj as j, ak as Wt, al as ye, u as $, k as be, am as we, an as xt, i as yt, ao as me } from "./index-LPeu-5gp.js";
4
- import { c as Le } from "./clone-CIrbb4_D.js";
5
- import { G as Se } from "./graph-CG-rVaun.js";
6
- import { c as ke } from "./channel-DjTSKqWx.js";
7
- var bt = function() {
8
- var e = /* @__PURE__ */ d(function(D, y, g, f) {
9
- for (g = g || {}, f = D.length; f--; g[D[f]] = y) ;
10
- return g;
11
- }, "o"), t = [1, 15], a = [1, 7], i = [1, 13], l = [1, 14], s = [1, 19], r = [1, 16], n = [1, 17], c = [1, 18], u = [8, 30], o = [8, 10, 21, 28, 29, 30, 31, 39, 43, 46], x = [1, 23], w = [1, 24], b = [8, 10, 15, 16, 21, 28, 29, 30, 31, 39, 43, 46], S = [8, 10, 15, 16, 21, 27, 28, 29, 30, 31, 39, 43, 46], v = [1, 49], k = {
12
- trace: /* @__PURE__ */ d(function() {
13
- }, "trace"),
14
- yy: {},
15
- symbols_: { error: 2, spaceLines: 3, SPACELINE: 4, NL: 5, separator: 6, SPACE: 7, EOF: 8, start: 9, BLOCK_DIAGRAM_KEY: 10, document: 11, stop: 12, statement: 13, link: 14, LINK: 15, START_LINK: 16, LINK_LABEL: 17, STR: 18, nodeStatement: 19, columnsStatement: 20, SPACE_BLOCK: 21, blockStatement: 22, classDefStatement: 23, cssClassStatement: 24, styleStatement: 25, node: 26, SIZE: 27, COLUMNS: 28, "id-block": 29, end: 30, NODE_ID: 31, nodeShapeNLabel: 32, dirList: 33, DIR: 34, NODE_DSTART: 35, NODE_DEND: 36, BLOCK_ARROW_START: 37, BLOCK_ARROW_END: 38, classDef: 39, CLASSDEF_ID: 40, CLASSDEF_STYLEOPTS: 41, DEFAULT: 42, class: 43, CLASSENTITY_IDS: 44, STYLECLASS: 45, style: 46, STYLE_ENTITY_IDS: 47, STYLE_DEFINITION_DATA: 48, $accept: 0, $end: 1 },
16
- terminals_: { 2: "error", 4: "SPACELINE", 5: "NL", 7: "SPACE", 8: "EOF", 10: "BLOCK_DIAGRAM_KEY", 15: "LINK", 16: "START_LINK", 17: "LINK_LABEL", 18: "STR", 21: "SPACE_BLOCK", 27: "SIZE", 28: "COLUMNS", 29: "id-block", 30: "end", 31: "NODE_ID", 34: "DIR", 35: "NODE_DSTART", 36: "NODE_DEND", 37: "BLOCK_ARROW_START", 38: "BLOCK_ARROW_END", 39: "classDef", 40: "CLASSDEF_ID", 41: "CLASSDEF_STYLEOPTS", 42: "DEFAULT", 43: "class", 44: "CLASSENTITY_IDS", 45: "STYLECLASS", 46: "style", 47: "STYLE_ENTITY_IDS", 48: "STYLE_DEFINITION_DATA" },
17
- productions_: [0, [3, 1], [3, 2], [3, 2], [6, 1], [6, 1], [6, 1], [9, 3], [12, 1], [12, 1], [12, 2], [12, 2], [11, 1], [11, 2], [14, 1], [14, 4], [13, 1], [13, 1], [13, 1], [13, 1], [13, 1], [13, 1], [13, 1], [19, 3], [19, 2], [19, 1], [20, 1], [22, 4], [22, 3], [26, 1], [26, 2], [33, 1], [33, 2], [32, 3], [32, 4], [23, 3], [23, 3], [24, 3], [25, 3]],
18
- performAction: /* @__PURE__ */ d(function(y, g, f, m, E, h, W) {
19
- var p = h.length - 1;
20
- switch (E) {
21
- case 4:
22
- m.getLogger().debug("Rule: separator (NL) ");
23
- break;
24
- case 5:
25
- m.getLogger().debug("Rule: separator (Space) ");
26
- break;
27
- case 6:
28
- m.getLogger().debug("Rule: separator (EOF) ");
29
- break;
30
- case 7:
31
- m.getLogger().debug("Rule: hierarchy: ", h[p - 1]), m.setHierarchy(h[p - 1]);
32
- break;
33
- case 8:
34
- m.getLogger().debug("Stop NL ");
35
- break;
36
- case 9:
37
- m.getLogger().debug("Stop EOF ");
38
- break;
39
- case 10:
40
- m.getLogger().debug("Stop NL2 ");
41
- break;
42
- case 11:
43
- m.getLogger().debug("Stop EOF2 ");
44
- break;
45
- case 12:
46
- m.getLogger().debug("Rule: statement: ", h[p]), typeof h[p].length == "number" ? this.$ = h[p] : this.$ = [h[p]];
47
- break;
48
- case 13:
49
- m.getLogger().debug("Rule: statement #2: ", h[p - 1]), this.$ = [h[p - 1]].concat(h[p]);
50
- break;
51
- case 14:
52
- m.getLogger().debug("Rule: link: ", h[p], y), this.$ = { edgeTypeStr: h[p], label: "" };
53
- break;
54
- case 15:
55
- m.getLogger().debug("Rule: LABEL link: ", h[p - 3], h[p - 1], h[p]), this.$ = { edgeTypeStr: h[p], label: h[p - 1] };
56
- break;
57
- case 18:
58
- const I = parseInt(h[p]), Z = m.generateId();
59
- this.$ = { id: Z, type: "space", label: "", width: I, children: [] };
60
- break;
61
- case 23:
62
- m.getLogger().debug("Rule: (nodeStatement link node) ", h[p - 2], h[p - 1], h[p], " typestr: ", h[p - 1].edgeTypeStr);
63
- const V = m.edgeStrToEdgeData(h[p - 1].edgeTypeStr);
64
- this.$ = [
65
- { id: h[p - 2].id, label: h[p - 2].label, type: h[p - 2].type, directions: h[p - 2].directions },
66
- { id: h[p - 2].id + "-" + h[p].id, start: h[p - 2].id, end: h[p].id, label: h[p - 1].label, type: "edge", directions: h[p].directions, arrowTypeEnd: V, arrowTypeStart: "arrow_open" },
67
- { id: h[p].id, label: h[p].label, type: m.typeStr2Type(h[p].typeStr), directions: h[p].directions }
68
- ];
69
- break;
70
- case 24:
71
- m.getLogger().debug("Rule: nodeStatement (abc88 node size) ", h[p - 1], h[p]), this.$ = { id: h[p - 1].id, label: h[p - 1].label, type: m.typeStr2Type(h[p - 1].typeStr), directions: h[p - 1].directions, widthInColumns: parseInt(h[p], 10) };
72
- break;
73
- case 25:
74
- m.getLogger().debug("Rule: nodeStatement (node) ", h[p]), this.$ = { id: h[p].id, label: h[p].label, type: m.typeStr2Type(h[p].typeStr), directions: h[p].directions, widthInColumns: 1 };
75
- break;
76
- case 26:
77
- m.getLogger().debug("APA123", this ? this : "na"), m.getLogger().debug("COLUMNS: ", h[p]), this.$ = { type: "column-setting", columns: h[p] === "auto" ? -1 : parseInt(h[p]) };
78
- break;
79
- case 27:
80
- m.getLogger().debug("Rule: id-block statement : ", h[p - 2], h[p - 1]), m.generateId(), this.$ = { ...h[p - 2], type: "composite", children: h[p - 1] };
81
- break;
82
- case 28:
83
- m.getLogger().debug("Rule: blockStatement : ", h[p - 2], h[p - 1], h[p]);
84
- const at = m.generateId();
85
- this.$ = { id: at, type: "composite", label: "", children: h[p - 1] };
86
- break;
87
- case 29:
88
- m.getLogger().debug("Rule: node (NODE_ID separator): ", h[p]), this.$ = { id: h[p] };
89
- break;
90
- case 30:
91
- m.getLogger().debug("Rule: node (NODE_ID nodeShapeNLabel separator): ", h[p - 1], h[p]), this.$ = { id: h[p - 1], label: h[p].label, typeStr: h[p].typeStr, directions: h[p].directions };
92
- break;
93
- case 31:
94
- m.getLogger().debug("Rule: dirList: ", h[p]), this.$ = [h[p]];
95
- break;
96
- case 32:
97
- m.getLogger().debug("Rule: dirList: ", h[p - 1], h[p]), this.$ = [h[p - 1]].concat(h[p]);
98
- break;
99
- case 33:
100
- m.getLogger().debug("Rule: nodeShapeNLabel: ", h[p - 2], h[p - 1], h[p]), this.$ = { typeStr: h[p - 2] + h[p], label: h[p - 1] };
101
- break;
102
- case 34:
103
- m.getLogger().debug("Rule: BLOCK_ARROW nodeShapeNLabel: ", h[p - 3], h[p - 2], " #3:", h[p - 1], h[p]), this.$ = { typeStr: h[p - 3] + h[p], label: h[p - 2], directions: h[p - 1] };
104
- break;
105
- case 35:
106
- case 36:
107
- this.$ = { type: "classDef", id: h[p - 1].trim(), css: h[p].trim() };
108
- break;
109
- case 37:
110
- this.$ = { type: "applyClass", id: h[p - 1].trim(), styleClass: h[p].trim() };
111
- break;
112
- case 38:
113
- this.$ = { type: "applyStyles", id: h[p - 1].trim(), stylesStr: h[p].trim() };
114
- break;
115
- }
116
- }, "anonymous"),
117
- table: [{ 9: 1, 10: [1, 2] }, { 1: [3] }, { 10: t, 11: 3, 13: 4, 19: 5, 20: 6, 21: a, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 28: i, 29: l, 31: s, 39: r, 43: n, 46: c }, { 8: [1, 20] }, e(u, [2, 12], { 13: 4, 19: 5, 20: 6, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 11: 21, 10: t, 21: a, 28: i, 29: l, 31: s, 39: r, 43: n, 46: c }), e(o, [2, 16], { 14: 22, 15: x, 16: w }), e(o, [2, 17]), e(o, [2, 18]), e(o, [2, 19]), e(o, [2, 20]), e(o, [2, 21]), e(o, [2, 22]), e(b, [2, 25], { 27: [1, 25] }), e(o, [2, 26]), { 19: 26, 26: 12, 31: s }, { 10: t, 11: 27, 13: 4, 19: 5, 20: 6, 21: a, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 28: i, 29: l, 31: s, 39: r, 43: n, 46: c }, { 40: [1, 28], 42: [1, 29] }, { 44: [1, 30] }, { 47: [1, 31] }, e(S, [2, 29], { 32: 32, 35: [1, 33], 37: [1, 34] }), { 1: [2, 7] }, e(u, [2, 13]), { 26: 35, 31: s }, { 31: [2, 14] }, { 17: [1, 36] }, e(b, [2, 24]), { 10: t, 11: 37, 13: 4, 14: 22, 15: x, 16: w, 19: 5, 20: 6, 21: a, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 28: i, 29: l, 31: s, 39: r, 43: n, 46: c }, { 30: [1, 38] }, { 41: [1, 39] }, { 41: [1, 40] }, { 45: [1, 41] }, { 48: [1, 42] }, e(S, [2, 30]), { 18: [1, 43] }, { 18: [1, 44] }, e(b, [2, 23]), { 18: [1, 45] }, { 30: [1, 46] }, e(o, [2, 28]), e(o, [2, 35]), e(o, [2, 36]), e(o, [2, 37]), e(o, [2, 38]), { 36: [1, 47] }, { 33: 48, 34: v }, { 15: [1, 50] }, e(o, [2, 27]), e(S, [2, 33]), { 38: [1, 51] }, { 33: 52, 34: v, 38: [2, 31] }, { 31: [2, 15] }, e(S, [2, 34]), { 38: [2, 32] }],
118
- defaultActions: { 20: [2, 7], 23: [2, 14], 50: [2, 15], 52: [2, 32] },
119
- parseError: /* @__PURE__ */ d(function(y, g) {
120
- if (g.recoverable)
121
- this.trace(y);
122
- else {
123
- var f = new Error(y);
124
- throw f.hash = g, f;
125
- }
126
- }, "parseError"),
127
- parse: /* @__PURE__ */ d(function(y) {
128
- var g = this, f = [0], m = [], E = [null], h = [], W = this.table, p = "", I = 0, Z = 0, V = 2, at = 1, ne = h.slice.call(arguments, 1), z = Object.create(this.lexer), q = { yy: {} };
129
- for (var gt in this.yy)
130
- Object.prototype.hasOwnProperty.call(this.yy, gt) && (q.yy[gt] = this.yy[gt]);
131
- z.setInput(y, q.yy), q.yy.lexer = z, q.yy.parser = this, typeof z.yylloc > "u" && (z.yylloc = {});
132
- var ut = z.yylloc;
133
- h.push(ut);
134
- var le = z.options && z.options.ranges;
135
- typeof q.yy.parseError == "function" ? this.parseError = q.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
136
- function ce(P) {
137
- f.length = f.length - 2 * P, E.length = E.length - P, h.length = h.length - P;
138
- }
139
- d(ce, "popStack");
140
- function Nt() {
141
- var P;
142
- return P = m.pop() || z.lex() || at, typeof P != "number" && (P instanceof Array && (m = P, P = m.pop()), P = g.symbols_[P] || P), P;
143
- }
144
- d(Nt, "lex");
145
- for (var F, J, H, pt, Q = {}, st, G, Tt, it; ; ) {
146
- if (J = f[f.length - 1], this.defaultActions[J] ? H = this.defaultActions[J] : ((F === null || typeof F > "u") && (F = Nt()), H = W[J] && W[J][F]), typeof H > "u" || !H.length || !H[0]) {
147
- var ft = "";
148
- it = [];
149
- for (st in W[J])
150
- this.terminals_[st] && st > V && it.push("'" + this.terminals_[st] + "'");
151
- z.showPosition ? ft = "Parse error on line " + (I + 1) + `:
152
- ` + z.showPosition() + `
153
- Expecting ` + it.join(", ") + ", got '" + (this.terminals_[F] || F) + "'" : ft = "Parse error on line " + (I + 1) + ": Unexpected " + (F == at ? "end of input" : "'" + (this.terminals_[F] || F) + "'"), this.parseError(ft, {
154
- text: z.match,
155
- token: this.terminals_[F] || F,
156
- line: z.yylineno,
157
- loc: ut,
158
- expected: it
159
- });
160
- }
161
- if (H[0] instanceof Array && H.length > 1)
162
- throw new Error("Parse Error: multiple actions possible at state: " + J + ", token: " + F);
163
- switch (H[0]) {
164
- case 1:
165
- f.push(F), E.push(z.yytext), h.push(z.yylloc), f.push(H[1]), F = null, Z = z.yyleng, p = z.yytext, I = z.yylineno, ut = z.yylloc;
166
- break;
167
- case 2:
168
- if (G = this.productions_[H[1]][1], Q.$ = E[E.length - G], Q._$ = {
169
- first_line: h[h.length - (G || 1)].first_line,
170
- last_line: h[h.length - 1].last_line,
171
- first_column: h[h.length - (G || 1)].first_column,
172
- last_column: h[h.length - 1].last_column
173
- }, le && (Q._$.range = [
174
- h[h.length - (G || 1)].range[0],
175
- h[h.length - 1].range[1]
176
- ]), pt = this.performAction.apply(Q, [
177
- p,
178
- Z,
179
- I,
180
- q.yy,
181
- H[1],
182
- E,
183
- h
184
- ].concat(ne)), typeof pt < "u")
185
- return pt;
186
- G && (f = f.slice(0, -1 * G * 2), E = E.slice(0, -1 * G), h = h.slice(0, -1 * G)), f.push(this.productions_[H[1]][0]), E.push(Q.$), h.push(Q._$), Tt = W[f[f.length - 2]][f[f.length - 1]], f.push(Tt);
187
- break;
188
- case 3:
189
- return !0;
190
- }
191
- }
192
- return !0;
193
- }, "parse")
194
- }, B = /* @__PURE__ */ function() {
195
- var D = {
196
- EOF: 1,
197
- parseError: /* @__PURE__ */ d(function(g, f) {
198
- if (this.yy.parser)
199
- this.yy.parser.parseError(g, f);
200
- else
201
- throw new Error(g);
202
- }, "parseError"),
203
- // resets the lexer, sets new input
204
- setInput: /* @__PURE__ */ d(function(y, g) {
205
- return this.yy = g || this.yy || {}, this._input = y, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
206
- first_line: 1,
207
- first_column: 0,
208
- last_line: 1,
209
- last_column: 0
210
- }, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
211
- }, "setInput"),
212
- // consumes and returns one char from the input
213
- input: /* @__PURE__ */ d(function() {
214
- var y = this._input[0];
215
- this.yytext += y, this.yyleng++, this.offset++, this.match += y, this.matched += y;
216
- var g = y.match(/(?:\r\n?|\n).*/g);
217
- return g ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), y;
218
- }, "input"),
219
- // unshifts one char (or a string) into the input
220
- unput: /* @__PURE__ */ d(function(y) {
221
- var g = y.length, f = y.split(/(?:\r\n?|\n)/g);
222
- this._input = y + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - g), this.offset -= g;
223
- var m = this.match.split(/(?:\r\n?|\n)/g);
224
- this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), f.length - 1 && (this.yylineno -= f.length - 1);
225
- var E = this.yylloc.range;
226
- return this.yylloc = {
227
- first_line: this.yylloc.first_line,
228
- last_line: this.yylineno + 1,
229
- first_column: this.yylloc.first_column,
230
- last_column: f ? (f.length === m.length ? this.yylloc.first_column : 0) + m[m.length - f.length].length - f[0].length : this.yylloc.first_column - g
231
- }, this.options.ranges && (this.yylloc.range = [E[0], E[0] + this.yyleng - g]), this.yyleng = this.yytext.length, this;
232
- }, "unput"),
233
- // When called from action, caches matched text and appends it on next action
234
- more: /* @__PURE__ */ d(function() {
235
- return this._more = !0, this;
236
- }, "more"),
237
- // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
238
- reject: /* @__PURE__ */ d(function() {
239
- if (this.options.backtrack_lexer)
240
- this._backtrack = !0;
241
- else
242
- return this.parseError("Lexical error on line " + (this.yylineno + 1) + `. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
243
- ` + this.showPosition(), {
244
- text: "",
245
- token: null,
246
- line: this.yylineno
247
- });
248
- return this;
249
- }, "reject"),
250
- // retain first n characters of the match
251
- less: /* @__PURE__ */ d(function(y) {
252
- this.unput(this.match.slice(y));
253
- }, "less"),
254
- // displays already matched input, i.e. for error messages
255
- pastInput: /* @__PURE__ */ d(function() {
256
- var y = this.matched.substr(0, this.matched.length - this.match.length);
257
- return (y.length > 20 ? "..." : "") + y.substr(-20).replace(/\n/g, "");
258
- }, "pastInput"),
259
- // displays upcoming input, i.e. for error messages
260
- upcomingInput: /* @__PURE__ */ d(function() {
261
- var y = this.match;
262
- return y.length < 20 && (y += this._input.substr(0, 20 - y.length)), (y.substr(0, 20) + (y.length > 20 ? "..." : "")).replace(/\n/g, "");
263
- }, "upcomingInput"),
264
- // displays the character position where the lexing error occurred, i.e. for error messages
265
- showPosition: /* @__PURE__ */ d(function() {
266
- var y = this.pastInput(), g = new Array(y.length + 1).join("-");
267
- return y + this.upcomingInput() + `
268
- ` + g + "^";
269
- }, "showPosition"),
270
- // test the lexed token: return FALSE when not a match, otherwise return token
271
- test_match: /* @__PURE__ */ d(function(y, g) {
272
- var f, m, E;
273
- if (this.options.backtrack_lexer && (E = {
274
- yylineno: this.yylineno,
275
- yylloc: {
276
- first_line: this.yylloc.first_line,
277
- last_line: this.last_line,
278
- first_column: this.yylloc.first_column,
279
- last_column: this.yylloc.last_column
280
- },
281
- yytext: this.yytext,
282
- match: this.match,
283
- matches: this.matches,
284
- matched: this.matched,
285
- yyleng: this.yyleng,
286
- offset: this.offset,
287
- _more: this._more,
288
- _input: this._input,
289
- yy: this.yy,
290
- conditionStack: this.conditionStack.slice(0),
291
- done: this.done
292
- }, this.options.ranges && (E.yylloc.range = this.yylloc.range.slice(0))), m = y[0].match(/(?:\r\n?|\n).*/g), m && (this.yylineno += m.length), this.yylloc = {
293
- first_line: this.yylloc.last_line,
294
- last_line: this.yylineno + 1,
295
- first_column: this.yylloc.last_column,
296
- last_column: m ? m[m.length - 1].length - m[m.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + y[0].length
297
- }, this.yytext += y[0], this.match += y[0], this.matches = y, this.yyleng = this.yytext.length, this.options.ranges && (this.yylloc.range = [this.offset, this.offset += this.yyleng]), this._more = !1, this._backtrack = !1, this._input = this._input.slice(y[0].length), this.matched += y[0], f = this.performAction.call(this, this.yy, this, g, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), f)
298
- return f;
299
- if (this._backtrack) {
300
- for (var h in E)
301
- this[h] = E[h];
302
- return !1;
303
- }
304
- return !1;
305
- }, "test_match"),
306
- // return next match in input
307
- next: /* @__PURE__ */ d(function() {
308
- if (this.done)
309
- return this.EOF;
310
- this._input || (this.done = !0);
311
- var y, g, f, m;
312
- this._more || (this.yytext = "", this.match = "");
313
- for (var E = this._currentRules(), h = 0; h < E.length; h++)
314
- if (f = this._input.match(this.rules[E[h]]), f && (!g || f[0].length > g[0].length)) {
315
- if (g = f, m = h, this.options.backtrack_lexer) {
316
- if (y = this.test_match(f, E[h]), y !== !1)
317
- return y;
318
- if (this._backtrack) {
319
- g = !1;
320
- continue;
321
- } else
322
- return !1;
323
- } else if (!this.options.flex)
324
- break;
325
- }
326
- return g ? (y = this.test_match(g, E[m]), y !== !1 ? y : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
327
- ` + this.showPosition(), {
328
- text: "",
329
- token: null,
330
- line: this.yylineno
331
- });
332
- }, "next"),
333
- // return next match that has a token
334
- lex: /* @__PURE__ */ d(function() {
335
- var g = this.next();
336
- return g || this.lex();
337
- }, "lex"),
338
- // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
339
- begin: /* @__PURE__ */ d(function(g) {
340
- this.conditionStack.push(g);
341
- }, "begin"),
342
- // pop the previously active lexer condition state off the condition stack
343
- popState: /* @__PURE__ */ d(function() {
344
- var g = this.conditionStack.length - 1;
345
- return g > 0 ? this.conditionStack.pop() : this.conditionStack[0];
346
- }, "popState"),
347
- // produce the lexer rule set which is active for the currently active lexer condition state
348
- _currentRules: /* @__PURE__ */ d(function() {
349
- return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
350
- }, "_currentRules"),
351
- // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
352
- topState: /* @__PURE__ */ d(function(g) {
353
- return g = this.conditionStack.length - 1 - Math.abs(g || 0), g >= 0 ? this.conditionStack[g] : "INITIAL";
354
- }, "topState"),
355
- // alias for begin(condition)
356
- pushState: /* @__PURE__ */ d(function(g) {
357
- this.begin(g);
358
- }, "pushState"),
359
- // return the number of states currently on the stack
360
- stateStackSize: /* @__PURE__ */ d(function() {
361
- return this.conditionStack.length;
362
- }, "stateStackSize"),
363
- options: {},
364
- performAction: /* @__PURE__ */ d(function(g, f, m, E) {
365
- switch (m) {
366
- case 0:
367
- return g.getLogger().debug("Found block-beta"), 10;
368
- case 1:
369
- return g.getLogger().debug("Found id-block"), 29;
370
- case 2:
371
- return g.getLogger().debug("Found block"), 10;
372
- case 3:
373
- g.getLogger().debug(".", f.yytext);
374
- break;
375
- case 4:
376
- g.getLogger().debug("_", f.yytext);
377
- break;
378
- case 5:
379
- return 5;
380
- case 6:
381
- return f.yytext = -1, 28;
382
- case 7:
383
- return f.yytext = f.yytext.replace(/columns\s+/, ""), g.getLogger().debug("COLUMNS (LEX)", f.yytext), 28;
384
- case 8:
385
- this.pushState("md_string");
386
- break;
387
- case 9:
388
- return "MD_STR";
389
- case 10:
390
- this.popState();
391
- break;
392
- case 11:
393
- this.pushState("string");
394
- break;
395
- case 12:
396
- g.getLogger().debug("LEX: POPPING STR:", f.yytext), this.popState();
397
- break;
398
- case 13:
399
- return g.getLogger().debug("LEX: STR end:", f.yytext), "STR";
400
- case 14:
401
- return f.yytext = f.yytext.replace(/space\:/, ""), g.getLogger().debug("SPACE NUM (LEX)", f.yytext), 21;
402
- case 15:
403
- return f.yytext = "1", g.getLogger().debug("COLUMNS (LEX)", f.yytext), 21;
404
- case 16:
405
- return 42;
406
- case 17:
407
- return "LINKSTYLE";
408
- case 18:
409
- return "INTERPOLATE";
410
- case 19:
411
- return this.pushState("CLASSDEF"), 39;
412
- case 20:
413
- return this.popState(), this.pushState("CLASSDEFID"), "DEFAULT_CLASSDEF_ID";
414
- case 21:
415
- return this.popState(), this.pushState("CLASSDEFID"), 40;
416
- case 22:
417
- return this.popState(), 41;
418
- case 23:
419
- return this.pushState("CLASS"), 43;
420
- case 24:
421
- return this.popState(), this.pushState("CLASS_STYLE"), 44;
422
- case 25:
423
- return this.popState(), 45;
424
- case 26:
425
- return this.pushState("STYLE_STMNT"), 46;
426
- case 27:
427
- return this.popState(), this.pushState("STYLE_DEFINITION"), 47;
428
- case 28:
429
- return this.popState(), 48;
430
- case 29:
431
- return this.pushState("acc_title"), "acc_title";
432
- case 30:
433
- return this.popState(), "acc_title_value";
434
- case 31:
435
- return this.pushState("acc_descr"), "acc_descr";
436
- case 32:
437
- return this.popState(), "acc_descr_value";
438
- case 33:
439
- this.pushState("acc_descr_multiline");
440
- break;
441
- case 34:
442
- this.popState();
443
- break;
444
- case 35:
445
- return "acc_descr_multiline_value";
446
- case 36:
447
- return 30;
448
- case 37:
449
- return this.popState(), g.getLogger().debug("Lex: (("), "NODE_DEND";
450
- case 38:
451
- return this.popState(), g.getLogger().debug("Lex: (("), "NODE_DEND";
452
- case 39:
453
- return this.popState(), g.getLogger().debug("Lex: ))"), "NODE_DEND";
454
- case 40:
455
- return this.popState(), g.getLogger().debug("Lex: (("), "NODE_DEND";
456
- case 41:
457
- return this.popState(), g.getLogger().debug("Lex: (("), "NODE_DEND";
458
- case 42:
459
- return this.popState(), g.getLogger().debug("Lex: (-"), "NODE_DEND";
460
- case 43:
461
- return this.popState(), g.getLogger().debug("Lex: -)"), "NODE_DEND";
462
- case 44:
463
- return this.popState(), g.getLogger().debug("Lex: (("), "NODE_DEND";
464
- case 45:
465
- return this.popState(), g.getLogger().debug("Lex: ]]"), "NODE_DEND";
466
- case 46:
467
- return this.popState(), g.getLogger().debug("Lex: ("), "NODE_DEND";
468
- case 47:
469
- return this.popState(), g.getLogger().debug("Lex: ])"), "NODE_DEND";
470
- case 48:
471
- return this.popState(), g.getLogger().debug("Lex: /]"), "NODE_DEND";
472
- case 49:
473
- return this.popState(), g.getLogger().debug("Lex: /]"), "NODE_DEND";
474
- case 50:
475
- return this.popState(), g.getLogger().debug("Lex: )]"), "NODE_DEND";
476
- case 51:
477
- return this.popState(), g.getLogger().debug("Lex: )"), "NODE_DEND";
478
- case 52:
479
- return this.popState(), g.getLogger().debug("Lex: ]>"), "NODE_DEND";
480
- case 53:
481
- return this.popState(), g.getLogger().debug("Lex: ]"), "NODE_DEND";
482
- case 54:
483
- return g.getLogger().debug("Lexa: -)"), this.pushState("NODE"), 35;
484
- case 55:
485
- return g.getLogger().debug("Lexa: (-"), this.pushState("NODE"), 35;
486
- case 56:
487
- return g.getLogger().debug("Lexa: ))"), this.pushState("NODE"), 35;
488
- case 57:
489
- return g.getLogger().debug("Lexa: )"), this.pushState("NODE"), 35;
490
- case 58:
491
- return g.getLogger().debug("Lex: ((("), this.pushState("NODE"), 35;
492
- case 59:
493
- return g.getLogger().debug("Lexa: )"), this.pushState("NODE"), 35;
494
- case 60:
495
- return g.getLogger().debug("Lexa: )"), this.pushState("NODE"), 35;
496
- case 61:
497
- return g.getLogger().debug("Lexa: )"), this.pushState("NODE"), 35;
498
- case 62:
499
- return g.getLogger().debug("Lexc: >"), this.pushState("NODE"), 35;
500
- case 63:
501
- return g.getLogger().debug("Lexa: (["), this.pushState("NODE"), 35;
502
- case 64:
503
- return g.getLogger().debug("Lexa: )"), this.pushState("NODE"), 35;
504
- case 65:
505
- return this.pushState("NODE"), 35;
506
- case 66:
507
- return this.pushState("NODE"), 35;
508
- case 67:
509
- return this.pushState("NODE"), 35;
510
- case 68:
511
- return this.pushState("NODE"), 35;
512
- case 69:
513
- return this.pushState("NODE"), 35;
514
- case 70:
515
- return this.pushState("NODE"), 35;
516
- case 71:
517
- return this.pushState("NODE"), 35;
518
- case 72:
519
- return g.getLogger().debug("Lexa: ["), this.pushState("NODE"), 35;
520
- case 73:
521
- return this.pushState("BLOCK_ARROW"), g.getLogger().debug("LEX ARR START"), 37;
522
- case 74:
523
- return g.getLogger().debug("Lex: NODE_ID", f.yytext), 31;
524
- case 75:
525
- return g.getLogger().debug("Lex: EOF", f.yytext), 8;
526
- case 76:
527
- this.pushState("md_string");
528
- break;
529
- case 77:
530
- this.pushState("md_string");
531
- break;
532
- case 78:
533
- return "NODE_DESCR";
534
- case 79:
535
- this.popState();
536
- break;
537
- case 80:
538
- g.getLogger().debug("Lex: Starting string"), this.pushState("string");
539
- break;
540
- case 81:
541
- g.getLogger().debug("LEX ARR: Starting string"), this.pushState("string");
542
- break;
543
- case 82:
544
- return g.getLogger().debug("LEX: NODE_DESCR:", f.yytext), "NODE_DESCR";
545
- case 83:
546
- g.getLogger().debug("LEX POPPING"), this.popState();
547
- break;
548
- case 84:
549
- g.getLogger().debug("Lex: =>BAE"), this.pushState("ARROW_DIR");
550
- break;
551
- case 85:
552
- return f.yytext = f.yytext.replace(/^,\s*/, ""), g.getLogger().debug("Lex (right): dir:", f.yytext), "DIR";
553
- case 86:
554
- return f.yytext = f.yytext.replace(/^,\s*/, ""), g.getLogger().debug("Lex (left):", f.yytext), "DIR";
555
- case 87:
556
- return f.yytext = f.yytext.replace(/^,\s*/, ""), g.getLogger().debug("Lex (x):", f.yytext), "DIR";
557
- case 88:
558
- return f.yytext = f.yytext.replace(/^,\s*/, ""), g.getLogger().debug("Lex (y):", f.yytext), "DIR";
559
- case 89:
560
- return f.yytext = f.yytext.replace(/^,\s*/, ""), g.getLogger().debug("Lex (up):", f.yytext), "DIR";
561
- case 90:
562
- return f.yytext = f.yytext.replace(/^,\s*/, ""), g.getLogger().debug("Lex (down):", f.yytext), "DIR";
563
- case 91:
564
- return f.yytext = "]>", g.getLogger().debug("Lex (ARROW_DIR end):", f.yytext), this.popState(), this.popState(), "BLOCK_ARROW_END";
565
- case 92:
566
- return g.getLogger().debug("Lex: LINK", "#" + f.yytext + "#"), 15;
567
- case 93:
568
- return g.getLogger().debug("Lex: LINK", f.yytext), 15;
569
- case 94:
570
- return g.getLogger().debug("Lex: LINK", f.yytext), 15;
571
- case 95:
572
- return g.getLogger().debug("Lex: LINK", f.yytext), 15;
573
- case 96:
574
- return g.getLogger().debug("Lex: START_LINK", f.yytext), this.pushState("LLABEL"), 16;
575
- case 97:
576
- return g.getLogger().debug("Lex: START_LINK", f.yytext), this.pushState("LLABEL"), 16;
577
- case 98:
578
- return g.getLogger().debug("Lex: START_LINK", f.yytext), this.pushState("LLABEL"), 16;
579
- case 99:
580
- this.pushState("md_string");
581
- break;
582
- case 100:
583
- return g.getLogger().debug("Lex: Starting string"), this.pushState("string"), "LINK_LABEL";
584
- case 101:
585
- return this.popState(), g.getLogger().debug("Lex: LINK", "#" + f.yytext + "#"), 15;
586
- case 102:
587
- return this.popState(), g.getLogger().debug("Lex: LINK", f.yytext), 15;
588
- case 103:
589
- return this.popState(), g.getLogger().debug("Lex: LINK", f.yytext), 15;
590
- case 104:
591
- return g.getLogger().debug("Lex: COLON", f.yytext), f.yytext = f.yytext.slice(1), 27;
592
- }
593
- }, "anonymous"),
594
- rules: [/^(?:block-beta\b)/, /^(?:block:)/, /^(?:block\b)/, /^(?:[\s]+)/, /^(?:[\n]+)/, /^(?:((\u000D\u000A)|(\u000A)))/, /^(?:columns\s+auto\b)/, /^(?:columns\s+[\d]+)/, /^(?:["][`])/, /^(?:[^`"]+)/, /^(?:[`]["])/, /^(?:["])/, /^(?:["])/, /^(?:[^"]*)/, /^(?:space[:]\d+)/, /^(?:space\b)/, /^(?:default\b)/, /^(?:linkStyle\b)/, /^(?:interpolate\b)/, /^(?:classDef\s+)/, /^(?:DEFAULT\s+)/, /^(?:\w+\s+)/, /^(?:[^\n]*)/, /^(?:class\s+)/, /^(?:(\w+)+((,\s*\w+)*))/, /^(?:[^\n]*)/, /^(?:style\s+)/, /^(?:(\w+)+((,\s*\w+)*))/, /^(?:[^\n]*)/, /^(?:accTitle\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*\{\s*)/, /^(?:[\}])/, /^(?:[^\}]*)/, /^(?:end\b\s*)/, /^(?:\(\(\()/, /^(?:\)\)\))/, /^(?:[\)]\))/, /^(?:\}\})/, /^(?:\})/, /^(?:\(-)/, /^(?:-\))/, /^(?:\(\()/, /^(?:\]\])/, /^(?:\()/, /^(?:\]\))/, /^(?:\\\])/, /^(?:\/\])/, /^(?:\)\])/, /^(?:[\)])/, /^(?:\]>)/, /^(?:[\]])/, /^(?:-\))/, /^(?:\(-)/, /^(?:\)\))/, /^(?:\))/, /^(?:\(\(\()/, /^(?:\(\()/, /^(?:\{\{)/, /^(?:\{)/, /^(?:>)/, /^(?:\(\[)/, /^(?:\()/, /^(?:\[\[)/, /^(?:\[\|)/, /^(?:\[\()/, /^(?:\)\)\))/, /^(?:\[\\)/, /^(?:\[\/)/, /^(?:\[\\)/, /^(?:\[)/, /^(?:<\[)/, /^(?:[^\(\[\n\-\)\{\}\s\<\>:]+)/, /^(?:$)/, /^(?:["][`])/, /^(?:["][`])/, /^(?:[^`"]+)/, /^(?:[`]["])/, /^(?:["])/, /^(?:["])/, /^(?:[^"]+)/, /^(?:["])/, /^(?:\]>\s*\()/, /^(?:,?\s*right\s*)/, /^(?:,?\s*left\s*)/, /^(?:,?\s*x\s*)/, /^(?:,?\s*y\s*)/, /^(?:,?\s*up\s*)/, /^(?:,?\s*down\s*)/, /^(?:\)\s*)/, /^(?:\s*[xo<]?--+[-xo>]\s*)/, /^(?:\s*[xo<]?==+[=xo>]\s*)/, /^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/, /^(?:\s*~~[\~]+\s*)/, /^(?:\s*[xo<]?--\s*)/, /^(?:\s*[xo<]?==\s*)/, /^(?:\s*[xo<]?-\.\s*)/, /^(?:["][`])/, /^(?:["])/, /^(?:\s*[xo<]?--+[-xo>]\s*)/, /^(?:\s*[xo<]?==+[=xo>]\s*)/, /^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/, /^(?::\d+)/],
595
- conditions: { STYLE_DEFINITION: { rules: [28], inclusive: !1 }, STYLE_STMNT: { rules: [27], inclusive: !1 }, CLASSDEFID: { rules: [22], inclusive: !1 }, CLASSDEF: { rules: [20, 21], inclusive: !1 }, CLASS_STYLE: { rules: [25], inclusive: !1 }, CLASS: { rules: [24], inclusive: !1 }, LLABEL: { rules: [99, 100, 101, 102, 103], inclusive: !1 }, ARROW_DIR: { rules: [85, 86, 87, 88, 89, 90, 91], inclusive: !1 }, BLOCK_ARROW: { rules: [76, 81, 84], inclusive: !1 }, NODE: { rules: [37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 77, 80], inclusive: !1 }, md_string: { rules: [9, 10, 78, 79], inclusive: !1 }, space: { rules: [], inclusive: !1 }, string: { rules: [12, 13, 82, 83], inclusive: !1 }, acc_descr_multiline: { rules: [34, 35], inclusive: !1 }, acc_descr: { rules: [32], inclusive: !1 }, acc_title: { rules: [30], inclusive: !1 }, INITIAL: { rules: [0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 14, 15, 16, 17, 18, 19, 23, 26, 29, 31, 33, 36, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 92, 93, 94, 95, 96, 97, 98, 104], inclusive: !0 } }
596
- };
597
- return D;
598
- }();
599
- k.lexer = B;
600
- function _() {
601
- this.yy = {};
602
- }
603
- return d(_, "Parser"), _.prototype = k, k.Parser = _, new _();
604
- }();
605
- bt.parser = bt;
606
- var ve = bt, X = /* @__PURE__ */ new Map(), kt = [], wt = /* @__PURE__ */ new Map(), Bt = "color", Ct = "fill", Ee = "bgFill", Pt = ",", _e = R(), ct = /* @__PURE__ */ new Map(), De = /* @__PURE__ */ d((e) => be.sanitizeText(e, _e), "sanitizeText"), Ne = /* @__PURE__ */ d(function(e, t = "") {
607
- let a = ct.get(e);
608
- a || (a = { id: e, styles: [], textStyles: [] }, ct.set(e, a)), t?.split(Pt).forEach((i) => {
609
- const l = i.replace(/([^;]*);/, "$1").trim();
610
- if (RegExp(Bt).exec(i)) {
611
- const r = l.replace(Ct, Ee).replace(Bt, Ct);
612
- a.textStyles.push(r);
613
- }
614
- a.styles.push(l);
615
- });
616
- }, "addStyleClass"), Te = /* @__PURE__ */ d(function(e, t = "") {
617
- const a = X.get(e);
618
- t != null && (a.styles = t.split(Pt));
619
- }, "addStyle2Node"), Be = /* @__PURE__ */ d(function(e, t) {
620
- e.split(",").forEach(function(a) {
621
- let i = X.get(a);
622
- if (i === void 0) {
623
- const l = a.trim();
624
- i = { id: l, type: "na", children: [] }, X.set(l, i);
625
- }
626
- i.classes || (i.classes = []), i.classes.push(t);
627
- });
628
- }, "setCssClass"), Yt = /* @__PURE__ */ d((e, t) => {
629
- const a = e.flat(), i = [], s = a.find((r) => r?.type === "column-setting")?.columns ?? -1;
630
- for (const r of a) {
631
- if (typeof s == "number" && s > 0 && r.type !== "column-setting" && typeof r.widthInColumns == "number" && r.widthInColumns > s && L.warn(
632
- `Block ${r.id} width ${r.widthInColumns} exceeds configured column width ${s}`
633
- ), r.label && (r.label = De(r.label)), r.type === "classDef") {
634
- Ne(r.id, r.css);
635
- continue;
636
- }
637
- if (r.type === "applyClass") {
638
- Be(r.id, r?.styleClass ?? "");
639
- continue;
640
- }
641
- if (r.type === "applyStyles") {
642
- r?.stylesStr && Te(r.id, r?.stylesStr);
643
- continue;
644
- }
645
- if (r.type === "column-setting")
646
- t.columns = r.columns ?? -1;
647
- else if (r.type === "edge") {
648
- const n = (wt.get(r.id) ?? 0) + 1;
649
- wt.set(r.id, n), r.id = n + "-" + r.id, kt.push(r);
650
- } else {
651
- r.label || (r.type === "composite" ? r.label = "" : r.label = r.id);
652
- const n = X.get(r.id);
653
- if (n === void 0 ? X.set(r.id, r) : (r.type !== "na" && (n.type = r.type), r.label !== r.id && (n.label = r.label)), r.children && Yt(r.children, r), r.type === "space") {
654
- const c = r.width ?? 1;
655
- for (let u = 0; u < c; u++) {
656
- const o = Le(r);
657
- o.id = o.id + "-" + u, X.set(o.id, o), i.push(o);
658
- }
659
- } else n === void 0 && i.push(r);
660
- }
661
- }
662
- t.children = i;
663
- }, "populateBlockDatabase"), vt = [], et = { id: "root", type: "composite", children: [], columns: -1 }, Ce = /* @__PURE__ */ d(() => {
664
- L.debug("Clear called"), de(), et = { id: "root", type: "composite", children: [], columns: -1 }, X = /* @__PURE__ */ new Map([["root", et]]), vt = [], ct = /* @__PURE__ */ new Map(), kt = [], wt = /* @__PURE__ */ new Map();
665
- }, "clear");
666
- function Ht(e) {
667
- switch (L.debug("typeStr2Type", e), e) {
668
- case "[]":
669
- return "square";
670
- case "()":
671
- return L.debug("we have a round"), "round";
672
- case "(())":
673
- return "circle";
674
- case ">]":
675
- return "rect_left_inv_arrow";
676
- case "{}":
677
- return "diamond";
678
- case "{{}}":
679
- return "hexagon";
680
- case "([])":
681
- return "stadium";
682
- case "[[]]":
683
- return "subroutine";
684
- case "[()]":
685
- return "cylinder";
686
- case "((()))":
687
- return "doublecircle";
688
- case "[//]":
689
- return "lean_right";
690
- case "[\\\\]":
691
- return "lean_left";
692
- case "[/\\]":
693
- return "trapezoid";
694
- case "[\\/]":
695
- return "inv_trapezoid";
696
- case "<[]>":
697
- return "block_arrow";
698
- default:
699
- return "na";
700
- }
701
- }
702
- d(Ht, "typeStr2Type");
703
- function Kt(e) {
704
- switch (L.debug("typeStr2Type", e), e) {
705
- case "==":
706
- return "thick";
707
- default:
708
- return "normal";
709
- }
710
- }
711
- d(Kt, "edgeTypeStr2Type");
712
- function Xt(e) {
713
- switch (e.replace(/^[\s-]+|[\s-]+$/g, "")) {
714
- case "x":
715
- return "arrow_cross";
716
- case "o":
717
- return "arrow_circle";
718
- case ">":
719
- return "arrow_point";
720
- default:
721
- return "";
722
- }
723
- }
724
- d(Xt, "edgeStrToEdgeData");
725
- var It = 0, Ie = /* @__PURE__ */ d(() => (It++, "id-" + Math.random().toString(36).substr(2, 12) + "-" + It), "generateId"), Oe = /* @__PURE__ */ d((e) => {
726
- et.children = e, Yt(e, et), vt = et.children;
727
- }, "setHierarchy"), Re = /* @__PURE__ */ d((e) => {
728
- const t = X.get(e);
729
- return t ? t.columns ? t.columns : t.children ? t.children.length : -1 : -1;
730
- }, "getColumns"), ze = /* @__PURE__ */ d(() => [...X.values()], "getBlocksFlat"), Ae = /* @__PURE__ */ d(() => vt || [], "getBlocks"), Me = /* @__PURE__ */ d(() => kt, "getEdges"), Fe = /* @__PURE__ */ d((e) => X.get(e), "getBlock"), We = /* @__PURE__ */ d((e) => {
731
- X.set(e.id, e);
732
- }, "setBlock"), Pe = /* @__PURE__ */ d(() => L, "getLogger"), Ye = /* @__PURE__ */ d(function() {
733
- return ct;
734
- }, "getClasses"), He = {
735
- getConfig: /* @__PURE__ */ d(() => rt().block, "getConfig"),
736
- typeStr2Type: Ht,
737
- edgeTypeStr2Type: Kt,
738
- edgeStrToEdgeData: Xt,
739
- getLogger: Pe,
740
- getBlocksFlat: ze,
741
- getBlocks: Ae,
742
- getEdges: Me,
743
- setHierarchy: Oe,
744
- getBlock: Fe,
745
- setBlock: We,
746
- getColumns: Re,
747
- getClasses: Ye,
748
- clear: Ce,
749
- generateId: Ie
750
- }, Ke = He, nt = /* @__PURE__ */ d((e, t) => {
751
- const a = ke, i = a(e, "r"), l = a(e, "g"), s = a(e, "b");
752
- return ge(i, l, s, t);
753
- }, "fade"), Xe = /* @__PURE__ */ d((e) => `.label {
754
- font-family: ${e.fontFamily};
755
- color: ${e.nodeTextColor || e.textColor};
756
- }
757
- .cluster-label text {
758
- fill: ${e.titleColor};
759
- }
760
- .cluster-label span,p {
761
- color: ${e.titleColor};
762
- }
763
-
764
-
765
-
766
- .label text,span,p {
767
- fill: ${e.nodeTextColor || e.textColor};
768
- color: ${e.nodeTextColor || e.textColor};
769
- }
770
-
771
- .node rect,
772
- .node circle,
773
- .node ellipse,
774
- .node polygon,
775
- .node path {
776
- fill: ${e.mainBkg};
777
- stroke: ${e.nodeBorder};
778
- stroke-width: 1px;
779
- }
780
- .flowchart-label text {
781
- text-anchor: middle;
782
- }
783
- // .flowchart-label .text-outer-tspan {
784
- // text-anchor: middle;
785
- // }
786
- // .flowchart-label .text-inner-tspan {
787
- // text-anchor: start;
788
- // }
789
-
790
- .node .label {
791
- text-align: center;
792
- }
793
- .node.clickable {
794
- cursor: pointer;
795
- }
796
-
797
- .arrowheadPath {
798
- fill: ${e.arrowheadColor};
799
- }
800
-
801
- .edgePath .path {
802
- stroke: ${e.lineColor};
803
- stroke-width: 2.0px;
804
- }
805
-
806
- .flowchart-link {
807
- stroke: ${e.lineColor};
808
- fill: none;
809
- }
810
-
811
- .edgeLabel {
812
- background-color: ${e.edgeLabelBackground};
813
- rect {
814
- opacity: 0.5;
815
- background-color: ${e.edgeLabelBackground};
816
- fill: ${e.edgeLabelBackground};
817
- }
818
- text-align: center;
819
- }
820
-
821
- /* For html labels only */
822
- .labelBkg {
823
- background-color: ${nt(e.edgeLabelBackground, 0.5)};
824
- // background-color:
825
- }
826
-
827
- .node .cluster {
828
- // fill: ${nt(e.mainBkg, 0.5)};
829
- fill: ${nt(e.clusterBkg, 0.5)};
830
- stroke: ${nt(e.clusterBorder, 0.2)};
831
- box-shadow: rgba(50, 50, 93, 0.25) 0px 13px 27px -5px, rgba(0, 0, 0, 0.3) 0px 8px 16px -8px;
832
- stroke-width: 1px;
833
- }
834
-
835
- .cluster text {
836
- fill: ${e.titleColor};
837
- }
838
-
839
- .cluster span,p {
840
- color: ${e.titleColor};
841
- }
842
- /* .cluster div {
843
- color: ${e.titleColor};
844
- } */
845
-
846
- div.mermaidTooltip {
847
- position: absolute;
848
- text-align: center;
849
- max-width: 200px;
850
- padding: 2px;
851
- font-family: ${e.fontFamily};
852
- font-size: 12px;
853
- background: ${e.tertiaryColor};
854
- border: 1px solid ${e.border2};
855
- border-radius: 2px;
856
- pointer-events: none;
857
- z-index: 100;
858
- }
859
-
860
- .flowchartTitleText {
861
- text-anchor: middle;
862
- font-size: 18px;
863
- fill: ${e.textColor};
864
- }
865
- ${oe()}
866
- `, "getStyles"), Ue = Xe, je = /* @__PURE__ */ d((e, t, a, i) => {
867
- t.forEach((l) => {
868
- rr[l](e, a, i);
869
- });
870
- }, "insertMarkers"), Ve = /* @__PURE__ */ d((e, t, a) => {
871
- L.trace("Making markers for ", a), e.append("defs").append("marker").attr("id", a + "_" + t + "-extensionStart").attr("class", "marker extension " + t).attr("refX", 18).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 1,7 L18,13 V 1 Z"), e.append("defs").append("marker").attr("id", a + "_" + t + "-extensionEnd").attr("class", "marker extension " + t).attr("refX", 1).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 1,1 V 13 L18,7 Z");
872
- }, "extension"), Ge = /* @__PURE__ */ d((e, t, a) => {
873
- e.append("defs").append("marker").attr("id", a + "_" + t + "-compositionStart").attr("class", "marker composition " + t).attr("refX", 18).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), e.append("defs").append("marker").attr("id", a + "_" + t + "-compositionEnd").attr("class", "marker composition " + t).attr("refX", 1).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
874
- }, "composition"), Ze = /* @__PURE__ */ d((e, t, a) => {
875
- e.append("defs").append("marker").attr("id", a + "_" + t + "-aggregationStart").attr("class", "marker aggregation " + t).attr("refX", 18).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), e.append("defs").append("marker").attr("id", a + "_" + t + "-aggregationEnd").attr("class", "marker aggregation " + t).attr("refX", 1).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
876
- }, "aggregation"), qe = /* @__PURE__ */ d((e, t, a) => {
877
- e.append("defs").append("marker").attr("id", a + "_" + t + "-dependencyStart").attr("class", "marker dependency " + t).attr("refX", 6).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 5,7 L9,13 L1,7 L9,1 Z"), e.append("defs").append("marker").attr("id", a + "_" + t + "-dependencyEnd").attr("class", "marker dependency " + t).attr("refX", 13).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L14,7 L9,1 Z");
878
- }, "dependency"), Je = /* @__PURE__ */ d((e, t, a) => {
879
- e.append("defs").append("marker").attr("id", a + "_" + t + "-lollipopStart").attr("class", "marker lollipop " + t).attr("refX", 13).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("circle").attr("stroke", "black").attr("fill", "transparent").attr("cx", 7).attr("cy", 7).attr("r", 6), e.append("defs").append("marker").attr("id", a + "_" + t + "-lollipopEnd").attr("class", "marker lollipop " + t).attr("refX", 1).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("circle").attr("stroke", "black").attr("fill", "transparent").attr("cx", 7).attr("cy", 7).attr("r", 6);
880
- }, "lollipop"), Qe = /* @__PURE__ */ d((e, t, a) => {
881
- e.append("marker").attr("id", a + "_" + t + "-pointEnd").attr("class", "marker " + t).attr("viewBox", "0 0 10 10").attr("refX", 6).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto").append("path").attr("d", "M 0 0 L 10 5 L 0 10 z").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0"), e.append("marker").attr("id", a + "_" + t + "-pointStart").attr("class", "marker " + t).attr("viewBox", "0 0 10 10").attr("refX", 4.5).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto").append("path").attr("d", "M 0 5 L 10 10 L 10 0 z").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0");
882
- }, "point"), $e = /* @__PURE__ */ d((e, t, a) => {
883
- e.append("marker").attr("id", a + "_" + t + "-circleEnd").attr("class", "marker " + t).attr("viewBox", "0 0 10 10").attr("refX", 11).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("circle").attr("cx", "5").attr("cy", "5").attr("r", "5").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0"), e.append("marker").attr("id", a + "_" + t + "-circleStart").attr("class", "marker " + t).attr("viewBox", "0 0 10 10").attr("refX", -1).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("circle").attr("cx", "5").attr("cy", "5").attr("r", "5").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0");
884
- }, "circle"), tr = /* @__PURE__ */ d((e, t, a) => {
885
- e.append("marker").attr("id", a + "_" + t + "-crossEnd").attr("class", "marker cross " + t).attr("viewBox", "0 0 11 11").attr("refX", 12).attr("refY", 5.2).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("path").attr("d", "M 1,1 l 9,9 M 10,1 l -9,9").attr("class", "arrowMarkerPath").style("stroke-width", 2).style("stroke-dasharray", "1,0"), e.append("marker").attr("id", a + "_" + t + "-crossStart").attr("class", "marker cross " + t).attr("viewBox", "0 0 11 11").attr("refX", -1).attr("refY", 5.2).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("path").attr("d", "M 1,1 l 9,9 M 10,1 l -9,9").attr("class", "arrowMarkerPath").style("stroke-width", 2).style("stroke-dasharray", "1,0");
886
- }, "cross"), er = /* @__PURE__ */ d((e, t, a) => {
887
- e.append("defs").append("marker").attr("id", a + "_" + t + "-barbEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 14).attr("markerUnits", "strokeWidth").attr("orient", "auto").append("path").attr("d", "M 19,7 L9,13 L14,7 L9,1 Z");
888
- }, "barb"), rr = {
889
- extension: Ve,
890
- composition: Ge,
891
- aggregation: Ze,
892
- dependency: qe,
893
- lollipop: Je,
894
- point: Qe,
895
- circle: $e,
896
- cross: tr,
897
- barb: er
898
- }, ar = je, C = R()?.block?.padding ?? 8;
899
- function Ut(e, t) {
900
- if (e === 0 || !Number.isInteger(e))
901
- throw new Error("Columns must be an integer !== 0.");
902
- if (t < 0 || !Number.isInteger(t))
903
- throw new Error("Position must be a non-negative integer." + t);
904
- if (e < 0)
905
- return { px: t, py: 0 };
906
- if (e === 1)
907
- return { px: 0, py: t };
908
- const a = t % e, i = Math.floor(t / e);
909
- return { px: a, py: i };
910
- }
911
- d(Ut, "calculateBlockPosition");
912
- var sr = /* @__PURE__ */ d((e) => {
913
- let t = 0, a = 0;
914
- for (const i of e.children) {
915
- const { width: l, height: s, x: r, y: n } = i.size ?? { width: 0, height: 0, x: 0, y: 0 };
916
- L.debug(
917
- "getMaxChildSize abc95 child:",
918
- i.id,
919
- "width:",
920
- l,
921
- "height:",
922
- s,
923
- "x:",
924
- r,
925
- "y:",
926
- n,
927
- i.type
928
- ), i.type !== "space" && (l > t && (t = l / (e.widthInColumns ?? 1)), s > a && (a = s));
929
- }
930
- return { width: t, height: a };
931
- }, "getMaxChildSize");
932
- function ot(e, t, a = 0, i = 0) {
933
- L.debug(
934
- "setBlockSizes abc95 (start)",
935
- e.id,
936
- e?.size?.x,
937
- "block width =",
938
- e?.size,
939
- "siblingWidth",
940
- a
941
- ), e?.size?.width || (e.size = {
942
- width: a,
943
- height: i,
944
- x: 0,
945
- y: 0
946
- });
947
- let l = 0, s = 0;
948
- if (e.children?.length > 0) {
949
- for (const b of e.children)
950
- ot(b, t);
951
- const r = sr(e);
952
- l = r.width, s = r.height, L.debug("setBlockSizes abc95 maxWidth of", e.id, ":s children is ", l, s);
953
- for (const b of e.children)
954
- b.size && (L.debug(
955
- `abc95 Setting size of children of ${e.id} id=${b.id} ${l} ${s} ${JSON.stringify(b.size)}`
956
- ), b.size.width = l * (b.widthInColumns ?? 1) + C * ((b.widthInColumns ?? 1) - 1), b.size.height = s, b.size.x = 0, b.size.y = 0, L.debug(
957
- `abc95 updating size of ${e.id} children child:${b.id} maxWidth:${l} maxHeight:${s}`
958
- ));
959
- for (const b of e.children)
960
- ot(b, t, l, s);
961
- const n = e.columns ?? -1;
962
- let c = 0;
963
- for (const b of e.children)
964
- c += b.widthInColumns ?? 1;
965
- let u = e.children.length;
966
- n > 0 && n < c && (u = n);
967
- const o = Math.ceil(c / u);
968
- let x = u * (l + C) + C, w = o * (s + C) + C;
969
- if (x < a) {
970
- L.debug(
971
- `Detected to small sibling: abc95 ${e.id} siblingWidth ${a} siblingHeight ${i} width ${x}`
972
- ), x = a, w = i;
973
- const b = (a - u * C - C) / u, S = (i - o * C - C) / o;
974
- L.debug("Size indata abc88", e.id, "childWidth", b, "maxWidth", l), L.debug("Size indata abc88", e.id, "childHeight", S, "maxHeight", s), L.debug("Size indata abc88 xSize", u, "padding", C);
975
- for (const v of e.children)
976
- v.size && (v.size.width = b, v.size.height = S, v.size.x = 0, v.size.y = 0);
977
- }
978
- if (L.debug(
979
- `abc95 (finale calc) ${e.id} xSize ${u} ySize ${o} columns ${n}${e.children.length} width=${Math.max(x, e.size?.width || 0)}`
980
- ), x < (e?.size?.width || 0)) {
981
- x = e?.size?.width || 0;
982
- const b = n > 0 ? Math.min(e.children.length, n) : e.children.length;
983
- if (b > 0) {
984
- const S = (x - b * C - C) / b;
985
- L.debug("abc95 (growing to fit) width", e.id, x, e.size?.width, S);
986
- for (const v of e.children)
987
- v.size && (v.size.width = S);
988
- }
989
- }
990
- e.size = {
991
- width: x,
992
- height: w,
993
- x: 0,
994
- y: 0
995
- };
996
- }
997
- L.debug(
998
- "setBlockSizes abc94 (done)",
999
- e.id,
1000
- e?.size?.x,
1001
- e?.size?.width,
1002
- e?.size?.y,
1003
- e?.size?.height
1004
- );
1005
- }
1006
- d(ot, "setBlockSizes");
1007
- function Et(e, t) {
1008
- L.debug(
1009
- `abc85 layout blocks (=>layoutBlocks) ${e.id} x: ${e?.size?.x} y: ${e?.size?.y} width: ${e?.size?.width}`
1010
- );
1011
- const a = e.columns ?? -1;
1012
- if (L.debug("layoutBlocks columns abc95", e.id, "=>", a, e), e.children && // find max width of children
1013
- e.children.length > 0) {
1014
- const i = e?.children[0]?.size?.width ?? 0, l = e.children.length * i + (e.children.length - 1) * C;
1015
- L.debug("widthOfChildren 88", l, "posX");
1016
- let s = 0;
1017
- L.debug("abc91 block?.size?.x", e.id, e?.size?.x);
1018
- let r = e?.size?.x ? e?.size?.x + (-e?.size?.width / 2 || 0) : -C, n = 0;
1019
- for (const c of e.children) {
1020
- const u = e;
1021
- if (!c.size)
1022
- continue;
1023
- const { width: o, height: x } = c.size, { px: w, py: b } = Ut(a, s);
1024
- if (b != n && (n = b, r = e?.size?.x ? e?.size?.x + (-e?.size?.width / 2 || 0) : -C, L.debug("New row in layout for block", e.id, " and child ", c.id, n)), L.debug(
1025
- `abc89 layout blocks (child) id: ${c.id} Pos: ${s} (px, py) ${w},${b} (${u?.size?.x},${u?.size?.y}) parent: ${u.id} width: ${o}${C}`
1026
- ), u.size) {
1027
- const v = o / 2;
1028
- c.size.x = r + C + v, L.debug(
1029
- `abc91 layout blocks (calc) px, pyid:${c.id} startingPos=X${r} new startingPosX${c.size.x} ${v} padding=${C} width=${o} halfWidth=${v} => x:${c.size.x} y:${c.size.y} ${c.widthInColumns} (width * (child?.w || 1)) / 2 ${o * (c?.widthInColumns ?? 1) / 2}`
1030
- ), r = c.size.x + v, c.size.y = u.size.y - u.size.height / 2 + b * (x + C) + x / 2 + C, L.debug(
1031
- `abc88 layout blocks (calc) px, pyid:${c.id}startingPosX${r}${C}${v}=>x:${c.size.x}y:${c.size.y}${c.widthInColumns}(width * (child?.w || 1)) / 2${o * (c?.widthInColumns ?? 1) / 2}`
1032
- );
1033
- }
1034
- c.children && Et(c);
1035
- let S = c?.widthInColumns ?? 1;
1036
- a > 0 && (S = Math.min(S, a - s % a)), s += S, L.debug("abc88 columnsPos", c, s);
1037
- }
1038
- }
1039
- L.debug(
1040
- `layout blocks (<==layoutBlocks) ${e.id} x: ${e?.size?.x} y: ${e?.size?.y} width: ${e?.size?.width}`
1041
- );
1042
- }
1043
- d(Et, "layoutBlocks");
1044
- function _t(e, { minX: t, minY: a, maxX: i, maxY: l } = { minX: 0, minY: 0, maxX: 0, maxY: 0 }) {
1045
- if (e.size && e.id !== "root") {
1046
- const { x: s, y: r, width: n, height: c } = e.size;
1047
- s - n / 2 < t && (t = s - n / 2), r - c / 2 < a && (a = r - c / 2), s + n / 2 > i && (i = s + n / 2), r + c / 2 > l && (l = r + c / 2);
1048
- }
1049
- if (e.children)
1050
- for (const s of e.children)
1051
- ({ minX: t, minY: a, maxX: i, maxY: l } = _t(s, { minX: t, minY: a, maxX: i, maxY: l }));
1052
- return { minX: t, minY: a, maxX: i, maxY: l };
1053
- }
1054
- d(_t, "findBounds");
1055
- function jt(e) {
1056
- const t = e.getBlock("root");
1057
- if (!t)
1058
- return;
1059
- ot(t, e, 0, 0), Et(t), L.debug("getBlocks", JSON.stringify(t, null, 2));
1060
- const { minX: a, minY: i, maxX: l, maxY: s } = _t(t), r = s - i, n = l - a;
1061
- return { x: a, y: i, width: n, height: r };
1062
- }
1063
- d(jt, "layout");
1064
- function mt(e, t) {
1065
- t && e.attr("style", t);
1066
- }
1067
- d(mt, "applyStyle");
1068
- function Vt(e, t) {
1069
- const a = O(document.createElementNS("http://www.w3.org/2000/svg", "foreignObject")), i = a.append("xhtml:div"), l = e.label, s = e.isNode ? "nodeLabel" : "edgeLabel", r = i.append("span");
1070
- return r.html(yt(l, t)), mt(r, e.labelStyle), r.attr("class", s), mt(i, e.labelStyle), i.style("display", "inline-block"), i.style("white-space", "nowrap"), i.attr("xmlns", "http://www.w3.org/1999/xhtml"), a.node();
1071
- }
1072
- d(Vt, "addHtmlLabel");
1073
- var ir = /* @__PURE__ */ d(async (e, t, a, i) => {
1074
- let l = e || "";
1075
- typeof l == "object" && (l = l[0]);
1076
- const s = R();
1077
- if (j(s.flowchart.htmlLabels)) {
1078
- l = l.replace(/\\n|\n/g, "<br />"), L.debug("vertexText" + l);
1079
- const r = await we(xt(l)), n = {
1080
- isNode: i,
1081
- label: r,
1082
- labelStyle: t.replace("fill:", "color:")
1083
- };
1084
- return Vt(n, s);
1085
- } else {
1086
- const r = document.createElementNS("http://www.w3.org/2000/svg", "text");
1087
- r.setAttribute("style", t.replace("color:", "fill:"));
1088
- let n = [];
1089
- typeof l == "string" ? n = l.split(/\\n|\n|<br\s*\/?>/gi) : Array.isArray(l) ? n = l : n = [];
1090
- for (const c of n) {
1091
- const u = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
1092
- u.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve"), u.setAttribute("dy", "1em"), u.setAttribute("x", "0"), a ? u.setAttribute("class", "title-row") : u.setAttribute("class", "row"), u.textContent = c.trim(), r.appendChild(u);
1093
- }
1094
- return r;
1095
- }
1096
- }, "createLabel"), K = ir, nr = /* @__PURE__ */ d((e, t, a, i, l) => {
1097
- t.arrowTypeStart && Ot(e, "start", t.arrowTypeStart, a, i, l), t.arrowTypeEnd && Ot(e, "end", t.arrowTypeEnd, a, i, l);
1098
- }, "addEdgeMarkers"), lr = {
1099
- arrow_cross: "cross",
1100
- arrow_point: "point",
1101
- arrow_barb: "barb",
1102
- arrow_circle: "circle",
1103
- aggregation: "aggregation",
1104
- extension: "extension",
1105
- composition: "composition",
1106
- dependency: "dependency",
1107
- lollipop: "lollipop"
1108
- }, Ot = /* @__PURE__ */ d((e, t, a, i, l, s) => {
1109
- const r = lr[a];
1110
- if (!r) {
1111
- L.warn(`Unknown arrow type: ${a}`);
1112
- return;
1113
- }
1114
- const n = t === "start" ? "Start" : "End";
1115
- e.attr(`marker-${t}`, `url(${i}#${l}_${s}-${r}${n})`);
1116
- }, "addEdgeMarker"), Lt = {}, M = {}, cr = /* @__PURE__ */ d(async (e, t) => {
1117
- const a = R(), i = j(a.flowchart.htmlLabels), l = t.labelType === "markdown" ? Wt(
1118
- e,
1119
- t.label,
1120
- {
1121
- style: t.labelStyle,
1122
- useHtmlLabels: i,
1123
- addSvgBackground: !0
1124
- },
1125
- a
1126
- ) : await K(t.label, t.labelStyle), s = e.insert("g").attr("class", "edgeLabel"), r = s.insert("g").attr("class", "label");
1127
- r.node().appendChild(l);
1128
- let n = l.getBBox();
1129
- if (i) {
1130
- const u = l.children[0], o = O(l);
1131
- n = u.getBoundingClientRect(), o.attr("width", n.width), o.attr("height", n.height);
1132
- }
1133
- r.attr("transform", "translate(" + -n.width / 2 + ", " + -n.height / 2 + ")"), Lt[t.id] = s, t.width = n.width, t.height = n.height;
1134
- let c;
1135
- if (t.startLabelLeft) {
1136
- const u = await K(t.startLabelLeft, t.labelStyle), o = e.insert("g").attr("class", "edgeTerminals"), x = o.insert("g").attr("class", "inner");
1137
- c = x.node().appendChild(u);
1138
- const w = u.getBBox();
1139
- x.attr("transform", "translate(" + -w.width / 2 + ", " + -w.height / 2 + ")"), M[t.id] || (M[t.id] = {}), M[t.id].startLeft = o, tt(c, t.startLabelLeft);
1140
- }
1141
- if (t.startLabelRight) {
1142
- const u = await K(t.startLabelRight, t.labelStyle), o = e.insert("g").attr("class", "edgeTerminals"), x = o.insert("g").attr("class", "inner");
1143
- c = o.node().appendChild(u), x.node().appendChild(u);
1144
- const w = u.getBBox();
1145
- x.attr("transform", "translate(" + -w.width / 2 + ", " + -w.height / 2 + ")"), M[t.id] || (M[t.id] = {}), M[t.id].startRight = o, tt(c, t.startLabelRight);
1146
- }
1147
- if (t.endLabelLeft) {
1148
- const u = await K(t.endLabelLeft, t.labelStyle), o = e.insert("g").attr("class", "edgeTerminals"), x = o.insert("g").attr("class", "inner");
1149
- c = x.node().appendChild(u);
1150
- const w = u.getBBox();
1151
- x.attr("transform", "translate(" + -w.width / 2 + ", " + -w.height / 2 + ")"), o.node().appendChild(u), M[t.id] || (M[t.id] = {}), M[t.id].endLeft = o, tt(c, t.endLabelLeft);
1152
- }
1153
- if (t.endLabelRight) {
1154
- const u = await K(t.endLabelRight, t.labelStyle), o = e.insert("g").attr("class", "edgeTerminals"), x = o.insert("g").attr("class", "inner");
1155
- c = x.node().appendChild(u);
1156
- const w = u.getBBox();
1157
- x.attr("transform", "translate(" + -w.width / 2 + ", " + -w.height / 2 + ")"), o.node().appendChild(u), M[t.id] || (M[t.id] = {}), M[t.id].endRight = o, tt(c, t.endLabelRight);
1158
- }
1159
- return l;
1160
- }, "insertEdgeLabel");
1161
- function tt(e, t) {
1162
- R().flowchart.htmlLabels && e && (e.style.width = t.length * 9 + "px", e.style.height = "12px");
1163
- }
1164
- d(tt, "setTerminalWidth");
1165
- var or = /* @__PURE__ */ d((e, t) => {
1166
- L.debug("Moving label abc88 ", e.id, e.label, Lt[e.id], t);
1167
- let a = t.updatedPath ? t.updatedPath : t.originalPath;
1168
- const i = R(), { subGraphTitleTotalMargin: l } = ye(i);
1169
- if (e.label) {
1170
- const s = Lt[e.id];
1171
- let r = e.x, n = e.y;
1172
- if (a) {
1173
- const c = $.calcLabelPosition(a);
1174
- L.debug(
1175
- "Moving label " + e.label + " from (",
1176
- r,
1177
- ",",
1178
- n,
1179
- ") to (",
1180
- c.x,
1181
- ",",
1182
- c.y,
1183
- ") abc88"
1184
- ), t.updatedPath && (r = c.x, n = c.y);
1185
- }
1186
- s.attr("transform", `translate(${r}, ${n + l / 2})`);
1187
- }
1188
- if (e.startLabelLeft) {
1189
- const s = M[e.id].startLeft;
1190
- let r = e.x, n = e.y;
1191
- if (a) {
1192
- const c = $.calcTerminalLabelPosition(e.arrowTypeStart ? 10 : 0, "start_left", a);
1193
- r = c.x, n = c.y;
1194
- }
1195
- s.attr("transform", `translate(${r}, ${n})`);
1196
- }
1197
- if (e.startLabelRight) {
1198
- const s = M[e.id].startRight;
1199
- let r = e.x, n = e.y;
1200
- if (a) {
1201
- const c = $.calcTerminalLabelPosition(
1202
- e.arrowTypeStart ? 10 : 0,
1203
- "start_right",
1204
- a
1205
- );
1206
- r = c.x, n = c.y;
1207
- }
1208
- s.attr("transform", `translate(${r}, ${n})`);
1209
- }
1210
- if (e.endLabelLeft) {
1211
- const s = M[e.id].endLeft;
1212
- let r = e.x, n = e.y;
1213
- if (a) {
1214
- const c = $.calcTerminalLabelPosition(e.arrowTypeEnd ? 10 : 0, "end_left", a);
1215
- r = c.x, n = c.y;
1216
- }
1217
- s.attr("transform", `translate(${r}, ${n})`);
1218
- }
1219
- if (e.endLabelRight) {
1220
- const s = M[e.id].endRight;
1221
- let r = e.x, n = e.y;
1222
- if (a) {
1223
- const c = $.calcTerminalLabelPosition(e.arrowTypeEnd ? 10 : 0, "end_right", a);
1224
- r = c.x, n = c.y;
1225
- }
1226
- s.attr("transform", `translate(${r}, ${n})`);
1227
- }
1228
- }, "positionEdgeLabel"), hr = /* @__PURE__ */ d((e, t) => {
1229
- const a = e.x, i = e.y, l = Math.abs(t.x - a), s = Math.abs(t.y - i), r = e.width / 2, n = e.height / 2;
1230
- return l >= r || s >= n;
1231
- }, "outsideNode"), dr = /* @__PURE__ */ d((e, t, a) => {
1232
- L.debug(`intersection calc abc89:
1233
- outsidePoint: ${JSON.stringify(t)}
1234
- insidePoint : ${JSON.stringify(a)}
1235
- node : x:${e.x} y:${e.y} w:${e.width} h:${e.height}`);
1236
- const i = e.x, l = e.y, s = Math.abs(i - a.x), r = e.width / 2;
1237
- let n = a.x < t.x ? r - s : r + s;
1238
- const c = e.height / 2, u = Math.abs(t.y - a.y), o = Math.abs(t.x - a.x);
1239
- if (Math.abs(l - t.y) * r > Math.abs(i - t.x) * c) {
1240
- let x = a.y < t.y ? t.y - c - l : l - c - t.y;
1241
- n = o * x / u;
1242
- const w = {
1243
- x: a.x < t.x ? a.x + n : a.x - o + n,
1244
- y: a.y < t.y ? a.y + u - x : a.y - u + x
1245
- };
1246
- return n === 0 && (w.x = t.x, w.y = t.y), o === 0 && (w.x = t.x), u === 0 && (w.y = t.y), L.debug(`abc89 topp/bott calc, Q ${u}, q ${x}, R ${o}, r ${n}`, w), w;
1247
- } else {
1248
- a.x < t.x ? n = t.x - r - i : n = i - r - t.x;
1249
- let x = u * n / o, w = a.x < t.x ? a.x + o - n : a.x - o + n, b = a.y < t.y ? a.y + x : a.y - x;
1250
- return L.debug(`sides calc abc89, Q ${u}, q ${x}, R ${o}, r ${n}`, { _x: w, _y: b }), n === 0 && (w = t.x, b = t.y), o === 0 && (w = t.x), u === 0 && (b = t.y), { x: w, y: b };
1251
- }
1252
- }, "intersection"), Rt = /* @__PURE__ */ d((e, t) => {
1253
- L.debug("abc88 cutPathAtIntersect", e, t);
1254
- let a = [], i = e[0], l = !1;
1255
- return e.forEach((s) => {
1256
- if (!hr(t, s) && !l) {
1257
- const r = dr(t, i, s);
1258
- let n = !1;
1259
- a.forEach((c) => {
1260
- n = n || c.x === r.x && c.y === r.y;
1261
- }), a.some((c) => c.x === r.x && c.y === r.y) || a.push(r), l = !0;
1262
- } else
1263
- i = s, l || a.push(s);
1264
- }), a;
1265
- }, "cutPathAtIntersect"), gr = /* @__PURE__ */ d(function(e, t, a, i, l, s, r) {
1266
- let n = a.points;
1267
- L.debug("abc88 InsertEdge: edge=", a, "e=", t);
1268
- let c = !1;
1269
- const u = s.node(t.v);
1270
- var o = s.node(t.w);
1271
- o?.intersect && u?.intersect && (n = n.slice(1, a.points.length - 1), n.unshift(u.intersect(n[0])), n.push(o.intersect(n[n.length - 1]))), a.toCluster && (L.debug("to cluster abc88", i[a.toCluster]), n = Rt(a.points, i[a.toCluster].node), c = !0), a.fromCluster && (L.debug("from cluster abc88", i[a.fromCluster]), n = Rt(n.reverse(), i[a.fromCluster].node).reverse(), c = !0);
1272
- const x = n.filter((y) => !Number.isNaN(y.y));
1273
- let w = fe;
1274
- a.curve && (l === "graph" || l === "flowchart") && (w = a.curve);
1275
- const { x: b, y: S } = ue(a), v = pe().x(b).y(S).curve(w);
1276
- let k;
1277
- switch (a.thickness) {
1278
- case "normal":
1279
- k = "edge-thickness-normal";
1280
- break;
1281
- case "thick":
1282
- k = "edge-thickness-thick";
1283
- break;
1284
- case "invisible":
1285
- k = "edge-thickness-thick";
1286
- break;
1287
- default:
1288
- k = "";
1289
- }
1290
- switch (a.pattern) {
1291
- case "solid":
1292
- k += " edge-pattern-solid";
1293
- break;
1294
- case "dotted":
1295
- k += " edge-pattern-dotted";
1296
- break;
1297
- case "dashed":
1298
- k += " edge-pattern-dashed";
1299
- break;
1300
- }
1301
- const B = e.append("path").attr("d", v(x)).attr("id", a.id).attr("class", " " + k + (a.classes ? " " + a.classes : "")).attr("style", a.style);
1302
- let _ = "";
1303
- (R().flowchart.arrowMarkerAbsolute || R().state.arrowMarkerAbsolute) && (_ = xe(!0)), nr(B, a, _, r, l);
1304
- let D = {};
1305
- return c && (D.updatedPath = n), D.originalPath = a.points, D;
1306
- }, "insertEdge"), ur = /* @__PURE__ */ d((e) => {
1307
- const t = /* @__PURE__ */ new Set();
1308
- for (const a of e)
1309
- switch (a) {
1310
- case "x":
1311
- t.add("right"), t.add("left");
1312
- break;
1313
- case "y":
1314
- t.add("up"), t.add("down");
1315
- break;
1316
- default:
1317
- t.add(a);
1318
- break;
1319
- }
1320
- return t;
1321
- }, "expandAndDeduplicateDirections"), pr = /* @__PURE__ */ d((e, t, a) => {
1322
- const i = ur(e), l = 2, s = t.height + 2 * a.padding, r = s / l, n = t.width + 2 * r + a.padding, c = a.padding / 2;
1323
- return i.has("right") && i.has("left") && i.has("up") && i.has("down") ? [
1324
- // Bottom
1325
- { x: 0, y: 0 },
1326
- { x: r, y: 0 },
1327
- { x: n / 2, y: 2 * c },
1328
- { x: n - r, y: 0 },
1329
- { x: n, y: 0 },
1330
- // Right
1331
- { x: n, y: -s / 3 },
1332
- { x: n + 2 * c, y: -s / 2 },
1333
- { x: n, y: -2 * s / 3 },
1334
- { x: n, y: -s },
1335
- // Top
1336
- { x: n - r, y: -s },
1337
- { x: n / 2, y: -s - 2 * c },
1338
- { x: r, y: -s },
1339
- // Left
1340
- { x: 0, y: -s },
1341
- { x: 0, y: -2 * s / 3 },
1342
- { x: -2 * c, y: -s / 2 },
1343
- { x: 0, y: -s / 3 }
1344
- ] : i.has("right") && i.has("left") && i.has("up") ? [
1345
- { x: r, y: 0 },
1346
- { x: n - r, y: 0 },
1347
- { x: n, y: -s / 2 },
1348
- { x: n - r, y: -s },
1349
- { x: r, y: -s },
1350
- { x: 0, y: -s / 2 }
1351
- ] : i.has("right") && i.has("left") && i.has("down") ? [
1352
- { x: 0, y: 0 },
1353
- { x: r, y: -s },
1354
- { x: n - r, y: -s },
1355
- { x: n, y: 0 }
1356
- ] : i.has("right") && i.has("up") && i.has("down") ? [
1357
- { x: 0, y: 0 },
1358
- { x: n, y: -r },
1359
- { x: n, y: -s + r },
1360
- { x: 0, y: -s }
1361
- ] : i.has("left") && i.has("up") && i.has("down") ? [
1362
- { x: n, y: 0 },
1363
- { x: 0, y: -r },
1364
- { x: 0, y: -s + r },
1365
- { x: n, y: -s }
1366
- ] : i.has("right") && i.has("left") ? [
1367
- { x: r, y: 0 },
1368
- { x: r, y: -c },
1369
- { x: n - r, y: -c },
1370
- { x: n - r, y: 0 },
1371
- { x: n, y: -s / 2 },
1372
- { x: n - r, y: -s },
1373
- { x: n - r, y: -s + c },
1374
- { x: r, y: -s + c },
1375
- { x: r, y: -s },
1376
- { x: 0, y: -s / 2 }
1377
- ] : i.has("up") && i.has("down") ? [
1378
- // Bottom center
1379
- { x: n / 2, y: 0 },
1380
- // Left pont of bottom arrow
1381
- { x: 0, y: -c },
1382
- { x: r, y: -c },
1383
- // Left top over vertical section
1384
- { x: r, y: -s + c },
1385
- { x: 0, y: -s + c },
1386
- // Top of arrow
1387
- { x: n / 2, y: -s },
1388
- { x: n, y: -s + c },
1389
- // Top of right vertical bar
1390
- { x: n - r, y: -s + c },
1391
- { x: n - r, y: -c },
1392
- { x: n, y: -c }
1393
- ] : i.has("right") && i.has("up") ? [
1394
- { x: 0, y: 0 },
1395
- { x: n, y: -r },
1396
- { x: 0, y: -s }
1397
- ] : i.has("right") && i.has("down") ? [
1398
- { x: 0, y: 0 },
1399
- { x: n, y: 0 },
1400
- { x: 0, y: -s }
1401
- ] : i.has("left") && i.has("up") ? [
1402
- { x: n, y: 0 },
1403
- { x: 0, y: -r },
1404
- { x: n, y: -s }
1405
- ] : i.has("left") && i.has("down") ? [
1406
- { x: n, y: 0 },
1407
- { x: 0, y: 0 },
1408
- { x: n, y: -s }
1409
- ] : i.has("right") ? [
1410
- { x: r, y: -c },
1411
- { x: r, y: -c },
1412
- { x: n - r, y: -c },
1413
- { x: n - r, y: 0 },
1414
- { x: n, y: -s / 2 },
1415
- { x: n - r, y: -s },
1416
- { x: n - r, y: -s + c },
1417
- // top left corner of arrow
1418
- { x: r, y: -s + c },
1419
- { x: r, y: -s + c }
1420
- ] : i.has("left") ? [
1421
- { x: r, y: 0 },
1422
- { x: r, y: -c },
1423
- // Two points, the right corners
1424
- { x: n - r, y: -c },
1425
- { x: n - r, y: -s + c },
1426
- { x: r, y: -s + c },
1427
- { x: r, y: -s },
1428
- { x: 0, y: -s / 2 }
1429
- ] : i.has("up") ? [
1430
- // Bottom center
1431
- { x: r, y: -c },
1432
- // Left top over vertical section
1433
- { x: r, y: -s + c },
1434
- { x: 0, y: -s + c },
1435
- // Top of arrow
1436
- { x: n / 2, y: -s },
1437
- { x: n, y: -s + c },
1438
- // Top of right vertical bar
1439
- { x: n - r, y: -s + c },
1440
- { x: n - r, y: -c }
1441
- ] : i.has("down") ? [
1442
- // Bottom center
1443
- { x: n / 2, y: 0 },
1444
- // Left pont of bottom arrow
1445
- { x: 0, y: -c },
1446
- { x: r, y: -c },
1447
- // Left top over vertical section
1448
- { x: r, y: -s + c },
1449
- { x: n - r, y: -s + c },
1450
- { x: n - r, y: -c },
1451
- { x: n, y: -c }
1452
- ] : [{ x: 0, y: 0 }];
1453
- }, "getArrowPoints");
1454
- function Gt(e, t) {
1455
- return e.intersect(t);
1456
- }
1457
- d(Gt, "intersectNode");
1458
- var fr = Gt;
1459
- function Zt(e, t, a, i) {
1460
- var l = e.x, s = e.y, r = l - i.x, n = s - i.y, c = Math.sqrt(t * t * n * n + a * a * r * r), u = Math.abs(t * a * r / c);
1461
- i.x < l && (u = -u);
1462
- var o = Math.abs(t * a * n / c);
1463
- return i.y < s && (o = -o), { x: l + u, y: s + o };
1464
- }
1465
- d(Zt, "intersectEllipse");
1466
- var qt = Zt;
1467
- function Jt(e, t, a) {
1468
- return qt(e, t, t, a);
1469
- }
1470
- d(Jt, "intersectCircle");
1471
- var xr = Jt;
1472
- function Qt(e, t, a, i) {
1473
- var l, s, r, n, c, u, o, x, w, b, S, v, k, B, _;
1474
- if (l = t.y - e.y, r = e.x - t.x, c = t.x * e.y - e.x * t.y, w = l * a.x + r * a.y + c, b = l * i.x + r * i.y + c, !(w !== 0 && b !== 0 && St(w, b)) && (s = i.y - a.y, n = a.x - i.x, u = i.x * a.y - a.x * i.y, o = s * e.x + n * e.y + u, x = s * t.x + n * t.y + u, !(o !== 0 && x !== 0 && St(o, x)) && (S = l * n - s * r, S !== 0)))
1475
- return v = Math.abs(S / 2), k = r * u - n * c, B = k < 0 ? (k - v) / S : (k + v) / S, k = s * c - l * u, _ = k < 0 ? (k - v) / S : (k + v) / S, { x: B, y: _ };
1476
- }
1477
- d(Qt, "intersectLine");
1478
- function St(e, t) {
1479
- return e * t > 0;
1480
- }
1481
- d(St, "sameSign");
1482
- var yr = Qt, br = $t;
1483
- function $t(e, t, a) {
1484
- var i = e.x, l = e.y, s = [], r = Number.POSITIVE_INFINITY, n = Number.POSITIVE_INFINITY;
1485
- typeof t.forEach == "function" ? t.forEach(function(S) {
1486
- r = Math.min(r, S.x), n = Math.min(n, S.y);
1487
- }) : (r = Math.min(r, t.x), n = Math.min(n, t.y));
1488
- for (var c = i - e.width / 2 - r, u = l - e.height / 2 - n, o = 0; o < t.length; o++) {
1489
- var x = t[o], w = t[o < t.length - 1 ? o + 1 : 0], b = yr(
1490
- e,
1491
- a,
1492
- { x: c + x.x, y: u + x.y },
1493
- { x: c + w.x, y: u + w.y }
1494
- );
1495
- b && s.push(b);
1496
- }
1497
- return s.length ? (s.length > 1 && s.sort(function(S, v) {
1498
- var k = S.x - a.x, B = S.y - a.y, _ = Math.sqrt(k * k + B * B), D = v.x - a.x, y = v.y - a.y, g = Math.sqrt(D * D + y * y);
1499
- return _ < g ? -1 : _ === g ? 0 : 1;
1500
- }), s[0]) : e;
1501
- }
1502
- d($t, "intersectPolygon");
1503
- var wr = /* @__PURE__ */ d((e, t) => {
1504
- var a = e.x, i = e.y, l = t.x - a, s = t.y - i, r = e.width / 2, n = e.height / 2, c, u;
1505
- return Math.abs(s) * r > Math.abs(l) * n ? (s < 0 && (n = -n), c = s === 0 ? 0 : n * l / s, u = n) : (l < 0 && (r = -r), c = r, u = l === 0 ? 0 : r * s / l), { x: a + c, y: i + u };
1506
- }, "intersectRect"), mr = wr, N = {
1507
- node: fr,
1508
- circle: xr,
1509
- ellipse: qt,
1510
- polygon: br,
1511
- rect: mr
1512
- }, A = /* @__PURE__ */ d(async (e, t, a, i) => {
1513
- const l = R();
1514
- let s;
1515
- const r = t.useHtmlLabels || j(l.flowchart.htmlLabels);
1516
- a ? s = a : s = "node default";
1517
- const n = e.insert("g").attr("class", s).attr("id", t.domId || t.id), c = n.insert("g").attr("class", "label").attr("style", t.labelStyle);
1518
- let u;
1519
- t.labelText === void 0 ? u = "" : u = typeof t.labelText == "string" ? t.labelText : t.labelText[0];
1520
- const o = c.node();
1521
- let x;
1522
- t.labelType === "markdown" ? x = Wt(
1523
- c,
1524
- yt(xt(u), l),
1525
- {
1526
- useHtmlLabels: r,
1527
- width: t.width || l.flowchart.wrappingWidth,
1528
- classes: "markdown-node-label"
1529
- },
1530
- l
1531
- ) : x = o.appendChild(
1532
- await K(
1533
- yt(xt(u), l),
1534
- t.labelStyle,
1535
- !1,
1536
- i
1537
- )
1538
- );
1539
- let w = x.getBBox();
1540
- const b = t.padding / 2;
1541
- if (j(l.flowchart.htmlLabels)) {
1542
- const S = x.children[0], v = O(x), k = S.getElementsByTagName("img");
1543
- if (k) {
1544
- const B = u.replace(/<img[^>]*>/g, "").trim() === "";
1545
- await Promise.all(
1546
- [...k].map(
1547
- (_) => new Promise((D) => {
1548
- function y() {
1549
- if (_.style.display = "flex", _.style.flexDirection = "column", B) {
1550
- const g = l.fontSize ? l.fontSize : window.getComputedStyle(document.body).fontSize, m = parseInt(g, 10) * 5 + "px";
1551
- _.style.minWidth = m, _.style.maxWidth = m;
1552
- } else
1553
- _.style.width = "100%";
1554
- D(_);
1555
- }
1556
- d(y, "setupImage"), setTimeout(() => {
1557
- _.complete && y();
1558
- }), _.addEventListener("error", y), _.addEventListener("load", y);
1559
- })
1560
- )
1561
- );
1562
- }
1563
- w = S.getBoundingClientRect(), v.attr("width", w.width), v.attr("height", w.height);
1564
- }
1565
- return r ? c.attr("transform", "translate(" + -w.width / 2 + ", " + -w.height / 2 + ")") : c.attr("transform", "translate(0, " + -w.height / 2 + ")"), t.centerLabel && c.attr("transform", "translate(" + -w.width / 2 + ", " + -w.height / 2 + ")"), c.insert("rect", ":first-child"), { shapeSvg: n, bbox: w, halfPadding: b, label: c };
1566
- }, "labelHelper"), T = /* @__PURE__ */ d((e, t) => {
1567
- const a = t.node().getBBox();
1568
- e.width = a.width, e.height = a.height;
1569
- }, "updateNodeBounds");
1570
- function U(e, t, a, i) {
1571
- return e.insert("polygon", ":first-child").attr(
1572
- "points",
1573
- i.map(function(l) {
1574
- return l.x + "," + l.y;
1575
- }).join(" ")
1576
- ).attr("class", "label-container").attr("transform", "translate(" + -t / 2 + "," + a / 2 + ")");
1577
- }
1578
- d(U, "insertPolygonShape");
1579
- var Lr = /* @__PURE__ */ d(async (e, t) => {
1580
- t.useHtmlLabels || R().flowchart.htmlLabels || (t.centerLabel = !0);
1581
- const { shapeSvg: i, bbox: l, halfPadding: s } = await A(
1582
- e,
1583
- t,
1584
- "node " + t.classes,
1585
- !0
1586
- );
1587
- L.info("Classes = ", t.classes);
1588
- const r = i.insert("rect", ":first-child");
1589
- return r.attr("rx", t.rx).attr("ry", t.ry).attr("x", -l.width / 2 - s).attr("y", -l.height / 2 - s).attr("width", l.width + t.padding).attr("height", l.height + t.padding), T(t, r), t.intersect = function(n) {
1590
- return N.rect(t, n);
1591
- }, i;
1592
- }, "note"), Sr = Lr, zt = /* @__PURE__ */ d((e) => e ? " " + e : "", "formatClass"), Y = /* @__PURE__ */ d((e, t) => `${t || "node default"}${zt(e.classes)} ${zt(
1593
- e.class
1594
- )}`, "getClassesFromNode"), At = /* @__PURE__ */ d(async (e, t) => {
1595
- const { shapeSvg: a, bbox: i } = await A(
1596
- e,
1597
- t,
1598
- Y(t, void 0),
1599
- !0
1600
- ), l = i.width + t.padding, s = i.height + t.padding, r = l + s, n = [
1601
- { x: r / 2, y: 0 },
1602
- { x: r, y: -r / 2 },
1603
- { x: r / 2, y: -r },
1604
- { x: 0, y: -r / 2 }
1605
- ];
1606
- L.info("Question main (Circle)");
1607
- const c = U(a, r, r, n);
1608
- return c.attr("style", t.style), T(t, c), t.intersect = function(u) {
1609
- return L.warn("Intersect called"), N.polygon(t, n, u);
1610
- }, a;
1611
- }, "question"), kr = /* @__PURE__ */ d((e, t) => {
1612
- const a = e.insert("g").attr("class", "node default").attr("id", t.domId || t.id), i = 28, l = [
1613
- { x: 0, y: i / 2 },
1614
- { x: i / 2, y: 0 },
1615
- { x: 0, y: -i / 2 },
1616
- { x: -i / 2, y: 0 }
1617
- ];
1618
- return a.insert("polygon", ":first-child").attr(
1619
- "points",
1620
- l.map(function(r) {
1621
- return r.x + "," + r.y;
1622
- }).join(" ")
1623
- ).attr("class", "state-start").attr("r", 7).attr("width", 28).attr("height", 28), t.width = 28, t.height = 28, t.intersect = function(r) {
1624
- return N.circle(t, 14, r);
1625
- }, a;
1626
- }, "choice"), vr = /* @__PURE__ */ d(async (e, t) => {
1627
- const { shapeSvg: a, bbox: i } = await A(
1628
- e,
1629
- t,
1630
- Y(t, void 0),
1631
- !0
1632
- ), l = 4, s = i.height + t.padding, r = s / l, n = i.width + 2 * r + t.padding, c = [
1633
- { x: r, y: 0 },
1634
- { x: n - r, y: 0 },
1635
- { x: n, y: -s / 2 },
1636
- { x: n - r, y: -s },
1637
- { x: r, y: -s },
1638
- { x: 0, y: -s / 2 }
1639
- ], u = U(a, n, s, c);
1640
- return u.attr("style", t.style), T(t, u), t.intersect = function(o) {
1641
- return N.polygon(t, c, o);
1642
- }, a;
1643
- }, "hexagon"), Er = /* @__PURE__ */ d(async (e, t) => {
1644
- const { shapeSvg: a, bbox: i } = await A(e, t, void 0, !0), l = 2, s = i.height + 2 * t.padding, r = s / l, n = i.width + 2 * r + t.padding, c = pr(t.directions, i, t), u = U(a, n, s, c);
1645
- return u.attr("style", t.style), T(t, u), t.intersect = function(o) {
1646
- return N.polygon(t, c, o);
1647
- }, a;
1648
- }, "block_arrow"), _r = /* @__PURE__ */ d(async (e, t) => {
1649
- const { shapeSvg: a, bbox: i } = await A(
1650
- e,
1651
- t,
1652
- Y(t, void 0),
1653
- !0
1654
- ), l = i.width + t.padding, s = i.height + t.padding, r = [
1655
- { x: -s / 2, y: 0 },
1656
- { x: l, y: 0 },
1657
- { x: l, y: -s },
1658
- { x: -s / 2, y: -s },
1659
- { x: 0, y: -s / 2 }
1660
- ];
1661
- return U(a, l, s, r).attr("style", t.style), t.width = l + s, t.height = s, t.intersect = function(c) {
1662
- return N.polygon(t, r, c);
1663
- }, a;
1664
- }, "rect_left_inv_arrow"), Dr = /* @__PURE__ */ d(async (e, t) => {
1665
- const { shapeSvg: a, bbox: i } = await A(e, t, Y(t), !0), l = i.width + t.padding, s = i.height + t.padding, r = [
1666
- { x: -2 * s / 6, y: 0 },
1667
- { x: l - s / 6, y: 0 },
1668
- { x: l + 2 * s / 6, y: -s },
1669
- { x: s / 6, y: -s }
1670
- ], n = U(a, l, s, r);
1671
- return n.attr("style", t.style), T(t, n), t.intersect = function(c) {
1672
- return N.polygon(t, r, c);
1673
- }, a;
1674
- }, "lean_right"), Nr = /* @__PURE__ */ d(async (e, t) => {
1675
- const { shapeSvg: a, bbox: i } = await A(
1676
- e,
1677
- t,
1678
- Y(t, void 0),
1679
- !0
1680
- ), l = i.width + t.padding, s = i.height + t.padding, r = [
1681
- { x: 2 * s / 6, y: 0 },
1682
- { x: l + s / 6, y: 0 },
1683
- { x: l - 2 * s / 6, y: -s },
1684
- { x: -s / 6, y: -s }
1685
- ], n = U(a, l, s, r);
1686
- return n.attr("style", t.style), T(t, n), t.intersect = function(c) {
1687
- return N.polygon(t, r, c);
1688
- }, a;
1689
- }, "lean_left"), Tr = /* @__PURE__ */ d(async (e, t) => {
1690
- const { shapeSvg: a, bbox: i } = await A(
1691
- e,
1692
- t,
1693
- Y(t, void 0),
1694
- !0
1695
- ), l = i.width + t.padding, s = i.height + t.padding, r = [
1696
- { x: -2 * s / 6, y: 0 },
1697
- { x: l + 2 * s / 6, y: 0 },
1698
- { x: l - s / 6, y: -s },
1699
- { x: s / 6, y: -s }
1700
- ], n = U(a, l, s, r);
1701
- return n.attr("style", t.style), T(t, n), t.intersect = function(c) {
1702
- return N.polygon(t, r, c);
1703
- }, a;
1704
- }, "trapezoid"), Br = /* @__PURE__ */ d(async (e, t) => {
1705
- const { shapeSvg: a, bbox: i } = await A(
1706
- e,
1707
- t,
1708
- Y(t, void 0),
1709
- !0
1710
- ), l = i.width + t.padding, s = i.height + t.padding, r = [
1711
- { x: s / 6, y: 0 },
1712
- { x: l - s / 6, y: 0 },
1713
- { x: l + 2 * s / 6, y: -s },
1714
- { x: -2 * s / 6, y: -s }
1715
- ], n = U(a, l, s, r);
1716
- return n.attr("style", t.style), T(t, n), t.intersect = function(c) {
1717
- return N.polygon(t, r, c);
1718
- }, a;
1719
- }, "inv_trapezoid"), Cr = /* @__PURE__ */ d(async (e, t) => {
1720
- const { shapeSvg: a, bbox: i } = await A(
1721
- e,
1722
- t,
1723
- Y(t, void 0),
1724
- !0
1725
- ), l = i.width + t.padding, s = i.height + t.padding, r = [
1726
- { x: 0, y: 0 },
1727
- { x: l + s / 2, y: 0 },
1728
- { x: l, y: -s / 2 },
1729
- { x: l + s / 2, y: -s },
1730
- { x: 0, y: -s }
1731
- ], n = U(a, l, s, r);
1732
- return n.attr("style", t.style), T(t, n), t.intersect = function(c) {
1733
- return N.polygon(t, r, c);
1734
- }, a;
1735
- }, "rect_right_inv_arrow"), Ir = /* @__PURE__ */ d(async (e, t) => {
1736
- const { shapeSvg: a, bbox: i } = await A(
1737
- e,
1738
- t,
1739
- Y(t, void 0),
1740
- !0
1741
- ), l = i.width + t.padding, s = l / 2, r = s / (2.5 + l / 50), n = i.height + r + t.padding, c = "M 0," + r + " a " + s + "," + r + " 0,0,0 " + l + " 0 a " + s + "," + r + " 0,0,0 " + -l + " 0 l 0," + n + " a " + s + "," + r + " 0,0,0 " + l + " 0 l 0," + -n, u = a.attr("label-offset-y", r).insert("path", ":first-child").attr("style", t.style).attr("d", c).attr("transform", "translate(" + -l / 2 + "," + -(n / 2 + r) + ")");
1742
- return T(t, u), t.intersect = function(o) {
1743
- const x = N.rect(t, o), w = x.x - t.x;
1744
- if (s != 0 && (Math.abs(w) < t.width / 2 || Math.abs(w) == t.width / 2 && Math.abs(x.y - t.y) > t.height / 2 - r)) {
1745
- let b = r * r * (1 - w * w / (s * s));
1746
- b != 0 && (b = Math.sqrt(b)), b = r - b, o.y - t.y > 0 && (b = -b), x.y += b;
1747
- }
1748
- return x;
1749
- }, a;
1750
- }, "cylinder"), Or = /* @__PURE__ */ d(async (e, t) => {
1751
- const { shapeSvg: a, bbox: i, halfPadding: l } = await A(
1752
- e,
1753
- t,
1754
- "node " + t.classes + " " + t.class,
1755
- !0
1756
- ), s = a.insert("rect", ":first-child"), r = t.positioned ? t.width : i.width + t.padding, n = t.positioned ? t.height : i.height + t.padding, c = t.positioned ? -r / 2 : -i.width / 2 - l, u = t.positioned ? -n / 2 : -i.height / 2 - l;
1757
- if (s.attr("class", "basic label-container").attr("style", t.style).attr("rx", t.rx).attr("ry", t.ry).attr("x", c).attr("y", u).attr("width", r).attr("height", n), t.props) {
1758
- const o = new Set(Object.keys(t.props));
1759
- t.props.borders && (ht(s, t.props.borders, r, n), o.delete("borders")), o.forEach((x) => {
1760
- L.warn(`Unknown node property ${x}`);
1761
- });
1762
- }
1763
- return T(t, s), t.intersect = function(o) {
1764
- return N.rect(t, o);
1765
- }, a;
1766
- }, "rect"), Rr = /* @__PURE__ */ d(async (e, t) => {
1767
- const { shapeSvg: a, bbox: i, halfPadding: l } = await A(
1768
- e,
1769
- t,
1770
- "node " + t.classes,
1771
- !0
1772
- ), s = a.insert("rect", ":first-child"), r = t.positioned ? t.width : i.width + t.padding, n = t.positioned ? t.height : i.height + t.padding, c = t.positioned ? -r / 2 : -i.width / 2 - l, u = t.positioned ? -n / 2 : -i.height / 2 - l;
1773
- if (s.attr("class", "basic cluster composite label-container").attr("style", t.style).attr("rx", t.rx).attr("ry", t.ry).attr("x", c).attr("y", u).attr("width", r).attr("height", n), t.props) {
1774
- const o = new Set(Object.keys(t.props));
1775
- t.props.borders && (ht(s, t.props.borders, r, n), o.delete("borders")), o.forEach((x) => {
1776
- L.warn(`Unknown node property ${x}`);
1777
- });
1778
- }
1779
- return T(t, s), t.intersect = function(o) {
1780
- return N.rect(t, o);
1781
- }, a;
1782
- }, "composite"), zr = /* @__PURE__ */ d(async (e, t) => {
1783
- const { shapeSvg: a } = await A(e, t, "label", !0);
1784
- L.trace("Classes = ", t.class);
1785
- const i = a.insert("rect", ":first-child"), l = 0, s = 0;
1786
- if (i.attr("width", l).attr("height", s), a.attr("class", "label edgeLabel"), t.props) {
1787
- const r = new Set(Object.keys(t.props));
1788
- t.props.borders && (ht(i, t.props.borders, l, s), r.delete("borders")), r.forEach((n) => {
1789
- L.warn(`Unknown node property ${n}`);
1790
- });
1791
- }
1792
- return T(t, i), t.intersect = function(r) {
1793
- return N.rect(t, r);
1794
- }, a;
1795
- }, "labelRect");
1796
- function ht(e, t, a, i) {
1797
- const l = [], s = /* @__PURE__ */ d((n) => {
1798
- l.push(n, 0);
1799
- }, "addBorder"), r = /* @__PURE__ */ d((n) => {
1800
- l.push(0, n);
1801
- }, "skipBorder");
1802
- t.includes("t") ? (L.debug("add top border"), s(a)) : r(a), t.includes("r") ? (L.debug("add right border"), s(i)) : r(i), t.includes("b") ? (L.debug("add bottom border"), s(a)) : r(a), t.includes("l") ? (L.debug("add left border"), s(i)) : r(i), e.attr("stroke-dasharray", l.join(" "));
1803
- }
1804
- d(ht, "applyNodePropertyBorders");
1805
- var Ar = /* @__PURE__ */ d(async (e, t) => {
1806
- let a;
1807
- t.classes ? a = "node " + t.classes : a = "node default";
1808
- const i = e.insert("g").attr("class", a).attr("id", t.domId || t.id), l = i.insert("rect", ":first-child"), s = i.insert("line"), r = i.insert("g").attr("class", "label"), n = t.labelText.flat ? t.labelText.flat() : t.labelText;
1809
- let c = "";
1810
- typeof n == "object" ? c = n[0] : c = n, L.info("Label text abc79", c, n, typeof n == "object");
1811
- const u = r.node().appendChild(await K(c, t.labelStyle, !0, !0));
1812
- let o = { width: 0, height: 0 };
1813
- if (j(R().flowchart.htmlLabels)) {
1814
- const v = u.children[0], k = O(u);
1815
- o = v.getBoundingClientRect(), k.attr("width", o.width), k.attr("height", o.height);
1816
- }
1817
- L.info("Text 2", n);
1818
- const x = n.slice(1, n.length);
1819
- let w = u.getBBox();
1820
- const b = r.node().appendChild(
1821
- await K(
1822
- x.join ? x.join("<br/>") : x,
1823
- t.labelStyle,
1824
- !0,
1825
- !0
1826
- )
1827
- );
1828
- if (j(R().flowchart.htmlLabels)) {
1829
- const v = b.children[0], k = O(b);
1830
- o = v.getBoundingClientRect(), k.attr("width", o.width), k.attr("height", o.height);
1831
- }
1832
- const S = t.padding / 2;
1833
- return O(b).attr(
1834
- "transform",
1835
- "translate( " + // (titleBox.width - bbox.width) / 2 +
1836
- (o.width > w.width ? 0 : (w.width - o.width) / 2) + ", " + (w.height + S + 5) + ")"
1837
- ), O(u).attr(
1838
- "transform",
1839
- "translate( " + // (titleBox.width - bbox.width) / 2 +
1840
- (o.width < w.width ? 0 : -(w.width - o.width) / 2) + ", 0)"
1841
- ), o = r.node().getBBox(), r.attr(
1842
- "transform",
1843
- "translate(" + -o.width / 2 + ", " + (-o.height / 2 - S + 3) + ")"
1844
- ), l.attr("class", "outer title-state").attr("x", -o.width / 2 - S).attr("y", -o.height / 2 - S).attr("width", o.width + t.padding).attr("height", o.height + t.padding), s.attr("class", "divider").attr("x1", -o.width / 2 - S).attr("x2", o.width / 2 + S).attr("y1", -o.height / 2 - S + w.height + S).attr("y2", -o.height / 2 - S + w.height + S), T(t, l), t.intersect = function(v) {
1845
- return N.rect(t, v);
1846
- }, i;
1847
- }, "rectWithTitle"), Mr = /* @__PURE__ */ d(async (e, t) => {
1848
- const { shapeSvg: a, bbox: i } = await A(
1849
- e,
1850
- t,
1851
- Y(t, void 0),
1852
- !0
1853
- ), l = i.height + t.padding, s = i.width + l / 4 + t.padding, r = a.insert("rect", ":first-child").attr("style", t.style).attr("rx", l / 2).attr("ry", l / 2).attr("x", -s / 2).attr("y", -l / 2).attr("width", s).attr("height", l);
1854
- return T(t, r), t.intersect = function(n) {
1855
- return N.rect(t, n);
1856
- }, a;
1857
- }, "stadium"), Fr = /* @__PURE__ */ d(async (e, t) => {
1858
- const { shapeSvg: a, bbox: i, halfPadding: l } = await A(
1859
- e,
1860
- t,
1861
- Y(t, void 0),
1862
- !0
1863
- ), s = a.insert("circle", ":first-child");
1864
- return s.attr("style", t.style).attr("rx", t.rx).attr("ry", t.ry).attr("r", i.width / 2 + l).attr("width", i.width + t.padding).attr("height", i.height + t.padding), L.info("Circle main"), T(t, s), t.intersect = function(r) {
1865
- return L.info("Circle intersect", t, i.width / 2 + l, r), N.circle(t, i.width / 2 + l, r);
1866
- }, a;
1867
- }, "circle"), Wr = /* @__PURE__ */ d(async (e, t) => {
1868
- const { shapeSvg: a, bbox: i, halfPadding: l } = await A(
1869
- e,
1870
- t,
1871
- Y(t, void 0),
1872
- !0
1873
- ), s = 5, r = a.insert("g", ":first-child"), n = r.insert("circle"), c = r.insert("circle");
1874
- return r.attr("class", t.class), n.attr("style", t.style).attr("rx", t.rx).attr("ry", t.ry).attr("r", i.width / 2 + l + s).attr("width", i.width + t.padding + s * 2).attr("height", i.height + t.padding + s * 2), c.attr("style", t.style).attr("rx", t.rx).attr("ry", t.ry).attr("r", i.width / 2 + l).attr("width", i.width + t.padding).attr("height", i.height + t.padding), L.info("DoubleCircle main"), T(t, n), t.intersect = function(u) {
1875
- return L.info("DoubleCircle intersect", t, i.width / 2 + l + s, u), N.circle(t, i.width / 2 + l + s, u);
1876
- }, a;
1877
- }, "doublecircle"), Pr = /* @__PURE__ */ d(async (e, t) => {
1878
- const { shapeSvg: a, bbox: i } = await A(
1879
- e,
1880
- t,
1881
- Y(t, void 0),
1882
- !0
1883
- ), l = i.width + t.padding, s = i.height + t.padding, r = [
1884
- { x: 0, y: 0 },
1885
- { x: l, y: 0 },
1886
- { x: l, y: -s },
1887
- { x: 0, y: -s },
1888
- { x: 0, y: 0 },
1889
- { x: -8, y: 0 },
1890
- { x: l + 8, y: 0 },
1891
- { x: l + 8, y: -s },
1892
- { x: -8, y: -s },
1893
- { x: -8, y: 0 }
1894
- ], n = U(a, l, s, r);
1895
- return n.attr("style", t.style), T(t, n), t.intersect = function(c) {
1896
- return N.polygon(t, r, c);
1897
- }, a;
1898
- }, "subroutine"), Yr = /* @__PURE__ */ d((e, t) => {
1899
- const a = e.insert("g").attr("class", "node default").attr("id", t.domId || t.id), i = a.insert("circle", ":first-child");
1900
- return i.attr("class", "state-start").attr("r", 7).attr("width", 14).attr("height", 14), T(t, i), t.intersect = function(l) {
1901
- return N.circle(t, 7, l);
1902
- }, a;
1903
- }, "start"), Mt = /* @__PURE__ */ d((e, t, a) => {
1904
- const i = e.insert("g").attr("class", "node default").attr("id", t.domId || t.id);
1905
- let l = 70, s = 10;
1906
- a === "LR" && (l = 10, s = 70);
1907
- const r = i.append("rect").attr("x", -1 * l / 2).attr("y", -1 * s / 2).attr("width", l).attr("height", s).attr("class", "fork-join");
1908
- return T(t, r), t.height = t.height + t.padding / 2, t.width = t.width + t.padding / 2, t.intersect = function(n) {
1909
- return N.rect(t, n);
1910
- }, i;
1911
- }, "forkJoin"), Hr = /* @__PURE__ */ d((e, t) => {
1912
- const a = e.insert("g").attr("class", "node default").attr("id", t.domId || t.id), i = a.insert("circle", ":first-child"), l = a.insert("circle", ":first-child");
1913
- return l.attr("class", "state-start").attr("r", 7).attr("width", 14).attr("height", 14), i.attr("class", "state-end").attr("r", 5).attr("width", 10).attr("height", 10), T(t, l), t.intersect = function(s) {
1914
- return N.circle(t, 7, s);
1915
- }, a;
1916
- }, "end"), Kr = /* @__PURE__ */ d(async (e, t) => {
1917
- const a = t.padding / 2, i = 4, l = 8;
1918
- let s;
1919
- t.classes ? s = "node " + t.classes : s = "node default";
1920
- const r = e.insert("g").attr("class", s).attr("id", t.domId || t.id), n = r.insert("rect", ":first-child"), c = r.insert("line"), u = r.insert("line");
1921
- let o = 0, x = i;
1922
- const w = r.insert("g").attr("class", "label");
1923
- let b = 0;
1924
- const S = t.classData.annotations?.[0], v = t.classData.annotations[0] ? "«" + t.classData.annotations[0] + "»" : "", k = w.node().appendChild(await K(v, t.labelStyle, !0, !0));
1925
- let B = k.getBBox();
1926
- if (j(R().flowchart.htmlLabels)) {
1927
- const E = k.children[0], h = O(k);
1928
- B = E.getBoundingClientRect(), h.attr("width", B.width), h.attr("height", B.height);
1929
- }
1930
- t.classData.annotations[0] && (x += B.height + i, o += B.width);
1931
- let _ = t.classData.label;
1932
- t.classData.type !== void 0 && t.classData.type !== "" && (R().flowchart.htmlLabels ? _ += "&lt;" + t.classData.type + "&gt;" : _ += "<" + t.classData.type + ">");
1933
- const D = w.node().appendChild(await K(_, t.labelStyle, !0, !0));
1934
- O(D).attr("class", "classTitle");
1935
- let y = D.getBBox();
1936
- if (j(R().flowchart.htmlLabels)) {
1937
- const E = D.children[0], h = O(D);
1938
- y = E.getBoundingClientRect(), h.attr("width", y.width), h.attr("height", y.height);
1939
- }
1940
- x += y.height + i, y.width > o && (o = y.width);
1941
- const g = [];
1942
- t.classData.members.forEach(async (E) => {
1943
- const h = E.getDisplayDetails();
1944
- let W = h.displayText;
1945
- R().flowchart.htmlLabels && (W = W.replace(/</g, "&lt;").replace(/>/g, "&gt;"));
1946
- const p = w.node().appendChild(
1947
- await K(
1948
- W,
1949
- h.cssStyle ? h.cssStyle : t.labelStyle,
1950
- !0,
1951
- !0
1952
- )
1953
- );
1954
- let I = p.getBBox();
1955
- if (j(R().flowchart.htmlLabels)) {
1956
- const Z = p.children[0], V = O(p);
1957
- I = Z.getBoundingClientRect(), V.attr("width", I.width), V.attr("height", I.height);
1958
- }
1959
- I.width > o && (o = I.width), x += I.height + i, g.push(p);
1960
- }), x += l;
1961
- const f = [];
1962
- if (t.classData.methods.forEach(async (E) => {
1963
- const h = E.getDisplayDetails();
1964
- let W = h.displayText;
1965
- R().flowchart.htmlLabels && (W = W.replace(/</g, "&lt;").replace(/>/g, "&gt;"));
1966
- const p = w.node().appendChild(
1967
- await K(
1968
- W,
1969
- h.cssStyle ? h.cssStyle : t.labelStyle,
1970
- !0,
1971
- !0
1972
- )
1973
- );
1974
- let I = p.getBBox();
1975
- if (j(R().flowchart.htmlLabels)) {
1976
- const Z = p.children[0], V = O(p);
1977
- I = Z.getBoundingClientRect(), V.attr("width", I.width), V.attr("height", I.height);
1978
- }
1979
- I.width > o && (o = I.width), x += I.height + i, f.push(p);
1980
- }), x += l, S) {
1981
- let E = (o - B.width) / 2;
1982
- O(k).attr(
1983
- "transform",
1984
- "translate( " + (-1 * o / 2 + E) + ", " + -1 * x / 2 + ")"
1985
- ), b = B.height + i;
1986
- }
1987
- let m = (o - y.width) / 2;
1988
- return O(D).attr(
1989
- "transform",
1990
- "translate( " + (-1 * o / 2 + m) + ", " + (-1 * x / 2 + b) + ")"
1991
- ), b += y.height + i, c.attr("class", "divider").attr("x1", -o / 2 - a).attr("x2", o / 2 + a).attr("y1", -x / 2 - a + l + b).attr("y2", -x / 2 - a + l + b), b += l, g.forEach((E) => {
1992
- O(E).attr(
1993
- "transform",
1994
- "translate( " + -o / 2 + ", " + (-1 * x / 2 + b + l / 2) + ")"
1995
- );
1996
- const h = E?.getBBox();
1997
- b += (h?.height ?? 0) + i;
1998
- }), b += l, u.attr("class", "divider").attr("x1", -o / 2 - a).attr("x2", o / 2 + a).attr("y1", -x / 2 - a + l + b).attr("y2", -x / 2 - a + l + b), b += l, f.forEach((E) => {
1999
- O(E).attr(
2000
- "transform",
2001
- "translate( " + -o / 2 + ", " + (-1 * x / 2 + b) + ")"
2002
- );
2003
- const h = E?.getBBox();
2004
- b += (h?.height ?? 0) + i;
2005
- }), n.attr("style", t.style).attr("class", "outer title-state").attr("x", -o / 2 - a).attr("y", -(x / 2) - a).attr("width", o + t.padding).attr("height", x + t.padding), T(t, n), t.intersect = function(E) {
2006
- return N.rect(t, E);
2007
- }, r;
2008
- }, "class_box"), Ft = {
2009
- rhombus: At,
2010
- composite: Rr,
2011
- question: At,
2012
- rect: Or,
2013
- labelRect: zr,
2014
- rectWithTitle: Ar,
2015
- choice: kr,
2016
- circle: Fr,
2017
- doublecircle: Wr,
2018
- stadium: Mr,
2019
- hexagon: vr,
2020
- block_arrow: Er,
2021
- rect_left_inv_arrow: _r,
2022
- lean_right: Dr,
2023
- lean_left: Nr,
2024
- trapezoid: Tr,
2025
- inv_trapezoid: Br,
2026
- rect_right_inv_arrow: Cr,
2027
- cylinder: Ir,
2028
- start: Yr,
2029
- end: Hr,
2030
- note: Sr,
2031
- subroutine: Pr,
2032
- fork: Mt,
2033
- join: Mt,
2034
- class_box: Kr
2035
- }, lt = {}, te = /* @__PURE__ */ d(async (e, t, a) => {
2036
- let i, l;
2037
- if (t.link) {
2038
- let s;
2039
- R().securityLevel === "sandbox" ? s = "_top" : t.linkTarget && (s = t.linkTarget || "_blank"), i = e.insert("svg:a").attr("xlink:href", t.link).attr("target", s), l = await Ft[t.shape](i, t, a);
2040
- } else
2041
- l = await Ft[t.shape](e, t, a), i = l;
2042
- return t.tooltip && l.attr("title", t.tooltip), t.class && l.attr("class", "node default " + t.class), lt[t.id] = i, t.haveCallback && lt[t.id].attr("class", lt[t.id].attr("class") + " clickable"), i;
2043
- }, "insertNode"), Xr = /* @__PURE__ */ d((e) => {
2044
- const t = lt[e.id];
2045
- L.trace(
2046
- "Transforming node",
2047
- e.diff,
2048
- e,
2049
- "translate(" + (e.x - e.width / 2 - 5) + ", " + e.width / 2 + ")"
2050
- );
2051
- const a = 8, i = e.diff || 0;
2052
- return e.clusterNode ? t.attr(
2053
- "transform",
2054
- "translate(" + (e.x + i - e.width / 2) + ", " + (e.y - e.height / 2 - a) + ")"
2055
- ) : t.attr("transform", "translate(" + e.x + ", " + e.y + ")"), i;
2056
- }, "positionNode");
2057
- function Dt(e, t, a = !1) {
2058
- const i = e;
2059
- let l = "default";
2060
- (i?.classes?.length || 0) > 0 && (l = (i?.classes ?? []).join(" ")), l = l + " flowchart-label";
2061
- let s = 0, r = "", n;
2062
- switch (i.type) {
2063
- case "round":
2064
- s = 5, r = "rect";
2065
- break;
2066
- case "composite":
2067
- s = 0, r = "composite", n = 0;
2068
- break;
2069
- case "square":
2070
- r = "rect";
2071
- break;
2072
- case "diamond":
2073
- r = "question";
2074
- break;
2075
- case "hexagon":
2076
- r = "hexagon";
2077
- break;
2078
- case "block_arrow":
2079
- r = "block_arrow";
2080
- break;
2081
- case "odd":
2082
- r = "rect_left_inv_arrow";
2083
- break;
2084
- case "lean_right":
2085
- r = "lean_right";
2086
- break;
2087
- case "lean_left":
2088
- r = "lean_left";
2089
- break;
2090
- case "trapezoid":
2091
- r = "trapezoid";
2092
- break;
2093
- case "inv_trapezoid":
2094
- r = "inv_trapezoid";
2095
- break;
2096
- case "rect_left_inv_arrow":
2097
- r = "rect_left_inv_arrow";
2098
- break;
2099
- case "circle":
2100
- r = "circle";
2101
- break;
2102
- case "ellipse":
2103
- r = "ellipse";
2104
- break;
2105
- case "stadium":
2106
- r = "stadium";
2107
- break;
2108
- case "subroutine":
2109
- r = "subroutine";
2110
- break;
2111
- case "cylinder":
2112
- r = "cylinder";
2113
- break;
2114
- case "group":
2115
- r = "rect";
2116
- break;
2117
- case "doublecircle":
2118
- r = "doublecircle";
2119
- break;
2120
- default:
2121
- r = "rect";
2122
- }
2123
- const c = me(i?.styles ?? []), u = i.label, o = i.size ?? { width: 0, height: 0, x: 0, y: 0 };
2124
- return {
2125
- labelStyle: c.labelStyle,
2126
- shape: r,
2127
- labelText: u,
2128
- rx: s,
2129
- ry: s,
2130
- class: l,
2131
- style: c.style,
2132
- id: i.id,
2133
- directions: i.directions,
2134
- width: o.width,
2135
- height: o.height,
2136
- x: o.x,
2137
- y: o.y,
2138
- positioned: a,
2139
- intersect: void 0,
2140
- type: i.type,
2141
- padding: n ?? rt()?.block?.padding ?? 0
2142
- };
2143
- }
2144
- d(Dt, "getNodeFromBlock");
2145
- async function ee(e, t, a) {
2146
- const i = Dt(t, a, !1);
2147
- if (i.type === "group")
2148
- return;
2149
- const l = rt(), s = await te(e, i, { config: l }), r = s.node().getBBox(), n = a.getBlock(i.id);
2150
- n.size = { width: r.width, height: r.height, x: 0, y: 0, node: s }, a.setBlock(n), s.remove();
2151
- }
2152
- d(ee, "calculateBlockSize");
2153
- async function re(e, t, a) {
2154
- const i = Dt(t, a, !0);
2155
- if (a.getBlock(i.id).type !== "space") {
2156
- const s = rt();
2157
- await te(e, i, { config: s }), t.intersect = i?.intersect, Xr(i);
2158
- }
2159
- }
2160
- d(re, "insertBlockPositioned");
2161
- async function dt(e, t, a, i) {
2162
- for (const l of t)
2163
- await i(e, l, a), l.children && await dt(e, l.children, a, i);
2164
- }
2165
- d(dt, "performOperations");
2166
- async function ae(e, t, a) {
2167
- await dt(e, t, a, ee);
2168
- }
2169
- d(ae, "calculateBlockSizes");
2170
- async function se(e, t, a) {
2171
- await dt(e, t, a, re);
2172
- }
2173
- d(se, "insertBlocks");
2174
- async function ie(e, t, a, i, l) {
2175
- const s = new Se({
2176
- multigraph: !0,
2177
- compound: !0
2178
- });
2179
- s.setGraph({
2180
- rankdir: "TB",
2181
- nodesep: 10,
2182
- ranksep: 10,
2183
- marginx: 8,
2184
- marginy: 8
2185
- });
2186
- for (const r of a)
2187
- r.size && s.setNode(r.id, {
2188
- width: r.size.width,
2189
- height: r.size.height,
2190
- intersect: r.intersect
2191
- });
2192
- for (const r of t)
2193
- if (r.start && r.end) {
2194
- const n = i.getBlock(r.start), c = i.getBlock(r.end);
2195
- if (n?.size && c?.size) {
2196
- const u = n.size, o = c.size, x = [
2197
- { x: u.x, y: u.y },
2198
- { x: u.x + (o.x - u.x) / 2, y: u.y + (o.y - u.y) / 2 },
2199
- { x: o.x, y: o.y }
2200
- ];
2201
- gr(
2202
- e,
2203
- { v: r.start, w: r.end, name: r.id },
2204
- {
2205
- ...r,
2206
- arrowTypeEnd: r.arrowTypeEnd,
2207
- arrowTypeStart: r.arrowTypeStart,
2208
- points: x,
2209
- classes: "edge-thickness-normal edge-pattern-solid flowchart-link LS-a1 LE-b1"
2210
- },
2211
- void 0,
2212
- "block",
2213
- s,
2214
- l
2215
- ), r.label && (await cr(e, {
2216
- ...r,
2217
- label: r.label,
2218
- labelStyle: "stroke: #333; stroke-width: 1.5px;fill:none;",
2219
- arrowTypeEnd: r.arrowTypeEnd,
2220
- arrowTypeStart: r.arrowTypeStart,
2221
- points: x,
2222
- classes: "edge-thickness-normal edge-pattern-solid flowchart-link LS-a1 LE-b1"
2223
- }), or(
2224
- { ...r, x: x[1].x, y: x[1].y },
2225
- {
2226
- originalPath: x
2227
- }
2228
- ));
2229
- }
2230
- }
2231
- }
2232
- d(ie, "insertEdges");
2233
- var Ur = /* @__PURE__ */ d(function(e, t) {
2234
- return t.db.getClasses();
2235
- }, "getClasses"), jr = /* @__PURE__ */ d(async function(e, t, a, i) {
2236
- const { securityLevel: l, block: s } = rt(), r = i.db;
2237
- let n;
2238
- l === "sandbox" && (n = O("#i" + t));
2239
- const c = l === "sandbox" ? O(n.nodes()[0].contentDocument.body) : O("body"), u = l === "sandbox" ? c.select(`[id="${t}"]`) : O(`[id="${t}"]`);
2240
- ar(u, ["point", "circle", "cross"], i.type, t);
2241
- const x = r.getBlocks(), w = r.getBlocksFlat(), b = r.getEdges(), S = u.insert("g").attr("class", "block");
2242
- await ae(S, x, r);
2243
- const v = jt(r);
2244
- if (await se(S, x, r), await ie(S, b, w, r, t), v) {
2245
- const k = v, B = Math.max(1, Math.round(0.125 * (k.width / k.height))), _ = k.height + B + 10, D = k.width + 10, { useMaxWidth: y } = s;
2246
- he(u, _, D, !!y), L.debug("Here Bounds", v, k), u.attr(
2247
- "viewBox",
2248
- `${k.x - 5} ${k.y - 5} ${k.width + 10} ${k.height + 10}`
2249
- );
2250
- }
2251
- }, "draw"), Vr = {
2252
- draw: jr,
2253
- getClasses: Ur
2254
- }, ta = {
2255
- parser: ve,
2256
- db: Ke,
2257
- renderer: Vr,
2258
- styles: Ue
2259
- };
2260
- export {
2261
- ta as diagram
2262
- };