hexagon-editor 0.1.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (308) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +105 -0
  3. package/THIRD_PARTY_NOTICES.md +29 -0
  4. package/dist/MarkdownEditor.vue.d.ts +926 -0
  5. package/dist/MarkdownEditor.vue.d.ts.map +1 -0
  6. package/dist/MarkdownEditorLinkForm-mq-BVYM_.js +338 -0
  7. package/dist/MarkdownEditorLinkForm.css +1 -0
  8. package/dist/abnfDiagram-N423BO3Z-DCf6sPky.js +87 -0
  9. package/dist/arc-y6UeoJpJ.js +83 -0
  10. package/dist/architectureDiagram-T3A2C74G-Cc3_3-cI.js +4778 -0
  11. package/dist/base-Bnv2-Te4.js +13338 -0
  12. package/dist/base.css +1 -0
  13. package/dist/blockDiagram-VBNYF7ZC-DWVLZwXY.js +2419 -0
  14. package/dist/c4Diagram-5PPSVZJV-CaIN7qay.js +1577 -0
  15. package/dist/channel-BwXGcavV.js +5 -0
  16. package/dist/chunk-2GRJ4B5K-O75udjPr.js +68 -0
  17. package/dist/chunk-2Q5K7J3B-CySL0lOA.js +15 -0
  18. package/dist/chunk-5RXB4S5H-BKPnLCOJ.js +1408 -0
  19. package/dist/chunk-5VM5RSS4--it1VJIv.js +19 -0
  20. package/dist/chunk-6Q2QTUOP-DNiML-50.js +664 -0
  21. package/dist/chunk-GF5L2VYU-z7A-k0-V.js +1533 -0
  22. package/dist/chunk-JWPE2WC7-DAjx3Kjr.js +8 -0
  23. package/dist/chunk-KBJHAD2P-D4R1VW0r.js +19 -0
  24. package/dist/chunk-RYQCIY6F-DmJAYxq8.js +313 -0
  25. package/dist/chunk-XXDRQBXY-CK913N-t.js +8 -0
  26. package/dist/classDiagram-JCYQIIEL-Djipq_HJ.js +16 -0
  27. package/dist/classDiagram-v2-OCEON4UE-Djipq_HJ.js +16 -0
  28. package/dist/classname.d.ts +13 -0
  29. package/dist/classname.d.ts.map +1 -0
  30. package/dist/classname.js +17 -0
  31. package/dist/components/MarkdownEditorFloatingMenus.vue.d.ts +48 -0
  32. package/dist/components/MarkdownEditorFloatingMenus.vue.d.ts.map +1 -0
  33. package/dist/components/MarkdownEditorImageActions.vue.d.ts +20 -0
  34. package/dist/components/MarkdownEditorImageActions.vue.d.ts.map +1 -0
  35. package/dist/components/MarkdownEditorToolbar.vue.d.ts +62 -0
  36. package/dist/components/MarkdownEditorToolbar.vue.d.ts.map +1 -0
  37. package/dist/components/MarkdownEditorToolbarIcon.vue.d.ts +26 -0
  38. package/dist/components/MarkdownEditorToolbarIcon.vue.d.ts.map +1 -0
  39. package/dist/composables/useFloatingPanel.d.ts +13 -0
  40. package/dist/composables/useFloatingPanel.d.ts.map +1 -0
  41. package/dist/composables/useMarkdownEditorValue.d.ts +19 -0
  42. package/dist/composables/useMarkdownEditorValue.d.ts.map +1 -0
  43. package/dist/configure.d.ts +15 -0
  44. package/dist/configure.d.ts.map +1 -0
  45. package/dist/configure.js +19 -0
  46. package/dist/core/actions.d.ts +16 -0
  47. package/dist/core/actions.d.ts.map +1 -0
  48. package/dist/core/basic-editor-atomic-source.d.ts +9 -0
  49. package/dist/core/basic-editor-atomic-source.d.ts.map +1 -0
  50. package/dist/core/basic-editor-command-helpers.d.ts +11 -0
  51. package/dist/core/basic-editor-command-helpers.d.ts.map +1 -0
  52. package/dist/core/basic-editor-markdown.d.ts +7 -0
  53. package/dist/core/basic-editor-markdown.d.ts.map +1 -0
  54. package/dist/core/basic-editor-renderers.d.ts +6 -0
  55. package/dist/core/basic-editor-renderers.d.ts.map +1 -0
  56. package/dist/core/basic-editor-runtime-plugins.d.ts +7 -0
  57. package/dist/core/basic-editor-runtime-plugins.d.ts.map +1 -0
  58. package/dist/core/basic-editor-selection.d.ts +6 -0
  59. package/dist/core/basic-editor-selection.d.ts.map +1 -0
  60. package/dist/core/basic-editor-table-controls.d.ts +3 -0
  61. package/dist/core/basic-editor-table-controls.d.ts.map +1 -0
  62. package/dist/core/basic-editor-table-popover.d.ts +5 -0
  63. package/dist/core/basic-editor-table-popover.d.ts.map +1 -0
  64. package/dist/core/basic-editor-types.d.ts +96 -0
  65. package/dist/core/basic-editor-types.d.ts.map +1 -0
  66. package/dist/core/basic-editor.d.ts +14 -0
  67. package/dist/core/basic-editor.d.ts.map +1 -0
  68. package/dist/core/content-handler.d.ts +21 -0
  69. package/dist/core/content-handler.d.ts.map +1 -0
  70. package/dist/core/editor-instance.d.ts +38 -0
  71. package/dist/core/editor-instance.d.ts.map +1 -0
  72. package/dist/core/events.d.ts +22 -0
  73. package/dist/core/events.d.ts.map +1 -0
  74. package/dist/core/extension-builder.d.ts +86 -0
  75. package/dist/core/extension-builder.d.ts.map +1 -0
  76. package/dist/core/extensions-manager.d.ts +36 -0
  77. package/dist/core/extensions-manager.d.ts.map +1 -0
  78. package/dist/core/index.d.ts +30 -0
  79. package/dist/core/index.d.ts.map +1 -0
  80. package/dist/core/lists.d.ts +18 -0
  81. package/dist/core/lists.d.ts.map +1 -0
  82. package/dist/core/logger.d.ts +46 -0
  83. package/dist/core/logger.d.ts.map +1 -0
  84. package/dist/core/markdown-parser.d.ts +60 -0
  85. package/dist/core/markdown-parser.d.ts.map +1 -0
  86. package/dist/core/markdown.d.ts +23 -0
  87. package/dist/core/markdown.d.ts.map +1 -0
  88. package/dist/core/markup-editor.d.ts +22 -0
  89. package/dist/core/markup-editor.d.ts.map +1 -0
  90. package/dist/core/optional-renderers.d.ts +9 -0
  91. package/dist/core/optional-renderers.d.ts.map +1 -0
  92. package/dist/core/registries.d.ts +50 -0
  93. package/dist/core/registries.d.ts.map +1 -0
  94. package/dist/core/schema-dynamic-modifier.d.ts +13 -0
  95. package/dist/core/schema-dynamic-modifier.d.ts.map +1 -0
  96. package/dist/core/vue-renderer.d.ts +40 -0
  97. package/dist/core/vue-renderer.d.ts.map +1 -0
  98. package/dist/core.js +46 -0
  99. package/dist/cose-bilkent-JH36ORCC-CXuKFbXy.js +2608 -0
  100. package/dist/cynefin-VYW2F7L2-Bkk-F_Js.js +23766 -0
  101. package/dist/cynefinDiagram-MW4NZA55-DwOK40hm.js +299 -0
  102. package/dist/cytoscape.esm-3W4EOjxC.js +18756 -0
  103. package/dist/dagre-VZM6K2ZE-0VsGm8Ag.js +340 -0
  104. package/dist/defaultLocale-BgPVtth8.js +171 -0
  105. package/dist/diagram-7IWD3JNH-BrApu1hz.js +350 -0
  106. package/dist/diagram-B4RE2ZJO-CVXoBg2r.js +461 -0
  107. package/dist/diagram-LBJQPF4R-Dp0eSz2L.js +142 -0
  108. package/dist/diagram-Q27KOJAE-DWIltqIH.js +528 -0
  109. package/dist/diagram-UB23O5K3-B7z2Lj3K.js +219 -0
  110. package/dist/directives.d.ts +10 -0
  111. package/dist/directives.d.ts.map +1 -0
  112. package/dist/ebnfDiagram-BXEA7PRR-CYgE6z_2.js +109 -0
  113. package/dist/erDiagram-JOGREHBK-D3QWrPo-.js +910 -0
  114. package/dist/extensions/additional/folding-heading.d.ts +11 -0
  115. package/dist/extensions/additional/folding-heading.d.ts.map +1 -0
  116. package/dist/extensions/additional/math.d.ts +36 -0
  117. package/dist/extensions/additional/math.d.ts.map +1 -0
  118. package/dist/extensions/additional/mermaid.d.ts +21 -0
  119. package/dist/extensions/additional/mermaid.d.ts.map +1 -0
  120. package/dist/extensions/additional/quote-link.d.ts +19 -0
  121. package/dist/extensions/additional/quote-link.d.ts.map +1 -0
  122. package/dist/extensions/additional/yfm-html-block.d.ts +21 -0
  123. package/dist/extensions/additional/yfm-html-block.d.ts.map +1 -0
  124. package/dist/extensions/base.d.ts +9 -0
  125. package/dist/extensions/base.d.ts.map +1 -0
  126. package/dist/extensions/behavior/clicks-on-edges.d.ts +12 -0
  127. package/dist/extensions/behavior/clicks-on-edges.d.ts.map +1 -0
  128. package/dist/extensions/behavior/clipboard.d.ts +6 -0
  129. package/dist/extensions/behavior/clipboard.d.ts.map +1 -0
  130. package/dist/extensions/behavior/cursor.d.ts +29 -0
  131. package/dist/extensions/behavior/cursor.d.ts.map +1 -0
  132. package/dist/extensions/behavior/editor-mode-keymap.d.ts +8 -0
  133. package/dist/extensions/behavior/editor-mode-keymap.d.ts.map +1 -0
  134. package/dist/extensions/behavior/history.d.ts +21 -0
  135. package/dist/extensions/behavior/history.d.ts.map +1 -0
  136. package/dist/extensions/behavior/placeholder.d.ts +11 -0
  137. package/dist/extensions/behavior/placeholder.d.ts.map +1 -0
  138. package/dist/extensions/behavior/resizable.d.ts +4 -0
  139. package/dist/extensions/behavior/resizable.d.ts.map +1 -0
  140. package/dist/extensions/behavior/selection-commands.d.ts +24 -0
  141. package/dist/extensions/behavior/selection-commands.d.ts.map +1 -0
  142. package/dist/extensions/behavior/selection-context.d.ts +9 -0
  143. package/dist/extensions/behavior/selection-context.d.ts.map +1 -0
  144. package/dist/extensions/behavior/selection.d.ts +12 -0
  145. package/dist/extensions/behavior/selection.d.ts.map +1 -0
  146. package/dist/extensions/index.d.ts +34 -0
  147. package/dist/extensions/index.d.ts.map +1 -0
  148. package/dist/extensions/markdown/blockquote-specs.d.ts +15 -0
  149. package/dist/extensions/markdown/blockquote-specs.d.ts.map +1 -0
  150. package/dist/extensions/markdown/blockquote.d.ts +14 -0
  151. package/dist/extensions/markdown/blockquote.d.ts.map +1 -0
  152. package/dist/extensions/markdown/bold-specs.d.ts +12 -0
  153. package/dist/extensions/markdown/bold-specs.d.ts.map +1 -0
  154. package/dist/extensions/markdown/bold.d.ts +17 -0
  155. package/dist/extensions/markdown/bold.d.ts.map +1 -0
  156. package/dist/extensions/markdown/breaks-specs.d.ts +22 -0
  157. package/dist/extensions/markdown/breaks-specs.d.ts.map +1 -0
  158. package/dist/extensions/markdown/breaks.d.ts +11 -0
  159. package/dist/extensions/markdown/breaks.d.ts.map +1 -0
  160. package/dist/extensions/markdown/code-block-specs.d.ts +14 -0
  161. package/dist/extensions/markdown/code-block-specs.d.ts.map +1 -0
  162. package/dist/extensions/markdown/code-block.d.ts +14 -0
  163. package/dist/extensions/markdown/code-block.d.ts.map +1 -0
  164. package/dist/extensions/markdown/code-specs.d.ts +9 -0
  165. package/dist/extensions/markdown/code-specs.d.ts.map +1 -0
  166. package/dist/extensions/markdown/code.d.ts +11 -0
  167. package/dist/extensions/markdown/code.d.ts.map +1 -0
  168. package/dist/extensions/markdown/deflist-specs.d.ts +16 -0
  169. package/dist/extensions/markdown/deflist-specs.d.ts.map +1 -0
  170. package/dist/extensions/markdown/deflist.d.ts +14 -0
  171. package/dist/extensions/markdown/deflist.d.ts.map +1 -0
  172. package/dist/extensions/markdown/heading-specs.d.ts +11 -0
  173. package/dist/extensions/markdown/heading-specs.d.ts.map +1 -0
  174. package/dist/extensions/markdown/heading.d.ts +17 -0
  175. package/dist/extensions/markdown/heading.d.ts.map +1 -0
  176. package/dist/extensions/markdown/horizontal-rule-specs.d.ts +10 -0
  177. package/dist/extensions/markdown/horizontal-rule-specs.d.ts.map +1 -0
  178. package/dist/extensions/markdown/horizontal-rule.d.ts +8 -0
  179. package/dist/extensions/markdown/horizontal-rule.d.ts.map +1 -0
  180. package/dist/extensions/markdown/html.d.ts +15 -0
  181. package/dist/extensions/markdown/html.d.ts.map +1 -0
  182. package/dist/extensions/markdown/image.d.ts +39 -0
  183. package/dist/extensions/markdown/image.d.ts.map +1 -0
  184. package/dist/extensions/markdown/italic-specs.d.ts +12 -0
  185. package/dist/extensions/markdown/italic-specs.d.ts.map +1 -0
  186. package/dist/extensions/markdown/italic.d.ts +11 -0
  187. package/dist/extensions/markdown/italic.d.ts.map +1 -0
  188. package/dist/extensions/markdown/link-specs.d.ts +19 -0
  189. package/dist/extensions/markdown/link-specs.d.ts.map +1 -0
  190. package/dist/extensions/markdown/link.d.ts +21 -0
  191. package/dist/extensions/markdown/link.d.ts.map +1 -0
  192. package/dist/extensions/markdown/list-specs.d.ts +6 -0
  193. package/dist/extensions/markdown/list-specs.d.ts.map +1 -0
  194. package/dist/extensions/markdown/lists.d.ts +18 -0
  195. package/dist/extensions/markdown/lists.d.ts.map +1 -0
  196. package/dist/extensions/markdown/mark.d.ts +12 -0
  197. package/dist/extensions/markdown/mark.d.ts.map +1 -0
  198. package/dist/extensions/markdown/strike.d.ts +12 -0
  199. package/dist/extensions/markdown/strike.d.ts.map +1 -0
  200. package/dist/extensions/markdown/subscript.d.ts +12 -0
  201. package/dist/extensions/markdown/subscript.d.ts.map +1 -0
  202. package/dist/extensions/markdown/table-actions.d.ts +14 -0
  203. package/dist/extensions/markdown/table-actions.d.ts.map +1 -0
  204. package/dist/extensions/markdown/table-specs.d.ts +25 -0
  205. package/dist/extensions/markdown/table-specs.d.ts.map +1 -0
  206. package/dist/extensions/markdown/table.d.ts +6 -0
  207. package/dist/extensions/markdown/table.d.ts.map +1 -0
  208. package/dist/extensions/markdown/underline.d.ts +12 -0
  209. package/dist/extensions/markdown/underline.d.ts.map +1 -0
  210. package/dist/extensions/specs.d.ts +13 -0
  211. package/dist/extensions/specs.d.ts.map +1 -0
  212. package/dist/extensions.js +247 -0
  213. package/dist/flowDiagram-UKHOOZJN-CfjPcHNW.js +1638 -0
  214. package/dist/forms/MarkdownEditorForm.vue.d.ts +37 -0
  215. package/dist/forms/MarkdownEditorForm.vue.d.ts.map +1 -0
  216. package/dist/forms/MarkdownEditorImageForm.vue.d.ts +131 -0
  217. package/dist/forms/MarkdownEditorImageForm.vue.d.ts.map +1 -0
  218. package/dist/forms/MarkdownEditorLinkForm.vue.d.ts +119 -0
  219. package/dist/forms/MarkdownEditorLinkForm.vue.d.ts.map +1 -0
  220. package/dist/forms/MarkdownEditorTextInput.vue.d.ts +39 -0
  221. package/dist/forms/MarkdownEditorTextInput.vue.d.ts.map +1 -0
  222. package/dist/forms/index.d.ts +7 -0
  223. package/dist/forms/index.d.ts.map +1 -0
  224. package/dist/forms.js +7 -0
  225. package/dist/full-C-o2lPBX.js +16 -0
  226. package/dist/full-specs-Cl-ODShc.js +10 -0
  227. package/dist/ganttDiagram-PKOTCBZU-ECmaWI-9.js +2711 -0
  228. package/dist/gitGraphDiagram-DS77QQ5N-DgG1RGJ8.js +815 -0
  229. package/dist/graph-DAHC4kPm.js +1545 -0
  230. package/dist/heading-specs-D7Bj4aIM.js +489 -0
  231. package/dist/i18n/index.d.ts +70 -0
  232. package/dist/i18n/index.d.ts.map +1 -0
  233. package/dist/i18n.js +132 -0
  234. package/dist/index-CqpK5VVw.js +149 -0
  235. package/dist/index-uerphigI.js +82 -0
  236. package/dist/index.css +1 -0
  237. package/dist/index.d.ts +87 -0
  238. package/dist/index.d.ts.map +1 -0
  239. package/dist/index.js +1293 -0
  240. package/dist/infoDiagram-6WML65LV-B1Yl3nZV.js +24 -0
  241. package/dist/init-DjUOC4st.js +16 -0
  242. package/dist/ishikawaDiagram-WSZJBQD7-4sngaB5o.js +621 -0
  243. package/dist/journeyDiagram-NVQOT4AX-B_6AmR_j.js +834 -0
  244. package/dist/kanban-definition-27J2QSJJ-B8BO9o8J.js +724 -0
  245. package/dist/katex-ByXcxnHy.js +14436 -0
  246. package/dist/katex-DoRnZ_sp.js +11682 -0
  247. package/dist/layout-DBbo_M5I.js +1519 -0
  248. package/dist/linear-BEdRfKba.js +259 -0
  249. package/dist/map-DRdzG8Ho.js +224 -0
  250. package/dist/mermaid.core-CR0bA2Wa.js +16496 -0
  251. package/dist/mindmap-definition-FAOFIHXS-DnPz807N.js +827 -0
  252. package/dist/optional-renderers-BalvqqvY.js +11 -0
  253. package/dist/ordinal-B6-f3MAq.js +61 -0
  254. package/dist/pegDiagram-VL7TDLO6-csGWlzs8.js +95 -0
  255. package/dist/pieDiagram-7S7Q4E2Y-Bqs8j5FX.js +207 -0
  256. package/dist/presets/commonmark-specs.d.ts +9 -0
  257. package/dist/presets/commonmark-specs.d.ts.map +1 -0
  258. package/dist/presets/commonmark.d.ts +26 -0
  259. package/dist/presets/commonmark.d.ts.map +1 -0
  260. package/dist/presets/default.d.ts +6 -0
  261. package/dist/presets/default.d.ts.map +1 -0
  262. package/dist/presets/full-specs.d.ts +6 -0
  263. package/dist/presets/full-specs.d.ts.map +1 -0
  264. package/dist/presets/full.d.ts +17 -0
  265. package/dist/presets/full.d.ts.map +1 -0
  266. package/dist/presets/index.d.ts +13 -0
  267. package/dist/presets/index.d.ts.map +1 -0
  268. package/dist/presets/zero.d.ts +8 -0
  269. package/dist/presets/zero.d.ts.map +1 -0
  270. package/dist/presets.js +10 -0
  271. package/dist/public-types.d.ts +96 -0
  272. package/dist/public-types.d.ts.map +1 -0
  273. package/dist/quadrantDiagram-CIZ2JOQS-jzP4lRrY.js +1023 -0
  274. package/dist/railroadDiagram-AXF67PYL-BSCyR24u.js +77 -0
  275. package/dist/renderer/MarkdownRenderer.vue.d.ts +10 -0
  276. package/dist/renderer/MarkdownRenderer.vue.d.ts.map +1 -0
  277. package/dist/renderer/index.d.ts +3 -0
  278. package/dist/renderer/index.d.ts.map +1 -0
  279. package/dist/renderer/markdown.d.ts +2 -0
  280. package/dist/renderer/markdown.d.ts.map +1 -0
  281. package/dist/renderer/mermaid-runtime.d.ts +4 -0
  282. package/dist/renderer/mermaid-runtime.d.ts.map +1 -0
  283. package/dist/renderer.js +258 -0
  284. package/dist/requirementDiagram-LRYGKXZP-DmEkLYqX.js +882 -0
  285. package/dist/sankeyDiagram-W5VNT64P-CYvRYMTh.js +847 -0
  286. package/dist/schema-dynamic-modifier-Dhf0m6tE.js +21514 -0
  287. package/dist/schema-dynamic-modifier.css +1 -0
  288. package/dist/sequenceDiagram-SI44F4Z6-CyWbDtPA.js +2888 -0
  289. package/dist/sizeCapture-X5ZJPWSS-xKhYCY84.js +46 -0
  290. package/dist/specs.js +127 -0
  291. package/dist/stateDiagram-OKZ733FA-DP44R2Dd.js +263 -0
  292. package/dist/stateDiagram-v2-UEYNNEHI-BvlOisND.js +16 -0
  293. package/dist/swimlanes-SLNWSIFB-BKFp8twH.js +5332 -0
  294. package/dist/swimlanesDiagram-ULZ7WXOC-CTvIFuHq.js +13 -0
  295. package/dist/timeline-definition-Z64GVDOM-B4137uIl.js +1055 -0
  296. package/dist/toolbar/config.d.ts +45 -0
  297. package/dist/toolbar/config.d.ts.map +1 -0
  298. package/dist/toolbar/index.d.ts +3 -0
  299. package/dist/toolbar/index.d.ts.map +1 -0
  300. package/dist/toolbar.js +100 -0
  301. package/dist/use-markdown-editor.d.ts +14 -0
  302. package/dist/use-markdown-editor.d.ts.map +1 -0
  303. package/dist/vennDiagram-T6HMQDX7-CPs8gXjx.js +1578 -0
  304. package/dist/version.d.ts +3 -0
  305. package/dist/version.d.ts.map +1 -0
  306. package/dist/wardleyDiagram-T6FBY63Y-BYp13hbI.js +675 -0
  307. package/dist/xychartDiagram-ELKLHX3M-DTT37K2u.js +1388 -0
  308. package/package.json +110 -0
@@ -0,0 +1,2419 @@
1
+ import { g as de } from "./chunk-5VM5RSS4--it1VJIv.js";
2
+ import { aA as pe, aB as Kt, aC as fe, aD as xe, aE as ye, aF as be, aG as we, aH as me, aI as Se, aJ as Le, aK as ke, aL as ve, aM as Ee, aN as _e, aO as Te, aP as De, aQ as Be, aR as Ne, aS as Ie, aT as Ce, aU as Oe, aV as Re, aW as Ae, aX as ze, aY as Me, _ as g, y as rt, d as D, e as Pe, l as k, p as Fe, r as We, c as R, aZ as Ye, P as He, Q as Ke, L as Ue, a_ as M, a$ as kt, b0 as Q, as as Xe, x as $, k as Ve, b1 as je, i as Ct, b2 as Ot, b3 as Ge } from "./mermaid.core-CR0bA2Wa.js";
3
+ import { G as Ze } from "./graph-DAHC4kPm.js";
4
+ import { c as qe } from "./channel-BwXGcavV.js";
5
+ function Je(e) {
6
+ return Array.isArray(e);
7
+ }
8
+ function Qe(e) {
9
+ if (pe(e)) return e;
10
+ const t = Kt(e);
11
+ if (!$e(e)) return {};
12
+ if (Je(e)) {
13
+ const s = Array.from(e);
14
+ return e.length > 0 && typeof e[0] == "string" && Object.hasOwn(e, "index") && (s.index = e.index, s.input = e.input), s;
15
+ }
16
+ if (fe(e)) {
17
+ const s = e, i = s.constructor;
18
+ return new i(s.buffer, s.byteOffset, s.length);
19
+ }
20
+ if (t === "[object ArrayBuffer]") return new ArrayBuffer(e.byteLength);
21
+ if (t === "[object DataView]") {
22
+ const s = e, i = s.buffer, c = s.byteOffset, r = s.byteLength, n = new ArrayBuffer(r), l = new Uint8Array(i, c, r);
23
+ return new Uint8Array(n).set(l), new DataView(n);
24
+ }
25
+ if (t === "[object Boolean]" || t === "[object Number]" || t === "[object String]") {
26
+ const s = e.constructor, i = new s(e.valueOf());
27
+ return t === "[object String]" ? er(i, e) : xt(i, e), i;
28
+ }
29
+ if (t === "[object Date]") return new Date(Number(e));
30
+ if (t === "[object RegExp]") {
31
+ const s = e, i = new RegExp(s.source, s.flags);
32
+ return i.lastIndex = s.lastIndex, i;
33
+ }
34
+ if (t === "[object Symbol]") return Object(Symbol.prototype.valueOf.call(e));
35
+ if (t === "[object Map]") {
36
+ const s = e, i = /* @__PURE__ */ new Map();
37
+ return s.forEach((c, r) => {
38
+ i.set(r, c);
39
+ }), i;
40
+ }
41
+ if (t === "[object Set]") {
42
+ const s = e, i = /* @__PURE__ */ new Set();
43
+ return s.forEach((c) => {
44
+ i.add(c);
45
+ }), i;
46
+ }
47
+ if (t === "[object Arguments]") {
48
+ const s = e, i = {};
49
+ return xt(i, s), i.length = s.length, i[Symbol.iterator] = s[Symbol.iterator], i;
50
+ }
51
+ const a = {};
52
+ return rr(a, e), xt(a, e), tr(a, e), a;
53
+ }
54
+ function $e(e) {
55
+ switch (Kt(e)) {
56
+ case Me:
57
+ case ze:
58
+ case Ae:
59
+ case Re:
60
+ case Oe:
61
+ case Ce:
62
+ case Ie:
63
+ case Ne:
64
+ case Be:
65
+ case De:
66
+ case Te:
67
+ case _e:
68
+ case Ee:
69
+ case ve:
70
+ case ke:
71
+ case Le:
72
+ case Se:
73
+ case me:
74
+ case we:
75
+ case be:
76
+ case ye:
77
+ case xe:
78
+ return !0;
79
+ default:
80
+ return !1;
81
+ }
82
+ }
83
+ function xt(e, t) {
84
+ for (const a in t) Object.hasOwn(t, a) && (e[a] = t[a]);
85
+ }
86
+ function tr(e, t) {
87
+ const a = Object.getOwnPropertySymbols(t);
88
+ for (let s = 0; s < a.length; s++) {
89
+ const i = a[s];
90
+ Object.prototype.propertyIsEnumerable.call(t, i) && (e[i] = t[i]);
91
+ }
92
+ }
93
+ function er(e, t) {
94
+ const a = t.valueOf().length;
95
+ for (const s in t) Object.hasOwn(t, s) && (Number.isNaN(Number(s)) || Number(s) >= a) && (e[s] = t[s]);
96
+ }
97
+ function rr(e, t) {
98
+ const a = Object.getPrototypeOf(t);
99
+ a !== null && typeof t.constructor == "function" && Object.setPrototypeOf(e, a);
100
+ }
101
+ var bt = (function() {
102
+ var e = /* @__PURE__ */ g(function(T, m, p, x) {
103
+ for (p = p || {}, x = T.length; x--; p[T[x]] = m) ;
104
+ return p;
105
+ }, "o"), t = [1, 15], a = [1, 7], s = [1, 13], i = [1, 14], c = [1, 19], r = [1, 16], n = [1, 17], l = [1, 18], u = [8, 30], h = [8, 10, 21, 28, 29, 30, 31, 39, 43, 46], d = [1, 23], b = [1, 24], w = [8, 10, 15, 16, 21, 28, 29, 30, 31, 39, 43, 46], y = [8, 10, 15, 16, 21, 27, 28, 29, 30, 31, 39, 43, 46], v = [1, 49], S = {
106
+ trace: /* @__PURE__ */ g(function() {
107
+ }, "trace"),
108
+ yy: {},
109
+ symbols_: { error: 2, spaceLines: 3, SPACELINE: 4, NL: 5, separator: 6, SPACE: 7, EOF: 8, start: 9, BLOCK_DIAGRAM_KEY: 10, document: 11, stop: 12, statement: 13, link: 14, LINK: 15, START_LINK: 16, LINK_LABEL: 17, STR: 18, nodeStatement: 19, columnsStatement: 20, SPACE_BLOCK: 21, blockStatement: 22, classDefStatement: 23, cssClassStatement: 24, styleStatement: 25, node: 26, SIZE: 27, COLUMNS: 28, "id-block": 29, end: 30, NODE_ID: 31, nodeShapeNLabel: 32, dirList: 33, DIR: 34, NODE_DSTART: 35, NODE_DEND: 36, BLOCK_ARROW_START: 37, BLOCK_ARROW_END: 38, classDef: 39, CLASSDEF_ID: 40, CLASSDEF_STYLEOPTS: 41, DEFAULT: 42, class: 43, CLASSENTITY_IDS: 44, STYLECLASS: 45, style: 46, STYLE_ENTITY_IDS: 47, STYLE_DEFINITION_DATA: 48, $accept: 0, $end: 1 },
110
+ terminals_: { 2: "error", 4: "SPACELINE", 5: "NL", 7: "SPACE", 8: "EOF", 10: "BLOCK_DIAGRAM_KEY", 15: "LINK", 16: "START_LINK", 17: "LINK_LABEL", 18: "STR", 21: "SPACE_BLOCK", 27: "SIZE", 28: "COLUMNS", 29: "id-block", 30: "end", 31: "NODE_ID", 34: "DIR", 35: "NODE_DSTART", 36: "NODE_DEND", 37: "BLOCK_ARROW_START", 38: "BLOCK_ARROW_END", 39: "classDef", 40: "CLASSDEF_ID", 41: "CLASSDEF_STYLEOPTS", 42: "DEFAULT", 43: "class", 44: "CLASSENTITY_IDS", 45: "STYLECLASS", 46: "style", 47: "STYLE_ENTITY_IDS", 48: "STYLE_DEFINITION_DATA" },
111
+ productions_: [0, [3, 1], [3, 2], [3, 2], [6, 1], [6, 1], [6, 1], [9, 3], [12, 1], [12, 1], [12, 2], [12, 2], [11, 1], [11, 2], [14, 1], [14, 4], [13, 1], [13, 1], [13, 1], [13, 1], [13, 1], [13, 1], [13, 1], [19, 3], [19, 2], [19, 1], [20, 1], [22, 4], [22, 3], [26, 1], [26, 2], [33, 1], [33, 2], [32, 3], [32, 4], [23, 3], [23, 3], [24, 3], [25, 3]],
112
+ performAction: /* @__PURE__ */ g(function(m, p, x, L, E, o, F) {
113
+ var f = o.length - 1;
114
+ switch (E) {
115
+ case 4:
116
+ L.getLogger().debug("Rule: separator (NL) ");
117
+ break;
118
+ case 5:
119
+ L.getLogger().debug("Rule: separator (Space) ");
120
+ break;
121
+ case 6:
122
+ L.getLogger().debug("Rule: separator (EOF) ");
123
+ break;
124
+ case 7:
125
+ L.getLogger().debug("Rule: hierarchy: ", o[f - 1]), L.setHierarchy(o[f - 1]);
126
+ break;
127
+ case 8:
128
+ L.getLogger().debug("Stop NL ");
129
+ break;
130
+ case 9:
131
+ L.getLogger().debug("Stop EOF ");
132
+ break;
133
+ case 10:
134
+ L.getLogger().debug("Stop NL2 ");
135
+ break;
136
+ case 11:
137
+ L.getLogger().debug("Stop EOF2 ");
138
+ break;
139
+ case 12:
140
+ L.getLogger().debug("Rule: statement: ", o[f]), typeof o[f].length == "number" ? this.$ = o[f] : this.$ = [o[f]];
141
+ break;
142
+ case 13:
143
+ L.getLogger().debug("Rule: statement #2: ", o[f - 1]), this.$ = [o[f - 1]].concat(o[f]);
144
+ break;
145
+ case 14:
146
+ L.getLogger().debug("Rule: link: ", o[f], m), this.$ = { edgeTypeStr: o[f], label: "" };
147
+ break;
148
+ case 15:
149
+ L.getLogger().debug("Rule: LABEL link: ", o[f - 3], o[f - 1], o[f]), this.$ = { edgeTypeStr: o[f], label: o[f - 1] };
150
+ break;
151
+ case 18:
152
+ const C = parseInt(o[f]), Z = L.generateId();
153
+ this.$ = { id: Z, type: "space", label: "", width: C, children: [] };
154
+ break;
155
+ case 23:
156
+ L.getLogger().debug("Rule: (nodeStatement link node) ", o[f - 2], o[f - 1], o[f], " typestr: ", o[f - 1].edgeTypeStr);
157
+ const V = L.edgeStrToEdgeData(o[f - 1].edgeTypeStr), at = L.edgeStrToEdgeStartData(o[f - 1].edgeTypeStr), gt = L.edgeStrToThickness(o[f - 1].edgeTypeStr), O = L.edgeStrToPattern(o[f - 1].edgeTypeStr);
158
+ this.$ = [
159
+ { id: o[f - 2].id, label: o[f - 2].label, type: o[f - 2].type, directions: o[f - 2].directions },
160
+ { id: o[f - 2].id + "-" + o[f].id, start: o[f - 2].id, end: o[f].id, label: o[f - 1].label, type: "edge", thickness: gt, pattern: O, directions: o[f].directions, arrowTypeEnd: V, arrowTypeStart: at },
161
+ { id: o[f].id, label: o[f].label, type: L.typeStr2Type(o[f].typeStr), directions: o[f].directions }
162
+ ];
163
+ break;
164
+ case 24:
165
+ L.getLogger().debug("Rule: nodeStatement (abc88 node size) ", o[f - 1], o[f]), this.$ = { id: o[f - 1].id, label: o[f - 1].label, type: L.typeStr2Type(o[f - 1].typeStr), directions: o[f - 1].directions, widthInColumns: parseInt(o[f], 10) };
166
+ break;
167
+ case 25:
168
+ L.getLogger().debug("Rule: nodeStatement (node) ", o[f]), this.$ = { id: o[f].id, label: o[f].label, type: L.typeStr2Type(o[f].typeStr), directions: o[f].directions, widthInColumns: 1 };
169
+ break;
170
+ case 26:
171
+ L.getLogger().debug("APA123", this ? this : "na"), L.getLogger().debug("COLUMNS: ", o[f]), this.$ = { type: "column-setting", columns: o[f] === "auto" ? -1 : parseInt(o[f]) };
172
+ break;
173
+ case 27:
174
+ L.getLogger().debug("Rule: id-block statement : ", o[f - 2], o[f - 1]), L.generateId(), this.$ = { ...o[f - 2], type: "composite", children: o[f - 1] };
175
+ break;
176
+ case 28:
177
+ L.getLogger().debug("Rule: blockStatement : ", o[f - 2], o[f - 1], o[f]);
178
+ const j = L.generateId();
179
+ this.$ = { id: j, type: "composite", label: "", children: o[f - 1] };
180
+ break;
181
+ case 29:
182
+ L.getLogger().debug("Rule: node (NODE_ID separator): ", o[f]), this.$ = { id: o[f] };
183
+ break;
184
+ case 30:
185
+ L.getLogger().debug("Rule: node (NODE_ID nodeShapeNLabel separator): ", o[f - 1], o[f]), this.$ = { id: o[f - 1], label: o[f].label, typeStr: o[f].typeStr, directions: o[f].directions };
186
+ break;
187
+ case 31:
188
+ L.getLogger().debug("Rule: dirList: ", o[f]), this.$ = [o[f]];
189
+ break;
190
+ case 32:
191
+ L.getLogger().debug("Rule: dirList: ", o[f - 1], o[f]), this.$ = [o[f - 1]].concat(o[f]);
192
+ break;
193
+ case 33:
194
+ L.getLogger().debug("Rule: nodeShapeNLabel: ", o[f - 2], o[f - 1], o[f]), this.$ = { typeStr: o[f - 2] + o[f], label: o[f - 1] };
195
+ break;
196
+ case 34:
197
+ L.getLogger().debug("Rule: BLOCK_ARROW nodeShapeNLabel: ", o[f - 3], o[f - 2], " #3:", o[f - 1], o[f]), this.$ = { typeStr: o[f - 3] + o[f], label: o[f - 2], directions: o[f - 1] };
198
+ break;
199
+ case 35:
200
+ case 36:
201
+ this.$ = { type: "classDef", id: o[f - 1].trim(), css: o[f].trim() };
202
+ break;
203
+ case 37:
204
+ this.$ = { type: "applyClass", id: o[f - 1].trim(), styleClass: o[f].trim() };
205
+ break;
206
+ case 38:
207
+ this.$ = { type: "applyStyles", id: o[f - 1].trim(), stylesStr: o[f].trim() };
208
+ break;
209
+ }
210
+ }, "anonymous"),
211
+ table: [{ 9: 1, 10: [1, 2] }, { 1: [3] }, { 10: t, 11: 3, 13: 4, 19: 5, 20: 6, 21: a, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 28: s, 29: i, 31: c, 39: r, 43: n, 46: l }, { 8: [1, 20] }, e(u, [2, 12], { 13: 4, 19: 5, 20: 6, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 11: 21, 10: t, 21: a, 28: s, 29: i, 31: c, 39: r, 43: n, 46: l }), e(h, [2, 16], { 14: 22, 15: d, 16: b }), e(h, [2, 17]), e(h, [2, 18]), e(h, [2, 19]), e(h, [2, 20]), e(h, [2, 21]), e(h, [2, 22]), e(w, [2, 25], { 27: [1, 25] }), e(h, [2, 26]), { 19: 26, 26: 12, 31: c }, { 10: t, 11: 27, 13: 4, 19: 5, 20: 6, 21: a, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 28: s, 29: i, 31: c, 39: r, 43: n, 46: l }, { 40: [1, 28], 42: [1, 29] }, { 44: [1, 30] }, { 47: [1, 31] }, e(y, [2, 29], { 32: 32, 35: [1, 33], 37: [1, 34] }), { 1: [2, 7] }, e(u, [2, 13]), { 26: 35, 31: c }, { 31: [2, 14] }, { 17: [1, 36] }, e(w, [2, 24]), { 10: t, 11: 37, 13: 4, 14: 22, 15: d, 16: b, 19: 5, 20: 6, 21: a, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 28: s, 29: i, 31: c, 39: r, 43: n, 46: l }, { 30: [1, 38] }, { 41: [1, 39] }, { 41: [1, 40] }, { 45: [1, 41] }, { 48: [1, 42] }, e(y, [2, 30]), { 18: [1, 43] }, { 18: [1, 44] }, e(w, [2, 23]), { 18: [1, 45] }, { 30: [1, 46] }, e(h, [2, 28]), e(h, [2, 35]), e(h, [2, 36]), e(h, [2, 37]), e(h, [2, 38]), { 36: [1, 47] }, { 33: 48, 34: v }, { 15: [1, 50] }, e(h, [2, 27]), e(y, [2, 33]), { 38: [1, 51] }, { 33: 52, 34: v, 38: [2, 31] }, { 31: [2, 15] }, e(y, [2, 34]), { 38: [2, 32] }],
212
+ defaultActions: { 20: [2, 7], 23: [2, 14], 50: [2, 15], 52: [2, 32] },
213
+ parseError: /* @__PURE__ */ g(function(m, p) {
214
+ if (p.recoverable)
215
+ this.trace(m);
216
+ else {
217
+ var x = new Error(m);
218
+ throw x.hash = p, x;
219
+ }
220
+ }, "parseError"),
221
+ parse: /* @__PURE__ */ g(function(m) {
222
+ var p = this, x = [0], L = [], E = [null], o = [], F = this.table, f = "", C = 0, Z = 0, V = 2, at = 1, gt = o.slice.call(arguments, 1), O = Object.create(this.lexer), j = { yy: {} };
223
+ for (var ut in this.yy)
224
+ Object.prototype.hasOwnProperty.call(this.yy, ut) && (j.yy[ut] = this.yy[ut]);
225
+ O.setInput(m, j.yy), j.yy.lexer = O, j.yy.parser = this, typeof O.yylloc > "u" && (O.yylloc = {});
226
+ var dt = O.yylloc;
227
+ o.push(dt);
228
+ var ge = O.options && O.options.ranges;
229
+ typeof j.yy.parseError == "function" ? this.parseError = j.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
230
+ function ue(W) {
231
+ x.length = x.length - 2 * W, E.length = E.length - W, o.length = o.length - W;
232
+ }
233
+ g(ue, "popStack");
234
+ function Nt() {
235
+ var W;
236
+ return W = L.pop() || O.lex() || at, typeof W != "number" && (W instanceof Array && (L = W, W = L.pop()), W = p.symbols_[W] || W), W;
237
+ }
238
+ g(Nt, "lex");
239
+ for (var P, q, H, pt, J = {}, st, G, It, it; ; ) {
240
+ if (q = x[x.length - 1], this.defaultActions[q] ? H = this.defaultActions[q] : ((P === null || typeof P > "u") && (P = Nt()), H = F[q] && F[q][P]), typeof H > "u" || !H.length || !H[0]) {
241
+ var ft = "";
242
+ it = [];
243
+ for (st in F[q])
244
+ this.terminals_[st] && st > V && it.push("'" + this.terminals_[st] + "'");
245
+ O.showPosition ? ft = "Parse error on line " + (C + 1) + `:
246
+ ` + O.showPosition() + `
247
+ Expecting ` + it.join(", ") + ", got '" + (this.terminals_[P] || P) + "'" : ft = "Parse error on line " + (C + 1) + ": Unexpected " + (P == at ? "end of input" : "'" + (this.terminals_[P] || P) + "'"), this.parseError(ft, {
248
+ text: O.match,
249
+ token: this.terminals_[P] || P,
250
+ line: O.yylineno,
251
+ loc: dt,
252
+ expected: it
253
+ });
254
+ }
255
+ if (H[0] instanceof Array && H.length > 1)
256
+ throw new Error("Parse Error: multiple actions possible at state: " + q + ", token: " + P);
257
+ switch (H[0]) {
258
+ case 1:
259
+ x.push(P), E.push(O.yytext), o.push(O.yylloc), x.push(H[1]), P = null, Z = O.yyleng, f = O.yytext, C = O.yylineno, dt = O.yylloc;
260
+ break;
261
+ case 2:
262
+ if (G = this.productions_[H[1]][1], J.$ = E[E.length - G], J._$ = {
263
+ first_line: o[o.length - (G || 1)].first_line,
264
+ last_line: o[o.length - 1].last_line,
265
+ first_column: o[o.length - (G || 1)].first_column,
266
+ last_column: o[o.length - 1].last_column
267
+ }, ge && (J._$.range = [
268
+ o[o.length - (G || 1)].range[0],
269
+ o[o.length - 1].range[1]
270
+ ]), pt = this.performAction.apply(J, [
271
+ f,
272
+ Z,
273
+ C,
274
+ j.yy,
275
+ H[1],
276
+ E,
277
+ o
278
+ ].concat(gt)), typeof pt < "u")
279
+ return pt;
280
+ G && (x = x.slice(0, -1 * G * 2), E = E.slice(0, -1 * G), o = o.slice(0, -1 * G)), x.push(this.productions_[H[1]][0]), E.push(J.$), o.push(J._$), It = F[x[x.length - 2]][x[x.length - 1]], x.push(It);
281
+ break;
282
+ case 3:
283
+ return !0;
284
+ }
285
+ }
286
+ return !0;
287
+ }, "parse")
288
+ }, N = /* @__PURE__ */ (function() {
289
+ var T = {
290
+ EOF: 1,
291
+ parseError: /* @__PURE__ */ g(function(p, x) {
292
+ if (this.yy.parser)
293
+ this.yy.parser.parseError(p, x);
294
+ else
295
+ throw new Error(p);
296
+ }, "parseError"),
297
+ // resets the lexer, sets new input
298
+ setInput: /* @__PURE__ */ g(function(m, p) {
299
+ return this.yy = p || this.yy || {}, this._input = m, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
300
+ first_line: 1,
301
+ first_column: 0,
302
+ last_line: 1,
303
+ last_column: 0
304
+ }, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
305
+ }, "setInput"),
306
+ // consumes and returns one char from the input
307
+ input: /* @__PURE__ */ g(function() {
308
+ var m = this._input[0];
309
+ this.yytext += m, this.yyleng++, this.offset++, this.match += m, this.matched += m;
310
+ var p = m.match(/(?:\r\n?|\n).*/g);
311
+ return p ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), m;
312
+ }, "input"),
313
+ // unshifts one char (or a string) into the input
314
+ unput: /* @__PURE__ */ g(function(m) {
315
+ var p = m.length, x = m.split(/(?:\r\n?|\n)/g);
316
+ this._input = m + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - p), this.offset -= p;
317
+ var L = this.match.split(/(?:\r\n?|\n)/g);
318
+ this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), x.length - 1 && (this.yylineno -= x.length - 1);
319
+ var E = this.yylloc.range;
320
+ return this.yylloc = {
321
+ first_line: this.yylloc.first_line,
322
+ last_line: this.yylineno + 1,
323
+ first_column: this.yylloc.first_column,
324
+ last_column: x ? (x.length === L.length ? this.yylloc.first_column : 0) + L[L.length - x.length].length - x[0].length : this.yylloc.first_column - p
325
+ }, this.options.ranges && (this.yylloc.range = [E[0], E[0] + this.yyleng - p]), this.yyleng = this.yytext.length, this;
326
+ }, "unput"),
327
+ // When called from action, caches matched text and appends it on next action
328
+ more: /* @__PURE__ */ g(function() {
329
+ return this._more = !0, this;
330
+ }, "more"),
331
+ // 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.
332
+ reject: /* @__PURE__ */ g(function() {
333
+ if (this.options.backtrack_lexer)
334
+ this._backtrack = !0;
335
+ else
336
+ 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).
337
+ ` + this.showPosition(), {
338
+ text: "",
339
+ token: null,
340
+ line: this.yylineno
341
+ });
342
+ return this;
343
+ }, "reject"),
344
+ // retain first n characters of the match
345
+ less: /* @__PURE__ */ g(function(m) {
346
+ this.unput(this.match.slice(m));
347
+ }, "less"),
348
+ // displays already matched input, i.e. for error messages
349
+ pastInput: /* @__PURE__ */ g(function() {
350
+ var m = this.matched.substr(0, this.matched.length - this.match.length);
351
+ return (m.length > 20 ? "..." : "") + m.substr(-20).replace(/\n/g, "");
352
+ }, "pastInput"),
353
+ // displays upcoming input, i.e. for error messages
354
+ upcomingInput: /* @__PURE__ */ g(function() {
355
+ var m = this.match;
356
+ return m.length < 20 && (m += this._input.substr(0, 20 - m.length)), (m.substr(0, 20) + (m.length > 20 ? "..." : "")).replace(/\n/g, "");
357
+ }, "upcomingInput"),
358
+ // displays the character position where the lexing error occurred, i.e. for error messages
359
+ showPosition: /* @__PURE__ */ g(function() {
360
+ var m = this.pastInput(), p = new Array(m.length + 1).join("-");
361
+ return m + this.upcomingInput() + `
362
+ ` + p + "^";
363
+ }, "showPosition"),
364
+ // test the lexed token: return FALSE when not a match, otherwise return token
365
+ test_match: /* @__PURE__ */ g(function(m, p) {
366
+ var x, L, E;
367
+ if (this.options.backtrack_lexer && (E = {
368
+ yylineno: this.yylineno,
369
+ yylloc: {
370
+ first_line: this.yylloc.first_line,
371
+ last_line: this.last_line,
372
+ first_column: this.yylloc.first_column,
373
+ last_column: this.yylloc.last_column
374
+ },
375
+ yytext: this.yytext,
376
+ match: this.match,
377
+ matches: this.matches,
378
+ matched: this.matched,
379
+ yyleng: this.yyleng,
380
+ offset: this.offset,
381
+ _more: this._more,
382
+ _input: this._input,
383
+ yy: this.yy,
384
+ conditionStack: this.conditionStack.slice(0),
385
+ done: this.done
386
+ }, this.options.ranges && (E.yylloc.range = this.yylloc.range.slice(0))), L = m[0].match(/(?:\r\n?|\n).*/g), L && (this.yylineno += L.length), this.yylloc = {
387
+ first_line: this.yylloc.last_line,
388
+ last_line: this.yylineno + 1,
389
+ first_column: this.yylloc.last_column,
390
+ last_column: L ? L[L.length - 1].length - L[L.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + m[0].length
391
+ }, this.yytext += m[0], this.match += m[0], this.matches = m, this.yyleng = this.yytext.length, this.options.ranges && (this.yylloc.range = [this.offset, this.offset += this.yyleng]), this._more = !1, this._backtrack = !1, this._input = this._input.slice(m[0].length), this.matched += m[0], x = this.performAction.call(this, this.yy, this, p, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), x)
392
+ return x;
393
+ if (this._backtrack) {
394
+ for (var o in E)
395
+ this[o] = E[o];
396
+ return !1;
397
+ }
398
+ return !1;
399
+ }, "test_match"),
400
+ // return next match in input
401
+ next: /* @__PURE__ */ g(function() {
402
+ if (this.done)
403
+ return this.EOF;
404
+ this._input || (this.done = !0);
405
+ var m, p, x, L;
406
+ this._more || (this.yytext = "", this.match = "");
407
+ for (var E = this._currentRules(), o = 0; o < E.length; o++)
408
+ if (x = this._input.match(this.rules[E[o]]), x && (!p || x[0].length > p[0].length)) {
409
+ if (p = x, L = o, this.options.backtrack_lexer) {
410
+ if (m = this.test_match(x, E[o]), m !== !1)
411
+ return m;
412
+ if (this._backtrack) {
413
+ p = !1;
414
+ continue;
415
+ } else
416
+ return !1;
417
+ } else if (!this.options.flex)
418
+ break;
419
+ }
420
+ return p ? (m = this.test_match(p, E[L]), m !== !1 ? m : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
421
+ ` + this.showPosition(), {
422
+ text: "",
423
+ token: null,
424
+ line: this.yylineno
425
+ });
426
+ }, "next"),
427
+ // return next match that has a token
428
+ lex: /* @__PURE__ */ g(function() {
429
+ var p = this.next();
430
+ return p || this.lex();
431
+ }, "lex"),
432
+ // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
433
+ begin: /* @__PURE__ */ g(function(p) {
434
+ this.conditionStack.push(p);
435
+ }, "begin"),
436
+ // pop the previously active lexer condition state off the condition stack
437
+ popState: /* @__PURE__ */ g(function() {
438
+ var p = this.conditionStack.length - 1;
439
+ return p > 0 ? this.conditionStack.pop() : this.conditionStack[0];
440
+ }, "popState"),
441
+ // produce the lexer rule set which is active for the currently active lexer condition state
442
+ _currentRules: /* @__PURE__ */ g(function() {
443
+ return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
444
+ }, "_currentRules"),
445
+ // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
446
+ topState: /* @__PURE__ */ g(function(p) {
447
+ return p = this.conditionStack.length - 1 - Math.abs(p || 0), p >= 0 ? this.conditionStack[p] : "INITIAL";
448
+ }, "topState"),
449
+ // alias for begin(condition)
450
+ pushState: /* @__PURE__ */ g(function(p) {
451
+ this.begin(p);
452
+ }, "pushState"),
453
+ // return the number of states currently on the stack
454
+ stateStackSize: /* @__PURE__ */ g(function() {
455
+ return this.conditionStack.length;
456
+ }, "stateStackSize"),
457
+ options: {},
458
+ performAction: /* @__PURE__ */ g(function(p, x, L, E) {
459
+ switch (L) {
460
+ case 0:
461
+ return p.getLogger().debug("Found block-beta"), 10;
462
+ case 1:
463
+ return p.getLogger().debug("Found id-block"), 29;
464
+ case 2:
465
+ return p.getLogger().debug("Found block"), 10;
466
+ case 3:
467
+ p.getLogger().debug(".", x.yytext);
468
+ break;
469
+ case 4:
470
+ p.getLogger().debug("_", x.yytext);
471
+ break;
472
+ case 5:
473
+ return 5;
474
+ case 6:
475
+ return x.yytext = -1, 28;
476
+ case 7:
477
+ return x.yytext = x.yytext.replace(/columns\s+/, ""), p.getLogger().debug("COLUMNS (LEX)", x.yytext), 28;
478
+ case 8:
479
+ this.pushState("md_string");
480
+ break;
481
+ case 9:
482
+ return "MD_STR";
483
+ case 10:
484
+ this.popState();
485
+ break;
486
+ case 11:
487
+ this.pushState("string");
488
+ break;
489
+ case 12:
490
+ p.getLogger().debug("LEX: POPPING STR:", x.yytext), this.popState();
491
+ break;
492
+ case 13:
493
+ return p.getLogger().debug("LEX: STR end:", x.yytext), "STR";
494
+ case 14:
495
+ return x.yytext = x.yytext.replace(/space\:/, ""), p.getLogger().debug("SPACE NUM (LEX)", x.yytext), 21;
496
+ case 15:
497
+ return x.yytext = "1", p.getLogger().debug("COLUMNS (LEX)", x.yytext), 21;
498
+ case 16:
499
+ return 42;
500
+ case 17:
501
+ return "LINKSTYLE";
502
+ case 18:
503
+ return "INTERPOLATE";
504
+ case 19:
505
+ return this.pushState("CLASSDEF"), 39;
506
+ case 20:
507
+ return this.popState(), this.pushState("CLASSDEFID"), "DEFAULT_CLASSDEF_ID";
508
+ case 21:
509
+ return this.popState(), this.pushState("CLASSDEFID"), 40;
510
+ case 22:
511
+ return this.popState(), 41;
512
+ case 23:
513
+ return this.pushState("CLASS"), 43;
514
+ case 24:
515
+ return this.popState(), this.pushState("CLASS_STYLE"), 44;
516
+ case 25:
517
+ return this.popState(), 45;
518
+ case 26:
519
+ return this.pushState("STYLE_STMNT"), 46;
520
+ case 27:
521
+ return this.popState(), this.pushState("STYLE_DEFINITION"), 47;
522
+ case 28:
523
+ return this.popState(), 48;
524
+ case 29:
525
+ return this.pushState("acc_title"), "acc_title";
526
+ case 30:
527
+ return this.popState(), "acc_title_value";
528
+ case 31:
529
+ return this.pushState("acc_descr"), "acc_descr";
530
+ case 32:
531
+ return this.popState(), "acc_descr_value";
532
+ case 33:
533
+ this.pushState("acc_descr_multiline");
534
+ break;
535
+ case 34:
536
+ this.popState();
537
+ break;
538
+ case 35:
539
+ return "acc_descr_multiline_value";
540
+ case 36:
541
+ return 30;
542
+ case 37:
543
+ return this.popState(), p.getLogger().debug("Lex: (("), "NODE_DEND";
544
+ case 38:
545
+ return this.popState(), p.getLogger().debug("Lex: (("), "NODE_DEND";
546
+ case 39:
547
+ return this.popState(), p.getLogger().debug("Lex: ))"), "NODE_DEND";
548
+ case 40:
549
+ return this.popState(), p.getLogger().debug("Lex: (("), "NODE_DEND";
550
+ case 41:
551
+ return this.popState(), p.getLogger().debug("Lex: (("), "NODE_DEND";
552
+ case 42:
553
+ return this.popState(), p.getLogger().debug("Lex: (-"), "NODE_DEND";
554
+ case 43:
555
+ return this.popState(), p.getLogger().debug("Lex: -)"), "NODE_DEND";
556
+ case 44:
557
+ return this.popState(), p.getLogger().debug("Lex: (("), "NODE_DEND";
558
+ case 45:
559
+ return this.popState(), p.getLogger().debug("Lex: ]]"), "NODE_DEND";
560
+ case 46:
561
+ return this.popState(), p.getLogger().debug("Lex: ("), "NODE_DEND";
562
+ case 47:
563
+ return this.popState(), p.getLogger().debug("Lex: ])"), "NODE_DEND";
564
+ case 48:
565
+ return this.popState(), p.getLogger().debug("Lex: /]"), "NODE_DEND";
566
+ case 49:
567
+ return this.popState(), p.getLogger().debug("Lex: /]"), "NODE_DEND";
568
+ case 50:
569
+ return this.popState(), p.getLogger().debug("Lex: )]"), "NODE_DEND";
570
+ case 51:
571
+ return this.popState(), p.getLogger().debug("Lex: )"), "NODE_DEND";
572
+ case 52:
573
+ return this.popState(), p.getLogger().debug("Lex: ]>"), "NODE_DEND";
574
+ case 53:
575
+ return this.popState(), p.getLogger().debug("Lex: ]"), "NODE_DEND";
576
+ case 54:
577
+ return p.getLogger().debug("Lexa: -)"), this.pushState("NODE"), 35;
578
+ case 55:
579
+ return p.getLogger().debug("Lexa: (-"), this.pushState("NODE"), 35;
580
+ case 56:
581
+ return p.getLogger().debug("Lexa: ))"), this.pushState("NODE"), 35;
582
+ case 57:
583
+ return p.getLogger().debug("Lexa: )"), this.pushState("NODE"), 35;
584
+ case 58:
585
+ return p.getLogger().debug("Lex: ((("), this.pushState("NODE"), 35;
586
+ case 59:
587
+ return p.getLogger().debug("Lexa: )"), this.pushState("NODE"), 35;
588
+ case 60:
589
+ return p.getLogger().debug("Lexa: )"), this.pushState("NODE"), 35;
590
+ case 61:
591
+ return p.getLogger().debug("Lexa: )"), this.pushState("NODE"), 35;
592
+ case 62:
593
+ return p.getLogger().debug("Lexc: >"), this.pushState("NODE"), 35;
594
+ case 63:
595
+ return p.getLogger().debug("Lexa: (["), this.pushState("NODE"), 35;
596
+ case 64:
597
+ return p.getLogger().debug("Lexa: )"), this.pushState("NODE"), 35;
598
+ case 65:
599
+ return this.pushState("NODE"), 35;
600
+ case 66:
601
+ return this.pushState("NODE"), 35;
602
+ case 67:
603
+ return this.pushState("NODE"), 35;
604
+ case 68:
605
+ return this.pushState("NODE"), 35;
606
+ case 69:
607
+ return this.pushState("NODE"), 35;
608
+ case 70:
609
+ return this.pushState("NODE"), 35;
610
+ case 71:
611
+ return this.pushState("NODE"), 35;
612
+ case 72:
613
+ return p.getLogger().debug("Lexa: ["), this.pushState("NODE"), 35;
614
+ case 73:
615
+ return this.pushState("BLOCK_ARROW"), p.getLogger().debug("LEX ARR START"), 37;
616
+ case 74:
617
+ return p.getLogger().debug("Lex: NODE_ID", x.yytext), 31;
618
+ case 75:
619
+ return p.getLogger().debug("Lex: EOF", x.yytext), 8;
620
+ case 76:
621
+ this.pushState("md_string");
622
+ break;
623
+ case 77:
624
+ this.pushState("md_string");
625
+ break;
626
+ case 78:
627
+ return "NODE_DESCR";
628
+ case 79:
629
+ this.popState();
630
+ break;
631
+ case 80:
632
+ p.getLogger().debug("Lex: Starting string"), this.pushState("string");
633
+ break;
634
+ case 81:
635
+ p.getLogger().debug("LEX ARR: Starting string"), this.pushState("string");
636
+ break;
637
+ case 82:
638
+ return p.getLogger().debug("LEX: NODE_DESCR:", x.yytext), "NODE_DESCR";
639
+ case 83:
640
+ p.getLogger().debug("LEX POPPING"), this.popState();
641
+ break;
642
+ case 84:
643
+ p.getLogger().debug("Lex: =>BAE"), this.pushState("ARROW_DIR");
644
+ break;
645
+ case 85:
646
+ return x.yytext = x.yytext.replace(/^,\s*/, ""), p.getLogger().debug("Lex (right): dir:", x.yytext), "DIR";
647
+ case 86:
648
+ return x.yytext = x.yytext.replace(/^,\s*/, ""), p.getLogger().debug("Lex (left):", x.yytext), "DIR";
649
+ case 87:
650
+ return x.yytext = x.yytext.replace(/^,\s*/, ""), p.getLogger().debug("Lex (x):", x.yytext), "DIR";
651
+ case 88:
652
+ return x.yytext = x.yytext.replace(/^,\s*/, ""), p.getLogger().debug("Lex (y):", x.yytext), "DIR";
653
+ case 89:
654
+ return x.yytext = x.yytext.replace(/^,\s*/, ""), p.getLogger().debug("Lex (up):", x.yytext), "DIR";
655
+ case 90:
656
+ return x.yytext = x.yytext.replace(/^,\s*/, ""), p.getLogger().debug("Lex (down):", x.yytext), "DIR";
657
+ case 91:
658
+ return x.yytext = "]>", p.getLogger().debug("Lex (ARROW_DIR end):", x.yytext), this.popState(), this.popState(), "BLOCK_ARROW_END";
659
+ case 92:
660
+ return p.getLogger().debug("Lex: LINK", "#" + x.yytext + "#"), 15;
661
+ case 93:
662
+ return p.getLogger().debug("Lex: LINK", x.yytext), 15;
663
+ case 94:
664
+ return p.getLogger().debug("Lex: LINK", x.yytext), 15;
665
+ case 95:
666
+ return p.getLogger().debug("Lex: LINK", x.yytext), 15;
667
+ case 96:
668
+ return p.getLogger().debug("Lex: START_LINK", x.yytext), this.pushState("LLABEL"), 16;
669
+ case 97:
670
+ return p.getLogger().debug("Lex: START_LINK", x.yytext), this.pushState("LLABEL"), 16;
671
+ case 98:
672
+ return p.getLogger().debug("Lex: START_LINK", x.yytext), this.pushState("LLABEL"), 16;
673
+ case 99:
674
+ this.pushState("md_string");
675
+ break;
676
+ case 100:
677
+ return p.getLogger().debug("Lex: Starting string"), this.pushState("string"), "LINK_LABEL";
678
+ case 101:
679
+ return this.popState(), p.getLogger().debug("Lex: LINK", "#" + x.yytext + "#"), 15;
680
+ case 102:
681
+ return this.popState(), p.getLogger().debug("Lex: LINK", x.yytext), 15;
682
+ case 103:
683
+ return this.popState(), p.getLogger().debug("Lex: LINK", x.yytext), 15;
684
+ case 104:
685
+ return p.getLogger().debug("Lex: COLON", x.yytext), x.yytext = x.yytext.slice(1), 27;
686
+ }
687
+ }, "anonymous"),
688
+ rules: [/^(?:block-beta\b)/, /^(?:block:)/, /^(?:block\b)/, /^(?:[\s]+)/, /^(?:[\n]+)/, /^(?:((\u000D\u000A)|(\u000A)))/, /^(?:columns\s+auto\b)/, /^(?:columns\s+[\d]+)/, /^(?:["][`])/, /^(?:[^`"]+)/, /^(?:[`]["])/, /^(?:["])/, /^(?:["])/, /^(?:[^"]*)/, /^(?:space[:]\d+)/, /^(?:space\b)/, /^(?:default\b)/, /^(?:linkStyle\b)/, /^(?:interpolate\b)/, /^(?:classDef\s+)/, /^(?:DEFAULT\s+)/, /^(?:\w+\s+)/, /^(?:[^\n]*)/, /^(?:class\s+)/, /^(?:(\w+)+((,\s*\w+)*))/, /^(?:[^\n]*)/, /^(?:style\s+)/, /^(?:(\w+)+((,\s*\w+)*))/, /^(?:[^\n]*)/, /^(?:accTitle\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*\{\s*)/, /^(?:[\}])/, /^(?:[^\}]*)/, /^(?:end\b\s*)/, /^(?:\(\(\()/, /^(?:\)\)\))/, /^(?:[\)]\))/, /^(?:\}\})/, /^(?:\})/, /^(?:\(-)/, /^(?:-\))/, /^(?:\(\()/, /^(?:\]\])/, /^(?:\()/, /^(?:\]\))/, /^(?:\\\])/, /^(?:\/\])/, /^(?:\)\])/, /^(?:[\)])/, /^(?:\]>)/, /^(?:[\]])/, /^(?:-\))/, /^(?:\(-)/, /^(?:\)\))/, /^(?:\))/, /^(?:\(\(\()/, /^(?:\(\()/, /^(?:\{\{)/, /^(?:\{)/, /^(?:>)/, /^(?:\(\[)/, /^(?:\()/, /^(?:\[\[)/, /^(?:\[\|)/, /^(?:\[\()/, /^(?:\)\)\))/, /^(?:\[\\)/, /^(?:\[\/)/, /^(?:\[\\)/, /^(?:\[)/, /^(?:<\[)/, /^(?:[^\(\[\n\-\)\{\}\s\<\>:=]+)/, /^(?:$)/, /^(?:["][`])/, /^(?:["][`])/, /^(?:[^`"]+)/, /^(?:[`]["])/, /^(?:["])/, /^(?:["])/, /^(?:[^"]+)/, /^(?:["])/, /^(?:\]>\s*\()/, /^(?:,?\s*right\s*)/, /^(?:,?\s*left\s*)/, /^(?:,?\s*x\s*)/, /^(?:,?\s*y\s*)/, /^(?:,?\s*up\s*)/, /^(?:,?\s*down\s*)/, /^(?:\)\s*)/, /^(?:\s*[xo<]?--+[-xo>]\s*)/, /^(?:\s*[xo<]?==+[=xo>]\s*)/, /^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/, /^(?:\s*~~[\~]+\s*)/, /^(?:\s*[xo<]?--\s*)/, /^(?:\s*[xo<]?==\s*)/, /^(?:\s*[xo<]?-\.\s*)/, /^(?:["][`])/, /^(?:["])/, /^(?:\s*[xo<]?--+[-xo>]\s*)/, /^(?:\s*[xo<]?==+[=xo>]\s*)/, /^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/, /^(?::\d+)/],
689
+ conditions: { STYLE_DEFINITION: { rules: [28], inclusive: !1 }, STYLE_STMNT: { rules: [27], inclusive: !1 }, CLASSDEFID: { rules: [22], inclusive: !1 }, CLASSDEF: { rules: [20, 21], inclusive: !1 }, CLASS_STYLE: { rules: [25], inclusive: !1 }, CLASS: { rules: [24], inclusive: !1 }, LLABEL: { rules: [99, 100, 101, 102, 103], inclusive: !1 }, ARROW_DIR: { rules: [85, 86, 87, 88, 89, 90, 91], inclusive: !1 }, BLOCK_ARROW: { rules: [76, 81, 84], inclusive: !1 }, NODE: { rules: [37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 77, 80], inclusive: !1 }, md_string: { rules: [9, 10, 78, 79], inclusive: !1 }, space: { rules: [], inclusive: !1 }, string: { rules: [12, 13, 82, 83], inclusive: !1 }, acc_descr_multiline: { rules: [34, 35], inclusive: !1 }, acc_descr: { rules: [32], inclusive: !1 }, acc_title: { rules: [30], inclusive: !1 }, INITIAL: { rules: [0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 14, 15, 16, 17, 18, 19, 23, 26, 29, 31, 33, 36, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 92, 93, 94, 95, 96, 97, 98, 104], inclusive: !0 } }
690
+ };
691
+ return T;
692
+ })();
693
+ S.lexer = N;
694
+ function _() {
695
+ this.yy = {};
696
+ }
697
+ return g(_, "Parser"), _.prototype = S, S.Parser = _, new _();
698
+ })();
699
+ bt.parser = bt;
700
+ var ar = bt, U = /* @__PURE__ */ new Map(), vt = [], wt = /* @__PURE__ */ new Map(), Rt = "color", At = "fill", sr = "bgFill", Ut = ",", ct = /* @__PURE__ */ new Map(), Et = "", ir = /* @__PURE__ */ g((e) => Ve.sanitizeText(e, R()), "sanitizeText"), nr = /* @__PURE__ */ g(function(e, t = "") {
701
+ let a = ct.get(e);
702
+ a || (a = { id: e, styles: [], textStyles: [] }, ct.set(e, a)), t?.split(Ut).forEach((s) => {
703
+ const i = s.replace(/([^;]*);/, "$1").trim();
704
+ if (RegExp(Rt).exec(s)) {
705
+ const r = i.replace(At, sr).replace(Rt, At);
706
+ a.textStyles.push(r);
707
+ }
708
+ a.styles.push(i);
709
+ });
710
+ }, "addStyleClass"), cr = /* @__PURE__ */ g(function(e, t = "") {
711
+ const a = U.get(e);
712
+ t != null && (a.styles = t.split(Ut));
713
+ }, "addStyle2Node"), lr = /* @__PURE__ */ g(function(e, t) {
714
+ e.split(",").forEach(function(a) {
715
+ let s = U.get(a);
716
+ if (s === void 0) {
717
+ const i = a.trim();
718
+ s = { id: i, type: "na", children: [] }, U.set(i, s);
719
+ }
720
+ s.classes || (s.classes = []), s.classes.push(t);
721
+ });
722
+ }, "setCssClass"), Xt = /* @__PURE__ */ g((e, t) => {
723
+ const a = e.flat(), s = [], c = a.find((r) => r?.type === "column-setting")?.columns ?? -1;
724
+ for (const r of a) {
725
+ if (typeof c == "number" && c > 0 && r.type !== "column-setting" && typeof r.widthInColumns == "number" && r.widthInColumns > c && k.warn(
726
+ `Block ${r.id} width ${r.widthInColumns} exceeds configured column width ${c}`
727
+ ), r.label && (r.label = ir(r.label)), r.type === "classDef") {
728
+ nr(r.id, r.css);
729
+ continue;
730
+ }
731
+ if (r.type === "applyClass") {
732
+ lr(r.id, r?.styleClass ?? "");
733
+ continue;
734
+ }
735
+ if (r.type === "applyStyles") {
736
+ r?.stylesStr && cr(r.id, r?.stylesStr);
737
+ continue;
738
+ }
739
+ if (r.type === "column-setting")
740
+ t.columns = r.columns ?? -1;
741
+ else if (r.type === "edge") {
742
+ const n = (wt.get(r.id) ?? 0) + 1;
743
+ wt.set(r.id, n), r.id = n + "-" + r.id, vt.push(r);
744
+ } else {
745
+ r.label || (r.type === "composite" ? r.label = "" : r.label = r.id);
746
+ const n = U.get(r.id);
747
+ if (n === void 0 ? U.set(r.id, r) : (r.type !== "na" && (n.type = r.type), r.label !== r.id && (n.label = r.label)), r.children && Xt(r.children, r), r.type === "space") {
748
+ const l = r.width ?? 1;
749
+ for (let u = 0; u < l; u++) {
750
+ const h = Qe(r);
751
+ h.id = h.id + "-" + u, U.set(h.id, h), s.push(h);
752
+ }
753
+ } else n === void 0 && s.push(r);
754
+ }
755
+ }
756
+ t.children = s;
757
+ }, "populateBlockDatabase"), _t = [], et = { id: "root", type: "composite", children: [], columns: -1 }, or = /* @__PURE__ */ g(() => {
758
+ k.debug("Clear called"), Fe(), et = { id: "root", type: "composite", children: [], columns: -1 }, U = /* @__PURE__ */ new Map([["root", et]]), _t = [], ct = /* @__PURE__ */ new Map(), vt = [], wt = /* @__PURE__ */ new Map(), Et = "";
759
+ }, "clear");
760
+ function Vt(e) {
761
+ switch (k.debug("typeStr2Type", e), e) {
762
+ case "[]":
763
+ return "square";
764
+ case "()":
765
+ return k.debug("we have a round"), "round";
766
+ case "(())":
767
+ return "circle";
768
+ case ">]":
769
+ return "rect_left_inv_arrow";
770
+ case "{}":
771
+ return "diamond";
772
+ case "{{}}":
773
+ return "hexagon";
774
+ case "([])":
775
+ return "stadium";
776
+ case "[[]]":
777
+ return "subroutine";
778
+ case "[()]":
779
+ return "cylinder";
780
+ case "((()))":
781
+ return "doublecircle";
782
+ case "[//]":
783
+ return "lean_right";
784
+ case "[\\\\]":
785
+ return "lean_left";
786
+ case "[/\\]":
787
+ return "trapezoid";
788
+ case "[\\/]":
789
+ return "inv_trapezoid";
790
+ case "<[]>":
791
+ return "block_arrow";
792
+ default:
793
+ return "na";
794
+ }
795
+ }
796
+ g(Vt, "typeStr2Type");
797
+ function jt(e) {
798
+ return k.debug("typeStr2Type", e), e === "==" ? "thick" : "normal";
799
+ }
800
+ g(jt, "edgeTypeStr2Type");
801
+ function Gt(e) {
802
+ switch (e.trim().slice(-1)) {
803
+ case "x":
804
+ return "arrow_cross";
805
+ case "o":
806
+ return "arrow_circle";
807
+ case ">":
808
+ return "arrow_point";
809
+ default:
810
+ return "";
811
+ }
812
+ }
813
+ g(Gt, "edgeStrToEdgeData");
814
+ function Zt(e) {
815
+ switch (e.trim().charAt(0)) {
816
+ case "x":
817
+ return "arrow_cross";
818
+ case "o":
819
+ return "arrow_circle";
820
+ case "<":
821
+ return "arrow_point";
822
+ default:
823
+ return "arrow_open";
824
+ }
825
+ }
826
+ g(Zt, "edgeStrToEdgeStartData");
827
+ function qt(e) {
828
+ return e.includes("==") ? "thick" : "normal";
829
+ }
830
+ g(qt, "edgeStrToThickness");
831
+ function Jt(e) {
832
+ return e.includes(".-") ? "dotted" : "solid";
833
+ }
834
+ g(Jt, "edgeStrToPattern");
835
+ var zt = 0, hr = /* @__PURE__ */ g(() => (zt++, "id-" + Math.random().toString(36).substr(2, 12) + "-" + zt), "generateId"), gr = /* @__PURE__ */ g((e) => {
836
+ et.children = e, Xt(e, et), _t = et.children;
837
+ }, "setHierarchy"), ur = /* @__PURE__ */ g((e) => {
838
+ const t = U.get(e);
839
+ return t ? t.columns ? t.columns : t.children ? t.children.length : -1 : -1;
840
+ }, "getColumns"), dr = /* @__PURE__ */ g(() => [...U.values()], "getBlocksFlat"), pr = /* @__PURE__ */ g(() => _t || [], "getBlocks"), fr = /* @__PURE__ */ g(() => vt, "getEdges"), xr = /* @__PURE__ */ g((e) => U.get(e), "getBlock"), yr = /* @__PURE__ */ g((e) => {
841
+ U.set(e.id, e);
842
+ }, "setBlock"), br = /* @__PURE__ */ g((e) => {
843
+ Et = e;
844
+ }, "setDiagramId"), wr = /* @__PURE__ */ g(() => Et, "getDiagramId"), mr = /* @__PURE__ */ g(() => k, "getLogger"), Sr = /* @__PURE__ */ g(function() {
845
+ return ct;
846
+ }, "getClasses"), Lr = {
847
+ getConfig: /* @__PURE__ */ g(() => rt().block, "getConfig"),
848
+ typeStr2Type: Vt,
849
+ edgeTypeStr2Type: jt,
850
+ edgeStrToEdgeData: Gt,
851
+ edgeStrToEdgeStartData: Zt,
852
+ edgeStrToThickness: qt,
853
+ edgeStrToPattern: Jt,
854
+ getLogger: mr,
855
+ getBlocksFlat: dr,
856
+ getBlocks: pr,
857
+ getEdges: fr,
858
+ setHierarchy: gr,
859
+ getBlock: xr,
860
+ setBlock: yr,
861
+ getColumns: ur,
862
+ getClasses: Sr,
863
+ clear: or,
864
+ generateId: hr,
865
+ setDiagramId: br,
866
+ getDiagramId: wr
867
+ }, kr = Lr, yt = /* @__PURE__ */ g((e, t) => {
868
+ const a = qe, s = a(e, "r"), i = a(e, "g"), c = a(e, "b");
869
+ return We(s, i, c, t);
870
+ }, "fade"), vr = /* @__PURE__ */ g((e) => `.label {
871
+ font-family: ${e.fontFamily};
872
+ color: ${e.nodeTextColor || e.textColor};
873
+ }
874
+ .cluster-label text {
875
+ fill: ${e.titleColor};
876
+ }
877
+ .cluster-label span,p {
878
+ color: ${e.titleColor};
879
+ }
880
+
881
+
882
+
883
+ .label text,span,p {
884
+ fill: ${e.nodeTextColor || e.textColor};
885
+ color: ${e.nodeTextColor || e.textColor};
886
+ }
887
+
888
+ .node rect,
889
+ .node circle,
890
+ .node ellipse,
891
+ .node polygon,
892
+ .node path {
893
+ fill: ${e.mainBkg};
894
+ stroke: ${e.nodeBorder};
895
+ stroke-width: 1px;
896
+ }
897
+ .flowchart-label text {
898
+ text-anchor: middle;
899
+ }
900
+ // .flowchart-label .text-outer-tspan {
901
+ // text-anchor: middle;
902
+ // }
903
+ // .flowchart-label .text-inner-tspan {
904
+ // text-anchor: start;
905
+ // }
906
+
907
+ .node .label {
908
+ text-align: center;
909
+ }
910
+ .node.clickable {
911
+ cursor: pointer;
912
+ }
913
+
914
+ .arrowheadPath {
915
+ fill: ${e.arrowheadColor};
916
+ }
917
+
918
+ .edgePath .path {
919
+ stroke: ${e.lineColor};
920
+ stroke-width: 2.0px;
921
+ }
922
+
923
+ .flowchart-link {
924
+ stroke: ${e.lineColor};
925
+ fill: none;
926
+ }
927
+
928
+ .edgeLabel {
929
+ background-color: ${e.edgeLabelBackground};
930
+ /*
931
+ * This is for backward compatibility with existing code that didn't
932
+ * add a \`<p>\` around edge labels.
933
+ *
934
+ * TODO: We should probably remove this in a future release.
935
+ */
936
+ p {
937
+ margin: 0;
938
+ padding: 0;
939
+ display: inline;
940
+ }
941
+ rect {
942
+ opacity: 0.5;
943
+ background-color: ${e.edgeLabelBackground};
944
+ fill: ${e.edgeLabelBackground};
945
+ }
946
+ text-align: center;
947
+ }
948
+
949
+ /* For html labels only */
950
+ .labelBkg {
951
+ background-color: ${e.edgeLabelBackground};
952
+ }
953
+
954
+ .node .cluster {
955
+ // fill: ${yt(e.mainBkg, 0.5)};
956
+ fill: ${yt(e.clusterBkg, 0.5)};
957
+ stroke: ${yt(e.clusterBorder, 0.2)};
958
+ box-shadow: rgba(50, 50, 93, 0.25) 0px 13px 27px -5px, rgba(0, 0, 0, 0.3) 0px 8px 16px -8px;
959
+ stroke-width: 1px;
960
+ }
961
+
962
+ .cluster text {
963
+ fill: ${e.titleColor};
964
+ }
965
+
966
+ .cluster span,p {
967
+ color: ${e.titleColor};
968
+ }
969
+ /* .cluster div {
970
+ color: ${e.titleColor};
971
+ } */
972
+
973
+ div.mermaidTooltip {
974
+ position: absolute;
975
+ text-align: center;
976
+ max-width: 200px;
977
+ padding: 2px;
978
+ font-family: ${e.fontFamily};
979
+ font-size: 12px;
980
+ background: ${e.tertiaryColor};
981
+ border: 1px solid ${e.border2};
982
+ border-radius: 2px;
983
+ pointer-events: none;
984
+ z-index: 100;
985
+ }
986
+
987
+ .flowchartTitleText {
988
+ text-anchor: middle;
989
+ font-size: 18px;
990
+ fill: ${e.textColor};
991
+ }
992
+ ${de()}
993
+ `, "getStyles"), Er = vr, _r = /* @__PURE__ */ g((e, t, a, s) => {
994
+ t.forEach((i) => {
995
+ zr[i](e, a, s);
996
+ });
997
+ }, "insertMarkers"), Tr = /* @__PURE__ */ g((e, t, a) => {
998
+ k.trace("Making markers for ", a), e.append("defs").append("marker").attr("id", a + "_" + t + "-extensionStart").attr("class", "marker extension " + t).attr("refX", 18).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 1,7 L18,13 V 1 Z"), e.append("defs").append("marker").attr("id", a + "_" + t + "-extensionEnd").attr("class", "marker extension " + t).attr("refX", 1).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 1,1 V 13 L18,7 Z");
999
+ }, "extension"), Dr = /* @__PURE__ */ g((e, t, a) => {
1000
+ e.append("defs").append("marker").attr("id", a + "_" + t + "-compositionStart").attr("class", "marker composition " + t).attr("refX", 18).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), e.append("defs").append("marker").attr("id", a + "_" + t + "-compositionEnd").attr("class", "marker composition " + t).attr("refX", 1).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
1001
+ }, "composition"), Br = /* @__PURE__ */ g((e, t, a) => {
1002
+ e.append("defs").append("marker").attr("id", a + "_" + t + "-aggregationStart").attr("class", "marker aggregation " + t).attr("refX", 18).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), e.append("defs").append("marker").attr("id", a + "_" + t + "-aggregationEnd").attr("class", "marker aggregation " + t).attr("refX", 1).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
1003
+ }, "aggregation"), Nr = /* @__PURE__ */ g((e, t, a) => {
1004
+ e.append("defs").append("marker").attr("id", a + "_" + t + "-dependencyStart").attr("class", "marker dependency " + t).attr("refX", 6).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 5,7 L9,13 L1,7 L9,1 Z"), e.append("defs").append("marker").attr("id", a + "_" + t + "-dependencyEnd").attr("class", "marker dependency " + t).attr("refX", 13).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L14,7 L9,1 Z");
1005
+ }, "dependency"), Ir = /* @__PURE__ */ g((e, t, a) => {
1006
+ e.append("defs").append("marker").attr("id", a + "_" + t + "-lollipopStart").attr("class", "marker lollipop " + t).attr("refX", 13).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("circle").attr("stroke", "black").attr("fill", "transparent").attr("cx", 7).attr("cy", 7).attr("r", 6), e.append("defs").append("marker").attr("id", a + "_" + t + "-lollipopEnd").attr("class", "marker lollipop " + t).attr("refX", 1).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("circle").attr("stroke", "black").attr("fill", "transparent").attr("cx", 7).attr("cy", 7).attr("r", 6);
1007
+ }, "lollipop"), Cr = /* @__PURE__ */ g((e, t, a) => {
1008
+ e.append("marker").attr("id", a + "_" + t + "-pointEnd").attr("class", "marker " + t).attr("viewBox", "0 0 10 10").attr("refX", 6).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto").append("path").attr("d", "M 0 0 L 10 5 L 0 10 z").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0"), e.append("marker").attr("id", a + "_" + t + "-pointStart").attr("class", "marker " + t).attr("viewBox", "0 0 10 10").attr("refX", 4.5).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto").append("path").attr("d", "M 0 5 L 10 10 L 10 0 z").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0");
1009
+ }, "point"), Or = /* @__PURE__ */ g((e, t, a) => {
1010
+ e.append("marker").attr("id", a + "_" + t + "-circleEnd").attr("class", "marker " + t).attr("viewBox", "0 0 10 10").attr("refX", 11).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("circle").attr("cx", "5").attr("cy", "5").attr("r", "5").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0"), e.append("marker").attr("id", a + "_" + t + "-circleStart").attr("class", "marker " + t).attr("viewBox", "0 0 10 10").attr("refX", -1).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("circle").attr("cx", "5").attr("cy", "5").attr("r", "5").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0");
1011
+ }, "circle"), Rr = /* @__PURE__ */ g((e, t, a) => {
1012
+ e.append("marker").attr("id", a + "_" + t + "-crossEnd").attr("class", "marker cross " + t).attr("viewBox", "0 0 11 11").attr("refX", 12).attr("refY", 5.2).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("path").attr("d", "M 1,1 l 9,9 M 10,1 l -9,9").attr("class", "arrowMarkerPath").style("stroke-width", 2).style("stroke-dasharray", "1,0"), e.append("marker").attr("id", a + "_" + t + "-crossStart").attr("class", "marker cross " + t).attr("viewBox", "0 0 11 11").attr("refX", -1).attr("refY", 5.2).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("path").attr("d", "M 1,1 l 9,9 M 10,1 l -9,9").attr("class", "arrowMarkerPath").style("stroke-width", 2).style("stroke-dasharray", "1,0");
1013
+ }, "cross"), Ar = /* @__PURE__ */ g((e, t, a) => {
1014
+ e.append("defs").append("marker").attr("id", a + "_" + t + "-barbEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 14).attr("markerUnits", "strokeWidth").attr("orient", "auto").append("path").attr("d", "M 19,7 L9,13 L14,7 L9,1 Z");
1015
+ }, "barb"), zr = {
1016
+ extension: Tr,
1017
+ composition: Dr,
1018
+ aggregation: Br,
1019
+ dependency: Nr,
1020
+ lollipop: Ir,
1021
+ point: Cr,
1022
+ circle: Or,
1023
+ cross: Rr,
1024
+ barb: Ar
1025
+ }, Mr = _r;
1026
+ function mt(e, t) {
1027
+ if (e === 0 || !Number.isInteger(e))
1028
+ throw new Error("Columns must be an integer !== 0.");
1029
+ if (t < 0 || !Number.isInteger(t))
1030
+ throw new Error("Position must be a non-negative integer." + t);
1031
+ if (e < 0)
1032
+ return { px: t, py: 0 };
1033
+ if (e === 1)
1034
+ return { px: 0, py: t };
1035
+ const a = t % e, s = Math.floor(t / e);
1036
+ return { px: a, py: s };
1037
+ }
1038
+ g(mt, "calculateBlockPosition");
1039
+ var Pr = /* @__PURE__ */ g((e) => {
1040
+ let t = 0, a = 0;
1041
+ for (const s of e.children) {
1042
+ const { width: i, height: c, x: r, y: n } = s.size ?? { width: 0, height: 0, x: 0, y: 0 };
1043
+ if (k.debug(
1044
+ "getMaxChildSize abc95 child:",
1045
+ s.id,
1046
+ "width:",
1047
+ i,
1048
+ "height:",
1049
+ c,
1050
+ "x:",
1051
+ r,
1052
+ "y:",
1053
+ n,
1054
+ s.type
1055
+ ), s.type === "space")
1056
+ continue;
1057
+ const l = i / (s.widthInColumns ?? 1);
1058
+ l > t && (t = l), c > a && (a = c);
1059
+ }
1060
+ return { width: t, height: a };
1061
+ }, "getMaxChildSize");
1062
+ function lt(e, t, a = 0, s = 0, i = 8) {
1063
+ k.debug(
1064
+ "setBlockSizes abc95 (start)",
1065
+ e.id,
1066
+ e?.size?.x,
1067
+ "block width =",
1068
+ e?.size,
1069
+ "siblingWidth",
1070
+ a
1071
+ ), e?.size?.width || (e.size = {
1072
+ width: a,
1073
+ height: s,
1074
+ x: 0,
1075
+ y: 0
1076
+ });
1077
+ let c = 0, r = 0;
1078
+ if (e.children?.length > 0) {
1079
+ for (const y of e.children)
1080
+ lt(y, t, 0, 0, i);
1081
+ const n = Pr(e);
1082
+ c = n.width, r = n.height, k.debug("setBlockSizes abc95 maxWidth of", e.id, ":s children is ", c, r);
1083
+ for (const y of e.children)
1084
+ y.size && (k.debug(
1085
+ `abc95 Setting size of children of ${e.id} id=${y.id} ${c} ${r} ${JSON.stringify(y.size)}`
1086
+ ), y.size.width = c * (y.widthInColumns ?? 1) + i * ((y.widthInColumns ?? 1) - 1), y.size.height = r, y.size.x = 0, y.size.y = 0, k.debug(
1087
+ `abc95 updating size of ${e.id} children child:${y.id} maxWidth:${c} maxHeight:${r}`
1088
+ ));
1089
+ for (const y of e.children)
1090
+ lt(y, t, c, r, i);
1091
+ const l = e.columns ?? -1;
1092
+ let u = 0;
1093
+ for (const y of e.children)
1094
+ u += y.widthInColumns ?? 1;
1095
+ let h = e.children.length;
1096
+ l > 0 && l < u && (h = l);
1097
+ const d = Math.ceil(u / h);
1098
+ let b = h * (c + i) + i, w = d * (r + i) + i;
1099
+ if (b < a) {
1100
+ k.debug(
1101
+ `Detected to small sibling: abc95 ${e.id} siblingWidth ${a} siblingHeight ${s} width ${b}`
1102
+ ), b = a, w = s;
1103
+ const y = (a - h * i - i) / h, v = (s - d * i - i) / d;
1104
+ k.debug("Size indata abc88", e.id, "childWidth", y, "maxWidth", c), k.debug("Size indata abc88", e.id, "childHeight", v, "maxHeight", r), k.debug("Size indata abc88 xSize", h, "padding", i);
1105
+ for (const S of e.children)
1106
+ S.size && (S.size.width = y, S.size.height = v, S.size.x = 0, S.size.y = 0);
1107
+ }
1108
+ if (k.debug(
1109
+ `abc95 (finale calc) ${e.id} xSize ${h} ySize ${d} columns ${l}${e.children.length} width=${Math.max(b, e.size?.width || 0)}`
1110
+ ), b < (e?.size?.width || 0)) {
1111
+ b = e?.size?.width || 0;
1112
+ const y = l > 0 ? Math.min(e.children.length, l) : e.children.length;
1113
+ if (y > 0) {
1114
+ const v = (b - y * i - i) / y;
1115
+ k.debug("abc95 (growing to fit) width", e.id, b, e.size?.width, v);
1116
+ for (const S of e.children)
1117
+ S.size && (S.size.width = v);
1118
+ }
1119
+ }
1120
+ e.size = {
1121
+ width: b,
1122
+ height: w,
1123
+ x: 0,
1124
+ y: 0
1125
+ };
1126
+ }
1127
+ k.debug(
1128
+ "setBlockSizes abc94 (done)",
1129
+ e.id,
1130
+ e?.size?.x,
1131
+ e?.size?.width,
1132
+ e?.size?.y,
1133
+ e?.size?.height
1134
+ );
1135
+ }
1136
+ g(lt, "setBlockSizes");
1137
+ function Tt(e, t, a = 8) {
1138
+ k.debug(
1139
+ `abc85 layout blocks (=>layoutBlocks) ${e.id} x: ${e?.size?.x} y: ${e?.size?.y} width: ${e?.size?.width}`
1140
+ );
1141
+ const s = e.columns ?? -1;
1142
+ if (k.debug("layoutBlocks columns abc95", e.id, "=>", s, e), e.children && // find max width of children
1143
+ e.children.length > 0) {
1144
+ const i = e?.children[0]?.size?.width ?? 0, c = e.children.length * i + (e.children.length - 1) * a;
1145
+ k.debug("widthOfChildren 88", c, "posX");
1146
+ const r = /* @__PURE__ */ new Map();
1147
+ {
1148
+ let d = 0;
1149
+ for (const b of e.children) {
1150
+ if (!b.size)
1151
+ continue;
1152
+ const { py: w } = mt(s, d), y = r.get(w) ?? 0;
1153
+ b.size.height > y && r.set(w, b.size.height);
1154
+ let v = b?.widthInColumns ?? 1;
1155
+ s > 0 && (v = Math.min(v, s - d % s)), d += v;
1156
+ }
1157
+ }
1158
+ const n = /* @__PURE__ */ new Map();
1159
+ {
1160
+ let d = 0;
1161
+ const b = [...r.keys()].sort((w, y) => w - y);
1162
+ for (const w of b)
1163
+ n.set(w, d), d += (r.get(w) ?? 0) + a;
1164
+ }
1165
+ let l = 0;
1166
+ k.debug("abc91 block?.size?.x", e.id, e?.size?.x);
1167
+ let u = e?.size?.x ? e?.size?.x + (-e?.size?.width / 2 || 0) : -a, h = 0;
1168
+ for (const d of e.children) {
1169
+ const b = e;
1170
+ if (!d.size)
1171
+ continue;
1172
+ const { width: w, height: y } = d.size, { px: v, py: S } = mt(s, l);
1173
+ if (S != h && (h = S, u = e?.size?.x ? e?.size?.x + (-e?.size?.width / 2 || 0) : -a, k.debug("New row in layout for block", e.id, " and child ", d.id, h)), k.debug(
1174
+ `abc89 layout blocks (child) id: ${d.id} Pos: ${l} (px, py) ${v},${S} (${b?.size?.x},${b?.size?.y}) parent: ${b.id} width: ${w}${a}`
1175
+ ), b.size) {
1176
+ const _ = w / 2;
1177
+ d.size.x = u + a + _, k.debug(
1178
+ `abc91 layout blocks (calc) px, pyid:${d.id} startingPos=X${u} new startingPosX${d.size.x} ${_} padding=${a} width=${w} halfWidth=${_} => x:${d.size.x} y:${d.size.y} ${d.widthInColumns} (width * (child?.w || 1)) / 2 ${w * (d?.widthInColumns ?? 1) / 2}`
1179
+ ), u = d.size.x + _;
1180
+ const T = n.get(S) ?? 0, m = r.get(S) ?? y;
1181
+ d.size.y = b.size.y - b.size.height / 2 + T + m / 2 + a, k.debug(
1182
+ `abc88 layout blocks (calc) px, pyid:${d.id}startingPosX${u}${a}${_}=>x:${d.size.x}y:${d.size.y}${d.widthInColumns}(width * (child?.w || 1)) / 2${w * (d?.widthInColumns ?? 1) / 2}`
1183
+ );
1184
+ }
1185
+ d.children && Tt(d, t, a);
1186
+ let N = d?.widthInColumns ?? 1;
1187
+ s > 0 && (N = Math.min(N, s - l % s)), l += N, k.debug("abc88 columnsPos", d, l);
1188
+ }
1189
+ }
1190
+ k.debug(
1191
+ `layout blocks (<==layoutBlocks) ${e.id} x: ${e?.size?.x} y: ${e?.size?.y} width: ${e?.size?.width}`
1192
+ );
1193
+ }
1194
+ g(Tt, "layoutBlocks");
1195
+ function Dt(e, { minX: t, minY: a, maxX: s, maxY: i } = { minX: 0, minY: 0, maxX: 0, maxY: 0 }) {
1196
+ if (e.size && e.id !== "root") {
1197
+ const { x: c, y: r, width: n, height: l } = e.size;
1198
+ c - n / 2 < t && (t = c - n / 2), r - l / 2 < a && (a = r - l / 2), c + n / 2 > s && (s = c + n / 2), r + l / 2 > i && (i = r + l / 2);
1199
+ }
1200
+ if (e.children)
1201
+ for (const c of e.children)
1202
+ ({ minX: t, minY: a, maxX: s, maxY: i } = Dt(c, { minX: t, minY: a, maxX: s, maxY: i }));
1203
+ return { minX: t, minY: a, maxX: s, maxY: i };
1204
+ }
1205
+ g(Dt, "findBounds");
1206
+ function Qt(e) {
1207
+ const t = e.getBlock("root");
1208
+ if (!t)
1209
+ return;
1210
+ const a = R()?.block?.padding ?? 8;
1211
+ lt(t, e, 0, 0, a), Tt(t, e, a), k.debug("getBlocks", JSON.stringify(t, null, 2));
1212
+ const { minX: s, minY: i, maxX: c, maxY: r } = Dt(t), n = r - i, l = c - s;
1213
+ return { x: s, y: i, width: l, height: n };
1214
+ }
1215
+ g(Qt, "layout");
1216
+ var Fr = /* @__PURE__ */ g(async (e, t, a, s = !1, i = !1) => {
1217
+ let c = t || "";
1218
+ typeof c == "object" && (c = c[0]);
1219
+ const r = R(), n = M(r);
1220
+ return await kt(
1221
+ e,
1222
+ c,
1223
+ {
1224
+ style: a,
1225
+ isTitle: s,
1226
+ useHtmlLabels: n,
1227
+ markdown: !1,
1228
+ isNode: i,
1229
+ width: Number.POSITIVE_INFINITY
1230
+ },
1231
+ r
1232
+ );
1233
+ }, "createLabel"), K = Fr, Wr = /* @__PURE__ */ g((e, t, a, s, i) => {
1234
+ t.arrowTypeStart && Mt(e, "start", t.arrowTypeStart, a, s, i), t.arrowTypeEnd && Mt(e, "end", t.arrowTypeEnd, a, s, i);
1235
+ }, "addEdgeMarkers"), Yr = {
1236
+ arrow_cross: "cross",
1237
+ arrow_point: "point",
1238
+ arrow_barb: "barb",
1239
+ arrow_circle: "circle",
1240
+ aggregation: "aggregation",
1241
+ extension: "extension",
1242
+ composition: "composition",
1243
+ dependency: "dependency",
1244
+ lollipop: "lollipop"
1245
+ }, Mt = /* @__PURE__ */ g((e, t, a, s, i, c) => {
1246
+ const r = Yr[a];
1247
+ if (!r) {
1248
+ k.warn(`Unknown arrow type: ${a}`);
1249
+ return;
1250
+ }
1251
+ const n = t === "start" ? "Start" : "End";
1252
+ e.attr(`marker-${t}`, `url(${s}#${i}_${c}-${r}${n})`);
1253
+ }, "addEdgeMarker"), St = {}, z = {}, Hr = /* @__PURE__ */ g(async (e, t) => {
1254
+ const a = R(), s = M(a), i = e.insert("g").attr("class", "edgeLabel"), c = i.insert("g").attr("class", "label"), r = t.labelType === "markdown", n = await kt(
1255
+ e,
1256
+ t.label,
1257
+ {
1258
+ style: t.labelStyle,
1259
+ useHtmlLabels: s,
1260
+ // TODO: The old code only set addSvgBackground when using markdown, but
1261
+ // this function is only used by block diagrams which never use markdown.
1262
+ addSvgBackground: r,
1263
+ isNode: !1,
1264
+ markdown: r,
1265
+ // If using markdown, wrap using default width
1266
+ width: r ? void 0 : Number.POSITIVE_INFINITY
1267
+ },
1268
+ a
1269
+ );
1270
+ c.node().appendChild(n);
1271
+ let l = n.getBBox(), u = l;
1272
+ if (s) {
1273
+ const d = n.children[0], b = D(n);
1274
+ l = d.getBoundingClientRect(), u = l, b.attr("width", l.width), b.attr("height", l.height);
1275
+ } else {
1276
+ const d = D(n).select("text").node();
1277
+ d && typeof d.getBBox == "function" && (u = d.getBBox());
1278
+ }
1279
+ c.attr("transform", Q(u, s)), St[t.id] = i, t.width = l.width, t.height = l.height;
1280
+ let h;
1281
+ if (t.startLabelLeft) {
1282
+ const d = e.insert("g").attr("class", "edgeTerminals"), b = d.insert("g").attr("class", "inner"), w = await K(b, t.startLabelLeft, t.labelStyle);
1283
+ h = w;
1284
+ let y = w.getBBox();
1285
+ if (s) {
1286
+ const v = w.children[0], S = D(w);
1287
+ y = v.getBoundingClientRect(), S.attr("width", y.width), S.attr("height", y.height);
1288
+ }
1289
+ b.attr("transform", Q(y, s)), z[t.id] || (z[t.id] = {}), z[t.id].startLeft = d, tt(h, t.startLabelLeft);
1290
+ }
1291
+ if (t.startLabelRight) {
1292
+ const d = e.insert("g").attr("class", "edgeTerminals"), b = d.insert("g").attr("class", "inner"), w = await K(b, t.startLabelRight, t.labelStyle);
1293
+ h = w;
1294
+ let y = w.getBBox();
1295
+ if (s) {
1296
+ const v = w.children[0], S = D(w);
1297
+ y = v.getBoundingClientRect(), S.attr("width", y.width), S.attr("height", y.height);
1298
+ }
1299
+ b.attr("transform", Q(y, s)), z[t.id] || (z[t.id] = {}), z[t.id].startRight = d, tt(h, t.startLabelRight);
1300
+ }
1301
+ if (t.endLabelLeft) {
1302
+ const d = e.insert("g").attr("class", "edgeTerminals"), b = d.insert("g").attr("class", "inner"), w = await K(d, t.endLabelLeft, t.labelStyle);
1303
+ h = w;
1304
+ let y = w.getBBox();
1305
+ if (s) {
1306
+ const v = w.children[0], S = D(w);
1307
+ y = v.getBoundingClientRect(), S.attr("width", y.width), S.attr("height", y.height);
1308
+ }
1309
+ b.attr("transform", Q(y, s)), z[t.id] || (z[t.id] = {}), z[t.id].endLeft = d, tt(h, t.endLabelLeft);
1310
+ }
1311
+ if (t.endLabelRight) {
1312
+ const d = e.insert("g").attr("class", "edgeTerminals"), b = d.insert("g").attr("class", "inner"), w = await K(
1313
+ d,
1314
+ t.endLabelRight,
1315
+ t.labelStyle
1316
+ );
1317
+ h = w;
1318
+ let y = w.getBBox();
1319
+ if (s) {
1320
+ const v = w.children[0], S = D(w);
1321
+ y = v.getBoundingClientRect(), S.attr("width", y.width), S.attr("height", y.height);
1322
+ }
1323
+ b.attr("transform", Q(y, s)), z[t.id] || (z[t.id] = {}), z[t.id].endRight = d, tt(h, t.endLabelRight);
1324
+ }
1325
+ return n;
1326
+ }, "insertEdgeLabel");
1327
+ function tt(e, t) {
1328
+ M(R()) && e && (e.style.width = t.length * 9 + "px", e.style.height = "12px");
1329
+ }
1330
+ g(tt, "setTerminalWidth");
1331
+ var Kr = /* @__PURE__ */ g((e, t) => {
1332
+ k.debug("Moving label abc88 ", e.id, e.label, St[e.id], t);
1333
+ let a = t.updatedPath ? t.updatedPath : t.originalPath;
1334
+ const s = R(), { subGraphTitleTotalMargin: i } = Xe(s);
1335
+ if (e.label) {
1336
+ const c = St[e.id];
1337
+ let r = e.x, n = e.y;
1338
+ if (a) {
1339
+ const l = $.calcLabelPosition(a);
1340
+ k.debug(
1341
+ "Moving label " + e.label + " from (",
1342
+ r,
1343
+ ",",
1344
+ n,
1345
+ ") to (",
1346
+ l.x,
1347
+ ",",
1348
+ l.y,
1349
+ ") abc88"
1350
+ ), t.updatedPath && (r = l.x, n = l.y);
1351
+ }
1352
+ c.attr("transform", `translate(${r}, ${n + i / 2})`);
1353
+ }
1354
+ if (e.startLabelLeft) {
1355
+ const c = z[e.id].startLeft;
1356
+ let r = e.x, n = e.y;
1357
+ if (a) {
1358
+ const l = $.calcTerminalLabelPosition(e.arrowTypeStart ? 10 : 0, "start_left", a);
1359
+ r = l.x, n = l.y;
1360
+ }
1361
+ c.attr("transform", `translate(${r}, ${n})`);
1362
+ }
1363
+ if (e.startLabelRight) {
1364
+ const c = z[e.id].startRight;
1365
+ let r = e.x, n = e.y;
1366
+ if (a) {
1367
+ const l = $.calcTerminalLabelPosition(
1368
+ e.arrowTypeStart ? 10 : 0,
1369
+ "start_right",
1370
+ a
1371
+ );
1372
+ r = l.x, n = l.y;
1373
+ }
1374
+ c.attr("transform", `translate(${r}, ${n})`);
1375
+ }
1376
+ if (e.endLabelLeft) {
1377
+ const c = z[e.id].endLeft;
1378
+ let r = e.x, n = e.y;
1379
+ if (a) {
1380
+ const l = $.calcTerminalLabelPosition(e.arrowTypeEnd ? 10 : 0, "end_left", a);
1381
+ r = l.x, n = l.y;
1382
+ }
1383
+ c.attr("transform", `translate(${r}, ${n})`);
1384
+ }
1385
+ if (e.endLabelRight) {
1386
+ const c = z[e.id].endRight;
1387
+ let r = e.x, n = e.y;
1388
+ if (a) {
1389
+ const l = $.calcTerminalLabelPosition(e.arrowTypeEnd ? 10 : 0, "end_right", a);
1390
+ r = l.x, n = l.y;
1391
+ }
1392
+ c.attr("transform", `translate(${r}, ${n})`);
1393
+ }
1394
+ }, "positionEdgeLabel"), Ur = /* @__PURE__ */ g((e, t) => {
1395
+ const a = e.x, s = e.y, i = Math.abs(t.x - a), c = Math.abs(t.y - s), r = e.width / 2, n = e.height / 2;
1396
+ return i >= r || c >= n;
1397
+ }, "outsideNode"), Xr = /* @__PURE__ */ g((e, t, a) => {
1398
+ k.debug(`intersection calc abc89:
1399
+ outsidePoint: ${JSON.stringify(t)}
1400
+ insidePoint : ${JSON.stringify(a)}
1401
+ node : x:${e.x} y:${e.y} w:${e.width} h:${e.height}`);
1402
+ const s = e.x, i = e.y, c = Math.abs(s - a.x), r = e.width / 2;
1403
+ let n = a.x < t.x ? r - c : r + c;
1404
+ const l = e.height / 2, u = Math.abs(t.y - a.y), h = Math.abs(t.x - a.x);
1405
+ if (Math.abs(i - t.y) * r > Math.abs(s - t.x) * l) {
1406
+ let d = a.y < t.y ? t.y - l - i : i - l - t.y;
1407
+ n = h * d / u;
1408
+ const b = {
1409
+ x: a.x < t.x ? a.x + n : a.x - h + n,
1410
+ y: a.y < t.y ? a.y + u - d : a.y - u + d
1411
+ };
1412
+ return n === 0 && (b.x = t.x, b.y = t.y), h === 0 && (b.x = t.x), u === 0 && (b.y = t.y), k.debug(`abc89 topp/bott calc, Q ${u}, q ${d}, R ${h}, r ${n}`, b), b;
1413
+ } else {
1414
+ a.x < t.x ? n = t.x - r - s : n = s - r - t.x;
1415
+ let d = u * n / h, b = a.x < t.x ? a.x + h - n : a.x - h + n, w = a.y < t.y ? a.y + d : a.y - d;
1416
+ return k.debug(`sides calc abc89, Q ${u}, q ${d}, R ${h}, r ${n}`, { _x: b, _y: w }), n === 0 && (b = t.x, w = t.y), h === 0 && (b = t.x), u === 0 && (w = t.y), { x: b, y: w };
1417
+ }
1418
+ }, "intersection"), Pt = /* @__PURE__ */ g((e, t) => {
1419
+ k.debug("abc88 cutPathAtIntersect", e, t);
1420
+ let a = [], s = e[0], i = !1;
1421
+ return e.forEach((c) => {
1422
+ if (!Ur(t, c) && !i) {
1423
+ const r = Xr(t, s, c);
1424
+ let n = !1;
1425
+ a.forEach((l) => {
1426
+ n = n || l.x === r.x && l.y === r.y;
1427
+ }), a.some((l) => l.x === r.x && l.y === r.y) || a.push(r), i = !0;
1428
+ } else
1429
+ s = c, i || a.push(c);
1430
+ }), a;
1431
+ }, "cutPathAtIntersect"), Vr = /* @__PURE__ */ g(function(e, t, a, s, i, c, r) {
1432
+ let n = a.points;
1433
+ k.debug("abc88 InsertEdge: edge=", a, "e=", t);
1434
+ let l = !1;
1435
+ const u = c.node(t.v);
1436
+ var h = c.node(t.w);
1437
+ h?.intersect && u?.intersect && (n = n.slice(1, a.points.length - 1), n.unshift(u.intersect(n[0])), n.push(h.intersect(n[n.length - 1]))), a.toCluster && (k.debug("to cluster abc88", s[a.toCluster]), n = Pt(a.points, s[a.toCluster].node), l = !0), a.fromCluster && (k.debug("from cluster abc88", s[a.fromCluster]), n = Pt(n.reverse(), s[a.fromCluster].node).reverse(), l = !0);
1438
+ const d = n.filter((m) => !Number.isNaN(m.y));
1439
+ let b = Ke;
1440
+ a.curve && (i === "graph" || i === "flowchart") && (b = a.curve);
1441
+ const { x: w, y } = Ye(a), v = He().x(w).y(y).curve(b);
1442
+ let S;
1443
+ switch (a.thickness) {
1444
+ case "normal":
1445
+ S = "edge-thickness-normal";
1446
+ break;
1447
+ case "thick":
1448
+ S = "edge-thickness-thick";
1449
+ break;
1450
+ case "invisible":
1451
+ S = "edge-thickness-thick";
1452
+ break;
1453
+ default:
1454
+ S = "";
1455
+ }
1456
+ switch (a.pattern) {
1457
+ case "solid":
1458
+ S += " edge-pattern-solid";
1459
+ break;
1460
+ case "dotted":
1461
+ S += " edge-pattern-dotted";
1462
+ break;
1463
+ case "dashed":
1464
+ S += " edge-pattern-dashed";
1465
+ break;
1466
+ }
1467
+ const N = e.append("path").attr("d", v(d)).attr("id", a.id).attr("class", " " + S + (a.classes ? " " + a.classes : "")).attr("style", a.style);
1468
+ let _ = "";
1469
+ (R().flowchart.arrowMarkerAbsolute || R().state.arrowMarkerAbsolute) && (_ = Ue(!0)), Wr(N, a, _, r, i);
1470
+ let T = {};
1471
+ return l && (T.updatedPath = n), T.originalPath = a.points, T;
1472
+ }, "insertEdge"), jr = /* @__PURE__ */ g((e) => {
1473
+ const t = /* @__PURE__ */ new Set();
1474
+ for (const a of e)
1475
+ switch (a) {
1476
+ case "x":
1477
+ t.add("right"), t.add("left");
1478
+ break;
1479
+ case "y":
1480
+ t.add("up"), t.add("down");
1481
+ break;
1482
+ default:
1483
+ t.add(a);
1484
+ break;
1485
+ }
1486
+ return t;
1487
+ }, "expandAndDeduplicateDirections"), Gr = /* @__PURE__ */ g((e, t, a, s) => {
1488
+ const i = jr(e), c = 2, r = t.height + 2 * a.padding, n = r / c, l = s ?? t.width + 2 * n + a.padding, u = a.padding / 2;
1489
+ return i.has("right") && i.has("left") && i.has("up") && i.has("down") ? [
1490
+ // Bottom
1491
+ { x: 0, y: 0 },
1492
+ { x: n, y: 0 },
1493
+ { x: l / 2, y: 2 * u },
1494
+ { x: l - n, y: 0 },
1495
+ { x: l, y: 0 },
1496
+ // Right
1497
+ { x: l, y: -r / 3 },
1498
+ { x: l + 2 * u, y: -r / 2 },
1499
+ { x: l, y: -2 * r / 3 },
1500
+ { x: l, y: -r },
1501
+ // Top
1502
+ { x: l - n, y: -r },
1503
+ { x: l / 2, y: -r - 2 * u },
1504
+ { x: n, y: -r },
1505
+ // Left
1506
+ { x: 0, y: -r },
1507
+ { x: 0, y: -2 * r / 3 },
1508
+ { x: -2 * u, y: -r / 2 },
1509
+ { x: 0, y: -r / 3 }
1510
+ ] : i.has("right") && i.has("left") && i.has("up") ? [
1511
+ { x: n, y: 0 },
1512
+ { x: l - n, y: 0 },
1513
+ { x: l, y: -r / 2 },
1514
+ { x: l - n, y: -r },
1515
+ { x: n, y: -r },
1516
+ { x: 0, y: -r / 2 }
1517
+ ] : i.has("right") && i.has("left") && i.has("down") ? [
1518
+ { x: 0, y: 0 },
1519
+ { x: n, y: -r },
1520
+ { x: l - n, y: -r },
1521
+ { x: l, y: 0 }
1522
+ ] : i.has("right") && i.has("up") && i.has("down") ? [
1523
+ { x: 0, y: 0 },
1524
+ { x: l, y: -n },
1525
+ { x: l, y: -r + n },
1526
+ { x: 0, y: -r }
1527
+ ] : i.has("left") && i.has("up") && i.has("down") ? [
1528
+ { x: l, y: 0 },
1529
+ { x: 0, y: -n },
1530
+ { x: 0, y: -r + n },
1531
+ { x: l, y: -r }
1532
+ ] : i.has("right") && i.has("left") ? [
1533
+ { x: n, y: 0 },
1534
+ { x: n, y: -u },
1535
+ { x: l - n, y: -u },
1536
+ { x: l - n, y: 0 },
1537
+ { x: l, y: -r / 2 },
1538
+ { x: l - n, y: -r },
1539
+ { x: l - n, y: -r + u },
1540
+ { x: n, y: -r + u },
1541
+ { x: n, y: -r },
1542
+ { x: 0, y: -r / 2 }
1543
+ ] : i.has("up") && i.has("down") ? [
1544
+ // Bottom center
1545
+ { x: l / 2, y: 0 },
1546
+ // Left point of bottom arrow
1547
+ { x: 0, y: -u },
1548
+ { x: n, y: -u },
1549
+ // Left top over vertical section
1550
+ { x: n, y: -r + u },
1551
+ { x: 0, y: -r + u },
1552
+ // Top of arrow
1553
+ { x: l / 2, y: -r },
1554
+ { x: l, y: -r + u },
1555
+ // Top of right vertical bar
1556
+ { x: l - n, y: -r + u },
1557
+ { x: l - n, y: -u },
1558
+ { x: l, y: -u }
1559
+ ] : i.has("right") && i.has("up") ? [
1560
+ { x: 0, y: 0 },
1561
+ { x: l, y: -n },
1562
+ { x: 0, y: -r }
1563
+ ] : i.has("right") && i.has("down") ? [
1564
+ { x: 0, y: 0 },
1565
+ { x: l, y: 0 },
1566
+ { x: 0, y: -r }
1567
+ ] : i.has("left") && i.has("up") ? [
1568
+ { x: l, y: 0 },
1569
+ { x: 0, y: -n },
1570
+ { x: l, y: -r }
1571
+ ] : i.has("left") && i.has("down") ? [
1572
+ { x: l, y: 0 },
1573
+ { x: 0, y: 0 },
1574
+ { x: l, y: -r }
1575
+ ] : i.has("right") ? [
1576
+ { x: n, y: -u },
1577
+ { x: n, y: -u },
1578
+ { x: l - n, y: -u },
1579
+ { x: l - n, y: 0 },
1580
+ { x: l, y: -r / 2 },
1581
+ { x: l - n, y: -r },
1582
+ { x: l - n, y: -r + u },
1583
+ // top left corner of arrow
1584
+ { x: n, y: -r + u },
1585
+ { x: n, y: -r + u }
1586
+ ] : i.has("left") ? [
1587
+ { x: n, y: 0 },
1588
+ { x: n, y: -u },
1589
+ // Two points, the right corners
1590
+ { x: l - n, y: -u },
1591
+ { x: l - n, y: -r + u },
1592
+ { x: n, y: -r + u },
1593
+ { x: n, y: -r },
1594
+ { x: 0, y: -r / 2 }
1595
+ ] : i.has("up") ? [
1596
+ // Bottom center
1597
+ { x: n, y: -u },
1598
+ // Left top over vertical section
1599
+ { x: n, y: -r + u },
1600
+ { x: 0, y: -r + u },
1601
+ // Top of arrow
1602
+ { x: l / 2, y: -r },
1603
+ { x: l, y: -r + u },
1604
+ // Top of right vertical bar
1605
+ { x: l - n, y: -r + u },
1606
+ { x: l - n, y: -u }
1607
+ ] : i.has("down") ? [
1608
+ // Bottom center
1609
+ { x: l / 2, y: 0 },
1610
+ // Left point of bottom arrow
1611
+ { x: 0, y: -u },
1612
+ { x: n, y: -u },
1613
+ // Left top over vertical section
1614
+ { x: n, y: -r + u },
1615
+ { x: l - n, y: -r + u },
1616
+ { x: l - n, y: -u },
1617
+ { x: l, y: -u }
1618
+ ] : [{ x: 0, y: 0 }];
1619
+ }, "getArrowPoints");
1620
+ function $t(e, t) {
1621
+ return e.intersect(t);
1622
+ }
1623
+ g($t, "intersectNode");
1624
+ var Zr = $t;
1625
+ function te(e, t, a, s) {
1626
+ var i = e.x, c = e.y, r = i - s.x, n = c - s.y, l = Math.sqrt(t * t * n * n + a * a * r * r), u = Math.abs(t * a * r / l);
1627
+ s.x < i && (u = -u);
1628
+ var h = Math.abs(t * a * n / l);
1629
+ return s.y < c && (h = -h), { x: i + u, y: c + h };
1630
+ }
1631
+ g(te, "intersectEllipse");
1632
+ var ee = te;
1633
+ function re(e, t, a) {
1634
+ return ee(e, t, t, a);
1635
+ }
1636
+ g(re, "intersectCircle");
1637
+ var qr = re;
1638
+ function ae(e, t, a, s) {
1639
+ var i, c, r, n, l, u, h, d, b, w, y, v, S, N, _;
1640
+ if (i = t.y - e.y, r = e.x - t.x, l = t.x * e.y - e.x * t.y, b = i * a.x + r * a.y + l, w = i * s.x + r * s.y + l, !(b !== 0 && w !== 0 && Lt(b, w)) && (c = s.y - a.y, n = a.x - s.x, u = s.x * a.y - a.x * s.y, h = c * e.x + n * e.y + u, d = c * t.x + n * t.y + u, !(h !== 0 && d !== 0 && Lt(h, d)) && (y = i * n - c * r, y !== 0)))
1641
+ return v = Math.abs(y / 2), S = r * u - n * l, N = S < 0 ? (S - v) / y : (S + v) / y, S = c * l - i * u, _ = S < 0 ? (S - v) / y : (S + v) / y, { x: N, y: _ };
1642
+ }
1643
+ g(ae, "intersectLine");
1644
+ function Lt(e, t) {
1645
+ return e * t > 0;
1646
+ }
1647
+ g(Lt, "sameSign");
1648
+ var Jr = ae, Qr = se;
1649
+ function se(e, t, a) {
1650
+ var s = e.x, i = e.y, c = [], r = Number.POSITIVE_INFINITY, n = Number.POSITIVE_INFINITY;
1651
+ typeof t.forEach == "function" ? t.forEach(function(y) {
1652
+ r = Math.min(r, y.x), n = Math.min(n, y.y);
1653
+ }) : (r = Math.min(r, t.x), n = Math.min(n, t.y));
1654
+ for (var l = s - e.width / 2 - r, u = i - e.height / 2 - n, h = 0; h < t.length; h++) {
1655
+ var d = t[h], b = t[h < t.length - 1 ? h + 1 : 0], w = Jr(
1656
+ e,
1657
+ a,
1658
+ { x: l + d.x, y: u + d.y },
1659
+ { x: l + b.x, y: u + b.y }
1660
+ );
1661
+ w && c.push(w);
1662
+ }
1663
+ return c.length ? (c.length > 1 && c.sort(function(y, v) {
1664
+ var S = y.x - a.x, N = y.y - a.y, _ = Math.sqrt(S * S + N * N), T = v.x - a.x, m = v.y - a.y, p = Math.sqrt(T * T + m * m);
1665
+ return _ < p ? -1 : _ === p ? 0 : 1;
1666
+ }), c[0]) : e;
1667
+ }
1668
+ g(se, "intersectPolygon");
1669
+ var $r = /* @__PURE__ */ g((e, t) => {
1670
+ var a = e.x, s = e.y, i = t.x - a, c = t.y - s, r = e.width / 2, n = e.height / 2, l, u;
1671
+ return Math.abs(c) * r > Math.abs(i) * n ? (c < 0 && (n = -n), l = c === 0 ? 0 : n * i / c, u = n) : (i < 0 && (r = -r), l = r, u = i === 0 ? 0 : r * c / i), { x: a + l, y: s + u };
1672
+ }, "intersectRect"), ta = $r, B = {
1673
+ node: Zr,
1674
+ circle: qr,
1675
+ ellipse: ee,
1676
+ polygon: Qr,
1677
+ rect: ta
1678
+ }, A = /* @__PURE__ */ g(async (e, t, a, s) => {
1679
+ const i = R();
1680
+ let c;
1681
+ const r = t.useHtmlLabels || M(i);
1682
+ a ? c = a : c = "node default";
1683
+ const n = e.insert("g").attr("class", c).attr("id", t.domId || t.id), l = n.insert("g").attr("class", "label").attr("style", t.labelStyle);
1684
+ let u;
1685
+ t.labelText === void 0 ? u = "" : u = typeof t.labelText == "string" ? t.labelText : t.labelText[0];
1686
+ let h;
1687
+ t.labelType === "markdown" ? h = kt(
1688
+ l,
1689
+ Ct(Ot(u), i),
1690
+ {
1691
+ useHtmlLabels: r,
1692
+ width: t.width || i.flowchart.wrappingWidth,
1693
+ classes: "markdown-node-label"
1694
+ },
1695
+ i
1696
+ ) : h = await K(
1697
+ l,
1698
+ Ct(Ot(u), i),
1699
+ t.labelStyle,
1700
+ !1,
1701
+ s
1702
+ );
1703
+ let d = h.getBBox();
1704
+ const b = t.padding / 2;
1705
+ if (M(i)) {
1706
+ const w = h.children[0], y = D(h);
1707
+ await Ge(w, u), d = w.getBoundingClientRect(), y.attr("width", d.width), y.attr("height", d.height);
1708
+ }
1709
+ return r ? l.attr("transform", "translate(" + -d.width / 2 + ", " + -d.height / 2 + ")") : l.attr("transform", "translate(0, " + -d.height / 2 + ")"), t.centerLabel && l.attr("transform", "translate(" + -d.width / 2 + ", " + -d.height / 2 + ")"), l.insert("rect", ":first-child"), { shapeSvg: n, bbox: d, halfPadding: b, label: l };
1710
+ }, "labelHelper"), I = /* @__PURE__ */ g((e, t) => {
1711
+ const a = t.node().getBBox();
1712
+ e.width = a.width, e.height = a.height;
1713
+ }, "updateNodeBounds");
1714
+ function X(e, t, a, s) {
1715
+ return e.insert("polygon", ":first-child").attr(
1716
+ "points",
1717
+ s.map(function(i) {
1718
+ return i.x + "," + i.y;
1719
+ }).join(" ")
1720
+ ).attr("class", "label-container").attr("transform", "translate(" + -t / 2 + "," + a / 2 + ")");
1721
+ }
1722
+ g(X, "insertPolygonShape");
1723
+ var ea = /* @__PURE__ */ g(async (e, t) => {
1724
+ t.useHtmlLabels || M(R()) || (t.centerLabel = !0);
1725
+ const { shapeSvg: s, bbox: i, halfPadding: c } = await A(
1726
+ e,
1727
+ t,
1728
+ "node " + t.classes,
1729
+ !0
1730
+ );
1731
+ k.info("Classes = ", t.classes);
1732
+ const r = s.insert("rect", ":first-child");
1733
+ return r.attr("rx", t.rx).attr("ry", t.ry).attr("x", -i.width / 2 - c).attr("y", -i.height / 2 - c).attr("width", i.width + t.padding).attr("height", i.height + t.padding), I(t, r), t.intersect = function(n) {
1734
+ return B.rect(t, n);
1735
+ }, s;
1736
+ }, "note"), ra = ea, Ft = /* @__PURE__ */ g((e) => e ? " " + e : "", "formatClass"), Y = /* @__PURE__ */ g((e, t) => `${t || "node default"}${Ft(e.classes)} ${Ft(
1737
+ e.class
1738
+ )}`, "getClassesFromNode"), Wt = /* @__PURE__ */ g(async (e, t) => {
1739
+ const { shapeSvg: a, bbox: s } = await A(
1740
+ e,
1741
+ t,
1742
+ Y(t, void 0),
1743
+ !0
1744
+ ), i = s.width + t.padding, c = s.height + t.padding, r = i + c, n = [
1745
+ { x: r / 2, y: 0 },
1746
+ { x: r, y: -r / 2 },
1747
+ { x: r / 2, y: -r },
1748
+ { x: 0, y: -r / 2 }
1749
+ ];
1750
+ k.info("Question main (Circle)");
1751
+ const l = X(a, r, r, n);
1752
+ return l.attr("style", t.style), I(t, l), t.intersect = function(u) {
1753
+ return k.warn("Intersect called"), B.polygon(t, n, u);
1754
+ }, a;
1755
+ }, "question"), aa = /* @__PURE__ */ g((e, t) => {
1756
+ const a = e.insert("g").attr("class", "node default").attr("id", t.domId || t.id), s = 28, i = [
1757
+ { x: 0, y: s / 2 },
1758
+ { x: s / 2, y: 0 },
1759
+ { x: 0, y: -s / 2 },
1760
+ { x: -s / 2, y: 0 }
1761
+ ];
1762
+ return a.insert("polygon", ":first-child").attr(
1763
+ "points",
1764
+ i.map(function(r) {
1765
+ return r.x + "," + r.y;
1766
+ }).join(" ")
1767
+ ).attr("class", "state-start").attr("r", 7).attr("width", 28).attr("height", 28), t.width = 28, t.height = 28, t.intersect = function(r) {
1768
+ return B.circle(t, 14, r);
1769
+ }, a;
1770
+ }, "choice"), sa = /* @__PURE__ */ g(async (e, t) => {
1771
+ const { shapeSvg: a, bbox: s } = await A(
1772
+ e,
1773
+ t,
1774
+ Y(t, void 0),
1775
+ !0
1776
+ ), i = 4, c = t.positioned ? t.height : s.height + t.padding, r = c / i, n = t.positioned ? t.width : s.width + 2 * r + t.padding, l = [
1777
+ { x: r, y: 0 },
1778
+ { x: n - r, y: 0 },
1779
+ { x: n, y: -c / 2 },
1780
+ { x: n - r, y: -c },
1781
+ { x: r, y: -c },
1782
+ { x: 0, y: -c / 2 }
1783
+ ], u = X(a, n, c, l);
1784
+ return u.attr("style", t.style), I(t, u), t.intersect = function(h) {
1785
+ return B.polygon(t, l, h);
1786
+ }, a;
1787
+ }, "hexagon"), ia = /* @__PURE__ */ g(async (e, t) => {
1788
+ const { shapeSvg: a, bbox: s } = await A(e, t, void 0, !0), i = 2, c = s.height + 2 * t.padding, r = c / i, n = s.width + 2 * r + t.padding, u = t.positioned && (t.widthInColumns ?? 1) > 1 && t.width > n ? t.width : n, h = Gr(t.directions, s, t, u), d = X(a, u, c, h);
1789
+ return d.attr("style", t.style), I(t, d), t.intersect = function(b) {
1790
+ return B.polygon(t, h, b);
1791
+ }, a;
1792
+ }, "block_arrow"), na = /* @__PURE__ */ g(async (e, t) => {
1793
+ const { shapeSvg: a, bbox: s } = await A(
1794
+ e,
1795
+ t,
1796
+ Y(t, void 0),
1797
+ !0
1798
+ ), i = s.width + t.padding, c = s.height + t.padding, r = [
1799
+ { x: -c / 2, y: 0 },
1800
+ { x: i, y: 0 },
1801
+ { x: i, y: -c },
1802
+ { x: -c / 2, y: -c },
1803
+ { x: 0, y: -c / 2 }
1804
+ ];
1805
+ return X(a, i, c, r).attr("style", t.style), t.width = i + c, t.height = c, t.intersect = function(l) {
1806
+ return B.polygon(t, r, l);
1807
+ }, a;
1808
+ }, "rect_left_inv_arrow"), ca = /* @__PURE__ */ g(async (e, t) => {
1809
+ const { shapeSvg: a, bbox: s } = await A(e, t, Y(t), !0), i = s.width + t.padding, c = s.height + t.padding, r = [
1810
+ { x: -2 * c / 6, y: 0 },
1811
+ { x: i - c / 6, y: 0 },
1812
+ { x: i + 2 * c / 6, y: -c },
1813
+ { x: c / 6, y: -c }
1814
+ ], n = X(a, i, c, r);
1815
+ return n.attr("style", t.style), I(t, n), t.intersect = function(l) {
1816
+ return B.polygon(t, r, l);
1817
+ }, a;
1818
+ }, "lean_right"), la = /* @__PURE__ */ g(async (e, t) => {
1819
+ const { shapeSvg: a, bbox: s } = await A(
1820
+ e,
1821
+ t,
1822
+ Y(t, void 0),
1823
+ !0
1824
+ ), i = s.width + t.padding, c = s.height + t.padding, r = [
1825
+ { x: 2 * c / 6, y: 0 },
1826
+ { x: i + c / 6, y: 0 },
1827
+ { x: i - 2 * c / 6, y: -c },
1828
+ { x: -c / 6, y: -c }
1829
+ ], n = X(a, i, c, r);
1830
+ return n.attr("style", t.style), I(t, n), t.intersect = function(l) {
1831
+ return B.polygon(t, r, l);
1832
+ }, a;
1833
+ }, "lean_left"), oa = /* @__PURE__ */ g(async (e, t) => {
1834
+ const { shapeSvg: a, bbox: s } = await A(
1835
+ e,
1836
+ t,
1837
+ Y(t, void 0),
1838
+ !0
1839
+ ), i = s.width + t.padding, c = s.height + t.padding, r = [
1840
+ { x: -2 * c / 6, y: 0 },
1841
+ { x: i + 2 * c / 6, y: 0 },
1842
+ { x: i - c / 6, y: -c },
1843
+ { x: c / 6, y: -c }
1844
+ ], n = X(a, i, c, r);
1845
+ return n.attr("style", t.style), I(t, n), t.intersect = function(l) {
1846
+ return B.polygon(t, r, l);
1847
+ }, a;
1848
+ }, "trapezoid"), ha = /* @__PURE__ */ g(async (e, t) => {
1849
+ const { shapeSvg: a, bbox: s } = await A(
1850
+ e,
1851
+ t,
1852
+ Y(t, void 0),
1853
+ !0
1854
+ ), i = s.width + t.padding, c = s.height + t.padding, r = [
1855
+ { x: c / 6, y: 0 },
1856
+ { x: i - c / 6, y: 0 },
1857
+ { x: i + 2 * c / 6, y: -c },
1858
+ { x: -2 * c / 6, y: -c }
1859
+ ], n = X(a, i, c, r);
1860
+ return n.attr("style", t.style), I(t, n), t.intersect = function(l) {
1861
+ return B.polygon(t, r, l);
1862
+ }, a;
1863
+ }, "inv_trapezoid"), ga = /* @__PURE__ */ g(async (e, t) => {
1864
+ const { shapeSvg: a, bbox: s } = await A(
1865
+ e,
1866
+ t,
1867
+ Y(t, void 0),
1868
+ !0
1869
+ ), i = s.width + t.padding, c = s.height + t.padding, r = [
1870
+ { x: 0, y: 0 },
1871
+ { x: i + c / 2, y: 0 },
1872
+ { x: i, y: -c / 2 },
1873
+ { x: i + c / 2, y: -c },
1874
+ { x: 0, y: -c }
1875
+ ], n = X(a, i, c, r);
1876
+ return n.attr("style", t.style), I(t, n), t.intersect = function(l) {
1877
+ return B.polygon(t, r, l);
1878
+ }, a;
1879
+ }, "rect_right_inv_arrow"), ua = /* @__PURE__ */ g(async (e, t) => {
1880
+ const { shapeSvg: a, bbox: s } = await A(
1881
+ e,
1882
+ t,
1883
+ Y(t, void 0),
1884
+ !0
1885
+ ), i = s.width + t.padding, c = i / 2, r = c / (2.5 + i / 50), n = s.height + r + t.padding, l = "M 0," + r + " a " + c + "," + r + " 0,0,0 " + i + " 0 a " + c + "," + r + " 0,0,0 " + -i + " 0 l 0," + n + " a " + c + "," + r + " 0,0,0 " + i + " 0 l 0," + -n, u = a.attr("label-offset-y", r).insert("path", ":first-child").attr("style", t.style).attr("d", l).attr("transform", "translate(" + -i / 2 + "," + -(n / 2 + r) + ")");
1886
+ return I(t, u), t.intersect = function(h) {
1887
+ const d = B.rect(t, h), b = d.x - t.x;
1888
+ if (c != 0 && (Math.abs(b) < t.width / 2 || Math.abs(b) == t.width / 2 && Math.abs(d.y - t.y) > t.height / 2 - r)) {
1889
+ let w = r * r * (1 - b * b / (c * c));
1890
+ w != 0 && (w = Math.sqrt(w)), w = r - w, h.y - t.y > 0 && (w = -w), d.y += w;
1891
+ }
1892
+ return d;
1893
+ }, a;
1894
+ }, "cylinder"), da = /* @__PURE__ */ g(async (e, t) => {
1895
+ const { shapeSvg: a, bbox: s, halfPadding: i } = await A(
1896
+ e,
1897
+ t,
1898
+ "node " + t.classes + " " + t.class,
1899
+ !0
1900
+ ), c = a.insert("rect", ":first-child"), r = t.positioned ? t.width : s.width + t.padding, n = t.positioned ? t.height : s.height + t.padding, l = t.positioned ? -r / 2 : -s.width / 2 - i, u = t.positioned ? -n / 2 : -s.height / 2 - i;
1901
+ if (c.attr("class", "basic label-container").attr("style", t.style).attr("rx", t.rx).attr("ry", t.ry).attr("x", l).attr("y", u).attr("width", r).attr("height", n), t.props) {
1902
+ const h = new Set(Object.keys(t.props));
1903
+ t.props.borders && (ot(c, t.props.borders, r, n), h.delete("borders")), h.forEach((d) => {
1904
+ k.warn(`Unknown node property ${d}`);
1905
+ });
1906
+ }
1907
+ return I(t, c), t.intersect = function(h) {
1908
+ return B.rect(t, h);
1909
+ }, a;
1910
+ }, "rect"), pa = /* @__PURE__ */ g(async (e, t) => {
1911
+ const { shapeSvg: a, bbox: s, halfPadding: i } = await A(
1912
+ e,
1913
+ t,
1914
+ "node " + t.classes,
1915
+ !0
1916
+ ), c = a.insert("rect", ":first-child"), r = t.positioned ? t.width : s.width + t.padding, n = t.positioned ? t.height : s.height + t.padding, l = t.positioned ? -r / 2 : -s.width / 2 - i, u = t.positioned ? -n / 2 : -s.height / 2 - i;
1917
+ if (c.attr("class", "basic cluster composite label-container").attr("style", t.style).attr("rx", t.rx).attr("ry", t.ry).attr("x", l).attr("y", u).attr("width", r).attr("height", n), t.props) {
1918
+ const h = new Set(Object.keys(t.props));
1919
+ t.props.borders && (ot(c, t.props.borders, r, n), h.delete("borders")), h.forEach((d) => {
1920
+ k.warn(`Unknown node property ${d}`);
1921
+ });
1922
+ }
1923
+ return I(t, c), t.intersect = function(h) {
1924
+ return B.rect(t, h);
1925
+ }, a;
1926
+ }, "composite"), fa = /* @__PURE__ */ g(async (e, t) => {
1927
+ const { shapeSvg: a } = await A(e, t, "label", !0);
1928
+ k.trace("Classes = ", t.class);
1929
+ const s = a.insert("rect", ":first-child"), i = 0, c = 0;
1930
+ if (s.attr("width", i).attr("height", c), a.attr("class", "label edgeLabel"), t.props) {
1931
+ const r = new Set(Object.keys(t.props));
1932
+ t.props.borders && (ot(s, t.props.borders, i, c), r.delete("borders")), r.forEach((n) => {
1933
+ k.warn(`Unknown node property ${n}`);
1934
+ });
1935
+ }
1936
+ return I(t, s), t.intersect = function(r) {
1937
+ return B.rect(t, r);
1938
+ }, a;
1939
+ }, "labelRect");
1940
+ function ot(e, t, a, s) {
1941
+ const i = [], c = /* @__PURE__ */ g((n) => {
1942
+ i.push(n, 0);
1943
+ }, "addBorder"), r = /* @__PURE__ */ g((n) => {
1944
+ i.push(0, n);
1945
+ }, "skipBorder");
1946
+ t.includes("t") ? (k.debug("add top border"), c(a)) : r(a), t.includes("r") ? (k.debug("add right border"), c(s)) : r(s), t.includes("b") ? (k.debug("add bottom border"), c(a)) : r(a), t.includes("l") ? (k.debug("add left border"), c(s)) : r(s), e.attr("stroke-dasharray", i.join(" "));
1947
+ }
1948
+ g(ot, "applyNodePropertyBorders");
1949
+ var xa = /* @__PURE__ */ g(async (e, t) => {
1950
+ let a;
1951
+ t.classes ? a = "node " + t.classes : a = "node default";
1952
+ const s = e.insert("g").attr("class", a).attr("id", t.domId || t.id), i = s.insert("rect", ":first-child"), c = s.insert("line"), r = s.insert("g").attr("class", "label"), n = t.labelText.flat ? t.labelText.flat() : t.labelText;
1953
+ let l = "";
1954
+ typeof n == "object" ? l = n[0] : l = n, k.info("Label text abc79", l, n, typeof n == "object");
1955
+ const u = await K(r, l, t.labelStyle, !0, !0);
1956
+ let h = { width: 0, height: 0 };
1957
+ if (M(R())) {
1958
+ const v = u.children[0], S = D(u);
1959
+ h = v.getBoundingClientRect(), S.attr("width", h.width), S.attr("height", h.height);
1960
+ }
1961
+ k.info("Text 2", n);
1962
+ const d = n.slice(1, n.length);
1963
+ let b = u.getBBox();
1964
+ const w = await K(
1965
+ r,
1966
+ d.join ? d.join("<br/>") : d,
1967
+ t.labelStyle,
1968
+ !0,
1969
+ !0
1970
+ );
1971
+ if (M(R())) {
1972
+ const v = w.children[0], S = D(w);
1973
+ h = v.getBoundingClientRect(), S.attr("width", h.width), S.attr("height", h.height);
1974
+ }
1975
+ const y = t.padding / 2;
1976
+ return D(w).attr(
1977
+ "transform",
1978
+ "translate( " + // (titleBox.width - bbox.width) / 2 +
1979
+ (h.width > b.width ? 0 : (b.width - h.width) / 2) + ", " + (b.height + y + 5) + ")"
1980
+ ), D(u).attr(
1981
+ "transform",
1982
+ "translate( " + // (titleBox.width - bbox.width) / 2 +
1983
+ (h.width < b.width ? 0 : -(b.width - h.width) / 2) + ", 0)"
1984
+ ), h = r.node().getBBox(), r.attr(
1985
+ "transform",
1986
+ "translate(" + -h.width / 2 + ", " + (-h.height / 2 - y + 3) + ")"
1987
+ ), i.attr("class", "outer title-state").attr("x", -h.width / 2 - y).attr("y", -h.height / 2 - y).attr("width", h.width + t.padding).attr("height", h.height + t.padding), c.attr("class", "divider").attr("x1", -h.width / 2 - y).attr("x2", h.width / 2 + y).attr("y1", -h.height / 2 - y + b.height + y).attr("y2", -h.height / 2 - y + b.height + y), I(t, i), t.intersect = function(v) {
1988
+ return B.rect(t, v);
1989
+ }, s;
1990
+ }, "rectWithTitle"), ya = /* @__PURE__ */ g(async (e, t) => {
1991
+ const { shapeSvg: a, bbox: s } = await A(
1992
+ e,
1993
+ t,
1994
+ Y(t, void 0),
1995
+ !0
1996
+ ), i = s.height + t.padding, c = s.width + i / 4 + t.padding, r = a.insert("rect", ":first-child").attr("style", t.style).attr("rx", i / 2).attr("ry", i / 2).attr("x", -c / 2).attr("y", -i / 2).attr("width", c).attr("height", i);
1997
+ return I(t, r), t.intersect = function(n) {
1998
+ return B.rect(t, n);
1999
+ }, a;
2000
+ }, "stadium"), ba = /* @__PURE__ */ g(async (e, t) => {
2001
+ const { shapeSvg: a, bbox: s, halfPadding: i } = await A(
2002
+ e,
2003
+ t,
2004
+ Y(t, void 0),
2005
+ !0
2006
+ ), c = a.insert("circle", ":first-child");
2007
+ return c.attr("style", t.style).attr("rx", t.rx).attr("ry", t.ry).attr("r", s.width / 2 + i).attr("width", s.width + t.padding).attr("height", s.height + t.padding), k.info("Circle main"), I(t, c), t.intersect = function(r) {
2008
+ return k.info("Circle intersect", t, s.width / 2 + i, r), B.circle(t, s.width / 2 + i, r);
2009
+ }, a;
2010
+ }, "circle"), wa = /* @__PURE__ */ g(async (e, t) => {
2011
+ const { shapeSvg: a, bbox: s, halfPadding: i } = await A(
2012
+ e,
2013
+ t,
2014
+ Y(t, void 0),
2015
+ !0
2016
+ ), c = 5, r = a.insert("g", ":first-child"), n = r.insert("circle"), l = r.insert("circle");
2017
+ return r.attr("class", t.class), n.attr("style", t.style).attr("rx", t.rx).attr("ry", t.ry).attr("r", s.width / 2 + i + c).attr("width", s.width + t.padding + c * 2).attr("height", s.height + t.padding + c * 2), l.attr("style", t.style).attr("rx", t.rx).attr("ry", t.ry).attr("r", s.width / 2 + i).attr("width", s.width + t.padding).attr("height", s.height + t.padding), k.info("DoubleCircle main"), I(t, n), t.intersect = function(u) {
2018
+ return k.info("DoubleCircle intersect", t, s.width / 2 + i + c, u), B.circle(t, s.width / 2 + i + c, u);
2019
+ }, a;
2020
+ }, "doublecircle"), ma = /* @__PURE__ */ g(async (e, t) => {
2021
+ const { shapeSvg: a, bbox: s } = await A(
2022
+ e,
2023
+ t,
2024
+ Y(t, void 0),
2025
+ !0
2026
+ ), i = s.width + t.padding, c = s.height + t.padding, r = [
2027
+ { x: 0, y: 0 },
2028
+ { x: i, y: 0 },
2029
+ { x: i, y: -c },
2030
+ { x: 0, y: -c },
2031
+ { x: 0, y: 0 },
2032
+ { x: -8, y: 0 },
2033
+ { x: i + 8, y: 0 },
2034
+ { x: i + 8, y: -c },
2035
+ { x: -8, y: -c },
2036
+ { x: -8, y: 0 }
2037
+ ], n = X(a, i, c, r);
2038
+ return n.attr("style", t.style), I(t, n), t.intersect = function(l) {
2039
+ return B.polygon(t, r, l);
2040
+ }, a;
2041
+ }, "subroutine"), Sa = /* @__PURE__ */ g((e, t) => {
2042
+ const a = e.insert("g").attr("class", "node default").attr("id", t.domId || t.id), s = a.insert("circle", ":first-child");
2043
+ return s.attr("class", "state-start").attr("r", 7).attr("width", 14).attr("height", 14), I(t, s), t.intersect = function(i) {
2044
+ return B.circle(t, 7, i);
2045
+ }, a;
2046
+ }, "start"), Yt = /* @__PURE__ */ g((e, t, a) => {
2047
+ const s = e.insert("g").attr("class", "node default").attr("id", t.domId || t.id);
2048
+ let i = 70, c = 10;
2049
+ a === "LR" && (i = 10, c = 70);
2050
+ const r = s.append("rect").attr("x", -1 * i / 2).attr("y", -1 * c / 2).attr("width", i).attr("height", c).attr("class", "fork-join");
2051
+ return I(t, r), t.height = t.height + t.padding / 2, t.width = t.width + t.padding / 2, t.intersect = function(n) {
2052
+ return B.rect(t, n);
2053
+ }, s;
2054
+ }, "forkJoin"), La = /* @__PURE__ */ g((e, t) => {
2055
+ const a = e.insert("g").attr("class", "node default").attr("id", t.domId || t.id), s = a.insert("circle", ":first-child"), i = a.insert("circle", ":first-child");
2056
+ return i.attr("class", "state-start").attr("r", 7).attr("width", 14).attr("height", 14), s.attr("class", "state-end").attr("r", 5).attr("width", 10).attr("height", 10), I(t, i), t.intersect = function(c) {
2057
+ return B.circle(t, 7, c);
2058
+ }, a;
2059
+ }, "end"), ka = /* @__PURE__ */ g(async (e, t) => {
2060
+ const a = t.padding / 2, s = 4, i = 8;
2061
+ let c;
2062
+ t.classes ? c = "node " + t.classes : c = "node default";
2063
+ const r = e.insert("g").attr("class", c).attr("id", t.domId || t.id), n = r.insert("rect", ":first-child"), l = r.insert("line"), u = r.insert("line");
2064
+ let h = 0, d = s;
2065
+ const b = r.insert("g").attr("class", "label");
2066
+ let w = 0;
2067
+ const y = t.classData.annotations?.[0], v = t.classData.annotations[0] ? "«" + t.classData.annotations[0] + "»" : "", S = await K(
2068
+ b,
2069
+ v,
2070
+ t.labelStyle,
2071
+ !0,
2072
+ !0
2073
+ );
2074
+ let N = S.getBBox();
2075
+ if (M(R())) {
2076
+ const E = S.children[0], o = D(S);
2077
+ N = E.getBoundingClientRect(), o.attr("width", N.width), o.attr("height", N.height);
2078
+ }
2079
+ t.classData.annotations[0] && (d += N.height + s, h += N.width);
2080
+ let _ = t.classData.label;
2081
+ t.classData.type !== void 0 && t.classData.type !== "" && (M(R()) ? _ += "&lt;" + t.classData.type + "&gt;" : _ += "<" + t.classData.type + ">");
2082
+ const T = await K(
2083
+ b,
2084
+ _,
2085
+ t.labelStyle,
2086
+ !0,
2087
+ !0
2088
+ );
2089
+ D(T).attr("class", "classTitle");
2090
+ let m = T.getBBox();
2091
+ if (M(R())) {
2092
+ const E = T.children[0], o = D(T);
2093
+ m = E.getBoundingClientRect(), o.attr("width", m.width), o.attr("height", m.height);
2094
+ }
2095
+ d += m.height + s, m.width > h && (h = m.width);
2096
+ const p = [];
2097
+ t.classData.members.forEach(async (E) => {
2098
+ const o = E.getDisplayDetails();
2099
+ let F = o.displayText;
2100
+ M(R()) && (F = F.replace(/</g, "&lt;").replace(/>/g, "&gt;"));
2101
+ const f = await K(
2102
+ b,
2103
+ F,
2104
+ o.cssStyle ? o.cssStyle : t.labelStyle,
2105
+ !0,
2106
+ !0
2107
+ );
2108
+ let C = f.getBBox();
2109
+ if (M(R())) {
2110
+ const Z = f.children[0], V = D(f);
2111
+ C = Z.getBoundingClientRect(), V.attr("width", C.width), V.attr("height", C.height);
2112
+ }
2113
+ C.width > h && (h = C.width), d += C.height + s, p.push(f);
2114
+ }), d += i;
2115
+ const x = [];
2116
+ if (t.classData.methods.forEach(async (E) => {
2117
+ const o = E.getDisplayDetails();
2118
+ let F = o.displayText;
2119
+ M(R()) && (F = F.replace(/</g, "&lt;").replace(/>/g, "&gt;"));
2120
+ const f = await K(
2121
+ b,
2122
+ F,
2123
+ o.cssStyle ? o.cssStyle : t.labelStyle,
2124
+ !0,
2125
+ !0
2126
+ );
2127
+ let C = f.getBBox();
2128
+ if (M(R())) {
2129
+ const Z = f.children[0], V = D(f);
2130
+ C = Z.getBoundingClientRect(), V.attr("width", C.width), V.attr("height", C.height);
2131
+ }
2132
+ C.width > h && (h = C.width), d += C.height + s, x.push(f);
2133
+ }), d += i, y) {
2134
+ let E = (h - N.width) / 2;
2135
+ D(S).attr(
2136
+ "transform",
2137
+ "translate( " + (-1 * h / 2 + E) + ", " + -1 * d / 2 + ")"
2138
+ ), w = N.height + s;
2139
+ }
2140
+ let L = (h - m.width) / 2;
2141
+ return D(T).attr(
2142
+ "transform",
2143
+ "translate( " + (-1 * h / 2 + L) + ", " + (-1 * d / 2 + w) + ")"
2144
+ ), w += m.height + s, l.attr("class", "divider").attr("x1", -h / 2 - a).attr("x2", h / 2 + a).attr("y1", -d / 2 - a + i + w).attr("y2", -d / 2 - a + i + w), w += i, p.forEach((E) => {
2145
+ D(E).attr(
2146
+ "transform",
2147
+ "translate( " + -h / 2 + ", " + (-1 * d / 2 + w + i / 2) + ")"
2148
+ );
2149
+ const o = E?.getBBox();
2150
+ w += (o?.height ?? 0) + s;
2151
+ }), w += i, u.attr("class", "divider").attr("x1", -h / 2 - a).attr("x2", h / 2 + a).attr("y1", -d / 2 - a + i + w).attr("y2", -d / 2 - a + i + w), w += i, x.forEach((E) => {
2152
+ D(E).attr(
2153
+ "transform",
2154
+ "translate( " + -h / 2 + ", " + (-1 * d / 2 + w) + ")"
2155
+ );
2156
+ const o = E?.getBBox();
2157
+ w += (o?.height ?? 0) + s;
2158
+ }), n.attr("style", t.style).attr("class", "outer title-state").attr("x", -h / 2 - a).attr("y", -(d / 2) - a).attr("width", h + t.padding).attr("height", d + t.padding), I(t, n), t.intersect = function(E) {
2159
+ return B.rect(t, E);
2160
+ }, r;
2161
+ }, "class_box"), Ht = {
2162
+ rhombus: Wt,
2163
+ composite: pa,
2164
+ question: Wt,
2165
+ rect: da,
2166
+ labelRect: fa,
2167
+ rectWithTitle: xa,
2168
+ choice: aa,
2169
+ circle: ba,
2170
+ doublecircle: wa,
2171
+ stadium: ya,
2172
+ hexagon: sa,
2173
+ block_arrow: ia,
2174
+ rect_left_inv_arrow: na,
2175
+ lean_right: ca,
2176
+ lean_left: la,
2177
+ trapezoid: oa,
2178
+ inv_trapezoid: ha,
2179
+ rect_right_inv_arrow: ga,
2180
+ cylinder: ua,
2181
+ start: Sa,
2182
+ end: La,
2183
+ note: ra,
2184
+ subroutine: ma,
2185
+ fork: Yt,
2186
+ join: Yt,
2187
+ class_box: ka
2188
+ }, nt = {}, ie = /* @__PURE__ */ g(async (e, t, a) => {
2189
+ let s, i;
2190
+ if (t.link) {
2191
+ let c;
2192
+ R().securityLevel === "sandbox" ? c = "_top" : t.linkTarget && (c = t.linkTarget || "_blank"), s = e.insert("svg:a").attr("xlink:href", t.link).attr("target", c), i = await Ht[t.shape](s, t, a);
2193
+ } else
2194
+ i = await Ht[t.shape](e, t, a), s = i;
2195
+ return t.tooltip && i.attr("title", t.tooltip), t.class && i.attr("class", "node default " + t.class), nt[t.id] = s, t.haveCallback && nt[t.id].attr("class", nt[t.id].attr("class") + " clickable"), s;
2196
+ }, "insertNode"), va = /* @__PURE__ */ g((e) => {
2197
+ const t = nt[e.id];
2198
+ k.trace(
2199
+ "Transforming node",
2200
+ e.diff,
2201
+ e,
2202
+ "translate(" + (e.x - e.width / 2 - 5) + ", " + e.width / 2 + ")"
2203
+ );
2204
+ const a = 8, s = e.diff || 0;
2205
+ return e.clusterNode ? t.attr(
2206
+ "transform",
2207
+ "translate(" + (e.x + s - e.width / 2) + ", " + (e.y - e.height / 2 - a) + ")"
2208
+ ) : t.attr("transform", "translate(" + e.x + ", " + e.y + ")"), s;
2209
+ }, "positionNode");
2210
+ function Bt(e, t, a = !1) {
2211
+ const s = e;
2212
+ let i = "default";
2213
+ (s?.classes?.length || 0) > 0 && (i = (s?.classes ?? []).join(" ")), i = i + " flowchart-label";
2214
+ let c = 0, r = "", n;
2215
+ switch (s.type) {
2216
+ case "round":
2217
+ c = 5, r = "rect";
2218
+ break;
2219
+ case "composite":
2220
+ c = 0, r = "composite", n = 0;
2221
+ break;
2222
+ case "square":
2223
+ r = "rect";
2224
+ break;
2225
+ case "diamond":
2226
+ r = "question";
2227
+ break;
2228
+ case "hexagon":
2229
+ r = "hexagon";
2230
+ break;
2231
+ case "block_arrow":
2232
+ r = "block_arrow";
2233
+ break;
2234
+ case "odd":
2235
+ r = "rect_left_inv_arrow";
2236
+ break;
2237
+ case "lean_right":
2238
+ r = "lean_right";
2239
+ break;
2240
+ case "lean_left":
2241
+ r = "lean_left";
2242
+ break;
2243
+ case "trapezoid":
2244
+ r = "trapezoid";
2245
+ break;
2246
+ case "inv_trapezoid":
2247
+ r = "inv_trapezoid";
2248
+ break;
2249
+ case "rect_left_inv_arrow":
2250
+ r = "rect_left_inv_arrow";
2251
+ break;
2252
+ case "circle":
2253
+ r = "circle";
2254
+ break;
2255
+ case "ellipse":
2256
+ r = "ellipse";
2257
+ break;
2258
+ case "stadium":
2259
+ r = "stadium";
2260
+ break;
2261
+ case "subroutine":
2262
+ r = "subroutine";
2263
+ break;
2264
+ case "cylinder":
2265
+ r = "cylinder";
2266
+ break;
2267
+ case "group":
2268
+ r = "rect";
2269
+ break;
2270
+ case "doublecircle":
2271
+ r = "doublecircle";
2272
+ break;
2273
+ default:
2274
+ r = "rect";
2275
+ }
2276
+ const l = je(s?.styles ?? []), u = s.label, h = s.size ?? { width: 0, height: 0, x: 0, y: 0 }, d = t.getDiagramId();
2277
+ return {
2278
+ labelStyle: l.labelStyle,
2279
+ shape: r,
2280
+ labelText: u,
2281
+ rx: c,
2282
+ ry: c,
2283
+ class: i,
2284
+ style: l.style,
2285
+ id: s.id,
2286
+ domId: d ? `${d}-${s.id}` : s.id,
2287
+ directions: s.directions,
2288
+ width: h.width,
2289
+ height: h.height,
2290
+ x: h.x,
2291
+ y: h.y,
2292
+ positioned: a,
2293
+ intersect: void 0,
2294
+ type: s.type,
2295
+ padding: n ?? rt()?.block?.padding ?? 0,
2296
+ widthInColumns: s.widthInColumns ?? 1
2297
+ };
2298
+ }
2299
+ g(Bt, "getNodeFromBlock");
2300
+ async function ne(e, t, a) {
2301
+ const s = Bt(t, a, !1);
2302
+ if (s.type === "group")
2303
+ return;
2304
+ const i = rt(), c = await ie(e, s, { config: i }), r = c.node().getBBox(), n = a.getBlock(s.id);
2305
+ n.size = { width: r.width, height: r.height, x: 0, y: 0, node: c }, a.setBlock(n), c.remove();
2306
+ }
2307
+ g(ne, "calculateBlockSize");
2308
+ async function ce(e, t, a) {
2309
+ const s = Bt(t, a, !0);
2310
+ if (a.getBlock(s.id).type !== "space") {
2311
+ const c = rt();
2312
+ await ie(e, s, { config: c }), t.intersect = s?.intersect, va(s);
2313
+ }
2314
+ }
2315
+ g(ce, "insertBlockPositioned");
2316
+ async function ht(e, t, a, s) {
2317
+ for (const i of t)
2318
+ await s(e, i, a), i.children && await ht(e, i.children, a, s);
2319
+ }
2320
+ g(ht, "performOperations");
2321
+ async function le(e, t, a) {
2322
+ await ht(e, t, a, ne);
2323
+ }
2324
+ g(le, "calculateBlockSizes");
2325
+ async function oe(e, t, a) {
2326
+ await ht(e, t, a, ce);
2327
+ }
2328
+ g(oe, "insertBlocks");
2329
+ async function he(e, t, a, s, i) {
2330
+ const c = new Ze({
2331
+ multigraph: !0,
2332
+ compound: !0
2333
+ });
2334
+ c.setGraph({
2335
+ rankdir: "TB",
2336
+ nodesep: 10,
2337
+ ranksep: 10,
2338
+ marginx: 8,
2339
+ marginy: 8
2340
+ });
2341
+ for (const r of a)
2342
+ r.size && c.setNode(r.id, {
2343
+ width: r.size.width,
2344
+ height: r.size.height,
2345
+ intersect: r.intersect
2346
+ });
2347
+ for (const r of t)
2348
+ if (r.start && r.end) {
2349
+ const n = s.getBlock(r.start), l = s.getBlock(r.end);
2350
+ if (n?.size && l?.size) {
2351
+ const u = n.size, h = l.size, d = [
2352
+ { x: u.x, y: u.y },
2353
+ { x: u.x + (h.x - u.x) / 2, y: u.y + (h.y - u.y) / 2 },
2354
+ { x: h.x, y: h.y }
2355
+ ], b = i ? `${i}-${r.id}` : r.id, w = r.thickness === "thick" ? "edge-thickness-thick" : "edge-thickness-normal", y = r.pattern === "dotted" ? "edge-pattern-dotted" : "edge-pattern-solid", v = `${w} ${y} flowchart-link LS-a1 LE-b1`;
2356
+ Vr(
2357
+ e,
2358
+ { v: r.start, w: r.end, name: b },
2359
+ {
2360
+ ...r,
2361
+ id: b,
2362
+ arrowTypeEnd: r.arrowTypeEnd,
2363
+ arrowTypeStart: r.arrowTypeStart,
2364
+ points: d,
2365
+ classes: v
2366
+ },
2367
+ void 0,
2368
+ "block",
2369
+ c,
2370
+ i
2371
+ ), r.label && (await Hr(e, {
2372
+ ...r,
2373
+ label: r.label,
2374
+ labelStyle: "stroke: #333; stroke-width: 1.5px;fill:none;",
2375
+ arrowTypeEnd: r.arrowTypeEnd,
2376
+ arrowTypeStart: r.arrowTypeStart,
2377
+ points: d,
2378
+ classes: v
2379
+ }), Kr(
2380
+ { ...r, x: d[1].x, y: d[1].y },
2381
+ {
2382
+ originalPath: d
2383
+ }
2384
+ ));
2385
+ }
2386
+ }
2387
+ }
2388
+ g(he, "insertEdges");
2389
+ var Ea = /* @__PURE__ */ g(function(e, t) {
2390
+ return t.db.getClasses();
2391
+ }, "getClasses"), _a = /* @__PURE__ */ g(async function(e, t, a, s) {
2392
+ const { securityLevel: i, block: c } = rt(), r = s.db;
2393
+ r.setDiagramId(t);
2394
+ let n;
2395
+ i === "sandbox" && (n = D("#i" + t));
2396
+ const l = i === "sandbox" ? D(n.nodes()[0].contentDocument.body) : D("body"), u = i === "sandbox" ? l.select(`[id="${t}"]`) : D(`[id="${t}"]`);
2397
+ Mr(u, ["point", "circle", "cross"], s.type, t);
2398
+ const d = r.getBlocks(), b = r.getBlocksFlat(), w = r.getEdges(), y = u.insert("g").attr("class", "block");
2399
+ await le(y, d, r);
2400
+ const v = Qt(r);
2401
+ if (await oe(y, d, r), await he(y, w, b, r, t), v) {
2402
+ const S = v, N = Math.max(1, Math.round(0.125 * (S.width / S.height))), _ = S.height + N + 10, T = S.width + 10, { useMaxWidth: m } = c;
2403
+ Pe(u, _, T, !!m), k.debug("Here Bounds", v, S), u.attr(
2404
+ "viewBox",
2405
+ `${S.x - 5} ${S.y - 5} ${S.width + 10} ${S.height + 10}`
2406
+ );
2407
+ }
2408
+ }, "draw"), Ta = {
2409
+ draw: _a,
2410
+ getClasses: Ea
2411
+ }, Ca = {
2412
+ parser: ar,
2413
+ db: kr,
2414
+ renderer: Ta,
2415
+ styles: Er
2416
+ };
2417
+ export {
2418
+ Ca as diagram
2419
+ };