@bytechain.cn/colamd 1.5.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 (157) hide show
  1. package/.github/workflows/release.yml +66 -0
  2. package/.trae/documents/fix-mermaid-colors-and-sankey.md +50 -0
  3. package/CLAUDE.md +87 -0
  4. package/LICENSE +21 -0
  5. package/README.md +540 -0
  6. package/README_CN.md +543 -0
  7. package/demo.md +486 -0
  8. package/dist/main/index.js +735 -0
  9. package/dist/preload/index.js +71 -0
  10. package/dist/renderer/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
  11. package/dist/renderer/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
  12. package/dist/renderer/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
  13. package/dist/renderer/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
  14. package/dist/renderer/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
  15. package/dist/renderer/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
  16. package/dist/renderer/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
  17. package/dist/renderer/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
  18. package/dist/renderer/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
  19. package/dist/renderer/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
  20. package/dist/renderer/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
  21. package/dist/renderer/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
  22. package/dist/renderer/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
  23. package/dist/renderer/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
  24. package/dist/renderer/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
  25. package/dist/renderer/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
  26. package/dist/renderer/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
  27. package/dist/renderer/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
  28. package/dist/renderer/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
  29. package/dist/renderer/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
  30. package/dist/renderer/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
  31. package/dist/renderer/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
  32. package/dist/renderer/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
  33. package/dist/renderer/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
  34. package/dist/renderer/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
  35. package/dist/renderer/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
  36. package/dist/renderer/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
  37. package/dist/renderer/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
  38. package/dist/renderer/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
  39. package/dist/renderer/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
  40. package/dist/renderer/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
  41. package/dist/renderer/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
  42. package/dist/renderer/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
  43. package/dist/renderer/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
  44. package/dist/renderer/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
  45. package/dist/renderer/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
  46. package/dist/renderer/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
  47. package/dist/renderer/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
  48. package/dist/renderer/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
  49. package/dist/renderer/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
  50. package/dist/renderer/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
  51. package/dist/renderer/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
  52. package/dist/renderer/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
  53. package/dist/renderer/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
  54. package/dist/renderer/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
  55. package/dist/renderer/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
  56. package/dist/renderer/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
  57. package/dist/renderer/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
  58. package/dist/renderer/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
  59. package/dist/renderer/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
  60. package/dist/renderer/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
  61. package/dist/renderer/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
  62. package/dist/renderer/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
  63. package/dist/renderer/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
  64. package/dist/renderer/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
  65. package/dist/renderer/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
  66. package/dist/renderer/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
  67. package/dist/renderer/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
  68. package/dist/renderer/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
  69. package/dist/renderer/assets/arc-tTbbM8LO.js +131 -0
  70. package/dist/renderer/assets/architectureDiagram-3BPJPVTR-CEgYow6c.js +8720 -0
  71. package/dist/renderer/assets/blockDiagram-GPEHLZMM-LHyVtPwW.js +3825 -0
  72. package/dist/renderer/assets/c4Diagram-AAUBKEIU-C1P1eJrf.js +2482 -0
  73. package/dist/renderer/assets/channel-upve91Tq.js +7 -0
  74. package/dist/renderer/assets/chunk-2J33WTMH-lag2vhq9.js +24 -0
  75. package/dist/renderer/assets/chunk-4BX2VUAB-BXJ8Ggh-.js +16 -0
  76. package/dist/renderer/assets/chunk-55IACEB6-CiBpxRa1.js +13 -0
  77. package/dist/renderer/assets/chunk-727SXJPM-ODeKQFXC.js +2016 -0
  78. package/dist/renderer/assets/chunk-AQP2D5EJ-BK7xJolB.js +1953 -0
  79. package/dist/renderer/assets/chunk-FMBD7UC4-BxpCZPtz.js +19 -0
  80. package/dist/renderer/assets/chunk-ND2GUHAM-CqqaU9Ue.js +116 -0
  81. package/dist/renderer/assets/chunk-QZHKN3VN-Biq_K124.js +19 -0
  82. package/dist/renderer/assets/classDiagram-4FO5ZUOK-Cq95X99o.js +23 -0
  83. package/dist/renderer/assets/classDiagram-v2-Q7XG4LA2-Cq95X99o.js +23 -0
  84. package/dist/renderer/assets/cose-bilkent-S5V4N54A-XasiD0bu.js +4942 -0
  85. package/dist/renderer/assets/cytoscape.esm-CpHeHM5e.js +30269 -0
  86. package/dist/renderer/assets/dagre-BM42HDAG-Nq84Gfx4.js +705 -0
  87. package/dist/renderer/assets/defaultLocale-B2RvLBDe.js +206 -0
  88. package/dist/renderer/assets/diagram-2AECGRRQ-DwuB1GWt.js +301 -0
  89. package/dist/renderer/assets/diagram-5GNKFQAL-C2tgeI1h.js +169 -0
  90. package/dist/renderer/assets/diagram-KO2AKTUF-D5KzjNBc.js +632 -0
  91. package/dist/renderer/assets/diagram-LMA3HP47-C12xHS1c.js +212 -0
  92. package/dist/renderer/assets/diagram-OG6HWLK6-CnxI9oEa.js +851 -0
  93. package/dist/renderer/assets/erDiagram-TEJ5UH35-D_uPaKwn.js +1227 -0
  94. package/dist/renderer/assets/flowDiagram-I6XJVG4X-B6q_1-tE.js +2332 -0
  95. package/dist/renderer/assets/ganttDiagram-6RSMTGT7-CFo7ifF9.js +3720 -0
  96. package/dist/renderer/assets/gitGraphDiagram-PVQCEYII-WSexHTnq.js +1373 -0
  97. package/dist/renderer/assets/graph-DyX_9f6d.js +1988 -0
  98. package/dist/renderer/assets/index-DW7LS8C1.js +72292 -0
  99. package/dist/renderer/assets/index-dyHEFYvY.css +2184 -0
  100. package/dist/renderer/assets/infoDiagram-5YYISTIA-DaeJdLRq.js +31 -0
  101. package/dist/renderer/assets/init-ZxktEp_H.js +16 -0
  102. package/dist/renderer/assets/ishikawaDiagram-YF4QCWOH-DDCZc35f.js +967 -0
  103. package/dist/renderer/assets/journeyDiagram-JHISSGLW-BEdmpAgl.js +1255 -0
  104. package/dist/renderer/assets/kanban-definition-UN3LZRKU-BEFtQcFb.js +1052 -0
  105. package/dist/renderer/assets/layout-CAJgQHdw.js +2610 -0
  106. package/dist/renderer/assets/linear-B2ggJ8Am.js +340 -0
  107. package/dist/renderer/assets/mindmap-definition-RKZ34NQL-DSxVgHB5.js +1180 -0
  108. package/dist/renderer/assets/ordinal-DSZU4PqD.js +76 -0
  109. package/dist/renderer/assets/pieDiagram-4H26LBE5-CwYoJBuL.js +246 -0
  110. package/dist/renderer/assets/quadrantDiagram-W4KKPZXB-CST9Fvg9.js +1344 -0
  111. package/dist/renderer/assets/requirementDiagram-4Y6WPE33-DtrH52jS.js +1204 -0
  112. package/dist/renderer/assets/sankeyDiagram-5OEKKPKP-ca1tPzJ_.js +1274 -0
  113. package/dist/renderer/assets/sequenceDiagram-3UESZ5HK-Dfp1EJZ7.js +4514 -0
  114. package/dist/renderer/assets/stateDiagram-AJRCARHV-Bha2QoNB.js +450 -0
  115. package/dist/renderer/assets/stateDiagram-v2-BHNVJYJU-DWgFUYu1.js +21 -0
  116. package/dist/renderer/assets/timeline-definition-PNZ67QCA-C3h_-OTj.js +1596 -0
  117. package/dist/renderer/assets/vennDiagram-CIIHVFJN-DFzjSrZi.js +2486 -0
  118. package/dist/renderer/assets/wardley-L42UT6IY-Cx-VbqoS.js +30699 -0
  119. package/dist/renderer/assets/wardleyDiagram-YWT4CUSO-S2D9XqX6.js +975 -0
  120. package/dist/renderer/assets/xychartDiagram-2RQKCTM6-Cfxigbts.js +1932 -0
  121. package/dist/renderer/index.html +19 -0
  122. package/docs/agent-diff-view.md +48 -0
  123. package/electron-builder.yml +57 -0
  124. package/electron.vite.config.ts +30 -0
  125. package/package.json +40 -0
  126. package/resources/entitlements.mac.plist +12 -0
  127. package/resources/icon.icns +0 -0
  128. package/resources/icon.png +0 -0
  129. package/resources/icon.svg +23 -0
  130. package/resources/templates/slides/icon.png +0 -0
  131. package/resources/templates/slides/slides-template.md +74 -0
  132. package/resources/templates/slides/template.html +535 -0
  133. package/scripts/afterPack.js +13 -0
  134. package/src/main/index.ts +881 -0
  135. package/src/preload/index.ts +110 -0
  136. package/src/renderer/editor/editor.ts +204 -0
  137. package/src/renderer/editor/html-view.ts +15 -0
  138. package/src/renderer/editor/plugins/index.ts +76 -0
  139. package/src/renderer/editor/plugins/math-plugin.ts +297 -0
  140. package/src/renderer/editor/plugins/mermaid-plugin-custom.css +431 -0
  141. package/src/renderer/editor/plugins/mermaid-plugin-dark.css +428 -0
  142. package/src/renderer/editor/plugins/mermaid-plugin-elegant.css +443 -0
  143. package/src/renderer/editor/plugins/mermaid-plugin-newsprint.css +208 -0
  144. package/src/renderer/editor/plugins/mermaid-plugin.css +111 -0
  145. package/src/renderer/editor/plugins/mermaid-plugin.ts +679 -0
  146. package/src/renderer/env.d.ts +7 -0
  147. package/src/renderer/index.html +18 -0
  148. package/src/renderer/main.ts +303 -0
  149. package/src/renderer/themes/base.css +509 -0
  150. package/src/renderer/themes/theme-manager.ts +40 -0
  151. package/themes/README.md +280 -0
  152. package/themes/elegant.css +664 -0
  153. package/themes/guizang.css +732 -0
  154. package/tsconfig.json +14 -0
  155. package/tsconfig.main.json +11 -0
  156. package/tsconfig.preload.json +11 -0
  157. package/tsconfig.renderer.json +12 -0
@@ -0,0 +1,1180 @@
1
+ import { g as getDiagramElement } from "./chunk-55IACEB6-CiBpxRa1.js";
2
+ import { s as setupViewPortForSVG } from "./chunk-2J33WTMH-lag2vhq9.js";
3
+ import { _ as __name, l as log, o as getRegisteredLayoutAlgorithm, r as render, D as getConfig, G as defaultConfig_default, c as getConfig2, i as sanitizeText, b3 as getUserDefinedConfig, V as isDark, W as lighten, X as darken } from "./index-DW7LS8C1.js";
4
+ const byteToHex = [];
5
+ for (let i = 0; i < 256; ++i) {
6
+ byteToHex.push((i + 256).toString(16).slice(1));
7
+ }
8
+ function unsafeStringify(arr, offset = 0) {
9
+ return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
10
+ }
11
+ const rnds8 = new Uint8Array(16);
12
+ function rng() {
13
+ return crypto.getRandomValues(rnds8);
14
+ }
15
+ function v4(options, buf, offset) {
16
+ if (crypto.randomUUID) {
17
+ return crypto.randomUUID();
18
+ }
19
+ return _v4(options);
20
+ }
21
+ function _v4(options, buf, offset) {
22
+ options = options || {};
23
+ const rnds = options.random ?? options.rng?.() ?? rng();
24
+ if (rnds.length < 16) {
25
+ throw new Error("Random bytes length must be >= 16");
26
+ }
27
+ rnds[6] = rnds[6] & 15 | 64;
28
+ rnds[8] = rnds[8] & 63 | 128;
29
+ return unsafeStringify(rnds);
30
+ }
31
+ var parser = (function() {
32
+ var o = /* @__PURE__ */ __name(function(k, v, o2, l) {
33
+ for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v) ;
34
+ return o2;
35
+ }, "o"), $V0 = [1, 4], $V1 = [1, 13], $V2 = [1, 12], $V3 = [1, 15], $V4 = [1, 16], $V5 = [1, 20], $V6 = [1, 19], $V7 = [6, 7, 8], $V8 = [1, 26], $V9 = [1, 24], $Va = [1, 25], $Vb = [6, 7, 11], $Vc = [1, 6, 13, 15, 16, 19, 22], $Vd = [1, 33], $Ve = [1, 34], $Vf = [1, 6, 7, 11, 13, 15, 16, 19, 22];
36
+ var parser2 = {
37
+ trace: /* @__PURE__ */ __name(function trace() {
38
+ }, "trace"),
39
+ yy: {},
40
+ symbols_: { "error": 2, "start": 3, "mindMap": 4, "spaceLines": 5, "SPACELINE": 6, "NL": 7, "MINDMAP": 8, "document": 9, "stop": 10, "EOF": 11, "statement": 12, "SPACELIST": 13, "node": 14, "ICON": 15, "CLASS": 16, "nodeWithId": 17, "nodeWithoutId": 18, "NODE_DSTART": 19, "NODE_DESCR": 20, "NODE_DEND": 21, "NODE_ID": 22, "$accept": 0, "$end": 1 },
41
+ terminals_: { 2: "error", 6: "SPACELINE", 7: "NL", 8: "MINDMAP", 11: "EOF", 13: "SPACELIST", 15: "ICON", 16: "CLASS", 19: "NODE_DSTART", 20: "NODE_DESCR", 21: "NODE_DEND", 22: "NODE_ID" },
42
+ productions_: [0, [3, 1], [3, 2], [5, 1], [5, 2], [5, 2], [4, 2], [4, 3], [10, 1], [10, 1], [10, 1], [10, 2], [10, 2], [9, 3], [9, 2], [12, 2], [12, 2], [12, 2], [12, 1], [12, 1], [12, 1], [12, 1], [12, 1], [14, 1], [14, 1], [18, 3], [17, 1], [17, 4]],
43
+ performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
44
+ var $0 = $$.length - 1;
45
+ switch (yystate) {
46
+ case 6:
47
+ case 7:
48
+ return yy;
49
+ case 8:
50
+ yy.getLogger().trace("Stop NL ");
51
+ break;
52
+ case 9:
53
+ yy.getLogger().trace("Stop EOF ");
54
+ break;
55
+ case 11:
56
+ yy.getLogger().trace("Stop NL2 ");
57
+ break;
58
+ case 12:
59
+ yy.getLogger().trace("Stop EOF2 ");
60
+ break;
61
+ case 15:
62
+ yy.getLogger().info("Node: ", $$[$0].id);
63
+ yy.addNode($$[$0 - 1].length, $$[$0].id, $$[$0].descr, $$[$0].type);
64
+ break;
65
+ case 16:
66
+ yy.getLogger().trace("Icon: ", $$[$0]);
67
+ yy.decorateNode({ icon: $$[$0] });
68
+ break;
69
+ case 17:
70
+ case 21:
71
+ yy.decorateNode({ class: $$[$0] });
72
+ break;
73
+ case 18:
74
+ yy.getLogger().trace("SPACELIST");
75
+ break;
76
+ case 19:
77
+ yy.getLogger().trace("Node: ", $$[$0].id);
78
+ yy.addNode(0, $$[$0].id, $$[$0].descr, $$[$0].type);
79
+ break;
80
+ case 20:
81
+ yy.decorateNode({ icon: $$[$0] });
82
+ break;
83
+ case 25:
84
+ yy.getLogger().trace("node found ..", $$[$0 - 2]);
85
+ this.$ = { id: $$[$0 - 1], descr: $$[$0 - 1], type: yy.getType($$[$0 - 2], $$[$0]) };
86
+ break;
87
+ case 26:
88
+ this.$ = { id: $$[$0], descr: $$[$0], type: yy.nodeType.DEFAULT };
89
+ break;
90
+ case 27:
91
+ yy.getLogger().trace("node found ..", $$[$0 - 3]);
92
+ this.$ = { id: $$[$0 - 3], descr: $$[$0 - 1], type: yy.getType($$[$0 - 2], $$[$0]) };
93
+ break;
94
+ }
95
+ }, "anonymous"),
96
+ table: [{ 3: 1, 4: 2, 5: 3, 6: [1, 5], 8: $V0 }, { 1: [3] }, { 1: [2, 1] }, { 4: 6, 6: [1, 7], 7: [1, 8], 8: $V0 }, { 6: $V1, 7: [1, 10], 9: 9, 12: 11, 13: $V2, 14: 14, 15: $V3, 16: $V4, 17: 17, 18: 18, 19: $V5, 22: $V6 }, o($V7, [2, 3]), { 1: [2, 2] }, o($V7, [2, 4]), o($V7, [2, 5]), { 1: [2, 6], 6: $V1, 12: 21, 13: $V2, 14: 14, 15: $V3, 16: $V4, 17: 17, 18: 18, 19: $V5, 22: $V6 }, { 6: $V1, 9: 22, 12: 11, 13: $V2, 14: 14, 15: $V3, 16: $V4, 17: 17, 18: 18, 19: $V5, 22: $V6 }, { 6: $V8, 7: $V9, 10: 23, 11: $Va }, o($Vb, [2, 22], { 17: 17, 18: 18, 14: 27, 15: [1, 28], 16: [1, 29], 19: $V5, 22: $V6 }), o($Vb, [2, 18]), o($Vb, [2, 19]), o($Vb, [2, 20]), o($Vb, [2, 21]), o($Vb, [2, 23]), o($Vb, [2, 24]), o($Vb, [2, 26], { 19: [1, 30] }), { 20: [1, 31] }, { 6: $V8, 7: $V9, 10: 32, 11: $Va }, { 1: [2, 7], 6: $V1, 12: 21, 13: $V2, 14: 14, 15: $V3, 16: $V4, 17: 17, 18: 18, 19: $V5, 22: $V6 }, o($Vc, [2, 14], { 7: $Vd, 11: $Ve }), o($Vf, [2, 8]), o($Vf, [2, 9]), o($Vf, [2, 10]), o($Vb, [2, 15]), o($Vb, [2, 16]), o($Vb, [2, 17]), { 20: [1, 35] }, { 21: [1, 36] }, o($Vc, [2, 13], { 7: $Vd, 11: $Ve }), o($Vf, [2, 11]), o($Vf, [2, 12]), { 21: [1, 37] }, o($Vb, [2, 25]), o($Vb, [2, 27])],
97
+ defaultActions: { 2: [2, 1], 6: [2, 2] },
98
+ parseError: /* @__PURE__ */ __name(function parseError(str, hash) {
99
+ if (hash.recoverable) {
100
+ this.trace(str);
101
+ } else {
102
+ var error = new Error(str);
103
+ error.hash = hash;
104
+ throw error;
105
+ }
106
+ }, "parseError"),
107
+ parse: /* @__PURE__ */ __name(function parse(input) {
108
+ var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, TERROR = 2, EOF = 1;
109
+ var args = lstack.slice.call(arguments, 1);
110
+ var lexer2 = Object.create(this.lexer);
111
+ var sharedState = { yy: {} };
112
+ for (var k in this.yy) {
113
+ if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
114
+ sharedState.yy[k] = this.yy[k];
115
+ }
116
+ }
117
+ lexer2.setInput(input, sharedState.yy);
118
+ sharedState.yy.lexer = lexer2;
119
+ sharedState.yy.parser = this;
120
+ if (typeof lexer2.yylloc == "undefined") {
121
+ lexer2.yylloc = {};
122
+ }
123
+ var yyloc = lexer2.yylloc;
124
+ lstack.push(yyloc);
125
+ var ranges = lexer2.options && lexer2.options.ranges;
126
+ if (typeof sharedState.yy.parseError === "function") {
127
+ this.parseError = sharedState.yy.parseError;
128
+ } else {
129
+ this.parseError = Object.getPrototypeOf(this).parseError;
130
+ }
131
+ function popStack(n) {
132
+ stack.length = stack.length - 2 * n;
133
+ vstack.length = vstack.length - n;
134
+ lstack.length = lstack.length - n;
135
+ }
136
+ __name(popStack, "popStack");
137
+ function lex() {
138
+ var token;
139
+ token = tstack.pop() || lexer2.lex() || EOF;
140
+ if (typeof token !== "number") {
141
+ if (token instanceof Array) {
142
+ tstack = token;
143
+ token = tstack.pop();
144
+ }
145
+ token = self.symbols_[token] || token;
146
+ }
147
+ return token;
148
+ }
149
+ __name(lex, "lex");
150
+ var symbol, state, action, r, yyval = {}, p, len, newState, expected;
151
+ while (true) {
152
+ state = stack[stack.length - 1];
153
+ if (this.defaultActions[state]) {
154
+ action = this.defaultActions[state];
155
+ } else {
156
+ if (symbol === null || typeof symbol == "undefined") {
157
+ symbol = lex();
158
+ }
159
+ action = table[state] && table[state][symbol];
160
+ }
161
+ if (typeof action === "undefined" || !action.length || !action[0]) {
162
+ var errStr = "";
163
+ expected = [];
164
+ for (p in table[state]) {
165
+ if (this.terminals_[p] && p > TERROR) {
166
+ expected.push("'" + this.terminals_[p] + "'");
167
+ }
168
+ }
169
+ if (lexer2.showPosition) {
170
+ errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
171
+ } else {
172
+ errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
173
+ }
174
+ this.parseError(errStr, {
175
+ text: lexer2.match,
176
+ token: this.terminals_[symbol] || symbol,
177
+ line: lexer2.yylineno,
178
+ loc: yyloc,
179
+ expected
180
+ });
181
+ }
182
+ if (action[0] instanceof Array && action.length > 1) {
183
+ throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
184
+ }
185
+ switch (action[0]) {
186
+ case 1:
187
+ stack.push(symbol);
188
+ vstack.push(lexer2.yytext);
189
+ lstack.push(lexer2.yylloc);
190
+ stack.push(action[1]);
191
+ symbol = null;
192
+ {
193
+ yyleng = lexer2.yyleng;
194
+ yytext = lexer2.yytext;
195
+ yylineno = lexer2.yylineno;
196
+ yyloc = lexer2.yylloc;
197
+ }
198
+ break;
199
+ case 2:
200
+ len = this.productions_[action[1]][1];
201
+ yyval.$ = vstack[vstack.length - len];
202
+ yyval._$ = {
203
+ first_line: lstack[lstack.length - (len || 1)].first_line,
204
+ last_line: lstack[lstack.length - 1].last_line,
205
+ first_column: lstack[lstack.length - (len || 1)].first_column,
206
+ last_column: lstack[lstack.length - 1].last_column
207
+ };
208
+ if (ranges) {
209
+ yyval._$.range = [
210
+ lstack[lstack.length - (len || 1)].range[0],
211
+ lstack[lstack.length - 1].range[1]
212
+ ];
213
+ }
214
+ r = this.performAction.apply(yyval, [
215
+ yytext,
216
+ yyleng,
217
+ yylineno,
218
+ sharedState.yy,
219
+ action[1],
220
+ vstack,
221
+ lstack
222
+ ].concat(args));
223
+ if (typeof r !== "undefined") {
224
+ return r;
225
+ }
226
+ if (len) {
227
+ stack = stack.slice(0, -1 * len * 2);
228
+ vstack = vstack.slice(0, -1 * len);
229
+ lstack = lstack.slice(0, -1 * len);
230
+ }
231
+ stack.push(this.productions_[action[1]][0]);
232
+ vstack.push(yyval.$);
233
+ lstack.push(yyval._$);
234
+ newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
235
+ stack.push(newState);
236
+ break;
237
+ case 3:
238
+ return true;
239
+ }
240
+ }
241
+ return true;
242
+ }, "parse")
243
+ };
244
+ var lexer = /* @__PURE__ */ (function() {
245
+ var lexer2 = {
246
+ EOF: 1,
247
+ parseError: /* @__PURE__ */ __name(function parseError(str, hash) {
248
+ if (this.yy.parser) {
249
+ this.yy.parser.parseError(str, hash);
250
+ } else {
251
+ throw new Error(str);
252
+ }
253
+ }, "parseError"),
254
+ // resets the lexer, sets new input
255
+ setInput: /* @__PURE__ */ __name(function(input, yy) {
256
+ this.yy = yy || this.yy || {};
257
+ this._input = input;
258
+ this._more = this._backtrack = this.done = false;
259
+ this.yylineno = this.yyleng = 0;
260
+ this.yytext = this.matched = this.match = "";
261
+ this.conditionStack = ["INITIAL"];
262
+ this.yylloc = {
263
+ first_line: 1,
264
+ first_column: 0,
265
+ last_line: 1,
266
+ last_column: 0
267
+ };
268
+ if (this.options.ranges) {
269
+ this.yylloc.range = [0, 0];
270
+ }
271
+ this.offset = 0;
272
+ return this;
273
+ }, "setInput"),
274
+ // consumes and returns one char from the input
275
+ input: /* @__PURE__ */ __name(function() {
276
+ var ch = this._input[0];
277
+ this.yytext += ch;
278
+ this.yyleng++;
279
+ this.offset++;
280
+ this.match += ch;
281
+ this.matched += ch;
282
+ var lines = ch.match(/(?:\r\n?|\n).*/g);
283
+ if (lines) {
284
+ this.yylineno++;
285
+ this.yylloc.last_line++;
286
+ } else {
287
+ this.yylloc.last_column++;
288
+ }
289
+ if (this.options.ranges) {
290
+ this.yylloc.range[1]++;
291
+ }
292
+ this._input = this._input.slice(1);
293
+ return ch;
294
+ }, "input"),
295
+ // unshifts one char (or a string) into the input
296
+ unput: /* @__PURE__ */ __name(function(ch) {
297
+ var len = ch.length;
298
+ var lines = ch.split(/(?:\r\n?|\n)/g);
299
+ this._input = ch + this._input;
300
+ this.yytext = this.yytext.substr(0, this.yytext.length - len);
301
+ this.offset -= len;
302
+ var oldLines = this.match.split(/(?:\r\n?|\n)/g);
303
+ this.match = this.match.substr(0, this.match.length - 1);
304
+ this.matched = this.matched.substr(0, this.matched.length - 1);
305
+ if (lines.length - 1) {
306
+ this.yylineno -= lines.length - 1;
307
+ }
308
+ var r = this.yylloc.range;
309
+ this.yylloc = {
310
+ first_line: this.yylloc.first_line,
311
+ last_line: this.yylineno + 1,
312
+ first_column: this.yylloc.first_column,
313
+ last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len
314
+ };
315
+ if (this.options.ranges) {
316
+ this.yylloc.range = [r[0], r[0] + this.yyleng - len];
317
+ }
318
+ this.yyleng = this.yytext.length;
319
+ return this;
320
+ }, "unput"),
321
+ // When called from action, caches matched text and appends it on next action
322
+ more: /* @__PURE__ */ __name(function() {
323
+ this._more = true;
324
+ return this;
325
+ }, "more"),
326
+ // 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.
327
+ reject: /* @__PURE__ */ __name(function() {
328
+ if (this.options.backtrack_lexer) {
329
+ this._backtrack = true;
330
+ } else {
331
+ 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(), {
332
+ text: "",
333
+ token: null,
334
+ line: this.yylineno
335
+ });
336
+ }
337
+ return this;
338
+ }, "reject"),
339
+ // retain first n characters of the match
340
+ less: /* @__PURE__ */ __name(function(n) {
341
+ this.unput(this.match.slice(n));
342
+ }, "less"),
343
+ // displays already matched input, i.e. for error messages
344
+ pastInput: /* @__PURE__ */ __name(function() {
345
+ var past = this.matched.substr(0, this.matched.length - this.match.length);
346
+ return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
347
+ }, "pastInput"),
348
+ // displays upcoming input, i.e. for error messages
349
+ upcomingInput: /* @__PURE__ */ __name(function() {
350
+ var next = this.match;
351
+ if (next.length < 20) {
352
+ next += this._input.substr(0, 20 - next.length);
353
+ }
354
+ return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
355
+ }, "upcomingInput"),
356
+ // displays the character position where the lexing error occurred, i.e. for error messages
357
+ showPosition: /* @__PURE__ */ __name(function() {
358
+ var pre = this.pastInput();
359
+ var c = new Array(pre.length + 1).join("-");
360
+ return pre + this.upcomingInput() + "\n" + c + "^";
361
+ }, "showPosition"),
362
+ // test the lexed token: return FALSE when not a match, otherwise return token
363
+ test_match: /* @__PURE__ */ __name(function(match, indexed_rule) {
364
+ var token, lines, backup;
365
+ if (this.options.backtrack_lexer) {
366
+ backup = {
367
+ yylineno: this.yylineno,
368
+ yylloc: {
369
+ first_line: this.yylloc.first_line,
370
+ last_line: this.last_line,
371
+ first_column: this.yylloc.first_column,
372
+ last_column: this.yylloc.last_column
373
+ },
374
+ yytext: this.yytext,
375
+ match: this.match,
376
+ matches: this.matches,
377
+ matched: this.matched,
378
+ yyleng: this.yyleng,
379
+ offset: this.offset,
380
+ _more: this._more,
381
+ _input: this._input,
382
+ yy: this.yy,
383
+ conditionStack: this.conditionStack.slice(0),
384
+ done: this.done
385
+ };
386
+ if (this.options.ranges) {
387
+ backup.yylloc.range = this.yylloc.range.slice(0);
388
+ }
389
+ }
390
+ lines = match[0].match(/(?:\r\n?|\n).*/g);
391
+ if (lines) {
392
+ this.yylineno += lines.length;
393
+ }
394
+ this.yylloc = {
395
+ first_line: this.yylloc.last_line,
396
+ last_line: this.yylineno + 1,
397
+ first_column: this.yylloc.last_column,
398
+ last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length
399
+ };
400
+ this.yytext += match[0];
401
+ this.match += match[0];
402
+ this.matches = match;
403
+ this.yyleng = this.yytext.length;
404
+ if (this.options.ranges) {
405
+ this.yylloc.range = [this.offset, this.offset += this.yyleng];
406
+ }
407
+ this._more = false;
408
+ this._backtrack = false;
409
+ this._input = this._input.slice(match[0].length);
410
+ this.matched += match[0];
411
+ token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
412
+ if (this.done && this._input) {
413
+ this.done = false;
414
+ }
415
+ if (token) {
416
+ return token;
417
+ } else if (this._backtrack) {
418
+ for (var k in backup) {
419
+ this[k] = backup[k];
420
+ }
421
+ return false;
422
+ }
423
+ return false;
424
+ }, "test_match"),
425
+ // return next match in input
426
+ next: /* @__PURE__ */ __name(function() {
427
+ if (this.done) {
428
+ return this.EOF;
429
+ }
430
+ if (!this._input) {
431
+ this.done = true;
432
+ }
433
+ var token, match, tempMatch, index;
434
+ if (!this._more) {
435
+ this.yytext = "";
436
+ this.match = "";
437
+ }
438
+ var rules = this._currentRules();
439
+ for (var i = 0; i < rules.length; i++) {
440
+ tempMatch = this._input.match(this.rules[rules[i]]);
441
+ if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
442
+ match = tempMatch;
443
+ index = i;
444
+ if (this.options.backtrack_lexer) {
445
+ token = this.test_match(tempMatch, rules[i]);
446
+ if (token !== false) {
447
+ return token;
448
+ } else if (this._backtrack) {
449
+ match = false;
450
+ continue;
451
+ } else {
452
+ return false;
453
+ }
454
+ } else if (!this.options.flex) {
455
+ break;
456
+ }
457
+ }
458
+ }
459
+ if (match) {
460
+ token = this.test_match(match, rules[index]);
461
+ if (token !== false) {
462
+ return token;
463
+ }
464
+ return false;
465
+ }
466
+ if (this._input === "") {
467
+ return this.EOF;
468
+ } else {
469
+ return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
470
+ text: "",
471
+ token: null,
472
+ line: this.yylineno
473
+ });
474
+ }
475
+ }, "next"),
476
+ // return next match that has a token
477
+ lex: /* @__PURE__ */ __name(function lex() {
478
+ var r = this.next();
479
+ if (r) {
480
+ return r;
481
+ } else {
482
+ return this.lex();
483
+ }
484
+ }, "lex"),
485
+ // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
486
+ begin: /* @__PURE__ */ __name(function begin(condition) {
487
+ this.conditionStack.push(condition);
488
+ }, "begin"),
489
+ // pop the previously active lexer condition state off the condition stack
490
+ popState: /* @__PURE__ */ __name(function popState() {
491
+ var n = this.conditionStack.length - 1;
492
+ if (n > 0) {
493
+ return this.conditionStack.pop();
494
+ } else {
495
+ return this.conditionStack[0];
496
+ }
497
+ }, "popState"),
498
+ // produce the lexer rule set which is active for the currently active lexer condition state
499
+ _currentRules: /* @__PURE__ */ __name(function _currentRules() {
500
+ if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
501
+ return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
502
+ } else {
503
+ return this.conditions["INITIAL"].rules;
504
+ }
505
+ }, "_currentRules"),
506
+ // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
507
+ topState: /* @__PURE__ */ __name(function topState(n) {
508
+ n = this.conditionStack.length - 1 - Math.abs(n || 0);
509
+ if (n >= 0) {
510
+ return this.conditionStack[n];
511
+ } else {
512
+ return "INITIAL";
513
+ }
514
+ }, "topState"),
515
+ // alias for begin(condition)
516
+ pushState: /* @__PURE__ */ __name(function pushState(condition) {
517
+ this.begin(condition);
518
+ }, "pushState"),
519
+ // return the number of states currently on the stack
520
+ stateStackSize: /* @__PURE__ */ __name(function stateStackSize() {
521
+ return this.conditionStack.length;
522
+ }, "stateStackSize"),
523
+ options: { "case-insensitive": true },
524
+ performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
525
+ switch ($avoiding_name_collisions) {
526
+ case 0:
527
+ yy.getLogger().trace("Found comment", yy_.yytext);
528
+ return 6;
529
+ case 1:
530
+ return 8;
531
+ case 2:
532
+ this.begin("CLASS");
533
+ break;
534
+ case 3:
535
+ this.popState();
536
+ return 16;
537
+ case 4:
538
+ this.popState();
539
+ break;
540
+ case 5:
541
+ yy.getLogger().trace("Begin icon");
542
+ this.begin("ICON");
543
+ break;
544
+ case 6:
545
+ yy.getLogger().trace("SPACELINE");
546
+ return 6;
547
+ case 7:
548
+ return 7;
549
+ case 8:
550
+ return 15;
551
+ case 9:
552
+ yy.getLogger().trace("end icon");
553
+ this.popState();
554
+ break;
555
+ case 10:
556
+ yy.getLogger().trace("Exploding node");
557
+ this.begin("NODE");
558
+ return 19;
559
+ case 11:
560
+ yy.getLogger().trace("Cloud");
561
+ this.begin("NODE");
562
+ return 19;
563
+ case 12:
564
+ yy.getLogger().trace("Explosion Bang");
565
+ this.begin("NODE");
566
+ return 19;
567
+ case 13:
568
+ yy.getLogger().trace("Cloud Bang");
569
+ this.begin("NODE");
570
+ return 19;
571
+ case 14:
572
+ this.begin("NODE");
573
+ return 19;
574
+ case 15:
575
+ this.begin("NODE");
576
+ return 19;
577
+ case 16:
578
+ this.begin("NODE");
579
+ return 19;
580
+ case 17:
581
+ this.begin("NODE");
582
+ return 19;
583
+ case 18:
584
+ return 13;
585
+ case 19:
586
+ return 22;
587
+ case 20:
588
+ return 11;
589
+ case 21:
590
+ this.begin("NSTR2");
591
+ break;
592
+ case 22:
593
+ return "NODE_DESCR";
594
+ case 23:
595
+ this.popState();
596
+ break;
597
+ case 24:
598
+ yy.getLogger().trace("Starting NSTR");
599
+ this.begin("NSTR");
600
+ break;
601
+ case 25:
602
+ yy.getLogger().trace("description:", yy_.yytext);
603
+ return "NODE_DESCR";
604
+ case 26:
605
+ this.popState();
606
+ break;
607
+ case 27:
608
+ this.popState();
609
+ yy.getLogger().trace("node end ))");
610
+ return "NODE_DEND";
611
+ case 28:
612
+ this.popState();
613
+ yy.getLogger().trace("node end )");
614
+ return "NODE_DEND";
615
+ case 29:
616
+ this.popState();
617
+ yy.getLogger().trace("node end ...", yy_.yytext);
618
+ return "NODE_DEND";
619
+ case 30:
620
+ this.popState();
621
+ yy.getLogger().trace("node end ((");
622
+ return "NODE_DEND";
623
+ case 31:
624
+ this.popState();
625
+ yy.getLogger().trace("node end (-");
626
+ return "NODE_DEND";
627
+ case 32:
628
+ this.popState();
629
+ yy.getLogger().trace("node end (-");
630
+ return "NODE_DEND";
631
+ case 33:
632
+ this.popState();
633
+ yy.getLogger().trace("node end ((");
634
+ return "NODE_DEND";
635
+ case 34:
636
+ this.popState();
637
+ yy.getLogger().trace("node end ((");
638
+ return "NODE_DEND";
639
+ case 35:
640
+ yy.getLogger().trace("Long description:", yy_.yytext);
641
+ return 20;
642
+ case 36:
643
+ yy.getLogger().trace("Long description:", yy_.yytext);
644
+ return 20;
645
+ }
646
+ }, "anonymous"),
647
+ rules: [/^(?:\s*%%.*)/i, /^(?:mindmap\b)/i, /^(?::::)/i, /^(?:.+)/i, /^(?:\n)/i, /^(?:::icon\()/i, /^(?:[\s]+[\n])/i, /^(?:[\n]+)/i, /^(?:[^\)]+)/i, /^(?:\))/i, /^(?:-\))/i, /^(?:\(-)/i, /^(?:\)\))/i, /^(?:\))/i, /^(?:\(\()/i, /^(?:\{\{)/i, /^(?:\()/i, /^(?:\[)/i, /^(?:[\s]+)/i, /^(?:[^\(\[\n\)\{\}]+)/i, /^(?:$)/i, /^(?:["][`])/i, /^(?:[^`"]+)/i, /^(?:[`]["])/i, /^(?:["])/i, /^(?:[^"]+)/i, /^(?:["])/i, /^(?:[\)]\))/i, /^(?:[\)])/i, /^(?:[\]])/i, /^(?:\}\})/i, /^(?:\(-)/i, /^(?:-\))/i, /^(?:\(\()/i, /^(?:\()/i, /^(?:[^\)\]\(\}]+)/i, /^(?:.+(?!\(\())/i],
648
+ conditions: { "CLASS": { "rules": [3, 4], "inclusive": false }, "ICON": { "rules": [8, 9], "inclusive": false }, "NSTR2": { "rules": [22, 23], "inclusive": false }, "NSTR": { "rules": [25, 26], "inclusive": false }, "NODE": { "rules": [21, 24, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36], "inclusive": false }, "INITIAL": { "rules": [0, 1, 2, 5, 6, 7, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], "inclusive": true } }
649
+ };
650
+ return lexer2;
651
+ })();
652
+ parser2.lexer = lexer;
653
+ function Parser() {
654
+ this.yy = {};
655
+ }
656
+ __name(Parser, "Parser");
657
+ Parser.prototype = parser2;
658
+ parser2.Parser = Parser;
659
+ return new Parser();
660
+ })();
661
+ parser.parser = parser;
662
+ var mindmap_default = parser;
663
+ var MAX_SECTIONS = 12;
664
+ var nodeType = {
665
+ DEFAULT: 0,
666
+ NO_BORDER: 0,
667
+ ROUNDED_RECT: 1,
668
+ RECT: 2,
669
+ CIRCLE: 3,
670
+ CLOUD: 4,
671
+ BANG: 5,
672
+ HEXAGON: 6
673
+ };
674
+ var MindmapDB = class {
675
+ constructor() {
676
+ this.nodes = [];
677
+ this.count = 0;
678
+ this.elements = {};
679
+ this.getLogger = this.getLogger.bind(this);
680
+ this.nodeType = nodeType;
681
+ this.clear();
682
+ this.getType = this.getType.bind(this);
683
+ this.getElementById = this.getElementById.bind(this);
684
+ this.getParent = this.getParent.bind(this);
685
+ this.getMindmap = this.getMindmap.bind(this);
686
+ this.addNode = this.addNode.bind(this);
687
+ this.decorateNode = this.decorateNode.bind(this);
688
+ }
689
+ static {
690
+ __name(this, "MindmapDB");
691
+ }
692
+ clear() {
693
+ this.nodes = [];
694
+ this.count = 0;
695
+ this.elements = {};
696
+ this.baseLevel = void 0;
697
+ }
698
+ getParent(level) {
699
+ for (let i = this.nodes.length - 1; i >= 0; i--) {
700
+ if (this.nodes[i].level < level) {
701
+ return this.nodes[i];
702
+ }
703
+ }
704
+ return null;
705
+ }
706
+ getMindmap() {
707
+ return this.nodes.length > 0 ? this.nodes[0] : null;
708
+ }
709
+ addNode(level, id, descr, type) {
710
+ log.info("addNode", level, id, descr, type);
711
+ let isRoot = false;
712
+ if (this.nodes.length === 0) {
713
+ this.baseLevel = level;
714
+ level = 0;
715
+ isRoot = true;
716
+ } else if (this.baseLevel !== void 0) {
717
+ level = level - this.baseLevel;
718
+ isRoot = false;
719
+ }
720
+ const conf = getConfig2();
721
+ let padding = conf.mindmap?.padding ?? defaultConfig_default.mindmap.padding;
722
+ switch (type) {
723
+ case this.nodeType.ROUNDED_RECT:
724
+ case this.nodeType.RECT:
725
+ case this.nodeType.HEXAGON:
726
+ padding *= 2;
727
+ break;
728
+ }
729
+ const node = {
730
+ id: this.count++,
731
+ nodeId: sanitizeText(id, conf),
732
+ level,
733
+ descr: sanitizeText(descr, conf),
734
+ type,
735
+ children: [],
736
+ width: conf.mindmap?.maxNodeWidth ?? defaultConfig_default.mindmap.maxNodeWidth,
737
+ padding,
738
+ isRoot
739
+ };
740
+ const parent = this.getParent(level);
741
+ if (parent) {
742
+ parent.children.push(node);
743
+ this.nodes.push(node);
744
+ } else {
745
+ if (isRoot) {
746
+ this.nodes.push(node);
747
+ } else {
748
+ throw new Error(
749
+ `There can be only one root. No parent could be found for ("${node.descr}")`
750
+ );
751
+ }
752
+ }
753
+ }
754
+ getType(startStr, endStr) {
755
+ log.debug("In get type", startStr, endStr);
756
+ switch (startStr) {
757
+ case "[":
758
+ return this.nodeType.RECT;
759
+ case "(":
760
+ return endStr === ")" ? this.nodeType.ROUNDED_RECT : this.nodeType.CLOUD;
761
+ case "((":
762
+ return this.nodeType.CIRCLE;
763
+ case ")":
764
+ return this.nodeType.CLOUD;
765
+ case "))":
766
+ return this.nodeType.BANG;
767
+ case "{{":
768
+ return this.nodeType.HEXAGON;
769
+ default:
770
+ return this.nodeType.DEFAULT;
771
+ }
772
+ }
773
+ setElementForId(id, element) {
774
+ this.elements[id] = element;
775
+ }
776
+ getElementById(id) {
777
+ return this.elements[id];
778
+ }
779
+ decorateNode(decoration) {
780
+ if (!decoration) {
781
+ return;
782
+ }
783
+ const config = getConfig2();
784
+ const node = this.nodes[this.nodes.length - 1];
785
+ if (decoration.icon) {
786
+ node.icon = sanitizeText(decoration.icon, config);
787
+ }
788
+ if (decoration.class) {
789
+ node.class = sanitizeText(decoration.class, config);
790
+ }
791
+ }
792
+ type2Str(type) {
793
+ switch (type) {
794
+ case this.nodeType.DEFAULT:
795
+ return "no-border";
796
+ case this.nodeType.RECT:
797
+ return "rect";
798
+ case this.nodeType.ROUNDED_RECT:
799
+ return "rounded-rect";
800
+ case this.nodeType.CIRCLE:
801
+ return "circle";
802
+ case this.nodeType.CLOUD:
803
+ return "cloud";
804
+ case this.nodeType.BANG:
805
+ return "bang";
806
+ case this.nodeType.HEXAGON:
807
+ return "hexgon";
808
+ // cspell: disable-line
809
+ default:
810
+ return "no-border";
811
+ }
812
+ }
813
+ /**
814
+ * Assign section numbers to nodes based on their position relative to root
815
+ * @param node - The mindmap node to process
816
+ * @param sectionNumber - The section number to assign (undefined for root)
817
+ */
818
+ assignSections(node, sectionNumber) {
819
+ if (node.level === 0) {
820
+ node.section = void 0;
821
+ } else {
822
+ node.section = sectionNumber;
823
+ }
824
+ if (node.children) {
825
+ for (const [index, child] of node.children.entries()) {
826
+ const childSectionNumber = node.level === 0 ? index % (MAX_SECTIONS - 1) : sectionNumber;
827
+ this.assignSections(child, childSectionNumber);
828
+ }
829
+ }
830
+ }
831
+ /**
832
+ * Convert mindmap tree structure to flat array of nodes
833
+ * @param node - The mindmap node to process
834
+ * @param processedNodes - Array to collect processed nodes
835
+ */
836
+ flattenNodes(node, processedNodes) {
837
+ const conf = getConfig2();
838
+ const cssClasses = ["mindmap-node"];
839
+ if (node.isRoot === true) {
840
+ cssClasses.push("section-root", "section--1");
841
+ } else if (node.section !== void 0) {
842
+ cssClasses.push(`section-${node.section}`);
843
+ }
844
+ if (node.class) {
845
+ cssClasses.push(node.class);
846
+ }
847
+ const classes = cssClasses.join(" ");
848
+ const getShapeFromType = /* @__PURE__ */ __name((type) => {
849
+ const theme = conf.theme?.toLowerCase() ?? "";
850
+ const isReduxTheme = theme.includes("redux");
851
+ switch (type) {
852
+ case nodeType.CIRCLE:
853
+ return "mindmapCircle";
854
+ case nodeType.RECT:
855
+ return "rect";
856
+ case nodeType.ROUNDED_RECT:
857
+ return "rounded";
858
+ case nodeType.CLOUD:
859
+ return "cloud";
860
+ case nodeType.BANG:
861
+ return "bang";
862
+ case nodeType.HEXAGON:
863
+ return "hexagon";
864
+ case nodeType.DEFAULT:
865
+ return isReduxTheme ? "rounded" : "defaultMindmapNode";
866
+ case nodeType.NO_BORDER:
867
+ default:
868
+ return "rect";
869
+ }
870
+ }, "getShapeFromType");
871
+ const processedNode = {
872
+ id: node.id.toString(),
873
+ domId: "node_" + node.id.toString(),
874
+ label: node.descr,
875
+ labelType: "markdown",
876
+ isGroup: false,
877
+ shape: getShapeFromType(node.type),
878
+ width: node.width,
879
+ height: node.height ?? 0,
880
+ padding: node.padding,
881
+ cssClasses: classes,
882
+ cssStyles: [],
883
+ look: conf.look,
884
+ icon: node.icon,
885
+ x: node.x,
886
+ y: node.y,
887
+ // Mindmap-specific properties
888
+ level: node.level,
889
+ nodeId: node.nodeId,
890
+ type: node.type,
891
+ section: node.section
892
+ };
893
+ processedNodes.push(processedNode);
894
+ if (node.children) {
895
+ for (const child of node.children) {
896
+ this.flattenNodes(child, processedNodes);
897
+ }
898
+ }
899
+ }
900
+ /**
901
+ * Generate edges from parent-child relationships in mindmap tree
902
+ * @param node - The mindmap node to process
903
+ * @param edges - Array to collect edges
904
+ */
905
+ generateEdges(node, edges) {
906
+ if (!node.children) {
907
+ return;
908
+ }
909
+ const conf = getConfig2();
910
+ for (const child of node.children) {
911
+ let edgeClasses = "edge";
912
+ if (child.section !== void 0) {
913
+ edgeClasses += ` section-edge-${child.section}`;
914
+ }
915
+ const edgeDepth = node.level + 1;
916
+ edgeClasses += ` edge-depth-${edgeDepth}`;
917
+ const edge = {
918
+ id: `edge_${node.id}_${child.id}`,
919
+ start: node.id.toString(),
920
+ end: child.id.toString(),
921
+ type: "normal",
922
+ curve: "basis",
923
+ thickness: "normal",
924
+ look: conf.look,
925
+ classes: edgeClasses,
926
+ // Store mindmap-specific data
927
+ depth: node.level,
928
+ section: child.section
929
+ };
930
+ edges.push(edge);
931
+ this.generateEdges(child, edges);
932
+ }
933
+ }
934
+ /**
935
+ * Get structured data for layout algorithms
936
+ * Following the pattern established by ER diagrams
937
+ * @returns Structured data containing nodes, edges, and config
938
+ */
939
+ getData() {
940
+ const mindmapRoot = this.getMindmap();
941
+ const config = getConfig2();
942
+ const userDefinedConfig = getUserDefinedConfig();
943
+ const hasUserDefinedLayout = userDefinedConfig.layout !== void 0;
944
+ const finalConfig = config;
945
+ if (!hasUserDefinedLayout) {
946
+ finalConfig.layout = "cose-bilkent";
947
+ }
948
+ if (!mindmapRoot) {
949
+ return {
950
+ nodes: [],
951
+ edges: [],
952
+ config: finalConfig
953
+ };
954
+ }
955
+ log.debug("getData: mindmapRoot", mindmapRoot, config);
956
+ this.assignSections(mindmapRoot);
957
+ const processedNodes = [];
958
+ const processedEdges = [];
959
+ this.flattenNodes(mindmapRoot, processedNodes);
960
+ this.generateEdges(mindmapRoot, processedEdges);
961
+ log.debug(
962
+ `getData: processed ${processedNodes.length} nodes and ${processedEdges.length} edges`
963
+ );
964
+ const shapes = /* @__PURE__ */ new Map();
965
+ for (const node of processedNodes) {
966
+ shapes.set(node.id, {
967
+ shape: node.shape,
968
+ width: node.width,
969
+ height: node.height,
970
+ padding: node.padding
971
+ });
972
+ }
973
+ return {
974
+ nodes: processedNodes,
975
+ edges: processedEdges,
976
+ config: finalConfig,
977
+ // Store the root node for mindmap-specific layout algorithms
978
+ rootNode: mindmapRoot,
979
+ // Properties required by dagre layout algorithm
980
+ markers: ["point"],
981
+ // Mindmaps don't use markers
982
+ direction: "TB",
983
+ // Top-to-bottom direction for mindmaps
984
+ nodeSpacing: 50,
985
+ // Default spacing between nodes
986
+ rankSpacing: 50,
987
+ // Default spacing between ranks
988
+ // Add shapes for ELK compatibility
989
+ shapes: Object.fromEntries(shapes),
990
+ // Additional properties that layout algorithms might expect
991
+ type: "mindmap",
992
+ diagramId: "mindmap-" + v4()
993
+ };
994
+ }
995
+ // Expose logger to grammar
996
+ getLogger() {
997
+ return log;
998
+ }
999
+ };
1000
+ var draw = /* @__PURE__ */ __name(async (text, id, _version, diagObj) => {
1001
+ log.debug("Rendering mindmap diagram\n" + text);
1002
+ const db = diagObj.db;
1003
+ const data4Layout = db.getData();
1004
+ const svg = getDiagramElement(id, data4Layout.config.securityLevel);
1005
+ data4Layout.type = diagObj.type;
1006
+ data4Layout.layoutAlgorithm = getRegisteredLayoutAlgorithm(data4Layout.config.layout, {
1007
+ fallback: "cose-bilkent"
1008
+ });
1009
+ data4Layout.diagramId = id;
1010
+ const mm = db.getMindmap();
1011
+ if (!mm) {
1012
+ return;
1013
+ }
1014
+ data4Layout.nodes.forEach((node) => {
1015
+ if (node.shape === "rounded") {
1016
+ node.radius = 15;
1017
+ node.taper = 15;
1018
+ node.stroke = "none";
1019
+ node.width = 0;
1020
+ node.padding = 15;
1021
+ } else if (node.shape === "circle") {
1022
+ node.padding = 10;
1023
+ } else if (node.shape === "rect") {
1024
+ node.width = 0;
1025
+ node.padding = 10;
1026
+ } else if (node.shape === "hexagon") {
1027
+ node.width = 0;
1028
+ node.height = 0;
1029
+ }
1030
+ });
1031
+ await render(data4Layout, svg);
1032
+ const { themeVariables } = getConfig();
1033
+ const { useGradient, gradientStart, gradientStop } = themeVariables;
1034
+ if (useGradient && gradientStart && gradientStop) {
1035
+ const svgId = svg.attr("id");
1036
+ const gradient = svg.append("defs").append("linearGradient").attr("id", `${svgId}-gradient`).attr("gradientUnits", "objectBoundingBox").attr("x1", "0%").attr("y1", "0%").attr("x2", "100%").attr("y2", "0%");
1037
+ gradient.append("stop").attr("offset", "0%").attr("stop-color", gradientStart).attr("stop-opacity", 1);
1038
+ gradient.append("stop").attr("offset", "100%").attr("stop-color", gradientStop).attr("stop-opacity", 1);
1039
+ }
1040
+ setupViewPortForSVG(
1041
+ svg,
1042
+ data4Layout.config.mindmap?.padding ?? defaultConfig_default.mindmap.padding,
1043
+ "mindmapDiagram",
1044
+ data4Layout.config.mindmap?.useMaxWidth ?? defaultConfig_default.mindmap.useMaxWidth
1045
+ );
1046
+ }, "draw");
1047
+ var mindmapRenderer_default = {
1048
+ draw
1049
+ };
1050
+ var genSections = /* @__PURE__ */ __name((options) => {
1051
+ const { theme, look } = options;
1052
+ let sections = "";
1053
+ for (let i = 0; i < options.THEME_COLOR_LIMIT; i++) {
1054
+ options["lineColor" + i] = options["lineColor" + i] || options["cScaleInv" + i];
1055
+ if (isDark(options["lineColor" + i])) {
1056
+ options["lineColor" + i] = lighten(options["lineColor" + i], 20);
1057
+ } else {
1058
+ options["lineColor" + i] = darken(options["lineColor" + i], 20);
1059
+ }
1060
+ }
1061
+ for (let i = 0; i < options.THEME_COLOR_LIMIT; i++) {
1062
+ const sw = "" + (look === "neo" ? Math.max(10 - (i - 1) * 2, 2) : 17 - 3 * i);
1063
+ sections += `
1064
+ .section-${i - 1} rect, .section-${i - 1} path, .section-${i - 1} circle, .section-${i - 1} polygon, .section-${i - 1} path {
1065
+ fill: ${options["cScale" + i]};
1066
+ }
1067
+ .section-${i - 1} text {
1068
+ fill: ${options["cScaleLabel" + i]};
1069
+ }
1070
+ .section-${i - 1} span {
1071
+ color: ${options["cScaleLabel" + i]};
1072
+ }
1073
+ .node-icon-${i - 1} {
1074
+ font-size: 40px;
1075
+ color: ${options["cScaleLabel" + i]};
1076
+ }
1077
+ .section-edge-${i - 1}{
1078
+ stroke: ${options["cScale" + i]};
1079
+ }
1080
+ .edge-depth-${i - 1}{
1081
+ stroke-width: ${sw};
1082
+ }
1083
+ .section-${i - 1} line {
1084
+ stroke: ${options["cScaleInv" + i]} ;
1085
+ stroke-width: 3;
1086
+ }
1087
+
1088
+ .disabled, .disabled circle, .disabled text {
1089
+ fill: lightgray;
1090
+ }
1091
+ .disabled text {
1092
+ fill: #efefef;
1093
+ }
1094
+ [data-look="neo"].mindmap-node.section-${i - 1} rect, [data-look="neo"].mindmap-node.section-${i - 1} path, [data-look="neo"].mindmap-node.section-${i - 1} circle, [data-look="neo"].mindmap-node.section-${i - 1} polygon {
1095
+ fill: ${theme === "redux" || theme === "redux-dark" || theme === "neutral" ? options.mainBkg : options["cScale" + i]};
1096
+ stroke: ${theme === "redux" || theme === "redux-dark" ? options.nodeBorder : options["cScale" + i]};
1097
+ stroke-width: ${options.strokeWidth ?? 2}px;
1098
+ }
1099
+ [data-look="neo"].section-edge-${i - 1}{
1100
+ stroke: ${theme?.includes("redux") || theme === "neo-dark" ? options.nodeBorder : options["cScale" + i]};
1101
+ }
1102
+ [data-look="neo"].mindmap-node.section-${i - 1} text {
1103
+ fill: ${theme === "redux" || theme === "redux-dark" ? options.nodeBorder : options["cScaleLabel" + (theme === "neutral" ? 1 : i)]};
1104
+ }
1105
+ `;
1106
+ }
1107
+ return sections;
1108
+ }, "genSections");
1109
+ var genGradient = /* @__PURE__ */ __name((THEME_COLOR_LIMIT, svgId, mainBkg) => {
1110
+ let sections = "";
1111
+ for (let i = 0; i < THEME_COLOR_LIMIT; i++) {
1112
+ sections += `
1113
+ [data-look="neo"].mindmap-node.section-${i - 1} rect, [data-look="neo"].mindmap-node.section-${i - 1} path, [data-look="neo"].mindmap-node.section-${i - 1} circle, [data-look="neo"].mindmap-node.section-${i - 1} polygon {
1114
+ stroke: url(${svgId}-gradient);
1115
+ fill: ${mainBkg};
1116
+ }
1117
+ .section-${i - 1} line {
1118
+ stroke-width: 0;
1119
+ }`;
1120
+ }
1121
+ return sections;
1122
+ }, "genGradient");
1123
+ var getStyles = /* @__PURE__ */ __name((options) => {
1124
+ const { theme } = options;
1125
+ const svgId = options.svgId;
1126
+ const scopedDropShadow = options.dropShadow ? options.dropShadow.replace("url(#drop-shadow)", `url(${svgId}-drop-shadow)`) : "none";
1127
+ return `
1128
+ .edge {
1129
+ stroke-width: 3;
1130
+ }
1131
+ ${genSections(options)}
1132
+ .section-root rect, .section-root path, .section-root circle, .section-root polygon {
1133
+ fill: ${options.git0};
1134
+ }
1135
+ .section-root text {
1136
+ fill: ${options.gitBranchLabel0};
1137
+ }
1138
+ .section-root span {
1139
+ color: ${theme?.includes("redux") ? options.nodeBorder : options.gitBranchLabel0};
1140
+ }
1141
+ .icon-container {
1142
+ height:100%;
1143
+ display: flex;
1144
+ justify-content: center;
1145
+ align-items: center;
1146
+ }
1147
+ .edge {
1148
+ fill: none;
1149
+ }
1150
+ .mindmap-node-label {
1151
+ dy: 1em;
1152
+ alignment-baseline: middle;
1153
+ text-anchor: middle;
1154
+ dominant-baseline: middle;
1155
+ text-align: center;
1156
+ }
1157
+ [data-look="neo"].mindmap-node {
1158
+ filter: ${scopedDropShadow};
1159
+ }
1160
+ [data-look="neo"].mindmap-node.section-root rect, [data-look="neo"].mindmap-node.section-root path, [data-look="neo"].mindmap-node.section-root circle, [data-look="neo"].mindmap-node.section-root polygon {
1161
+ fill: ${theme?.includes("redux") ? options.mainBkg : options.git0};
1162
+ }
1163
+ [data-look="neo"].mindmap-node.section-root .text-inner-tspan {
1164
+ fill: ${theme?.includes("redux") ? options.nodeBorder : options["cScaleLabel" + (theme === "neutral" ? 1 : 0)]};
1165
+ }
1166
+ ${options.useGradient && svgId && options.mainBkg ? genGradient(options.THEME_COLOR_LIMIT, svgId, options.mainBkg) : ""}
1167
+ `;
1168
+ }, "getStyles");
1169
+ var styles_default = getStyles;
1170
+ var diagram = {
1171
+ get db() {
1172
+ return new MindmapDB();
1173
+ },
1174
+ renderer: mindmapRenderer_default,
1175
+ parser: mindmap_default,
1176
+ styles: styles_default
1177
+ };
1178
+ export {
1179
+ diagram
1180
+ };