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