@loopstack/loopstack-studio 0.25.0 → 0.25.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (196) hide show
  1. package/dist/components/ai-elements/message.js +2 -2
  2. package/dist/components/ai-elements/reasoning.js +9 -9
  3. package/dist/loopstack-studio.css +1 -1
  4. package/dist/node_modules/@chevrotain/gast/lib/src/helpers.js +2 -5
  5. package/dist/node_modules/@chevrotain/gast/lib/src/model.js +69 -72
  6. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{architecture-7HQA4BMR.js → architecture-YZFGNWBL.js} +2 -2
  7. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-TQ3KTPDO.js → chunk-2KRD3SAO.js} +1 -1
  8. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-4F5CHEZ2.js → chunk-67CJDMHE.js} +1 -1
  9. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-UMXZTB3W.js → chunk-7N4EOEYR.js} +5 -2
  10. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-PL6DKKU2.js → chunk-AA7GKIK3.js} +1 -1
  11. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-CIAEETIT.js +23 -0
  12. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-SJTYNZTY.js → chunk-FOC6F5B3.js} +1 -1
  13. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-K5T4RW27.js +1197 -0
  14. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-FRFDVMJY.js → chunk-KGLVRYIC.js} +1 -1
  15. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-B2363JML.js → chunk-LIHQZDEY.js} +1 -1
  16. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-ORNJ4GCN.js +29 -0
  17. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{gitGraph-G5XIXVHT.js → gitGraph-7Q5UKJZL.js} +2 -2
  18. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/info-OMHHGYJF.js +3 -0
  19. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/packet-4T2RLAQJ.js +3 -0
  20. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/pie-ZZUOXDRM.js +3 -0
  21. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/radar-PYXPWWZC.js +3 -0
  22. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/treeView-SZITEDCU.js +3 -0
  23. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/treemap-W4RFUUIX.js +3 -0
  24. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/wardley-RL74JXVD.js +3 -0
  25. package/dist/node_modules/@mermaid-js/parser/dist/mermaid-parser.core.js +27 -17
  26. package/dist/node_modules/@upsetjs/venn.js/build/venn.esm.js +903 -0
  27. package/dist/node_modules/@xyflow/react/dist/esm/index.js +76 -75
  28. package/dist/node_modules/@xyflow/system/dist/esm/index.js +30 -28
  29. package/dist/node_modules/chevrotain/lib/src/parse/cst/cst_visitor.js +31 -40
  30. package/dist/node_modules/chevrotain/lib/src/parse/errors_public.js +23 -26
  31. package/dist/node_modules/chevrotain/lib/src/parse/exceptions_public.js +12 -13
  32. package/dist/node_modules/chevrotain/lib/src/parse/grammar/checks.js +181 -205
  33. package/dist/node_modules/chevrotain/lib/src/parse/grammar/first.js +11 -13
  34. package/dist/node_modules/chevrotain/lib/src/parse/grammar/follow.js +12 -13
  35. package/dist/node_modules/chevrotain/lib/src/parse/grammar/gast/gast_resolver_public.js +8 -9
  36. package/dist/node_modules/chevrotain/lib/src/parse/grammar/interpreter.js +176 -183
  37. package/dist/node_modules/chevrotain/lib/src/parse/grammar/llk_lookahead.js +17 -19
  38. package/dist/node_modules/chevrotain/lib/src/parse/grammar/lookahead.js +153 -160
  39. package/dist/node_modules/chevrotain/lib/src/parse/grammar/resolver.js +10 -12
  40. package/dist/node_modules/chevrotain/lib/src/parse/grammar/rest.js +36 -38
  41. package/dist/node_modules/chevrotain/lib/src/parse/parser/parser.js +37 -45
  42. package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/error_handler.js +12 -14
  43. package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/gast_recorder.js +80 -86
  44. package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/lexer_adapter.js +6 -2
  45. package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/looksahead.js +39 -41
  46. package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/perf_tracer.js +7 -8
  47. package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/recognizer_api.js +69 -70
  48. package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/recognizer_engine.js +215 -205
  49. package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/recoverable.js +76 -76
  50. package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/tree_builder.js +29 -39
  51. package/dist/node_modules/chevrotain/lib/src/scan/lexer.js +252 -274
  52. package/dist/node_modules/chevrotain/lib/src/scan/lexer_public.js +93 -106
  53. package/dist/node_modules/chevrotain/lib/src/scan/reg_exp.js +61 -61
  54. package/dist/node_modules/chevrotain/lib/src/scan/tokens.js +31 -41
  55. package/dist/node_modules/chevrotain/lib/src/scan/tokens_public.js +15 -18
  56. package/dist/node_modules/chevrotain-allstar/lib/all-star-lookahead.js +226 -226
  57. package/dist/node_modules/chevrotain-allstar/lib/atn.js +17 -17
  58. package/dist/node_modules/cytoscape/dist/cytoscape.esm.js +17 -14
  59. package/dist/node_modules/dagre-d3-es/src/dagre/greedy-fas.js +19 -19
  60. package/dist/node_modules/dagre-d3-es/src/dagre/layout.js +48 -48
  61. package/dist/node_modules/dagre-d3-es/src/dagre/nesting-graph.js +9 -9
  62. package/dist/node_modules/dagre-d3-es/src/dagre/order/cross-count.js +3 -3
  63. package/dist/node_modules/dagre-d3-es/src/dagre/order/index.js +11 -11
  64. package/dist/node_modules/dagre-d3-es/src/dagre/order/init-order.js +4 -4
  65. package/dist/node_modules/dagre-d3-es/src/dagre/order/resolve-conflicts.js +4 -4
  66. package/dist/node_modules/dagre-d3-es/src/dagre/order/sort-subgraph.js +8 -8
  67. package/dist/node_modules/dagre-d3-es/src/dagre/order/sort.js +5 -5
  68. package/dist/node_modules/dagre-d3-es/src/dagre/position/bk.js +61 -61
  69. package/dist/node_modules/dagre-d3-es/src/dagre/position/index.js +1 -1
  70. package/dist/node_modules/dagre-d3-es/src/dagre/rank/network-simplex.js +25 -25
  71. package/dist/node_modules/dagre-d3-es/src/dagre/rank/util.js +8 -8
  72. package/dist/node_modules/dagre-d3-es/src/dagre/util.js +48 -48
  73. package/dist/node_modules/dagre-d3-es/src/graphlib/graph.js +109 -109
  74. package/dist/node_modules/dagre-d3-es/src/graphlib/json.js +17 -17
  75. package/dist/node_modules/dompurify/dist/purify.es.js +67 -67
  76. package/dist/node_modules/katex/dist/katex.js +1256 -1209
  77. package/dist/node_modules/khroma/dist/methods/transparentize.js +3 -0
  78. package/dist/node_modules/lodash-es/_baseClone.js +2 -2
  79. package/dist/node_modules/lodash-es/_baseMatchesProperty.js +6 -6
  80. package/dist/node_modules/lodash-es/_baseToString.js +1 -1
  81. package/dist/node_modules/lodash-es/_baseUniq.js +1 -1
  82. package/dist/node_modules/lodash-es/_createSet.js +1 -1
  83. package/dist/node_modules/lodash-es/_getAllKeys.js +2 -2
  84. package/dist/node_modules/lodash-es/_getAllKeysIn.js +1 -1
  85. package/dist/node_modules/lodash-es/findIndex.js +2 -2
  86. package/dist/node_modules/lodash-es/flatMap.js +1 -1
  87. package/dist/node_modules/lodash-es/forEach.js +1 -1
  88. package/dist/node_modules/lodash-es/max.js +1 -1
  89. package/dist/node_modules/lodash-es/min.js +1 -1
  90. package/dist/node_modules/lodash-es/minBy.js +1 -1
  91. package/dist/node_modules/lodash-es/reduce.js +1 -1
  92. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/architectureDiagram-Q4EWVU46.js +691 -0
  93. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{blockDiagram-VD42YOAC.js → blockDiagram-DXYQGD6D.js} +183 -157
  94. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{c4Diagram-YG6GDRKO.js → c4Diagram-AHTNJAMY.js} +65 -63
  95. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-336JU56O.js +47 -0
  96. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-EXTU4WIE.js → chunk-426QAEUC.js} +1 -1
  97. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-B4BG7PRW.js → chunk-4TB4RGXK.js} +533 -393
  98. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-5FUZZQ4R.js +3638 -0
  99. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-S3R3BYOJ.js → chunk-5PVQY5BW.js} +1 -1
  100. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-HN2XXSSU.js → chunk-BSJP7CBP.js} +20 -14
  101. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-QN33PNHL.js → chunk-EDXVE4YY.js} +1 -1
  102. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-ENJZ2VHE.js +568 -0
  103. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-ICPOFSXX.js +2320 -0
  104. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-DI55MBZ5.js → chunk-OYMX7WX6.js} +35 -21
  105. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-U2HBQHQK.js +272 -0
  106. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-ATLVNIR6.js → chunk-X2U36JSP.js} +1 -1
  107. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-MI3HLSF2.js → chunk-XPW4576I.js} +11 -7
  108. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-YZCP3GAM.js +60 -0
  109. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-ZZ45TVLE.js +30 -0
  110. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{classDiagram-2ON5EDUG.js → classDiagram-6PBFFD2Q.js} +12 -11
  111. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{classDiagram-v2-WZHVMYZB.js → classDiagram-v2-HSJHXN6E.js} +12 -11
  112. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{dagre-6UL2VRFP.js → dagre-KV5264BT.js} +8 -8
  113. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/diagram-5BDNPKRD.js +99 -0
  114. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{diagram-PSM6KHXK.js → diagram-G4DWMVQ6.js} +20 -23
  115. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/diagram-MMDJMWI5.js +211 -0
  116. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{diagram-S2PKOQOG.js → diagram-TYMM5635.js} +4 -4
  117. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{erDiagram-Q2GNP2WA.js → erDiagram-SMLLAGMA.js} +486 -386
  118. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{flowDiagram-NV44I4VS.js → flowDiagram-DWJPFMVM.js} +915 -898
  119. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{ganttDiagram-JELNMOA3.js → ganttDiagram-T4ZO3ILL.js} +59 -29
  120. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/gitGraphDiagram-UUTBAWPF.js +728 -0
  121. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/infoDiagram-42DDH7IO.js +17 -0
  122. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/ishikawaDiagram-UXIWVN3A.js +714 -0
  123. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{journeyDiagram-XKPGCS4Q.js → journeyDiagram-VCZTEJTY.js} +32 -32
  124. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{kanban-definition-3W4ZIXB7.js → kanban-definition-6JOO6SKY.js} +13 -9
  125. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{mindmap-definition-VGOIOE7T.js → mindmap-definition-QFDTVHPH.js} +105 -59
  126. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/pieDiagram-DEJITSTG.js +117 -0
  127. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{quadrantDiagram-AYHSOK5B.js → quadrantDiagram-34T5L4WZ.js} +1 -1
  128. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{requirementDiagram-UZGBJVZJ.js → requirementDiagram-MS252O5E.js} +49 -19
  129. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{sankeyDiagram-TZEHDZUN.js → sankeyDiagram-XADWPNL6.js} +1 -1
  130. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-FGHM5R23.js +4155 -0
  131. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{stateDiagram-FKZM4ZOC.js → stateDiagram-FHFEXIEX.js} +12 -12
  132. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{stateDiagram-v2-4FDKWEC3.js → stateDiagram-v2-QKLJ7IA2.js} +11 -11
  133. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/timeline-definition-GMOUNBTQ.js +1071 -0
  134. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/vennDiagram-DHZGUBPP.js +959 -0
  135. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/wardleyDiagram-NUSXRM2D.js +574 -0
  136. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{xychartDiagram-PRI3JC2R.js → xychartDiagram-5P7HB3ND.js} +38 -35
  137. package/dist/node_modules/mermaid/dist/mermaid.core.js +235 -192
  138. package/dist/node_modules/nanoid/url-alphabet/index.js +1 -1
  139. package/dist/node_modules/remend/dist/index.js +333 -264
  140. package/dist/node_modules/streamdown/dist/chunk-BO2N2NFS.js +2498 -0
  141. package/dist/node_modules/streamdown/dist/highlighted-body-OFNGDK62.js +35 -0
  142. package/dist/node_modules/streamdown/dist/index.js +1 -1
  143. package/dist/node_modules/streamdown/dist/mermaid-GHXKKRXX.js +3 -0
  144. package/dist/node_modules/streamdown/node_modules/marked/lib/marked.esm.js +672 -667
  145. package/dist/pages/DashboardPage.js +3 -3
  146. package/package.json +2 -2
  147. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-TCCFYFTB.js +0 -787
  148. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/info-VBDWY6EO.js +0 -3
  149. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/packet-DYOGHKS2.js +0 -3
  150. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/pie-VRWISCQL.js +0 -3
  151. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/radar-ZZBFDIW7.js +0 -3
  152. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/treemap-GDKQZRPO.js +0 -3
  153. package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/context_assist.js +0 -16
  154. package/dist/node_modules/lodash-es/_arrayAggregator.js +0 -9
  155. package/dist/node_modules/lodash-es/_arrayEvery.js +0 -6
  156. package/dist/node_modules/lodash-es/_baseAggregator.js +0 -8
  157. package/dist/node_modules/lodash-es/_baseDifference.js +0 -22
  158. package/dist/node_modules/lodash-es/_baseEvery.js +0 -9
  159. package/dist/node_modules/lodash-es/_baseIsRegExp.js +0 -8
  160. package/dist/node_modules/lodash-es/_baseSlice.js +0 -8
  161. package/dist/node_modules/lodash-es/_baseSome.js +0 -9
  162. package/dist/node_modules/lodash-es/_createAggregator.js +0 -12
  163. package/dist/node_modules/lodash-es/assign.js +0 -14
  164. package/dist/node_modules/lodash-es/compact.js +0 -9
  165. package/dist/node_modules/lodash-es/difference.js +0 -8
  166. package/dist/node_modules/lodash-es/drop.js +0 -8
  167. package/dist/node_modules/lodash-es/dropRight.js +0 -8
  168. package/dist/node_modules/lodash-es/every.js +0 -11
  169. package/dist/node_modules/lodash-es/groupBy.js +0 -6
  170. package/dist/node_modules/lodash-es/head.js +0 -5
  171. package/dist/node_modules/lodash-es/includes.js +0 -13
  172. package/dist/node_modules/lodash-es/indexOf.js +0 -11
  173. package/dist/node_modules/lodash-es/isRegExp.js +0 -5
  174. package/dist/node_modules/lodash-es/negate.js +0 -16
  175. package/dist/node_modules/lodash-es/pickBy.js +0 -15
  176. package/dist/node_modules/lodash-es/reject.js +0 -10
  177. package/dist/node_modules/lodash-es/some.js +0 -11
  178. package/dist/node_modules/lodash-es/uniq.js +0 -6
  179. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/architectureDiagram-VXUJARFQ.js +0 -673
  180. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-ABZYJK2D.js +0 -1547
  181. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-CVBHYZKI.js +0 -10
  182. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-DR5Q36YT.js +0 -135
  183. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-JA3XYJ7Z.js +0 -247
  184. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-JZLCHNYA.js +0 -3516
  185. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-N4CR4FBY.js +0 -39
  186. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-QXUST7PY.js +0 -497
  187. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-TZMSLE5B.js +0 -55
  188. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/diagram-QEK2KX5R.js +0 -211
  189. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/gitGraphDiagram-V2S2FVAM.js +0 -621
  190. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/infoDiagram-HS3SLOUP.js +0 -18
  191. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/pieDiagram-ADFJNKIX.js +0 -117
  192. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-WL72ISMW.js +0 -3560
  193. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/timeline-definition-IT6M3QCI.js +0 -833
  194. package/dist/node_modules/streamdown/dist/chunk-RLXIAIE6.js +0 -2189
  195. package/dist/node_modules/streamdown/dist/highlighted-body-B3W2YXNL.js +0 -33
  196. package/dist/node_modules/streamdown/dist/mermaid-3ZIDBTTL.js +0 -3
@@ -0,0 +1,3638 @@
1
+ import { __name, log } from "./chunk-AGHRB4JF.js";
2
+ import { evaluate, getConfig, getConfig2, getEffectiveHtmlLabels, hasKatex, parseGenericTypes, sanitizeText, sanitizeText3 } from "./chunk-ICPOFSXX.js";
3
+ import select_default from "../../../../d3-selection/src/select.js";
4
+ import "../../../../d3/src/index.js";
5
+ import { calculateTextWidth, decodeEntities, handleUndefinedAttr } from "./chunk-5PVQY5BW.js";
6
+ import { configureLabelImages, getSubGraphTitleMargins } from "./chunk-ZZ45TVLE.js";
7
+ import { compileStyles, solidStateFill, styles2String, userNodeOverrides } from "./chunk-X2U36JSP.js";
8
+ import { createText, getIconSVG } from "./chunk-U2HBQHQK.js";
9
+ import { at } from "../../../../roughjs/bundled/rough.esm.js";
10
+ var labelHelper = /* @__PURE__ */ __name(async (e, a, s) => {
11
+ let l, u = a.useHtmlLabels || evaluate(getConfig2()?.htmlLabels);
12
+ l = s || "node default";
13
+ let d = e.insert("g").attr("class", l).attr("id", a.domId || a.id), p = d.insert("g").attr("class", "label").attr("style", handleUndefinedAttr(a.labelStyle)), h;
14
+ h = a.label === void 0 ? "" : typeof a.label == "string" ? a.label : a.label[0];
15
+ let y = !!a.icon || !!a.img, b = a.labelType === "markdown", x = await createText(p, sanitizeText(decodeEntities(h), getConfig2()), {
16
+ useHtmlLabels: u,
17
+ width: a.width || getConfig2().flowchart?.wrappingWidth,
18
+ classes: b ? "markdown-node-label" : "",
19
+ style: a.labelStyle,
20
+ addSvgBackground: y,
21
+ markdown: b
22
+ }, getConfig2()), S = x.getBBox(), C = (a?.padding ?? 0) / 2;
23
+ if (u) {
24
+ let e = x.children[0], a = select_default(x);
25
+ await configureLabelImages(e, h), S = e.getBoundingClientRect(), a.attr("width", S.width), a.attr("height", S.height);
26
+ }
27
+ return u ? p.attr("transform", "translate(" + -S.width / 2 + ", " + -S.height / 2 + ")") : p.attr("transform", "translate(0, " + -S.height / 2 + ")"), a.centerLabel && p.attr("transform", "translate(" + -S.width / 2 + ", " + -S.height / 2 + ")"), p.insert("rect", ":first-child"), {
28
+ shapeSvg: d,
29
+ bbox: S,
30
+ halfPadding: C,
31
+ label: p
32
+ };
33
+ }, "labelHelper"), insertLabel = /* @__PURE__ */ __name(async (e, a, o) => {
34
+ let s = o.useHtmlLabels ?? getEffectiveHtmlLabels(getConfig2()), u = e.insert("g").attr("class", "label").attr("style", o.labelStyle || ""), d = await createText(u, sanitizeText(decodeEntities(a), getConfig2()), {
35
+ useHtmlLabels: s,
36
+ width: o.width || getConfig2()?.flowchart?.wrappingWidth,
37
+ style: o.labelStyle,
38
+ addSvgBackground: !!o.icon || !!o.img
39
+ }), p = d.getBBox(), h = o.padding / 2;
40
+ if (getEffectiveHtmlLabels(getConfig2())) {
41
+ let e = d.children[0], a = select_default(d);
42
+ p = e.getBoundingClientRect(), a.attr("width", p.width), a.attr("height", p.height);
43
+ }
44
+ return s ? u.attr("transform", "translate(" + -p.width / 2 + ", " + -p.height / 2 + ")") : u.attr("transform", "translate(0, " + -p.height / 2 + ")"), o.centerLabel && u.attr("transform", "translate(" + -p.width / 2 + ", " + -p.height / 2 + ")"), u.insert("rect", ":first-child"), {
45
+ shapeSvg: e,
46
+ bbox: p,
47
+ halfPadding: h,
48
+ label: u
49
+ };
50
+ }, "insertLabel"), updateNodeBounds = /* @__PURE__ */ __name((e, a) => {
51
+ let o = a.node().getBBox();
52
+ e.width = o.width, e.height = o.height;
53
+ }, "updateNodeBounds"), getNodeClasses = /* @__PURE__ */ __name((e, a) => (e.look === "handDrawn" ? "rough-node" : "node") + " " + e.cssClasses + " " + (a || ""), "getNodeClasses");
54
+ function createPathFromPoints(e) {
55
+ let a = e.map((e, a) => `${a === 0 ? "M" : "L"}${e.x},${e.y}`);
56
+ return a.push("Z"), a.join(" ");
57
+ }
58
+ __name(createPathFromPoints, "createPathFromPoints");
59
+ function generateFullSineWavePoints(e, a, o, s, c, l) {
60
+ let u = [], d = o - e, f = s - a, p = d / l, m = 2 * Math.PI / p, h = a + f / 2;
61
+ for (let a = 0; a <= 50; a++) {
62
+ let o = e + a / 50 * d, s = h + c * Math.sin(m * (o - e));
63
+ u.push({
64
+ x: o,
65
+ y: s
66
+ });
67
+ }
68
+ return u;
69
+ }
70
+ __name(generateFullSineWavePoints, "generateFullSineWavePoints");
71
+ function generateCirclePoints(e, a, o, s, c, l) {
72
+ let u = [], d = c * Math.PI / 180, f = (l * Math.PI / 180 - d) / (s - 1);
73
+ for (let c = 0; c < s; c++) {
74
+ let s = d + c * f, l = e + o * Math.cos(s), p = a + o * Math.sin(s);
75
+ u.push({
76
+ x: -l,
77
+ y: -p
78
+ });
79
+ }
80
+ return u;
81
+ }
82
+ __name(generateCirclePoints, "generateCirclePoints");
83
+ function mergePaths(a) {
84
+ let o = Array.from(a.childNodes).filter((e) => e.tagName === "path"), s = document.createElementNS("http://www.w3.org/2000/svg", "path"), c = o.map((e) => e.getAttribute("d")).filter((e) => e !== null).join(" ");
85
+ s.setAttribute("d", c);
86
+ let l = o.find((e) => e.getAttribute("fill") !== "none"), u = o.find((e) => e.getAttribute("stroke") !== "none"), d = /* @__PURE__ */ __name((e, a) => e?.getAttribute(a) ?? void 0, "getAttr");
87
+ if (l) {
88
+ let e = {
89
+ fill: d(l, "fill"),
90
+ "fill-opacity": d(l, "fill-opacity") ?? "1"
91
+ };
92
+ Object.entries(e).forEach(([e, a]) => {
93
+ a && s.setAttribute(e, a);
94
+ });
95
+ }
96
+ if (u) {
97
+ let e = {
98
+ stroke: d(u, "stroke"),
99
+ "stroke-width": d(u, "stroke-width") ?? "1",
100
+ "stroke-opacity": d(u, "stroke-opacity") ?? "1"
101
+ };
102
+ Object.entries(e).forEach(([e, a]) => {
103
+ a && s.setAttribute(e, a);
104
+ });
105
+ }
106
+ let f = document.createElementNS("http://www.w3.org/2000/svg", "g");
107
+ return f.appendChild(s), f;
108
+ }
109
+ __name(mergePaths, "mergePaths");
110
+ var intersect_rect_default = /* @__PURE__ */ __name((e, a) => {
111
+ var o = e.x, s = e.y, c = a.x - o, l = a.y - s, u = e.width / 2, d = e.height / 2, f, p;
112
+ return Math.abs(l) * u > Math.abs(c) * d ? (l < 0 && (d = -d), f = l === 0 ? 0 : d * c / l, p = d) : (c < 0 && (u = -u), f = u, p = c === 0 ? 0 : u * l / c), {
113
+ x: o + f,
114
+ y: s + p
115
+ };
116
+ }, "intersectRect"), createLabel_default = /* @__PURE__ */ __name(async (e, a, o, s = !1, u = !1) => {
117
+ let d = a || "";
118
+ typeof d == "object" && (d = d[0]);
119
+ let f = getConfig2(), p = getEffectiveHtmlLabels(f);
120
+ return await createText(e, d, {
121
+ style: o,
122
+ isTitle: s,
123
+ useHtmlLabels: p,
124
+ markdown: !1,
125
+ isNode: u,
126
+ width: Infinity
127
+ }, f);
128
+ }, "createLabel"), createRoundedRectPathD = /* @__PURE__ */ __name((e, a, o, s, c) => [
129
+ "M",
130
+ e + c,
131
+ a,
132
+ "H",
133
+ e + o - c,
134
+ "A",
135
+ c,
136
+ c,
137
+ 0,
138
+ 0,
139
+ 1,
140
+ e + o,
141
+ a + c,
142
+ "V",
143
+ a + s - c,
144
+ "A",
145
+ c,
146
+ c,
147
+ 0,
148
+ 0,
149
+ 1,
150
+ e + o - c,
151
+ a + s,
152
+ "H",
153
+ e + c,
154
+ "A",
155
+ c,
156
+ c,
157
+ 0,
158
+ 0,
159
+ 1,
160
+ e,
161
+ a + s - c,
162
+ "V",
163
+ a + c,
164
+ "A",
165
+ c,
166
+ c,
167
+ 0,
168
+ 0,
169
+ 1,
170
+ e + c,
171
+ a,
172
+ "Z"
173
+ ].join(" "), "createRoundedRectPathD"), rect = /* @__PURE__ */ __name(async (e, o) => {
174
+ log.info("Creating subgraph rect for ", o.id, o);
175
+ let s = getConfig2(), { themeVariables: u, handDrawnSeed: d } = s, { clusterBkg: f, clusterBorder: p } = u, { labelStyles: h, nodeStyles: g, borderStyles: _, backgroundStyles: v } = styles2String(o), b = e.insert("g").attr("class", "cluster " + o.cssClasses).attr("id", o.domId).attr("data-look", o.look), x = getEffectiveHtmlLabels(s), T = b.insert("g").attr("class", "cluster-label "), E;
176
+ E = o.labelType === "markdown" ? await createText(T, o.label, {
177
+ style: o.labelStyle,
178
+ useHtmlLabels: x,
179
+ isNode: !0,
180
+ width: o.width
181
+ }) : await createLabel_default(T, o.label, o.labelStyle || "", !1, !0);
182
+ let D = E.getBBox();
183
+ if (getEffectiveHtmlLabels(s)) {
184
+ let e = E.children[0], a = select_default(E);
185
+ D = e.getBoundingClientRect(), a.attr("width", D.width), a.attr("height", D.height);
186
+ }
187
+ let O = o.width <= D.width + o.padding ? D.width + o.padding : o.width;
188
+ o.width <= D.width + o.padding ? o.diff = (O - o.width) / 2 - o.padding : o.diff = -o.padding;
189
+ let k = o.height, A = o.x - O / 2, j = o.y - k / 2;
190
+ log.trace("Data ", o, JSON.stringify(o));
191
+ let M;
192
+ if (o.look === "handDrawn") {
193
+ let e = at.svg(b), s = userNodeOverrides(o, {
194
+ roughness: .7,
195
+ fill: f,
196
+ stroke: p,
197
+ fillWeight: 3,
198
+ seed: d
199
+ }), c = e.path(createRoundedRectPathD(A, j, O, k, 0), s);
200
+ M = b.insert(() => (log.debug("Rough node insert CXC", c), c), ":first-child"), M.select("path:nth-child(2)").attr("style", _.join(";")), M.select("path").attr("style", v.join(";").replace("fill", "stroke"));
201
+ } else M = b.insert("rect", ":first-child"), M.attr("style", g).attr("rx", o.rx).attr("ry", o.ry).attr("x", A).attr("y", j).attr("width", O).attr("height", k);
202
+ let { subGraphTitleTopMargin: N } = getSubGraphTitleMargins(s);
203
+ if (T.attr("transform", `translate(${o.x - D.width / 2}, ${o.y - o.height / 2 + N})`), h) {
204
+ let e = T.select("span");
205
+ e && e.attr("style", h);
206
+ }
207
+ let L = M.node().getBBox();
208
+ return o.offsetX = 0, o.width = L.width, o.height = L.height, o.offsetY = D.height - o.padding / 2, o.intersect = function(e) {
209
+ return intersect_rect_default(o, e);
210
+ }, {
211
+ cluster: b,
212
+ labelBBox: D
213
+ };
214
+ }, "rect"), shapes = {
215
+ rect,
216
+ squareRect: rect,
217
+ roundedWithTitle: /* @__PURE__ */ __name(async (e, a) => {
218
+ let o = getConfig2(), { themeVariables: s, handDrawnSeed: u } = o, { altBackground: d, compositeBackground: f, compositeTitleBackground: p, nodeBorder: h } = s, g = e.insert("g").attr("class", a.cssClasses).attr("id", a.domId).attr("data-id", a.id).attr("data-look", a.look), _ = g.insert("g", ":first-child"), v = g.insert("g").attr("class", "cluster-label"), y = g.append("rect"), b = await createLabel_default(v, a.label, a.labelStyle, void 0, !0), x = b.getBBox();
219
+ if (getEffectiveHtmlLabels(o)) {
220
+ let e = b.children[0], a = select_default(b);
221
+ x = e.getBoundingClientRect(), a.attr("width", x.width), a.attr("height", x.height);
222
+ }
223
+ let S = 0 * a.padding, C = S / 2, w = (a.width <= x.width + a.padding ? x.width + a.padding : a.width) + S;
224
+ a.width <= x.width + a.padding ? a.diff = (w - a.width) / 2 - a.padding : a.diff = -a.padding;
225
+ let T = a.height + S, E = a.height + S - x.height - 6, D = a.x - w / 2, O = a.y - T / 2;
226
+ a.width = w;
227
+ let k = a.y - a.height / 2 - C + x.height + 2, A;
228
+ if (a.look === "handDrawn") {
229
+ let e = a.cssClasses.includes("statediagram-cluster-alt"), o = at.svg(g), s = a.rx || a.ry ? o.path(createRoundedRectPathD(D, O, w, T, 10), {
230
+ roughness: .7,
231
+ fill: p,
232
+ fillStyle: "solid",
233
+ stroke: h,
234
+ seed: u
235
+ }) : o.rectangle(D, O, w, T, { seed: u });
236
+ A = g.insert(() => s, ":first-child");
237
+ let c = o.rectangle(D, k, w, E, {
238
+ fill: e ? d : f,
239
+ fillStyle: e ? "hachure" : "solid",
240
+ stroke: h,
241
+ seed: u
242
+ });
243
+ A = g.insert(() => s, ":first-child"), y = g.insert(() => c);
244
+ } else A = _.insert("rect", ":first-child"), A.attr("class", "outer").attr("x", D).attr("y", O).attr("width", w).attr("height", T).attr("data-look", a.look), y.attr("class", "inner").attr("x", D).attr("y", k).attr("width", w).attr("height", E);
245
+ return v.attr("transform", `translate(${a.x - x.width / 2}, ${O + 1 - (getEffectiveHtmlLabels(o) ? 0 : 3)})`), a.height = A.node().getBBox().height, a.offsetX = 0, a.offsetY = x.height - a.padding / 2, a.labelBBox = x, a.intersect = function(e) {
246
+ return intersect_rect_default(a, e);
247
+ }, {
248
+ cluster: g,
249
+ labelBBox: x
250
+ };
251
+ }, "roundedWithTitle"),
252
+ noteGroup: /* @__PURE__ */ __name((e, a) => {
253
+ let o = e.insert("g").attr("class", "note-cluster").attr("id", a.domId), s = o.insert("rect", ":first-child"), c = 0 * a.padding, l = c / 2;
254
+ s.attr("rx", a.rx).attr("ry", a.ry).attr("x", a.x - a.width / 2 - l).attr("y", a.y - a.height / 2 - l).attr("width", a.width + c).attr("height", a.height + c).attr("fill", "none");
255
+ let u = s.node().getBBox();
256
+ return a.width = u.width, a.height = u.height, a.intersect = function(e) {
257
+ return intersect_rect_default(a, e);
258
+ }, {
259
+ cluster: o,
260
+ labelBBox: {
261
+ width: 0,
262
+ height: 0
263
+ }
264
+ };
265
+ }, "noteGroup"),
266
+ divider: /* @__PURE__ */ __name((e, a) => {
267
+ let { themeVariables: o, handDrawnSeed: s } = getConfig2(), { nodeBorder: l } = o, u = e.insert("g").attr("class", a.cssClasses).attr("id", a.domId).attr("data-look", a.look), d = u.insert("g", ":first-child"), f = 0 * a.padding, p = a.width + f;
268
+ a.diff = -a.padding;
269
+ let m = a.height + f, h = a.x - p / 2, g = a.y - m / 2;
270
+ a.width = p;
271
+ let _;
272
+ if (a.look === "handDrawn") {
273
+ let e = at.svg(u).rectangle(h, g, p, m, {
274
+ fill: "lightgrey",
275
+ roughness: .5,
276
+ strokeLineDash: [5],
277
+ stroke: l,
278
+ seed: s
279
+ });
280
+ _ = u.insert(() => e, ":first-child");
281
+ } else {
282
+ _ = d.insert("rect", ":first-child");
283
+ let e = "outer";
284
+ e = (a.look, "divider"), _.attr("class", e).attr("x", h).attr("y", g).attr("width", p).attr("height", m).attr("data-look", a.look);
285
+ }
286
+ return a.height = _.node().getBBox().height, a.offsetX = 0, a.offsetY = 0, a.intersect = function(e) {
287
+ return intersect_rect_default(a, e);
288
+ }, {
289
+ cluster: u,
290
+ labelBBox: {}
291
+ };
292
+ }, "divider"),
293
+ kanbanSection: /* @__PURE__ */ __name(async (e, o) => {
294
+ log.info("Creating subgraph rect for ", o.id, o);
295
+ let s = getConfig2(), { themeVariables: u, handDrawnSeed: d } = s, { clusterBkg: f, clusterBorder: p } = u, { labelStyles: h, nodeStyles: g, borderStyles: _, backgroundStyles: v } = styles2String(o), b = e.insert("g").attr("class", "cluster " + o.cssClasses).attr("id", o.domId).attr("data-look", o.look), x = getEffectiveHtmlLabels(s), T = b.insert("g").attr("class", "cluster-label "), E = await createText(T, o.label, {
296
+ style: o.labelStyle,
297
+ useHtmlLabels: x,
298
+ isNode: !0,
299
+ width: o.width
300
+ }), D = E.getBBox();
301
+ if (getEffectiveHtmlLabels(s)) {
302
+ let e = E.children[0], a = select_default(E);
303
+ D = e.getBoundingClientRect(), a.attr("width", D.width), a.attr("height", D.height);
304
+ }
305
+ let O = o.width <= D.width + o.padding ? D.width + o.padding : o.width;
306
+ o.width <= D.width + o.padding ? o.diff = (O - o.width) / 2 - o.padding : o.diff = -o.padding;
307
+ let k = o.height, A = o.x - O / 2, j = o.y - k / 2;
308
+ log.trace("Data ", o, JSON.stringify(o));
309
+ let M;
310
+ if (o.look === "handDrawn") {
311
+ let e = at.svg(b), s = userNodeOverrides(o, {
312
+ roughness: .7,
313
+ fill: f,
314
+ stroke: p,
315
+ fillWeight: 4,
316
+ seed: d
317
+ }), c = e.path(createRoundedRectPathD(A, j, O, k, o.rx), s);
318
+ M = b.insert(() => (log.debug("Rough node insert CXC", c), c), ":first-child"), M.select("path:nth-child(2)").attr("style", _.join(";")), M.select("path").attr("style", v.join(";").replace("fill", "stroke"));
319
+ } else M = b.insert("rect", ":first-child"), M.attr("style", g).attr("rx", o.rx).attr("ry", o.ry).attr("x", A).attr("y", j).attr("width", O).attr("height", k);
320
+ let { subGraphTitleTopMargin: N } = getSubGraphTitleMargins(s);
321
+ if (T.attr("transform", `translate(${o.x - D.width / 2}, ${o.y - o.height / 2 + N})`), h) {
322
+ let e = T.select("span");
323
+ e && e.attr("style", h);
324
+ }
325
+ let F = M.node().getBBox();
326
+ return o.offsetX = 0, o.width = F.width, o.height = F.height, o.offsetY = D.height - o.padding / 2, o.intersect = function(e) {
327
+ return intersect_rect_default(o, e);
328
+ }, {
329
+ cluster: b,
330
+ labelBBox: D
331
+ };
332
+ }, "kanbanSection")
333
+ }, clusterElems = /* @__PURE__ */ new Map(), insertCluster = /* @__PURE__ */ __name(async (e, a) => {
334
+ let o = await shapes[a.shape || "rect"](e, a);
335
+ return clusterElems.set(a.id, o), o;
336
+ }, "insertCluster"), clear = /* @__PURE__ */ __name(() => {
337
+ clusterElems = /* @__PURE__ */ new Map();
338
+ }, "clear");
339
+ function intersectNode(e, a) {
340
+ return e.intersect(a);
341
+ }
342
+ __name(intersectNode, "intersectNode");
343
+ var intersect_node_default = intersectNode;
344
+ function intersectEllipse(e, a, o, s) {
345
+ var c = e.x, l = e.y, u = c - s.x, d = l - s.y, f = Math.sqrt(a * a * d * d + o * o * u * u), p = Math.abs(a * o * u / f);
346
+ s.x < c && (p = -p);
347
+ var m = Math.abs(a * o * d / f);
348
+ return s.y < l && (m = -m), {
349
+ x: c + p,
350
+ y: l + m
351
+ };
352
+ }
353
+ __name(intersectEllipse, "intersectEllipse");
354
+ var intersect_ellipse_default = intersectEllipse;
355
+ function intersectCircle(e, a, o) {
356
+ return intersect_ellipse_default(e, a, a, o);
357
+ }
358
+ __name(intersectCircle, "intersectCircle");
359
+ var intersect_circle_default = intersectCircle;
360
+ function intersectLine(e, a, o, s) {
361
+ {
362
+ let c = a.y - e.y, l = e.x - a.x, u = a.x * e.y - e.x * a.y, d = c * o.x + l * o.y + u, f = c * s.x + l * s.y + u, p = 1e-6;
363
+ if (d !== 0 && f !== 0 && sameSign(d, f)) return;
364
+ let m = s.y - o.y, h = o.x - s.x, g = s.x * o.y - o.x * s.y, _ = m * e.x + h * e.y + g, v = m * a.x + h * a.y + g;
365
+ if (Math.abs(_) < p && Math.abs(v) < p && sameSign(_, v)) return;
366
+ let y = c * h - m * l;
367
+ if (y === 0) return;
368
+ let b = Math.abs(y / 2), x = l * g - h * u, S = x < 0 ? (x - b) / y : (x + b) / y;
369
+ return x = m * u - c * g, {
370
+ x: S,
371
+ y: x < 0 ? (x - b) / y : (x + b) / y
372
+ };
373
+ }
374
+ }
375
+ __name(intersectLine, "intersectLine");
376
+ function sameSign(e, a) {
377
+ return e * a > 0;
378
+ }
379
+ __name(sameSign, "sameSign");
380
+ var intersect_line_default = intersectLine;
381
+ function intersectPolygon(e, a, o) {
382
+ let s = e.x, c = e.y, l = [], u = Infinity, d = Infinity;
383
+ typeof a.forEach == "function" ? a.forEach(function(e) {
384
+ u = Math.min(u, e.x), d = Math.min(d, e.y);
385
+ }) : (u = Math.min(u, a.x), d = Math.min(d, a.y));
386
+ let f = s - e.width / 2 - u, p = c - e.height / 2 - d;
387
+ for (let s = 0; s < a.length; s++) {
388
+ let c = a[s], u = a[s < a.length - 1 ? s + 1 : 0], d = intersect_line_default(e, o, {
389
+ x: f + c.x,
390
+ y: p + c.y
391
+ }, {
392
+ x: f + u.x,
393
+ y: p + u.y
394
+ });
395
+ d && l.push(d);
396
+ }
397
+ return l.length ? (l.length > 1 && l.sort(function(e, a) {
398
+ let s = e.x - o.x, c = e.y - o.y, l = Math.sqrt(s * s + c * c), u = a.x - o.x, d = a.y - o.y, f = Math.sqrt(u * u + d * d);
399
+ return l < f ? -1 : l === f ? 0 : 1;
400
+ }), l[0]) : e;
401
+ }
402
+ __name(intersectPolygon, "intersectPolygon");
403
+ var intersect_default = {
404
+ node: intersect_node_default,
405
+ circle: intersect_circle_default,
406
+ ellipse: intersect_ellipse_default,
407
+ polygon: intersectPolygon,
408
+ rect: intersect_rect_default
409
+ };
410
+ function anchor(e, o) {
411
+ let { labelStyles: s } = styles2String(o);
412
+ o.labelStyle = s;
413
+ let c = getNodeClasses(o), l = c;
414
+ c || (l = "anchor");
415
+ let u = e.insert("g").attr("class", l).attr("id", o.domId || o.id), { cssStyles: d } = o, f = at.svg(u), p = userNodeOverrides(o, {
416
+ fill: "black",
417
+ stroke: "none",
418
+ fillStyle: "solid"
419
+ });
420
+ o.look !== "handDrawn" && (p.roughness = 0);
421
+ let m = f.circle(0, 0, 2, p), h = u.insert(() => m, ":first-child");
422
+ return h.attr("class", "anchor").attr("style", handleUndefinedAttr(d)), updateNodeBounds(o, h), o.intersect = function(e) {
423
+ return log.info("Circle intersect", o, 1, e), intersect_default.circle(o, 1, e);
424
+ }, u;
425
+ }
426
+ __name(anchor, "anchor");
427
+ function generateArcPoints(e, a, o, s, c, l, u) {
428
+ let d = (e + o) / 2, f = (a + s) / 2, p = Math.atan2(s - a, o - e), m = (o - e) / 2, h = (s - a) / 2, g = m / c, _ = h / l, v = Math.sqrt(g ** 2 + _ ** 2);
429
+ if (v > 1) throw Error("The given radii are too small to create an arc between the points.");
430
+ let y = Math.sqrt(1 - v ** 2), b = d + y * l * Math.sin(p) * (u ? -1 : 1), x = f - y * c * Math.cos(p) * (u ? -1 : 1), S = Math.atan2((a - x) / l, (e - b) / c), C = Math.atan2((s - x) / l, (o - b) / c) - S;
431
+ u && C < 0 && (C += 2 * Math.PI), !u && C > 0 && (C -= 2 * Math.PI);
432
+ let w = [];
433
+ for (let e = 0; e < 20; e++) {
434
+ let a = S + e / 19 * C, o = b + c * Math.cos(a), s = x + l * Math.sin(a);
435
+ w.push({
436
+ x: o,
437
+ y: s
438
+ });
439
+ }
440
+ return w;
441
+ }
442
+ __name(generateArcPoints, "generateArcPoints");
443
+ function calculateArcSagitta(e, a, o) {
444
+ let [s, c] = [a, o].sort((e, a) => a - e);
445
+ return c * (1 - Math.sqrt(1 - (e / s / 2) ** 2));
446
+ }
447
+ __name(calculateArcSagitta, "calculateArcSagitta");
448
+ async function bowTieRect(a, o) {
449
+ let { labelStyles: s, nodeStyles: c } = styles2String(o);
450
+ o.labelStyle = s;
451
+ let l = o.padding ?? 0, u = o.look === "neo" ? 16 : l, d = o.look === "neo" ? 12 : l, f = /* @__PURE__ */ __name((e) => e + d, "calcTotalHeight"), p = /* @__PURE__ */ __name((e) => {
452
+ let a = e / 2;
453
+ return [a / (2.5 + e / 50), a];
454
+ }, "calcEllipseRadius"), { shapeSvg: m, bbox: h } = await labelHelper(a, o, getNodeClasses(o)), g = f(o?.height ? o?.height : h.height), [_, v] = p(g), y = calculateArcSagitta(g, _, v), b = (o?.width ? o?.width : h.width) + u * 2 + y - y, x = g, { cssStyles: w } = o, T = [
455
+ {
456
+ x: b / 2,
457
+ y: -x / 2
458
+ },
459
+ {
460
+ x: -b / 2,
461
+ y: -x / 2
462
+ },
463
+ ...generateArcPoints(-b / 2, -x / 2, -b / 2, x / 2, _, v, !1),
464
+ {
465
+ x: b / 2,
466
+ y: x / 2
467
+ },
468
+ ...generateArcPoints(b / 2, x / 2, b / 2, -x / 2, _, v, !0)
469
+ ], D = at.svg(m), j = userNodeOverrides(o, {});
470
+ o.look !== "handDrawn" && (j.roughness = 0, j.fillStyle = "solid");
471
+ let M = createPathFromPoints(T), N = D.path(M, j), P = m.insert(() => N, ":first-child");
472
+ return P.attr("class", "basic label-container outer-path"), w && o.look !== "handDrawn" && P.selectAll("path").attr("style", w), c && o.look !== "handDrawn" && P.selectAll("path").attr("style", c), P.attr("transform", `translate(${_ / 2}, 0)`), updateNodeBounds(o, P), o.intersect = function(e) {
473
+ return intersect_default.polygon(o, T, e);
474
+ }, m;
475
+ }
476
+ __name(bowTieRect, "bowTieRect");
477
+ function insertPolygonShape(e, a, o, s) {
478
+ return e.insert("polygon", ":first-child").attr("points", s.map(function(e) {
479
+ return e.x + "," + e.y;
480
+ }).join(" ")).attr("class", "label-container").attr("transform", "translate(" + -a / 2 + "," + o / 2 + ")");
481
+ }
482
+ __name(insertPolygonShape, "insertPolygonShape");
483
+ var NOTCH_SIZE = 12;
484
+ async function card(e, a) {
485
+ let { labelStyles: o, nodeStyles: s } = styles2String(a);
486
+ a.labelStyle = o;
487
+ let c = a.padding ?? 0, l = a.look === "neo" ? 28 : c, u = a.look === "neo" ? 24 : c, { shapeSvg: d, bbox: f } = await labelHelper(e, a, getNodeClasses(a)), p = (a?.width ?? f.width) + (a.look === "neo" ? l * 2 : l + NOTCH_SIZE), m = (a?.height ?? f.height) + (a.look === "neo" ? u * 2 : u), h = p, g = -m, _ = [
488
+ {
489
+ x: 0 + NOTCH_SIZE,
490
+ y: g
491
+ },
492
+ {
493
+ x: h,
494
+ y: g
495
+ },
496
+ {
497
+ x: h,
498
+ y: 0
499
+ },
500
+ {
501
+ x: 0,
502
+ y: 0
503
+ },
504
+ {
505
+ x: 0,
506
+ y: g + NOTCH_SIZE
507
+ },
508
+ {
509
+ x: 0 + NOTCH_SIZE,
510
+ y: g
511
+ }
512
+ ], v, { cssStyles: y } = a;
513
+ if (a.look === "handDrawn") {
514
+ let e = at.svg(d), o = userNodeOverrides(a, {}), s = createPathFromPoints(_), c = e.path(s, o);
515
+ v = d.insert(() => c, ":first-child").attr("transform", `translate(${-p / 2}, ${m / 2})`), y && v.attr("style", y);
516
+ } else v = insertPolygonShape(d, p, m, _);
517
+ return s && v.attr("style", s), updateNodeBounds(a, v), a.intersect = function(e) {
518
+ return intersect_default.polygon(a, _, e);
519
+ }, d;
520
+ }
521
+ __name(card, "card");
522
+ function choice(e, a) {
523
+ let { nodeStyles: o } = styles2String(a);
524
+ a.label = "";
525
+ let s = e.insert("g").attr("class", getNodeClasses(a)).attr("id", a.domId ?? a.id), { cssStyles: c } = a, l = Math.max(28, a.width ?? 0), u = [
526
+ {
527
+ x: 0,
528
+ y: l / 2
529
+ },
530
+ {
531
+ x: l / 2,
532
+ y: 0
533
+ },
534
+ {
535
+ x: 0,
536
+ y: -l / 2
537
+ },
538
+ {
539
+ x: -l / 2,
540
+ y: 0
541
+ }
542
+ ], d = at.svg(s), f = userNodeOverrides(a, {});
543
+ a.look !== "handDrawn" && (f.roughness = 0, f.fillStyle = "solid");
544
+ let p = createPathFromPoints(u), m = d.path(p, f), h = s.insert(() => m, ":first-child");
545
+ return c && a.look !== "handDrawn" && h.selectAll("path").attr("style", c), o && a.look !== "handDrawn" && h.selectAll("path").attr("style", o), a.width = 28, a.height = 28, a.intersect = function(e) {
546
+ return intersect_default.polygon(a, u, e);
547
+ }, s;
548
+ }
549
+ __name(choice, "choice");
550
+ async function circle(e, o, s) {
551
+ let { labelStyles: c, nodeStyles: l } = styles2String(o);
552
+ o.labelStyle = c;
553
+ let { shapeSvg: u, bbox: d, halfPadding: f } = await labelHelper(e, o, getNodeClasses(o)), p = s?.padding ?? f, m = o.look === "neo" ? d.width / 2 + 32 : d.width / 2 + p, h, { cssStyles: g } = o;
554
+ if (o.look === "handDrawn") {
555
+ let e = at.svg(u), a = userNodeOverrides(o, {}), s = e.circle(0, 0, m * 2, a);
556
+ h = u.insert(() => s, ":first-child"), h.attr("class", "basic label-container").attr("style", handleUndefinedAttr(g));
557
+ } else h = u.insert("circle", ":first-child").attr("class", "basic label-container").attr("style", l).attr("r", m).attr("cx", 0).attr("cy", 0);
558
+ return updateNodeBounds(o, h), o.calcIntersect = function(e, a) {
559
+ let o = e.width / 2;
560
+ return intersect_default.circle(e, o, a);
561
+ }, o.intersect = function(e) {
562
+ return log.info("Circle intersect", o, m, e), intersect_default.circle(o, m, e);
563
+ }, u;
564
+ }
565
+ __name(circle, "circle");
566
+ function createLine(e) {
567
+ let a = Math.cos(Math.PI / 4), o = Math.sin(Math.PI / 4), s = e * 2, c = {
568
+ x: s / 2 * a,
569
+ y: s / 2 * o
570
+ }, l = {
571
+ x: -(s / 2) * a,
572
+ y: s / 2 * o
573
+ }, u = {
574
+ x: -(s / 2) * a,
575
+ y: -(s / 2) * o
576
+ }, d = {
577
+ x: s / 2 * a,
578
+ y: -(s / 2) * o
579
+ };
580
+ return `M ${l.x},${l.y} L ${d.x},${d.y}
581
+ M ${c.x},${c.y} L ${u.x},${u.y}`;
582
+ }
583
+ __name(createLine, "createLine");
584
+ function crossedCircle(e, o) {
585
+ let { labelStyles: s, nodeStyles: c } = styles2String(o);
586
+ o.labelStyle = s, o.label = "";
587
+ let l = e.insert("g").attr("class", getNodeClasses(o)).attr("id", o.domId ?? o.id), u = Math.max(30, o?.width ?? 0), { cssStyles: d } = o, f = at.svg(l), p = userNodeOverrides(o, {});
588
+ o.look !== "handDrawn" && (p.roughness = 0, p.fillStyle = "solid");
589
+ let m = f.circle(0, 0, u * 2, p), h = createLine(u), g = f.path(h, p), _ = l.insert(() => m, ":first-child");
590
+ return _.insert(() => g), _.attr("class", "outer-path"), d && o.look !== "handDrawn" && _.selectAll("path").attr("style", d), c && o.look !== "handDrawn" && _.selectAll("path").attr("style", c), updateNodeBounds(o, _), o.intersect = function(e) {
591
+ return log.info("crossedCircle intersect", o, {
592
+ radius: u,
593
+ point: e
594
+ }), intersect_default.circle(o, u, e);
595
+ }, l;
596
+ }
597
+ __name(crossedCircle, "crossedCircle");
598
+ function generateCirclePoints2(e, a, o, s = 100, c = 0, l = 180) {
599
+ let u = [], d = c * Math.PI / 180, f = (l * Math.PI / 180 - d) / (s - 1);
600
+ for (let c = 0; c < s; c++) {
601
+ let s = d + c * f, l = e + o * Math.cos(s), p = a + o * Math.sin(s);
602
+ u.push({
603
+ x: -l,
604
+ y: -p
605
+ });
606
+ }
607
+ return u;
608
+ }
609
+ __name(generateCirclePoints2, "generateCirclePoints");
610
+ async function curlyBraceLeft(e, a) {
611
+ let { labelStyles: o, nodeStyles: s } = styles2String(a);
612
+ a.labelStyle = o;
613
+ let { shapeSvg: c, bbox: l, label: u } = await labelHelper(e, a, getNodeClasses(a)), d = a.look === "neo" ? 18 : a.padding ?? 0, f = a.look === "neo" ? 12 : a.padding ?? 0, p = l.width + d, m = l.height + f, h = Math.max(5, m * .1), { cssStyles: g } = a, _ = [
614
+ ...generateCirclePoints2(p / 2, -m / 2, h, 30, -90, 0),
615
+ {
616
+ x: -p / 2 - h,
617
+ y: h
618
+ },
619
+ ...generateCirclePoints2(p / 2 + h * 2, -h, h, 20, -180, -270),
620
+ ...generateCirclePoints2(p / 2 + h * 2, h, h, 20, -90, -180),
621
+ {
622
+ x: -p / 2 - h,
623
+ y: -m / 2
624
+ },
625
+ ...generateCirclePoints2(p / 2, m / 2, h, 20, 0, 90)
626
+ ], v = [
627
+ {
628
+ x: p / 2,
629
+ y: -m / 2 - h
630
+ },
631
+ {
632
+ x: -p / 2,
633
+ y: -m / 2 - h
634
+ },
635
+ ...generateCirclePoints2(p / 2, -m / 2, h, 20, -90, 0),
636
+ {
637
+ x: -p / 2 - h,
638
+ y: -h
639
+ },
640
+ ...generateCirclePoints2(p / 2 + p * .1, -h, h, 20, -180, -270),
641
+ ...generateCirclePoints2(p / 2 + p * .1, h, h, 20, -90, -180),
642
+ {
643
+ x: -p / 2 - h,
644
+ y: m / 2
645
+ },
646
+ ...generateCirclePoints2(p / 2, m / 2, h, 20, 0, 90),
647
+ {
648
+ x: -p / 2,
649
+ y: m / 2 + h
650
+ },
651
+ {
652
+ x: p / 2,
653
+ y: m / 2 + h
654
+ }
655
+ ], y = at.svg(c), b = userNodeOverrides(a, { fill: "none" });
656
+ a.look !== "handDrawn" && (b.roughness = 0, b.fillStyle = "solid");
657
+ let x = createPathFromPoints(_).replace("Z", ""), w = y.path(x, b), T = createPathFromPoints(v), D = y.path(T, { ...b }), j = c.insert("g", ":first-child");
658
+ return j.insert(() => D, ":first-child").attr("stroke-opacity", 0), j.insert(() => w, ":first-child"), j.attr("class", "text"), g && a.look !== "handDrawn" && j.selectAll("path").attr("style", g), s && a.look !== "handDrawn" && j.selectAll("path").attr("style", s), j.attr("transform", `translate(${h}, 0)`), u.attr("transform", `translate(${-p / 2 + h - (l.x - (l.left ?? 0))},${-m / 2 + (a.padding ?? 0) / 2 - (l.y - (l.top ?? 0))})`), updateNodeBounds(a, j), a.intersect = function(e) {
659
+ return intersect_default.polygon(a, v, e);
660
+ }, c;
661
+ }
662
+ __name(curlyBraceLeft, "curlyBraceLeft");
663
+ function generateCirclePoints3(e, a, o, s = 100, c = 0, l = 180) {
664
+ let u = [], d = c * Math.PI / 180, f = (l * Math.PI / 180 - d) / (s - 1);
665
+ for (let c = 0; c < s; c++) {
666
+ let s = d + c * f, l = e + o * Math.cos(s), p = a + o * Math.sin(s);
667
+ u.push({
668
+ x: l,
669
+ y: p
670
+ });
671
+ }
672
+ return u;
673
+ }
674
+ __name(generateCirclePoints3, "generateCirclePoints");
675
+ async function curlyBraceRight(e, a) {
676
+ let { labelStyles: o, nodeStyles: s } = styles2String(a);
677
+ a.labelStyle = o;
678
+ let { shapeSvg: c, bbox: l, label: u } = await labelHelper(e, a, getNodeClasses(a)), d = a.look === "neo" ? 18 : a.padding ?? 0, f = a.look === "neo" ? 12 : a.padding ?? 0, p = l.width + (a.look === "neo" ? d * 2 : d), m = l.height + (a.look === "neo" ? f * 2 : f), h = Math.max(5, m * .1), { cssStyles: g } = a, _ = [
679
+ ...generateCirclePoints3(p / 2, -m / 2, h, 20, -90, 0),
680
+ {
681
+ x: p / 2 + h,
682
+ y: -h
683
+ },
684
+ ...generateCirclePoints3(p / 2 + h * 2, -h, h, 20, -180, -270),
685
+ ...generateCirclePoints3(p / 2 + h * 2, h, h, 20, -90, -180),
686
+ {
687
+ x: p / 2 + h,
688
+ y: m / 2
689
+ },
690
+ ...generateCirclePoints3(p / 2, m / 2, h, 20, 0, 90)
691
+ ], v = [
692
+ {
693
+ x: -p / 2,
694
+ y: -m / 2 - h
695
+ },
696
+ {
697
+ x: p / 2,
698
+ y: -m / 2 - h
699
+ },
700
+ ...generateCirclePoints3(p / 2, -m / 2, h, 20, -90, 0),
701
+ {
702
+ x: p / 2 + h,
703
+ y: -h
704
+ },
705
+ ...generateCirclePoints3(p / 2 + h * 2, -h, h, 20, -180, -270),
706
+ ...generateCirclePoints3(p / 2 + h * 2, h, h, 20, -90, -180),
707
+ {
708
+ x: p / 2 + h,
709
+ y: m / 2
710
+ },
711
+ ...generateCirclePoints3(p / 2, m / 2, h, 20, 0, 90),
712
+ {
713
+ x: p / 2,
714
+ y: m / 2 + h
715
+ },
716
+ {
717
+ x: -p / 2,
718
+ y: m / 2 + h
719
+ }
720
+ ], y = at.svg(c), b = userNodeOverrides(a, { fill: "none" });
721
+ a.look !== "handDrawn" && (b.roughness = 0, b.fillStyle = "solid");
722
+ let x = createPathFromPoints(_).replace("Z", ""), w = y.path(x, b), T = createPathFromPoints(v), D = y.path(T, { ...b }), j = c.insert("g", ":first-child");
723
+ return j.insert(() => D, ":first-child").attr("stroke-opacity", 0), j.insert(() => w, ":first-child"), j.attr("class", "text"), g && a.look !== "handDrawn" && j.selectAll("path").attr("style", g), s && a.look !== "handDrawn" && j.selectAll("path").attr("style", s), j.attr("transform", `translate(${-h}, 0)`), u.attr("transform", `translate(${-p / 2 + (a.padding ?? 0) / 2 - (l.x - (l.left ?? 0))},${-m / 2 + (a.padding ?? 0) / 2 - (l.y - (l.top ?? 0))})`), updateNodeBounds(a, j), a.intersect = function(e) {
724
+ return intersect_default.polygon(a, v, e);
725
+ }, c;
726
+ }
727
+ __name(curlyBraceRight, "curlyBraceRight");
728
+ function generateCirclePoints4(e, a, o, s = 100, c = 0, l = 180) {
729
+ let u = [], d = c * Math.PI / 180, f = (l * Math.PI / 180 - d) / (s - 1);
730
+ for (let c = 0; c < s; c++) {
731
+ let s = d + c * f, l = e + o * Math.cos(s), p = a + o * Math.sin(s);
732
+ u.push({
733
+ x: -l,
734
+ y: -p
735
+ });
736
+ }
737
+ return u;
738
+ }
739
+ __name(generateCirclePoints4, "generateCirclePoints");
740
+ async function curlyBraces(e, a) {
741
+ let { labelStyles: o, nodeStyles: s } = styles2String(a);
742
+ a.labelStyle = o;
743
+ let { shapeSvg: c, bbox: l, label: u } = await labelHelper(e, a, getNodeClasses(a)), d = a.look === "neo" ? 18 : a.padding ?? 0, f = a.look === "neo" ? 12 : a.padding ?? 0, p = l.width + (a.look === "neo" ? d * 2 : d), m = l.height + (a.look === "neo" ? f * 2 : f), h = Math.max(5, m * .1), { cssStyles: g } = a, _ = [
744
+ ...generateCirclePoints4(p / 2, -m / 2, h, 30, -90, 0),
745
+ {
746
+ x: -p / 2 - h,
747
+ y: h
748
+ },
749
+ ...generateCirclePoints4(p / 2 + h * 2, -h, h, 20, -180, -270),
750
+ ...generateCirclePoints4(p / 2 + h * 2, h, h, 20, -90, -180),
751
+ {
752
+ x: -p / 2 - h,
753
+ y: -m / 2
754
+ },
755
+ ...generateCirclePoints4(p / 2, m / 2, h, 20, 0, 90)
756
+ ], v = [
757
+ ...generateCirclePoints4(-p / 2 + h + h / 2, -m / 2, h, 20, -90, -180),
758
+ {
759
+ x: p / 2 - h / 2,
760
+ y: h
761
+ },
762
+ ...generateCirclePoints4(-p / 2 - h / 2, -h, h, 20, 0, 90),
763
+ ...generateCirclePoints4(-p / 2 - h / 2, h, h, 20, -90, 0),
764
+ {
765
+ x: p / 2 - h / 2,
766
+ y: -h
767
+ },
768
+ ...generateCirclePoints4(-p / 2 + h + h / 2, m / 2, h, 30, -180, -270)
769
+ ], y = [
770
+ {
771
+ x: p / 2,
772
+ y: -m / 2 - h
773
+ },
774
+ {
775
+ x: -p / 2,
776
+ y: -m / 2 - h
777
+ },
778
+ ...generateCirclePoints4(p / 2, -m / 2, h, 20, -90, 0),
779
+ {
780
+ x: -p / 2 - h,
781
+ y: -h
782
+ },
783
+ ...generateCirclePoints4(p / 2 + h * 2, -h, h, 20, -180, -270),
784
+ ...generateCirclePoints4(p / 2 + h * 2, h, h, 20, -90, -180),
785
+ {
786
+ x: -p / 2 - h,
787
+ y: m / 2
788
+ },
789
+ ...generateCirclePoints4(p / 2, m / 2, h, 20, 0, 90),
790
+ {
791
+ x: -p / 2,
792
+ y: m / 2 + h
793
+ },
794
+ {
795
+ x: p / 2 - h - h / 2,
796
+ y: m / 2 + h
797
+ },
798
+ ...generateCirclePoints4(-p / 2 + h + h / 2, -m / 2, h, 20, -90, -180),
799
+ {
800
+ x: p / 2 - h / 2,
801
+ y: h
802
+ },
803
+ ...generateCirclePoints4(-p / 2 - h / 2, -h, h, 20, 0, 90),
804
+ ...generateCirclePoints4(-p / 2 - h / 2, h, h, 20, -90, 0),
805
+ {
806
+ x: p / 2 - h / 2,
807
+ y: -h
808
+ },
809
+ ...generateCirclePoints4(-p / 2 + h + h / 2, m / 2, h, 30, -180, -270)
810
+ ], b = at.svg(c), x = userNodeOverrides(a, { fill: "none" });
811
+ a.look !== "handDrawn" && (x.roughness = 0, x.fillStyle = "solid");
812
+ let w = createPathFromPoints(_).replace("Z", ""), T = b.path(w, x), D = createPathFromPoints(v).replace("Z", ""), j = b.path(D, x), M = createPathFromPoints(y), N = b.path(M, { ...x }), P = c.insert("g", ":first-child");
813
+ return P.insert(() => N, ":first-child").attr("stroke-opacity", 0), P.insert(() => T, ":first-child"), P.insert(() => j, ":first-child"), P.attr("class", "text"), g && a.look !== "handDrawn" && P.selectAll("path").attr("style", g), s && a.look !== "handDrawn" && P.selectAll("path").attr("style", s), P.attr("transform", `translate(${h - h / 4}, 0)`), u.attr("transform", `translate(${-p / 2 + (a.padding ?? 0) / 2 - (l.x - (l.left ?? 0))},${-m / 2 + (a.padding ?? 0) / 2 - (l.y - (l.top ?? 0))})`), updateNodeBounds(a, P), a.intersect = function(e) {
814
+ return intersect_default.polygon(a, y, e);
815
+ }, c;
816
+ }
817
+ __name(curlyBraces, "curlyBraces");
818
+ async function curvedTrapezoid(e, a) {
819
+ let { labelStyles: o, nodeStyles: s } = styles2String(a);
820
+ a.labelStyle = o;
821
+ let c = a.padding ?? 0, l = a.look === "neo" ? 16 : c, u = a.look === "neo" ? 12 : c, { shapeSvg: d, bbox: f } = await labelHelper(e, a, getNodeClasses(a)), p = Math.max(20, (f.width + l * 2) * 1.25, a?.width ?? 0), m = Math.max(5, f.height + u * 2, a?.height ?? 0), h = m / 2, { cssStyles: g } = a, _ = at.svg(d), v = userNodeOverrides(a, {});
822
+ a.look !== "handDrawn" && (v.roughness = 0, v.fillStyle = "solid");
823
+ let y = p, b = m, x = y - h, w = b / 4, T = [
824
+ {
825
+ x,
826
+ y: 0
827
+ },
828
+ {
829
+ x: w,
830
+ y: 0
831
+ },
832
+ {
833
+ x: 0,
834
+ y: b / 2
835
+ },
836
+ {
837
+ x: w,
838
+ y: b
839
+ },
840
+ {
841
+ x,
842
+ y: b
843
+ },
844
+ ...generateCirclePoints(-x, -b / 2, h, 50, 270, 90)
845
+ ], D = createPathFromPoints(T), j = _.path(D, v), N = d.insert(() => j, ":first-child");
846
+ return N.attr("class", "basic label-container outer-path"), g && a.look !== "handDrawn" && N.selectChildren("path").attr("style", g), s && a.look !== "handDrawn" && N.selectChildren("path").attr("style", s), N.attr("transform", `translate(${-p / 2}, ${-m / 2})`), updateNodeBounds(a, N), a.intersect = function(e) {
847
+ return intersect_default.polygon(a, T, e);
848
+ }, d;
849
+ }
850
+ __name(curvedTrapezoid, "curvedTrapezoid");
851
+ var createCylinderPathD = /* @__PURE__ */ __name((e, a, o, s, c, l) => [
852
+ `M${e},${a + l}`,
853
+ `a${c},${l} 0,0,0 ${o},0`,
854
+ `a${c},${l} 0,0,0 ${-o},0`,
855
+ `l0,${s}`,
856
+ `a${c},${l} 0,0,0 ${o},0`,
857
+ `l0,${-s}`
858
+ ].join(" "), "createCylinderPathD"), createOuterCylinderPathD = /* @__PURE__ */ __name((e, a, o, s, c, l) => [
859
+ `M${e},${a + l}`,
860
+ `M${e + o},${a + l}`,
861
+ `a${c},${l} 0,0,0 ${-o},0`,
862
+ `l0,${s}`,
863
+ `a${c},${l} 0,0,0 ${o},0`,
864
+ `l0,${-s}`
865
+ ].join(" "), "createOuterCylinderPathD"), createInnerCylinderPathD = /* @__PURE__ */ __name((e, a, o, s, c, l) => [`M${e - o / 2},${-s / 2}`, `a${c},${l} 0,0,0 ${o},0`].join(" "), "createInnerCylinderPathD"), MIN_HEIGHT = 8, MIN_WIDTH = 8;
866
+ async function cylinder(e, a) {
867
+ let { labelStyles: o, nodeStyles: s } = styles2String(a);
868
+ a.labelStyle = o;
869
+ let c = a.padding ?? 0, l = a.look === "neo" ? 24 : c, u = a.look === "neo" ? 24 : c;
870
+ if (a.width || a.height) {
871
+ let e = a.width ?? 0;
872
+ a.width = (a.width ?? 0) - u, a.width < MIN_WIDTH && (a.width = MIN_WIDTH);
873
+ let o = e / 2 / (2.5 + e / 50);
874
+ a.height = (a.height ?? 0) - l - o * 3, a.height < MIN_HEIGHT && (a.height = MIN_HEIGHT);
875
+ }
876
+ let { shapeSvg: d, bbox: f, label: p } = await labelHelper(e, a, getNodeClasses(a)), m = (a.width ? a.width : f.width) + u, h = m / 2, g = h / (2.5 + m / 50), v = (a.height ? a.height : f.height) + l + g, y, { cssStyles: b } = a;
877
+ if (a.look === "handDrawn") {
878
+ let e = at.svg(d), o = createOuterCylinderPathD(0, 0, m, v, h, g), s = createInnerCylinderPathD(0, g, m, v, h, g), c = userNodeOverrides(a, {}), l = e.path(o, c), u = e.path(s, userNodeOverrides(a, { fill: "none" }));
879
+ y = d.insert(() => u, ":first-child"), y = d.insert(() => l, ":first-child"), y.attr("class", "basic label-container"), b && y.attr("style", b);
880
+ } else {
881
+ let e = createCylinderPathD(0, 0, m, v, h, g);
882
+ y = d.insert("path", ":first-child").attr("d", e).attr("class", "basic label-container outer-path").attr("style", handleUndefinedAttr(b)).attr("style", s);
883
+ }
884
+ return y.attr("label-offset-y", g), y.attr("transform", `translate(${-m / 2}, ${-(v / 2 + g)})`), updateNodeBounds(a, y), p.attr("transform", `translate(${-(f.width / 2) - (f.x - (f.left ?? 0))}, ${-(f.height / 2) + (a.padding ?? 0) / 1.5 - (f.y - (f.top ?? 0))})`), a.intersect = function(e) {
885
+ let o = intersect_default.rect(a, e), s = o.x - (a.x ?? 0);
886
+ if (h != 0 && (Math.abs(s) < (a.width ?? 0) / 2 || Math.abs(s) == (a.width ?? 0) / 2 && Math.abs(o.y - (a.y ?? 0)) > (a.height ?? 0) / 2 - g)) {
887
+ let c = g * g * (1 - s * s / (h * h));
888
+ c > 0 && (c = Math.sqrt(c)), c = g - c, e.y - (a.y ?? 0) > 0 && (c = -c), o.y += c;
889
+ }
890
+ return o;
891
+ }, d;
892
+ }
893
+ __name(cylinder, "cylinder");
894
+ async function dividedRectangle(e, a) {
895
+ let { labelStyles: o, nodeStyles: s } = styles2String(a);
896
+ a.labelStyle = o;
897
+ let c = a.look === "neo" ? 16 : a.padding ?? 0, l = a.look === "neo" ? 16 : a.padding ?? 0, { shapeSvg: u, bbox: d, label: f } = await labelHelper(e, a, getNodeClasses(a)), p = d.width + c, m = d.height + l, h = m * .2, g = -p / 2, _ = -m / 2 - h / 2, { cssStyles: v } = a, y = at.svg(u), b = userNodeOverrides(a, {});
898
+ a.look !== "handDrawn" && (b.roughness = 0, b.fillStyle = "solid");
899
+ let x = [
900
+ {
901
+ x: g,
902
+ y: _ + h
903
+ },
904
+ {
905
+ x: -g,
906
+ y: _ + h
907
+ },
908
+ {
909
+ x: -g,
910
+ y: -_
911
+ },
912
+ {
913
+ x: g,
914
+ y: -_
915
+ },
916
+ {
917
+ x: g,
918
+ y: _
919
+ },
920
+ {
921
+ x: -g,
922
+ y: _
923
+ },
924
+ {
925
+ x: -g,
926
+ y: _ + h
927
+ }
928
+ ], w = y.polygon(x.map((e) => [e.x, e.y]), b), T = u.insert(() => w, ":first-child");
929
+ return T.attr("class", "basic label-container outer-path"), v && a.look !== "handDrawn" && T.selectAll("path").attr("style", v), s && a.look !== "handDrawn" && T.selectAll("path").attr("style", s), f.attr("transform", `translate(${g + (a.padding ?? 0) / 2 - (d.x - (d.left ?? 0))}, ${_ + h + (a.padding ?? 0) / 2 - (d.y - (d.top ?? 0))})`), updateNodeBounds(a, T), a.intersect = function(e) {
930
+ return intersect_default.rect(a, e);
931
+ }, u;
932
+ }
933
+ __name(dividedRectangle, "dividedRectangle");
934
+ async function doublecircle(e, o) {
935
+ let { labelStyles: s, nodeStyles: c } = styles2String(o), l = o.look === "neo" ? 12 : 5;
936
+ o.labelStyle = s;
937
+ let u = o.padding ?? 0, d = o.look === "neo" ? 16 : u, { shapeSvg: f, bbox: p } = await labelHelper(e, o, getNodeClasses(o)), m = (o?.width ? o?.width / 2 : p.width / 2) + (d ?? 0), h = m - l, g, { cssStyles: v } = o;
938
+ if (o.look === "handDrawn") {
939
+ let e = at.svg(f), a = userNodeOverrides(o, {
940
+ roughness: .2,
941
+ strokeWidth: 2.5
942
+ }), s = userNodeOverrides(o, {
943
+ roughness: .2,
944
+ strokeWidth: 1.5
945
+ }), c = e.circle(0, 0, m * 2, a), l = e.circle(0, 0, h * 2, s);
946
+ g = f.insert("g", ":first-child"), g.attr("class", handleUndefinedAttr(o.cssClasses)).attr("style", handleUndefinedAttr(v)), g.node()?.appendChild(c), g.node()?.appendChild(l);
947
+ } else {
948
+ g = f.insert("g", ":first-child");
949
+ let e = g.insert("circle", ":first-child"), a = g.insert("circle");
950
+ g.attr("class", "basic label-container").attr("style", c), e.attr("class", "outer-circle").attr("style", c).attr("r", m).attr("cx", 0).attr("cy", 0), a.attr("class", "inner-circle").attr("style", c).attr("r", h).attr("cx", 0).attr("cy", 0);
951
+ }
952
+ return updateNodeBounds(o, g), o.intersect = function(e) {
953
+ return log.info("DoubleCircle intersect", o, m, e), intersect_default.circle(o, m, e);
954
+ }, f;
955
+ }
956
+ __name(doublecircle, "doublecircle");
957
+ function filledCircle(e, o, { config: { themeVariables: s } }) {
958
+ let { labelStyles: c, nodeStyles: l } = styles2String(o);
959
+ o.label = "", o.labelStyle = c;
960
+ let u = e.insert("g").attr("class", getNodeClasses(o)).attr("id", o.domId ?? o.id), { cssStyles: d } = o, f = at.svg(u), { nodeBorder: p } = s, m = userNodeOverrides(o, { fillStyle: "solid" });
961
+ o.look !== "handDrawn" && (m.roughness = 0);
962
+ let h = f.circle(0, 0, 14, m), g = u.insert(() => h, ":first-child");
963
+ return g.selectAll("path").attr("style", `fill: ${p} !important;`), d && d.length > 0 && o.look !== "handDrawn" && g.selectAll("path").attr("style", d), l && o.look !== "handDrawn" && g.selectAll("path").attr("style", l), updateNodeBounds(o, g), o.intersect = function(e) {
964
+ return log.info("filledCircle intersect", o, {
965
+ radius: 7,
966
+ point: e
967
+ }), intersect_default.circle(o, 7, e);
968
+ }, u;
969
+ }
970
+ __name(filledCircle, "filledCircle");
971
+ var MIN_HEIGHT2 = 10, MIN_WIDTH2 = 10;
972
+ async function flippedTriangle(e, o) {
973
+ let { labelStyles: s, nodeStyles: c } = styles2String(o);
974
+ o.labelStyle = s;
975
+ let l = o.padding ?? 0, u = o.look === "neo" ? l * 2 : l;
976
+ (o.width || o.height) && (o.height = o?.height ?? 0, o.height < MIN_HEIGHT2 && (o.height = MIN_HEIGHT2), o.width = (o?.width ?? 0) - u - u / 2, o.width < MIN_WIDTH2 && (o.width = MIN_WIDTH2));
977
+ let { shapeSvg: d, bbox: f, label: p } = await labelHelper(e, o, getNodeClasses(o)), m = (o?.width ? o?.width : f.width) + (u ?? 0), h = o?.height ? o?.height : m + f.height, g = h, _ = [
978
+ {
979
+ x: 0,
980
+ y: -h
981
+ },
982
+ {
983
+ x: g,
984
+ y: -h
985
+ },
986
+ {
987
+ x: g / 2,
988
+ y: 0
989
+ }
990
+ ], { cssStyles: v } = o, y = at.svg(d), b = userNodeOverrides(o, {});
991
+ o.look !== "handDrawn" && (b.roughness = 0, b.fillStyle = "solid");
992
+ let x = createPathFromPoints(_), w = y.path(x, b), T = d.insert(() => w, ":first-child").attr("transform", `translate(${-h / 2}, ${h / 2})`).attr("class", "outer-path");
993
+ return v && o.look !== "handDrawn" && T.selectChildren("path").attr("style", v), c && o.look !== "handDrawn" && T.selectChildren("path").attr("style", c), o.width = m, o.height = h, updateNodeBounds(o, T), p.attr("transform", `translate(${-f.width / 2 - (f.x - (f.left ?? 0))}, ${-h / 2 + (o.padding ?? 0) / 2 + (f.y - (f.top ?? 0))})`), o.intersect = function(e) {
994
+ return log.info("Triangle intersect", o, _, e), intersect_default.polygon(o, _, e);
995
+ }, d;
996
+ }
997
+ __name(flippedTriangle, "flippedTriangle");
998
+ function forkJoin(e, a, { dir: o, config: { state: s, themeVariables: c } }) {
999
+ let { nodeStyles: l } = styles2String(a);
1000
+ a.label = "";
1001
+ let u = e.insert("g").attr("class", getNodeClasses(a)).attr("id", a.domId ?? a.id), { cssStyles: d } = a, f = Math.max(70, a?.width ?? 0), p = Math.max(10, a?.height ?? 0);
1002
+ o === "LR" && (f = Math.max(10, a?.width ?? 0), p = Math.max(70, a?.height ?? 0));
1003
+ let m = -1 * f / 2, h = -1 * p / 2, g = at.svg(u), _ = userNodeOverrides(a, {
1004
+ stroke: c.lineColor,
1005
+ fill: c.lineColor
1006
+ });
1007
+ a.look !== "handDrawn" && (_.roughness = 0, _.fillStyle = "solid");
1008
+ let v = g.rectangle(m, h, f, p, _), y = u.insert(() => v, ":first-child");
1009
+ d && a.look !== "handDrawn" && y.selectAll("path").attr("style", d), l && a.look !== "handDrawn" && y.selectAll("path").attr("style", l), updateNodeBounds(a, y);
1010
+ let b = s?.padding ?? 0;
1011
+ return a.width && a.height && (a.width += b / 2 || 0, a.height += b / 2 || 0), a.intersect = function(e) {
1012
+ return intersect_default.rect(a, e);
1013
+ }, u;
1014
+ }
1015
+ __name(forkJoin, "forkJoin");
1016
+ async function halfRoundedRectangle(e, o) {
1017
+ let { labelStyles: s, nodeStyles: c } = styles2String(o);
1018
+ o.labelStyle = s;
1019
+ let l = o.look === "neo" ? 16 : o.padding ?? 0, u = o.look === "neo" ? 12 : o.padding ?? 0;
1020
+ (o.width || o.height) && (o.height = (o?.height ?? 0) - u * 2, o.height < 10 && (o.height = 10), o.width = (o?.width ?? 0) - l * 2, o.width < 15 && (o.width = 15));
1021
+ let { shapeSvg: d, bbox: f } = await labelHelper(e, o, getNodeClasses(o)), p = (o?.width ? o?.width : Math.max(15, f.width)) + l * 2, m = (o?.height ? o?.height : Math.max(10, f.height)) + u * 2, h = m / 2, { cssStyles: g } = o, _ = at.svg(d), v = userNodeOverrides(o, {});
1022
+ o.look !== "handDrawn" && (v.roughness = 0, v.fillStyle = "solid");
1023
+ let y = [
1024
+ {
1025
+ x: -p / 2,
1026
+ y: -m / 2
1027
+ },
1028
+ {
1029
+ x: p / 2 - h,
1030
+ y: -m / 2
1031
+ },
1032
+ ...generateCirclePoints(-p / 2 + h, 0, h, 50, 90, 270),
1033
+ {
1034
+ x: p / 2 - h,
1035
+ y: m / 2
1036
+ },
1037
+ {
1038
+ x: -p / 2,
1039
+ y: m / 2
1040
+ }
1041
+ ], b = createPathFromPoints(y), x = _.path(b, v), w = d.insert(() => x, ":first-child");
1042
+ return w.attr("class", "basic label-container outer-path"), g && o.look !== "handDrawn" && w.selectChildren("path").attr("style", g), c && o.look !== "handDrawn" && w.selectChildren("path").attr("style", c), updateNodeBounds(o, w), o.intersect = function(e) {
1043
+ return log.info("Pill intersect", o, {
1044
+ radius: h,
1045
+ point: e
1046
+ }), intersect_default.polygon(o, y, e);
1047
+ }, d;
1048
+ }
1049
+ __name(halfRoundedRectangle, "halfRoundedRectangle");
1050
+ var createHexagonPathD = /* @__PURE__ */ __name((e, a, o, s, c) => [
1051
+ `M${e + c},${a}`,
1052
+ `L${e + o - c},${a}`,
1053
+ `L${e + o},${a - s / 2}`,
1054
+ `L${e + o - c},${a - s}`,
1055
+ `L${e + c},${a - s}`,
1056
+ `L${e},${a - s / 2}`,
1057
+ "Z"
1058
+ ].join(" "), "createHexagonPathD");
1059
+ async function hexagon(e, a) {
1060
+ let { labelStyles: o, nodeStyles: s } = styles2String(a), c = a.look === "neo" ? 3.5 : 4;
1061
+ a.labelStyle = o;
1062
+ let l = a.padding ?? 0, u = a.look === "neo" ? 70 : l, d = a.look === "neo" ? 32 : l;
1063
+ if (a.width || a.height) {
1064
+ let e = (a.height ?? 0) / c;
1065
+ a.width = (a?.width ?? 0) - 2 * e - d, a.height = (a.height ?? 0) - u;
1066
+ }
1067
+ let { shapeSvg: f, bbox: p } = await labelHelper(e, a, getNodeClasses(a)), m = (a?.height ? a?.height : p.height) + u, h = m / c, g = (a?.width ? a?.width : p.width) + 2 * h + d, _ = [
1068
+ {
1069
+ x: h,
1070
+ y: 0
1071
+ },
1072
+ {
1073
+ x: g - h,
1074
+ y: 0
1075
+ },
1076
+ {
1077
+ x: g,
1078
+ y: -m / 2
1079
+ },
1080
+ {
1081
+ x: g - h,
1082
+ y: -m
1083
+ },
1084
+ {
1085
+ x: h,
1086
+ y: -m
1087
+ },
1088
+ {
1089
+ x: 0,
1090
+ y: -m / 2
1091
+ }
1092
+ ], v, { cssStyles: y } = a;
1093
+ if (a.look === "handDrawn") {
1094
+ let e = at.svg(f), o = userNodeOverrides(a, {}), s = createHexagonPathD(0, 0, g, m, h), c = e.path(s, o);
1095
+ v = f.insert(() => c, ":first-child").attr("transform", `translate(${-g / 2}, ${m / 2})`), y && v.attr("style", y);
1096
+ } else v = insertPolygonShape(f, g, m, _);
1097
+ return s && v.attr("style", s), a.width = g, a.height = m, updateNodeBounds(a, v), a.intersect = function(e) {
1098
+ return intersect_default.polygon(a, _, e);
1099
+ }, f;
1100
+ }
1101
+ __name(hexagon, "hexagon");
1102
+ async function hourglass(e, o) {
1103
+ let { labelStyles: s, nodeStyles: c } = styles2String(o);
1104
+ o.label = "", o.labelStyle = s;
1105
+ let { shapeSvg: l } = await labelHelper(e, o, getNodeClasses(o)), u = Math.max(30, o?.width ?? 0), d = Math.max(30, o?.height ?? 0), { cssStyles: f } = o, p = at.svg(l), m = userNodeOverrides(o, {});
1106
+ o.look !== "handDrawn" && (m.roughness = 0, m.fillStyle = "solid");
1107
+ let h = [
1108
+ {
1109
+ x: 0,
1110
+ y: 0
1111
+ },
1112
+ {
1113
+ x: u,
1114
+ y: 0
1115
+ },
1116
+ {
1117
+ x: 0,
1118
+ y: d
1119
+ },
1120
+ {
1121
+ x: u,
1122
+ y: d
1123
+ }
1124
+ ], g = createPathFromPoints(h), _ = p.path(g, m), v = l.insert(() => _, ":first-child");
1125
+ return v.attr("class", "basic label-container outer-path"), f && o.look !== "handDrawn" && v.selectChildren("path").attr("style", f), c && o.look !== "handDrawn" && v.selectChildren("path").attr("style", c), v.attr("transform", `translate(${-u / 2}, ${-d / 2})`), updateNodeBounds(o, v), o.intersect = function(e) {
1126
+ return log.info("Pill intersect", o, { points: h }), intersect_default.polygon(o, h, e);
1127
+ }, l;
1128
+ }
1129
+ __name(hourglass, "hourglass");
1130
+ async function icon(e, o, { config: { themeVariables: s, flowchart: c } }) {
1131
+ let { labelStyles: l } = styles2String(o);
1132
+ o.labelStyle = l;
1133
+ let u = o.assetHeight ?? 48, d = o.assetWidth ?? 48, f = Math.max(u, d), p = c?.wrappingWidth;
1134
+ o.width = Math.max(f, p ?? 0);
1135
+ let { shapeSvg: m, bbox: h, label: g } = await labelHelper(e, o, "icon-shape default"), _ = o.pos === "t", v = f, y = f, { nodeBorder: x } = s, { stylesMap: w } = compileStyles(o), D = -y / 2, k = -v / 2, A = o.label ? 8 : 0, j = at.svg(m), M = userNodeOverrides(o, {
1136
+ stroke: "none",
1137
+ fill: "none"
1138
+ });
1139
+ o.look !== "handDrawn" && (M.roughness = 0, M.fillStyle = "solid");
1140
+ let N = j.rectangle(D, k, y, v, M), P = Math.max(y, h.width), F = v + h.height + A, I = j.rectangle(-P / 2, -F / 2, P, F, {
1141
+ ...M,
1142
+ fill: "transparent",
1143
+ stroke: "none"
1144
+ }), L = m.insert(() => N, ":first-child"), R = m.insert(() => I);
1145
+ if (o.icon) {
1146
+ let e = m.append("g");
1147
+ e.html(`<g>${await getIconSVG(o.icon, {
1148
+ height: f,
1149
+ width: f,
1150
+ fallbackPrefix: ""
1151
+ })}</g>`);
1152
+ let a = e.node().getBBox(), s = a.width, c = a.height, l = a.x, u = a.y;
1153
+ e.attr("transform", `translate(${-s / 2 - l},${_ ? h.height / 2 + A / 2 - c / 2 - u : -h.height / 2 - A / 2 - c / 2 - u})`), e.attr("style", `color: ${w.get("stroke") ?? x};`);
1154
+ }
1155
+ return g.attr("transform", `translate(${-h.width / 2 - (h.x - (h.left ?? 0))},${_ ? -F / 2 : F / 2 - h.height})`), L.attr("transform", `translate(0,${_ ? h.height / 2 + A / 2 : -h.height / 2 - A / 2})`), updateNodeBounds(o, R), o.intersect = function(e) {
1156
+ if (log.info("iconSquare intersect", o, e), !o.label) return intersect_default.rect(o, e);
1157
+ let s = o.x ?? 0, c = o.y ?? 0, l = o.height ?? 0, u = [];
1158
+ return u = _ ? [
1159
+ {
1160
+ x: s - h.width / 2,
1161
+ y: c - l / 2
1162
+ },
1163
+ {
1164
+ x: s + h.width / 2,
1165
+ y: c - l / 2
1166
+ },
1167
+ {
1168
+ x: s + h.width / 2,
1169
+ y: c - l / 2 + h.height + A
1170
+ },
1171
+ {
1172
+ x: s + y / 2,
1173
+ y: c - l / 2 + h.height + A
1174
+ },
1175
+ {
1176
+ x: s + y / 2,
1177
+ y: c + l / 2
1178
+ },
1179
+ {
1180
+ x: s - y / 2,
1181
+ y: c + l / 2
1182
+ },
1183
+ {
1184
+ x: s - y / 2,
1185
+ y: c - l / 2 + h.height + A
1186
+ },
1187
+ {
1188
+ x: s - h.width / 2,
1189
+ y: c - l / 2 + h.height + A
1190
+ }
1191
+ ] : [
1192
+ {
1193
+ x: s - y / 2,
1194
+ y: c - l / 2
1195
+ },
1196
+ {
1197
+ x: s + y / 2,
1198
+ y: c - l / 2
1199
+ },
1200
+ {
1201
+ x: s + y / 2,
1202
+ y: c - l / 2 + v
1203
+ },
1204
+ {
1205
+ x: s + h.width / 2,
1206
+ y: c - l / 2 + v
1207
+ },
1208
+ {
1209
+ x: s + h.width / 2 / 2,
1210
+ y: c + l / 2
1211
+ },
1212
+ {
1213
+ x: s - h.width / 2,
1214
+ y: c + l / 2
1215
+ },
1216
+ {
1217
+ x: s - h.width / 2,
1218
+ y: c - l / 2 + v
1219
+ },
1220
+ {
1221
+ x: s - y / 2,
1222
+ y: c - l / 2 + v
1223
+ }
1224
+ ], intersect_default.polygon(o, u, e);
1225
+ }, m;
1226
+ }
1227
+ __name(icon, "icon");
1228
+ async function iconCircle(e, o, { config: { themeVariables: s, flowchart: c } }) {
1229
+ let { labelStyles: l } = styles2String(o);
1230
+ o.labelStyle = l;
1231
+ let u = o.assetHeight ?? 48, d = o.assetWidth ?? 48, f = Math.max(u, d), p = c?.wrappingWidth;
1232
+ o.width = Math.max(f, p ?? 0);
1233
+ let { shapeSvg: m, bbox: h, label: g } = await labelHelper(e, o, "icon-shape default"), _ = o.label ? 8 : 0, v = o.pos === "t", { nodeBorder: y, mainBkg: x } = s, { stylesMap: w } = compileStyles(o), D = at.svg(m), k = userNodeOverrides(o, {});
1234
+ o.look !== "handDrawn" && (k.roughness = 0, k.fillStyle = "solid"), k.stroke = w.get("fill") ?? x;
1235
+ let A = m.append("g");
1236
+ o.icon && A.html(`<g>${await getIconSVG(o.icon, {
1237
+ height: f,
1238
+ width: f,
1239
+ fallbackPrefix: ""
1240
+ })}</g>`);
1241
+ let j = A.node().getBBox(), M = j.width, N = j.height, P = j.x, F = j.y, I = Math.max(M, N) * Math.SQRT2 + 40, L = D.circle(0, 0, I, k), R = Math.max(I, h.width), z = I + h.height + _, B = D.rectangle(-R / 2, -z / 2, R, z, {
1242
+ ...k,
1243
+ fill: "transparent",
1244
+ stroke: "none"
1245
+ }), V = m.insert(() => L, ":first-child"), H = m.insert(() => B);
1246
+ return A.attr("transform", `translate(${-M / 2 - P},${v ? h.height / 2 + _ / 2 - N / 2 - F : -h.height / 2 - _ / 2 - N / 2 - F})`), A.attr("style", `color: ${w.get("stroke") ?? y};`), g.attr("transform", `translate(${-h.width / 2 - (h.x - (h.left ?? 0))},${v ? -z / 2 : z / 2 - h.height})`), V.attr("transform", `translate(0,${v ? h.height / 2 + _ / 2 : -h.height / 2 - _ / 2})`), updateNodeBounds(o, H), o.intersect = function(e) {
1247
+ return log.info("iconSquare intersect", o, e), intersect_default.rect(o, e);
1248
+ }, m;
1249
+ }
1250
+ __name(iconCircle, "iconCircle");
1251
+ async function iconRounded(e, o, { config: { themeVariables: s, flowchart: c } }) {
1252
+ let { labelStyles: l } = styles2String(o);
1253
+ o.labelStyle = l;
1254
+ let u = o.assetHeight ?? 48, d = o.assetWidth ?? 48, f = Math.max(u, d), p = c?.wrappingWidth;
1255
+ o.width = Math.max(f, p ?? 0);
1256
+ let { shapeSvg: m, bbox: h, halfPadding: g, label: _ } = await labelHelper(e, o, "icon-shape default"), v = o.pos === "t", y = f + g * 2, x = f + g * 2, { nodeBorder: w, mainBkg: D } = s, { stylesMap: k } = compileStyles(o), A = -x / 2, j = -y / 2, M = o.label ? 8 : 0, N = at.svg(m), P = userNodeOverrides(o, {});
1257
+ o.look !== "handDrawn" && (P.roughness = 0, P.fillStyle = "solid"), P.stroke = k.get("fill") ?? D;
1258
+ let F = N.path(createRoundedRectPathD(A, j, x, y, 5), P), L = Math.max(x, h.width), R = y + h.height + M, z = N.rectangle(-L / 2, -R / 2, L, R, {
1259
+ ...P,
1260
+ fill: "transparent",
1261
+ stroke: "none"
1262
+ }), B = m.insert(() => F, ":first-child").attr("class", "icon-shape2"), V = m.insert(() => z);
1263
+ if (o.icon) {
1264
+ let e = m.append("g");
1265
+ e.html(`<g>${await getIconSVG(o.icon, {
1266
+ height: f,
1267
+ width: f,
1268
+ fallbackPrefix: ""
1269
+ })}</g>`);
1270
+ let a = e.node().getBBox(), s = a.width, c = a.height, l = a.x, u = a.y;
1271
+ e.attr("transform", `translate(${-s / 2 - l},${v ? h.height / 2 + M / 2 - c / 2 - u : -h.height / 2 - M / 2 - c / 2 - u})`), e.attr("style", `color: ${k.get("stroke") ?? w};`);
1272
+ }
1273
+ return _.attr("transform", `translate(${-h.width / 2 - (h.x - (h.left ?? 0))},${v ? -R / 2 : R / 2 - h.height})`), B.attr("transform", `translate(0,${v ? h.height / 2 + M / 2 : -h.height / 2 - M / 2})`), updateNodeBounds(o, V), o.intersect = function(e) {
1274
+ if (log.info("iconSquare intersect", o, e), !o.label) return intersect_default.rect(o, e);
1275
+ let s = o.x ?? 0, c = o.y ?? 0, l = o.height ?? 0, u = [];
1276
+ return u = v ? [
1277
+ {
1278
+ x: s - h.width / 2,
1279
+ y: c - l / 2
1280
+ },
1281
+ {
1282
+ x: s + h.width / 2,
1283
+ y: c - l / 2
1284
+ },
1285
+ {
1286
+ x: s + h.width / 2,
1287
+ y: c - l / 2 + h.height + M
1288
+ },
1289
+ {
1290
+ x: s + x / 2,
1291
+ y: c - l / 2 + h.height + M
1292
+ },
1293
+ {
1294
+ x: s + x / 2,
1295
+ y: c + l / 2
1296
+ },
1297
+ {
1298
+ x: s - x / 2,
1299
+ y: c + l / 2
1300
+ },
1301
+ {
1302
+ x: s - x / 2,
1303
+ y: c - l / 2 + h.height + M
1304
+ },
1305
+ {
1306
+ x: s - h.width / 2,
1307
+ y: c - l / 2 + h.height + M
1308
+ }
1309
+ ] : [
1310
+ {
1311
+ x: s - x / 2,
1312
+ y: c - l / 2
1313
+ },
1314
+ {
1315
+ x: s + x / 2,
1316
+ y: c - l / 2
1317
+ },
1318
+ {
1319
+ x: s + x / 2,
1320
+ y: c - l / 2 + y
1321
+ },
1322
+ {
1323
+ x: s + h.width / 2,
1324
+ y: c - l / 2 + y
1325
+ },
1326
+ {
1327
+ x: s + h.width / 2 / 2,
1328
+ y: c + l / 2
1329
+ },
1330
+ {
1331
+ x: s - h.width / 2,
1332
+ y: c + l / 2
1333
+ },
1334
+ {
1335
+ x: s - h.width / 2,
1336
+ y: c - l / 2 + y
1337
+ },
1338
+ {
1339
+ x: s - x / 2,
1340
+ y: c - l / 2 + y
1341
+ }
1342
+ ], intersect_default.polygon(o, u, e);
1343
+ }, m;
1344
+ }
1345
+ __name(iconRounded, "iconRounded");
1346
+ async function iconSquare(e, o, { config: { themeVariables: s, flowchart: c } }) {
1347
+ let { labelStyles: l } = styles2String(o);
1348
+ o.labelStyle = l;
1349
+ let u = o.assetHeight ?? 48, d = o.assetWidth ?? 48, f = Math.max(u, d), p = c?.wrappingWidth;
1350
+ o.width = Math.max(f, p ?? 0);
1351
+ let { shapeSvg: m, bbox: h, halfPadding: g, label: _ } = await labelHelper(e, o, "icon-shape default"), v = o.pos === "t", y = f + g * 2, x = f + g * 2, { nodeBorder: w, mainBkg: D } = s, { stylesMap: k } = compileStyles(o), A = -x / 2, j = -y / 2, M = o.label ? 8 : 0, N = at.svg(m), P = userNodeOverrides(o, {});
1352
+ o.look !== "handDrawn" && (P.roughness = 0, P.fillStyle = "solid"), P.stroke = k.get("fill") ?? D;
1353
+ let F = N.path(createRoundedRectPathD(A, j, x, y, .1), P), L = Math.max(x, h.width), R = y + h.height + M, z = N.rectangle(-L / 2, -R / 2, L, R, {
1354
+ ...P,
1355
+ fill: "transparent",
1356
+ stroke: "none"
1357
+ }), B = m.insert(() => F, ":first-child"), V = m.insert(() => z);
1358
+ if (o.icon) {
1359
+ let e = m.append("g");
1360
+ e.html(`<g>${await getIconSVG(o.icon, {
1361
+ height: f,
1362
+ width: f,
1363
+ fallbackPrefix: ""
1364
+ })}</g>`);
1365
+ let a = e.node().getBBox(), s = a.width, c = a.height, l = a.x, u = a.y;
1366
+ e.attr("transform", `translate(${-s / 2 - l},${v ? h.height / 2 + M / 2 - c / 2 - u : -h.height / 2 - M / 2 - c / 2 - u})`), e.attr("style", `color: ${k.get("stroke") ?? w};`);
1367
+ }
1368
+ return _.attr("transform", `translate(${-h.width / 2 - (h.x - (h.left ?? 0))},${v ? -R / 2 : R / 2 - h.height})`), B.attr("transform", `translate(0,${v ? h.height / 2 + M / 2 : -h.height / 2 - M / 2})`), updateNodeBounds(o, V), o.intersect = function(e) {
1369
+ if (log.info("iconSquare intersect", o, e), !o.label) return intersect_default.rect(o, e);
1370
+ let s = o.x ?? 0, c = o.y ?? 0, l = o.height ?? 0, u = [];
1371
+ return u = v ? [
1372
+ {
1373
+ x: s - h.width / 2,
1374
+ y: c - l / 2
1375
+ },
1376
+ {
1377
+ x: s + h.width / 2,
1378
+ y: c - l / 2
1379
+ },
1380
+ {
1381
+ x: s + h.width / 2,
1382
+ y: c - l / 2 + h.height + M
1383
+ },
1384
+ {
1385
+ x: s + x / 2,
1386
+ y: c - l / 2 + h.height + M
1387
+ },
1388
+ {
1389
+ x: s + x / 2,
1390
+ y: c + l / 2
1391
+ },
1392
+ {
1393
+ x: s - x / 2,
1394
+ y: c + l / 2
1395
+ },
1396
+ {
1397
+ x: s - x / 2,
1398
+ y: c - l / 2 + h.height + M
1399
+ },
1400
+ {
1401
+ x: s - h.width / 2,
1402
+ y: c - l / 2 + h.height + M
1403
+ }
1404
+ ] : [
1405
+ {
1406
+ x: s - x / 2,
1407
+ y: c - l / 2
1408
+ },
1409
+ {
1410
+ x: s + x / 2,
1411
+ y: c - l / 2
1412
+ },
1413
+ {
1414
+ x: s + x / 2,
1415
+ y: c - l / 2 + y
1416
+ },
1417
+ {
1418
+ x: s + h.width / 2,
1419
+ y: c - l / 2 + y
1420
+ },
1421
+ {
1422
+ x: s + h.width / 2 / 2,
1423
+ y: c + l / 2
1424
+ },
1425
+ {
1426
+ x: s - h.width / 2,
1427
+ y: c + l / 2
1428
+ },
1429
+ {
1430
+ x: s - h.width / 2,
1431
+ y: c - l / 2 + y
1432
+ },
1433
+ {
1434
+ x: s - x / 2,
1435
+ y: c - l / 2 + y
1436
+ }
1437
+ ], intersect_default.polygon(o, u, e);
1438
+ }, m;
1439
+ }
1440
+ __name(iconSquare, "iconSquare");
1441
+ async function imageSquare(e, o, { config: { flowchart: s } }) {
1442
+ let c = new Image();
1443
+ c.src = o?.img ?? "", await c.decode();
1444
+ let l = Number(c.naturalWidth.toString().replace("px", "")), u = Number(c.naturalHeight.toString().replace("px", ""));
1445
+ o.imageAspectRatio = l / u;
1446
+ let { labelStyles: d } = styles2String(o);
1447
+ o.labelStyle = d;
1448
+ let f = s?.wrappingWidth;
1449
+ o.defaultWidth = s?.wrappingWidth;
1450
+ let p = Math.max(o.label ? f ?? 0 : 0, o?.assetWidth ?? l), m = o.constraint === "on" && o?.assetHeight ? o.assetHeight * o.imageAspectRatio : p, h = o.constraint === "on" ? m / o.imageAspectRatio : o?.assetHeight ?? u;
1451
+ o.width = Math.max(m, f ?? 0);
1452
+ let { shapeSvg: g, bbox: _, label: v } = await labelHelper(e, o, "image-shape default"), y = o.pos === "t", b = -m / 2, x = -h / 2, w = o.label ? 8 : 0, T = at.svg(g), D = userNodeOverrides(o, {});
1453
+ o.look !== "handDrawn" && (D.roughness = 0, D.fillStyle = "solid");
1454
+ let k = T.rectangle(b, x, m, h, D), A = Math.max(m, _.width), j = h + _.height + w, M = T.rectangle(-A / 2, -j / 2, A, j, {
1455
+ ...D,
1456
+ fill: "none",
1457
+ stroke: "none"
1458
+ }), N = g.insert(() => k, ":first-child"), P = g.insert(() => M);
1459
+ if (o.img) {
1460
+ let e = g.append("image");
1461
+ e.attr("href", o.img), e.attr("width", m), e.attr("height", h), e.attr("preserveAspectRatio", "none"), e.attr("transform", `translate(${-m / 2},${y ? j / 2 - h : -j / 2})`);
1462
+ }
1463
+ return v.attr("transform", `translate(${-_.width / 2 - (_.x - (_.left ?? 0))},${y ? -h / 2 - _.height / 2 - w / 2 : h / 2 - _.height / 2 + w / 2})`), N.attr("transform", `translate(0,${y ? _.height / 2 + w / 2 : -_.height / 2 - w / 2})`), updateNodeBounds(o, P), o.intersect = function(e) {
1464
+ if (log.info("iconSquare intersect", o, e), !o.label) return intersect_default.rect(o, e);
1465
+ let s = o.x ?? 0, c = o.y ?? 0, l = o.height ?? 0, u = [];
1466
+ return u = y ? [
1467
+ {
1468
+ x: s - _.width / 2,
1469
+ y: c - l / 2
1470
+ },
1471
+ {
1472
+ x: s + _.width / 2,
1473
+ y: c - l / 2
1474
+ },
1475
+ {
1476
+ x: s + _.width / 2,
1477
+ y: c - l / 2 + _.height + w
1478
+ },
1479
+ {
1480
+ x: s + m / 2,
1481
+ y: c - l / 2 + _.height + w
1482
+ },
1483
+ {
1484
+ x: s + m / 2,
1485
+ y: c + l / 2
1486
+ },
1487
+ {
1488
+ x: s - m / 2,
1489
+ y: c + l / 2
1490
+ },
1491
+ {
1492
+ x: s - m / 2,
1493
+ y: c - l / 2 + _.height + w
1494
+ },
1495
+ {
1496
+ x: s - _.width / 2,
1497
+ y: c - l / 2 + _.height + w
1498
+ }
1499
+ ] : [
1500
+ {
1501
+ x: s - m / 2,
1502
+ y: c - l / 2
1503
+ },
1504
+ {
1505
+ x: s + m / 2,
1506
+ y: c - l / 2
1507
+ },
1508
+ {
1509
+ x: s + m / 2,
1510
+ y: c - l / 2 + h
1511
+ },
1512
+ {
1513
+ x: s + _.width / 2,
1514
+ y: c - l / 2 + h
1515
+ },
1516
+ {
1517
+ x: s + _.width / 2 / 2,
1518
+ y: c + l / 2
1519
+ },
1520
+ {
1521
+ x: s - _.width / 2,
1522
+ y: c + l / 2
1523
+ },
1524
+ {
1525
+ x: s - _.width / 2,
1526
+ y: c - l / 2 + h
1527
+ },
1528
+ {
1529
+ x: s - m / 2,
1530
+ y: c - l / 2 + h
1531
+ }
1532
+ ], intersect_default.polygon(o, u, e);
1533
+ }, g;
1534
+ }
1535
+ __name(imageSquare, "imageSquare");
1536
+ async function inv_trapezoid(e, a) {
1537
+ let { labelStyles: o, nodeStyles: s } = styles2String(a);
1538
+ a.labelStyle = o;
1539
+ let c = a.padding ?? 0, l = c, u = a.look === "neo" ? c * 2 : c, { shapeSvg: d, bbox: f } = await labelHelper(e, a, getNodeClasses(a)), p = Math.max(f.width + (u ?? 0) * 2, a?.width ?? 0), m = Math.max(f.height + (l ?? 0) * 2, a?.height ?? 0), h = [
1540
+ {
1541
+ x: 0,
1542
+ y: 0
1543
+ },
1544
+ {
1545
+ x: p,
1546
+ y: 0
1547
+ },
1548
+ {
1549
+ x: p + 3 * m / 6,
1550
+ y: -m
1551
+ },
1552
+ {
1553
+ x: -3 * m / 6,
1554
+ y: -m
1555
+ }
1556
+ ], g, { cssStyles: _ } = a;
1557
+ if (a.look === "handDrawn") {
1558
+ let e = at.svg(d), o = userNodeOverrides(a, {}), s = createPathFromPoints(h), c = e.path(s, o);
1559
+ g = d.insert(() => c, ":first-child").attr("transform", `translate(${-p / 2}, ${m / 2})`), _ && g.attr("style", _);
1560
+ } else g = insertPolygonShape(d, p, m, h);
1561
+ return s && g.attr("style", s), a.width = p, a.height = m, updateNodeBounds(a, g), a.intersect = function(e) {
1562
+ return intersect_default.polygon(a, h, e);
1563
+ }, d;
1564
+ }
1565
+ __name(inv_trapezoid, "inv_trapezoid");
1566
+ async function drawRect(e, a, o) {
1567
+ let { labelStyles: s, nodeStyles: c } = styles2String(a);
1568
+ a.labelStyle = s;
1569
+ let { shapeSvg: l, bbox: u } = await labelHelper(e, a, getNodeClasses(a)), d = Math.max(u.width + o.labelPaddingX * 2, a?.width || 0), f = Math.max(u.height + o.labelPaddingY * 2, a?.height || 0), p = -d / 2, m = -f / 2, h, { rx: g, ry: v } = a, { cssStyles: y } = a;
1570
+ if (o?.rx && o.ry && (g = o.rx, v = o.ry), a.look === "handDrawn") {
1571
+ let e = at.svg(l), o = userNodeOverrides(a, {}), s = g || v ? e.path(createRoundedRectPathD(p, m, d, f, g || 0), o) : e.rectangle(p, m, d, f, o);
1572
+ h = l.insert(() => s, ":first-child"), h.attr("class", "basic label-container").attr("style", handleUndefinedAttr(y));
1573
+ } else h = l.insert("rect", ":first-child"), h.attr("class", "basic label-container").attr("style", c).attr("rx", handleUndefinedAttr(g)).attr("ry", handleUndefinedAttr(v)).attr("x", p).attr("y", m).attr("width", d).attr("height", f);
1574
+ return updateNodeBounds(a, h), a.calcIntersect = function(e, a) {
1575
+ return intersect_default.rect(e, a);
1576
+ }, a.intersect = function(e) {
1577
+ return intersect_default.rect(a, e);
1578
+ }, l;
1579
+ }
1580
+ __name(drawRect, "drawRect");
1581
+ async function labelRect(e, a) {
1582
+ let { shapeSvg: o, bbox: s, label: c } = await labelHelper(e, a, "label"), l = o.insert("rect", ":first-child");
1583
+ return l.attr("width", .1).attr("height", .1), o.attr("class", "label edgeLabel"), c.attr("transform", `translate(${-(s.width / 2) - (s.x - (s.left ?? 0))}, ${-(s.height / 2) - (s.y - (s.top ?? 0))})`), updateNodeBounds(a, l), a.intersect = function(e) {
1584
+ return intersect_default.rect(a, e);
1585
+ }, o;
1586
+ }
1587
+ __name(labelRect, "labelRect");
1588
+ async function lean_left(e, a) {
1589
+ let { labelStyles: o, nodeStyles: s } = styles2String(a);
1590
+ a.labelStyle = o;
1591
+ let c = a.padding ?? 0, l = c, u = a.look === "neo" ? c * 2 : c, { shapeSvg: d, bbox: f } = await labelHelper(e, a, getNodeClasses(a)), p = (a?.height ?? f.height) + l, m = (a?.width ?? f.width) + u, h = [
1592
+ {
1593
+ x: 0,
1594
+ y: 0
1595
+ },
1596
+ {
1597
+ x: m + 3 * p / 6,
1598
+ y: 0
1599
+ },
1600
+ {
1601
+ x: m,
1602
+ y: -p
1603
+ },
1604
+ {
1605
+ x: -(3 * p) / 6,
1606
+ y: -p
1607
+ }
1608
+ ], g, { cssStyles: _ } = a;
1609
+ if (a.look === "handDrawn") {
1610
+ let e = at.svg(d), o = userNodeOverrides(a, {}), s = createPathFromPoints(h), c = e.path(s, o);
1611
+ g = d.insert(() => c, ":first-child").attr("transform", `translate(${-m / 2}, ${p / 2})`), _ && g.attr("style", _);
1612
+ } else g = insertPolygonShape(d, m, p, h);
1613
+ return s && g.attr("style", s), a.width = m, a.height = p, updateNodeBounds(a, g), a.intersect = function(e) {
1614
+ return intersect_default.polygon(a, h, e);
1615
+ }, d;
1616
+ }
1617
+ __name(lean_left, "lean_left");
1618
+ async function lean_right(e, a) {
1619
+ let { labelStyles: o, nodeStyles: s } = styles2String(a);
1620
+ a.labelStyle = o;
1621
+ let c = a.padding ?? 0, l = c, u = a.look === "neo" ? c * 2 : c, { shapeSvg: d, bbox: f } = await labelHelper(e, a, getNodeClasses(a)), p = (a?.height ?? f.height) + l, m = (a?.width ?? f.width) + u, h = [
1622
+ {
1623
+ x: -3 * p / 6,
1624
+ y: 0
1625
+ },
1626
+ {
1627
+ x: m,
1628
+ y: 0
1629
+ },
1630
+ {
1631
+ x: m + 3 * p / 6,
1632
+ y: -p
1633
+ },
1634
+ {
1635
+ x: 0,
1636
+ y: -p
1637
+ }
1638
+ ], g, { cssStyles: _ } = a;
1639
+ if (a.look === "handDrawn") {
1640
+ let e = at.svg(d), o = userNodeOverrides(a, {}), s = createPathFromPoints(h), c = e.path(s, o);
1641
+ g = d.insert(() => c, ":first-child").attr("transform", `translate(${-m / 2}, ${p / 2})`), _ && g.attr("style", _);
1642
+ } else g = insertPolygonShape(d, m, p, h);
1643
+ return s && g.attr("style", s), a.width = m, a.height = p, updateNodeBounds(a, g), a.intersect = function(e) {
1644
+ return intersect_default.polygon(a, h, e);
1645
+ }, d;
1646
+ }
1647
+ __name(lean_right, "lean_right");
1648
+ function lightningBolt(e, o) {
1649
+ let { labelStyles: s, nodeStyles: c } = styles2String(o);
1650
+ o.label = "", o.labelStyle = s;
1651
+ let l = e.insert("g").attr("class", getNodeClasses(o)).attr("id", o.domId ?? o.id), { cssStyles: u } = o, d = Math.max(35, o?.width ?? 0), f = Math.max(35, o?.height ?? 0), p = [
1652
+ {
1653
+ x: d,
1654
+ y: 0
1655
+ },
1656
+ {
1657
+ x: 0,
1658
+ y: f + 7 / 2
1659
+ },
1660
+ {
1661
+ x: d - 14,
1662
+ y: f + 7 / 2
1663
+ },
1664
+ {
1665
+ x: 0,
1666
+ y: 2 * f
1667
+ },
1668
+ {
1669
+ x: d,
1670
+ y: f - 7 / 2
1671
+ },
1672
+ {
1673
+ x: 14,
1674
+ y: f - 7 / 2
1675
+ }
1676
+ ], m = at.svg(l), h = userNodeOverrides(o, {});
1677
+ o.look !== "handDrawn" && (h.roughness = 0, h.fillStyle = "solid");
1678
+ let g = createPathFromPoints(p), _ = m.path(g, h), v = l.insert(() => _, ":first-child");
1679
+ return v.attr("class", "outer-path"), u && o.look !== "handDrawn" && v.selectAll("path").attr("style", u), c && o.look !== "handDrawn" && v.selectAll("path").attr("style", c), v.attr("transform", `translate(-${d / 2},${-f})`), updateNodeBounds(o, v), o.intersect = function(e) {
1680
+ return log.info("lightningBolt intersect", o, e), intersect_default.polygon(o, p, e);
1681
+ }, l;
1682
+ }
1683
+ __name(lightningBolt, "lightningBolt");
1684
+ var createCylinderPathD2 = /* @__PURE__ */ __name((e, a, o, s, c, l, u) => [
1685
+ `M${e},${a + l}`,
1686
+ `a${c},${l} 0,0,0 ${o},0`,
1687
+ `a${c},${l} 0,0,0 ${-o},0`,
1688
+ `l0,${s}`,
1689
+ `a${c},${l} 0,0,0 ${o},0`,
1690
+ `l0,${-s}`,
1691
+ `M${e},${a + l + u}`,
1692
+ `a${c},${l} 0,0,0 ${o},0`
1693
+ ].join(" "), "createCylinderPathD"), createOuterCylinderPathD2 = /* @__PURE__ */ __name((e, a, o, s, c, l, u) => [
1694
+ `M${e},${a + l}`,
1695
+ `M${e + o},${a + l}`,
1696
+ `a${c},${l} 0,0,0 ${-o},0`,
1697
+ `l0,${s}`,
1698
+ `a${c},${l} 0,0,0 ${o},0`,
1699
+ `l0,${-s}`,
1700
+ `M${e},${a + l + u}`,
1701
+ `a${c},${l} 0,0,0 ${o},0`
1702
+ ].join(" "), "createOuterCylinderPathD"), createInnerCylinderPathD2 = /* @__PURE__ */ __name((e, a, o, s, c, l) => [`M${e - o / 2},${-s / 2}`, `a${c},${l} 0,0,0 ${o},0`].join(" "), "createInnerCylinderPathD"), MIN_HEIGHT3 = 10, MIN_WIDTH3 = 10;
1703
+ async function linedCylinder(e, a) {
1704
+ let { labelStyles: o, nodeStyles: s } = styles2String(a);
1705
+ a.labelStyle = o;
1706
+ let c = a.padding ?? 0, l = a.look === "neo" ? 16 : c, u = a.look === "neo" ? 24 : c;
1707
+ if (a.width || a.height) {
1708
+ let e = a.width ?? 0;
1709
+ a.width = (a.width ?? 0) - l, a.width < MIN_WIDTH3 && (a.width = MIN_WIDTH3);
1710
+ let o = e / 2 / (2.5 + e / 50);
1711
+ a.height = (a.height ?? 0) - u - o * 3, a.height < MIN_HEIGHT3 && (a.height = MIN_HEIGHT3);
1712
+ }
1713
+ let { shapeSvg: d, bbox: f, label: p } = await labelHelper(e, a, getNodeClasses(a)), m = (a?.width ? a?.width : f.width) + l * 2, h = m / 2, g = h / (2.5 + m / 50), v = (a?.height ? a?.height : f.height) + g + u * 2, y = v * .1, b, { cssStyles: x } = a;
1714
+ if (a.look === "handDrawn") {
1715
+ let e = at.svg(d), o = createOuterCylinderPathD2(0, 0, m, v, h, g, y), s = createInnerCylinderPathD2(0, g, m, v, h, g), c = userNodeOverrides(a, {}), l = e.path(o, c), u = e.path(s, c);
1716
+ d.insert(() => u, ":first-child").attr("class", "line"), b = d.insert(() => l, ":first-child"), b.attr("class", "basic label-container"), x && b.attr("style", x);
1717
+ } else {
1718
+ let e = createCylinderPathD2(0, 0, m, v, h, g, y);
1719
+ b = d.insert("path", ":first-child").attr("d", e).attr("class", "basic label-container outer-path").attr("style", handleUndefinedAttr(x)).attr("style", s);
1720
+ }
1721
+ return b.attr("label-offset-y", g), b.attr("transform", `translate(${-m / 2}, ${-(v / 2 + g)})`), updateNodeBounds(a, b), p.attr("transform", `translate(${-(f.width / 2) - (f.x - (f.left ?? 0))}, ${-(f.height / 2) + g - (f.y - (f.top ?? 0))})`), a.intersect = function(e) {
1722
+ let o = intersect_default.rect(a, e), s = o.x - (a.x ?? 0);
1723
+ if (h != 0 && (Math.abs(s) < (a.width ?? 0) / 2 || Math.abs(s) == (a.width ?? 0) / 2 && Math.abs(o.y - (a.y ?? 0)) > (a.height ?? 0) / 2 - g)) {
1724
+ let c = g * g * (1 - s * s / (h * h));
1725
+ c > 0 && (c = Math.sqrt(c)), c = g - c, e.y - (a.y ?? 0) > 0 && (c = -c), o.y += c;
1726
+ }
1727
+ return o;
1728
+ }, d;
1729
+ }
1730
+ __name(linedCylinder, "linedCylinder");
1731
+ async function linedWaveEdgedRect(e, a) {
1732
+ let { labelStyles: o, nodeStyles: s } = styles2String(a);
1733
+ a.labelStyle = o;
1734
+ let c = a.padding ?? 0, l = a.look === "neo" ? 16 : c, u = a.look === "neo" ? 12 : c;
1735
+ (a.width || a.height) && (a.width = (a.width ?? 0) * 10 / 11 - l * 2, a.width < 10 && (a.width = 10), a.height = (a?.height ?? 0) - u * 2, a.height < 10 && (a.height = 10));
1736
+ let { shapeSvg: d, bbox: f, label: p } = await labelHelper(e, a, getNodeClasses(a)), m = (a?.width ? a?.width : f.width) + (l ?? 0) * 2, h = (a?.height ? a?.height : f.height) + (u ?? 0) * 2, g = a.look === "neo" ? h / 4 : h / 8, _ = h + g, { cssStyles: v } = a, y = at.svg(d), b = userNodeOverrides(a, {});
1737
+ a.look !== "handDrawn" && (b.roughness = 0, b.fillStyle = "solid");
1738
+ let x = [
1739
+ {
1740
+ x: -m / 2 - m / 2 * .1,
1741
+ y: -_ / 2
1742
+ },
1743
+ {
1744
+ x: -m / 2 - m / 2 * .1,
1745
+ y: _ / 2
1746
+ },
1747
+ ...generateFullSineWavePoints(-m / 2 - m / 2 * .1, _ / 2, m / 2 + m / 2 * .1, _ / 2, g, .8),
1748
+ {
1749
+ x: m / 2 + m / 2 * .1,
1750
+ y: -_ / 2
1751
+ },
1752
+ {
1753
+ x: -m / 2 - m / 2 * .1,
1754
+ y: -_ / 2
1755
+ },
1756
+ {
1757
+ x: -m / 2,
1758
+ y: -_ / 2
1759
+ },
1760
+ {
1761
+ x: -m / 2,
1762
+ y: _ / 2 * 1.1
1763
+ },
1764
+ {
1765
+ x: -m / 2,
1766
+ y: -_ / 2
1767
+ }
1768
+ ], w = y.polygon(x.map((e) => [e.x, e.y]), b), T = d.insert(() => w, ":first-child");
1769
+ return T.attr("class", "basic label-container outer-path"), v && a.look !== "handDrawn" && T.selectAll("path").attr("style", v), s && a.look !== "handDrawn" && T.selectAll("path").attr("style", s), T.attr("transform", `translate(0,${-g / 2})`), p.attr("transform", `translate(${-m / 2 + (a.padding ?? 0) + m / 2 * .1 / 2 - (f.x - (f.left ?? 0))},${-h / 2 + (a.padding ?? 0) - g / 2 - (f.y - (f.top ?? 0))})`), updateNodeBounds(a, T), a.intersect = function(e) {
1770
+ return intersect_default.polygon(a, x, e);
1771
+ }, d;
1772
+ }
1773
+ __name(linedWaveEdgedRect, "linedWaveEdgedRect");
1774
+ async function multiRect(e, a) {
1775
+ let { labelStyles: o, nodeStyles: s } = styles2String(a);
1776
+ a.labelStyle = o;
1777
+ let c = a.padding ?? 0, l = a.look === "neo" ? 16 : c, u = a.look === "neo" ? 12 : c, d = a.look === "neo" ? 10 : 5;
1778
+ (a.width || a.height) && (a.width = Math.max((a?.width ?? 0) - l * 2 - 2 * d, 10), a.height = Math.max((a?.height ?? 0) - u * 2 - 2 * d, 10));
1779
+ let { shapeSvg: f, bbox: p, label: m } = await labelHelper(e, a, getNodeClasses(a)), h = (a?.width ? a?.width : p.width) + l * 2 + 2 * d, g = (a?.height ? a?.height : p.height) + u * 2 + 2 * d, _ = h - 2 * d, v = g - 2 * d, y = -_ / 2, b = -v / 2, { cssStyles: x } = a, w = at.svg(f), T = userNodeOverrides(a, {}), D = [
1780
+ {
1781
+ x: y - d,
1782
+ y: b + d
1783
+ },
1784
+ {
1785
+ x: y - d,
1786
+ y: b + v + d
1787
+ },
1788
+ {
1789
+ x: y + _ - d,
1790
+ y: b + v + d
1791
+ },
1792
+ {
1793
+ x: y + _ - d,
1794
+ y: b + v
1795
+ },
1796
+ {
1797
+ x: y + _,
1798
+ y: b + v
1799
+ },
1800
+ {
1801
+ x: y + _,
1802
+ y: b + v - d
1803
+ },
1804
+ {
1805
+ x: y + _ + d,
1806
+ y: b + v - d
1807
+ },
1808
+ {
1809
+ x: y + _ + d,
1810
+ y: b - d
1811
+ },
1812
+ {
1813
+ x: y + d,
1814
+ y: b - d
1815
+ },
1816
+ {
1817
+ x: y + d,
1818
+ y: b
1819
+ },
1820
+ {
1821
+ x: y,
1822
+ y: b
1823
+ },
1824
+ {
1825
+ x: y,
1826
+ y: b + d
1827
+ }
1828
+ ], j = [
1829
+ {
1830
+ x: y,
1831
+ y: b + d
1832
+ },
1833
+ {
1834
+ x: y + _ - d,
1835
+ y: b + d
1836
+ },
1837
+ {
1838
+ x: y + _ - d,
1839
+ y: b + v
1840
+ },
1841
+ {
1842
+ x: y + _,
1843
+ y: b + v
1844
+ },
1845
+ {
1846
+ x: y + _,
1847
+ y: b
1848
+ },
1849
+ {
1850
+ x: y,
1851
+ y: b
1852
+ }
1853
+ ];
1854
+ a.look !== "handDrawn" && (T.roughness = 0, T.fillStyle = "solid");
1855
+ let M = createPathFromPoints(D), P = w.path(M, T), F = createPathFromPoints(j), I = w.path(F, T);
1856
+ a.look !== "handDrawn" && (P = mergePaths(P), I = mergePaths(I));
1857
+ let L = f.insert("g", ":first-child");
1858
+ return L.insert(() => P), L.insert(() => I), L.attr("class", "basic label-container outer-path"), x && a.look !== "handDrawn" && L.selectAll("path").attr("style", x), s && a.look !== "handDrawn" && L.selectAll("path").attr("style", s), m.attr("transform", `translate(${-(p.width / 2) - d - (p.x - (p.left ?? 0))}, ${-(p.height / 2) + d - (p.y - (p.top ?? 0))})`), updateNodeBounds(a, L), a.intersect = function(e) {
1859
+ return intersect_default.polygon(a, D, e);
1860
+ }, f;
1861
+ }
1862
+ __name(multiRect, "multiRect");
1863
+ async function multiWaveEdgedRectangle(e, a) {
1864
+ let { labelStyles: o, nodeStyles: s } = styles2String(a);
1865
+ a.labelStyle = o;
1866
+ let { shapeSvg: c, bbox: l, label: u } = await labelHelper(e, a, getNodeClasses(a)), d = a.padding ?? 0, f = a.look === "neo" ? 16 : d, p = a.look === "neo" ? 12 : d, m = !0;
1867
+ (a.width || a.height) && (m = !1, a.width = (a?.width ?? 0) - f * 2, a.height = (a?.height ?? 0) - p * 3);
1868
+ let h = Math.max(l.width, a?.width ?? 0) + f * 2, g = Math.max(l.height, a?.height ?? 0) + p * 3, _ = a.look === "neo" ? g / 4 : g / 8, v = g + (m ? _ / 2 : -_ / 2), y = -h / 2, b = -v / 2, { cssStyles: x } = a, w = generateFullSineWavePoints(y - 10, b + v + 10, y + h - 10, b + v + 10, _, .8), T = w?.[w.length - 1], D = [
1869
+ {
1870
+ x: y - 10,
1871
+ y: b + 10
1872
+ },
1873
+ {
1874
+ x: y - 10,
1875
+ y: b + v + 10
1876
+ },
1877
+ ...w,
1878
+ {
1879
+ x: y + h - 10,
1880
+ y: T.y - 10
1881
+ },
1882
+ {
1883
+ x: y + h,
1884
+ y: T.y - 10
1885
+ },
1886
+ {
1887
+ x: y + h,
1888
+ y: T.y - 20
1889
+ },
1890
+ {
1891
+ x: y + h + 10,
1892
+ y: T.y - 20
1893
+ },
1894
+ {
1895
+ x: y + h + 10,
1896
+ y: b - 10
1897
+ },
1898
+ {
1899
+ x: y + 10,
1900
+ y: b - 10
1901
+ },
1902
+ {
1903
+ x: y + 10,
1904
+ y: b
1905
+ },
1906
+ {
1907
+ x: y,
1908
+ y: b
1909
+ },
1910
+ {
1911
+ x: y,
1912
+ y: b + 10
1913
+ }
1914
+ ], M = [
1915
+ {
1916
+ x: y,
1917
+ y: b + 10
1918
+ },
1919
+ {
1920
+ x: y + h - 10,
1921
+ y: b + 10
1922
+ },
1923
+ {
1924
+ x: y + h - 10,
1925
+ y: T.y - 10
1926
+ },
1927
+ {
1928
+ x: y + h,
1929
+ y: T.y - 10
1930
+ },
1931
+ {
1932
+ x: y + h,
1933
+ y: b
1934
+ },
1935
+ {
1936
+ x: y,
1937
+ y: b
1938
+ }
1939
+ ], N = at.svg(c), P = userNodeOverrides(a, {});
1940
+ a.look !== "handDrawn" && (P.roughness = 0, P.fillStyle = "solid");
1941
+ let F = createPathFromPoints(D), I = N.path(F, P), L = createPathFromPoints(M), R = N.path(L, P), z = c.insert(() => I, ":first-child");
1942
+ return z.insert(() => R), z.attr("class", "basic label-container outer-path"), x && a.look !== "handDrawn" && z.selectAll("path").attr("style", x), s && a.look !== "handDrawn" && z.selectAll("path").attr("style", s), z.attr("transform", `translate(0,${-_ / 2})`), u.attr("transform", `translate(${-(l.width / 2) - 10 - (l.x - (l.left ?? 0))}, ${-(l.height / 2) + 10 - _ / 2 - (l.y - (l.top ?? 0))})`), updateNodeBounds(a, z), a.intersect = function(e) {
1943
+ return intersect_default.polygon(a, D, e);
1944
+ }, c;
1945
+ }
1946
+ __name(multiWaveEdgedRectangle, "multiWaveEdgedRectangle");
1947
+ async function note(e, a, { config: { themeVariables: o } }) {
1948
+ let { labelStyles: c, nodeStyles: u } = styles2String(a);
1949
+ a.labelStyle = c, a.useHtmlLabels || getEffectiveHtmlLabels(getConfig()) || (a.centerLabel = !0);
1950
+ let { shapeSvg: d, bbox: f, label: p } = await labelHelper(e, a, getNodeClasses(a)), m = Math.max(f.width + (a.padding ?? 0) * 2, a?.width ?? 0), h = Math.max(f.height + (a.padding ?? 0) * 2, a?.height ?? 0), g = -m / 2, _ = -h / 2, { cssStyles: v } = a, y = at.svg(d), b = userNodeOverrides(a, {
1951
+ fill: o.noteBkgColor,
1952
+ stroke: o.noteBorderColor
1953
+ });
1954
+ a.look !== "handDrawn" && (b.roughness = 0, b.fillStyle = "solid");
1955
+ let x = y.rectangle(g, _, m, h, b), w = d.insert(() => x, ":first-child");
1956
+ return w.attr("class", "basic label-container outer-path"), p.attr("class", "label noteLabel"), v && a.look !== "handDrawn" && w.selectAll("path").attr("style", v), u && a.look !== "handDrawn" && w.selectAll("path").attr("style", u), p.attr("transform", `translate(${-f.width / 2 - (f.x - (f.left ?? 0))}, ${-(f.height / 2) - (f.y - (f.top ?? 0))})`), updateNodeBounds(a, w), a.intersect = function(e) {
1957
+ return intersect_default.rect(a, e);
1958
+ }, d;
1959
+ }
1960
+ __name(note, "note");
1961
+ var createDecisionBoxPathD = /* @__PURE__ */ __name((e, a, o) => [
1962
+ `M${e + o / 2},${a}`,
1963
+ `L${e + o},${a - o / 2}`,
1964
+ `L${e + o / 2},${a - o}`,
1965
+ `L${e},${a - o / 2}`,
1966
+ "Z"
1967
+ ].join(" "), "createDecisionBoxPathD");
1968
+ async function question(e, a) {
1969
+ let { labelStyles: o, nodeStyles: s } = styles2String(a);
1970
+ a.labelStyle = o;
1971
+ let { shapeSvg: c, bbox: l } = await labelHelper(e, a, getNodeClasses(a)), u = l.width + (a.padding ?? 0) + (l.height + (a.padding ?? 0)), d = .5, f = [
1972
+ {
1973
+ x: u / 2,
1974
+ y: 0
1975
+ },
1976
+ {
1977
+ x: u,
1978
+ y: -u / 2
1979
+ },
1980
+ {
1981
+ x: u / 2,
1982
+ y: -u
1983
+ },
1984
+ {
1985
+ x: 0,
1986
+ y: -u / 2
1987
+ }
1988
+ ], p, { cssStyles: m } = a;
1989
+ if (a.look === "handDrawn") {
1990
+ let e = at.svg(c), o = userNodeOverrides(a, {}), s = createDecisionBoxPathD(0, 0, u), l = e.path(s, o);
1991
+ p = c.insert(() => l, ":first-child").attr("transform", `translate(${-u / 2 + d}, ${u / 2})`), m && p.attr("style", m);
1992
+ } else p = insertPolygonShape(c, u, u, f), p.attr("transform", `translate(${-u / 2 + d}, ${u / 2})`);
1993
+ return s && p.attr("style", s), updateNodeBounds(a, p), a.calcIntersect = function(e, a) {
1994
+ let o = e.width, s = [
1995
+ {
1996
+ x: o / 2,
1997
+ y: 0
1998
+ },
1999
+ {
2000
+ x: o,
2001
+ y: -o / 2
2002
+ },
2003
+ {
2004
+ x: o / 2,
2005
+ y: -o
2006
+ },
2007
+ {
2008
+ x: 0,
2009
+ y: -o / 2
2010
+ }
2011
+ ], c = intersect_default.polygon(e, s, a);
2012
+ return {
2013
+ x: c.x - .5,
2014
+ y: c.y - .5
2015
+ };
2016
+ }, a.intersect = function(e) {
2017
+ return this.calcIntersect(a, e);
2018
+ }, c;
2019
+ }
2020
+ __name(question, "question");
2021
+ async function rect_left_inv_arrow(e, a) {
2022
+ let { labelStyles: o, nodeStyles: s } = styles2String(a);
2023
+ a.labelStyle = o;
2024
+ let c = a.padding ?? 0, l = a.look === "neo" ? 21 : c ?? 0, u = a.look === "neo" ? 12 : c ?? 0, { shapeSvg: d, bbox: f, label: p } = await labelHelper(e, a, getNodeClasses(a)), m = (a?.width ?? f.width) + (a.look === "neo" ? l * 2 : l), h = (a?.height ?? f.height) + (a.look === "neo" ? u * 2 : u), g = -m / 2, _ = -h / 2, v = _ / 2, y = [
2025
+ {
2026
+ x: g + v,
2027
+ y: _
2028
+ },
2029
+ {
2030
+ x: g,
2031
+ y: 0
2032
+ },
2033
+ {
2034
+ x: g + v,
2035
+ y: -_
2036
+ },
2037
+ {
2038
+ x: -g,
2039
+ y: -_
2040
+ },
2041
+ {
2042
+ x: -g,
2043
+ y: _
2044
+ }
2045
+ ], { cssStyles: b } = a, x = at.svg(d), w = userNodeOverrides(a, {});
2046
+ a.look !== "handDrawn" && (w.roughness = 0, w.fillStyle = "solid");
2047
+ let T = createPathFromPoints(y), D = x.path(T, w), j = d.insert(() => D, ":first-child");
2048
+ return j.attr("class", "basic label-container outer-path"), b && a.look !== "handDrawn" && j.selectAll("path").attr("style", b), s && a.look !== "handDrawn" && j.selectAll("path").attr("style", s), j.attr("transform", `translate(${-v / 2},0)`), p.attr("transform", `translate(${-v / 2 - f.width / 2 - (f.x - (f.left ?? 0))}, ${-(f.height / 2) - (f.y - (f.top ?? 0))})`), updateNodeBounds(a, j), a.intersect = function(e) {
2049
+ return intersect_default.polygon(a, y, e);
2050
+ }, d;
2051
+ }
2052
+ __name(rect_left_inv_arrow, "rect_left_inv_arrow");
2053
+ async function rectWithTitle(e, o) {
2054
+ let { labelStyles: s, nodeStyles: u } = styles2String(o);
2055
+ o.labelStyle = s;
2056
+ let d;
2057
+ d = o.cssClasses ? "node " + o.cssClasses : "node default";
2058
+ let f = e.insert("g").attr("class", d).attr("id", o.domId || o.id), p = f.insert("g"), h = f.insert("g").attr("class", "label").attr("style", u), g = o.description, _ = o.label, v = await createLabel_default(h, _, o.labelStyle, !0, !0), y = {
2059
+ width: 0,
2060
+ height: 0
2061
+ };
2062
+ if (getEffectiveHtmlLabels(getConfig2())) {
2063
+ let e = v.children[0], a = select_default(v);
2064
+ y = e.getBoundingClientRect(), a.attr("width", y.width), a.attr("height", y.height);
2065
+ }
2066
+ log.info("Text 2", g);
2067
+ let b = g || [], x = v.getBBox(), w = await createLabel_default(h, Array.isArray(b) ? b.join("<br/>") : b, o.labelStyle, !0, !0), T = w.children[0], E = select_default(w);
2068
+ y = T.getBoundingClientRect(), E.attr("width", y.width), E.attr("height", y.height);
2069
+ let D = (o.padding || 0) / 2;
2070
+ select_default(w).attr("transform", "translate( " + (y.width > x.width ? 0 : (x.width - y.width) / 2) + ", " + (x.height + D + 5) + ")"), select_default(v).attr("transform", "translate( " + (y.width < x.width ? 0 : -(x.width - y.width) / 2) + ", 0)"), y = h.node().getBBox(), h.attr("transform", "translate(" + -y.width / 2 + ", " + (-y.height / 2 - D + 3) + ")");
2071
+ let k = y.width + (o.padding || 0), A = y.height + (o.padding || 0), j = -y.width / 2 - D, M = -y.height / 2 - D, N, P;
2072
+ if (o.look === "handDrawn") {
2073
+ let e = at.svg(f), s = userNodeOverrides(o, {}), c = e.path(createRoundedRectPathD(j, M, k, A, o.rx || 0), s), l = e.line(-y.width / 2 - D, -y.height / 2 - D + x.height + D, y.width / 2 + D, -y.height / 2 - D + x.height + D, s);
2074
+ P = f.insert(() => (log.debug("Rough node insert CXC", c), l), ":first-child"), N = f.insert(() => (log.debug("Rough node insert CXC", c), c), ":first-child");
2075
+ } else N = p.insert("rect", ":first-child"), P = p.insert("line"), N.attr("class", "outer title-state").attr("style", u).attr("x", -y.width / 2 - D).attr("y", -y.height / 2 - D).attr("width", y.width + (o.padding || 0)).attr("height", y.height + (o.padding || 0)), P.attr("class", "divider").attr("x1", -y.width / 2 - D).attr("x2", y.width / 2 + D).attr("y1", -y.height / 2 - D + x.height + D).attr("y2", -y.height / 2 - D + x.height + D);
2076
+ return updateNodeBounds(o, N), o.intersect = function(e) {
2077
+ return intersect_default.rect(o, e);
2078
+ }, f;
2079
+ }
2080
+ __name(rectWithTitle, "rectWithTitle");
2081
+ async function roundedRect(e, a, { config: { themeVariables: o } }) {
2082
+ let s = o?.radius ?? 5;
2083
+ return drawRect(e, a, {
2084
+ rx: s,
2085
+ ry: s,
2086
+ classes: "",
2087
+ labelPaddingX: (a?.padding ?? 0) * 1,
2088
+ labelPaddingY: (a?.padding ?? 0) * 1
2089
+ });
2090
+ }
2091
+ __name(roundedRect, "roundedRect");
2092
+ var FRAME_WIDTH = 8;
2093
+ async function shadedProcess(e, a) {
2094
+ let { labelStyles: o, nodeStyles: s } = styles2String(a);
2095
+ a.labelStyle = o;
2096
+ let c = a.look === "neo" ? 16 : a.padding ?? 0, l = a.look === "neo" ? 12 : a.padding ?? 0, { shapeSvg: u, bbox: d, label: f } = await labelHelper(e, a, getNodeClasses(a)), p = (a?.width ?? d.width) + c * 2 + (a.look === "neo" ? FRAME_WIDTH : FRAME_WIDTH * 2), m = (a?.height ?? d.height) + l * 2, h = p - FRAME_WIDTH, g = m, v = FRAME_WIDTH - p / 2, y = -m / 2, { cssStyles: b } = a, x = at.svg(u), w = userNodeOverrides(a, {});
2097
+ a.look !== "handDrawn" && (w.roughness = 0, w.fillStyle = "solid");
2098
+ let T = [
2099
+ {
2100
+ x: v,
2101
+ y
2102
+ },
2103
+ {
2104
+ x: v + h,
2105
+ y
2106
+ },
2107
+ {
2108
+ x: v + h,
2109
+ y: y + g
2110
+ },
2111
+ {
2112
+ x: v - FRAME_WIDTH,
2113
+ y: y + g
2114
+ },
2115
+ {
2116
+ x: v - FRAME_WIDTH,
2117
+ y
2118
+ },
2119
+ {
2120
+ x: v,
2121
+ y
2122
+ },
2123
+ {
2124
+ x: v,
2125
+ y: y + g
2126
+ }
2127
+ ], D = x.polygon(T.map((e) => [e.x, e.y]), w), A = u.insert(() => D, ":first-child");
2128
+ return A.attr("class", "basic label-container outer-path").attr("style", handleUndefinedAttr(b)), s && a.look !== "handDrawn" && A.selectAll("path").attr("style", s), b && a.look !== "handDrawn" && A.selectAll("path").attr("style", s), f.attr("transform", `translate(${FRAME_WIDTH / 2 - d.width / 2 - (d.x - (d.left ?? 0))}, ${-(d.height / 2) - (d.y - (d.top ?? 0))})`), updateNodeBounds(a, A), a.intersect = function(e) {
2129
+ return intersect_default.rect(a, e);
2130
+ }, u;
2131
+ }
2132
+ __name(shadedProcess, "shadedProcess");
2133
+ async function slopedRect(e, a) {
2134
+ let { labelStyles: o, nodeStyles: s } = styles2String(a);
2135
+ a.labelStyle = o;
2136
+ let c = a.padding ?? 0, l = a.look === "neo" ? 16 : c, u = a.look === "neo" ? 12 : c;
2137
+ (a.width || a.height) && (a.width = Math.max((a?.width ?? 0) - l * 2, 10), a.height = Math.max((a?.height ?? 0) / 1.5 - u * 2, 10));
2138
+ let { shapeSvg: d, bbox: f, label: p } = await labelHelper(e, a, getNodeClasses(a)), m = (a?.width ? a?.width : f.width) + l * 2, h = ((a?.height ? a?.height : f.height) + u * 2) * 1.5, g = m, _ = h / 1.5, v = -g / 2, y = -_ / 2, { cssStyles: b } = a, x = at.svg(d), w = userNodeOverrides(a, {});
2139
+ a.look !== "handDrawn" && (w.roughness = 0, w.fillStyle = "solid");
2140
+ let T = [
2141
+ {
2142
+ x: v,
2143
+ y
2144
+ },
2145
+ {
2146
+ x: v,
2147
+ y: y + _
2148
+ },
2149
+ {
2150
+ x: v + g,
2151
+ y: y + _
2152
+ },
2153
+ {
2154
+ x: v + g,
2155
+ y: y - _ / 2
2156
+ }
2157
+ ], D = createPathFromPoints(T), j = x.path(D, w), M = d.insert(() => j, ":first-child");
2158
+ return M.attr("class", "basic label-container outer-path"), b && a.look !== "handDrawn" && M.selectChildren("path").attr("style", b), s && a.look !== "handDrawn" && M.selectChildren("path").attr("style", s), M.attr("transform", `translate(0, ${_ / 4})`), p.attr("transform", `translate(${-g / 2 + (a.padding ?? 0) - (f.x - (f.left ?? 0))}, ${-_ / 4 + (a.padding ?? 0) - (f.y - (f.top ?? 0))})`), updateNodeBounds(a, M), a.intersect = function(e) {
2159
+ return intersect_default.polygon(a, T, e);
2160
+ }, d;
2161
+ }
2162
+ __name(slopedRect, "slopedRect");
2163
+ async function squareRect2(e, a) {
2164
+ let o = a.padding ?? 0, s = a.look === "neo" ? 16 : o * 2, c = a.look === "neo" ? 12 : o;
2165
+ return drawRect(e, a, {
2166
+ rx: 0,
2167
+ ry: 0,
2168
+ classes: "",
2169
+ labelPaddingX: a.labelPaddingX ?? s,
2170
+ labelPaddingY: c
2171
+ });
2172
+ }
2173
+ __name(squareRect2, "squareRect");
2174
+ async function stadium(e, a) {
2175
+ let { labelStyles: o, nodeStyles: s } = styles2String(a);
2176
+ a.labelStyle = o;
2177
+ let c = a.padding ?? 0, l = a.look === "neo" ? 20 : c, u = a.look === "neo" ? 12 : c, { shapeSvg: d, bbox: f } = await labelHelper(e, a, getNodeClasses(a)), p = f.height + (a.look === "neo" ? u * 2 : u), m = f.width + p / 4 + (a.look === "neo" ? l * 2 : l), h = p / 2, { cssStyles: g } = a, _ = at.svg(d), v = userNodeOverrides(a, {});
2178
+ a.look !== "handDrawn" && (v.roughness = 0, v.fillStyle = "solid");
2179
+ let y = [
2180
+ {
2181
+ x: -m / 2 + h,
2182
+ y: -p / 2
2183
+ },
2184
+ {
2185
+ x: m / 2 - h,
2186
+ y: -p / 2
2187
+ },
2188
+ ...generateCirclePoints(-m / 2 + h, 0, h, 50, 90, 270),
2189
+ {
2190
+ x: m / 2 - h,
2191
+ y: p / 2
2192
+ },
2193
+ ...generateCirclePoints(m / 2 - h, 0, h, 50, 270, 450)
2194
+ ], b = createPathFromPoints(y), x = _.path(b, v), w = d.insert(() => x, ":first-child");
2195
+ return w.attr("class", "basic label-container outer-path"), g && a.look !== "handDrawn" && w.selectChildren("path").attr("style", g), s && a.look !== "handDrawn" && w.selectChildren("path").attr("style", s), updateNodeBounds(a, w), a.intersect = function(e) {
2196
+ return intersect_default.polygon(a, y, e);
2197
+ }, d;
2198
+ }
2199
+ __name(stadium, "stadium");
2200
+ async function state(e, a) {
2201
+ return drawRect(e, a, {
2202
+ rx: a.look === "neo" ? 3 : 5,
2203
+ ry: a.look === "neo" ? 3 : 5,
2204
+ classes: "flowchart-node"
2205
+ });
2206
+ }
2207
+ __name(state, "state");
2208
+ function stateEnd(e, a, { config: { themeVariables: o } }) {
2209
+ let { labelStyles: s, nodeStyles: c } = styles2String(a);
2210
+ a.labelStyle = s;
2211
+ let { cssStyles: l } = a, { lineColor: u, stateBorder: d, nodeBorder: f, nodeShadow: p } = o;
2212
+ (a.width || a.height) && ((a.width ?? 0) < 14 && (a.width = 14), (a.height ?? 0) < 14 && (a.height = 14)), a.width ||= 14, a.height ||= 14;
2213
+ let m = e.insert("g").attr("class", "node default").attr("id", a.domId ?? a.id), h = at.svg(m), g = userNodeOverrides(a, {});
2214
+ a.look !== "handDrawn" && (g.roughness = 0, g.fillStyle = "solid");
2215
+ let _ = h.circle(0, 0, a.width, {
2216
+ ...g,
2217
+ stroke: u,
2218
+ strokeWidth: 2
2219
+ }), v = d ?? f, y = (a.width ?? 0) * 5 / 14, b = h.circle(0, 0, y, {
2220
+ ...g,
2221
+ fill: v,
2222
+ stroke: v,
2223
+ strokeWidth: 2,
2224
+ fillStyle: "solid"
2225
+ }), x = m.insert(() => _, ":first-child");
2226
+ if (x.insert(() => b), a.look !== "handDrawn" && x.attr("class", "outer-path"), l && x.selectAll("path").attr("style", l), c && x.selectAll("path").attr("style", c), a.width < 25 && p && a.look !== "handDrawn") {
2227
+ let a = e.node()?.ownerSVGElement?.id ?? "", o = a ? `${a}-drop-shadow-small` : "drop-shadow-small";
2228
+ x.attr("style", `filter:url(#${o})`);
2229
+ }
2230
+ return updateNodeBounds(a, x), a.intersect = function(e) {
2231
+ return intersect_default.circle(a, (a.width ?? 0) / 2, e);
2232
+ }, m;
2233
+ }
2234
+ __name(stateEnd, "stateEnd");
2235
+ function stateStart(e, a, { config: { themeVariables: o } }) {
2236
+ let { lineColor: s, nodeShadow: c } = o;
2237
+ (a.width || a.height) && ((a.width ?? 0) < 14 && (a.width = 14), (a.height ?? 0) < 14 && (a.height = 14)), a.width ||= 14, a.height ||= 14;
2238
+ let l = e.insert("g").attr("class", "node default").attr("id", a.domId || a.id), u;
2239
+ if (a.look === "handDrawn") {
2240
+ let e = at.svg(l).circle(0, 0, a.width, solidStateFill(s));
2241
+ u = l.insert(() => e), u.attr("class", "state-start").attr("r", (a.width ?? 7) / 2).attr("width", a.width ?? 14).attr("height", a.height ?? 14);
2242
+ } else u = l.insert("circle", ":first-child"), u.attr("class", "state-start").attr("r", (a.width ?? 7) / 2).attr("width", a.width ?? 14).attr("height", a.height ?? 14);
2243
+ if (a.width < 25 && c && a.look !== "handDrawn") {
2244
+ let a = e.node()?.ownerSVGElement?.id ?? "", o = a ? `${a}-drop-shadow-small` : "drop-shadow-small";
2245
+ u.attr("style", `filter:url(#${o})`);
2246
+ }
2247
+ return updateNodeBounds(a, u), a.intersect = function(e) {
2248
+ return intersect_default.circle(a, (a.width ?? 7) / 2, e);
2249
+ }, l;
2250
+ }
2251
+ __name(stateStart, "stateStart");
2252
+ var FRAME_WIDTH2 = 8;
2253
+ async function subroutine(e, a) {
2254
+ let { labelStyles: o, nodeStyles: s } = styles2String(a);
2255
+ a.labelStyle = o;
2256
+ let c = a?.padding ?? 8, l = a.look === "neo" ? 28 : c, u = a.look === "neo" ? 12 : c, { shapeSvg: d, bbox: f } = await labelHelper(e, a, getNodeClasses(a)), p = (a?.width ?? f.width) + 2 * FRAME_WIDTH2 + l, m = (a?.height ?? f.height) + u, h = p - 2 * FRAME_WIDTH2, g = m, v = -p / 2, y = -m / 2, b = [
2257
+ {
2258
+ x: 0,
2259
+ y: 0
2260
+ },
2261
+ {
2262
+ x: h,
2263
+ y: 0
2264
+ },
2265
+ {
2266
+ x: h,
2267
+ y: -g
2268
+ },
2269
+ {
2270
+ x: 0,
2271
+ y: -g
2272
+ },
2273
+ {
2274
+ x: 0,
2275
+ y: 0
2276
+ },
2277
+ {
2278
+ x: -8,
2279
+ y: 0
2280
+ },
2281
+ {
2282
+ x: h + 8,
2283
+ y: 0
2284
+ },
2285
+ {
2286
+ x: h + 8,
2287
+ y: -g
2288
+ },
2289
+ {
2290
+ x: -8,
2291
+ y: -g
2292
+ },
2293
+ {
2294
+ x: -8,
2295
+ y: 0
2296
+ }
2297
+ ];
2298
+ if (a.look === "handDrawn") {
2299
+ let e = at.svg(d), o = userNodeOverrides(a, {}), s = e.rectangle(v, y, h + 16, g, o), c = e.line(v + FRAME_WIDTH2, y, v + FRAME_WIDTH2, y + g, o), l = e.line(v + FRAME_WIDTH2 + h, y, v + FRAME_WIDTH2 + h, y + g, o);
2300
+ d.insert(() => c, ":first-child"), d.insert(() => l, ":first-child");
2301
+ let u = d.insert(() => s, ":first-child"), { cssStyles: f } = a;
2302
+ u.attr("class", "basic label-container").attr("style", handleUndefinedAttr(f)), updateNodeBounds(a, u);
2303
+ } else {
2304
+ let e = insertPolygonShape(d, h, g, b);
2305
+ s && e.attr("style", s), updateNodeBounds(a, e);
2306
+ }
2307
+ return a.intersect = function(e) {
2308
+ return intersect_default.polygon(a, b, e);
2309
+ }, d;
2310
+ }
2311
+ __name(subroutine, "subroutine");
2312
+ var TAG_RATIO = .2;
2313
+ async function taggedRect(e, a) {
2314
+ let { labelStyles: o, nodeStyles: s } = styles2String(a);
2315
+ a.labelStyle = o;
2316
+ let c = a.padding ?? 0, l = a.look === "neo" ? 16 : c, u = a.look === "neo" ? 12 : c;
2317
+ (a.width || a.height) && (a.height = Math.max((a?.height ?? 0) - u * 2, 10), a.width = Math.max((a?.width ?? 0) - l * 2 - TAG_RATIO * (a.height + u * 2), 10));
2318
+ let { shapeSvg: d, bbox: f } = await labelHelper(e, a, getNodeClasses(a)), p = (a?.height ? a?.height : f.height) + u * 2, m = TAG_RATIO * p, h = TAG_RATIO * p, g = (a?.width ? a?.width : f.width) + l * 2 + m - m, _ = p, v = -g / 2, y = -_ / 2, { cssStyles: b } = a, x = at.svg(d), w = userNodeOverrides(a, {}), T = [
2319
+ {
2320
+ x: v - m / 2,
2321
+ y
2322
+ },
2323
+ {
2324
+ x: v + g + m / 2,
2325
+ y
2326
+ },
2327
+ {
2328
+ x: v + g + m / 2,
2329
+ y: y + _
2330
+ },
2331
+ {
2332
+ x: v - m / 2,
2333
+ y: y + _
2334
+ }
2335
+ ], D = [
2336
+ {
2337
+ x: v + g - m / 2,
2338
+ y: y + _
2339
+ },
2340
+ {
2341
+ x: v + g + m / 2,
2342
+ y: y + _
2343
+ },
2344
+ {
2345
+ x: v + g + m / 2,
2346
+ y: y + _ - h
2347
+ }
2348
+ ];
2349
+ a.look !== "handDrawn" && (w.roughness = 0, w.fillStyle = "solid");
2350
+ let j = createPathFromPoints(T), M = x.path(j, w), N = createPathFromPoints(D), P = x.path(N, {
2351
+ ...w,
2352
+ fillStyle: "solid"
2353
+ }), F = d.insert(() => P, ":first-child");
2354
+ return F.insert(() => M, ":first-child"), F.attr("class", "basic label-container outer-path"), b && a.look !== "handDrawn" && F.selectAll("path").attr("style", b), s && a.look !== "handDrawn" && F.selectAll("path").attr("style", s), updateNodeBounds(a, F), a.intersect = function(e) {
2355
+ return intersect_default.polygon(a, T, e);
2356
+ }, d;
2357
+ }
2358
+ __name(taggedRect, "taggedRect");
2359
+ async function taggedWaveEdgedRectangle(e, a) {
2360
+ let { labelStyles: o, nodeStyles: s } = styles2String(a);
2361
+ a.labelStyle = o;
2362
+ let { shapeSvg: c, bbox: l, label: u } = await labelHelper(e, a, getNodeClasses(a)), d = Math.max(l.width + (a.padding ?? 0) * 2, a?.width ?? 0), f = Math.max(l.height + (a.padding ?? 0) * 2, a?.height ?? 0), p = f / 8, m = .2 * d, h = .2 * f, g = f + p, { cssStyles: _ } = a, v = at.svg(c), y = userNodeOverrides(a, {});
2363
+ a.look !== "handDrawn" && (y.roughness = 0, y.fillStyle = "solid");
2364
+ let b = [
2365
+ {
2366
+ x: -d / 2 - d / 2 * .1,
2367
+ y: g / 2
2368
+ },
2369
+ ...generateFullSineWavePoints(-d / 2 - d / 2 * .1, g / 2, d / 2 + d / 2 * .1, g / 2, p, .8),
2370
+ {
2371
+ x: d / 2 + d / 2 * .1,
2372
+ y: -g / 2
2373
+ },
2374
+ {
2375
+ x: -d / 2 - d / 2 * .1,
2376
+ y: -g / 2
2377
+ }
2378
+ ], x = -d / 2 + d / 2 * .1, w = -g / 2 - h * .4, T = [
2379
+ {
2380
+ x: x + d - m,
2381
+ y: (w + f) * 1.3
2382
+ },
2383
+ {
2384
+ x: x + d,
2385
+ y: w + f - h
2386
+ },
2387
+ {
2388
+ x: x + d,
2389
+ y: (w + f) * .9
2390
+ },
2391
+ ...generateFullSineWavePoints(x + d, (w + f) * 1.25, x + d - m, (w + f) * 1.3, -f * .02, .5)
2392
+ ], D = createPathFromPoints(b), M = v.path(D, y), N = createPathFromPoints(T), P = v.path(N, {
2393
+ ...y,
2394
+ fillStyle: "solid"
2395
+ }), F = c.insert(() => P, ":first-child");
2396
+ return F.insert(() => M, ":first-child"), F.attr("class", "basic label-container outer-path"), _ && a.look !== "handDrawn" && F.selectAll("path").attr("style", _), s && a.look !== "handDrawn" && F.selectAll("path").attr("style", s), F.attr("transform", `translate(0,${-p / 2})`), u.attr("transform", `translate(${-d / 2 + (a.padding ?? 0) - (l.x - (l.left ?? 0))},${-f / 2 + (a.padding ?? 0) - p / 2 - (l.y - (l.top ?? 0))})`), updateNodeBounds(a, F), a.intersect = function(e) {
2397
+ return intersect_default.polygon(a, b, e);
2398
+ }, c;
2399
+ }
2400
+ __name(taggedWaveEdgedRectangle, "taggedWaveEdgedRectangle");
2401
+ async function text(e, a) {
2402
+ let { labelStyles: o, nodeStyles: s } = styles2String(a);
2403
+ a.labelStyle = o;
2404
+ let { shapeSvg: c, bbox: l } = await labelHelper(e, a, getNodeClasses(a)), u = Math.max(l.width + (a.padding ?? 0), a?.width || 0), d = Math.max(l.height + (a.padding ?? 0), a?.height || 0), f = -u / 2, p = -d / 2, m = c.insert("rect", ":first-child");
2405
+ return m.attr("class", "text").attr("style", s).attr("rx", 0).attr("ry", 0).attr("x", f).attr("y", p).attr("width", u).attr("height", d), updateNodeBounds(a, m), a.intersect = function(e) {
2406
+ return intersect_default.rect(a, e);
2407
+ }, c;
2408
+ }
2409
+ __name(text, "text");
2410
+ var createCylinderPathD3 = /* @__PURE__ */ __name((e, a, o, s, c, l) => `M${e},${a}
2411
+ a${c},${l} 0,0,1 0,${-s}
2412
+ l${o},0
2413
+ a${c},${l} 0,0,1 0,${s}
2414
+ M${o},${-s}
2415
+ a${c},${l} 0,0,0 0,${s}
2416
+ l${-o},0`, "createCylinderPathD"), createOuterCylinderPathD3 = /* @__PURE__ */ __name((e, a, o, s, c, l) => [
2417
+ `M${e},${a}`,
2418
+ `M${e + o},${a}`,
2419
+ `a${c},${l} 0,0,0 0,${-s}`,
2420
+ `l${-o},0`,
2421
+ `a${c},${l} 0,0,0 0,${s}`,
2422
+ `l${o},0`
2423
+ ].join(" "), "createOuterCylinderPathD"), createInnerCylinderPathD3 = /* @__PURE__ */ __name((e, a, o, s, c, l) => [`M${e + o / 2},${-s / 2}`, `a${c},${l} 0,0,0 0,${s}`].join(" "), "createInnerCylinderPathD"), MIN_HEIGHT4 = 5, MIN_WIDTH4 = 10;
2424
+ async function tiltedCylinder(e, a) {
2425
+ let { labelStyles: o, nodeStyles: s } = styles2String(a);
2426
+ a.labelStyle = o;
2427
+ let c = a.padding ?? 0, l = a.look === "neo" ? 12 : c / 2;
2428
+ if (a.width || a.height) {
2429
+ let e = a.height ?? 0;
2430
+ a.height = (a.height ?? 0) - l, a.height < MIN_HEIGHT4 && (a.height = MIN_HEIGHT4);
2431
+ let o = e / 2 / (2.5 + e / 50);
2432
+ a.width = (a.width ?? 0) - l - o * 3, a.width < MIN_WIDTH4 && (a.width = MIN_WIDTH4);
2433
+ }
2434
+ let { shapeSvg: u, bbox: d, label: f } = await labelHelper(e, a, getNodeClasses(a)), p = (a.height ? a.height : d.height) + l, m = p / 2, h = m / (2.5 + p / 50), g = (a.width ? a.width : d.width) + h + l, { cssStyles: v } = a, y;
2435
+ if (a.look === "handDrawn") {
2436
+ let e = at.svg(u), o = createOuterCylinderPathD3(0, 0, g, p, h, m), s = createInnerCylinderPathD3(0, 0, g, p, h, m), c = e.path(o, userNodeOverrides(a, {})), l = e.path(s, userNodeOverrides(a, { fill: "none" }));
2437
+ y = u.insert(() => l, ":first-child"), y = u.insert(() => c, ":first-child"), y.attr("class", "basic label-container"), v && y.attr("style", v);
2438
+ } else {
2439
+ let e = createCylinderPathD3(0, 0, g, p, h, m);
2440
+ y = u.insert("path", ":first-child").attr("d", e).attr("class", "basic label-container").attr("style", handleUndefinedAttr(v)).attr("style", s), y.attr("class", "basic label-container outer-path"), v && y.selectAll("path").attr("style", v), s && y.selectAll("path").attr("style", s);
2441
+ }
2442
+ return y.attr("label-offset-x", h), y.attr("transform", `translate(${-g / 2}, ${p / 2} )`), f.attr("transform", `translate(${-(d.width / 2) - h - (d.x - (d.left ?? 0))}, ${-(d.height / 2) - (d.y - (d.top ?? 0))})`), updateNodeBounds(a, y), a.intersect = function(e) {
2443
+ let o = intersect_default.rect(a, e), s = o.y - (a.y ?? 0);
2444
+ if (m != 0 && (Math.abs(s) < (a.height ?? 0) / 2 || Math.abs(s) == (a.height ?? 0) / 2 && Math.abs(o.x - (a.x ?? 0)) > (a.width ?? 0) / 2 - h)) {
2445
+ let c = h * h * (1 - s * s / (m * m));
2446
+ c != 0 && (c = Math.sqrt(Math.abs(c))), c = h - c, e.x - (a.x ?? 0) > 0 && (c = -c), o.x += c;
2447
+ }
2448
+ return o;
2449
+ }, u;
2450
+ }
2451
+ __name(tiltedCylinder, "tiltedCylinder");
2452
+ async function trapezoid(e, a) {
2453
+ let { labelStyles: o, nodeStyles: s } = styles2String(a);
2454
+ a.labelStyle = o;
2455
+ let c = a.padding ?? 0, l = (a.look, c), u = a.look === "neo" ? c * 2 : c, { shapeSvg: d, bbox: f } = await labelHelper(e, a, getNodeClasses(a)), p = (a?.height ?? f.height) + l, m = (a?.width ?? f.width) + u, h = [
2456
+ {
2457
+ x: -3 * p / 6,
2458
+ y: 0
2459
+ },
2460
+ {
2461
+ x: m + 3 * p / 6,
2462
+ y: 0
2463
+ },
2464
+ {
2465
+ x: m,
2466
+ y: -p
2467
+ },
2468
+ {
2469
+ x: 0,
2470
+ y: -p
2471
+ }
2472
+ ], g, { cssStyles: _ } = a;
2473
+ if (a.look === "handDrawn") {
2474
+ let e = at.svg(d), o = userNodeOverrides(a, {}), s = createPathFromPoints(h), c = e.path(s, o);
2475
+ g = d.insert(() => c, ":first-child").attr("transform", `translate(${-m / 2}, ${p / 2})`), _ && g.attr("style", _);
2476
+ } else g = insertPolygonShape(d, m, p, h);
2477
+ return s && g.attr("style", s), a.width = m, a.height = p, updateNodeBounds(a, g), a.intersect = function(e) {
2478
+ return intersect_default.polygon(a, h, e);
2479
+ }, d;
2480
+ }
2481
+ __name(trapezoid, "trapezoid");
2482
+ async function trapezoidalPentagon(e, a) {
2483
+ let { labelStyles: o, nodeStyles: s } = styles2String(a);
2484
+ a.labelStyle = o;
2485
+ let c = a.padding ?? 0, l = a.look === "neo" ? 16 : c, u = a.look === "neo" ? 12 : c;
2486
+ (a.width || a.height) && (a.height = (a.height ?? 0) - u * 2, a.height < 5 && (a.height = 5), a.width = (a.width ?? 0) - l * 2, a.width < 15 && (a.width = 15));
2487
+ let { shapeSvg: d, bbox: f } = await labelHelper(e, a, getNodeClasses(a)), p = (a?.width ? a?.width : f.width) + l * 2, m = (a?.height ? a?.height : f.height) + u * 2, { cssStyles: h } = a, g = at.svg(d), _ = userNodeOverrides(a, {});
2488
+ a.look !== "handDrawn" && (_.roughness = 0, _.fillStyle = "solid");
2489
+ let v = [
2490
+ {
2491
+ x: -p / 2 * .8,
2492
+ y: -m / 2
2493
+ },
2494
+ {
2495
+ x: p / 2 * .8,
2496
+ y: -m / 2
2497
+ },
2498
+ {
2499
+ x: p / 2,
2500
+ y: -m / 2 * .6
2501
+ },
2502
+ {
2503
+ x: p / 2,
2504
+ y: m / 2
2505
+ },
2506
+ {
2507
+ x: -p / 2,
2508
+ y: m / 2
2509
+ },
2510
+ {
2511
+ x: -p / 2,
2512
+ y: -m / 2 * .6
2513
+ }
2514
+ ], y = createPathFromPoints(v), b = g.path(y, _), x = d.insert(() => b, ":first-child");
2515
+ return x.attr("class", "basic label-container outer-path"), h && a.look !== "handDrawn" && x.selectChildren("path").attr("style", h), s && a.look !== "handDrawn" && x.selectChildren("path").attr("style", s), updateNodeBounds(a, x), a.intersect = function(e) {
2516
+ return intersect_default.polygon(a, v, e);
2517
+ }, d;
2518
+ }
2519
+ __name(trapezoidalPentagon, "trapezoidalPentagon");
2520
+ var MIN_HEIGHT5 = 10, MIN_WIDTH5 = 10;
2521
+ async function triangle(e, s) {
2522
+ let { labelStyles: l, nodeStyles: u } = styles2String(s);
2523
+ s.labelStyle = l;
2524
+ let d = s.padding ?? 0, f = s.look === "neo" ? d * 2 : d;
2525
+ (s.width || s.height) && (s.width = ((s?.width ?? 0) - f) / 2, s.width < MIN_WIDTH5 && (s.width = MIN_WIDTH5), s.height = s?.height ?? 0, s.height < MIN_HEIGHT5 && (s.height = MIN_HEIGHT5));
2526
+ let { shapeSvg: p, bbox: m, label: h } = await labelHelper(e, s, getNodeClasses(s)), g = evaluate(getConfig2().flowchart?.htmlLabels), _ = (s?.width ? s?.width : m.width) + f, v = s?.height ? s?.height : _ + m.height, y = v, b = [
2527
+ {
2528
+ x: 0,
2529
+ y: 0
2530
+ },
2531
+ {
2532
+ x: y,
2533
+ y: 0
2534
+ },
2535
+ {
2536
+ x: y / 2,
2537
+ y: -v
2538
+ }
2539
+ ], { cssStyles: x } = s, w = at.svg(p), T = userNodeOverrides(s, {});
2540
+ s.look !== "handDrawn" && (T.roughness = 0, T.fillStyle = "solid");
2541
+ let D = createPathFromPoints(b), j = w.path(D, T), M = p.insert(() => j, ":first-child").attr("transform", `translate(${-v / 2}, ${v / 2})`).attr("class", "outer-path");
2542
+ return x && s.look !== "handDrawn" && M.selectChildren("path").attr("style", x), u && s.look !== "handDrawn" && M.selectChildren("path").attr("style", u), s.width = _, s.height = v, updateNodeBounds(s, M), h.attr("transform", `translate(${-m.width / 2 - (m.x - (m.left ?? 0))}, ${v / 2 - (m.height + (s.padding ?? 0) / (g ? 2 : 1) - (m.y - (m.top ?? 0)))})`), s.intersect = function(e) {
2543
+ return log.info("Triangle intersect", s, b, e), intersect_default.polygon(s, b, e);
2544
+ }, p;
2545
+ }
2546
+ __name(triangle, "triangle");
2547
+ async function waveEdgedRectangle(e, a) {
2548
+ let { labelStyles: o, nodeStyles: s } = styles2String(a);
2549
+ a.labelStyle = o;
2550
+ let c = a.padding ?? 0, l = a.look === "neo" ? 16 : c, u = a.look === "neo" ? 12 : c, d = !0;
2551
+ (a.width || a.height) && (d = !1, a.width = (a?.width ?? 0) - l * 2, a.width < 10 && (a.width = 10), a.height = (a?.height ?? 0) - u * 2, a.height < 10 && (a.height = 10));
2552
+ let { shapeSvg: f, bbox: p, label: m } = await labelHelper(e, a, getNodeClasses(a)), h = (a?.width ? a?.width : p.width) + (l ?? 0) * 2, g = (a?.height ? a?.height : p.height) + (u ?? 0) * 2, _ = a.look === "neo" ? g / 4 : g / 8, v = g + (d ? _ : -_), { cssStyles: y } = a, b = 14 - h, x = b > 0 ? b / 2 : 0, w = at.svg(f), T = userNodeOverrides(a, {});
2553
+ a.look !== "handDrawn" && (T.roughness = 0, T.fillStyle = "solid");
2554
+ let D = [
2555
+ {
2556
+ x: -h / 2 - x,
2557
+ y: v / 2
2558
+ },
2559
+ ...generateFullSineWavePoints(-h / 2 - x, v / 2, h / 2 + x, v / 2, _, .8),
2560
+ {
2561
+ x: h / 2 + x,
2562
+ y: -v / 2
2563
+ },
2564
+ {
2565
+ x: -h / 2 - x,
2566
+ y: -v / 2
2567
+ }
2568
+ ], M = createPathFromPoints(D), N = w.path(M, T), P = f.insert(() => N, ":first-child");
2569
+ return P.attr("class", "basic label-container outer-path"), y && a.look !== "handDrawn" && P.selectAll("path").attr("style", y), s && a.look !== "handDrawn" && P.selectAll("path").attr("style", s), P.attr("transform", `translate(0,${-_ / 2})`), m.attr("transform", `translate(${-h / 2 + (a.padding ?? 0) - (p.x - (p.left ?? 0))},${-g / 2 + (a.padding ?? 0) - _ - (p.y - (p.top ?? 0))})`), updateNodeBounds(a, P), a.intersect = function(e) {
2570
+ return intersect_default.polygon(a, D, e);
2571
+ }, f;
2572
+ }
2573
+ __name(waveEdgedRectangle, "waveEdgedRectangle");
2574
+ async function waveRectangle(e, a) {
2575
+ let { labelStyles: o, nodeStyles: s } = styles2String(a);
2576
+ a.labelStyle = o;
2577
+ let c = a.padding ?? 0, l = a.look === "neo" ? 16 : c, u = a.look === "neo" ? 20 : c;
2578
+ if (a.width || a.height) {
2579
+ a.width = a?.width ?? 0, a.width < 20 && (a.width = 20), a.height = a?.height ?? 0, a.height < 10 && (a.height = 10);
2580
+ let e = Math.min(a.height * .2, a.height / 4);
2581
+ a.height = Math.ceil(a.height - u - 20 / 9 * e), a.width -= l * 2;
2582
+ }
2583
+ let { shapeSvg: d, bbox: f } = await labelHelper(e, a, getNodeClasses(a)), p = (a?.width ? a?.width : f.width) + l * 2, m = (a?.height ? a?.height : f.height) + u, h = m / 8, g = m + h * 2, { cssStyles: _ } = a, v = at.svg(d), y = userNodeOverrides(a, {});
2584
+ a.look !== "handDrawn" && (y.roughness = 0, y.fillStyle = "solid");
2585
+ let b = [
2586
+ {
2587
+ x: -p / 2,
2588
+ y: g / 2
2589
+ },
2590
+ ...generateFullSineWavePoints(-p / 2, g / 2, p / 2, g / 2, h, 1),
2591
+ {
2592
+ x: p / 2,
2593
+ y: -g / 2
2594
+ },
2595
+ ...generateFullSineWavePoints(p / 2, -g / 2, -p / 2, -g / 2, h, -1)
2596
+ ], x = createPathFromPoints(b), w = v.path(x, y), T = d.insert(() => w, ":first-child");
2597
+ return T.attr("class", "basic label-container"), _ && a.look !== "handDrawn" && T.selectAll("path").attr("style", _), s && a.look !== "handDrawn" && T.selectAll("path").attr("style", s), updateNodeBounds(a, T), a.intersect = function(e) {
2598
+ return intersect_default.polygon(a, b, e);
2599
+ }, d;
2600
+ }
2601
+ __name(waveRectangle, "waveRectangle");
2602
+ var rectOffset = 10;
2603
+ async function windowPane(e, a) {
2604
+ let { labelStyles: o, nodeStyles: s } = styles2String(a);
2605
+ a.labelStyle = o;
2606
+ let c = a.look === "neo" ? 16 : a.padding ?? 0, l = a.look === "neo" ? 12 : a.padding ?? 0;
2607
+ (a.width || a.height) && (a.width = Math.max((a?.width ?? 0) - c * 2 - rectOffset, 10), a.height = Math.max((a?.height ?? 0) - l * 2 - rectOffset, 10));
2608
+ let { shapeSvg: u, bbox: d, label: f } = await labelHelper(e, a, getNodeClasses(a)), p = (a?.width ? a?.width : d.width) + c * 2 + rectOffset, m = (a?.height ? a?.height : d.height) + l * 2 + rectOffset, h = p - rectOffset, g = m - rectOffset, _ = -h / 2, v = -g / 2, { cssStyles: y } = a, b = at.svg(u), x = userNodeOverrides(a, {}), w = [
2609
+ {
2610
+ x: _ - rectOffset,
2611
+ y: v - rectOffset
2612
+ },
2613
+ {
2614
+ x: _ - rectOffset,
2615
+ y: v + g
2616
+ },
2617
+ {
2618
+ x: _ + h,
2619
+ y: v + g
2620
+ },
2621
+ {
2622
+ x: _ + h,
2623
+ y: v - rectOffset
2624
+ }
2625
+ ], T = `M${_ - rectOffset},${v - rectOffset} L${_ + h},${v - rectOffset} L${_ + h},${v + g} L${_ - rectOffset},${v + g} L${_ - rectOffset},${v - rectOffset}
2626
+ M${_ - rectOffset},${v} L${_ + h},${v}
2627
+ M${_},${v - rectOffset} L${_},${v + g}`;
2628
+ a.look !== "handDrawn" && (x.roughness = 0, x.fillStyle = "solid");
2629
+ let D = b.path(T, x), A = u.insert(() => D, ":first-child");
2630
+ return A.attr("transform", `translate(${rectOffset / 2}, ${rectOffset / 2})`), A.attr("class", "basic label-container outer-path"), y && a.look !== "handDrawn" && A.selectAll("path").attr("style", y), s && a.look !== "handDrawn" && A.selectAll("path").attr("style", s), f.attr("transform", `translate(${-(d.width / 2) + rectOffset / 2 - (d.x - (d.left ?? 0))}, ${-(d.height / 2) + rectOffset / 2 - (d.y - (d.top ?? 0))})`), updateNodeBounds(a, A), a.intersect = function(e) {
2631
+ return intersect_default.polygon(a, w, e);
2632
+ }, u;
2633
+ }
2634
+ __name(windowPane, "windowPane");
2635
+ var COLOR_THEMES = /* @__PURE__ */ new Set(["redux-color", "redux-dark-color"]), REDUX_THEMES = /* @__PURE__ */ new Set([
2636
+ "redux",
2637
+ "redux-dark",
2638
+ "redux-color",
2639
+ "redux-dark-color"
2640
+ ]);
2641
+ async function erBox(e, a) {
2642
+ let c = a;
2643
+ c.alias && (a.label = c.alias);
2644
+ let { theme: l, themeVariables: u } = getConfig(), { rowEven: d, rowOdd: f, nodeBorder: p, borderColorArray: g } = u;
2645
+ if (a.look === "handDrawn") {
2646
+ let { themeVariables: o } = getConfig(), { background: c } = o;
2647
+ await erBox(e, {
2648
+ ...a,
2649
+ id: a.id + "-background",
2650
+ domId: (a.domId || a.id) + "-background",
2651
+ look: "default",
2652
+ cssStyles: ["stroke: none", `fill: ${c}`]
2653
+ });
2654
+ }
2655
+ let _ = getConfig();
2656
+ a.useHtmlLabels = _.htmlLabels;
2657
+ let v = _.er?.diagramPadding ?? 10, y = _.er?.entityPadding ?? 6, { cssStyles: b } = a, { labelStyles: x, nodeStyles: w } = styles2String(a);
2658
+ if (c.attributes.length === 0 && a.label) {
2659
+ let s = {
2660
+ rx: 0,
2661
+ ry: 0,
2662
+ labelPaddingX: v,
2663
+ labelPaddingY: v * 1.5,
2664
+ classes: ""
2665
+ };
2666
+ calculateTextWidth(a.label, _) + s.labelPaddingX * 2 < _.er.minEntityWidth && (a.width = _.er.minEntityWidth);
2667
+ let u = await drawRect(e, a, s);
2668
+ if (l != null && COLOR_THEMES.has(l)) {
2669
+ let e = c.colorIndex ?? 0;
2670
+ u.attr("data-color-id", `color-${e % g.length}`);
2671
+ }
2672
+ if (!evaluate(_.htmlLabels)) {
2673
+ let e = u.select("text"), a = e.node()?.getBBox();
2674
+ e.attr("transform", `translate(${-a.width / 2}, 0)`);
2675
+ }
2676
+ return u;
2677
+ }
2678
+ _.htmlLabels || (v *= 1.25, y *= 1.25);
2679
+ let T = getNodeClasses(a);
2680
+ T ||= "node default";
2681
+ let E = e.insert("g").attr("class", T).attr("id", a.domId || a.id), D = await addText(E, a.label ?? "", _, 0, 0, ["name"], x);
2682
+ D.height += y;
2683
+ let A = 0, j = [], M = [], N = 0, P = 0, F = 0, I = 0, L = !0, R = !0;
2684
+ for (let e of c.attributes) {
2685
+ let a = await addText(E, e.type, _, 0, A, ["attribute-type"], x);
2686
+ N = Math.max(N, a.width + v);
2687
+ let o = await addText(E, e.name, _, 0, A, ["attribute-name"], x);
2688
+ P = Math.max(P, o.width + v);
2689
+ let s = await addText(E, e.keys.join(), _, 0, A, ["attribute-keys"], x);
2690
+ F = Math.max(F, s.width + v);
2691
+ let c = await addText(E, e.comment, _, 0, A, ["attribute-comment"], x);
2692
+ I = Math.max(I, c.width + v);
2693
+ let l = Math.max(a.height, o.height, s.height, c.height) + y;
2694
+ M.push({
2695
+ yOffset: A,
2696
+ rowHeight: l
2697
+ }), A += l;
2698
+ }
2699
+ let z = 4;
2700
+ F <= v && (L = !1, F = 0, z--), I <= v && (R = !1, I = 0, z--);
2701
+ let B = E.node().getBBox();
2702
+ if (D.width + v * 2 - (N + P + F + I) > 0) {
2703
+ let e = D.width + v * 2 - (N + P + F + I);
2704
+ N += e / z, P += e / z, F > 0 && (F += e / z), I > 0 && (I += e / z);
2705
+ }
2706
+ let V = N + P + F + I, H = at.svg(E), U = userNodeOverrides(a, {});
2707
+ a.look !== "handDrawn" && (U.roughness = 0, U.fillStyle = "solid");
2708
+ let W = 0;
2709
+ M.length > 0 && (W = M.reduce((e, a) => e + (a?.rowHeight ?? 0), 0));
2710
+ let G = Math.max(B.width + v * 2, a?.width || 0, V), K = Math.max((W ?? 0) + D.height, a?.height || 0), q = -G / 2, J = -K / 2;
2711
+ if (E.selectAll("g:not(:first-child)").each((e, a, o) => {
2712
+ let s = select_default(o[a]), c = s.attr("transform"), l = 0, u = 0;
2713
+ if (c) {
2714
+ let e = RegExp(/translate\(([^,]+),([^)]+)\)/).exec(c);
2715
+ e && (l = parseFloat(e[1]), u = parseFloat(e[2]), s.attr("class").includes("attribute-name") ? l += N : s.attr("class").includes("attribute-keys") ? l += N + P : s.attr("class").includes("attribute-comment") && (l += N + P + F));
2716
+ }
2717
+ s.attr("transform", `translate(${q + v / 2 + l}, ${u + J + D.height + y / 2})`);
2718
+ }), E.select(".name").attr("transform", "translate(" + -D.width / 2 + ", " + (J + y / 2) + ")"), l != null && COLOR_THEMES.has(l)) {
2719
+ let e = c.colorIndex ?? 0;
2720
+ E.attr("data-color-id", `color-${e % g.length}`);
2721
+ }
2722
+ let Y = H.rectangle(q, J, G, K, U), X = E.insert(() => Y, ":first-child").attr("class", "outer-path").attr("style", b.join(""));
2723
+ j.push(0);
2724
+ for (let [e, a] of M.entries()) {
2725
+ let o = (e + 1) % 2 == 0 && a.yOffset !== 0, s = H.rectangle(q, D.height + J + a?.yOffset, G, a?.rowHeight, {
2726
+ ...U,
2727
+ fill: o ? d : f,
2728
+ stroke: p
2729
+ });
2730
+ E.insert(() => s, "g.label").attr("style", b.join("")).attr("class", `row-rect-${o ? "even" : "odd"}`);
2731
+ }
2732
+ let Z = 1e-4, Q = lineToPolygon(q, D.height + J, G + q, D.height + J, Z), $ = H.polygon(Q.map((e) => [e.x, e.y]), U);
2733
+ if (E.insert(() => $).attr("class", "divider"), Q = lineToPolygon(N + q, D.height + J, N + q, K + J, Z), $ = H.polygon(Q.map((e) => [e.x, e.y]), U), E.insert(() => $).attr("class", "divider"), L) {
2734
+ let e = N + P + q;
2735
+ Q = lineToPolygon(e, D.height + J, e, K + J, Z), $ = H.polygon(Q.map((e) => [e.x, e.y]), U), E.insert(() => $).attr("class", "divider");
2736
+ }
2737
+ if (R) {
2738
+ let e = N + P + F + q;
2739
+ Q = lineToPolygon(e, D.height + J, e, K + J, Z), $ = H.polygon(Q.map((e) => [e.x, e.y]), U), E.insert(() => $).attr("class", "divider");
2740
+ }
2741
+ for (let e of j) {
2742
+ let a = D.height + J + e;
2743
+ Q = lineToPolygon(q, a, G + q, a, Z), $ = H.polygon(Q.map((e) => [e.x, e.y]), U), E.insert(() => $).attr("class", "divider");
2744
+ }
2745
+ if (updateNodeBounds(a, X), w && a.look !== "handDrawn") if (l != null && REDUX_THEMES.has(l)) E.selectAll("path").attr("style", w);
2746
+ else {
2747
+ let e = w.split(";")?.filter((e) => e.includes("stroke"))?.map((e) => `${e}`).join("; ");
2748
+ E.selectAll("path").attr("style", e ?? ""), E.selectAll(".row-rect-even path").attr("style", w);
2749
+ }
2750
+ return a.intersect = function(e) {
2751
+ return intersect_default.rect(a, e);
2752
+ }, E;
2753
+ }
2754
+ __name(erBox, "erBox");
2755
+ async function addText(e, a, s, c = 0, l = 0, u = [], f = "") {
2756
+ let p = e.insert("g").attr("class", `label ${u.join(" ")}`).attr("transform", `translate(${c}, ${l})`).attr("style", f);
2757
+ a !== parseGenericTypes(a) && (a = parseGenericTypes(a), a = a.replaceAll("<", "&lt;").replaceAll(">", "&gt;"));
2758
+ let g = p.node().appendChild(await createText(p, a, {
2759
+ width: calculateTextWidth(a, s) + 100,
2760
+ style: f,
2761
+ useHtmlLabels: s.htmlLabels
2762
+ }, s));
2763
+ if (a.includes("&lt;") || a.includes("&gt;")) {
2764
+ let e = g.children[0];
2765
+ for (e.textContent = e.textContent.replaceAll("&lt;", "<").replaceAll("&gt;", ">"); e.childNodes[0];) e = e.childNodes[0], e.textContent = e.textContent.replaceAll("&lt;", "<").replaceAll("&gt;", ">");
2766
+ }
2767
+ let _ = g.getBBox();
2768
+ if (evaluate(s.htmlLabels)) {
2769
+ let e = g.children[0];
2770
+ e.style.textAlign = "start";
2771
+ let a = select_default(g);
2772
+ _ = e.getBoundingClientRect(), a.attr("width", _.width), a.attr("height", _.height);
2773
+ }
2774
+ return _;
2775
+ }
2776
+ __name(addText, "addText");
2777
+ function lineToPolygon(e, a, o, s, c) {
2778
+ return e === o ? [
2779
+ {
2780
+ x: e - c / 2,
2781
+ y: a
2782
+ },
2783
+ {
2784
+ x: e + c / 2,
2785
+ y: a
2786
+ },
2787
+ {
2788
+ x: o + c / 2,
2789
+ y: s
2790
+ },
2791
+ {
2792
+ x: o - c / 2,
2793
+ y: s
2794
+ }
2795
+ ] : [
2796
+ {
2797
+ x: e,
2798
+ y: a - c / 2
2799
+ },
2800
+ {
2801
+ x: e,
2802
+ y: a + c / 2
2803
+ },
2804
+ {
2805
+ x: o,
2806
+ y: s + c / 2
2807
+ },
2808
+ {
2809
+ x: o,
2810
+ y: s - c / 2
2811
+ }
2812
+ ];
2813
+ }
2814
+ __name(lineToPolygon, "lineToPolygon");
2815
+ async function textHelper(e, a, o, s, c = o.class.padding ?? 12) {
2816
+ let l = s ? 0 : 3, u = e.insert("g").attr("class", getNodeClasses(a)).attr("id", a.domId || a.id), d = null, f = null, p = null, m = null, h = 0, g = 0, _ = 0;
2817
+ if (d = u.insert("g").attr("class", "annotation-group text"), a.annotations.length > 0) {
2818
+ let e = a.annotations[0];
2819
+ await addText2(d, { text: `\xAB${e}\xBB` }, 0), h = d.node().getBBox().height;
2820
+ }
2821
+ f = u.insert("g").attr("class", "label-group text"), await addText2(f, a, 0, ["font-weight: bolder"]);
2822
+ let v = f.node().getBBox();
2823
+ g = v.height, p = u.insert("g").attr("class", "members-group text");
2824
+ let y = 0;
2825
+ for (let e of a.members) {
2826
+ let a = await addText2(p, e, y, [e.parseClassifier()]);
2827
+ y += a + l;
2828
+ }
2829
+ _ = p.node().getBBox().height, _ <= 0 && (_ = c / 2), m = u.insert("g").attr("class", "methods-group text");
2830
+ let b = 0;
2831
+ for (let e of a.methods) {
2832
+ let a = await addText2(m, e, b, [e.parseClassifier()]);
2833
+ b += a + l;
2834
+ }
2835
+ let x = u.node().getBBox();
2836
+ if (d !== null) {
2837
+ let e = d.node().getBBox();
2838
+ d.attr("transform", `translate(${-e.width / 2})`);
2839
+ }
2840
+ return f.attr("transform", `translate(${-v.width / 2}, ${h})`), x = u.node().getBBox(), p.attr("transform", `translate(0, ${h + g + c * 2})`), x = u.node().getBBox(), m.attr("transform", `translate(0, ${h + g + (_ ? _ + c * 4 : c * 2)})`), x = u.node().getBBox(), {
2841
+ shapeSvg: u,
2842
+ bbox: x
2843
+ };
2844
+ }
2845
+ __name(textHelper, "textHelper");
2846
+ async function addText2(a, c, l, d = []) {
2847
+ let f = a.insert("g").attr("class", "label").attr("style", d.join("; ")), _ = getConfig(), v = "useHtmlLabels" in c ? c.useHtmlLabels : evaluate(_.htmlLabels) ?? !0, y = "";
2848
+ y = "text" in c ? c.text : c.label, !v && y.startsWith("\\") && (y = y.substring(1)), hasKatex(y) && (v = !0);
2849
+ let b = await createText(f, sanitizeText3(decodeEntities(y)), {
2850
+ width: calculateTextWidth(y, _) + 50,
2851
+ classes: "markdown-node-label",
2852
+ useHtmlLabels: v
2853
+ }, _), x, S = 1;
2854
+ if (v) {
2855
+ let a = b.children[0], o = select_default(b);
2856
+ S = a.innerHTML.split("<br>").length, a.innerHTML.includes("</math>") && (S += a.innerHTML.split("<mrow>").length - 1);
2857
+ let s = a.getElementsByTagName("img");
2858
+ if (s) {
2859
+ let a = y.replace(/<img[^>]*>/g, "").trim() === "";
2860
+ await Promise.all([...s].map((o) => new Promise((s) => {
2861
+ function c() {
2862
+ if (o.style.display = "flex", o.style.flexDirection = "column", a) {
2863
+ let e = _.fontSize?.toString() ?? window.getComputedStyle(document.body).fontSize, a = parseInt(e, 10) * 5 + "px";
2864
+ o.style.minWidth = a, o.style.maxWidth = a;
2865
+ } else o.style.width = "100%";
2866
+ s(o);
2867
+ }
2868
+ __name(c, "setupImage"), setTimeout(() => {
2869
+ o.complete && c();
2870
+ }), o.addEventListener("error", c), o.addEventListener("load", c);
2871
+ })));
2872
+ }
2873
+ x = a.getBoundingClientRect(), o.attr("width", x.width), o.attr("height", x.height);
2874
+ } else {
2875
+ d.includes("font-weight: bolder") && select_default(b).selectAll("tspan").attr("font-weight", ""), S = b.children.length;
2876
+ let e = b.children[0];
2877
+ (b.textContent === "" || b.textContent.includes("&gt")) && (e.textContent = y[0] + y.substring(1).replaceAll("&gt;", ">").replaceAll("&lt;", "<").trim(), y[1] === " " && (e.textContent = e.textContent[0] + " " + e.textContent.substring(1))), e.textContent === "undefined" && (e.textContent = ""), x = b.getBBox();
2878
+ }
2879
+ return f.attr("transform", "translate(0," + (-x.height / (2 * S) + l) + ")"), x.height;
2880
+ }
2881
+ __name(addText2, "addText");
2882
+ async function classBox(e, a) {
2883
+ let s = getConfig2(), { themeVariables: l } = s, { useGradient: u } = l, d = s.class.padding ?? 12, f = d, p = a.useHtmlLabels ?? evaluate(s.htmlLabels) ?? !0, h = a;
2884
+ h.annotations = h.annotations ?? [], h.members = h.members ?? [], h.methods = h.methods ?? [];
2885
+ let { shapeSvg: g, bbox: _ } = await textHelper(e, a, s, p, f), { labelStyles: v, nodeStyles: y } = styles2String(a);
2886
+ a.labelStyle = v, a.cssStyles = h.styles || "";
2887
+ let b = h.styles?.join(";") || y || "";
2888
+ a.cssStyles ||= b.replaceAll("!important", "").split(";");
2889
+ let x = h.members.length === 0 && h.methods.length === 0 && !s.class?.hideEmptyMembersBox, w = at.svg(g), T = userNodeOverrides(a, {});
2890
+ a.look !== "handDrawn" && (T.roughness = 0, T.fillStyle = "solid");
2891
+ let E = Math.max(a.width ?? 0, _.width), D = Math.max(a.height ?? 0, _.height), k = (a.height ?? 0) > _.height;
2892
+ h.members.length === 0 && h.methods.length === 0 ? D += f : h.members.length > 0 && h.methods.length === 0 && (D += f * 2);
2893
+ let A = -E / 2, j = -D / 2, M = x ? d * 2 : h.members.length === 0 && h.methods.length === 0 ? -d : 0;
2894
+ k && (M = d * 2);
2895
+ let N = w.rectangle(A - d, j - d - (x ? d : h.members.length === 0 && h.methods.length === 0 ? -d / 2 : 0), E + 2 * d, D + 2 * d + M, T), P = g.insert(() => N, ":first-child");
2896
+ P.attr("class", "basic label-container outer-path");
2897
+ let F = P.node().getBBox(), I = g.select(".annotation-group").node().getBBox().height - (x ? d / 2 : 0) || 0, L = g.select(".label-group").node().getBBox().height - (x ? d / 2 : 0) || 0, R = g.select(".members-group").node().getBBox().height - (x ? d / 2 : 0) || 0, z = (I + L + j + d - (j - d - (x ? d : h.members.length === 0 && h.methods.length === 0 ? -d / 2 : 0))) / 2;
2898
+ if (g.selectAll(".text").each((e, a, o) => {
2899
+ let c = select_default(o[a]), l = c.attr("transform"), u = 0;
2900
+ if (l) {
2901
+ let e = RegExp(/translate\(([^,]+),([^)]+)\)/).exec(l);
2902
+ e && (u = parseFloat(e[2]));
2903
+ }
2904
+ let _ = u + j + d - (x ? d : h.members.length === 0 && h.methods.length === 0 ? -d / 2 : 0);
2905
+ if (c.attr("class").includes("methods-group")) {
2906
+ let e = Math.max(R, f / 2);
2907
+ _ = k ? Math.max(z, I + L + e + j + f * 2 + d) + f * 2 : I + L + e + j + f * 4 + d;
2908
+ }
2909
+ h.members.length === 0 && h.methods.length === 0 && s.class?.hideEmptyMembersBox && (_ = h.annotations.length > 0 ? u - f : u), p || (_ -= 4);
2910
+ let v = A;
2911
+ (c.attr("class").includes("label-group") || c.attr("class").includes("annotation-group")) && (v = -c.node()?.getBBox().width / 2 || 0, g.selectAll("text").each(function(e, a, o) {
2912
+ window.getComputedStyle(o[a]).textAnchor === "middle" && (v = 0);
2913
+ })), c.attr("transform", `translate(${v}, ${_})`);
2914
+ }), h.members.length > 0 || h.methods.length > 0 || x) {
2915
+ let e = I + L + j + d, o = w.line(F.x, e, F.x + F.width, e + .001, T);
2916
+ g.insert(() => o).attr("class", `divider${a.look === "neo" && !u ? " neo-line" : ""}`).attr("style", b);
2917
+ }
2918
+ if (x || h.members.length > 0 || h.methods.length > 0) {
2919
+ let e = I + L + R + j + f * 2 + d, o = w.line(F.x, k ? Math.max(z, e) : e, F.x + F.width, (k ? Math.max(z, e) : e) + .001, T);
2920
+ g.insert(() => o).attr("class", `divider${a.look === "neo" && !u ? " neo-line" : ""}`).attr("style", b);
2921
+ }
2922
+ if (h.look !== "handDrawn" && g.selectAll("path").attr("style", b), P.select(":nth-child(2)").attr("style", b), g.selectAll(".divider").select("path").attr("style", b), a.labelStyle ? g.selectAll("span").attr("style", a.labelStyle) : g.selectAll("span").attr("style", b), !p) {
2923
+ let e = RegExp(/color\s*:\s*([^;]*)/), a = e.exec(b);
2924
+ if (a) {
2925
+ let e = a[0].replace("color", "fill");
2926
+ g.selectAll("tspan").attr("style", e);
2927
+ } else if (v) {
2928
+ let a = e.exec(v);
2929
+ if (a) {
2930
+ let e = a[0].replace("color", "fill");
2931
+ g.selectAll("tspan").attr("style", e);
2932
+ }
2933
+ }
2934
+ }
2935
+ return updateNodeBounds(a, P), a.intersect = function(e) {
2936
+ return intersect_default.rect(a, e);
2937
+ }, g;
2938
+ }
2939
+ __name(classBox, "classBox");
2940
+ async function requirementBox(e, a) {
2941
+ let { labelStyles: o, nodeStyles: s } = styles2String(a);
2942
+ a.labelStyle = o;
2943
+ let l = a, u = a, d = "verifyMethod" in a, f = getNodeClasses(a), { themeVariables: p } = getConfig2(), { borderColorArray: h, requirementEdgeLabelBackground: g } = p, _ = e.insert("g").attr("class", f).attr("id", a.domId ?? a.id), v;
2944
+ v = d ? await addText3(_, `&lt;&lt;${l.type}&gt;&gt;`, 0, a.labelStyle) : await addText3(_, "&lt;&lt;Element&gt;&gt;", 0, a.labelStyle);
2945
+ let y = v, b = await addText3(_, l.name, y, a.labelStyle + "; font-weight: bold;");
2946
+ if (y += b + 20, d) {
2947
+ let e = await addText3(_, `${l.requirementId ? `ID: ${l.requirementId}` : ""}`, y, a.labelStyle);
2948
+ y += e;
2949
+ let o = await addText3(_, `${l.text ? `Text: ${l.text}` : ""}`, y, a.labelStyle);
2950
+ y += o;
2951
+ let s = await addText3(_, `${l.risk ? `Risk: ${l.risk}` : ""}`, y, a.labelStyle);
2952
+ y += s, await addText3(_, `${l.verifyMethod ? `Verification: ${l.verifyMethod}` : ""}`, y, a.labelStyle);
2953
+ } else {
2954
+ let e = await addText3(_, `${u.type ? `Type: ${u.type}` : ""}`, y, a.labelStyle);
2955
+ y += e, await addText3(_, `${u.docRef ? `Doc Ref: ${u.docRef}` : ""}`, y, a.labelStyle);
2956
+ }
2957
+ let x = (_.node()?.getBBox().width ?? 200) + 20, w = (_.node()?.getBBox().height ?? 200) + 20, T = -x / 2, E = -w / 2, D = at.svg(_), A = userNodeOverrides(a, {});
2958
+ a.look !== "handDrawn" && (A.roughness = 0, A.fillStyle = "solid");
2959
+ let j = D.rectangle(T, E, x, w, A), M = _.insert(() => j, ":first-child");
2960
+ if (M.attr("class", "basic label-container outer-path").attr("style", s), h?.length) {
2961
+ let e = a.colorIndex ?? 0;
2962
+ _.attr("data-color-id", `color-${e % h.length}`);
2963
+ }
2964
+ if (_.selectAll(".label").each((e, a, o) => {
2965
+ let s = select_default(o[a]), c = s.attr("transform"), l = 0, u = 0;
2966
+ if (c) {
2967
+ let e = RegExp(/translate\(([^,]+),([^)]+)\)/).exec(c);
2968
+ e && (l = parseFloat(e[1]), u = parseFloat(e[2]));
2969
+ }
2970
+ let d = u - w / 2, f = T + 20 / 2;
2971
+ (a === 0 || a === 1) && (f = l), s.attr("transform", `translate(${f}, ${d + 20})`);
2972
+ }), y > v + b + 20) {
2973
+ let e = E + v + b + 20, o;
2974
+ if (a.look === "neo") {
2975
+ let a = .001, s = [
2976
+ [T, e],
2977
+ [T + x, e],
2978
+ [T + x, e + a],
2979
+ [T, e + a]
2980
+ ];
2981
+ o = D.polygon(s, A);
2982
+ } else o = D.line(T, e, T + x, e, A);
2983
+ _.insert(() => o).attr("class", "divider");
2984
+ }
2985
+ return updateNodeBounds(a, M), a.intersect = function(e) {
2986
+ return intersect_default.rect(a, e);
2987
+ }, s && a.look !== "handDrawn" && (g || h?.length) && _.selectAll("path").attr("style", s), _;
2988
+ }
2989
+ __name(requirementBox, "requirementBox");
2990
+ async function addText3(e, a, o, s = "") {
2991
+ if (a === "") return 0;
2992
+ let l = e.insert("g").attr("class", "label").attr("style", s), u = getConfig2(), d = u.htmlLabels ?? !0, f = await createText(l, sanitizeText3(decodeEntities(a)), {
2993
+ width: calculateTextWidth(a, u) + 50,
2994
+ classes: "markdown-node-label",
2995
+ useHtmlLabels: d,
2996
+ style: s
2997
+ }, u), _;
2998
+ if (d) {
2999
+ let e = f.children[0], a = select_default(f);
3000
+ _ = e.getBoundingClientRect(), a.attr("width", _.width), a.attr("height", _.height);
3001
+ } else {
3002
+ let e = f.children[0];
3003
+ for (let a of e.children) s && a.setAttribute("style", s);
3004
+ _ = f.getBBox(), _.height += 6;
3005
+ }
3006
+ return l.attr("transform", `translate(${-_.width / 2},${-_.height / 2 + o})`), _.height;
3007
+ }
3008
+ __name(addText3, "addText");
3009
+ var colorFromPriority = /* @__PURE__ */ __name((e) => {
3010
+ switch (e) {
3011
+ case "Very High": return "red";
3012
+ case "High": return "orange";
3013
+ case "Medium": return null;
3014
+ case "Low": return "blue";
3015
+ case "Very Low": return "lightblue";
3016
+ }
3017
+ }, "colorFromPriority");
3018
+ async function kanbanItem(e, a, { config: o }) {
3019
+ let { labelStyles: s, nodeStyles: c } = styles2String(a);
3020
+ a.labelStyle = s || "";
3021
+ let l = a.width;
3022
+ a.width = (a.width ?? 200) - 10;
3023
+ let { shapeSvg: u, bbox: d, label: f } = await labelHelper(e, a, getNodeClasses(a)), p = a.padding || 10, m = "", h;
3024
+ "ticket" in a && a.ticket && o?.kanban?.ticketBaseUrl && (m = o?.kanban?.ticketBaseUrl.replace("#TICKET#", a.ticket), h = u.insert("svg:a", ":first-child").attr("class", "kanban-ticket-link").attr("xlink:href", m).attr("target", "_blank"));
3025
+ let g = {
3026
+ useHtmlLabels: a.useHtmlLabels,
3027
+ labelStyle: a.labelStyle || "",
3028
+ width: a.width,
3029
+ img: a.img,
3030
+ padding: a.padding || 8,
3031
+ centerLabel: !1
3032
+ }, _, v;
3033
+ h ? {label: _, bbox: v} = await insertLabel(h, "ticket" in a && a.ticket || "", g) : {label: _, bbox: v} = await insertLabel(u, "ticket" in a && a.ticket || "", g);
3034
+ let { label: y, bbox: b } = await insertLabel(u, "assigned" in a && a.assigned || "", g);
3035
+ a.width = l;
3036
+ let x = a?.width || 0, w = Math.max(v.height, b.height) / 2, T = Math.max(d.height + 20, a?.height || 0) + w, A = -x / 2, j = -T / 2;
3037
+ f.attr("transform", "translate(" + (p - x / 2) + ", " + (-w - d.height / 2) + ")"), _.attr("transform", "translate(" + (p - x / 2) + ", " + (-w + d.height / 2) + ")"), y.attr("transform", "translate(" + (p + x / 2 - b.width - 20) + ", " + (-w + d.height / 2) + ")");
3038
+ let M, { rx: N, ry: P } = a, { cssStyles: F } = a;
3039
+ if (a.look === "handDrawn") {
3040
+ let e = at.svg(u), o = userNodeOverrides(a, {}), s = N || P ? e.path(createRoundedRectPathD(A, j, x, T, N || 0), o) : e.rectangle(A, j, x, T, o);
3041
+ M = u.insert(() => s, ":first-child"), M.attr("class", "basic label-container").attr("style", F || null);
3042
+ } else {
3043
+ M = u.insert("rect", ":first-child"), M.attr("class", "basic label-container __APA__").attr("style", c).attr("rx", N ?? 5).attr("ry", P ?? 5).attr("x", A).attr("y", j).attr("width", x).attr("height", T);
3044
+ let e = "priority" in a && a.priority;
3045
+ if (e) {
3046
+ let a = u.append("line"), o = A + 2, s = j + Math.floor((N ?? 0) / 2), c = j + T - Math.floor((N ?? 0) / 2);
3047
+ a.attr("x1", o).attr("y1", s).attr("x2", o).attr("y2", c).attr("stroke-width", "4").attr("stroke", colorFromPriority(e));
3048
+ }
3049
+ }
3050
+ return updateNodeBounds(a, M), a.height = T, a.intersect = function(e) {
3051
+ return intersect_default.rect(a, e);
3052
+ }, u;
3053
+ }
3054
+ __name(kanbanItem, "kanbanItem");
3055
+ async function bang(e, o) {
3056
+ let { labelStyles: s, nodeStyles: c } = styles2String(o);
3057
+ o.labelStyle = s;
3058
+ let { shapeSvg: l, bbox: u, halfPadding: d, label: f } = await labelHelper(e, o, getNodeClasses(o)), p = u.width + 10 * d, m = u.height + 8 * d, h = .15 * p, { cssStyles: g } = o, v = u.width + 20, y = u.height + 20, b = Math.max(p, v), x = Math.max(m, y);
3059
+ f.attr("transform", `translate(${-u.width / 2}, ${-u.height / 2})`);
3060
+ let w, T = `M0 0
3061
+ a${h},${h} 1 0,0 ${b * .25},${-1 * x * .1}
3062
+ a${h},${h} 1 0,0 ${b * .25},0
3063
+ a${h},${h} 1 0,0 ${b * .25},0
3064
+ a${h},${h} 1 0,0 ${b * .25},${x * .1}
3065
+
3066
+ a${h},${h} 1 0,0 ${b * .15},${x * .33}
3067
+ a${h * .8},${h * .8} 1 0,0 0,${x * .34}
3068
+ a${h},${h} 1 0,0 ${-1 * b * .15},${x * .33}
3069
+
3070
+ a${h},${h} 1 0,0 ${-1 * b * .25},${x * .15}
3071
+ a${h},${h} 1 0,0 ${-1 * b * .25},0
3072
+ a${h},${h} 1 0,0 ${-1 * b * .25},0
3073
+ a${h},${h} 1 0,0 ${-1 * b * .25},${-1 * x * .15}
3074
+
3075
+ a${h},${h} 1 0,0 ${-1 * b * .1},${-1 * x * .33}
3076
+ a${h * .8},${h * .8} 1 0,0 0,${-1 * x * .34}
3077
+ a${h},${h} 1 0,0 ${b * .1},${-1 * x * .33}
3078
+ H0 V0 Z`;
3079
+ if (o.look === "handDrawn") {
3080
+ let e = at.svg(l), a = userNodeOverrides(o, {}), s = e.path(T, a);
3081
+ w = l.insert(() => s, ":first-child"), w.attr("class", "basic label-container").attr("style", handleUndefinedAttr(g));
3082
+ } else w = l.insert("path", ":first-child").attr("class", "basic label-container").attr("style", c).attr("d", T);
3083
+ return w.attr("transform", `translate(${-b / 2}, ${-x / 2})`), updateNodeBounds(o, w), o.calcIntersect = function(e, a) {
3084
+ return intersect_default.rect(e, a);
3085
+ }, o.intersect = function(e) {
3086
+ return log.info("Bang intersect", o, e), intersect_default.rect(o, e);
3087
+ }, l;
3088
+ }
3089
+ __name(bang, "bang");
3090
+ async function cloud(e, o) {
3091
+ let { labelStyles: s, nodeStyles: c } = styles2String(o);
3092
+ o.labelStyle = s;
3093
+ let { shapeSvg: l, bbox: u, halfPadding: d, label: f } = await labelHelper(e, o, getNodeClasses(o)), p = u.width + 2 * d, m = u.height + 2 * d, h = .15 * p, g = .25 * p, v = .35 * p, y = .2 * p, { cssStyles: b } = o, x, w = `M0 0
3094
+ a${h},${h} 0 0,1 ${p * .25},${-1 * p * .1}
3095
+ a${v},${v} 1 0,1 ${p * .4},${-1 * p * .1}
3096
+ a${g},${g} 1 0,1 ${p * .35},${p * .2}
3097
+
3098
+ a${h},${h} 1 0,1 ${p * .15},${m * .35}
3099
+ a${y},${y} 1 0,1 ${-1 * p * .15},${m * .65}
3100
+
3101
+ a${g},${h} 1 0,1 ${-1 * p * .25},${p * .15}
3102
+ a${v},${v} 1 0,1 ${-1 * p * .5},0
3103
+ a${h},${h} 1 0,1 ${-1 * p * .25},${-1 * p * .15}
3104
+
3105
+ a${h},${h} 1 0,1 ${-1 * p * .1},${-1 * m * .35}
3106
+ a${y},${y} 1 0,1 ${p * .1},${-1 * m * .65}
3107
+ H0 V0 Z`;
3108
+ if (o.look === "handDrawn") {
3109
+ let e = at.svg(l), a = userNodeOverrides(o, {}), s = e.path(w, a);
3110
+ x = l.insert(() => s, ":first-child"), x.attr("class", "basic label-container").attr("style", handleUndefinedAttr(b));
3111
+ } else x = l.insert("path", ":first-child").attr("class", "basic label-container").attr("style", c).attr("d", w);
3112
+ return f.attr("transform", `translate(${-u.width / 2}, ${-u.height / 2})`), x.attr("transform", `translate(${-p / 2}, ${-m / 2})`), updateNodeBounds(o, x), o.calcIntersect = function(e, a) {
3113
+ return intersect_default.rect(e, a);
3114
+ }, o.intersect = function(e) {
3115
+ return log.info("Cloud intersect", o, e), intersect_default.rect(o, e);
3116
+ }, l;
3117
+ }
3118
+ __name(cloud, "cloud");
3119
+ async function defaultMindmapNode(e, a) {
3120
+ let { labelStyles: o, nodeStyles: s } = styles2String(a);
3121
+ a.labelStyle = o;
3122
+ let { shapeSvg: c, bbox: l, halfPadding: u, label: d } = await labelHelper(e, a, getNodeClasses(a)), f = l.width + 8 * u, p = l.height + 2 * u, m = a.look === "neo" ? `
3123
+ M${-f / 2} ${p / 2 - 5}
3124
+ v${-p + 10}
3125
+ q0,-5 5,-5
3126
+ h${f - 10}
3127
+ q5,0 5,5
3128
+ v${p - 5}
3129
+ H${-f / 2}
3130
+ Z
3131
+ ` : `
3132
+ M${-f / 2} ${p / 2 - 5}
3133
+ v${-p + 10}
3134
+ q0,-5 5,-5
3135
+ h${f - 10}
3136
+ q5,0 5,5
3137
+ v${p - 10}
3138
+ q0,5 -5,5
3139
+ h${-(f - 10)}
3140
+ q-5,0 -5,-5
3141
+ Z
3142
+ `;
3143
+ if (!a.domId) throw Error(`defaultMindmapNode: node "${a.id}" is missing a domId \u2014 was render.ts domId prefixing skipped?`);
3144
+ let h = c.append("path").attr("id", a.domId).attr("class", "node-bkg node-" + a.type).attr("style", s).attr("d", m);
3145
+ return c.append("line").attr("class", "node-line-").attr("x1", -f / 2).attr("y1", p / 2).attr("x2", f / 2).attr("y2", p / 2), d.attr("transform", `translate(${-l.width / 2}, ${-l.height / 2})`), c.append(() => d.node()), updateNodeBounds(a, h), a.calcIntersect = function(e, a) {
3146
+ return intersect_default.rect(e, a);
3147
+ }, a.intersect = function(e) {
3148
+ return intersect_default.rect(a, e);
3149
+ }, c;
3150
+ }
3151
+ __name(defaultMindmapNode, "defaultMindmapNode");
3152
+ async function mindmapCircle(e, a) {
3153
+ return circle(e, a, { padding: a.padding ?? 0 });
3154
+ }
3155
+ __name(mindmapCircle, "mindmapCircle");
3156
+ var shapesDefs = [
3157
+ {
3158
+ semanticName: "Process",
3159
+ name: "Rectangle",
3160
+ shortName: "rect",
3161
+ description: "Standard process shape",
3162
+ aliases: [
3163
+ "proc",
3164
+ "process",
3165
+ "rectangle"
3166
+ ],
3167
+ internalAliases: ["squareRect"],
3168
+ handler: squareRect2
3169
+ },
3170
+ {
3171
+ semanticName: "Event",
3172
+ name: "Rounded Rectangle",
3173
+ shortName: "rounded",
3174
+ description: "Represents an event",
3175
+ aliases: ["event"],
3176
+ internalAliases: ["roundedRect"],
3177
+ handler: roundedRect
3178
+ },
3179
+ {
3180
+ semanticName: "Terminal Point",
3181
+ name: "Stadium",
3182
+ shortName: "stadium",
3183
+ description: "Terminal point",
3184
+ aliases: ["terminal", "pill"],
3185
+ handler: stadium
3186
+ },
3187
+ {
3188
+ semanticName: "Subprocess",
3189
+ name: "Framed Rectangle",
3190
+ shortName: "fr-rect",
3191
+ description: "Subprocess",
3192
+ aliases: [
3193
+ "subprocess",
3194
+ "subproc",
3195
+ "framed-rectangle",
3196
+ "subroutine"
3197
+ ],
3198
+ handler: subroutine
3199
+ },
3200
+ {
3201
+ semanticName: "Database",
3202
+ name: "Cylinder",
3203
+ shortName: "cyl",
3204
+ description: "Database storage",
3205
+ aliases: [
3206
+ "db",
3207
+ "database",
3208
+ "cylinder"
3209
+ ],
3210
+ handler: cylinder
3211
+ },
3212
+ {
3213
+ semanticName: "Start",
3214
+ name: "Circle",
3215
+ shortName: "circle",
3216
+ description: "Starting point",
3217
+ aliases: ["circ"],
3218
+ handler: circle
3219
+ },
3220
+ {
3221
+ semanticName: "Bang",
3222
+ name: "Bang",
3223
+ shortName: "bang",
3224
+ description: "Bang",
3225
+ aliases: ["bang"],
3226
+ handler: bang
3227
+ },
3228
+ {
3229
+ semanticName: "Cloud",
3230
+ name: "Cloud",
3231
+ shortName: "cloud",
3232
+ description: "cloud",
3233
+ aliases: ["cloud"],
3234
+ handler: cloud
3235
+ },
3236
+ {
3237
+ semanticName: "Decision",
3238
+ name: "Diamond",
3239
+ shortName: "diam",
3240
+ description: "Decision-making step",
3241
+ aliases: [
3242
+ "decision",
3243
+ "diamond",
3244
+ "question"
3245
+ ],
3246
+ handler: question
3247
+ },
3248
+ {
3249
+ semanticName: "Prepare Conditional",
3250
+ name: "Hexagon",
3251
+ shortName: "hex",
3252
+ description: "Preparation or condition step",
3253
+ aliases: ["hexagon", "prepare"],
3254
+ handler: hexagon
3255
+ },
3256
+ {
3257
+ semanticName: "Data Input/Output",
3258
+ name: "Lean Right",
3259
+ shortName: "lean-r",
3260
+ description: "Represents input or output",
3261
+ aliases: ["lean-right", "in-out"],
3262
+ internalAliases: ["lean_right"],
3263
+ handler: lean_right
3264
+ },
3265
+ {
3266
+ semanticName: "Data Input/Output",
3267
+ name: "Lean Left",
3268
+ shortName: "lean-l",
3269
+ description: "Represents output or input",
3270
+ aliases: ["lean-left", "out-in"],
3271
+ internalAliases: ["lean_left"],
3272
+ handler: lean_left
3273
+ },
3274
+ {
3275
+ semanticName: "Priority Action",
3276
+ name: "Trapezoid Base Bottom",
3277
+ shortName: "trap-b",
3278
+ description: "Priority action",
3279
+ aliases: [
3280
+ "priority",
3281
+ "trapezoid-bottom",
3282
+ "trapezoid"
3283
+ ],
3284
+ handler: trapezoid
3285
+ },
3286
+ {
3287
+ semanticName: "Manual Operation",
3288
+ name: "Trapezoid Base Top",
3289
+ shortName: "trap-t",
3290
+ description: "Represents a manual task",
3291
+ aliases: [
3292
+ "manual",
3293
+ "trapezoid-top",
3294
+ "inv-trapezoid"
3295
+ ],
3296
+ internalAliases: ["inv_trapezoid"],
3297
+ handler: inv_trapezoid
3298
+ },
3299
+ {
3300
+ semanticName: "Stop",
3301
+ name: "Double Circle",
3302
+ shortName: "dbl-circ",
3303
+ description: "Represents a stop point",
3304
+ aliases: ["double-circle"],
3305
+ internalAliases: ["doublecircle"],
3306
+ handler: doublecircle
3307
+ },
3308
+ {
3309
+ semanticName: "Text Block",
3310
+ name: "Text Block",
3311
+ shortName: "text",
3312
+ description: "Text block",
3313
+ handler: text
3314
+ },
3315
+ {
3316
+ semanticName: "Card",
3317
+ name: "Notched Rectangle",
3318
+ shortName: "notch-rect",
3319
+ description: "Represents a card",
3320
+ aliases: ["card", "notched-rectangle"],
3321
+ handler: card
3322
+ },
3323
+ {
3324
+ semanticName: "Lined/Shaded Process",
3325
+ name: "Lined Rectangle",
3326
+ shortName: "lin-rect",
3327
+ description: "Lined process shape",
3328
+ aliases: [
3329
+ "lined-rectangle",
3330
+ "lined-process",
3331
+ "lin-proc",
3332
+ "shaded-process"
3333
+ ],
3334
+ handler: shadedProcess
3335
+ },
3336
+ {
3337
+ semanticName: "Start",
3338
+ name: "Small Circle",
3339
+ shortName: "sm-circ",
3340
+ description: "Small starting point",
3341
+ aliases: ["start", "small-circle"],
3342
+ internalAliases: ["stateStart"],
3343
+ handler: stateStart
3344
+ },
3345
+ {
3346
+ semanticName: "Stop",
3347
+ name: "Framed Circle",
3348
+ shortName: "fr-circ",
3349
+ description: "Stop point",
3350
+ aliases: ["stop", "framed-circle"],
3351
+ internalAliases: ["stateEnd"],
3352
+ handler: stateEnd
3353
+ },
3354
+ {
3355
+ semanticName: "Fork/Join",
3356
+ name: "Filled Rectangle",
3357
+ shortName: "fork",
3358
+ description: "Fork or join in process flow",
3359
+ aliases: ["join"],
3360
+ internalAliases: ["forkJoin"],
3361
+ handler: forkJoin
3362
+ },
3363
+ {
3364
+ semanticName: "Collate",
3365
+ name: "Hourglass",
3366
+ shortName: "hourglass",
3367
+ description: "Represents a collate operation",
3368
+ aliases: ["hourglass", "collate"],
3369
+ handler: hourglass
3370
+ },
3371
+ {
3372
+ semanticName: "Comment",
3373
+ name: "Curly Brace",
3374
+ shortName: "brace",
3375
+ description: "Adds a comment",
3376
+ aliases: ["comment", "brace-l"],
3377
+ handler: curlyBraceLeft
3378
+ },
3379
+ {
3380
+ semanticName: "Comment Right",
3381
+ name: "Curly Brace",
3382
+ shortName: "brace-r",
3383
+ description: "Adds a comment",
3384
+ handler: curlyBraceRight
3385
+ },
3386
+ {
3387
+ semanticName: "Comment with braces on both sides",
3388
+ name: "Curly Braces",
3389
+ shortName: "braces",
3390
+ description: "Adds a comment",
3391
+ handler: curlyBraces
3392
+ },
3393
+ {
3394
+ semanticName: "Com Link",
3395
+ name: "Lightning Bolt",
3396
+ shortName: "bolt",
3397
+ description: "Communication link",
3398
+ aliases: ["com-link", "lightning-bolt"],
3399
+ handler: lightningBolt
3400
+ },
3401
+ {
3402
+ semanticName: "Document",
3403
+ name: "Document",
3404
+ shortName: "doc",
3405
+ description: "Represents a document",
3406
+ aliases: ["doc", "document"],
3407
+ handler: waveEdgedRectangle
3408
+ },
3409
+ {
3410
+ semanticName: "Delay",
3411
+ name: "Half-Rounded Rectangle",
3412
+ shortName: "delay",
3413
+ description: "Represents a delay",
3414
+ aliases: ["half-rounded-rectangle"],
3415
+ handler: halfRoundedRectangle
3416
+ },
3417
+ {
3418
+ semanticName: "Direct Access Storage",
3419
+ name: "Horizontal Cylinder",
3420
+ shortName: "h-cyl",
3421
+ description: "Direct access storage",
3422
+ aliases: ["das", "horizontal-cylinder"],
3423
+ handler: tiltedCylinder
3424
+ },
3425
+ {
3426
+ semanticName: "Disk Storage",
3427
+ name: "Lined Cylinder",
3428
+ shortName: "lin-cyl",
3429
+ description: "Disk storage",
3430
+ aliases: ["disk", "lined-cylinder"],
3431
+ handler: linedCylinder
3432
+ },
3433
+ {
3434
+ semanticName: "Display",
3435
+ name: "Curved Trapezoid",
3436
+ shortName: "curv-trap",
3437
+ description: "Represents a display",
3438
+ aliases: ["curved-trapezoid", "display"],
3439
+ handler: curvedTrapezoid
3440
+ },
3441
+ {
3442
+ semanticName: "Divided Process",
3443
+ name: "Divided Rectangle",
3444
+ shortName: "div-rect",
3445
+ description: "Divided process shape",
3446
+ aliases: [
3447
+ "div-proc",
3448
+ "divided-rectangle",
3449
+ "divided-process"
3450
+ ],
3451
+ handler: dividedRectangle
3452
+ },
3453
+ {
3454
+ semanticName: "Extract",
3455
+ name: "Triangle",
3456
+ shortName: "tri",
3457
+ description: "Extraction process",
3458
+ aliases: ["extract", "triangle"],
3459
+ handler: triangle
3460
+ },
3461
+ {
3462
+ semanticName: "Internal Storage",
3463
+ name: "Window Pane",
3464
+ shortName: "win-pane",
3465
+ description: "Internal storage",
3466
+ aliases: ["internal-storage", "window-pane"],
3467
+ handler: windowPane
3468
+ },
3469
+ {
3470
+ semanticName: "Junction",
3471
+ name: "Filled Circle",
3472
+ shortName: "f-circ",
3473
+ description: "Junction point",
3474
+ aliases: ["junction", "filled-circle"],
3475
+ handler: filledCircle
3476
+ },
3477
+ {
3478
+ semanticName: "Loop Limit",
3479
+ name: "Trapezoidal Pentagon",
3480
+ shortName: "notch-pent",
3481
+ description: "Loop limit step",
3482
+ aliases: ["loop-limit", "notched-pentagon"],
3483
+ handler: trapezoidalPentagon
3484
+ },
3485
+ {
3486
+ semanticName: "Manual File",
3487
+ name: "Flipped Triangle",
3488
+ shortName: "flip-tri",
3489
+ description: "Manual file operation",
3490
+ aliases: ["manual-file", "flipped-triangle"],
3491
+ handler: flippedTriangle
3492
+ },
3493
+ {
3494
+ semanticName: "Manual Input",
3495
+ name: "Sloped Rectangle",
3496
+ shortName: "sl-rect",
3497
+ description: "Manual input step",
3498
+ aliases: ["manual-input", "sloped-rectangle"],
3499
+ handler: slopedRect
3500
+ },
3501
+ {
3502
+ semanticName: "Multi-Document",
3503
+ name: "Stacked Document",
3504
+ shortName: "docs",
3505
+ description: "Multiple documents",
3506
+ aliases: [
3507
+ "documents",
3508
+ "st-doc",
3509
+ "stacked-document"
3510
+ ],
3511
+ handler: multiWaveEdgedRectangle
3512
+ },
3513
+ {
3514
+ semanticName: "Multi-Process",
3515
+ name: "Stacked Rectangle",
3516
+ shortName: "st-rect",
3517
+ description: "Multiple processes",
3518
+ aliases: [
3519
+ "procs",
3520
+ "processes",
3521
+ "stacked-rectangle"
3522
+ ],
3523
+ handler: multiRect
3524
+ },
3525
+ {
3526
+ semanticName: "Stored Data",
3527
+ name: "Bow Tie Rectangle",
3528
+ shortName: "bow-rect",
3529
+ description: "Stored data",
3530
+ aliases: ["stored-data", "bow-tie-rectangle"],
3531
+ handler: bowTieRect
3532
+ },
3533
+ {
3534
+ semanticName: "Summary",
3535
+ name: "Crossed Circle",
3536
+ shortName: "cross-circ",
3537
+ description: "Summary",
3538
+ aliases: ["summary", "crossed-circle"],
3539
+ handler: crossedCircle
3540
+ },
3541
+ {
3542
+ semanticName: "Tagged Document",
3543
+ name: "Tagged Document",
3544
+ shortName: "tag-doc",
3545
+ description: "Tagged document",
3546
+ aliases: ["tag-doc", "tagged-document"],
3547
+ handler: taggedWaveEdgedRectangle
3548
+ },
3549
+ {
3550
+ semanticName: "Tagged Process",
3551
+ name: "Tagged Rectangle",
3552
+ shortName: "tag-rect",
3553
+ description: "Tagged process",
3554
+ aliases: [
3555
+ "tagged-rectangle",
3556
+ "tag-proc",
3557
+ "tagged-process"
3558
+ ],
3559
+ handler: taggedRect
3560
+ },
3561
+ {
3562
+ semanticName: "Paper Tape",
3563
+ name: "Flag",
3564
+ shortName: "flag",
3565
+ description: "Paper tape",
3566
+ aliases: ["paper-tape"],
3567
+ handler: waveRectangle
3568
+ },
3569
+ {
3570
+ semanticName: "Odd",
3571
+ name: "Odd",
3572
+ shortName: "odd",
3573
+ description: "Odd shape",
3574
+ internalAliases: ["rect_left_inv_arrow"],
3575
+ handler: rect_left_inv_arrow
3576
+ },
3577
+ {
3578
+ semanticName: "Lined Document",
3579
+ name: "Lined Document",
3580
+ shortName: "lin-doc",
3581
+ description: "Lined document",
3582
+ aliases: ["lined-document"],
3583
+ handler: linedWaveEdgedRect
3584
+ }
3585
+ ], shapes2 = (/* @__PURE__ */ __name(() => {
3586
+ let e = {
3587
+ state,
3588
+ choice,
3589
+ note,
3590
+ rectWithTitle,
3591
+ labelRect,
3592
+ iconSquare,
3593
+ iconCircle,
3594
+ icon,
3595
+ iconRounded,
3596
+ imageSquare,
3597
+ anchor,
3598
+ kanbanItem,
3599
+ mindmapCircle,
3600
+ defaultMindmapNode,
3601
+ classBox,
3602
+ erBox,
3603
+ requirementBox
3604
+ }, a = [...Object.entries(e), ...shapesDefs.flatMap((e) => [
3605
+ e.shortName,
3606
+ ..."aliases" in e ? e.aliases : [],
3607
+ ..."internalAliases" in e ? e.internalAliases : []
3608
+ ].map((a) => [a, e.handler]))];
3609
+ return Object.fromEntries(a);
3610
+ }, "generateShapeMap"))();
3611
+ function isValidShape(e) {
3612
+ return e in shapes2;
3613
+ }
3614
+ __name(isValidShape, "isValidShape");
3615
+ var nodeElems = /* @__PURE__ */ new Map();
3616
+ async function insertNode(e, a, o) {
3617
+ let s, c;
3618
+ a.shape === "rect" && (a.rx && a.ry ? a.shape = "roundedRect" : a.shape = "squareRect");
3619
+ let l = a.shape ? shapes2[a.shape] : void 0;
3620
+ if (!l) throw Error(`No such shape: ${a.shape}. Please check your syntax.`);
3621
+ if (a.link) {
3622
+ let u;
3623
+ o.config.securityLevel === "sandbox" ? u = "_top" : a.linkTarget && (u = a.linkTarget || "_blank"), s = e.insert("svg:a").attr("xlink:href", a.link).attr("target", u ?? null), c = await l(s, a, o);
3624
+ } else c = await l(e, a, o), s = c;
3625
+ return s.attr("data-look", handleUndefinedAttr(a.look)), a.tooltip && c.attr("title", a.tooltip), nodeElems.set(a.id, s), a.haveCallback && s.attr("class", s.attr("class") + " clickable"), s;
3626
+ }
3627
+ __name(insertNode, "insertNode");
3628
+ var setNodeElem = /* @__PURE__ */ __name((e, a) => {
3629
+ nodeElems.set(a.id, e);
3630
+ }, "setNodeElem"), clear2 = /* @__PURE__ */ __name(() => {
3631
+ nodeElems.clear();
3632
+ }, "clear"), positionNode = /* @__PURE__ */ __name((e) => {
3633
+ let o = nodeElems.get(e.id);
3634
+ log.trace("Transforming node", e.diff, e, "translate(" + (e.x - e.width / 2 - 5) + ", " + e.width / 2 + ")");
3635
+ let s = e.diff || 0;
3636
+ return e.clusterNode ? o.attr("transform", "translate(" + (e.x + s - e.width / 2) + ", " + (e.y - e.height / 2 - 8) + ")") : o.attr("transform", "translate(" + e.x + ", " + e.y + ")"), s;
3637
+ }, "positionNode");
3638
+ export { clear, clear2, createLabel_default, insertCluster, insertNode, isValidShape, labelHelper, positionNode, setNodeElem, updateNodeBounds };