@n8n-zengchao/chat 0.62.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 (151) hide show
  1. package/README.md +289 -0
  2. package/dist/App.vue.d.ts +2 -0
  3. package/dist/__stories__/App.stories.d.ts +18 -0
  4. package/dist/__tests__/Input.spec.d.ts +1 -0
  5. package/dist/__tests__/api/generic.spec.d.ts +1 -0
  6. package/dist/__tests__/api/message.spec.d.ts +1 -0
  7. package/dist/__tests__/index.spec.d.ts +1 -0
  8. package/dist/__tests__/plugins/chat.spec.d.ts +1 -0
  9. package/dist/__tests__/plugins/chat.test.d.ts +1 -0
  10. package/dist/__tests__/setup.d.ts +0 -0
  11. package/dist/__tests__/utils/create.d.ts +5 -0
  12. package/dist/__tests__/utils/fetch.d.ts +13 -0
  13. package/dist/__tests__/utils/index.d.ts +3 -0
  14. package/dist/__tests__/utils/selectors.d.ts +12 -0
  15. package/dist/__tests__/utils/streaming.spec.d.ts +1 -0
  16. package/dist/__tests__/utils/streamingHandlers.spec.d.ts +1 -0
  17. package/dist/_basePickBy-aQilsjEs.mjs +106 -0
  18. package/dist/_baseUniq-Agc10qFQ.mjs +232 -0
  19. package/dist/api/generic.d.ts +7 -0
  20. package/dist/api/index.d.ts +2 -0
  21. package/dist/api/message.d.ts +11 -0
  22. package/dist/arc-EhYU_DB1.mjs +79 -0
  23. package/dist/architecture-U656AL7Q-B1STlXpR.mjs +10 -0
  24. package/dist/architectureDiagram-VXUJARFQ-DOVAbXSw.mjs +4054 -0
  25. package/dist/array-B5w981Vk.mjs +5 -0
  26. package/dist/blockDiagram-VD42YOAC-BsX3Fkg3.mjs +3013 -0
  27. package/dist/c4Diagram-YG6GDRKO-B5JaLuX6.mjs +2957 -0
  28. package/dist/channel-CqrIo07y.mjs +4 -0
  29. package/dist/chat.bundle.es.js +37656 -0
  30. package/dist/chat.bundle.umd.js +2784 -0
  31. package/dist/chat.es.js +35738 -0
  32. package/dist/chat.umd.js +2776 -0
  33. package/dist/chunk-4BX2VUAB-dn0RXIrC.mjs +7 -0
  34. package/dist/chunk-55IACEB6-DrIttNoL.mjs +7 -0
  35. package/dist/chunk-76Q3JFCE-D7DMbWeQ.mjs +20 -0
  36. package/dist/chunk-ABZYJK2D-_NXv778f.mjs +2516 -0
  37. package/dist/chunk-ATLVNIR6-CBnG7Ev9.mjs +66 -0
  38. package/dist/chunk-B4BG7PRW-DElmmAse.mjs +3109 -0
  39. package/dist/chunk-CVBHYZKI-kPsSw5G9.mjs +11 -0
  40. package/dist/chunk-DI55MBZ5-Bw6uFFfD.mjs +1995 -0
  41. package/dist/chunk-DZXZ2BO8.mjs +19 -0
  42. package/dist/chunk-EXTU4WIE-DWzncOZf.mjs +8 -0
  43. package/dist/chunk-FMBD7UC4-CQf-nVrj.mjs +4 -0
  44. package/dist/chunk-FPAJGGOC-HRc6DGju.mjs +12254 -0
  45. package/dist/chunk-FWNWRKHM-CGiJVNMo.mjs +57 -0
  46. package/dist/chunk-HN2XXSSU-DMfVdeUE.mjs +75 -0
  47. package/dist/chunk-JA3XYJ7Z-b0Li4NN8.mjs +1834 -0
  48. package/dist/chunk-JZLCHNYA-C_4MLySW.mjs +4862 -0
  49. package/dist/chunk-KS23V3DP-BRKOfbU6.mjs +136 -0
  50. package/dist/chunk-LBM3YZW2-JIQK8wiH.mjs +20 -0
  51. package/dist/chunk-LHMN2FUI-PNCyIUgu.mjs +20 -0
  52. package/dist/chunk-MI3HLSF2-B9GTCmLp.mjs +1146 -0
  53. package/dist/chunk-N4CR4FBY-CjlmnCPD.mjs +40 -0
  54. package/dist/chunk-O7ZBX7Z2-DmJUfqJj.mjs +27 -0
  55. package/dist/chunk-QN33PNHL-nN1zLFSf.mjs +24 -0
  56. package/dist/chunk-QXUST7PY-CY78Btj9.mjs +487 -0
  57. package/dist/chunk-QZHKN3VN-BF5N1pfB.mjs +12 -0
  58. package/dist/chunk-S3R3BYOJ-BhFsv0Go.mjs +1076 -0
  59. package/dist/chunk-S6J4BHB3-BvrWTdbl.mjs +20 -0
  60. package/dist/chunk-T53DSG4Q-XzY06amw.mjs +25 -0
  61. package/dist/chunk-TZMSLE5B-DVmJQ8eg.mjs +57 -0
  62. package/dist/classDiagram-2ON5EDUG-CKxiEVX9.mjs +33 -0
  63. package/dist/classDiagram-v2-WZHVMYZB-sAa_2keq.mjs +33 -0
  64. package/dist/clone-nkGlb0Gn.mjs +8 -0
  65. package/dist/components/Button.vue.d.ts +17 -0
  66. package/dist/components/Chat.vue.d.ts +2 -0
  67. package/dist/components/ChatFile.vue.d.ts +11 -0
  68. package/dist/components/ChatWindow.vue.d.ts +2 -0
  69. package/dist/components/GetStarted.vue.d.ts +2 -0
  70. package/dist/components/GetStartedFooter.vue.d.ts +2 -0
  71. package/dist/components/Input.vue.d.ts +39 -0
  72. package/dist/components/Layout.vue.d.ts +23 -0
  73. package/dist/components/Message.vue.d.ts +39 -0
  74. package/dist/components/MessageTyping.vue.d.ts +76 -0
  75. package/dist/components/MessagesList.vue.d.ts +164 -0
  76. package/dist/components/PoweredBy.vue.d.ts +2 -0
  77. package/dist/components/index.d.ts +10 -0
  78. package/dist/composables/index.d.ts +3 -0
  79. package/dist/composables/useChat.d.ts +2 -0
  80. package/dist/composables/useI18n.d.ts +4 -0
  81. package/dist/composables/useOptions.d.ts +4 -0
  82. package/dist/constants/defaults.d.ts +3 -0
  83. package/dist/constants/index.d.ts +3 -0
  84. package/dist/constants/localStorage.d.ts +2 -0
  85. package/dist/constants/symbols.d.ts +4 -0
  86. package/dist/cose-bilkent-S5V4N54A-1lKG2PUg.mjs +2251 -0
  87. package/dist/cytoscape.esm-Dls1_mGy.mjs +18108 -0
  88. package/dist/dagre-6UL2VRFP-CbWFu9xQ.mjs +300 -0
  89. package/dist/dagre-DEdOheHq.mjs +1385 -0
  90. package/dist/defaultLocale-CyoQm63E.mjs +178 -0
  91. package/dist/diagram-PSM6KHXK-CJcHbrJH.mjs +499 -0
  92. package/dist/diagram-QEK2KX5R-XQ9XOVL4.mjs +228 -0
  93. package/dist/diagram-S2PKOQOG-CmRfaeSf.mjs +146 -0
  94. package/dist/dist-BT0fjU7K.mjs +50 -0
  95. package/dist/erDiagram-Q2GNP2WA-iuoUWHwm.mjs +1603 -0
  96. package/dist/event-buses/chatEventBus.d.ts +1 -0
  97. package/dist/event-buses/index.d.ts +1 -0
  98. package/dist/favicon.ico +0 -0
  99. package/dist/flowDiagram-NV44I4VS-D3GMS8-G.mjs +4132 -0
  100. package/dist/ganttDiagram-LVOFAZNH-DMTZVZDR.mjs +2832 -0
  101. package/dist/gitGraph-F6HP7TQM-CrdUzURw.mjs +10 -0
  102. package/dist/gitGraphDiagram-NY62KEGX-DipP5Fgt.mjs +636 -0
  103. package/dist/graphlib-D9eH5icd.mjs +224 -0
  104. package/dist/index.d.ts +2 -0
  105. package/dist/info-NVLQJR56-C-93Yf3U.mjs +10 -0
  106. package/dist/infoDiagram-F6ZHWCRC-jM50s26K.mjs +33 -0
  107. package/dist/init-CYeu4QfE.mjs +14 -0
  108. package/dist/isArrayLikeObject-BPcFdnyK.mjs +459 -0
  109. package/dist/isUndefined-BvarJ1wS.mjs +374 -0
  110. package/dist/journeyDiagram-XKPGCS4Q-BEEO_0Bh.mjs +885 -0
  111. package/dist/kanban-definition-3W4ZIXB7-B8u_HDmL.mjs +971 -0
  112. package/dist/katex-Dc1vXbUC.mjs +22094 -0
  113. package/dist/line-BJxACIPZ.mjs +31 -0
  114. package/dist/linear-DHHVI-cj.mjs +251 -0
  115. package/dist/math-Byg0NvhS.mjs +9 -0
  116. package/dist/mermaid-parser.core-YT4qvimq.mjs +49 -0
  117. package/dist/mindmap-definition-VGOIOE7T-ah41V88S.mjs +960 -0
  118. package/dist/now-DsJMgI1z.mjs +6 -0
  119. package/dist/ordinal-L0-EVPg8.mjs +62 -0
  120. package/dist/packet-BFZMPI3H-Cs4kRHct.mjs +10 -0
  121. package/dist/path-BcDHwjEr.mjs +80 -0
  122. package/dist/pie-7BOR55EZ-YZ5Xu4o6.mjs +10 -0
  123. package/dist/pieDiagram-ADFJNKIX-CqI33m1a.mjs +174 -0
  124. package/dist/plugins/chat.d.ts +3 -0
  125. package/dist/plugins/index.d.ts +1 -0
  126. package/dist/quadrantDiagram-AYHSOK5B-DDv2X9c1.mjs +1971 -0
  127. package/dist/radar-NHE76QYJ-TpirOFtv.mjs +10 -0
  128. package/dist/requirementDiagram-UZGBJVZJ-DXa77VzO.mjs +2194 -0
  129. package/dist/sankeyDiagram-TZEHDZUN--B9DInJC.mjs +885 -0
  130. package/dist/sequenceDiagram-WL72ISMW-Dqn9jJ3g.mjs +3562 -0
  131. package/dist/src-DdwtiGjk.mjs +1976 -0
  132. package/dist/stateDiagram-FKZM4ZOC-D3eEcVjS.mjs +226 -0
  133. package/dist/stateDiagram-v2-4FDKWEC3-dzwJ4caL.mjs +32 -0
  134. package/dist/style.css +3 -0
  135. package/dist/timeline-definition-IT6M3QCI-z93ry7RN.mjs +831 -0
  136. package/dist/toInteger-1S_4Byef.mjs +36 -0
  137. package/dist/treemap-KMMF4GRG-BlF0Ev1z.mjs +10 -0
  138. package/dist/types/chat.d.ts +13 -0
  139. package/dist/types/index.d.ts +5 -0
  140. package/dist/types/messages.d.ts +17 -0
  141. package/dist/types/options.d.ts +33 -0
  142. package/dist/types/streaming.d.ts +18 -0
  143. package/dist/types/webhook.d.ts +19 -0
  144. package/dist/utils/event-bus.d.ts +8 -0
  145. package/dist/utils/index.d.ts +3 -0
  146. package/dist/utils/mount.d.ts +1 -0
  147. package/dist/utils/streaming.d.ts +26 -0
  148. package/dist/utils/streamingHandlers.d.ts +6 -0
  149. package/dist/utils/utils.d.ts +1 -0
  150. package/dist/xychartDiagram-PRI3JC2R-C3aDcgBz.mjs +2022 -0
  151. package/package.json +78 -0
@@ -0,0 +1,1995 @@
1
+ /*! Package version @n8n/chat@0.62.0 */
2
+ import { g as utils_default, s as generateId } from "./chunk-S3R3BYOJ-BhFsv0Go.mjs";
3
+ import { g as log, h as __name } from "./src-DdwtiGjk.mjs";
4
+ import { B as setAccTitle, C as getDiagramTitle, U as setDiagramTitle, _ as getAccDescription, a as clear, b as getConfig2, s as common_default, v as getAccTitle, z as setAccDescription } from "./chunk-ABZYJK2D-_NXv778f.mjs";
5
+ import { r as render } from "./chunk-N4CR4FBY-CjlmnCPD.mjs";
6
+ import { t as getDiagramElement } from "./chunk-55IACEB6-DrIttNoL.mjs";
7
+ import { t as setupViewPortForSVG } from "./chunk-QN33PNHL-nN1zLFSf.mjs";
8
+ var parser = (function() {
9
+ var e = /* @__PURE__ */ __name(function(e, b, x, S) {
10
+ for (x ||= {}, S = e.length; S--; x[e[S]] = b);
11
+ return x;
12
+ }, "o"), b = [1, 2], x = [1, 3], C = [1, 4], w = [2, 4], T = [1, 9], E = [1, 11], D = [1, 16], O = [1, 17], k = [1, 18], A = [1, 19], j = [1, 33], M = [1, 20], N = [1, 21], P = [1, 22], F = [1, 23], I = [1, 24], L = [1, 26], R = [1, 27], z = [1, 28], B = [1, 29], V = [1, 30], H = [1, 31], U = [1, 32], W = [1, 35], G = [1, 36], K = [1, 37], q = [1, 38], J = [1, 34], Y = [
13
+ 1,
14
+ 4,
15
+ 5,
16
+ 16,
17
+ 17,
18
+ 19,
19
+ 21,
20
+ 22,
21
+ 24,
22
+ 25,
23
+ 26,
24
+ 27,
25
+ 28,
26
+ 29,
27
+ 33,
28
+ 35,
29
+ 37,
30
+ 38,
31
+ 41,
32
+ 45,
33
+ 48,
34
+ 51,
35
+ 52,
36
+ 53,
37
+ 54,
38
+ 57
39
+ ], X = [
40
+ 1,
41
+ 4,
42
+ 5,
43
+ 14,
44
+ 15,
45
+ 16,
46
+ 17,
47
+ 19,
48
+ 21,
49
+ 22,
50
+ 24,
51
+ 25,
52
+ 26,
53
+ 27,
54
+ 28,
55
+ 29,
56
+ 33,
57
+ 35,
58
+ 37,
59
+ 38,
60
+ 39,
61
+ 40,
62
+ 41,
63
+ 45,
64
+ 48,
65
+ 51,
66
+ 52,
67
+ 53,
68
+ 54,
69
+ 57
70
+ ], Z = [
71
+ 4,
72
+ 5,
73
+ 16,
74
+ 17,
75
+ 19,
76
+ 21,
77
+ 22,
78
+ 24,
79
+ 25,
80
+ 26,
81
+ 27,
82
+ 28,
83
+ 29,
84
+ 33,
85
+ 35,
86
+ 37,
87
+ 38,
88
+ 41,
89
+ 45,
90
+ 48,
91
+ 51,
92
+ 52,
93
+ 53,
94
+ 54,
95
+ 57
96
+ ], Q = {
97
+ trace: /* @__PURE__ */ __name(function() {}, "trace"),
98
+ yy: {},
99
+ symbols_: {
100
+ error: 2,
101
+ start: 3,
102
+ SPACE: 4,
103
+ NL: 5,
104
+ SD: 6,
105
+ document: 7,
106
+ line: 8,
107
+ statement: 9,
108
+ classDefStatement: 10,
109
+ styleStatement: 11,
110
+ cssClassStatement: 12,
111
+ idStatement: 13,
112
+ DESCR: 14,
113
+ "-->": 15,
114
+ HIDE_EMPTY: 16,
115
+ scale: 17,
116
+ WIDTH: 18,
117
+ COMPOSIT_STATE: 19,
118
+ STRUCT_START: 20,
119
+ STRUCT_STOP: 21,
120
+ STATE_DESCR: 22,
121
+ AS: 23,
122
+ ID: 24,
123
+ FORK: 25,
124
+ JOIN: 26,
125
+ CHOICE: 27,
126
+ CONCURRENT: 28,
127
+ note: 29,
128
+ notePosition: 30,
129
+ NOTE_TEXT: 31,
130
+ direction: 32,
131
+ acc_title: 33,
132
+ acc_title_value: 34,
133
+ acc_descr: 35,
134
+ acc_descr_value: 36,
135
+ acc_descr_multiline_value: 37,
136
+ CLICK: 38,
137
+ STRING: 39,
138
+ HREF: 40,
139
+ classDef: 41,
140
+ CLASSDEF_ID: 42,
141
+ CLASSDEF_STYLEOPTS: 43,
142
+ DEFAULT: 44,
143
+ style: 45,
144
+ STYLE_IDS: 46,
145
+ STYLEDEF_STYLEOPTS: 47,
146
+ class: 48,
147
+ CLASSENTITY_IDS: 49,
148
+ STYLECLASS: 50,
149
+ direction_tb: 51,
150
+ direction_bt: 52,
151
+ direction_rl: 53,
152
+ direction_lr: 54,
153
+ eol: 55,
154
+ ";": 56,
155
+ EDGE_STATE: 57,
156
+ STYLE_SEPARATOR: 58,
157
+ left_of: 59,
158
+ right_of: 60,
159
+ $accept: 0,
160
+ $end: 1
161
+ },
162
+ terminals_: {
163
+ 2: "error",
164
+ 4: "SPACE",
165
+ 5: "NL",
166
+ 6: "SD",
167
+ 14: "DESCR",
168
+ 15: "-->",
169
+ 16: "HIDE_EMPTY",
170
+ 17: "scale",
171
+ 18: "WIDTH",
172
+ 19: "COMPOSIT_STATE",
173
+ 20: "STRUCT_START",
174
+ 21: "STRUCT_STOP",
175
+ 22: "STATE_DESCR",
176
+ 23: "AS",
177
+ 24: "ID",
178
+ 25: "FORK",
179
+ 26: "JOIN",
180
+ 27: "CHOICE",
181
+ 28: "CONCURRENT",
182
+ 29: "note",
183
+ 31: "NOTE_TEXT",
184
+ 33: "acc_title",
185
+ 34: "acc_title_value",
186
+ 35: "acc_descr",
187
+ 36: "acc_descr_value",
188
+ 37: "acc_descr_multiline_value",
189
+ 38: "CLICK",
190
+ 39: "STRING",
191
+ 40: "HREF",
192
+ 41: "classDef",
193
+ 42: "CLASSDEF_ID",
194
+ 43: "CLASSDEF_STYLEOPTS",
195
+ 44: "DEFAULT",
196
+ 45: "style",
197
+ 46: "STYLE_IDS",
198
+ 47: "STYLEDEF_STYLEOPTS",
199
+ 48: "class",
200
+ 49: "CLASSENTITY_IDS",
201
+ 50: "STYLECLASS",
202
+ 51: "direction_tb",
203
+ 52: "direction_bt",
204
+ 53: "direction_rl",
205
+ 54: "direction_lr",
206
+ 56: ";",
207
+ 57: "EDGE_STATE",
208
+ 58: "STYLE_SEPARATOR",
209
+ 59: "left_of",
210
+ 60: "right_of"
211
+ },
212
+ productions_: [
213
+ 0,
214
+ [3, 2],
215
+ [3, 2],
216
+ [3, 2],
217
+ [7, 0],
218
+ [7, 2],
219
+ [8, 2],
220
+ [8, 1],
221
+ [8, 1],
222
+ [9, 1],
223
+ [9, 1],
224
+ [9, 1],
225
+ [9, 1],
226
+ [9, 2],
227
+ [9, 3],
228
+ [9, 4],
229
+ [9, 1],
230
+ [9, 2],
231
+ [9, 1],
232
+ [9, 4],
233
+ [9, 3],
234
+ [9, 6],
235
+ [9, 1],
236
+ [9, 1],
237
+ [9, 1],
238
+ [9, 1],
239
+ [9, 4],
240
+ [9, 4],
241
+ [9, 1],
242
+ [9, 2],
243
+ [9, 2],
244
+ [9, 1],
245
+ [9, 5],
246
+ [9, 5],
247
+ [10, 3],
248
+ [10, 3],
249
+ [11, 3],
250
+ [12, 3],
251
+ [32, 1],
252
+ [32, 1],
253
+ [32, 1],
254
+ [32, 1],
255
+ [55, 1],
256
+ [55, 1],
257
+ [13, 1],
258
+ [13, 1],
259
+ [13, 3],
260
+ [13, 3],
261
+ [30, 1],
262
+ [30, 1]
263
+ ],
264
+ performAction: /* @__PURE__ */ __name(function(e, b, x, S, C, w, T) {
265
+ var E = w.length - 1;
266
+ switch (C) {
267
+ case 3: return S.setRootDoc(w[E]), w[E];
268
+ case 4:
269
+ this.$ = [];
270
+ break;
271
+ case 5:
272
+ w[E] != "nl" && (w[E - 1].push(w[E]), this.$ = w[E - 1]);
273
+ break;
274
+ case 6:
275
+ case 7:
276
+ this.$ = w[E];
277
+ break;
278
+ case 8:
279
+ this.$ = "nl";
280
+ break;
281
+ case 12:
282
+ this.$ = w[E];
283
+ break;
284
+ case 13:
285
+ let e = w[E - 1];
286
+ e.description = S.trimColon(w[E]), this.$ = e;
287
+ break;
288
+ case 14:
289
+ this.$ = {
290
+ stmt: "relation",
291
+ state1: w[E - 2],
292
+ state2: w[E]
293
+ };
294
+ break;
295
+ case 15:
296
+ let b = S.trimColon(w[E]);
297
+ this.$ = {
298
+ stmt: "relation",
299
+ state1: w[E - 3],
300
+ state2: w[E - 1],
301
+ description: b
302
+ };
303
+ break;
304
+ case 19:
305
+ this.$ = {
306
+ stmt: "state",
307
+ id: w[E - 3],
308
+ type: "default",
309
+ description: "",
310
+ doc: w[E - 1]
311
+ };
312
+ break;
313
+ case 20:
314
+ var D = w[E], O = w[E - 2].trim();
315
+ if (w[E].match(":")) {
316
+ var k = w[E].split(":");
317
+ D = k[0], O = [O, k[1]];
318
+ }
319
+ this.$ = {
320
+ stmt: "state",
321
+ id: D,
322
+ type: "default",
323
+ description: O
324
+ };
325
+ break;
326
+ case 21:
327
+ this.$ = {
328
+ stmt: "state",
329
+ id: w[E - 3],
330
+ type: "default",
331
+ description: w[E - 5],
332
+ doc: w[E - 1]
333
+ };
334
+ break;
335
+ case 22:
336
+ this.$ = {
337
+ stmt: "state",
338
+ id: w[E],
339
+ type: "fork"
340
+ };
341
+ break;
342
+ case 23:
343
+ this.$ = {
344
+ stmt: "state",
345
+ id: w[E],
346
+ type: "join"
347
+ };
348
+ break;
349
+ case 24:
350
+ this.$ = {
351
+ stmt: "state",
352
+ id: w[E],
353
+ type: "choice"
354
+ };
355
+ break;
356
+ case 25:
357
+ this.$ = {
358
+ stmt: "state",
359
+ id: S.getDividerId(),
360
+ type: "divider"
361
+ };
362
+ break;
363
+ case 26:
364
+ this.$ = {
365
+ stmt: "state",
366
+ id: w[E - 1].trim(),
367
+ note: {
368
+ position: w[E - 2].trim(),
369
+ text: w[E].trim()
370
+ }
371
+ };
372
+ break;
373
+ case 29:
374
+ this.$ = w[E].trim(), S.setAccTitle(this.$);
375
+ break;
376
+ case 30:
377
+ case 31:
378
+ this.$ = w[E].trim(), S.setAccDescription(this.$);
379
+ break;
380
+ case 32:
381
+ this.$ = {
382
+ stmt: "click",
383
+ id: w[E - 3],
384
+ url: w[E - 2],
385
+ tooltip: w[E - 1]
386
+ };
387
+ break;
388
+ case 33:
389
+ this.$ = {
390
+ stmt: "click",
391
+ id: w[E - 3],
392
+ url: w[E - 1],
393
+ tooltip: ""
394
+ };
395
+ break;
396
+ case 34:
397
+ case 35:
398
+ this.$ = {
399
+ stmt: "classDef",
400
+ id: w[E - 1].trim(),
401
+ classes: w[E].trim()
402
+ };
403
+ break;
404
+ case 36:
405
+ this.$ = {
406
+ stmt: "style",
407
+ id: w[E - 1].trim(),
408
+ styleClass: w[E].trim()
409
+ };
410
+ break;
411
+ case 37:
412
+ this.$ = {
413
+ stmt: "applyClass",
414
+ id: w[E - 1].trim(),
415
+ styleClass: w[E].trim()
416
+ };
417
+ break;
418
+ case 38:
419
+ S.setDirection("TB"), this.$ = {
420
+ stmt: "dir",
421
+ value: "TB"
422
+ };
423
+ break;
424
+ case 39:
425
+ S.setDirection("BT"), this.$ = {
426
+ stmt: "dir",
427
+ value: "BT"
428
+ };
429
+ break;
430
+ case 40:
431
+ S.setDirection("RL"), this.$ = {
432
+ stmt: "dir",
433
+ value: "RL"
434
+ };
435
+ break;
436
+ case 41:
437
+ S.setDirection("LR"), this.$ = {
438
+ stmt: "dir",
439
+ value: "LR"
440
+ };
441
+ break;
442
+ case 44:
443
+ case 45:
444
+ this.$ = {
445
+ stmt: "state",
446
+ id: w[E].trim(),
447
+ type: "default",
448
+ description: ""
449
+ };
450
+ break;
451
+ case 46:
452
+ this.$ = {
453
+ stmt: "state",
454
+ id: w[E - 2].trim(),
455
+ classes: [w[E].trim()],
456
+ type: "default",
457
+ description: ""
458
+ };
459
+ break;
460
+ case 47:
461
+ this.$ = {
462
+ stmt: "state",
463
+ id: w[E - 2].trim(),
464
+ classes: [w[E].trim()],
465
+ type: "default",
466
+ description: ""
467
+ };
468
+ break;
469
+ }
470
+ }, "anonymous"),
471
+ table: [
472
+ {
473
+ 3: 1,
474
+ 4: b,
475
+ 5: x,
476
+ 6: C
477
+ },
478
+ { 1: [3] },
479
+ {
480
+ 3: 5,
481
+ 4: b,
482
+ 5: x,
483
+ 6: C
484
+ },
485
+ {
486
+ 3: 6,
487
+ 4: b,
488
+ 5: x,
489
+ 6: C
490
+ },
491
+ e([
492
+ 1,
493
+ 4,
494
+ 5,
495
+ 16,
496
+ 17,
497
+ 19,
498
+ 22,
499
+ 24,
500
+ 25,
501
+ 26,
502
+ 27,
503
+ 28,
504
+ 29,
505
+ 33,
506
+ 35,
507
+ 37,
508
+ 38,
509
+ 41,
510
+ 45,
511
+ 48,
512
+ 51,
513
+ 52,
514
+ 53,
515
+ 54,
516
+ 57
517
+ ], w, { 7: 7 }),
518
+ { 1: [2, 1] },
519
+ { 1: [2, 2] },
520
+ {
521
+ 1: [2, 3],
522
+ 4: T,
523
+ 5: E,
524
+ 8: 8,
525
+ 9: 10,
526
+ 10: 12,
527
+ 11: 13,
528
+ 12: 14,
529
+ 13: 15,
530
+ 16: D,
531
+ 17: O,
532
+ 19: k,
533
+ 22: A,
534
+ 24: j,
535
+ 25: M,
536
+ 26: N,
537
+ 27: P,
538
+ 28: F,
539
+ 29: I,
540
+ 32: 25,
541
+ 33: L,
542
+ 35: R,
543
+ 37: z,
544
+ 38: B,
545
+ 41: V,
546
+ 45: H,
547
+ 48: U,
548
+ 51: W,
549
+ 52: G,
550
+ 53: K,
551
+ 54: q,
552
+ 57: J
553
+ },
554
+ e(Y, [2, 5]),
555
+ {
556
+ 9: 39,
557
+ 10: 12,
558
+ 11: 13,
559
+ 12: 14,
560
+ 13: 15,
561
+ 16: D,
562
+ 17: O,
563
+ 19: k,
564
+ 22: A,
565
+ 24: j,
566
+ 25: M,
567
+ 26: N,
568
+ 27: P,
569
+ 28: F,
570
+ 29: I,
571
+ 32: 25,
572
+ 33: L,
573
+ 35: R,
574
+ 37: z,
575
+ 38: B,
576
+ 41: V,
577
+ 45: H,
578
+ 48: U,
579
+ 51: W,
580
+ 52: G,
581
+ 53: K,
582
+ 54: q,
583
+ 57: J
584
+ },
585
+ e(Y, [2, 7]),
586
+ e(Y, [2, 8]),
587
+ e(Y, [2, 9]),
588
+ e(Y, [2, 10]),
589
+ e(Y, [2, 11]),
590
+ e(Y, [2, 12], {
591
+ 14: [1, 40],
592
+ 15: [1, 41]
593
+ }),
594
+ e(Y, [2, 16]),
595
+ { 18: [1, 42] },
596
+ e(Y, [2, 18], { 20: [1, 43] }),
597
+ { 23: [1, 44] },
598
+ e(Y, [2, 22]),
599
+ e(Y, [2, 23]),
600
+ e(Y, [2, 24]),
601
+ e(Y, [2, 25]),
602
+ {
603
+ 30: 45,
604
+ 31: [1, 46],
605
+ 59: [1, 47],
606
+ 60: [1, 48]
607
+ },
608
+ e(Y, [2, 28]),
609
+ { 34: [1, 49] },
610
+ { 36: [1, 50] },
611
+ e(Y, [2, 31]),
612
+ {
613
+ 13: 51,
614
+ 24: j,
615
+ 57: J
616
+ },
617
+ {
618
+ 42: [1, 52],
619
+ 44: [1, 53]
620
+ },
621
+ { 46: [1, 54] },
622
+ { 49: [1, 55] },
623
+ e(X, [2, 44], { 58: [1, 56] }),
624
+ e(X, [2, 45], { 58: [1, 57] }),
625
+ e(Y, [2, 38]),
626
+ e(Y, [2, 39]),
627
+ e(Y, [2, 40]),
628
+ e(Y, [2, 41]),
629
+ e(Y, [2, 6]),
630
+ e(Y, [2, 13]),
631
+ {
632
+ 13: 58,
633
+ 24: j,
634
+ 57: J
635
+ },
636
+ e(Y, [2, 17]),
637
+ e(Z, w, { 7: 59 }),
638
+ { 24: [1, 60] },
639
+ { 24: [1, 61] },
640
+ { 23: [1, 62] },
641
+ { 24: [2, 48] },
642
+ { 24: [2, 49] },
643
+ e(Y, [2, 29]),
644
+ e(Y, [2, 30]),
645
+ {
646
+ 39: [1, 63],
647
+ 40: [1, 64]
648
+ },
649
+ { 43: [1, 65] },
650
+ { 43: [1, 66] },
651
+ { 47: [1, 67] },
652
+ { 50: [1, 68] },
653
+ { 24: [1, 69] },
654
+ { 24: [1, 70] },
655
+ e(Y, [2, 14], { 14: [1, 71] }),
656
+ {
657
+ 4: T,
658
+ 5: E,
659
+ 8: 8,
660
+ 9: 10,
661
+ 10: 12,
662
+ 11: 13,
663
+ 12: 14,
664
+ 13: 15,
665
+ 16: D,
666
+ 17: O,
667
+ 19: k,
668
+ 21: [1, 72],
669
+ 22: A,
670
+ 24: j,
671
+ 25: M,
672
+ 26: N,
673
+ 27: P,
674
+ 28: F,
675
+ 29: I,
676
+ 32: 25,
677
+ 33: L,
678
+ 35: R,
679
+ 37: z,
680
+ 38: B,
681
+ 41: V,
682
+ 45: H,
683
+ 48: U,
684
+ 51: W,
685
+ 52: G,
686
+ 53: K,
687
+ 54: q,
688
+ 57: J
689
+ },
690
+ e(Y, [2, 20], { 20: [1, 73] }),
691
+ { 31: [1, 74] },
692
+ { 24: [1, 75] },
693
+ { 39: [1, 76] },
694
+ { 39: [1, 77] },
695
+ e(Y, [2, 34]),
696
+ e(Y, [2, 35]),
697
+ e(Y, [2, 36]),
698
+ e(Y, [2, 37]),
699
+ e(X, [2, 46]),
700
+ e(X, [2, 47]),
701
+ e(Y, [2, 15]),
702
+ e(Y, [2, 19]),
703
+ e(Z, w, { 7: 78 }),
704
+ e(Y, [2, 26]),
705
+ e(Y, [2, 27]),
706
+ { 5: [1, 79] },
707
+ { 5: [1, 80] },
708
+ {
709
+ 4: T,
710
+ 5: E,
711
+ 8: 8,
712
+ 9: 10,
713
+ 10: 12,
714
+ 11: 13,
715
+ 12: 14,
716
+ 13: 15,
717
+ 16: D,
718
+ 17: O,
719
+ 19: k,
720
+ 21: [1, 81],
721
+ 22: A,
722
+ 24: j,
723
+ 25: M,
724
+ 26: N,
725
+ 27: P,
726
+ 28: F,
727
+ 29: I,
728
+ 32: 25,
729
+ 33: L,
730
+ 35: R,
731
+ 37: z,
732
+ 38: B,
733
+ 41: V,
734
+ 45: H,
735
+ 48: U,
736
+ 51: W,
737
+ 52: G,
738
+ 53: K,
739
+ 54: q,
740
+ 57: J
741
+ },
742
+ e(Y, [2, 32]),
743
+ e(Y, [2, 33]),
744
+ e(Y, [2, 21])
745
+ ],
746
+ defaultActions: {
747
+ 5: [2, 1],
748
+ 6: [2, 2],
749
+ 47: [2, 48],
750
+ 48: [2, 49]
751
+ },
752
+ parseError: /* @__PURE__ */ __name(function(e, b) {
753
+ if (b.recoverable) this.trace(e);
754
+ else {
755
+ var x = Error(e);
756
+ throw x.hash = b, x;
757
+ }
758
+ }, "parseError"),
759
+ parse: /* @__PURE__ */ __name(function(e) {
760
+ var b = this, x = [0], C = [], w = [null], T = [], E = this.table, D = "", O = 0, k = 0, A = 0, j = 2, M = 1, N = T.slice.call(arguments, 1), P = Object.create(this.lexer), F = { yy: {} };
761
+ for (var I in this.yy) Object.prototype.hasOwnProperty.call(this.yy, I) && (F.yy[I] = this.yy[I]);
762
+ P.setInput(e, F.yy), F.yy.lexer = P, F.yy.parser = this, P.yylloc === void 0 && (P.yylloc = {});
763
+ var L = P.yylloc;
764
+ T.push(L);
765
+ var R = P.options && P.options.ranges;
766
+ typeof F.yy.parseError == "function" ? this.parseError = F.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
767
+ function z(e) {
768
+ x.length -= 2 * e, w.length -= e, T.length -= e;
769
+ }
770
+ __name(z, "popStack");
771
+ function B() {
772
+ var e = C.pop() || P.lex() || M;
773
+ return typeof e != "number" && (e instanceof Array && (C = e, e = C.pop()), e = b.symbols_[e] || e), e;
774
+ }
775
+ __name(B, "lex");
776
+ for (var V, H, U, W, G, K = {}, q, J, Y, X;;) {
777
+ if (U = x[x.length - 1], this.defaultActions[U] ? W = this.defaultActions[U] : (V ??= B(), W = E[U] && E[U][V]), W === void 0 || !W.length || !W[0]) {
778
+ var Z = "";
779
+ for (q in X = [], E[U]) this.terminals_[q] && q > j && X.push("'" + this.terminals_[q] + "'");
780
+ Z = P.showPosition ? "Parse error on line " + (O + 1) + ":\n" + P.showPosition() + "\nExpecting " + X.join(", ") + ", got '" + (this.terminals_[V] || V) + "'" : "Parse error on line " + (O + 1) + ": Unexpected " + (V == M ? "end of input" : "'" + (this.terminals_[V] || V) + "'"), this.parseError(Z, {
781
+ text: P.match,
782
+ token: this.terminals_[V] || V,
783
+ line: P.yylineno,
784
+ loc: L,
785
+ expected: X
786
+ });
787
+ }
788
+ if (W[0] instanceof Array && W.length > 1) throw Error("Parse Error: multiple actions possible at state: " + U + ", token: " + V);
789
+ switch (W[0]) {
790
+ case 1:
791
+ x.push(V), w.push(P.yytext), T.push(P.yylloc), x.push(W[1]), V = null, H ? (V = H, H = null) : (k = P.yyleng, D = P.yytext, O = P.yylineno, L = P.yylloc, A > 0 && A--);
792
+ break;
793
+ case 2:
794
+ if (J = this.productions_[W[1]][1], K.$ = w[w.length - J], K._$ = {
795
+ first_line: T[T.length - (J || 1)].first_line,
796
+ last_line: T[T.length - 1].last_line,
797
+ first_column: T[T.length - (J || 1)].first_column,
798
+ last_column: T[T.length - 1].last_column
799
+ }, R && (K._$.range = [T[T.length - (J || 1)].range[0], T[T.length - 1].range[1]]), G = this.performAction.apply(K, [
800
+ D,
801
+ k,
802
+ O,
803
+ F.yy,
804
+ W[1],
805
+ w,
806
+ T
807
+ ].concat(N)), G !== void 0) return G;
808
+ J && (x = x.slice(0, -1 * J * 2), w = w.slice(0, -1 * J), T = T.slice(0, -1 * J)), x.push(this.productions_[W[1]][0]), w.push(K.$), T.push(K._$), Y = E[x[x.length - 2]][x[x.length - 1]], x.push(Y);
809
+ break;
810
+ case 3: return !0;
811
+ }
812
+ }
813
+ return !0;
814
+ }, "parse")
815
+ };
816
+ Q.lexer = /* @__PURE__ */ (function() {
817
+ return {
818
+ EOF: 1,
819
+ parseError: /* @__PURE__ */ __name(function(e, b) {
820
+ if (this.yy.parser) this.yy.parser.parseError(e, b);
821
+ else throw Error(e);
822
+ }, "parseError"),
823
+ setInput: /* @__PURE__ */ __name(function(e, b) {
824
+ return this.yy = b || this.yy || {}, this._input = e, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
825
+ first_line: 1,
826
+ first_column: 0,
827
+ last_line: 1,
828
+ last_column: 0
829
+ }, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
830
+ }, "setInput"),
831
+ input: /* @__PURE__ */ __name(function() {
832
+ var e = this._input[0];
833
+ return this.yytext += e, this.yyleng++, this.offset++, this.match += e, this.matched += e, e.match(/(?:\r\n?|\n).*/g) ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), e;
834
+ }, "input"),
835
+ unput: /* @__PURE__ */ __name(function(e) {
836
+ var b = e.length, x = e.split(/(?:\r\n?|\n)/g);
837
+ this._input = e + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - b), this.offset -= b;
838
+ var S = this.match.split(/(?:\r\n?|\n)/g);
839
+ this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), x.length - 1 && (this.yylineno -= x.length - 1);
840
+ var C = this.yylloc.range;
841
+ return this.yylloc = {
842
+ first_line: this.yylloc.first_line,
843
+ last_line: this.yylineno + 1,
844
+ first_column: this.yylloc.first_column,
845
+ last_column: x ? (x.length === S.length ? this.yylloc.first_column : 0) + S[S.length - x.length].length - x[0].length : this.yylloc.first_column - b
846
+ }, this.options.ranges && (this.yylloc.range = [C[0], C[0] + this.yyleng - b]), this.yyleng = this.yytext.length, this;
847
+ }, "unput"),
848
+ more: /* @__PURE__ */ __name(function() {
849
+ return this._more = !0, this;
850
+ }, "more"),
851
+ reject: /* @__PURE__ */ __name(function() {
852
+ if (this.options.backtrack_lexer) this._backtrack = !0;
853
+ 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(), {
854
+ text: "",
855
+ token: null,
856
+ line: this.yylineno
857
+ });
858
+ return this;
859
+ }, "reject"),
860
+ less: /* @__PURE__ */ __name(function(e) {
861
+ this.unput(this.match.slice(e));
862
+ }, "less"),
863
+ pastInput: /* @__PURE__ */ __name(function() {
864
+ var e = this.matched.substr(0, this.matched.length - this.match.length);
865
+ return (e.length > 20 ? "..." : "") + e.substr(-20).replace(/\n/g, "");
866
+ }, "pastInput"),
867
+ upcomingInput: /* @__PURE__ */ __name(function() {
868
+ var e = this.match;
869
+ return e.length < 20 && (e += this._input.substr(0, 20 - e.length)), (e.substr(0, 20) + (e.length > 20 ? "..." : "")).replace(/\n/g, "");
870
+ }, "upcomingInput"),
871
+ showPosition: /* @__PURE__ */ __name(function() {
872
+ var e = this.pastInput(), b = Array(e.length + 1).join("-");
873
+ return e + this.upcomingInput() + "\n" + b + "^";
874
+ }, "showPosition"),
875
+ test_match: /* @__PURE__ */ __name(function(e, b) {
876
+ var x, S, C;
877
+ if (this.options.backtrack_lexer && (C = {
878
+ yylineno: this.yylineno,
879
+ yylloc: {
880
+ first_line: this.yylloc.first_line,
881
+ last_line: this.last_line,
882
+ first_column: this.yylloc.first_column,
883
+ last_column: this.yylloc.last_column
884
+ },
885
+ yytext: this.yytext,
886
+ match: this.match,
887
+ matches: this.matches,
888
+ matched: this.matched,
889
+ yyleng: this.yyleng,
890
+ offset: this.offset,
891
+ _more: this._more,
892
+ _input: this._input,
893
+ yy: this.yy,
894
+ conditionStack: this.conditionStack.slice(0),
895
+ done: this.done
896
+ }, this.options.ranges && (C.yylloc.range = this.yylloc.range.slice(0))), S = e[0].match(/(?:\r\n?|\n).*/g), S && (this.yylineno += S.length), this.yylloc = {
897
+ first_line: this.yylloc.last_line,
898
+ last_line: this.yylineno + 1,
899
+ first_column: this.yylloc.last_column,
900
+ last_column: S ? S[S.length - 1].length - S[S.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + e[0].length
901
+ }, this.yytext += e[0], this.match += e[0], this.matches = e, 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(e[0].length), this.matched += e[0], x = this.performAction.call(this, this.yy, this, b, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), x) return x;
902
+ if (this._backtrack) {
903
+ for (var w in C) this[w] = C[w];
904
+ return !1;
905
+ }
906
+ return !1;
907
+ }, "test_match"),
908
+ next: /* @__PURE__ */ __name(function() {
909
+ if (this.done) return this.EOF;
910
+ this._input || (this.done = !0);
911
+ var e, b, x, S;
912
+ this._more || (this.yytext = "", this.match = "");
913
+ for (var C = this._currentRules(), w = 0; w < C.length; w++) if (x = this._input.match(this.rules[C[w]]), x && (!b || x[0].length > b[0].length)) {
914
+ if (b = x, S = w, this.options.backtrack_lexer) {
915
+ if (e = this.test_match(x, C[w]), e !== !1) return e;
916
+ if (this._backtrack) {
917
+ b = !1;
918
+ continue;
919
+ } else return !1;
920
+ } else if (!this.options.flex) break;
921
+ }
922
+ return b ? (e = this.test_match(b, C[S]), e === !1 ? !1 : e) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
923
+ text: "",
924
+ token: null,
925
+ line: this.yylineno
926
+ });
927
+ }, "next"),
928
+ lex: /* @__PURE__ */ __name(function() {
929
+ return this.next() || this.lex();
930
+ }, "lex"),
931
+ begin: /* @__PURE__ */ __name(function(e) {
932
+ this.conditionStack.push(e);
933
+ }, "begin"),
934
+ popState: /* @__PURE__ */ __name(function() {
935
+ return this.conditionStack.length - 1 > 0 ? this.conditionStack.pop() : this.conditionStack[0];
936
+ }, "popState"),
937
+ _currentRules: /* @__PURE__ */ __name(function() {
938
+ return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
939
+ }, "_currentRules"),
940
+ topState: /* @__PURE__ */ __name(function(e) {
941
+ return e = this.conditionStack.length - 1 - Math.abs(e || 0), e >= 0 ? this.conditionStack[e] : "INITIAL";
942
+ }, "topState"),
943
+ pushState: /* @__PURE__ */ __name(function(e) {
944
+ this.begin(e);
945
+ }, "pushState"),
946
+ stateStackSize: /* @__PURE__ */ __name(function() {
947
+ return this.conditionStack.length;
948
+ }, "stateStackSize"),
949
+ options: { "case-insensitive": !0 },
950
+ performAction: /* @__PURE__ */ __name(function(e, b, x, S) {
951
+ switch (x) {
952
+ case 0: return 38;
953
+ case 1: return 40;
954
+ case 2: return 39;
955
+ case 3: return 44;
956
+ case 4: return 51;
957
+ case 5: return 52;
958
+ case 6: return 53;
959
+ case 7: return 54;
960
+ case 8: break;
961
+ case 9: break;
962
+ case 10: return 5;
963
+ case 11: break;
964
+ case 12: break;
965
+ case 13: break;
966
+ case 14: break;
967
+ case 15: return this.pushState("SCALE"), 17;
968
+ case 16: return 18;
969
+ case 17:
970
+ this.popState();
971
+ break;
972
+ case 18: return this.begin("acc_title"), 33;
973
+ case 19: return this.popState(), "acc_title_value";
974
+ case 20: return this.begin("acc_descr"), 35;
975
+ case 21: return this.popState(), "acc_descr_value";
976
+ case 22:
977
+ this.begin("acc_descr_multiline");
978
+ break;
979
+ case 23:
980
+ this.popState();
981
+ break;
982
+ case 24: return "acc_descr_multiline_value";
983
+ case 25: return this.pushState("CLASSDEF"), 41;
984
+ case 26: return this.popState(), this.pushState("CLASSDEFID"), "DEFAULT_CLASSDEF_ID";
985
+ case 27: return this.popState(), this.pushState("CLASSDEFID"), 42;
986
+ case 28: return this.popState(), 43;
987
+ case 29: return this.pushState("CLASS"), 48;
988
+ case 30: return this.popState(), this.pushState("CLASS_STYLE"), 49;
989
+ case 31: return this.popState(), 50;
990
+ case 32: return this.pushState("STYLE"), 45;
991
+ case 33: return this.popState(), this.pushState("STYLEDEF_STYLES"), 46;
992
+ case 34: return this.popState(), 47;
993
+ case 35: return this.pushState("SCALE"), 17;
994
+ case 36: return 18;
995
+ case 37:
996
+ this.popState();
997
+ break;
998
+ case 38:
999
+ this.pushState("STATE");
1000
+ break;
1001
+ case 39: return this.popState(), b.yytext = b.yytext.slice(0, -8).trim(), 25;
1002
+ case 40: return this.popState(), b.yytext = b.yytext.slice(0, -8).trim(), 26;
1003
+ case 41: return this.popState(), b.yytext = b.yytext.slice(0, -10).trim(), 27;
1004
+ case 42: return this.popState(), b.yytext = b.yytext.slice(0, -8).trim(), 25;
1005
+ case 43: return this.popState(), b.yytext = b.yytext.slice(0, -8).trim(), 26;
1006
+ case 44: return this.popState(), b.yytext = b.yytext.slice(0, -10).trim(), 27;
1007
+ case 45: return 51;
1008
+ case 46: return 52;
1009
+ case 47: return 53;
1010
+ case 48: return 54;
1011
+ case 49:
1012
+ this.pushState("STATE_STRING");
1013
+ break;
1014
+ case 50: return this.pushState("STATE_ID"), "AS";
1015
+ case 51: return this.popState(), "ID";
1016
+ case 52:
1017
+ this.popState();
1018
+ break;
1019
+ case 53: return "STATE_DESCR";
1020
+ case 54: return 19;
1021
+ case 55:
1022
+ this.popState();
1023
+ break;
1024
+ case 56: return this.popState(), this.pushState("struct"), 20;
1025
+ case 57: break;
1026
+ case 58: return this.popState(), 21;
1027
+ case 59: break;
1028
+ case 60: return this.begin("NOTE"), 29;
1029
+ case 61: return this.popState(), this.pushState("NOTE_ID"), 59;
1030
+ case 62: return this.popState(), this.pushState("NOTE_ID"), 60;
1031
+ case 63:
1032
+ this.popState(), this.pushState("FLOATING_NOTE");
1033
+ break;
1034
+ case 64: return this.popState(), this.pushState("FLOATING_NOTE_ID"), "AS";
1035
+ case 65: break;
1036
+ case 66: return "NOTE_TEXT";
1037
+ case 67: return this.popState(), "ID";
1038
+ case 68: return this.popState(), this.pushState("NOTE_TEXT"), 24;
1039
+ case 69: return this.popState(), b.yytext = b.yytext.substr(2).trim(), 31;
1040
+ case 70: return this.popState(), b.yytext = b.yytext.slice(0, -8).trim(), 31;
1041
+ case 71: return 6;
1042
+ case 72: return 6;
1043
+ case 73: return 16;
1044
+ case 74: return 57;
1045
+ case 75: return 24;
1046
+ case 76: return b.yytext = b.yytext.trim(), 14;
1047
+ case 77: return 15;
1048
+ case 78: return 28;
1049
+ case 79: return 58;
1050
+ case 80: return 5;
1051
+ case 81: return "INVALID";
1052
+ }
1053
+ }, "anonymous"),
1054
+ rules: [
1055
+ /^(?:click\b)/i,
1056
+ /^(?:href\b)/i,
1057
+ /^(?:"[^"]*")/i,
1058
+ /^(?:default\b)/i,
1059
+ /^(?:.*direction\s+TB[^\n]*)/i,
1060
+ /^(?:.*direction\s+BT[^\n]*)/i,
1061
+ /^(?:.*direction\s+RL[^\n]*)/i,
1062
+ /^(?:.*direction\s+LR[^\n]*)/i,
1063
+ /^(?:%%(?!\{)[^\n]*)/i,
1064
+ /^(?:[^\}]%%[^\n]*)/i,
1065
+ /^(?:[\n]+)/i,
1066
+ /^(?:[\s]+)/i,
1067
+ /^(?:((?!\n)\s)+)/i,
1068
+ /^(?:#[^\n]*)/i,
1069
+ /^(?:%[^\n]*)/i,
1070
+ /^(?:scale\s+)/i,
1071
+ /^(?:\d+)/i,
1072
+ /^(?:\s+width\b)/i,
1073
+ /^(?:accTitle\s*:\s*)/i,
1074
+ /^(?:(?!\n||)*[^\n]*)/i,
1075
+ /^(?:accDescr\s*:\s*)/i,
1076
+ /^(?:(?!\n||)*[^\n]*)/i,
1077
+ /^(?:accDescr\s*\{\s*)/i,
1078
+ /^(?:[\}])/i,
1079
+ /^(?:[^\}]*)/i,
1080
+ /^(?:classDef\s+)/i,
1081
+ /^(?:DEFAULT\s+)/i,
1082
+ /^(?:\w+\s+)/i,
1083
+ /^(?:[^\n]*)/i,
1084
+ /^(?:class\s+)/i,
1085
+ /^(?:(\w+)+((,\s*\w+)*))/i,
1086
+ /^(?:[^\n]*)/i,
1087
+ /^(?:style\s+)/i,
1088
+ /^(?:[\w,]+\s+)/i,
1089
+ /^(?:[^\n]*)/i,
1090
+ /^(?:scale\s+)/i,
1091
+ /^(?:\d+)/i,
1092
+ /^(?:\s+width\b)/i,
1093
+ /^(?:state\s+)/i,
1094
+ /^(?:.*<<fork>>)/i,
1095
+ /^(?:.*<<join>>)/i,
1096
+ /^(?:.*<<choice>>)/i,
1097
+ /^(?:.*\[\[fork\]\])/i,
1098
+ /^(?:.*\[\[join\]\])/i,
1099
+ /^(?:.*\[\[choice\]\])/i,
1100
+ /^(?:.*direction\s+TB[^\n]*)/i,
1101
+ /^(?:.*direction\s+BT[^\n]*)/i,
1102
+ /^(?:.*direction\s+RL[^\n]*)/i,
1103
+ /^(?:.*direction\s+LR[^\n]*)/i,
1104
+ /^(?:["])/i,
1105
+ /^(?:\s*as\s+)/i,
1106
+ /^(?:[^\n\{]*)/i,
1107
+ /^(?:["])/i,
1108
+ /^(?:[^"]*)/i,
1109
+ /^(?:[^\n\s\{]+)/i,
1110
+ /^(?:\n)/i,
1111
+ /^(?:\{)/i,
1112
+ /^(?:%%(?!\{)[^\n]*)/i,
1113
+ /^(?:\})/i,
1114
+ /^(?:[\n])/i,
1115
+ /^(?:note\s+)/i,
1116
+ /^(?:left of\b)/i,
1117
+ /^(?:right of\b)/i,
1118
+ /^(?:")/i,
1119
+ /^(?:\s*as\s*)/i,
1120
+ /^(?:["])/i,
1121
+ /^(?:[^"]*)/i,
1122
+ /^(?:[^\n]*)/i,
1123
+ /^(?:\s*[^:\n\s\-]+)/i,
1124
+ /^(?:\s*:[^:\n;]+)/i,
1125
+ /^(?:[\s\S]*?end note\b)/i,
1126
+ /^(?:stateDiagram\s+)/i,
1127
+ /^(?:stateDiagram-v2\s+)/i,
1128
+ /^(?:hide empty description\b)/i,
1129
+ /^(?:\[\*\])/i,
1130
+ /^(?:[^:\n\s\-\{]+)/i,
1131
+ /^(?:\s*:[^:\n;]+)/i,
1132
+ /^(?:-->)/i,
1133
+ /^(?:--)/i,
1134
+ /^(?::::)/i,
1135
+ /^(?:$)/i,
1136
+ /^(?:.)/i
1137
+ ],
1138
+ conditions: {
1139
+ LINE: {
1140
+ rules: [12, 13],
1141
+ inclusive: !1
1142
+ },
1143
+ struct: {
1144
+ rules: [
1145
+ 12,
1146
+ 13,
1147
+ 25,
1148
+ 29,
1149
+ 32,
1150
+ 38,
1151
+ 45,
1152
+ 46,
1153
+ 47,
1154
+ 48,
1155
+ 57,
1156
+ 58,
1157
+ 59,
1158
+ 60,
1159
+ 74,
1160
+ 75,
1161
+ 76,
1162
+ 77,
1163
+ 78
1164
+ ],
1165
+ inclusive: !1
1166
+ },
1167
+ FLOATING_NOTE_ID: {
1168
+ rules: [67],
1169
+ inclusive: !1
1170
+ },
1171
+ FLOATING_NOTE: {
1172
+ rules: [
1173
+ 64,
1174
+ 65,
1175
+ 66
1176
+ ],
1177
+ inclusive: !1
1178
+ },
1179
+ NOTE_TEXT: {
1180
+ rules: [69, 70],
1181
+ inclusive: !1
1182
+ },
1183
+ NOTE_ID: {
1184
+ rules: [68],
1185
+ inclusive: !1
1186
+ },
1187
+ NOTE: {
1188
+ rules: [
1189
+ 61,
1190
+ 62,
1191
+ 63
1192
+ ],
1193
+ inclusive: !1
1194
+ },
1195
+ STYLEDEF_STYLEOPTS: {
1196
+ rules: [],
1197
+ inclusive: !1
1198
+ },
1199
+ STYLEDEF_STYLES: {
1200
+ rules: [34],
1201
+ inclusive: !1
1202
+ },
1203
+ STYLE_IDS: {
1204
+ rules: [],
1205
+ inclusive: !1
1206
+ },
1207
+ STYLE: {
1208
+ rules: [33],
1209
+ inclusive: !1
1210
+ },
1211
+ CLASS_STYLE: {
1212
+ rules: [31],
1213
+ inclusive: !1
1214
+ },
1215
+ CLASS: {
1216
+ rules: [30],
1217
+ inclusive: !1
1218
+ },
1219
+ CLASSDEFID: {
1220
+ rules: [28],
1221
+ inclusive: !1
1222
+ },
1223
+ CLASSDEF: {
1224
+ rules: [26, 27],
1225
+ inclusive: !1
1226
+ },
1227
+ acc_descr_multiline: {
1228
+ rules: [23, 24],
1229
+ inclusive: !1
1230
+ },
1231
+ acc_descr: {
1232
+ rules: [21],
1233
+ inclusive: !1
1234
+ },
1235
+ acc_title: {
1236
+ rules: [19],
1237
+ inclusive: !1
1238
+ },
1239
+ SCALE: {
1240
+ rules: [
1241
+ 16,
1242
+ 17,
1243
+ 36,
1244
+ 37
1245
+ ],
1246
+ inclusive: !1
1247
+ },
1248
+ ALIAS: {
1249
+ rules: [],
1250
+ inclusive: !1
1251
+ },
1252
+ STATE_ID: {
1253
+ rules: [51],
1254
+ inclusive: !1
1255
+ },
1256
+ STATE_STRING: {
1257
+ rules: [52, 53],
1258
+ inclusive: !1
1259
+ },
1260
+ FORK_STATE: {
1261
+ rules: [],
1262
+ inclusive: !1
1263
+ },
1264
+ STATE: {
1265
+ rules: [
1266
+ 12,
1267
+ 13,
1268
+ 39,
1269
+ 40,
1270
+ 41,
1271
+ 42,
1272
+ 43,
1273
+ 44,
1274
+ 49,
1275
+ 50,
1276
+ 54,
1277
+ 55,
1278
+ 56
1279
+ ],
1280
+ inclusive: !1
1281
+ },
1282
+ ID: {
1283
+ rules: [12, 13],
1284
+ inclusive: !1
1285
+ },
1286
+ INITIAL: {
1287
+ rules: [
1288
+ 0,
1289
+ 1,
1290
+ 2,
1291
+ 3,
1292
+ 4,
1293
+ 5,
1294
+ 6,
1295
+ 7,
1296
+ 8,
1297
+ 9,
1298
+ 10,
1299
+ 11,
1300
+ 13,
1301
+ 14,
1302
+ 15,
1303
+ 18,
1304
+ 20,
1305
+ 22,
1306
+ 25,
1307
+ 29,
1308
+ 32,
1309
+ 35,
1310
+ 38,
1311
+ 56,
1312
+ 60,
1313
+ 71,
1314
+ 72,
1315
+ 73,
1316
+ 74,
1317
+ 75,
1318
+ 76,
1319
+ 77,
1320
+ 79,
1321
+ 80,
1322
+ 81
1323
+ ],
1324
+ inclusive: !0
1325
+ }
1326
+ }
1327
+ };
1328
+ })();
1329
+ function $() {
1330
+ this.yy = {};
1331
+ }
1332
+ return __name($, "Parser"), $.prototype = Q, Q.Parser = $, new $();
1333
+ })();
1334
+ parser.parser = parser;
1335
+ var stateDiagram_default = parser, DEFAULT_DIAGRAM_DIRECTION = "TB", DEFAULT_NESTED_DOC_DIR = "TB", STMT_DIRECTION = "dir", STMT_STATE = "state", STMT_ROOT = "root", STMT_RELATION = "relation", STMT_CLASSDEF = "classDef", STMT_STYLEDEF = "style", STMT_APPLYCLASS = "applyClass", DEFAULT_STATE_TYPE = "default", DIVIDER_TYPE = "divider", G_EDGE_STYLE = "fill:none", G_EDGE_ARROWHEADSTYLE = "fill: #333", G_EDGE_LABELPOS = "c", G_EDGE_LABELTYPE = "text", G_EDGE_THICKNESS = "normal", SHAPE_STATE = "rect", SHAPE_STATE_WITH_DESC = "rectWithTitle", SHAPE_START = "stateStart", SHAPE_END = "stateEnd", SHAPE_DIVIDER = "divider", SHAPE_GROUP = "roundedWithTitle", SHAPE_NOTE = "note", SHAPE_NOTEGROUP = "noteGroup", CSS_DIAGRAM = "statediagram", CSS_DIAGRAM_STATE = `${CSS_DIAGRAM}-state`, CSS_EDGE = "transition", CSS_NOTE = "note", CSS_EDGE_NOTE_EDGE = `${CSS_EDGE} note-edge`, CSS_DIAGRAM_NOTE = `${CSS_DIAGRAM}-${CSS_NOTE}`, CSS_DIAGRAM_CLUSTER = `${CSS_DIAGRAM}-cluster`, CSS_DIAGRAM_CLUSTER_ALT = `${CSS_DIAGRAM}-cluster-alt`, PARENT = "parent", NOTE = "note", DOMID_STATE = "state", DOMID_TYPE_SPACER = "----", NOTE_ID = `${DOMID_TYPE_SPACER}${NOTE}`, PARENT_ID = `${DOMID_TYPE_SPACER}${PARENT}`, getDir = /* @__PURE__ */ __name((e, b = DEFAULT_NESTED_DOC_DIR) => {
1336
+ if (!e.doc) return b;
1337
+ let x = b;
1338
+ for (let b of e.doc) b.stmt === "dir" && (x = b.value);
1339
+ return x;
1340
+ }, "getDir"), stateRenderer_v3_unified_default = {
1341
+ getClasses: /* @__PURE__ */ __name(function(e, b) {
1342
+ return b.db.getClasses();
1343
+ }, "getClasses"),
1344
+ draw: /* @__PURE__ */ __name(async function(b, S, C, w) {
1345
+ log.info("REF0:"), log.info("Drawing state diagram (v2)", S);
1346
+ let { securityLevel: T, state: E, layout: D } = getConfig2();
1347
+ w.db.extract(w.db.getRootDocV2());
1348
+ let k = w.db.getData(), A = getDiagramElement(S, T);
1349
+ k.type = w.type, k.layoutAlgorithm = D, k.nodeSpacing = E?.nodeSpacing || 50, k.rankSpacing = E?.rankSpacing || 50, k.markers = ["barb"], k.diagramId = S, await render(k, A);
1350
+ try {
1351
+ (typeof w.db.getLinks == "function" ? w.db.getLinks() : /* @__PURE__ */ new Map()).forEach((e, b) => {
1352
+ let S = typeof b == "string" ? b : typeof b?.id == "string" ? b.id : "";
1353
+ if (!S) {
1354
+ log.warn("⚠️ Invalid or missing stateId from key:", JSON.stringify(b));
1355
+ return;
1356
+ }
1357
+ let C = A.node()?.querySelectorAll("g"), w;
1358
+ if (C?.forEach((e) => {
1359
+ e.textContent?.trim() === S && (w = e);
1360
+ }), !w) {
1361
+ log.warn("⚠️ Could not find node matching text:", S);
1362
+ return;
1363
+ }
1364
+ let T = w.parentNode;
1365
+ if (!T) {
1366
+ log.warn("⚠️ Node has no parent, cannot wrap:", S);
1367
+ return;
1368
+ }
1369
+ let E = document.createElementNS("http://www.w3.org/2000/svg", "a"), D = e.url.replace(/^"+|"+$/g, "");
1370
+ if (E.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", D), E.setAttribute("target", "_blank"), e.tooltip) {
1371
+ let b = e.tooltip.replace(/^"+|"+$/g, "");
1372
+ E.setAttribute("title", b);
1373
+ }
1374
+ T.replaceChild(E, w), E.appendChild(w), log.info("🔗 Wrapped node in <a> tag for:", S, e.url);
1375
+ });
1376
+ } catch (e) {
1377
+ log.error("❌ Error injecting clickable links:", e);
1378
+ }
1379
+ utils_default.insertTitle(A, "statediagramTitleText", E?.titleTopMargin ?? 25, w.db.getDiagramTitle()), setupViewPortForSVG(A, 8, CSS_DIAGRAM, E?.useMaxWidth ?? !0);
1380
+ }, "draw"),
1381
+ getDir
1382
+ }, nodeDb = /* @__PURE__ */ new Map(), graphItemCount = 0;
1383
+ function stateDomId(e = "", b = 0, x = "", S = DOMID_TYPE_SPACER) {
1384
+ return `${DOMID_STATE}-${e}${x !== null && x.length > 0 ? `${S}${x}` : ""}-${b}`;
1385
+ }
1386
+ __name(stateDomId, "stateDomId");
1387
+ var setupDoc = /* @__PURE__ */ __name((e, b, S, C, w, T, E, D) => {
1388
+ log.trace("items", b), b.forEach((b) => {
1389
+ switch (b.stmt) {
1390
+ case STMT_STATE:
1391
+ dataFetcher(e, b, S, C, w, T, E, D);
1392
+ break;
1393
+ case DEFAULT_STATE_TYPE:
1394
+ dataFetcher(e, b, S, C, w, T, E, D);
1395
+ break;
1396
+ case STMT_RELATION:
1397
+ {
1398
+ dataFetcher(e, b.state1, S, C, w, T, E, D), dataFetcher(e, b.state2, S, C, w, T, E, D);
1399
+ let x = {
1400
+ id: "edge" + graphItemCount,
1401
+ start: b.state1.id,
1402
+ end: b.state2.id,
1403
+ arrowhead: "normal",
1404
+ arrowTypeEnd: "arrow_barb",
1405
+ style: G_EDGE_STYLE,
1406
+ labelStyle: "",
1407
+ label: common_default.sanitizeText(b.description ?? "", getConfig2()),
1408
+ arrowheadStyle: G_EDGE_ARROWHEADSTYLE,
1409
+ labelpos: G_EDGE_LABELPOS,
1410
+ labelType: G_EDGE_LABELTYPE,
1411
+ thickness: G_EDGE_THICKNESS,
1412
+ classes: CSS_EDGE,
1413
+ look: E
1414
+ };
1415
+ w.push(x), graphItemCount++;
1416
+ }
1417
+ break;
1418
+ }
1419
+ });
1420
+ }, "setupDoc"), getDir2 = /* @__PURE__ */ __name((e, b = DEFAULT_NESTED_DOC_DIR) => {
1421
+ let x = b;
1422
+ if (e.doc) for (let b of e.doc) b.stmt === "dir" && (x = b.value);
1423
+ return x;
1424
+ }, "getDir");
1425
+ function insertOrUpdateNode(e, b, x) {
1426
+ if (!b.id || b.id === "</join></fork>" || b.id === "</choice>") return;
1427
+ b.cssClasses && (Array.isArray(b.cssCompiledStyles) || (b.cssCompiledStyles = []), b.cssClasses.split(" ").forEach((e) => {
1428
+ let S = x.get(e);
1429
+ S && (b.cssCompiledStyles = [...b.cssCompiledStyles ?? [], ...S.styles]);
1430
+ }));
1431
+ let S = e.find((e) => e.id === b.id);
1432
+ S ? Object.assign(S, b) : e.push(b);
1433
+ }
1434
+ __name(insertOrUpdateNode, "insertOrUpdateNode");
1435
+ function getClassesFromDbInfo(e) {
1436
+ return e?.classes?.join(" ") ?? "";
1437
+ }
1438
+ __name(getClassesFromDbInfo, "getClassesFromDbInfo");
1439
+ function getStylesFromDbInfo(e) {
1440
+ return e?.styles ?? [];
1441
+ }
1442
+ __name(getStylesFromDbInfo, "getStylesFromDbInfo");
1443
+ var dataFetcher = /* @__PURE__ */ __name((e, b, S, C, w, T, E, D) => {
1444
+ let A = b.id, j = S.get(A), M = getClassesFromDbInfo(j), N = getStylesFromDbInfo(j), P = getConfig2();
1445
+ if (log.info("dataFetcher parsedItem", b, j, N), A !== "root") {
1446
+ let S = SHAPE_STATE;
1447
+ b.start === !0 ? S = SHAPE_START : b.start === !1 && (S = SHAPE_END), b.type !== DEFAULT_STATE_TYPE && (S = b.type), nodeDb.get(A) || nodeDb.set(A, {
1448
+ id: A,
1449
+ shape: S,
1450
+ description: common_default.sanitizeText(A, P),
1451
+ cssClasses: `${M} ${CSS_DIAGRAM_STATE}`,
1452
+ cssStyles: N
1453
+ });
1454
+ let O = nodeDb.get(A);
1455
+ b.description && (Array.isArray(O.description) ? (O.shape = SHAPE_STATE_WITH_DESC, O.description.push(b.description)) : O.description?.length && O.description.length > 0 ? (O.shape = SHAPE_STATE_WITH_DESC, O.description === A ? O.description = [b.description] : O.description = [O.description, b.description]) : (O.shape = SHAPE_STATE, O.description = b.description), O.description = common_default.sanitizeTextOrArray(O.description, P)), O.description?.length === 1 && O.shape === SHAPE_STATE_WITH_DESC && (O.type === "group" ? O.shape = SHAPE_GROUP : O.shape = SHAPE_STATE), !O.type && b.doc && (log.info("Setting cluster for XCX", A, getDir2(b)), O.type = "group", O.isGroup = !0, O.dir = getDir2(b), O.shape = b.type === DIVIDER_TYPE ? SHAPE_DIVIDER : SHAPE_GROUP, O.cssClasses = `${O.cssClasses} ${CSS_DIAGRAM_CLUSTER} ${T ? CSS_DIAGRAM_CLUSTER_ALT : ""}`);
1456
+ let j = {
1457
+ labelStyle: "",
1458
+ shape: O.shape,
1459
+ label: O.description,
1460
+ cssClasses: O.cssClasses,
1461
+ cssCompiledStyles: [],
1462
+ cssStyles: O.cssStyles,
1463
+ id: A,
1464
+ dir: O.dir,
1465
+ domId: stateDomId(A, graphItemCount),
1466
+ type: O.type,
1467
+ isGroup: O.type === "group",
1468
+ padding: 8,
1469
+ rx: 10,
1470
+ ry: 10,
1471
+ look: E
1472
+ };
1473
+ if (j.shape === SHAPE_DIVIDER && (j.label = ""), e && e.id !== "root" && (log.trace("Setting node ", A, " to be child of its parent ", e.id), j.parentId = e.id), j.centerLabel = !0, b.note) {
1474
+ let e = {
1475
+ labelStyle: "",
1476
+ shape: SHAPE_NOTE,
1477
+ label: b.note.text,
1478
+ cssClasses: CSS_DIAGRAM_NOTE,
1479
+ cssStyles: [],
1480
+ cssCompiledStyles: [],
1481
+ id: A + NOTE_ID + "-" + graphItemCount,
1482
+ domId: stateDomId(A, graphItemCount, NOTE),
1483
+ type: O.type,
1484
+ isGroup: O.type === "group",
1485
+ padding: P.flowchart?.padding,
1486
+ look: E,
1487
+ position: b.note.position
1488
+ }, x = A + PARENT_ID, S = {
1489
+ labelStyle: "",
1490
+ shape: SHAPE_NOTEGROUP,
1491
+ label: b.note.text,
1492
+ cssClasses: O.cssClasses,
1493
+ cssStyles: [],
1494
+ id: A + PARENT_ID,
1495
+ domId: stateDomId(A, graphItemCount, PARENT),
1496
+ type: "group",
1497
+ isGroup: !0,
1498
+ padding: 16,
1499
+ look: E,
1500
+ position: b.note.position
1501
+ };
1502
+ graphItemCount++, S.id = x, e.parentId = x, insertOrUpdateNode(C, S, D), insertOrUpdateNode(C, e, D), insertOrUpdateNode(C, j, D);
1503
+ let T = A, k = e.id;
1504
+ b.note.position === "left of" && (T = e.id, k = A), w.push({
1505
+ id: T + "-" + k,
1506
+ start: T,
1507
+ end: k,
1508
+ arrowhead: "none",
1509
+ arrowTypeEnd: "",
1510
+ style: G_EDGE_STYLE,
1511
+ labelStyle: "",
1512
+ classes: CSS_EDGE_NOTE_EDGE,
1513
+ arrowheadStyle: G_EDGE_ARROWHEADSTYLE,
1514
+ labelpos: G_EDGE_LABELPOS,
1515
+ labelType: G_EDGE_LABELTYPE,
1516
+ thickness: G_EDGE_THICKNESS,
1517
+ look: E
1518
+ });
1519
+ } else insertOrUpdateNode(C, j, D);
1520
+ }
1521
+ b.doc && (log.trace("Adding nodes children "), setupDoc(b, b.doc, S, C, w, !T, E, D));
1522
+ }, "dataFetcher"), reset = /* @__PURE__ */ __name(() => {
1523
+ nodeDb.clear(), graphItemCount = 0;
1524
+ }, "reset"), CONSTANTS = {
1525
+ START_NODE: "[*]",
1526
+ START_TYPE: "start",
1527
+ END_NODE: "[*]",
1528
+ END_TYPE: "end",
1529
+ COLOR_KEYWORD: "color",
1530
+ FILL_KEYWORD: "fill",
1531
+ BG_FILL: "bgFill",
1532
+ STYLECLASS_SEP: ","
1533
+ }, newClassesList = /* @__PURE__ */ __name(() => /* @__PURE__ */ new Map(), "newClassesList"), newDoc = /* @__PURE__ */ __name(() => ({
1534
+ relations: [],
1535
+ states: /* @__PURE__ */ new Map(),
1536
+ documents: {}
1537
+ }), "newDoc"), clone = /* @__PURE__ */ __name((e) => JSON.parse(JSON.stringify(e)), "clone"), StateDB = class {
1538
+ constructor(e) {
1539
+ this.version = e, this.nodes = [], this.edges = [], this.rootDoc = [], this.classes = newClassesList(), this.documents = { root: newDoc() }, this.currentDocument = this.documents.root, this.startEndCount = 0, this.dividerCnt = 0, this.links = /* @__PURE__ */ new Map(), this.getAccTitle = getAccTitle, this.setAccTitle = setAccTitle, this.getAccDescription = getAccDescription, this.setAccDescription = setAccDescription, this.setDiagramTitle = setDiagramTitle, this.getDiagramTitle = getDiagramTitle, this.clear(), this.setRootDoc = this.setRootDoc.bind(this), this.getDividerId = this.getDividerId.bind(this), this.setDirection = this.setDirection.bind(this), this.trimColon = this.trimColon.bind(this);
1540
+ }
1541
+ static #_ = __name(this, "StateDB");
1542
+ static #_2 = this.relationType = {
1543
+ AGGREGATION: 0,
1544
+ EXTENSION: 1,
1545
+ COMPOSITION: 2,
1546
+ DEPENDENCY: 3
1547
+ };
1548
+ extract(e) {
1549
+ this.clear(!0);
1550
+ for (let b of Array.isArray(e) ? e : e.doc) switch (b.stmt) {
1551
+ case STMT_STATE:
1552
+ this.addState(b.id.trim(), b.type, b.doc, b.description, b.note);
1553
+ break;
1554
+ case STMT_RELATION:
1555
+ this.addRelation(b.state1, b.state2, b.description);
1556
+ break;
1557
+ case STMT_CLASSDEF:
1558
+ this.addStyleClass(b.id.trim(), b.classes);
1559
+ break;
1560
+ case STMT_STYLEDEF:
1561
+ this.handleStyleDef(b);
1562
+ break;
1563
+ case STMT_APPLYCLASS:
1564
+ this.setCssClass(b.id.trim(), b.styleClass);
1565
+ break;
1566
+ case "click":
1567
+ this.addLink(b.id, b.url, b.tooltip);
1568
+ break;
1569
+ }
1570
+ let b = this.getStates(), x = getConfig2();
1571
+ reset(), dataFetcher(void 0, this.getRootDocV2(), b, this.nodes, this.edges, !0, x.look, this.classes);
1572
+ for (let e of this.nodes) if (Array.isArray(e.label)) {
1573
+ if (e.description = e.label.slice(1), e.isGroup && e.description.length > 0) throw Error(`Group nodes can only have label. Remove the additional description for node [${e.id}]`);
1574
+ e.label = e.label[0];
1575
+ }
1576
+ }
1577
+ handleStyleDef(e) {
1578
+ let b = e.id.trim().split(","), x = e.styleClass.split(",");
1579
+ for (let e of b) {
1580
+ let b = this.getState(e);
1581
+ if (!b) {
1582
+ let x = e.trim();
1583
+ this.addState(x), b = this.getState(x);
1584
+ }
1585
+ b && (b.styles = x.map((e) => e.replace(/;/g, "")?.trim()));
1586
+ }
1587
+ }
1588
+ setRootDoc(e) {
1589
+ log.info("Setting root doc", e), this.rootDoc = e, this.version === 1 ? this.extract(e) : this.extract(this.getRootDocV2());
1590
+ }
1591
+ docTranslator(e, x, S) {
1592
+ if (x.stmt === STMT_RELATION) {
1593
+ this.docTranslator(e, x.state1, !0), this.docTranslator(e, x.state2, !1);
1594
+ return;
1595
+ }
1596
+ if (x.stmt === STMT_STATE && (x.id === CONSTANTS.START_NODE ? (x.id = e.id + (S ? "_start" : "_end"), x.start = S) : x.id = x.id.trim()), x.stmt !== STMT_ROOT && x.stmt !== STMT_STATE || !x.doc) return;
1597
+ let C = [], w = [];
1598
+ for (let e of x.doc) if (e.type === DIVIDER_TYPE) {
1599
+ let b = clone(e);
1600
+ b.doc = clone(w), C.push(b), w = [];
1601
+ } else w.push(e);
1602
+ if (C.length > 0 && w.length > 0) {
1603
+ let e = {
1604
+ stmt: STMT_STATE,
1605
+ id: generateId(),
1606
+ type: "divider",
1607
+ doc: clone(w)
1608
+ };
1609
+ C.push(clone(e)), x.doc = C;
1610
+ }
1611
+ x.doc.forEach((e) => this.docTranslator(x, e, !0));
1612
+ }
1613
+ getRootDocV2() {
1614
+ return this.docTranslator({
1615
+ id: STMT_ROOT,
1616
+ stmt: STMT_ROOT
1617
+ }, {
1618
+ id: STMT_ROOT,
1619
+ stmt: STMT_ROOT,
1620
+ doc: this.rootDoc
1621
+ }, !0), {
1622
+ id: STMT_ROOT,
1623
+ doc: this.rootDoc
1624
+ };
1625
+ }
1626
+ addState(e, b = DEFAULT_STATE_TYPE, S = void 0, C = void 0, w = void 0, T = void 0, E = void 0, D = void 0) {
1627
+ let A = e?.trim();
1628
+ if (!this.currentDocument.states.has(A)) log.info("Adding state ", A, C), this.currentDocument.states.set(A, {
1629
+ stmt: STMT_STATE,
1630
+ id: A,
1631
+ descriptions: [],
1632
+ type: b,
1633
+ doc: S,
1634
+ note: w,
1635
+ classes: [],
1636
+ styles: [],
1637
+ textStyles: []
1638
+ });
1639
+ else {
1640
+ let e = this.currentDocument.states.get(A);
1641
+ if (!e) throw Error(`State not found: ${A}`);
1642
+ e.doc ||= S, e.type ||= b;
1643
+ }
1644
+ if (C && (log.info("Setting state description", A, C), (Array.isArray(C) ? C : [C]).forEach((e) => this.addDescription(A, e.trim()))), w) {
1645
+ let e = this.currentDocument.states.get(A);
1646
+ if (!e) throw Error(`State not found: ${A}`);
1647
+ e.note = w, e.note.text = common_default.sanitizeText(e.note.text, getConfig2());
1648
+ }
1649
+ T && (log.info("Setting state classes", A, T), (Array.isArray(T) ? T : [T]).forEach((e) => this.setCssClass(A, e.trim()))), E && (log.info("Setting state styles", A, E), (Array.isArray(E) ? E : [E]).forEach((e) => this.setStyle(A, e.trim()))), D && (log.info("Setting state styles", A, E), (Array.isArray(D) ? D : [D]).forEach((e) => this.setTextStyle(A, e.trim())));
1650
+ }
1651
+ clear(e) {
1652
+ this.nodes = [], this.edges = [], this.documents = { root: newDoc() }, this.currentDocument = this.documents.root, this.startEndCount = 0, this.classes = newClassesList(), e || (this.links = /* @__PURE__ */ new Map(), clear());
1653
+ }
1654
+ getState(e) {
1655
+ return this.currentDocument.states.get(e);
1656
+ }
1657
+ getStates() {
1658
+ return this.currentDocument.states;
1659
+ }
1660
+ logDocuments() {
1661
+ log.info("Documents = ", this.documents);
1662
+ }
1663
+ getRelations() {
1664
+ return this.currentDocument.relations;
1665
+ }
1666
+ addLink(e, b, S) {
1667
+ this.links.set(e, {
1668
+ url: b,
1669
+ tooltip: S
1670
+ }), log.warn("Adding link", e, b, S);
1671
+ }
1672
+ getLinks() {
1673
+ return this.links;
1674
+ }
1675
+ startIdIfNeeded(e = "") {
1676
+ return e === CONSTANTS.START_NODE ? (this.startEndCount++, `${CONSTANTS.START_TYPE}${this.startEndCount}`) : e;
1677
+ }
1678
+ startTypeIfNeeded(e = "", b = DEFAULT_STATE_TYPE) {
1679
+ return e === CONSTANTS.START_NODE ? CONSTANTS.START_TYPE : b;
1680
+ }
1681
+ endIdIfNeeded(e = "") {
1682
+ return e === CONSTANTS.END_NODE ? (this.startEndCount++, `${CONSTANTS.END_TYPE}${this.startEndCount}`) : e;
1683
+ }
1684
+ endTypeIfNeeded(e = "", b = DEFAULT_STATE_TYPE) {
1685
+ return e === CONSTANTS.END_NODE ? CONSTANTS.END_TYPE : b;
1686
+ }
1687
+ addRelationObjs(e, b, x = "") {
1688
+ let S = this.startIdIfNeeded(e.id.trim()), C = this.startTypeIfNeeded(e.id.trim(), e.type), w = this.startIdIfNeeded(b.id.trim()), T = this.startTypeIfNeeded(b.id.trim(), b.type);
1689
+ this.addState(S, C, e.doc, e.description, e.note, e.classes, e.styles, e.textStyles), this.addState(w, T, b.doc, b.description, b.note, b.classes, b.styles, b.textStyles), this.currentDocument.relations.push({
1690
+ id1: S,
1691
+ id2: w,
1692
+ relationTitle: common_default.sanitizeText(x, getConfig2())
1693
+ });
1694
+ }
1695
+ addRelation(e, b, x) {
1696
+ if (typeof e == "object" && typeof b == "object") this.addRelationObjs(e, b, x);
1697
+ else if (typeof e == "string" && typeof b == "string") {
1698
+ let S = this.startIdIfNeeded(e.trim()), C = this.startTypeIfNeeded(e), w = this.endIdIfNeeded(b.trim()), T = this.endTypeIfNeeded(b);
1699
+ this.addState(S, C), this.addState(w, T), this.currentDocument.relations.push({
1700
+ id1: S,
1701
+ id2: w,
1702
+ relationTitle: x ? common_default.sanitizeText(x, getConfig2()) : void 0
1703
+ });
1704
+ }
1705
+ }
1706
+ addDescription(e, b) {
1707
+ let x = this.currentDocument.states.get(e), S = b.startsWith(":") ? b.replace(":", "").trim() : b;
1708
+ x?.descriptions?.push(common_default.sanitizeText(S, getConfig2()));
1709
+ }
1710
+ cleanupLabel(e) {
1711
+ return e.startsWith(":") ? e.slice(2).trim() : e.trim();
1712
+ }
1713
+ getDividerId() {
1714
+ return this.dividerCnt++, `divider-id-${this.dividerCnt}`;
1715
+ }
1716
+ addStyleClass(e, b = "") {
1717
+ this.classes.has(e) || this.classes.set(e, {
1718
+ id: e,
1719
+ styles: [],
1720
+ textStyles: []
1721
+ });
1722
+ let x = this.classes.get(e);
1723
+ b && x && b.split(CONSTANTS.STYLECLASS_SEP).forEach((e) => {
1724
+ let b = e.replace(/([^;]*);/, "$1").trim();
1725
+ if (RegExp(CONSTANTS.COLOR_KEYWORD).exec(e)) {
1726
+ let e = b.replace(CONSTANTS.FILL_KEYWORD, CONSTANTS.BG_FILL).replace(CONSTANTS.COLOR_KEYWORD, CONSTANTS.FILL_KEYWORD);
1727
+ x.textStyles.push(e);
1728
+ }
1729
+ x.styles.push(b);
1730
+ });
1731
+ }
1732
+ getClasses() {
1733
+ return this.classes;
1734
+ }
1735
+ setCssClass(e, b) {
1736
+ e.split(",").forEach((e) => {
1737
+ let x = this.getState(e);
1738
+ if (!x) {
1739
+ let b = e.trim();
1740
+ this.addState(b), x = this.getState(b);
1741
+ }
1742
+ x?.classes?.push(b);
1743
+ });
1744
+ }
1745
+ setStyle(e, b) {
1746
+ this.getState(e)?.styles?.push(b);
1747
+ }
1748
+ setTextStyle(e, b) {
1749
+ this.getState(e)?.textStyles?.push(b);
1750
+ }
1751
+ getDirectionStatement() {
1752
+ return this.rootDoc.find((e) => e.stmt === STMT_DIRECTION);
1753
+ }
1754
+ getDirection() {
1755
+ return this.getDirectionStatement()?.value ?? DEFAULT_DIAGRAM_DIRECTION;
1756
+ }
1757
+ setDirection(e) {
1758
+ let b = this.getDirectionStatement();
1759
+ b ? b.value = e : this.rootDoc.unshift({
1760
+ stmt: STMT_DIRECTION,
1761
+ value: e
1762
+ });
1763
+ }
1764
+ trimColon(e) {
1765
+ return e.startsWith(":") ? e.slice(1).trim() : e.trim();
1766
+ }
1767
+ getData() {
1768
+ let e = getConfig2();
1769
+ return {
1770
+ nodes: this.nodes,
1771
+ edges: this.edges,
1772
+ other: {},
1773
+ config: e,
1774
+ direction: getDir(this.getRootDocV2())
1775
+ };
1776
+ }
1777
+ getConfig() {
1778
+ return getConfig2().state;
1779
+ }
1780
+ }, styles_default = /* @__PURE__ */ __name((e) => `
1781
+ defs #statediagram-barbEnd {
1782
+ fill: ${e.transitionColor};
1783
+ stroke: ${e.transitionColor};
1784
+ }
1785
+ g.stateGroup text {
1786
+ fill: ${e.nodeBorder};
1787
+ stroke: none;
1788
+ font-size: 10px;
1789
+ }
1790
+ g.stateGroup text {
1791
+ fill: ${e.textColor};
1792
+ stroke: none;
1793
+ font-size: 10px;
1794
+
1795
+ }
1796
+ g.stateGroup .state-title {
1797
+ font-weight: bolder;
1798
+ fill: ${e.stateLabelColor};
1799
+ }
1800
+
1801
+ g.stateGroup rect {
1802
+ fill: ${e.mainBkg};
1803
+ stroke: ${e.nodeBorder};
1804
+ }
1805
+
1806
+ g.stateGroup line {
1807
+ stroke: ${e.lineColor};
1808
+ stroke-width: 1;
1809
+ }
1810
+
1811
+ .transition {
1812
+ stroke: ${e.transitionColor};
1813
+ stroke-width: 1;
1814
+ fill: none;
1815
+ }
1816
+
1817
+ .stateGroup .composit {
1818
+ fill: ${e.background};
1819
+ border-bottom: 1px
1820
+ }
1821
+
1822
+ .stateGroup .alt-composit {
1823
+ fill: #e0e0e0;
1824
+ border-bottom: 1px
1825
+ }
1826
+
1827
+ .state-note {
1828
+ stroke: ${e.noteBorderColor};
1829
+ fill: ${e.noteBkgColor};
1830
+
1831
+ text {
1832
+ fill: ${e.noteTextColor};
1833
+ stroke: none;
1834
+ font-size: 10px;
1835
+ }
1836
+ }
1837
+
1838
+ .stateLabel .box {
1839
+ stroke: none;
1840
+ stroke-width: 0;
1841
+ fill: ${e.mainBkg};
1842
+ opacity: 0.5;
1843
+ }
1844
+
1845
+ .edgeLabel .label rect {
1846
+ fill: ${e.labelBackgroundColor};
1847
+ opacity: 0.5;
1848
+ }
1849
+ .edgeLabel {
1850
+ background-color: ${e.edgeLabelBackground};
1851
+ p {
1852
+ background-color: ${e.edgeLabelBackground};
1853
+ }
1854
+ rect {
1855
+ opacity: 0.5;
1856
+ background-color: ${e.edgeLabelBackground};
1857
+ fill: ${e.edgeLabelBackground};
1858
+ }
1859
+ text-align: center;
1860
+ }
1861
+ .edgeLabel .label text {
1862
+ fill: ${e.transitionLabelColor || e.tertiaryTextColor};
1863
+ }
1864
+ .label div .edgeLabel {
1865
+ color: ${e.transitionLabelColor || e.tertiaryTextColor};
1866
+ }
1867
+
1868
+ .stateLabel text {
1869
+ fill: ${e.stateLabelColor};
1870
+ font-size: 10px;
1871
+ font-weight: bold;
1872
+ }
1873
+
1874
+ .node circle.state-start {
1875
+ fill: ${e.specialStateColor};
1876
+ stroke: ${e.specialStateColor};
1877
+ }
1878
+
1879
+ .node .fork-join {
1880
+ fill: ${e.specialStateColor};
1881
+ stroke: ${e.specialStateColor};
1882
+ }
1883
+
1884
+ .node circle.state-end {
1885
+ fill: ${e.innerEndBackground};
1886
+ stroke: ${e.background};
1887
+ stroke-width: 1.5
1888
+ }
1889
+ .end-state-inner {
1890
+ fill: ${e.compositeBackground || e.background};
1891
+ // stroke: ${e.background};
1892
+ stroke-width: 1.5
1893
+ }
1894
+
1895
+ .node rect {
1896
+ fill: ${e.stateBkg || e.mainBkg};
1897
+ stroke: ${e.stateBorder || e.nodeBorder};
1898
+ stroke-width: 1px;
1899
+ }
1900
+ .node polygon {
1901
+ fill: ${e.mainBkg};
1902
+ stroke: ${e.stateBorder || e.nodeBorder};;
1903
+ stroke-width: 1px;
1904
+ }
1905
+ #statediagram-barbEnd {
1906
+ fill: ${e.lineColor};
1907
+ }
1908
+
1909
+ .statediagram-cluster rect {
1910
+ fill: ${e.compositeTitleBackground};
1911
+ stroke: ${e.stateBorder || e.nodeBorder};
1912
+ stroke-width: 1px;
1913
+ }
1914
+
1915
+ .cluster-label, .nodeLabel {
1916
+ color: ${e.stateLabelColor};
1917
+ // line-height: 1;
1918
+ }
1919
+
1920
+ .statediagram-cluster rect.outer {
1921
+ rx: 5px;
1922
+ ry: 5px;
1923
+ }
1924
+ .statediagram-state .divider {
1925
+ stroke: ${e.stateBorder || e.nodeBorder};
1926
+ }
1927
+
1928
+ .statediagram-state .title-state {
1929
+ rx: 5px;
1930
+ ry: 5px;
1931
+ }
1932
+ .statediagram-cluster.statediagram-cluster .inner {
1933
+ fill: ${e.compositeBackground || e.background};
1934
+ }
1935
+ .statediagram-cluster.statediagram-cluster-alt .inner {
1936
+ fill: ${e.altBackground ? e.altBackground : "#efefef"};
1937
+ }
1938
+
1939
+ .statediagram-cluster .inner {
1940
+ rx:0;
1941
+ ry:0;
1942
+ }
1943
+
1944
+ .statediagram-state rect.basic {
1945
+ rx: 5px;
1946
+ ry: 5px;
1947
+ }
1948
+ .statediagram-state rect.divider {
1949
+ stroke-dasharray: 10,10;
1950
+ fill: ${e.altBackground ? e.altBackground : "#efefef"};
1951
+ }
1952
+
1953
+ .note-edge {
1954
+ stroke-dasharray: 5;
1955
+ }
1956
+
1957
+ .statediagram-note rect {
1958
+ fill: ${e.noteBkgColor};
1959
+ stroke: ${e.noteBorderColor};
1960
+ stroke-width: 1px;
1961
+ rx: 0;
1962
+ ry: 0;
1963
+ }
1964
+ .statediagram-note rect {
1965
+ fill: ${e.noteBkgColor};
1966
+ stroke: ${e.noteBorderColor};
1967
+ stroke-width: 1px;
1968
+ rx: 0;
1969
+ ry: 0;
1970
+ }
1971
+
1972
+ .statediagram-note text {
1973
+ fill: ${e.noteTextColor};
1974
+ }
1975
+
1976
+ .statediagram-note .nodeLabel {
1977
+ color: ${e.noteTextColor};
1978
+ }
1979
+ .statediagram .edgeLabel {
1980
+ color: red; // ${e.noteTextColor};
1981
+ }
1982
+
1983
+ #dependencyStart, #dependencyEnd {
1984
+ fill: ${e.lineColor};
1985
+ stroke: ${e.lineColor};
1986
+ stroke-width: 1;
1987
+ }
1988
+
1989
+ .statediagramTitleText {
1990
+ text-anchor: middle;
1991
+ font-size: 18px;
1992
+ fill: ${e.textColor};
1993
+ }
1994
+ `, "getStyles");
1995
+ export { styles_default as i, stateDiagram_default as n, stateRenderer_v3_unified_default as r, StateDB as t };