research-copilot 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (395) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +190 -0
  3. package/app/build/icon.icns +0 -0
  4. package/app/build/icon.ico +0 -0
  5. package/app/build/icon.png +0 -0
  6. package/app/out/main/index.mjs +6719 -0
  7. package/app/out/preload/index.js +141 -0
  8. package/app/out/renderer/assets/Inter-Variable-Latin-8kRkwJBP.woff2 +0 -0
  9. package/app/out/renderer/assets/Inter-Variable-LatinExt-B_-bZUTo.woff2 +0 -0
  10. package/app/out/renderer/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
  11. package/app/out/renderer/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
  12. package/app/out/renderer/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
  13. package/app/out/renderer/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
  14. package/app/out/renderer/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
  15. package/app/out/renderer/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
  16. package/app/out/renderer/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
  17. package/app/out/renderer/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
  18. package/app/out/renderer/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
  19. package/app/out/renderer/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
  20. package/app/out/renderer/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
  21. package/app/out/renderer/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
  22. package/app/out/renderer/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
  23. package/app/out/renderer/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
  24. package/app/out/renderer/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
  25. package/app/out/renderer/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
  26. package/app/out/renderer/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
  27. package/app/out/renderer/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
  28. package/app/out/renderer/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
  29. package/app/out/renderer/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
  30. package/app/out/renderer/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
  31. package/app/out/renderer/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
  32. package/app/out/renderer/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
  33. package/app/out/renderer/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
  34. package/app/out/renderer/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
  35. package/app/out/renderer/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
  36. package/app/out/renderer/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
  37. package/app/out/renderer/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
  38. package/app/out/renderer/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
  39. package/app/out/renderer/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
  40. package/app/out/renderer/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
  41. package/app/out/renderer/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
  42. package/app/out/renderer/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
  43. package/app/out/renderer/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
  44. package/app/out/renderer/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
  45. package/app/out/renderer/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
  46. package/app/out/renderer/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
  47. package/app/out/renderer/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
  48. package/app/out/renderer/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
  49. package/app/out/renderer/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
  50. package/app/out/renderer/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
  51. package/app/out/renderer/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
  52. package/app/out/renderer/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
  53. package/app/out/renderer/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
  54. package/app/out/renderer/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
  55. package/app/out/renderer/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
  56. package/app/out/renderer/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
  57. package/app/out/renderer/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
  58. package/app/out/renderer/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
  59. package/app/out/renderer/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
  60. package/app/out/renderer/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
  61. package/app/out/renderer/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
  62. package/app/out/renderer/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
  63. package/app/out/renderer/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
  64. package/app/out/renderer/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
  65. package/app/out/renderer/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
  66. package/app/out/renderer/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
  67. package/app/out/renderer/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
  68. package/app/out/renderer/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
  69. package/app/out/renderer/assets/MilkdownMarkdownEditor-bLPxrCVb.js +89821 -0
  70. package/app/out/renderer/assets/MilkdownMarkdownEditor-tTNRIB2K.css +2555 -0
  71. package/app/out/renderer/assets/Tableau10-BqnYsPR6.js +9 -0
  72. package/app/out/renderer/assets/apl-fqmucPXA.js +140 -0
  73. package/app/out/renderer/assets/arc-J47ePHZ2.js +132 -0
  74. package/app/out/renderer/assets/array-DgktLKBx.js +6 -0
  75. package/app/out/renderer/assets/asciiarmor-DucZyvP0.js +56 -0
  76. package/app/out/renderer/assets/asn1-BnOEsgAm.js +144 -0
  77. package/app/out/renderer/assets/asterisk-QAlztEwS.js +345 -0
  78. package/app/out/renderer/assets/blockDiagram-c4efeb88-5uRQXgQJ.js +1817 -0
  79. package/app/out/renderer/assets/brainfuck-DZVCuF_t.js +53 -0
  80. package/app/out/renderer/assets/c4Diagram-c83219d4-C4iCTPEL.js +2464 -0
  81. package/app/out/renderer/assets/channel-ZAmhHE3g.js +7 -0
  82. package/app/out/renderer/assets/classDiagram-beda092f-7NOZxq_W.js +357 -0
  83. package/app/out/renderer/assets/classDiagram-v2-2358418a-5fPT-cUH.js +291 -0
  84. package/app/out/renderer/assets/clike-xqXYL6ge.js +805 -0
  85. package/app/out/renderer/assets/clojure-BhXMqnxz.js +849 -0
  86. package/app/out/renderer/assets/clone-CsnzsYXQ.js +8 -0
  87. package/app/out/renderer/assets/cmake-BGaNd9E7.js +71 -0
  88. package/app/out/renderer/assets/cobol-4yqQntpt.js +120 -0
  89. package/app/out/renderer/assets/coffeescript-D2dXvhEc.js +308 -0
  90. package/app/out/renderer/assets/commonlisp-CF_VNHQR.js +130 -0
  91. package/app/out/renderer/assets/createText-1719965b-Cji7KN4K.js +4904 -0
  92. package/app/out/renderer/assets/crystal-DyuLTqLs.js +398 -0
  93. package/app/out/renderer/assets/css-c-jst79C.js +1783 -0
  94. package/app/out/renderer/assets/cypher-Dlu_3r4V.js +121 -0
  95. package/app/out/renderer/assets/d-UURgV0Ux.js +179 -0
  96. package/app/out/renderer/assets/diff-B_Bi2Crb.js +25 -0
  97. package/app/out/renderer/assets/dockerfile-Bvk733Ga.js +201 -0
  98. package/app/out/renderer/assets/dtd-Dy74G54E.js +114 -0
  99. package/app/out/renderer/assets/dylan-TSb-Nfix.js +314 -0
  100. package/app/out/renderer/assets/ebnf-DAomQUbD.js +139 -0
  101. package/app/out/renderer/assets/ecl-B59qGGVg.js +178 -0
  102. package/app/out/renderer/assets/edges-96097737-CD0EvAZQ.js +1844 -0
  103. package/app/out/renderer/assets/eiffel-Dze7nlu3.js +134 -0
  104. package/app/out/renderer/assets/elm-DG7jkhNZ.js +176 -0
  105. package/app/out/renderer/assets/erDiagram-0228fc6a-DRYXBpi7.js +1321 -0
  106. package/app/out/renderer/assets/erlang-BO6gOnGA.js +674 -0
  107. package/app/out/renderer/assets/factor-CMxFHDqz.js +65 -0
  108. package/app/out/renderer/assets/fcl-CDDUNjTj.js +141 -0
  109. package/app/out/renderer/assets/flowDb-c6c81e3f-CuoIN-Cy.js +1713 -0
  110. package/app/out/renderer/assets/flowDiagram-50d868cf-CPWPLOml.js +1272 -0
  111. package/app/out/renderer/assets/flowDiagram-v2-4f6560a1-C_R12s4S.js +33 -0
  112. package/app/out/renderer/assets/flowchart-elk-definition-6af322e1-BdKUSFpi.js +92921 -0
  113. package/app/out/renderer/assets/forth-B9D2JCeE.js +116 -0
  114. package/app/out/renderer/assets/fortran-CAG2BFbe.js +467 -0
  115. package/app/out/renderer/assets/ganttDiagram-a2739b55-ygqT5HlG.js +3399 -0
  116. package/app/out/renderer/assets/gas-d3KEcW3x.js +294 -0
  117. package/app/out/renderer/assets/gherkin-DhZlEZiy.js +115 -0
  118. package/app/out/renderer/assets/gitGraphDiagram-82fe8481-D97GT4iA.js +1791 -0
  119. package/app/out/renderer/assets/graph-DpC13d95.js +1237 -0
  120. package/app/out/renderer/assets/groovy-CpwJiBl7.js +223 -0
  121. package/app/out/renderer/assets/haskell-BlGBCCe3.js +459 -0
  122. package/app/out/renderer/assets/haxe-7MlzfeYV.js +514 -0
  123. package/app/out/renderer/assets/http-BqypyemW.js +79 -0
  124. package/app/out/renderer/assets/idl-4HIGJlDI.js +985 -0
  125. package/app/out/renderer/assets/index-4-ziknCv.js +292 -0
  126. package/app/out/renderer/assets/index-5325376f-Bbs7Fbqr.js +663 -0
  127. package/app/out/renderer/assets/index-B2jip-rk.js +2489 -0
  128. package/app/out/renderer/assets/index-BKTVfokE.js +312 -0
  129. package/app/out/renderer/assets/index-BiJbFgVG.js +118 -0
  130. package/app/out/renderer/assets/index-Bn433Fat.js +83 -0
  131. package/app/out/renderer/assets/index-BqDyyRCx.js +39679 -0
  132. package/app/out/renderer/assets/index-BzFMeMPn.js +158 -0
  133. package/app/out/renderer/assets/index-C-_uCjZJ.css +2701 -0
  134. package/app/out/renderer/assets/index-C1ithNW1.js +1765 -0
  135. package/app/out/renderer/assets/index-CAJkRYkO.js +407 -0
  136. package/app/out/renderer/assets/index-CleO0-yj.js +690 -0
  137. package/app/out/renderer/assets/index-Cq4MH3sY.js +1020 -0
  138. package/app/out/renderer/assets/index-CtA0Xj22.js +705 -0
  139. package/app/out/renderer/assets/index-CvAZkqBZ.js +83 -0
  140. package/app/out/renderer/assets/index-D3UDN-5c.js +152 -0
  141. package/app/out/renderer/assets/index-D4F9R5ao.js +179 -0
  142. package/app/out/renderer/assets/index-D6RguhZ5.js +328 -0
  143. package/app/out/renderer/assets/index-DnEowqXv.js +386 -0
  144. package/app/out/renderer/assets/index-K8c8Mqdy.js +98 -0
  145. package/app/out/renderer/assets/index-Kh14gO6K.js +62 -0
  146. package/app/out/renderer/assets/index-WFd2jRnA.js +333 -0
  147. package/app/out/renderer/assets/index-WgMfkRFp.js +313 -0
  148. package/app/out/renderer/assets/index-Y4lKyF6t.js +1042 -0
  149. package/app/out/renderer/assets/index-fx307_f1.js +643 -0
  150. package/app/out/renderer/assets/infoDiagram-8eee0895-ptaVSwzq.js +511 -0
  151. package/app/out/renderer/assets/init-ZxktEp_H.js +16 -0
  152. package/app/out/renderer/assets/javascript-C3MnDRiU.js +994 -0
  153. package/app/out/renderer/assets/journeyDiagram-c64418c1-aloEGOQp.js +1184 -0
  154. package/app/out/renderer/assets/julia-Bs6JJhYG.js +407 -0
  155. package/app/out/renderer/assets/layout-ZeuHE_aY.js +2217 -0
  156. package/app/out/renderer/assets/line-CAgaGl-S.js +45 -0
  157. package/app/out/renderer/assets/linear-DIg7lTe1.js +539 -0
  158. package/app/out/renderer/assets/livescript-DmzgM3Yt.js +296 -0
  159. package/app/out/renderer/assets/lua-8cJgIlqe.js +256 -0
  160. package/app/out/renderer/assets/mathematica-DNLOL9PQ.js +110 -0
  161. package/app/out/renderer/assets/mbox-Ga7d4MMN.js +117 -0
  162. package/app/out/renderer/assets/mindmap-definition-8da855dc-B8XVoUxz.js +36054 -0
  163. package/app/out/renderer/assets/mirc-Dma3B8rS.js +107 -0
  164. package/app/out/renderer/assets/mllike-DHn7xckP.js +334 -0
  165. package/app/out/renderer/assets/modelica-0d55jYY0.js +147 -0
  166. package/app/out/renderer/assets/mscgen-DdqZYINH.js +135 -0
  167. package/app/out/renderer/assets/mumps-Btr8VblO.js +93 -0
  168. package/app/out/renderer/assets/nginx-DTDtBDVN.js +141 -0
  169. package/app/out/renderer/assets/nsis-3zG7tgur.js +62 -0
  170. package/app/out/renderer/assets/ntriples-CvgOYMpL.js +153 -0
  171. package/app/out/renderer/assets/octave-DYBj3-tl.js +200 -0
  172. package/app/out/renderer/assets/ordinal-DSZU4PqD.js +76 -0
  173. package/app/out/renderer/assets/oz-R_e8WMIi.js +231 -0
  174. package/app/out/renderer/assets/pascal-GD8iposT.js +105 -0
  175. package/app/out/renderer/assets/path-Cp2qmpkd.js +109 -0
  176. package/app/out/renderer/assets/perl-DL9mHpoi.js +1105 -0
  177. package/app/out/renderer/assets/pieDiagram-a8764435-DlwoeBU2.js +770 -0
  178. package/app/out/renderer/assets/pig-C_4T4YIV.js +101 -0
  179. package/app/out/renderer/assets/powershell-B0suO7Vd.js +328 -0
  180. package/app/out/renderer/assets/properties-BR-vP1aU.js +58 -0
  181. package/app/out/renderer/assets/protobuf-BxgpyhoW.js +77 -0
  182. package/app/out/renderer/assets/pug-By0kVCfm.js +405 -0
  183. package/app/out/renderer/assets/puppet-Bdao66PW.js +137 -0
  184. package/app/out/renderer/assets/python-CvWbmiX4.js +427 -0
  185. package/app/out/renderer/assets/q-CrbCVq4a.js +131 -0
  186. package/app/out/renderer/assets/quadrantDiagram-1e28029f-BaSi1XB4.js +1200 -0
  187. package/app/out/renderer/assets/r-V7nswm59.js +170 -0
  188. package/app/out/renderer/assets/requirementDiagram-08caed73-D3EFyegZ.js +1092 -0
  189. package/app/out/renderer/assets/rpm-C-DLY-If.js +109 -0
  190. package/app/out/renderer/assets/ruby-JDKLJNK0.js +330 -0
  191. package/app/out/renderer/assets/sankeyDiagram-a04cb91d-Cv44AsnM.js +1174 -0
  192. package/app/out/renderer/assets/sas-D2UG-yhZ.js +207 -0
  193. package/app/out/renderer/assets/scheme-BKzrkGJD.js +222 -0
  194. package/app/out/renderer/assets/sequenceDiagram-c5b8d532-CuUBu-x4.js +3337 -0
  195. package/app/out/renderer/assets/shell-BlsXDxCn.js +222 -0
  196. package/app/out/renderer/assets/sieve-CjwBwOY5.js +135 -0
  197. package/app/out/renderer/assets/simple-mode-DMneyfDu.js +130 -0
  198. package/app/out/renderer/assets/smalltalk-BOIGQuhN.js +121 -0
  199. package/app/out/renderer/assets/solr-CwD7U71z.js +69 -0
  200. package/app/out/renderer/assets/sparql-DYskk2vE.js +249 -0
  201. package/app/out/renderer/assets/spreadsheet-Bgtt3oLP.js +87 -0
  202. package/app/out/renderer/assets/sql-BSrOzCRI.js +354 -0
  203. package/app/out/renderer/assets/stateDiagram-1ecb1508-BOU34Zp4.js +454 -0
  204. package/app/out/renderer/assets/stateDiagram-v2-c2b004d7-BgRoffou.js +326 -0
  205. package/app/out/renderer/assets/stex-B6LNC55o.js +231 -0
  206. package/app/out/renderer/assets/styles-b4e223ce-BMr9TPuj.js +1483 -0
  207. package/app/out/renderer/assets/styles-ca3715f6-DgbNw99p.js +1363 -0
  208. package/app/out/renderer/assets/styles-d45a18b0-DtRYKYKf.js +574 -0
  209. package/app/out/renderer/assets/stylus-BkS-boTH.js +565 -0
  210. package/app/out/renderer/assets/svgDrawCommon-b86b1483-Bein03PD.js +100 -0
  211. package/app/out/renderer/assets/swift-FRZi1uvB.js +291 -0
  212. package/app/out/renderer/assets/tcl-CUcaCdmq.js +114 -0
  213. package/app/out/renderer/assets/textile-BnFpjsrl.js +414 -0
  214. package/app/out/renderer/assets/tiddlywiki-CjprD-Qp.js +218 -0
  215. package/app/out/renderer/assets/tiki-B4EPSQ1G.js +265 -0
  216. package/app/out/renderer/assets/timeline-definition-faaaa080-BlWpLE_4.js +1212 -0
  217. package/app/out/renderer/assets/toml-BOuWGMcf.js +76 -0
  218. package/app/out/renderer/assets/troff-E1bJ0PPL.js +61 -0
  219. package/app/out/renderer/assets/ttcn-cfg-Dc39-fIP.js +133 -0
  220. package/app/out/renderer/assets/ttcn-tKd4HLu4.js +192 -0
  221. package/app/out/renderer/assets/turtle-Dq7-1WAf.js +124 -0
  222. package/app/out/renderer/assets/vb-Dp90gtsv.js +196 -0
  223. package/app/out/renderer/assets/vbscript-CI6_mxxU.js +479 -0
  224. package/app/out/renderer/assets/velocity-BwIZK1TH.js +149 -0
  225. package/app/out/renderer/assets/verilog-DDCYnHN8.js +430 -0
  226. package/app/out/renderer/assets/vhdl-DCkMIyT9.js +158 -0
  227. package/app/out/renderer/assets/webidl-BTLTThCm.js +204 -0
  228. package/app/out/renderer/assets/xquery-BgiOC5Ce.js +525 -0
  229. package/app/out/renderer/assets/xychartDiagram-f5964ef8-Bhga-YXm.js +1799 -0
  230. package/app/out/renderer/assets/yacas-b5lAVEIl.js +130 -0
  231. package/app/out/renderer/assets/z80-BZV19vqv.js +93 -0
  232. package/app/out/renderer/index.html +13 -0
  233. package/app/out/skills/community-builtin/README.md +29 -0
  234. package/app/out/skills/community-builtin/document-docx/SKILL.md +44 -0
  235. package/app/out/skills/community-builtin/document-docx/scripts/docx-to-markdown.sh +20 -0
  236. package/app/out/skills/community-builtin/document-docx/scripts/extract-docx-text.sh +28 -0
  237. package/app/out/skills/community-builtin/document-docx/scripts/init-docx-template.sh +32 -0
  238. package/app/out/skills/community-builtin/document-docx/scripts/setup-docx-tools.sh +10 -0
  239. package/app/out/skills/community-builtin/markitdown/SKILL.md +105 -0
  240. package/app/out/skills/community-builtin/markitdown/scripts/batch-convert.sh +40 -0
  241. package/app/out/skills/community-builtin/markitdown/scripts/convert-file.sh +24 -0
  242. package/app/out/skills/community-builtin/markitdown/scripts/setup-markitdown.sh +10 -0
  243. package/app/out/skills/community-builtin/repo-quick-audit/SKILL.md +27 -0
  244. package/app/out/skills/community-builtin/repo-quick-audit/scripts/audit-basics.sh +19 -0
  245. package/app/out/skills/research-pilot-default-project-skills/README.md +23 -0
  246. package/app/out/skills/research-pilot-default-project-skills/citation-management/SKILL.md +39 -0
  247. package/app/out/skills/research-pilot-default-project-skills/citation-management/scripts/doi-to-bibtex.sh +25 -0
  248. package/app/out/skills/research-pilot-default-project-skills/citation-management/scripts/normalize-bibtex-keys.sh +51 -0
  249. package/app/out/skills/research-pilot-default-project-skills/citation-management/scripts/setup-citation-tools.sh +10 -0
  250. package/app/out/skills/research-pilot-default-project-skills/citation-management/scripts/validate-bib.sh +31 -0
  251. package/app/out/skills/research-pilot-default-project-skills/matplotlib/SKILL.md +34 -0
  252. package/app/out/skills/research-pilot-default-project-skills/matplotlib/references/api_reference.md +412 -0
  253. package/app/out/skills/research-pilot-default-project-skills/matplotlib/references/common_issues.md +563 -0
  254. package/app/out/skills/research-pilot-default-project-skills/matplotlib/references/plot_types.md +476 -0
  255. package/app/out/skills/research-pilot-default-project-skills/matplotlib/references/styling_guide.md +589 -0
  256. package/app/out/skills/research-pilot-default-project-skills/matplotlib/references/subagent_quickstart.md +30 -0
  257. package/app/out/skills/research-pilot-default-project-skills/matplotlib/scripts/plot_template.py +401 -0
  258. package/app/out/skills/research-pilot-default-project-skills/matplotlib/scripts/style_configurator.py +409 -0
  259. package/app/out/skills/research-pilot-default-project-skills/research-grants/SKILL.md +38 -0
  260. package/app/out/skills/research-pilot-default-project-skills/research-grants/scripts/check-grant-compliance.sh +40 -0
  261. package/app/out/skills/research-pilot-default-project-skills/research-grants/scripts/grant-summary-card.sh +32 -0
  262. package/app/out/skills/research-pilot-default-project-skills/research-grants/scripts/init-grant-structure.sh +70 -0
  263. package/app/package.json +77 -0
  264. package/bin/cli.mjs +56 -0
  265. package/lib/README.md +145 -0
  266. package/lib/skills/_generated.ts +13 -0
  267. package/lib/skills/builtin/brainstorming-research-ideas/SKILL.md +280 -0
  268. package/lib/skills/builtin/coding/SKILL.md +114 -0
  269. package/lib/skills/builtin/creative-thinking-for-research/SKILL.md +273 -0
  270. package/lib/skills/builtin/matplotlib/SKILL.md +361 -0
  271. package/lib/skills/builtin/matplotlib/references/api_reference.md +412 -0
  272. package/lib/skills/builtin/matplotlib/references/common_issues.md +563 -0
  273. package/lib/skills/builtin/matplotlib/references/plot_types.md +476 -0
  274. package/lib/skills/builtin/matplotlib/references/styling_guide.md +589 -0
  275. package/lib/skills/builtin/matplotlib/scripts/plot_template.py +401 -0
  276. package/lib/skills/builtin/matplotlib/scripts/style_configurator.py +409 -0
  277. package/lib/skills/builtin/paper-writing/SKILL.md +554 -0
  278. package/lib/skills/builtin/paper-writing/references/checklists.md +524 -0
  279. package/lib/skills/builtin/paper-writing/references/citation-workflow.md +562 -0
  280. package/lib/skills/builtin/paper-writing/references/reviewer-guidelines.md +462 -0
  281. package/lib/skills/builtin/paper-writing/references/sources.md +189 -0
  282. package/lib/skills/builtin/paper-writing/references/systems-conferences.md +260 -0
  283. package/lib/skills/builtin/paper-writing/references/writing-guide.md +476 -0
  284. package/lib/skills/builtin/paper-writing/templates/README.md +408 -0
  285. package/lib/skills/builtin/paper-writing/templates/aaai2026/README.md +534 -0
  286. package/lib/skills/builtin/paper-writing/templates/aaai2026/aaai2026-unified-supp.tex +144 -0
  287. package/lib/skills/builtin/paper-writing/templates/aaai2026/aaai2026-unified-template.tex +952 -0
  288. package/lib/skills/builtin/paper-writing/templates/aaai2026/aaai2026.bib +111 -0
  289. package/lib/skills/builtin/paper-writing/templates/aaai2026/aaai2026.bst +1493 -0
  290. package/lib/skills/builtin/paper-writing/templates/aaai2026/aaai2026.sty +315 -0
  291. package/lib/skills/builtin/paper-writing/templates/acl/README.md +50 -0
  292. package/lib/skills/builtin/paper-writing/templates/acl/acl.sty +312 -0
  293. package/lib/skills/builtin/paper-writing/templates/acl/acl_latex.tex +377 -0
  294. package/lib/skills/builtin/paper-writing/templates/acl/acl_lualatex.tex +101 -0
  295. package/lib/skills/builtin/paper-writing/templates/acl/acl_natbib.bst +1940 -0
  296. package/lib/skills/builtin/paper-writing/templates/acl/anthology.bib.txt +26 -0
  297. package/lib/skills/builtin/paper-writing/templates/acl/custom.bib +70 -0
  298. package/lib/skills/builtin/paper-writing/templates/acl/formatting.md +326 -0
  299. package/lib/skills/builtin/paper-writing/templates/asplos2027/main.tex +459 -0
  300. package/lib/skills/builtin/paper-writing/templates/asplos2027/references.bib +135 -0
  301. package/lib/skills/builtin/paper-writing/templates/colm2025/README.md +3 -0
  302. package/lib/skills/builtin/paper-writing/templates/colm2025/colm2025_conference.bib +11 -0
  303. package/lib/skills/builtin/paper-writing/templates/colm2025/colm2025_conference.bst +1440 -0
  304. package/lib/skills/builtin/paper-writing/templates/colm2025/colm2025_conference.pdf +0 -0
  305. package/lib/skills/builtin/paper-writing/templates/colm2025/colm2025_conference.sty +218 -0
  306. package/lib/skills/builtin/paper-writing/templates/colm2025/colm2025_conference.tex +305 -0
  307. package/lib/skills/builtin/paper-writing/templates/colm2025/fancyhdr.sty +485 -0
  308. package/lib/skills/builtin/paper-writing/templates/colm2025/math_commands.tex +508 -0
  309. package/lib/skills/builtin/paper-writing/templates/colm2025/natbib.sty +1246 -0
  310. package/lib/skills/builtin/paper-writing/templates/iclr2026/fancyhdr.sty +485 -0
  311. package/lib/skills/builtin/paper-writing/templates/iclr2026/iclr2026_conference.bib +24 -0
  312. package/lib/skills/builtin/paper-writing/templates/iclr2026/iclr2026_conference.bst +1440 -0
  313. package/lib/skills/builtin/paper-writing/templates/iclr2026/iclr2026_conference.pdf +0 -0
  314. package/lib/skills/builtin/paper-writing/templates/iclr2026/iclr2026_conference.sty +246 -0
  315. package/lib/skills/builtin/paper-writing/templates/iclr2026/iclr2026_conference.tex +414 -0
  316. package/lib/skills/builtin/paper-writing/templates/iclr2026/math_commands.tex +508 -0
  317. package/lib/skills/builtin/paper-writing/templates/iclr2026/natbib.sty +1246 -0
  318. package/lib/skills/builtin/paper-writing/templates/icml2026/algorithm.sty +79 -0
  319. package/lib/skills/builtin/paper-writing/templates/icml2026/algorithmic.sty +201 -0
  320. package/lib/skills/builtin/paper-writing/templates/icml2026/example_paper.bib +75 -0
  321. package/lib/skills/builtin/paper-writing/templates/icml2026/example_paper.pdf +0 -0
  322. package/lib/skills/builtin/paper-writing/templates/icml2026/example_paper.tex +662 -0
  323. package/lib/skills/builtin/paper-writing/templates/icml2026/fancyhdr.sty +864 -0
  324. package/lib/skills/builtin/paper-writing/templates/icml2026/icml2026.bst +1443 -0
  325. package/lib/skills/builtin/paper-writing/templates/icml2026/icml2026.sty +767 -0
  326. package/lib/skills/builtin/paper-writing/templates/icml2026/icml_numpapers.pdf +0 -0
  327. package/lib/skills/builtin/paper-writing/templates/neurips2025/Makefile +36 -0
  328. package/lib/skills/builtin/paper-writing/templates/neurips2025/extra_pkgs.tex +53 -0
  329. package/lib/skills/builtin/paper-writing/templates/neurips2025/main.tex +38 -0
  330. package/lib/skills/builtin/paper-writing/templates/neurips2025/neurips.sty +382 -0
  331. package/lib/skills/builtin/paper-writing/templates/nsdi2027/main.tex +426 -0
  332. package/lib/skills/builtin/paper-writing/templates/nsdi2027/references.bib +151 -0
  333. package/lib/skills/builtin/paper-writing/templates/nsdi2027/usenix-2020-09.sty +83 -0
  334. package/lib/skills/builtin/paper-writing/templates/osdi2026/main.tex +429 -0
  335. package/lib/skills/builtin/paper-writing/templates/osdi2026/references.bib +150 -0
  336. package/lib/skills/builtin/paper-writing/templates/osdi2026/usenix-2020-09.sty +83 -0
  337. package/lib/skills/builtin/paper-writing/templates/sosp2026/main.tex +532 -0
  338. package/lib/skills/builtin/paper-writing/templates/sosp2026/references.bib +148 -0
  339. package/lib/skills/builtin/research-grants/SKILL.md +958 -0
  340. package/lib/skills/builtin/research-grants/assets/budget_justification_template.md +453 -0
  341. package/lib/skills/builtin/research-grants/assets/nih_specific_aims_template.md +166 -0
  342. package/lib/skills/builtin/research-grants/assets/nsf_project_summary_template.md +92 -0
  343. package/lib/skills/builtin/research-grants/references/README.md +285 -0
  344. package/lib/skills/builtin/research-grants/references/broader_impacts.md +392 -0
  345. package/lib/skills/builtin/research-grants/references/darpa_guidelines.md +636 -0
  346. package/lib/skills/builtin/research-grants/references/doe_guidelines.md +586 -0
  347. package/lib/skills/builtin/research-grants/references/nih_guidelines.md +851 -0
  348. package/lib/skills/builtin/research-grants/references/nsf_guidelines.md +570 -0
  349. package/lib/skills/builtin/research-grants/references/nstc_guidelines.md +733 -0
  350. package/lib/skills/builtin/research-grants/references/specific_aims_guide.md +458 -0
  351. package/lib/skills/builtin/rewrite-humanize/SKILL.md +116 -0
  352. package/lib/skills/builtin/rewrite-humanize/references/cs-venue-tone.md +57 -0
  353. package/lib/skills/builtin/rewrite-humanize/references/lexicon.md +50 -0
  354. package/lib/skills/builtin/scholar-evaluation/SKILL.md +300 -0
  355. package/lib/skills/builtin/scholar-evaluation/references/evaluation_framework.md +663 -0
  356. package/lib/skills/builtin/scholar-evaluation/scripts/calculate_scores.py +379 -0
  357. package/lib/skills/builtin/scientific-schematics/SKILL.md +603 -0
  358. package/lib/skills/builtin/scientific-schematics/references/QUICK_REFERENCE.md +182 -0
  359. package/lib/skills/builtin/scientific-schematics/references/README.md +292 -0
  360. package/lib/skills/builtin/scientific-schematics/references/best_practices.md +560 -0
  361. package/lib/skills/builtin/scientific-schematics/scripts/__pycache__/generate_schematic.cpython-312.pyc +0 -0
  362. package/lib/skills/builtin/scientific-schematics/scripts/__pycache__/generate_schematic_ai.cpython-312.pyc +0 -0
  363. package/lib/skills/builtin/scientific-schematics/scripts/example_usage.sh +85 -0
  364. package/lib/skills/builtin/scientific-schematics/scripts/generate_schematic.py +141 -0
  365. package/lib/skills/builtin/scientific-schematics/scripts/generate_schematic_ai.py +910 -0
  366. package/lib/skills/builtin/scientific-visualization/SKILL.md +749 -0
  367. package/lib/skills/builtin/scientific-visualization/assets/color_palettes.py +197 -0
  368. package/lib/skills/builtin/scientific-visualization/assets/nature.mplstyle +63 -0
  369. package/lib/skills/builtin/scientific-visualization/assets/presentation.mplstyle +61 -0
  370. package/lib/skills/builtin/scientific-visualization/assets/publication.mplstyle +68 -0
  371. package/lib/skills/builtin/scientific-visualization/references/color_palettes.md +348 -0
  372. package/lib/skills/builtin/scientific-visualization/references/journal_requirements.md +320 -0
  373. package/lib/skills/builtin/scientific-visualization/references/matplotlib_examples.md +620 -0
  374. package/lib/skills/builtin/scientific-visualization/references/publication_guidelines.md +205 -0
  375. package/lib/skills/builtin/scientific-visualization/scripts/figure_export.py +343 -0
  376. package/lib/skills/builtin/scientific-visualization/scripts/style_presets.py +416 -0
  377. package/lib/skills/builtin/scientific-writing/SKILL.md +745 -0
  378. package/lib/skills/builtin/scientific-writing/assets/REPORT_FORMATTING_GUIDE.md +574 -0
  379. package/lib/skills/builtin/scientific-writing/assets/scientific_report.sty +606 -0
  380. package/lib/skills/builtin/scientific-writing/assets/scientific_report_template.tex +449 -0
  381. package/lib/skills/builtin/scientific-writing/references/citation_styles.md +720 -0
  382. package/lib/skills/builtin/scientific-writing/references/figures_tables.md +806 -0
  383. package/lib/skills/builtin/scientific-writing/references/imrad_structure.md +686 -0
  384. package/lib/skills/builtin/scientific-writing/references/professional_report_formatting.md +664 -0
  385. package/lib/skills/builtin/scientific-writing/references/reporting_guidelines.md +748 -0
  386. package/lib/skills/builtin/scientific-writing/references/writing_principles.md +824 -0
  387. package/lib/skills/builtin/seaborn/SKILL.md +674 -0
  388. package/lib/skills/builtin/seaborn/references/examples.md +822 -0
  389. package/lib/skills/builtin/seaborn/references/function_reference.md +770 -0
  390. package/lib/skills/builtin/seaborn/references/objects_interface.md +964 -0
  391. package/lib/skills/data-analysis/SKILL.md +285 -0
  392. package/lib/skills/generate-skill-content.mjs +58 -0
  393. package/lib/skills/index.ts +34 -0
  394. package/lib/skills/loader.ts +452 -0
  395. package/package.json +62 -0
@@ -0,0 +1,1844 @@
1
+ import { v as log$1, R as curveBasis, r as getConfig, S as evaluate, u as select, O as utils, z as sanitizeText$2, V as decodeEntities } from "./MilkdownMarkdownEditor-bLPxrCVb.js";
2
+ import { c as createText } from "./createText-1719965b-Cji7KN4K.js";
3
+ import { l as line } from "./line-CAgaGl-S.js";
4
+ const insertMarkers = (elem, markerArray, type, id) => {
5
+ markerArray.forEach((markerName) => {
6
+ markers[markerName](elem, type, id);
7
+ });
8
+ };
9
+ const extension = (elem, type, id) => {
10
+ log$1.trace("Making markers for ", id);
11
+ elem.append("defs").append("marker").attr("id", id + "_" + type + "-extensionStart").attr("class", "marker extension " + type).attr("refX", 18).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 1,7 L18,13 V 1 Z");
12
+ elem.append("defs").append("marker").attr("id", id + "_" + type + "-extensionEnd").attr("class", "marker extension " + type).attr("refX", 1).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 1,1 V 13 L18,7 Z");
13
+ };
14
+ const composition = (elem, type, id) => {
15
+ elem.append("defs").append("marker").attr("id", id + "_" + type + "-compositionStart").attr("class", "marker composition " + type).attr("refX", 18).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
16
+ elem.append("defs").append("marker").attr("id", id + "_" + type + "-compositionEnd").attr("class", "marker composition " + type).attr("refX", 1).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
17
+ };
18
+ const aggregation = (elem, type, id) => {
19
+ elem.append("defs").append("marker").attr("id", id + "_" + type + "-aggregationStart").attr("class", "marker aggregation " + type).attr("refX", 18).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
20
+ elem.append("defs").append("marker").attr("id", id + "_" + type + "-aggregationEnd").attr("class", "marker aggregation " + type).attr("refX", 1).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
21
+ };
22
+ const dependency = (elem, type, id) => {
23
+ elem.append("defs").append("marker").attr("id", id + "_" + type + "-dependencyStart").attr("class", "marker dependency " + type).attr("refX", 6).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 5,7 L9,13 L1,7 L9,1 Z");
24
+ elem.append("defs").append("marker").attr("id", id + "_" + type + "-dependencyEnd").attr("class", "marker dependency " + type).attr("refX", 13).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L14,7 L9,1 Z");
25
+ };
26
+ const lollipop = (elem, type, id) => {
27
+ elem.append("defs").append("marker").attr("id", id + "_" + type + "-lollipopStart").attr("class", "marker lollipop " + type).attr("refX", 13).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("circle").attr("stroke", "black").attr("fill", "transparent").attr("cx", 7).attr("cy", 7).attr("r", 6);
28
+ elem.append("defs").append("marker").attr("id", id + "_" + type + "-lollipopEnd").attr("class", "marker lollipop " + type).attr("refX", 1).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("circle").attr("stroke", "black").attr("fill", "transparent").attr("cx", 7).attr("cy", 7).attr("r", 6);
29
+ };
30
+ const point = (elem, type, id) => {
31
+ elem.append("marker").attr("id", id + "_" + type + "-pointEnd").attr("class", "marker " + type).attr("viewBox", "0 0 10 10").attr("refX", 6).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto").append("path").attr("d", "M 0 0 L 10 5 L 0 10 z").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0");
32
+ elem.append("marker").attr("id", id + "_" + type + "-pointStart").attr("class", "marker " + type).attr("viewBox", "0 0 10 10").attr("refX", 4.5).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto").append("path").attr("d", "M 0 5 L 10 10 L 10 0 z").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0");
33
+ };
34
+ const circle$1 = (elem, type, id) => {
35
+ elem.append("marker").attr("id", id + "_" + type + "-circleEnd").attr("class", "marker " + type).attr("viewBox", "0 0 10 10").attr("refX", 11).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("circle").attr("cx", "5").attr("cy", "5").attr("r", "5").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0");
36
+ elem.append("marker").attr("id", id + "_" + type + "-circleStart").attr("class", "marker " + type).attr("viewBox", "0 0 10 10").attr("refX", -1).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("circle").attr("cx", "5").attr("cy", "5").attr("r", "5").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0");
37
+ };
38
+ const cross = (elem, type, id) => {
39
+ elem.append("marker").attr("id", id + "_" + type + "-crossEnd").attr("class", "marker cross " + type).attr("viewBox", "0 0 11 11").attr("refX", 12).attr("refY", 5.2).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("path").attr("d", "M 1,1 l 9,9 M 10,1 l -9,9").attr("class", "arrowMarkerPath").style("stroke-width", 2).style("stroke-dasharray", "1,0");
40
+ elem.append("marker").attr("id", id + "_" + type + "-crossStart").attr("class", "marker cross " + type).attr("viewBox", "0 0 11 11").attr("refX", -1).attr("refY", 5.2).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("path").attr("d", "M 1,1 l 9,9 M 10,1 l -9,9").attr("class", "arrowMarkerPath").style("stroke-width", 2).style("stroke-dasharray", "1,0");
41
+ };
42
+ const barb = (elem, type, id) => {
43
+ elem.append("defs").append("marker").attr("id", id + "_" + type + "-barbEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 14).attr("markerUnits", "strokeWidth").attr("orient", "auto").append("path").attr("d", "M 19,7 L9,13 L14,7 L9,1 Z");
44
+ };
45
+ const markers = {
46
+ extension,
47
+ composition,
48
+ aggregation,
49
+ dependency,
50
+ lollipop,
51
+ point,
52
+ circle: circle$1,
53
+ cross,
54
+ barb
55
+ };
56
+ const insertMarkers$1 = insertMarkers;
57
+ function applyStyle(dom, styleFn) {
58
+ if (styleFn) {
59
+ dom.attr("style", styleFn);
60
+ }
61
+ }
62
+ function addHtmlLabel(node, config) {
63
+ const fo = select(document.createElementNS("http://www.w3.org/2000/svg", "foreignObject"));
64
+ const div = fo.append("xhtml:div");
65
+ const label = node.label;
66
+ const labelClass = node.isNode ? "nodeLabel" : "edgeLabel";
67
+ div.html(
68
+ sanitizeText$2(
69
+ '<span class="' + labelClass + '" ' + (node.labelStyle ? 'style="' + node.labelStyle + '"' : "") + ">" + label + "</span>",
70
+ config
71
+ )
72
+ );
73
+ applyStyle(div, node.labelStyle);
74
+ div.style("display", "inline-block");
75
+ div.style("white-space", "nowrap");
76
+ div.attr("xmlns", "http://www.w3.org/1999/xhtml");
77
+ return fo.node();
78
+ }
79
+ const createLabel = (_vertexText, style, isTitle, isNode) => {
80
+ let vertexText = _vertexText || "";
81
+ if (typeof vertexText === "object") {
82
+ vertexText = vertexText[0];
83
+ }
84
+ const config = getConfig();
85
+ if (evaluate(config.flowchart.htmlLabels)) {
86
+ vertexText = vertexText.replace(/\\n|\n/g, "<br />");
87
+ log$1.debug("vertexText" + vertexText);
88
+ const node = {
89
+ isNode,
90
+ label: decodeEntities(vertexText).replace(
91
+ /fa[blrs]?:fa-[\w-]+/g,
92
+ // cspell: disable-line
93
+ (s) => `<i class='${s.replace(":", " ")}'></i>`
94
+ ),
95
+ labelStyle: style.replace("fill:", "color:")
96
+ };
97
+ let vertexNode = addHtmlLabel(node, config);
98
+ return vertexNode;
99
+ } else {
100
+ const svgLabel = document.createElementNS("http://www.w3.org/2000/svg", "text");
101
+ svgLabel.setAttribute("style", style.replace("color:", "fill:"));
102
+ let rows = [];
103
+ if (typeof vertexText === "string") {
104
+ rows = vertexText.split(/\\n|\n|<br\s*\/?>/gi);
105
+ } else if (Array.isArray(vertexText)) {
106
+ rows = vertexText;
107
+ } else {
108
+ rows = [];
109
+ }
110
+ for (const row of rows) {
111
+ const tspan = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
112
+ tspan.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve");
113
+ tspan.setAttribute("dy", "1em");
114
+ tspan.setAttribute("x", "0");
115
+ if (isTitle) {
116
+ tspan.setAttribute("class", "title-row");
117
+ } else {
118
+ tspan.setAttribute("class", "row");
119
+ }
120
+ tspan.textContent = row.trim();
121
+ svgLabel.appendChild(tspan);
122
+ }
123
+ return svgLabel;
124
+ }
125
+ };
126
+ const createLabel$1 = createLabel;
127
+ const labelHelper = async (parent, node, _classes, isNode) => {
128
+ let classes;
129
+ const useHtmlLabels = node.useHtmlLabels || evaluate(getConfig().flowchart.htmlLabels);
130
+ if (!_classes) {
131
+ classes = "node default";
132
+ } else {
133
+ classes = _classes;
134
+ }
135
+ const shapeSvg = parent.insert("g").attr("class", classes).attr("id", node.domId || node.id);
136
+ const label = shapeSvg.insert("g").attr("class", "label").attr("style", node.labelStyle);
137
+ let labelText;
138
+ if (node.labelText === void 0) {
139
+ labelText = "";
140
+ } else {
141
+ labelText = typeof node.labelText === "string" ? node.labelText : node.labelText[0];
142
+ }
143
+ const textNode = label.node();
144
+ let text;
145
+ if (node.labelType === "markdown") {
146
+ text = createText(label, sanitizeText$2(decodeEntities(labelText), getConfig()), {
147
+ useHtmlLabels,
148
+ width: node.width || getConfig().flowchart.wrappingWidth,
149
+ classes: "markdown-node-label"
150
+ });
151
+ } else {
152
+ text = textNode.appendChild(
153
+ createLabel$1(
154
+ sanitizeText$2(decodeEntities(labelText), getConfig()),
155
+ node.labelStyle,
156
+ false,
157
+ isNode
158
+ )
159
+ );
160
+ }
161
+ let bbox = text.getBBox();
162
+ const halfPadding = node.padding / 2;
163
+ if (evaluate(getConfig().flowchart.htmlLabels)) {
164
+ const div = text.children[0];
165
+ const dv = select(text);
166
+ const images = div.getElementsByTagName("img");
167
+ if (images) {
168
+ const noImgText = labelText.replace(/<img[^>]*>/g, "").trim() === "";
169
+ await Promise.all(
170
+ [...images].map(
171
+ (img) => new Promise((res) => {
172
+ function setupImage() {
173
+ img.style.display = "flex";
174
+ img.style.flexDirection = "column";
175
+ if (noImgText) {
176
+ const bodyFontSize = getConfig().fontSize ? getConfig().fontSize : window.getComputedStyle(document.body).fontSize;
177
+ const enlargingFactor = 5;
178
+ const width = parseInt(bodyFontSize, 10) * enlargingFactor + "px";
179
+ img.style.minWidth = width;
180
+ img.style.maxWidth = width;
181
+ } else {
182
+ img.style.width = "100%";
183
+ }
184
+ res(img);
185
+ }
186
+ setTimeout(() => {
187
+ if (img.complete) {
188
+ setupImage();
189
+ }
190
+ });
191
+ img.addEventListener("error", setupImage);
192
+ img.addEventListener("load", setupImage);
193
+ })
194
+ )
195
+ );
196
+ }
197
+ bbox = div.getBoundingClientRect();
198
+ dv.attr("width", bbox.width);
199
+ dv.attr("height", bbox.height);
200
+ }
201
+ if (useHtmlLabels) {
202
+ label.attr("transform", "translate(" + -bbox.width / 2 + ", " + -bbox.height / 2 + ")");
203
+ } else {
204
+ label.attr("transform", "translate(0, " + -bbox.height / 2 + ")");
205
+ }
206
+ if (node.centerLabel) {
207
+ label.attr("transform", "translate(" + -bbox.width / 2 + ", " + -bbox.height / 2 + ")");
208
+ }
209
+ label.insert("rect", ":first-child");
210
+ return { shapeSvg, bbox, halfPadding, label };
211
+ };
212
+ const updateNodeBounds = (node, element) => {
213
+ const bbox = element.node().getBBox();
214
+ node.width = bbox.width;
215
+ node.height = bbox.height;
216
+ };
217
+ function insertPolygonShape(parent, w, h, points) {
218
+ return parent.insert("polygon", ":first-child").attr(
219
+ "points",
220
+ points.map(function(d) {
221
+ return d.x + "," + d.y;
222
+ }).join(" ")
223
+ ).attr("class", "label-container").attr("transform", "translate(" + -w / 2 + "," + h / 2 + ")");
224
+ }
225
+ function intersectNode(node, point2) {
226
+ return node.intersect(point2);
227
+ }
228
+ function intersectEllipse(node, rx, ry, point2) {
229
+ var cx = node.x;
230
+ var cy = node.y;
231
+ var px = cx - point2.x;
232
+ var py = cy - point2.y;
233
+ var det = Math.sqrt(rx * rx * py * py + ry * ry * px * px);
234
+ var dx = Math.abs(rx * ry * px / det);
235
+ if (point2.x < cx) {
236
+ dx = -dx;
237
+ }
238
+ var dy = Math.abs(rx * ry * py / det);
239
+ if (point2.y < cy) {
240
+ dy = -dy;
241
+ }
242
+ return { x: cx + dx, y: cy + dy };
243
+ }
244
+ function intersectCircle(node, rx, point2) {
245
+ return intersectEllipse(node, rx, rx, point2);
246
+ }
247
+ function intersectLine(p1, p2, q1, q2) {
248
+ var a1, a2, b1, b2, c1, c2;
249
+ var r1, r2, r3, r4;
250
+ var denom, offset, num;
251
+ var x, y;
252
+ a1 = p2.y - p1.y;
253
+ b1 = p1.x - p2.x;
254
+ c1 = p2.x * p1.y - p1.x * p2.y;
255
+ r3 = a1 * q1.x + b1 * q1.y + c1;
256
+ r4 = a1 * q2.x + b1 * q2.y + c1;
257
+ if (r3 !== 0 && r4 !== 0 && sameSign(r3, r4)) {
258
+ return;
259
+ }
260
+ a2 = q2.y - q1.y;
261
+ b2 = q1.x - q2.x;
262
+ c2 = q2.x * q1.y - q1.x * q2.y;
263
+ r1 = a2 * p1.x + b2 * p1.y + c2;
264
+ r2 = a2 * p2.x + b2 * p2.y + c2;
265
+ if (r1 !== 0 && r2 !== 0 && sameSign(r1, r2)) {
266
+ return;
267
+ }
268
+ denom = a1 * b2 - a2 * b1;
269
+ if (denom === 0) {
270
+ return;
271
+ }
272
+ offset = Math.abs(denom / 2);
273
+ num = b1 * c2 - b2 * c1;
274
+ x = num < 0 ? (num - offset) / denom : (num + offset) / denom;
275
+ num = a2 * c1 - a1 * c2;
276
+ y = num < 0 ? (num - offset) / denom : (num + offset) / denom;
277
+ return { x, y };
278
+ }
279
+ function sameSign(r1, r2) {
280
+ return r1 * r2 > 0;
281
+ }
282
+ function intersectPolygon(node, polyPoints, point2) {
283
+ var x1 = node.x;
284
+ var y1 = node.y;
285
+ var intersections = [];
286
+ var minX = Number.POSITIVE_INFINITY;
287
+ var minY = Number.POSITIVE_INFINITY;
288
+ if (typeof polyPoints.forEach === "function") {
289
+ polyPoints.forEach(function(entry) {
290
+ minX = Math.min(minX, entry.x);
291
+ minY = Math.min(minY, entry.y);
292
+ });
293
+ } else {
294
+ minX = Math.min(minX, polyPoints.x);
295
+ minY = Math.min(minY, polyPoints.y);
296
+ }
297
+ var left = x1 - node.width / 2 - minX;
298
+ var top = y1 - node.height / 2 - minY;
299
+ for (var i = 0; i < polyPoints.length; i++) {
300
+ var p1 = polyPoints[i];
301
+ var p2 = polyPoints[i < polyPoints.length - 1 ? i + 1 : 0];
302
+ var intersect2 = intersectLine(
303
+ node,
304
+ point2,
305
+ { x: left + p1.x, y: top + p1.y },
306
+ { x: left + p2.x, y: top + p2.y }
307
+ );
308
+ if (intersect2) {
309
+ intersections.push(intersect2);
310
+ }
311
+ }
312
+ if (!intersections.length) {
313
+ return node;
314
+ }
315
+ if (intersections.length > 1) {
316
+ intersections.sort(function(p, q) {
317
+ var pdx = p.x - point2.x;
318
+ var pdy = p.y - point2.y;
319
+ var distp = Math.sqrt(pdx * pdx + pdy * pdy);
320
+ var qdx = q.x - point2.x;
321
+ var qdy = q.y - point2.y;
322
+ var distq = Math.sqrt(qdx * qdx + qdy * qdy);
323
+ return distp < distq ? -1 : distp === distq ? 0 : 1;
324
+ });
325
+ }
326
+ return intersections[0];
327
+ }
328
+ const intersectRect = (node, point2) => {
329
+ var x = node.x;
330
+ var y = node.y;
331
+ var dx = point2.x - x;
332
+ var dy = point2.y - y;
333
+ var w = node.width / 2;
334
+ var h = node.height / 2;
335
+ var sx, sy;
336
+ if (Math.abs(dy) * w > Math.abs(dx) * h) {
337
+ if (dy < 0) {
338
+ h = -h;
339
+ }
340
+ sx = dy === 0 ? 0 : h * dx / dy;
341
+ sy = h;
342
+ } else {
343
+ if (dx < 0) {
344
+ w = -w;
345
+ }
346
+ sx = w;
347
+ sy = dx === 0 ? 0 : w * dy / dx;
348
+ }
349
+ return { x: x + sx, y: y + sy };
350
+ };
351
+ const intersectRect$1 = intersectRect;
352
+ const intersect = {
353
+ node: intersectNode,
354
+ circle: intersectCircle,
355
+ ellipse: intersectEllipse,
356
+ polygon: intersectPolygon,
357
+ rect: intersectRect$1
358
+ };
359
+ const note = async (parent, node) => {
360
+ const useHtmlLabels = node.useHtmlLabels || getConfig().flowchart.htmlLabels;
361
+ if (!useHtmlLabels) {
362
+ node.centerLabel = true;
363
+ }
364
+ const { shapeSvg, bbox, halfPadding } = await labelHelper(
365
+ parent,
366
+ node,
367
+ "node " + node.classes,
368
+ true
369
+ );
370
+ log$1.info("Classes = ", node.classes);
371
+ const rect2 = shapeSvg.insert("rect", ":first-child");
372
+ rect2.attr("rx", node.rx).attr("ry", node.ry).attr("x", -bbox.width / 2 - halfPadding).attr("y", -bbox.height / 2 - halfPadding).attr("width", bbox.width + node.padding).attr("height", bbox.height + node.padding);
373
+ updateNodeBounds(node, rect2);
374
+ node.intersect = function(point2) {
375
+ return intersect.rect(node, point2);
376
+ };
377
+ return shapeSvg;
378
+ };
379
+ const note$1 = note;
380
+ const expandAndDeduplicateDirections = (directions) => {
381
+ const uniqueDirections = /* @__PURE__ */ new Set();
382
+ for (const direction of directions) {
383
+ switch (direction) {
384
+ case "x":
385
+ uniqueDirections.add("right");
386
+ uniqueDirections.add("left");
387
+ break;
388
+ case "y":
389
+ uniqueDirections.add("up");
390
+ uniqueDirections.add("down");
391
+ break;
392
+ default:
393
+ uniqueDirections.add(direction);
394
+ break;
395
+ }
396
+ }
397
+ return uniqueDirections;
398
+ };
399
+ const getArrowPoints = (duplicatedDirections, bbox, node) => {
400
+ const directions = expandAndDeduplicateDirections(duplicatedDirections);
401
+ const f = 2;
402
+ const height = bbox.height + 2 * node.padding;
403
+ const midpoint = height / f;
404
+ const width = bbox.width + 2 * midpoint + node.padding;
405
+ const padding = node.padding / 2;
406
+ if (directions.has("right") && directions.has("left") && directions.has("up") && directions.has("down")) {
407
+ return [
408
+ // Bottom
409
+ { x: 0, y: 0 },
410
+ { x: midpoint, y: 0 },
411
+ { x: width / 2, y: 2 * padding },
412
+ { x: width - midpoint, y: 0 },
413
+ { x: width, y: 0 },
414
+ // Right
415
+ { x: width, y: -height / 3 },
416
+ { x: width + 2 * padding, y: -height / 2 },
417
+ { x: width, y: -2 * height / 3 },
418
+ { x: width, y: -height },
419
+ // Top
420
+ { x: width - midpoint, y: -height },
421
+ { x: width / 2, y: -height - 2 * padding },
422
+ { x: midpoint, y: -height },
423
+ // Left
424
+ { x: 0, y: -height },
425
+ { x: 0, y: -2 * height / 3 },
426
+ { x: -2 * padding, y: -height / 2 },
427
+ { x: 0, y: -height / 3 }
428
+ ];
429
+ }
430
+ if (directions.has("right") && directions.has("left") && directions.has("up")) {
431
+ return [
432
+ { x: midpoint, y: 0 },
433
+ { x: width - midpoint, y: 0 },
434
+ { x: width, y: -height / 2 },
435
+ { x: width - midpoint, y: -height },
436
+ { x: midpoint, y: -height },
437
+ { x: 0, y: -height / 2 }
438
+ ];
439
+ }
440
+ if (directions.has("right") && directions.has("left") && directions.has("down")) {
441
+ return [
442
+ { x: 0, y: 0 },
443
+ { x: midpoint, y: -height },
444
+ { x: width - midpoint, y: -height },
445
+ { x: width, y: 0 }
446
+ ];
447
+ }
448
+ if (directions.has("right") && directions.has("up") && directions.has("down")) {
449
+ return [
450
+ { x: 0, y: 0 },
451
+ { x: width, y: -midpoint },
452
+ { x: width, y: -height + midpoint },
453
+ { x: 0, y: -height }
454
+ ];
455
+ }
456
+ if (directions.has("left") && directions.has("up") && directions.has("down")) {
457
+ return [
458
+ { x: width, y: 0 },
459
+ { x: 0, y: -midpoint },
460
+ { x: 0, y: -height + midpoint },
461
+ { x: width, y: -height }
462
+ ];
463
+ }
464
+ if (directions.has("right") && directions.has("left")) {
465
+ return [
466
+ { x: midpoint, y: 0 },
467
+ { x: midpoint, y: -padding },
468
+ { x: width - midpoint, y: -padding },
469
+ { x: width - midpoint, y: 0 },
470
+ { x: width, y: -height / 2 },
471
+ { x: width - midpoint, y: -height },
472
+ { x: width - midpoint, y: -height + padding },
473
+ { x: midpoint, y: -height + padding },
474
+ { x: midpoint, y: -height },
475
+ { x: 0, y: -height / 2 }
476
+ ];
477
+ }
478
+ if (directions.has("up") && directions.has("down")) {
479
+ return [
480
+ // Bottom center
481
+ { x: width / 2, y: 0 },
482
+ // Left pont of bottom arrow
483
+ { x: 0, y: -padding },
484
+ { x: midpoint, y: -padding },
485
+ // Left top over vertical section
486
+ { x: midpoint, y: -height + padding },
487
+ { x: 0, y: -height + padding },
488
+ // Top of arrow
489
+ { x: width / 2, y: -height },
490
+ { x: width, y: -height + padding },
491
+ // Top of right vertical bar
492
+ { x: width - midpoint, y: -height + padding },
493
+ { x: width - midpoint, y: -padding },
494
+ { x: width, y: -padding }
495
+ ];
496
+ }
497
+ if (directions.has("right") && directions.has("up")) {
498
+ return [
499
+ { x: 0, y: 0 },
500
+ { x: width, y: -midpoint },
501
+ { x: 0, y: -height }
502
+ ];
503
+ }
504
+ if (directions.has("right") && directions.has("down")) {
505
+ return [
506
+ { x: 0, y: 0 },
507
+ { x: width, y: 0 },
508
+ { x: 0, y: -height }
509
+ ];
510
+ }
511
+ if (directions.has("left") && directions.has("up")) {
512
+ return [
513
+ { x: width, y: 0 },
514
+ { x: 0, y: -midpoint },
515
+ { x: width, y: -height }
516
+ ];
517
+ }
518
+ if (directions.has("left") && directions.has("down")) {
519
+ return [
520
+ { x: width, y: 0 },
521
+ { x: 0, y: 0 },
522
+ { x: width, y: -height }
523
+ ];
524
+ }
525
+ if (directions.has("right")) {
526
+ return [
527
+ { x: midpoint, y: -padding },
528
+ { x: midpoint, y: -padding },
529
+ { x: width - midpoint, y: -padding },
530
+ { x: width - midpoint, y: 0 },
531
+ { x: width, y: -height / 2 },
532
+ { x: width - midpoint, y: -height },
533
+ { x: width - midpoint, y: -height + padding },
534
+ // top left corner of arrow
535
+ { x: midpoint, y: -height + padding },
536
+ { x: midpoint, y: -height + padding }
537
+ ];
538
+ }
539
+ if (directions.has("left")) {
540
+ return [
541
+ { x: midpoint, y: 0 },
542
+ { x: midpoint, y: -padding },
543
+ // Two points, the right corners
544
+ { x: width - midpoint, y: -padding },
545
+ { x: width - midpoint, y: -height + padding },
546
+ { x: midpoint, y: -height + padding },
547
+ { x: midpoint, y: -height },
548
+ { x: 0, y: -height / 2 }
549
+ ];
550
+ }
551
+ if (directions.has("up")) {
552
+ return [
553
+ // Bottom center
554
+ { x: midpoint, y: -padding },
555
+ // Left top over vertical section
556
+ { x: midpoint, y: -height + padding },
557
+ { x: 0, y: -height + padding },
558
+ // Top of arrow
559
+ { x: width / 2, y: -height },
560
+ { x: width, y: -height + padding },
561
+ // Top of right vertical bar
562
+ { x: width - midpoint, y: -height + padding },
563
+ { x: width - midpoint, y: -padding }
564
+ ];
565
+ }
566
+ if (directions.has("down")) {
567
+ return [
568
+ // Bottom center
569
+ { x: width / 2, y: 0 },
570
+ // Left pont of bottom arrow
571
+ { x: 0, y: -padding },
572
+ { x: midpoint, y: -padding },
573
+ // Left top over vertical section
574
+ { x: midpoint, y: -height + padding },
575
+ { x: width - midpoint, y: -height + padding },
576
+ { x: width - midpoint, y: -padding },
577
+ { x: width, y: -padding }
578
+ ];
579
+ }
580
+ return [{ x: 0, y: 0 }];
581
+ };
582
+ const formatClass = (str) => {
583
+ if (str) {
584
+ return " " + str;
585
+ }
586
+ return "";
587
+ };
588
+ const getClassesFromNode = (node, otherClasses) => {
589
+ return `${"node default"}${formatClass(node.classes)} ${formatClass(
590
+ node.class
591
+ )}`;
592
+ };
593
+ const question = async (parent, node) => {
594
+ const { shapeSvg, bbox } = await labelHelper(
595
+ parent,
596
+ node,
597
+ getClassesFromNode(node),
598
+ true
599
+ );
600
+ const w = bbox.width + node.padding;
601
+ const h = bbox.height + node.padding;
602
+ const s = w + h;
603
+ const points = [
604
+ { x: s / 2, y: 0 },
605
+ { x: s, y: -s / 2 },
606
+ { x: s / 2, y: -s },
607
+ { x: 0, y: -s / 2 }
608
+ ];
609
+ log$1.info("Question main (Circle)");
610
+ const questionElem = insertPolygonShape(shapeSvg, s, s, points);
611
+ questionElem.attr("style", node.style);
612
+ updateNodeBounds(node, questionElem);
613
+ node.intersect = function(point2) {
614
+ log$1.warn("Intersect called");
615
+ return intersect.polygon(node, points, point2);
616
+ };
617
+ return shapeSvg;
618
+ };
619
+ const choice = (parent, node) => {
620
+ const shapeSvg = parent.insert("g").attr("class", "node default").attr("id", node.domId || node.id);
621
+ const s = 28;
622
+ const points = [
623
+ { x: 0, y: s / 2 },
624
+ { x: s / 2, y: 0 },
625
+ { x: 0, y: -s / 2 },
626
+ { x: -s / 2, y: 0 }
627
+ ];
628
+ const choice2 = shapeSvg.insert("polygon", ":first-child").attr(
629
+ "points",
630
+ points.map(function(d) {
631
+ return d.x + "," + d.y;
632
+ }).join(" ")
633
+ );
634
+ choice2.attr("class", "state-start").attr("r", 7).attr("width", 28).attr("height", 28);
635
+ node.width = 28;
636
+ node.height = 28;
637
+ node.intersect = function(point2) {
638
+ return intersect.circle(node, 14, point2);
639
+ };
640
+ return shapeSvg;
641
+ };
642
+ const hexagon = async (parent, node) => {
643
+ const { shapeSvg, bbox } = await labelHelper(
644
+ parent,
645
+ node,
646
+ getClassesFromNode(node),
647
+ true
648
+ );
649
+ const f = 4;
650
+ const h = bbox.height + node.padding;
651
+ const m = h / f;
652
+ const w = bbox.width + 2 * m + node.padding;
653
+ const points = [
654
+ { x: m, y: 0 },
655
+ { x: w - m, y: 0 },
656
+ { x: w, y: -h / 2 },
657
+ { x: w - m, y: -h },
658
+ { x: m, y: -h },
659
+ { x: 0, y: -h / 2 }
660
+ ];
661
+ const hex = insertPolygonShape(shapeSvg, w, h, points);
662
+ hex.attr("style", node.style);
663
+ updateNodeBounds(node, hex);
664
+ node.intersect = function(point2) {
665
+ return intersect.polygon(node, points, point2);
666
+ };
667
+ return shapeSvg;
668
+ };
669
+ const block_arrow = async (parent, node) => {
670
+ const { shapeSvg, bbox } = await labelHelper(parent, node, void 0, true);
671
+ const f = 2;
672
+ const h = bbox.height + 2 * node.padding;
673
+ const m = h / f;
674
+ const w = bbox.width + 2 * m + node.padding;
675
+ const points = getArrowPoints(node.directions, bbox, node);
676
+ const blockArrow = insertPolygonShape(shapeSvg, w, h, points);
677
+ blockArrow.attr("style", node.style);
678
+ updateNodeBounds(node, blockArrow);
679
+ node.intersect = function(point2) {
680
+ return intersect.polygon(node, points, point2);
681
+ };
682
+ return shapeSvg;
683
+ };
684
+ const rect_left_inv_arrow = async (parent, node) => {
685
+ const { shapeSvg, bbox } = await labelHelper(
686
+ parent,
687
+ node,
688
+ getClassesFromNode(node),
689
+ true
690
+ );
691
+ const w = bbox.width + node.padding;
692
+ const h = bbox.height + node.padding;
693
+ const points = [
694
+ { x: -h / 2, y: 0 },
695
+ { x: w, y: 0 },
696
+ { x: w, y: -h },
697
+ { x: -h / 2, y: -h },
698
+ { x: 0, y: -h / 2 }
699
+ ];
700
+ const el = insertPolygonShape(shapeSvg, w, h, points);
701
+ el.attr("style", node.style);
702
+ node.width = w + h;
703
+ node.height = h;
704
+ node.intersect = function(point2) {
705
+ return intersect.polygon(node, points, point2);
706
+ };
707
+ return shapeSvg;
708
+ };
709
+ const lean_right = async (parent, node) => {
710
+ const { shapeSvg, bbox } = await labelHelper(parent, node, getClassesFromNode(node), true);
711
+ const w = bbox.width + node.padding;
712
+ const h = bbox.height + node.padding;
713
+ const points = [
714
+ { x: -2 * h / 6, y: 0 },
715
+ { x: w - h / 6, y: 0 },
716
+ { x: w + 2 * h / 6, y: -h },
717
+ { x: h / 6, y: -h }
718
+ ];
719
+ const el = insertPolygonShape(shapeSvg, w, h, points);
720
+ el.attr("style", node.style);
721
+ updateNodeBounds(node, el);
722
+ node.intersect = function(point2) {
723
+ return intersect.polygon(node, points, point2);
724
+ };
725
+ return shapeSvg;
726
+ };
727
+ const lean_left = async (parent, node) => {
728
+ const { shapeSvg, bbox } = await labelHelper(
729
+ parent,
730
+ node,
731
+ getClassesFromNode(node),
732
+ true
733
+ );
734
+ const w = bbox.width + node.padding;
735
+ const h = bbox.height + node.padding;
736
+ const points = [
737
+ { x: 2 * h / 6, y: 0 },
738
+ { x: w + h / 6, y: 0 },
739
+ { x: w - 2 * h / 6, y: -h },
740
+ { x: -h / 6, y: -h }
741
+ ];
742
+ const el = insertPolygonShape(shapeSvg, w, h, points);
743
+ el.attr("style", node.style);
744
+ updateNodeBounds(node, el);
745
+ node.intersect = function(point2) {
746
+ return intersect.polygon(node, points, point2);
747
+ };
748
+ return shapeSvg;
749
+ };
750
+ const trapezoid = async (parent, node) => {
751
+ const { shapeSvg, bbox } = await labelHelper(
752
+ parent,
753
+ node,
754
+ getClassesFromNode(node),
755
+ true
756
+ );
757
+ const w = bbox.width + node.padding;
758
+ const h = bbox.height + node.padding;
759
+ const points = [
760
+ { x: -2 * h / 6, y: 0 },
761
+ { x: w + 2 * h / 6, y: 0 },
762
+ { x: w - h / 6, y: -h },
763
+ { x: h / 6, y: -h }
764
+ ];
765
+ const el = insertPolygonShape(shapeSvg, w, h, points);
766
+ el.attr("style", node.style);
767
+ updateNodeBounds(node, el);
768
+ node.intersect = function(point2) {
769
+ return intersect.polygon(node, points, point2);
770
+ };
771
+ return shapeSvg;
772
+ };
773
+ const inv_trapezoid = async (parent, node) => {
774
+ const { shapeSvg, bbox } = await labelHelper(
775
+ parent,
776
+ node,
777
+ getClassesFromNode(node),
778
+ true
779
+ );
780
+ const w = bbox.width + node.padding;
781
+ const h = bbox.height + node.padding;
782
+ const points = [
783
+ { x: h / 6, y: 0 },
784
+ { x: w - h / 6, y: 0 },
785
+ { x: w + 2 * h / 6, y: -h },
786
+ { x: -2 * h / 6, y: -h }
787
+ ];
788
+ const el = insertPolygonShape(shapeSvg, w, h, points);
789
+ el.attr("style", node.style);
790
+ updateNodeBounds(node, el);
791
+ node.intersect = function(point2) {
792
+ return intersect.polygon(node, points, point2);
793
+ };
794
+ return shapeSvg;
795
+ };
796
+ const rect_right_inv_arrow = async (parent, node) => {
797
+ const { shapeSvg, bbox } = await labelHelper(
798
+ parent,
799
+ node,
800
+ getClassesFromNode(node),
801
+ true
802
+ );
803
+ const w = bbox.width + node.padding;
804
+ const h = bbox.height + node.padding;
805
+ const points = [
806
+ { x: 0, y: 0 },
807
+ { x: w + h / 2, y: 0 },
808
+ { x: w, y: -h / 2 },
809
+ { x: w + h / 2, y: -h },
810
+ { x: 0, y: -h }
811
+ ];
812
+ const el = insertPolygonShape(shapeSvg, w, h, points);
813
+ el.attr("style", node.style);
814
+ updateNodeBounds(node, el);
815
+ node.intersect = function(point2) {
816
+ return intersect.polygon(node, points, point2);
817
+ };
818
+ return shapeSvg;
819
+ };
820
+ const cylinder = async (parent, node) => {
821
+ const { shapeSvg, bbox } = await labelHelper(
822
+ parent,
823
+ node,
824
+ getClassesFromNode(node),
825
+ true
826
+ );
827
+ const w = bbox.width + node.padding;
828
+ const rx = w / 2;
829
+ const ry = rx / (2.5 + w / 50);
830
+ const h = bbox.height + ry + node.padding;
831
+ const shape = "M 0," + ry + " a " + rx + "," + ry + " 0,0,0 " + w + " 0 a " + rx + "," + ry + " 0,0,0 " + -w + " 0 l 0," + h + " a " + rx + "," + ry + " 0,0,0 " + w + " 0 l 0," + -h;
832
+ const el = shapeSvg.attr("label-offset-y", ry).insert("path", ":first-child").attr("style", node.style).attr("d", shape).attr("transform", "translate(" + -w / 2 + "," + -(h / 2 + ry) + ")");
833
+ updateNodeBounds(node, el);
834
+ node.intersect = function(point2) {
835
+ const pos = intersect.rect(node, point2);
836
+ const x = pos.x - node.x;
837
+ if (rx != 0 && (Math.abs(x) < node.width / 2 || Math.abs(x) == node.width / 2 && Math.abs(pos.y - node.y) > node.height / 2 - ry)) {
838
+ let y = ry * ry * (1 - x * x / (rx * rx));
839
+ if (y != 0) {
840
+ y = Math.sqrt(y);
841
+ }
842
+ y = ry - y;
843
+ if (point2.y - node.y > 0) {
844
+ y = -y;
845
+ }
846
+ pos.y += y;
847
+ }
848
+ return pos;
849
+ };
850
+ return shapeSvg;
851
+ };
852
+ const rect = async (parent, node) => {
853
+ const { shapeSvg, bbox, halfPadding } = await labelHelper(
854
+ parent,
855
+ node,
856
+ "node " + node.classes + " " + node.class,
857
+ true
858
+ );
859
+ const rect2 = shapeSvg.insert("rect", ":first-child");
860
+ const totalWidth = node.positioned ? node.width : bbox.width + node.padding;
861
+ const totalHeight = node.positioned ? node.height : bbox.height + node.padding;
862
+ const x = node.positioned ? -totalWidth / 2 : -bbox.width / 2 - halfPadding;
863
+ const y = node.positioned ? -totalHeight / 2 : -bbox.height / 2 - halfPadding;
864
+ rect2.attr("class", "basic label-container").attr("style", node.style).attr("rx", node.rx).attr("ry", node.ry).attr("x", x).attr("y", y).attr("width", totalWidth).attr("height", totalHeight);
865
+ if (node.props) {
866
+ const propKeys = new Set(Object.keys(node.props));
867
+ if (node.props.borders) {
868
+ applyNodePropertyBorders(rect2, node.props.borders, totalWidth, totalHeight);
869
+ propKeys.delete("borders");
870
+ }
871
+ propKeys.forEach((propKey) => {
872
+ log$1.warn(`Unknown node property ${propKey}`);
873
+ });
874
+ }
875
+ updateNodeBounds(node, rect2);
876
+ node.intersect = function(point2) {
877
+ return intersect.rect(node, point2);
878
+ };
879
+ return shapeSvg;
880
+ };
881
+ const composite = async (parent, node) => {
882
+ const { shapeSvg, bbox, halfPadding } = await labelHelper(
883
+ parent,
884
+ node,
885
+ "node " + node.classes,
886
+ true
887
+ );
888
+ const rect2 = shapeSvg.insert("rect", ":first-child");
889
+ const totalWidth = node.positioned ? node.width : bbox.width + node.padding;
890
+ const totalHeight = node.positioned ? node.height : bbox.height + node.padding;
891
+ const x = node.positioned ? -totalWidth / 2 : -bbox.width / 2 - halfPadding;
892
+ const y = node.positioned ? -totalHeight / 2 : -bbox.height / 2 - halfPadding;
893
+ rect2.attr("class", "basic cluster composite label-container").attr("style", node.style).attr("rx", node.rx).attr("ry", node.ry).attr("x", x).attr("y", y).attr("width", totalWidth).attr("height", totalHeight);
894
+ if (node.props) {
895
+ const propKeys = new Set(Object.keys(node.props));
896
+ if (node.props.borders) {
897
+ applyNodePropertyBorders(rect2, node.props.borders, totalWidth, totalHeight);
898
+ propKeys.delete("borders");
899
+ }
900
+ propKeys.forEach((propKey) => {
901
+ log$1.warn(`Unknown node property ${propKey}`);
902
+ });
903
+ }
904
+ updateNodeBounds(node, rect2);
905
+ node.intersect = function(point2) {
906
+ return intersect.rect(node, point2);
907
+ };
908
+ return shapeSvg;
909
+ };
910
+ const labelRect = async (parent, node) => {
911
+ const { shapeSvg } = await labelHelper(parent, node, "label", true);
912
+ log$1.trace("Classes = ", node.class);
913
+ const rect2 = shapeSvg.insert("rect", ":first-child");
914
+ const totalWidth = 0;
915
+ const totalHeight = 0;
916
+ rect2.attr("width", totalWidth).attr("height", totalHeight);
917
+ shapeSvg.attr("class", "label edgeLabel");
918
+ if (node.props) {
919
+ const propKeys = new Set(Object.keys(node.props));
920
+ if (node.props.borders) {
921
+ applyNodePropertyBorders(rect2, node.props.borders, totalWidth, totalHeight);
922
+ propKeys.delete("borders");
923
+ }
924
+ propKeys.forEach((propKey) => {
925
+ log$1.warn(`Unknown node property ${propKey}`);
926
+ });
927
+ }
928
+ updateNodeBounds(node, rect2);
929
+ node.intersect = function(point2) {
930
+ return intersect.rect(node, point2);
931
+ };
932
+ return shapeSvg;
933
+ };
934
+ function applyNodePropertyBorders(rect2, borders, totalWidth, totalHeight) {
935
+ const strokeDashArray = [];
936
+ const addBorder = (length) => {
937
+ strokeDashArray.push(length, 0);
938
+ };
939
+ const skipBorder = (length) => {
940
+ strokeDashArray.push(0, length);
941
+ };
942
+ if (borders.includes("t")) {
943
+ log$1.debug("add top border");
944
+ addBorder(totalWidth);
945
+ } else {
946
+ skipBorder(totalWidth);
947
+ }
948
+ if (borders.includes("r")) {
949
+ log$1.debug("add right border");
950
+ addBorder(totalHeight);
951
+ } else {
952
+ skipBorder(totalHeight);
953
+ }
954
+ if (borders.includes("b")) {
955
+ log$1.debug("add bottom border");
956
+ addBorder(totalWidth);
957
+ } else {
958
+ skipBorder(totalWidth);
959
+ }
960
+ if (borders.includes("l")) {
961
+ log$1.debug("add left border");
962
+ addBorder(totalHeight);
963
+ } else {
964
+ skipBorder(totalHeight);
965
+ }
966
+ rect2.attr("stroke-dasharray", strokeDashArray.join(" "));
967
+ }
968
+ const rectWithTitle = (parent, node) => {
969
+ let classes;
970
+ if (!node.classes) {
971
+ classes = "node default";
972
+ } else {
973
+ classes = "node " + node.classes;
974
+ }
975
+ const shapeSvg = parent.insert("g").attr("class", classes).attr("id", node.domId || node.id);
976
+ const rect2 = shapeSvg.insert("rect", ":first-child");
977
+ const innerLine = shapeSvg.insert("line");
978
+ const label = shapeSvg.insert("g").attr("class", "label");
979
+ const text2 = node.labelText.flat ? node.labelText.flat() : node.labelText;
980
+ let title = "";
981
+ if (typeof text2 === "object") {
982
+ title = text2[0];
983
+ } else {
984
+ title = text2;
985
+ }
986
+ log$1.info("Label text abc79", title, text2, typeof text2 === "object");
987
+ const text = label.node().appendChild(createLabel$1(title, node.labelStyle, true, true));
988
+ let bbox = { width: 0, height: 0 };
989
+ if (evaluate(getConfig().flowchart.htmlLabels)) {
990
+ const div = text.children[0];
991
+ const dv = select(text);
992
+ bbox = div.getBoundingClientRect();
993
+ dv.attr("width", bbox.width);
994
+ dv.attr("height", bbox.height);
995
+ }
996
+ log$1.info("Text 2", text2);
997
+ const textRows = text2.slice(1, text2.length);
998
+ let titleBox = text.getBBox();
999
+ const descr = label.node().appendChild(
1000
+ createLabel$1(textRows.join ? textRows.join("<br/>") : textRows, node.labelStyle, true, true)
1001
+ );
1002
+ if (evaluate(getConfig().flowchart.htmlLabels)) {
1003
+ const div = descr.children[0];
1004
+ const dv = select(descr);
1005
+ bbox = div.getBoundingClientRect();
1006
+ dv.attr("width", bbox.width);
1007
+ dv.attr("height", bbox.height);
1008
+ }
1009
+ const halfPadding = node.padding / 2;
1010
+ select(descr).attr(
1011
+ "transform",
1012
+ "translate( " + // (titleBox.width - bbox.width) / 2 +
1013
+ (bbox.width > titleBox.width ? 0 : (titleBox.width - bbox.width) / 2) + ", " + (titleBox.height + halfPadding + 5) + ")"
1014
+ );
1015
+ select(text).attr(
1016
+ "transform",
1017
+ "translate( " + // (titleBox.width - bbox.width) / 2 +
1018
+ (bbox.width < titleBox.width ? 0 : -(titleBox.width - bbox.width) / 2) + ", 0)"
1019
+ );
1020
+ bbox = label.node().getBBox();
1021
+ label.attr(
1022
+ "transform",
1023
+ "translate(" + -bbox.width / 2 + ", " + (-bbox.height / 2 - halfPadding + 3) + ")"
1024
+ );
1025
+ rect2.attr("class", "outer title-state").attr("x", -bbox.width / 2 - halfPadding).attr("y", -bbox.height / 2 - halfPadding).attr("width", bbox.width + node.padding).attr("height", bbox.height + node.padding);
1026
+ innerLine.attr("class", "divider").attr("x1", -bbox.width / 2 - halfPadding).attr("x2", bbox.width / 2 + halfPadding).attr("y1", -bbox.height / 2 - halfPadding + titleBox.height + halfPadding).attr("y2", -bbox.height / 2 - halfPadding + titleBox.height + halfPadding);
1027
+ updateNodeBounds(node, rect2);
1028
+ node.intersect = function(point2) {
1029
+ return intersect.rect(node, point2);
1030
+ };
1031
+ return shapeSvg;
1032
+ };
1033
+ const stadium = async (parent, node) => {
1034
+ const { shapeSvg, bbox } = await labelHelper(
1035
+ parent,
1036
+ node,
1037
+ getClassesFromNode(node),
1038
+ true
1039
+ );
1040
+ const h = bbox.height + node.padding;
1041
+ const w = bbox.width + h / 4 + node.padding;
1042
+ const rect2 = shapeSvg.insert("rect", ":first-child").attr("style", node.style).attr("rx", h / 2).attr("ry", h / 2).attr("x", -w / 2).attr("y", -h / 2).attr("width", w).attr("height", h);
1043
+ updateNodeBounds(node, rect2);
1044
+ node.intersect = function(point2) {
1045
+ return intersect.rect(node, point2);
1046
+ };
1047
+ return shapeSvg;
1048
+ };
1049
+ const circle = async (parent, node) => {
1050
+ const { shapeSvg, bbox, halfPadding } = await labelHelper(
1051
+ parent,
1052
+ node,
1053
+ getClassesFromNode(node),
1054
+ true
1055
+ );
1056
+ const circle2 = shapeSvg.insert("circle", ":first-child");
1057
+ circle2.attr("style", node.style).attr("rx", node.rx).attr("ry", node.ry).attr("r", bbox.width / 2 + halfPadding).attr("width", bbox.width + node.padding).attr("height", bbox.height + node.padding);
1058
+ log$1.info("Circle main");
1059
+ updateNodeBounds(node, circle2);
1060
+ node.intersect = function(point2) {
1061
+ log$1.info("Circle intersect", node, bbox.width / 2 + halfPadding, point2);
1062
+ return intersect.circle(node, bbox.width / 2 + halfPadding, point2);
1063
+ };
1064
+ return shapeSvg;
1065
+ };
1066
+ const doublecircle = async (parent, node) => {
1067
+ const { shapeSvg, bbox, halfPadding } = await labelHelper(
1068
+ parent,
1069
+ node,
1070
+ getClassesFromNode(node),
1071
+ true
1072
+ );
1073
+ const gap = 5;
1074
+ const circleGroup = shapeSvg.insert("g", ":first-child");
1075
+ const outerCircle = circleGroup.insert("circle");
1076
+ const innerCircle = circleGroup.insert("circle");
1077
+ circleGroup.attr("class", node.class);
1078
+ outerCircle.attr("style", node.style).attr("rx", node.rx).attr("ry", node.ry).attr("r", bbox.width / 2 + halfPadding + gap).attr("width", bbox.width + node.padding + gap * 2).attr("height", bbox.height + node.padding + gap * 2);
1079
+ innerCircle.attr("style", node.style).attr("rx", node.rx).attr("ry", node.ry).attr("r", bbox.width / 2 + halfPadding).attr("width", bbox.width + node.padding).attr("height", bbox.height + node.padding);
1080
+ log$1.info("DoubleCircle main");
1081
+ updateNodeBounds(node, outerCircle);
1082
+ node.intersect = function(point2) {
1083
+ log$1.info("DoubleCircle intersect", node, bbox.width / 2 + halfPadding + gap, point2);
1084
+ return intersect.circle(node, bbox.width / 2 + halfPadding + gap, point2);
1085
+ };
1086
+ return shapeSvg;
1087
+ };
1088
+ const subroutine = async (parent, node) => {
1089
+ const { shapeSvg, bbox } = await labelHelper(
1090
+ parent,
1091
+ node,
1092
+ getClassesFromNode(node),
1093
+ true
1094
+ );
1095
+ const w = bbox.width + node.padding;
1096
+ const h = bbox.height + node.padding;
1097
+ const points = [
1098
+ { x: 0, y: 0 },
1099
+ { x: w, y: 0 },
1100
+ { x: w, y: -h },
1101
+ { x: 0, y: -h },
1102
+ { x: 0, y: 0 },
1103
+ { x: -8, y: 0 },
1104
+ { x: w + 8, y: 0 },
1105
+ { x: w + 8, y: -h },
1106
+ { x: -8, y: -h },
1107
+ { x: -8, y: 0 }
1108
+ ];
1109
+ const el = insertPolygonShape(shapeSvg, w, h, points);
1110
+ el.attr("style", node.style);
1111
+ updateNodeBounds(node, el);
1112
+ node.intersect = function(point2) {
1113
+ return intersect.polygon(node, points, point2);
1114
+ };
1115
+ return shapeSvg;
1116
+ };
1117
+ const start = (parent, node) => {
1118
+ const shapeSvg = parent.insert("g").attr("class", "node default").attr("id", node.domId || node.id);
1119
+ const circle2 = shapeSvg.insert("circle", ":first-child");
1120
+ circle2.attr("class", "state-start").attr("r", 7).attr("width", 14).attr("height", 14);
1121
+ updateNodeBounds(node, circle2);
1122
+ node.intersect = function(point2) {
1123
+ return intersect.circle(node, 7, point2);
1124
+ };
1125
+ return shapeSvg;
1126
+ };
1127
+ const forkJoin = (parent, node, dir) => {
1128
+ const shapeSvg = parent.insert("g").attr("class", "node default").attr("id", node.domId || node.id);
1129
+ let width = 70;
1130
+ let height = 10;
1131
+ if (dir === "LR") {
1132
+ width = 10;
1133
+ height = 70;
1134
+ }
1135
+ const shape = shapeSvg.append("rect").attr("x", -1 * width / 2).attr("y", -1 * height / 2).attr("width", width).attr("height", height).attr("class", "fork-join");
1136
+ updateNodeBounds(node, shape);
1137
+ node.height = node.height + node.padding / 2;
1138
+ node.width = node.width + node.padding / 2;
1139
+ node.intersect = function(point2) {
1140
+ return intersect.rect(node, point2);
1141
+ };
1142
+ return shapeSvg;
1143
+ };
1144
+ const end = (parent, node) => {
1145
+ const shapeSvg = parent.insert("g").attr("class", "node default").attr("id", node.domId || node.id);
1146
+ const innerCircle = shapeSvg.insert("circle", ":first-child");
1147
+ const circle2 = shapeSvg.insert("circle", ":first-child");
1148
+ circle2.attr("class", "state-start").attr("r", 7).attr("width", 14).attr("height", 14);
1149
+ innerCircle.attr("class", "state-end").attr("r", 5).attr("width", 10).attr("height", 10);
1150
+ updateNodeBounds(node, circle2);
1151
+ node.intersect = function(point2) {
1152
+ return intersect.circle(node, 7, point2);
1153
+ };
1154
+ return shapeSvg;
1155
+ };
1156
+ const class_box = (parent, node) => {
1157
+ const halfPadding = node.padding / 2;
1158
+ const rowPadding = 4;
1159
+ const lineHeight = 8;
1160
+ let classes;
1161
+ if (!node.classes) {
1162
+ classes = "node default";
1163
+ } else {
1164
+ classes = "node " + node.classes;
1165
+ }
1166
+ const shapeSvg = parent.insert("g").attr("class", classes).attr("id", node.domId || node.id);
1167
+ const rect2 = shapeSvg.insert("rect", ":first-child");
1168
+ const topLine = shapeSvg.insert("line");
1169
+ const bottomLine = shapeSvg.insert("line");
1170
+ let maxWidth = 0;
1171
+ let maxHeight = rowPadding;
1172
+ const labelContainer = shapeSvg.insert("g").attr("class", "label");
1173
+ let verticalPos = 0;
1174
+ const hasInterface = node.classData.annotations && node.classData.annotations[0];
1175
+ const interfaceLabelText = node.classData.annotations[0] ? "«" + node.classData.annotations[0] + "»" : "";
1176
+ const interfaceLabel = labelContainer.node().appendChild(createLabel$1(interfaceLabelText, node.labelStyle, true, true));
1177
+ let interfaceBBox = interfaceLabel.getBBox();
1178
+ if (evaluate(getConfig().flowchart.htmlLabels)) {
1179
+ const div = interfaceLabel.children[0];
1180
+ const dv = select(interfaceLabel);
1181
+ interfaceBBox = div.getBoundingClientRect();
1182
+ dv.attr("width", interfaceBBox.width);
1183
+ dv.attr("height", interfaceBBox.height);
1184
+ }
1185
+ if (node.classData.annotations[0]) {
1186
+ maxHeight += interfaceBBox.height + rowPadding;
1187
+ maxWidth += interfaceBBox.width;
1188
+ }
1189
+ let classTitleString = node.classData.label;
1190
+ if (node.classData.type !== void 0 && node.classData.type !== "") {
1191
+ if (getConfig().flowchart.htmlLabels) {
1192
+ classTitleString += "&lt;" + node.classData.type + "&gt;";
1193
+ } else {
1194
+ classTitleString += "<" + node.classData.type + ">";
1195
+ }
1196
+ }
1197
+ const classTitleLabel = labelContainer.node().appendChild(createLabel$1(classTitleString, node.labelStyle, true, true));
1198
+ select(classTitleLabel).attr("class", "classTitle");
1199
+ let classTitleBBox = classTitleLabel.getBBox();
1200
+ if (evaluate(getConfig().flowchart.htmlLabels)) {
1201
+ const div = classTitleLabel.children[0];
1202
+ const dv = select(classTitleLabel);
1203
+ classTitleBBox = div.getBoundingClientRect();
1204
+ dv.attr("width", classTitleBBox.width);
1205
+ dv.attr("height", classTitleBBox.height);
1206
+ }
1207
+ maxHeight += classTitleBBox.height + rowPadding;
1208
+ if (classTitleBBox.width > maxWidth) {
1209
+ maxWidth = classTitleBBox.width;
1210
+ }
1211
+ const classAttributes = [];
1212
+ node.classData.members.forEach((member) => {
1213
+ const parsedInfo = member.getDisplayDetails();
1214
+ let parsedText = parsedInfo.displayText;
1215
+ if (getConfig().flowchart.htmlLabels) {
1216
+ parsedText = parsedText.replace(/</g, "&lt;").replace(/>/g, "&gt;");
1217
+ }
1218
+ const lbl = labelContainer.node().appendChild(
1219
+ createLabel$1(
1220
+ parsedText,
1221
+ parsedInfo.cssStyle ? parsedInfo.cssStyle : node.labelStyle,
1222
+ true,
1223
+ true
1224
+ )
1225
+ );
1226
+ let bbox = lbl.getBBox();
1227
+ if (evaluate(getConfig().flowchart.htmlLabels)) {
1228
+ const div = lbl.children[0];
1229
+ const dv = select(lbl);
1230
+ bbox = div.getBoundingClientRect();
1231
+ dv.attr("width", bbox.width);
1232
+ dv.attr("height", bbox.height);
1233
+ }
1234
+ if (bbox.width > maxWidth) {
1235
+ maxWidth = bbox.width;
1236
+ }
1237
+ maxHeight += bbox.height + rowPadding;
1238
+ classAttributes.push(lbl);
1239
+ });
1240
+ maxHeight += lineHeight;
1241
+ const classMethods = [];
1242
+ node.classData.methods.forEach((member) => {
1243
+ const parsedInfo = member.getDisplayDetails();
1244
+ let displayText = parsedInfo.displayText;
1245
+ if (getConfig().flowchart.htmlLabels) {
1246
+ displayText = displayText.replace(/</g, "&lt;").replace(/>/g, "&gt;");
1247
+ }
1248
+ const lbl = labelContainer.node().appendChild(
1249
+ createLabel$1(
1250
+ displayText,
1251
+ parsedInfo.cssStyle ? parsedInfo.cssStyle : node.labelStyle,
1252
+ true,
1253
+ true
1254
+ )
1255
+ );
1256
+ let bbox = lbl.getBBox();
1257
+ if (evaluate(getConfig().flowchart.htmlLabels)) {
1258
+ const div = lbl.children[0];
1259
+ const dv = select(lbl);
1260
+ bbox = div.getBoundingClientRect();
1261
+ dv.attr("width", bbox.width);
1262
+ dv.attr("height", bbox.height);
1263
+ }
1264
+ if (bbox.width > maxWidth) {
1265
+ maxWidth = bbox.width;
1266
+ }
1267
+ maxHeight += bbox.height + rowPadding;
1268
+ classMethods.push(lbl);
1269
+ });
1270
+ maxHeight += lineHeight;
1271
+ if (hasInterface) {
1272
+ let diffX2 = (maxWidth - interfaceBBox.width) / 2;
1273
+ select(interfaceLabel).attr(
1274
+ "transform",
1275
+ "translate( " + (-1 * maxWidth / 2 + diffX2) + ", " + -1 * maxHeight / 2 + ")"
1276
+ );
1277
+ verticalPos = interfaceBBox.height + rowPadding;
1278
+ }
1279
+ let diffX = (maxWidth - classTitleBBox.width) / 2;
1280
+ select(classTitleLabel).attr(
1281
+ "transform",
1282
+ "translate( " + (-1 * maxWidth / 2 + diffX) + ", " + (-1 * maxHeight / 2 + verticalPos) + ")"
1283
+ );
1284
+ verticalPos += classTitleBBox.height + rowPadding;
1285
+ topLine.attr("class", "divider").attr("x1", -maxWidth / 2 - halfPadding).attr("x2", maxWidth / 2 + halfPadding).attr("y1", -maxHeight / 2 - halfPadding + lineHeight + verticalPos).attr("y2", -maxHeight / 2 - halfPadding + lineHeight + verticalPos);
1286
+ verticalPos += lineHeight;
1287
+ classAttributes.forEach((lbl) => {
1288
+ select(lbl).attr(
1289
+ "transform",
1290
+ "translate( " + -maxWidth / 2 + ", " + (-1 * maxHeight / 2 + verticalPos + lineHeight / 2) + ")"
1291
+ );
1292
+ const memberBBox = lbl == null ? void 0 : lbl.getBBox();
1293
+ verticalPos += ((memberBBox == null ? void 0 : memberBBox.height) ?? 0) + rowPadding;
1294
+ });
1295
+ verticalPos += lineHeight;
1296
+ bottomLine.attr("class", "divider").attr("x1", -maxWidth / 2 - halfPadding).attr("x2", maxWidth / 2 + halfPadding).attr("y1", -maxHeight / 2 - halfPadding + lineHeight + verticalPos).attr("y2", -maxHeight / 2 - halfPadding + lineHeight + verticalPos);
1297
+ verticalPos += lineHeight;
1298
+ classMethods.forEach((lbl) => {
1299
+ select(lbl).attr(
1300
+ "transform",
1301
+ "translate( " + -maxWidth / 2 + ", " + (-1 * maxHeight / 2 + verticalPos) + ")"
1302
+ );
1303
+ const memberBBox = lbl == null ? void 0 : lbl.getBBox();
1304
+ verticalPos += ((memberBBox == null ? void 0 : memberBBox.height) ?? 0) + rowPadding;
1305
+ });
1306
+ rect2.attr("style", node.style).attr("class", "outer title-state").attr("x", -maxWidth / 2 - halfPadding).attr("y", -(maxHeight / 2) - halfPadding).attr("width", maxWidth + node.padding).attr("height", maxHeight + node.padding);
1307
+ updateNodeBounds(node, rect2);
1308
+ node.intersect = function(point2) {
1309
+ return intersect.rect(node, point2);
1310
+ };
1311
+ return shapeSvg;
1312
+ };
1313
+ const shapes = {
1314
+ rhombus: question,
1315
+ composite,
1316
+ question,
1317
+ rect,
1318
+ labelRect,
1319
+ rectWithTitle,
1320
+ choice,
1321
+ circle,
1322
+ doublecircle,
1323
+ stadium,
1324
+ hexagon,
1325
+ block_arrow,
1326
+ rect_left_inv_arrow,
1327
+ lean_right,
1328
+ lean_left,
1329
+ trapezoid,
1330
+ inv_trapezoid,
1331
+ rect_right_inv_arrow,
1332
+ cylinder,
1333
+ start,
1334
+ end,
1335
+ note: note$1,
1336
+ subroutine,
1337
+ fork: forkJoin,
1338
+ join: forkJoin,
1339
+ class_box
1340
+ };
1341
+ let nodeElems = {};
1342
+ const insertNode = async (elem, node, dir) => {
1343
+ let newEl;
1344
+ let el;
1345
+ if (node.link) {
1346
+ let target;
1347
+ if (getConfig().securityLevel === "sandbox") {
1348
+ target = "_top";
1349
+ } else if (node.linkTarget) {
1350
+ target = node.linkTarget || "_blank";
1351
+ }
1352
+ newEl = elem.insert("svg:a").attr("xlink:href", node.link).attr("target", target);
1353
+ el = await shapes[node.shape](newEl, node, dir);
1354
+ } else {
1355
+ el = await shapes[node.shape](elem, node, dir);
1356
+ newEl = el;
1357
+ }
1358
+ if (node.tooltip) {
1359
+ el.attr("title", node.tooltip);
1360
+ }
1361
+ if (node.class) {
1362
+ el.attr("class", "node default " + node.class);
1363
+ }
1364
+ newEl.attr("data-node", "true");
1365
+ newEl.attr("data-id", node.id);
1366
+ nodeElems[node.id] = newEl;
1367
+ if (node.haveCallback) {
1368
+ nodeElems[node.id].attr("class", nodeElems[node.id].attr("class") + " clickable");
1369
+ }
1370
+ return newEl;
1371
+ };
1372
+ const setNodeElem = (elem, node) => {
1373
+ nodeElems[node.id] = elem;
1374
+ };
1375
+ const clear$1 = () => {
1376
+ nodeElems = {};
1377
+ };
1378
+ const positionNode = (node) => {
1379
+ const el = nodeElems[node.id];
1380
+ log$1.trace(
1381
+ "Transforming node",
1382
+ node.diff,
1383
+ node,
1384
+ "translate(" + (node.x - node.width / 2 - 5) + ", " + node.width / 2 + ")"
1385
+ );
1386
+ const padding = 8;
1387
+ const diff = node.diff || 0;
1388
+ if (node.clusterNode) {
1389
+ el.attr(
1390
+ "transform",
1391
+ "translate(" + (node.x + diff - node.width / 2) + ", " + (node.y - node.height / 2 - padding) + ")"
1392
+ );
1393
+ } else {
1394
+ el.attr("transform", "translate(" + node.x + ", " + node.y + ")");
1395
+ }
1396
+ return diff;
1397
+ };
1398
+ const getSubGraphTitleMargins = ({
1399
+ flowchart
1400
+ }) => {
1401
+ var _a, _b;
1402
+ const subGraphTitleTopMargin = ((_a = flowchart == null ? void 0 : flowchart.subGraphTitleMargin) == null ? void 0 : _a.top) ?? 0;
1403
+ const subGraphTitleBottomMargin = ((_b = flowchart == null ? void 0 : flowchart.subGraphTitleMargin) == null ? void 0 : _b.bottom) ?? 0;
1404
+ const subGraphTitleTotalMargin = subGraphTitleTopMargin + subGraphTitleBottomMargin;
1405
+ return {
1406
+ subGraphTitleTopMargin,
1407
+ subGraphTitleBottomMargin,
1408
+ subGraphTitleTotalMargin
1409
+ };
1410
+ };
1411
+ const markerOffsets = {
1412
+ aggregation: 18,
1413
+ extension: 18,
1414
+ composition: 18,
1415
+ dependency: 6,
1416
+ lollipop: 13.5,
1417
+ arrow_point: 5.3
1418
+ };
1419
+ function calculateDeltaAndAngle(point1, point2) {
1420
+ if (point1 === void 0 || point2 === void 0) {
1421
+ return { angle: 0, deltaX: 0, deltaY: 0 };
1422
+ }
1423
+ point1 = pointTransformer(point1);
1424
+ point2 = pointTransformer(point2);
1425
+ const [x1, y1] = [point1.x, point1.y];
1426
+ const [x2, y2] = [point2.x, point2.y];
1427
+ const deltaX = x2 - x1;
1428
+ const deltaY = y2 - y1;
1429
+ return { angle: Math.atan(deltaY / deltaX), deltaX, deltaY };
1430
+ }
1431
+ const pointTransformer = (data) => {
1432
+ if (Array.isArray(data)) {
1433
+ return { x: data[0], y: data[1] };
1434
+ }
1435
+ return data;
1436
+ };
1437
+ const getLineFunctionsWithOffset = (edge) => {
1438
+ return {
1439
+ x: function(d, i, data) {
1440
+ let offset = 0;
1441
+ if (i === 0 && Object.hasOwn(markerOffsets, edge.arrowTypeStart)) {
1442
+ const { angle, deltaX } = calculateDeltaAndAngle(data[0], data[1]);
1443
+ offset = markerOffsets[edge.arrowTypeStart] * Math.cos(angle) * (deltaX >= 0 ? 1 : -1);
1444
+ } else if (i === data.length - 1 && Object.hasOwn(markerOffsets, edge.arrowTypeEnd)) {
1445
+ const { angle, deltaX } = calculateDeltaAndAngle(
1446
+ data[data.length - 1],
1447
+ data[data.length - 2]
1448
+ );
1449
+ offset = markerOffsets[edge.arrowTypeEnd] * Math.cos(angle) * (deltaX >= 0 ? 1 : -1);
1450
+ }
1451
+ return pointTransformer(d).x + offset;
1452
+ },
1453
+ y: function(d, i, data) {
1454
+ let offset = 0;
1455
+ if (i === 0 && Object.hasOwn(markerOffsets, edge.arrowTypeStart)) {
1456
+ const { angle, deltaY } = calculateDeltaAndAngle(data[0], data[1]);
1457
+ offset = markerOffsets[edge.arrowTypeStart] * Math.abs(Math.sin(angle)) * (deltaY >= 0 ? 1 : -1);
1458
+ } else if (i === data.length - 1 && Object.hasOwn(markerOffsets, edge.arrowTypeEnd)) {
1459
+ const { angle, deltaY } = calculateDeltaAndAngle(
1460
+ data[data.length - 1],
1461
+ data[data.length - 2]
1462
+ );
1463
+ offset = markerOffsets[edge.arrowTypeEnd] * Math.abs(Math.sin(angle)) * (deltaY >= 0 ? 1 : -1);
1464
+ }
1465
+ return pointTransformer(d).y + offset;
1466
+ }
1467
+ };
1468
+ };
1469
+ const addEdgeMarkers = (svgPath, edge, url, id, diagramType) => {
1470
+ if (edge.arrowTypeStart) {
1471
+ addEdgeMarker(svgPath, "start", edge.arrowTypeStart, url, id, diagramType);
1472
+ }
1473
+ if (edge.arrowTypeEnd) {
1474
+ addEdgeMarker(svgPath, "end", edge.arrowTypeEnd, url, id, diagramType);
1475
+ }
1476
+ };
1477
+ const arrowTypesMap = {
1478
+ arrow_cross: "cross",
1479
+ arrow_point: "point",
1480
+ arrow_barb: "barb",
1481
+ arrow_circle: "circle",
1482
+ aggregation: "aggregation",
1483
+ extension: "extension",
1484
+ composition: "composition",
1485
+ dependency: "dependency",
1486
+ lollipop: "lollipop"
1487
+ };
1488
+ const addEdgeMarker = (svgPath, position, arrowType, url, id, diagramType) => {
1489
+ const endMarkerType = arrowTypesMap[arrowType];
1490
+ if (!endMarkerType) {
1491
+ log$1.warn(`Unknown arrow type: ${arrowType}`);
1492
+ return;
1493
+ }
1494
+ const suffix = position === "start" ? "Start" : "End";
1495
+ svgPath.attr(`marker-${position}`, `url(${url}#${id}_${diagramType}-${endMarkerType}${suffix})`);
1496
+ };
1497
+ let edgeLabels = {};
1498
+ let terminalLabels = {};
1499
+ const clear = () => {
1500
+ edgeLabels = {};
1501
+ terminalLabels = {};
1502
+ };
1503
+ const insertEdgeLabel = (elem, edge) => {
1504
+ const useHtmlLabels = evaluate(getConfig().flowchart.htmlLabels);
1505
+ const labelElement = edge.labelType === "markdown" ? createText(elem, edge.label, {
1506
+ style: edge.labelStyle,
1507
+ useHtmlLabels,
1508
+ addSvgBackground: true
1509
+ }) : createLabel$1(edge.label, edge.labelStyle);
1510
+ const edgeLabel = elem.insert("g").attr("class", "edgeLabel");
1511
+ const label = edgeLabel.insert("g").attr("class", "label");
1512
+ label.node().appendChild(labelElement);
1513
+ let bbox = labelElement.getBBox();
1514
+ if (useHtmlLabels) {
1515
+ const div = labelElement.children[0];
1516
+ const dv = select(labelElement);
1517
+ bbox = div.getBoundingClientRect();
1518
+ dv.attr("width", bbox.width);
1519
+ dv.attr("height", bbox.height);
1520
+ }
1521
+ label.attr("transform", "translate(" + -bbox.width / 2 + ", " + -bbox.height / 2 + ")");
1522
+ edgeLabels[edge.id] = edgeLabel;
1523
+ edge.width = bbox.width;
1524
+ edge.height = bbox.height;
1525
+ let fo;
1526
+ if (edge.startLabelLeft) {
1527
+ const startLabelElement = createLabel$1(edge.startLabelLeft, edge.labelStyle);
1528
+ const startEdgeLabelLeft = elem.insert("g").attr("class", "edgeTerminals");
1529
+ const inner = startEdgeLabelLeft.insert("g").attr("class", "inner");
1530
+ fo = inner.node().appendChild(startLabelElement);
1531
+ const slBox = startLabelElement.getBBox();
1532
+ inner.attr("transform", "translate(" + -slBox.width / 2 + ", " + -slBox.height / 2 + ")");
1533
+ if (!terminalLabels[edge.id]) {
1534
+ terminalLabels[edge.id] = {};
1535
+ }
1536
+ terminalLabels[edge.id].startLeft = startEdgeLabelLeft;
1537
+ setTerminalWidth(fo, edge.startLabelLeft);
1538
+ }
1539
+ if (edge.startLabelRight) {
1540
+ const startLabelElement = createLabel$1(edge.startLabelRight, edge.labelStyle);
1541
+ const startEdgeLabelRight = elem.insert("g").attr("class", "edgeTerminals");
1542
+ const inner = startEdgeLabelRight.insert("g").attr("class", "inner");
1543
+ fo = startEdgeLabelRight.node().appendChild(startLabelElement);
1544
+ inner.node().appendChild(startLabelElement);
1545
+ const slBox = startLabelElement.getBBox();
1546
+ inner.attr("transform", "translate(" + -slBox.width / 2 + ", " + -slBox.height / 2 + ")");
1547
+ if (!terminalLabels[edge.id]) {
1548
+ terminalLabels[edge.id] = {};
1549
+ }
1550
+ terminalLabels[edge.id].startRight = startEdgeLabelRight;
1551
+ setTerminalWidth(fo, edge.startLabelRight);
1552
+ }
1553
+ if (edge.endLabelLeft) {
1554
+ const endLabelElement = createLabel$1(edge.endLabelLeft, edge.labelStyle);
1555
+ const endEdgeLabelLeft = elem.insert("g").attr("class", "edgeTerminals");
1556
+ const inner = endEdgeLabelLeft.insert("g").attr("class", "inner");
1557
+ fo = inner.node().appendChild(endLabelElement);
1558
+ const slBox = endLabelElement.getBBox();
1559
+ inner.attr("transform", "translate(" + -slBox.width / 2 + ", " + -slBox.height / 2 + ")");
1560
+ endEdgeLabelLeft.node().appendChild(endLabelElement);
1561
+ if (!terminalLabels[edge.id]) {
1562
+ terminalLabels[edge.id] = {};
1563
+ }
1564
+ terminalLabels[edge.id].endLeft = endEdgeLabelLeft;
1565
+ setTerminalWidth(fo, edge.endLabelLeft);
1566
+ }
1567
+ if (edge.endLabelRight) {
1568
+ const endLabelElement = createLabel$1(edge.endLabelRight, edge.labelStyle);
1569
+ const endEdgeLabelRight = elem.insert("g").attr("class", "edgeTerminals");
1570
+ const inner = endEdgeLabelRight.insert("g").attr("class", "inner");
1571
+ fo = inner.node().appendChild(endLabelElement);
1572
+ const slBox = endLabelElement.getBBox();
1573
+ inner.attr("transform", "translate(" + -slBox.width / 2 + ", " + -slBox.height / 2 + ")");
1574
+ endEdgeLabelRight.node().appendChild(endLabelElement);
1575
+ if (!terminalLabels[edge.id]) {
1576
+ terminalLabels[edge.id] = {};
1577
+ }
1578
+ terminalLabels[edge.id].endRight = endEdgeLabelRight;
1579
+ setTerminalWidth(fo, edge.endLabelRight);
1580
+ }
1581
+ return labelElement;
1582
+ };
1583
+ function setTerminalWidth(fo, value) {
1584
+ if (getConfig().flowchart.htmlLabels && fo) {
1585
+ fo.style.width = value.length * 9 + "px";
1586
+ fo.style.height = "12px";
1587
+ }
1588
+ }
1589
+ const positionEdgeLabel = (edge, paths) => {
1590
+ log$1.debug("Moving label abc88 ", edge.id, edge.label, edgeLabels[edge.id], paths);
1591
+ let path = paths.updatedPath ? paths.updatedPath : paths.originalPath;
1592
+ const siteConfig = getConfig();
1593
+ const { subGraphTitleTotalMargin } = getSubGraphTitleMargins(siteConfig);
1594
+ if (edge.label) {
1595
+ const el = edgeLabels[edge.id];
1596
+ let x = edge.x;
1597
+ let y = edge.y;
1598
+ if (path) {
1599
+ const pos = utils.calcLabelPosition(path);
1600
+ log$1.debug(
1601
+ "Moving label " + edge.label + " from (",
1602
+ x,
1603
+ ",",
1604
+ y,
1605
+ ") to (",
1606
+ pos.x,
1607
+ ",",
1608
+ pos.y,
1609
+ ") abc88"
1610
+ );
1611
+ if (paths.updatedPath) {
1612
+ x = pos.x;
1613
+ y = pos.y;
1614
+ }
1615
+ }
1616
+ el.attr("transform", `translate(${x}, ${y + subGraphTitleTotalMargin / 2})`);
1617
+ }
1618
+ if (edge.startLabelLeft) {
1619
+ const el = terminalLabels[edge.id].startLeft;
1620
+ let x = edge.x;
1621
+ let y = edge.y;
1622
+ if (path) {
1623
+ const pos = utils.calcTerminalLabelPosition(edge.arrowTypeStart ? 10 : 0, "start_left", path);
1624
+ x = pos.x;
1625
+ y = pos.y;
1626
+ }
1627
+ el.attr("transform", `translate(${x}, ${y})`);
1628
+ }
1629
+ if (edge.startLabelRight) {
1630
+ const el = terminalLabels[edge.id].startRight;
1631
+ let x = edge.x;
1632
+ let y = edge.y;
1633
+ if (path) {
1634
+ const pos = utils.calcTerminalLabelPosition(
1635
+ edge.arrowTypeStart ? 10 : 0,
1636
+ "start_right",
1637
+ path
1638
+ );
1639
+ x = pos.x;
1640
+ y = pos.y;
1641
+ }
1642
+ el.attr("transform", `translate(${x}, ${y})`);
1643
+ }
1644
+ if (edge.endLabelLeft) {
1645
+ const el = terminalLabels[edge.id].endLeft;
1646
+ let x = edge.x;
1647
+ let y = edge.y;
1648
+ if (path) {
1649
+ const pos = utils.calcTerminalLabelPosition(edge.arrowTypeEnd ? 10 : 0, "end_left", path);
1650
+ x = pos.x;
1651
+ y = pos.y;
1652
+ }
1653
+ el.attr("transform", `translate(${x}, ${y})`);
1654
+ }
1655
+ if (edge.endLabelRight) {
1656
+ const el = terminalLabels[edge.id].endRight;
1657
+ let x = edge.x;
1658
+ let y = edge.y;
1659
+ if (path) {
1660
+ const pos = utils.calcTerminalLabelPosition(edge.arrowTypeEnd ? 10 : 0, "end_right", path);
1661
+ x = pos.x;
1662
+ y = pos.y;
1663
+ }
1664
+ el.attr("transform", `translate(${x}, ${y})`);
1665
+ }
1666
+ };
1667
+ const outsideNode = (node, point2) => {
1668
+ const x = node.x;
1669
+ const y = node.y;
1670
+ const dx = Math.abs(point2.x - x);
1671
+ const dy = Math.abs(point2.y - y);
1672
+ const w = node.width / 2;
1673
+ const h = node.height / 2;
1674
+ if (dx >= w || dy >= h) {
1675
+ return true;
1676
+ }
1677
+ return false;
1678
+ };
1679
+ const intersection = (node, outsidePoint, insidePoint) => {
1680
+ log$1.debug(`intersection calc abc89:
1681
+ outsidePoint: ${JSON.stringify(outsidePoint)}
1682
+ insidePoint : ${JSON.stringify(insidePoint)}
1683
+ node : x:${node.x} y:${node.y} w:${node.width} h:${node.height}`);
1684
+ const x = node.x;
1685
+ const y = node.y;
1686
+ const dx = Math.abs(x - insidePoint.x);
1687
+ const w = node.width / 2;
1688
+ let r = insidePoint.x < outsidePoint.x ? w - dx : w + dx;
1689
+ const h = node.height / 2;
1690
+ const Q = Math.abs(outsidePoint.y - insidePoint.y);
1691
+ const R = Math.abs(outsidePoint.x - insidePoint.x);
1692
+ if (Math.abs(y - outsidePoint.y) * w > Math.abs(x - outsidePoint.x) * h) {
1693
+ let q = insidePoint.y < outsidePoint.y ? outsidePoint.y - h - y : y - h - outsidePoint.y;
1694
+ r = R * q / Q;
1695
+ const res = {
1696
+ x: insidePoint.x < outsidePoint.x ? insidePoint.x + r : insidePoint.x - R + r,
1697
+ y: insidePoint.y < outsidePoint.y ? insidePoint.y + Q - q : insidePoint.y - Q + q
1698
+ };
1699
+ if (r === 0) {
1700
+ res.x = outsidePoint.x;
1701
+ res.y = outsidePoint.y;
1702
+ }
1703
+ if (R === 0) {
1704
+ res.x = outsidePoint.x;
1705
+ }
1706
+ if (Q === 0) {
1707
+ res.y = outsidePoint.y;
1708
+ }
1709
+ log$1.debug(`abc89 topp/bott calc, Q ${Q}, q ${q}, R ${R}, r ${r}`, res);
1710
+ return res;
1711
+ } else {
1712
+ if (insidePoint.x < outsidePoint.x) {
1713
+ r = outsidePoint.x - w - x;
1714
+ } else {
1715
+ r = x - w - outsidePoint.x;
1716
+ }
1717
+ let q = Q * r / R;
1718
+ let _x = insidePoint.x < outsidePoint.x ? insidePoint.x + R - r : insidePoint.x - R + r;
1719
+ let _y = insidePoint.y < outsidePoint.y ? insidePoint.y + q : insidePoint.y - q;
1720
+ log$1.debug(`sides calc abc89, Q ${Q}, q ${q}, R ${R}, r ${r}`, { _x, _y });
1721
+ if (r === 0) {
1722
+ _x = outsidePoint.x;
1723
+ _y = outsidePoint.y;
1724
+ }
1725
+ if (R === 0) {
1726
+ _x = outsidePoint.x;
1727
+ }
1728
+ if (Q === 0) {
1729
+ _y = outsidePoint.y;
1730
+ }
1731
+ return { x: _x, y: _y };
1732
+ }
1733
+ };
1734
+ const cutPathAtIntersect = (_points, boundaryNode) => {
1735
+ log$1.debug("abc88 cutPathAtIntersect", _points, boundaryNode);
1736
+ let points = [];
1737
+ let lastPointOutside = _points[0];
1738
+ let isInside = false;
1739
+ _points.forEach((point2) => {
1740
+ if (!outsideNode(boundaryNode, point2) && !isInside) {
1741
+ const inter = intersection(boundaryNode, lastPointOutside, point2);
1742
+ let pointPresent = false;
1743
+ points.forEach((p) => {
1744
+ pointPresent = pointPresent || p.x === inter.x && p.y === inter.y;
1745
+ });
1746
+ if (!points.some((e) => e.x === inter.x && e.y === inter.y)) {
1747
+ points.push(inter);
1748
+ }
1749
+ isInside = true;
1750
+ } else {
1751
+ lastPointOutside = point2;
1752
+ if (!isInside) {
1753
+ points.push(point2);
1754
+ }
1755
+ }
1756
+ });
1757
+ return points;
1758
+ };
1759
+ const insertEdge = function(elem, e, edge, clusterDb, diagramType, graph, id) {
1760
+ let points = edge.points;
1761
+ log$1.debug("abc88 InsertEdge: edge=", edge, "e=", e);
1762
+ let pointsHasChanged = false;
1763
+ const tail = graph.node(e.v);
1764
+ var head = graph.node(e.w);
1765
+ if ((head == null ? void 0 : head.intersect) && (tail == null ? void 0 : tail.intersect)) {
1766
+ points = points.slice(1, edge.points.length - 1);
1767
+ points.unshift(tail.intersect(points[0]));
1768
+ points.push(head.intersect(points[points.length - 1]));
1769
+ }
1770
+ if (edge.toCluster) {
1771
+ log$1.debug("to cluster abc88", clusterDb[edge.toCluster]);
1772
+ points = cutPathAtIntersect(edge.points, clusterDb[edge.toCluster].node);
1773
+ pointsHasChanged = true;
1774
+ }
1775
+ if (edge.fromCluster) {
1776
+ log$1.debug("from cluster abc88", clusterDb[edge.fromCluster]);
1777
+ points = cutPathAtIntersect(points.reverse(), clusterDb[edge.fromCluster].node).reverse();
1778
+ pointsHasChanged = true;
1779
+ }
1780
+ const lineData = points.filter((p) => !Number.isNaN(p.y));
1781
+ let curve = curveBasis;
1782
+ if (edge.curve && (diagramType === "graph" || diagramType === "flowchart")) {
1783
+ curve = edge.curve;
1784
+ }
1785
+ const { x, y } = getLineFunctionsWithOffset(edge);
1786
+ const lineFunction = line().x(x).y(y).curve(curve);
1787
+ let strokeClasses;
1788
+ switch (edge.thickness) {
1789
+ case "normal":
1790
+ strokeClasses = "edge-thickness-normal";
1791
+ break;
1792
+ case "thick":
1793
+ strokeClasses = "edge-thickness-thick";
1794
+ break;
1795
+ case "invisible":
1796
+ strokeClasses = "edge-thickness-thick";
1797
+ break;
1798
+ default:
1799
+ strokeClasses = "";
1800
+ }
1801
+ switch (edge.pattern) {
1802
+ case "solid":
1803
+ strokeClasses += " edge-pattern-solid";
1804
+ break;
1805
+ case "dotted":
1806
+ strokeClasses += " edge-pattern-dotted";
1807
+ break;
1808
+ case "dashed":
1809
+ strokeClasses += " edge-pattern-dashed";
1810
+ break;
1811
+ }
1812
+ const svgPath = elem.append("path").attr("d", lineFunction(lineData)).attr("id", edge.id).attr("class", " " + strokeClasses + (edge.classes ? " " + edge.classes : "")).attr("style", edge.style);
1813
+ let url = "";
1814
+ if (getConfig().flowchart.arrowMarkerAbsolute || getConfig().state.arrowMarkerAbsolute) {
1815
+ url = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search;
1816
+ url = url.replace(/\(/g, "\\(");
1817
+ url = url.replace(/\)/g, "\\)");
1818
+ }
1819
+ addEdgeMarkers(svgPath, edge, url, id, diagramType);
1820
+ let paths = {};
1821
+ if (pointsHasChanged) {
1822
+ paths.updatedPath = points;
1823
+ }
1824
+ paths.originalPath = edge.points;
1825
+ return paths;
1826
+ };
1827
+ export {
1828
+ insertEdge as a,
1829
+ insertEdgeLabel as b,
1830
+ insertNode as c,
1831
+ positionNode as d,
1832
+ intersectRect$1 as e,
1833
+ createLabel$1 as f,
1834
+ getSubGraphTitleMargins as g,
1835
+ clear$1 as h,
1836
+ insertMarkers$1 as i,
1837
+ clear as j,
1838
+ getLineFunctionsWithOffset as k,
1839
+ labelHelper as l,
1840
+ addEdgeMarkers as m,
1841
+ positionEdgeLabel as p,
1842
+ setNodeElem as s,
1843
+ updateNodeBounds as u
1844
+ };