@aidapt/caity-chat 3.0.0

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