lowcoder-comps 0.0.29 → 0.0.31

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 (86) hide show
  1. package/README.md +120 -0
  2. package/index.html +26 -0
  3. package/index.tsx +21 -0
  4. package/jest.config.js +6 -0
  5. package/package.json +3 -4
  6. package/src/__test__/allComp.test.tsx +61 -0
  7. package/src/app-env.d.ts +3 -0
  8. package/src/comps/calendarComp/calendarComp.tsx +633 -0
  9. package/src/comps/calendarComp/calendarConstants.tsx +1048 -0
  10. package/src/comps/calendarComp/errorBoundary.tsx +30 -0
  11. package/src/comps/chartComp/chartComp.tsx +442 -0
  12. package/src/comps/chartComp/chartConfigs/barChartConfig.tsx +51 -0
  13. package/src/comps/chartComp/chartConfigs/cartesianAxisConfig.tsx +307 -0
  14. package/src/comps/chartComp/chartConfigs/chartUrls.tsx +9 -0
  15. package/src/comps/chartComp/chartConfigs/legendConfig.tsx +55 -0
  16. package/src/comps/chartComp/chartConfigs/lineChartConfig.tsx +96 -0
  17. package/src/comps/chartComp/chartConfigs/pieChartConfig.tsx +83 -0
  18. package/src/comps/chartComp/chartConfigs/scatterChartConfig.tsx +62 -0
  19. package/src/comps/chartComp/chartConstants.tsx +299 -0
  20. package/src/comps/chartComp/chartPropertyView.tsx +235 -0
  21. package/src/comps/chartComp/chartUtils.ts +291 -0
  22. package/src/comps/chartComp/reactEcharts/core.tsx +194 -0
  23. package/src/comps/chartComp/reactEcharts/index.ts +21 -0
  24. package/src/comps/chartComp/reactEcharts/types.ts +76 -0
  25. package/src/comps/chartComp/seriesComp.tsx +119 -0
  26. package/src/comps/imageEditorComp/imageEditorClass.tsx +52 -0
  27. package/src/comps/imageEditorComp/imageEditorConstants.tsx +109 -0
  28. package/src/comps/imageEditorComp/index.tsx +184 -0
  29. package/src/comps/mermaidComp/index.tsx +44 -0
  30. package/src/comps/mermaidComp/mermaid.tsx +29 -0
  31. package/src/global.ts +1 -0
  32. package/src/i18n/comps/index.tsx +29 -0
  33. package/src/i18n/comps/locales/en.ts +163 -0
  34. package/src/i18n/comps/locales/enObj.tsx +198 -0
  35. package/src/i18n/comps/locales/index.ts +7 -0
  36. package/src/i18n/comps/locales/types.tsx +10 -0
  37. package/src/i18n/comps/locales/zh.ts +156 -0
  38. package/src/i18n/comps/locales/zhObj.tsx +4 -0
  39. package/src/index.ts +11 -0
  40. package/tsconfig.json +22 -0
  41. package/vite.config.js +10 -0
  42. package/2085da13.js +0 -960
  43. package/250691b5.js +0 -5
  44. package/256b619e.js +0 -92
  45. package/274f545c.js +0 -881
  46. package/289305a1.js +0 -208
  47. package/2eae45c2.js +0 -34
  48. package/2ff2c7a6.js +0 -6
  49. package/2ff7471d.js +0 -9
  50. package/335b22a2.js +0 -220
  51. package/38c826fe.js +0 -1127
  52. package/44011c1d.js +0 -818
  53. package/4fc06812.js +0 -64
  54. package/56a787cf.js +0 -915
  55. package/590941ff.js +0 -86
  56. package/6341867f.js +0 -804
  57. package/657fd065.js +0 -8
  58. package/78a5e50d.js +0 -1579
  59. package/820c3641.js +0 -25
  60. package/88b4e75a.js +0 -2967
  61. package/8d999722.js +0 -1102
  62. package/92e85b65.js +0 -65
  63. package/989caea2.js +0 -505
  64. package/99b984d1.js +0 -237
  65. package/9e5f02d6.js +0 -19104
  66. package/a40faea7.js +0 -11624
  67. package/abac9104.js +0 -1536
  68. package/af2f19b3.js +0 -819
  69. package/af5ee3de.js +0 -268
  70. package/b24707c2.js +0 -48428
  71. package/b68f8b69.js +0 -1276
  72. package/ba68ba65.js +0 -391
  73. package/bafb8599.js +0 -319
  74. package/bba60c35.js +0 -2501
  75. package/bd7c2a8e.js +0 -1089
  76. package/c71dadea.js +0 -455
  77. package/d05c1762.js +0 -933
  78. package/d073ab24.js +0 -134353
  79. package/d838cd10.js +0 -769
  80. package/dc36a6eb.js +0 -796
  81. package/ed143450.js +0 -1284
  82. package/ee8ec8f2.js +0 -2284
  83. package/f6755210.js +0 -1269
  84. package/f9637058.js +0 -16
  85. package/fba4c8e4.js +0 -447
  86. package/index.js +0 -5
package/f6755210.js DELETED
@@ -1,1269 +0,0 @@
1
- var ve = Object.defineProperty, Ne = Object.defineProperties;
2
- var ke = Object.getOwnPropertyDescriptors;
3
- var ue = Object.getOwnPropertySymbols;
4
- var Ie = Object.prototype.hasOwnProperty, Oe = Object.prototype.propertyIsEnumerable;
5
- var he = (e, a, l) => a in e ? ve(e, a, { enumerable: !0, configurable: !0, writable: !0, value: l }) : e[a] = l, j = (e, a) => {
6
- for (var l in a || (a = {}))
7
- Ie.call(a, l) && he(e, l, a[l]);
8
- if (ue)
9
- for (var l of ue(a))
10
- Oe.call(a, l) && he(e, l, a[l]);
11
- return e;
12
- }, U = (e, a) => Ne(e, ke(a));
13
- var K = (e, a, l) => new Promise((u, n) => {
14
- var p = (f) => {
15
- try {
16
- b(l.next(f));
17
- } catch (g) {
18
- n(g);
19
- }
20
- }, o = (f) => {
21
- try {
22
- b(l.throw(f));
23
- } catch (g) {
24
- n(g);
25
- }
26
- }, b = (f) => f.done ? u(f.value) : Promise.resolve(f.value).then(p, o);
27
- b((l = l.apply(e, a)).next());
28
- });
29
- import { c as Te, Z as ne, h as J, i as ze, l as S, E as Ce, B as Ae, o as Re } from "./d073ab24.js";
30
- import { c as Be } from "./657fd065.js";
31
- import { i as Pe, c as Fe, b as Ke, d as Me, a as xe, p as Ye } from "./8d999722.js";
32
- import { G as We } from "./274f545c.js";
33
- import { o as Ve } from "./92e85b65.js";
34
- import { s as je } from "./2ff7471d.js";
35
- import { c as Ue } from "./250691b5.js";
36
- import "./88b4e75a.js";
37
- import "./2eae45c2.js";
38
- import "./2ff2c7a6.js";
39
- import "./256b619e.js";
40
- import "./f9637058.js";
41
- var de, ge, ie = function() {
42
- var e = function(D, c, s, i) {
43
- for (s = s || {}, i = D.length; i--; s[D[i]] = c)
44
- ;
45
- return s;
46
- }, a = [1, 7], l = [1, 13], u = [1, 14], n = [1, 15], p = [1, 19], o = [1, 16], b = [1, 17], f = [1, 18], g = [8, 30], x = [8, 21, 28, 29, 30, 31, 32, 40, 44, 47], E = [1, 23], T = [1, 24], v = [8, 15, 16, 21, 28, 29, 30, 31, 32, 40, 44, 47], N = [8, 15, 16, 21, 27, 28, 29, 30, 31, 32, 40, 44, 47], y = [1, 49], L = {
47
- trace: function() {
48
- },
49
- yy: {},
50
- symbols_: { error: 2, spaceLines: 3, SPACELINE: 4, NL: 5, separator: 6, SPACE: 7, EOF: 8, start: 9, BLOCK_DIAGRAM_KEY: 10, document: 11, stop: 12, statement: 13, link: 14, LINK: 15, START_LINK: 16, LINK_LABEL: 17, STR: 18, nodeStatement: 19, columnsStatement: 20, SPACE_BLOCK: 21, blockStatement: 22, classDefStatement: 23, cssClassStatement: 24, styleStatement: 25, node: 26, SIZE: 27, COLUMNS: 28, "id-block": 29, end: 30, block: 31, NODE_ID: 32, nodeShapeNLabel: 33, dirList: 34, DIR: 35, NODE_DSTART: 36, NODE_DEND: 37, BLOCK_ARROW_START: 38, BLOCK_ARROW_END: 39, classDef: 40, CLASSDEF_ID: 41, CLASSDEF_STYLEOPTS: 42, DEFAULT: 43, class: 44, CLASSENTITY_IDS: 45, STYLECLASS: 46, style: 47, STYLE_ENTITY_IDS: 48, STYLE_DEFINITION_DATA: 49, $accept: 0, $end: 1 },
51
- terminals_: { 2: "error", 4: "SPACELINE", 5: "NL", 7: "SPACE", 8: "EOF", 10: "BLOCK_DIAGRAM_KEY", 15: "LINK", 16: "START_LINK", 17: "LINK_LABEL", 18: "STR", 21: "SPACE_BLOCK", 27: "SIZE", 28: "COLUMNS", 29: "id-block", 30: "end", 31: "block", 32: "NODE_ID", 35: "DIR", 36: "NODE_DSTART", 37: "NODE_DEND", 38: "BLOCK_ARROW_START", 39: "BLOCK_ARROW_END", 40: "classDef", 41: "CLASSDEF_ID", 42: "CLASSDEF_STYLEOPTS", 43: "DEFAULT", 44: "class", 45: "CLASSENTITY_IDS", 46: "STYLECLASS", 47: "style", 48: "STYLE_ENTITY_IDS", 49: "STYLE_DEFINITION_DATA" },
52
- productions_: [0, [3, 1], [3, 2], [3, 2], [6, 1], [6, 1], [6, 1], [9, 3], [12, 1], [12, 1], [12, 2], [12, 2], [11, 1], [11, 2], [14, 1], [14, 4], [13, 1], [13, 1], [13, 1], [13, 1], [13, 1], [13, 1], [13, 1], [19, 3], [19, 2], [19, 1], [20, 1], [22, 4], [22, 3], [26, 1], [26, 2], [34, 1], [34, 2], [33, 3], [33, 4], [23, 3], [23, 3], [24, 3], [25, 3]],
53
- performAction: function(c, s, i, h, d, t, m) {
54
- var r = t.length - 1;
55
- switch (d) {
56
- case 4:
57
- h.getLogger().debug("Rule: separator (NL) ");
58
- break;
59
- case 5:
60
- h.getLogger().debug("Rule: separator (Space) ");
61
- break;
62
- case 6:
63
- h.getLogger().debug("Rule: separator (EOF) ");
64
- break;
65
- case 7:
66
- h.getLogger().debug("Rule: hierarchy: ", t[r - 1]), h.setHierarchy(t[r - 1]);
67
- break;
68
- case 8:
69
- h.getLogger().debug("Stop NL ");
70
- break;
71
- case 9:
72
- h.getLogger().debug("Stop EOF ");
73
- break;
74
- case 10:
75
- h.getLogger().debug("Stop NL2 ");
76
- break;
77
- case 11:
78
- h.getLogger().debug("Stop EOF2 ");
79
- break;
80
- case 12:
81
- h.getLogger().debug("Rule: statement: ", t[r]), typeof t[r].length == "number" ? this.$ = t[r] : this.$ = [t[r]];
82
- break;
83
- case 13:
84
- h.getLogger().debug("Rule: statement #2: ", t[r - 1]), this.$ = [t[r - 1]].concat(t[r]);
85
- break;
86
- case 14:
87
- h.getLogger().debug("Rule: link: ", t[r], c), this.$ = { edgeTypeStr: t[r], label: "" };
88
- break;
89
- case 15:
90
- h.getLogger().debug("Rule: LABEL link: ", t[r - 3], t[r - 1], t[r]), this.$ = { edgeTypeStr: t[r], label: t[r - 1] };
91
- break;
92
- case 18:
93
- const R = parseInt(t[r]), W = h.generateId();
94
- this.$ = { id: W, type: "space", label: "", width: R, children: [] };
95
- break;
96
- case 23:
97
- h.getLogger().debug("Rule: (nodeStatement link node) ", t[r - 2], t[r - 1], t[r], " typestr: ", t[r - 1].edgeTypeStr);
98
- const F = h.edgeStrToEdgeData(t[r - 1].edgeTypeStr);
99
- this.$ = [
100
- { id: t[r - 2].id, label: t[r - 2].label, type: t[r - 2].type, directions: t[r - 2].directions },
101
- { id: t[r - 2].id + "-" + t[r].id, start: t[r - 2].id, end: t[r].id, label: t[r - 1].label, type: "edge", directions: t[r].directions, arrowTypeEnd: F, arrowTypeStart: "arrow_open" },
102
- { id: t[r].id, label: t[r].label, type: h.typeStr2Type(t[r].typeStr), directions: t[r].directions }
103
- ];
104
- break;
105
- case 24:
106
- h.getLogger().debug("Rule: nodeStatement (abc88 node size) ", t[r - 1], t[r]), this.$ = { id: t[r - 1].id, label: t[r - 1].label, type: h.typeStr2Type(t[r - 1].typeStr), directions: t[r - 1].directions, widthInColumns: parseInt(t[r], 10) };
107
- break;
108
- case 25:
109
- h.getLogger().debug("Rule: nodeStatement (node) ", t[r]), this.$ = { id: t[r].id, label: t[r].label, type: h.typeStr2Type(t[r].typeStr), directions: t[r].directions, widthInColumns: 1 };
110
- break;
111
- case 26:
112
- h.getLogger().debug("APA123", this ? this : "na"), h.getLogger().debug("COLUMNS: ", t[r]), this.$ = { type: "column-setting", columns: t[r] === "auto" ? -1 : parseInt(t[r]) };
113
- break;
114
- case 27:
115
- h.getLogger().debug("Rule: id-block statement : ", t[r - 2], t[r - 1]), h.generateId(), this.$ = U(j({}, t[r - 2]), { type: "composite", children: t[r - 1] });
116
- break;
117
- case 28:
118
- h.getLogger().debug("Rule: blockStatement : ", t[r - 2], t[r - 1], t[r]);
119
- const C = h.generateId();
120
- this.$ = { id: C, type: "composite", label: "", children: t[r - 1] };
121
- break;
122
- case 29:
123
- h.getLogger().debug("Rule: node (NODE_ID separator): ", t[r]), this.$ = { id: t[r] };
124
- break;
125
- case 30:
126
- h.getLogger().debug("Rule: node (NODE_ID nodeShapeNLabel separator): ", t[r - 1], t[r]), this.$ = { id: t[r - 1], label: t[r].label, typeStr: t[r].typeStr, directions: t[r].directions };
127
- break;
128
- case 31:
129
- h.getLogger().debug("Rule: dirList: ", t[r]), this.$ = [t[r]];
130
- break;
131
- case 32:
132
- h.getLogger().debug("Rule: dirList: ", t[r - 1], t[r]), this.$ = [t[r - 1]].concat(t[r]);
133
- break;
134
- case 33:
135
- h.getLogger().debug("Rule: nodeShapeNLabel: ", t[r - 2], t[r - 1], t[r]), this.$ = { typeStr: t[r - 2] + t[r], label: t[r - 1] };
136
- break;
137
- case 34:
138
- h.getLogger().debug("Rule: BLOCK_ARROW nodeShapeNLabel: ", t[r - 3], t[r - 2], " #3:", t[r - 1], t[r]), this.$ = { typeStr: t[r - 3] + t[r], label: t[r - 2], directions: t[r - 1] };
139
- break;
140
- case 35:
141
- case 36:
142
- this.$ = { type: "classDef", id: t[r - 1].trim(), css: t[r].trim() };
143
- break;
144
- case 37:
145
- this.$ = { type: "applyClass", id: t[r - 1].trim(), styleClass: t[r].trim() };
146
- break;
147
- case 38:
148
- this.$ = { type: "applyStyles", id: t[r - 1].trim(), stylesStr: t[r].trim() };
149
- break;
150
- }
151
- },
152
- table: [{ 9: 1, 10: [1, 2] }, { 1: [3] }, { 11: 3, 13: 4, 19: 5, 20: 6, 21: a, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 28: l, 29: u, 31: n, 32: p, 40: o, 44: b, 47: f }, { 8: [1, 20] }, e(g, [2, 12], { 13: 4, 19: 5, 20: 6, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 11: 21, 21: a, 28: l, 29: u, 31: n, 32: p, 40: o, 44: b, 47: f }), e(x, [2, 16], { 14: 22, 15: E, 16: T }), e(x, [2, 17]), e(x, [2, 18]), e(x, [2, 19]), e(x, [2, 20]), e(x, [2, 21]), e(x, [2, 22]), e(v, [2, 25], { 27: [1, 25] }), e(x, [2, 26]), { 19: 26, 26: 12, 32: p }, { 11: 27, 13: 4, 19: 5, 20: 6, 21: a, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 28: l, 29: u, 31: n, 32: p, 40: o, 44: b, 47: f }, { 41: [1, 28], 43: [1, 29] }, { 45: [1, 30] }, { 48: [1, 31] }, e(N, [2, 29], { 33: 32, 36: [1, 33], 38: [1, 34] }), { 1: [2, 7] }, e(g, [2, 13]), { 26: 35, 32: p }, { 32: [2, 14] }, { 17: [1, 36] }, e(v, [2, 24]), { 11: 37, 13: 4, 14: 22, 15: E, 16: T, 19: 5, 20: 6, 21: a, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 28: l, 29: u, 31: n, 32: p, 40: o, 44: b, 47: f }, { 30: [1, 38] }, { 42: [1, 39] }, { 42: [1, 40] }, { 46: [1, 41] }, { 49: [1, 42] }, e(N, [2, 30]), { 18: [1, 43] }, { 18: [1, 44] }, e(v, [2, 23]), { 18: [1, 45] }, { 30: [1, 46] }, e(x, [2, 28]), e(x, [2, 35]), e(x, [2, 36]), e(x, [2, 37]), e(x, [2, 38]), { 37: [1, 47] }, { 34: 48, 35: y }, { 15: [1, 50] }, e(x, [2, 27]), e(N, [2, 33]), { 39: [1, 51] }, { 34: 52, 35: y, 39: [2, 31] }, { 32: [2, 15] }, e(N, [2, 34]), { 39: [2, 32] }],
153
- defaultActions: { 20: [2, 7], 23: [2, 14], 50: [2, 15], 52: [2, 32] },
154
- parseError: function(c, s) {
155
- if (s.recoverable)
156
- this.trace(c);
157
- else {
158
- var i = new Error(c);
159
- throw i.hash = s, i;
160
- }
161
- },
162
- parse: function(c) {
163
- var s = this, i = [0], h = [], d = [null], t = [], m = this.table, r = "", R = 0, W = 0, F = 2, C = 1, ye = t.slice.call(arguments, 1), w = Object.create(this.lexer), M = { yy: {} };
164
- for (var $ in this.yy)
165
- Object.prototype.hasOwnProperty.call(this.yy, $) && (M.yy[$] = this.yy[$]);
166
- w.setInput(c, M.yy), M.yy.lexer = w, M.yy.parser = this, typeof w.yylloc == "undefined" && (w.yylloc = {});
167
- var ee = w.yylloc;
168
- t.push(ee);
169
- var we = w.options && w.options.ranges;
170
- typeof M.yy.parseError == "function" ? this.parseError = M.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
171
- function De() {
172
- var P;
173
- return P = h.pop() || w.lex() || C, typeof P != "number" && (P instanceof Array && (h = P, P = h.pop()), P = s.symbols_[P] || P), P;
174
- }
175
- for (var I, Y, z, te, V = {}, q, B, ce, Z; ; ) {
176
- if (Y = i[i.length - 1], this.defaultActions[Y] ? z = this.defaultActions[Y] : ((I === null || typeof I == "undefined") && (I = De()), z = m[Y] && m[Y][I]), typeof z == "undefined" || !z.length || !z[0]) {
177
- var se = "";
178
- Z = [];
179
- for (q in m[Y])
180
- this.terminals_[q] && q > F && Z.push("'" + this.terminals_[q] + "'");
181
- w.showPosition ? se = "Parse error on line " + (R + 1) + `:
182
- ` + w.showPosition() + `
183
- Expecting ` + Z.join(", ") + ", got '" + (this.terminals_[I] || I) + "'" : se = "Parse error on line " + (R + 1) + ": Unexpected " + (I == C ? "end of input" : "'" + (this.terminals_[I] || I) + "'"), this.parseError(se, {
184
- text: w.match,
185
- token: this.terminals_[I] || I,
186
- line: w.yylineno,
187
- loc: ee,
188
- expected: Z
189
- });
190
- }
191
- if (z[0] instanceof Array && z.length > 1)
192
- throw new Error("Parse Error: multiple actions possible at state: " + Y + ", token: " + I);
193
- switch (z[0]) {
194
- case 1:
195
- i.push(I), d.push(w.yytext), t.push(w.yylloc), i.push(z[1]), I = null, W = w.yyleng, r = w.yytext, R = w.yylineno, ee = w.yylloc;
196
- break;
197
- case 2:
198
- if (B = this.productions_[z[1]][1], V.$ = d[d.length - B], V._$ = {
199
- first_line: t[t.length - (B || 1)].first_line,
200
- last_line: t[t.length - 1].last_line,
201
- first_column: t[t.length - (B || 1)].first_column,
202
- last_column: t[t.length - 1].last_column
203
- }, we && (V._$.range = [
204
- t[t.length - (B || 1)].range[0],
205
- t[t.length - 1].range[1]
206
- ]), te = this.performAction.apply(V, [
207
- r,
208
- W,
209
- R,
210
- M.yy,
211
- z[1],
212
- d,
213
- t
214
- ].concat(ye)), typeof te != "undefined")
215
- return te;
216
- B && (i = i.slice(0, -1 * B * 2), d = d.slice(0, -1 * B), t = t.slice(0, -1 * B)), i.push(this.productions_[z[1]][0]), d.push(V.$), t.push(V._$), ce = m[i[i.length - 2]][i[i.length - 1]], i.push(ce);
217
- break;
218
- case 3:
219
- return !0;
220
- }
221
- }
222
- return !0;
223
- }
224
- }, A = function() {
225
- var D = {
226
- EOF: 1,
227
- parseError: function(s, i) {
228
- if (this.yy.parser)
229
- this.yy.parser.parseError(s, i);
230
- else
231
- throw new Error(s);
232
- },
233
- // resets the lexer, sets new input
234
- setInput: function(c, s) {
235
- return this.yy = s || this.yy || {}, this._input = c, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
236
- first_line: 1,
237
- first_column: 0,
238
- last_line: 1,
239
- last_column: 0
240
- }, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
241
- },
242
- // consumes and returns one char from the input
243
- input: function() {
244
- var c = this._input[0];
245
- this.yytext += c, this.yyleng++, this.offset++, this.match += c, this.matched += c;
246
- var s = c.match(/(?:\r\n?|\n).*/g);
247
- return s ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), c;
248
- },
249
- // unshifts one char (or a string) into the input
250
- unput: function(c) {
251
- var s = c.length, i = c.split(/(?:\r\n?|\n)/g);
252
- this._input = c + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - s), this.offset -= s;
253
- var h = this.match.split(/(?:\r\n?|\n)/g);
254
- this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), i.length - 1 && (this.yylineno -= i.length - 1);
255
- var d = this.yylloc.range;
256
- return this.yylloc = {
257
- first_line: this.yylloc.first_line,
258
- last_line: this.yylineno + 1,
259
- first_column: this.yylloc.first_column,
260
- last_column: i ? (i.length === h.length ? this.yylloc.first_column : 0) + h[h.length - i.length].length - i[0].length : this.yylloc.first_column - s
261
- }, this.options.ranges && (this.yylloc.range = [d[0], d[0] + this.yyleng - s]), this.yyleng = this.yytext.length, this;
262
- },
263
- // When called from action, caches matched text and appends it on next action
264
- more: function() {
265
- return this._more = !0, this;
266
- },
267
- // 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.
268
- reject: function() {
269
- if (this.options.backtrack_lexer)
270
- this._backtrack = !0;
271
- else
272
- 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).
273
- ` + this.showPosition(), {
274
- text: "",
275
- token: null,
276
- line: this.yylineno
277
- });
278
- return this;
279
- },
280
- // retain first n characters of the match
281
- less: function(c) {
282
- this.unput(this.match.slice(c));
283
- },
284
- // displays already matched input, i.e. for error messages
285
- pastInput: function() {
286
- var c = this.matched.substr(0, this.matched.length - this.match.length);
287
- return (c.length > 20 ? "..." : "") + c.substr(-20).replace(/\n/g, "");
288
- },
289
- // displays upcoming input, i.e. for error messages
290
- upcomingInput: function() {
291
- var c = this.match;
292
- return c.length < 20 && (c += this._input.substr(0, 20 - c.length)), (c.substr(0, 20) + (c.length > 20 ? "..." : "")).replace(/\n/g, "");
293
- },
294
- // displays the character position where the lexing error occurred, i.e. for error messages
295
- showPosition: function() {
296
- var c = this.pastInput(), s = new Array(c.length + 1).join("-");
297
- return c + this.upcomingInput() + `
298
- ` + s + "^";
299
- },
300
- // test the lexed token: return FALSE when not a match, otherwise return token
301
- test_match: function(c, s) {
302
- var i, h, d;
303
- if (this.options.backtrack_lexer && (d = {
304
- yylineno: this.yylineno,
305
- yylloc: {
306
- first_line: this.yylloc.first_line,
307
- last_line: this.last_line,
308
- first_column: this.yylloc.first_column,
309
- last_column: this.yylloc.last_column
310
- },
311
- yytext: this.yytext,
312
- match: this.match,
313
- matches: this.matches,
314
- matched: this.matched,
315
- yyleng: this.yyleng,
316
- offset: this.offset,
317
- _more: this._more,
318
- _input: this._input,
319
- yy: this.yy,
320
- conditionStack: this.conditionStack.slice(0),
321
- done: this.done
322
- }, this.options.ranges && (d.yylloc.range = this.yylloc.range.slice(0))), h = c[0].match(/(?:\r\n?|\n).*/g), h && (this.yylineno += h.length), this.yylloc = {
323
- first_line: this.yylloc.last_line,
324
- last_line: this.yylineno + 1,
325
- first_column: this.yylloc.last_column,
326
- last_column: h ? h[h.length - 1].length - h[h.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + c[0].length
327
- }, this.yytext += c[0], this.match += c[0], this.matches = c, 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(c[0].length), this.matched += c[0], i = this.performAction.call(this, this.yy, this, s, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), i)
328
- return i;
329
- if (this._backtrack) {
330
- for (var t in d)
331
- this[t] = d[t];
332
- return !1;
333
- }
334
- return !1;
335
- },
336
- // return next match in input
337
- next: function() {
338
- if (this.done)
339
- return this.EOF;
340
- this._input || (this.done = !0);
341
- var c, s, i, h;
342
- this._more || (this.yytext = "", this.match = "");
343
- for (var d = this._currentRules(), t = 0; t < d.length; t++)
344
- if (i = this._input.match(this.rules[d[t]]), i && (!s || i[0].length > s[0].length)) {
345
- if (s = i, h = t, this.options.backtrack_lexer) {
346
- if (c = this.test_match(i, d[t]), c !== !1)
347
- return c;
348
- if (this._backtrack) {
349
- s = !1;
350
- continue;
351
- } else
352
- return !1;
353
- } else if (!this.options.flex)
354
- break;
355
- }
356
- return s ? (c = this.test_match(s, d[h]), c !== !1 ? c : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
357
- ` + this.showPosition(), {
358
- text: "",
359
- token: null,
360
- line: this.yylineno
361
- });
362
- },
363
- // return next match that has a token
364
- lex: function() {
365
- var s = this.next();
366
- return s || this.lex();
367
- },
368
- // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
369
- begin: function(s) {
370
- this.conditionStack.push(s);
371
- },
372
- // pop the previously active lexer condition state off the condition stack
373
- popState: function() {
374
- var s = this.conditionStack.length - 1;
375
- return s > 0 ? this.conditionStack.pop() : this.conditionStack[0];
376
- },
377
- // produce the lexer rule set which is active for the currently active lexer condition state
378
- _currentRules: function() {
379
- return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
380
- },
381
- // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
382
- topState: function(s) {
383
- return s = this.conditionStack.length - 1 - Math.abs(s || 0), s >= 0 ? this.conditionStack[s] : "INITIAL";
384
- },
385
- // alias for begin(condition)
386
- pushState: function(s) {
387
- this.begin(s);
388
- },
389
- // return the number of states currently on the stack
390
- stateStackSize: function() {
391
- return this.conditionStack.length;
392
- },
393
- options: {},
394
- performAction: function(s, i, h, d) {
395
- switch (h) {
396
- case 0:
397
- return 10;
398
- case 1:
399
- return s.getLogger().debug("Found space-block"), 31;
400
- case 2:
401
- return s.getLogger().debug("Found nl-block"), 31;
402
- case 3:
403
- return s.getLogger().debug("Found space-block"), 29;
404
- case 4:
405
- s.getLogger().debug(".", i.yytext);
406
- break;
407
- case 5:
408
- s.getLogger().debug("_", i.yytext);
409
- break;
410
- case 6:
411
- return 5;
412
- case 7:
413
- return i.yytext = -1, 28;
414
- case 8:
415
- return i.yytext = i.yytext.replace(/columns\s+/, ""), s.getLogger().debug("COLUMNS (LEX)", i.yytext), 28;
416
- case 9:
417
- this.pushState("md_string");
418
- break;
419
- case 10:
420
- return "MD_STR";
421
- case 11:
422
- this.popState();
423
- break;
424
- case 12:
425
- this.pushState("string");
426
- break;
427
- case 13:
428
- s.getLogger().debug("LEX: POPPING STR:", i.yytext), this.popState();
429
- break;
430
- case 14:
431
- return s.getLogger().debug("LEX: STR end:", i.yytext), "STR";
432
- case 15:
433
- return i.yytext = i.yytext.replace(/space\:/, ""), s.getLogger().debug("SPACE NUM (LEX)", i.yytext), 21;
434
- case 16:
435
- return i.yytext = "1", s.getLogger().debug("COLUMNS (LEX)", i.yytext), 21;
436
- case 17:
437
- return 43;
438
- case 18:
439
- return "LINKSTYLE";
440
- case 19:
441
- return "INTERPOLATE";
442
- case 20:
443
- return this.pushState("CLASSDEF"), 40;
444
- case 21:
445
- return this.popState(), this.pushState("CLASSDEFID"), "DEFAULT_CLASSDEF_ID";
446
- case 22:
447
- return this.popState(), this.pushState("CLASSDEFID"), 41;
448
- case 23:
449
- return this.popState(), 42;
450
- case 24:
451
- return this.pushState("CLASS"), 44;
452
- case 25:
453
- return this.popState(), this.pushState("CLASS_STYLE"), 45;
454
- case 26:
455
- return this.popState(), 46;
456
- case 27:
457
- return this.pushState("STYLE_STMNT"), 47;
458
- case 28:
459
- return this.popState(), this.pushState("STYLE_DEFINITION"), 48;
460
- case 29:
461
- return this.popState(), 49;
462
- case 30:
463
- return this.pushState("acc_title"), "acc_title";
464
- case 31:
465
- return this.popState(), "acc_title_value";
466
- case 32:
467
- return this.pushState("acc_descr"), "acc_descr";
468
- case 33:
469
- return this.popState(), "acc_descr_value";
470
- case 34:
471
- this.pushState("acc_descr_multiline");
472
- break;
473
- case 35:
474
- this.popState();
475
- break;
476
- case 36:
477
- return "acc_descr_multiline_value";
478
- case 37:
479
- return 30;
480
- case 38:
481
- return this.popState(), s.getLogger().debug("Lex: (("), "NODE_DEND";
482
- case 39:
483
- return this.popState(), s.getLogger().debug("Lex: (("), "NODE_DEND";
484
- case 40:
485
- return this.popState(), s.getLogger().debug("Lex: ))"), "NODE_DEND";
486
- case 41:
487
- return this.popState(), s.getLogger().debug("Lex: (("), "NODE_DEND";
488
- case 42:
489
- return this.popState(), s.getLogger().debug("Lex: (("), "NODE_DEND";
490
- case 43:
491
- return this.popState(), s.getLogger().debug("Lex: (-"), "NODE_DEND";
492
- case 44:
493
- return this.popState(), s.getLogger().debug("Lex: -)"), "NODE_DEND";
494
- case 45:
495
- return this.popState(), s.getLogger().debug("Lex: (("), "NODE_DEND";
496
- case 46:
497
- return this.popState(), s.getLogger().debug("Lex: ]]"), "NODE_DEND";
498
- case 47:
499
- return this.popState(), s.getLogger().debug("Lex: ("), "NODE_DEND";
500
- case 48:
501
- return this.popState(), s.getLogger().debug("Lex: ])"), "NODE_DEND";
502
- case 49:
503
- return this.popState(), s.getLogger().debug("Lex: /]"), "NODE_DEND";
504
- case 50:
505
- return this.popState(), s.getLogger().debug("Lex: /]"), "NODE_DEND";
506
- case 51:
507
- return this.popState(), s.getLogger().debug("Lex: )]"), "NODE_DEND";
508
- case 52:
509
- return this.popState(), s.getLogger().debug("Lex: )"), "NODE_DEND";
510
- case 53:
511
- return this.popState(), s.getLogger().debug("Lex: ]>"), "NODE_DEND";
512
- case 54:
513
- return this.popState(), s.getLogger().debug("Lex: ]"), "NODE_DEND";
514
- case 55:
515
- return s.getLogger().debug("Lexa: -)"), this.pushState("NODE"), 36;
516
- case 56:
517
- return s.getLogger().debug("Lexa: (-"), this.pushState("NODE"), 36;
518
- case 57:
519
- return s.getLogger().debug("Lexa: ))"), this.pushState("NODE"), 36;
520
- case 58:
521
- return s.getLogger().debug("Lexa: )"), this.pushState("NODE"), 36;
522
- case 59:
523
- return s.getLogger().debug("Lex: ((("), this.pushState("NODE"), 36;
524
- case 60:
525
- return s.getLogger().debug("Lexa: )"), this.pushState("NODE"), 36;
526
- case 61:
527
- return s.getLogger().debug("Lexa: )"), this.pushState("NODE"), 36;
528
- case 62:
529
- return s.getLogger().debug("Lexa: )"), this.pushState("NODE"), 36;
530
- case 63:
531
- return s.getLogger().debug("Lexc: >"), this.pushState("NODE"), 36;
532
- case 64:
533
- return s.getLogger().debug("Lexa: (["), this.pushState("NODE"), 36;
534
- case 65:
535
- return s.getLogger().debug("Lexa: )"), this.pushState("NODE"), 36;
536
- case 66:
537
- return this.pushState("NODE"), 36;
538
- case 67:
539
- return this.pushState("NODE"), 36;
540
- case 68:
541
- return this.pushState("NODE"), 36;
542
- case 69:
543
- return this.pushState("NODE"), 36;
544
- case 70:
545
- return this.pushState("NODE"), 36;
546
- case 71:
547
- return this.pushState("NODE"), 36;
548
- case 72:
549
- return this.pushState("NODE"), 36;
550
- case 73:
551
- return s.getLogger().debug("Lexa: ["), this.pushState("NODE"), 36;
552
- case 74:
553
- return this.pushState("BLOCK_ARROW"), s.getLogger().debug("LEX ARR START"), 38;
554
- case 75:
555
- return s.getLogger().debug("Lex: NODE_ID", i.yytext), 32;
556
- case 76:
557
- return s.getLogger().debug("Lex: EOF", i.yytext), 8;
558
- case 77:
559
- this.pushState("md_string");
560
- break;
561
- case 78:
562
- this.pushState("md_string");
563
- break;
564
- case 79:
565
- return "NODE_DESCR";
566
- case 80:
567
- this.popState();
568
- break;
569
- case 81:
570
- s.getLogger().debug("Lex: Starting string"), this.pushState("string");
571
- break;
572
- case 82:
573
- s.getLogger().debug("LEX ARR: Starting string"), this.pushState("string");
574
- break;
575
- case 83:
576
- return s.getLogger().debug("LEX: NODE_DESCR:", i.yytext), "NODE_DESCR";
577
- case 84:
578
- s.getLogger().debug("LEX POPPING"), this.popState();
579
- break;
580
- case 85:
581
- s.getLogger().debug("Lex: =>BAE"), this.pushState("ARROW_DIR");
582
- break;
583
- case 86:
584
- return i.yytext = i.yytext.replace(/^,\s*/, ""), s.getLogger().debug("Lex (right): dir:", i.yytext), "DIR";
585
- case 87:
586
- return i.yytext = i.yytext.replace(/^,\s*/, ""), s.getLogger().debug("Lex (left):", i.yytext), "DIR";
587
- case 88:
588
- return i.yytext = i.yytext.replace(/^,\s*/, ""), s.getLogger().debug("Lex (x):", i.yytext), "DIR";
589
- case 89:
590
- return i.yytext = i.yytext.replace(/^,\s*/, ""), s.getLogger().debug("Lex (y):", i.yytext), "DIR";
591
- case 90:
592
- return i.yytext = i.yytext.replace(/^,\s*/, ""), s.getLogger().debug("Lex (up):", i.yytext), "DIR";
593
- case 91:
594
- return i.yytext = i.yytext.replace(/^,\s*/, ""), s.getLogger().debug("Lex (down):", i.yytext), "DIR";
595
- case 92:
596
- return i.yytext = "]>", s.getLogger().debug("Lex (ARROW_DIR end):", i.yytext), this.popState(), this.popState(), "BLOCK_ARROW_END";
597
- case 93:
598
- return s.getLogger().debug("Lex: LINK", "#" + i.yytext + "#"), 15;
599
- case 94:
600
- return s.getLogger().debug("Lex: LINK", i.yytext), 15;
601
- case 95:
602
- return s.getLogger().debug("Lex: LINK", i.yytext), 15;
603
- case 96:
604
- return s.getLogger().debug("Lex: LINK", i.yytext), 15;
605
- case 97:
606
- return s.getLogger().debug("Lex: START_LINK", i.yytext), this.pushState("LLABEL"), 16;
607
- case 98:
608
- return s.getLogger().debug("Lex: START_LINK", i.yytext), this.pushState("LLABEL"), 16;
609
- case 99:
610
- return s.getLogger().debug("Lex: START_LINK", i.yytext), this.pushState("LLABEL"), 16;
611
- case 100:
612
- this.pushState("md_string");
613
- break;
614
- case 101:
615
- return s.getLogger().debug("Lex: Starting string"), this.pushState("string"), "LINK_LABEL";
616
- case 102:
617
- return this.popState(), s.getLogger().debug("Lex: LINK", "#" + i.yytext + "#"), 15;
618
- case 103:
619
- return this.popState(), s.getLogger().debug("Lex: LINK", i.yytext), 15;
620
- case 104:
621
- return this.popState(), s.getLogger().debug("Lex: LINK", i.yytext), 15;
622
- case 105:
623
- return s.getLogger().debug("Lex: COLON", i.yytext), i.yytext = i.yytext.slice(1), 27;
624
- }
625
- },
626
- rules: [/^(?:block-beta\b)/, /^(?:block\s+)/, /^(?:block\n+)/, /^(?:block:)/, /^(?:[\s]+)/, /^(?:[\n]+)/, /^(?:((\u000D\u000A)|(\u000A)))/, /^(?:columns\s+auto\b)/, /^(?:columns\s+[\d]+)/, /^(?:["][`])/, /^(?:[^`"]+)/, /^(?:[`]["])/, /^(?:["])/, /^(?:["])/, /^(?:[^"]*)/, /^(?:space[:]\d+)/, /^(?:space\b)/, /^(?:default\b)/, /^(?:linkStyle\b)/, /^(?:interpolate\b)/, /^(?:classDef\s+)/, /^(?:DEFAULT\s+)/, /^(?:\w+\s+)/, /^(?:[^\n]*)/, /^(?:class\s+)/, /^(?:(\w+)+((,\s*\w+)*))/, /^(?:[^\n]*)/, /^(?:style\s+)/, /^(?:(\w+)+((,\s*\w+)*))/, /^(?:[^\n]*)/, /^(?:accTitle\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*\{\s*)/, /^(?:[\}])/, /^(?:[^\}]*)/, /^(?:end\b\s*)/, /^(?:\(\(\()/, /^(?:\)\)\))/, /^(?:[\)]\))/, /^(?:\}\})/, /^(?:\})/, /^(?:\(-)/, /^(?:-\))/, /^(?:\(\()/, /^(?:\]\])/, /^(?:\()/, /^(?:\]\))/, /^(?:\\\])/, /^(?:\/\])/, /^(?:\)\])/, /^(?:[\)])/, /^(?:\]>)/, /^(?:[\]])/, /^(?:-\))/, /^(?:\(-)/, /^(?:\)\))/, /^(?:\))/, /^(?:\(\(\()/, /^(?:\(\()/, /^(?:\{\{)/, /^(?:\{)/, /^(?:>)/, /^(?:\(\[)/, /^(?:\()/, /^(?:\[\[)/, /^(?:\[\|)/, /^(?:\[\()/, /^(?:\)\)\))/, /^(?:\[\\)/, /^(?:\[\/)/, /^(?:\[\\)/, /^(?:\[)/, /^(?:<\[)/, /^(?:[^\(\[\n\-\)\{\}\s\<\>:]+)/, /^(?:$)/, /^(?:["][`])/, /^(?:["][`])/, /^(?:[^`"]+)/, /^(?:[`]["])/, /^(?:["])/, /^(?:["])/, /^(?:[^"]+)/, /^(?:["])/, /^(?:\]>\s*\()/, /^(?:,?\s*right\s*)/, /^(?:,?\s*left\s*)/, /^(?:,?\s*x\s*)/, /^(?:,?\s*y\s*)/, /^(?:,?\s*up\s*)/, /^(?:,?\s*down\s*)/, /^(?:\)\s*)/, /^(?:\s*[xo<]?--+[-xo>]\s*)/, /^(?:\s*[xo<]?==+[=xo>]\s*)/, /^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/, /^(?:\s*~~[\~]+\s*)/, /^(?:\s*[xo<]?--\s*)/, /^(?:\s*[xo<]?==\s*)/, /^(?:\s*[xo<]?-\.\s*)/, /^(?:["][`])/, /^(?:["])/, /^(?:\s*[xo<]?--+[-xo>]\s*)/, /^(?:\s*[xo<]?==+[=xo>]\s*)/, /^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/, /^(?::\d+)/],
627
- conditions: { STYLE_DEFINITION: { rules: [29], inclusive: !1 }, STYLE_STMNT: { rules: [28], inclusive: !1 }, CLASSDEFID: { rules: [23], inclusive: !1 }, CLASSDEF: { rules: [21, 22], inclusive: !1 }, CLASS_STYLE: { rules: [26], inclusive: !1 }, CLASS: { rules: [25], inclusive: !1 }, LLABEL: { rules: [100, 101, 102, 103, 104], inclusive: !1 }, ARROW_DIR: { rules: [86, 87, 88, 89, 90, 91, 92], inclusive: !1 }, BLOCK_ARROW: { rules: [77, 82, 85], inclusive: !1 }, NODE: { rules: [38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 78, 81], inclusive: !1 }, md_string: { rules: [10, 11, 79, 80], inclusive: !1 }, space: { rules: [], inclusive: !1 }, string: { rules: [13, 14, 83, 84], inclusive: !1 }, acc_descr_multiline: { rules: [35, 36], inclusive: !1 }, acc_descr: { rules: [33], inclusive: !1 }, acc_title: { rules: [31], inclusive: !1 }, INITIAL: { rules: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 15, 16, 17, 18, 19, 20, 24, 27, 30, 32, 34, 37, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 93, 94, 95, 96, 97, 98, 99, 105], inclusive: !0 } }
628
- };
629
- return D;
630
- }();
631
- L.lexer = A;
632
- function k() {
633
- this.yy = {};
634
- }
635
- return k.prototype = L, L.Parser = k, new k();
636
- }();
637
- ie.parser = ie;
638
- const Xe = ie;
639
- let O = {}, ae = [], X = {};
640
- const pe = "color", fe = "fill", Ge = "bgFill", Se = ",";
641
- let G = {};
642
- const He = function(e, a = "") {
643
- G[e] === void 0 && (G[e] = { id: e, styles: [], textStyles: [] });
644
- const l = G[e];
645
- a != null && a.split(Se).forEach((u) => {
646
- const n = u.replace(/([^;]*);/, "$1").trim();
647
- if (u.match(pe)) {
648
- const o = n.replace(fe, Ge).replace(pe, fe);
649
- l.textStyles.push(o);
650
- }
651
- l.styles.push(n);
652
- });
653
- }, qe = function(e, a = "") {
654
- const l = O[e];
655
- a != null && (l.styles = a.split(Se));
656
- }, Ze = function(e, a) {
657
- e.split(",").forEach(function(l) {
658
- let u = O[l];
659
- if (u === void 0) {
660
- const n = l.trim();
661
- O[n] = { id: n, type: "na", children: [] }, u = O[n];
662
- }
663
- u.classes || (u.classes = []), u.classes.push(a);
664
- });
665
- }, Le = (e, a) => {
666
- const l = e.flat(), u = [];
667
- for (const n of l) {
668
- if (n.type === "classDef") {
669
- He(n.id, n.css);
670
- continue;
671
- }
672
- if (n.type === "applyClass") {
673
- Ze(n.id, (n == null ? void 0 : n.styleClass) || "");
674
- continue;
675
- }
676
- if (n.type === "applyStyles") {
677
- n != null && n.stylesStr && qe(n.id, n == null ? void 0 : n.stylesStr);
678
- continue;
679
- }
680
- if (n.type === "column-setting")
681
- a.columns = n.columns || -1;
682
- else if (n.type === "edge")
683
- X[n.id] ? X[n.id]++ : X[n.id] = 1, n.id = X[n.id] + "-" + n.id, ae.push(n);
684
- else {
685
- n.label || (n.type === "composite" ? n.label = "" : n.label = n.id);
686
- const p = !O[n.id];
687
- if (p ? O[n.id] = n : (n.type !== "na" && (O[n.id].type = n.type), n.label !== n.id && (O[n.id].label = n.label)), n.children && Le(n.children, n), n.type === "space") {
688
- const o = n.width || 1;
689
- for (let b = 0; b < o; b++) {
690
- const f = Be(n);
691
- f.id = f.id + "-" + b, O[f.id] = f, u.push(f);
692
- }
693
- } else
694
- p && u.push(n);
695
- }
696
- }
697
- a.children = u;
698
- };
699
- let le = [], H = { id: "root", type: "composite", children: [], columns: -1 };
700
- const Je = () => {
701
- S.debug("Clear called"), Ce(), H = { id: "root", type: "composite", children: [], columns: -1 }, O = { root: H }, le = [], G = {}, ae = [], X = {};
702
- };
703
- function Qe(e) {
704
- switch (S.debug("typeStr2Type", e), e) {
705
- case "[]":
706
- return "square";
707
- case "()":
708
- return S.debug("we have a round"), "round";
709
- case "(())":
710
- return "circle";
711
- case ">]":
712
- return "rect_left_inv_arrow";
713
- case "{}":
714
- return "diamond";
715
- case "{{}}":
716
- return "hexagon";
717
- case "([])":
718
- return "stadium";
719
- case "[[]]":
720
- return "subroutine";
721
- case "[()]":
722
- return "cylinder";
723
- case "((()))":
724
- return "doublecircle";
725
- case "[//]":
726
- return "lean_right";
727
- case "[\\\\]":
728
- return "lean_left";
729
- case "[/\\]":
730
- return "trapezoid";
731
- case "[\\/]":
732
- return "inv_trapezoid";
733
- case "<[]>":
734
- return "block_arrow";
735
- default:
736
- return "na";
737
- }
738
- }
739
- function $e(e) {
740
- switch (S.debug("typeStr2Type", e), e) {
741
- case "==":
742
- return "thick";
743
- default:
744
- return "normal";
745
- }
746
- }
747
- function et(e) {
748
- switch (e.trim()) {
749
- case "--x":
750
- return "arrow_cross";
751
- case "--o":
752
- return "arrow_circle";
753
- default:
754
- return "arrow_point";
755
- }
756
- }
757
- let be = 0;
758
- const tt = () => (be++, "id-" + Math.random().toString(36).substr(2, 12) + "-" + be), st = (e) => {
759
- H.children = e, Le(e, H), le = H.children;
760
- }, it = (e) => {
761
- const a = O[e];
762
- return a ? a.columns ? a.columns : a.children ? a.children.length : -1 : -1;
763
- }, rt = () => [...Object.values(O)], nt = () => le || [], at = () => ae, lt = (e) => O[e], ot = (e) => {
764
- O[e.id] = e;
765
- }, ct = () => console, ut = function() {
766
- return G;
767
- }, ht = {
768
- getConfig: () => ne().block,
769
- typeStr2Type: Qe,
770
- edgeTypeStr2Type: $e,
771
- edgeStrToEdgeData: et,
772
- getLogger: ct,
773
- getBlocksFlat: rt,
774
- getBlocks: nt,
775
- getEdges: at,
776
- setHierarchy: st,
777
- getBlock: lt,
778
- setBlock: ot,
779
- getColumns: it,
780
- getClasses: ut,
781
- clear: Je,
782
- generateId: tt
783
- }, dt = ht, Q = (e, a) => {
784
- const l = Ue, u = l(e, "r"), n = l(e, "g"), p = l(e, "b");
785
- return Ae(u, n, p, a);
786
- }, gt = (e) => `.label {
787
- font-family: ${e.fontFamily};
788
- color: ${e.nodeTextColor || e.textColor};
789
- }
790
- .cluster-label text {
791
- fill: ${e.titleColor};
792
- }
793
- .cluster-label span,p {
794
- color: ${e.titleColor};
795
- }
796
-
797
-
798
-
799
- .label text,span,p {
800
- fill: ${e.nodeTextColor || e.textColor};
801
- color: ${e.nodeTextColor || e.textColor};
802
- }
803
-
804
- .node rect,
805
- .node circle,
806
- .node ellipse,
807
- .node polygon,
808
- .node path {
809
- fill: ${e.mainBkg};
810
- stroke: ${e.nodeBorder};
811
- stroke-width: 1px;
812
- }
813
- .flowchart-label text {
814
- text-anchor: middle;
815
- }
816
- // .flowchart-label .text-outer-tspan {
817
- // text-anchor: middle;
818
- // }
819
- // .flowchart-label .text-inner-tspan {
820
- // text-anchor: start;
821
- // }
822
-
823
- .node .label {
824
- text-align: center;
825
- }
826
- .node.clickable {
827
- cursor: pointer;
828
- }
829
-
830
- .arrowheadPath {
831
- fill: ${e.arrowheadColor};
832
- }
833
-
834
- .edgePath .path {
835
- stroke: ${e.lineColor};
836
- stroke-width: 2.0px;
837
- }
838
-
839
- .flowchart-link {
840
- stroke: ${e.lineColor};
841
- fill: none;
842
- }
843
-
844
- .edgeLabel {
845
- background-color: ${e.edgeLabelBackground};
846
- rect {
847
- opacity: 0.5;
848
- background-color: ${e.edgeLabelBackground};
849
- fill: ${e.edgeLabelBackground};
850
- }
851
- text-align: center;
852
- }
853
-
854
- /* For html labels only */
855
- .labelBkg {
856
- background-color: ${Q(e.edgeLabelBackground, 0.5)};
857
- // background-color:
858
- }
859
-
860
- .node .cluster {
861
- // fill: ${Q(e.mainBkg, 0.5)};
862
- fill: ${Q(e.clusterBkg, 0.5)};
863
- stroke: ${Q(e.clusterBorder, 0.2)};
864
- box-shadow: rgba(50, 50, 93, 0.25) 0px 13px 27px -5px, rgba(0, 0, 0, 0.3) 0px 8px 16px -8px;
865
- stroke-width: 1px;
866
- }
867
-
868
- .cluster text {
869
- fill: ${e.titleColor};
870
- }
871
-
872
- .cluster span,p {
873
- color: ${e.titleColor};
874
- }
875
- /* .cluster div {
876
- color: ${e.titleColor};
877
- } */
878
-
879
- div.mermaidTooltip {
880
- position: absolute;
881
- text-align: center;
882
- max-width: 200px;
883
- padding: 2px;
884
- font-family: ${e.fontFamily};
885
- font-size: 12px;
886
- background: ${e.tertiaryColor};
887
- border: 1px solid ${e.border2};
888
- border-radius: 2px;
889
- pointer-events: none;
890
- z-index: 100;
891
- }
892
-
893
- .flowchartTitleText {
894
- text-anchor: middle;
895
- font-size: 18px;
896
- fill: ${e.textColor};
897
- }
898
- `, pt = gt;
899
- function me(e, a, l = !1) {
900
- var u, n, p;
901
- const o = e;
902
- let b = "default";
903
- (((u = o == null ? void 0 : o.classes) == null ? void 0 : u.length) || 0) > 0 && (b = ((o == null ? void 0 : o.classes) || []).join(" ")), b = b + " flowchart-label";
904
- let f = 0, g = "", x;
905
- switch (o.type) {
906
- case "round":
907
- f = 5, g = "rect";
908
- break;
909
- case "composite":
910
- f = 0, g = "composite", x = 0;
911
- break;
912
- case "square":
913
- g = "rect";
914
- break;
915
- case "diamond":
916
- g = "question";
917
- break;
918
- case "hexagon":
919
- g = "hexagon";
920
- break;
921
- case "block_arrow":
922
- g = "block_arrow";
923
- break;
924
- case "odd":
925
- g = "rect_left_inv_arrow";
926
- break;
927
- case "lean_right":
928
- g = "lean_right";
929
- break;
930
- case "lean_left":
931
- g = "lean_left";
932
- break;
933
- case "trapezoid":
934
- g = "trapezoid";
935
- break;
936
- case "inv_trapezoid":
937
- g = "inv_trapezoid";
938
- break;
939
- case "rect_left_inv_arrow":
940
- g = "rect_left_inv_arrow";
941
- break;
942
- case "circle":
943
- g = "circle";
944
- break;
945
- case "ellipse":
946
- g = "ellipse";
947
- break;
948
- case "stadium":
949
- g = "stadium";
950
- break;
951
- case "subroutine":
952
- g = "subroutine";
953
- break;
954
- case "cylinder":
955
- g = "cylinder";
956
- break;
957
- case "group":
958
- g = "rect";
959
- break;
960
- case "doublecircle":
961
- g = "doublecircle";
962
- break;
963
- default:
964
- g = "rect";
965
- }
966
- const E = Re((o == null ? void 0 : o.styles) || []), T = o.label, v = o.size || { width: 0, height: 0, x: 0, y: 0 };
967
- return {
968
- labelStyle: E.labelStyle,
969
- shape: g,
970
- labelText: T,
971
- rx: f,
972
- ry: f,
973
- class: b,
974
- style: E.style,
975
- id: o.id,
976
- directions: o.directions,
977
- width: v.width,
978
- height: v.height,
979
- x: v.x,
980
- y: v.y,
981
- positioned: l,
982
- intersect: void 0,
983
- type: o.type,
984
- padding: x != null ? x : ((p = (n = ne()) == null ? void 0 : n.block) == null ? void 0 : p.padding) || 0
985
- };
986
- }
987
- function ft(e, a, l) {
988
- return K(this, null, function* () {
989
- const u = me(a, l, !1);
990
- if (u.type === "group")
991
- return;
992
- const n = yield xe(e, u), p = n.node().getBBox(), o = l.getBlock(u.id);
993
- o.size = { width: p.width, height: p.height, x: 0, y: 0, node: n }, l.setBlock(o), n.remove();
994
- });
995
- }
996
- function bt(e, a, l) {
997
- return K(this, null, function* () {
998
- const u = me(a, l, !0);
999
- l.getBlock(u.id).type !== "space" && (yield xe(e, u), a.intersect = u == null ? void 0 : u.intersect, Ye(u));
1000
- });
1001
- }
1002
- function oe(e, a, l, u) {
1003
- return K(this, null, function* () {
1004
- for (const n of a)
1005
- yield u(e, n, l), n.children && (yield oe(e, n.children, l, u));
1006
- });
1007
- }
1008
- function xt(e, a, l) {
1009
- return K(this, null, function* () {
1010
- yield oe(e, a, l, ft);
1011
- });
1012
- }
1013
- function St(e, a, l) {
1014
- return K(this, null, function* () {
1015
- yield oe(e, a, l, bt);
1016
- });
1017
- }
1018
- function Lt(e, a, l, u, n) {
1019
- return K(this, null, function* () {
1020
- const p = new We({
1021
- multigraph: !0,
1022
- compound: !0
1023
- });
1024
- p.setGraph({
1025
- rankdir: "TB",
1026
- nodesep: 10,
1027
- ranksep: 10,
1028
- marginx: 8,
1029
- marginy: 8
1030
- });
1031
- for (const o of l)
1032
- o.size && p.setNode(o.id, {
1033
- width: o.size.width,
1034
- height: o.size.height,
1035
- intersect: o.intersect
1036
- });
1037
- for (const o of a)
1038
- if (o.start && o.end) {
1039
- const b = u.getBlock(o.start), f = u.getBlock(o.end);
1040
- if (b != null && b.size && (f != null && f.size)) {
1041
- const g = b.size, x = f.size, E = [
1042
- { x: g.x, y: g.y },
1043
- { x: g.x + (x.x - g.x) / 2, y: g.y + (x.y - g.y) / 2 },
1044
- { x: x.x, y: x.y }
1045
- ];
1046
- yield Fe(
1047
- e,
1048
- { v: o.start, w: o.end, name: o.id },
1049
- U(j({}, o), {
1050
- arrowTypeEnd: o.arrowTypeEnd,
1051
- arrowTypeStart: o.arrowTypeStart,
1052
- points: E,
1053
- classes: "edge-thickness-normal edge-pattern-solid flowchart-link LS-a1 LE-b1"
1054
- }),
1055
- void 0,
1056
- "block",
1057
- p,
1058
- n
1059
- ), o.label && (yield Ke(e, U(j({}, o), {
1060
- label: o.label,
1061
- labelStyle: "stroke: #333; stroke-width: 1.5px;fill:none;",
1062
- arrowTypeEnd: o.arrowTypeEnd,
1063
- arrowTypeStart: o.arrowTypeStart,
1064
- points: E,
1065
- classes: "edge-thickness-normal edge-pattern-solid flowchart-link LS-a1 LE-b1"
1066
- })), yield Me(
1067
- U(j({}, o), { x: E[1].x, y: E[1].y }),
1068
- {
1069
- originalPath: E
1070
- }
1071
- ));
1072
- }
1073
- }
1074
- });
1075
- }
1076
- const _ = ((ge = (de = Te()) == null ? void 0 : de.block) == null ? void 0 : ge.padding) || 8;
1077
- function mt(e, a) {
1078
- if (e === 0 || !Number.isInteger(e))
1079
- throw new Error("Columns must be an integer !== 0.");
1080
- if (a < 0 || !Number.isInteger(a))
1081
- throw new Error("Position must be a non-negative integer." + a);
1082
- if (e < 0)
1083
- return { px: a, py: 0 };
1084
- if (e === 1)
1085
- return { px: 0, py: a };
1086
- const l = a % e, u = Math.floor(a / e);
1087
- return { px: l, py: u };
1088
- }
1089
- const _t = (e) => {
1090
- let a = 0, l = 0;
1091
- for (const u of e.children) {
1092
- const { width: n, height: p, x: o, y: b } = u.size || { width: 0, height: 0, x: 0, y: 0 };
1093
- S.debug(
1094
- "getMaxChildSize abc95 child:",
1095
- u.id,
1096
- "width:",
1097
- n,
1098
- "height:",
1099
- p,
1100
- "x:",
1101
- o,
1102
- "y:",
1103
- b,
1104
- u.type
1105
- ), u.type !== "space" && (n > a && (a = n / (e.widthInColumns || 1)), p > l && (l = p));
1106
- }
1107
- return { width: a, height: l };
1108
- };
1109
- function re(e, a, l = 0, u = 0) {
1110
- var n, p, o, b, f, g, x, E, T, v, N;
1111
- S.debug(
1112
- "setBlockSizes abc95 (start)",
1113
- e.id,
1114
- (n = e == null ? void 0 : e.size) == null ? void 0 : n.x,
1115
- "block width =",
1116
- e == null ? void 0 : e.size,
1117
- "sieblingWidth",
1118
- l
1119
- ), (p = e == null ? void 0 : e.size) != null && p.width || (e.size = {
1120
- width: l,
1121
- height: u,
1122
- x: 0,
1123
- y: 0
1124
- });
1125
- let y = 0, L = 0;
1126
- if (((o = e.children) == null ? void 0 : o.length) > 0) {
1127
- for (const d of e.children)
1128
- re(d, a);
1129
- const A = _t(e);
1130
- y = A.width, L = A.height, S.debug("setBlockSizes abc95 maxWidth of", e.id, ":s children is ", y, L);
1131
- for (const d of e.children)
1132
- d.size && (S.debug(
1133
- `abc95 Setting size of children of ${e.id} id=${d.id} ${y} ${L} ${d.size}`
1134
- ), d.size.width = y * (d.widthInColumns || 1) + _ * ((d.widthInColumns || 1) - 1), d.size.height = L, d.size.x = 0, d.size.y = 0, S.debug(
1135
- `abc95 updating size of ${e.id} children child:${d.id} maxWidth:${y} maxHeight:${L}`
1136
- ));
1137
- for (const d of e.children)
1138
- re(d, a, y, L);
1139
- const k = e.columns || -1;
1140
- let D = 0;
1141
- for (const d of e.children)
1142
- D += d.widthInColumns || 1;
1143
- let c = e.children.length;
1144
- k > 0 && k < D && (c = k), e.widthInColumns;
1145
- const s = Math.ceil(D / c);
1146
- let i = c * (y + _) + _, h = s * (L + _) + _;
1147
- if (i < l) {
1148
- S.debug(
1149
- `Detected to small siebling: abc95 ${e.id} sieblingWidth ${l} sieblingHeight ${u} width ${i}`
1150
- ), i = l, h = u;
1151
- const d = (l - c * _ - _) / c, t = (u - s * _ - _) / s;
1152
- S.debug("Size indata abc88", e.id, "childWidth", d, "maxWidth", y), S.debug("Size indata abc88", e.id, "childHeight", t, "maxHeight", L), S.debug("Size indata abc88 xSize", c, "padding", _);
1153
- for (const m of e.children)
1154
- m.size && (m.size.width = d, m.size.height = t, m.size.x = 0, m.size.y = 0);
1155
- }
1156
- if (S.debug(
1157
- `abc95 (finale calc) ${e.id} xSize ${c} ySize ${s} columns ${k}${e.children.length} width=${Math.max(i, ((b = e.size) == null ? void 0 : b.width) || 0)}`
1158
- ), i < (((f = e == null ? void 0 : e.size) == null ? void 0 : f.width) || 0)) {
1159
- i = ((g = e == null ? void 0 : e.size) == null ? void 0 : g.width) || 0;
1160
- const d = k > 0 ? Math.min(e.children.length, k) : e.children.length;
1161
- if (d > 0) {
1162
- const t = (i - d * _ - _) / d;
1163
- S.debug("abc95 (growing to fit) width", e.id, i, (x = e.size) == null ? void 0 : x.width, t);
1164
- for (const m of e.children)
1165
- m.size && (m.size.width = t);
1166
- }
1167
- }
1168
- e.size = {
1169
- width: i,
1170
- height: h,
1171
- x: 0,
1172
- y: 0
1173
- };
1174
- }
1175
- S.debug(
1176
- "setBlockSizes abc94 (done)",
1177
- e.id,
1178
- (E = e == null ? void 0 : e.size) == null ? void 0 : E.x,
1179
- (T = e == null ? void 0 : e.size) == null ? void 0 : T.width,
1180
- (v = e == null ? void 0 : e.size) == null ? void 0 : v.y,
1181
- (N = e == null ? void 0 : e.size) == null ? void 0 : N.height
1182
- );
1183
- }
1184
- function _e(e, a) {
1185
- var l, u, n, p, o, b, f, g, x, E, T, v, N, y, L, A, k;
1186
- S.debug(
1187
- `abc85 layout blocks (=>layoutBlocks) ${e.id} x: ${(l = e == null ? void 0 : e.size) == null ? void 0 : l.x} y: ${(u = e == null ? void 0 : e.size) == null ? void 0 : u.y} width: ${(n = e == null ? void 0 : e.size) == null ? void 0 : n.width}`
1188
- );
1189
- const D = e.columns || -1;
1190
- if (S.debug("layoutBlocks columns abc95", e.id, "=>", D, e), e.children && // find max width of children
1191
- e.children.length > 0) {
1192
- const c = ((o = (p = e == null ? void 0 : e.children[0]) == null ? void 0 : p.size) == null ? void 0 : o.width) || 0, s = e.children.length * c + (e.children.length - 1) * _;
1193
- S.debug("widthOfChildren 88", s, "posX");
1194
- let i = 0;
1195
- S.debug("abc91 block?.size?.x", e.id, (b = e == null ? void 0 : e.size) == null ? void 0 : b.x);
1196
- let h = (f = e == null ? void 0 : e.size) != null && f.x ? ((g = e == null ? void 0 : e.size) == null ? void 0 : g.x) + (-((x = e == null ? void 0 : e.size) == null ? void 0 : x.width) / 2 || 0) : -_, d = 0;
1197
- for (const t of e.children) {
1198
- const m = e;
1199
- if (!t.size)
1200
- continue;
1201
- const { width: r, height: R } = t.size, { px: W, py: F } = mt(D, i);
1202
- if (F != d && (d = F, h = (E = e == null ? void 0 : e.size) != null && E.x ? ((T = e == null ? void 0 : e.size) == null ? void 0 : T.x) + (-((v = e == null ? void 0 : e.size) == null ? void 0 : v.width) / 2 || 0) : -_, S.debug("New row in layout for block", e.id, " and child ", t.id, d)), S.debug(
1203
- `abc89 layout blocks (child) id: ${t.id} Pos: ${i} (px, py) ${W},${F} (${(N = m == null ? void 0 : m.size) == null ? void 0 : N.x},${(y = m == null ? void 0 : m.size) == null ? void 0 : y.y}) parent: ${m.id} width: ${r}${_}`
1204
- ), m.size) {
1205
- const C = r / 2;
1206
- t.size.x = h + _ + C, S.debug(
1207
- `abc91 layout blocks (calc) px, pyid:${t.id} startingPos=X${h} new startingPosX${t.size.x} ${C} padding=${_} width=${r} halfWidth=${C} => x:${t.size.x} y:${t.size.y} ${t.widthInColumns} (width * (child?.w || 1)) / 2 ${r * ((t == null ? void 0 : t.widthInColumns) || 1) / 2}`
1208
- ), h = t.size.x + C, t.size.y = m.size.y - m.size.height / 2 + F * (R + _) + R / 2 + _, S.debug(
1209
- `abc88 layout blocks (calc) px, pyid:${t.id}startingPosX${h}${_}${C}=>x:${t.size.x}y:${t.size.y}${t.widthInColumns}(width * (child?.w || 1)) / 2${r * ((t == null ? void 0 : t.widthInColumns) || 1) / 2}`
1210
- );
1211
- }
1212
- t.children && _e(t), i += (t == null ? void 0 : t.widthInColumns) || 1, S.debug("abc88 columnsPos", t, i);
1213
- }
1214
- }
1215
- S.debug(
1216
- `layout blocks (<==layoutBlocks) ${e.id} x: ${(L = e == null ? void 0 : e.size) == null ? void 0 : L.x} y: ${(A = e == null ? void 0 : e.size) == null ? void 0 : A.y} width: ${(k = e == null ? void 0 : e.size) == null ? void 0 : k.width}`
1217
- );
1218
- }
1219
- function Ee(e, { minX: a, minY: l, maxX: u, maxY: n } = { minX: 0, minY: 0, maxX: 0, maxY: 0 }) {
1220
- if (e.size && e.id !== "root") {
1221
- const { x: p, y: o, width: b, height: f } = e.size;
1222
- p - b / 2 < a && (a = p - b / 2), o - f / 2 < l && (l = o - f / 2), p + b / 2 > u && (u = p + b / 2), o + f / 2 > n && (n = o + f / 2);
1223
- }
1224
- if (e.children)
1225
- for (const p of e.children)
1226
- ({ minX: a, minY: l, maxX: u, maxY: n } = Ee(p, { minX: a, minY: l, maxX: u, maxY: n }));
1227
- return { minX: a, minY: l, maxX: u, maxY: n };
1228
- }
1229
- function Et(e) {
1230
- const a = e.getBlock("root");
1231
- if (!a)
1232
- return;
1233
- re(a, e, 0, 0), _e(a), S.debug("getBlocks", JSON.stringify(a, null, 2));
1234
- const { minX: l, minY: u, maxX: n, maxY: p } = Ee(a), o = p - u, b = n - l;
1235
- return { x: l, y: u, width: b, height: o };
1236
- }
1237
- const yt = function(e, a) {
1238
- return a.db.getClasses();
1239
- }, wt = function(e, a, l, u) {
1240
- return K(this, null, function* () {
1241
- const { securityLevel: n, block: p } = ne(), o = u.db;
1242
- let b;
1243
- n === "sandbox" && (b = J("#i" + a));
1244
- const f = n === "sandbox" ? J(b.nodes()[0].contentDocument.body) : J("body"), g = n === "sandbox" ? f.select(`[id="${a}"]`) : J(`[id="${a}"]`);
1245
- Pe(g, ["point", "circle", "cross"], u.type, a);
1246
- const E = o.getBlocks(), T = o.getBlocksFlat(), v = o.getEdges(), N = g.insert("g").attr("class", "block");
1247
- yield xt(N, E, o);
1248
- const y = Et(o);
1249
- if (yield St(N, E, o), yield Lt(N, v, T, o, a), y) {
1250
- const L = y, A = Math.max(1, Math.round(0.125 * (L.width / L.height))), k = L.height + A + 10, D = L.width + 10, { useMaxWidth: c } = p;
1251
- ze(g, k, D, !!c), S.debug("Here Bounds", y, L), g.attr(
1252
- "viewBox",
1253
- `${L.x - 5} ${L.y - 5} ${L.width + 10} ${L.height + 10}`
1254
- );
1255
- }
1256
- Ve(je);
1257
- });
1258
- }, Dt = {
1259
- draw: wt,
1260
- getClasses: yt
1261
- }, Kt = {
1262
- parser: Xe,
1263
- db: dt,
1264
- renderer: Dt,
1265
- styles: pt
1266
- };
1267
- export {
1268
- Kt as diagram
1269
- };