@webskill/sdk 0.21.0 → 0.23.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 (135) hide show
  1. package/dist/abnfDiagram-O67JEVCF-DtYFjfqO.js +109 -0
  2. package/dist/agent.d.ts +3 -3
  3. package/dist/agent.js +1174 -169
  4. package/dist/{approval-DwN2o2QG.js → approval-7CuZS3Z4.js} +104 -18
  5. package/dist/arc-8U_6NQWm.js +130 -0
  6. package/dist/architecture-7GRP2DOG-RTw1wpAq.js +4 -0
  7. package/dist/architectureDiagram-NJMV4G6O-XmmXrJAK.js +7473 -0
  8. package/dist/array-DQfpQNY8.js +8 -0
  9. package/dist/blockDiagram-BEXU5L5S-D4yjnCD1.js +2582 -0
  10. package/dist/browser.d.ts +455 -49
  11. package/dist/browser.js +2134 -138
  12. package/dist/c4Diagram-YGBWAQC7-BLmA_JSd.js +3668 -0
  13. package/dist/channel-CZxxLrG7.js +9 -0
  14. package/dist/chunk-2Q5K7J3B-Ck03gkFR.js +21 -0
  15. package/dist/chunk-3FUC2YCW-tr6jmbQf.js +530 -0
  16. package/dist/chunk-5DYCD2WN-Bt97YGTd.js +58 -0
  17. package/dist/chunk-5VM5RSS4-BBxa48HL.js +21 -0
  18. package/dist/chunk-6AEJRKK7-JXK89I-O.js +14 -0
  19. package/dist/chunk-742MDFTN-CPmgCGwC.js +466 -0
  20. package/dist/chunk-7INBJB4K-C9jq9o66.js +6552 -0
  21. package/dist/chunk-7M6MHVWA-BrKCWcR1.js +4894 -0
  22. package/dist/chunk-7PRAP22T-BHED6GVs.js +95 -0
  23. package/dist/chunk-DUW6YSOI-DoZj78PO.js +19 -0
  24. package/dist/chunk-FOHPRMQF-Dkbp819z.js +27189 -0
  25. package/dist/chunk-GNY47TPC-Bpvq1T49.js +87 -0
  26. package/dist/chunk-GTNCS2PH-CLmh4I2c.js +686 -0
  27. package/dist/chunk-GWA4HPMP-B6vN3fkL.js +95 -0
  28. package/dist/chunk-J5ZVWO5B-Bi_Pcobw.js +26 -0
  29. package/dist/chunk-JWPE2WC7-D1rC79GS.js +12 -0
  30. package/dist/chunk-LNGE3PJU-D5OIoe3Z.js +2582 -0
  31. package/dist/chunk-MBY4JIJT-C34L7a4f.js +2276 -0
  32. package/dist/chunk-NETBCI7D-Cg84k8N8.js +321 -0
  33. package/dist/chunk-O7XYJQB3-B6K0KOSL.js +8846 -0
  34. package/dist/chunk-UA2S7LBM-DxHM29_K.js +612 -0
  35. package/dist/chunk-WEXAMYUT-Ba6jFWhB.js +33 -0
  36. package/dist/chunk-XXDRQBXY-DPbSy4kg.js +12 -0
  37. package/dist/chunk-Y2CYZVJY-U3QOMqrW.js +15 -0
  38. package/dist/chunk-Z7XXMR3K-oLg1h8F3.js +1038 -0
  39. package/dist/chunk-ZIGJFQKS-DqEFBuHR.js +2215 -0
  40. package/dist/classDiagram-v2-NBCMYWYE-BqnOWIUt.js +3845 -0
  41. package/dist/cose-bilkent-JH36ORCC-C0dTAHVK.js +4270 -0
  42. package/dist/cynefin-OW5HDTMX-B2QvgEQj.js +4 -0
  43. package/dist/cynefinDiagram-VND7K2PF-yAWc6Z3W.js +479 -0
  44. package/dist/cytoscape.esm-C64mRh9B.js +28325 -0
  45. package/dist/dagre-6A5THRUB-D0w2W27v.js +4816 -0
  46. package/dist/defaultLocale-B_EoOkSF.js +249 -0
  47. package/dist/diagram-22UHCM2B-DvgzhUzP.js +6115 -0
  48. package/dist/diagram-3UASUU5V-DWgUB-ef.js +795 -0
  49. package/dist/diagram-ATOU4E4O-P1olqwIs.js +553 -0
  50. package/dist/diagram-CDSNMT55-BUlZuLUe.js +402 -0
  51. package/dist/diagram-MLGK6HIB-6w5qmkGt.js +186 -0
  52. package/dist/diagram-MPIPVDR6-DEFiSo8o.js +289 -0
  53. package/dist/dist-UajCDt3n.js +92 -0
  54. package/dist/ebnfDiagram-ZINNZB2B-CI8liCfR.js +123 -0
  55. package/dist/elk-276RUBZZ-3SvW6OAK.js +90034 -0
  56. package/dist/erDiagram-OPXOYQCR-CPTbKhwP.js +2301 -0
  57. package/dist/eventmodeling-NTZA5JFV-BlyuqGp0.js +4 -0
  58. package/dist/flowDiagram-KWPJA3E3-CcUJ6HbV.js +18 -0
  59. package/dist/ganttDiagram-FUAMR5RP-31UjY0KK.js +3939 -0
  60. package/dist/{toolSource-C9oNuKmr.js → geometry-CRhuySKV.js} +169 -12
  61. package/dist/gitGraph-4MIJSDKK-ChdVlrk7.js +4 -0
  62. package/dist/gitGraphDiagram-X574FWY7-DKuxJymB.js +1153 -0
  63. package/dist/governance.d.ts +22 -4
  64. package/dist/governance.js +100 -10
  65. package/dist/graphlib-tk9gQYuN.js +4194 -0
  66. package/dist/{index-DHopiH_m.d.ts → index-7No55dRb.d.ts} +161 -11
  67. package/dist/{index-B8Tgmpwh.d.ts → index-ShvCB5I9.d.ts} +2 -2
  68. package/dist/{index-CYLt5u4L.d.ts → index-V76_OFj2.d.ts} +789 -21
  69. package/dist/index.d.ts +4 -4
  70. package/dist/index.js +11 -9
  71. package/dist/info-A6RAGUB7-CxRAt9S9.js +4 -0
  72. package/dist/infoDiagram-VRGFBTTK-pRspGfjZ.js +25 -0
  73. package/dist/init-CMOIWdg-.js +16 -0
  74. package/dist/ishikawaDiagram-OU5B5YK6-DKerAPAg.js +975 -0
  75. package/dist/journeyDiagram-ZHPQQLJL-C4MK-YO5.js +1227 -0
  76. package/dist/kanban-definition-PNTS6WVX-BqsZpMXx.js +1244 -0
  77. package/dist/katex-BcRRvyh_.js +26465 -0
  78. package/dist/{kind-DaKqLX2F.js → kind-Dc8x0HWz.js} +54 -7
  79. package/dist/line-LgV8iVMV.js +48 -0
  80. package/dist/linear-BWKR0Tqd.js +393 -0
  81. package/dist/linkedDocument-CZZOl9cO.js +456 -0
  82. package/dist/mcp.d.ts +2 -2
  83. package/dist/{memoryArtifactStore-D6dLeY55.js → memoryArtifactStore-Bs7glPqm.js} +14 -0
  84. package/dist/mermaid-parser.core-pYR5siSx.js +754 -0
  85. package/dist/mermaid.core-DMtwGCHy.js +1756 -0
  86. package/dist/mindmap-definition-NLK3R4M7-CXbD-myG.js +1312 -0
  87. package/dist/node.d.ts +3 -3
  88. package/dist/node.js +12 -5
  89. package/dist/{openUiLibrary-b0i7F_oZ.js → openUiLibrary-B7j3rLrm.js} +1 -1
  90. package/dist/{openUiSpecLang-CLXJEeRU.js → openUiSpecLang-BSYYnjay.js} +1 -1
  91. package/dist/ordinal-CxA6GHQS.js +84 -0
  92. package/dist/packet-AYTQ26CC-BOm08cxl.js +4 -0
  93. package/dist/path-C27Z2Bjv.js +106 -0
  94. package/dist/{pathSecurity-B1owvJAF.js → pathSecurity-CirkQwWP.js} +12 -1
  95. package/dist/pegDiagram-GJSIUBJH-BLGJOewQ.js +115 -0
  96. package/dist/pie-WAS4IAKB-Dvg7glpk.js +4 -0
  97. package/dist/pieDiagram-5QR66LMP-laoaV_PB.js +298 -0
  98. package/dist/quadrantDiagram-O4NWA36T-Db_wFBkT.js +2236 -0
  99. package/dist/radar-RG4KPBEZ-BZDaTu06.js +4 -0
  100. package/dist/railroad-74A4TZTK-C-UhjkOy.js +4 -0
  101. package/dist/railroad-abnf-HS5TGJTU-dUKVA4OS.js +4 -0
  102. package/dist/railroad-ebnf-LZEXJU2U-DzQumk18.js +4 -0
  103. package/dist/railroad-peg-WCYAUIDC-B3vvTWed.js +4 -0
  104. package/dist/railroadDiagram-XR7U4H2S-BY0sTM4X.js +89 -0
  105. package/dist/requirementDiagram-PLB6GJNP-3rkQfEhs.js +2474 -0
  106. package/dist/rough.cjs-AmDd_NQk.js +1395 -0
  107. package/dist/sankeyDiagram-IPEJSGJF-CGAJhyG2.js +3578 -0
  108. package/dist/sequenceDiagram-PO4LG4MO-9FJjFX06.js +5522 -0
  109. package/dist/sizeCapture-INFHLROL-D8PWxdOn.js +56 -0
  110. package/dist/{skill-CAJMsLod.js → skill-WSUDp6A1.js} +1 -1
  111. package/dist/{skillVersionStore-B24Jjjry-BkOk9wI_.d.ts → skillVersionStore-S4_HJ_Fl-Cvy9LqVu.d.ts} +35 -4
  112. package/dist/src-NkhI3UMl.js +2653 -0
  113. package/dist/stateDiagram-v2-GCMORJYK-B0O3wc1-.js +2715 -0
  114. package/dist/swimlanes-2SLR337P-D4EOnrpu.js +6637 -0
  115. package/dist/swimlanesDiagram-TC7HE7FX-BUx29EJ9.js +30 -0
  116. package/dist/testing.d.ts +2 -1
  117. package/dist/testing.js +1 -1
  118. package/dist/timeline-definition-EJHVYXUP-CrgiiB4C.js +1513 -0
  119. package/dist/treeView-Q6P3EWNA-C1by-Gzc.js +4 -0
  120. package/dist/treemap-WGGIJYW6-mC2NZ6ad.js +4 -0
  121. package/dist/{types-BvTV_05--BW8zDuEk.d.ts → types-CpDRZ0rA-BiZBXGm4.d.ts} +66 -8
  122. package/dist/ui-react.d.ts +3 -3
  123. package/dist/ui-react.js +3746 -96
  124. package/dist/ui-vue.d.ts +1 -1
  125. package/dist/ui.d.ts +3 -3
  126. package/dist/ui.js +2 -2
  127. package/dist/usecaseDiagram-POWQR4AR-BUt_TQOY.js +14397 -0
  128. package/dist/vennDiagram-UO4OBE2U-CwXr0wjA.js +2808 -0
  129. package/dist/wardley-WFR3VGLG-CVSYjq_S.js +4 -0
  130. package/dist/wardleyDiagram-VNRHLVJA-Cpfd47dQ.js +874 -0
  131. package/dist/{webSkillApi-Cib6G-94.js → webSkillApi-D5VMUnrv.js} +2 -2
  132. package/dist/{webskillLitCatalog-W06npwej.js → webskillLitCatalog-D5BCiMCU.js} +1 -1
  133. package/dist/xychartDiagram-PMCCYNJV-e1TeVoc6.js +2704 -0
  134. package/package.json +1 -1
  135. package/dist/linkedDocument-C0gj1sMq.js +0 -245
@@ -0,0 +1,2715 @@
1
+ import { n as __name } from "./chunk-Y2CYZVJY-U3QOMqrW.js";
2
+ import { m as log, p as select_default } from "./src-NkhI3UMl.js";
3
+ import { H as setAccDescription, U as setAccTitle, a as clear, et as purify, q as setDiagramTitle, s as common_default, v as getAccDescription, w as getDiagramTitle, x as getConfig2, y as getAccTitle } from "./chunk-O7XYJQB3-B6K0KOSL.js";
4
+ import { g as utils_default, s as generateId } from "./chunk-ZIGJFQKS-DqEFBuHR.js";
5
+ import "./chunk-742MDFTN-CPmgCGwC.js";
6
+ import "./chunk-MBY4JIJT-C34L7a4f.js";
7
+ import "./chunk-7PRAP22T-BHED6GVs.js";
8
+ import { a as paletteSlotCount, i as isColorTheme, o as safeLook, r as hasPalette } from "./chunk-J5ZVWO5B-Bi_Pcobw.js";
9
+ import "./chunk-7INBJB4K-C9jq9o66.js";
10
+ import "./chunk-5DYCD2WN-Bt97YGTd.js";
11
+ import "./chunk-Z7XXMR3K-oLg1h8F3.js";
12
+ import { t as createTooltip } from "./chunk-GWA4HPMP-B6vN3fkL.js";
13
+ import { t as getDiagramElement } from "./chunk-XXDRQBXY-DPbSy4kg.js";
14
+ import { t as setupViewPortForSVG } from "./chunk-WEXAMYUT-Ba6jFWhB.js";
15
+ import "./chunk-UA2S7LBM-DxHM29_K.js";
16
+ import { r as render, t as getRegisteredLayoutAlgorithm } from "./chunk-GNY47TPC-Bpvq1T49.js";
17
+
18
+ //#region ../../node_modules/.pnpm/mermaid@12.0.0/node_modules/mermaid/dist/chunks/mermaid.core/stateDiagram-v2-GCMORJYK.mjs
19
+ var parser = (function() {
20
+ var o = /* @__PURE__ */ __name(function(k, v, o2, l) {
21
+ for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v);
22
+ return o2;
23
+ }, "o"), $V0 = [1, 2], $V1 = [1, 3], $V2 = [1, 4], $V3 = [2, 4], $V4 = [1, 9], $V5 = [1, 11], $V6 = [1, 16], $V7 = [1, 17], $V8 = [1, 18], $V9 = [1, 19], $Va = [1, 33], $Vb = [1, 20], $Vc = [1, 21], $Vd = [1, 22], $Ve = [1, 23], $Vf = [1, 24], $Vg = [1, 26], $Vh = [1, 27], $Vi = [1, 28], $Vj = [1, 29], $Vk = [1, 30], $Vl = [1, 31], $Vm = [1, 32], $Vn = [1, 35], $Vo = [1, 36], $Vp = [1, 37], $Vq = [1, 38], $Vr = [1, 34], $Vs = [
24
+ 1,
25
+ 4,
26
+ 5,
27
+ 16,
28
+ 17,
29
+ 19,
30
+ 21,
31
+ 22,
32
+ 24,
33
+ 25,
34
+ 26,
35
+ 27,
36
+ 28,
37
+ 29,
38
+ 33,
39
+ 35,
40
+ 37,
41
+ 38,
42
+ 41,
43
+ 45,
44
+ 48,
45
+ 51,
46
+ 52,
47
+ 53,
48
+ 54,
49
+ 57
50
+ ], $Vt = [
51
+ 1,
52
+ 4,
53
+ 5,
54
+ 14,
55
+ 15,
56
+ 16,
57
+ 17,
58
+ 19,
59
+ 21,
60
+ 22,
61
+ 24,
62
+ 25,
63
+ 26,
64
+ 27,
65
+ 28,
66
+ 29,
67
+ 33,
68
+ 35,
69
+ 37,
70
+ 38,
71
+ 39,
72
+ 40,
73
+ 41,
74
+ 45,
75
+ 48,
76
+ 51,
77
+ 52,
78
+ 53,
79
+ 54,
80
+ 57
81
+ ], $Vu = [
82
+ 4,
83
+ 5,
84
+ 16,
85
+ 17,
86
+ 19,
87
+ 21,
88
+ 22,
89
+ 24,
90
+ 25,
91
+ 26,
92
+ 27,
93
+ 28,
94
+ 29,
95
+ 33,
96
+ 35,
97
+ 37,
98
+ 38,
99
+ 41,
100
+ 45,
101
+ 48,
102
+ 51,
103
+ 52,
104
+ 53,
105
+ 54,
106
+ 57
107
+ ];
108
+ var parser2 = {
109
+ trace: /* @__PURE__ */ __name(function trace() {}, "trace"),
110
+ yy: {},
111
+ symbols_: {
112
+ "error": 2,
113
+ "start": 3,
114
+ "SPACE": 4,
115
+ "NL": 5,
116
+ "SD": 6,
117
+ "document": 7,
118
+ "line": 8,
119
+ "statement": 9,
120
+ "classDefStatement": 10,
121
+ "styleStatement": 11,
122
+ "cssClassStatement": 12,
123
+ "idStatement": 13,
124
+ "DESCR": 14,
125
+ "-->": 15,
126
+ "HIDE_EMPTY": 16,
127
+ "scale": 17,
128
+ "WIDTH": 18,
129
+ "COMPOSIT_STATE": 19,
130
+ "STRUCT_START": 20,
131
+ "STRUCT_STOP": 21,
132
+ "STATE_DESCR": 22,
133
+ "AS": 23,
134
+ "ID": 24,
135
+ "FORK": 25,
136
+ "JOIN": 26,
137
+ "CHOICE": 27,
138
+ "CONCURRENT": 28,
139
+ "note": 29,
140
+ "notePosition": 30,
141
+ "NOTE_TEXT": 31,
142
+ "direction": 32,
143
+ "acc_title": 33,
144
+ "acc_title_value": 34,
145
+ "acc_descr": 35,
146
+ "acc_descr_value": 36,
147
+ "acc_descr_multiline_value": 37,
148
+ "CLICK": 38,
149
+ "STRING": 39,
150
+ "HREF": 40,
151
+ "classDef": 41,
152
+ "CLASSDEF_ID": 42,
153
+ "CLASSDEF_STYLEOPTS": 43,
154
+ "DEFAULT": 44,
155
+ "style": 45,
156
+ "STYLE_IDS": 46,
157
+ "STYLEDEF_STYLEOPTS": 47,
158
+ "class": 48,
159
+ "CLASSENTITY_IDS": 49,
160
+ "STYLECLASS": 50,
161
+ "direction_tb": 51,
162
+ "direction_bt": 52,
163
+ "direction_rl": 53,
164
+ "direction_lr": 54,
165
+ "eol": 55,
166
+ ";": 56,
167
+ "EDGE_STATE": 57,
168
+ "STYLE_SEPARATOR": 58,
169
+ "left_of": 59,
170
+ "right_of": 60,
171
+ "$accept": 0,
172
+ "$end": 1
173
+ },
174
+ terminals_: {
175
+ 2: "error",
176
+ 4: "SPACE",
177
+ 5: "NL",
178
+ 6: "SD",
179
+ 14: "DESCR",
180
+ 15: "-->",
181
+ 16: "HIDE_EMPTY",
182
+ 17: "scale",
183
+ 18: "WIDTH",
184
+ 19: "COMPOSIT_STATE",
185
+ 20: "STRUCT_START",
186
+ 21: "STRUCT_STOP",
187
+ 22: "STATE_DESCR",
188
+ 23: "AS",
189
+ 24: "ID",
190
+ 25: "FORK",
191
+ 26: "JOIN",
192
+ 27: "CHOICE",
193
+ 28: "CONCURRENT",
194
+ 29: "note",
195
+ 31: "NOTE_TEXT",
196
+ 33: "acc_title",
197
+ 34: "acc_title_value",
198
+ 35: "acc_descr",
199
+ 36: "acc_descr_value",
200
+ 37: "acc_descr_multiline_value",
201
+ 38: "CLICK",
202
+ 39: "STRING",
203
+ 40: "HREF",
204
+ 41: "classDef",
205
+ 42: "CLASSDEF_ID",
206
+ 43: "CLASSDEF_STYLEOPTS",
207
+ 44: "DEFAULT",
208
+ 45: "style",
209
+ 46: "STYLE_IDS",
210
+ 47: "STYLEDEF_STYLEOPTS",
211
+ 48: "class",
212
+ 49: "CLASSENTITY_IDS",
213
+ 50: "STYLECLASS",
214
+ 51: "direction_tb",
215
+ 52: "direction_bt",
216
+ 53: "direction_rl",
217
+ 54: "direction_lr",
218
+ 56: ";",
219
+ 57: "EDGE_STATE",
220
+ 58: "STYLE_SEPARATOR",
221
+ 59: "left_of",
222
+ 60: "right_of"
223
+ },
224
+ productions_: [
225
+ 0,
226
+ [3, 2],
227
+ [3, 2],
228
+ [3, 2],
229
+ [7, 0],
230
+ [7, 2],
231
+ [8, 2],
232
+ [8, 1],
233
+ [8, 1],
234
+ [9, 1],
235
+ [9, 1],
236
+ [9, 1],
237
+ [9, 1],
238
+ [9, 2],
239
+ [9, 3],
240
+ [9, 4],
241
+ [9, 1],
242
+ [9, 2],
243
+ [9, 1],
244
+ [9, 4],
245
+ [9, 3],
246
+ [9, 6],
247
+ [9, 1],
248
+ [9, 1],
249
+ [9, 1],
250
+ [9, 1],
251
+ [9, 4],
252
+ [9, 4],
253
+ [9, 1],
254
+ [9, 2],
255
+ [9, 2],
256
+ [9, 1],
257
+ [9, 5],
258
+ [9, 5],
259
+ [10, 3],
260
+ [10, 3],
261
+ [11, 3],
262
+ [12, 3],
263
+ [32, 1],
264
+ [32, 1],
265
+ [32, 1],
266
+ [32, 1],
267
+ [55, 1],
268
+ [55, 1],
269
+ [13, 1],
270
+ [13, 1],
271
+ [13, 3],
272
+ [13, 3],
273
+ [30, 1],
274
+ [30, 1]
275
+ ],
276
+ performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
277
+ var $0 = $$.length - 1;
278
+ switch (yystate) {
279
+ case 3:
280
+ yy.setRootDoc($$[$0]);
281
+ return $$[$0];
282
+ case 4:
283
+ this.$ = [];
284
+ break;
285
+ case 5:
286
+ if ($$[$0] != "nl") {
287
+ $$[$0 - 1].push($$[$0]);
288
+ this.$ = $$[$0 - 1];
289
+ }
290
+ break;
291
+ case 6:
292
+ case 7:
293
+ this.$ = $$[$0];
294
+ break;
295
+ case 8:
296
+ this.$ = "nl";
297
+ break;
298
+ case 12:
299
+ this.$ = $$[$0];
300
+ break;
301
+ case 13:
302
+ const stateStmt = $$[$0 - 1];
303
+ stateStmt.description = yy.trimColon($$[$0]);
304
+ this.$ = stateStmt;
305
+ break;
306
+ case 14:
307
+ this.$ = {
308
+ stmt: "relation",
309
+ state1: $$[$0 - 2],
310
+ state2: $$[$0]
311
+ };
312
+ break;
313
+ case 15:
314
+ const relDescription = yy.trimColon($$[$0]);
315
+ this.$ = {
316
+ stmt: "relation",
317
+ state1: $$[$0 - 3],
318
+ state2: $$[$0 - 1],
319
+ description: relDescription
320
+ };
321
+ break;
322
+ case 19:
323
+ this.$ = {
324
+ stmt: "state",
325
+ id: $$[$0 - 3],
326
+ type: "default",
327
+ description: "",
328
+ doc: $$[$0 - 1]
329
+ };
330
+ break;
331
+ case 20:
332
+ var id = $$[$0];
333
+ var description = $$[$0 - 2].trim();
334
+ if ($$[$0].match(":")) {
335
+ var parts = $$[$0].split(":");
336
+ id = parts[0];
337
+ description = [description, parts[1]];
338
+ }
339
+ this.$ = {
340
+ stmt: "state",
341
+ id,
342
+ type: "default",
343
+ description
344
+ };
345
+ break;
346
+ case 21:
347
+ this.$ = {
348
+ stmt: "state",
349
+ id: $$[$0 - 3],
350
+ type: "default",
351
+ description: $$[$0 - 5],
352
+ doc: $$[$0 - 1]
353
+ };
354
+ break;
355
+ case 22:
356
+ this.$ = {
357
+ stmt: "state",
358
+ id: $$[$0],
359
+ type: "fork"
360
+ };
361
+ break;
362
+ case 23:
363
+ this.$ = {
364
+ stmt: "state",
365
+ id: $$[$0],
366
+ type: "join"
367
+ };
368
+ break;
369
+ case 24:
370
+ this.$ = {
371
+ stmt: "state",
372
+ id: $$[$0],
373
+ type: "choice"
374
+ };
375
+ break;
376
+ case 25:
377
+ this.$ = {
378
+ stmt: "state",
379
+ id: yy.getDividerId(),
380
+ type: "divider"
381
+ };
382
+ break;
383
+ case 26:
384
+ this.$ = {
385
+ stmt: "state",
386
+ id: $$[$0 - 1].trim(),
387
+ note: {
388
+ position: $$[$0 - 2].trim(),
389
+ text: $$[$0].trim()
390
+ }
391
+ };
392
+ break;
393
+ case 29:
394
+ this.$ = $$[$0].trim();
395
+ yy.setAccTitle(this.$);
396
+ break;
397
+ case 30:
398
+ case 31:
399
+ this.$ = $$[$0].trim();
400
+ yy.setAccDescription(this.$);
401
+ break;
402
+ case 32:
403
+ this.$ = {
404
+ stmt: "click",
405
+ id: $$[$0 - 3],
406
+ url: $$[$0 - 2],
407
+ tooltip: $$[$0 - 1]
408
+ };
409
+ break;
410
+ case 33:
411
+ this.$ = {
412
+ stmt: "click",
413
+ id: $$[$0 - 3],
414
+ url: $$[$0 - 1],
415
+ tooltip: ""
416
+ };
417
+ break;
418
+ case 34:
419
+ case 35:
420
+ this.$ = {
421
+ stmt: "classDef",
422
+ id: $$[$0 - 1].trim(),
423
+ classes: $$[$0].trim()
424
+ };
425
+ break;
426
+ case 36:
427
+ this.$ = {
428
+ stmt: "style",
429
+ id: $$[$0 - 1].trim(),
430
+ styleClass: $$[$0].trim()
431
+ };
432
+ break;
433
+ case 37:
434
+ this.$ = {
435
+ stmt: "applyClass",
436
+ id: $$[$0 - 1].trim(),
437
+ styleClass: $$[$0].trim()
438
+ };
439
+ break;
440
+ case 38:
441
+ yy.setDirection("TB");
442
+ this.$ = {
443
+ stmt: "dir",
444
+ value: "TB"
445
+ };
446
+ break;
447
+ case 39:
448
+ yy.setDirection("BT");
449
+ this.$ = {
450
+ stmt: "dir",
451
+ value: "BT"
452
+ };
453
+ break;
454
+ case 40:
455
+ yy.setDirection("RL");
456
+ this.$ = {
457
+ stmt: "dir",
458
+ value: "RL"
459
+ };
460
+ break;
461
+ case 41:
462
+ yy.setDirection("LR");
463
+ this.$ = {
464
+ stmt: "dir",
465
+ value: "LR"
466
+ };
467
+ break;
468
+ case 44:
469
+ case 45:
470
+ this.$ = {
471
+ stmt: "state",
472
+ id: $$[$0].trim(),
473
+ type: "default",
474
+ description: ""
475
+ };
476
+ break;
477
+ case 46:
478
+ this.$ = {
479
+ stmt: "state",
480
+ id: $$[$0 - 2].trim(),
481
+ classes: [$$[$0].trim()],
482
+ type: "default",
483
+ description: ""
484
+ };
485
+ break;
486
+ case 47:
487
+ this.$ = {
488
+ stmt: "state",
489
+ id: $$[$0 - 2].trim(),
490
+ classes: [$$[$0].trim()],
491
+ type: "default",
492
+ description: ""
493
+ };
494
+ break;
495
+ }
496
+ }, "anonymous"),
497
+ table: [
498
+ {
499
+ 3: 1,
500
+ 4: $V0,
501
+ 5: $V1,
502
+ 6: $V2
503
+ },
504
+ { 1: [3] },
505
+ {
506
+ 3: 5,
507
+ 4: $V0,
508
+ 5: $V1,
509
+ 6: $V2
510
+ },
511
+ {
512
+ 3: 6,
513
+ 4: $V0,
514
+ 5: $V1,
515
+ 6: $V2
516
+ },
517
+ o([
518
+ 1,
519
+ 4,
520
+ 5,
521
+ 16,
522
+ 17,
523
+ 19,
524
+ 22,
525
+ 24,
526
+ 25,
527
+ 26,
528
+ 27,
529
+ 28,
530
+ 29,
531
+ 33,
532
+ 35,
533
+ 37,
534
+ 38,
535
+ 41,
536
+ 45,
537
+ 48,
538
+ 51,
539
+ 52,
540
+ 53,
541
+ 54,
542
+ 57
543
+ ], $V3, { 7: 7 }),
544
+ { 1: [2, 1] },
545
+ { 1: [2, 2] },
546
+ {
547
+ 1: [2, 3],
548
+ 4: $V4,
549
+ 5: $V5,
550
+ 8: 8,
551
+ 9: 10,
552
+ 10: 12,
553
+ 11: 13,
554
+ 12: 14,
555
+ 13: 15,
556
+ 16: $V6,
557
+ 17: $V7,
558
+ 19: $V8,
559
+ 22: $V9,
560
+ 24: $Va,
561
+ 25: $Vb,
562
+ 26: $Vc,
563
+ 27: $Vd,
564
+ 28: $Ve,
565
+ 29: $Vf,
566
+ 32: 25,
567
+ 33: $Vg,
568
+ 35: $Vh,
569
+ 37: $Vi,
570
+ 38: $Vj,
571
+ 41: $Vk,
572
+ 45: $Vl,
573
+ 48: $Vm,
574
+ 51: $Vn,
575
+ 52: $Vo,
576
+ 53: $Vp,
577
+ 54: $Vq,
578
+ 57: $Vr
579
+ },
580
+ o($Vs, [2, 5]),
581
+ {
582
+ 9: 39,
583
+ 10: 12,
584
+ 11: 13,
585
+ 12: 14,
586
+ 13: 15,
587
+ 16: $V6,
588
+ 17: $V7,
589
+ 19: $V8,
590
+ 22: $V9,
591
+ 24: $Va,
592
+ 25: $Vb,
593
+ 26: $Vc,
594
+ 27: $Vd,
595
+ 28: $Ve,
596
+ 29: $Vf,
597
+ 32: 25,
598
+ 33: $Vg,
599
+ 35: $Vh,
600
+ 37: $Vi,
601
+ 38: $Vj,
602
+ 41: $Vk,
603
+ 45: $Vl,
604
+ 48: $Vm,
605
+ 51: $Vn,
606
+ 52: $Vo,
607
+ 53: $Vp,
608
+ 54: $Vq,
609
+ 57: $Vr
610
+ },
611
+ o($Vs, [2, 7]),
612
+ o($Vs, [2, 8]),
613
+ o($Vs, [2, 9]),
614
+ o($Vs, [2, 10]),
615
+ o($Vs, [2, 11]),
616
+ o($Vs, [2, 12], {
617
+ 14: [1, 40],
618
+ 15: [1, 41]
619
+ }),
620
+ o($Vs, [2, 16]),
621
+ { 18: [1, 42] },
622
+ o($Vs, [2, 18], { 20: [1, 43] }),
623
+ { 23: [1, 44] },
624
+ o($Vs, [2, 22]),
625
+ o($Vs, [2, 23]),
626
+ o($Vs, [2, 24]),
627
+ o($Vs, [2, 25]),
628
+ {
629
+ 30: 45,
630
+ 31: [1, 46],
631
+ 59: [1, 47],
632
+ 60: [1, 48]
633
+ },
634
+ o($Vs, [2, 28]),
635
+ { 34: [1, 49] },
636
+ { 36: [1, 50] },
637
+ o($Vs, [2, 31]),
638
+ {
639
+ 13: 51,
640
+ 24: $Va,
641
+ 57: $Vr
642
+ },
643
+ {
644
+ 42: [1, 52],
645
+ 44: [1, 53]
646
+ },
647
+ { 46: [1, 54] },
648
+ { 49: [1, 55] },
649
+ o($Vt, [2, 44], { 58: [1, 56] }),
650
+ o($Vt, [2, 45], { 58: [1, 57] }),
651
+ o($Vs, [2, 38]),
652
+ o($Vs, [2, 39]),
653
+ o($Vs, [2, 40]),
654
+ o($Vs, [2, 41]),
655
+ o($Vs, [2, 6]),
656
+ o($Vs, [2, 13]),
657
+ {
658
+ 13: 58,
659
+ 24: $Va,
660
+ 57: $Vr
661
+ },
662
+ o($Vs, [2, 17]),
663
+ o($Vu, $V3, { 7: 59 }),
664
+ { 24: [1, 60] },
665
+ { 24: [1, 61] },
666
+ { 23: [1, 62] },
667
+ { 24: [2, 48] },
668
+ { 24: [2, 49] },
669
+ o($Vs, [2, 29]),
670
+ o($Vs, [2, 30]),
671
+ {
672
+ 39: [1, 63],
673
+ 40: [1, 64]
674
+ },
675
+ { 43: [1, 65] },
676
+ { 43: [1, 66] },
677
+ { 47: [1, 67] },
678
+ { 50: [1, 68] },
679
+ { 24: [1, 69] },
680
+ { 24: [1, 70] },
681
+ o($Vs, [2, 14], { 14: [1, 71] }),
682
+ {
683
+ 4: $V4,
684
+ 5: $V5,
685
+ 8: 8,
686
+ 9: 10,
687
+ 10: 12,
688
+ 11: 13,
689
+ 12: 14,
690
+ 13: 15,
691
+ 16: $V6,
692
+ 17: $V7,
693
+ 19: $V8,
694
+ 21: [1, 72],
695
+ 22: $V9,
696
+ 24: $Va,
697
+ 25: $Vb,
698
+ 26: $Vc,
699
+ 27: $Vd,
700
+ 28: $Ve,
701
+ 29: $Vf,
702
+ 32: 25,
703
+ 33: $Vg,
704
+ 35: $Vh,
705
+ 37: $Vi,
706
+ 38: $Vj,
707
+ 41: $Vk,
708
+ 45: $Vl,
709
+ 48: $Vm,
710
+ 51: $Vn,
711
+ 52: $Vo,
712
+ 53: $Vp,
713
+ 54: $Vq,
714
+ 57: $Vr
715
+ },
716
+ o($Vs, [2, 20], { 20: [1, 73] }),
717
+ { 31: [1, 74] },
718
+ { 24: [1, 75] },
719
+ { 39: [1, 76] },
720
+ { 39: [1, 77] },
721
+ o($Vs, [2, 34]),
722
+ o($Vs, [2, 35]),
723
+ o($Vs, [2, 36]),
724
+ o($Vs, [2, 37]),
725
+ o($Vt, [2, 46]),
726
+ o($Vt, [2, 47]),
727
+ o($Vs, [2, 15]),
728
+ o($Vs, [2, 19]),
729
+ o($Vu, $V3, { 7: 78 }),
730
+ o($Vs, [2, 26]),
731
+ o($Vs, [2, 27]),
732
+ { 5: [1, 79] },
733
+ { 5: [1, 80] },
734
+ {
735
+ 4: $V4,
736
+ 5: $V5,
737
+ 8: 8,
738
+ 9: 10,
739
+ 10: 12,
740
+ 11: 13,
741
+ 12: 14,
742
+ 13: 15,
743
+ 16: $V6,
744
+ 17: $V7,
745
+ 19: $V8,
746
+ 21: [1, 81],
747
+ 22: $V9,
748
+ 24: $Va,
749
+ 25: $Vb,
750
+ 26: $Vc,
751
+ 27: $Vd,
752
+ 28: $Ve,
753
+ 29: $Vf,
754
+ 32: 25,
755
+ 33: $Vg,
756
+ 35: $Vh,
757
+ 37: $Vi,
758
+ 38: $Vj,
759
+ 41: $Vk,
760
+ 45: $Vl,
761
+ 48: $Vm,
762
+ 51: $Vn,
763
+ 52: $Vo,
764
+ 53: $Vp,
765
+ 54: $Vq,
766
+ 57: $Vr
767
+ },
768
+ o($Vs, [2, 32]),
769
+ o($Vs, [2, 33]),
770
+ o($Vs, [2, 21])
771
+ ],
772
+ defaultActions: {
773
+ 5: [2, 1],
774
+ 6: [2, 2],
775
+ 47: [2, 48],
776
+ 48: [2, 49]
777
+ },
778
+ parseError: /* @__PURE__ */ __name(function parseError(str, hash) {
779
+ if (hash.recoverable) this.trace(str);
780
+ else {
781
+ var error = new Error(str);
782
+ error.hash = hash;
783
+ throw error;
784
+ }
785
+ }, "parseError"),
786
+ parse: /* @__PURE__ */ __name(function parse(input) {
787
+ var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
788
+ var args = lstack.slice.call(arguments, 1);
789
+ var lexer2 = Object.create(this.lexer);
790
+ var sharedState = { yy: {} };
791
+ for (var k in this.yy) if (Object.prototype.hasOwnProperty.call(this.yy, k)) sharedState.yy[k] = this.yy[k];
792
+ lexer2.setInput(input, sharedState.yy);
793
+ sharedState.yy.lexer = lexer2;
794
+ sharedState.yy.parser = this;
795
+ if (typeof lexer2.yylloc == "undefined") lexer2.yylloc = {};
796
+ var yyloc = lexer2.yylloc;
797
+ lstack.push(yyloc);
798
+ var ranges = lexer2.options && lexer2.options.ranges;
799
+ if (typeof sharedState.yy.parseError === "function") this.parseError = sharedState.yy.parseError;
800
+ else this.parseError = Object.getPrototypeOf(this).parseError;
801
+ function popStack(n) {
802
+ stack.length = stack.length - 2 * n;
803
+ vstack.length = vstack.length - n;
804
+ lstack.length = lstack.length - n;
805
+ }
806
+ __name(popStack, "popStack");
807
+ function lex() {
808
+ var token = tstack.pop() || lexer2.lex() || EOF;
809
+ if (typeof token !== "number") {
810
+ if (token instanceof Array) {
811
+ tstack = token;
812
+ token = tstack.pop();
813
+ }
814
+ token = self.symbols_[token] || token;
815
+ }
816
+ return token;
817
+ }
818
+ __name(lex, "lex");
819
+ var symbol, preErrorSymbol, state, action, r, yyval = {}, p, len, newState, expected;
820
+ while (true) {
821
+ state = stack[stack.length - 1];
822
+ if (this.defaultActions[state]) action = this.defaultActions[state];
823
+ else {
824
+ if (symbol === null || typeof symbol == "undefined") symbol = lex();
825
+ action = table[state] && table[state][symbol];
826
+ }
827
+ if (typeof action === "undefined" || !action.length || !action[0]) {
828
+ var errStr = "";
829
+ expected = [];
830
+ for (p in table[state]) if (this.terminals_[p] && p > TERROR) expected.push("'" + this.terminals_[p] + "'");
831
+ if (lexer2.showPosition) errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
832
+ else errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
833
+ this.parseError(errStr, {
834
+ text: lexer2.match,
835
+ token: this.terminals_[symbol] || symbol,
836
+ line: lexer2.yylineno,
837
+ loc: yyloc,
838
+ expected
839
+ });
840
+ }
841
+ if (action[0] instanceof Array && action.length > 1) throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
842
+ switch (action[0]) {
843
+ case 1:
844
+ stack.push(symbol);
845
+ vstack.push(lexer2.yytext);
846
+ lstack.push(lexer2.yylloc);
847
+ stack.push(action[1]);
848
+ symbol = null;
849
+ if (!preErrorSymbol) {
850
+ yyleng = lexer2.yyleng;
851
+ yytext = lexer2.yytext;
852
+ yylineno = lexer2.yylineno;
853
+ yyloc = lexer2.yylloc;
854
+ if (recovering > 0) recovering--;
855
+ } else {
856
+ symbol = preErrorSymbol;
857
+ preErrorSymbol = null;
858
+ }
859
+ break;
860
+ case 2:
861
+ len = this.productions_[action[1]][1];
862
+ yyval.$ = vstack[vstack.length - len];
863
+ yyval._$ = {
864
+ first_line: lstack[lstack.length - (len || 1)].first_line,
865
+ last_line: lstack[lstack.length - 1].last_line,
866
+ first_column: lstack[lstack.length - (len || 1)].first_column,
867
+ last_column: lstack[lstack.length - 1].last_column
868
+ };
869
+ if (ranges) yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]];
870
+ r = this.performAction.apply(yyval, [
871
+ yytext,
872
+ yyleng,
873
+ yylineno,
874
+ sharedState.yy,
875
+ action[1],
876
+ vstack,
877
+ lstack
878
+ ].concat(args));
879
+ if (typeof r !== "undefined") return r;
880
+ if (len) {
881
+ stack = stack.slice(0, -1 * len * 2);
882
+ vstack = vstack.slice(0, -1 * len);
883
+ lstack = lstack.slice(0, -1 * len);
884
+ }
885
+ stack.push(this.productions_[action[1]][0]);
886
+ vstack.push(yyval.$);
887
+ lstack.push(yyval._$);
888
+ newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
889
+ stack.push(newState);
890
+ break;
891
+ case 3: return true;
892
+ }
893
+ }
894
+ return true;
895
+ }, "parse")
896
+ };
897
+ parser2.lexer = /* @__PURE__ */ (function() {
898
+ return {
899
+ EOF: 1,
900
+ parseError: /* @__PURE__ */ __name(function parseError(str, hash) {
901
+ if (this.yy.parser) this.yy.parser.parseError(str, hash);
902
+ else throw new Error(str);
903
+ }, "parseError"),
904
+ setInput: /* @__PURE__ */ __name(function(input, yy) {
905
+ this.yy = yy || this.yy || {};
906
+ this._input = input;
907
+ this._more = this._backtrack = this.done = false;
908
+ this.yylineno = this.yyleng = 0;
909
+ this.yytext = this.matched = this.match = "";
910
+ this.conditionStack = ["INITIAL"];
911
+ this.yylloc = {
912
+ first_line: 1,
913
+ first_column: 0,
914
+ last_line: 1,
915
+ last_column: 0
916
+ };
917
+ if (this.options.ranges) this.yylloc.range = [0, 0];
918
+ this.offset = 0;
919
+ return this;
920
+ }, "setInput"),
921
+ input: /* @__PURE__ */ __name(function() {
922
+ var ch = this._input[0];
923
+ this.yytext += ch;
924
+ this.yyleng++;
925
+ this.offset++;
926
+ this.match += ch;
927
+ this.matched += ch;
928
+ if (ch.match(/(?:\r\n?|\n).*/g)) {
929
+ this.yylineno++;
930
+ this.yylloc.last_line++;
931
+ } else this.yylloc.last_column++;
932
+ if (this.options.ranges) this.yylloc.range[1]++;
933
+ this._input = this._input.slice(1);
934
+ return ch;
935
+ }, "input"),
936
+ unput: /* @__PURE__ */ __name(function(ch) {
937
+ var len = ch.length;
938
+ var lines = ch.split(/(?:\r\n?|\n)/g);
939
+ this._input = ch + this._input;
940
+ this.yytext = this.yytext.substr(0, this.yytext.length - len);
941
+ this.offset -= len;
942
+ var oldLines = this.match.split(/(?:\r\n?|\n)/g);
943
+ this.match = this.match.substr(0, this.match.length - 1);
944
+ this.matched = this.matched.substr(0, this.matched.length - 1);
945
+ if (lines.length - 1) this.yylineno -= lines.length - 1;
946
+ var r = this.yylloc.range;
947
+ this.yylloc = {
948
+ first_line: this.yylloc.first_line,
949
+ last_line: this.yylineno + 1,
950
+ first_column: this.yylloc.first_column,
951
+ last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len
952
+ };
953
+ if (this.options.ranges) this.yylloc.range = [r[0], r[0] + this.yyleng - len];
954
+ this.yyleng = this.yytext.length;
955
+ return this;
956
+ }, "unput"),
957
+ more: /* @__PURE__ */ __name(function() {
958
+ this._more = true;
959
+ return this;
960
+ }, "more"),
961
+ reject: /* @__PURE__ */ __name(function() {
962
+ if (this.options.backtrack_lexer) this._backtrack = true;
963
+ else 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).\n" + this.showPosition(), {
964
+ text: "",
965
+ token: null,
966
+ line: this.yylineno
967
+ });
968
+ return this;
969
+ }, "reject"),
970
+ less: /* @__PURE__ */ __name(function(n) {
971
+ this.unput(this.match.slice(n));
972
+ }, "less"),
973
+ pastInput: /* @__PURE__ */ __name(function() {
974
+ var past = this.matched.substr(0, this.matched.length - this.match.length);
975
+ return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
976
+ }, "pastInput"),
977
+ upcomingInput: /* @__PURE__ */ __name(function() {
978
+ var next = this.match;
979
+ if (next.length < 20) next += this._input.substr(0, 20 - next.length);
980
+ return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
981
+ }, "upcomingInput"),
982
+ showPosition: /* @__PURE__ */ __name(function() {
983
+ var pre = this.pastInput();
984
+ var c = new Array(pre.length + 1).join("-");
985
+ return pre + this.upcomingInput() + "\n" + c + "^";
986
+ }, "showPosition"),
987
+ test_match: /* @__PURE__ */ __name(function(match, indexed_rule) {
988
+ var token, lines, backup;
989
+ if (this.options.backtrack_lexer) {
990
+ backup = {
991
+ yylineno: this.yylineno,
992
+ yylloc: {
993
+ first_line: this.yylloc.first_line,
994
+ last_line: this.last_line,
995
+ first_column: this.yylloc.first_column,
996
+ last_column: this.yylloc.last_column
997
+ },
998
+ yytext: this.yytext,
999
+ match: this.match,
1000
+ matches: this.matches,
1001
+ matched: this.matched,
1002
+ yyleng: this.yyleng,
1003
+ offset: this.offset,
1004
+ _more: this._more,
1005
+ _input: this._input,
1006
+ yy: this.yy,
1007
+ conditionStack: this.conditionStack.slice(0),
1008
+ done: this.done
1009
+ };
1010
+ if (this.options.ranges) backup.yylloc.range = this.yylloc.range.slice(0);
1011
+ }
1012
+ lines = match[0].match(/(?:\r\n?|\n).*/g);
1013
+ if (lines) this.yylineno += lines.length;
1014
+ this.yylloc = {
1015
+ first_line: this.yylloc.last_line,
1016
+ last_line: this.yylineno + 1,
1017
+ first_column: this.yylloc.last_column,
1018
+ last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length
1019
+ };
1020
+ this.yytext += match[0];
1021
+ this.match += match[0];
1022
+ this.matches = match;
1023
+ this.yyleng = this.yytext.length;
1024
+ if (this.options.ranges) this.yylloc.range = [this.offset, this.offset += this.yyleng];
1025
+ this._more = false;
1026
+ this._backtrack = false;
1027
+ this._input = this._input.slice(match[0].length);
1028
+ this.matched += match[0];
1029
+ token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
1030
+ if (this.done && this._input) this.done = false;
1031
+ if (token) return token;
1032
+ else if (this._backtrack) {
1033
+ for (var k in backup) this[k] = backup[k];
1034
+ return false;
1035
+ }
1036
+ return false;
1037
+ }, "test_match"),
1038
+ next: /* @__PURE__ */ __name(function() {
1039
+ if (this.done) return this.EOF;
1040
+ if (!this._input) this.done = true;
1041
+ var token, match, tempMatch, index;
1042
+ if (!this._more) {
1043
+ this.yytext = "";
1044
+ this.match = "";
1045
+ }
1046
+ var rules = this._currentRules();
1047
+ for (var i = 0; i < rules.length; i++) {
1048
+ tempMatch = this._input.match(this.rules[rules[i]]);
1049
+ if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
1050
+ match = tempMatch;
1051
+ index = i;
1052
+ if (this.options.backtrack_lexer) {
1053
+ token = this.test_match(tempMatch, rules[i]);
1054
+ if (token !== false) return token;
1055
+ else if (this._backtrack) {
1056
+ match = false;
1057
+ continue;
1058
+ } else return false;
1059
+ } else if (!this.options.flex) break;
1060
+ }
1061
+ }
1062
+ if (match) {
1063
+ token = this.test_match(match, rules[index]);
1064
+ if (token !== false) return token;
1065
+ return false;
1066
+ }
1067
+ if (this._input === "") return this.EOF;
1068
+ else return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
1069
+ text: "",
1070
+ token: null,
1071
+ line: this.yylineno
1072
+ });
1073
+ }, "next"),
1074
+ lex: /* @__PURE__ */ __name(function lex() {
1075
+ var r = this.next();
1076
+ if (r) return r;
1077
+ else return this.lex();
1078
+ }, "lex"),
1079
+ begin: /* @__PURE__ */ __name(function begin(condition) {
1080
+ this.conditionStack.push(condition);
1081
+ }, "begin"),
1082
+ popState: /* @__PURE__ */ __name(function popState() {
1083
+ if (this.conditionStack.length - 1 > 0) return this.conditionStack.pop();
1084
+ else return this.conditionStack[0];
1085
+ }, "popState"),
1086
+ _currentRules: /* @__PURE__ */ __name(function _currentRules() {
1087
+ if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
1088
+ else return this.conditions["INITIAL"].rules;
1089
+ }, "_currentRules"),
1090
+ topState: /* @__PURE__ */ __name(function topState(n) {
1091
+ n = this.conditionStack.length - 1 - Math.abs(n || 0);
1092
+ if (n >= 0) return this.conditionStack[n];
1093
+ else return "INITIAL";
1094
+ }, "topState"),
1095
+ pushState: /* @__PURE__ */ __name(function pushState(condition) {
1096
+ this.begin(condition);
1097
+ }, "pushState"),
1098
+ stateStackSize: /* @__PURE__ */ __name(function stateStackSize() {
1099
+ return this.conditionStack.length;
1100
+ }, "stateStackSize"),
1101
+ options: { "case-insensitive": true },
1102
+ performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
1103
+ function processId() {
1104
+ const idx = yy_.yytext.indexOf("%%");
1105
+ if (idx === 0) return false;
1106
+ if (idx > 0) {
1107
+ const before = yy_.yytext.slice(0, idx);
1108
+ const after = yy_.yytext.slice(idx);
1109
+ if (after) yy.lexer.unput(after);
1110
+ yy_.yytext = before;
1111
+ }
1112
+ return true;
1113
+ }
1114
+ __name(processId, "processId");
1115
+ switch ($avoiding_name_collisions) {
1116
+ case 0: return 38;
1117
+ case 1: return 40;
1118
+ case 2: return 39;
1119
+ case 3: return 44;
1120
+ case 4: return 51;
1121
+ case 5: return 52;
1122
+ case 6: return 53;
1123
+ case 7: return 54;
1124
+ case 8: return 5;
1125
+ case 9: break;
1126
+ case 10: break;
1127
+ case 11: break;
1128
+ case 12: break;
1129
+ case 13:
1130
+ this.pushState("SCALE");
1131
+ return 17;
1132
+ case 14: return 18;
1133
+ case 15:
1134
+ this.popState();
1135
+ break;
1136
+ case 16:
1137
+ this.begin("acc_title");
1138
+ return 33;
1139
+ case 17:
1140
+ this.popState();
1141
+ return "acc_title_value";
1142
+ case 18:
1143
+ this.begin("acc_descr");
1144
+ return 35;
1145
+ case 19:
1146
+ this.popState();
1147
+ return "acc_descr_value";
1148
+ case 20:
1149
+ this.begin("acc_descr_multiline");
1150
+ break;
1151
+ case 21:
1152
+ this.popState();
1153
+ break;
1154
+ case 22: return "acc_descr_multiline_value";
1155
+ case 23:
1156
+ this.pushState("CLASSDEF");
1157
+ return 41;
1158
+ case 24:
1159
+ this.popState();
1160
+ this.pushState("CLASSDEFID");
1161
+ return "DEFAULT_CLASSDEF_ID";
1162
+ case 25:
1163
+ this.popState();
1164
+ this.pushState("CLASSDEFID");
1165
+ return 42;
1166
+ case 26:
1167
+ this.popState();
1168
+ return 43;
1169
+ case 27:
1170
+ this.pushState("CLASS");
1171
+ return 48;
1172
+ case 28:
1173
+ this.popState();
1174
+ this.pushState("CLASS_STYLE");
1175
+ return 49;
1176
+ case 29:
1177
+ this.popState();
1178
+ return 50;
1179
+ case 30:
1180
+ this.pushState("STYLE");
1181
+ return 45;
1182
+ case 31:
1183
+ this.popState();
1184
+ this.pushState("STYLEDEF_STYLES");
1185
+ return 46;
1186
+ case 32:
1187
+ this.popState();
1188
+ return 47;
1189
+ case 33:
1190
+ this.pushState("SCALE");
1191
+ return 17;
1192
+ case 34: return 18;
1193
+ case 35:
1194
+ this.popState();
1195
+ break;
1196
+ case 36:
1197
+ this.pushState("STATE");
1198
+ break;
1199
+ case 37:
1200
+ this.popState();
1201
+ yy_.yytext = yy_.yytext.slice(0, -8).trim();
1202
+ return 25;
1203
+ case 38:
1204
+ this.popState();
1205
+ yy_.yytext = yy_.yytext.slice(0, -8).trim();
1206
+ return 26;
1207
+ case 39:
1208
+ this.popState();
1209
+ yy_.yytext = yy_.yytext.slice(0, -10).trim();
1210
+ return 27;
1211
+ case 40:
1212
+ this.popState();
1213
+ yy_.yytext = yy_.yytext.slice(0, -8).trim();
1214
+ return 25;
1215
+ case 41:
1216
+ this.popState();
1217
+ yy_.yytext = yy_.yytext.slice(0, -8).trim();
1218
+ return 26;
1219
+ case 42:
1220
+ this.popState();
1221
+ yy_.yytext = yy_.yytext.slice(0, -10).trim();
1222
+ return 27;
1223
+ case 43: return 51;
1224
+ case 44: return 52;
1225
+ case 45: return 53;
1226
+ case 46: return 54;
1227
+ case 47:
1228
+ this.pushState("STATE_STRING");
1229
+ break;
1230
+ case 48:
1231
+ this.pushState("STATE_ID");
1232
+ return "AS";
1233
+ case 49:
1234
+ if (!processId()) return;
1235
+ this.popState();
1236
+ return "ID";
1237
+ case 50:
1238
+ this.popState();
1239
+ break;
1240
+ case 51: return "STATE_DESCR";
1241
+ case 52: throw new Error("Error: State name must be a single word. Found: \"" + yy_.yytext.trim() + "\"");
1242
+ case 53: return 19;
1243
+ case 54:
1244
+ this.popState();
1245
+ break;
1246
+ case 55:
1247
+ this.popState();
1248
+ this.pushState("struct");
1249
+ return 20;
1250
+ case 56:
1251
+ this.popState();
1252
+ return 21;
1253
+ case 57: break;
1254
+ case 58:
1255
+ this.begin("NOTE");
1256
+ return 29;
1257
+ case 59:
1258
+ this.popState();
1259
+ this.pushState("NOTE_ID");
1260
+ return 59;
1261
+ case 60:
1262
+ this.popState();
1263
+ this.pushState("NOTE_ID");
1264
+ return 60;
1265
+ case 61:
1266
+ this.popState();
1267
+ this.pushState("FLOATING_NOTE");
1268
+ break;
1269
+ case 62:
1270
+ this.popState();
1271
+ this.pushState("FLOATING_NOTE_ID");
1272
+ return "AS";
1273
+ case 63: break;
1274
+ case 64: return "NOTE_TEXT";
1275
+ case 65:
1276
+ if (!processId()) return;
1277
+ this.popState();
1278
+ return "ID";
1279
+ case 66:
1280
+ if (!processId()) return;
1281
+ this.popState();
1282
+ this.pushState("NOTE_TEXT");
1283
+ return 24;
1284
+ case 67:
1285
+ this.popState();
1286
+ yy_.yytext = yy_.yytext.substr(2).trim();
1287
+ return 31;
1288
+ case 68:
1289
+ this.popState();
1290
+ yy_.yytext = yy_.yytext.slice(0, -8).trim();
1291
+ return 31;
1292
+ case 69: return 6;
1293
+ case 70: return 6;
1294
+ case 71: return 16;
1295
+ case 72: return 57;
1296
+ case 73:
1297
+ if (!processId()) return;
1298
+ return 24;
1299
+ case 74:
1300
+ yy_.yytext = yy_.yytext.trim();
1301
+ return 14;
1302
+ case 75: return 15;
1303
+ case 76: return 28;
1304
+ case 77: return 58;
1305
+ case 78: return 5;
1306
+ case 79: return "INVALID";
1307
+ }
1308
+ }, "anonymous"),
1309
+ rules: [
1310
+ /^(?:click\b)/i,
1311
+ /^(?:href\b)/i,
1312
+ /^(?:"[^"]*")/i,
1313
+ /^(?:default\b)/i,
1314
+ /^(?:.*direction\s+TB[^\n]*)/i,
1315
+ /^(?:.*direction\s+BT[^\n]*)/i,
1316
+ /^(?:.*direction\s+RL[^\n]*)/i,
1317
+ /^(?:.*direction\s+LR[^\n]*)/i,
1318
+ /^(?:[\n]+)/i,
1319
+ /^(?:[\s]+)/i,
1320
+ /^(?:((?!\n)\s)+)/i,
1321
+ /^(?:#[^\n]*)/i,
1322
+ /^(?:%%(?!\{)[^\n]*)/i,
1323
+ /^(?:scale\s+)/i,
1324
+ /^(?:\d+)/i,
1325
+ /^(?:\s+width\b)/i,
1326
+ /^(?:accTitle\s*:\s*)/i,
1327
+ /^(?:(?!\n||)*[^\n]*)/i,
1328
+ /^(?:accDescr\s*:\s*)/i,
1329
+ /^(?:(?!\n||)*[^\n]*)/i,
1330
+ /^(?:accDescr\s*\{\s*)/i,
1331
+ /^(?:[\}])/i,
1332
+ /^(?:[^\}]*)/i,
1333
+ /^(?:classDef\s+)/i,
1334
+ /^(?:DEFAULT\s+)/i,
1335
+ /^(?:\w+\s+)/i,
1336
+ /^(?:[^\n]*)/i,
1337
+ /^(?:class\s+)/i,
1338
+ /^(?:(\w+)+((,\s*\w+)*))/i,
1339
+ /^(?:[^\n]*)/i,
1340
+ /^(?:style\s+)/i,
1341
+ /^(?:[\w,]+\s+)/i,
1342
+ /^(?:[^\n]*)/i,
1343
+ /^(?:scale\s+)/i,
1344
+ /^(?:\d+)/i,
1345
+ /^(?:\s+width\b)/i,
1346
+ /^(?:state\s+)/i,
1347
+ /^(?:.*<<fork>>)/i,
1348
+ /^(?:.*<<join>>)/i,
1349
+ /^(?:.*<<choice>>)/i,
1350
+ /^(?:.*\[\[fork\]\])/i,
1351
+ /^(?:.*\[\[join\]\])/i,
1352
+ /^(?:.*\[\[choice\]\])/i,
1353
+ /^(?:.*direction\s+TB[^\n]*)/i,
1354
+ /^(?:.*direction\s+BT[^\n]*)/i,
1355
+ /^(?:.*direction\s+RL[^\n]*)/i,
1356
+ /^(?:.*direction\s+LR[^\n]*)/i,
1357
+ /^(?:["])/i,
1358
+ /^(?:\s*as\s+)/i,
1359
+ /^(?:[^\n\{]*)/i,
1360
+ /^(?:["])/i,
1361
+ /^(?:[^"]*)/i,
1362
+ /^(?:\w+\s+\w+.*?\{)/i,
1363
+ /^(?:[^\n\s\{]+)/i,
1364
+ /^(?:\n)/i,
1365
+ /^(?:\{)/i,
1366
+ /^(?:\})/i,
1367
+ /^(?:[\n])/i,
1368
+ /^(?:note\s+)/i,
1369
+ /^(?:left of\b)/i,
1370
+ /^(?:right of\b)/i,
1371
+ /^(?:")/i,
1372
+ /^(?:\s*as\s*)/i,
1373
+ /^(?:["])/i,
1374
+ /^(?:[^"]*)/i,
1375
+ /^(?:[^\n]*)/i,
1376
+ /^(?:\s*[^:\n\s\-]+)/i,
1377
+ /^(?:\s*:[^:\n;]+)/i,
1378
+ /^(?:[\s\S]*?\n\s*end note\b)/i,
1379
+ /^(?:stateDiagram\s+)/i,
1380
+ /^(?:stateDiagram-v2\s+)/i,
1381
+ /^(?:hide empty description\b)/i,
1382
+ /^(?:\[\*\])/i,
1383
+ /^(?:[^:\n\s\-\{]+)/i,
1384
+ /^(?:\s*:(?:[^:\n;]|:[^:\n;])+)/i,
1385
+ /^(?:-->)/i,
1386
+ /^(?:--)/i,
1387
+ /^(?::::)/i,
1388
+ /^(?:$)/i,
1389
+ /^(?:.)/i
1390
+ ],
1391
+ conditions: {
1392
+ "LINE": {
1393
+ "rules": [
1394
+ 10,
1395
+ 11,
1396
+ 12
1397
+ ],
1398
+ "inclusive": false
1399
+ },
1400
+ "struct": {
1401
+ "rules": [
1402
+ 10,
1403
+ 11,
1404
+ 12,
1405
+ 23,
1406
+ 27,
1407
+ 30,
1408
+ 36,
1409
+ 43,
1410
+ 44,
1411
+ 45,
1412
+ 46,
1413
+ 56,
1414
+ 57,
1415
+ 58,
1416
+ 72,
1417
+ 73,
1418
+ 74,
1419
+ 75,
1420
+ 76,
1421
+ 77
1422
+ ],
1423
+ "inclusive": false
1424
+ },
1425
+ "FLOATING_NOTE_ID": {
1426
+ "rules": [65],
1427
+ "inclusive": false
1428
+ },
1429
+ "FLOATING_NOTE": {
1430
+ "rules": [
1431
+ 62,
1432
+ 63,
1433
+ 64
1434
+ ],
1435
+ "inclusive": false
1436
+ },
1437
+ "NOTE_TEXT": {
1438
+ "rules": [67, 68],
1439
+ "inclusive": false
1440
+ },
1441
+ "NOTE_ID": {
1442
+ "rules": [66],
1443
+ "inclusive": false
1444
+ },
1445
+ "NOTE": {
1446
+ "rules": [
1447
+ 59,
1448
+ 60,
1449
+ 61
1450
+ ],
1451
+ "inclusive": false
1452
+ },
1453
+ "STYLEDEF_STYLEOPTS": {
1454
+ "rules": [],
1455
+ "inclusive": false
1456
+ },
1457
+ "STYLEDEF_STYLES": {
1458
+ "rules": [32],
1459
+ "inclusive": false
1460
+ },
1461
+ "STYLE_IDS": {
1462
+ "rules": [],
1463
+ "inclusive": false
1464
+ },
1465
+ "STYLE": {
1466
+ "rules": [31],
1467
+ "inclusive": false
1468
+ },
1469
+ "CLASS_STYLE": {
1470
+ "rules": [29],
1471
+ "inclusive": false
1472
+ },
1473
+ "CLASS": {
1474
+ "rules": [28],
1475
+ "inclusive": false
1476
+ },
1477
+ "CLASSDEFID": {
1478
+ "rules": [26],
1479
+ "inclusive": false
1480
+ },
1481
+ "CLASSDEF": {
1482
+ "rules": [24, 25],
1483
+ "inclusive": false
1484
+ },
1485
+ "acc_descr_multiline": {
1486
+ "rules": [21, 22],
1487
+ "inclusive": false
1488
+ },
1489
+ "acc_descr": {
1490
+ "rules": [19],
1491
+ "inclusive": false
1492
+ },
1493
+ "acc_title": {
1494
+ "rules": [17],
1495
+ "inclusive": false
1496
+ },
1497
+ "SCALE": {
1498
+ "rules": [
1499
+ 14,
1500
+ 15,
1501
+ 34,
1502
+ 35
1503
+ ],
1504
+ "inclusive": false
1505
+ },
1506
+ "ALIAS": {
1507
+ "rules": [],
1508
+ "inclusive": false
1509
+ },
1510
+ "STATE_ID": {
1511
+ "rules": [49],
1512
+ "inclusive": false
1513
+ },
1514
+ "STATE_STRING": {
1515
+ "rules": [50, 51],
1516
+ "inclusive": false
1517
+ },
1518
+ "FORK_STATE": {
1519
+ "rules": [],
1520
+ "inclusive": false
1521
+ },
1522
+ "STATE": {
1523
+ "rules": [
1524
+ 10,
1525
+ 11,
1526
+ 12,
1527
+ 37,
1528
+ 38,
1529
+ 39,
1530
+ 40,
1531
+ 41,
1532
+ 42,
1533
+ 47,
1534
+ 48,
1535
+ 52,
1536
+ 53,
1537
+ 54,
1538
+ 55
1539
+ ],
1540
+ "inclusive": false
1541
+ },
1542
+ "ID": {
1543
+ "rules": [
1544
+ 10,
1545
+ 11,
1546
+ 12
1547
+ ],
1548
+ "inclusive": false
1549
+ },
1550
+ "INITIAL": {
1551
+ "rules": [
1552
+ 0,
1553
+ 1,
1554
+ 2,
1555
+ 3,
1556
+ 4,
1557
+ 5,
1558
+ 6,
1559
+ 7,
1560
+ 8,
1561
+ 9,
1562
+ 11,
1563
+ 12,
1564
+ 13,
1565
+ 16,
1566
+ 18,
1567
+ 20,
1568
+ 23,
1569
+ 27,
1570
+ 30,
1571
+ 33,
1572
+ 36,
1573
+ 55,
1574
+ 58,
1575
+ 69,
1576
+ 70,
1577
+ 71,
1578
+ 72,
1579
+ 73,
1580
+ 74,
1581
+ 75,
1582
+ 77,
1583
+ 78,
1584
+ 79
1585
+ ],
1586
+ "inclusive": true
1587
+ }
1588
+ }
1589
+ };
1590
+ })();
1591
+ function Parser() {
1592
+ this.yy = {};
1593
+ }
1594
+ __name(Parser, "Parser");
1595
+ Parser.prototype = parser2;
1596
+ parser2.Parser = Parser;
1597
+ return new Parser();
1598
+ })();
1599
+ parser.parser = parser;
1600
+ var stateDiagram_default = parser;
1601
+ var DEFAULT_DIAGRAM_DIRECTION = "TB";
1602
+ var DEFAULT_NESTED_DOC_DIR = "TB";
1603
+ var STMT_DIRECTION = "dir";
1604
+ var STMT_STATE = "state";
1605
+ var STMT_ROOT = "root";
1606
+ var STMT_RELATION = "relation";
1607
+ var STMT_CLASSDEF = "classDef";
1608
+ var STMT_STYLEDEF = "style";
1609
+ var STMT_APPLYCLASS = "applyClass";
1610
+ var DEFAULT_STATE_TYPE = "default";
1611
+ var DIVIDER_TYPE = "divider";
1612
+ var G_EDGE_STYLE = "fill:none";
1613
+ var G_EDGE_ARROWHEADSTYLE = "fill: #333";
1614
+ var G_EDGE_LABELPOS = "c";
1615
+ var G_EDGE_LABELTYPE = "markdown";
1616
+ var G_EDGE_THICKNESS = "normal";
1617
+ var SHAPE_STATE = "rect";
1618
+ var SHAPE_STATE_WITH_DESC = "rectWithTitle";
1619
+ var SHAPE_START = "stateStart";
1620
+ var SHAPE_END = "stateEnd";
1621
+ var SHAPE_DIVIDER = "divider";
1622
+ var SHAPE_GROUP = "roundedWithTitle";
1623
+ var SHAPE_NOTE = "note";
1624
+ var SHAPE_NOTEGROUP = "noteGroup";
1625
+ var CSS_DIAGRAM = "statediagram";
1626
+ var CSS_DIAGRAM_STATE = `${CSS_DIAGRAM}-state`;
1627
+ var CSS_EDGE = "transition";
1628
+ var CSS_NOTE = "note";
1629
+ var CSS_EDGE_NOTE_EDGE = `${CSS_EDGE} note-edge`;
1630
+ var CSS_DIAGRAM_NOTE = `${CSS_DIAGRAM}-${CSS_NOTE}`;
1631
+ var CSS_DIAGRAM_CLUSTER = `${CSS_DIAGRAM}-cluster`;
1632
+ var CSS_DIAGRAM_CLUSTER_ALT = `${CSS_DIAGRAM}-cluster-alt`;
1633
+ var PARENT = "parent";
1634
+ var NOTE = "note";
1635
+ var DOMID_STATE = "state";
1636
+ var DOMID_TYPE_SPACER = "----";
1637
+ var NOTE_ID = `${DOMID_TYPE_SPACER}${NOTE}`;
1638
+ var PARENT_ID = `${DOMID_TYPE_SPACER}${PARENT}`;
1639
+ var nodeDb = /* @__PURE__ */ new Map();
1640
+ var graphItemCount = 0;
1641
+ var nextColorIndex = 0;
1642
+ var containerColorIndex = /* @__PURE__ */ new Map();
1643
+ var colorSlotFor = /* @__PURE__ */ __name((shape, itemId, parent, userStyled) => {
1644
+ if (shape === SHAPE_DIVIDER && parent?.id !== void 0 && containerColorIndex.has(parent.id)) {
1645
+ const inherited = containerColorIndex.get(parent.id);
1646
+ containerColorIndex.set(itemId, inherited);
1647
+ return inherited;
1648
+ }
1649
+ const slot = nextColorIndex++;
1650
+ const effective = userStyled ? void 0 : slot;
1651
+ containerColorIndex.set(itemId, effective);
1652
+ return effective;
1653
+ }, "colorSlotFor");
1654
+ function stateDomId(itemId = "", counter = 0, type = "", typeSpacer = DOMID_TYPE_SPACER) {
1655
+ return `${DOMID_STATE}-${itemId}${type !== null && type.length > 0 ? `${typeSpacer}${type}` : ""}-${counter}`;
1656
+ }
1657
+ __name(stateDomId, "stateDomId");
1658
+ var setupDoc = /* @__PURE__ */ __name((parentParsedItem, doc, diagramStates, nodes, edges, altFlag, look, classes) => {
1659
+ log.trace("items", doc);
1660
+ doc.forEach((item) => {
1661
+ switch (item.stmt) {
1662
+ case STMT_STATE:
1663
+ dataFetcher(parentParsedItem, item, diagramStates, nodes, edges, altFlag, look, classes);
1664
+ break;
1665
+ case DEFAULT_STATE_TYPE:
1666
+ dataFetcher(parentParsedItem, item, diagramStates, nodes, edges, altFlag, look, classes);
1667
+ break;
1668
+ case STMT_RELATION:
1669
+ {
1670
+ dataFetcher(parentParsedItem, item.state1, diagramStates, nodes, edges, altFlag, look, classes);
1671
+ dataFetcher(parentParsedItem, item.state2, diagramStates, nodes, edges, altFlag, look, classes);
1672
+ const isNeo = look === "neo";
1673
+ const edgeData = {
1674
+ id: "edge" + graphItemCount,
1675
+ start: item.state1.id,
1676
+ end: item.state2.id,
1677
+ arrowhead: "normal",
1678
+ arrowTypeEnd: isNeo ? "arrow_barb_neo" : "arrow_barb",
1679
+ style: G_EDGE_STYLE,
1680
+ labelStyle: "",
1681
+ label: common_default.sanitizeText(item.description ?? "", getConfig2()),
1682
+ arrowheadStyle: G_EDGE_ARROWHEADSTYLE,
1683
+ labelpos: G_EDGE_LABELPOS,
1684
+ labelType: G_EDGE_LABELTYPE,
1685
+ thickness: G_EDGE_THICKNESS,
1686
+ classes: CSS_EDGE,
1687
+ look
1688
+ };
1689
+ edges.push(edgeData);
1690
+ graphItemCount++;
1691
+ }
1692
+ break;
1693
+ }
1694
+ });
1695
+ }, "setupDoc");
1696
+ var getDir = /* @__PURE__ */ __name((parsedItem, defaultDir = DEFAULT_NESTED_DOC_DIR) => {
1697
+ let dir = defaultDir;
1698
+ if (parsedItem.doc) {
1699
+ for (const parsedItemDoc of parsedItem.doc) if (parsedItemDoc.stmt === "dir") dir = parsedItemDoc.value;
1700
+ }
1701
+ return dir;
1702
+ }, "getDir");
1703
+ function insertOrUpdateNode(nodes, nodeData, classes) {
1704
+ if (!nodeData.id || nodeData.id === "</join></fork>" || nodeData.id === "</choice>") return;
1705
+ if (nodeData.cssClasses) {
1706
+ if (!Array.isArray(nodeData.cssCompiledStyles)) nodeData.cssCompiledStyles = [];
1707
+ nodeData.cssClasses.split(" ").forEach((cssClass) => {
1708
+ const classDef = classes.get(cssClass);
1709
+ if (classDef) nodeData.cssCompiledStyles = [...nodeData.cssCompiledStyles ?? [], ...classDef.styles];
1710
+ });
1711
+ }
1712
+ const existingNodeData = nodes.find((node) => node.id === nodeData.id);
1713
+ if (existingNodeData) Object.assign(existingNodeData, nodeData);
1714
+ else nodes.push(nodeData);
1715
+ }
1716
+ __name(insertOrUpdateNode, "insertOrUpdateNode");
1717
+ function getClassesFromDbInfo(dbInfoItem) {
1718
+ return dbInfoItem?.classes?.join(" ") ?? "";
1719
+ }
1720
+ __name(getClassesFromDbInfo, "getClassesFromDbInfo");
1721
+ function getStylesFromDbInfo(dbInfoItem) {
1722
+ return dbInfoItem?.styles ?? [];
1723
+ }
1724
+ __name(getStylesFromDbInfo, "getStylesFromDbInfo");
1725
+ var dataFetcher = /* @__PURE__ */ __name((parent, parsedItem, diagramStates, nodes, edges, altFlag, look, classes) => {
1726
+ const itemId = parsedItem.id;
1727
+ const dbState = diagramStates.get(itemId);
1728
+ const classStr = getClassesFromDbInfo(dbState);
1729
+ const style = getStylesFromDbInfo(dbState);
1730
+ const config = getConfig2();
1731
+ const userStyled = classStr.trim() !== "" || style.length > 0;
1732
+ log.info("dataFetcher parsedItem", parsedItem, dbState, style);
1733
+ if (itemId !== "root") {
1734
+ let shape = SHAPE_STATE;
1735
+ if (parsedItem.start === true) shape = SHAPE_START;
1736
+ else if (parsedItem.start === false) shape = SHAPE_END;
1737
+ if (parsedItem.type !== DEFAULT_STATE_TYPE) shape = parsedItem.type;
1738
+ if (!nodeDb.get(itemId)) nodeDb.set(itemId, {
1739
+ id: itemId,
1740
+ shape,
1741
+ description: common_default.sanitizeText(itemId, config),
1742
+ cssClasses: `${classStr} ${CSS_DIAGRAM_STATE}`,
1743
+ cssStyles: style
1744
+ });
1745
+ const newNode = nodeDb.get(itemId);
1746
+ if (parsedItem.description) {
1747
+ if (Array.isArray(newNode.description)) {
1748
+ newNode.shape = SHAPE_STATE_WITH_DESC;
1749
+ newNode.description.push(parsedItem.description);
1750
+ } else if (newNode.description?.length && newNode.description.length > 0) {
1751
+ newNode.shape = SHAPE_STATE_WITH_DESC;
1752
+ if (newNode.description === itemId) newNode.description = [parsedItem.description];
1753
+ else newNode.description = [newNode.description, parsedItem.description];
1754
+ } else {
1755
+ newNode.shape = SHAPE_STATE;
1756
+ newNode.description = parsedItem.description;
1757
+ }
1758
+ newNode.description = common_default.sanitizeTextOrArray(newNode.description, config);
1759
+ }
1760
+ if (newNode.description?.length === 1 && newNode.shape === SHAPE_STATE_WITH_DESC) if (newNode.type === "group") newNode.shape = SHAPE_GROUP;
1761
+ else newNode.shape = SHAPE_STATE;
1762
+ if (!newNode.type && parsedItem.doc) {
1763
+ log.info("Setting cluster for XCX", itemId, getDir(parsedItem));
1764
+ newNode.type = "group";
1765
+ newNode.isGroup = true;
1766
+ newNode.dir = getDir(parsedItem);
1767
+ newNode.shape = parsedItem.type === DIVIDER_TYPE ? SHAPE_DIVIDER : SHAPE_GROUP;
1768
+ newNode.colorIndex = colorSlotFor(newNode.shape, itemId, parent, userStyled);
1769
+ newNode.cssClasses = `${newNode.cssClasses} ${CSS_DIAGRAM_CLUSTER} ${altFlag ? CSS_DIAGRAM_CLUSTER_ALT : ""}`;
1770
+ }
1771
+ const nodeData = {
1772
+ labelStyle: "",
1773
+ shape: newNode.shape,
1774
+ label: newNode.description,
1775
+ cssClasses: newNode.cssClasses,
1776
+ cssCompiledStyles: [],
1777
+ cssStyles: newNode.cssStyles,
1778
+ id: itemId,
1779
+ dir: newNode.dir,
1780
+ domId: stateDomId(itemId, graphItemCount),
1781
+ type: newNode.type,
1782
+ isGroup: newNode.type === "group",
1783
+ colorIndex: newNode.colorIndex,
1784
+ padding: 8,
1785
+ rx: 10,
1786
+ ry: 10,
1787
+ look,
1788
+ labelType: "markdown"
1789
+ };
1790
+ if (nodeData.shape === SHAPE_DIVIDER) nodeData.label = "";
1791
+ if (parent && parent.id !== "root") {
1792
+ log.trace("Setting node ", itemId, " to be child of its parent ", parent.id);
1793
+ nodeData.parentId = parent.id;
1794
+ }
1795
+ nodeData.centerLabel = true;
1796
+ if (parsedItem.note) {
1797
+ const noteData = {
1798
+ labelStyle: "",
1799
+ shape: SHAPE_NOTE,
1800
+ label: parsedItem.note.text,
1801
+ labelType: "markdown",
1802
+ cssClasses: CSS_DIAGRAM_NOTE,
1803
+ cssStyles: [],
1804
+ cssCompiledStyles: [],
1805
+ id: itemId + NOTE_ID + "-" + graphItemCount,
1806
+ domId: stateDomId(itemId, graphItemCount, NOTE),
1807
+ type: "node",
1808
+ isGroup: false,
1809
+ padding: config.flowchart?.padding,
1810
+ look,
1811
+ position: parsedItem.note.position
1812
+ };
1813
+ const parentNodeId = itemId + PARENT_ID;
1814
+ const groupData = {
1815
+ labelStyle: "",
1816
+ shape: SHAPE_NOTEGROUP,
1817
+ label: parsedItem.note.text,
1818
+ cssClasses: newNode.cssClasses,
1819
+ cssStyles: [],
1820
+ id: itemId + PARENT_ID,
1821
+ domId: stateDomId(itemId, graphItemCount, PARENT),
1822
+ type: "group",
1823
+ isGroup: true,
1824
+ padding: 16,
1825
+ look,
1826
+ position: parsedItem.note.position
1827
+ };
1828
+ graphItemCount++;
1829
+ groupData.id = parentNodeId;
1830
+ noteData.parentId = parentNodeId;
1831
+ insertOrUpdateNode(nodes, groupData, classes);
1832
+ insertOrUpdateNode(nodes, noteData, classes);
1833
+ insertOrUpdateNode(nodes, nodeData, classes);
1834
+ let from = itemId;
1835
+ let to = noteData.id;
1836
+ if (parsedItem.note.position === "left of") {
1837
+ from = noteData.id;
1838
+ to = itemId;
1839
+ }
1840
+ edges.push({
1841
+ id: from + "-" + to,
1842
+ start: from,
1843
+ end: to,
1844
+ arrowhead: "none",
1845
+ arrowTypeEnd: "",
1846
+ style: G_EDGE_STYLE,
1847
+ labelStyle: "",
1848
+ classes: CSS_EDGE_NOTE_EDGE,
1849
+ pattern: "dashed",
1850
+ arrowheadStyle: G_EDGE_ARROWHEADSTYLE,
1851
+ labelpos: G_EDGE_LABELPOS,
1852
+ labelType: G_EDGE_LABELTYPE,
1853
+ thickness: G_EDGE_THICKNESS,
1854
+ look
1855
+ });
1856
+ } else insertOrUpdateNode(nodes, nodeData, classes);
1857
+ }
1858
+ if (parsedItem.doc) {
1859
+ log.trace("Adding nodes children ");
1860
+ setupDoc(parsedItem, parsedItem.doc, diagramStates, nodes, edges, !altFlag, look, classes);
1861
+ }
1862
+ }, "dataFetcher");
1863
+ var reset = /* @__PURE__ */ __name(() => {
1864
+ nodeDb.clear();
1865
+ graphItemCount = 0;
1866
+ nextColorIndex = 0;
1867
+ containerColorIndex.clear();
1868
+ }, "reset");
1869
+ var getDir2 = /* @__PURE__ */ __name((parsedItem, defaultDir = DEFAULT_NESTED_DOC_DIR) => {
1870
+ if (!parsedItem.doc) return defaultDir;
1871
+ let dir = defaultDir;
1872
+ for (const parsedItemDoc of parsedItem.doc) if (parsedItemDoc.stmt === "dir") dir = parsedItemDoc.value;
1873
+ return dir;
1874
+ }, "getDir");
1875
+ var stateRenderer_v3_unified_default = {
1876
+ getClasses: /* @__PURE__ */ __name(function(text, diagramObj) {
1877
+ return diagramObj.db.getClasses();
1878
+ }, "getClasses"),
1879
+ draw: /* @__PURE__ */ __name(async function(text, id, _version, diag) {
1880
+ log.info("REF0:");
1881
+ log.info("Drawing state diagram (v2)", id);
1882
+ const { securityLevel, state: conf, layout } = getConfig2();
1883
+ diag.db.extract(diag.db.getRootDocV2());
1884
+ const data4Layout = diag.db.getData();
1885
+ const svg = getDiagramElement(id, securityLevel);
1886
+ data4Layout.type = diag.type;
1887
+ data4Layout.layoutAlgorithm = getRegisteredLayoutAlgorithm(layout);
1888
+ data4Layout.nodeSpacing = conf?.nodeSpacing || 50;
1889
+ data4Layout.rankSpacing = conf?.rankSpacing || 50;
1890
+ if (getConfig2().look === "neo") data4Layout.markers = ["barbNeo"];
1891
+ else data4Layout.markers = ["barb"];
1892
+ data4Layout.diagramId = id;
1893
+ await render(data4Layout, svg);
1894
+ const padding = 8;
1895
+ try {
1896
+ (typeof diag.db.getLinks === "function" ? diag.db.getLinks() : /* @__PURE__ */ new Map()).forEach((linkInfo, key) => {
1897
+ const stateId = typeof key === "string" ? key : typeof key?.id === "string" ? key.id : "";
1898
+ const stateNode = data4Layout.nodes.find((node) => node.id === stateId);
1899
+ if (!stateId) {
1900
+ log.warn("⚠️ Invalid or missing stateId from key:", JSON.stringify(key));
1901
+ return;
1902
+ }
1903
+ const allNodes = svg.node()?.querySelectorAll("g.node, g.rough-node");
1904
+ let matchedElem;
1905
+ allNodes?.forEach((g) => {
1906
+ const text2 = g.textContent?.trim();
1907
+ if (g.id === stateNode?.domId || text2 === stateId) matchedElem = g;
1908
+ });
1909
+ if (!matchedElem) {
1910
+ log.warn("⚠️ Could not find node matching text:", stateId);
1911
+ return;
1912
+ }
1913
+ const parent = matchedElem.parentNode;
1914
+ if (!parent) {
1915
+ log.warn("⚠️ Node has no parent, cannot wrap:", stateId);
1916
+ return;
1917
+ }
1918
+ const a = document.createElementNS("http://www.w3.org/2000/svg", "a");
1919
+ const cleanedUrl = linkInfo.url.replace(/^"+|"+$/g, "");
1920
+ a.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", cleanedUrl);
1921
+ a.setAttribute("target", "_blank");
1922
+ if (linkInfo.tooltip) {
1923
+ const tooltip = linkInfo.tooltip.replace(/^"+|"+$/g, "");
1924
+ a.setAttribute("title", tooltip);
1925
+ matchedElem.setAttribute("title", tooltip);
1926
+ }
1927
+ parent.replaceChild(a, matchedElem);
1928
+ a.appendChild(matchedElem);
1929
+ log.info("🔗 Wrapped node in <a> tag for:", stateId, linkInfo.url);
1930
+ });
1931
+ } catch (err) {
1932
+ log.error("❌ Error injecting clickable links:", err);
1933
+ }
1934
+ utils_default.insertTitle(svg, "statediagramTitleText", conf?.titleTopMargin ?? 25, diag.db.getDiagramTitle());
1935
+ setupViewPortForSVG(svg, padding, CSS_DIAGRAM, conf?.useMaxWidth ?? true);
1936
+ }, "draw"),
1937
+ getDir: getDir2
1938
+ };
1939
+ var CONSTANTS = {
1940
+ START_NODE: "[*]",
1941
+ START_TYPE: "start",
1942
+ END_NODE: "[*]",
1943
+ END_TYPE: "end",
1944
+ COLOR_KEYWORD: "color",
1945
+ FILL_KEYWORD: "fill",
1946
+ BG_FILL: "bgFill",
1947
+ STYLECLASS_SEP: ","
1948
+ };
1949
+ var newClassesList = /* @__PURE__ */ __name(() => /* @__PURE__ */ new Map(), "newClassesList");
1950
+ var newDoc = /* @__PURE__ */ __name(() => ({
1951
+ relations: [],
1952
+ states: /* @__PURE__ */ new Map(),
1953
+ documents: {}
1954
+ }), "newDoc");
1955
+ var clone = /* @__PURE__ */ __name((o) => JSON.parse(JSON.stringify(o)), "clone");
1956
+ var StateDB = class {
1957
+ constructor(version) {
1958
+ this.version = version;
1959
+ this.nodes = [];
1960
+ this.edges = [];
1961
+ this.rootDoc = [];
1962
+ this.classes = newClassesList();
1963
+ this.documents = { root: newDoc() };
1964
+ this.currentDocument = this.documents.root;
1965
+ this.startEndCount = 0;
1966
+ this.dividerCnt = 0;
1967
+ this.links = /* @__PURE__ */ new Map();
1968
+ this.funs = [];
1969
+ this.getAccTitle = getAccTitle;
1970
+ this.setAccTitle = setAccTitle;
1971
+ this.getAccDescription = getAccDescription;
1972
+ this.setAccDescription = setAccDescription;
1973
+ this.setDiagramTitle = setDiagramTitle;
1974
+ this.getDiagramTitle = getDiagramTitle;
1975
+ this.clear();
1976
+ this.setRootDoc = this.setRootDoc.bind(this);
1977
+ this.getDividerId = this.getDividerId.bind(this);
1978
+ this.setDirection = this.setDirection.bind(this);
1979
+ this.trimColon = this.trimColon.bind(this);
1980
+ this.bindFunctions = this.bindFunctions.bind(this);
1981
+ }
1982
+ static {
1983
+ __name(this, "StateDB");
1984
+ }
1985
+ static {
1986
+ this.relationType = {
1987
+ AGGREGATION: 0,
1988
+ EXTENSION: 1,
1989
+ COMPOSITION: 2,
1990
+ DEPENDENCY: 3
1991
+ };
1992
+ }
1993
+ /**
1994
+ * Convert all of the statements (stmts) that were parsed into states and relationships.
1995
+ * This is done because a state diagram may have nested sections,
1996
+ * where each section is a 'document' and has its own set of statements.
1997
+ * Ex: the section within a fork has its own statements, and incoming and outgoing statements
1998
+ * refer to the fork as a whole (document).
1999
+ * See the parser grammar: the definition of a document is a document then a 'line', where a line can be a statement.
2000
+ * This will push the statement into the list of statements for the current document.
2001
+ */
2002
+ extract(statements) {
2003
+ this.clear(true);
2004
+ for (const item of Array.isArray(statements) ? statements : statements.doc) switch (item.stmt) {
2005
+ case STMT_STATE:
2006
+ this.addState(item.id.trim(), item.type, item.doc, item.description, item.note);
2007
+ break;
2008
+ case STMT_RELATION:
2009
+ this.addRelation(item.state1, item.state2, item.description);
2010
+ break;
2011
+ case STMT_CLASSDEF:
2012
+ this.addStyleClass(item.id.trim(), item.classes);
2013
+ break;
2014
+ case STMT_STYLEDEF:
2015
+ this.handleStyleDef(item);
2016
+ break;
2017
+ case STMT_APPLYCLASS:
2018
+ this.setCssClass(item.id.trim(), item.styleClass);
2019
+ break;
2020
+ case "click":
2021
+ this.addLink(item.id, item.url, item.tooltip);
2022
+ break;
2023
+ }
2024
+ const diagramStates = this.getStates();
2025
+ const config = getConfig2();
2026
+ reset();
2027
+ dataFetcher(void 0, this.getRootDocV2(), diagramStates, this.nodes, this.edges, true, config.look, this.classes);
2028
+ for (const node of this.nodes) {
2029
+ if (!Array.isArray(node.label)) continue;
2030
+ node.description = node.label.slice(1);
2031
+ if (node.isGroup && node.description.length > 0) throw new Error(`Group nodes can only have label. Remove the additional description for node [${node.id}]`);
2032
+ node.label = node.label[0];
2033
+ }
2034
+ }
2035
+ handleStyleDef(item) {
2036
+ const ids = item.id.trim().split(",");
2037
+ const styles = item.styleClass.split(",");
2038
+ for (const id of ids) {
2039
+ let state = this.getState(id);
2040
+ if (!state) {
2041
+ const trimmedId = id.trim();
2042
+ this.addState(trimmedId);
2043
+ state = this.getState(trimmedId);
2044
+ }
2045
+ if (state) state.styles = styles.map((s) => s.replace(/;/g, "")?.trim());
2046
+ }
2047
+ }
2048
+ setRootDoc(o) {
2049
+ log.info("Setting root doc", o);
2050
+ this.rootDoc = o;
2051
+ if (this.version === 1) this.extract(o);
2052
+ else this.extract(this.getRootDocV2());
2053
+ }
2054
+ docTranslator(parent, node, first) {
2055
+ if (node.stmt === STMT_RELATION) {
2056
+ this.docTranslator(parent, node.state1, true);
2057
+ this.docTranslator(parent, node.state2, false);
2058
+ return;
2059
+ }
2060
+ if (node.stmt === STMT_STATE) if (node.id === CONSTANTS.START_NODE) {
2061
+ node.id = parent.id + (first ? "_start" : "_end");
2062
+ node.start = first;
2063
+ } else node.id = node.id.trim();
2064
+ if (node.stmt !== STMT_ROOT && node.stmt !== STMT_STATE || !node.doc) return;
2065
+ const doc = [];
2066
+ let currentDoc = [];
2067
+ for (const stmt of node.doc) if (stmt.type === DIVIDER_TYPE) {
2068
+ const newNode = clone(stmt);
2069
+ newNode.doc = clone(currentDoc);
2070
+ doc.push(newNode);
2071
+ currentDoc = [];
2072
+ } else currentDoc.push(stmt);
2073
+ if (doc.length > 0 && currentDoc.length > 0) {
2074
+ const newNode = {
2075
+ stmt: STMT_STATE,
2076
+ id: generateId(),
2077
+ type: "divider",
2078
+ doc: clone(currentDoc)
2079
+ };
2080
+ doc.push(clone(newNode));
2081
+ node.doc = doc;
2082
+ }
2083
+ node.doc.forEach((docNode) => this.docTranslator(node, docNode, true));
2084
+ }
2085
+ getRootDocV2() {
2086
+ this.docTranslator({
2087
+ id: STMT_ROOT,
2088
+ stmt: STMT_ROOT
2089
+ }, {
2090
+ id: STMT_ROOT,
2091
+ stmt: STMT_ROOT,
2092
+ doc: this.rootDoc
2093
+ }, true);
2094
+ return {
2095
+ id: STMT_ROOT,
2096
+ doc: this.rootDoc
2097
+ };
2098
+ }
2099
+ /**
2100
+ * Function called by parser when a node definition has been found.
2101
+ *
2102
+ * @param descr - description for the state. Can be a string or a list or strings
2103
+ * @param classes - class styles to apply to this state. Can be a string (1 style) or an array of styles. If it's just 1 class, convert it to an array of that 1 class.
2104
+ * @param styles - styles to apply to this state. Can be a string (1 style) or an array of styles. If it's just 1 style, convert it to an array of that 1 style.
2105
+ * @param textStyles - text styles to apply to this state. Can be a string (1 text test) or an array of text styles. If it's just 1 text style, convert it to an array of that 1 text style.
2106
+ */
2107
+ addState(id, type = DEFAULT_STATE_TYPE, doc = void 0, descr = void 0, note = void 0, classes = void 0, styles = void 0, textStyles = void 0) {
2108
+ const trimmedId = id?.trim();
2109
+ if (!this.currentDocument.states.has(trimmedId)) {
2110
+ log.info("Adding state ", trimmedId, descr);
2111
+ this.currentDocument.states.set(trimmedId, {
2112
+ stmt: STMT_STATE,
2113
+ id: trimmedId,
2114
+ descriptions: [],
2115
+ type,
2116
+ doc,
2117
+ note,
2118
+ classes: [],
2119
+ styles: [],
2120
+ textStyles: []
2121
+ });
2122
+ } else {
2123
+ const state = this.currentDocument.states.get(trimmedId);
2124
+ if (!state) throw new Error(`State not found: ${trimmedId}`);
2125
+ if (!state.doc) state.doc = doc;
2126
+ if (!state.type) state.type = type;
2127
+ }
2128
+ if (descr) {
2129
+ log.info("Setting state description", trimmedId, descr);
2130
+ (Array.isArray(descr) ? descr : [descr]).forEach((des) => this.addDescription(trimmedId, des.trim()));
2131
+ }
2132
+ if (note) {
2133
+ const doc2 = this.currentDocument.states.get(trimmedId);
2134
+ if (!doc2) throw new Error(`State not found: ${trimmedId}`);
2135
+ doc2.note = note;
2136
+ doc2.note.text = common_default.sanitizeText(doc2.note.text, getConfig2());
2137
+ }
2138
+ if (classes) {
2139
+ log.info("Setting state classes", trimmedId, classes);
2140
+ (Array.isArray(classes) ? classes : [classes]).forEach((cssClass) => this.setCssClass(trimmedId, cssClass.trim()));
2141
+ }
2142
+ if (styles) {
2143
+ log.info("Setting state styles", trimmedId, styles);
2144
+ (Array.isArray(styles) ? styles : [styles]).forEach((style) => this.setStyle(trimmedId, style.trim()));
2145
+ }
2146
+ if (textStyles) {
2147
+ log.info("Setting state styles", trimmedId, styles);
2148
+ (Array.isArray(textStyles) ? textStyles : [textStyles]).forEach((textStyle) => this.setTextStyle(trimmedId, textStyle.trim()));
2149
+ }
2150
+ }
2151
+ clear(saveCommon) {
2152
+ this.nodes = [];
2153
+ this.edges = [];
2154
+ this.funs = [this.setupToolTips.bind(this)];
2155
+ this.documents = { root: newDoc() };
2156
+ this.currentDocument = this.documents.root;
2157
+ this.startEndCount = 0;
2158
+ this.classes = newClassesList();
2159
+ if (!saveCommon) {
2160
+ this.links = /* @__PURE__ */ new Map();
2161
+ clear();
2162
+ }
2163
+ }
2164
+ getState(id) {
2165
+ return this.currentDocument.states.get(id);
2166
+ }
2167
+ getStates() {
2168
+ return this.currentDocument.states;
2169
+ }
2170
+ logDocuments() {
2171
+ log.info("Documents = ", this.documents);
2172
+ }
2173
+ getRelations() {
2174
+ return this.currentDocument.relations;
2175
+ }
2176
+ /**
2177
+ * Adds a clickable link to a state.
2178
+ */
2179
+ addLink(stateId, url, tooltip) {
2180
+ this.links.set(stateId, {
2181
+ url,
2182
+ tooltip
2183
+ });
2184
+ log.warn("Adding link", stateId, url, tooltip);
2185
+ }
2186
+ /**
2187
+ * Get all registered links.
2188
+ */
2189
+ getLinks() {
2190
+ return this.links;
2191
+ }
2192
+ /**
2193
+ * If the id is a start node ( [*] ), then return a new id constructed from
2194
+ * the start node name and the current start node count.
2195
+ * else return the given id
2196
+ */
2197
+ startIdIfNeeded(id = "") {
2198
+ if (id === CONSTANTS.START_NODE) {
2199
+ this.startEndCount++;
2200
+ return `${CONSTANTS.START_TYPE}${this.startEndCount}`;
2201
+ }
2202
+ return id;
2203
+ }
2204
+ /**
2205
+ * If the id is a start node ( [*] ), then return the start type ('start')
2206
+ * else return the given type
2207
+ */
2208
+ startTypeIfNeeded(id = "", type = DEFAULT_STATE_TYPE) {
2209
+ return id === CONSTANTS.START_NODE ? CONSTANTS.START_TYPE : type;
2210
+ }
2211
+ /**
2212
+ * If the id is an end node ( [*] ), then return a new id constructed from
2213
+ * the end node name and the current start_end node count.
2214
+ * else return the given id
2215
+ */
2216
+ endIdIfNeeded(id = "") {
2217
+ if (id === CONSTANTS.END_NODE) {
2218
+ this.startEndCount++;
2219
+ return `${CONSTANTS.END_TYPE}${this.startEndCount}`;
2220
+ }
2221
+ return id;
2222
+ }
2223
+ /**
2224
+ * If the id is an end node ( [*] ), then return the end type
2225
+ * else return the given type
2226
+ *
2227
+ */
2228
+ endTypeIfNeeded(id = "", type = DEFAULT_STATE_TYPE) {
2229
+ return id === CONSTANTS.END_NODE ? CONSTANTS.END_TYPE : type;
2230
+ }
2231
+ addRelationObjs(item1, item2, relationTitle = "") {
2232
+ const id1 = this.startIdIfNeeded(item1.id.trim());
2233
+ const type1 = this.startTypeIfNeeded(item1.id.trim(), item1.type);
2234
+ const id2 = this.startIdIfNeeded(item2.id.trim());
2235
+ const type2 = this.startTypeIfNeeded(item2.id.trim(), item2.type);
2236
+ this.addState(id1, type1, item1.doc, item1.description, item1.note, item1.classes, item1.styles, item1.textStyles);
2237
+ this.addState(id2, type2, item2.doc, item2.description, item2.note, item2.classes, item2.styles, item2.textStyles);
2238
+ this.currentDocument.relations.push({
2239
+ id1,
2240
+ id2,
2241
+ relationTitle: common_default.sanitizeText(relationTitle, getConfig2())
2242
+ });
2243
+ }
2244
+ /**
2245
+ * Add a relation between two items. The items may be full objects or just the string id of a state.
2246
+ */
2247
+ addRelation(item1, item2, title) {
2248
+ if (typeof item1 === "object" && typeof item2 === "object") this.addRelationObjs(item1, item2, title);
2249
+ else if (typeof item1 === "string" && typeof item2 === "string") {
2250
+ const id1 = this.startIdIfNeeded(item1.trim());
2251
+ const type1 = this.startTypeIfNeeded(item1);
2252
+ const id2 = this.endIdIfNeeded(item2.trim());
2253
+ const type2 = this.endTypeIfNeeded(item2);
2254
+ this.addState(id1, type1);
2255
+ this.addState(id2, type2);
2256
+ this.currentDocument.relations.push({
2257
+ id1,
2258
+ id2,
2259
+ relationTitle: title ? common_default.sanitizeText(title, getConfig2()) : void 0
2260
+ });
2261
+ }
2262
+ }
2263
+ addDescription(id, descr) {
2264
+ const theState = this.currentDocument.states.get(id);
2265
+ const _descr = descr.startsWith(":") ? descr.replace(":", "").trim() : descr;
2266
+ theState?.descriptions?.push(common_default.sanitizeText(_descr, getConfig2()));
2267
+ }
2268
+ cleanupLabel(label) {
2269
+ return label.startsWith(":") ? label.slice(2).trim() : label.trim();
2270
+ }
2271
+ getDividerId() {
2272
+ this.dividerCnt++;
2273
+ return `divider-id-${this.dividerCnt}`;
2274
+ }
2275
+ /**
2276
+ * Called when the parser comes across a (style) class definition
2277
+ * @example classDef my-style fill:#f96;
2278
+ *
2279
+ * @param id - the id of this (style) class
2280
+ * @param styleAttributes - the string with 1 or more style attributes (each separated by a comma)
2281
+ */
2282
+ addStyleClass(id, styleAttributes = "") {
2283
+ if (!this.classes.has(id)) this.classes.set(id, {
2284
+ id,
2285
+ styles: [],
2286
+ textStyles: []
2287
+ });
2288
+ const foundClass = this.classes.get(id);
2289
+ if (styleAttributes && foundClass) styleAttributes.split(CONSTANTS.STYLECLASS_SEP).forEach((attrib) => {
2290
+ const fixedAttrib = attrib.replace(/([^;]*);/, "$1").trim();
2291
+ if (RegExp(CONSTANTS.COLOR_KEYWORD).exec(attrib)) {
2292
+ const newStyle2 = fixedAttrib.replace(CONSTANTS.FILL_KEYWORD, CONSTANTS.BG_FILL).replace(CONSTANTS.COLOR_KEYWORD, CONSTANTS.FILL_KEYWORD);
2293
+ foundClass.textStyles.push(newStyle2);
2294
+ }
2295
+ foundClass.styles.push(fixedAttrib);
2296
+ });
2297
+ }
2298
+ getClasses() {
2299
+ return this.classes;
2300
+ }
2301
+ setupToolTips(element) {
2302
+ const tooltipElem = createTooltip();
2303
+ select_default(element).select("svg").selectAll("g.node, g.rough-node").on("mouseover", (e) => {
2304
+ const el = select_default(e.currentTarget);
2305
+ const title = el.attr("title");
2306
+ if (title === null) return;
2307
+ const rect = e.currentTarget?.getBoundingClientRect();
2308
+ tooltipElem.transition().duration(200).style("opacity", ".9");
2309
+ tooltipElem.style("left", window.scrollX + rect.left + (rect.right - rect.left) / 2 + "px").style("top", window.scrollY + rect.bottom + "px");
2310
+ tooltipElem.html(purify.sanitize(title));
2311
+ el.classed("hover", true);
2312
+ }).on("mouseout", (e) => {
2313
+ tooltipElem.transition().duration(500).style("opacity", 0);
2314
+ select_default(e.currentTarget).classed("hover", false);
2315
+ });
2316
+ }
2317
+ /**
2318
+ * Add a (style) class or css class to a state with the given id.
2319
+ * If the state isn't already in the list of known states, add it.
2320
+ * Might be called by parser when a style class or CSS class should be applied to a state
2321
+ *
2322
+ * @param itemIds - The id or a list of ids of the item(s) to apply the css class to
2323
+ * @param cssClassName - CSS class name
2324
+ */
2325
+ setCssClass(itemIds, cssClassName) {
2326
+ itemIds.split(",").forEach((id) => {
2327
+ let foundState = this.getState(id);
2328
+ if (!foundState) {
2329
+ const trimmedId = id.trim();
2330
+ this.addState(trimmedId);
2331
+ foundState = this.getState(trimmedId);
2332
+ }
2333
+ foundState?.classes?.push(cssClassName);
2334
+ });
2335
+ }
2336
+ /**
2337
+ * Add a style to a state with the given id.
2338
+ * @example style stateId fill:#f9f,stroke:#333,stroke-width:4px
2339
+ * where 'style' is the keyword
2340
+ * stateId is the id of a state
2341
+ * the rest of the string is the styleText (all of the attributes to be applied to the state)
2342
+ *
2343
+ * @param itemId - The id of item to apply the style to
2344
+ * @param styleText - the text of the attributes for the style
2345
+ */
2346
+ setStyle(itemId, styleText) {
2347
+ this.getState(itemId)?.styles?.push(styleText);
2348
+ }
2349
+ /**
2350
+ * Add a text style to a state with the given id
2351
+ *
2352
+ * @param itemId - The id of item to apply the css class to
2353
+ * @param cssClassName - CSS class name
2354
+ */
2355
+ setTextStyle(itemId, cssClassName) {
2356
+ this.getState(itemId)?.textStyles?.push(cssClassName);
2357
+ }
2358
+ bindFunctions(element) {
2359
+ this.funs.forEach((fun) => {
2360
+ fun(element);
2361
+ });
2362
+ }
2363
+ /**
2364
+ * Finds the direction statement in the root document.
2365
+ * @returns the direction statement if present
2366
+ */
2367
+ getDirectionStatement() {
2368
+ return this.rootDoc.find((doc) => doc.stmt === STMT_DIRECTION);
2369
+ }
2370
+ getDirection() {
2371
+ return this.getDirectionStatement()?.value ?? DEFAULT_DIAGRAM_DIRECTION;
2372
+ }
2373
+ setDirection(dir) {
2374
+ const doc = this.getDirectionStatement();
2375
+ if (doc) doc.value = dir;
2376
+ else this.rootDoc.unshift({
2377
+ stmt: STMT_DIRECTION,
2378
+ value: dir
2379
+ });
2380
+ }
2381
+ trimColon(str) {
2382
+ return str.startsWith(":") ? str.slice(1).trim() : str.trim();
2383
+ }
2384
+ getData() {
2385
+ const config = getConfig2();
2386
+ for (const node of this.nodes) {
2387
+ node.wrappingWidth ??= config.state?.wrappingWidth;
2388
+ if (!node.isGroup) node.minWidth ??= config.state?.minNodeWidth;
2389
+ }
2390
+ return {
2391
+ nodes: this.nodes,
2392
+ edges: this.edges,
2393
+ other: {},
2394
+ config,
2395
+ direction: getDir2(this.getRootDocV2())
2396
+ };
2397
+ }
2398
+ getConfig() {
2399
+ return getConfig2().state;
2400
+ }
2401
+ };
2402
+ var genColor = /* @__PURE__ */ __name((options) => {
2403
+ const { theme, bkgColorArray, borderColorArray } = options;
2404
+ if (!isColorTheme(theme, borderColorArray)) return "";
2405
+ const look = safeLook(options.look);
2406
+ const hasBkgColors = hasPalette(bkgColorArray);
2407
+ let sections = "";
2408
+ for (let i = 0; i < paletteSlotCount(borderColorArray); i++) {
2409
+ const borderColor = borderColorArray[i];
2410
+ const tint = hasBkgColors ? `fill: ${bkgColorArray[i % bkgColorArray.length]};` : "";
2411
+ const slot = `[data-look="${look}"][data-color-id="color-${i}"]`;
2412
+ sections += `
2413
+
2414
+ /* The title strip: \`rect.outer\` spans the whole composite and \`rect.inner\` covers
2415
+ the body, so what stays visible of \`outer\` is the band behind the label. */
2416
+ ${slot}.statediagram-cluster rect.outer {
2417
+ stroke: ${borderColor};
2418
+ ${tint}
2419
+ }
2420
+
2421
+ ${slot}.statediagram-cluster rect.inner {
2422
+ stroke: ${borderColor};
2423
+ }
2424
+
2425
+ /* Concurrency regions. Siblings of one composite share a slot, so a divided composite
2426
+ reads as one thing split into parts rather than as several composites. */
2427
+ ${slot}.statediagram-cluster rect.divider {
2428
+ stroke: ${borderColor};
2429
+ ${tint}
2430
+ }
2431
+
2432
+ /* handDrawn draws the same container as roughjs shapes rather than plain rects, so it
2433
+ needs its own rules. \`roundedWithTitle\` and \`divider\` name those groups \`outer\`,
2434
+ \`inner\` and \`divider\` to match the classic branch, which is what lets these
2435
+ discriminate -- a bare \`.statediagram-cluster path\` rule reached the body as well and
2436
+ tinted the whole composite, losing \`compositeBackground\` and diverging from what
2437
+ classic and neo do.
2438
+
2439
+ roughjs emits two paths per shape and marks them: the filled shape carries
2440
+ \`stroke="none"\` and the sketched outline carries \`fill="none"\`. Splitting on that is
2441
+ what keeps \`fill\` off the outline -- a rough outline is open squiggles, not a closed
2442
+ region, so filling it produces smears -- and keeps \`stroke\` off the fill shape, which
2443
+ would otherwise gain an edge it was drawn without. */
2444
+ ${slot}.statediagram-cluster .outer path[stroke='none'] {
2445
+ ${tint}
2446
+ }
2447
+
2448
+ ${slot}.statediagram-cluster .outer path[fill='none'] {
2449
+ stroke: ${borderColor};
2450
+ }
2451
+
2452
+ /* No \`.inner\` rule on purpose. The body shape is left entirely alone under handDrawn,
2453
+ where a rect's \`inner\` counterpart cannot be recoloured safely: roughjs draws a
2454
+ hachure fill as *stroked* lines, so its fill paths carry \`fill="none"\` exactly like
2455
+ the outline and no selector separates them. An \`.inner\` stroke rule therefore
2456
+ repainted the hatching of every alt composite in the palette colour instead of
2457
+ leaving it on \`altBackground\`. The container still reads as palette-coloured: the
2458
+ \`outer\` shape spans the whole composite, so its outline already frames the body. */
2459
+
2460
+ /* Regions split the same way, which is why \`divider\` fills solid rather than taking
2461
+ roughjs's default hachure -- see the note on that call. Hatched, both of its paths
2462
+ carried \`fill="none"\` and these two rules degenerated: the tint matched nothing and
2463
+ the border rule repainted the hatching. */
2464
+ ${slot}.statediagram-cluster .divider path[stroke='none'] {
2465
+ ${tint}
2466
+ }
2467
+
2468
+ ${slot}.statediagram-cluster .divider path[fill='none'] {
2469
+ stroke: ${borderColor};
2470
+ }
2471
+ `;
2472
+ }
2473
+ return sections;
2474
+ }, "genColor");
2475
+ var diagram = {
2476
+ parser: stateDiagram_default,
2477
+ get db() {
2478
+ return new StateDB(2);
2479
+ },
2480
+ renderer: stateRenderer_v3_unified_default,
2481
+ styles: /* @__PURE__ */ __name((options) => `
2482
+ ${genColor(options)}
2483
+ defs [id$="-barbEnd"] {
2484
+ fill: ${options.transitionColor};
2485
+ stroke: ${options.transitionColor};
2486
+ }
2487
+ g.stateGroup text {
2488
+ fill: ${options.nodeBorder};
2489
+ stroke: none;
2490
+ font-size: 10px;
2491
+ }
2492
+ g.stateGroup text {
2493
+ fill: ${options.textColor};
2494
+ stroke: none;
2495
+ font-size: 10px;
2496
+
2497
+ }
2498
+ g.stateGroup .state-title {
2499
+ font-weight: bolder;
2500
+ fill: ${options.stateLabelColor};
2501
+ }
2502
+
2503
+ g.stateGroup rect {
2504
+ fill: ${options.mainBkg};
2505
+ stroke: ${options.nodeBorder};
2506
+ }
2507
+
2508
+ g.stateGroup line {
2509
+ stroke: ${options.lineColor};
2510
+ stroke-width: ${options.strokeWidth || 1};
2511
+ }
2512
+
2513
+ .transition {
2514
+ stroke: ${options.transitionColor};
2515
+ stroke-width: ${options.strokeWidth || 1};
2516
+ fill: none;
2517
+ }
2518
+
2519
+ .stateGroup .composit {
2520
+ fill: ${options.background};
2521
+ border-bottom: 1px
2522
+ }
2523
+
2524
+ .stateGroup .alt-composit {
2525
+ fill: #e0e0e0;
2526
+ border-bottom: 1px
2527
+ }
2528
+
2529
+ .state-note {
2530
+ stroke: ${options.noteBorderColor};
2531
+ fill: ${options.noteBkgColor};
2532
+
2533
+ text {
2534
+ fill: ${options.noteTextColor};
2535
+ stroke: none;
2536
+ font-size: 10px;
2537
+ }
2538
+ }
2539
+
2540
+ .stateLabel .box {
2541
+ stroke: none;
2542
+ stroke-width: 0;
2543
+ fill: ${options.mainBkg};
2544
+ opacity: 0.5;
2545
+ }
2546
+
2547
+ .edgeLabel .label rect {
2548
+ fill: ${options.labelBackgroundColor};
2549
+ opacity: 0.5;
2550
+ }
2551
+ .edgeLabel {
2552
+ background-color: ${options.edgeLabelBackground};
2553
+ p {
2554
+ background-color: ${options.edgeLabelBackground};
2555
+ }
2556
+ rect {
2557
+ opacity: 0.5;
2558
+ background-color: ${options.edgeLabelBackground};
2559
+ fill: ${options.edgeLabelBackground};
2560
+ }
2561
+ text-align: center;
2562
+ }
2563
+ .edgeLabel .label text {
2564
+ fill: ${options.transitionLabelColor || options.tertiaryTextColor};
2565
+ }
2566
+ .label div .edgeLabel {
2567
+ color: ${options.transitionLabelColor || options.tertiaryTextColor};
2568
+ }
2569
+
2570
+ .stateLabel text {
2571
+ fill: ${options.stateLabelColor};
2572
+ font-size: 10px;
2573
+ font-weight: bold;
2574
+ }
2575
+
2576
+ .node circle.state-start {
2577
+ fill: ${options.specialStateColor};
2578
+ stroke: ${options.specialStateColor};
2579
+ }
2580
+
2581
+ .node .fork-join {
2582
+ fill: ${options.specialStateColor};
2583
+ stroke: ${options.specialStateColor};
2584
+ }
2585
+
2586
+ .node circle.state-end {
2587
+ fill: ${options.innerEndBackground};
2588
+ stroke: ${options.background};
2589
+ stroke-width: 1.5
2590
+ }
2591
+ .end-state-inner {
2592
+ fill: ${options.compositeBackground || options.background};
2593
+ // stroke: ${options.background};
2594
+ stroke-width: 1.5
2595
+ }
2596
+
2597
+ .node rect {
2598
+ fill: ${options.stateBkg || options.mainBkg};
2599
+ stroke: ${options.stateBorder || options.nodeBorder};
2600
+ stroke-width: ${options.strokeWidth || 1}px;
2601
+ }
2602
+ .node polygon {
2603
+ fill: ${options.mainBkg};
2604
+ stroke: ${options.stateBorder || options.nodeBorder};;
2605
+ stroke-width: ${options.strokeWidth || 1}px;
2606
+ }
2607
+ [id$="-barbEnd"] {
2608
+ fill: ${options.lineColor};
2609
+ }
2610
+
2611
+ .statediagram-cluster rect {
2612
+ fill: ${options.compositeTitleBackground};
2613
+ stroke: ${options.stateBorder || options.nodeBorder};
2614
+ stroke-width: ${options.strokeWidth || 1}px;
2615
+ }
2616
+
2617
+ .cluster-label, .nodeLabel {
2618
+ color: ${options.stateLabelColor};
2619
+ // line-height: 1;
2620
+ }
2621
+
2622
+ .statediagram-cluster rect.outer {
2623
+ rx: 5px;
2624
+ ry: 5px;
2625
+ }
2626
+ .statediagram-state .divider {
2627
+ stroke: ${options.stateBorder || options.nodeBorder};
2628
+ }
2629
+
2630
+ .statediagram-state .title-state {
2631
+ rx: 5px;
2632
+ ry: 5px;
2633
+ }
2634
+ .statediagram-cluster.statediagram-cluster .inner {
2635
+ fill: ${options.compositeBackground || options.background};
2636
+ }
2637
+ .statediagram-cluster.statediagram-cluster-alt .inner {
2638
+ fill: ${options.altBackground ? options.altBackground : "#efefef"};
2639
+ }
2640
+
2641
+ .statediagram-cluster .inner {
2642
+ rx:0;
2643
+ ry:0;
2644
+ }
2645
+
2646
+ .statediagram-state rect.basic {
2647
+ rx: 5px;
2648
+ ry: 5px;
2649
+ }
2650
+ .statediagram-state rect.divider {
2651
+ stroke-dasharray: 10,10;
2652
+ fill: ${options.altBackground ? options.altBackground : "#efefef"};
2653
+ }
2654
+
2655
+ .note-edge {
2656
+ stroke-dasharray: 5;
2657
+ }
2658
+
2659
+ .statediagram-note rect {
2660
+ fill: ${options.noteBkgColor};
2661
+ stroke: ${options.noteBorderColor};
2662
+ stroke-width: 1px;
2663
+ rx: 0;
2664
+ ry: 0;
2665
+ }
2666
+ .statediagram-note rect {
2667
+ fill: ${options.noteBkgColor};
2668
+ stroke: ${options.noteBorderColor};
2669
+ stroke-width: 1px;
2670
+ rx: 0;
2671
+ ry: 0;
2672
+ }
2673
+
2674
+ .statediagram-note text {
2675
+ fill: ${options.noteTextColor};
2676
+ }
2677
+
2678
+ .statediagram-note .nodeLabel {
2679
+ color: ${options.noteTextColor};
2680
+ }
2681
+ .statediagram .edgeLabel {
2682
+ color: red; // ${options.noteTextColor};
2683
+ }
2684
+
2685
+ [id$="-dependencyStart"], [id$="-dependencyEnd"] {
2686
+ fill: ${options.lineColor};
2687
+ stroke: ${options.lineColor};
2688
+ stroke-width: ${options.strokeWidth || 1};
2689
+ }
2690
+
2691
+ .statediagramTitleText {
2692
+ text-anchor: middle;
2693
+ font-size: 18px;
2694
+ fill: ${options.textColor};
2695
+ }
2696
+
2697
+ [data-look="neo"].statediagram-cluster rect {
2698
+ fill: ${options.mainBkg};
2699
+ stroke: ${options.useGradient ? "url(" + options.svgId + "-gradient)" : options.stateBorder || options.nodeBorder};
2700
+ stroke-width: ${options.strokeWidth ?? 1};
2701
+ }
2702
+ [data-look="neo"].statediagram-cluster rect.outer {
2703
+ rx: ${options.radius}px;
2704
+ ry: ${options.radius}px;
2705
+ filter: ${options.dropShadow ? options.dropShadow.replace("url(#drop-shadow)", `url(${options.svgId}-drop-shadow)`) : "none"}
2706
+ }
2707
+ `, "getStyles"),
2708
+ init: /* @__PURE__ */ __name((cnf) => {
2709
+ if (!cnf.state) cnf.state = {};
2710
+ cnf.state.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
2711
+ }, "init")
2712
+ };
2713
+
2714
+ //#endregion
2715
+ export { diagram };