@infinilabs/ai-chat 0.0.1 → 0.0.2

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 (116) hide show
  1. package/README.md +10 -1
  2. package/dist/{_baseUniq-BQcAhV7E.js → _baseUniq-BFn6cCm9.js} +1 -1
  3. package/dist/_baseUniq-nfJyj2zU.cjs +151 -0
  4. package/dist/arc-BWSMkwk2.cjs +130 -0
  5. package/dist/{arc-2jwvQ2TN.js → arc-DODeX7B9.js} +1 -1
  6. package/dist/{architecture-U656AL7Q-WuSilpZW.js → architecture-U656AL7Q-B4C0nw6C.js} +1 -1
  7. package/dist/architecture-U656AL7Q-CVURQXwt.cjs +5 -0
  8. package/dist/architectureDiagram-VXUJARFQ-2UbdzpNz.cjs +8681 -0
  9. package/dist/{architectureDiagram-VXUJARFQ-D6SKNy5z.js → architectureDiagram-VXUJARFQ-NCVmzKuE.js} +3 -3
  10. package/dist/blockDiagram-VD42YOAC-B3yCPK1N.cjs +3606 -0
  11. package/dist/{blockDiagram-VD42YOAC-Ct2DD8jj.js → blockDiagram-VD42YOAC-C4FsmQfk.js} +5 -5
  12. package/dist/{c4Diagram-YG6GDRKO-B7wBU4mz.js → c4Diagram-YG6GDRKO-ATyoKzFV.js} +2 -2
  13. package/dist/c4Diagram-YG6GDRKO-COwVcHWj.cjs +2481 -0
  14. package/dist/channel-2Y73gsu9.cjs +6 -0
  15. package/dist/{channel-BRREX19f.js → channel-oB8MffQV.js} +1 -1
  16. package/dist/chunk-4BX2VUAB-C3diNHZw.cjs +15 -0
  17. package/dist/{chunk-4BX2VUAB-BnghU1_v.js → chunk-4BX2VUAB-sd2zFBFz.js} +1 -1
  18. package/dist/{chunk-55IACEB6-Dduk-DEL.js → chunk-55IACEB6-6ohTnYE3.js} +1 -1
  19. package/dist/chunk-55IACEB6-T-CzlJke.cjs +12 -0
  20. package/dist/chunk-B4BG7PRW-B1zqG62l.cjs +1825 -0
  21. package/dist/{chunk-B4BG7PRW-DeHw-z-x.js → chunk-B4BG7PRW-E1dti26Y.js} +4 -4
  22. package/dist/chunk-DI55MBZ5-Dk0kfYBV.cjs +1914 -0
  23. package/dist/{chunk-DI55MBZ5-GTHMAr0M.js → chunk-DI55MBZ5-DpHw-vMw.js} +3 -3
  24. package/dist/{chunk-FMBD7UC4-Bchh4_3W.js → chunk-FMBD7UC4-B1vXpasq.js} +1 -1
  25. package/dist/chunk-FMBD7UC4-CShN9-qf.cjs +18 -0
  26. package/dist/{chunk-QN33PNHL-H6S-NYp0.js → chunk-QN33PNHL-Cw7FG91D.js} +1 -1
  27. package/dist/chunk-QN33PNHL-DJi1fhak.cjs +23 -0
  28. package/dist/{chunk-QZHKN3VN-DdcyNnvM.js → chunk-QZHKN3VN-BweiBR9P.js} +1 -1
  29. package/dist/chunk-QZHKN3VN-DfUW_gDw.cjs +16 -0
  30. package/dist/chunk-TZMSLE5B-DY2Kbag4.cjs +107 -0
  31. package/dist/{chunk-TZMSLE5B-C7te_j4V.js → chunk-TZMSLE5B-ZQ2Esoix.js} +1 -1
  32. package/dist/{classDiagram-2ON5EDUG-CNkHY_Y7.js → classDiagram-2ON5EDUG-D2tIbkjc.js} +2 -2
  33. package/dist/classDiagram-2ON5EDUG-DRhRmkUb.cjs +19 -0
  34. package/dist/{classDiagram-v2-WZHVMYZB-CNkHY_Y7.js → classDiagram-v2-WZHVMYZB-D2tIbkjc.js} +2 -2
  35. package/dist/classDiagram-v2-WZHVMYZB-DRhRmkUb.cjs +19 -0
  36. package/dist/clone-BMkj3yun.cjs +7 -0
  37. package/dist/{clone-DnOD7gQ4.js → clone-ChHXIoR6.js} +1 -1
  38. package/dist/cose-bilkent-S5V4N54A-BXnWH5Od.cjs +4942 -0
  39. package/dist/{cose-bilkent-S5V4N54A-2EKtTYth.js → cose-bilkent-S5V4N54A-D15BmpCb.js} +1 -1
  40. package/dist/cytoscape.esm-D8IBYQeQ.cjs +30238 -0
  41. package/dist/dagre-6UL2VRFP-DGQ6TW_g.cjs +693 -0
  42. package/dist/{dagre-6UL2VRFP-oJLNDO4O.js → dagre-6UL2VRFP-WmhUYWg8.js} +5 -5
  43. package/dist/defaultLocale-DwYGIg9G.cjs +203 -0
  44. package/dist/{diagram-PSM6KHXK-DhMgmu9h.js → diagram-PSM6KHXK-DSfHBoUT.js} +4 -4
  45. package/dist/diagram-PSM6KHXK-J4qyGeN7.cjs +845 -0
  46. package/dist/diagram-QEK2KX5R-D96wT5cH.cjs +300 -0
  47. package/dist/{diagram-QEK2KX5R-pB1vUeno.js → diagram-QEK2KX5R-I_nyexpY.js} +3 -3
  48. package/dist/diagram-S2PKOQOG-BC_WyKEe.cjs +210 -0
  49. package/dist/{diagram-S2PKOQOG-HTooIr24.js → diagram-S2PKOQOG-aooXSMNo.js} +3 -3
  50. package/dist/erDiagram-Q2GNP2WA-DQ8Lquay.cjs +1158 -0
  51. package/dist/{erDiagram-Q2GNP2WA-CCaN2EHf.js → erDiagram-Q2GNP2WA-DWF8e6EL.js} +4 -4
  52. package/dist/{flowDiagram-NV44I4VS-CG0erQtl.js → flowDiagram-NV44I4VS-CM9c4F1o.js} +5 -5
  53. package/dist/flowDiagram-NV44I4VS-DpYNkyM2.cjs +2331 -0
  54. package/dist/{ganttDiagram-JELNMOA3-D3rSLJec.js → ganttDiagram-JELNMOA3-CAsoD6rZ.js} +2 -2
  55. package/dist/ganttDiagram-JELNMOA3-DfKahpj4.cjs +3679 -0
  56. package/dist/{gitGraph-F6HP7TQM-BDWdXs6A.js → gitGraph-F6HP7TQM-BX2fz4_i.js} +1 -1
  57. package/dist/gitGraph-F6HP7TQM-DRkGg4T1.cjs +5 -0
  58. package/dist/{gitGraphDiagram-NY62KEGX-Ip-PiLDb.js → gitGraphDiagram-NY62KEGX-PXpI94u6.js} +4 -4
  59. package/dist/gitGraphDiagram-NY62KEGX-YhnKpooH.cjs +1203 -0
  60. package/dist/{graph-wCViE1vL.js → graph-BvxpI7Xc.js} +2 -2
  61. package/dist/graph-CI_TWBSn.cjs +595 -0
  62. package/dist/index-BctLGjTK.cjs +120500 -0
  63. package/dist/{index-BQvQI7yA.js → index-CjSgoo1P.js} +103324 -100141
  64. package/dist/index.cjs +19 -0
  65. package/dist/index.js +13 -1
  66. package/dist/info-NVLQJR56-BGbTE7dw.cjs +5 -0
  67. package/dist/info-NVLQJR56-DRxIh-N8.js +5 -0
  68. package/dist/infoDiagram-WHAUD3N6-BB2Bnbnh.cjs +31 -0
  69. package/dist/{infoDiagram-WHAUD3N6-BbVs4x8y.js → infoDiagram-WHAUD3N6-D_RrgwxS.js} +2 -2
  70. package/dist/init-DevvdK2U.cjs +15 -0
  71. package/dist/{journeyDiagram-XKPGCS4Q-Cz9ox9GA.js → journeyDiagram-XKPGCS4Q-BJjXlMIj.js} +4 -4
  72. package/dist/journeyDiagram-XKPGCS4Q-BcBLsfI9.cjs +1254 -0
  73. package/dist/{kanban-definition-3W4ZIXB7-ChdUHO5f.js → kanban-definition-3W4ZIXB7-0wwNBZ93.js} +2 -2
  74. package/dist/kanban-definition-3W4ZIXB7-CaY0q4j9.cjs +1047 -0
  75. package/dist/katex-BhpYeT3b.cjs +14523 -0
  76. package/dist/{layout-BaZPdTGN.js → layout-CcghncRv.js} +4 -4
  77. package/dist/layout-CvwzED_C.cjs +2182 -0
  78. package/dist/linear-CYow-mAK.cjs +339 -0
  79. package/dist/{linear-D_RX7hM-.js → linear-D_gKQzVp.js} +1 -1
  80. package/dist/mermaid-parser.core-CzmkR-3i.cjs +18703 -0
  81. package/dist/{mermaid-parser.core-_sn6A3wB.js → mermaid-parser.core-DCMDT-Cp.js} +10 -10
  82. package/dist/{min-BxeM4Drj.js → min-BBp7Smma.js} +2 -2
  83. package/dist/min-Gu1I_bJ9.cjs +40 -0
  84. package/dist/mindmap-definition-VGOIOE7T-D16Pp1u5.cjs +1126 -0
  85. package/dist/{mindmap-definition-VGOIOE7T-BkjJibdi.js → mindmap-definition-VGOIOE7T-PjSLRtz4.js} +3 -3
  86. package/dist/ordinal-D7sQNqXZ.cjs +75 -0
  87. package/dist/{packet-BFZMPI3H-D3RtU0mc.js → packet-BFZMPI3H-BvdogPiS.js} +1 -1
  88. package/dist/packet-BFZMPI3H-C7pOHUWY.cjs +5 -0
  89. package/dist/pie-7BOR55EZ-D-DxSHbP.cjs +5 -0
  90. package/dist/pie-7BOR55EZ-DEWJe4Xn.js +5 -0
  91. package/dist/{pieDiagram-ADFJNKIX-2Yr1gkth.js → pieDiagram-ADFJNKIX-CoDddKZl.js} +4 -4
  92. package/dist/pieDiagram-ADFJNKIX-DjN4DU9l.cjs +237 -0
  93. package/dist/{quadrantDiagram-AYHSOK5B-CjicpXRv.js → quadrantDiagram-AYHSOK5B-BZOg0JMm.js} +2 -2
  94. package/dist/quadrantDiagram-AYHSOK5B-DXjTSOL4.cjs +1335 -0
  95. package/dist/radar-NHE76QYJ-BrnDXy9q.cjs +5 -0
  96. package/dist/{radar-NHE76QYJ-CL0tHnUP.js → radar-NHE76QYJ-C2WmPmJ4.js} +1 -1
  97. package/dist/{requirementDiagram-UZGBJVZJ-DBnhlfjR.js → requirementDiagram-UZGBJVZJ-CCW1O1xH.js} +3 -3
  98. package/dist/requirementDiagram-UZGBJVZJ-e5F3-dDI.cjs +1161 -0
  99. package/dist/{sankeyDiagram-TZEHDZUN-B2FErKCa.js → sankeyDiagram-TZEHDZUN-BaGzCxTp.js} +1 -1
  100. package/dist/sankeyDiagram-TZEHDZUN-DtIvOvVI.cjs +1193 -0
  101. package/dist/sequenceDiagram-WL72ISMW-0vFhYnxn.cjs +3874 -0
  102. package/dist/{sequenceDiagram-WL72ISMW-BkNTlRlB.js → sequenceDiagram-WL72ISMW-DL3B7U56.js} +3 -3
  103. package/dist/stateDiagram-FKZM4ZOC-CXW608BR.cjs +447 -0
  104. package/dist/{stateDiagram-FKZM4ZOC-CAAFQtS9.js → stateDiagram-FKZM4ZOC-Ddw6HxPD.js} +4 -4
  105. package/dist/{stateDiagram-v2-4FDKWEC3-lF6kUebI.js → stateDiagram-v2-4FDKWEC3-DZCkQKmp.js} +2 -2
  106. package/dist/stateDiagram-v2-4FDKWEC3-DefWUbvq.cjs +19 -0
  107. package/dist/timeline-definition-IT6M3QCI-C3TfA9lE.cjs +1222 -0
  108. package/dist/{timeline-definition-IT6M3QCI-CQgMFEPA.js → timeline-definition-IT6M3QCI-DiS88lUo.js} +2 -2
  109. package/dist/treemap-KMMF4GRG-Bl-H6j2c.cjs +5 -0
  110. package/dist/{treemap-KMMF4GRG-B0Mc-u8X.js → treemap-KMMF4GRG-DGGr_R9A.js} +1 -1
  111. package/dist/{xychartDiagram-PRI3JC2R-Cee7LdLr.js → xychartDiagram-PRI3JC2R-BrOwRjfF.js} +2 -2
  112. package/dist/xychartDiagram-PRI3JC2R-CM06DttH.cjs +1886 -0
  113. package/package.json +17 -5
  114. package/dist/index.css +0 -3334
  115. package/dist/info-NVLQJR56-pJlVBPs6.js +0 -5
  116. package/dist/pie-7BOR55EZ-xH--CiaM.js +0 -5
@@ -0,0 +1,1126 @@
1
+ "use strict";
2
+ var _a;
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
+ const chunk55IACEB6 = require("./chunk-55IACEB6-T-CzlJke.cjs");
5
+ const chunkQN33PNHL = require("./chunk-QN33PNHL-DJi1fhak.cjs");
6
+ const index = require("./index-BctLGjTK.cjs");
7
+ const byteToHex = [];
8
+ for (let i = 0; i < 256; ++i) {
9
+ byteToHex.push((i + 256).toString(16).slice(1));
10
+ }
11
+ function unsafeStringify(arr, offset = 0) {
12
+ 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();
13
+ }
14
+ let getRandomValues;
15
+ const rnds8 = new Uint8Array(16);
16
+ function rng() {
17
+ if (!getRandomValues) {
18
+ if (typeof crypto === "undefined" || !crypto.getRandomValues) {
19
+ throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
20
+ }
21
+ getRandomValues = crypto.getRandomValues.bind(crypto);
22
+ }
23
+ return getRandomValues(rnds8);
24
+ }
25
+ const randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
26
+ const native = { randomUUID };
27
+ function v4(options, buf, offset) {
28
+ if (native.randomUUID && true && !options) {
29
+ return native.randomUUID();
30
+ }
31
+ options = options || {};
32
+ const rnds = options.random ?? options.rng?.() ?? rng();
33
+ if (rnds.length < 16) {
34
+ throw new Error("Random bytes length must be >= 16");
35
+ }
36
+ rnds[6] = rnds[6] & 15 | 64;
37
+ rnds[8] = rnds[8] & 63 | 128;
38
+ return unsafeStringify(rnds);
39
+ }
40
+ var parser = (function() {
41
+ var o = /* @__PURE__ */ index.__name(function(k, v, o2, l) {
42
+ for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v) ;
43
+ return o2;
44
+ }, "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];
45
+ var parser2 = {
46
+ trace: /* @__PURE__ */ index.__name(function trace() {
47
+ }, "trace"),
48
+ yy: {},
49
+ 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 },
50
+ 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" },
51
+ 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]],
52
+ performAction: /* @__PURE__ */ index.__name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
53
+ var $0 = $$.length - 1;
54
+ switch (yystate) {
55
+ case 6:
56
+ case 7:
57
+ return yy;
58
+ case 8:
59
+ yy.getLogger().trace("Stop NL ");
60
+ break;
61
+ case 9:
62
+ yy.getLogger().trace("Stop EOF ");
63
+ break;
64
+ case 11:
65
+ yy.getLogger().trace("Stop NL2 ");
66
+ break;
67
+ case 12:
68
+ yy.getLogger().trace("Stop EOF2 ");
69
+ break;
70
+ case 15:
71
+ yy.getLogger().info("Node: ", $$[$0].id);
72
+ yy.addNode($$[$0 - 1].length, $$[$0].id, $$[$0].descr, $$[$0].type);
73
+ break;
74
+ case 16:
75
+ yy.getLogger().trace("Icon: ", $$[$0]);
76
+ yy.decorateNode({ icon: $$[$0] });
77
+ break;
78
+ case 17:
79
+ case 21:
80
+ yy.decorateNode({ class: $$[$0] });
81
+ break;
82
+ case 18:
83
+ yy.getLogger().trace("SPACELIST");
84
+ break;
85
+ case 19:
86
+ yy.getLogger().trace("Node: ", $$[$0].id);
87
+ yy.addNode(0, $$[$0].id, $$[$0].descr, $$[$0].type);
88
+ break;
89
+ case 20:
90
+ yy.decorateNode({ icon: $$[$0] });
91
+ break;
92
+ case 25:
93
+ yy.getLogger().trace("node found ..", $$[$0 - 2]);
94
+ this.$ = { id: $$[$0 - 1], descr: $$[$0 - 1], type: yy.getType($$[$0 - 2], $$[$0]) };
95
+ break;
96
+ case 26:
97
+ this.$ = { id: $$[$0], descr: $$[$0], type: yy.nodeType.DEFAULT };
98
+ break;
99
+ case 27:
100
+ yy.getLogger().trace("node found ..", $$[$0 - 3]);
101
+ this.$ = { id: $$[$0 - 3], descr: $$[$0 - 1], type: yy.getType($$[$0 - 2], $$[$0]) };
102
+ break;
103
+ }
104
+ }, "anonymous"),
105
+ 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])],
106
+ defaultActions: { 2: [2, 1], 6: [2, 2] },
107
+ parseError: /* @__PURE__ */ index.__name(function parseError(str, hash) {
108
+ if (hash.recoverable) {
109
+ this.trace(str);
110
+ } else {
111
+ var error = new Error(str);
112
+ error.hash = hash;
113
+ throw error;
114
+ }
115
+ }, "parseError"),
116
+ parse: /* @__PURE__ */ index.__name(function parse(input) {
117
+ var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, TERROR = 2, EOF = 1;
118
+ var args = lstack.slice.call(arguments, 1);
119
+ var lexer2 = Object.create(this.lexer);
120
+ var sharedState = { yy: {} };
121
+ for (var k in this.yy) {
122
+ if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
123
+ sharedState.yy[k] = this.yy[k];
124
+ }
125
+ }
126
+ lexer2.setInput(input, sharedState.yy);
127
+ sharedState.yy.lexer = lexer2;
128
+ sharedState.yy.parser = this;
129
+ if (typeof lexer2.yylloc == "undefined") {
130
+ lexer2.yylloc = {};
131
+ }
132
+ var yyloc = lexer2.yylloc;
133
+ lstack.push(yyloc);
134
+ var ranges = lexer2.options && lexer2.options.ranges;
135
+ if (typeof sharedState.yy.parseError === "function") {
136
+ this.parseError = sharedState.yy.parseError;
137
+ } else {
138
+ this.parseError = Object.getPrototypeOf(this).parseError;
139
+ }
140
+ function popStack(n) {
141
+ stack.length = stack.length - 2 * n;
142
+ vstack.length = vstack.length - n;
143
+ lstack.length = lstack.length - n;
144
+ }
145
+ index.__name(popStack, "popStack");
146
+ function lex() {
147
+ var token;
148
+ token = tstack.pop() || lexer2.lex() || EOF;
149
+ if (typeof token !== "number") {
150
+ if (token instanceof Array) {
151
+ tstack = token;
152
+ token = tstack.pop();
153
+ }
154
+ token = self.symbols_[token] || token;
155
+ }
156
+ return token;
157
+ }
158
+ index.__name(lex, "lex");
159
+ var symbol, state, action, r, yyval = {}, p, len, newState, expected;
160
+ while (true) {
161
+ state = stack[stack.length - 1];
162
+ if (this.defaultActions[state]) {
163
+ action = this.defaultActions[state];
164
+ } else {
165
+ if (symbol === null || typeof symbol == "undefined") {
166
+ symbol = lex();
167
+ }
168
+ action = table[state] && table[state][symbol];
169
+ }
170
+ if (typeof action === "undefined" || !action.length || !action[0]) {
171
+ var errStr = "";
172
+ expected = [];
173
+ for (p in table[state]) {
174
+ if (this.terminals_[p] && p > TERROR) {
175
+ expected.push("'" + this.terminals_[p] + "'");
176
+ }
177
+ }
178
+ if (lexer2.showPosition) {
179
+ errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
180
+ } else {
181
+ errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
182
+ }
183
+ this.parseError(errStr, {
184
+ text: lexer2.match,
185
+ token: this.terminals_[symbol] || symbol,
186
+ line: lexer2.yylineno,
187
+ loc: yyloc,
188
+ expected
189
+ });
190
+ }
191
+ if (action[0] instanceof Array && action.length > 1) {
192
+ throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
193
+ }
194
+ switch (action[0]) {
195
+ case 1:
196
+ stack.push(symbol);
197
+ vstack.push(lexer2.yytext);
198
+ lstack.push(lexer2.yylloc);
199
+ stack.push(action[1]);
200
+ symbol = null;
201
+ {
202
+ yyleng = lexer2.yyleng;
203
+ yytext = lexer2.yytext;
204
+ yylineno = lexer2.yylineno;
205
+ yyloc = lexer2.yylloc;
206
+ }
207
+ break;
208
+ case 2:
209
+ len = this.productions_[action[1]][1];
210
+ yyval.$ = vstack[vstack.length - len];
211
+ yyval._$ = {
212
+ first_line: lstack[lstack.length - (len || 1)].first_line,
213
+ last_line: lstack[lstack.length - 1].last_line,
214
+ first_column: lstack[lstack.length - (len || 1)].first_column,
215
+ last_column: lstack[lstack.length - 1].last_column
216
+ };
217
+ if (ranges) {
218
+ yyval._$.range = [
219
+ lstack[lstack.length - (len || 1)].range[0],
220
+ lstack[lstack.length - 1].range[1]
221
+ ];
222
+ }
223
+ r = this.performAction.apply(yyval, [
224
+ yytext,
225
+ yyleng,
226
+ yylineno,
227
+ sharedState.yy,
228
+ action[1],
229
+ vstack,
230
+ lstack
231
+ ].concat(args));
232
+ if (typeof r !== "undefined") {
233
+ return r;
234
+ }
235
+ if (len) {
236
+ stack = stack.slice(0, -1 * len * 2);
237
+ vstack = vstack.slice(0, -1 * len);
238
+ lstack = lstack.slice(0, -1 * len);
239
+ }
240
+ stack.push(this.productions_[action[1]][0]);
241
+ vstack.push(yyval.$);
242
+ lstack.push(yyval._$);
243
+ newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
244
+ stack.push(newState);
245
+ break;
246
+ case 3:
247
+ return true;
248
+ }
249
+ }
250
+ return true;
251
+ }, "parse")
252
+ };
253
+ var lexer = /* @__PURE__ */ (function() {
254
+ var lexer2 = {
255
+ EOF: 1,
256
+ parseError: /* @__PURE__ */ index.__name(function parseError(str, hash) {
257
+ if (this.yy.parser) {
258
+ this.yy.parser.parseError(str, hash);
259
+ } else {
260
+ throw new Error(str);
261
+ }
262
+ }, "parseError"),
263
+ // resets the lexer, sets new input
264
+ setInput: /* @__PURE__ */ index.__name(function(input, yy) {
265
+ this.yy = yy || this.yy || {};
266
+ this._input = input;
267
+ this._more = this._backtrack = this.done = false;
268
+ this.yylineno = this.yyleng = 0;
269
+ this.yytext = this.matched = this.match = "";
270
+ this.conditionStack = ["INITIAL"];
271
+ this.yylloc = {
272
+ first_line: 1,
273
+ first_column: 0,
274
+ last_line: 1,
275
+ last_column: 0
276
+ };
277
+ if (this.options.ranges) {
278
+ this.yylloc.range = [0, 0];
279
+ }
280
+ this.offset = 0;
281
+ return this;
282
+ }, "setInput"),
283
+ // consumes and returns one char from the input
284
+ input: /* @__PURE__ */ index.__name(function() {
285
+ var ch = this._input[0];
286
+ this.yytext += ch;
287
+ this.yyleng++;
288
+ this.offset++;
289
+ this.match += ch;
290
+ this.matched += ch;
291
+ var lines = ch.match(/(?:\r\n?|\n).*/g);
292
+ if (lines) {
293
+ this.yylineno++;
294
+ this.yylloc.last_line++;
295
+ } else {
296
+ this.yylloc.last_column++;
297
+ }
298
+ if (this.options.ranges) {
299
+ this.yylloc.range[1]++;
300
+ }
301
+ this._input = this._input.slice(1);
302
+ return ch;
303
+ }, "input"),
304
+ // unshifts one char (or a string) into the input
305
+ unput: /* @__PURE__ */ index.__name(function(ch) {
306
+ var len = ch.length;
307
+ var lines = ch.split(/(?:\r\n?|\n)/g);
308
+ this._input = ch + this._input;
309
+ this.yytext = this.yytext.substr(0, this.yytext.length - len);
310
+ this.offset -= len;
311
+ var oldLines = this.match.split(/(?:\r\n?|\n)/g);
312
+ this.match = this.match.substr(0, this.match.length - 1);
313
+ this.matched = this.matched.substr(0, this.matched.length - 1);
314
+ if (lines.length - 1) {
315
+ this.yylineno -= lines.length - 1;
316
+ }
317
+ var r = this.yylloc.range;
318
+ this.yylloc = {
319
+ first_line: this.yylloc.first_line,
320
+ last_line: this.yylineno + 1,
321
+ first_column: this.yylloc.first_column,
322
+ 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
323
+ };
324
+ if (this.options.ranges) {
325
+ this.yylloc.range = [r[0], r[0] + this.yyleng - len];
326
+ }
327
+ this.yyleng = this.yytext.length;
328
+ return this;
329
+ }, "unput"),
330
+ // When called from action, caches matched text and appends it on next action
331
+ more: /* @__PURE__ */ index.__name(function() {
332
+ this._more = true;
333
+ return this;
334
+ }, "more"),
335
+ // 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.
336
+ reject: /* @__PURE__ */ index.__name(function() {
337
+ if (this.options.backtrack_lexer) {
338
+ this._backtrack = true;
339
+ } else {
340
+ 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(), {
341
+ text: "",
342
+ token: null,
343
+ line: this.yylineno
344
+ });
345
+ }
346
+ return this;
347
+ }, "reject"),
348
+ // retain first n characters of the match
349
+ less: /* @__PURE__ */ index.__name(function(n) {
350
+ this.unput(this.match.slice(n));
351
+ }, "less"),
352
+ // displays already matched input, i.e. for error messages
353
+ pastInput: /* @__PURE__ */ index.__name(function() {
354
+ var past = this.matched.substr(0, this.matched.length - this.match.length);
355
+ return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
356
+ }, "pastInput"),
357
+ // displays upcoming input, i.e. for error messages
358
+ upcomingInput: /* @__PURE__ */ index.__name(function() {
359
+ var next = this.match;
360
+ if (next.length < 20) {
361
+ next += this._input.substr(0, 20 - next.length);
362
+ }
363
+ return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
364
+ }, "upcomingInput"),
365
+ // displays the character position where the lexing error occurred, i.e. for error messages
366
+ showPosition: /* @__PURE__ */ index.__name(function() {
367
+ var pre = this.pastInput();
368
+ var c = new Array(pre.length + 1).join("-");
369
+ return pre + this.upcomingInput() + "\n" + c + "^";
370
+ }, "showPosition"),
371
+ // test the lexed token: return FALSE when not a match, otherwise return token
372
+ test_match: /* @__PURE__ */ index.__name(function(match, indexed_rule) {
373
+ var token, lines, backup;
374
+ if (this.options.backtrack_lexer) {
375
+ backup = {
376
+ yylineno: this.yylineno,
377
+ yylloc: {
378
+ first_line: this.yylloc.first_line,
379
+ last_line: this.last_line,
380
+ first_column: this.yylloc.first_column,
381
+ last_column: this.yylloc.last_column
382
+ },
383
+ yytext: this.yytext,
384
+ match: this.match,
385
+ matches: this.matches,
386
+ matched: this.matched,
387
+ yyleng: this.yyleng,
388
+ offset: this.offset,
389
+ _more: this._more,
390
+ _input: this._input,
391
+ yy: this.yy,
392
+ conditionStack: this.conditionStack.slice(0),
393
+ done: this.done
394
+ };
395
+ if (this.options.ranges) {
396
+ backup.yylloc.range = this.yylloc.range.slice(0);
397
+ }
398
+ }
399
+ lines = match[0].match(/(?:\r\n?|\n).*/g);
400
+ if (lines) {
401
+ this.yylineno += lines.length;
402
+ }
403
+ this.yylloc = {
404
+ first_line: this.yylloc.last_line,
405
+ last_line: this.yylineno + 1,
406
+ first_column: this.yylloc.last_column,
407
+ last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length
408
+ };
409
+ this.yytext += match[0];
410
+ this.match += match[0];
411
+ this.matches = match;
412
+ this.yyleng = this.yytext.length;
413
+ if (this.options.ranges) {
414
+ this.yylloc.range = [this.offset, this.offset += this.yyleng];
415
+ }
416
+ this._more = false;
417
+ this._backtrack = false;
418
+ this._input = this._input.slice(match[0].length);
419
+ this.matched += match[0];
420
+ token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
421
+ if (this.done && this._input) {
422
+ this.done = false;
423
+ }
424
+ if (token) {
425
+ return token;
426
+ } else if (this._backtrack) {
427
+ for (var k in backup) {
428
+ this[k] = backup[k];
429
+ }
430
+ return false;
431
+ }
432
+ return false;
433
+ }, "test_match"),
434
+ // return next match in input
435
+ next: /* @__PURE__ */ index.__name(function() {
436
+ if (this.done) {
437
+ return this.EOF;
438
+ }
439
+ if (!this._input) {
440
+ this.done = true;
441
+ }
442
+ var token, match, tempMatch, index2;
443
+ if (!this._more) {
444
+ this.yytext = "";
445
+ this.match = "";
446
+ }
447
+ var rules = this._currentRules();
448
+ for (var i = 0; i < rules.length; i++) {
449
+ tempMatch = this._input.match(this.rules[rules[i]]);
450
+ if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
451
+ match = tempMatch;
452
+ index2 = i;
453
+ if (this.options.backtrack_lexer) {
454
+ token = this.test_match(tempMatch, rules[i]);
455
+ if (token !== false) {
456
+ return token;
457
+ } else if (this._backtrack) {
458
+ match = false;
459
+ continue;
460
+ } else {
461
+ return false;
462
+ }
463
+ } else if (!this.options.flex) {
464
+ break;
465
+ }
466
+ }
467
+ }
468
+ if (match) {
469
+ token = this.test_match(match, rules[index2]);
470
+ if (token !== false) {
471
+ return token;
472
+ }
473
+ return false;
474
+ }
475
+ if (this._input === "") {
476
+ return this.EOF;
477
+ } else {
478
+ return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
479
+ text: "",
480
+ token: null,
481
+ line: this.yylineno
482
+ });
483
+ }
484
+ }, "next"),
485
+ // return next match that has a token
486
+ lex: /* @__PURE__ */ index.__name(function lex() {
487
+ var r = this.next();
488
+ if (r) {
489
+ return r;
490
+ } else {
491
+ return this.lex();
492
+ }
493
+ }, "lex"),
494
+ // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
495
+ begin: /* @__PURE__ */ index.__name(function begin(condition) {
496
+ this.conditionStack.push(condition);
497
+ }, "begin"),
498
+ // pop the previously active lexer condition state off the condition stack
499
+ popState: /* @__PURE__ */ index.__name(function popState() {
500
+ var n = this.conditionStack.length - 1;
501
+ if (n > 0) {
502
+ return this.conditionStack.pop();
503
+ } else {
504
+ return this.conditionStack[0];
505
+ }
506
+ }, "popState"),
507
+ // produce the lexer rule set which is active for the currently active lexer condition state
508
+ _currentRules: /* @__PURE__ */ index.__name(function _currentRules() {
509
+ if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
510
+ return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
511
+ } else {
512
+ return this.conditions["INITIAL"].rules;
513
+ }
514
+ }, "_currentRules"),
515
+ // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
516
+ topState: /* @__PURE__ */ index.__name(function topState(n) {
517
+ n = this.conditionStack.length - 1 - Math.abs(n || 0);
518
+ if (n >= 0) {
519
+ return this.conditionStack[n];
520
+ } else {
521
+ return "INITIAL";
522
+ }
523
+ }, "topState"),
524
+ // alias for begin(condition)
525
+ pushState: /* @__PURE__ */ index.__name(function pushState(condition) {
526
+ this.begin(condition);
527
+ }, "pushState"),
528
+ // return the number of states currently on the stack
529
+ stateStackSize: /* @__PURE__ */ index.__name(function stateStackSize() {
530
+ return this.conditionStack.length;
531
+ }, "stateStackSize"),
532
+ options: { "case-insensitive": true },
533
+ performAction: /* @__PURE__ */ index.__name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
534
+ switch ($avoiding_name_collisions) {
535
+ case 0:
536
+ yy.getLogger().trace("Found comment", yy_.yytext);
537
+ return 6;
538
+ case 1:
539
+ return 8;
540
+ case 2:
541
+ this.begin("CLASS");
542
+ break;
543
+ case 3:
544
+ this.popState();
545
+ return 16;
546
+ case 4:
547
+ this.popState();
548
+ break;
549
+ case 5:
550
+ yy.getLogger().trace("Begin icon");
551
+ this.begin("ICON");
552
+ break;
553
+ case 6:
554
+ yy.getLogger().trace("SPACELINE");
555
+ return 6;
556
+ case 7:
557
+ return 7;
558
+ case 8:
559
+ return 15;
560
+ case 9:
561
+ yy.getLogger().trace("end icon");
562
+ this.popState();
563
+ break;
564
+ case 10:
565
+ yy.getLogger().trace("Exploding node");
566
+ this.begin("NODE");
567
+ return 19;
568
+ case 11:
569
+ yy.getLogger().trace("Cloud");
570
+ this.begin("NODE");
571
+ return 19;
572
+ case 12:
573
+ yy.getLogger().trace("Explosion Bang");
574
+ this.begin("NODE");
575
+ return 19;
576
+ case 13:
577
+ yy.getLogger().trace("Cloud Bang");
578
+ this.begin("NODE");
579
+ return 19;
580
+ case 14:
581
+ this.begin("NODE");
582
+ return 19;
583
+ case 15:
584
+ this.begin("NODE");
585
+ return 19;
586
+ case 16:
587
+ this.begin("NODE");
588
+ return 19;
589
+ case 17:
590
+ this.begin("NODE");
591
+ return 19;
592
+ case 18:
593
+ return 13;
594
+ case 19:
595
+ return 22;
596
+ case 20:
597
+ return 11;
598
+ case 21:
599
+ this.begin("NSTR2");
600
+ break;
601
+ case 22:
602
+ return "NODE_DESCR";
603
+ case 23:
604
+ this.popState();
605
+ break;
606
+ case 24:
607
+ yy.getLogger().trace("Starting NSTR");
608
+ this.begin("NSTR");
609
+ break;
610
+ case 25:
611
+ yy.getLogger().trace("description:", yy_.yytext);
612
+ return "NODE_DESCR";
613
+ case 26:
614
+ this.popState();
615
+ break;
616
+ case 27:
617
+ this.popState();
618
+ yy.getLogger().trace("node end ))");
619
+ return "NODE_DEND";
620
+ case 28:
621
+ this.popState();
622
+ yy.getLogger().trace("node end )");
623
+ return "NODE_DEND";
624
+ case 29:
625
+ this.popState();
626
+ yy.getLogger().trace("node end ...", yy_.yytext);
627
+ return "NODE_DEND";
628
+ case 30:
629
+ this.popState();
630
+ yy.getLogger().trace("node end ((");
631
+ return "NODE_DEND";
632
+ case 31:
633
+ this.popState();
634
+ yy.getLogger().trace("node end (-");
635
+ return "NODE_DEND";
636
+ case 32:
637
+ this.popState();
638
+ yy.getLogger().trace("node end (-");
639
+ return "NODE_DEND";
640
+ case 33:
641
+ this.popState();
642
+ yy.getLogger().trace("node end ((");
643
+ return "NODE_DEND";
644
+ case 34:
645
+ this.popState();
646
+ yy.getLogger().trace("node end ((");
647
+ return "NODE_DEND";
648
+ case 35:
649
+ yy.getLogger().trace("Long description:", yy_.yytext);
650
+ return 20;
651
+ case 36:
652
+ yy.getLogger().trace("Long description:", yy_.yytext);
653
+ return 20;
654
+ }
655
+ }, "anonymous"),
656
+ 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],
657
+ 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 } }
658
+ };
659
+ return lexer2;
660
+ })();
661
+ parser2.lexer = lexer;
662
+ function Parser() {
663
+ this.yy = {};
664
+ }
665
+ index.__name(Parser, "Parser");
666
+ Parser.prototype = parser2;
667
+ parser2.Parser = Parser;
668
+ return new Parser();
669
+ })();
670
+ parser.parser = parser;
671
+ var mindmap_default = parser;
672
+ var nodeType = {
673
+ DEFAULT: 0,
674
+ NO_BORDER: 0,
675
+ ROUNDED_RECT: 1,
676
+ RECT: 2,
677
+ CIRCLE: 3,
678
+ CLOUD: 4,
679
+ BANG: 5,
680
+ HEXAGON: 6
681
+ };
682
+ var MindmapDB = (_a = class {
683
+ constructor() {
684
+ this.nodes = [];
685
+ this.count = 0;
686
+ this.elements = {};
687
+ this.getLogger = this.getLogger.bind(this);
688
+ this.nodeType = nodeType;
689
+ this.clear();
690
+ this.getType = this.getType.bind(this);
691
+ this.getElementById = this.getElementById.bind(this);
692
+ this.getParent = this.getParent.bind(this);
693
+ this.getMindmap = this.getMindmap.bind(this);
694
+ this.addNode = this.addNode.bind(this);
695
+ this.decorateNode = this.decorateNode.bind(this);
696
+ }
697
+ clear() {
698
+ this.nodes = [];
699
+ this.count = 0;
700
+ this.elements = {};
701
+ this.baseLevel = void 0;
702
+ }
703
+ getParent(level) {
704
+ for (let i = this.nodes.length - 1; i >= 0; i--) {
705
+ if (this.nodes[i].level < level) {
706
+ return this.nodes[i];
707
+ }
708
+ }
709
+ return null;
710
+ }
711
+ getMindmap() {
712
+ return this.nodes.length > 0 ? this.nodes[0] : null;
713
+ }
714
+ addNode(level, id, descr, type) {
715
+ index.log.info("addNode", level, id, descr, type);
716
+ let isRoot = false;
717
+ if (this.nodes.length === 0) {
718
+ this.baseLevel = level;
719
+ level = 0;
720
+ isRoot = true;
721
+ } else if (this.baseLevel !== void 0) {
722
+ level = level - this.baseLevel;
723
+ isRoot = false;
724
+ }
725
+ const conf = index.getConfig2();
726
+ let padding = conf.mindmap?.padding ?? index.defaultConfig_default.mindmap.padding;
727
+ switch (type) {
728
+ case this.nodeType.ROUNDED_RECT:
729
+ case this.nodeType.RECT:
730
+ case this.nodeType.HEXAGON:
731
+ padding *= 2;
732
+ break;
733
+ }
734
+ const node = {
735
+ id: this.count++,
736
+ nodeId: index.sanitizeText(id, conf),
737
+ level,
738
+ descr: index.sanitizeText(descr, conf),
739
+ type,
740
+ children: [],
741
+ width: conf.mindmap?.maxNodeWidth ?? index.defaultConfig_default.mindmap.maxNodeWidth,
742
+ padding,
743
+ isRoot
744
+ };
745
+ const parent = this.getParent(level);
746
+ if (parent) {
747
+ parent.children.push(node);
748
+ this.nodes.push(node);
749
+ } else {
750
+ if (isRoot) {
751
+ this.nodes.push(node);
752
+ } else {
753
+ throw new Error(
754
+ `There can be only one root. No parent could be found for ("${node.descr}")`
755
+ );
756
+ }
757
+ }
758
+ }
759
+ getType(startStr, endStr) {
760
+ index.log.debug("In get type", startStr, endStr);
761
+ switch (startStr) {
762
+ case "[":
763
+ return this.nodeType.RECT;
764
+ case "(":
765
+ return endStr === ")" ? this.nodeType.ROUNDED_RECT : this.nodeType.CLOUD;
766
+ case "((":
767
+ return this.nodeType.CIRCLE;
768
+ case ")":
769
+ return this.nodeType.CLOUD;
770
+ case "))":
771
+ return this.nodeType.BANG;
772
+ case "{{":
773
+ return this.nodeType.HEXAGON;
774
+ default:
775
+ return this.nodeType.DEFAULT;
776
+ }
777
+ }
778
+ setElementForId(id, element) {
779
+ this.elements[id] = element;
780
+ }
781
+ getElementById(id) {
782
+ return this.elements[id];
783
+ }
784
+ decorateNode(decoration) {
785
+ if (!decoration) {
786
+ return;
787
+ }
788
+ const config = index.getConfig2();
789
+ const node = this.nodes[this.nodes.length - 1];
790
+ if (decoration.icon) {
791
+ node.icon = index.sanitizeText(decoration.icon, config);
792
+ }
793
+ if (decoration.class) {
794
+ node.class = index.sanitizeText(decoration.class, config);
795
+ }
796
+ }
797
+ type2Str(type) {
798
+ switch (type) {
799
+ case this.nodeType.DEFAULT:
800
+ return "no-border";
801
+ case this.nodeType.RECT:
802
+ return "rect";
803
+ case this.nodeType.ROUNDED_RECT:
804
+ return "rounded-rect";
805
+ case this.nodeType.CIRCLE:
806
+ return "circle";
807
+ case this.nodeType.CLOUD:
808
+ return "cloud";
809
+ case this.nodeType.BANG:
810
+ return "bang";
811
+ case this.nodeType.HEXAGON:
812
+ return "hexgon";
813
+ // cspell: disable-line
814
+ default:
815
+ return "no-border";
816
+ }
817
+ }
818
+ /**
819
+ * Assign section numbers to nodes based on their position relative to root
820
+ * @param node - The mindmap node to process
821
+ * @param sectionNumber - The section number to assign (undefined for root)
822
+ */
823
+ assignSections(node, sectionNumber) {
824
+ if (node.level === 0) {
825
+ node.section = void 0;
826
+ } else {
827
+ node.section = sectionNumber;
828
+ }
829
+ if (node.children) {
830
+ for (const [index2, child] of node.children.entries()) {
831
+ const childSectionNumber = node.level === 0 ? index2 : sectionNumber;
832
+ this.assignSections(child, childSectionNumber);
833
+ }
834
+ }
835
+ }
836
+ /**
837
+ * Convert mindmap tree structure to flat array of nodes
838
+ * @param node - The mindmap node to process
839
+ * @param processedNodes - Array to collect processed nodes
840
+ */
841
+ flattenNodes(node, processedNodes) {
842
+ const cssClasses = ["mindmap-node"];
843
+ if (node.isRoot === true) {
844
+ cssClasses.push("section-root", "section--1");
845
+ } else if (node.section !== void 0) {
846
+ cssClasses.push(`section-${node.section}`);
847
+ }
848
+ if (node.class) {
849
+ cssClasses.push(node.class);
850
+ }
851
+ const classes = cssClasses.join(" ");
852
+ const getShapeFromType = /* @__PURE__ */ index.__name((type) => {
853
+ switch (type) {
854
+ case nodeType.CIRCLE:
855
+ return "mindmapCircle";
856
+ case nodeType.RECT:
857
+ return "rect";
858
+ case nodeType.ROUNDED_RECT:
859
+ return "rounded";
860
+ case nodeType.CLOUD:
861
+ return "cloud";
862
+ case nodeType.BANG:
863
+ return "bang";
864
+ case nodeType.HEXAGON:
865
+ return "hexagon";
866
+ case nodeType.DEFAULT:
867
+ return "defaultMindmapNode";
868
+ case nodeType.NO_BORDER:
869
+ default:
870
+ return "rect";
871
+ }
872
+ }, "getShapeFromType");
873
+ const processedNode = {
874
+ id: node.id.toString(),
875
+ domId: "node_" + node.id.toString(),
876
+ label: node.descr,
877
+ isGroup: false,
878
+ shape: getShapeFromType(node.type),
879
+ width: node.width,
880
+ height: node.height ?? 0,
881
+ padding: node.padding,
882
+ cssClasses: classes,
883
+ cssStyles: [],
884
+ look: "default",
885
+ icon: node.icon,
886
+ x: node.x,
887
+ y: node.y,
888
+ // Mindmap-specific properties
889
+ level: node.level,
890
+ nodeId: node.nodeId,
891
+ type: node.type,
892
+ section: node.section
893
+ };
894
+ processedNodes.push(processedNode);
895
+ if (node.children) {
896
+ for (const child of node.children) {
897
+ this.flattenNodes(child, processedNodes);
898
+ }
899
+ }
900
+ }
901
+ /**
902
+ * Generate edges from parent-child relationships in mindmap tree
903
+ * @param node - The mindmap node to process
904
+ * @param edges - Array to collect edges
905
+ */
906
+ generateEdges(node, edges) {
907
+ if (!node.children) {
908
+ return;
909
+ }
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: "default",
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 = index.getConfig2();
942
+ const userDefinedConfig = index.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
+ index.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
+ index.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 index.log;
998
+ }
999
+ }, index.__name(_a, "MindmapDB"), _a);
1000
+ var draw = /* @__PURE__ */ index.__name(async (text, id, _version, diagObj) => {
1001
+ index.log.debug("Rendering mindmap diagram\n" + text);
1002
+ const db = diagObj.db;
1003
+ const data4Layout = db.getData();
1004
+ const svg = chunk55IACEB6.getDiagramElement(id, data4Layout.config.securityLevel);
1005
+ data4Layout.type = diagObj.type;
1006
+ data4Layout.layoutAlgorithm = index.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
+ }
1027
+ });
1028
+ await index.render(data4Layout, svg);
1029
+ chunkQN33PNHL.setupViewPortForSVG(
1030
+ svg,
1031
+ data4Layout.config.mindmap?.padding ?? index.defaultConfig_default.mindmap.padding,
1032
+ "mindmapDiagram",
1033
+ data4Layout.config.mindmap?.useMaxWidth ?? index.defaultConfig_default.mindmap.useMaxWidth
1034
+ );
1035
+ }, "draw");
1036
+ var mindmapRenderer_default = {
1037
+ draw
1038
+ };
1039
+ var genSections = /* @__PURE__ */ index.__name((options) => {
1040
+ let sections = "";
1041
+ for (let i = 0; i < options.THEME_COLOR_LIMIT; i++) {
1042
+ options["lineColor" + i] = options["lineColor" + i] || options["cScaleInv" + i];
1043
+ if (index.isDark(options["lineColor" + i])) {
1044
+ options["lineColor" + i] = index.lighten(options["lineColor" + i], 20);
1045
+ } else {
1046
+ options["lineColor" + i] = index.darken(options["lineColor" + i], 20);
1047
+ }
1048
+ }
1049
+ for (let i = 0; i < options.THEME_COLOR_LIMIT; i++) {
1050
+ const sw = "" + (17 - 3 * i);
1051
+ sections += `
1052
+ .section-${i - 1} rect, .section-${i - 1} path, .section-${i - 1} circle, .section-${i - 1} polygon, .section-${i - 1} path {
1053
+ fill: ${options["cScale" + i]};
1054
+ }
1055
+ .section-${i - 1} text {
1056
+ fill: ${options["cScaleLabel" + i]};
1057
+ }
1058
+ .node-icon-${i - 1} {
1059
+ font-size: 40px;
1060
+ color: ${options["cScaleLabel" + i]};
1061
+ }
1062
+ .section-edge-${i - 1}{
1063
+ stroke: ${options["cScale" + i]};
1064
+ }
1065
+ .edge-depth-${i - 1}{
1066
+ stroke-width: ${sw};
1067
+ }
1068
+ .section-${i - 1} line {
1069
+ stroke: ${options["cScaleInv" + i]} ;
1070
+ stroke-width: 3;
1071
+ }
1072
+
1073
+ .disabled, .disabled circle, .disabled text {
1074
+ fill: lightgray;
1075
+ }
1076
+ .disabled text {
1077
+ fill: #efefef;
1078
+ }
1079
+ `;
1080
+ }
1081
+ return sections;
1082
+ }, "genSections");
1083
+ var getStyles = /* @__PURE__ */ index.__name((options) => `
1084
+ .edge {
1085
+ stroke-width: 3;
1086
+ }
1087
+ ${genSections(options)}
1088
+ .section-root rect, .section-root path, .section-root circle, .section-root polygon {
1089
+ fill: ${options.git0};
1090
+ }
1091
+ .section-root text {
1092
+ fill: ${options.gitBranchLabel0};
1093
+ }
1094
+ .section-root span {
1095
+ color: ${options.gitBranchLabel0};
1096
+ }
1097
+ .section-2 span {
1098
+ color: ${options.gitBranchLabel0};
1099
+ }
1100
+ .icon-container {
1101
+ height:100%;
1102
+ display: flex;
1103
+ justify-content: center;
1104
+ align-items: center;
1105
+ }
1106
+ .edge {
1107
+ fill: none;
1108
+ }
1109
+ .mindmap-node-label {
1110
+ dy: 1em;
1111
+ alignment-baseline: middle;
1112
+ text-anchor: middle;
1113
+ dominant-baseline: middle;
1114
+ text-align: center;
1115
+ }
1116
+ `, "getStyles");
1117
+ var styles_default = getStyles;
1118
+ var diagram = {
1119
+ get db() {
1120
+ return new MindmapDB();
1121
+ },
1122
+ renderer: mindmapRenderer_default,
1123
+ parser: mindmap_default,
1124
+ styles: styles_default
1125
+ };
1126
+ exports.diagram = diagram;