@marimo-team/islands 0.15.1 → 0.15.3

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 (189) hide show
  1. package/dist/{ConnectedDataExplorerComponent-DIy_POzQ.js → ConnectedDataExplorerComponent-DfvW3rBn.js} +323 -328
  2. package/dist/{ImageComparisonComponent-4ehfWTqN.js → ImageComparisonComponent-XaJshw7d.js} +13 -13
  3. package/dist/{_baseUniq-Duh9chhg.js → _baseUniq-dN9WKF9m.js} +67 -67
  4. package/dist/any-language-editor-CpFniVi-.js +27 -0
  5. package/dist/{arc-BXrety1g.js → arc-BOhn-m2C.js} +1 -1
  6. package/dist/{architectureDiagram-KFL7JDKH-3xVup6Z2.js → architectureDiagram-W76B3OCA-Bpg85ZKv.js} +144 -144
  7. package/dist/assets/{worker-COGufAQn.js → worker-Y-Q4G-N2.js} +30 -26
  8. package/dist/asterisk-DS281yxp.js +271 -0
  9. package/dist/{blockDiagram-ZYB65J3Q-eEZ6LTIH.js → blockDiagram-QIGZ2CNN-DS1kOHlW.js} +10 -10
  10. package/dist/{c4Diagram-AAMF2YG6-BqjOo55d.js → c4Diagram-FPNF74CW-CyRVKssw.js} +8 -8
  11. package/dist/{channel-BkhHQVue.js → channel-BilGXox7.js} +1 -1
  12. package/dist/{chunk-ANTBXLJU-BkLYh6ot.js → chunk-4BX2VUAB-CZR39zCO.js} +1 -1
  13. package/dist/{chunk-WVR4S24B-DpdvazVp.js → chunk-55IACEB6-BIH-MYov.js} +1 -1
  14. package/dist/{chunk-GLLZNHP4-BGaltx6Q.js → chunk-FMBD7UC4-4PZXFZE8.js} +1 -1
  15. package/dist/{chunk-JBRWN2VN-BZ3JgjiU.js → chunk-K7UQS3LO-CEvWKznk.js} +117 -117
  16. package/dist/{chunk-NRVI72HA-XO3jKXGr.js → chunk-QN33PNHL-D5LO5Jq_.js} +1 -1
  17. package/dist/{chunk-FHKO5MBM-BqvR49qe.js → chunk-QZHKN3VN-6gwUonWI.js} +1 -1
  18. package/dist/{chunk-LXBSTHXV-CJgOmuuc.js → chunk-TVAH2DTR-3gm06QdU.js} +7 -7
  19. package/dist/{chunk-OMD6QJNC-1rwXYaVn.js → chunk-TZMSLE5B-Cm8Iy9bO.js} +1 -1
  20. package/dist/{classDiagram-v2-QTMF73CY-_BeLc0pY.js → classDiagram-KNZD7YFC-DC529O_z.js} +2 -2
  21. package/dist/{classDiagram-3BZAVTQC-_BeLc0pY.js → classDiagram-v2-RKCZMP56-DC529O_z.js} +2 -2
  22. package/dist/{clone-DhXjmfNH.js → clone-CLoRX3j6.js} +1 -1
  23. package/dist/cose-bilkent-S5V4N54A-qf5DlS6Y.js +2609 -0
  24. package/dist/{cytoscape.esm-BYnVVhJX.js → cytoscape.esm-DfdJODL8.js} +34 -34
  25. package/dist/{dagre-2BBEFEWP-DoebA2zc.js → dagre-5GWH7T2D-Ceocls0m.js} +6 -6
  26. package/dist/{data-grid-overlay-editor-DYmc5v9I.js → data-grid-overlay-editor-AqDS_UKe.js} +11 -11
  27. package/dist/{diagram-4IRLE6MV-CxnJ439S.js → diagram-N5W7TBWH-CP66oSiv.js} +59 -60
  28. package/dist/{diagram-RP2FKANI-C-v51IXB.js → diagram-QEK2KX5R-_YD4kxxi.js} +15 -15
  29. package/dist/{diagram-GUPCWM2R-B7MLfHE7.js → diagram-S2PKOQOG-Cnj8T-OP.js} +10 -10
  30. package/dist/dockerfile-Cm8cRYCN.js +194 -0
  31. package/dist/ebnf-DUPDuY4r.js +78 -0
  32. package/dist/{erDiagram-HZWUO2LU-Cv1Slpwd.js → erDiagram-AWTI2OKA-CGnvoHx6.js} +8 -8
  33. package/dist/fcl-CPC2WYrI.js +103 -0
  34. package/dist/{flowDiagram-THRYKUMA-CnjAkcKg.js → flowDiagram-PVAE7QVJ-DG-pr9R9.js} +9 -9
  35. package/dist/{ganttDiagram-WV7ZQ7D5-CRQQ5cqP.js → ganttDiagram-OWAHRB6G-JmChtxvn.js} +34 -34
  36. package/dist/{gitGraphDiagram-OJR772UL-a7Wl_pP8.js → gitGraphDiagram-NY62KEGX-D8wLfOPd.js} +4 -4
  37. package/dist/{glide-data-editor-DrSTYUHP.js → glide-data-editor-9nC3iCIZ.js} +33 -33
  38. package/dist/{graph-Dq4lx1WI.js → graph-CoRe7vAN.js} +3 -3
  39. package/dist/http-D9LttvKF.js +44 -0
  40. package/dist/{index-B_t2cVfJ.js → index-6qYeHHjQ.js} +33090 -32892
  41. package/dist/{index-BhnWrXVh.js → index-BpzLh4Qe.js} +7711 -7711
  42. package/dist/{index-DSAnCCyV.js → index-BthgsgYX.js} +6 -6
  43. package/dist/{index-pBmAzQJl.js → index-MCx5v1x0.js} +2 -2
  44. package/dist/index-jkm77Jrz.js +98 -0
  45. package/dist/{infoDiagram-6WOFNB3A-B4pr_cke.js → infoDiagram-STP46IZ2-BlXxvOrR.js} +2 -2
  46. package/dist/{journeyDiagram-FFXJYRFH-CF8H9tcV.js → journeyDiagram-BIP6EPQ6-CNRYs_Fc.js} +24 -26
  47. package/dist/{kanban-definition-KOZQBZVT-BYfBCo4W.js → kanban-definition-6OIFK2YF-B9HeMAuP.js} +14 -14
  48. package/dist/{layout-D8_YOjKz.js → layout-m2vOUiW1.js} +81 -81
  49. package/dist/{linear-Be5SurQB.js → linear-DU6Q5CX3.js} +35 -35
  50. package/dist/{main-8IC_V2L6.js → main-BD2KGFpU.js} +74594 -68034
  51. package/dist/main.js +1 -1
  52. package/dist/{mermaid-B4v-qVXz.js → mermaid-HVCtvbyx.js} +6160 -7493
  53. package/dist/min-DcGMA4e_.js +80 -0
  54. package/dist/mindmap-definition-Q6HEUPPD-BW8UmIDQ.js +785 -0
  55. package/dist/nginx-zDPm3Z74.js +89 -0
  56. package/dist/{number-overlay-editor-XASk1ikZ.js → number-overlay-editor-D8Hl0Syo.js} +19 -19
  57. package/dist/{pieDiagram-DBDJKBY4-DhPX65dy.js → pieDiagram-ADFJNKIX-Bg-3zg5U.js} +17 -17
  58. package/dist/{quadrantDiagram-YPSRARAO-BjPa8bg5.js → quadrantDiagram-LMRXKWRM-BO4IG6Yz.js} +6 -6
  59. package/dist/{react-plotly-C_6SNkG9.js → react-plotly-dkvHVuRb.js} +3577 -3577
  60. package/dist/{requirementDiagram-EGVEC5DT-CtN_U9bI.js → requirementDiagram-4UW4RH46-5sdTguSM.js} +7 -7
  61. package/dist/{sankeyDiagram-HRAUVNP4-DVi73SZP.js → sankeyDiagram-GR3RE2ED-Buhlv9OI.js} +5 -5
  62. package/dist/sequenceDiagram-C3RYC4MD-C3qsM2UP.js +2519 -0
  63. package/dist/{slides-component-ML7vxRcD.js → slides-component-D209A0-s.js} +66 -66
  64. package/dist/solr-BNlsLglM.js +41 -0
  65. package/dist/spreadsheet-C-cy4P5N.js +49 -0
  66. package/dist/{stateDiagram-UUKSUZ4H-qZ62tNIz.js → stateDiagram-KXAO66HF-CopJ7G6P.js} +5 -5
  67. package/dist/{stateDiagram-v2-EYPG3UTE-BZEyTMgl.js → stateDiagram-v2-UMBNRL4Z-CejL8AKf.js} +2 -2
  68. package/dist/style.css +1 -1
  69. package/dist/tiddlywiki-5wqsXtSk.js +155 -0
  70. package/dist/tiki-__Kn3CeS.js +181 -0
  71. package/dist/{time-CZ2vTSO2.js → time-BwSBitlN.js} +58 -58
  72. package/dist/{timeline-definition-3HZDQTIS-DbWMwd1x.js → timeline-definition-XQNQX7LJ-DzMNTX-C.js} +10 -12
  73. package/dist/{timer-BYwnU4DF.js → timer-B0-z63CM.js} +16 -16
  74. package/dist/{treemap-75Q7IDZK-CocR-oAZ.js → treemap-75Q7IDZK-zeJG07dk.js} +14 -14
  75. package/dist/{vega-component-BrYek_kz.js → vega-component-CUkiTayd.js} +30 -30
  76. package/dist/{xychartDiagram-FDP5SA34-CYiUdiy5.js → xychartDiagram-6GGTOJPD-DiENNXMS.js} +7 -7
  77. package/package.json +39 -39
  78. package/src/__mocks__/notebook.ts +3 -0
  79. package/src/__mocks__/requests.ts +3 -0
  80. package/src/__tests__/__snapshots__/CellStatus.test.tsx.snap +12 -12
  81. package/src/__tests__/chat-utils.test.ts +26 -211
  82. package/src/components/ai/ai-model-dropdown.tsx +25 -9
  83. package/src/components/app-config/ai-config.tsx +7 -0
  84. package/src/components/chat/chat-components.tsx +71 -0
  85. package/src/components/chat/chat-panel.tsx +481 -291
  86. package/src/components/chat/chat-utils.ts +50 -0
  87. package/src/components/chat/markdown-renderer.tsx +3 -7
  88. package/src/components/chat/tool-call-accordion.tsx +5 -5
  89. package/src/components/datasources/__tests__/utils.test.ts +6 -0
  90. package/src/components/datasources/column-preview.tsx +1 -3
  91. package/src/components/editor/actions/useNotebookActions.tsx +1 -1
  92. package/src/components/editor/ai/add-cell-with-ai.tsx +20 -15
  93. package/src/components/editor/ai/ai-completion-editor.tsx +22 -3
  94. package/src/components/editor/ai/completion-handlers.tsx +2 -4
  95. package/src/components/editor/ai/completion-utils.ts +85 -11
  96. package/src/components/editor/alerts/startup-logs-alert.tsx +72 -0
  97. package/src/components/editor/chrome/panels/datasources-panel.tsx +3 -1
  98. package/src/components/editor/chrome/panels/dependency-graph-panel.tsx +3 -1
  99. package/src/components/editor/chrome/panels/documentation-panel.tsx +3 -1
  100. package/src/components/editor/chrome/panels/error-panel.tsx +3 -1
  101. package/src/components/editor/chrome/panels/file-explorer-panel.tsx +3 -1
  102. package/src/components/editor/chrome/panels/logs-panel.tsx +3 -1
  103. package/src/components/editor/chrome/panels/outline-panel.tsx +3 -1
  104. package/src/components/editor/chrome/panels/packages-panel.tsx +4 -2
  105. package/src/components/editor/chrome/panels/scratchpad-panel.tsx +3 -1
  106. package/src/components/editor/chrome/panels/secrets-panel.tsx +3 -1
  107. package/src/components/editor/chrome/panels/snippets-panel.tsx +3 -1
  108. package/src/components/editor/chrome/panels/tracing-panel.tsx +3 -1
  109. package/src/components/editor/chrome/panels/variable-panel.tsx +3 -1
  110. package/src/components/editor/chrome/wrapper/app-chrome.tsx +38 -28
  111. package/src/components/editor/controls/command-palette-button.tsx +1 -1
  112. package/src/components/editor/controls/command-palette.tsx +5 -4
  113. package/src/components/editor/controls/state.ts +4 -0
  114. package/src/components/editor/package-alert.tsx +108 -58
  115. package/src/components/editor/renderers/CellArray.tsx +2 -0
  116. package/src/components/editor/renderers/vertical-layout/vertical-layout.tsx +0 -1
  117. package/src/components/pages/edit-page.tsx +7 -3
  118. package/src/core/ai/chat-utils.ts +26 -43
  119. package/src/core/ai/config.ts +1 -1
  120. package/src/core/ai/context/__tests__/registry.test.ts +277 -3
  121. package/src/core/ai/context/context.ts +11 -1
  122. package/src/core/ai/context/providers/__tests__/cell-output.test.ts +378 -0
  123. package/src/core/ai/context/providers/__tests__/error.test.ts +3 -2
  124. package/src/core/ai/context/providers/__tests__/file.test.ts +119 -0
  125. package/src/core/ai/context/providers/cell-output.ts +349 -0
  126. package/src/core/ai/context/providers/common.ts +5 -1
  127. package/src/core/ai/context/providers/file.ts +287 -0
  128. package/src/core/ai/context/registry.ts +79 -0
  129. package/src/core/ai/state.ts +22 -5
  130. package/src/core/alerts/state.ts +71 -3
  131. package/src/core/cells/cell.ts +2 -2
  132. package/src/core/cells/cells.ts +1 -1
  133. package/src/core/cells/logs.ts +1 -1
  134. package/src/core/cells/runs.ts +6 -5
  135. package/src/core/codemirror/ai/resources.ts +47 -5
  136. package/src/core/codemirror/ai/state.ts +12 -0
  137. package/src/core/codemirror/language/__tests__/sql.test.ts +45 -0
  138. package/src/core/codemirror/markdown/__tests__/commands.test.ts +1 -0
  139. package/src/core/codemirror/theme/dark.ts +1 -1
  140. package/src/core/config/capabilities.ts +1 -1
  141. package/src/core/datasets/__tests__/data-source.test.ts +24 -0
  142. package/src/core/errors/__tests__/errors.test.ts +2 -0
  143. package/src/core/islands/bridge.ts +1 -0
  144. package/src/core/islands/main.ts +1 -0
  145. package/src/core/kernel/messages.ts +12 -6
  146. package/src/core/layout/layout.ts +3 -3
  147. package/src/core/network/requests-network.ts +8 -0
  148. package/src/core/network/requests-static.ts +1 -0
  149. package/src/core/network/requests-toasting.ts +1 -0
  150. package/src/core/network/types.ts +4 -1
  151. package/src/core/wasm/bridge.ts +18 -2
  152. package/src/core/wasm/worker/bootstrap.ts +3 -1
  153. package/src/core/wasm/worker/getMarimoWheel.ts +3 -8
  154. package/src/core/wasm/worker/types.ts +3 -0
  155. package/src/core/websocket/useMarimoWebSocket.tsx +7 -1
  156. package/src/css/app/Cell.css +42 -21
  157. package/src/css/app/codemirror.css +5 -1
  158. package/src/css/globals.css +3 -0
  159. package/src/css/md.css +1 -1
  160. package/src/plugins/impl/MicrophonePlugin.tsx +2 -2
  161. package/src/plugins/impl/chat/ChatPlugin.tsx +2 -9
  162. package/src/plugins/impl/chat/chat-ui.tsx +129 -110
  163. package/src/plugins/impl/chat/types.ts +5 -8
  164. package/src/plugins/impl/code/__tests__/language.test.ts +15 -0
  165. package/src/plugins/impl/code/any-language-editor.tsx +11 -8
  166. package/src/plugins/layout/MimeRenderPlugin.tsx +3 -6
  167. package/src/stories/cell.stories.tsx +6 -0
  168. package/src/stories/layout/vertical/one-column.stories.tsx +215 -0
  169. package/src/theme/useTheme.ts +11 -6
  170. package/src/utils/__tests__/blob.test.ts +37 -0
  171. package/src/utils/arrays.ts +13 -0
  172. package/src/utils/fileToBase64.ts +21 -6
  173. package/src/utils/json/base64.ts +5 -2
  174. package/src/utils/numbers.ts +9 -7
  175. package/dist/any-language-editor-Cvakxnzg.js +0 -45
  176. package/dist/asn1-jKiBa2Ya.js +0 -95
  177. package/dist/clojure-CCKyeQKf.js +0 -800
  178. package/dist/css-BkF-NPzE.js +0 -1553
  179. package/dist/index-CfrpOVe5.js +0 -341
  180. package/dist/index-DIFrY2JV.js +0 -288
  181. package/dist/javascript-C2yteZeJ.js +0 -691
  182. package/dist/min-Q4QXsXWR.js +0 -80
  183. package/dist/mindmap-definition-LNHGMQRG-CebaDS3t.js +0 -3234
  184. package/dist/mllike-BSnXJBGA.js +0 -272
  185. package/dist/pug-CwAQJzGR.js +0 -248
  186. package/dist/python-BkR3uSy8.js +0 -313
  187. package/dist/rpm-IznJm2Xc.js +0 -57
  188. package/dist/sequenceDiagram-WFGC7UMF-C8jImRwI.js +0 -2284
  189. package/dist/ttcn-cfg-Bac_acMi.js +0 -88
@@ -0,0 +1,785 @@
1
+ var _a;
2
+ import { g as ce } from "./chunk-55IACEB6-BIH-MYov.js";
3
+ import { s as le } from "./chunk-QN33PNHL-D5LO5Jq_.js";
4
+ import { _ as c, l as O, p as he, r as de, H as M, c as H, i as P, an as ge, W as ue, X as pe, Y as fe } from "./mermaid-HVCtvbyx.js";
5
+ const m = [];
6
+ for (let e = 0; e < 256; ++e)
7
+ m.push((e + 256).toString(16).slice(1));
8
+ function ye(e, r = 0) {
9
+ return (m[e[r + 0]] + m[e[r + 1]] + m[e[r + 2]] + m[e[r + 3]] + "-" + m[e[r + 4]] + m[e[r + 5]] + "-" + m[e[r + 6]] + m[e[r + 7]] + "-" + m[e[r + 8]] + m[e[r + 9]] + "-" + m[e[r + 10]] + m[e[r + 11]] + m[e[r + 12]] + m[e[r + 13]] + m[e[r + 14]] + m[e[r + 15]]).toLowerCase();
10
+ }
11
+ let $;
12
+ const me = new Uint8Array(16);
13
+ function Ee() {
14
+ if (!$) {
15
+ if (typeof crypto > "u" || !crypto.getRandomValues)
16
+ throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
17
+ $ = crypto.getRandomValues.bind(crypto);
18
+ }
19
+ return $(me);
20
+ }
21
+ const _e = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), ie = { randomUUID: _e };
22
+ function be(e, r, i) {
23
+ var _a2;
24
+ if (ie.randomUUID && !e)
25
+ return ie.randomUUID();
26
+ e = e || {};
27
+ const l = e.random ?? ((_a2 = e.rng) == null ? void 0 : _a2.call(e)) ?? Ee();
28
+ if (l.length < 16)
29
+ throw new Error("Random bytes length must be >= 16");
30
+ return l[6] = l[6] & 15 | 64, l[8] = l[8] & 63 | 128, ye(l);
31
+ }
32
+ var W = (function() {
33
+ var e = /* @__PURE__ */ c(function(L, n, t, o) {
34
+ for (t = t || {}, o = L.length; o--; t[L[o]] = n) ;
35
+ return t;
36
+ }, "o"), r = [1, 4], i = [1, 13], l = [1, 12], u = [1, 15], d = [1, 16], p = [1, 20], S = [1, 19], f = [6, 7, 8], z = [1, 26], X = [1, 24], Y = [1, 25], _ = [6, 7, 11], q = [1, 6, 13, 15, 16, 19, 22], J = [1, 33], K = [1, 34], I = [1, 6, 7, 11, 13, 15, 16, 19, 22], V = {
37
+ trace: /* @__PURE__ */ c(function() {
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__ */ c(function(n, t, o, a, g, s, C) {
44
+ var h = s.length - 1;
45
+ switch (g) {
46
+ case 6:
47
+ case 7:
48
+ return a;
49
+ case 8:
50
+ a.getLogger().trace("Stop NL ");
51
+ break;
52
+ case 9:
53
+ a.getLogger().trace("Stop EOF ");
54
+ break;
55
+ case 11:
56
+ a.getLogger().trace("Stop NL2 ");
57
+ break;
58
+ case 12:
59
+ a.getLogger().trace("Stop EOF2 ");
60
+ break;
61
+ case 15:
62
+ a.getLogger().info("Node: ", s[h].id), a.addNode(s[h - 1].length, s[h].id, s[h].descr, s[h].type);
63
+ break;
64
+ case 16:
65
+ a.getLogger().trace("Icon: ", s[h]), a.decorateNode({ icon: s[h] });
66
+ break;
67
+ case 17:
68
+ case 21:
69
+ a.decorateNode({ class: s[h] });
70
+ break;
71
+ case 18:
72
+ a.getLogger().trace("SPACELIST");
73
+ break;
74
+ case 19:
75
+ a.getLogger().trace("Node: ", s[h].id), a.addNode(0, s[h].id, s[h].descr, s[h].type);
76
+ break;
77
+ case 20:
78
+ a.decorateNode({ icon: s[h] });
79
+ break;
80
+ case 25:
81
+ a.getLogger().trace("node found ..", s[h - 2]), this.$ = { id: s[h - 1], descr: s[h - 1], type: a.getType(s[h - 2], s[h]) };
82
+ break;
83
+ case 26:
84
+ this.$ = { id: s[h], descr: s[h], type: a.nodeType.DEFAULT };
85
+ break;
86
+ case 27:
87
+ a.getLogger().trace("node found ..", s[h - 3]), this.$ = { id: s[h - 3], descr: s[h - 1], type: a.getType(s[h - 2], s[h]) };
88
+ break;
89
+ }
90
+ }, "anonymous"),
91
+ table: [{ 3: 1, 4: 2, 5: 3, 6: [1, 5], 8: r }, { 1: [3] }, { 1: [2, 1] }, { 4: 6, 6: [1, 7], 7: [1, 8], 8: r }, { 6: i, 7: [1, 10], 9: 9, 12: 11, 13: l, 14: 14, 15: u, 16: d, 17: 17, 18: 18, 19: p, 22: S }, e(f, [2, 3]), { 1: [2, 2] }, e(f, [2, 4]), e(f, [2, 5]), { 1: [2, 6], 6: i, 12: 21, 13: l, 14: 14, 15: u, 16: d, 17: 17, 18: 18, 19: p, 22: S }, { 6: i, 9: 22, 12: 11, 13: l, 14: 14, 15: u, 16: d, 17: 17, 18: 18, 19: p, 22: S }, { 6: z, 7: X, 10: 23, 11: Y }, e(_, [2, 22], { 17: 17, 18: 18, 14: 27, 15: [1, 28], 16: [1, 29], 19: p, 22: S }), e(_, [2, 18]), e(_, [2, 19]), e(_, [2, 20]), e(_, [2, 21]), e(_, [2, 23]), e(_, [2, 24]), e(_, [2, 26], { 19: [1, 30] }), { 20: [1, 31] }, { 6: z, 7: X, 10: 32, 11: Y }, { 1: [2, 7], 6: i, 12: 21, 13: l, 14: 14, 15: u, 16: d, 17: 17, 18: 18, 19: p, 22: S }, e(q, [2, 14], { 7: J, 11: K }), e(I, [2, 8]), e(I, [2, 9]), e(I, [2, 10]), e(_, [2, 15]), e(_, [2, 16]), e(_, [2, 17]), { 20: [1, 35] }, { 21: [1, 36] }, e(q, [2, 13], { 7: J, 11: K }), e(I, [2, 11]), e(I, [2, 12]), { 21: [1, 37] }, e(_, [2, 25]), e(_, [2, 27])],
92
+ defaultActions: { 2: [2, 1], 6: [2, 2] },
93
+ parseError: /* @__PURE__ */ c(function(n, t) {
94
+ if (t.recoverable)
95
+ this.trace(n);
96
+ else {
97
+ var o = new Error(n);
98
+ throw o.hash = t, o;
99
+ }
100
+ }, "parseError"),
101
+ parse: /* @__PURE__ */ c(function(n) {
102
+ var t = this, o = [0], a = [], g = [null], s = [], C = this.table, h = "", w = 0, Q = 0, se = 2, Z = 1, re = s.slice.call(arguments, 1), y = Object.create(this.lexer), x = { yy: {} };
103
+ for (var B in this.yy)
104
+ Object.prototype.hasOwnProperty.call(this.yy, B) && (x.yy[B] = this.yy[B]);
105
+ y.setInput(n, x.yy), x.yy.lexer = y, x.yy.parser = this, typeof y.yylloc > "u" && (y.yylloc = {});
106
+ var F = y.yylloc;
107
+ s.push(F);
108
+ var oe = y.options && y.options.ranges;
109
+ typeof x.yy.parseError == "function" ? this.parseError = x.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
110
+ function ae(b) {
111
+ o.length = o.length - 2 * b, g.length = g.length - b, s.length = s.length - b;
112
+ }
113
+ c(ae, "popStack");
114
+ function ee() {
115
+ var b;
116
+ return b = a.pop() || y.lex() || Z, typeof b != "number" && (b instanceof Array && (a = b, b = a.pop()), b = t.symbols_[b] || b), b;
117
+ }
118
+ c(ee, "lex");
119
+ for (var E, v, D, j, T = {}, A, N, te, U; ; ) {
120
+ if (v = o[o.length - 1], this.defaultActions[v] ? D = this.defaultActions[v] : ((E === null || typeof E > "u") && (E = ee()), D = C[v] && C[v][E]), typeof D > "u" || !D.length || !D[0]) {
121
+ var G = "";
122
+ U = [];
123
+ for (A in C[v])
124
+ this.terminals_[A] && A > se && U.push("'" + this.terminals_[A] + "'");
125
+ y.showPosition ? G = "Parse error on line " + (w + 1) + `:
126
+ ` + y.showPosition() + `
127
+ Expecting ` + U.join(", ") + ", got '" + (this.terminals_[E] || E) + "'" : G = "Parse error on line " + (w + 1) + ": Unexpected " + (E == Z ? "end of input" : "'" + (this.terminals_[E] || E) + "'"), this.parseError(G, {
128
+ text: y.match,
129
+ token: this.terminals_[E] || E,
130
+ line: y.yylineno,
131
+ loc: F,
132
+ expected: U
133
+ });
134
+ }
135
+ if (D[0] instanceof Array && D.length > 1)
136
+ throw new Error("Parse Error: multiple actions possible at state: " + v + ", token: " + E);
137
+ switch (D[0]) {
138
+ case 1:
139
+ o.push(E), g.push(y.yytext), s.push(y.yylloc), o.push(D[1]), E = null, Q = y.yyleng, h = y.yytext, w = y.yylineno, F = y.yylloc;
140
+ break;
141
+ case 2:
142
+ if (N = this.productions_[D[1]][1], T.$ = g[g.length - N], T._$ = {
143
+ first_line: s[s.length - (N || 1)].first_line,
144
+ last_line: s[s.length - 1].last_line,
145
+ first_column: s[s.length - (N || 1)].first_column,
146
+ last_column: s[s.length - 1].last_column
147
+ }, oe && (T._$.range = [
148
+ s[s.length - (N || 1)].range[0],
149
+ s[s.length - 1].range[1]
150
+ ]), j = this.performAction.apply(T, [
151
+ h,
152
+ Q,
153
+ w,
154
+ x.yy,
155
+ D[1],
156
+ g,
157
+ s
158
+ ].concat(re)), typeof j < "u")
159
+ return j;
160
+ N && (o = o.slice(0, -1 * N * 2), g = g.slice(0, -1 * N), s = s.slice(0, -1 * N)), o.push(this.productions_[D[1]][0]), g.push(T.$), s.push(T._$), te = C[o[o.length - 2]][o[o.length - 1]], o.push(te);
161
+ break;
162
+ case 3:
163
+ return true;
164
+ }
165
+ }
166
+ return true;
167
+ }, "parse")
168
+ }, ne = /* @__PURE__ */ (function() {
169
+ var L = {
170
+ EOF: 1,
171
+ parseError: /* @__PURE__ */ c(function(t, o) {
172
+ if (this.yy.parser)
173
+ this.yy.parser.parseError(t, o);
174
+ else
175
+ throw new Error(t);
176
+ }, "parseError"),
177
+ // resets the lexer, sets new input
178
+ setInput: /* @__PURE__ */ c(function(n, t) {
179
+ return this.yy = t || this.yy || {}, this._input = n, this._more = this._backtrack = this.done = false, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
180
+ first_line: 1,
181
+ first_column: 0,
182
+ last_line: 1,
183
+ last_column: 0
184
+ }, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
185
+ }, "setInput"),
186
+ // consumes and returns one char from the input
187
+ input: /* @__PURE__ */ c(function() {
188
+ var n = this._input[0];
189
+ this.yytext += n, this.yyleng++, this.offset++, this.match += n, this.matched += n;
190
+ var t = n.match(/(?:\r\n?|\n).*/g);
191
+ return t ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), n;
192
+ }, "input"),
193
+ // unshifts one char (or a string) into the input
194
+ unput: /* @__PURE__ */ c(function(n) {
195
+ var t = n.length, o = n.split(/(?:\r\n?|\n)/g);
196
+ this._input = n + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - t), this.offset -= t;
197
+ var a = this.match.split(/(?:\r\n?|\n)/g);
198
+ this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), o.length - 1 && (this.yylineno -= o.length - 1);
199
+ var g = this.yylloc.range;
200
+ return this.yylloc = {
201
+ first_line: this.yylloc.first_line,
202
+ last_line: this.yylineno + 1,
203
+ first_column: this.yylloc.first_column,
204
+ last_column: o ? (o.length === a.length ? this.yylloc.first_column : 0) + a[a.length - o.length].length - o[0].length : this.yylloc.first_column - t
205
+ }, this.options.ranges && (this.yylloc.range = [g[0], g[0] + this.yyleng - t]), this.yyleng = this.yytext.length, this;
206
+ }, "unput"),
207
+ // When called from action, caches matched text and appends it on next action
208
+ more: /* @__PURE__ */ c(function() {
209
+ return this._more = true, this;
210
+ }, "more"),
211
+ // 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.
212
+ reject: /* @__PURE__ */ c(function() {
213
+ if (this.options.backtrack_lexer)
214
+ this._backtrack = true;
215
+ else
216
+ 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).
217
+ ` + this.showPosition(), {
218
+ text: "",
219
+ token: null,
220
+ line: this.yylineno
221
+ });
222
+ return this;
223
+ }, "reject"),
224
+ // retain first n characters of the match
225
+ less: /* @__PURE__ */ c(function(n) {
226
+ this.unput(this.match.slice(n));
227
+ }, "less"),
228
+ // displays already matched input, i.e. for error messages
229
+ pastInput: /* @__PURE__ */ c(function() {
230
+ var n = this.matched.substr(0, this.matched.length - this.match.length);
231
+ return (n.length > 20 ? "..." : "") + n.substr(-20).replace(/\n/g, "");
232
+ }, "pastInput"),
233
+ // displays upcoming input, i.e. for error messages
234
+ upcomingInput: /* @__PURE__ */ c(function() {
235
+ var n = this.match;
236
+ return n.length < 20 && (n += this._input.substr(0, 20 - n.length)), (n.substr(0, 20) + (n.length > 20 ? "..." : "")).replace(/\n/g, "");
237
+ }, "upcomingInput"),
238
+ // displays the character position where the lexing error occurred, i.e. for error messages
239
+ showPosition: /* @__PURE__ */ c(function() {
240
+ var n = this.pastInput(), t = new Array(n.length + 1).join("-");
241
+ return n + this.upcomingInput() + `
242
+ ` + t + "^";
243
+ }, "showPosition"),
244
+ // test the lexed token: return FALSE when not a match, otherwise return token
245
+ test_match: /* @__PURE__ */ c(function(n, t) {
246
+ var o, a, g;
247
+ if (this.options.backtrack_lexer && (g = {
248
+ yylineno: this.yylineno,
249
+ yylloc: {
250
+ first_line: this.yylloc.first_line,
251
+ last_line: this.last_line,
252
+ first_column: this.yylloc.first_column,
253
+ last_column: this.yylloc.last_column
254
+ },
255
+ yytext: this.yytext,
256
+ match: this.match,
257
+ matches: this.matches,
258
+ matched: this.matched,
259
+ yyleng: this.yyleng,
260
+ offset: this.offset,
261
+ _more: this._more,
262
+ _input: this._input,
263
+ yy: this.yy,
264
+ conditionStack: this.conditionStack.slice(0),
265
+ done: this.done
266
+ }, this.options.ranges && (g.yylloc.range = this.yylloc.range.slice(0))), a = n[0].match(/(?:\r\n?|\n).*/g), a && (this.yylineno += a.length), this.yylloc = {
267
+ first_line: this.yylloc.last_line,
268
+ last_line: this.yylineno + 1,
269
+ first_column: this.yylloc.last_column,
270
+ last_column: a ? a[a.length - 1].length - a[a.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + n[0].length
271
+ }, this.yytext += n[0], this.match += n[0], this.matches = n, this.yyleng = this.yytext.length, this.options.ranges && (this.yylloc.range = [this.offset, this.offset += this.yyleng]), this._more = false, this._backtrack = false, this._input = this._input.slice(n[0].length), this.matched += n[0], o = this.performAction.call(this, this.yy, this, t, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = false), o)
272
+ return o;
273
+ if (this._backtrack) {
274
+ for (var s in g)
275
+ this[s] = g[s];
276
+ return false;
277
+ }
278
+ return false;
279
+ }, "test_match"),
280
+ // return next match in input
281
+ next: /* @__PURE__ */ c(function() {
282
+ if (this.done)
283
+ return this.EOF;
284
+ this._input || (this.done = true);
285
+ var n, t, o, a;
286
+ this._more || (this.yytext = "", this.match = "");
287
+ for (var g = this._currentRules(), s = 0; s < g.length; s++)
288
+ if (o = this._input.match(this.rules[g[s]]), o && (!t || o[0].length > t[0].length)) {
289
+ if (t = o, a = s, this.options.backtrack_lexer) {
290
+ if (n = this.test_match(o, g[s]), n !== false)
291
+ return n;
292
+ if (this._backtrack) {
293
+ t = false;
294
+ continue;
295
+ } else
296
+ return false;
297
+ } else if (!this.options.flex)
298
+ break;
299
+ }
300
+ return t ? (n = this.test_match(t, g[a]), n !== false ? n : false) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
301
+ ` + this.showPosition(), {
302
+ text: "",
303
+ token: null,
304
+ line: this.yylineno
305
+ });
306
+ }, "next"),
307
+ // return next match that has a token
308
+ lex: /* @__PURE__ */ c(function() {
309
+ var t = this.next();
310
+ return t || this.lex();
311
+ }, "lex"),
312
+ // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
313
+ begin: /* @__PURE__ */ c(function(t) {
314
+ this.conditionStack.push(t);
315
+ }, "begin"),
316
+ // pop the previously active lexer condition state off the condition stack
317
+ popState: /* @__PURE__ */ c(function() {
318
+ var t = this.conditionStack.length - 1;
319
+ return t > 0 ? this.conditionStack.pop() : this.conditionStack[0];
320
+ }, "popState"),
321
+ // produce the lexer rule set which is active for the currently active lexer condition state
322
+ _currentRules: /* @__PURE__ */ c(function() {
323
+ return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
324
+ }, "_currentRules"),
325
+ // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
326
+ topState: /* @__PURE__ */ c(function(t) {
327
+ return t = this.conditionStack.length - 1 - Math.abs(t || 0), t >= 0 ? this.conditionStack[t] : "INITIAL";
328
+ }, "topState"),
329
+ // alias for begin(condition)
330
+ pushState: /* @__PURE__ */ c(function(t) {
331
+ this.begin(t);
332
+ }, "pushState"),
333
+ // return the number of states currently on the stack
334
+ stateStackSize: /* @__PURE__ */ c(function() {
335
+ return this.conditionStack.length;
336
+ }, "stateStackSize"),
337
+ options: { "case-insensitive": true },
338
+ performAction: /* @__PURE__ */ c(function(t, o, a, g) {
339
+ switch (a) {
340
+ case 0:
341
+ return t.getLogger().trace("Found comment", o.yytext), 6;
342
+ case 1:
343
+ return 8;
344
+ case 2:
345
+ this.begin("CLASS");
346
+ break;
347
+ case 3:
348
+ return this.popState(), 16;
349
+ case 4:
350
+ this.popState();
351
+ break;
352
+ case 5:
353
+ t.getLogger().trace("Begin icon"), this.begin("ICON");
354
+ break;
355
+ case 6:
356
+ return t.getLogger().trace("SPACELINE"), 6;
357
+ case 7:
358
+ return 7;
359
+ case 8:
360
+ return 15;
361
+ case 9:
362
+ t.getLogger().trace("end icon"), this.popState();
363
+ break;
364
+ case 10:
365
+ return t.getLogger().trace("Exploding node"), this.begin("NODE"), 19;
366
+ case 11:
367
+ return t.getLogger().trace("Cloud"), this.begin("NODE"), 19;
368
+ case 12:
369
+ return t.getLogger().trace("Explosion Bang"), this.begin("NODE"), 19;
370
+ case 13:
371
+ return t.getLogger().trace("Cloud Bang"), this.begin("NODE"), 19;
372
+ case 14:
373
+ return this.begin("NODE"), 19;
374
+ case 15:
375
+ return this.begin("NODE"), 19;
376
+ case 16:
377
+ return this.begin("NODE"), 19;
378
+ case 17:
379
+ return this.begin("NODE"), 19;
380
+ case 18:
381
+ return 13;
382
+ case 19:
383
+ return 22;
384
+ case 20:
385
+ return 11;
386
+ case 21:
387
+ this.begin("NSTR2");
388
+ break;
389
+ case 22:
390
+ return "NODE_DESCR";
391
+ case 23:
392
+ this.popState();
393
+ break;
394
+ case 24:
395
+ t.getLogger().trace("Starting NSTR"), this.begin("NSTR");
396
+ break;
397
+ case 25:
398
+ return t.getLogger().trace("description:", o.yytext), "NODE_DESCR";
399
+ case 26:
400
+ this.popState();
401
+ break;
402
+ case 27:
403
+ return this.popState(), t.getLogger().trace("node end ))"), "NODE_DEND";
404
+ case 28:
405
+ return this.popState(), t.getLogger().trace("node end )"), "NODE_DEND";
406
+ case 29:
407
+ return this.popState(), t.getLogger().trace("node end ...", o.yytext), "NODE_DEND";
408
+ case 30:
409
+ return this.popState(), t.getLogger().trace("node end (("), "NODE_DEND";
410
+ case 31:
411
+ return this.popState(), t.getLogger().trace("node end (-"), "NODE_DEND";
412
+ case 32:
413
+ return this.popState(), t.getLogger().trace("node end (-"), "NODE_DEND";
414
+ case 33:
415
+ return this.popState(), t.getLogger().trace("node end (("), "NODE_DEND";
416
+ case 34:
417
+ return this.popState(), t.getLogger().trace("node end (("), "NODE_DEND";
418
+ case 35:
419
+ return t.getLogger().trace("Long description:", o.yytext), 20;
420
+ case 36:
421
+ return t.getLogger().trace("Long description:", o.yytext), 20;
422
+ }
423
+ }, "anonymous"),
424
+ 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],
425
+ 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 } }
426
+ };
427
+ return L;
428
+ })();
429
+ V.lexer = ne;
430
+ function R() {
431
+ this.yy = {};
432
+ }
433
+ return c(R, "Parser"), R.prototype = V, V.Parser = R, new R();
434
+ })();
435
+ W.parser = W;
436
+ var Se = W, k = {
437
+ DEFAULT: 0,
438
+ NO_BORDER: 0,
439
+ ROUNDED_RECT: 1,
440
+ RECT: 2,
441
+ CIRCLE: 3,
442
+ CLOUD: 4,
443
+ BANG: 5,
444
+ HEXAGON: 6
445
+ }, De = (_a = class {
446
+ constructor() {
447
+ this.nodes = [], this.count = 0, this.elements = {}, this.getLogger = this.getLogger.bind(this), this.nodeType = k, this.clear(), this.getType = this.getType.bind(this), this.getElementById = this.getElementById.bind(this), this.getParent = this.getParent.bind(this), this.getMindmap = this.getMindmap.bind(this), this.addNode = this.addNode.bind(this), this.decorateNode = this.decorateNode.bind(this);
448
+ }
449
+ clear() {
450
+ this.nodes = [], this.count = 0, this.elements = {};
451
+ }
452
+ getParent(e) {
453
+ for (let r = this.nodes.length - 1; r >= 0; r--)
454
+ if (this.nodes[r].level < e)
455
+ return this.nodes[r];
456
+ return null;
457
+ }
458
+ getMindmap() {
459
+ return this.nodes.length > 0 ? this.nodes[0] : null;
460
+ }
461
+ addNode(e, r, i, l) {
462
+ var _a2, _b;
463
+ O.info("addNode", e, r, i, l);
464
+ const u = H();
465
+ let d = ((_a2 = u.mindmap) == null ? void 0 : _a2.padding) ?? M.mindmap.padding;
466
+ switch (l) {
467
+ case this.nodeType.ROUNDED_RECT:
468
+ case this.nodeType.RECT:
469
+ case this.nodeType.HEXAGON:
470
+ d *= 2;
471
+ break;
472
+ }
473
+ const p = {
474
+ id: this.count++,
475
+ nodeId: P(r, u),
476
+ level: e,
477
+ descr: P(i, u),
478
+ type: l,
479
+ children: [],
480
+ width: ((_b = u.mindmap) == null ? void 0 : _b.maxNodeWidth) ?? M.mindmap.maxNodeWidth,
481
+ padding: d
482
+ }, S = this.getParent(e);
483
+ if (S)
484
+ S.children.push(p), this.nodes.push(p);
485
+ else if (this.nodes.length === 0)
486
+ this.nodes.push(p);
487
+ else
488
+ throw new Error(
489
+ `There can be only one root. No parent could be found for ("${p.descr}")`
490
+ );
491
+ }
492
+ getType(e, r) {
493
+ switch (O.debug("In get type", e, r), e) {
494
+ case "[":
495
+ return this.nodeType.RECT;
496
+ case "(":
497
+ return r === ")" ? this.nodeType.ROUNDED_RECT : this.nodeType.CLOUD;
498
+ case "((":
499
+ return this.nodeType.CIRCLE;
500
+ case ")":
501
+ return this.nodeType.CLOUD;
502
+ case "))":
503
+ return this.nodeType.BANG;
504
+ case "{{":
505
+ return this.nodeType.HEXAGON;
506
+ default:
507
+ return this.nodeType.DEFAULT;
508
+ }
509
+ }
510
+ setElementForId(e, r) {
511
+ this.elements[e] = r;
512
+ }
513
+ getElementById(e) {
514
+ return this.elements[e];
515
+ }
516
+ decorateNode(e) {
517
+ if (!e)
518
+ return;
519
+ const r = H(), i = this.nodes[this.nodes.length - 1];
520
+ e.icon && (i.icon = P(e.icon, r)), e.class && (i.class = P(e.class, r));
521
+ }
522
+ type2Str(e) {
523
+ switch (e) {
524
+ case this.nodeType.DEFAULT:
525
+ return "no-border";
526
+ case this.nodeType.RECT:
527
+ return "rect";
528
+ case this.nodeType.ROUNDED_RECT:
529
+ return "rounded-rect";
530
+ case this.nodeType.CIRCLE:
531
+ return "circle";
532
+ case this.nodeType.CLOUD:
533
+ return "cloud";
534
+ case this.nodeType.BANG:
535
+ return "bang";
536
+ case this.nodeType.HEXAGON:
537
+ return "hexgon";
538
+ // cspell: disable-line
539
+ default:
540
+ return "no-border";
541
+ }
542
+ }
543
+ /**
544
+ * Assign section numbers to nodes based on their position relative to root
545
+ * @param node - The mindmap node to process
546
+ * @param sectionNumber - The section number to assign (undefined for root)
547
+ */
548
+ assignSections(e, r) {
549
+ if (e.level === 0 ? e.section = void 0 : e.section = r, e.children)
550
+ for (const [i, l] of e.children.entries()) {
551
+ const u = e.level === 0 ? i : r;
552
+ this.assignSections(l, u);
553
+ }
554
+ }
555
+ /**
556
+ * Convert mindmap tree structure to flat array of nodes
557
+ * @param node - The mindmap node to process
558
+ * @param processedNodes - Array to collect processed nodes
559
+ */
560
+ flattenNodes(e, r) {
561
+ const i = ["mindmap-node"];
562
+ e.level === 0 ? i.push("section-root", "section--1") : e.section !== void 0 && i.push(`section-${e.section}`), e.class && i.push(e.class);
563
+ const l = i.join(" "), u = /* @__PURE__ */ c((p) => {
564
+ switch (p) {
565
+ case k.CIRCLE:
566
+ return "mindmapCircle";
567
+ case k.RECT:
568
+ return "rect";
569
+ case k.ROUNDED_RECT:
570
+ return "rounded";
571
+ case k.CLOUD:
572
+ return "cloud";
573
+ case k.BANG:
574
+ return "bang";
575
+ case k.HEXAGON:
576
+ return "hexagon";
577
+ case k.DEFAULT:
578
+ return "defaultMindmapNode";
579
+ case k.NO_BORDER:
580
+ default:
581
+ return "rect";
582
+ }
583
+ }, "getShapeFromType"), d = {
584
+ id: e.id.toString(),
585
+ domId: "node_" + e.id.toString(),
586
+ label: e.descr,
587
+ isGroup: false,
588
+ shape: u(e.type),
589
+ width: e.width,
590
+ height: e.height ?? 0,
591
+ padding: e.padding,
592
+ cssClasses: l,
593
+ cssStyles: [],
594
+ look: "default",
595
+ icon: e.icon,
596
+ x: e.x,
597
+ y: e.y,
598
+ // Mindmap-specific properties
599
+ level: e.level,
600
+ nodeId: e.nodeId,
601
+ type: e.type,
602
+ section: e.section
603
+ };
604
+ if (r.push(d), e.children)
605
+ for (const p of e.children)
606
+ this.flattenNodes(p, r);
607
+ }
608
+ /**
609
+ * Generate edges from parent-child relationships in mindmap tree
610
+ * @param node - The mindmap node to process
611
+ * @param edges - Array to collect edges
612
+ */
613
+ generateEdges(e, r) {
614
+ if (e.children)
615
+ for (const i of e.children) {
616
+ let l = "edge";
617
+ i.section !== void 0 && (l += ` section-edge-${i.section}`);
618
+ const u = e.level + 1;
619
+ l += ` edge-depth-${u}`;
620
+ const d = {
621
+ id: `edge_${e.id}_${i.id}`,
622
+ start: e.id.toString(),
623
+ end: i.id.toString(),
624
+ type: "normal",
625
+ curve: "basis",
626
+ thickness: "normal",
627
+ look: "default",
628
+ classes: l,
629
+ // Store mindmap-specific data
630
+ depth: e.level,
631
+ section: i.section
632
+ };
633
+ r.push(d), this.generateEdges(i, r);
634
+ }
635
+ }
636
+ /**
637
+ * Get structured data for layout algorithms
638
+ * Following the pattern established by ER diagrams
639
+ * @returns Structured data containing nodes, edges, and config
640
+ */
641
+ getData() {
642
+ const e = this.getMindmap(), r = H(), l = ge().layout !== void 0, u = r;
643
+ if (l || (u.layout = "cose-bilkent"), !e)
644
+ return {
645
+ nodes: [],
646
+ edges: [],
647
+ config: u
648
+ };
649
+ O.debug("getData: mindmapRoot", e, r), this.assignSections(e);
650
+ const d = [], p = [];
651
+ this.flattenNodes(e, d), this.generateEdges(e, p), O.debug(
652
+ `getData: processed ${d.length} nodes and ${p.length} edges`
653
+ );
654
+ const S = /* @__PURE__ */ new Map();
655
+ for (const f of d)
656
+ S.set(f.id, {
657
+ shape: f.shape,
658
+ width: f.width,
659
+ height: f.height,
660
+ padding: f.padding
661
+ });
662
+ return {
663
+ nodes: d,
664
+ edges: p,
665
+ config: u,
666
+ // Store the root node for mindmap-specific layout algorithms
667
+ rootNode: e,
668
+ // Properties required by dagre layout algorithm
669
+ markers: ["point"],
670
+ // Mindmaps don't use markers
671
+ direction: "TB",
672
+ // Top-to-bottom direction for mindmaps
673
+ nodeSpacing: 50,
674
+ // Default spacing between nodes
675
+ rankSpacing: 50,
676
+ // Default spacing between ranks
677
+ // Add shapes for ELK compatibility
678
+ shapes: Object.fromEntries(S),
679
+ // Additional properties that layout algorithms might expect
680
+ type: "mindmap",
681
+ diagramId: "mindmap-" + be()
682
+ };
683
+ }
684
+ // Expose logger to grammar
685
+ getLogger() {
686
+ return O;
687
+ }
688
+ }, c(_a, "MindmapDB"), _a), Ne = /* @__PURE__ */ c(async (e, r, i, l) => {
689
+ var _a2, _b;
690
+ O.debug(`Rendering mindmap diagram
691
+ ` + e);
692
+ const u = l.db, d = u.getData(), p = ce(r, d.config.securityLevel);
693
+ d.type = l.type, d.layoutAlgorithm = he(d.config.layout, {
694
+ fallback: "cose-bilkent"
695
+ }), d.diagramId = r, u.getMindmap() && (d.nodes.forEach((f) => {
696
+ f.shape === "rounded" ? (f.radius = 15, f.taper = 15, f.stroke = "none", f.width = 0, f.padding = 15) : f.shape === "circle" ? f.padding = 10 : f.shape === "rect" && (f.width = 0, f.padding = 10);
697
+ }), await de(d, p), le(
698
+ p,
699
+ ((_a2 = d.config.mindmap) == null ? void 0 : _a2.padding) ?? M.mindmap.padding,
700
+ "mindmapDiagram",
701
+ ((_b = d.config.mindmap) == null ? void 0 : _b.useMaxWidth) ?? M.mindmap.useMaxWidth
702
+ ));
703
+ }, "draw"), ke = {
704
+ draw: Ne
705
+ }, Le = /* @__PURE__ */ c((e) => {
706
+ let r = "";
707
+ for (let i = 0; i < e.THEME_COLOR_LIMIT; i++)
708
+ e["lineColor" + i] = e["lineColor" + i] || e["cScaleInv" + i], ue(e["lineColor" + i]) ? e["lineColor" + i] = pe(e["lineColor" + i], 20) : e["lineColor" + i] = fe(e["lineColor" + i], 20);
709
+ for (let i = 0; i < e.THEME_COLOR_LIMIT; i++) {
710
+ const l = "" + (17 - 3 * i);
711
+ r += `
712
+ .section-${i - 1} rect, .section-${i - 1} path, .section-${i - 1} circle, .section-${i - 1} polygon, .section-${i - 1} path {
713
+ fill: ${e["cScale" + i]};
714
+ }
715
+ .section-${i - 1} text {
716
+ fill: ${e["cScaleLabel" + i]};
717
+ }
718
+ .node-icon-${i - 1} {
719
+ font-size: 40px;
720
+ color: ${e["cScaleLabel" + i]};
721
+ }
722
+ .section-edge-${i - 1}{
723
+ stroke: ${e["cScale" + i]};
724
+ }
725
+ .edge-depth-${i - 1}{
726
+ stroke-width: ${l};
727
+ }
728
+ .section-${i - 1} line {
729
+ stroke: ${e["cScaleInv" + i]} ;
730
+ stroke-width: 3;
731
+ }
732
+
733
+ .disabled, .disabled circle, .disabled text {
734
+ fill: lightgray;
735
+ }
736
+ .disabled text {
737
+ fill: #efefef;
738
+ }
739
+ `;
740
+ }
741
+ return r;
742
+ }, "genSections"), xe = /* @__PURE__ */ c((e) => `
743
+ .edge {
744
+ stroke-width: 3;
745
+ }
746
+ ${Le(e)}
747
+ .section-root rect, .section-root path, .section-root circle, .section-root polygon {
748
+ fill: ${e.git0};
749
+ }
750
+ .section-root text {
751
+ fill: ${e.gitBranchLabel0};
752
+ }
753
+ .section-root span {
754
+ color: ${e.gitBranchLabel0};
755
+ }
756
+ .section-2 span {
757
+ color: ${e.gitBranchLabel0};
758
+ }
759
+ .icon-container {
760
+ height:100%;
761
+ display: flex;
762
+ justify-content: center;
763
+ align-items: center;
764
+ }
765
+ .edge {
766
+ fill: none;
767
+ }
768
+ .mindmap-node-label {
769
+ dy: 1em;
770
+ alignment-baseline: middle;
771
+ text-anchor: middle;
772
+ dominant-baseline: middle;
773
+ text-align: center;
774
+ }
775
+ `, "getStyles"), ve = xe, Ce = {
776
+ get db() {
777
+ return new De();
778
+ },
779
+ renderer: ke,
780
+ parser: Se,
781
+ styles: ve
782
+ };
783
+ export {
784
+ Ce as diagram
785
+ };