@sourcegraph/amp 0.0.1749585689-g82b91d → 0.0.1749600114-g5c00b8

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