@draftably/editor 0.1.0 → 0.3.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 (104) hide show
  1. package/README.md +4 -5
  2. package/dist/assets/engine.worker-BY9GKt7x.js +7505 -0
  3. package/dist/element.js +1 -1
  4. package/dist/index.js +20202 -2
  5. package/dist/types/src/cli/raster-fonts.d.ts +3 -0
  6. package/dist/types/src/components/controls.d.ts +8 -5
  7. package/dist/types/src/dsl/compile.d.ts +13 -0
  8. package/dist/types/src/dsl/corridors.d.ts +38 -0
  9. package/dist/types/src/model/types.d.ts +9 -0
  10. package/dist/types/src/state/canvas-commands.d.ts +169 -0
  11. package/dist/types/src/state/canvas-keyboard.d.ts +15 -0
  12. package/dist/types/src/state/links.d.ts +4 -1
  13. package/dist/types/src/state/workspace.d.ts +3 -0
  14. package/package.json +1 -1
  15. package/dist/assets/engine.worker-DmHew5f6.js +0 -6813
  16. package/dist/assets/import-d2.worker-CnXfFXoa.js +0 -5395
  17. package/dist/chunks/abnfDiagram-WEYOIA3C-llcpthp5.js +0 -87
  18. package/dist/chunks/arc-rJj0TtXf.js +0 -83
  19. package/dist/chunks/architectureDiagram-ZHVYKT53-CfiXg0Lk.js +0 -4781
  20. package/dist/chunks/blockDiagram-RJAE7QA3-CO-14jWz.js +0 -1440
  21. package/dist/chunks/browser-iNhbPsGc.js +0 -40
  22. package/dist/chunks/c4Diagram-XDPPPE54-DYKuxA4n.js +0 -1524
  23. package/dist/chunks/channel-qMvPU6eH.js +0 -5
  24. package/dist/chunks/chunk-2E7WHVMD-BEZwsFS3.js +0 -670
  25. package/dist/chunks/chunk-2Q5K7J3B-gqtzQ8ux.js +0 -18
  26. package/dist/chunks/chunk-4EMNKR2T-MC54CXVe.js +0 -262
  27. package/dist/chunks/chunk-55XCU76K-DkZUAaqC.js +0 -68
  28. package/dist/chunks/chunk-5VM5RSS4-CaKe4sjM.js +0 -19
  29. package/dist/chunks/chunk-JWPE2WC7-CnAFS2xF.js +0 -8
  30. package/dist/chunks/chunk-VQ5W62QI-CXRv7FiX.js +0 -19
  31. package/dist/chunks/chunk-XXDRQBXY-B-AMQgD2.js +0 -8
  32. package/dist/chunks/chunk-ZCHMQSOR-BALpdc3g.js +0 -451
  33. package/dist/chunks/classDiagram-v2-4MYWR3UA-wPjgJTg4.js +0 -1570
  34. package/dist/chunks/cose-bilkent-JH36ORCC-Bbh5ggBc.js +0 -2608
  35. package/dist/chunks/cynefin-EF2NZ3EQ-Bt6b88hY.js +0 -22361
  36. package/dist/chunks/cynefinDiagram-WF24UDRP-BHWZvxoF.js +0 -299
  37. package/dist/chunks/cytoscape.esm-CRsF_JA3.js +0 -18791
  38. package/dist/chunks/dagre-NK4GIZVX-Cz37yPrT.js +0 -2157
  39. package/dist/chunks/defaultLocale-BgPVtth8.js +0 -171
  40. package/dist/chunks/diagram-CBK3MWTC-Q2R6FJ0B.js +0 -531
  41. package/dist/chunks/diagram-I5XIIV2D-a2Kdu_wA.js +0 -153
  42. package/dist/chunks/diagram-ODIL2UCW-DTWXxcOn.js +0 -346
  43. package/dist/chunks/diagram-PFBEJUXE-DIAQQ5KX.js +0 -480
  44. package/dist/chunks/diagram-RJA3I4VV-BPD0GghS.js +0 -219
  45. package/dist/chunks/diagram-TYUNFSNR-BmdkONfG.js +0 -2586
  46. package/dist/chunks/dot-importer-B23jwEkx.js +0 -1547
  47. package/dist/chunks/ebnfDiagram-V4P3TTPT-C5IKvYlb.js +0 -109
  48. package/dist/chunks/elk-QONTBCTQ-CtdQFvh2.js +0 -49229
  49. package/dist/chunks/erDiagram-KYQIGQAA-5wguK9Dx.js +0 -1064
  50. package/dist/chunks/flowDiagram-IUGLLWBU-BijvFPku.js +0 -1771
  51. package/dist/chunks/ganttDiagram-R7GPNTJY-BaqGPz-O.js +0 -2729
  52. package/dist/chunks/gitGraphDiagram-PDYL7XHY-DZfMGyHE.js +0 -815
  53. package/dist/chunks/graph-CKJmgLki.js +0 -1541
  54. package/dist/chunks/import-core-C-I1wGfw.js +0 -145
  55. package/dist/chunks/infoDiagram-MVDRKAX5-C2vH_59e.js +0 -24
  56. package/dist/chunks/init-DjUOC4st.js +0 -16
  57. package/dist/chunks/ishikawaDiagram-HPEHV2GE-q149MFlV.js +0 -624
  58. package/dist/chunks/journeyDiagram-BOSHW7O7-D-2Z3VtR.js +0 -834
  59. package/dist/chunks/kanban-definition-FNSA4HC5-wvAjV5ub.js +0 -724
  60. package/dist/chunks/katex-BsrBVQKd.js +0 -11314
  61. package/dist/chunks/linear-4t7D_ros.js +0 -259
  62. package/dist/chunks/mermaid-facade-BoLWBerE.js +0 -289
  63. package/dist/chunks/mermaid-importer-Cgx1IhmR.js +0 -478
  64. package/dist/chunks/mermaid.core-DXv6D2Sm.js +0 -19244
  65. package/dist/chunks/mindmap-definition-6OY57UG3-r9wTKul_.js +0 -837
  66. package/dist/chunks/mount-C1Xk_GQz.js +0 -22131
  67. package/dist/chunks/ordinal-DfAQgscy.js +0 -61
  68. package/dist/chunks/pegDiagram-ECIUJNBX-CmKlFWiP.js +0 -95
  69. package/dist/chunks/pieDiagram-GNMPY74T-DNTw_qan.js +0 -208
  70. package/dist/chunks/quadrantDiagram-D57K4MC3-CT_tvVub.js +0 -1029
  71. package/dist/chunks/railroadDiagram-Y72NRBL7-C5TUvZBe.js +0 -77
  72. package/dist/chunks/requirementDiagram-EQYSW5RA-C_c65aCa.js +0 -889
  73. package/dist/chunks/sankeyDiagram-SY24JHO5-CKcbizM1.js +0 -859
  74. package/dist/chunks/sequenceDiagram-BLEHNHQU-GpVnHOjf.js +0 -2972
  75. package/dist/chunks/sizeCapture-INFHLROL-CToN3JSu.js +0 -46
  76. package/dist/chunks/stateDiagram-v2-A6IESKWZ-rJYd2FfM.js +0 -1520
  77. package/dist/chunks/swimlanes-B3ENRKFQ-C7w5pfxG.js +0 -4991
  78. package/dist/chunks/swimlanesDiagram-AYQRV4AK-BpGY_bvE.js +0 -13
  79. package/dist/chunks/timeline-definition-JXYKGLGB-ChKFPBKc.js +0 -1058
  80. package/dist/chunks/usecaseDiagram-WPOLBNNX-skXH8Dcu.js +0 -7945
  81. package/dist/chunks/vennDiagram-Q3Y3IDCW-C5KknmJf.js +0 -1578
  82. package/dist/chunks/wardleyDiagram-IVAIDKWA-DY4Lkfpu.js +0 -678
  83. package/dist/chunks/xychartDiagram-4URNHDU4-BHScsL7h.js +0 -1536
  84. package/dist/types/src/cli/png.d.ts +0 -23
  85. package/dist/types/src/import/browser.d.ts +0 -3
  86. package/dist/types/src/import/detect.d.ts +0 -31
  87. package/dist/types/src/import/dot-importer.d.ts +0 -3
  88. package/dist/types/src/import/import-core.d.ts +0 -105
  89. package/dist/types/src/import/mermaid-facade.d.ts +0 -120
  90. package/dist/types/src/import/mermaid-importer.d.ts +0 -4
  91. package/dist/types/src/import/mermaid-sequence.d.ts +0 -8
  92. package/dist/types/src/import/scratch.d.ts +0 -3
  93. package/dist/types/src/lib/source-hash.d.ts +0 -7
  94. package/dist/types/src/model/candidates.d.ts +0 -53
  95. package/dist/types/src/model/embed.d.ts +0 -17
  96. package/dist/types/src/model/examples.d.ts +0 -15
  97. package/dist/types/src/model/label-hits.d.ts +0 -27
  98. package/dist/types/src/model/static-scene.d.ts +0 -15
  99. package/dist/types/src/state/commands.d.ts +0 -529
  100. package/dist/types/src/state/comparison.d.ts +0 -151
  101. package/dist/types/src/state/files.d.ts +0 -61
  102. package/dist/types/src/state/keyboard.d.ts +0 -6
  103. package/dist/types/src/state/launch.d.ts +0 -61
  104. package/dist/types/src/state/ui.d.ts +0 -39
@@ -1,1440 +0,0 @@
1
- import { g as Me } from "./chunk-5VM5RSS4-CaKe4sjM.js";
2
- import { aJ as Ke, aK as Le, aL as oe, aM as Ye, aN as We, aO as Ve, aP as Ue, aQ as He, aR as Xe, aS as Ge, aT as je, aU as qe, aV as Je, aW as Ze, aX as Qe, aY as $e, aZ as et, a_ as tt, a$ as st, b0 as rt, b1 as it, b2 as at, b3 as nt, b4 as ot, b5 as lt, b6 as ct, _ as u, L as P, k as X, b7 as ut, av as ht, d as gt, l as y, A as dt, C as pt, D as ft, E as bt, F as St, G as xt, c as me, az as Lt, aC as mt, b8 as yt, m as wt, b9 as Et, am as ye, ba as kt, an as _t } from "./mermaid.core-DXv6D2Sm.js";
3
- import { G as Dt } from "./graph-CKJmgLki.js";
4
- import { c as Tt } from "./channel-qMvPU6eH.js";
5
- function Nt(e) {
6
- return Array.isArray(e);
7
- }
8
- function It(e) {
9
- if (Ke(e)) return e;
10
- const a = Le(e);
11
- if (!Ct(e)) return {};
12
- if (Nt(e)) {
13
- const s = Array.from(e);
14
- return e.length > 0 && typeof e[0] == "string" && oe(e, "index") && (s.index = e.index, s.input = e.input), s;
15
- }
16
- if (Ye(e)) {
17
- const s = e, l = s.constructor;
18
- return new l(s.buffer, s.byteOffset, s.length);
19
- }
20
- if (a === "[object ArrayBuffer]") return new ArrayBuffer(e.byteLength);
21
- if (a === "[object DataView]") {
22
- const s = e, l = s.buffer, g = s.byteOffset, t = s.byteLength, h = new ArrayBuffer(t), x = new Uint8Array(l, g, t);
23
- return new Uint8Array(h).set(x), new DataView(h);
24
- }
25
- if (a === "[object Boolean]" || a === "[object Number]" || a === "[object String]") {
26
- const s = e.constructor, l = new s(e.valueOf());
27
- return a === "[object String]" ? Ot(l, e) : se(l, e), l;
28
- }
29
- if (a === "[object Date]") return new Date(Number(e));
30
- if (a === "[object RegExp]") {
31
- const s = e, l = new RegExp(s.source, s.flags);
32
- return l.lastIndex = s.lastIndex, l;
33
- }
34
- if (a === "[object Symbol]") return Object(Symbol.prototype.valueOf.call(e));
35
- if (a === "[object Map]") {
36
- const s = e, l = /* @__PURE__ */ new Map();
37
- return s.forEach((g, t) => {
38
- l.set(t, g);
39
- }), l;
40
- }
41
- if (a === "[object Set]") {
42
- const s = e, l = /* @__PURE__ */ new Set();
43
- return s.forEach((g) => {
44
- l.add(g);
45
- }), l;
46
- }
47
- if (a === "[object Arguments]") {
48
- const s = e, l = {};
49
- return se(l, s), l.length = s.length, l[Symbol.iterator] = s[Symbol.iterator], l;
50
- }
51
- const o = {};
52
- return At(o, e), se(o, e), vt(o, e), o;
53
- }
54
- function Ct(e) {
55
- switch (Le(e)) {
56
- case ct:
57
- case lt:
58
- case ot:
59
- case nt:
60
- case at:
61
- case it:
62
- case rt:
63
- case st:
64
- case tt:
65
- case et:
66
- case $e:
67
- case Qe:
68
- case Ze:
69
- case Je:
70
- case qe:
71
- case je:
72
- case Ge:
73
- case Xe:
74
- case He:
75
- case Ue:
76
- case Ve:
77
- case We:
78
- return !0;
79
- default:
80
- return !1;
81
- }
82
- }
83
- function se(e, a) {
84
- for (const o in a) oe(a, o) && (e[o] = a[o]);
85
- }
86
- function vt(e, a) {
87
- const o = Object.getOwnPropertySymbols(a);
88
- for (let s = 0; s < o.length; s++) {
89
- const l = o[s];
90
- Object.prototype.propertyIsEnumerable.call(a, l) && (e[l] = a[l]);
91
- }
92
- }
93
- function Ot(e, a) {
94
- const o = a.valueOf().length;
95
- for (const s in a) oe(a, s) && (Number.isNaN(Number(s)) || Number(s) >= o) && (e[s] = a[s]);
96
- }
97
- function At(e, a) {
98
- const o = Object.getPrototypeOf(a);
99
- o !== null && typeof a.constructor == "function" && Object.setPrototypeOf(e, o);
100
- }
101
- var ie = (function() {
102
- var e = /* @__PURE__ */ u(function(v, d, i, c) {
103
- for (i = i || {}, c = v.length; c--; i[v[c]] = d) ;
104
- return i;
105
- }, "o"), a = [1, 15], o = [1, 7], s = [1, 13], l = [1, 14], g = [1, 19], t = [1, 16], h = [1, 17], x = [1, 18], L = [8, 30], b = [8, 10, 21, 28, 29, 30, 31, 39, 43, 46], f = [1, 23], m = [1, 24], w = [8, 10, 15, 16, 21, 28, 29, 30, 31, 39, 43, 46], S = [8, 10, 15, 16, 21, 27, 28, 29, 30, 31, 39, 43, 46], _ = [1, 49], k = {
106
- trace: /* @__PURE__ */ u(function() {
107
- }, "trace"),
108
- yy: {},
109
- 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 },
110
- 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" },
111
- 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]],
112
- performAction: /* @__PURE__ */ u(function(d, i, c, p, E, r, K) {
113
- var n = r.length - 1;
114
- switch (E) {
115
- case 4:
116
- p.getLogger().debug("Rule: separator (NL) ");
117
- break;
118
- case 5:
119
- p.getLogger().debug("Rule: separator (Space) ");
120
- break;
121
- case 6:
122
- p.getLogger().debug("Rule: separator (EOF) ");
123
- break;
124
- case 7:
125
- p.getLogger().debug("Rule: hierarchy: ", r[n - 1]), p.setHierarchy(r[n - 1]);
126
- break;
127
- case 8:
128
- p.getLogger().debug("Stop NL ");
129
- break;
130
- case 9:
131
- p.getLogger().debug("Stop EOF ");
132
- break;
133
- case 10:
134
- p.getLogger().debug("Stop NL2 ");
135
- break;
136
- case 11:
137
- p.getLogger().debug("Stop EOF2 ");
138
- break;
139
- case 12:
140
- p.getLogger().debug("Rule: statement: ", r[n]), typeof r[n].length == "number" ? this.$ = r[n] : this.$ = [r[n]];
141
- break;
142
- case 13:
143
- p.getLogger().debug("Rule: statement #2: ", r[n - 1]), this.$ = [r[n - 1]].concat(r[n]);
144
- break;
145
- case 14:
146
- p.getLogger().debug("Rule: link: ", r[n], d), this.$ = { edgeTypeStr: r[n], label: "" };
147
- break;
148
- case 15:
149
- p.getLogger().debug("Rule: LABEL link: ", r[n - 3], r[n - 1], r[n]), this.$ = { edgeTypeStr: r[n], label: r[n - 1] };
150
- break;
151
- case 18:
152
- const F = parseInt(r[n]), W = p.generateId();
153
- this.$ = { id: W, type: "space", label: "", width: F, children: [] };
154
- break;
155
- case 23:
156
- p.getLogger().debug("Rule: (nodeStatement link node) ", r[n - 2], r[n - 1], r[n], " typestr: ", r[n - 1].edgeTypeStr);
157
- const J = p.edgeStrToEdgeData(r[n - 1].edgeTypeStr), V = p.edgeStrToEdgeStartData(r[n - 1].edgeTypeStr), Z = p.edgeStrToThickness(r[n - 1].edgeTypeStr), D = p.edgeStrToPattern(r[n - 1].edgeTypeStr);
158
- this.$ = [
159
- { id: r[n - 2].id, label: r[n - 2].label, type: r[n - 2].type, directions: r[n - 2].directions },
160
- { id: r[n - 2].id + "-" + r[n].id, start: r[n - 2].id, end: r[n].id, label: r[n - 1].label, type: "edge", thickness: Z, pattern: D, directions: r[n].directions, arrowTypeEnd: J, arrowTypeStart: V },
161
- { id: r[n].id, label: r[n].label, type: p.typeStr2Type(r[n].typeStr), directions: r[n].directions }
162
- ];
163
- break;
164
- case 24:
165
- p.getLogger().debug("Rule: nodeStatement (abc88 node size) ", r[n - 1], r[n]), this.$ = { id: r[n - 1].id, label: r[n - 1].label, type: p.typeStr2Type(r[n - 1].typeStr), directions: r[n - 1].directions, widthInColumns: parseInt(r[n], 10) };
166
- break;
167
- case 25:
168
- p.getLogger().debug("Rule: nodeStatement (node) ", r[n]), this.$ = { id: r[n].id, label: r[n].label, type: p.typeStr2Type(r[n].typeStr), directions: r[n].directions, widthInColumns: 1 };
169
- break;
170
- case 26:
171
- p.getLogger().debug("APA123", this ? this : "na"), p.getLogger().debug("COLUMNS: ", r[n]), this.$ = { type: "column-setting", columns: r[n] === "auto" ? -1 : parseInt(r[n]) };
172
- break;
173
- case 27:
174
- p.getLogger().debug("Rule: id-block statement : ", r[n - 2], r[n - 1]), p.generateId(), this.$ = { ...r[n - 2], type: "composite", children: r[n - 1] };
175
- break;
176
- case 28:
177
- p.getLogger().debug("Rule: blockStatement : ", r[n - 2], r[n - 1], r[n]);
178
- const z = p.generateId();
179
- this.$ = { id: z, type: "composite", label: "", children: r[n - 1] };
180
- break;
181
- case 29:
182
- p.getLogger().debug("Rule: node (NODE_ID separator): ", r[n]), this.$ = { id: r[n] };
183
- break;
184
- case 30:
185
- p.getLogger().debug("Rule: node (NODE_ID nodeShapeNLabel separator): ", r[n - 1], r[n]), this.$ = { id: r[n - 1], label: r[n].label, typeStr: r[n].typeStr, directions: r[n].directions };
186
- break;
187
- case 31:
188
- p.getLogger().debug("Rule: dirList: ", r[n]), this.$ = [r[n]];
189
- break;
190
- case 32:
191
- p.getLogger().debug("Rule: dirList: ", r[n - 1], r[n]), this.$ = [r[n - 1]].concat(r[n]);
192
- break;
193
- case 33:
194
- p.getLogger().debug("Rule: nodeShapeNLabel: ", r[n - 2], r[n - 1], r[n]), this.$ = { typeStr: r[n - 2] + r[n], label: r[n - 1] };
195
- break;
196
- case 34:
197
- p.getLogger().debug("Rule: BLOCK_ARROW nodeShapeNLabel: ", r[n - 3], r[n - 2], " #3:", r[n - 1], r[n]), this.$ = { typeStr: r[n - 3] + r[n], label: r[n - 2], directions: r[n - 1] };
198
- break;
199
- case 35:
200
- case 36:
201
- this.$ = { type: "classDef", id: r[n - 1].trim(), css: r[n].trim() };
202
- break;
203
- case 37:
204
- this.$ = { type: "applyClass", id: r[n - 1].trim(), styleClass: r[n].trim() };
205
- break;
206
- case 38:
207
- this.$ = { type: "applyStyles", id: r[n - 1].trim(), stylesStr: r[n].trim() };
208
- break;
209
- }
210
- }, "anonymous"),
211
- table: [{ 9: 1, 10: [1, 2] }, { 1: [3] }, { 10: a, 11: 3, 13: 4, 19: 5, 20: 6, 21: o, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 28: s, 29: l, 31: g, 39: t, 43: h, 46: x }, { 8: [1, 20] }, e(L, [2, 12], { 13: 4, 19: 5, 20: 6, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 11: 21, 10: a, 21: o, 28: s, 29: l, 31: g, 39: t, 43: h, 46: x }), e(b, [2, 16], { 14: 22, 15: f, 16: m }), e(b, [2, 17]), e(b, [2, 18]), e(b, [2, 19]), e(b, [2, 20]), e(b, [2, 21]), e(b, [2, 22]), e(w, [2, 25], { 27: [1, 25] }), e(b, [2, 26]), { 19: 26, 26: 12, 31: g }, { 10: a, 11: 27, 13: 4, 19: 5, 20: 6, 21: o, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 28: s, 29: l, 31: g, 39: t, 43: h, 46: x }, { 40: [1, 28], 42: [1, 29] }, { 44: [1, 30] }, { 47: [1, 31] }, e(S, [2, 29], { 32: 32, 35: [1, 33], 37: [1, 34] }), { 1: [2, 7] }, e(L, [2, 13]), { 26: 35, 31: g }, { 31: [2, 14] }, { 17: [1, 36] }, e(w, [2, 24]), { 10: a, 11: 37, 13: 4, 14: 22, 15: f, 16: m, 19: 5, 20: 6, 21: o, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 28: s, 29: l, 31: g, 39: t, 43: h, 46: x }, { 30: [1, 38] }, { 41: [1, 39] }, { 41: [1, 40] }, { 45: [1, 41] }, { 48: [1, 42] }, e(S, [2, 30]), { 18: [1, 43] }, { 18: [1, 44] }, e(w, [2, 23]), { 18: [1, 45] }, { 30: [1, 46] }, e(b, [2, 28]), e(b, [2, 35]), e(b, [2, 36]), e(b, [2, 37]), e(b, [2, 38]), { 36: [1, 47] }, { 33: 48, 34: _ }, { 15: [1, 50] }, e(b, [2, 27]), e(S, [2, 33]), { 38: [1, 51] }, { 33: 52, 34: _, 38: [2, 31] }, { 31: [2, 15] }, e(S, [2, 34]), { 38: [2, 32] }],
212
- defaultActions: { 20: [2, 7], 23: [2, 14], 50: [2, 15], 52: [2, 32] },
213
- parseError: /* @__PURE__ */ u(function(d, i) {
214
- if (i.recoverable)
215
- this.trace(d);
216
- else {
217
- var c = new Error(d);
218
- throw c.hash = i, c;
219
- }
220
- }, "parseError"),
221
- parse: /* @__PURE__ */ u(function(d) {
222
- var i = this, c = [0], p = [], E = [null], r = [], K = this.table, n = "", F = 0, W = 0, J = 2, V = 1, Z = r.slice.call(arguments, 1), D = Object.create(this.lexer), z = { yy: {} };
223
- for (var Q in this.yy)
224
- Object.prototype.hasOwnProperty.call(this.yy, Q) && (z.yy[Q] = this.yy[Q]);
225
- D.setInput(d, z.yy), z.yy.lexer = D, z.yy.parser = this, typeof D.yylloc > "u" && (D.yylloc = {});
226
- var $ = D.yylloc;
227
- r.push($);
228
- var Pe = D.options && D.options.ranges;
229
- typeof z.yy.parseError == "function" ? this.parseError = z.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
230
- function Fe(I) {
231
- c.length = c.length - 2 * I, E.length = E.length - I, r.length = r.length - I;
232
- }
233
- u(Fe, "popStack");
234
- function pe() {
235
- var I;
236
- return I = p.pop() || D.lex() || V, typeof I != "number" && (I instanceof Array && (p = I, I = p.pop()), I = i.symbols_[I] || I), I;
237
- }
238
- u(pe, "lex");
239
- for (var N, R, O, ee, M = {}, U, B, fe, H; ; ) {
240
- if (R = c[c.length - 1], this.defaultActions[R] ? O = this.defaultActions[R] : ((N === null || typeof N > "u") && (N = pe()), O = K[R] && K[R][N]), typeof O > "u" || !O.length || !O[0]) {
241
- var te = "";
242
- H = [];
243
- for (U in K[R])
244
- this.terminals_[U] && U > J && H.push("'" + this.terminals_[U] + "'");
245
- D.showPosition ? te = "Parse error on line " + (F + 1) + `:
246
- ` + D.showPosition() + `
247
- Expecting ` + H.join(", ") + ", got '" + (this.terminals_[N] || N) + "'" : te = "Parse error on line " + (F + 1) + ": Unexpected " + (N == V ? "end of input" : "'" + (this.terminals_[N] || N) + "'"), this.parseError(te, {
248
- text: D.match,
249
- token: this.terminals_[N] || N,
250
- line: D.yylineno,
251
- loc: $,
252
- expected: H
253
- });
254
- }
255
- if (O[0] instanceof Array && O.length > 1)
256
- throw new Error("Parse Error: multiple actions possible at state: " + R + ", token: " + N);
257
- switch (O[0]) {
258
- case 1:
259
- c.push(N), E.push(D.yytext), r.push(D.yylloc), c.push(O[1]), N = null, W = D.yyleng, n = D.yytext, F = D.yylineno, $ = D.yylloc;
260
- break;
261
- case 2:
262
- if (B = this.productions_[O[1]][1], M.$ = E[E.length - B], M._$ = {
263
- first_line: r[r.length - (B || 1)].first_line,
264
- last_line: r[r.length - 1].last_line,
265
- first_column: r[r.length - (B || 1)].first_column,
266
- last_column: r[r.length - 1].last_column
267
- }, Pe && (M._$.range = [
268
- r[r.length - (B || 1)].range[0],
269
- r[r.length - 1].range[1]
270
- ]), ee = this.performAction.apply(M, [
271
- n,
272
- W,
273
- F,
274
- z.yy,
275
- O[1],
276
- E,
277
- r
278
- ].concat(Z)), typeof ee < "u")
279
- return ee;
280
- B && (c = c.slice(0, -1 * B * 2), E = E.slice(0, -1 * B), r = r.slice(0, -1 * B)), c.push(this.productions_[O[1]][0]), E.push(M.$), r.push(M._$), fe = K[c[c.length - 2]][c[c.length - 1]], c.push(fe);
281
- break;
282
- case 3:
283
- return !0;
284
- }
285
- }
286
- return !0;
287
- }, "parse")
288
- }, T = /* @__PURE__ */ (function() {
289
- var v = {
290
- EOF: 1,
291
- parseError: /* @__PURE__ */ u(function(i, c) {
292
- if (this.yy.parser)
293
- this.yy.parser.parseError(i, c);
294
- else
295
- throw new Error(i);
296
- }, "parseError"),
297
- // resets the lexer, sets new input
298
- setInput: /* @__PURE__ */ u(function(d, i) {
299
- return this.yy = i || this.yy || {}, this._input = d, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
300
- first_line: 1,
301
- first_column: 0,
302
- last_line: 1,
303
- last_column: 0
304
- }, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
305
- }, "setInput"),
306
- // consumes and returns one char from the input
307
- input: /* @__PURE__ */ u(function() {
308
- var d = this._input[0];
309
- this.yytext += d, this.yyleng++, this.offset++, this.match += d, this.matched += d;
310
- var i = d.match(/(?:\r\n?|\n).*/g);
311
- return i ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), d;
312
- }, "input"),
313
- // unshifts one char (or a string) into the input
314
- unput: /* @__PURE__ */ u(function(d) {
315
- var i = d.length, c = d.split(/(?:\r\n?|\n)/g);
316
- this._input = d + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - i), this.offset -= i;
317
- var p = this.match.split(/(?:\r\n?|\n)/g);
318
- this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), c.length - 1 && (this.yylineno -= c.length - 1);
319
- var E = this.yylloc.range;
320
- return this.yylloc = {
321
- first_line: this.yylloc.first_line,
322
- last_line: this.yylineno + 1,
323
- first_column: this.yylloc.first_column,
324
- last_column: c ? (c.length === p.length ? this.yylloc.first_column : 0) + p[p.length - c.length].length - c[0].length : this.yylloc.first_column - i
325
- }, this.options.ranges && (this.yylloc.range = [E[0], E[0] + this.yyleng - i]), this.yyleng = this.yytext.length, this;
326
- }, "unput"),
327
- // When called from action, caches matched text and appends it on next action
328
- more: /* @__PURE__ */ u(function() {
329
- return this._more = !0, this;
330
- }, "more"),
331
- // 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.
332
- reject: /* @__PURE__ */ u(function() {
333
- if (this.options.backtrack_lexer)
334
- this._backtrack = !0;
335
- else
336
- 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).
337
- ` + this.showPosition(), {
338
- text: "",
339
- token: null,
340
- line: this.yylineno
341
- });
342
- return this;
343
- }, "reject"),
344
- // retain first n characters of the match
345
- less: /* @__PURE__ */ u(function(d) {
346
- this.unput(this.match.slice(d));
347
- }, "less"),
348
- // displays already matched input, i.e. for error messages
349
- pastInput: /* @__PURE__ */ u(function() {
350
- var d = this.matched.substr(0, this.matched.length - this.match.length);
351
- return (d.length > 20 ? "..." : "") + d.substr(-20).replace(/\n/g, "");
352
- }, "pastInput"),
353
- // displays upcoming input, i.e. for error messages
354
- upcomingInput: /* @__PURE__ */ u(function() {
355
- var d = this.match;
356
- return d.length < 20 && (d += this._input.substr(0, 20 - d.length)), (d.substr(0, 20) + (d.length > 20 ? "..." : "")).replace(/\n/g, "");
357
- }, "upcomingInput"),
358
- // displays the character position where the lexing error occurred, i.e. for error messages
359
- showPosition: /* @__PURE__ */ u(function() {
360
- var d = this.pastInput(), i = new Array(d.length + 1).join("-");
361
- return d + this.upcomingInput() + `
362
- ` + i + "^";
363
- }, "showPosition"),
364
- // test the lexed token: return FALSE when not a match, otherwise return token
365
- test_match: /* @__PURE__ */ u(function(d, i) {
366
- var c, p, E;
367
- if (this.options.backtrack_lexer && (E = {
368
- yylineno: this.yylineno,
369
- yylloc: {
370
- first_line: this.yylloc.first_line,
371
- last_line: this.last_line,
372
- first_column: this.yylloc.first_column,
373
- last_column: this.yylloc.last_column
374
- },
375
- yytext: this.yytext,
376
- match: this.match,
377
- matches: this.matches,
378
- matched: this.matched,
379
- yyleng: this.yyleng,
380
- offset: this.offset,
381
- _more: this._more,
382
- _input: this._input,
383
- yy: this.yy,
384
- conditionStack: this.conditionStack.slice(0),
385
- done: this.done
386
- }, this.options.ranges && (E.yylloc.range = this.yylloc.range.slice(0))), p = d[0].match(/(?:\r\n?|\n).*/g), p && (this.yylineno += p.length), this.yylloc = {
387
- first_line: this.yylloc.last_line,
388
- last_line: this.yylineno + 1,
389
- first_column: this.yylloc.last_column,
390
- last_column: p ? p[p.length - 1].length - p[p.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + d[0].length
391
- }, this.yytext += d[0], this.match += d[0], this.matches = d, 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(d[0].length), this.matched += d[0], c = this.performAction.call(this, this.yy, this, i, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), c)
392
- return c;
393
- if (this._backtrack) {
394
- for (var r in E)
395
- this[r] = E[r];
396
- return !1;
397
- }
398
- return !1;
399
- }, "test_match"),
400
- // return next match in input
401
- next: /* @__PURE__ */ u(function() {
402
- if (this.done)
403
- return this.EOF;
404
- this._input || (this.done = !0);
405
- var d, i, c, p;
406
- this._more || (this.yytext = "", this.match = "");
407
- for (var E = this._currentRules(), r = 0; r < E.length; r++)
408
- if (c = this._input.match(this.rules[E[r]]), c && (!i || c[0].length > i[0].length)) {
409
- if (i = c, p = r, this.options.backtrack_lexer) {
410
- if (d = this.test_match(c, E[r]), d !== !1)
411
- return d;
412
- if (this._backtrack) {
413
- i = !1;
414
- continue;
415
- } else
416
- return !1;
417
- } else if (!this.options.flex)
418
- break;
419
- }
420
- return i ? (d = this.test_match(i, E[p]), d !== !1 ? d : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
421
- ` + this.showPosition(), {
422
- text: "",
423
- token: null,
424
- line: this.yylineno
425
- });
426
- }, "next"),
427
- // return next match that has a token
428
- lex: /* @__PURE__ */ u(function() {
429
- var i = this.next();
430
- return i || this.lex();
431
- }, "lex"),
432
- // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
433
- begin: /* @__PURE__ */ u(function(i) {
434
- this.conditionStack.push(i);
435
- }, "begin"),
436
- // pop the previously active lexer condition state off the condition stack
437
- popState: /* @__PURE__ */ u(function() {
438
- var i = this.conditionStack.length - 1;
439
- return i > 0 ? this.conditionStack.pop() : this.conditionStack[0];
440
- }, "popState"),
441
- // produce the lexer rule set which is active for the currently active lexer condition state
442
- _currentRules: /* @__PURE__ */ u(function() {
443
- return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
444
- }, "_currentRules"),
445
- // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
446
- topState: /* @__PURE__ */ u(function(i) {
447
- return i = this.conditionStack.length - 1 - Math.abs(i || 0), i >= 0 ? this.conditionStack[i] : "INITIAL";
448
- }, "topState"),
449
- // alias for begin(condition)
450
- pushState: /* @__PURE__ */ u(function(i) {
451
- this.begin(i);
452
- }, "pushState"),
453
- // return the number of states currently on the stack
454
- stateStackSize: /* @__PURE__ */ u(function() {
455
- return this.conditionStack.length;
456
- }, "stateStackSize"),
457
- options: {},
458
- performAction: /* @__PURE__ */ u(function(i, c, p, E) {
459
- switch (p) {
460
- case 0:
461
- return i.getLogger().debug("Found block-beta"), 10;
462
- case 1:
463
- return i.getLogger().debug("Found id-block"), 29;
464
- case 2:
465
- return i.getLogger().debug("Found block"), 10;
466
- case 3:
467
- i.getLogger().debug(".", c.yytext);
468
- break;
469
- case 4:
470
- i.getLogger().debug("_", c.yytext);
471
- break;
472
- case 5:
473
- return 5;
474
- case 6:
475
- return c.yytext = -1, 28;
476
- case 7:
477
- return c.yytext = c.yytext.replace(/columns\s+/, ""), i.getLogger().debug("COLUMNS (LEX)", c.yytext), 28;
478
- case 8:
479
- this.pushState("md_string");
480
- break;
481
- case 9:
482
- return "MD_STR";
483
- case 10:
484
- this.popState();
485
- break;
486
- case 11:
487
- this.pushState("string");
488
- break;
489
- case 12:
490
- i.getLogger().debug("LEX: POPPING STR:", c.yytext), this.popState();
491
- break;
492
- case 13:
493
- return i.getLogger().debug("LEX: STR end:", c.yytext), "STR";
494
- case 14:
495
- return c.yytext = c.yytext.replace(/space\:/, ""), i.getLogger().debug("SPACE NUM (LEX)", c.yytext), 21;
496
- case 15:
497
- return c.yytext = "1", i.getLogger().debug("COLUMNS (LEX)", c.yytext), 21;
498
- case 16:
499
- return 42;
500
- case 17:
501
- return "LINKSTYLE";
502
- case 18:
503
- return "INTERPOLATE";
504
- case 19:
505
- return this.pushState("CLASSDEF"), 39;
506
- case 20:
507
- return this.popState(), this.pushState("CLASSDEFID"), "DEFAULT_CLASSDEF_ID";
508
- case 21:
509
- return this.popState(), this.pushState("CLASSDEFID"), 40;
510
- case 22:
511
- return this.popState(), 41;
512
- case 23:
513
- return this.pushState("CLASS"), 43;
514
- case 24:
515
- return this.popState(), this.pushState("CLASS_STYLE"), 44;
516
- case 25:
517
- return this.popState(), 45;
518
- case 26:
519
- return this.pushState("STYLE_STMNT"), 46;
520
- case 27:
521
- return this.popState(), this.pushState("STYLE_DEFINITION"), 47;
522
- case 28:
523
- return this.popState(), 48;
524
- case 29:
525
- return this.pushState("acc_title"), "acc_title";
526
- case 30:
527
- return this.popState(), "acc_title_value";
528
- case 31:
529
- return this.pushState("acc_descr"), "acc_descr";
530
- case 32:
531
- return this.popState(), "acc_descr_value";
532
- case 33:
533
- this.pushState("acc_descr_multiline");
534
- break;
535
- case 34:
536
- this.popState();
537
- break;
538
- case 35:
539
- return "acc_descr_multiline_value";
540
- case 36:
541
- return 30;
542
- case 37:
543
- return this.popState(), i.getLogger().debug("Lex: (("), "NODE_DEND";
544
- case 38:
545
- return this.popState(), i.getLogger().debug("Lex: (("), "NODE_DEND";
546
- case 39:
547
- return this.popState(), i.getLogger().debug("Lex: ))"), "NODE_DEND";
548
- case 40:
549
- return this.popState(), i.getLogger().debug("Lex: (("), "NODE_DEND";
550
- case 41:
551
- return this.popState(), i.getLogger().debug("Lex: (("), "NODE_DEND";
552
- case 42:
553
- return this.popState(), i.getLogger().debug("Lex: (-"), "NODE_DEND";
554
- case 43:
555
- return this.popState(), i.getLogger().debug("Lex: -)"), "NODE_DEND";
556
- case 44:
557
- return this.popState(), i.getLogger().debug("Lex: (("), "NODE_DEND";
558
- case 45:
559
- return this.popState(), i.getLogger().debug("Lex: ]]"), "NODE_DEND";
560
- case 46:
561
- return this.popState(), i.getLogger().debug("Lex: ("), "NODE_DEND";
562
- case 47:
563
- return this.popState(), i.getLogger().debug("Lex: ])"), "NODE_DEND";
564
- case 48:
565
- return this.popState(), i.getLogger().debug("Lex: /]"), "NODE_DEND";
566
- case 49:
567
- return this.popState(), i.getLogger().debug("Lex: /]"), "NODE_DEND";
568
- case 50:
569
- return this.popState(), i.getLogger().debug("Lex: )]"), "NODE_DEND";
570
- case 51:
571
- return this.popState(), i.getLogger().debug("Lex: )"), "NODE_DEND";
572
- case 52:
573
- return this.popState(), i.getLogger().debug("Lex: ]>"), "NODE_DEND";
574
- case 53:
575
- return this.popState(), i.getLogger().debug("Lex: ]"), "NODE_DEND";
576
- case 54:
577
- return i.getLogger().debug("Lexa: -)"), this.pushState("NODE"), 35;
578
- case 55:
579
- return i.getLogger().debug("Lexa: (-"), this.pushState("NODE"), 35;
580
- case 56:
581
- return i.getLogger().debug("Lexa: ))"), this.pushState("NODE"), 35;
582
- case 57:
583
- return i.getLogger().debug("Lexa: )"), this.pushState("NODE"), 35;
584
- case 58:
585
- return i.getLogger().debug("Lex: ((("), this.pushState("NODE"), 35;
586
- case 59:
587
- return i.getLogger().debug("Lexa: )"), this.pushState("NODE"), 35;
588
- case 60:
589
- return i.getLogger().debug("Lexa: )"), this.pushState("NODE"), 35;
590
- case 61:
591
- return i.getLogger().debug("Lexa: )"), this.pushState("NODE"), 35;
592
- case 62:
593
- return i.getLogger().debug("Lexc: >"), this.pushState("NODE"), 35;
594
- case 63:
595
- return i.getLogger().debug("Lexa: (["), this.pushState("NODE"), 35;
596
- case 64:
597
- return i.getLogger().debug("Lexa: )"), this.pushState("NODE"), 35;
598
- case 65:
599
- return this.pushState("NODE"), 35;
600
- case 66:
601
- return this.pushState("NODE"), 35;
602
- case 67:
603
- return this.pushState("NODE"), 35;
604
- case 68:
605
- return this.pushState("NODE"), 35;
606
- case 69:
607
- return this.pushState("NODE"), 35;
608
- case 70:
609
- return this.pushState("NODE"), 35;
610
- case 71:
611
- return this.pushState("NODE"), 35;
612
- case 72:
613
- return i.getLogger().debug("Lexa: ["), this.pushState("NODE"), 35;
614
- case 73:
615
- return this.pushState("BLOCK_ARROW"), i.getLogger().debug("LEX ARR START"), 37;
616
- case 74:
617
- return i.getLogger().debug("Lex: NODE_ID", c.yytext), 31;
618
- case 75:
619
- return i.getLogger().debug("Lex: EOF", c.yytext), 8;
620
- case 76:
621
- this.pushState("md_string");
622
- break;
623
- case 77:
624
- this.pushState("md_string");
625
- break;
626
- case 78:
627
- return "NODE_DESCR";
628
- case 79:
629
- this.popState();
630
- break;
631
- case 80:
632
- i.getLogger().debug("Lex: Starting string"), this.pushState("string");
633
- break;
634
- case 81:
635
- i.getLogger().debug("LEX ARR: Starting string"), this.pushState("string");
636
- break;
637
- case 82:
638
- return i.getLogger().debug("LEX: NODE_DESCR:", c.yytext), "NODE_DESCR";
639
- case 83:
640
- i.getLogger().debug("LEX POPPING"), this.popState();
641
- break;
642
- case 84:
643
- i.getLogger().debug("Lex: =>BAE"), this.pushState("ARROW_DIR");
644
- break;
645
- case 85:
646
- return c.yytext = c.yytext.replace(/^,\s*/, ""), i.getLogger().debug("Lex (right): dir:", c.yytext), "DIR";
647
- case 86:
648
- return c.yytext = c.yytext.replace(/^,\s*/, ""), i.getLogger().debug("Lex (left):", c.yytext), "DIR";
649
- case 87:
650
- return c.yytext = c.yytext.replace(/^,\s*/, ""), i.getLogger().debug("Lex (x):", c.yytext), "DIR";
651
- case 88:
652
- return c.yytext = c.yytext.replace(/^,\s*/, ""), i.getLogger().debug("Lex (y):", c.yytext), "DIR";
653
- case 89:
654
- return c.yytext = c.yytext.replace(/^,\s*/, ""), i.getLogger().debug("Lex (up):", c.yytext), "DIR";
655
- case 90:
656
- return c.yytext = c.yytext.replace(/^,\s*/, ""), i.getLogger().debug("Lex (down):", c.yytext), "DIR";
657
- case 91:
658
- return c.yytext = "]>", i.getLogger().debug("Lex (ARROW_DIR end):", c.yytext), this.popState(), this.popState(), "BLOCK_ARROW_END";
659
- case 92:
660
- return i.getLogger().debug("Lex: LINK", "#" + c.yytext + "#"), 15;
661
- case 93:
662
- return i.getLogger().debug("Lex: LINK", c.yytext), 15;
663
- case 94:
664
- return i.getLogger().debug("Lex: LINK", c.yytext), 15;
665
- case 95:
666
- return i.getLogger().debug("Lex: LINK", c.yytext), 15;
667
- case 96:
668
- return i.getLogger().debug("Lex: START_LINK", c.yytext), this.pushState("LLABEL"), 16;
669
- case 97:
670
- return i.getLogger().debug("Lex: START_LINK", c.yytext), this.pushState("LLABEL"), 16;
671
- case 98:
672
- return i.getLogger().debug("Lex: START_LINK", c.yytext), this.pushState("LLABEL"), 16;
673
- case 99:
674
- this.pushState("md_string");
675
- break;
676
- case 100:
677
- return i.getLogger().debug("Lex: Starting string"), this.pushState("string"), "LINK_LABEL";
678
- case 101:
679
- return this.popState(), i.getLogger().debug("Lex: LINK", "#" + c.yytext + "#"), 15;
680
- case 102:
681
- return this.popState(), i.getLogger().debug("Lex: LINK", c.yytext), 15;
682
- case 103:
683
- return this.popState(), i.getLogger().debug("Lex: LINK", c.yytext), 15;
684
- case 104:
685
- return i.getLogger().debug("Lex: COLON", c.yytext), c.yytext = c.yytext.slice(1), 27;
686
- }
687
- }, "anonymous"),
688
- 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+)/],
689
- 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 } }
690
- };
691
- return v;
692
- })();
693
- k.lexer = T;
694
- function C() {
695
- this.yy = {};
696
- }
697
- return u(C, "Parser"), C.prototype = k, k.Parser = C, new C();
698
- })();
699
- ie.parser = ie;
700
- var zt = ie, A = /* @__PURE__ */ new Map(), le = [], ae = /* @__PURE__ */ new Map(), be = "color", Se = "fill", Bt = "bgFill", we = ",", G = /* @__PURE__ */ new Map(), ce = "", Rt = /* @__PURE__ */ u((e) => wt.sanitizeText(e, me()), "sanitizeText"), Pt = /* @__PURE__ */ u(function(e, a = "") {
701
- let o = G.get(e);
702
- o || (o = { id: e, styles: [], textStyles: [] }, G.set(e, o)), a?.split(we).forEach((s) => {
703
- const l = s.replace(/([^;]*);/, "$1").trim();
704
- if (RegExp(be).exec(s)) {
705
- const t = l.replace(Se, Bt).replace(be, Se);
706
- o.textStyles.push(t);
707
- }
708
- o.styles.push(l);
709
- });
710
- }, "addStyleClass"), Ft = /* @__PURE__ */ u(function(e, a = "") {
711
- const o = A.get(e);
712
- a != null && (o.styles = a.split(we));
713
- }, "addStyle2Node"), Mt = /* @__PURE__ */ u(function(e, a) {
714
- e.split(",").forEach(function(o) {
715
- let s = A.get(o);
716
- if (s === void 0) {
717
- const l = o.trim();
718
- s = { id: l, type: "na", children: [] }, A.set(l, s);
719
- }
720
- s.classes || (s.classes = []), s.classes.push(a);
721
- });
722
- }, "setCssClass"), Ee = 0, ke = /* @__PURE__ */ u((e, a) => {
723
- const o = e.flat(), s = [], g = o.find((t) => t?.type === "column-setting")?.columns ?? -1;
724
- for (const t of o) {
725
- if (typeof g == "number" && g > 0 && t.type !== "column-setting" && typeof t.widthInColumns == "number" && t.widthInColumns > g && y.warn(
726
- `Block ${t.id} width ${t.widthInColumns} exceeds configured column width ${g}`
727
- ), t.label && (t.label = Rt(t.label)), t.type === "classDef") {
728
- Pt(t.id, t.css);
729
- continue;
730
- }
731
- if (t.type === "applyClass") {
732
- Mt(t.id, t?.styleClass ?? "");
733
- continue;
734
- }
735
- if (t.type === "applyStyles") {
736
- t?.stylesStr && Ft(t.id, t?.stylesStr);
737
- continue;
738
- }
739
- if (t.type === "column-setting")
740
- a.columns = t.columns ?? -1;
741
- else if (t.type === "edge") {
742
- const h = (ae.get(t.id) ?? 0) + 1;
743
- ae.set(t.id, h), t.id = h + "-" + t.id, le.push(t);
744
- } else {
745
- t.label || (t.type === "composite" ? t.label = "" : t.label = t.id);
746
- const h = A.get(t.id);
747
- if (h === void 0 ? (t.type === "composite" && (t.colorIndex = Ee++), A.set(t.id, t)) : (t.type !== "na" && (h.type = t.type), t.label !== t.id && (h.label = t.label)), t.children && ke(t.children, t), t.type === "space") {
748
- const x = t.width ?? 1;
749
- for (let L = 0; L < x; L++) {
750
- const b = It(t);
751
- b.id = b.id + "-" + L, A.set(b.id, b), s.push(b);
752
- }
753
- } else h === void 0 && s.push(t);
754
- }
755
- }
756
- a.children = s;
757
- }, "populateBlockDatabase"), ue = [], Y = { id: "root", type: "composite", children: [], columns: -1 }, Kt = /* @__PURE__ */ u(() => {
758
- y.debug("Clear called"), dt(), Y = { id: "root", type: "composite", children: [], columns: -1 }, A = /* @__PURE__ */ new Map([["root", Y]]), ue = [], G = /* @__PURE__ */ new Map(), le = [], ae = /* @__PURE__ */ new Map(), ce = "", Ee = 0;
759
- }, "clear");
760
- function _e(e) {
761
- switch (y.debug("typeStr2Type", e), e) {
762
- case "[]":
763
- return "square";
764
- case "()":
765
- return y.debug("we have a round"), "round";
766
- case "(())":
767
- return "circle";
768
- case ">]":
769
- return "rect_left_inv_arrow";
770
- case "{}":
771
- return "diamond";
772
- case "{{}}":
773
- return "hexagon";
774
- case "([])":
775
- return "stadium";
776
- case "[[]]":
777
- return "subroutine";
778
- case "[()]":
779
- return "cylinder";
780
- case "((()))":
781
- return "doublecircle";
782
- case "[//]":
783
- return "lean_right";
784
- case "[\\\\]":
785
- return "lean_left";
786
- case "[/\\]":
787
- return "trapezoid";
788
- case "[\\/]":
789
- return "inv_trapezoid";
790
- case "<[]>":
791
- return "block_arrow";
792
- default:
793
- return "na";
794
- }
795
- }
796
- u(_e, "typeStr2Type");
797
- function De(e) {
798
- switch (y.debug("typeStr2Type", e), e) {
799
- case "==":
800
- return "thick";
801
- default:
802
- return "normal";
803
- }
804
- }
805
- u(De, "edgeTypeStr2Type");
806
- function Te(e) {
807
- switch (e.trim().slice(-1)) {
808
- case "x":
809
- return "arrow_cross";
810
- case "o":
811
- return "arrow_circle";
812
- case ">":
813
- return "arrow_point";
814
- default:
815
- return "";
816
- }
817
- }
818
- u(Te, "edgeStrToEdgeData");
819
- function Ne(e) {
820
- switch (e.trim().charAt(0)) {
821
- case "x":
822
- return "arrow_cross";
823
- case "o":
824
- return "arrow_circle";
825
- case "<":
826
- return "arrow_point";
827
- default:
828
- return "arrow_open";
829
- }
830
- }
831
- u(Ne, "edgeStrToEdgeStartData");
832
- function Ie(e) {
833
- return e.includes("==") ? "thick" : "normal";
834
- }
835
- u(Ie, "edgeStrToThickness");
836
- function Ce(e) {
837
- return e.includes(".-") ? "dotted" : "solid";
838
- }
839
- u(Ce, "edgeStrToPattern");
840
- var xe = 0, Yt = /* @__PURE__ */ u(() => (xe++, "id-" + Math.random().toString(36).substr(2, 12) + "-" + xe), "generateId"), Wt = /* @__PURE__ */ u((e) => {
841
- Y.children = e, ke(e, Y), ue = Y.children;
842
- }, "setHierarchy"), Vt = /* @__PURE__ */ u((e) => {
843
- const a = A.get(e);
844
- return a ? a.columns ? a.columns : a.children ? a.children.length : -1 : -1;
845
- }, "getColumns"), Ut = /* @__PURE__ */ u(() => [...A.values()], "getBlocksFlat"), Ht = /* @__PURE__ */ u(() => ue || [], "getBlocks"), Xt = /* @__PURE__ */ u(() => le, "getEdges"), Gt = /* @__PURE__ */ u((e) => A.get(e), "getBlock"), jt = /* @__PURE__ */ u((e) => {
846
- A.set(e.id, e);
847
- }, "setBlock"), qt = /* @__PURE__ */ u((e) => {
848
- ce = e;
849
- }, "setDiagramId"), Jt = /* @__PURE__ */ u(() => ce, "getDiagramId"), Zt = /* @__PURE__ */ u(() => y, "getLogger"), Qt = /* @__PURE__ */ u(function() {
850
- return G;
851
- }, "getClasses"), $t = {
852
- getConfig: /* @__PURE__ */ u(() => P().block, "getConfig"),
853
- typeStr2Type: _e,
854
- edgeTypeStr2Type: De,
855
- edgeStrToEdgeData: Te,
856
- edgeStrToEdgeStartData: Ne,
857
- edgeStrToThickness: Ie,
858
- edgeStrToPattern: Ce,
859
- getLogger: Zt,
860
- getBlocksFlat: Ut,
861
- getBlocks: Ht,
862
- getEdges: Xt,
863
- setHierarchy: Wt,
864
- getBlock: Gt,
865
- setBlock: jt,
866
- getColumns: Vt,
867
- getClasses: Qt,
868
- clear: Kt,
869
- generateId: Yt,
870
- setDiagramId: qt,
871
- getDiagramId: Jt
872
- }, es = $t, ts = /* @__PURE__ */ u((e) => {
873
- const { theme: a, bkgColorArray: o, borderColorArray: s } = e;
874
- if (!pt(a, s))
875
- return "";
876
- const l = ft(e.look), g = bt(o);
877
- let t = "";
878
- for (let h = 0; h < St(e.THEME_COLOR_LIMIT, s); h++) {
879
- const x = s[h % s.length], L = g ? `fill: ${o[h % o.length]};` : "", b = `[data-look="${l}"][data-color-id="color-${h}"]`;
880
- t += `
881
-
882
- ${b}.node rect.composite {
883
- stroke: ${x};
884
- ${L}
885
- }
886
- `;
887
- }
888
- return t;
889
- }, "genColor"), re = /* @__PURE__ */ u((e, a) => {
890
- const o = Tt, s = o(e, "r"), l = o(e, "g"), g = o(e, "b");
891
- return xt(s, l, g, a);
892
- }, "fade"), ss = /* @__PURE__ */ u((e) => `${ts(e)}
893
- .label {
894
- font-family: ${e.fontFamily};
895
- color: ${e.nodeTextColor || e.textColor};
896
- }
897
- .cluster-label text {
898
- fill: ${e.titleColor};
899
- }
900
- .cluster-label span {
901
- color: ${e.titleColor};
902
- }
903
-
904
-
905
-
906
- .label text,span {
907
- fill: ${e.nodeTextColor || e.textColor};
908
- color: ${e.nodeTextColor || e.textColor};
909
- }
910
-
911
- .node rect,
912
- .node circle,
913
- .node ellipse,
914
- .node polygon,
915
- .node path {
916
- fill: ${e.mainBkg};
917
- stroke: ${e.nodeBorder};
918
- /* From the theme, as every other diagram does. Pinned at 1px here, so block drew a
919
- thinner border than an identical flowchart node under any theme asking for more --
920
- the neo theme asks for 2. Nothing downstream corrected it: the neo rules set stroke
921
- and filter, never stroke-width. */
922
- stroke-width: ${e.strokeWidth ?? 1}px;
923
- }
924
- .flowchart-label text {
925
- text-anchor: middle;
926
- }
927
- // .flowchart-label .text-outer-tspan {
928
- // text-anchor: middle;
929
- // }
930
- // .flowchart-label .text-inner-tspan {
931
- // text-anchor: start;
932
- // }
933
-
934
- .node .label {
935
- text-align: center;
936
- }
937
- .node.clickable {
938
- cursor: pointer;
939
- }
940
-
941
- .arrowheadPath {
942
- fill: ${e.arrowheadColor};
943
- }
944
-
945
- .edgePaths .path {
946
- stroke: ${e.lineColor};
947
- stroke-width: 2.0px;
948
- }
949
-
950
- .flowchart-link {
951
- stroke: ${e.lineColor};
952
- fill: none;
953
- }
954
-
955
- .edgeLabel {
956
- background-color: ${e.edgeLabelBackground};
957
- /*
958
- * This is for backward compatibility with existing code that didn't
959
- * add a \`<p>\` around edge labels.
960
- *
961
- * TODO: We should probably remove this in a future release.
962
- */
963
- p {
964
- margin: 0;
965
- padding: 0;
966
- display: inline;
967
- }
968
- rect {
969
- opacity: 0.5;
970
- background-color: ${e.edgeLabelBackground};
971
- fill: ${e.edgeLabelBackground};
972
- }
973
- text-align: center;
974
- }
975
-
976
- /* For html labels only */
977
- .labelBkg {
978
- background-color: ${e.edgeLabelBackground};
979
- }
980
-
981
- .node .cluster {
982
- // fill: ${re(e.mainBkg, 0.5)};
983
- fill: ${re(e.clusterBkg, 0.5)};
984
- stroke: ${re(e.clusterBorder, 0.2)};
985
- box-shadow: rgba(50, 50, 93, 0.25) 0px 13px 27px -5px, rgba(0, 0, 0, 0.3) 0px 8px 16px -8px;
986
- stroke-width: 1px;
987
- }
988
-
989
- .cluster text {
990
- fill: ${e.titleColor};
991
- }
992
-
993
- .cluster span {
994
- color: ${e.titleColor};
995
- }
996
- /* .cluster div {
997
- color: ${e.titleColor};
998
- } */
999
-
1000
- div.mermaidTooltip {
1001
- position: absolute;
1002
- text-align: center;
1003
- max-width: 200px;
1004
- padding: 2px;
1005
- font-family: ${e.fontFamily};
1006
- font-size: 12px;
1007
- background: ${e.tertiaryColor};
1008
- border: 1px solid ${e.border2};
1009
- border-radius: 2px;
1010
- pointer-events: none;
1011
- z-index: 100;
1012
- }
1013
-
1014
- .flowchartTitleText {
1015
- text-anchor: middle;
1016
- font-size: 18px;
1017
- fill: ${e.textColor};
1018
- }
1019
- ${Me()}
1020
- `, "getStyles"), rs = ss;
1021
- function ne(e, a) {
1022
- if (e === 0 || !Number.isInteger(e))
1023
- throw new Error("Columns must be an integer !== 0.");
1024
- if (a < 0 || !Number.isInteger(a))
1025
- throw new Error("Position must be a non-negative integer." + a);
1026
- if (e < 0)
1027
- return { px: a, py: 0 };
1028
- if (e === 1)
1029
- return { px: 0, py: a };
1030
- const o = a % e, s = Math.floor(a / e);
1031
- return { px: o, py: s };
1032
- }
1033
- u(ne, "calculateBlockPosition");
1034
- var is = /* @__PURE__ */ u((e) => {
1035
- let a = 0, o = 0;
1036
- for (const s of e.children) {
1037
- const { width: l, height: g, x: t, y: h } = s.size ?? { width: 0, height: 0, x: 0, y: 0 };
1038
- if (y.debug(
1039
- "getMaxChildSize abc95 child:",
1040
- s.id,
1041
- "width:",
1042
- l,
1043
- "height:",
1044
- g,
1045
- "x:",
1046
- t,
1047
- "y:",
1048
- h,
1049
- s.type
1050
- ), s.type === "space")
1051
- continue;
1052
- const x = l / (s.widthInColumns ?? 1);
1053
- x > a && (a = x), g > o && (o = g);
1054
- }
1055
- return { width: a, height: o };
1056
- }, "getMaxChildSize");
1057
- function j(e, a, o = 0, s = 0, l = 8) {
1058
- y.debug(
1059
- "setBlockSizes abc95 (start)",
1060
- e.id,
1061
- e?.size?.x,
1062
- "block width =",
1063
- e?.size,
1064
- "siblingWidth",
1065
- o
1066
- ), e?.size?.width || (e.size = {
1067
- width: o,
1068
- height: s,
1069
- x: 0,
1070
- y: 0
1071
- });
1072
- let g = 0, t = 0;
1073
- if (e.children?.length > 0) {
1074
- for (const S of e.children)
1075
- j(S, a, 0, 0, l);
1076
- const h = is(e);
1077
- g = h.width, t = h.height, y.debug("setBlockSizes abc95 maxWidth of", e.id, ":s children is ", g, t);
1078
- for (const S of e.children)
1079
- S.size && (y.debug(
1080
- `abc95 Setting size of children of ${e.id} id=${S.id} ${g} ${t} ${JSON.stringify(S.size)}`
1081
- ), S.size.width = g * (S.widthInColumns ?? 1) + l * ((S.widthInColumns ?? 1) - 1), S.size.height = t, S.size.x = 0, S.size.y = 0, y.debug(
1082
- `abc95 updating size of ${e.id} children child:${S.id} maxWidth:${g} maxHeight:${t}`
1083
- ));
1084
- for (const S of e.children)
1085
- j(S, a, g, t, l);
1086
- const x = e.columns ?? -1;
1087
- let L = 0;
1088
- for (const S of e.children)
1089
- L += S.widthInColumns ?? 1;
1090
- let b = e.children.length;
1091
- x > 0 && x < L && (b = x);
1092
- const f = Math.ceil(L / b);
1093
- let m = b * (g + l) + l, w = f * (t + l) + l;
1094
- if (m < o) {
1095
- y.debug(
1096
- `Detected to small sibling: abc95 ${e.id} siblingWidth ${o} siblingHeight ${s} width ${m}`
1097
- ), m = o, w = s;
1098
- const S = (o - b * l - l) / b, _ = (s - f * l - l) / f;
1099
- y.debug("Size indata abc88", e.id, "childWidth", S, "maxWidth", g), y.debug("Size indata abc88", e.id, "childHeight", _, "maxHeight", t), y.debug("Size indata abc88 xSize", b, "padding", l);
1100
- for (const k of e.children)
1101
- k.size && (k.size.width = S, k.size.height = _, k.size.x = 0, k.size.y = 0);
1102
- }
1103
- if (y.debug(
1104
- `abc95 (finale calc) ${e.id} xSize ${b} ySize ${f} columns ${x}${e.children.length} width=${Math.max(m, e.size?.width || 0)}`
1105
- ), m < (e?.size?.width || 0)) {
1106
- m = e?.size?.width || 0;
1107
- const S = x > 0 ? Math.min(e.children.length, x) : e.children.length;
1108
- if (S > 0) {
1109
- const _ = (m - S * l - l) / S;
1110
- y.debug("abc95 (growing to fit) width", e.id, m, e.size?.width, _);
1111
- for (const k of e.children)
1112
- k.size && (k.size.width = _);
1113
- }
1114
- }
1115
- e.size = {
1116
- width: m,
1117
- height: w,
1118
- x: 0,
1119
- y: 0
1120
- };
1121
- }
1122
- y.debug(
1123
- "setBlockSizes abc94 (done)",
1124
- e.id,
1125
- e?.size?.x,
1126
- e?.size?.width,
1127
- e?.size?.y,
1128
- e?.size?.height
1129
- );
1130
- }
1131
- u(j, "setBlockSizes");
1132
- function he(e, a, o = 8) {
1133
- y.debug(
1134
- `abc85 layout blocks (=>layoutBlocks) ${e.id} x: ${e?.size?.x} y: ${e?.size?.y} width: ${e?.size?.width}`
1135
- );
1136
- const s = e.columns ?? -1;
1137
- if (y.debug("layoutBlocks columns abc95", e.id, "=>", s, e), e.children && // find max width of children
1138
- e.children.length > 0) {
1139
- const l = e?.children[0]?.size?.width ?? 0, g = e.children.length * l + (e.children.length - 1) * o;
1140
- y.debug("widthOfChildren 88", g, "posX");
1141
- const t = /* @__PURE__ */ new Map();
1142
- {
1143
- let f = 0;
1144
- for (const m of e.children) {
1145
- if (!m.size)
1146
- continue;
1147
- const { py: w } = ne(s, f), S = t.get(w) ?? 0;
1148
- m.size.height > S && t.set(w, m.size.height);
1149
- let _ = m?.widthInColumns ?? 1;
1150
- s > 0 && (_ = Math.min(_, s - f % s)), f += _;
1151
- }
1152
- }
1153
- const h = /* @__PURE__ */ new Map();
1154
- {
1155
- let f = 0;
1156
- const m = [...t.keys()].sort((w, S) => w - S);
1157
- for (const w of m)
1158
- h.set(w, f), f += (t.get(w) ?? 0) + o;
1159
- }
1160
- let x = 0;
1161
- y.debug("abc91 block?.size?.x", e.id, e?.size?.x);
1162
- let L = e?.size?.x ? e?.size?.x + (-e?.size?.width / 2 || 0) : -o, b = 0;
1163
- for (const f of e.children) {
1164
- const m = e;
1165
- if (!f.size)
1166
- continue;
1167
- const { width: w, height: S } = f.size, { px: _, py: k } = ne(s, x);
1168
- if (k != b && (b = k, L = e?.size?.x ? e?.size?.x + (-e?.size?.width / 2 || 0) : -o, y.debug("New row in layout for block", e.id, " and child ", f.id, b)), y.debug(
1169
- `abc89 layout blocks (child) id: ${f.id} Pos: ${x} (px, py) ${_},${k} (${m?.size?.x},${m?.size?.y}) parent: ${m.id} width: ${w}${o}`
1170
- ), m.size) {
1171
- const C = w / 2;
1172
- f.size.x = L + o + C, y.debug(
1173
- `abc91 layout blocks (calc) px, pyid:${f.id} startingPos=X${L} new startingPosX${f.size.x} ${C} padding=${o} width=${w} halfWidth=${C} => x:${f.size.x} y:${f.size.y} ${f.widthInColumns} (width * (child?.w || 1)) / 2 ${w * (f?.widthInColumns ?? 1) / 2}`
1174
- ), L = f.size.x + C;
1175
- const v = h.get(k) ?? 0, d = t.get(k) ?? S;
1176
- f.size.y = m.size.y - m.size.height / 2 + v + d / 2 + o, y.debug(
1177
- `abc88 layout blocks (calc) px, pyid:${f.id}startingPosX${L}${o}${C}=>x:${f.size.x}y:${f.size.y}${f.widthInColumns}(width * (child?.w || 1)) / 2${w * (f?.widthInColumns ?? 1) / 2}`
1178
- );
1179
- }
1180
- f.children && he(f, a, o);
1181
- let T = f?.widthInColumns ?? 1;
1182
- s > 0 && (T = Math.min(T, s - x % s)), x += T, y.debug("abc88 columnsPos", f, x);
1183
- }
1184
- }
1185
- y.debug(
1186
- `layout blocks (<==layoutBlocks) ${e.id} x: ${e?.size?.x} y: ${e?.size?.y} width: ${e?.size?.width}`
1187
- );
1188
- }
1189
- u(he, "layoutBlocks");
1190
- function ge(e, { minX: a, minY: o, maxX: s, maxY: l } = { minX: 0, minY: 0, maxX: 0, maxY: 0 }) {
1191
- if (e.size && e.id !== "root") {
1192
- const { x: g, y: t, width: h, height: x } = e.size;
1193
- g - h / 2 < a && (a = g - h / 2), t - x / 2 < o && (o = t - x / 2), g + h / 2 > s && (s = g + h / 2), t + x / 2 > l && (l = t + x / 2);
1194
- }
1195
- if (e.children)
1196
- for (const g of e.children)
1197
- ({ minX: a, minY: o, maxX: s, maxY: l } = ge(g, { minX: a, minY: o, maxX: s, maxY: l }));
1198
- return { minX: a, minY: o, maxX: s, maxY: l };
1199
- }
1200
- u(ge, "findBounds");
1201
- function ve(e) {
1202
- const a = e.getBlock("root");
1203
- if (!a)
1204
- return;
1205
- const o = me()?.block?.padding ?? 8;
1206
- j(a, e, 0, 0, o), he(a, e, o), y.debug("getBlocks", JSON.stringify(a, null, 2));
1207
- const { minX: s, minY: l, maxX: g, maxY: t } = ge(a), h = t - l, x = g - s;
1208
- return { x: s, y: l, width: x, height: h };
1209
- }
1210
- u(ve, "layout");
1211
- function de(e, a, o = !1) {
1212
- const s = e;
1213
- let l = "default";
1214
- (s?.classes?.length || 0) > 0 && (l = (s?.classes ?? []).join(" ")), l = l + " flowchart-label";
1215
- const g = (s?.classes ?? []).flatMap(
1216
- (S) => a.getClasses().get(S)?.styles ?? []
1217
- );
1218
- let t = 0, h = "rect", x;
1219
- switch (s.type) {
1220
- case "round":
1221
- t = 5, h = "rect";
1222
- break;
1223
- case "composite":
1224
- t = 0, h = "composite", x = 0;
1225
- break;
1226
- case "square":
1227
- h = "rect";
1228
- break;
1229
- case "diamond":
1230
- h = "question";
1231
- break;
1232
- case "hexagon":
1233
- h = "hexagon";
1234
- break;
1235
- case "block_arrow":
1236
- h = "block_arrow";
1237
- break;
1238
- case "odd":
1239
- h = "rect_left_inv_arrow";
1240
- break;
1241
- case "lean_right":
1242
- h = "lean_right";
1243
- break;
1244
- case "lean_left":
1245
- h = "lean_left";
1246
- break;
1247
- case "trapezoid":
1248
- h = "trapezoid";
1249
- break;
1250
- case "inv_trapezoid":
1251
- h = "inv_trapezoid";
1252
- break;
1253
- case "rect_left_inv_arrow":
1254
- h = "rect_left_inv_arrow";
1255
- break;
1256
- case "circle":
1257
- h = "circle";
1258
- break;
1259
- case "ellipse":
1260
- h = "ellipse";
1261
- break;
1262
- case "stadium":
1263
- h = "stadium";
1264
- break;
1265
- case "subroutine":
1266
- h = "subroutine";
1267
- break;
1268
- case "cylinder":
1269
- h = "cylinder";
1270
- break;
1271
- case "group":
1272
- h = "rect";
1273
- break;
1274
- case "doublecircle":
1275
- h = "doublecircle";
1276
- break;
1277
- default:
1278
- h = "rect";
1279
- }
1280
- const L = Et(s?.styles ?? []), b = s.label, f = s.size ?? { width: 0, height: 0, x: 0, y: 0 }, m = a.getDiagramId();
1281
- return {
1282
- labelStyle: L.labelStyle,
1283
- shape: h,
1284
- label: b,
1285
- labelText: b,
1286
- rx: t,
1287
- ry: t,
1288
- class: l,
1289
- cssClasses: l,
1290
- cssStyles: s?.styles ?? [],
1291
- cssCompiledStyles: g,
1292
- style: L.style,
1293
- id: s.id,
1294
- domId: m ? `${m}-${s.id}` : s.id,
1295
- isGroup: !1,
1296
- directions: s.directions,
1297
- width: f.width || void 0,
1298
- height: f.height || void 0,
1299
- wrappingWidth: f.width || Number.POSITIVE_INFINITY,
1300
- x: f.x,
1301
- y: f.y,
1302
- positioned: o,
1303
- intersect: void 0,
1304
- padding: x ?? P()?.block?.padding ?? 0,
1305
- widthInColumns: s.widthInColumns ?? 1,
1306
- colorIndex: s.colorIndex,
1307
- look: P().look
1308
- };
1309
- }
1310
- u(de, "getNodeFromBlock");
1311
- async function Oe(e, a, o) {
1312
- const s = de(a, o, !1);
1313
- if (a.type === "group")
1314
- return;
1315
- const l = P(), g = await ye(e, s, { config: l }), t = g.node()?.getBBox() ?? { width: 0, height: 0 }, h = o.getBlock(s.id);
1316
- h.size = { width: t.width, height: t.height, x: 0, y: 0, node: g }, o.setBlock(h), g.remove();
1317
- }
1318
- u(Oe, "calculateBlockSize");
1319
- async function Ae(e, a, o) {
1320
- const s = de(a, o, !0);
1321
- if (o.getBlock(s.id).type !== "space") {
1322
- const g = P(), t = await ye(e, s, { config: g });
1323
- s.colorIndex !== void 0 && kt(
1324
- // `insertNode` returns an anchor instead of a group when the node carries a
1325
- // link, and both are `SVGGraphicsElement`s -- but the union of the two selections
1326
- // is not assignable to one instantiation of the generic, so it is narrowed here.
1327
- t,
1328
- s.colorIndex,
1329
- g.theme,
1330
- g.themeVariables?.borderColorArray
1331
- ), a.intersect = s?.intersect, _t(s);
1332
- }
1333
- }
1334
- u(Ae, "insertBlockPositioned");
1335
- async function q(e, a, o, s) {
1336
- for (const l of a)
1337
- await s(e, l, o), l.children && await q(e, l.children, o, s);
1338
- }
1339
- u(q, "performOperations");
1340
- async function ze(e, a, o) {
1341
- await q(e, a, o, Oe);
1342
- }
1343
- u(ze, "calculateBlockSizes");
1344
- async function Be(e, a, o) {
1345
- await q(e, a, o, Ae);
1346
- }
1347
- u(Be, "insertBlocks");
1348
- async function Re(e, a, o, s, l) {
1349
- const g = new Dt({
1350
- multigraph: !0,
1351
- compound: !0
1352
- });
1353
- g.setGraph({
1354
- rankdir: "TB",
1355
- nodesep: 10,
1356
- ranksep: 10,
1357
- marginx: 8,
1358
- marginy: 8
1359
- });
1360
- for (const t of o)
1361
- t.size && g.setNode(t.id, {
1362
- width: t.size.width,
1363
- height: t.size.height,
1364
- intersect: t.intersect
1365
- });
1366
- for (const t of a)
1367
- if (t.start && t.end) {
1368
- const h = s.getBlock(t.start), x = s.getBlock(t.end);
1369
- if (h?.size && x?.size) {
1370
- const L = h.size, b = x.size, f = [
1371
- { x: L.x, y: L.y },
1372
- { x: L.x + (b.x - L.x) / 2, y: L.y + (b.y - L.y) / 2 },
1373
- { x: b.x, y: b.y }
1374
- ], m = l ? `${l}-${t.id}` : t.id, w = t.thickness === "thick" ? "edge-thickness-thick" : "edge-thickness-normal", S = t.pattern === "dotted" ? "edge-pattern-dotted" : "edge-pattern-solid", _ = `${w} ${S} flowchart-link LS-a1 LE-b1`;
1375
- Lt(
1376
- e,
1377
- {
1378
- ...t,
1379
- id: m,
1380
- arrowTypeEnd: t.arrowTypeEnd,
1381
- arrowTypeStart: t.arrowTypeStart,
1382
- points: f,
1383
- classes: _
1384
- },
1385
- {},
1386
- "block",
1387
- g.node(t.start),
1388
- g.node(t.end),
1389
- l
1390
- ), t.label && (await mt(e, {
1391
- ...t,
1392
- label: t.label,
1393
- labelStyle: "stroke: #333; stroke-width: 1.5px;fill:none;",
1394
- arrowTypeEnd: t.arrowTypeEnd,
1395
- arrowTypeStart: t.arrowTypeStart,
1396
- points: f,
1397
- classes: _
1398
- }), yt(
1399
- { ...t, x: f[1].x, y: f[1].y },
1400
- {
1401
- originalPath: f
1402
- }
1403
- ));
1404
- }
1405
- }
1406
- }
1407
- u(Re, "insertEdges");
1408
- var as = /* @__PURE__ */ u(function(e, a) {
1409
- return a.db.getClasses();
1410
- }, "getClasses"), ns = /* @__PURE__ */ u(async function(e, a, o, s) {
1411
- const { securityLevel: l, block: g } = P(), t = s.db;
1412
- t.setDiagramId(a);
1413
- let h;
1414
- l === "sandbox" && (h = X("#i" + a));
1415
- const x = l === "sandbox" ? X(h.nodes()[0].contentDocument.body) : X("body"), L = l === "sandbox" ? x.select(`[id="${a}"]`) : X(`[id="${a}"]`);
1416
- ut(L, P()), ht(L, ["point", "circle", "cross"], s.type, a);
1417
- const f = t.getBlocks(), m = t.getBlocksFlat(), w = t.getEdges(), S = L.insert("g").attr("class", "block");
1418
- await ze(S, f, t);
1419
- const _ = ve(t);
1420
- await Be(S, f, t), await Re(S, w, m, t, a);
1421
- const k = S.node()?.getBBox(), T = k && Number.isFinite(k.width) && Number.isFinite(k.height) ? k : _;
1422
- if (T) {
1423
- const C = Math.max(1, Math.round(0.125 * (T.width / T.height))), v = T.height + C + 10, d = T.width + 10, { useMaxWidth: i } = g;
1424
- gt(L, v, d, !!i), y.debug("Here Bounds", _, T), L.attr(
1425
- "viewBox",
1426
- `${T.x - 5} ${T.y - 5} ${T.width + 10} ${T.height + 10}`
1427
- );
1428
- }
1429
- }, "draw"), os = {
1430
- draw: ns,
1431
- getClasses: as
1432
- }, gs = {
1433
- parser: zt,
1434
- db: es,
1435
- renderer: os,
1436
- styles: rs
1437
- };
1438
- export {
1439
- gs as diagram
1440
- };