@readme/markdown 9.3.0 → 9.3.1

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 (122) hide show
  1. package/dist/10.node.js +20064 -19229
  2. package/dist/10.node.js.map +1 -1
  3. package/dist/122.node.js +23 -0
  4. package/dist/122.node.js.map +1 -0
  5. package/dist/{17.node.js → 135.node.js} +109 -110
  6. package/dist/135.node.js.map +1 -0
  7. package/dist/136.node.js +23 -0
  8. package/dist/136.node.js.map +1 -0
  9. package/dist/{52.node.js → 188.node.js} +211 -196
  10. package/dist/188.node.js.map +1 -0
  11. package/dist/214.node.js +1280 -0
  12. package/dist/214.node.js.map +1 -0
  13. package/dist/23.node.js +2563 -0
  14. package/dist/23.node.js.map +1 -0
  15. package/dist/{867.node.js → 311.node.js} +95 -95
  16. package/dist/{867.node.js.map → 311.node.js.map} +1 -1
  17. package/dist/{940.node.js → 339.node.js} +3 -75
  18. package/dist/339.node.js.map +1 -0
  19. package/dist/354.node.js +23 -0
  20. package/dist/354.node.js.map +1 -0
  21. package/dist/359.node.js +2001 -0
  22. package/dist/359.node.js.map +1 -0
  23. package/dist/364.node.js +4435 -0
  24. package/dist/364.node.js.map +1 -0
  25. package/dist/{429.node.js → 371.node.js} +196 -139
  26. package/dist/371.node.js.map +1 -0
  27. package/dist/{687.node.js → 38.node.js} +761 -761
  28. package/dist/38.node.js.map +1 -0
  29. package/dist/391.node.js +522 -0
  30. package/dist/391.node.js.map +1 -0
  31. package/dist/462.node.js +23 -0
  32. package/dist/462.node.js.map +1 -0
  33. package/dist/48.node.js +57 -0
  34. package/dist/48.node.js.map +1 -0
  35. package/dist/486.node.js +16267 -14851
  36. package/dist/486.node.js.map +1 -1
  37. package/dist/537.node.js +59 -0
  38. package/dist/537.node.js.map +1 -0
  39. package/dist/550.node.js +201 -1408
  40. package/dist/550.node.js.map +1 -1
  41. package/dist/{403.node.js → 572.node.js} +118 -118
  42. package/dist/572.node.js.map +1 -0
  43. package/dist/580.node.js +1324 -0
  44. package/dist/580.node.js.map +1 -0
  45. package/dist/{952.node.js → 649.node.js} +39 -39
  46. package/dist/{952.node.js.map → 649.node.js.map} +1 -1
  47. package/dist/740.node.js +23 -0
  48. package/dist/740.node.js.map +1 -0
  49. package/dist/741.node.js +23 -0
  50. package/dist/741.node.js.map +1 -0
  51. package/dist/779.node.js +57 -0
  52. package/dist/779.node.js.map +1 -0
  53. package/dist/805.node.js +1355 -0
  54. package/dist/805.node.js.map +1 -0
  55. package/dist/{246.node.js → 855.node.js} +671 -495
  56. package/dist/855.node.js.map +1 -0
  57. package/dist/{11.node.js → 870.node.js} +70 -63
  58. package/dist/870.node.js.map +1 -0
  59. package/dist/874.node.js +57 -0
  60. package/dist/874.node.js.map +1 -0
  61. package/dist/881.node.js +1344 -720
  62. package/dist/881.node.js.map +1 -1
  63. package/dist/{906.node.js → 890.node.js} +147 -147
  64. package/dist/{906.node.js.map → 890.node.js.map} +1 -1
  65. package/dist/898.node.js +361 -0
  66. package/dist/898.node.js.map +1 -0
  67. package/dist/{551.node.js → 912.node.js} +133 -133
  68. package/dist/{551.node.js.map → 912.node.js.map} +1 -1
  69. package/dist/{745.node.js → 915.node.js} +86 -85
  70. package/dist/915.node.js.map +1 -0
  71. package/dist/982.node.js +1132 -0
  72. package/dist/982.node.js.map +1 -0
  73. package/dist/995.node.js +189 -159
  74. package/dist/995.node.js.map +1 -1
  75. package/dist/lib/plain.d.ts +1 -1
  76. package/dist/main.js +1881 -331
  77. package/dist/main.node.js +1872 -332
  78. package/dist/main.node.js.map +1 -1
  79. package/package.json +1 -2
  80. package/dist/11.node.js.map +0 -1
  81. package/dist/120.node.js +0 -23
  82. package/dist/120.node.js.map +0 -1
  83. package/dist/134.node.js +0 -23
  84. package/dist/134.node.js.map +0 -1
  85. package/dist/150.node.js +0 -1892
  86. package/dist/150.node.js.map +0 -1
  87. package/dist/17.node.js.map +0 -1
  88. package/dist/246.node.js.map +0 -1
  89. package/dist/351.node.js +0 -2404
  90. package/dist/351.node.js.map +0 -1
  91. package/dist/366.node.js +0 -1185
  92. package/dist/366.node.js.map +0 -1
  93. package/dist/403.node.js.map +0 -1
  94. package/dist/429.node.js.map +0 -1
  95. package/dist/485.node.js +0 -518
  96. package/dist/485.node.js.map +0 -1
  97. package/dist/488.node.js +0 -59
  98. package/dist/488.node.js.map +0 -1
  99. package/dist/510.node.js +0 -250
  100. package/dist/510.node.js.map +0 -1
  101. package/dist/52.node.js.map +0 -1
  102. package/dist/617.node.js +0 -23
  103. package/dist/617.node.js.map +0 -1
  104. package/dist/687.node.js.map +0 -1
  105. package/dist/745.node.js.map +0 -1
  106. package/dist/775.node.js +0 -1904
  107. package/dist/775.node.js.map +0 -1
  108. package/dist/788.node.js +0 -1025
  109. package/dist/788.node.js.map +0 -1
  110. package/dist/81.node.js +0 -386
  111. package/dist/81.node.js.map +0 -1
  112. package/dist/849.node.js +0 -2590
  113. package/dist/849.node.js.map +0 -1
  114. package/dist/863.node.js +0 -23
  115. package/dist/863.node.js.map +0 -1
  116. package/dist/885.node.js +0 -52
  117. package/dist/885.node.js.map +0 -1
  118. package/dist/896.node.js +0 -1617
  119. package/dist/896.node.js.map +0 -1
  120. package/dist/91.node.js +0 -23
  121. package/dist/91.node.js.map +0 -1
  122. package/dist/940.node.js.map +0 -1
@@ -1,71 +1,21 @@
1
1
  "use strict";
2
- exports.id = 246;
3
- exports.ids = [246];
2
+ exports.id = 855;
3
+ exports.ids = [855];
4
4
  exports.modules = {
5
5
 
6
- /***/ 4265:
7
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
8
-
9
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
10
- /* harmony export */ A: () => (/* binding */ getDiagramElement),
11
- /* harmony export */ P: () => (/* binding */ setupViewPortForSVG)
12
- /* harmony export */ });
13
- /* harmony import */ var _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6322);
14
- /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(8066);
15
-
16
-
17
- // src/rendering-util/insertElementsForSize.js
18
-
19
- var getDiagramElement = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__name */ .K2)((id, securityLevel) => {
20
- let sandboxElement;
21
- if (securityLevel === "sandbox") {
22
- sandboxElement = (0,d3__WEBPACK_IMPORTED_MODULE_1__/* .select */ .Ltv)("#i" + id);
23
- }
24
- const root = securityLevel === "sandbox" ? (0,d3__WEBPACK_IMPORTED_MODULE_1__/* .select */ .Ltv)(sandboxElement.nodes()[0].contentDocument.body) : (0,d3__WEBPACK_IMPORTED_MODULE_1__/* .select */ .Ltv)("body");
25
- const svg = root.select(`[id="${id}"]`);
26
- return svg;
27
- }, "getDiagramElement");
28
-
29
- // src/rendering-util/setupViewPortForSVG.ts
30
- var setupViewPortForSVG = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__name */ .K2)((svg, padding, cssDiagram, useMaxWidth) => {
31
- svg.attr("class", cssDiagram);
32
- const { width, height, x, y } = calculateDimensionsWithPadding(svg, padding);
33
- (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_0__/* .configureSvgSize */ .a$)(svg, height, width, useMaxWidth);
34
- const viewBox = createViewBox(x, y, width, height, padding);
35
- svg.attr("viewBox", viewBox);
36
- _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_0__/* .log */ .Rm.debug(`viewBox configured: ${viewBox} with padding: ${padding}`);
37
- }, "setupViewPortForSVG");
38
- var calculateDimensionsWithPadding = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__name */ .K2)((svg, padding) => {
39
- const bounds = svg.node()?.getBBox() || { width: 0, height: 0, x: 0, y: 0 };
40
- return {
41
- width: bounds.width + padding * 2,
42
- height: bounds.height + padding * 2,
43
- x: bounds.x,
44
- y: bounds.y
45
- };
46
- }, "calculateDimensionsWithPadding");
47
- var createViewBox = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__name */ .K2)((x, y, width, height, padding) => {
48
- return `${x - padding} ${y - padding} ${width} ${height}`;
49
- }, "createViewBox");
50
-
51
-
52
-
53
-
54
- /***/ }),
55
-
56
- /***/ 3246:
6
+ /***/ 8855:
57
7
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
58
8
 
59
9
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
60
10
  /* harmony export */ Zk: () => (/* binding */ stateDiagram_default),
61
- /* harmony export */ iP: () => (/* binding */ stateDb_default),
62
11
  /* harmony export */ q7: () => (/* binding */ stateRenderer_v3_unified_default),
63
- /* harmony export */ tM: () => (/* binding */ styles_default)
12
+ /* harmony export */ tM: () => (/* binding */ styles_default),
13
+ /* harmony export */ u4: () => (/* binding */ StateDB)
64
14
  /* harmony export */ });
65
- /* harmony import */ var _chunk_4LC2V6XN_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4265);
66
- /* harmony import */ var _chunk_U2OMI7UW_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2385);
67
- /* harmony import */ var _chunk_TLUHKHBO_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2843);
68
- /* harmony import */ var _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6322);
15
+ /* harmony import */ var _chunk_RZ5BOZE2_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5051);
16
+ /* harmony import */ var _chunk_TYCBKAJE_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4065);
17
+ /* harmony import */ var _chunk_O4NI6UNU_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(8430);
18
+ /* harmony import */ var _chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(3804);
69
19
 
70
20
 
71
21
 
@@ -73,18 +23,18 @@ var createViewBox = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MOD
73
23
 
74
24
  // src/diagrams/state/parser/stateDiagram.jison
75
25
  var parser = function() {
76
- var o = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(k, v, o2, l) {
26
+ var o = /* @__PURE__ */ (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(k, v, o2, l) {
77
27
  for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v) ;
78
28
  return o2;
79
29
  }, "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, 32], $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, 34], $Vn = [1, 35], $Vo = [1, 36], $Vp = [1, 37], $Vq = [1, 33], $Vr = [1, 4, 5, 16, 17, 19, 21, 22, 24, 25, 26, 27, 28, 29, 33, 35, 37, 38, 42, 45, 48, 49, 50, 51, 54], $Vs = [1, 4, 5, 14, 15, 16, 17, 19, 21, 22, 24, 25, 26, 27, 28, 29, 33, 35, 37, 38, 42, 45, 48, 49, 50, 51, 54], $Vt = [4, 5, 16, 17, 19, 21, 22, 24, 25, 26, 27, 28, 29, 33, 35, 37, 38, 42, 45, 48, 49, 50, 51, 54];
80
30
  var parser2 = {
81
- trace: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function trace() {
31
+ trace: /* @__PURE__ */ (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function trace() {
82
32
  }, "trace"),
83
33
  yy: {},
84
34
  symbols_: { "error": 2, "start": 3, "SPACE": 4, "NL": 5, "SD": 6, "document": 7, "line": 8, "statement": 9, "classDefStatement": 10, "styleStatement": 11, "cssClassStatement": 12, "idStatement": 13, "DESCR": 14, "-->": 15, "HIDE_EMPTY": 16, "scale": 17, "WIDTH": 18, "COMPOSIT_STATE": 19, "STRUCT_START": 20, "STRUCT_STOP": 21, "STATE_DESCR": 22, "AS": 23, "ID": 24, "FORK": 25, "JOIN": 26, "CHOICE": 27, "CONCURRENT": 28, "note": 29, "notePosition": 30, "NOTE_TEXT": 31, "direction": 32, "acc_title": 33, "acc_title_value": 34, "acc_descr": 35, "acc_descr_value": 36, "acc_descr_multiline_value": 37, "classDef": 38, "CLASSDEF_ID": 39, "CLASSDEF_STYLEOPTS": 40, "DEFAULT": 41, "style": 42, "STYLE_IDS": 43, "STYLEDEF_STYLEOPTS": 44, "class": 45, "CLASSENTITY_IDS": 46, "STYLECLASS": 47, "direction_tb": 48, "direction_bt": 49, "direction_rl": 50, "direction_lr": 51, "eol": 52, ";": 53, "EDGE_STATE": 54, "STYLE_SEPARATOR": 55, "left_of": 56, "right_of": 57, "$accept": 0, "$end": 1 },
85
35
  terminals_: { 2: "error", 4: "SPACE", 5: "NL", 6: "SD", 14: "DESCR", 15: "-->", 16: "HIDE_EMPTY", 17: "scale", 18: "WIDTH", 19: "COMPOSIT_STATE", 20: "STRUCT_START", 21: "STRUCT_STOP", 22: "STATE_DESCR", 23: "AS", 24: "ID", 25: "FORK", 26: "JOIN", 27: "CHOICE", 28: "CONCURRENT", 29: "note", 31: "NOTE_TEXT", 33: "acc_title", 34: "acc_title_value", 35: "acc_descr", 36: "acc_descr_value", 37: "acc_descr_multiline_value", 38: "classDef", 39: "CLASSDEF_ID", 40: "CLASSDEF_STYLEOPTS", 41: "DEFAULT", 42: "style", 43: "STYLE_IDS", 44: "STYLEDEF_STYLEOPTS", 45: "class", 46: "CLASSENTITY_IDS", 47: "STYLECLASS", 48: "direction_tb", 49: "direction_bt", 50: "direction_rl", 51: "direction_lr", 53: ";", 54: "EDGE_STATE", 55: "STYLE_SEPARATOR", 56: "left_of", 57: "right_of" },
86
36
  productions_: [0, [3, 2], [3, 2], [3, 2], [7, 0], [7, 2], [8, 2], [8, 1], [8, 1], [9, 1], [9, 1], [9, 1], [9, 1], [9, 2], [9, 3], [9, 4], [9, 1], [9, 2], [9, 1], [9, 4], [9, 3], [9, 6], [9, 1], [9, 1], [9, 1], [9, 1], [9, 4], [9, 4], [9, 1], [9, 2], [9, 2], [9, 1], [10, 3], [10, 3], [11, 3], [12, 3], [32, 1], [32, 1], [32, 1], [32, 1], [52, 1], [52, 1], [13, 1], [13, 1], [13, 3], [13, 3], [30, 1], [30, 1]],
87
- performAction: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
37
+ performAction: /* @__PURE__ */ (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
88
38
  var $0 = $$.length - 1;
89
39
  switch (yystate) {
90
40
  case 3:
@@ -202,7 +152,7 @@ var parser = function() {
202
152
  }, "anonymous"),
203
153
  table: [{ 3: 1, 4: $V0, 5: $V1, 6: $V2 }, { 1: [3] }, { 3: 5, 4: $V0, 5: $V1, 6: $V2 }, { 3: 6, 4: $V0, 5: $V1, 6: $V2 }, o([1, 4, 5, 16, 17, 19, 22, 24, 25, 26, 27, 28, 29, 33, 35, 37, 38, 42, 45, 48, 49, 50, 51, 54], $V3, { 7: 7 }), { 1: [2, 1] }, { 1: [2, 2] }, { 1: [2, 3], 4: $V4, 5: $V5, 8: 8, 9: 10, 10: 12, 11: 13, 12: 14, 13: 15, 16: $V6, 17: $V7, 19: $V8, 22: $V9, 24: $Va, 25: $Vb, 26: $Vc, 27: $Vd, 28: $Ve, 29: $Vf, 32: 25, 33: $Vg, 35: $Vh, 37: $Vi, 38: $Vj, 42: $Vk, 45: $Vl, 48: $Vm, 49: $Vn, 50: $Vo, 51: $Vp, 54: $Vq }, o($Vr, [2, 5]), { 9: 38, 10: 12, 11: 13, 12: 14, 13: 15, 16: $V6, 17: $V7, 19: $V8, 22: $V9, 24: $Va, 25: $Vb, 26: $Vc, 27: $Vd, 28: $Ve, 29: $Vf, 32: 25, 33: $Vg, 35: $Vh, 37: $Vi, 38: $Vj, 42: $Vk, 45: $Vl, 48: $Vm, 49: $Vn, 50: $Vo, 51: $Vp, 54: $Vq }, o($Vr, [2, 7]), o($Vr, [2, 8]), o($Vr, [2, 9]), o($Vr, [2, 10]), o($Vr, [2, 11]), o($Vr, [2, 12], { 14: [1, 39], 15: [1, 40] }), o($Vr, [2, 16]), { 18: [1, 41] }, o($Vr, [2, 18], { 20: [1, 42] }), { 23: [1, 43] }, o($Vr, [2, 22]), o($Vr, [2, 23]), o($Vr, [2, 24]), o($Vr, [2, 25]), { 30: 44, 31: [1, 45], 56: [1, 46], 57: [1, 47] }, o($Vr, [2, 28]), { 34: [1, 48] }, { 36: [1, 49] }, o($Vr, [2, 31]), { 39: [1, 50], 41: [1, 51] }, { 43: [1, 52] }, { 46: [1, 53] }, o($Vs, [2, 42], { 55: [1, 54] }), o($Vs, [2, 43], { 55: [1, 55] }), o($Vr, [2, 36]), o($Vr, [2, 37]), o($Vr, [2, 38]), o($Vr, [2, 39]), o($Vr, [2, 6]), o($Vr, [2, 13]), { 13: 56, 24: $Va, 54: $Vq }, o($Vr, [2, 17]), o($Vt, $V3, { 7: 57 }), { 24: [1, 58] }, { 24: [1, 59] }, { 23: [1, 60] }, { 24: [2, 46] }, { 24: [2, 47] }, o($Vr, [2, 29]), o($Vr, [2, 30]), { 40: [1, 61] }, { 40: [1, 62] }, { 44: [1, 63] }, { 47: [1, 64] }, { 24: [1, 65] }, { 24: [1, 66] }, o($Vr, [2, 14], { 14: [1, 67] }), { 4: $V4, 5: $V5, 8: 8, 9: 10, 10: 12, 11: 13, 12: 14, 13: 15, 16: $V6, 17: $V7, 19: $V8, 21: [1, 68], 22: $V9, 24: $Va, 25: $Vb, 26: $Vc, 27: $Vd, 28: $Ve, 29: $Vf, 32: 25, 33: $Vg, 35: $Vh, 37: $Vi, 38: $Vj, 42: $Vk, 45: $Vl, 48: $Vm, 49: $Vn, 50: $Vo, 51: $Vp, 54: $Vq }, o($Vr, [2, 20], { 20: [1, 69] }), { 31: [1, 70] }, { 24: [1, 71] }, o($Vr, [2, 32]), o($Vr, [2, 33]), o($Vr, [2, 34]), o($Vr, [2, 35]), o($Vs, [2, 44]), o($Vs, [2, 45]), o($Vr, [2, 15]), o($Vr, [2, 19]), o($Vt, $V3, { 7: 72 }), o($Vr, [2, 26]), o($Vr, [2, 27]), { 4: $V4, 5: $V5, 8: 8, 9: 10, 10: 12, 11: 13, 12: 14, 13: 15, 16: $V6, 17: $V7, 19: $V8, 21: [1, 73], 22: $V9, 24: $Va, 25: $Vb, 26: $Vc, 27: $Vd, 28: $Ve, 29: $Vf, 32: 25, 33: $Vg, 35: $Vh, 37: $Vi, 38: $Vj, 42: $Vk, 45: $Vl, 48: $Vm, 49: $Vn, 50: $Vo, 51: $Vp, 54: $Vq }, o($Vr, [2, 21])],
204
154
  defaultActions: { 5: [2, 1], 6: [2, 2], 46: [2, 46], 47: [2, 47] },
205
- parseError: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function parseError(str, hash) {
155
+ parseError: /* @__PURE__ */ (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function parseError(str, hash) {
206
156
  if (hash.recoverable) {
207
157
  this.trace(str);
208
158
  } else {
@@ -211,7 +161,7 @@ var parser = function() {
211
161
  throw error;
212
162
  }
213
163
  }, "parseError"),
214
- parse: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function parse(input) {
164
+ parse: /* @__PURE__ */ (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function parse(input) {
215
165
  var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
216
166
  var args = lstack.slice.call(arguments, 1);
217
167
  var lexer2 = Object.create(this.lexer);
@@ -240,7 +190,7 @@ var parser = function() {
240
190
  vstack.length = vstack.length - n;
241
191
  lstack.length = lstack.length - n;
242
192
  }
243
- (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(popStack, "popStack");
193
+ (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(popStack, "popStack");
244
194
  function lex() {
245
195
  var token;
246
196
  token = tstack.pop() || lexer2.lex() || EOF;
@@ -253,7 +203,7 @@ var parser = function() {
253
203
  }
254
204
  return token;
255
205
  }
256
- (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(lex, "lex");
206
+ (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(lex, "lex");
257
207
  var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
258
208
  while (true) {
259
209
  state = stack[stack.length - 1];
@@ -357,7 +307,7 @@ var parser = function() {
357
307
  var lexer = /* @__PURE__ */ function() {
358
308
  var lexer2 = {
359
309
  EOF: 1,
360
- parseError: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function parseError(str, hash) {
310
+ parseError: /* @__PURE__ */ (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function parseError(str, hash) {
361
311
  if (this.yy.parser) {
362
312
  this.yy.parser.parseError(str, hash);
363
313
  } else {
@@ -365,7 +315,7 @@ var parser = function() {
365
315
  }
366
316
  }, "parseError"),
367
317
  // resets the lexer, sets new input
368
- setInput: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(input, yy) {
318
+ setInput: /* @__PURE__ */ (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(input, yy) {
369
319
  this.yy = yy || this.yy || {};
370
320
  this._input = input;
371
321
  this._more = this._backtrack = this.done = false;
@@ -385,7 +335,7 @@ var parser = function() {
385
335
  return this;
386
336
  }, "setInput"),
387
337
  // consumes and returns one char from the input
388
- input: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function() {
338
+ input: /* @__PURE__ */ (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function() {
389
339
  var ch = this._input[0];
390
340
  this.yytext += ch;
391
341
  this.yyleng++;
@@ -406,7 +356,7 @@ var parser = function() {
406
356
  return ch;
407
357
  }, "input"),
408
358
  // unshifts one char (or a string) into the input
409
- unput: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(ch) {
359
+ unput: /* @__PURE__ */ (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(ch) {
410
360
  var len = ch.length;
411
361
  var lines = ch.split(/(?:\r\n?|\n)/g);
412
362
  this._input = ch + this._input;
@@ -432,12 +382,12 @@ var parser = function() {
432
382
  return this;
433
383
  }, "unput"),
434
384
  // When called from action, caches matched text and appends it on next action
435
- more: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function() {
385
+ more: /* @__PURE__ */ (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function() {
436
386
  this._more = true;
437
387
  return this;
438
388
  }, "more"),
439
389
  // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
440
- reject: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function() {
390
+ reject: /* @__PURE__ */ (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function() {
441
391
  if (this.options.backtrack_lexer) {
442
392
  this._backtrack = true;
443
393
  } else {
@@ -450,16 +400,16 @@ var parser = function() {
450
400
  return this;
451
401
  }, "reject"),
452
402
  // retain first n characters of the match
453
- less: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(n) {
403
+ less: /* @__PURE__ */ (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(n) {
454
404
  this.unput(this.match.slice(n));
455
405
  }, "less"),
456
406
  // displays already matched input, i.e. for error messages
457
- pastInput: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function() {
407
+ pastInput: /* @__PURE__ */ (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function() {
458
408
  var past = this.matched.substr(0, this.matched.length - this.match.length);
459
409
  return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
460
410
  }, "pastInput"),
461
411
  // displays upcoming input, i.e. for error messages
462
- upcomingInput: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function() {
412
+ upcomingInput: /* @__PURE__ */ (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function() {
463
413
  var next = this.match;
464
414
  if (next.length < 20) {
465
415
  next += this._input.substr(0, 20 - next.length);
@@ -467,13 +417,13 @@ var parser = function() {
467
417
  return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
468
418
  }, "upcomingInput"),
469
419
  // displays the character position where the lexing error occurred, i.e. for error messages
470
- showPosition: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function() {
420
+ showPosition: /* @__PURE__ */ (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function() {
471
421
  var pre = this.pastInput();
472
422
  var c = new Array(pre.length + 1).join("-");
473
423
  return pre + this.upcomingInput() + "\n" + c + "^";
474
424
  }, "showPosition"),
475
425
  // test the lexed token: return FALSE when not a match, otherwise return token
476
- test_match: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(match, indexed_rule) {
426
+ test_match: /* @__PURE__ */ (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(match, indexed_rule) {
477
427
  var token, lines, backup;
478
428
  if (this.options.backtrack_lexer) {
479
429
  backup = {
@@ -536,7 +486,7 @@ var parser = function() {
536
486
  return false;
537
487
  }, "test_match"),
538
488
  // return next match in input
539
- next: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function() {
489
+ next: /* @__PURE__ */ (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function() {
540
490
  if (this.done) {
541
491
  return this.EOF;
542
492
  }
@@ -587,7 +537,7 @@ var parser = function() {
587
537
  }
588
538
  }, "next"),
589
539
  // return next match that has a token
590
- lex: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function lex() {
540
+ lex: /* @__PURE__ */ (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function lex() {
591
541
  var r = this.next();
592
542
  if (r) {
593
543
  return r;
@@ -596,11 +546,11 @@ var parser = function() {
596
546
  }
597
547
  }, "lex"),
598
548
  // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
599
- begin: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function begin(condition) {
549
+ begin: /* @__PURE__ */ (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function begin(condition) {
600
550
  this.conditionStack.push(condition);
601
551
  }, "begin"),
602
552
  // pop the previously active lexer condition state off the condition stack
603
- popState: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function popState() {
553
+ popState: /* @__PURE__ */ (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function popState() {
604
554
  var n = this.conditionStack.length - 1;
605
555
  if (n > 0) {
606
556
  return this.conditionStack.pop();
@@ -609,7 +559,7 @@ var parser = function() {
609
559
  }
610
560
  }, "popState"),
611
561
  // produce the lexer rule set which is active for the currently active lexer condition state
612
- _currentRules: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function _currentRules() {
562
+ _currentRules: /* @__PURE__ */ (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function _currentRules() {
613
563
  if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
614
564
  return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
615
565
  } else {
@@ -617,7 +567,7 @@ var parser = function() {
617
567
  }
618
568
  }, "_currentRules"),
619
569
  // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
620
- topState: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function topState(n) {
570
+ topState: /* @__PURE__ */ (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function topState(n) {
621
571
  n = this.conditionStack.length - 1 - Math.abs(n || 0);
622
572
  if (n >= 0) {
623
573
  return this.conditionStack[n];
@@ -626,15 +576,15 @@ var parser = function() {
626
576
  }
627
577
  }, "topState"),
628
578
  // alias for begin(condition)
629
- pushState: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function pushState(condition) {
579
+ pushState: /* @__PURE__ */ (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function pushState(condition) {
630
580
  this.begin(condition);
631
581
  }, "pushState"),
632
582
  // return the number of states currently on the stack
633
- stateStackSize: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function stateStackSize() {
583
+ stateStackSize: /* @__PURE__ */ (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function stateStackSize() {
634
584
  return this.conditionStack.length;
635
585
  }, "stateStackSize"),
636
586
  options: { "case-insensitive": true },
637
- performAction: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
587
+ performAction: /* @__PURE__ */ (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
638
588
  var YYSTATE = YY_START;
639
589
  switch ($avoiding_name_collisions) {
640
590
  case 0:
@@ -931,7 +881,7 @@ var parser = function() {
931
881
  function Parser() {
932
882
  this.yy = {};
933
883
  }
934
- (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(Parser, "Parser");
884
+ (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(Parser, "Parser");
935
885
  Parser.prototype = parser2;
936
886
  parser2.Parser = Parser;
937
887
  return new Parser();
@@ -940,8 +890,9 @@ parser.parser = parser;
940
890
  var stateDiagram_default = parser;
941
891
 
942
892
  // src/diagrams/state/stateCommon.ts
943
- var DEFAULT_DIAGRAM_DIRECTION = "LR";
893
+ var DEFAULT_DIAGRAM_DIRECTION = "TB";
944
894
  var DEFAULT_NESTED_DOC_DIR = "TB";
895
+ var STMT_DIRECTION = "dir";
945
896
  var STMT_STATE = "state";
946
897
  var STMT_RELATION = "relation";
947
898
  var STMT_CLASSDEF = "classDef";
@@ -982,7 +933,7 @@ var NOTE_ID = `${DOMID_TYPE_SPACER}${NOTE}`;
982
933
  var PARENT_ID = `${DOMID_TYPE_SPACER}${PARENT}`;
983
934
 
984
935
  // src/diagrams/state/stateRenderer-v3-unified.ts
985
- var getDir = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)((parsedItem, defaultDir = DEFAULT_NESTED_DOC_DIR) => {
936
+ var getDir = /* @__PURE__ */ (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)((parsedItem, defaultDir = DEFAULT_NESTED_DOC_DIR) => {
986
937
  if (!parsedItem.doc) {
987
938
  return defaultDir;
988
939
  }
@@ -994,32 +945,31 @@ var getDir = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__
994
945
  }
995
946
  return dir;
996
947
  }, "getDir");
997
- var getClasses = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(text, diagramObj) {
998
- diagramObj.db.extract(diagramObj.db.getRootDocV2());
948
+ var getClasses = /* @__PURE__ */ (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(text, diagramObj) {
999
949
  return diagramObj.db.getClasses();
1000
950
  }, "getClasses");
1001
- var draw = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(async function(text, id, _version, diag) {
1002
- _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .log */ .Rm.info("REF0:");
1003
- _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .log */ .Rm.info("Drawing state diagram (v2)", id);
1004
- const { securityLevel, state: conf, layout } = (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .getConfig2 */ .D7)();
951
+ var draw = /* @__PURE__ */ (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(async function(text, id, _version, diag) {
952
+ _chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .log */ .Rm.info("REF0:");
953
+ _chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .log */ .Rm.info("Drawing state diagram (v2)", id);
954
+ const { securityLevel, state: conf, layout } = (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .getConfig2 */ .D7)();
1005
955
  diag.db.extract(diag.db.getRootDocV2());
1006
956
  const data4Layout = diag.db.getData();
1007
- const svg = (0,_chunk_4LC2V6XN_mjs__WEBPACK_IMPORTED_MODULE_0__/* .getDiagramElement */ .A)(id, securityLevel);
957
+ const svg = (0,_chunk_RZ5BOZE2_mjs__WEBPACK_IMPORTED_MODULE_0__/* .getDiagramElement */ .A)(id, securityLevel);
1008
958
  data4Layout.type = diag.type;
1009
959
  data4Layout.layoutAlgorithm = layout;
1010
960
  data4Layout.nodeSpacing = conf?.nodeSpacing || 50;
1011
961
  data4Layout.rankSpacing = conf?.rankSpacing || 50;
1012
962
  data4Layout.markers = ["barb"];
1013
963
  data4Layout.diagramId = id;
1014
- await (0,_chunk_U2OMI7UW_mjs__WEBPACK_IMPORTED_MODULE_1__/* .render */ .XX)(data4Layout, svg);
964
+ await (0,_chunk_TYCBKAJE_mjs__WEBPACK_IMPORTED_MODULE_1__/* .render */ .XX)(data4Layout, svg);
1015
965
  const padding = 8;
1016
- _chunk_TLUHKHBO_mjs__WEBPACK_IMPORTED_MODULE_2__/* .utils_default */ ._K.insertTitle(
966
+ _chunk_O4NI6UNU_mjs__WEBPACK_IMPORTED_MODULE_2__/* .utils_default */ ._K.insertTitle(
1017
967
  svg,
1018
968
  "statediagramTitleText",
1019
969
  conf?.titleTopMargin ?? 25,
1020
970
  diag.db.getDiagramTitle()
1021
971
  );
1022
- (0,_chunk_4LC2V6XN_mjs__WEBPACK_IMPORTED_MODULE_0__/* .setupViewPortForSVG */ .P)(svg, padding, CSS_DIAGRAM, conf?.useMaxWidth ?? true);
972
+ (0,_chunk_RZ5BOZE2_mjs__WEBPACK_IMPORTED_MODULE_0__/* .setupViewPortForSVG */ .P)(svg, padding, CSS_DIAGRAM, conf?.useMaxWidth ?? true);
1023
973
  }, "draw");
1024
974
  var stateRenderer_v3_unified_default = {
1025
975
  getClasses,
@@ -1034,16 +984,16 @@ function stateDomId(itemId = "", counter = 0, type = "", typeSpacer = DOMID_TYPE
1034
984
  const typeStr = type !== null && type.length > 0 ? `${typeSpacer}${type}` : "";
1035
985
  return `${DOMID_STATE}-${itemId}${typeStr}-${counter}`;
1036
986
  }
1037
- (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(stateDomId, "stateDomId");
1038
- var setupDoc = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)((parentParsedItem, doc, diagramStates, nodes2, edges2, altFlag, look, classes2) => {
1039
- _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .log */ .Rm.trace("items", doc);
987
+ (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(stateDomId, "stateDomId");
988
+ var setupDoc = /* @__PURE__ */ (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)((parentParsedItem, doc, diagramStates, nodes, edges, altFlag, look, classes) => {
989
+ _chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .log */ .Rm.trace("items", doc);
1040
990
  doc.forEach((item) => {
1041
991
  switch (item.stmt) {
1042
992
  case STMT_STATE:
1043
- dataFetcher(parentParsedItem, item, diagramStates, nodes2, edges2, altFlag, look, classes2);
993
+ dataFetcher(parentParsedItem, item, diagramStates, nodes, edges, altFlag, look, classes);
1044
994
  break;
1045
995
  case DEFAULT_STATE_TYPE:
1046
- dataFetcher(parentParsedItem, item, diagramStates, nodes2, edges2, altFlag, look, classes2);
996
+ dataFetcher(parentParsedItem, item, diagramStates, nodes, edges, altFlag, look, classes);
1047
997
  break;
1048
998
  case STMT_RELATION:
1049
999
  {
@@ -1051,21 +1001,21 @@ var setupDoc = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3
1051
1001
  parentParsedItem,
1052
1002
  item.state1,
1053
1003
  diagramStates,
1054
- nodes2,
1055
- edges2,
1004
+ nodes,
1005
+ edges,
1056
1006
  altFlag,
1057
1007
  look,
1058
- classes2
1008
+ classes
1059
1009
  );
1060
1010
  dataFetcher(
1061
1011
  parentParsedItem,
1062
1012
  item.state2,
1063
1013
  diagramStates,
1064
- nodes2,
1065
- edges2,
1014
+ nodes,
1015
+ edges,
1066
1016
  altFlag,
1067
1017
  look,
1068
- classes2
1018
+ classes
1069
1019
  );
1070
1020
  const edgeData = {
1071
1021
  id: "edge" + graphItemCount,
@@ -1075,7 +1025,7 @@ var setupDoc = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3
1075
1025
  arrowTypeEnd: "arrow_barb",
1076
1026
  style: G_EDGE_STYLE,
1077
1027
  labelStyle: "",
1078
- label: _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.sanitizeText(item.description, (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .getConfig2 */ .D7)()),
1028
+ label: _chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.sanitizeText(item.description, (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .getConfig2 */ .D7)()),
1079
1029
  arrowheadStyle: G_EDGE_ARROWHEADSTYLE,
1080
1030
  labelpos: G_EDGE_LABELPOS,
1081
1031
  labelType: G_EDGE_LABELTYPE,
@@ -1083,14 +1033,14 @@ var setupDoc = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3
1083
1033
  classes: CSS_EDGE,
1084
1034
  look
1085
1035
  };
1086
- edges2.push(edgeData);
1036
+ edges.push(edgeData);
1087
1037
  graphItemCount++;
1088
1038
  }
1089
1039
  break;
1090
1040
  }
1091
1041
  });
1092
1042
  }, "setupDoc");
1093
- var getDir2 = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)((parsedItem, defaultDir = DEFAULT_NESTED_DOC_DIR) => {
1043
+ var getDir2 = /* @__PURE__ */ (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)((parsedItem, defaultDir = DEFAULT_NESTED_DOC_DIR) => {
1094
1044
  let dir = defaultDir;
1095
1045
  if (parsedItem.doc) {
1096
1046
  for (const parsedItemDoc of parsedItem.doc) {
@@ -1101,7 +1051,7 @@ var getDir2 = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3_
1101
1051
  }
1102
1052
  return dir;
1103
1053
  }, "getDir");
1104
- function insertOrUpdateNode(nodes2, nodeData, classes2) {
1054
+ function insertOrUpdateNode(nodes, nodeData, classes) {
1105
1055
  if (!nodeData.id || nodeData.id === "</join></fork>" || nodeData.id === "</choice>") {
1106
1056
  return;
1107
1057
  }
@@ -1110,34 +1060,34 @@ function insertOrUpdateNode(nodes2, nodeData, classes2) {
1110
1060
  nodeData.cssCompiledStyles = [];
1111
1061
  }
1112
1062
  nodeData.cssClasses.split(" ").forEach((cssClass) => {
1113
- if (classes2.get(cssClass)) {
1114
- const classDef = classes2.get(cssClass);
1063
+ if (classes.get(cssClass)) {
1064
+ const classDef = classes.get(cssClass);
1115
1065
  nodeData.cssCompiledStyles = [...nodeData.cssCompiledStyles, ...classDef.styles];
1116
1066
  }
1117
1067
  });
1118
1068
  }
1119
- const existingNodeData = nodes2.find((node) => node.id === nodeData.id);
1069
+ const existingNodeData = nodes.find((node) => node.id === nodeData.id);
1120
1070
  if (existingNodeData) {
1121
1071
  Object.assign(existingNodeData, nodeData);
1122
1072
  } else {
1123
- nodes2.push(nodeData);
1073
+ nodes.push(nodeData);
1124
1074
  }
1125
1075
  }
1126
- (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(insertOrUpdateNode, "insertOrUpdateNode");
1076
+ (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(insertOrUpdateNode, "insertOrUpdateNode");
1127
1077
  function getClassesFromDbInfo(dbInfoItem) {
1128
1078
  return dbInfoItem?.classes?.join(" ") ?? "";
1129
1079
  }
1130
- (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(getClassesFromDbInfo, "getClassesFromDbInfo");
1080
+ (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(getClassesFromDbInfo, "getClassesFromDbInfo");
1131
1081
  function getStylesFromDbInfo(dbInfoItem) {
1132
1082
  return dbInfoItem?.styles ?? [];
1133
1083
  }
1134
- (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(getStylesFromDbInfo, "getStylesFromDbInfo");
1135
- var dataFetcher = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)((parent, parsedItem, diagramStates, nodes2, edges2, altFlag, look, classes2) => {
1084
+ (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(getStylesFromDbInfo, "getStylesFromDbInfo");
1085
+ var dataFetcher = /* @__PURE__ */ (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)((parent, parsedItem, diagramStates, nodes, edges, altFlag, look, classes) => {
1136
1086
  const itemId = parsedItem.id;
1137
1087
  const dbState = diagramStates.get(itemId);
1138
1088
  const classStr = getClassesFromDbInfo(dbState);
1139
1089
  const style = getStylesFromDbInfo(dbState);
1140
- _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .log */ .Rm.info("dataFetcher parsedItem", parsedItem, dbState, style);
1090
+ _chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .log */ .Rm.info("dataFetcher parsedItem", parsedItem, dbState, style);
1141
1091
  if (itemId !== "root") {
1142
1092
  let shape = SHAPE_STATE;
1143
1093
  if (parsedItem.start === true) {
@@ -1152,7 +1102,7 @@ var dataFetcher = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODUL
1152
1102
  nodeDb.set(itemId, {
1153
1103
  id: itemId,
1154
1104
  shape,
1155
- description: _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.sanitizeText(itemId, (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .getConfig2 */ .D7)()),
1105
+ description: _chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.sanitizeText(itemId, (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .getConfig2 */ .D7)()),
1156
1106
  cssClasses: `${classStr} ${CSS_DIAGRAM_STATE}`,
1157
1107
  cssStyles: style
1158
1108
  });
@@ -1175,7 +1125,7 @@ var dataFetcher = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODUL
1175
1125
  newNode.description = parsedItem.description;
1176
1126
  }
1177
1127
  }
1178
- newNode.description = _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.sanitizeTextOrArray(newNode.description, (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .getConfig2 */ .D7)());
1128
+ newNode.description = _chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.sanitizeTextOrArray(newNode.description, (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .getConfig2 */ .D7)());
1179
1129
  }
1180
1130
  if (newNode.description?.length === 1 && newNode.shape === SHAPE_STATE_WITH_DESC) {
1181
1131
  if (newNode.type === "group") {
@@ -1185,7 +1135,7 @@ var dataFetcher = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODUL
1185
1135
  }
1186
1136
  }
1187
1137
  if (!newNode.type && parsedItem.doc) {
1188
- _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .log */ .Rm.info("Setting cluster for XCX", itemId, getDir2(parsedItem));
1138
+ _chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .log */ .Rm.info("Setting cluster for XCX", itemId, getDir2(parsedItem));
1189
1139
  newNode.type = "group";
1190
1140
  newNode.isGroup = true;
1191
1141
  newNode.dir = getDir2(parsedItem);
@@ -1213,7 +1163,7 @@ var dataFetcher = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODUL
1213
1163
  nodeData.label = "";
1214
1164
  }
1215
1165
  if (parent && parent.id !== "root") {
1216
- _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .log */ .Rm.trace("Setting node ", itemId, " to be child of its parent ", parent.id);
1166
+ _chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .log */ .Rm.trace("Setting node ", itemId, " to be child of its parent ", parent.id);
1217
1167
  nodeData.parentId = parent.id;
1218
1168
  }
1219
1169
  nodeData.centerLabel = true;
@@ -1230,7 +1180,7 @@ var dataFetcher = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODUL
1230
1180
  domId: stateDomId(itemId, graphItemCount, NOTE),
1231
1181
  type: newNode.type,
1232
1182
  isGroup: newNode.type === "group",
1233
- padding: (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .getConfig2 */ .D7)().flowchart.padding,
1183
+ padding: (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .getConfig2 */ .D7)().flowchart.padding,
1234
1184
  look,
1235
1185
  position: parsedItem.note.position
1236
1186
  };
@@ -1253,16 +1203,16 @@ var dataFetcher = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODUL
1253
1203
  graphItemCount++;
1254
1204
  groupData.id = parentNodeId;
1255
1205
  noteData.parentId = parentNodeId;
1256
- insertOrUpdateNode(nodes2, groupData, classes2);
1257
- insertOrUpdateNode(nodes2, noteData, classes2);
1258
- insertOrUpdateNode(nodes2, nodeData, classes2);
1206
+ insertOrUpdateNode(nodes, groupData, classes);
1207
+ insertOrUpdateNode(nodes, noteData, classes);
1208
+ insertOrUpdateNode(nodes, nodeData, classes);
1259
1209
  let from = itemId;
1260
1210
  let to = noteData.id;
1261
1211
  if (parsedItem.note.position === "left of") {
1262
1212
  from = noteData.id;
1263
1213
  to = itemId;
1264
1214
  }
1265
- edges2.push({
1215
+ edges.push({
1266
1216
  id: from + "-" + to,
1267
1217
  start: from,
1268
1218
  end: to,
@@ -1278,15 +1228,15 @@ var dataFetcher = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODUL
1278
1228
  look
1279
1229
  });
1280
1230
  } else {
1281
- insertOrUpdateNode(nodes2, nodeData, classes2);
1231
+ insertOrUpdateNode(nodes, nodeData, classes);
1282
1232
  }
1283
1233
  }
1284
1234
  if (parsedItem.doc) {
1285
- _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .log */ .Rm.trace("Adding nodes children ");
1286
- setupDoc(parsedItem, parsedItem.doc, diagramStates, nodes2, edges2, !altFlag, look, classes2);
1235
+ _chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .log */ .Rm.trace("Adding nodes children ");
1236
+ setupDoc(parsedItem, parsedItem.doc, diagramStates, nodes, edges, !altFlag, look, classes);
1287
1237
  }
1288
1238
  }, "dataFetcher");
1289
- var reset = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(() => {
1239
+ var reset = /* @__PURE__ */ (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(() => {
1290
1240
  nodeDb.clear();
1291
1241
  graphItemCount = 0;
1292
1242
  }, "reset");
@@ -1303,13 +1253,8 @@ var STYLECLASS_SEP = ",";
1303
1253
  function newClassesList() {
1304
1254
  return /* @__PURE__ */ new Map();
1305
1255
  }
1306
- (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(newClassesList, "newClassesList");
1307
- var nodes = [];
1308
- var edges = [];
1309
- var direction = DEFAULT_DIAGRAM_DIRECTION;
1310
- var rootDoc = [];
1311
- var classes = newClassesList();
1312
- var newDoc = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(() => {
1256
+ (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(newClassesList, "newClassesList");
1257
+ var newDoc = /* @__PURE__ */ (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(() => {
1313
1258
  return {
1314
1259
  /** @type {{ id1: string, id2: string, relationTitle: string }[]} */
1315
1260
  relations: [],
@@ -1317,396 +1262,577 @@ var newDoc = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__
1317
1262
  documents: {}
1318
1263
  };
1319
1264
  }, "newDoc");
1320
- var documents = {
1321
- root: newDoc()
1322
- };
1323
- var currentDocument = documents.root;
1324
- var startEndCount = 0;
1325
- var dividerCnt = 0;
1326
- var lineType = {
1327
- LINE: 0,
1328
- DOTTED_LINE: 1
1329
- };
1330
- var relationType = {
1331
- AGGREGATION: 0,
1332
- EXTENSION: 1,
1333
- COMPOSITION: 2,
1334
- DEPENDENCY: 3
1335
- };
1336
- var clone = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)((o) => JSON.parse(JSON.stringify(o)), "clone");
1337
- var setRootDoc = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)((o) => {
1338
- _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .log */ .Rm.info("Setting root doc", o);
1339
- rootDoc = o;
1340
- }, "setRootDoc");
1341
- var getRootDoc = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(() => rootDoc, "getRootDoc");
1342
- var docTranslator = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)((parent, node, first) => {
1343
- if (node.stmt === STMT_RELATION) {
1344
- docTranslator(parent, node.state1, true);
1345
- docTranslator(parent, node.state2, false);
1346
- } else {
1347
- if (node.stmt === STMT_STATE) {
1348
- if (node.id === "[*]") {
1349
- node.id = first ? parent.id + "_start" : parent.id + "_end";
1350
- node.start = first;
1351
- } else {
1352
- node.id = node.id.trim();
1353
- }
1265
+ var clone = /* @__PURE__ */ (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)((o) => JSON.parse(JSON.stringify(o)), "clone");
1266
+ var StateDB = class {
1267
+ static {
1268
+ (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(this, "StateDB");
1269
+ }
1270
+ /**
1271
+ * @param {1 | 2} version - v1 renderer or v2 renderer.
1272
+ */
1273
+ constructor(version) {
1274
+ this.clear();
1275
+ this.version = version;
1276
+ this.setRootDoc = this.setRootDoc.bind(this);
1277
+ this.getDividerId = this.getDividerId.bind(this);
1278
+ this.setDirection = this.setDirection.bind(this);
1279
+ this.trimColon = this.trimColon.bind(this);
1280
+ }
1281
+ /**
1282
+ * @private
1283
+ * @type {1 | 2}
1284
+ */
1285
+ version;
1286
+ /**
1287
+ * @private
1288
+ * @type {Array}
1289
+ */
1290
+ nodes = [];
1291
+ /**
1292
+ * @private
1293
+ * @type {Array}
1294
+ */
1295
+ edges = [];
1296
+ /**
1297
+ * @private
1298
+ * @type {Array}
1299
+ */
1300
+ rootDoc = [];
1301
+ /**
1302
+ * @private
1303
+ * @type {Map<string, any>}
1304
+ */
1305
+ classes = newClassesList();
1306
+ // style classes defined by a classDef
1307
+ /**
1308
+ * @private
1309
+ * @type {Object}
1310
+ */
1311
+ documents = {
1312
+ root: newDoc()
1313
+ };
1314
+ /**
1315
+ * @private
1316
+ * @type {Object}
1317
+ */
1318
+ currentDocument = this.documents.root;
1319
+ /**
1320
+ * @private
1321
+ * @type {number}
1322
+ */
1323
+ startEndCount = 0;
1324
+ /**
1325
+ * @private
1326
+ * @type {number}
1327
+ */
1328
+ dividerCnt = 0;
1329
+ static relationType = {
1330
+ AGGREGATION: 0,
1331
+ EXTENSION: 1,
1332
+ COMPOSITION: 2,
1333
+ DEPENDENCY: 3
1334
+ };
1335
+ setRootDoc(o) {
1336
+ _chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .log */ .Rm.info("Setting root doc", o);
1337
+ this.rootDoc = o;
1338
+ if (this.version === 1) {
1339
+ this.extract(o);
1340
+ } else {
1341
+ this.extract(this.getRootDocV2());
1354
1342
  }
1355
- if (node.doc) {
1356
- const doc = [];
1357
- let currentDoc = [];
1358
- let i;
1359
- for (i = 0; i < node.doc.length; i++) {
1360
- if (node.doc[i].type === DIVIDER_TYPE) {
1361
- const newNode = clone(node.doc[i]);
1362
- newNode.doc = clone(currentDoc);
1363
- doc.push(newNode);
1364
- currentDoc = [];
1343
+ }
1344
+ getRootDoc() {
1345
+ return this.rootDoc;
1346
+ }
1347
+ /**
1348
+ * @private
1349
+ * @param {Object} parent
1350
+ * @param {Object} node
1351
+ * @param {boolean} first
1352
+ */
1353
+ docTranslator(parent, node, first) {
1354
+ if (node.stmt === STMT_RELATION) {
1355
+ this.docTranslator(parent, node.state1, true);
1356
+ this.docTranslator(parent, node.state2, false);
1357
+ } else {
1358
+ if (node.stmt === STMT_STATE) {
1359
+ if (node.id === "[*]") {
1360
+ node.id = first ? parent.id + "_start" : parent.id + "_end";
1361
+ node.start = first;
1365
1362
  } else {
1366
- currentDoc.push(node.doc[i]);
1363
+ node.id = node.id.trim();
1367
1364
  }
1368
1365
  }
1369
- if (doc.length > 0 && currentDoc.length > 0) {
1370
- const newNode = {
1371
- stmt: STMT_STATE,
1372
- id: (0,_chunk_TLUHKHBO_mjs__WEBPACK_IMPORTED_MODULE_2__/* .generateId */ .$C)(),
1373
- type: "divider",
1374
- doc: clone(currentDoc)
1375
- };
1376
- doc.push(clone(newNode));
1377
- node.doc = doc;
1366
+ if (node.doc) {
1367
+ const doc = [];
1368
+ let currentDoc = [];
1369
+ let i;
1370
+ for (i = 0; i < node.doc.length; i++) {
1371
+ if (node.doc[i].type === DIVIDER_TYPE) {
1372
+ const newNode = clone(node.doc[i]);
1373
+ newNode.doc = clone(currentDoc);
1374
+ doc.push(newNode);
1375
+ currentDoc = [];
1376
+ } else {
1377
+ currentDoc.push(node.doc[i]);
1378
+ }
1379
+ }
1380
+ if (doc.length > 0 && currentDoc.length > 0) {
1381
+ const newNode = {
1382
+ stmt: STMT_STATE,
1383
+ id: (0,_chunk_O4NI6UNU_mjs__WEBPACK_IMPORTED_MODULE_2__/* .generateId */ .$C)(),
1384
+ type: "divider",
1385
+ doc: clone(currentDoc)
1386
+ };
1387
+ doc.push(clone(newNode));
1388
+ node.doc = doc;
1389
+ }
1390
+ node.doc.forEach((docNode) => this.docTranslator(node, docNode, true));
1378
1391
  }
1379
- node.doc.forEach((docNode) => docTranslator(node, docNode, true));
1380
1392
  }
1381
1393
  }
1382
- }, "docTranslator");
1383
- var getRootDocV2 = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(() => {
1384
- docTranslator({ id: "root" }, { id: "root", doc: rootDoc }, true);
1385
- return { id: "root", doc: rootDoc };
1386
- }, "getRootDocV2");
1387
- var extract = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)((_doc) => {
1388
- let doc;
1389
- if (_doc.doc) {
1390
- doc = _doc.doc;
1391
- } else {
1392
- doc = _doc;
1394
+ /**
1395
+ * @private
1396
+ */
1397
+ getRootDocV2() {
1398
+ this.docTranslator({ id: "root" }, { id: "root", doc: this.rootDoc }, true);
1399
+ return { id: "root", doc: this.rootDoc };
1393
1400
  }
1394
- _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .log */ .Rm.info(doc);
1395
- clear2(true);
1396
- _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .log */ .Rm.info("Extract initial document:", doc);
1397
- doc.forEach((item) => {
1398
- _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .log */ .Rm.warn("Statement", item.stmt);
1399
- switch (item.stmt) {
1400
- case STMT_STATE:
1401
- addState(
1402
- item.id.trim(),
1403
- item.type,
1404
- item.doc,
1405
- item.description,
1406
- item.note,
1407
- item.classes,
1408
- item.styles,
1409
- item.textStyles
1410
- );
1411
- break;
1412
- case STMT_RELATION:
1413
- addRelation(item.state1, item.state2, item.description);
1414
- break;
1415
- case STMT_CLASSDEF:
1416
- addStyleClass(item.id.trim(), item.classes);
1417
- break;
1418
- case STMT_STYLEDEF:
1419
- {
1420
- const ids = item.id.trim().split(",");
1421
- const styles = item.styleClass.split(",");
1422
- ids.forEach((id) => {
1423
- let foundState = getState(id);
1424
- if (foundState === void 0) {
1425
- const trimmedId = id.trim();
1426
- addState(trimmedId);
1427
- foundState = getState(trimmedId);
1428
- }
1429
- foundState.styles = styles.map((s) => s.replace(/;/g, "")?.trim());
1430
- });
1401
+ /**
1402
+ * Convert all of the statements (stmts) that were parsed into states and relationships.
1403
+ * This is done because a state diagram may have nested sections,
1404
+ * where each section is a 'document' and has its own set of statements.
1405
+ * Ex: the section within a fork has its own statements, and incoming and outgoing statements
1406
+ * refer to the fork as a whole (document).
1407
+ * See the parser grammar: the definition of a document is a document then a 'line', where a line can be a statement.
1408
+ * This will push the statement into the list of statements for the current document.
1409
+ * @private
1410
+ * @param _doc
1411
+ */
1412
+ extract(_doc) {
1413
+ let doc;
1414
+ if (_doc.doc) {
1415
+ doc = _doc.doc;
1416
+ } else {
1417
+ doc = _doc;
1418
+ }
1419
+ _chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .log */ .Rm.info(doc);
1420
+ this.clear(true);
1421
+ _chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .log */ .Rm.info("Extract initial document:", doc);
1422
+ doc.forEach((item) => {
1423
+ _chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .log */ .Rm.warn("Statement", item.stmt);
1424
+ switch (item.stmt) {
1425
+ case STMT_STATE:
1426
+ this.addState(
1427
+ item.id.trim(),
1428
+ item.type,
1429
+ item.doc,
1430
+ item.description,
1431
+ item.note,
1432
+ item.classes,
1433
+ item.styles,
1434
+ item.textStyles
1435
+ );
1436
+ break;
1437
+ case STMT_RELATION:
1438
+ this.addRelation(item.state1, item.state2, item.description);
1439
+ break;
1440
+ case STMT_CLASSDEF:
1441
+ this.addStyleClass(item.id.trim(), item.classes);
1442
+ break;
1443
+ case STMT_STYLEDEF:
1444
+ {
1445
+ const ids = item.id.trim().split(",");
1446
+ const styles = item.styleClass.split(",");
1447
+ ids.forEach((id) => {
1448
+ let foundState = this.getState(id);
1449
+ if (foundState === void 0) {
1450
+ const trimmedId = id.trim();
1451
+ this.addState(trimmedId);
1452
+ foundState = this.getState(trimmedId);
1453
+ }
1454
+ foundState.styles = styles.map((s) => s.replace(/;/g, "")?.trim());
1455
+ });
1456
+ }
1457
+ break;
1458
+ case STMT_APPLYCLASS:
1459
+ this.setCssClass(item.id.trim(), item.styleClass);
1460
+ break;
1461
+ }
1462
+ });
1463
+ const diagramStates = this.getStates();
1464
+ const config = (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .getConfig2 */ .D7)();
1465
+ const look = config.look;
1466
+ reset();
1467
+ dataFetcher(
1468
+ void 0,
1469
+ this.getRootDocV2(),
1470
+ diagramStates,
1471
+ this.nodes,
1472
+ this.edges,
1473
+ true,
1474
+ look,
1475
+ this.classes
1476
+ );
1477
+ this.nodes.forEach((node) => {
1478
+ if (Array.isArray(node.label)) {
1479
+ node.description = node.label.slice(1);
1480
+ if (node.isGroup && node.description.length > 0) {
1481
+ throw new Error(
1482
+ "Group nodes can only have label. Remove the additional description for node [" + node.id + "]"
1483
+ );
1431
1484
  }
1432
- break;
1433
- case STMT_APPLYCLASS:
1434
- setCssClass(item.id.trim(), item.styleClass);
1435
- break;
1485
+ node.label = node.label[0];
1486
+ }
1487
+ });
1488
+ }
1489
+ /**
1490
+ * Function called by parser when a node definition has been found.
1491
+ *
1492
+ * @param {null | string} id
1493
+ * @param {null | string} type
1494
+ * @param {null | string} doc
1495
+ * @param {null | string | string[]} descr - description for the state. Can be a string or a list or strings
1496
+ * @param {null | string} note
1497
+ * @param {null | string | string[]} 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.
1498
+ * @param {null | string | string[]} 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.
1499
+ * @param {null | string | string[]} 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.
1500
+ */
1501
+ addState(id, type = DEFAULT_STATE_TYPE, doc = null, descr = null, note = null, classes = null, styles = null, textStyles = null) {
1502
+ const trimmedId = id?.trim();
1503
+ if (!this.currentDocument.states.has(trimmedId)) {
1504
+ _chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .log */ .Rm.info("Adding state ", trimmedId, descr);
1505
+ this.currentDocument.states.set(trimmedId, {
1506
+ id: trimmedId,
1507
+ descriptions: [],
1508
+ type,
1509
+ doc,
1510
+ note,
1511
+ classes: [],
1512
+ styles: [],
1513
+ textStyles: []
1514
+ });
1515
+ } else {
1516
+ if (!this.currentDocument.states.get(trimmedId).doc) {
1517
+ this.currentDocument.states.get(trimmedId).doc = doc;
1518
+ }
1519
+ if (!this.currentDocument.states.get(trimmedId).type) {
1520
+ this.currentDocument.states.get(trimmedId).type = type;
1521
+ }
1436
1522
  }
1437
- });
1438
- const diagramStates = getStates();
1439
- const config = (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .getConfig2 */ .D7)();
1440
- const look = config.look;
1441
- reset();
1442
- dataFetcher(void 0, getRootDocV2(), diagramStates, nodes, edges, true, look, classes);
1443
- nodes.forEach((node) => {
1444
- if (Array.isArray(node.label)) {
1445
- node.description = node.label.slice(1);
1446
- if (node.isGroup && node.description.length > 0) {
1447
- throw new Error(
1448
- "Group nodes can only have label. Remove the additional description for node [" + node.id + "]"
1449
- );
1523
+ if (descr) {
1524
+ _chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .log */ .Rm.info("Setting state description", trimmedId, descr);
1525
+ if (typeof descr === "string") {
1526
+ this.addDescription(trimmedId, descr.trim());
1527
+ }
1528
+ if (typeof descr === "object") {
1529
+ descr.forEach((des) => this.addDescription(trimmedId, des.trim()));
1450
1530
  }
1451
- node.label = node.label[0];
1452
1531
  }
1453
- });
1454
- }, "extract");
1455
- var addState = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(id, type = DEFAULT_STATE_TYPE, doc = null, descr = null, note = null, classes2 = null, styles = null, textStyles = null) {
1456
- const trimmedId = id?.trim();
1457
- if (!currentDocument.states.has(trimmedId)) {
1458
- _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .log */ .Rm.info("Adding state ", trimmedId, descr);
1459
- currentDocument.states.set(trimmedId, {
1460
- id: trimmedId,
1461
- descriptions: [],
1462
- type,
1463
- doc,
1464
- note,
1465
- classes: [],
1466
- styles: [],
1467
- textStyles: []
1468
- });
1469
- } else {
1470
- if (!currentDocument.states.get(trimmedId).doc) {
1471
- currentDocument.states.get(trimmedId).doc = doc;
1532
+ if (note) {
1533
+ const doc2 = this.currentDocument.states.get(trimmedId);
1534
+ doc2.note = note;
1535
+ doc2.note.text = _chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.sanitizeText(doc2.note.text, (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .getConfig2 */ .D7)());
1472
1536
  }
1473
- if (!currentDocument.states.get(trimmedId).type) {
1474
- currentDocument.states.get(trimmedId).type = type;
1537
+ if (classes) {
1538
+ _chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .log */ .Rm.info("Setting state classes", trimmedId, classes);
1539
+ const classesList = typeof classes === "string" ? [classes] : classes;
1540
+ classesList.forEach((cssClass) => this.setCssClass(trimmedId, cssClass.trim()));
1475
1541
  }
1476
- }
1477
- if (descr) {
1478
- _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .log */ .Rm.info("Setting state description", trimmedId, descr);
1479
- if (typeof descr === "string") {
1480
- addDescription(trimmedId, descr.trim());
1542
+ if (styles) {
1543
+ _chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .log */ .Rm.info("Setting state styles", trimmedId, styles);
1544
+ const stylesList = typeof styles === "string" ? [styles] : styles;
1545
+ stylesList.forEach((style) => this.setStyle(trimmedId, style.trim()));
1481
1546
  }
1482
- if (typeof descr === "object") {
1483
- descr.forEach((des) => addDescription(trimmedId, des.trim()));
1547
+ if (textStyles) {
1548
+ _chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .log */ .Rm.info("Setting state styles", trimmedId, styles);
1549
+ const textStylesList = typeof textStyles === "string" ? [textStyles] : textStyles;
1550
+ textStylesList.forEach((textStyle) => this.setTextStyle(trimmedId, textStyle.trim()));
1484
1551
  }
1485
1552
  }
1486
- if (note) {
1487
- const doc2 = currentDocument.states.get(trimmedId);
1488
- doc2.note = note;
1489
- doc2.note.text = _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.sanitizeText(doc2.note.text, (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .getConfig2 */ .D7)());
1553
+ clear(saveCommon) {
1554
+ this.nodes = [];
1555
+ this.edges = [];
1556
+ this.documents = {
1557
+ root: newDoc()
1558
+ };
1559
+ this.currentDocument = this.documents.root;
1560
+ this.startEndCount = 0;
1561
+ this.classes = newClassesList();
1562
+ if (!saveCommon) {
1563
+ (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .clear */ .IU)();
1564
+ }
1490
1565
  }
1491
- if (classes2) {
1492
- _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .log */ .Rm.info("Setting state classes", trimmedId, classes2);
1493
- const classesList = typeof classes2 === "string" ? [classes2] : classes2;
1494
- classesList.forEach((cssClass) => setCssClass(trimmedId, cssClass.trim()));
1566
+ getState(id) {
1567
+ return this.currentDocument.states.get(id);
1495
1568
  }
1496
- if (styles) {
1497
- _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .log */ .Rm.info("Setting state styles", trimmedId, styles);
1498
- const stylesList = typeof styles === "string" ? [styles] : styles;
1499
- stylesList.forEach((style) => setStyle(trimmedId, style.trim()));
1569
+ getStates() {
1570
+ return this.currentDocument.states;
1500
1571
  }
1501
- if (textStyles) {
1502
- _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .log */ .Rm.info("Setting state styles", trimmedId, styles);
1503
- const textStylesList = typeof textStyles === "string" ? [textStyles] : textStyles;
1504
- textStylesList.forEach((textStyle) => setTextStyle(trimmedId, textStyle.trim()));
1572
+ logDocuments() {
1573
+ _chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .log */ .Rm.info("Documents = ", this.documents);
1505
1574
  }
1506
- }, "addState");
1507
- var clear2 = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(saveCommon) {
1508
- nodes = [];
1509
- edges = [];
1510
- documents = {
1511
- root: newDoc()
1512
- };
1513
- currentDocument = documents.root;
1514
- startEndCount = 0;
1515
- classes = newClassesList();
1516
- if (!saveCommon) {
1517
- (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .clear */ .IU)();
1575
+ getRelations() {
1576
+ return this.currentDocument.relations;
1518
1577
  }
1519
- }, "clear");
1520
- var getState = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(id) {
1521
- return currentDocument.states.get(id);
1522
- }, "getState");
1523
- var getStates = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function() {
1524
- return currentDocument.states;
1525
- }, "getStates");
1526
- var logDocuments = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function() {
1527
- _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .log */ .Rm.info("Documents = ", documents);
1528
- }, "logDocuments");
1529
- var getRelations = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function() {
1530
- return currentDocument.relations;
1531
- }, "getRelations");
1532
- function startIdIfNeeded(id = "") {
1533
- let fixedId = id;
1534
- if (id === START_NODE) {
1535
- startEndCount++;
1536
- fixedId = `${START_TYPE}${startEndCount}`;
1578
+ /**
1579
+ * If the id is a start node ( [*] ), then return a new id constructed from
1580
+ * the start node name and the current start node count.
1581
+ * else return the given id
1582
+ *
1583
+ * @param {string} id
1584
+ * @returns {string} - the id (original or constructed)
1585
+ * @private
1586
+ */
1587
+ startIdIfNeeded(id = "") {
1588
+ let fixedId = id;
1589
+ if (id === START_NODE) {
1590
+ this.startEndCount++;
1591
+ fixedId = `${START_TYPE}${this.startEndCount}`;
1592
+ }
1593
+ return fixedId;
1537
1594
  }
1538
- return fixedId;
1539
- }
1540
- (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(startIdIfNeeded, "startIdIfNeeded");
1541
- function startTypeIfNeeded(id = "", type = DEFAULT_STATE_TYPE) {
1542
- return id === START_NODE ? START_TYPE : type;
1543
- }
1544
- (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(startTypeIfNeeded, "startTypeIfNeeded");
1545
- function endIdIfNeeded(id = "") {
1546
- let fixedId = id;
1547
- if (id === END_NODE) {
1548
- startEndCount++;
1549
- fixedId = `${END_TYPE}${startEndCount}`;
1595
+ /**
1596
+ * If the id is a start node ( [*] ), then return the start type ('start')
1597
+ * else return the given type
1598
+ *
1599
+ * @param {string} id
1600
+ * @param {string} type
1601
+ * @returns {string} - the type that should be used
1602
+ * @private
1603
+ */
1604
+ startTypeIfNeeded(id = "", type = DEFAULT_STATE_TYPE) {
1605
+ return id === START_NODE ? START_TYPE : type;
1550
1606
  }
1551
- return fixedId;
1552
- }
1553
- (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(endIdIfNeeded, "endIdIfNeeded");
1554
- function endTypeIfNeeded(id = "", type = DEFAULT_STATE_TYPE) {
1555
- return id === END_NODE ? END_TYPE : type;
1556
- }
1557
- (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(endTypeIfNeeded, "endTypeIfNeeded");
1558
- function addRelationObjs(item1, item2, relationTitle) {
1559
- let id1 = startIdIfNeeded(item1.id.trim());
1560
- let type1 = startTypeIfNeeded(item1.id.trim(), item1.type);
1561
- let id2 = startIdIfNeeded(item2.id.trim());
1562
- let type2 = startTypeIfNeeded(item2.id.trim(), item2.type);
1563
- addState(
1564
- id1,
1565
- type1,
1566
- item1.doc,
1567
- item1.description,
1568
- item1.note,
1569
- item1.classes,
1570
- item1.styles,
1571
- item1.textStyles
1572
- );
1573
- addState(
1574
- id2,
1575
- type2,
1576
- item2.doc,
1577
- item2.description,
1578
- item2.note,
1579
- item2.classes,
1580
- item2.styles,
1581
- item2.textStyles
1582
- );
1583
- currentDocument.relations.push({
1584
- id1,
1585
- id2,
1586
- relationTitle: _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.sanitizeText(relationTitle, (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .getConfig2 */ .D7)())
1587
- });
1588
- }
1589
- (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(addRelationObjs, "addRelationObjs");
1590
- var addRelation = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(item1, item2, title) {
1591
- if (typeof item1 === "object") {
1592
- addRelationObjs(item1, item2, title);
1593
- } else {
1594
- const id1 = startIdIfNeeded(item1.trim());
1595
- const type1 = startTypeIfNeeded(item1);
1596
- const id2 = endIdIfNeeded(item2.trim());
1597
- const type2 = endTypeIfNeeded(item2);
1598
- addState(id1, type1);
1599
- addState(id2, type2);
1600
- currentDocument.relations.push({
1607
+ /**
1608
+ * If the id is an end node ( [*] ), then return a new id constructed from
1609
+ * the end node name and the current start_end node count.
1610
+ * else return the given id
1611
+ *
1612
+ * @param {string} id
1613
+ * @returns {string} - the id (original or constructed)
1614
+ * @private
1615
+ */
1616
+ endIdIfNeeded(id = "") {
1617
+ let fixedId = id;
1618
+ if (id === END_NODE) {
1619
+ this.startEndCount++;
1620
+ fixedId = `${END_TYPE}${this.startEndCount}`;
1621
+ }
1622
+ return fixedId;
1623
+ }
1624
+ /**
1625
+ * If the id is an end node ( [*] ), then return the end type
1626
+ * else return the given type
1627
+ *
1628
+ * @param {string} id
1629
+ * @param {string} type
1630
+ * @returns {string} - the type that should be used
1631
+ * @private
1632
+ */
1633
+ endTypeIfNeeded(id = "", type = DEFAULT_STATE_TYPE) {
1634
+ return id === END_NODE ? END_TYPE : type;
1635
+ }
1636
+ /**
1637
+ *
1638
+ * @param item1
1639
+ * @param item2
1640
+ * @param relationTitle
1641
+ */
1642
+ addRelationObjs(item1, item2, relationTitle) {
1643
+ let id1 = this.startIdIfNeeded(item1.id.trim());
1644
+ let type1 = this.startTypeIfNeeded(item1.id.trim(), item1.type);
1645
+ let id2 = this.startIdIfNeeded(item2.id.trim());
1646
+ let type2 = this.startTypeIfNeeded(item2.id.trim(), item2.type);
1647
+ this.addState(
1601
1648
  id1,
1649
+ type1,
1650
+ item1.doc,
1651
+ item1.description,
1652
+ item1.note,
1653
+ item1.classes,
1654
+ item1.styles,
1655
+ item1.textStyles
1656
+ );
1657
+ this.addState(
1602
1658
  id2,
1603
- title: _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.sanitizeText(title, (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .getConfig2 */ .D7)())
1659
+ type2,
1660
+ item2.doc,
1661
+ item2.description,
1662
+ item2.note,
1663
+ item2.classes,
1664
+ item2.styles,
1665
+ item2.textStyles
1666
+ );
1667
+ this.currentDocument.relations.push({
1668
+ id1,
1669
+ id2,
1670
+ relationTitle: _chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.sanitizeText(relationTitle, (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .getConfig2 */ .D7)())
1604
1671
  });
1605
1672
  }
1606
- }, "addRelation");
1607
- var addDescription = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(id, descr) {
1608
- const theState = currentDocument.states.get(id);
1609
- const _descr = descr.startsWith(":") ? descr.replace(":", "").trim() : descr;
1610
- theState.descriptions.push(_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.sanitizeText(_descr, (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .getConfig2 */ .D7)()));
1611
- }, "addDescription");
1612
- var cleanupLabel = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(label) {
1613
- if (label.substring(0, 1) === ":") {
1614
- return label.substr(2).trim();
1615
- } else {
1616
- return label.trim();
1673
+ /**
1674
+ * Add a relation between two items. The items may be full objects or just the string id of a state.
1675
+ *
1676
+ * @param {string | object} item1
1677
+ * @param {string | object} item2
1678
+ * @param {string} title
1679
+ */
1680
+ addRelation(item1, item2, title) {
1681
+ if (typeof item1 === "object") {
1682
+ this.addRelationObjs(item1, item2, title);
1683
+ } else {
1684
+ const id1 = this.startIdIfNeeded(item1.trim());
1685
+ const type1 = this.startTypeIfNeeded(item1);
1686
+ const id2 = this.endIdIfNeeded(item2.trim());
1687
+ const type2 = this.endTypeIfNeeded(item2);
1688
+ this.addState(id1, type1);
1689
+ this.addState(id2, type2);
1690
+ this.currentDocument.relations.push({
1691
+ id1,
1692
+ id2,
1693
+ title: _chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.sanitizeText(title, (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .getConfig2 */ .D7)())
1694
+ });
1695
+ }
1617
1696
  }
1618
- }, "cleanupLabel");
1619
- var getDividerId = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(() => {
1620
- dividerCnt++;
1621
- return "divider-id-" + dividerCnt;
1622
- }, "getDividerId");
1623
- var addStyleClass = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(id, styleAttributes = "") {
1624
- if (!classes.has(id)) {
1625
- classes.set(id, { id, styles: [], textStyles: [] });
1697
+ addDescription(id, descr) {
1698
+ const theState = this.currentDocument.states.get(id);
1699
+ const _descr = descr.startsWith(":") ? descr.replace(":", "").trim() : descr;
1700
+ theState.descriptions.push(_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .common_default */ .Y2.sanitizeText(_descr, (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .getConfig2 */ .D7)()));
1701
+ }
1702
+ cleanupLabel(label) {
1703
+ if (label.substring(0, 1) === ":") {
1704
+ return label.substr(2).trim();
1705
+ } else {
1706
+ return label.trim();
1707
+ }
1626
1708
  }
1627
- const foundClass = classes.get(id);
1628
- if (styleAttributes !== void 0 && styleAttributes !== null) {
1629
- styleAttributes.split(STYLECLASS_SEP).forEach((attrib) => {
1630
- const fixedAttrib = attrib.replace(/([^;]*);/, "$1").trim();
1631
- if (RegExp(COLOR_KEYWORD).exec(attrib)) {
1632
- const newStyle1 = fixedAttrib.replace(FILL_KEYWORD, BG_FILL);
1633
- const newStyle2 = newStyle1.replace(COLOR_KEYWORD, FILL_KEYWORD);
1634
- foundClass.textStyles.push(newStyle2);
1709
+ getDividerId() {
1710
+ this.dividerCnt++;
1711
+ return "divider-id-" + this.dividerCnt;
1712
+ }
1713
+ /**
1714
+ * Called when the parser comes across a (style) class definition
1715
+ * @example classDef my-style fill:#f96;
1716
+ *
1717
+ * @param {string} id - the id of this (style) class
1718
+ * @param {string | null} styleAttributes - the string with 1 or more style attributes (each separated by a comma)
1719
+ */
1720
+ addStyleClass(id, styleAttributes = "") {
1721
+ if (!this.classes.has(id)) {
1722
+ this.classes.set(id, { id, styles: [], textStyles: [] });
1723
+ }
1724
+ const foundClass = this.classes.get(id);
1725
+ if (styleAttributes !== void 0 && styleAttributes !== null) {
1726
+ styleAttributes.split(STYLECLASS_SEP).forEach((attrib) => {
1727
+ const fixedAttrib = attrib.replace(/([^;]*);/, "$1").trim();
1728
+ if (RegExp(COLOR_KEYWORD).exec(attrib)) {
1729
+ const newStyle1 = fixedAttrib.replace(FILL_KEYWORD, BG_FILL);
1730
+ const newStyle2 = newStyle1.replace(COLOR_KEYWORD, FILL_KEYWORD);
1731
+ foundClass.textStyles.push(newStyle2);
1732
+ }
1733
+ foundClass.styles.push(fixedAttrib);
1734
+ });
1735
+ }
1736
+ }
1737
+ /**
1738
+ * Return all of the style classes
1739
+ * @returns {{} | any | classes}
1740
+ */
1741
+ getClasses() {
1742
+ return this.classes;
1743
+ }
1744
+ /**
1745
+ * Add a (style) class or css class to a state with the given id.
1746
+ * If the state isn't already in the list of known states, add it.
1747
+ * Might be called by parser when a style class or CSS class should be applied to a state
1748
+ *
1749
+ * @param {string | string[]} itemIds The id or a list of ids of the item(s) to apply the css class to
1750
+ * @param {string} cssClassName CSS class name
1751
+ */
1752
+ setCssClass(itemIds, cssClassName) {
1753
+ itemIds.split(",").forEach((id) => {
1754
+ let foundState = this.getState(id);
1755
+ if (foundState === void 0) {
1756
+ const trimmedId = id.trim();
1757
+ this.addState(trimmedId);
1758
+ foundState = this.getState(trimmedId);
1635
1759
  }
1636
- foundClass.styles.push(fixedAttrib);
1760
+ foundState.classes.push(cssClassName);
1637
1761
  });
1638
1762
  }
1639
- }, "addStyleClass");
1640
- var getClasses2 = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function() {
1641
- return classes;
1642
- }, "getClasses");
1643
- var setCssClass = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(itemIds, cssClassName) {
1644
- itemIds.split(",").forEach(function(id) {
1645
- let foundState = getState(id);
1646
- if (foundState === void 0) {
1647
- const trimmedId = id.trim();
1648
- addState(trimmedId);
1649
- foundState = getState(trimmedId);
1763
+ /**
1764
+ * Add a style to a state with the given id.
1765
+ * @example style stateId fill:#f9f,stroke:#333,stroke-width:4px
1766
+ * where 'style' is the keyword
1767
+ * stateId is the id of a state
1768
+ * the rest of the string is the styleText (all of the attributes to be applied to the state)
1769
+ *
1770
+ * @param itemId The id of item to apply the style to
1771
+ * @param styleText - the text of the attributes for the style
1772
+ */
1773
+ setStyle(itemId, styleText) {
1774
+ const item = this.getState(itemId);
1775
+ if (item !== void 0) {
1776
+ item.styles.push(styleText);
1650
1777
  }
1651
- foundState.classes.push(cssClassName);
1652
- });
1653
- }, "setCssClass");
1654
- var setStyle = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(itemId, styleText) {
1655
- const item = getState(itemId);
1656
- if (item !== void 0) {
1657
- item.styles.push(styleText);
1658
1778
  }
1659
- }, "setStyle");
1660
- var setTextStyle = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(function(itemId, cssClassName) {
1661
- const item = getState(itemId);
1662
- if (item !== void 0) {
1663
- item.textStyles.push(cssClassName);
1779
+ /**
1780
+ * Add a text style to a state with the given id
1781
+ *
1782
+ * @param itemId The id of item to apply the css class to
1783
+ * @param cssClassName CSS class name
1784
+ */
1785
+ setTextStyle(itemId, cssClassName) {
1786
+ const item = this.getState(itemId);
1787
+ if (item !== void 0) {
1788
+ item.textStyles.push(cssClassName);
1789
+ }
1790
+ }
1791
+ /**
1792
+ * Finds the direction statement in the root document.
1793
+ * @private
1794
+ * @returns {{ value: string } | undefined} - the direction statement if present
1795
+ */
1796
+ getDirectionStatement() {
1797
+ return this.rootDoc.find((doc) => doc.stmt === STMT_DIRECTION);
1798
+ }
1799
+ getDirection() {
1800
+ return this.getDirectionStatement()?.value ?? DEFAULT_DIAGRAM_DIRECTION;
1664
1801
  }
1665
- }, "setTextStyle");
1666
- var getDirection = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(() => direction, "getDirection");
1667
- var setDirection = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)((dir) => {
1668
- direction = dir;
1669
- }, "setDirection");
1670
- var trimColon = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)((str) => str && str[0] === ":" ? str.substr(1).trim() : str.trim(), "trimColon");
1671
- var getData = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(() => {
1672
- const config = (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .getConfig2 */ .D7)();
1673
- return { nodes, edges, other: {}, config, direction: getDir(getRootDocV2()) };
1674
- }, "getData");
1675
- var stateDb_default = {
1676
- getConfig: /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)(() => (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .getConfig2 */ .D7)().state, "getConfig"),
1677
- getData,
1678
- addState,
1679
- clear: clear2,
1680
- getState,
1681
- getStates,
1682
- getRelations,
1683
- getClasses: getClasses2,
1684
- getDirection,
1685
- addRelation,
1686
- getDividerId,
1687
- setDirection,
1688
- cleanupLabel,
1689
- lineType,
1690
- relationType,
1691
- logDocuments,
1692
- getRootDoc,
1693
- setRootDoc,
1694
- getRootDocV2,
1695
- extract,
1696
- trimColon,
1697
- getAccTitle: _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .getAccTitle */ .iN,
1698
- setAccTitle: _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .setAccTitle */ .SV,
1699
- getAccDescription: _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .getAccDescription */ .m7,
1700
- setAccDescription: _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .setAccDescription */ .EI,
1701
- addStyleClass,
1702
- setCssClass,
1703
- addDescription,
1704
- setDiagramTitle: _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .setDiagramTitle */ .ke,
1705
- getDiagramTitle: _chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .getDiagramTitle */ .ab
1802
+ setDirection(dir) {
1803
+ const doc = this.getDirectionStatement();
1804
+ if (doc) {
1805
+ doc.value = dir;
1806
+ } else {
1807
+ this.rootDoc.unshift({ stmt: STMT_DIRECTION, value: dir });
1808
+ }
1809
+ }
1810
+ trimColon(str) {
1811
+ return str && str[0] === ":" ? str.substr(1).trim() : str.trim();
1812
+ }
1813
+ getData() {
1814
+ const config = (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .getConfig2 */ .D7)();
1815
+ return {
1816
+ nodes: this.nodes,
1817
+ edges: this.edges,
1818
+ other: {},
1819
+ config,
1820
+ direction: getDir(this.getRootDocV2())
1821
+ };
1822
+ }
1823
+ getConfig() {
1824
+ return (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .getConfig2 */ .D7)().state;
1825
+ }
1826
+ getAccTitle = _chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .getAccTitle */ .iN;
1827
+ setAccTitle = _chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .setAccTitle */ .SV;
1828
+ getAccDescription = _chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .getAccDescription */ .m7;
1829
+ setAccDescription = _chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .setAccDescription */ .EI;
1830
+ setDiagramTitle = _chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .setDiagramTitle */ .ke;
1831
+ getDiagramTitle = _chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .getDiagramTitle */ .ab;
1706
1832
  };
1707
1833
 
1708
1834
  // src/diagrams/state/styles.js
1709
- var getStyles = /* @__PURE__ */ (0,_chunk_S24QXQKS_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)((options) => `
1835
+ var getStyles = /* @__PURE__ */ (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_3__/* .__name */ .K2)((options) => `
1710
1836
  defs #statediagram-barbEnd {
1711
1837
  fill: ${options.transitionColor};
1712
1838
  stroke: ${options.transitionColor};
@@ -1926,8 +2052,58 @@ var styles_default = getStyles;
1926
2052
 
1927
2053
 
1928
2054
 
2055
+ /***/ }),
2056
+
2057
+ /***/ 5051:
2058
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2059
+
2060
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2061
+ /* harmony export */ A: () => (/* binding */ getDiagramElement),
2062
+ /* harmony export */ P: () => (/* binding */ setupViewPortForSVG)
2063
+ /* harmony export */ });
2064
+ /* harmony import */ var _chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3804);
2065
+ /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(8066);
2066
+
2067
+
2068
+ // src/rendering-util/insertElementsForSize.js
2069
+
2070
+ var getDiagramElement = /* @__PURE__ */ (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__name */ .K2)((id, securityLevel) => {
2071
+ let sandboxElement;
2072
+ if (securityLevel === "sandbox") {
2073
+ sandboxElement = (0,d3__WEBPACK_IMPORTED_MODULE_1__/* .select */ .Ltv)("#i" + id);
2074
+ }
2075
+ const root = securityLevel === "sandbox" ? (0,d3__WEBPACK_IMPORTED_MODULE_1__/* .select */ .Ltv)(sandboxElement.nodes()[0].contentDocument.body) : (0,d3__WEBPACK_IMPORTED_MODULE_1__/* .select */ .Ltv)("body");
2076
+ const svg = root.select(`[id="${id}"]`);
2077
+ return svg;
2078
+ }, "getDiagramElement");
2079
+
2080
+ // src/rendering-util/setupViewPortForSVG.ts
2081
+ var setupViewPortForSVG = /* @__PURE__ */ (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__name */ .K2)((svg, padding, cssDiagram, useMaxWidth) => {
2082
+ svg.attr("class", cssDiagram);
2083
+ const { width, height, x, y } = calculateDimensionsWithPadding(svg, padding);
2084
+ (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_0__/* .configureSvgSize */ .a$)(svg, height, width, useMaxWidth);
2085
+ const viewBox = createViewBox(x, y, width, height, padding);
2086
+ svg.attr("viewBox", viewBox);
2087
+ _chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_0__/* .log */ .Rm.debug(`viewBox configured: ${viewBox} with padding: ${padding}`);
2088
+ }, "setupViewPortForSVG");
2089
+ var calculateDimensionsWithPadding = /* @__PURE__ */ (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__name */ .K2)((svg, padding) => {
2090
+ const bounds = svg.node()?.getBBox() || { width: 0, height: 0, x: 0, y: 0 };
2091
+ return {
2092
+ width: bounds.width + padding * 2,
2093
+ height: bounds.height + padding * 2,
2094
+ x: bounds.x,
2095
+ y: bounds.y
2096
+ };
2097
+ }, "calculateDimensionsWithPadding");
2098
+ var createViewBox = /* @__PURE__ */ (0,_chunk_YTJNT7DU_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__name */ .K2)((x, y, width, height, padding) => {
2099
+ return `${x - padding} ${y - padding} ${width} ${height}`;
2100
+ }, "createViewBox");
2101
+
2102
+
2103
+
2104
+
1929
2105
  /***/ })
1930
2106
 
1931
2107
  };
1932
2108
  ;
1933
- //# sourceMappingURL=246.node.js.map
2109
+ //# sourceMappingURL=855.node.js.map