@aiderdesk/aiderdesk 0.87.0 → 0.89.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 (223) hide show
  1. package/out/renderer/assets/2DXBBFLN-DhlZjS3f.js +666 -0
  2. package/out/renderer/assets/46IJ22JX-C1e8pvI2.js +853 -0
  3. package/out/renderer/assets/4TTDE5I4-Bea_IXhu.js +501 -0
  4. package/out/renderer/assets/4UF3HTLV-CVqcE2iq.js +29 -0
  5. package/out/renderer/assets/5THPTBWS-2mBFupjU.js +21 -0
  6. package/out/renderer/assets/7WLXJQOR-C8MM6Bra.js +23 -0
  7. package/out/renderer/assets/AAXQQPKT-BVbjBycX.js +1130 -0
  8. package/out/renderer/assets/AKE5O7KZ-Dr4O6i9X.js +184 -0
  9. package/out/renderer/assets/{AgentSettings-Cp7VI6CM.js → AgentSettings-ByYnHHTv.js} +710 -255
  10. package/out/renderer/assets/BNMLP6AG-CHDGj3j_.js +804 -0
  11. package/out/renderer/assets/DKTLEL5E-Dj3316cp.js +42 -0
  12. package/out/renderer/assets/DR6PKOQU-C6a3Tq7K.js +301 -0
  13. package/out/renderer/assets/E4RJ7UJB-BQWgl9gv.js +441 -0
  14. package/out/renderer/assets/ELSXBIJH-CVPK3kX4.js +39 -0
  15. package/out/renderer/assets/ERTIBQVS-71_Ru0iJ.js +182 -0
  16. package/out/renderer/assets/F653G4FO-Dj2Ang6n.js +1497 -0
  17. package/out/renderer/assets/FKCDD66M-DCrQTwBi.js +205 -0
  18. package/out/renderer/assets/FP7KDXVC-DKVnH-En.js +221 -0
  19. package/out/renderer/assets/FT5I3RHX-hlTJy7Nw.js +243 -0
  20. package/out/renderer/assets/FTXIJQGB-BX14b7pN.js +13 -0
  21. package/out/renderer/assets/G3MDBVQH-qZ3yfAIw.js +25 -0
  22. package/out/renderer/assets/GY35JXOZ-cSi0MdIc.js +168 -0
  23. package/out/renderer/assets/H5EEJPP2-bpYW0xE8.js +353 -0
  24. package/out/renderer/assets/HWDLEDTA-uLGgs5fE.js +982 -0
  25. package/out/renderer/assets/{InfoIcon-DesJ60KC.js → InfoIcon-DI4teJbi.js} +1 -1
  26. package/out/renderer/assets/JZWSX6AR-B0pkfB2b.js +67 -0
  27. package/out/renderer/assets/KQOEJWJY-EQFQbIDt.js +84 -0
  28. package/out/renderer/assets/KS3BB3KE-DclWHpbY.js +138 -0
  29. package/out/renderer/assets/KXJRRZHI-CHoCRoQ4.js +502 -0
  30. package/out/renderer/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
  31. package/out/renderer/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
  32. package/out/renderer/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
  33. package/out/renderer/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
  34. package/out/renderer/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
  35. package/out/renderer/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
  36. package/out/renderer/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
  37. package/out/renderer/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
  38. package/out/renderer/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
  39. package/out/renderer/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
  40. package/out/renderer/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
  41. package/out/renderer/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
  42. package/out/renderer/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
  43. package/out/renderer/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
  44. package/out/renderer/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
  45. package/out/renderer/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
  46. package/out/renderer/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
  47. package/out/renderer/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
  48. package/out/renderer/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
  49. package/out/renderer/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
  50. package/out/renderer/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
  51. package/out/renderer/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
  52. package/out/renderer/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
  53. package/out/renderer/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
  54. package/out/renderer/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
  55. package/out/renderer/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
  56. package/out/renderer/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
  57. package/out/renderer/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
  58. package/out/renderer/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
  59. package/out/renderer/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
  60. package/out/renderer/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
  61. package/out/renderer/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
  62. package/out/renderer/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
  63. package/out/renderer/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
  64. package/out/renderer/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
  65. package/out/renderer/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
  66. package/out/renderer/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
  67. package/out/renderer/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
  68. package/out/renderer/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
  69. package/out/renderer/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
  70. package/out/renderer/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
  71. package/out/renderer/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
  72. package/out/renderer/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
  73. package/out/renderer/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
  74. package/out/renderer/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
  75. package/out/renderer/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
  76. package/out/renderer/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
  77. package/out/renderer/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
  78. package/out/renderer/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
  79. package/out/renderer/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
  80. package/out/renderer/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
  81. package/out/renderer/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
  82. package/out/renderer/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
  83. package/out/renderer/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
  84. package/out/renderer/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
  85. package/out/renderer/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
  86. package/out/renderer/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
  87. package/out/renderer/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
  88. package/out/renderer/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
  89. package/out/renderer/assets/MFVI5XKI-TmPyVySZ.js +10 -0
  90. package/out/renderer/assets/MWY2J62P-BlVjis68.js +1102 -0
  91. package/out/renderer/assets/MXGNCBL2-HvKcixVr.js +216 -0
  92. package/out/renderer/assets/N6DAJLIZ-B0JHSPS3.js +120 -0
  93. package/out/renderer/assets/NU5M23IW-CWgVJ5o_.js +116 -0
  94. package/out/renderer/assets/NV4XNBIS-uOSoaYKk.js +1221 -0
  95. package/out/renderer/assets/OGLU4SIR-CiNpshB1.js +289 -0
  96. package/out/renderer/assets/OUNS5N76-C6p0zhvm.js +1064 -0
  97. package/out/renderer/assets/{Onboarding-B2h7iatR.js → Onboarding-Ct6-CF4Z.js} +4 -4
  98. package/out/renderer/assets/PU4ISKXV-BQc-2oYa.js +515 -0
  99. package/out/renderer/assets/PUZGS23X-Bf89SCAj.js +21 -0
  100. package/out/renderer/assets/{ProviderHeader-BvigqAWX.js → ProviderHeader-Buje398H.js} +2 -2
  101. package/out/renderer/assets/Q3IYVLG5-DbP4qs2C.js +500 -0
  102. package/out/renderer/assets/QYHQDLKZ-dANs6SeT.js +983 -0
  103. package/out/renderer/assets/RVARI57O-DMrXgtoB.js +10 -0
  104. package/out/renderer/assets/RZSVICHU-CeuX_9H4.js +263 -0
  105. package/out/renderer/assets/{SettingsPage-CBonY1bv.js → SettingsPage-CLpPKXG1.js} +978 -848
  106. package/out/renderer/assets/UEXXS2NB-Bmbum3yG.js +25 -0
  107. package/out/renderer/assets/UHTQJXKL-C2OuiQBx.js +134 -0
  108. package/out/renderer/assets/URA2L2QI-DJ2BF8fn.js +201 -0
  109. package/out/renderer/assets/UXCHDUKG-B6wMZRAn.js +173 -0
  110. package/out/renderer/assets/{UsageDashboard-DFgckoeT.js → UsageDashboard-ORnsHGxF.js} +9130 -6449
  111. package/out/renderer/assets/VKNV3BUX-BMK4lviM.js +277 -0
  112. package/out/renderer/assets/VMV7XPHP-CzHnUaWh.js +127 -0
  113. package/out/renderer/assets/WEVWDWVA-BYWYeLxq.js +57 -0
  114. package/out/renderer/assets/XRRJ35LF-DaeQ2kbN.js +119 -0
  115. package/out/renderer/assets/YFKBLVVN-DsXlM7HO.js +990 -0
  116. package/out/renderer/assets/YHRE5QGZ-nB9z3NP1.js +697 -0
  117. package/out/renderer/assets/ZF3OVT4B-Ctn5OOBd.js +420 -0
  118. package/out/renderer/assets/{index-BFhJk8dv.js → index-BCaQe4ny.js} +2 -2
  119. package/out/renderer/assets/{index-Dk4pOCFt.js → index-BD-JYQGT.js} +5 -5
  120. package/out/renderer/assets/{index-bNFXvWqr.js → index-BGR4ZXWZ.js} +2 -2
  121. package/out/renderer/assets/{index-BP0q4HOE.js → index-BZBhErKV.js} +2 -2
  122. package/out/renderer/assets/{index-x_iC3w5N.js → index-BcWszklu.js} +1 -1
  123. package/out/renderer/assets/{index-C8TOzJWw.js → index-BpNNugm2.js} +4 -4
  124. package/out/renderer/assets/{index-uAJ0Zw9K.js → index-BrgyIQaN.js} +2 -2
  125. package/out/renderer/assets/{index-CuQvDzzr.js → index-Bt1dN7k_.js} +1 -1
  126. package/out/renderer/assets/{index-BZmjwrvJ.js → index-Bxu6rqm3.js} +1 -1
  127. package/out/renderer/assets/{index-tNlkrDYM.js → index-C6mXHxX3.js} +1 -1
  128. package/out/renderer/assets/{index-Z71oMk_m.js → index-CCbq90uE.js} +1 -1
  129. package/out/renderer/assets/{index-DE2koGci.js → index-CCm3UXZP.js} +2 -2
  130. package/out/renderer/assets/{index-DKNYbwcH.js → index-CNkiGtsK.js} +3 -3
  131. package/out/renderer/assets/{index-D_o1aMFn.css → index-CWfnJXNI.css} +130 -0
  132. package/out/renderer/assets/{index-47ZLfCU8.js → index-Cc-He418.js} +72999 -82151
  133. package/out/renderer/assets/{index-Dx6kKrXY.js → index-Crdzxx6k.js} +19 -15
  134. package/out/renderer/assets/{index-B_PkNLqT.js → index-D30k3y98.js} +1 -1
  135. package/out/renderer/assets/{index-CasrGDb0.js → index-DAWoHfjM.js} +2 -2
  136. package/out/renderer/assets/{index-D-rE7YVD.js → index-DG5AIC6J.js} +3 -3
  137. package/out/renderer/assets/{index-BzOM6AUj.js → index-DSBgCNMv.js} +2 -2
  138. package/out/renderer/assets/{index-C1I2Idqy.js → index-DeRKeskE.js} +5 -5
  139. package/out/renderer/assets/{index-Bh4xfAPL.js → index-DgQEgdew.js} +2 -2
  140. package/out/renderer/assets/{index-BKmr7UTW.js → index-Dgdp4i2K.js} +1 -1
  141. package/out/renderer/assets/{index-Bbv79qeB.js → index-DnNK6R2g.js} +2 -2
  142. package/out/renderer/assets/{index-CiIr--kg.js → index-DrNutodm.js} +2 -2
  143. package/out/renderer/assets/{index-B2jZTTYL.js → index-FS3mY8Ct.js} +1 -1
  144. package/out/renderer/assets/{index-DvSWnCZD.js → index-KId2jLzt.js} +2 -2
  145. package/out/renderer/assets/{index-DWZF-uSf.js → index-PyRCX6hq.js} +5 -5
  146. package/out/renderer/assets/{index-J-dLn6uq.js → index-U8nE80jx.js} +2 -2
  147. package/out/renderer/assets/{index-cO9XeYPQ.js → index-Vw8jKJU_.js} +5 -5
  148. package/out/renderer/assets/{index-B9bf5T9j.js → index-_a6zbU-0.js} +1 -1
  149. package/out/renderer/assets/{index-CenYyetH.js → index-dsqlqRSG.js} +5 -5
  150. package/out/renderer/assets/{index-D4dhIRp1.js → index-rQL1hwaP.js} +5 -5
  151. package/out/renderer/assets/{jsx-dev-runtime-CtvYhMha.js → jsx-dev-runtime-Bwt8d4vP.js} +1 -1
  152. package/out/renderer/index.html +2 -2
  153. package/out/resources/prompts/system-prompt.hbs +11 -0
  154. package/out/resources/skills/extension-creator/SKILL.md +20 -1
  155. package/out/resources/skills/extension-creator/references/event-types.md +5 -3
  156. package/out/resources/skills/extension-creator/references/extension-interface.md +62 -1
  157. package/out/resources/skills/extension-creator/references/external-agent-providers.md +90 -0
  158. package/out/runner.js +2016 -615
  159. package/package.json +3 -3
  160. package/out/renderer/assets/abnfDiagram-N423BO3Z-DV7pjob8.js +0 -118
  161. package/out/renderer/assets/arc-C2NyJjKR.js +0 -131
  162. package/out/renderer/assets/architectureDiagram-T3A2C74G-BmG8PHmc.js +0 -8829
  163. package/out/renderer/assets/band-zXq5o_Ib.js +0 -77
  164. package/out/renderer/assets/blockDiagram-VBNYF7ZC-CJndPtzf.js +0 -3824
  165. package/out/renderer/assets/c4Diagram-5PPSVZJV-B9DY2Hnr.js +0 -2482
  166. package/out/renderer/assets/channel-CCPkBLnh.js +0 -7
  167. package/out/renderer/assets/chunk-2GRJ4B5K-Bt46bDfT.js +0 -116
  168. package/out/renderer/assets/chunk-2Q5K7J3B-DkQwfKC2.js +0 -19
  169. package/out/renderer/assets/chunk-5RXB4S5H-CFNEWvlR.js +0 -1988
  170. package/out/renderer/assets/chunk-5VM5RSS4-BNeZg_6d.js +0 -19
  171. package/out/renderer/assets/chunk-6Q2QTUOP-BU5gT8Us.js +0 -860
  172. package/out/renderer/assets/chunk-GF5L2VYU-BNML5JwJ.js +0 -2026
  173. package/out/renderer/assets/chunk-JWPE2WC7-Dvih3ku3.js +0 -16
  174. package/out/renderer/assets/chunk-KBJHAD2P-CMgAbRkQ.js +0 -24
  175. package/out/renderer/assets/chunk-RYQCIY6F-CAJ6Qldz.js +0 -474
  176. package/out/renderer/assets/chunk-XXDRQBXY-BDZJ-WFV.js +0 -13
  177. package/out/renderer/assets/classDiagram-JCYQIIEL-BJCilkUQ.js +0 -23
  178. package/out/renderer/assets/classDiagram-v2-OCEON4UE-BJCilkUQ.js +0 -23
  179. package/out/renderer/assets/cose-bilkent-JH36ORCC-D6MsqBP5.js +0 -4942
  180. package/out/renderer/assets/cynefin-VYW2F7L2-3kPlVPG0.js +0 -32093
  181. package/out/renderer/assets/cynefinDiagram-MW4NZA55-6BlkJqWN.js +0 -453
  182. package/out/renderer/assets/cytoscape.esm-Bx_1tVW-.js +0 -30332
  183. package/out/renderer/assets/dagre-VZM6K2ZE-Chj1W0as.js +0 -522
  184. package/out/renderer/assets/defaultLocale-B2RvLBDe.js +0 -206
  185. package/out/renderer/assets/diagram-7IWD3JNH-CHFj7vIm.js +0 -488
  186. package/out/renderer/assets/diagram-B4RE2ZJO-BqOMO30m.js +0 -632
  187. package/out/renderer/assets/diagram-LBJQPF4R-CkiuQM5K.js +0 -212
  188. package/out/renderer/assets/diagram-Q27KOJAE-WVbpb4Iq.js +0 -857
  189. package/out/renderer/assets/diagram-UB23O5K3-B9Q0wQI3.js +0 -311
  190. package/out/renderer/assets/ebnfDiagram-BXEA7PRR-BUhf1ZxU.js +0 -138
  191. package/out/renderer/assets/erDiagram-JOGREHBK-DGxWkssI.js +0 -1238
  192. package/out/renderer/assets/flowDiagram-UKHOOZJN-D3ul5aGG.js +0 -2348
  193. package/out/renderer/assets/ganttDiagram-PKOTCBZU-BD3VbhAZ.js +0 -2782
  194. package/out/renderer/assets/gitGraphDiagram-DS77QQ5N-x-7NMw7v.js +0 -1373
  195. package/out/renderer/assets/graph-BDbmSegI.js +0 -1308
  196. package/out/renderer/assets/infoDiagram-6WML65LV-BMwbA6CU.js +0 -31
  197. package/out/renderer/assets/init-CTO7spbL.js +0 -35
  198. package/out/renderer/assets/ishikawaDiagram-WSZJBQD7-Bx90Gz0s.js +0 -967
  199. package/out/renderer/assets/journeyDiagram-NVQOT4AX-Dh4pUAU5.js +0 -1255
  200. package/out/renderer/assets/kanban-definition-27J2QSJJ-BZ_lX-ko.js +0 -1052
  201. package/out/renderer/assets/katex-oVG3DVWa.js +0 -14499
  202. package/out/renderer/assets/layout-oaOUFeBM.js +0 -2326
  203. package/out/renderer/assets/linear-B2eGZpM_.js +0 -361
  204. package/out/renderer/assets/map-BijQCI9U.js +0 -299
  205. package/out/renderer/assets/mindmap-definition-FAOFIHXS-BeWZh5qg.js +0 -1153
  206. package/out/renderer/assets/ordinal-BD3Y6v77.js +0 -77
  207. package/out/renderer/assets/pegDiagram-VL7TDLO6-BA6NzzN6.js +0 -126
  208. package/out/renderer/assets/pieDiagram-7S7Q4E2Y-KJmT5t-P.js +0 -316
  209. package/out/renderer/assets/quadrantDiagram-CIZ2JOQS-BdFz_bQU.js +0 -1343
  210. package/out/renderer/assets/railroadDiagram-AXF67PYL-CbH2ZZ1S.js +0 -92
  211. package/out/renderer/assets/requirementDiagram-LRYGKXZP-BZXG5Vgf.js +0 -1204
  212. package/out/renderer/assets/sankeyDiagram-W5VNT64P-CV1Upv22.js +0 -1274
  213. package/out/renderer/assets/sequenceDiagram-SI44F4Z6-Csbi3ivi.js +0 -4514
  214. package/out/renderer/assets/sizeCapture-X5ZJPWSS-CaN4k1d3.js +0 -62
  215. package/out/renderer/assets/stateDiagram-OKZ733FA-DSo1KeOQ.js +0 -452
  216. package/out/renderer/assets/stateDiagram-v2-UEYNNEHI-BhXw89HT.js +0 -22
  217. package/out/renderer/assets/swimlanes-SLNWSIFB-p3GZ-wkU.js +0 -8557
  218. package/out/renderer/assets/swimlanesDiagram-ULZ7WXOC-DGBdyiqy.js +0 -20
  219. package/out/renderer/assets/time-4LaKa9ym.js +0 -985
  220. package/out/renderer/assets/timeline-definition-Z64GVDOM-DfY8hG5p.js +0 -1596
  221. package/out/renderer/assets/vennDiagram-T6HMQDX7-wp87GaTi.js +0 -2515
  222. package/out/renderer/assets/wardleyDiagram-T6FBY63Y-DNrC2vOI.js +0 -975
  223. package/out/renderer/assets/xychartDiagram-ELKLHX3M-Bn8J2SKt.js +0 -1943
@@ -1,4514 +0,0 @@
1
- import { I as ImperativeState } from "./chunk-2Q5K7J3B-DkQwfKC2.js";
2
- import { _ as __name, ar as setConfig2, y as getConfig2, z as select, A as log, K as distExports, B as configureSvgSize, C as assignWithDepth_default, O as common_default, x as setAccTitle, u as setAccDescription, V as setDiagramTitle, w as getAccTitle, v as getAccDescription, W as getDiagramTitle, as as load, at as JSON_SCHEMA, X as clear, J as sanitizeText, a2 as utils_default, au as hasKatex, av as calculateMathMLDimensions, aw as parseFontSize, ax as ZERO_WIDTH_SPACE, a3 as getConfig, ay as getUrl, az as renderKatexSanitized } from "./index-47ZLfCU8.js";
3
- import { a as drawBackgroundRect, b as getTextObj, g as getNoteRect, d as drawRect, c as drawEmbeddedImage, e as drawImage } from "./chunk-2GRJ4B5K-Bt46bDfT.js";
4
- var parser = (function() {
5
- var o = /* @__PURE__ */ __name(function(k, v, o2, l) {
6
- for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v) ;
7
- return o2;
8
- }, "o"), $V0 = [1, 2], $V1 = [1, 3], $V2 = [1, 4], $V3 = [2, 4], $V4 = [1, 9], $V5 = [1, 11], $V6 = [1, 12], $V7 = [1, 14], $V8 = [1, 15], $V9 = [1, 17], $Va = [1, 18], $Vb = [1, 19], $Vc = [1, 25], $Vd = [1, 26], $Ve = [1, 27], $Vf = [1, 28], $Vg = [1, 29], $Vh = [1, 30], $Vi = [1, 31], $Vj = [1, 32], $Vk = [1, 33], $Vl = [1, 34], $Vm = [1, 35], $Vn = [1, 36], $Vo = [1, 37], $Vp = [1, 38], $Vq = [1, 39], $Vr = [1, 40], $Vs = [1, 42], $Vt = [1, 43], $Vu = [1, 44], $Vv = [1, 45], $Vw = [1, 46], $Vx = [1, 47], $Vy = [1, 4, 5, 10, 14, 15, 17, 19, 22, 24, 30, 31, 32, 34, 36, 37, 38, 39, 40, 42, 44, 45, 47, 48, 49, 50, 51, 53, 54, 56, 61, 62, 63, 64, 73], $Vz = [1, 74], $VA = [1, 80], $VB = [1, 81], $VC = [1, 82], $VD = [1, 83], $VE = [1, 84], $VF = [1, 85], $VG = [1, 86], $VH = [1, 87], $VI = [1, 88], $VJ = [1, 89], $VK = [1, 90], $VL = [1, 91], $VM = [1, 92], $VN = [1, 93], $VO = [1, 94], $VP = [1, 95], $VQ = [1, 96], $VR = [1, 97], $VS = [1, 98], $VT = [1, 99], $VU = [1, 100], $VV = [1, 101], $VW = [1, 102], $VX = [1, 103], $VY = [1, 104], $VZ = [1, 105], $V_ = [2, 78], $V$ = [4, 5, 17, 51, 53, 54], $V01 = [4, 5, 10, 14, 15, 17, 19, 22, 24, 30, 31, 32, 34, 36, 37, 38, 39, 40, 42, 44, 45, 47, 51, 53, 54, 56, 61, 62, 63, 64, 73], $V11 = [4, 5, 10, 14, 15, 17, 19, 22, 24, 30, 31, 32, 34, 36, 37, 38, 39, 40, 42, 44, 45, 47, 50, 51, 53, 54, 56, 61, 62, 63, 64, 73], $V21 = [4, 5, 10, 14, 15, 17, 19, 22, 24, 30, 31, 32, 34, 36, 37, 38, 39, 40, 42, 44, 45, 47, 49, 51, 53, 54, 56, 61, 62, 63, 64, 73], $V31 = [4, 5, 10, 14, 15, 17, 19, 22, 24, 30, 31, 32, 34, 36, 37, 38, 39, 40, 42, 44, 45, 47, 48, 51, 53, 54, 56, 61, 62, 63, 64, 73], $V41 = [5, 52], $V51 = [70, 71, 72, 73], $V61 = [1, 151];
9
- var parser2 = {
10
- trace: /* @__PURE__ */ __name(function trace() {
11
- }, "trace"),
12
- yy: {},
13
- symbols_: { "error": 2, "start": 3, "SPACE": 4, "NEWLINE": 5, "SD": 6, "document": 7, "line": 8, "statement": 9, "INVALID": 10, "box_section": 11, "box_line": 12, "participant_statement": 13, "create": 14, "box": 15, "restOfLine": 16, "end": 17, "signal": 18, "autonumber": 19, "NUM": 20, "off": 21, "activate": 22, "actor": 23, "deactivate": 24, "note_statement": 25, "links_statement": 26, "link_statement": 27, "properties_statement": 28, "details_statement": 29, "title": 30, "legacy_title": 31, "acc_title": 32, "acc_title_value": 33, "acc_descr": 34, "acc_descr_value": 35, "acc_descr_multiline_value": 36, "loop": 37, "rect": 38, "opt": 39, "alt": 40, "else_sections": 41, "par": 42, "par_sections": 43, "par_over": 44, "critical": 45, "option_sections": 46, "break": 47, "option": 48, "and": 49, "else": 50, "participant": 51, "AS": 52, "participant_actor": 53, "destroy": 54, "actor_with_config": 55, "note": 56, "placement": 57, "text2": 58, "over": 59, "actor_pair": 60, "links": 61, "link": 62, "properties": 63, "details": 64, "spaceList": 65, ",": 66, "left_of": 67, "right_of": 68, "signaltype": 69, "+": 70, "-": 71, "()": 72, "ACTOR": 73, "config_object": 74, "CONFIG_START": 75, "CONFIG_CONTENT": 76, "CONFIG_END": 77, "SOLID_OPEN_ARROW": 78, "DOTTED_OPEN_ARROW": 79, "SOLID_ARROW": 80, "SOLID_ARROW_TOP": 81, "SOLID_ARROW_BOTTOM": 82, "STICK_ARROW_TOP": 83, "STICK_ARROW_BOTTOM": 84, "SOLID_ARROW_TOP_DOTTED": 85, "SOLID_ARROW_BOTTOM_DOTTED": 86, "STICK_ARROW_TOP_DOTTED": 87, "STICK_ARROW_BOTTOM_DOTTED": 88, "SOLID_ARROW_TOP_REVERSE": 89, "SOLID_ARROW_BOTTOM_REVERSE": 90, "STICK_ARROW_TOP_REVERSE": 91, "STICK_ARROW_BOTTOM_REVERSE": 92, "SOLID_ARROW_TOP_REVERSE_DOTTED": 93, "SOLID_ARROW_BOTTOM_REVERSE_DOTTED": 94, "STICK_ARROW_TOP_REVERSE_DOTTED": 95, "STICK_ARROW_BOTTOM_REVERSE_DOTTED": 96, "BIDIRECTIONAL_SOLID_ARROW": 97, "DOTTED_ARROW": 98, "BIDIRECTIONAL_DOTTED_ARROW": 99, "SOLID_CROSS": 100, "DOTTED_CROSS": 101, "SOLID_POINT": 102, "DOTTED_POINT": 103, "TXT": 104, "$accept": 0, "$end": 1 },
14
- terminals_: { 2: "error", 4: "SPACE", 5: "NEWLINE", 6: "SD", 10: "INVALID", 14: "create", 15: "box", 16: "restOfLine", 17: "end", 19: "autonumber", 20: "NUM", 21: "off", 22: "activate", 24: "deactivate", 30: "title", 31: "legacy_title", 32: "acc_title", 33: "acc_title_value", 34: "acc_descr", 35: "acc_descr_value", 36: "acc_descr_multiline_value", 37: "loop", 38: "rect", 39: "opt", 40: "alt", 42: "par", 44: "par_over", 45: "critical", 47: "break", 48: "option", 49: "and", 50: "else", 51: "participant", 52: "AS", 53: "participant_actor", 54: "destroy", 56: "note", 59: "over", 61: "links", 62: "link", 63: "properties", 64: "details", 66: ",", 67: "left_of", 68: "right_of", 70: "+", 71: "-", 72: "()", 73: "ACTOR", 75: "CONFIG_START", 76: "CONFIG_CONTENT", 77: "CONFIG_END", 78: "SOLID_OPEN_ARROW", 79: "DOTTED_OPEN_ARROW", 80: "SOLID_ARROW", 81: "SOLID_ARROW_TOP", 82: "SOLID_ARROW_BOTTOM", 83: "STICK_ARROW_TOP", 84: "STICK_ARROW_BOTTOM", 85: "SOLID_ARROW_TOP_DOTTED", 86: "SOLID_ARROW_BOTTOM_DOTTED", 87: "STICK_ARROW_TOP_DOTTED", 88: "STICK_ARROW_BOTTOM_DOTTED", 89: "SOLID_ARROW_TOP_REVERSE", 90: "SOLID_ARROW_BOTTOM_REVERSE", 91: "STICK_ARROW_TOP_REVERSE", 92: "STICK_ARROW_BOTTOM_REVERSE", 93: "SOLID_ARROW_TOP_REVERSE_DOTTED", 94: "SOLID_ARROW_BOTTOM_REVERSE_DOTTED", 95: "STICK_ARROW_TOP_REVERSE_DOTTED", 96: "STICK_ARROW_BOTTOM_REVERSE_DOTTED", 97: "BIDIRECTIONAL_SOLID_ARROW", 98: "DOTTED_ARROW", 99: "BIDIRECTIONAL_DOTTED_ARROW", 100: "SOLID_CROSS", 101: "DOTTED_CROSS", 102: "SOLID_POINT", 103: "DOTTED_POINT", 104: "TXT" },
15
- productions_: [0, [3, 2], [3, 2], [3, 2], [7, 0], [7, 2], [8, 2], [8, 1], [8, 1], [8, 1], [11, 0], [11, 2], [12, 2], [12, 1], [12, 1], [9, 1], [9, 2], [9, 4], [9, 2], [9, 4], [9, 3], [9, 3], [9, 2], [9, 3], [9, 3], [9, 2], [9, 2], [9, 2], [9, 2], [9, 2], [9, 1], [9, 1], [9, 2], [9, 2], [9, 1], [9, 4], [9, 4], [9, 4], [9, 4], [9, 4], [9, 4], [9, 4], [9, 4], [46, 1], [46, 4], [43, 1], [43, 4], [41, 1], [41, 4], [13, 5], [13, 3], [13, 5], [13, 3], [13, 3], [13, 5], [13, 3], [13, 5], [13, 3], [25, 4], [25, 4], [26, 3], [27, 3], [28, 3], [29, 3], [65, 2], [65, 1], [60, 3], [60, 1], [57, 1], [57, 1], [18, 5], [18, 5], [18, 5], [18, 5], [18, 6], [18, 4], [55, 2], [74, 3], [23, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [58, 1]],
16
- performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
17
- var $0 = $$.length - 1;
18
- switch (yystate) {
19
- case 3:
20
- yy.apply($$[$0]);
21
- return $$[$0];
22
- case 4:
23
- case 10:
24
- this.$ = [];
25
- break;
26
- case 5:
27
- case 11:
28
- $$[$0 - 1].push($$[$0]);
29
- this.$ = $$[$0 - 1];
30
- break;
31
- case 6:
32
- case 7:
33
- case 12:
34
- case 13:
35
- this.$ = $$[$0];
36
- break;
37
- case 8:
38
- case 9:
39
- case 14:
40
- this.$ = [];
41
- break;
42
- case 16:
43
- $$[$0].type = "createParticipant";
44
- this.$ = $$[$0];
45
- break;
46
- case 17:
47
- $$[$0 - 1].unshift({ type: "boxStart", boxData: yy.parseBoxData($$[$0 - 2]) });
48
- $$[$0 - 1].push({ type: "boxEnd", boxText: $$[$0 - 2] });
49
- this.$ = $$[$0 - 1];
50
- break;
51
- case 19:
52
- this.$ = { type: "sequenceIndex", sequenceIndex: Number($$[$0 - 2]), sequenceIndexStep: Number($$[$0 - 1]), sequenceVisible: true, signalType: yy.LINETYPE.AUTONUMBER };
53
- break;
54
- case 20:
55
- this.$ = { type: "sequenceIndex", sequenceIndex: Number($$[$0 - 1]), sequenceIndexStep: 1, sequenceVisible: true, signalType: yy.LINETYPE.AUTONUMBER };
56
- break;
57
- case 21:
58
- this.$ = { type: "sequenceIndex", sequenceVisible: false, signalType: yy.LINETYPE.AUTONUMBER };
59
- break;
60
- case 22:
61
- this.$ = { type: "sequenceIndex", sequenceVisible: true, signalType: yy.LINETYPE.AUTONUMBER };
62
- break;
63
- case 23:
64
- this.$ = { type: "activeStart", signalType: yy.LINETYPE.ACTIVE_START, actor: $$[$0 - 1].actor };
65
- break;
66
- case 24:
67
- this.$ = { type: "activeEnd", signalType: yy.LINETYPE.ACTIVE_END, actor: $$[$0 - 1].actor };
68
- break;
69
- case 30:
70
- yy.setDiagramTitle($$[$0].substring(6));
71
- this.$ = $$[$0].substring(6);
72
- break;
73
- case 31:
74
- yy.setDiagramTitle($$[$0].substring(7));
75
- this.$ = $$[$0].substring(7);
76
- break;
77
- case 32:
78
- this.$ = $$[$0].trim();
79
- yy.setAccTitle(this.$);
80
- break;
81
- case 33:
82
- case 34:
83
- this.$ = $$[$0].trim();
84
- yy.setAccDescription(this.$);
85
- break;
86
- case 35:
87
- $$[$0 - 1].unshift({ type: "loopStart", loopText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.LOOP_START });
88
- $$[$0 - 1].push({ type: "loopEnd", loopText: $$[$0 - 2], signalType: yy.LINETYPE.LOOP_END });
89
- this.$ = $$[$0 - 1];
90
- break;
91
- case 36:
92
- $$[$0 - 1].unshift({ type: "rectStart", color: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.RECT_START });
93
- $$[$0 - 1].push({ type: "rectEnd", color: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.RECT_END });
94
- this.$ = $$[$0 - 1];
95
- break;
96
- case 37:
97
- $$[$0 - 1].unshift({ type: "optStart", optText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.OPT_START });
98
- $$[$0 - 1].push({ type: "optEnd", optText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.OPT_END });
99
- this.$ = $$[$0 - 1];
100
- break;
101
- case 38:
102
- $$[$0 - 1].unshift({ type: "altStart", altText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.ALT_START });
103
- $$[$0 - 1].push({ type: "altEnd", signalType: yy.LINETYPE.ALT_END });
104
- this.$ = $$[$0 - 1];
105
- break;
106
- case 39:
107
- $$[$0 - 1].unshift({ type: "parStart", parText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.PAR_START });
108
- $$[$0 - 1].push({ type: "parEnd", signalType: yy.LINETYPE.PAR_END });
109
- this.$ = $$[$0 - 1];
110
- break;
111
- case 40:
112
- $$[$0 - 1].unshift({ type: "parStart", parText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.PAR_OVER_START });
113
- $$[$0 - 1].push({ type: "parEnd", signalType: yy.LINETYPE.PAR_END });
114
- this.$ = $$[$0 - 1];
115
- break;
116
- case 41:
117
- $$[$0 - 1].unshift({ type: "criticalStart", criticalText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.CRITICAL_START });
118
- $$[$0 - 1].push({ type: "criticalEnd", signalType: yy.LINETYPE.CRITICAL_END });
119
- this.$ = $$[$0 - 1];
120
- break;
121
- case 42:
122
- $$[$0 - 1].unshift({ type: "breakStart", breakText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.BREAK_START });
123
- $$[$0 - 1].push({ type: "breakEnd", optText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.BREAK_END });
124
- this.$ = $$[$0 - 1];
125
- break;
126
- case 44:
127
- this.$ = $$[$0 - 3].concat([{ type: "option", optionText: yy.parseMessage($$[$0 - 1]), signalType: yy.LINETYPE.CRITICAL_OPTION }, $$[$0]]);
128
- break;
129
- case 46:
130
- this.$ = $$[$0 - 3].concat([{ type: "and", parText: yy.parseMessage($$[$0 - 1]), signalType: yy.LINETYPE.PAR_AND }, $$[$0]]);
131
- break;
132
- case 48:
133
- this.$ = $$[$0 - 3].concat([{ type: "else", altText: yy.parseMessage($$[$0 - 1]), signalType: yy.LINETYPE.ALT_ELSE }, $$[$0]]);
134
- break;
135
- case 49:
136
- $$[$0 - 3].draw = "participant";
137
- $$[$0 - 3].type = "addParticipant";
138
- $$[$0 - 3].description = yy.parseMessage($$[$0 - 1]);
139
- this.$ = $$[$0 - 3];
140
- break;
141
- case 50:
142
- $$[$0 - 1].draw = "participant";
143
- $$[$0 - 1].type = "addParticipant";
144
- this.$ = $$[$0 - 1];
145
- break;
146
- case 51:
147
- $$[$0 - 3].draw = "actor";
148
- $$[$0 - 3].type = "addParticipant";
149
- $$[$0 - 3].description = yy.parseMessage($$[$0 - 1]);
150
- this.$ = $$[$0 - 3];
151
- break;
152
- case 52:
153
- case 57:
154
- $$[$0 - 1].draw = "actor";
155
- $$[$0 - 1].type = "addParticipant";
156
- this.$ = $$[$0 - 1];
157
- break;
158
- case 53:
159
- $$[$0 - 1].type = "destroyParticipant";
160
- this.$ = $$[$0 - 1];
161
- break;
162
- case 54:
163
- $$[$0 - 3].draw = "participant";
164
- $$[$0 - 3].type = "addParticipant";
165
- $$[$0 - 3].description = yy.parseMessage($$[$0 - 1]);
166
- this.$ = $$[$0 - 3];
167
- break;
168
- case 55:
169
- $$[$0 - 1].draw = "participant";
170
- $$[$0 - 1].type = "addParticipant";
171
- this.$ = $$[$0 - 1];
172
- break;
173
- case 56:
174
- $$[$0 - 3].draw = "actor";
175
- $$[$0 - 3].type = "addParticipant";
176
- $$[$0 - 3].description = yy.parseMessage($$[$0 - 1]);
177
- this.$ = $$[$0 - 3];
178
- break;
179
- case 58:
180
- this.$ = [$$[$0 - 1], { type: "addNote", placement: $$[$0 - 2], actor: $$[$0 - 1].actor, text: $$[$0] }];
181
- break;
182
- case 59:
183
- $$[$0 - 2] = [].concat($$[$0 - 1], $$[$0 - 1]).slice(0, 2);
184
- $$[$0 - 2][0] = $$[$0 - 2][0].actor;
185
- $$[$0 - 2][1] = $$[$0 - 2][1].actor;
186
- this.$ = [$$[$0 - 1], { type: "addNote", placement: yy.PLACEMENT.OVER, actor: $$[$0 - 2].slice(0, 2), text: $$[$0] }];
187
- break;
188
- case 60:
189
- this.$ = [$$[$0 - 1], { type: "addLinks", actor: $$[$0 - 1].actor, text: $$[$0] }];
190
- break;
191
- case 61:
192
- this.$ = [$$[$0 - 1], { type: "addALink", actor: $$[$0 - 1].actor, text: $$[$0] }];
193
- break;
194
- case 62:
195
- this.$ = [$$[$0 - 1], { type: "addProperties", actor: $$[$0 - 1].actor, text: $$[$0] }];
196
- break;
197
- case 63:
198
- this.$ = [$$[$0 - 1], { type: "addDetails", actor: $$[$0 - 1].actor, text: $$[$0] }];
199
- break;
200
- case 66:
201
- this.$ = [$$[$0 - 2], $$[$0]];
202
- break;
203
- case 67:
204
- this.$ = $$[$0];
205
- break;
206
- case 68:
207
- this.$ = yy.PLACEMENT.LEFTOF;
208
- break;
209
- case 69:
210
- this.$ = yy.PLACEMENT.RIGHTOF;
211
- break;
212
- case 70:
213
- this.$ = [
214
- $$[$0 - 4],
215
- $$[$0 - 1],
216
- { type: "addMessage", from: $$[$0 - 4].actor, to: $$[$0 - 1].actor, signalType: $$[$0 - 3], msg: $$[$0], activate: true },
217
- { type: "activeStart", signalType: yy.LINETYPE.ACTIVE_START, actor: $$[$0 - 1].actor }
218
- ];
219
- break;
220
- case 71:
221
- this.$ = [
222
- $$[$0 - 4],
223
- $$[$0 - 1],
224
- { type: "addMessage", from: $$[$0 - 4].actor, to: $$[$0 - 1].actor, signalType: $$[$0 - 3], msg: $$[$0] },
225
- { type: "activeEnd", signalType: yy.LINETYPE.ACTIVE_END, actor: $$[$0 - 4].actor }
226
- ];
227
- break;
228
- case 72:
229
- this.$ = [
230
- $$[$0 - 4],
231
- $$[$0 - 1],
232
- { type: "addMessage", from: $$[$0 - 4].actor, to: $$[$0 - 1].actor, signalType: $$[$0 - 3], msg: $$[$0], activate: true, centralConnection: yy.LINETYPE.CENTRAL_CONNECTION },
233
- { type: "centralConnection", signalType: yy.LINETYPE.CENTRAL_CONNECTION, actor: $$[$0 - 1].actor }
234
- ];
235
- break;
236
- case 73:
237
- this.$ = [
238
- $$[$0 - 4],
239
- $$[$0 - 1],
240
- { type: "addMessage", from: $$[$0 - 4].actor, to: $$[$0 - 1].actor, signalType: $$[$0 - 2], msg: $$[$0], activate: false, centralConnection: yy.LINETYPE.CENTRAL_CONNECTION_REVERSE },
241
- { type: "centralConnectionReverse", signalType: yy.LINETYPE.CENTRAL_CONNECTION_REVERSE, actor: $$[$0 - 4].actor }
242
- ];
243
- break;
244
- case 74:
245
- this.$ = [
246
- $$[$0 - 5],
247
- $$[$0 - 1],
248
- { type: "addMessage", from: $$[$0 - 5].actor, to: $$[$0 - 1].actor, signalType: $$[$0 - 3], msg: $$[$0], activate: true, centralConnection: yy.LINETYPE.CENTRAL_CONNECTION_DUAL },
249
- { type: "centralConnection", signalType: yy.LINETYPE.CENTRAL_CONNECTION, actor: $$[$0 - 1].actor },
250
- { type: "centralConnectionReverse", signalType: yy.LINETYPE.CENTRAL_CONNECTION_REVERSE, actor: $$[$0 - 5].actor }
251
- ];
252
- break;
253
- case 75:
254
- this.$ = [$$[$0 - 3], $$[$0 - 1], { type: "addMessage", from: $$[$0 - 3].actor, to: $$[$0 - 1].actor, signalType: $$[$0 - 2], msg: $$[$0] }];
255
- break;
256
- case 76:
257
- this.$ = {
258
- type: "addParticipant",
259
- actor: $$[$0 - 1],
260
- config: $$[$0]
261
- };
262
- break;
263
- case 77:
264
- this.$ = $$[$0 - 1].trim();
265
- break;
266
- case 78:
267
- this.$ = { type: "addParticipant", actor: $$[$0] };
268
- break;
269
- case 79:
270
- this.$ = yy.LINETYPE.SOLID_OPEN;
271
- break;
272
- case 80:
273
- this.$ = yy.LINETYPE.DOTTED_OPEN;
274
- break;
275
- case 81:
276
- this.$ = yy.LINETYPE.SOLID;
277
- break;
278
- case 82:
279
- this.$ = yy.LINETYPE.SOLID_TOP;
280
- break;
281
- case 83:
282
- this.$ = yy.LINETYPE.SOLID_BOTTOM;
283
- break;
284
- case 84:
285
- this.$ = yy.LINETYPE.STICK_TOP;
286
- break;
287
- case 85:
288
- this.$ = yy.LINETYPE.STICK_BOTTOM;
289
- break;
290
- case 86:
291
- this.$ = yy.LINETYPE.SOLID_TOP_DOTTED;
292
- break;
293
- case 87:
294
- this.$ = yy.LINETYPE.SOLID_BOTTOM_DOTTED;
295
- break;
296
- case 88:
297
- this.$ = yy.LINETYPE.STICK_TOP_DOTTED;
298
- break;
299
- case 89:
300
- this.$ = yy.LINETYPE.STICK_BOTTOM_DOTTED;
301
- break;
302
- case 90:
303
- this.$ = yy.LINETYPE.SOLID_ARROW_TOP_REVERSE;
304
- break;
305
- case 91:
306
- this.$ = yy.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE;
307
- break;
308
- case 92:
309
- this.$ = yy.LINETYPE.STICK_ARROW_TOP_REVERSE;
310
- break;
311
- case 93:
312
- this.$ = yy.LINETYPE.STICK_ARROW_BOTTOM_REVERSE;
313
- break;
314
- case 94:
315
- this.$ = yy.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED;
316
- break;
317
- case 95:
318
- this.$ = yy.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED;
319
- break;
320
- case 96:
321
- this.$ = yy.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED;
322
- break;
323
- case 97:
324
- this.$ = yy.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED;
325
- break;
326
- case 98:
327
- this.$ = yy.LINETYPE.BIDIRECTIONAL_SOLID;
328
- break;
329
- case 99:
330
- this.$ = yy.LINETYPE.DOTTED;
331
- break;
332
- case 100:
333
- this.$ = yy.LINETYPE.BIDIRECTIONAL_DOTTED;
334
- break;
335
- case 101:
336
- this.$ = yy.LINETYPE.SOLID_CROSS;
337
- break;
338
- case 102:
339
- this.$ = yy.LINETYPE.DOTTED_CROSS;
340
- break;
341
- case 103:
342
- this.$ = yy.LINETYPE.SOLID_POINT;
343
- break;
344
- case 104:
345
- this.$ = yy.LINETYPE.DOTTED_POINT;
346
- break;
347
- case 105:
348
- this.$ = yy.parseMessage($$[$0].trim().substring(1));
349
- break;
350
- }
351
- }, "anonymous"),
352
- table: [{ 3: 1, 4: $V0, 5: $V1, 6: $V2 }, { 1: [3] }, { 3: 5, 4: $V0, 5: $V1, 6: $V2 }, { 3: 6, 4: $V0, 5: $V1, 6: $V2 }, o([1, 4, 5, 10, 14, 15, 19, 22, 24, 30, 31, 32, 34, 36, 37, 38, 39, 40, 42, 44, 45, 47, 51, 53, 54, 56, 61, 62, 63, 64, 73], $V3, { 7: 7 }), { 1: [2, 1] }, { 1: [2, 2] }, { 1: [2, 3], 4: $V4, 5: $V5, 8: 8, 9: 10, 10: $V6, 13: 13, 14: $V7, 15: $V8, 18: 16, 19: $V9, 22: $Va, 23: 41, 24: $Vb, 25: 20, 26: 21, 27: 22, 28: 23, 29: 24, 30: $Vc, 31: $Vd, 32: $Ve, 34: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 40: $Vk, 42: $Vl, 44: $Vm, 45: $Vn, 47: $Vo, 51: $Vp, 53: $Vq, 54: $Vr, 56: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 73: $Vx }, o($Vy, [2, 5]), { 9: 48, 13: 13, 14: $V7, 15: $V8, 18: 16, 19: $V9, 22: $Va, 23: 41, 24: $Vb, 25: 20, 26: 21, 27: 22, 28: 23, 29: 24, 30: $Vc, 31: $Vd, 32: $Ve, 34: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 40: $Vk, 42: $Vl, 44: $Vm, 45: $Vn, 47: $Vo, 51: $Vp, 53: $Vq, 54: $Vr, 56: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 73: $Vx }, o($Vy, [2, 7]), o($Vy, [2, 8]), o($Vy, [2, 9]), o($Vy, [2, 15]), { 13: 49, 51: $Vp, 53: $Vq, 54: $Vr }, { 16: [1, 50] }, { 5: [1, 51] }, { 5: [1, 54], 20: [1, 52], 21: [1, 53] }, { 23: 55, 73: $Vx }, { 23: 56, 73: $Vx }, { 5: [1, 57] }, { 5: [1, 58] }, { 5: [1, 59] }, { 5: [1, 60] }, { 5: [1, 61] }, o($Vy, [2, 30]), o($Vy, [2, 31]), { 33: [1, 62] }, { 35: [1, 63] }, o($Vy, [2, 34]), { 16: [1, 64] }, { 16: [1, 65] }, { 16: [1, 66] }, { 16: [1, 67] }, { 16: [1, 68] }, { 16: [1, 69] }, { 16: [1, 70] }, { 16: [1, 71] }, { 23: 72, 55: 73, 73: $Vz }, { 23: 75, 55: 76, 73: $Vz }, { 23: 77, 73: $Vx }, { 69: 78, 72: [1, 79], 78: $VA, 79: $VB, 80: $VC, 81: $VD, 82: $VE, 83: $VF, 84: $VG, 85: $VH, 86: $VI, 87: $VJ, 88: $VK, 89: $VL, 90: $VM, 91: $VN, 92: $VO, 93: $VP, 94: $VQ, 95: $VR, 96: $VS, 97: $VT, 98: $VU, 99: $VV, 100: $VW, 101: $VX, 102: $VY, 103: $VZ }, { 57: 106, 59: [1, 107], 67: [1, 108], 68: [1, 109] }, { 23: 110, 73: $Vx }, { 23: 111, 73: $Vx }, { 23: 112, 73: $Vx }, { 23: 113, 73: $Vx }, o([5, 66, 72, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104], $V_), o($Vy, [2, 6]), o($Vy, [2, 16]), o($V$, [2, 10], { 11: 114 }), o($Vy, [2, 18]), { 5: [1, 116], 20: [1, 115] }, { 5: [1, 117] }, o($Vy, [2, 22]), { 5: [1, 118] }, { 5: [1, 119] }, o($Vy, [2, 25]), o($Vy, [2, 26]), o($Vy, [2, 27]), o($Vy, [2, 28]), o($Vy, [2, 29]), o($Vy, [2, 32]), o($Vy, [2, 33]), o($V01, $V3, { 7: 120 }), o($V01, $V3, { 7: 121 }), o($V01, $V3, { 7: 122 }), o($V11, $V3, { 41: 123, 7: 124 }), o($V21, $V3, { 43: 125, 7: 126 }), o($V21, $V3, { 7: 126, 43: 127 }), o($V31, $V3, { 46: 128, 7: 129 }), o($V01, $V3, { 7: 130 }), { 5: [1, 132], 52: [1, 131] }, { 5: [1, 134], 52: [1, 133] }, o($V41, $V_, { 74: 135, 75: [1, 136] }), { 5: [1, 138], 52: [1, 137] }, { 5: [1, 140], 52: [1, 139] }, { 5: [1, 141] }, { 23: 145, 70: [1, 142], 71: [1, 143], 72: [1, 144], 73: $Vx }, { 69: 146, 78: $VA, 79: $VB, 80: $VC, 81: $VD, 82: $VE, 83: $VF, 84: $VG, 85: $VH, 86: $VI, 87: $VJ, 88: $VK, 89: $VL, 90: $VM, 91: $VN, 92: $VO, 93: $VP, 94: $VQ, 95: $VR, 96: $VS, 97: $VT, 98: $VU, 99: $VV, 100: $VW, 101: $VX, 102: $VY, 103: $VZ }, o($V51, [2, 79]), o($V51, [2, 80]), o($V51, [2, 81]), o($V51, [2, 82]), o($V51, [2, 83]), o($V51, [2, 84]), o($V51, [2, 85]), o($V51, [2, 86]), o($V51, [2, 87]), o($V51, [2, 88]), o($V51, [2, 89]), o($V51, [2, 90]), o($V51, [2, 91]), o($V51, [2, 92]), o($V51, [2, 93]), o($V51, [2, 94]), o($V51, [2, 95]), o($V51, [2, 96]), o($V51, [2, 97]), o($V51, [2, 98]), o($V51, [2, 99]), o($V51, [2, 100]), o($V51, [2, 101]), o($V51, [2, 102]), o($V51, [2, 103]), o($V51, [2, 104]), { 23: 147, 73: $Vx }, { 23: 149, 60: 148, 73: $Vx }, { 73: [2, 68] }, { 73: [2, 69] }, { 58: 150, 104: $V61 }, { 58: 152, 104: $V61 }, { 58: 153, 104: $V61 }, { 58: 154, 104: $V61 }, { 4: [1, 157], 5: [1, 159], 12: 156, 13: 158, 17: [1, 155], 51: $Vp, 53: $Vq, 54: $Vr }, { 5: [1, 160] }, o($Vy, [2, 20]), o($Vy, [2, 21]), o($Vy, [2, 23]), o($Vy, [2, 24]), { 4: $V4, 5: $V5, 8: 8, 9: 10, 10: $V6, 13: 13, 14: $V7, 15: $V8, 17: [1, 161], 18: 16, 19: $V9, 22: $Va, 23: 41, 24: $Vb, 25: 20, 26: 21, 27: 22, 28: 23, 29: 24, 30: $Vc, 31: $Vd, 32: $Ve, 34: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 40: $Vk, 42: $Vl, 44: $Vm, 45: $Vn, 47: $Vo, 51: $Vp, 53: $Vq, 54: $Vr, 56: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 73: $Vx }, { 4: $V4, 5: $V5, 8: 8, 9: 10, 10: $V6, 13: 13, 14: $V7, 15: $V8, 17: [1, 162], 18: 16, 19: $V9, 22: $Va, 23: 41, 24: $Vb, 25: 20, 26: 21, 27: 22, 28: 23, 29: 24, 30: $Vc, 31: $Vd, 32: $Ve, 34: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 40: $Vk, 42: $Vl, 44: $Vm, 45: $Vn, 47: $Vo, 51: $Vp, 53: $Vq, 54: $Vr, 56: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 73: $Vx }, { 4: $V4, 5: $V5, 8: 8, 9: 10, 10: $V6, 13: 13, 14: $V7, 15: $V8, 17: [1, 163], 18: 16, 19: $V9, 22: $Va, 23: 41, 24: $Vb, 25: 20, 26: 21, 27: 22, 28: 23, 29: 24, 30: $Vc, 31: $Vd, 32: $Ve, 34: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 40: $Vk, 42: $Vl, 44: $Vm, 45: $Vn, 47: $Vo, 51: $Vp, 53: $Vq, 54: $Vr, 56: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 73: $Vx }, { 17: [1, 164] }, { 4: $V4, 5: $V5, 8: 8, 9: 10, 10: $V6, 13: 13, 14: $V7, 15: $V8, 17: [2, 47], 18: 16, 19: $V9, 22: $Va, 23: 41, 24: $Vb, 25: 20, 26: 21, 27: 22, 28: 23, 29: 24, 30: $Vc, 31: $Vd, 32: $Ve, 34: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 40: $Vk, 42: $Vl, 44: $Vm, 45: $Vn, 47: $Vo, 50: [1, 165], 51: $Vp, 53: $Vq, 54: $Vr, 56: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 73: $Vx }, { 17: [1, 166] }, { 4: $V4, 5: $V5, 8: 8, 9: 10, 10: $V6, 13: 13, 14: $V7, 15: $V8, 17: [2, 45], 18: 16, 19: $V9, 22: $Va, 23: 41, 24: $Vb, 25: 20, 26: 21, 27: 22, 28: 23, 29: 24, 30: $Vc, 31: $Vd, 32: $Ve, 34: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 40: $Vk, 42: $Vl, 44: $Vm, 45: $Vn, 47: $Vo, 49: [1, 167], 51: $Vp, 53: $Vq, 54: $Vr, 56: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 73: $Vx }, { 17: [1, 168] }, { 17: [1, 169] }, { 4: $V4, 5: $V5, 8: 8, 9: 10, 10: $V6, 13: 13, 14: $V7, 15: $V8, 17: [2, 43], 18: 16, 19: $V9, 22: $Va, 23: 41, 24: $Vb, 25: 20, 26: 21, 27: 22, 28: 23, 29: 24, 30: $Vc, 31: $Vd, 32: $Ve, 34: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 40: $Vk, 42: $Vl, 44: $Vm, 45: $Vn, 47: $Vo, 48: [1, 170], 51: $Vp, 53: $Vq, 54: $Vr, 56: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 73: $Vx }, { 4: $V4, 5: $V5, 8: 8, 9: 10, 10: $V6, 13: 13, 14: $V7, 15: $V8, 17: [1, 171], 18: 16, 19: $V9, 22: $Va, 23: 41, 24: $Vb, 25: 20, 26: 21, 27: 22, 28: 23, 29: 24, 30: $Vc, 31: $Vd, 32: $Ve, 34: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 40: $Vk, 42: $Vl, 44: $Vm, 45: $Vn, 47: $Vo, 51: $Vp, 53: $Vq, 54: $Vr, 56: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 73: $Vx }, { 16: [1, 172] }, o($Vy, [2, 50]), { 16: [1, 173] }, o($Vy, [2, 55]), o($V41, [2, 76]), { 76: [1, 174] }, { 16: [1, 175] }, o($Vy, [2, 52]), { 16: [1, 176] }, o($Vy, [2, 57]), o($Vy, [2, 53]), { 23: 177, 73: $Vx }, { 23: 178, 73: $Vx }, { 23: 179, 73: $Vx }, { 58: 180, 104: $V61 }, { 23: 181, 72: [1, 182], 73: $Vx }, { 58: 183, 104: $V61 }, { 58: 184, 104: $V61 }, { 66: [1, 185], 104: [2, 67] }, { 5: [2, 60] }, { 5: [2, 105] }, { 5: [2, 61] }, { 5: [2, 62] }, { 5: [2, 63] }, o($Vy, [2, 17]), o($V$, [2, 11]), { 13: 186, 51: $Vp, 53: $Vq, 54: $Vr }, o($V$, [2, 13]), o($V$, [2, 14]), o($Vy, [2, 19]), o($Vy, [2, 35]), o($Vy, [2, 36]), o($Vy, [2, 37]), o($Vy, [2, 38]), { 16: [1, 187] }, o($Vy, [2, 39]), { 16: [1, 188] }, o($Vy, [2, 40]), o($Vy, [2, 41]), { 16: [1, 189] }, o($Vy, [2, 42]), { 5: [1, 190] }, { 5: [1, 191] }, { 77: [1, 192] }, { 5: [1, 193] }, { 5: [1, 194] }, { 58: 195, 104: $V61 }, { 58: 196, 104: $V61 }, { 58: 197, 104: $V61 }, { 5: [2, 75] }, { 58: 198, 104: $V61 }, { 23: 199, 73: $Vx }, { 5: [2, 58] }, { 5: [2, 59] }, { 23: 200, 73: $Vx }, o($V$, [2, 12]), o($V11, $V3, { 7: 124, 41: 201 }), o($V21, $V3, { 7: 126, 43: 202 }), o($V31, $V3, { 7: 129, 46: 203 }), o($Vy, [2, 49]), o($Vy, [2, 54]), o($V41, [2, 77]), o($Vy, [2, 51]), o($Vy, [2, 56]), { 5: [2, 70] }, { 5: [2, 71] }, { 5: [2, 72] }, { 5: [2, 73] }, { 58: 204, 104: $V61 }, { 104: [2, 66] }, { 17: [2, 48] }, { 17: [2, 46] }, { 17: [2, 44] }, { 5: [2, 74] }],
353
- defaultActions: { 5: [2, 1], 6: [2, 2], 108: [2, 68], 109: [2, 69], 150: [2, 60], 151: [2, 105], 152: [2, 61], 153: [2, 62], 154: [2, 63], 180: [2, 75], 183: [2, 58], 184: [2, 59], 195: [2, 70], 196: [2, 71], 197: [2, 72], 198: [2, 73], 200: [2, 66], 201: [2, 48], 202: [2, 46], 203: [2, 44], 204: [2, 74] },
354
- parseError: /* @__PURE__ */ __name(function parseError(str, hash) {
355
- if (hash.recoverable) {
356
- this.trace(str);
357
- } else {
358
- var error = new Error(str);
359
- error.hash = hash;
360
- throw error;
361
- }
362
- }, "parseError"),
363
- parse: /* @__PURE__ */ __name(function parse(input) {
364
- var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, TERROR = 2, EOF = 1;
365
- var args = lstack.slice.call(arguments, 1);
366
- var lexer2 = Object.create(this.lexer);
367
- var sharedState = { yy: {} };
368
- for (var k in this.yy) {
369
- if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
370
- sharedState.yy[k] = this.yy[k];
371
- }
372
- }
373
- lexer2.setInput(input, sharedState.yy);
374
- sharedState.yy.lexer = lexer2;
375
- sharedState.yy.parser = this;
376
- if (typeof lexer2.yylloc == "undefined") {
377
- lexer2.yylloc = {};
378
- }
379
- var yyloc = lexer2.yylloc;
380
- lstack.push(yyloc);
381
- var ranges = lexer2.options && lexer2.options.ranges;
382
- if (typeof sharedState.yy.parseError === "function") {
383
- this.parseError = sharedState.yy.parseError;
384
- } else {
385
- this.parseError = Object.getPrototypeOf(this).parseError;
386
- }
387
- function popStack(n) {
388
- stack.length = stack.length - 2 * n;
389
- vstack.length = vstack.length - n;
390
- lstack.length = lstack.length - n;
391
- }
392
- __name(popStack, "popStack");
393
- function lex() {
394
- var token;
395
- token = tstack.pop() || lexer2.lex() || EOF;
396
- if (typeof token !== "number") {
397
- if (token instanceof Array) {
398
- tstack = token;
399
- token = tstack.pop();
400
- }
401
- token = self.symbols_[token] || token;
402
- }
403
- return token;
404
- }
405
- __name(lex, "lex");
406
- var symbol, state, action, r, yyval = {}, p, len, newState, expected;
407
- while (true) {
408
- state = stack[stack.length - 1];
409
- if (this.defaultActions[state]) {
410
- action = this.defaultActions[state];
411
- } else {
412
- if (symbol === null || typeof symbol == "undefined") {
413
- symbol = lex();
414
- }
415
- action = table[state] && table[state][symbol];
416
- }
417
- if (typeof action === "undefined" || !action.length || !action[0]) {
418
- var errStr = "";
419
- expected = [];
420
- for (p in table[state]) {
421
- if (this.terminals_[p] && p > TERROR) {
422
- expected.push("'" + this.terminals_[p] + "'");
423
- }
424
- }
425
- if (lexer2.showPosition) {
426
- errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
427
- } else {
428
- errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
429
- }
430
- this.parseError(errStr, {
431
- text: lexer2.match,
432
- token: this.terminals_[symbol] || symbol,
433
- line: lexer2.yylineno,
434
- loc: yyloc,
435
- expected
436
- });
437
- }
438
- if (action[0] instanceof Array && action.length > 1) {
439
- throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
440
- }
441
- switch (action[0]) {
442
- case 1:
443
- stack.push(symbol);
444
- vstack.push(lexer2.yytext);
445
- lstack.push(lexer2.yylloc);
446
- stack.push(action[1]);
447
- symbol = null;
448
- {
449
- yyleng = lexer2.yyleng;
450
- yytext = lexer2.yytext;
451
- yylineno = lexer2.yylineno;
452
- yyloc = lexer2.yylloc;
453
- }
454
- break;
455
- case 2:
456
- len = this.productions_[action[1]][1];
457
- yyval.$ = vstack[vstack.length - len];
458
- yyval._$ = {
459
- first_line: lstack[lstack.length - (len || 1)].first_line,
460
- last_line: lstack[lstack.length - 1].last_line,
461
- first_column: lstack[lstack.length - (len || 1)].first_column,
462
- last_column: lstack[lstack.length - 1].last_column
463
- };
464
- if (ranges) {
465
- yyval._$.range = [
466
- lstack[lstack.length - (len || 1)].range[0],
467
- lstack[lstack.length - 1].range[1]
468
- ];
469
- }
470
- r = this.performAction.apply(yyval, [
471
- yytext,
472
- yyleng,
473
- yylineno,
474
- sharedState.yy,
475
- action[1],
476
- vstack,
477
- lstack
478
- ].concat(args));
479
- if (typeof r !== "undefined") {
480
- return r;
481
- }
482
- if (len) {
483
- stack = stack.slice(0, -1 * len * 2);
484
- vstack = vstack.slice(0, -1 * len);
485
- lstack = lstack.slice(0, -1 * len);
486
- }
487
- stack.push(this.productions_[action[1]][0]);
488
- vstack.push(yyval.$);
489
- lstack.push(yyval._$);
490
- newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
491
- stack.push(newState);
492
- break;
493
- case 3:
494
- return true;
495
- }
496
- }
497
- return true;
498
- }, "parse")
499
- };
500
- var lexer = /* @__PURE__ */ (function() {
501
- var lexer2 = {
502
- EOF: 1,
503
- parseError: /* @__PURE__ */ __name(function parseError(str, hash) {
504
- if (this.yy.parser) {
505
- this.yy.parser.parseError(str, hash);
506
- } else {
507
- throw new Error(str);
508
- }
509
- }, "parseError"),
510
- // resets the lexer, sets new input
511
- setInput: /* @__PURE__ */ __name(function(input, yy) {
512
- this.yy = yy || this.yy || {};
513
- this._input = input;
514
- this._more = this._backtrack = this.done = false;
515
- this.yylineno = this.yyleng = 0;
516
- this.yytext = this.matched = this.match = "";
517
- this.conditionStack = ["INITIAL"];
518
- this.yylloc = {
519
- first_line: 1,
520
- first_column: 0,
521
- last_line: 1,
522
- last_column: 0
523
- };
524
- if (this.options.ranges) {
525
- this.yylloc.range = [0, 0];
526
- }
527
- this.offset = 0;
528
- return this;
529
- }, "setInput"),
530
- // consumes and returns one char from the input
531
- input: /* @__PURE__ */ __name(function() {
532
- var ch = this._input[0];
533
- this.yytext += ch;
534
- this.yyleng++;
535
- this.offset++;
536
- this.match += ch;
537
- this.matched += ch;
538
- var lines = ch.match(/(?:\r\n?|\n).*/g);
539
- if (lines) {
540
- this.yylineno++;
541
- this.yylloc.last_line++;
542
- } else {
543
- this.yylloc.last_column++;
544
- }
545
- if (this.options.ranges) {
546
- this.yylloc.range[1]++;
547
- }
548
- this._input = this._input.slice(1);
549
- return ch;
550
- }, "input"),
551
- // unshifts one char (or a string) into the input
552
- unput: /* @__PURE__ */ __name(function(ch) {
553
- var len = ch.length;
554
- var lines = ch.split(/(?:\r\n?|\n)/g);
555
- this._input = ch + this._input;
556
- this.yytext = this.yytext.substr(0, this.yytext.length - len);
557
- this.offset -= len;
558
- var oldLines = this.match.split(/(?:\r\n?|\n)/g);
559
- this.match = this.match.substr(0, this.match.length - 1);
560
- this.matched = this.matched.substr(0, this.matched.length - 1);
561
- if (lines.length - 1) {
562
- this.yylineno -= lines.length - 1;
563
- }
564
- var r = this.yylloc.range;
565
- this.yylloc = {
566
- first_line: this.yylloc.first_line,
567
- last_line: this.yylineno + 1,
568
- first_column: this.yylloc.first_column,
569
- last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len
570
- };
571
- if (this.options.ranges) {
572
- this.yylloc.range = [r[0], r[0] + this.yyleng - len];
573
- }
574
- this.yyleng = this.yytext.length;
575
- return this;
576
- }, "unput"),
577
- // When called from action, caches matched text and appends it on next action
578
- more: /* @__PURE__ */ __name(function() {
579
- this._more = true;
580
- return this;
581
- }, "more"),
582
- // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
583
- reject: /* @__PURE__ */ __name(function() {
584
- if (this.options.backtrack_lexer) {
585
- this._backtrack = true;
586
- } else {
587
- return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), {
588
- text: "",
589
- token: null,
590
- line: this.yylineno
591
- });
592
- }
593
- return this;
594
- }, "reject"),
595
- // retain first n characters of the match
596
- less: /* @__PURE__ */ __name(function(n) {
597
- this.unput(this.match.slice(n));
598
- }, "less"),
599
- // displays already matched input, i.e. for error messages
600
- pastInput: /* @__PURE__ */ __name(function() {
601
- var past = this.matched.substr(0, this.matched.length - this.match.length);
602
- return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
603
- }, "pastInput"),
604
- // displays upcoming input, i.e. for error messages
605
- upcomingInput: /* @__PURE__ */ __name(function() {
606
- var next = this.match;
607
- if (next.length < 20) {
608
- next += this._input.substr(0, 20 - next.length);
609
- }
610
- return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
611
- }, "upcomingInput"),
612
- // displays the character position where the lexing error occurred, i.e. for error messages
613
- showPosition: /* @__PURE__ */ __name(function() {
614
- var pre = this.pastInput();
615
- var c = new Array(pre.length + 1).join("-");
616
- return pre + this.upcomingInput() + "\n" + c + "^";
617
- }, "showPosition"),
618
- // test the lexed token: return FALSE when not a match, otherwise return token
619
- test_match: /* @__PURE__ */ __name(function(match, indexed_rule) {
620
- var token, lines, backup;
621
- if (this.options.backtrack_lexer) {
622
- backup = {
623
- yylineno: this.yylineno,
624
- yylloc: {
625
- first_line: this.yylloc.first_line,
626
- last_line: this.last_line,
627
- first_column: this.yylloc.first_column,
628
- last_column: this.yylloc.last_column
629
- },
630
- yytext: this.yytext,
631
- match: this.match,
632
- matches: this.matches,
633
- matched: this.matched,
634
- yyleng: this.yyleng,
635
- offset: this.offset,
636
- _more: this._more,
637
- _input: this._input,
638
- yy: this.yy,
639
- conditionStack: this.conditionStack.slice(0),
640
- done: this.done
641
- };
642
- if (this.options.ranges) {
643
- backup.yylloc.range = this.yylloc.range.slice(0);
644
- }
645
- }
646
- lines = match[0].match(/(?:\r\n?|\n).*/g);
647
- if (lines) {
648
- this.yylineno += lines.length;
649
- }
650
- this.yylloc = {
651
- first_line: this.yylloc.last_line,
652
- last_line: this.yylineno + 1,
653
- first_column: this.yylloc.last_column,
654
- last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length
655
- };
656
- this.yytext += match[0];
657
- this.match += match[0];
658
- this.matches = match;
659
- this.yyleng = this.yytext.length;
660
- if (this.options.ranges) {
661
- this.yylloc.range = [this.offset, this.offset += this.yyleng];
662
- }
663
- this._more = false;
664
- this._backtrack = false;
665
- this._input = this._input.slice(match[0].length);
666
- this.matched += match[0];
667
- token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
668
- if (this.done && this._input) {
669
- this.done = false;
670
- }
671
- if (token) {
672
- return token;
673
- } else if (this._backtrack) {
674
- for (var k in backup) {
675
- this[k] = backup[k];
676
- }
677
- return false;
678
- }
679
- return false;
680
- }, "test_match"),
681
- // return next match in input
682
- next: /* @__PURE__ */ __name(function() {
683
- if (this.done) {
684
- return this.EOF;
685
- }
686
- if (!this._input) {
687
- this.done = true;
688
- }
689
- var token, match, tempMatch, index;
690
- if (!this._more) {
691
- this.yytext = "";
692
- this.match = "";
693
- }
694
- var rules = this._currentRules();
695
- for (var i = 0; i < rules.length; i++) {
696
- tempMatch = this._input.match(this.rules[rules[i]]);
697
- if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
698
- match = tempMatch;
699
- index = i;
700
- if (this.options.backtrack_lexer) {
701
- token = this.test_match(tempMatch, rules[i]);
702
- if (token !== false) {
703
- return token;
704
- } else if (this._backtrack) {
705
- match = false;
706
- continue;
707
- } else {
708
- return false;
709
- }
710
- } else if (!this.options.flex) {
711
- break;
712
- }
713
- }
714
- }
715
- if (match) {
716
- token = this.test_match(match, rules[index]);
717
- if (token !== false) {
718
- return token;
719
- }
720
- return false;
721
- }
722
- if (this._input === "") {
723
- return this.EOF;
724
- } else {
725
- return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
726
- text: "",
727
- token: null,
728
- line: this.yylineno
729
- });
730
- }
731
- }, "next"),
732
- // return next match that has a token
733
- lex: /* @__PURE__ */ __name(function lex() {
734
- var r = this.next();
735
- if (r) {
736
- return r;
737
- } else {
738
- return this.lex();
739
- }
740
- }, "lex"),
741
- // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
742
- begin: /* @__PURE__ */ __name(function begin(condition) {
743
- this.conditionStack.push(condition);
744
- }, "begin"),
745
- // pop the previously active lexer condition state off the condition stack
746
- popState: /* @__PURE__ */ __name(function popState() {
747
- var n = this.conditionStack.length - 1;
748
- if (n > 0) {
749
- return this.conditionStack.pop();
750
- } else {
751
- return this.conditionStack[0];
752
- }
753
- }, "popState"),
754
- // produce the lexer rule set which is active for the currently active lexer condition state
755
- _currentRules: /* @__PURE__ */ __name(function _currentRules() {
756
- if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
757
- return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
758
- } else {
759
- return this.conditions["INITIAL"].rules;
760
- }
761
- }, "_currentRules"),
762
- // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
763
- topState: /* @__PURE__ */ __name(function topState(n) {
764
- n = this.conditionStack.length - 1 - Math.abs(n || 0);
765
- if (n >= 0) {
766
- return this.conditionStack[n];
767
- } else {
768
- return "INITIAL";
769
- }
770
- }, "topState"),
771
- // alias for begin(condition)
772
- pushState: /* @__PURE__ */ __name(function pushState(condition) {
773
- this.begin(condition);
774
- }, "pushState"),
775
- // return the number of states currently on the stack
776
- stateStackSize: /* @__PURE__ */ __name(function stateStackSize() {
777
- return this.conditionStack.length;
778
- }, "stateStackSize"),
779
- options: { "case-insensitive": true },
780
- performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
781
- switch ($avoiding_name_collisions) {
782
- case 0:
783
- return 5;
784
- case 1:
785
- break;
786
- case 2:
787
- break;
788
- case 3:
789
- break;
790
- case 4:
791
- break;
792
- case 5:
793
- break;
794
- case 6:
795
- return 20;
796
- case 7:
797
- this.begin("CONFIG");
798
- return 75;
799
- case 8:
800
- return 76;
801
- case 9:
802
- this.popState();
803
- this.begin("ALIAS");
804
- return 77;
805
- case 10:
806
- this.popState();
807
- this.popState();
808
- return 77;
809
- case 11:
810
- yy_.yytext = yy_.yytext.trim();
811
- return 73;
812
- case 12:
813
- yy_.yytext = yy_.yytext.trim();
814
- this.begin("ALIAS");
815
- return 73;
816
- case 13:
817
- yy_.yytext = yy_.yytext.trim();
818
- this.popState();
819
- return 73;
820
- case 14:
821
- this.popState();
822
- return 10;
823
- case 15:
824
- yy_.yytext = yy_.yytext.trim();
825
- this.popState();
826
- return 10;
827
- case 16:
828
- this.begin("LINE");
829
- return 15;
830
- case 17:
831
- this.begin("ID");
832
- return 51;
833
- case 18:
834
- this.begin("ID");
835
- return 53;
836
- case 19:
837
- return 14;
838
- case 20:
839
- this.begin("ID");
840
- return 54;
841
- case 21:
842
- this.popState();
843
- this.popState();
844
- this.begin("LINE");
845
- return 52;
846
- case 22:
847
- this.popState();
848
- this.popState();
849
- return 5;
850
- case 23:
851
- this.begin("LINE");
852
- return 37;
853
- case 24:
854
- this.begin("LINE");
855
- return 38;
856
- case 25:
857
- this.begin("LINE");
858
- return 39;
859
- case 26:
860
- this.begin("LINE");
861
- return 40;
862
- case 27:
863
- this.begin("LINE");
864
- return 50;
865
- case 28:
866
- this.begin("LINE");
867
- return 42;
868
- case 29:
869
- this.begin("LINE");
870
- return 44;
871
- case 30:
872
- this.begin("LINE");
873
- return 49;
874
- case 31:
875
- this.begin("LINE");
876
- return 45;
877
- case 32:
878
- this.begin("LINE");
879
- return 48;
880
- case 33:
881
- this.begin("LINE");
882
- return 47;
883
- case 34:
884
- this.popState();
885
- return 16;
886
- case 35:
887
- return 17;
888
- case 36:
889
- return 67;
890
- case 37:
891
- return 68;
892
- case 38:
893
- return 61;
894
- case 39:
895
- return 62;
896
- case 40:
897
- return 63;
898
- case 41:
899
- return 64;
900
- case 42:
901
- return 59;
902
- case 43:
903
- return 56;
904
- case 44:
905
- this.begin("ID");
906
- return 22;
907
- case 45:
908
- this.begin("ID");
909
- return 24;
910
- case 46:
911
- return 30;
912
- case 47:
913
- return 31;
914
- case 48:
915
- this.begin("acc_title");
916
- return 32;
917
- case 49:
918
- this.popState();
919
- return "acc_title_value";
920
- case 50:
921
- this.begin("acc_descr");
922
- return 34;
923
- case 51:
924
- this.popState();
925
- return "acc_descr_value";
926
- case 52:
927
- this.begin("acc_descr_multiline");
928
- break;
929
- case 53:
930
- this.popState();
931
- break;
932
- case 54:
933
- return "acc_descr_multiline_value";
934
- case 55:
935
- return 6;
936
- case 56:
937
- return 19;
938
- case 57:
939
- return 21;
940
- case 58:
941
- return 66;
942
- case 59:
943
- return 5;
944
- case 60:
945
- yy_.yytext = yy_.yytext.trim();
946
- return 73;
947
- case 61:
948
- return 80;
949
- case 62:
950
- return 97;
951
- case 63:
952
- return 98;
953
- case 64:
954
- return 99;
955
- case 65:
956
- return 78;
957
- case 66:
958
- return 79;
959
- case 67:
960
- return 100;
961
- case 68:
962
- return 101;
963
- case 69:
964
- return 102;
965
- case 70:
966
- return 103;
967
- case 71:
968
- return 85;
969
- case 72:
970
- return 86;
971
- case 73:
972
- return 87;
973
- case 74:
974
- return 88;
975
- case 75:
976
- return 93;
977
- case 76:
978
- return 94;
979
- case 77:
980
- return 95;
981
- case 78:
982
- return 96;
983
- case 79:
984
- return 81;
985
- case 80:
986
- return 82;
987
- case 81:
988
- return 83;
989
- case 82:
990
- return 84;
991
- case 83:
992
- return 89;
993
- case 84:
994
- return 90;
995
- case 85:
996
- return 91;
997
- case 86:
998
- return 92;
999
- case 87:
1000
- return 104;
1001
- case 88:
1002
- return 104;
1003
- case 89:
1004
- return 70;
1005
- case 90:
1006
- return 71;
1007
- case 91:
1008
- return 72;
1009
- case 92:
1010
- return 5;
1011
- case 93:
1012
- return 10;
1013
- }
1014
- }, "anonymous"),
1015
- rules: [/^(?:[\n]+)/i, /^(?:\s+)/i, /^(?:((?!\n)\s)+)/i, /^(?:#[^\n]*)/i, /^(?:%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:([0-9]+(\.[0-9]{1,2})?|\.[0-9]{1,2})(?=[ \n]+))/i, /^(?:@\{)/i, /^(?:[^\}]+)/i, /^(?:\}(?=\s+as\s))/i, /^(?:\})/i, /^(?:[^\<->\->:\n,;@\s]+(?=@\{))/i, /^(?:[^<>:\n,;@\s]+(?=\s+as\s))/i, /^(?:[^<>:\n,;@]+(?=\s*[\n;#]|$))/i, /^(?:[^<>:\n,;@]*<[^\n]*)/i, /^(?:[^\n]+)/i, /^(?:box\b)/i, /^(?:participant\b)/i, /^(?:actor\b)/i, /^(?:create\b)/i, /^(?:destroy\b)/i, /^(?:as\b)/i, /^(?:(?:))/i, /^(?:loop\b)/i, /^(?:rect\b)/i, /^(?:opt\b)/i, /^(?:alt\b)/i, /^(?:else\b)/i, /^(?:par\b)/i, /^(?:par_over\b)/i, /^(?:and\b)/i, /^(?:critical\b)/i, /^(?:option\b)/i, /^(?:break\b)/i, /^(?:(?:[:]?(?:no)?wrap)?[^#\n;]*)/i, /^(?:end\b)/i, /^(?:left of\b)/i, /^(?:right of\b)/i, /^(?:links\b)/i, /^(?:link\b)/i, /^(?:properties\b)/i, /^(?:details\b)/i, /^(?:over\b)/i, /^(?:note\b)/i, /^(?:activate\b)/i, /^(?:deactivate\b)/i, /^(?:title\s[^#\n;]+)/i, /^(?:title:\s[^#\n;]+)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:sequenceDiagram\b)/i, /^(?:autonumber\b)/i, /^(?:off\b)/i, /^(?:,)/i, /^(?:;)/i, /^(?:[^\/\\\+\()\+<\->\->:\n,;]+((?!(-x|--x|-\)|--\)|-\|\\|-\\|-\/|-\/\/|-\|\/|\/\|-|\\\|-|\/\/-|\\\\-|\/\|-|--\|\\|--|\(\)))[\-]*[^\+<\->\->:\n,;]+)*)/i, /^(?:->>)/i, /^(?:<<->>)/i, /^(?:-->>)/i, /^(?:<<-->>)/i, /^(?:->)/i, /^(?:-->)/i, /^(?:-[x])/i, /^(?:--[x])/i, /^(?:-[\)])/i, /^(?:--[\)])/i, /^(?:--\|\\)/i, /^(?:--\|\/)/i, /^(?:--\\\\)/i, /^(?:--\/\/)/i, /^(?:\/\|--)/i, /^(?:\\\|--)/i, /^(?:\/\/--)/i, /^(?:\\\\--)/i, /^(?:-\|\\)/i, /^(?:-\|\/)/i, /^(?:-\\\\)/i, /^(?:-\/\/)/i, /^(?:\/\|-)/i, /^(?:\\\|-)/i, /^(?:\/\/-)/i, /^(?:\\\\-)/i, /^(?::(?:(?:no)?wrap)?[^#\n;]*)/i, /^(?::)/i, /^(?:\+)/i, /^(?:-)/i, /^(?:\(\))/i, /^(?:$)/i, /^(?:.)/i],
1016
- conditions: { "acc_descr_multiline": { "rules": [53, 54], "inclusive": false }, "acc_descr": { "rules": [51], "inclusive": false }, "acc_title": { "rules": [49], "inclusive": false }, "ID": { "rules": [2, 3, 7, 11, 12, 13, 14, 15], "inclusive": false }, "ALIAS": { "rules": [2, 3, 21, 22], "inclusive": false }, "LINE": { "rules": [2, 3, 34], "inclusive": false }, "CONFIG": { "rules": [8, 9, 10], "inclusive": false }, "CONFIG_DATA": { "rules": [], "inclusive": false }, "INITIAL": { "rules": [0, 1, 3, 4, 5, 6, 16, 17, 18, 19, 20, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 50, 52, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93], "inclusive": true } }
1017
- };
1018
- return lexer2;
1019
- })();
1020
- parser2.lexer = lexer;
1021
- function Parser() {
1022
- this.yy = {};
1023
- }
1024
- __name(Parser, "Parser");
1025
- Parser.prototype = parser2;
1026
- parser2.Parser = Parser;
1027
- return new Parser();
1028
- })();
1029
- parser.parser = parser;
1030
- var sequenceDiagram_default = parser;
1031
- var LINETYPE = {
1032
- SOLID: 0,
1033
- DOTTED: 1,
1034
- NOTE: 2,
1035
- SOLID_CROSS: 3,
1036
- DOTTED_CROSS: 4,
1037
- SOLID_OPEN: 5,
1038
- DOTTED_OPEN: 6,
1039
- LOOP_START: 10,
1040
- LOOP_END: 11,
1041
- ALT_START: 12,
1042
- ALT_ELSE: 13,
1043
- ALT_END: 14,
1044
- OPT_START: 15,
1045
- OPT_END: 16,
1046
- ACTIVE_START: 17,
1047
- ACTIVE_END: 18,
1048
- PAR_START: 19,
1049
- PAR_AND: 20,
1050
- PAR_END: 21,
1051
- RECT_START: 22,
1052
- RECT_END: 23,
1053
- SOLID_POINT: 24,
1054
- DOTTED_POINT: 25,
1055
- AUTONUMBER: 26,
1056
- CRITICAL_START: 27,
1057
- CRITICAL_OPTION: 28,
1058
- CRITICAL_END: 29,
1059
- BREAK_START: 30,
1060
- BREAK_END: 31,
1061
- PAR_OVER_START: 32,
1062
- BIDIRECTIONAL_SOLID: 33,
1063
- BIDIRECTIONAL_DOTTED: 34,
1064
- SOLID_TOP: 41,
1065
- SOLID_BOTTOM: 42,
1066
- STICK_TOP: 43,
1067
- STICK_BOTTOM: 44,
1068
- SOLID_ARROW_TOP_REVERSE: 45,
1069
- SOLID_ARROW_BOTTOM_REVERSE: 46,
1070
- STICK_ARROW_TOP_REVERSE: 47,
1071
- STICK_ARROW_BOTTOM_REVERSE: 48,
1072
- SOLID_TOP_DOTTED: 51,
1073
- SOLID_BOTTOM_DOTTED: 52,
1074
- STICK_TOP_DOTTED: 53,
1075
- STICK_BOTTOM_DOTTED: 54,
1076
- SOLID_ARROW_TOP_REVERSE_DOTTED: 55,
1077
- SOLID_ARROW_BOTTOM_REVERSE_DOTTED: 56,
1078
- STICK_ARROW_TOP_REVERSE_DOTTED: 57,
1079
- STICK_ARROW_BOTTOM_REVERSE_DOTTED: 58,
1080
- CENTRAL_CONNECTION: 59,
1081
- CENTRAL_CONNECTION_REVERSE: 60,
1082
- CENTRAL_CONNECTION_DUAL: 61
1083
- };
1084
- var ARROWTYPE = {
1085
- FILLED: 0,
1086
- OPEN: 1
1087
- };
1088
- var PLACEMENT = {
1089
- LEFTOF: 0,
1090
- RIGHTOF: 1,
1091
- OVER: 2
1092
- };
1093
- var PARTICIPANT_TYPE = {
1094
- ACTOR: "actor",
1095
- CONTROL: "control",
1096
- DATABASE: "database",
1097
- ENTITY: "entity"
1098
- };
1099
- var SequenceDB = class {
1100
- constructor() {
1101
- this.state = new ImperativeState(() => ({
1102
- prevActor: void 0,
1103
- actors: /* @__PURE__ */ new Map(),
1104
- createdActors: /* @__PURE__ */ new Map(),
1105
- destroyedActors: /* @__PURE__ */ new Map(),
1106
- boxes: [],
1107
- messages: [],
1108
- notes: [],
1109
- sequenceNumbersEnabled: false,
1110
- wrapEnabled: void 0,
1111
- currentBox: void 0,
1112
- lastCreated: void 0,
1113
- lastDestroyed: void 0
1114
- }));
1115
- this.setAccTitle = setAccTitle;
1116
- this.setAccDescription = setAccDescription;
1117
- this.setDiagramTitle = setDiagramTitle;
1118
- this.getAccTitle = getAccTitle;
1119
- this.getAccDescription = getAccDescription;
1120
- this.getDiagramTitle = getDiagramTitle;
1121
- this.apply = this.apply.bind(this);
1122
- this.parseBoxData = this.parseBoxData.bind(this);
1123
- this.parseMessage = this.parseMessage.bind(this);
1124
- this.clear();
1125
- this.setWrap(getConfig2().wrap);
1126
- this.LINETYPE = LINETYPE;
1127
- this.ARROWTYPE = ARROWTYPE;
1128
- this.PLACEMENT = PLACEMENT;
1129
- }
1130
- static {
1131
- __name(this, "SequenceDB");
1132
- }
1133
- addBox(data) {
1134
- this.state.records.boxes.push({
1135
- name: data.text,
1136
- wrap: data.wrap ?? this.autoWrap(),
1137
- fill: data.color,
1138
- actorKeys: []
1139
- });
1140
- this.state.records.currentBox = this.state.records.boxes.slice(-1)[0];
1141
- }
1142
- addActor(id, name, description, type, metadata) {
1143
- let assignedBox = this.state.records.currentBox;
1144
- let doc;
1145
- if (metadata !== void 0) {
1146
- let yamlData;
1147
- if (!metadata.includes("\n")) {
1148
- yamlData = "{\n" + metadata + "\n}";
1149
- } else {
1150
- yamlData = metadata + "\n";
1151
- }
1152
- doc = load(yamlData, { schema: JSON_SCHEMA });
1153
- }
1154
- type = doc?.type ?? type;
1155
- if (doc?.alias && (!description || description.text === name)) {
1156
- description = { text: doc.alias, wrap: description?.wrap, type };
1157
- }
1158
- const old = this.state.records.actors.get(id);
1159
- if (old) {
1160
- if (this.state.records.currentBox && old.box && this.state.records.currentBox !== old.box) {
1161
- throw new Error(
1162
- `A same participant should only be defined in one Box: ${old.name} can't be in '${old.box.name}' and in '${this.state.records.currentBox.name}' at the same time.`
1163
- );
1164
- }
1165
- assignedBox = old.box ? old.box : this.state.records.currentBox;
1166
- old.box = assignedBox;
1167
- if (old && name === old.name && description == null) {
1168
- return;
1169
- }
1170
- }
1171
- if (description?.text == null) {
1172
- description = { text: name, type };
1173
- }
1174
- if (type == null || description.text == null) {
1175
- description = { text: name, type };
1176
- }
1177
- this.state.records.actors.set(id, {
1178
- box: assignedBox,
1179
- name,
1180
- description: description.text,
1181
- wrap: description.wrap ?? this.autoWrap(),
1182
- prevActor: this.state.records.prevActor,
1183
- links: {},
1184
- properties: {},
1185
- actorCnt: null,
1186
- rectData: null,
1187
- type: type ?? "participant"
1188
- });
1189
- if (this.state.records.prevActor) {
1190
- const prevActorInRecords = this.state.records.actors.get(this.state.records.prevActor);
1191
- if (prevActorInRecords) {
1192
- prevActorInRecords.nextActor = id;
1193
- }
1194
- }
1195
- if (this.state.records.currentBox) {
1196
- this.state.records.currentBox.actorKeys.push(id);
1197
- }
1198
- this.state.records.prevActor = id;
1199
- }
1200
- activationCount(part) {
1201
- let i;
1202
- let count = 0;
1203
- if (!part) {
1204
- return 0;
1205
- }
1206
- for (i = 0; i < this.state.records.messages.length; i++) {
1207
- if (this.state.records.messages[i].type === this.LINETYPE.ACTIVE_START && this.state.records.messages[i].from === part) {
1208
- count++;
1209
- }
1210
- if (this.state.records.messages[i].type === this.LINETYPE.ACTIVE_END && this.state.records.messages[i].from === part) {
1211
- count--;
1212
- }
1213
- }
1214
- return count;
1215
- }
1216
- addMessage(idFrom, idTo, message, answer) {
1217
- this.state.records.messages.push({
1218
- id: this.state.records.messages.length.toString(),
1219
- from: idFrom,
1220
- to: idTo,
1221
- message: message.text,
1222
- wrap: message.wrap ?? this.autoWrap(),
1223
- answer
1224
- });
1225
- }
1226
- addSignal(idFrom, idTo, message, messageType, activate = false, centralConnection) {
1227
- if (messageType === this.LINETYPE.ACTIVE_END) {
1228
- const cnt = this.activationCount(idFrom ?? "");
1229
- if (cnt < 1) {
1230
- const error = new Error("Trying to inactivate an inactive participant (" + idFrom + ")");
1231
- error.hash = {
1232
- text: "->>-",
1233
- token: "->>-",
1234
- line: "1",
1235
- loc: { first_line: 1, last_line: 1, first_column: 1, last_column: 1 },
1236
- expected: ["'ACTIVE_PARTICIPANT'"]
1237
- };
1238
- throw error;
1239
- }
1240
- }
1241
- this.state.records.messages.push({
1242
- id: this.state.records.messages.length.toString(),
1243
- from: idFrom,
1244
- to: idTo,
1245
- message: message?.text ?? "",
1246
- wrap: message?.wrap ?? this.autoWrap(),
1247
- type: messageType,
1248
- activate,
1249
- centralConnection: centralConnection ?? 0
1250
- });
1251
- return true;
1252
- }
1253
- hasAtLeastOneBox() {
1254
- return this.state.records.boxes.length > 0;
1255
- }
1256
- hasAtLeastOneBoxWithTitle() {
1257
- return this.state.records.boxes.some((b) => b.name);
1258
- }
1259
- getMessages() {
1260
- return this.state.records.messages;
1261
- }
1262
- getBoxes() {
1263
- return this.state.records.boxes;
1264
- }
1265
- getActors() {
1266
- return this.state.records.actors;
1267
- }
1268
- getCreatedActors() {
1269
- return this.state.records.createdActors;
1270
- }
1271
- getDestroyedActors() {
1272
- return this.state.records.destroyedActors;
1273
- }
1274
- getActor(id) {
1275
- return this.state.records.actors.get(id);
1276
- }
1277
- getActorKeys() {
1278
- return [...this.state.records.actors.keys()];
1279
- }
1280
- enableSequenceNumbers() {
1281
- this.state.records.sequenceNumbersEnabled = true;
1282
- }
1283
- disableSequenceNumbers() {
1284
- this.state.records.sequenceNumbersEnabled = false;
1285
- }
1286
- showSequenceNumbers() {
1287
- return this.state.records.sequenceNumbersEnabled;
1288
- }
1289
- setWrap(wrapSetting) {
1290
- this.state.records.wrapEnabled = wrapSetting;
1291
- }
1292
- extractWrap(text) {
1293
- if (text === void 0) {
1294
- return {};
1295
- }
1296
- text = text.trim();
1297
- const wrap = /^:?wrap:/.exec(text) !== null ? true : /^:?nowrap:/.exec(text) !== null ? false : void 0;
1298
- const cleanedText = (wrap === void 0 ? text : text.replace(/^:?(?:no)?wrap:/, "")).trim();
1299
- return { cleanedText, wrap };
1300
- }
1301
- autoWrap() {
1302
- if (this.state.records.wrapEnabled !== void 0) {
1303
- return this.state.records.wrapEnabled;
1304
- }
1305
- return getConfig2().sequence?.wrap ?? false;
1306
- }
1307
- clear() {
1308
- this.state.reset();
1309
- clear();
1310
- }
1311
- parseMessage(str) {
1312
- const trimmedStr = str.trim();
1313
- const { wrap, cleanedText } = this.extractWrap(trimmedStr);
1314
- const message = {
1315
- text: cleanedText,
1316
- wrap
1317
- };
1318
- log.debug(`parseMessage: ${JSON.stringify(message)}`);
1319
- return message;
1320
- }
1321
- // We expect the box statement to be color first then description
1322
- // The color can be rgb,rgba,hsl,hsla, or css code names #hex codes are not supported for now because of the way the char # is handled
1323
- // We extract first segment as color, the rest of the line is considered as text
1324
- parseBoxData(str) {
1325
- const match = /^((?:rgba?|hsla?)\s*\(.*\)|\w*)(.*)$/.exec(str);
1326
- let color = match?.[1] ? match[1].trim() : "transparent";
1327
- let title = match?.[2] ? match[2].trim() : void 0;
1328
- if (window?.CSS) {
1329
- if (!window.CSS.supports("color", color)) {
1330
- color = "transparent";
1331
- title = str.trim();
1332
- }
1333
- } else {
1334
- const style = new Option().style;
1335
- style.color = color;
1336
- if (style.color !== color) {
1337
- color = "transparent";
1338
- title = str.trim();
1339
- }
1340
- }
1341
- const { wrap, cleanedText } = this.extractWrap(title);
1342
- return {
1343
- text: cleanedText ? sanitizeText(cleanedText, getConfig2()) : void 0,
1344
- color,
1345
- wrap
1346
- };
1347
- }
1348
- addNote(actor, placement, message) {
1349
- const note = {
1350
- actor,
1351
- placement,
1352
- message: message.text,
1353
- wrap: message.wrap ?? this.autoWrap()
1354
- };
1355
- const actors = [].concat(actor, actor);
1356
- this.state.records.notes.push(note);
1357
- this.state.records.messages.push({
1358
- id: this.state.records.messages.length.toString(),
1359
- from: actors[0],
1360
- to: actors[1],
1361
- message: message.text,
1362
- wrap: message.wrap ?? this.autoWrap(),
1363
- type: this.LINETYPE.NOTE,
1364
- placement
1365
- });
1366
- }
1367
- addLinks(actorId, text) {
1368
- const actor = this.getActor(actorId);
1369
- try {
1370
- let sanitizedText = sanitizeText(text.text, getConfig2());
1371
- sanitizedText = sanitizedText.replace(/&equals;/g, "=");
1372
- sanitizedText = sanitizedText.replace(/&amp;/g, "&");
1373
- const links = JSON.parse(sanitizedText);
1374
- this.insertLinks(actor, links);
1375
- } catch (e) {
1376
- log.error("error while parsing actor link text", e);
1377
- }
1378
- }
1379
- addALink(actorId, text) {
1380
- const actor = this.getActor(actorId);
1381
- try {
1382
- const links = {};
1383
- let sanitizedText = sanitizeText(text.text, getConfig2());
1384
- const sep = sanitizedText.indexOf("@");
1385
- sanitizedText = sanitizedText.replace(/&equals;/g, "=");
1386
- sanitizedText = sanitizedText.replace(/&amp;/g, "&");
1387
- const label = sanitizedText.slice(0, sep - 1).trim();
1388
- const link = sanitizedText.slice(sep + 1).trim();
1389
- links[label] = link;
1390
- this.insertLinks(actor, links);
1391
- } catch (e) {
1392
- log.error("error while parsing actor link text", e);
1393
- }
1394
- }
1395
- insertLinks(actor, links) {
1396
- if (actor.links == null) {
1397
- actor.links = links;
1398
- } else {
1399
- for (const key in links) {
1400
- actor.links[key] = links[key];
1401
- }
1402
- }
1403
- }
1404
- addProperties(actorId, text) {
1405
- const actor = this.getActor(actorId);
1406
- try {
1407
- const sanitizedText = sanitizeText(text.text, getConfig2());
1408
- const properties = JSON.parse(sanitizedText);
1409
- this.insertProperties(actor, properties);
1410
- } catch (e) {
1411
- log.error("error while parsing actor properties text", e);
1412
- }
1413
- }
1414
- insertProperties(actor, properties) {
1415
- if (actor.properties == null) {
1416
- actor.properties = properties;
1417
- } else {
1418
- for (const key in properties) {
1419
- actor.properties[key] = properties[key];
1420
- }
1421
- }
1422
- }
1423
- boxEnd() {
1424
- this.state.records.currentBox = void 0;
1425
- }
1426
- addDetails(actorId, text) {
1427
- const actor = this.getActor(actorId);
1428
- const elem = document.getElementById(text.text);
1429
- try {
1430
- const text2 = elem.innerHTML;
1431
- const details = JSON.parse(text2);
1432
- if (details.properties) {
1433
- this.insertProperties(actor, details.properties);
1434
- }
1435
- if (details.links) {
1436
- this.insertLinks(actor, details.links);
1437
- }
1438
- } catch (e) {
1439
- log.error("error while parsing actor details text", e);
1440
- }
1441
- }
1442
- getActorProperty(actor, key) {
1443
- if (actor?.properties !== void 0) {
1444
- return actor.properties[key];
1445
- }
1446
- return void 0;
1447
- }
1448
- // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-redundant-type-constituents
1449
- apply(param) {
1450
- if (Array.isArray(param)) {
1451
- param.forEach((item) => {
1452
- this.apply(item);
1453
- });
1454
- } else {
1455
- switch (param.type) {
1456
- case "sequenceIndex":
1457
- this.state.records.messages.push({
1458
- id: this.state.records.messages.length.toString(),
1459
- from: void 0,
1460
- to: void 0,
1461
- message: {
1462
- start: param.sequenceIndex,
1463
- step: param.sequenceIndexStep,
1464
- visible: param.sequenceVisible
1465
- },
1466
- wrap: false,
1467
- type: param.signalType
1468
- });
1469
- break;
1470
- case "addParticipant":
1471
- this.addActor(param.actor, param.actor, param.description, param.draw, param.config);
1472
- break;
1473
- case "createParticipant":
1474
- if (this.state.records.actors.has(param.actor)) {
1475
- throw new Error(
1476
- "It is not possible to have actors with the same id, even if one is destroyed before the next is created. Use 'AS' aliases to simulate the behavior"
1477
- );
1478
- }
1479
- this.state.records.lastCreated = param.actor;
1480
- this.addActor(param.actor, param.actor, param.description, param.draw, param.config);
1481
- this.state.records.createdActors.set(param.actor, this.state.records.messages.length);
1482
- break;
1483
- case "destroyParticipant":
1484
- this.state.records.lastDestroyed = param.actor;
1485
- this.state.records.destroyedActors.set(param.actor, this.state.records.messages.length);
1486
- break;
1487
- case "activeStart":
1488
- this.addSignal(param.actor, void 0, void 0, param.signalType);
1489
- break;
1490
- case "centralConnection":
1491
- this.addSignal(param.actor, void 0, void 0, param.signalType);
1492
- break;
1493
- case "centralConnectionReverse":
1494
- this.addSignal(param.actor, void 0, void 0, param.signalType);
1495
- break;
1496
- case "activeEnd":
1497
- this.addSignal(param.actor, void 0, void 0, param.signalType);
1498
- break;
1499
- case "addNote":
1500
- this.addNote(param.actor, param.placement, param.text);
1501
- break;
1502
- case "addLinks":
1503
- this.addLinks(param.actor, param.text);
1504
- break;
1505
- case "addALink":
1506
- this.addALink(param.actor, param.text);
1507
- break;
1508
- case "addProperties":
1509
- this.addProperties(param.actor, param.text);
1510
- break;
1511
- case "addDetails":
1512
- this.addDetails(param.actor, param.text);
1513
- break;
1514
- case "addMessage":
1515
- if (this.state.records.lastCreated) {
1516
- if (param.to !== this.state.records.lastCreated) {
1517
- throw new Error(
1518
- "The created participant " + this.state.records.lastCreated.name + " does not have an associated creating message after its declaration. Please check the sequence diagram."
1519
- );
1520
- } else {
1521
- this.state.records.lastCreated = void 0;
1522
- }
1523
- } else if (this.state.records.lastDestroyed) {
1524
- if (param.to !== this.state.records.lastDestroyed && param.from !== this.state.records.lastDestroyed) {
1525
- throw new Error(
1526
- "The destroyed participant " + this.state.records.lastDestroyed.name + " does not have an associated destroying message after its declaration. Please check the sequence diagram."
1527
- );
1528
- } else {
1529
- this.state.records.lastDestroyed = void 0;
1530
- }
1531
- }
1532
- this.addSignal(
1533
- param.from,
1534
- param.to,
1535
- param.msg,
1536
- param.signalType,
1537
- param.activate,
1538
- param.centralConnection
1539
- );
1540
- break;
1541
- case "boxStart":
1542
- this.addBox(param.boxData);
1543
- break;
1544
- case "boxEnd":
1545
- this.boxEnd();
1546
- break;
1547
- case "loopStart":
1548
- this.addSignal(void 0, void 0, param.loopText, param.signalType);
1549
- break;
1550
- case "loopEnd":
1551
- this.addSignal(void 0, void 0, void 0, param.signalType);
1552
- break;
1553
- case "rectStart":
1554
- this.addSignal(void 0, void 0, param.color, param.signalType);
1555
- break;
1556
- case "rectEnd":
1557
- this.addSignal(void 0, void 0, void 0, param.signalType);
1558
- break;
1559
- case "optStart":
1560
- this.addSignal(void 0, void 0, param.optText, param.signalType);
1561
- break;
1562
- case "optEnd":
1563
- this.addSignal(void 0, void 0, void 0, param.signalType);
1564
- break;
1565
- case "altStart":
1566
- this.addSignal(void 0, void 0, param.altText, param.signalType);
1567
- break;
1568
- case "else":
1569
- this.addSignal(void 0, void 0, param.altText, param.signalType);
1570
- break;
1571
- case "altEnd":
1572
- this.addSignal(void 0, void 0, void 0, param.signalType);
1573
- break;
1574
- case "setAccTitle":
1575
- setAccTitle(param.text);
1576
- break;
1577
- case "parStart":
1578
- this.addSignal(void 0, void 0, param.parText, param.signalType);
1579
- break;
1580
- case "and":
1581
- this.addSignal(void 0, void 0, param.parText, param.signalType);
1582
- break;
1583
- case "parEnd":
1584
- this.addSignal(void 0, void 0, void 0, param.signalType);
1585
- break;
1586
- case "criticalStart":
1587
- this.addSignal(void 0, void 0, param.criticalText, param.signalType);
1588
- break;
1589
- case "option":
1590
- this.addSignal(void 0, void 0, param.optionText, param.signalType);
1591
- break;
1592
- case "criticalEnd":
1593
- this.addSignal(void 0, void 0, void 0, param.signalType);
1594
- break;
1595
- case "breakStart":
1596
- this.addSignal(void 0, void 0, param.breakText, param.signalType);
1597
- break;
1598
- case "breakEnd":
1599
- this.addSignal(void 0, void 0, void 0, param.signalType);
1600
- break;
1601
- }
1602
- }
1603
- }
1604
- getConfig() {
1605
- return getConfig2().sequence;
1606
- }
1607
- };
1608
- var getStyles = /* @__PURE__ */ __name((options) => {
1609
- const dropShadow = options.dropShadow ?? "none";
1610
- const { look } = getConfig2();
1611
- return `.actor {
1612
- stroke: ${options.actorBorder};
1613
- fill: ${options.actorBkg};
1614
- stroke-width: ${options.strokeWidth ?? 1};
1615
- }
1616
-
1617
- rect.actor.outer-path[data-look="neo"] {
1618
- filter: ${dropShadow};
1619
- }
1620
-
1621
- rect.note[data-look="neo"] {
1622
- stroke:${options.noteBorderColor};
1623
- fill:${options.noteBkgColor};
1624
- filter: ${dropShadow};
1625
- }
1626
-
1627
- text.actor > tspan {
1628
- fill: ${options.actorTextColor};
1629
- stroke: none;
1630
- }
1631
-
1632
- .actor-line {
1633
- stroke: ${options.actorLineColor};
1634
- }
1635
-
1636
- .innerArc {
1637
- stroke-width: 1.5;
1638
- stroke-dasharray: none;
1639
- }
1640
-
1641
- .messageLine0 {
1642
- stroke-width: 1.5;
1643
- stroke-dasharray: none;
1644
- stroke: ${options.signalColor};
1645
- }
1646
-
1647
- .messageLine1 {
1648
- stroke-width: 1.5;
1649
- stroke-dasharray: 2, 2;
1650
- stroke: ${options.signalColor};
1651
- }
1652
-
1653
- [id$="-arrowhead"] path {
1654
- fill: ${options.signalColor};
1655
- stroke: ${options.signalColor};
1656
- }
1657
-
1658
- .sequenceNumber {
1659
- fill: ${options.sequenceNumberColor};
1660
- }
1661
-
1662
- [id$="-sequencenumber"] {
1663
- fill: ${options.signalColor};
1664
- }
1665
-
1666
- [id$="-crosshead"] path {
1667
- fill: ${options.signalColor};
1668
- stroke: ${options.signalColor};
1669
- }
1670
-
1671
- .messageText {
1672
- fill: ${options.signalTextColor};
1673
- stroke: none;
1674
- }
1675
-
1676
- .labelBox {
1677
- stroke: ${options.labelBoxBorderColor};
1678
- fill: ${options.labelBoxBkgColor};
1679
- filter: ${look === "neo" ? dropShadow : "none"};
1680
- }
1681
-
1682
- .labelText, .labelText > tspan {
1683
- fill: ${options.labelTextColor};
1684
- stroke: none;
1685
- }
1686
-
1687
- .loopText, .loopText > tspan {
1688
- fill: ${options.loopTextColor};
1689
- stroke: none;
1690
- }
1691
-
1692
- .sectionTitle, .sectionTitle > tspan {
1693
- fill: ${options.loopTextColor};
1694
- stroke: none;
1695
- }
1696
-
1697
- .loopLine {
1698
- stroke-width: 2px;
1699
- stroke-dasharray: 2, 2;
1700
- stroke: ${options.labelBoxBorderColor};
1701
- fill: ${options.labelBoxBorderColor};
1702
- }
1703
-
1704
- .note {
1705
- //stroke: #decc93;
1706
- stroke: ${options.noteBorderColor};
1707
- fill: ${options.noteBkgColor};
1708
- }
1709
-
1710
- .noteText, .noteText > tspan {
1711
- fill: ${options.noteTextColor};
1712
- stroke: none;
1713
- ${options.noteFontWeight ? `font-weight: ${options.noteFontWeight};` : ""}
1714
- }
1715
-
1716
- .activation0 {
1717
- fill: ${options.activationBkgColor};
1718
- stroke: ${options.activationBorderColor};
1719
- }
1720
-
1721
- .activation1 {
1722
- fill: ${options.activationBkgColor};
1723
- stroke: ${options.activationBorderColor};
1724
- }
1725
-
1726
- .activation2 {
1727
- fill: ${options.activationBkgColor};
1728
- stroke: ${options.activationBorderColor};
1729
- }
1730
-
1731
- .actorPopupMenu {
1732
- position: absolute;
1733
- }
1734
-
1735
- .actorPopupMenuPanel {
1736
- position: absolute;
1737
- fill: ${options.actorBkg};
1738
- box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
1739
- filter: drop-shadow(3px 5px 2px rgb(0 0 0 / 0.4));
1740
- }
1741
- .actor-man circle, line {
1742
- fill: ${options.actorBkg};
1743
- stroke-width: 2px;
1744
- }
1745
-
1746
- g rect.rect {
1747
- filter: ${dropShadow};
1748
- stroke: ${options.nodeBorder};
1749
- }
1750
- `;
1751
- }, "getStyles");
1752
- var styles_default = getStyles;
1753
- var ACTOR_TYPE_WIDTH = 18 * 2;
1754
- var TOP_ACTOR_CLASS = "actor-top";
1755
- var BOTTOM_ACTOR_CLASS = "actor-bottom";
1756
- var ACTOR_BOX_CLASS = "actor-box";
1757
- var ACTOR_MAN_FIGURE_CLASS = "actor-man";
1758
- var COLOR_THEMES = /* @__PURE__ */ new Set(["redux-color", "redux-dark-color"]);
1759
- var drawRect2 = /* @__PURE__ */ __name(function(elem, rectData) {
1760
- const rectElement = drawRect(elem, rectData);
1761
- if (getConfig().look === "neo") {
1762
- rectElement.attr("data-look", "neo");
1763
- }
1764
- return rectElement;
1765
- }, "drawRect");
1766
- var drawPopup = /* @__PURE__ */ __name(function(elem, actor, minMenuWidth, textAttrs, forceMenus) {
1767
- if (actor.links === void 0 || actor.links === null || Object.keys(actor.links).length === 0) {
1768
- return { height: 0, width: 0 };
1769
- }
1770
- const links = actor.links;
1771
- const actorCnt2 = actor.actorCnt;
1772
- const rectData = actor.rectData;
1773
- var displayValue = "none";
1774
- if (forceMenus) {
1775
- displayValue = "block !important";
1776
- }
1777
- const g = elem.append("g");
1778
- g.attr("id", "actor" + actorCnt2 + "_popup");
1779
- g.attr("class", "actorPopupMenu");
1780
- g.attr("display", displayValue);
1781
- var actorClass = "";
1782
- if (rectData.class !== void 0) {
1783
- actorClass = " " + rectData.class;
1784
- }
1785
- let menuWidth = rectData.width > minMenuWidth ? rectData.width : minMenuWidth;
1786
- const rectElem = g.append("rect");
1787
- rectElem.attr("class", "actorPopupMenuPanel" + actorClass);
1788
- rectElem.attr("x", rectData.x);
1789
- rectElem.attr("y", rectData.height);
1790
- rectElem.attr("fill", rectData.fill);
1791
- rectElem.attr("stroke", rectData.stroke);
1792
- rectElem.attr("width", menuWidth);
1793
- rectElem.attr("height", rectData.height);
1794
- rectElem.attr("rx", rectData.rx);
1795
- rectElem.attr("ry", rectData.ry);
1796
- if (links != null) {
1797
- var linkY = 20;
1798
- for (let key in links) {
1799
- var linkElem = g.append("a");
1800
- var sanitizedLink = distExports.sanitizeUrl(links[key]);
1801
- linkElem.attr("xlink:href", sanitizedLink);
1802
- linkElem.attr("target", "_blank");
1803
- _drawMenuItemTextCandidateFunc(textAttrs)(
1804
- key,
1805
- linkElem,
1806
- rectData.x + 10,
1807
- rectData.height + linkY,
1808
- menuWidth,
1809
- 20,
1810
- { class: "actor" },
1811
- textAttrs
1812
- );
1813
- linkY += 30;
1814
- }
1815
- }
1816
- rectElem.attr("height", linkY);
1817
- return { height: rectData.height + linkY, width: menuWidth };
1818
- }, "drawPopup");
1819
- var popupMenuToggle = /* @__PURE__ */ __name(function(popId) {
1820
- return "var pu = document.getElementById('" + popId + "'); if (pu != null) { pu.style.display = pu.style.display == 'block' ? 'none' : 'block'; }";
1821
- }, "popupMenuToggle");
1822
- var drawKatex = /* @__PURE__ */ __name(async function(elem, textData, msgModel = null) {
1823
- let textElem = elem.append("foreignObject");
1824
- const linesSanitized = await renderKatexSanitized(textData.text, getConfig());
1825
- const divElem = textElem.append("xhtml:div").attr("style", "width: fit-content;").attr("xmlns", "http://www.w3.org/1999/xhtml").html(linesSanitized);
1826
- const dim = divElem.node().getBoundingClientRect();
1827
- textElem.attr("height", Math.round(dim.height)).attr("width", Math.round(dim.width));
1828
- if (textData.class === "noteText") {
1829
- const rectElem = elem.node().firstChild;
1830
- rectElem.setAttribute("height", dim.height + 2 * textData.textMargin);
1831
- const rectDim = rectElem.getBBox();
1832
- textElem.attr("x", Math.round(rectDim.x + rectDim.width / 2 - dim.width / 2)).attr("y", Math.round(rectDim.y + rectDim.height / 2 - dim.height / 2));
1833
- } else if (msgModel) {
1834
- let { startx, stopx, starty } = msgModel;
1835
- if (startx > stopx) {
1836
- const temp = startx;
1837
- startx = stopx;
1838
- stopx = temp;
1839
- }
1840
- textElem.attr("x", Math.round(startx + Math.abs(startx - stopx) / 2 - dim.width / 2));
1841
- if (textData.class === "loopText") {
1842
- textElem.attr("y", Math.round(starty));
1843
- } else {
1844
- textElem.attr("y", Math.round(starty - dim.height));
1845
- }
1846
- }
1847
- return [textElem];
1848
- }, "drawKatex");
1849
- var drawText = /* @__PURE__ */ __name(function(elem, textData) {
1850
- let prevTextHeight = 0;
1851
- let textHeight = 0;
1852
- const lines = textData.text.split(common_default.lineBreakRegex);
1853
- const [_textFontSize, _textFontSizePx] = parseFontSize(textData.fontSize);
1854
- let textElems = [];
1855
- let dy = 0;
1856
- let yfunc = /* @__PURE__ */ __name(() => textData.y, "yfunc");
1857
- if (textData.valign !== void 0 && textData.textMargin !== void 0 && textData.textMargin > 0) {
1858
- switch (textData.valign) {
1859
- case "top":
1860
- case "start":
1861
- yfunc = /* @__PURE__ */ __name(() => Math.round(textData.y + textData.textMargin), "yfunc");
1862
- break;
1863
- case "middle":
1864
- case "center":
1865
- yfunc = /* @__PURE__ */ __name(() => Math.round(textData.y + (prevTextHeight + textHeight + textData.textMargin) / 2), "yfunc");
1866
- break;
1867
- case "bottom":
1868
- case "end":
1869
- yfunc = /* @__PURE__ */ __name(() => Math.round(
1870
- textData.y + (prevTextHeight + textHeight + 2 * textData.textMargin) - textData.textMargin
1871
- ), "yfunc");
1872
- break;
1873
- }
1874
- }
1875
- if (textData.anchor !== void 0 && textData.textMargin !== void 0 && textData.width !== void 0) {
1876
- switch (textData.anchor) {
1877
- case "left":
1878
- case "start":
1879
- textData.x = Math.round(textData.x + textData.textMargin);
1880
- textData.anchor = "start";
1881
- textData.dominantBaseline = "middle";
1882
- textData.alignmentBaseline = "middle";
1883
- break;
1884
- case "middle":
1885
- case "center":
1886
- textData.x = Math.round(textData.x + textData.width / 2);
1887
- textData.anchor = "middle";
1888
- textData.dominantBaseline = "middle";
1889
- textData.alignmentBaseline = "middle";
1890
- break;
1891
- case "right":
1892
- case "end":
1893
- textData.x = Math.round(textData.x + textData.width - textData.textMargin);
1894
- textData.anchor = "end";
1895
- textData.dominantBaseline = "middle";
1896
- textData.alignmentBaseline = "middle";
1897
- break;
1898
- }
1899
- }
1900
- for (let [i, line] of lines.entries()) {
1901
- if (textData.textMargin !== void 0 && textData.textMargin === 0 && _textFontSize !== void 0) {
1902
- dy = i * _textFontSize;
1903
- }
1904
- const textElem = elem.append("text");
1905
- textElem.attr("x", textData.x);
1906
- textElem.attr("y", yfunc());
1907
- if (textData.anchor !== void 0) {
1908
- textElem.attr("text-anchor", textData.anchor).attr("dominant-baseline", textData.dominantBaseline).attr("alignment-baseline", textData.alignmentBaseline);
1909
- }
1910
- if (textData.fontFamily !== void 0) {
1911
- textElem.style("font-family", textData.fontFamily);
1912
- }
1913
- if (_textFontSizePx !== void 0) {
1914
- textElem.style("font-size", _textFontSizePx);
1915
- }
1916
- if (textData.fontWeight !== void 0) {
1917
- textElem.style("font-weight", textData.fontWeight);
1918
- }
1919
- if (textData.fill !== void 0) {
1920
- textElem.attr("fill", textData.fill);
1921
- }
1922
- if (textData.class !== void 0) {
1923
- textElem.attr("class", textData.class);
1924
- }
1925
- if (textData.dy !== void 0) {
1926
- textElem.attr("dy", textData.dy);
1927
- } else if (dy !== 0) {
1928
- textElem.attr("dy", dy);
1929
- }
1930
- const text = line || ZERO_WIDTH_SPACE;
1931
- if (textData.tspan) {
1932
- const span = textElem.append("tspan");
1933
- span.attr("x", textData.x);
1934
- if (textData.fill !== void 0) {
1935
- span.attr("fill", textData.fill);
1936
- }
1937
- span.text(text);
1938
- } else {
1939
- textElem.text(text);
1940
- }
1941
- if (textData.valign !== void 0 && textData.textMargin !== void 0 && textData.textMargin > 0) {
1942
- textHeight += (textElem._groups || textElem)[0][0].getBBox().height;
1943
- prevTextHeight = textHeight;
1944
- }
1945
- textElems.push(textElem);
1946
- }
1947
- return textElems;
1948
- }, "drawText");
1949
- var drawLabel = /* @__PURE__ */ __name(function(elem, txtObject) {
1950
- function genPoints(x, y, width, height, cut) {
1951
- return x + "," + y + " " + (x + width) + "," + y + " " + (x + width) + "," + (y + height - cut) + " " + (x + width - cut * 1.2) + "," + (y + height) + " " + x + "," + (y + height);
1952
- }
1953
- __name(genPoints, "genPoints");
1954
- const polygon = elem.append("polygon");
1955
- polygon.attr("points", genPoints(txtObject.x, txtObject.y, txtObject.width, txtObject.height, 7));
1956
- polygon.attr("class", "labelBox");
1957
- txtObject.y = txtObject.y + txtObject.height / 2;
1958
- drawText(elem, txtObject);
1959
- return polygon;
1960
- }, "drawLabel");
1961
- var actorCnt = -1;
1962
- var fixLifeLineHeights = /* @__PURE__ */ __name((diagram2, actors, actorKeys, conf2) => {
1963
- if (!diagram2.select) {
1964
- return;
1965
- }
1966
- actorKeys.forEach((actorKey) => {
1967
- const actor = actors.get(actorKey);
1968
- const actorDOM = diagram2.select("#actor" + actor.actorCnt);
1969
- if (!conf2.mirrorActors && actor.stopy) {
1970
- actorDOM.attr("y2", actor.stopy + actor.height / 2);
1971
- } else if (conf2.mirrorActors) {
1972
- actorDOM.attr("y2", actor.stopy);
1973
- }
1974
- });
1975
- }, "fixLifeLineHeights");
1976
- var drawActorTypeParticipant = /* @__PURE__ */ __name(function(elem, actor, conf2, isFooter, actorIndexMap) {
1977
- const actorY = isFooter ? actor.stopy : actor.starty;
1978
- const center = actor.x + actor.width / 2;
1979
- const centerY = actorY + actor.height;
1980
- const { look, theme, themeVariables } = conf2;
1981
- const { bkgColorArray, borderColorArray } = themeVariables;
1982
- const boxplusLineGroup = elem.append("g").lower();
1983
- var g = boxplusLineGroup;
1984
- if (!isFooter) {
1985
- actorCnt++;
1986
- if (Object.keys(actor.links || {}).length && !conf2.forceMenus) {
1987
- g.attr("onclick", popupMenuToggle(`actor${actorCnt}_popup`)).attr("cursor", "pointer");
1988
- }
1989
- g.append("line").attr("id", "actor" + actorCnt).attr("x1", center).attr("y1", centerY).attr("x2", center).attr("y2", 2e3).attr("class", "actor-line 200").attr("stroke-width", "0.5px").attr("stroke", "#999").attr("name", actor.name).attr("data-et", "life-line").attr("data-id", actor.name);
1990
- g = boxplusLineGroup.append("g");
1991
- actor.actorCnt = actorCnt;
1992
- if (actor.links != null) {
1993
- g.attr("id", "root-" + actorCnt);
1994
- }
1995
- if (look === "neo") {
1996
- g.attr("data-look", "neo");
1997
- }
1998
- }
1999
- const rect = getNoteRect();
2000
- var cssclass = "actor";
2001
- if (actor.properties?.class) {
2002
- cssclass = actor.properties.class;
2003
- } else {
2004
- rect.fill = "#eaeaea";
2005
- }
2006
- if (isFooter) {
2007
- cssclass += ` ${BOTTOM_ACTOR_CLASS}`;
2008
- } else {
2009
- cssclass += ` ${TOP_ACTOR_CLASS}`;
2010
- }
2011
- rect.x = actor.x;
2012
- rect.y = actorY;
2013
- rect.width = actor.width;
2014
- rect.height = actor.height;
2015
- rect.class = cssclass;
2016
- rect.rx = 3;
2017
- rect.ry = 3;
2018
- rect.name = actor.name;
2019
- if (look === "neo") {
2020
- rect.rx = 6;
2021
- rect.ry = 6;
2022
- }
2023
- const rectElem = drawRect2(g, rect);
2024
- const actorCount = actorIndexMap.get(actor.name) ?? 0;
2025
- if (COLOR_THEMES.has(theme)) {
2026
- rectElem.style("stroke", borderColorArray[actorCount % borderColorArray.length]);
2027
- rectElem.style("fill", bkgColorArray[actorCount % borderColorArray.length]);
2028
- }
2029
- if (look === "neo") {
2030
- rectElem.attr("filter", "url(#drop-shadow)");
2031
- }
2032
- actor.rectData = rect;
2033
- if (actor.properties?.icon) {
2034
- const iconSrc = actor.properties.icon.trim();
2035
- if (iconSrc.charAt(0) === "@") {
2036
- drawEmbeddedImage(g, rect.x + rect.width - 20, rect.y + 10, iconSrc.substr(1));
2037
- } else {
2038
- drawImage(g, rect.x + rect.width - 20, rect.y + 10, iconSrc);
2039
- }
2040
- }
2041
- if (!isFooter) {
2042
- g.attr("data-et", "participant");
2043
- g.attr("data-type", "participant");
2044
- g.attr("data-id", actor.name);
2045
- }
2046
- _drawTextCandidateFunc(conf2, hasKatex(actor.description))(
2047
- actor.description,
2048
- g,
2049
- rect.x,
2050
- rect.y,
2051
- rect.width,
2052
- rect.height,
2053
- { class: `actor ${ACTOR_BOX_CLASS}` },
2054
- conf2
2055
- );
2056
- let height = actor.height;
2057
- if (rectElem.node) {
2058
- const bounds2 = rectElem.node().getBBox();
2059
- actor.height = bounds2.height;
2060
- height = bounds2.height;
2061
- }
2062
- return height;
2063
- }, "drawActorTypeParticipant");
2064
- var drawActorTypeCollections = /* @__PURE__ */ __name(function(elem, actor, conf2, isFooter, actorIndexMap) {
2065
- const actorY = isFooter ? actor.stopy : actor.starty;
2066
- const center = actor.x + actor.width / 2;
2067
- const centerY = actorY + actor.height;
2068
- const { look, theme, themeVariables } = conf2;
2069
- const { bkgColorArray, borderColorArray } = themeVariables;
2070
- const boxplusLineGroup = elem.append("g").lower();
2071
- var g = boxplusLineGroup;
2072
- if (!isFooter) {
2073
- actorCnt++;
2074
- if (Object.keys(actor.links || {}).length && !conf2.forceMenus) {
2075
- g.attr("onclick", popupMenuToggle(`actor${actorCnt}_popup`)).attr("cursor", "pointer");
2076
- }
2077
- g.append("line").attr("id", "actor" + actorCnt).attr("x1", center).attr("y1", centerY).attr("x2", center).attr("y2", 2e3).attr("class", "actor-line 200").attr("stroke-width", "0.5px").attr("stroke", "#999").attr("name", actor.name).attr("data-et", "life-line").attr("data-id", actor.name);
2078
- g = boxplusLineGroup.append("g");
2079
- actor.actorCnt = actorCnt;
2080
- if (actor.links != null) {
2081
- g.attr("id", "root-" + actorCnt);
2082
- }
2083
- if (look === "neo") {
2084
- g.attr("data-look", "neo");
2085
- }
2086
- }
2087
- const rect = getNoteRect();
2088
- var cssclass = "actor";
2089
- if (actor.properties?.class) {
2090
- cssclass = actor.properties.class;
2091
- } else {
2092
- rect.fill = "#eaeaea";
2093
- }
2094
- if (isFooter) {
2095
- cssclass += ` ${BOTTOM_ACTOR_CLASS}`;
2096
- } else {
2097
- cssclass += ` ${TOP_ACTOR_CLASS}`;
2098
- }
2099
- rect.x = actor.x;
2100
- rect.y = actorY;
2101
- rect.width = actor.width;
2102
- rect.height = actor.height;
2103
- rect.class = cssclass;
2104
- rect.name = actor.name;
2105
- const offset = 6;
2106
- const shadowRect = {
2107
- ...rect,
2108
- x: rect.x + (isFooter ? -offset : -offset),
2109
- y: rect.y + (isFooter ? +offset : +offset),
2110
- class: "actor"
2111
- };
2112
- const rectElem = drawRect2(g, rect);
2113
- const stackedRect = drawRect2(g, shadowRect);
2114
- actor.rectData = rect;
2115
- if (look === "neo") {
2116
- g.attr("filter", "url(#drop-shadow)");
2117
- }
2118
- const actorCount = actorIndexMap.get(actor.name) ?? 0;
2119
- if (COLOR_THEMES.has(theme)) {
2120
- rectElem.style("stroke", borderColorArray[actorCount % borderColorArray.length]);
2121
- rectElem.style("fill", bkgColorArray[actorCount % borderColorArray.length]);
2122
- stackedRect.style("stroke", borderColorArray[actorCount % borderColorArray.length]);
2123
- stackedRect.style("fill", bkgColorArray[actorCount % borderColorArray.length]);
2124
- }
2125
- if (actor.properties?.icon) {
2126
- const iconSrc = actor.properties.icon.trim();
2127
- if (iconSrc.charAt(0) === "@") {
2128
- drawEmbeddedImage(g, rect.x + rect.width - 20, rect.y + 10, iconSrc.substr(1));
2129
- } else {
2130
- drawImage(g, rect.x + rect.width - 20, rect.y + 10, iconSrc);
2131
- }
2132
- }
2133
- _drawTextCandidateFunc(conf2, hasKatex(actor.description))(
2134
- actor.description,
2135
- g,
2136
- rect.x - offset,
2137
- rect.y + offset,
2138
- rect.width,
2139
- rect.height,
2140
- { class: `actor ${ACTOR_BOX_CLASS}` },
2141
- conf2
2142
- );
2143
- let height = actor.height;
2144
- if (rectElem.node) {
2145
- const bounds2 = rectElem.node().getBBox();
2146
- actor.height = bounds2.height;
2147
- height = bounds2.height;
2148
- }
2149
- if (!isFooter) {
2150
- g.attr("data-et", "participant");
2151
- g.attr("data-type", "collections");
2152
- g.attr("data-id", actor.name);
2153
- }
2154
- return height;
2155
- }, "drawActorTypeCollections");
2156
- var drawActorTypeQueue = /* @__PURE__ */ __name(function(elem, actor, conf2, isFooter, actorIndexMap) {
2157
- const actorY = isFooter ? actor.stopy : actor.starty;
2158
- const center = actor.x + actor.width / 2;
2159
- const centerY = actorY + actor.height;
2160
- const { look, theme, themeVariables } = conf2;
2161
- const { bkgColorArray, borderColorArray } = themeVariables;
2162
- const boxplusLineGroup = elem.append("g").lower();
2163
- let g = boxplusLineGroup;
2164
- if (!isFooter) {
2165
- actorCnt++;
2166
- if (Object.keys(actor.links || {}).length && !conf2.forceMenus) {
2167
- g.attr("onclick", popupMenuToggle(`actor${actorCnt}_popup`)).attr("cursor", "pointer");
2168
- }
2169
- g.append("line").attr("id", "actor" + actorCnt).attr("x1", center).attr("y1", centerY).attr("x2", center).attr("y2", 2e3).attr("class", "actor-line 200").attr("stroke-width", "0.5px").attr("stroke", "#999").attr("name", actor.name).attr("data-et", "life-line").attr("data-id", actor.name);
2170
- g = boxplusLineGroup.append("g");
2171
- actor.actorCnt = actorCnt;
2172
- if (actor.links != null) {
2173
- g.attr("id", "root-" + actorCnt);
2174
- }
2175
- if (look === "neo") {
2176
- g.attr("data-look", "neo");
2177
- }
2178
- }
2179
- const rect = getNoteRect();
2180
- let cssclass = "actor";
2181
- if (actor.properties?.class) {
2182
- cssclass = actor.properties.class;
2183
- } else {
2184
- rect.fill = "#eaeaea";
2185
- }
2186
- if (isFooter) {
2187
- cssclass += ` ${BOTTOM_ACTOR_CLASS}`;
2188
- } else {
2189
- cssclass += ` ${TOP_ACTOR_CLASS}`;
2190
- }
2191
- g.attr("class", cssclass);
2192
- rect.x = actor.x;
2193
- rect.y = actorY;
2194
- rect.width = actor.width;
2195
- rect.height = actor.height;
2196
- rect.name = actor.name;
2197
- const ry = rect.height / 2;
2198
- const rx = ry / (2.5 + rect.height / 50);
2199
- const cylinderGroup = g.append("g");
2200
- const cylinderArc = g.append("g");
2201
- const cylinderPath = `M ${rect.x},${rect.y + ry}
2202
- a ${rx},${ry} 0 0 0 0,${rect.height}
2203
- h ${rect.width - 2 * rx}
2204
- a ${rx},${ry} 0 0 0 0,-${rect.height}
2205
- Z
2206
- `;
2207
- cylinderGroup.append("path").attr("d", cylinderPath);
2208
- cylinderArc.append("path").attr(
2209
- "d",
2210
- `M ${rect.x},${rect.y + ry}
2211
- a ${rx},${ry} 0 0 0 0,${rect.height}`
2212
- );
2213
- cylinderGroup.attr("transform", `translate(${rx}, ${-(rect.height / 2)})`);
2214
- cylinderArc.attr("transform", `translate(${rect.width - rx}, ${-rect.height / 2})`);
2215
- actor.rectData = rect;
2216
- if (look === "neo") {
2217
- cylinderGroup.attr("filter", "url(#drop-shadow)");
2218
- }
2219
- const actorCount = actorIndexMap.get(actor.name) ?? 0;
2220
- if (COLOR_THEMES.has(theme)) {
2221
- cylinderGroup.style("stroke", borderColorArray[actorCount % borderColorArray.length]);
2222
- cylinderGroup.style("fill", bkgColorArray[actorCount % borderColorArray.length]);
2223
- cylinderArc.style("stroke", borderColorArray[actorCount % borderColorArray.length]);
2224
- cylinderArc.style("fill", bkgColorArray[actorCount % borderColorArray.length]);
2225
- }
2226
- if (actor.properties?.icon) {
2227
- const iconSrc = actor.properties.icon.trim();
2228
- const iconX = rect.x + rect.width - 20;
2229
- const iconY = rect.y + 10;
2230
- if (iconSrc.charAt(0) === "@") {
2231
- drawEmbeddedImage(g, iconX, iconY, iconSrc.substr(1));
2232
- } else {
2233
- drawImage(g, iconX, iconY, iconSrc);
2234
- }
2235
- }
2236
- _drawTextCandidateFunc(conf2, hasKatex(actor.description))(
2237
- actor.description,
2238
- g,
2239
- rect.x,
2240
- rect.y,
2241
- rect.width,
2242
- rect.height,
2243
- { class: `actor ${ACTOR_BOX_CLASS}` },
2244
- conf2
2245
- );
2246
- let height = actor.height;
2247
- const lastPath = cylinderGroup.select("path:last-child");
2248
- if (lastPath.node()) {
2249
- const bounds2 = lastPath.node().getBBox();
2250
- actor.height = bounds2.height;
2251
- height = bounds2.height;
2252
- }
2253
- if (!isFooter) {
2254
- g.attr("data-et", "participant");
2255
- g.attr("data-type", "queue");
2256
- g.attr("data-id", actor.name);
2257
- }
2258
- return height;
2259
- }, "drawActorTypeQueue");
2260
- var drawActorTypeControl = /* @__PURE__ */ __name(function(elem, actor, conf2, isFooter, diagramId, actorIndexMap) {
2261
- const actorY = isFooter ? actor.stopy : actor.starty;
2262
- const center = actor.x + actor.width / 2;
2263
- const centerY = actorY + 75;
2264
- const { look, theme, themeVariables } = conf2;
2265
- const { bkgColorArray, borderColorArray, actorBorder, actorBkg } = themeVariables;
2266
- const line = elem.append("g").lower();
2267
- if (!isFooter) {
2268
- actorCnt++;
2269
- line.append("line").attr("id", "actor" + actorCnt).attr("x1", center).attr("y1", centerY).attr("x2", center).attr("y2", 2e3).attr("class", "actor-line 200").attr("stroke-width", "0.5px").attr("stroke", "#999").attr("name", actor.name).attr("data-et", "life-line").attr("data-id", actor.name);
2270
- actor.actorCnt = actorCnt;
2271
- }
2272
- const actElem = elem.append("g");
2273
- let cssClass = ACTOR_MAN_FIGURE_CLASS;
2274
- if (isFooter) {
2275
- cssClass += ` ${BOTTOM_ACTOR_CLASS}`;
2276
- } else {
2277
- cssClass += ` ${TOP_ACTOR_CLASS}`;
2278
- }
2279
- actElem.attr("class", cssClass);
2280
- actElem.attr("name", actor.name);
2281
- const rect = getNoteRect();
2282
- rect.x = actor.x;
2283
- rect.y = actorY;
2284
- rect.fill = "#eaeaea";
2285
- rect.width = actor.width;
2286
- rect.height = actor.height;
2287
- rect.class = "actor";
2288
- const cx = actor.x + actor.width / 2;
2289
- const cy = actorY + 32;
2290
- const r = 22;
2291
- actElem.append("defs").append("marker").attr("id", diagramId + "-filled-head-control").attr("refX", 11).attr("refY", 5.8).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "172.5").attr("stroke-width", 1.2).append("path").attr("d", "M 14.4 5.6 L 7.2 10.4 L 8.8 5.6 L 7.2 0.8 Z");
2292
- actElem.append("circle").attr("cx", cx).attr("cy", cy).attr("r", r).attr("filter", `${look === "neo" ? "url(#drop-shadow)" : ""}`);
2293
- actElem.append("line").attr("marker-end", "url(#" + diagramId + "-filled-head-control)").attr("transform", `translate(${cx}, ${cy - r})`);
2294
- const actorCount = actorIndexMap.get(actor.name) ?? 0;
2295
- if (COLOR_THEMES.has(theme)) {
2296
- actElem.style("stroke", borderColorArray[actorCount % borderColorArray.length]);
2297
- actElem.style("fill", bkgColorArray[actorCount % borderColorArray.length]);
2298
- } else {
2299
- actElem.style("stroke", actorBorder);
2300
- actElem.style("fill", actorBkg);
2301
- }
2302
- const bounds2 = actElem.node().getBBox();
2303
- actor.height = bounds2.height + 2 * (conf2?.sequence?.labelBoxHeight ?? 0);
2304
- _drawTextCandidateFunc(conf2, hasKatex(actor.description))(
2305
- actor.description,
2306
- actElem,
2307
- rect.x,
2308
- rect.y + r + (!isFooter ? 12 : 5),
2309
- rect.width,
2310
- rect.height,
2311
- { class: `actor ${ACTOR_MAN_FIGURE_CLASS}` },
2312
- conf2
2313
- );
2314
- if (!isFooter) {
2315
- actElem.attr("data-et", "participant");
2316
- actElem.attr("data-type", "control");
2317
- actElem.attr("data-id", actor.name);
2318
- }
2319
- return actor.height;
2320
- }, "drawActorTypeControl");
2321
- var drawActorTypeEntity = /* @__PURE__ */ __name(function(elem, actor, conf2, isFooter, actorIndexMap) {
2322
- const actorY = isFooter ? actor.stopy : actor.starty;
2323
- const center = actor.x + actor.width / 2;
2324
- const centerY = actorY + 75;
2325
- const { look, theme, themeVariables } = conf2;
2326
- const { bkgColorArray, borderColorArray } = themeVariables;
2327
- const line = elem.append("g").lower();
2328
- const actElem = elem.append("g");
2329
- let cssClass = "actor";
2330
- if (isFooter) {
2331
- cssClass += ` ${BOTTOM_ACTOR_CLASS}`;
2332
- } else {
2333
- cssClass += ` ${TOP_ACTOR_CLASS}`;
2334
- }
2335
- actElem.attr("class", cssClass);
2336
- actElem.attr("name", actor.name);
2337
- const rect = getNoteRect();
2338
- rect.x = actor.x;
2339
- rect.y = actorY;
2340
- rect.fill = "#eaeaea";
2341
- rect.width = actor.width;
2342
- rect.height = actor.height;
2343
- rect.class = "actor";
2344
- const cx = actor.x + actor.width / 2;
2345
- const cy = actorY + (!isFooter ? 25 : 10);
2346
- const r = 22;
2347
- actElem.append("circle").attr("cx", cx).attr("cy", cy).attr("r", r).attr("width", actor.width).attr("height", actor.height);
2348
- actElem.append("line").attr("x1", cx - r).attr("x2", cx + r).attr("y1", cy + r).attr("y2", cy + r).attr("stroke-width", 2);
2349
- if (look === "neo") {
2350
- actElem.attr("filter", "url(#drop-shadow)");
2351
- }
2352
- const actorCount = actorIndexMap.get(actor.name) ?? 0;
2353
- if (COLOR_THEMES.has(theme)) {
2354
- actElem.style("stroke", borderColorArray[actorCount % borderColorArray.length]);
2355
- actElem.style("fill", bkgColorArray[actorCount % borderColorArray.length]);
2356
- }
2357
- const bounds2 = actElem.node().getBBox();
2358
- actor.height = bounds2.height + (conf2?.sequence?.labelBoxHeight ?? 0);
2359
- if (!isFooter) {
2360
- actorCnt++;
2361
- line.append("line").attr("id", "actor" + actorCnt).attr("x1", center).attr("y1", centerY).attr("x2", center).attr("y2", 2e3).attr("class", "actor-line 200").attr("stroke-width", "0.5px").attr("stroke", "#999").attr("name", actor.name).attr("data-et", "life-line").attr("data-id", actor.name);
2362
- actor.actorCnt = actorCnt;
2363
- }
2364
- _drawTextCandidateFunc(conf2, hasKatex(actor.description))(
2365
- actor.description,
2366
- actElem,
2367
- rect.x,
2368
- rect.y + (!isFooter ? 30 : 15),
2369
- rect.width,
2370
- rect.height,
2371
- { class: `actor ${ACTOR_MAN_FIGURE_CLASS}` },
2372
- conf2
2373
- );
2374
- if (!isFooter) {
2375
- actElem.attr("transform", `translate(${0}, ${r / 2 - 5})`);
2376
- actElem.attr("data-et", "participant");
2377
- actElem.attr("data-type", "entity");
2378
- actElem.attr("data-id", actor.name);
2379
- } else {
2380
- actElem.attr("transform", `translate(${0}, ${r})`);
2381
- }
2382
- return actor.height;
2383
- }, "drawActorTypeEntity");
2384
- var drawActorTypeDatabase = /* @__PURE__ */ __name(function(elem, actor, conf2, isFooter, actorIndexMap) {
2385
- const actorY = isFooter ? actor.stopy : actor.starty;
2386
- const center = actor.x + actor.width / 2;
2387
- const centerY = actorY + actor.height + 2 * conf2.boxTextMargin;
2388
- const { theme, themeVariables, look } = conf2;
2389
- const { bkgColorArray, borderColorArray, actorBorder } = themeVariables;
2390
- const boxplusLineGroup = elem.append("g").lower();
2391
- let g = boxplusLineGroup;
2392
- if (!isFooter) {
2393
- actorCnt++;
2394
- if (Object.keys(actor.links || {}).length && !conf2.forceMenus) {
2395
- g.attr("onclick", popupMenuToggle(`actor${actorCnt}_popup`)).attr("cursor", "pointer");
2396
- }
2397
- g.append("line").attr("id", "actor" + actorCnt).attr("x1", center).attr("y1", centerY).attr("x2", center).attr("y2", 2e3).attr("class", "actor-line 200").attr("stroke-width", "0.5px").attr("stroke", "#999").attr("name", actor.name).attr("data-et", "life-line").attr("data-id", actor.name);
2398
- g = boxplusLineGroup.append("g");
2399
- actor.actorCnt = actorCnt;
2400
- if (actor.links != null) {
2401
- g.attr("id", "root-" + actorCnt);
2402
- }
2403
- if (look === "neo") {
2404
- g.attr("data-look", "neo");
2405
- }
2406
- }
2407
- const rect = getNoteRect();
2408
- let cssclass = "actor";
2409
- if (actor.properties?.class) {
2410
- cssclass = actor.properties.class;
2411
- } else {
2412
- rect.fill = "#eaeaea";
2413
- }
2414
- if (isFooter) {
2415
- cssclass += ` ${BOTTOM_ACTOR_CLASS}`;
2416
- } else {
2417
- cssclass += ` ${TOP_ACTOR_CLASS}`;
2418
- }
2419
- rect.x = actor.x;
2420
- rect.y = actorY;
2421
- rect.width = actor.width;
2422
- rect.height = actor.height;
2423
- rect.class = cssclass;
2424
- rect.name = actor.name;
2425
- rect.x = actor.x;
2426
- rect.y = actorY;
2427
- const w = rect.width / 3;
2428
- const h = rect.width / 3;
2429
- const rx = w / 2;
2430
- const ry = rx / (2.5 + w / 50);
2431
- const cylinderGroup = g.append("g");
2432
- cylinderGroup.attr("class", cssclass);
2433
- const d = `
2434
- M ${rect.x},${rect.y + ry}
2435
- a ${rx},${ry} 0 0 0 ${w},0
2436
- a ${rx},${ry} 0 0 0 -${w},0
2437
- l 0,${h - 2 * ry}
2438
- a ${rx},${ry} 0 0 0 ${w},0
2439
- l 0,-${h - 2 * ry}
2440
- `;
2441
- cylinderGroup.append("path").attr("d", d);
2442
- if (look === "neo") {
2443
- cylinderGroup.attr("filter", "url(#drop-shadow)");
2444
- }
2445
- const actorCount = actorIndexMap.get(actor.name) ?? 0;
2446
- if (COLOR_THEMES.has(theme)) {
2447
- cylinderGroup.style("stroke", borderColorArray[actorCount % borderColorArray.length]);
2448
- cylinderGroup.style("fill", bkgColorArray[actorCount % borderColorArray.length]);
2449
- } else {
2450
- cylinderGroup.style("stroke", actorBorder);
2451
- }
2452
- cylinderGroup.attr("transform", `translate(${w}, ${ry})`);
2453
- actor.rectData = rect;
2454
- _drawTextCandidateFunc(conf2, hasKatex(actor.description))(
2455
- actor.description,
2456
- g,
2457
- rect.x,
2458
- rect.y + 35,
2459
- rect.width,
2460
- rect.height,
2461
- { class: `actor ${ACTOR_BOX_CLASS}` },
2462
- conf2
2463
- );
2464
- const lastPath = cylinderGroup.select("path:last-child");
2465
- if (lastPath.node()) {
2466
- const bounds2 = lastPath.node().getBBox();
2467
- actor.height = bounds2.height + (conf2.sequence.labelBoxHeight ?? 0);
2468
- }
2469
- if (!isFooter) {
2470
- g.attr("data-et", "participant");
2471
- g.attr("data-type", "database");
2472
- g.attr("data-id", actor.name);
2473
- }
2474
- return actor.height;
2475
- }, "drawActorTypeDatabase");
2476
- var drawActorTypeBoundary = /* @__PURE__ */ __name(function(elem, actor, conf2, isFooter, actorIndexMap) {
2477
- const actorY = isFooter ? actor.stopy : actor.starty;
2478
- const center = actor.x + actor.width / 2;
2479
- const centerY = actorY + 80;
2480
- const radius = 22;
2481
- const line = elem.append("g").lower();
2482
- const { look, theme, themeVariables } = conf2;
2483
- const { bkgColorArray, borderColorArray, actorBorder } = themeVariables;
2484
- if (!isFooter) {
2485
- actorCnt++;
2486
- line.append("line").attr("id", "actor" + actorCnt).attr("x1", center).attr("y1", centerY).attr("x2", center).attr("y2", 2e3).attr("class", "actor-line 200").attr("stroke-width", "0.5px").attr("stroke", "#999").attr("name", actor.name).attr("data-et", "life-line").attr("data-id", actor.name);
2487
- actor.actorCnt = actorCnt;
2488
- }
2489
- const actElem = elem.append("g");
2490
- let cssClass = ACTOR_MAN_FIGURE_CLASS;
2491
- if (isFooter) {
2492
- cssClass += ` ${BOTTOM_ACTOR_CLASS}`;
2493
- } else {
2494
- cssClass += ` ${TOP_ACTOR_CLASS}`;
2495
- }
2496
- actElem.attr("class", cssClass);
2497
- actElem.attr("name", actor.name);
2498
- const rect = getNoteRect();
2499
- rect.x = actor.x;
2500
- rect.y = actorY;
2501
- rect.fill = "#eaeaea";
2502
- rect.width = actor.width;
2503
- rect.height = actor.height;
2504
- rect.class = "actor";
2505
- actElem.append("line").attr("id", "actor-man-torso" + actorCnt).attr("x1", actor.x + actor.width / 2 - radius * 2.5).attr("y1", actorY + 12).attr("x2", actor.x + actor.width / 2 - 15).attr("y2", actorY + 12);
2506
- actElem.append("line").attr("id", "actor-man-arms" + actorCnt).attr("x1", actor.x + actor.width / 2 - radius * 2.5).attr("y1", actorY + 2).attr("x2", actor.x + actor.width / 2 - radius * 2.5).attr("y2", actorY + 22);
2507
- actElem.append("circle").attr("cx", actor.x + actor.width / 2).attr("cy", actorY + 12).attr("r", radius);
2508
- if (look === "neo") {
2509
- actElem.attr("filter", "url(#drop-shadow)");
2510
- }
2511
- const actorCount = actorIndexMap.get(actor.name) ?? 0;
2512
- if (COLOR_THEMES.has(theme)) {
2513
- actElem.style("stroke", borderColorArray[actorCount % borderColorArray.length]);
2514
- actElem.style("fill", bkgColorArray[actorCount % borderColorArray.length]);
2515
- } else {
2516
- actElem.style("stroke", actorBorder);
2517
- }
2518
- const bounds2 = actElem.node().getBBox();
2519
- actor.height = bounds2.height + (conf2.sequence.labelBoxHeight ?? 0);
2520
- _drawTextCandidateFunc(conf2, hasKatex(actor.description))(
2521
- actor.description,
2522
- actElem,
2523
- rect.x,
2524
- rect.y + 15,
2525
- rect.width,
2526
- rect.height,
2527
- { class: `actor ${ACTOR_MAN_FIGURE_CLASS}` },
2528
- conf2
2529
- );
2530
- actElem.attr("transform", `translate(0,${radius / 2 + 10})`);
2531
- if (!isFooter) {
2532
- actElem.attr("data-et", "participant");
2533
- actElem.attr("data-type", "boundary");
2534
- actElem.attr("data-id", actor.name);
2535
- }
2536
- return actor.height;
2537
- }, "drawActorTypeBoundary");
2538
- var drawActorTypeActor = /* @__PURE__ */ __name(function(elem, actor, conf2, isFooter, actorIndexMap) {
2539
- const actorY = isFooter ? actor.stopy : actor.starty;
2540
- const center = actor.x + actor.width / 2;
2541
- const centerY = actorY + 80;
2542
- const { look, theme, themeVariables } = conf2;
2543
- const { bkgColorArray, borderColorArray, actorBorder } = themeVariables;
2544
- const line = elem.append("g").lower();
2545
- if (!isFooter) {
2546
- actorCnt++;
2547
- line.append("line").attr("id", "actor" + actorCnt).attr("x1", center).attr("y1", centerY).attr("x2", center).attr("y2", 2e3).attr("class", "actor-line 200").attr("stroke-width", "0.5px").attr("stroke", "#999").attr("name", actor.name).attr("data-et", "life-line").attr("data-id", actor.name);
2548
- actor.actorCnt = actorCnt;
2549
- }
2550
- const actElem = elem.append("g");
2551
- let cssClass = ACTOR_MAN_FIGURE_CLASS;
2552
- if (isFooter) {
2553
- cssClass += ` ${BOTTOM_ACTOR_CLASS}`;
2554
- } else {
2555
- cssClass += ` ${TOP_ACTOR_CLASS}`;
2556
- }
2557
- actElem.attr("class", cssClass);
2558
- actElem.attr("name", actor.name);
2559
- if (!isFooter) {
2560
- actElem.attr("data-et", "participant").attr("data-type", "actor").attr("data-id", actor.name);
2561
- }
2562
- const scale = look === "neo" ? 0.5 : 1;
2563
- const adjustedActorY = look === "neo" ? actorY + (1 - scale) * 30 : actorY;
2564
- actElem.append("line").attr("id", "actor-man-torso" + actorCnt).attr("x1", center).attr("y1", adjustedActorY + 25 * scale).attr("x2", center).attr("y2", adjustedActorY + 45 * scale);
2565
- actElem.append("line").attr("id", "actor-man-arms" + actorCnt).attr("x1", center - ACTOR_TYPE_WIDTH / 2 * scale).attr("y1", adjustedActorY + 33 * scale).attr("x2", center + ACTOR_TYPE_WIDTH / 2 * scale).attr("y2", adjustedActorY + 33 * scale);
2566
- actElem.append("line").attr("x1", center - ACTOR_TYPE_WIDTH / 2 * scale).attr("y1", adjustedActorY + 60 * scale).attr("x2", center).attr("y2", adjustedActorY + 45 * scale);
2567
- actElem.append("line").attr("x1", center).attr("y1", adjustedActorY + 45 * scale).attr("x2", center + (ACTOR_TYPE_WIDTH / 2 - 2) * scale).attr("y2", adjustedActorY + 60 * scale);
2568
- const circle = actElem.append("circle");
2569
- circle.attr("cx", actor.x + actor.width / 2);
2570
- circle.attr("cy", adjustedActorY + 10 * scale);
2571
- circle.attr("r", 15 * scale);
2572
- circle.attr("width", actor.width * scale);
2573
- circle.attr("height", actor.height * scale);
2574
- const bounds2 = actElem.node().getBBox();
2575
- actor.height = bounds2.height;
2576
- const rect = getNoteRect();
2577
- rect.x = actor.x;
2578
- rect.y = adjustedActorY;
2579
- rect.fill = "#eaeaea";
2580
- rect.width = actor.width;
2581
- rect.height = actor.height / scale;
2582
- rect.class = "actor";
2583
- rect.rx = 3;
2584
- rect.ry = 3;
2585
- const actorCount = actorIndexMap.get(actor.name) ?? 0;
2586
- if (COLOR_THEMES.has(theme)) {
2587
- actElem.style("stroke", borderColorArray[actorCount % borderColorArray.length]);
2588
- actElem.style("fill", bkgColorArray[actorCount % borderColorArray.length]);
2589
- } else {
2590
- actElem.style("stroke", actorBorder);
2591
- }
2592
- _drawTextCandidateFunc(conf2, hasKatex(actor.description))(
2593
- actor.description,
2594
- actElem,
2595
- rect.x,
2596
- adjustedActorY + 35 * scale - (look === "neo" ? 10 : 0),
2597
- rect.width,
2598
- rect.height,
2599
- { class: `actor ${ACTOR_MAN_FIGURE_CLASS}` },
2600
- conf2
2601
- );
2602
- return actor.height;
2603
- }, "drawActorTypeActor");
2604
- var drawActor = /* @__PURE__ */ __name(async function(elem, actor, conf2, isFooter, diagramId, diagObj, actorIndexMap) {
2605
- const resolvedActorIndexMap = actorIndexMap ?? new Map(
2606
- [...diagObj.db.getActors().values()].map((participant, index) => [participant.name, index])
2607
- );
2608
- switch (actor.type) {
2609
- case "actor":
2610
- return await drawActorTypeActor(elem, actor, conf2, isFooter, resolvedActorIndexMap);
2611
- case "participant":
2612
- return await drawActorTypeParticipant(elem, actor, conf2, isFooter, resolvedActorIndexMap);
2613
- case "boundary":
2614
- return await drawActorTypeBoundary(elem, actor, conf2, isFooter, resolvedActorIndexMap);
2615
- case "control":
2616
- return await drawActorTypeControl(
2617
- elem,
2618
- actor,
2619
- conf2,
2620
- isFooter,
2621
- diagramId,
2622
- resolvedActorIndexMap
2623
- );
2624
- case "entity":
2625
- return await drawActorTypeEntity(elem, actor, conf2, isFooter, resolvedActorIndexMap);
2626
- case "database":
2627
- return await drawActorTypeDatabase(elem, actor, conf2, isFooter, resolvedActorIndexMap);
2628
- case "collections":
2629
- return await drawActorTypeCollections(elem, actor, conf2, isFooter, resolvedActorIndexMap);
2630
- case "queue":
2631
- return await drawActorTypeQueue(elem, actor, conf2, isFooter, resolvedActorIndexMap);
2632
- }
2633
- }, "drawActor");
2634
- var drawBox = /* @__PURE__ */ __name(function(elem, box, conf2) {
2635
- const boxplusTextGroup = elem.append("g");
2636
- const g = boxplusTextGroup;
2637
- drawBackgroundRect2(g, box);
2638
- if (box.name) {
2639
- _drawTextCandidateFunc(conf2)(
2640
- box.name,
2641
- g,
2642
- box.x,
2643
- box.y + conf2.boxTextMargin + (box.textMaxHeight || 0) / 2,
2644
- box.width,
2645
- 0,
2646
- { class: "text" },
2647
- conf2
2648
- );
2649
- }
2650
- g.lower();
2651
- }, "drawBox");
2652
- var anchorElement = /* @__PURE__ */ __name(function(elem) {
2653
- return elem.append("g");
2654
- }, "anchorElement");
2655
- var drawActivation = /* @__PURE__ */ __name(function(_elem, bounds2, verticalPos, conf2, actorActivations2, diagObj, actorIndexMap) {
2656
- const { theme, themeVariables } = conf2;
2657
- const { bkgColorArray, borderColorArray, mainBkg } = themeVariables;
2658
- const rect = getNoteRect();
2659
- const g = bounds2.anchored;
2660
- const actor = bounds2.actor;
2661
- rect.x = bounds2.startx;
2662
- rect.y = bounds2.starty;
2663
- rect.class = "activation" + actorActivations2 % 3;
2664
- rect.width = bounds2.stopx - bounds2.startx;
2665
- rect.height = verticalPos - bounds2.starty;
2666
- const rectElem = drawRect2(g, rect);
2667
- const resolvedActorIndexMap = actorIndexMap ?? new Map(
2668
- [...diagObj.db.getActors().values()].map((participant, index) => [participant.name, index])
2669
- );
2670
- const actorCount = resolvedActorIndexMap.get(actor) ?? 0;
2671
- if (COLOR_THEMES.has(theme)) {
2672
- rectElem.style("stroke", borderColorArray[actorCount % borderColorArray.length]);
2673
- rectElem.style("fill", bkgColorArray[actorCount % borderColorArray.length] ?? mainBkg);
2674
- }
2675
- }, "drawActivation");
2676
- var drawLoop = /* @__PURE__ */ __name(async function(elem, loopModel, labelText, conf2, msg) {
2677
- const {
2678
- boxMargin,
2679
- boxTextMargin,
2680
- labelBoxHeight,
2681
- labelBoxWidth,
2682
- messageFontFamily: fontFamily,
2683
- messageFontSize: fontSize,
2684
- messageFontWeight: fontWeight
2685
- } = conf2;
2686
- const g = elem.append("g").attr("data-et", "control-structure").attr("data-id", "i" + msg.id);
2687
- const drawLoopLine = /* @__PURE__ */ __name(function(startx, starty, stopx, stopy) {
2688
- return g.append("line").attr("x1", startx).attr("y1", starty).attr("x2", stopx).attr("y2", stopy).attr("class", "loopLine");
2689
- }, "drawLoopLine");
2690
- drawLoopLine(loopModel.startx, loopModel.starty, loopModel.stopx, loopModel.starty);
2691
- drawLoopLine(loopModel.stopx, loopModel.starty, loopModel.stopx, loopModel.stopy);
2692
- drawLoopLine(loopModel.startx, loopModel.stopy, loopModel.stopx, loopModel.stopy);
2693
- drawLoopLine(loopModel.startx, loopModel.starty, loopModel.startx, loopModel.stopy);
2694
- if (loopModel.sections !== void 0) {
2695
- loopModel.sections.forEach(function(item) {
2696
- drawLoopLine(loopModel.startx, item.y, loopModel.stopx, item.y).style(
2697
- "stroke-dasharray",
2698
- "3, 3"
2699
- );
2700
- });
2701
- }
2702
- let txt = getTextObj();
2703
- txt.text = labelText;
2704
- txt.x = loopModel.startx;
2705
- txt.y = loopModel.starty;
2706
- txt.fontFamily = fontFamily;
2707
- txt.fontSize = fontSize;
2708
- txt.fontWeight = fontWeight;
2709
- txt.anchor = "middle";
2710
- txt.valign = "middle";
2711
- txt.tspan = false;
2712
- txt.width = Math.max(labelBoxWidth ?? 0, 50);
2713
- txt.height = labelBoxHeight + (conf2.look === "neo" ? 15 : 0) || 20;
2714
- txt.textMargin = boxTextMargin;
2715
- txt.class = "labelText";
2716
- drawLabel(g, txt);
2717
- txt = getTextObj2();
2718
- txt.text = loopModel.title;
2719
- txt.x = loopModel.startx + labelBoxWidth / 2 + (loopModel.stopx - loopModel.startx) / 2;
2720
- txt.y = loopModel.starty + boxMargin + boxTextMargin;
2721
- txt.anchor = "middle";
2722
- txt.valign = "middle";
2723
- txt.textMargin = boxTextMargin;
2724
- txt.class = "loopText";
2725
- txt.fontFamily = fontFamily;
2726
- txt.fontSize = fontSize;
2727
- txt.fontWeight = fontWeight;
2728
- txt.wrap = true;
2729
- let textElem = hasKatex(txt.text) ? await drawKatex(g, txt, loopModel) : drawText(g, txt);
2730
- if (loopModel.sectionTitles !== void 0) {
2731
- for (const [idx, item] of Object.entries(loopModel.sectionTitles)) {
2732
- if (item.message) {
2733
- txt.text = item.message;
2734
- txt.x = loopModel.startx + (loopModel.stopx - loopModel.startx) / 2;
2735
- txt.y = loopModel.sections[idx].y + boxMargin + boxTextMargin;
2736
- txt.class = "sectionTitle";
2737
- txt.anchor = "middle";
2738
- txt.valign = "middle";
2739
- txt.tspan = false;
2740
- txt.fontFamily = fontFamily;
2741
- txt.fontSize = fontSize;
2742
- txt.fontWeight = fontWeight;
2743
- txt.wrap = loopModel.wrap;
2744
- if (hasKatex(txt.text)) {
2745
- loopModel.starty = loopModel.sections[idx].y;
2746
- await drawKatex(g, txt, loopModel);
2747
- } else {
2748
- drawText(g, txt);
2749
- }
2750
- let sectionHeight = Math.round(
2751
- textElem.map((te) => (te._groups || te)[0][0].getBBox().height).reduce((acc, curr) => acc + curr)
2752
- );
2753
- loopModel.sections[idx].height += sectionHeight - (boxMargin + boxTextMargin);
2754
- }
2755
- }
2756
- }
2757
- loopModel.height = Math.round(loopModel.stopy - loopModel.starty);
2758
- return g;
2759
- }, "drawLoop");
2760
- var drawBackgroundRect2 = /* @__PURE__ */ __name(function(elem, bounds2) {
2761
- drawBackgroundRect(elem, bounds2);
2762
- }, "drawBackgroundRect");
2763
- var insertDatabaseIcon = /* @__PURE__ */ __name(function(elem, id) {
2764
- elem.append("defs").append("symbol").attr("id", id + "-database").attr("fill-rule", "evenodd").attr("clip-rule", "evenodd").append("path").attr("transform", "scale(.5)").attr(
2765
- "d",
2766
- "M12.258.001l.256.004.255.005.253.008.251.01.249.012.247.015.246.016.242.019.241.02.239.023.236.024.233.027.231.028.229.031.225.032.223.034.22.036.217.038.214.04.211.041.208.043.205.045.201.046.198.048.194.05.191.051.187.053.183.054.18.056.175.057.172.059.168.06.163.061.16.063.155.064.15.066.074.033.073.033.071.034.07.034.069.035.068.035.067.035.066.035.064.036.064.036.062.036.06.036.06.037.058.037.058.037.055.038.055.038.053.038.052.038.051.039.05.039.048.039.047.039.045.04.044.04.043.04.041.04.04.041.039.041.037.041.036.041.034.041.033.042.032.042.03.042.029.042.027.042.026.043.024.043.023.043.021.043.02.043.018.044.017.043.015.044.013.044.012.044.011.045.009.044.007.045.006.045.004.045.002.045.001.045v17l-.001.045-.002.045-.004.045-.006.045-.007.045-.009.044-.011.045-.012.044-.013.044-.015.044-.017.043-.018.044-.02.043-.021.043-.023.043-.024.043-.026.043-.027.042-.029.042-.03.042-.032.042-.033.042-.034.041-.036.041-.037.041-.039.041-.04.041-.041.04-.043.04-.044.04-.045.04-.047.039-.048.039-.05.039-.051.039-.052.038-.053.038-.055.038-.055.038-.058.037-.058.037-.06.037-.06.036-.062.036-.064.036-.064.036-.066.035-.067.035-.068.035-.069.035-.07.034-.071.034-.073.033-.074.033-.15.066-.155.064-.16.063-.163.061-.168.06-.172.059-.175.057-.18.056-.183.054-.187.053-.191.051-.194.05-.198.048-.201.046-.205.045-.208.043-.211.041-.214.04-.217.038-.22.036-.223.034-.225.032-.229.031-.231.028-.233.027-.236.024-.239.023-.241.02-.242.019-.246.016-.247.015-.249.012-.251.01-.253.008-.255.005-.256.004-.258.001-.258-.001-.256-.004-.255-.005-.253-.008-.251-.01-.249-.012-.247-.015-.245-.016-.243-.019-.241-.02-.238-.023-.236-.024-.234-.027-.231-.028-.228-.031-.226-.032-.223-.034-.22-.036-.217-.038-.214-.04-.211-.041-.208-.043-.204-.045-.201-.046-.198-.048-.195-.05-.19-.051-.187-.053-.184-.054-.179-.056-.176-.057-.172-.059-.167-.06-.164-.061-.159-.063-.155-.064-.151-.066-.074-.033-.072-.033-.072-.034-.07-.034-.069-.035-.068-.035-.067-.035-.066-.035-.064-.036-.063-.036-.062-.036-.061-.036-.06-.037-.058-.037-.057-.037-.056-.038-.055-.038-.053-.038-.052-.038-.051-.039-.049-.039-.049-.039-.046-.039-.046-.04-.044-.04-.043-.04-.041-.04-.04-.041-.039-.041-.037-.041-.036-.041-.034-.041-.033-.042-.032-.042-.03-.042-.029-.042-.027-.042-.026-.043-.024-.043-.023-.043-.021-.043-.02-.043-.018-.044-.017-.043-.015-.044-.013-.044-.012-.044-.011-.045-.009-.044-.007-.045-.006-.045-.004-.045-.002-.045-.001-.045v-17l.001-.045.002-.045.004-.045.006-.045.007-.045.009-.044.011-.045.012-.044.013-.044.015-.044.017-.043.018-.044.02-.043.021-.043.023-.043.024-.043.026-.043.027-.042.029-.042.03-.042.032-.042.033-.042.034-.041.036-.041.037-.041.039-.041.04-.041.041-.04.043-.04.044-.04.046-.04.046-.039.049-.039.049-.039.051-.039.052-.038.053-.038.055-.038.056-.038.057-.037.058-.037.06-.037.061-.036.062-.036.063-.036.064-.036.066-.035.067-.035.068-.035.069-.035.07-.034.072-.034.072-.033.074-.033.151-.066.155-.064.159-.063.164-.061.167-.06.172-.059.176-.057.179-.056.184-.054.187-.053.19-.051.195-.05.198-.048.201-.046.204-.045.208-.043.211-.041.214-.04.217-.038.22-.036.223-.034.226-.032.228-.031.231-.028.234-.027.236-.024.238-.023.241-.02.243-.019.245-.016.247-.015.249-.012.251-.01.253-.008.255-.005.256-.004.258-.001.258.001zm-9.258 20.499v.01l.001.021.003.021.004.022.005.021.006.022.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.023.018.024.019.024.021.024.022.025.023.024.024.025.052.049.056.05.061.051.066.051.07.051.075.051.079.052.084.052.088.052.092.052.097.052.102.051.105.052.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.048.144.049.147.047.152.047.155.047.16.045.163.045.167.043.171.043.176.041.178.041.183.039.187.039.19.037.194.035.197.035.202.033.204.031.209.03.212.029.216.027.219.025.222.024.226.021.23.02.233.018.236.016.24.015.243.012.246.01.249.008.253.005.256.004.259.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.021.224-.024.22-.026.216-.027.212-.028.21-.031.205-.031.202-.034.198-.034.194-.036.191-.037.187-.039.183-.04.179-.04.175-.042.172-.043.168-.044.163-.045.16-.046.155-.046.152-.047.148-.048.143-.049.139-.049.136-.05.131-.05.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.053.083-.051.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.05.023-.024.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.023.01-.022.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.127l-.077.055-.08.053-.083.054-.085.053-.087.052-.09.052-.093.051-.095.05-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.045-.118.044-.12.043-.122.042-.124.042-.126.041-.128.04-.13.04-.132.038-.134.038-.135.037-.138.037-.139.035-.142.035-.143.034-.144.033-.147.032-.148.031-.15.03-.151.03-.153.029-.154.027-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.01-.179.008-.179.008-.181.006-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.006-.179-.008-.179-.008-.178-.01-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.027-.153-.029-.151-.03-.15-.03-.148-.031-.146-.032-.145-.033-.143-.034-.141-.035-.14-.035-.137-.037-.136-.037-.134-.038-.132-.038-.13-.04-.128-.04-.126-.041-.124-.042-.122-.042-.12-.044-.117-.043-.116-.045-.113-.045-.112-.046-.109-.047-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.05-.093-.052-.09-.051-.087-.052-.085-.053-.083-.054-.08-.054-.077-.054v4.127zm0-5.654v.011l.001.021.003.021.004.021.005.022.006.022.007.022.009.022.01.022.011.023.012.023.013.023.015.024.016.023.017.024.018.024.019.024.021.024.022.024.023.025.024.024.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.052.11.051.114.051.119.052.123.05.127.051.131.05.135.049.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.044.171.042.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.022.23.02.233.018.236.016.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.012.241-.015.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.048.139-.05.136-.049.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.051.051-.049.023-.025.023-.024.021-.025.02-.024.019-.024.018-.024.017-.024.015-.023.014-.023.013-.024.012-.022.01-.023.01-.023.008-.022.006-.022.006-.022.004-.021.004-.022.001-.021.001-.021v-4.139l-.077.054-.08.054-.083.054-.085.052-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.044-.118.044-.12.044-.122.042-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.035-.143.033-.144.033-.147.033-.148.031-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.009-.179.009-.179.007-.181.007-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.007-.179-.007-.179-.009-.178-.009-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.031-.146-.033-.145-.033-.143-.033-.141-.035-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.04-.126-.041-.124-.042-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.051-.093-.051-.09-.051-.087-.053-.085-.052-.083-.054-.08-.054-.077-.054v4.139zm0-5.666v.011l.001.02.003.022.004.021.005.022.006.021.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.024.018.023.019.024.021.025.022.024.023.024.024.025.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.051.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.043.171.043.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.021.23.02.233.018.236.017.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.013.241-.014.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.049.139-.049.136-.049.131-.051.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.049.023-.025.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.022.01-.023.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.153l-.077.054-.08.054-.083.053-.085.053-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.048-.105.048-.106.048-.109.046-.111.046-.114.046-.115.044-.118.044-.12.043-.122.043-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.034-.143.034-.144.033-.147.032-.148.032-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.024-.161.024-.162.023-.163.023-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.01-.178.01-.179.009-.179.007-.181.006-.182.006-.182.004-.184.003-.184.001-.185.001-.185-.001-.184-.001-.184-.003-.182-.004-.182-.006-.181-.006-.179-.007-.179-.009-.178-.01-.176-.01-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.023-.162-.023-.161-.024-.159-.024-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.032-.146-.032-.145-.033-.143-.034-.141-.034-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.041-.126-.041-.124-.041-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.048-.105-.048-.102-.048-.1-.05-.097-.049-.095-.051-.093-.051-.09-.052-.087-.052-.085-.053-.083-.053-.08-.054-.077-.054v4.153zm8.74-8.179l-.257.004-.254.005-.25.008-.247.011-.244.012-.241.014-.237.016-.233.018-.231.021-.226.022-.224.023-.22.026-.216.027-.212.028-.21.031-.205.032-.202.033-.198.034-.194.036-.191.038-.187.038-.183.04-.179.041-.175.042-.172.043-.168.043-.163.045-.16.046-.155.046-.152.048-.148.048-.143.048-.139.049-.136.05-.131.05-.126.051-.123.051-.118.051-.114.052-.11.052-.106.052-.101.052-.096.052-.092.052-.088.052-.083.052-.079.052-.074.051-.07.052-.065.051-.06.05-.056.05-.051.05-.023.025-.023.024-.021.024-.02.025-.019.024-.018.024-.017.023-.015.024-.014.023-.013.023-.012.023-.01.023-.01.022-.008.022-.006.023-.006.021-.004.022-.004.021-.001.021-.001.021.001.021.001.021.004.021.004.022.006.021.006.023.008.022.01.022.01.023.012.023.013.023.014.023.015.024.017.023.018.024.019.024.02.025.021.024.023.024.023.025.051.05.056.05.06.05.065.051.07.052.074.051.079.052.083.052.088.052.092.052.096.052.101.052.106.052.11.052.114.052.118.051.123.051.126.051.131.05.136.05.139.049.143.048.148.048.152.048.155.046.16.046.163.045.168.043.172.043.175.042.179.041.183.04.187.038.191.038.194.036.198.034.202.033.205.032.21.031.212.028.216.027.22.026.224.023.226.022.231.021.233.018.237.016.241.014.244.012.247.011.25.008.254.005.257.004.26.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.022.224-.023.22-.026.216-.027.212-.028.21-.031.205-.032.202-.033.198-.034.194-.036.191-.038.187-.038.183-.04.179-.041.175-.042.172-.043.168-.043.163-.045.16-.046.155-.046.152-.048.148-.048.143-.048.139-.049.136-.05.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.05.051-.05.023-.025.023-.024.021-.024.02-.025.019-.024.018-.024.017-.023.015-.024.014-.023.013-.023.012-.023.01-.023.01-.022.008-.022.006-.023.006-.021.004-.022.004-.021.001-.021.001-.021-.001-.021-.001-.021-.004-.021-.004-.022-.006-.021-.006-.023-.008-.022-.01-.022-.01-.023-.012-.023-.013-.023-.014-.023-.015-.024-.017-.023-.018-.024-.019-.024-.02-.025-.021-.024-.023-.024-.023-.025-.051-.05-.056-.05-.06-.05-.065-.051-.07-.052-.074-.051-.079-.052-.083-.052-.088-.052-.092-.052-.096-.052-.101-.052-.106-.052-.11-.052-.114-.052-.118-.051-.123-.051-.126-.051-.131-.05-.136-.05-.139-.049-.143-.048-.148-.048-.152-.048-.155-.046-.16-.046-.163-.045-.168-.043-.172-.043-.175-.042-.179-.041-.183-.04-.187-.038-.191-.038-.194-.036-.198-.034-.202-.033-.205-.032-.21-.031-.212-.028-.216-.027-.22-.026-.224-.023-.226-.022-.231-.021-.233-.018-.237-.016-.241-.014-.244-.012-.247-.011-.25-.008-.254-.005-.257-.004-.26-.001-.26.001z"
2767
- );
2768
- }, "insertDatabaseIcon");
2769
- var insertComputerIcon = /* @__PURE__ */ __name(function(elem, id) {
2770
- elem.append("defs").append("symbol").attr("id", id + "-computer").attr("width", "24").attr("height", "24").append("path").attr("transform", "scale(.5)").attr(
2771
- "d",
2772
- "M2 2v13h20v-13h-20zm18 11h-16v-9h16v9zm-10.228 6l.466-1h3.524l.467 1h-4.457zm14.228 3h-24l2-6h2.104l-1.33 4h18.45l-1.297-4h2.073l2 6zm-5-10h-14v-7h14v7z"
2773
- );
2774
- }, "insertComputerIcon");
2775
- var insertClockIcon = /* @__PURE__ */ __name(function(elem, id) {
2776
- elem.append("defs").append("symbol").attr("id", id + "-clock").attr("width", "24").attr("height", "24").append("path").attr("transform", "scale(.5)").attr(
2777
- "d",
2778
- "M12 2c5.514 0 10 4.486 10 10s-4.486 10-10 10-10-4.486-10-10 4.486-10 10-10zm0-2c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12zm5.848 12.459c.202.038.202.333.001.372-1.907.361-6.045 1.111-6.547 1.111-.719 0-1.301-.582-1.301-1.301 0-.512.77-5.447 1.125-7.445.034-.192.312-.181.343.014l.985 6.238 5.394 1.011z"
2779
- );
2780
- }, "insertClockIcon");
2781
- var insertArrowHead = /* @__PURE__ */ __name(function(elem, id) {
2782
- elem.append("defs").append("marker").attr("id", id + "-arrowhead").attr("refX", 7.9).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto-start-reverse").append("path").attr("d", "M -1 0 L 10 5 L 0 10 z");
2783
- }, "insertArrowHead");
2784
- var insertArrowFilledHead = /* @__PURE__ */ __name(function(elem, id) {
2785
- elem.append("defs").append("marker").attr("id", id + "-filled-head").attr("refX", 15.5).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");
2786
- }, "insertArrowFilledHead");
2787
- var insertSequenceNumber = /* @__PURE__ */ __name(function(elem, id) {
2788
- elem.append("defs").append("marker").attr("id", id + "-sequencenumber").attr("refX", 15).attr("refY", 15).attr("markerWidth", 60).attr("markerHeight", 40).attr("orient", "auto").append("circle").attr("cx", 15).attr("cy", 15).attr("r", 6);
2789
- }, "insertSequenceNumber");
2790
- var insertArrowCrossHead = /* @__PURE__ */ __name(function(elem, id) {
2791
- const defs = elem.append("defs");
2792
- const marker = defs.append("marker").attr("id", id + "-crosshead").attr("markerWidth", 15).attr("markerHeight", 8).attr("orient", "auto").attr("refX", 4).attr("refY", 4.5);
2793
- marker.append("path").attr("fill", "none").attr("stroke", "#000000").style("stroke-dasharray", "0, 0").attr("stroke-width", "1pt").attr("d", "M 1,2 L 6,7 M 6,2 L 1,7");
2794
- }, "insertArrowCrossHead");
2795
- var insertDropShadow = /* @__PURE__ */ __name(function(elem, conf2) {
2796
- const { theme } = conf2;
2797
- elem.append("defs").append("filter").attr("id", "drop-shadow").attr("height", "130%").attr("width", "130%").append("feDropShadow").attr("dx", "4").attr("dy", "4").attr("stdDeviation", 0).attr("flood-opacity", "0.06").attr("flood-color", `${theme === "redux" || theme === "redux-color" ? "#000000" : "#FFFFFF"}`);
2798
- }, "insertDropShadow");
2799
- var getTextObj2 = /* @__PURE__ */ __name(function() {
2800
- return {
2801
- x: 0,
2802
- y: 0,
2803
- fill: void 0,
2804
- anchor: void 0,
2805
- style: "#666",
2806
- width: void 0,
2807
- height: void 0,
2808
- textMargin: 0,
2809
- rx: 0,
2810
- ry: 0,
2811
- tspan: true,
2812
- valign: void 0
2813
- };
2814
- }, "getTextObj");
2815
- var getNoteRect2 = /* @__PURE__ */ __name(function() {
2816
- return {
2817
- x: 0,
2818
- y: 0,
2819
- fill: "#EDF2AE",
2820
- stroke: "#666",
2821
- width: 100,
2822
- anchor: "start",
2823
- height: 100,
2824
- rx: 0,
2825
- ry: 0
2826
- };
2827
- }, "getNoteRect");
2828
- var _drawTextCandidateFunc = /* @__PURE__ */ (function() {
2829
- function byText(content, g, x, y, width, height, textAttrs) {
2830
- const text = g.append("text").attr("x", x + width / 2).attr("y", y + height / 2 + 5).style("text-anchor", "middle").text(content);
2831
- _setTextAttrs(text, textAttrs);
2832
- }
2833
- __name(byText, "byText");
2834
- function byTspan(content, g, x, y, width, height, textAttrs, conf2) {
2835
- const { actorFontSize, actorFontFamily, actorFontWeight } = conf2;
2836
- const [_actorFontSize, _actorFontSizePx] = parseFontSize(actorFontSize);
2837
- const lines = content.split(common_default.lineBreakRegex);
2838
- for (let i = 0; i < lines.length; i++) {
2839
- const dy = i * _actorFontSize - _actorFontSize * (lines.length - 1) / 2;
2840
- const text = g.append("text").attr("x", x + width / 2).attr("y", y).style("text-anchor", "middle").style("font-size", _actorFontSizePx).style("font-weight", actorFontWeight).style("font-family", actorFontFamily);
2841
- text.append("tspan").attr("x", x + width / 2).attr("dy", dy).text(lines[i]);
2842
- text.attr("y", y + height / 2).attr("dominant-baseline", "central").attr("alignment-baseline", "central");
2843
- _setTextAttrs(text, textAttrs);
2844
- }
2845
- }
2846
- __name(byTspan, "byTspan");
2847
- function byFo(content, g, x, y, width, height, textAttrs, conf2) {
2848
- const s = g.append("switch");
2849
- const f = s.append("foreignObject").attr("x", x).attr("y", y).attr("width", width).attr("height", height);
2850
- const text = f.append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%");
2851
- text.append("div").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(content);
2852
- byTspan(content, s, x, y, width, height, textAttrs, conf2);
2853
- _setTextAttrs(text, textAttrs);
2854
- }
2855
- __name(byFo, "byFo");
2856
- async function byKatex(content, g, x, y, width, height, textAttrs, conf2) {
2857
- const dim = await calculateMathMLDimensions(content, getConfig());
2858
- const s = g.append("switch");
2859
- const f = s.append("foreignObject").attr("x", x + width / 2 - dim.width / 2).attr("y", y + height / 2 - dim.height / 2).attr("width", dim.width).attr("height", dim.height);
2860
- const text = f.append("xhtml:div").style("height", "100%").style("width", "100%");
2861
- text.append("div").style("text-align", "center").style("vertical-align", "middle").html(await renderKatexSanitized(content, getConfig()));
2862
- byTspan(content, s, x, y, width, height, textAttrs, conf2);
2863
- _setTextAttrs(text, textAttrs);
2864
- }
2865
- __name(byKatex, "byKatex");
2866
- function _setTextAttrs(toText, fromTextAttrsDict) {
2867
- for (const key in fromTextAttrsDict) {
2868
- if (fromTextAttrsDict.hasOwnProperty(key)) {
2869
- toText.attr(key, fromTextAttrsDict[key]);
2870
- }
2871
- }
2872
- }
2873
- __name(_setTextAttrs, "_setTextAttrs");
2874
- return function(conf2, hasKatex2 = false) {
2875
- if (hasKatex2) {
2876
- return byKatex;
2877
- }
2878
- return conf2.textPlacement === "fo" ? byFo : conf2.textPlacement === "old" ? byText : byTspan;
2879
- };
2880
- })();
2881
- var _drawMenuItemTextCandidateFunc = /* @__PURE__ */ (function() {
2882
- function byText(content, g, x, y, width, height, textAttrs) {
2883
- const text = g.append("text").attr("x", x).attr("y", y).style("text-anchor", "start").text(content);
2884
- _setTextAttrs(text, textAttrs);
2885
- }
2886
- __name(byText, "byText");
2887
- function byTspan(content, g, x, y, width, height, textAttrs, conf2) {
2888
- const { actorFontSize, actorFontFamily, actorFontWeight } = conf2;
2889
- const lines = content.split(common_default.lineBreakRegex);
2890
- for (let i = 0; i < lines.length; i++) {
2891
- const dy = i * actorFontSize - actorFontSize * (lines.length - 1) / 2;
2892
- const text = g.append("text").attr("x", x).attr("y", y).style("text-anchor", "start").style("font-size", actorFontSize).style("font-weight", actorFontWeight).style("font-family", actorFontFamily);
2893
- text.append("tspan").attr("x", x).attr("dy", dy).text(lines[i]);
2894
- text.attr("y", y + height / 2).attr("dominant-baseline", "central").attr("alignment-baseline", "central");
2895
- _setTextAttrs(text, textAttrs);
2896
- }
2897
- }
2898
- __name(byTspan, "byTspan");
2899
- function byFo(content, g, x, y, width, height, textAttrs, conf2) {
2900
- const s = g.append("switch");
2901
- const f = s.append("foreignObject").attr("x", x).attr("y", y).attr("width", width).attr("height", height);
2902
- const text = f.append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%");
2903
- text.append("div").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(content);
2904
- byTspan(content, s, x, y, width, height, textAttrs, conf2);
2905
- _setTextAttrs(text, textAttrs);
2906
- }
2907
- __name(byFo, "byFo");
2908
- function _setTextAttrs(toText, fromTextAttrsDict) {
2909
- for (const key in fromTextAttrsDict) {
2910
- if (fromTextAttrsDict.hasOwnProperty(key)) {
2911
- toText.attr(key, fromTextAttrsDict[key]);
2912
- }
2913
- }
2914
- }
2915
- __name(_setTextAttrs, "_setTextAttrs");
2916
- return function(conf2) {
2917
- return conf2.textPlacement === "fo" ? byFo : conf2.textPlacement === "old" ? byText : byTspan;
2918
- };
2919
- })();
2920
- var insertSolidTopArrowHead = /* @__PURE__ */ __name(function(elem, id) {
2921
- elem.append("defs").append("marker").attr("id", id + "-solidTopArrowHead").attr("refX", 7.9).attr("refY", 7.25).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto-start-reverse").append("path").attr("d", "M 0 0 L 10 8 L 0 8 z");
2922
- }, "insertSolidTopArrowHead");
2923
- var insertSolidBottomArrowHead = /* @__PURE__ */ __name(function(elem, id) {
2924
- elem.append("defs").append("marker").attr("id", id + "-solidBottomArrowHead").attr("refX", 7.9).attr("refY", 0.75).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto-start-reverse").append("path").attr("d", "M 0 0 L 10 0 L 0 8 z");
2925
- }, "insertSolidBottomArrowHead");
2926
- var insertStickTopArrowHead = /* @__PURE__ */ __name(function(elem, id) {
2927
- elem.append("defs").append("marker").attr("id", id + "-stickTopArrowHead").attr("refX", 7.5).attr("refY", 7).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto-start-reverse").append("path").attr("d", "M 0 0 L 7 7").attr("stroke", "black").attr("stroke-width", 1.5).attr("fill", "none");
2928
- }, "insertStickTopArrowHead");
2929
- var insertStickBottomArrowHead = /* @__PURE__ */ __name(function(elem, id) {
2930
- elem.append("defs").append("marker").attr("id", id + "-stickBottomArrowHead").attr("refX", 7.5).attr("refY", 0).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto-start-reverse").append("path").attr("d", "M 0 7 L 7 0").attr("stroke", "black").attr("stroke-width", 1.5).attr("fill", "none");
2931
- }, "insertStickBottomArrowHead");
2932
- var svgDraw_default = {
2933
- drawRect: drawRect2,
2934
- drawText,
2935
- drawLabel,
2936
- drawActor,
2937
- drawBox,
2938
- drawPopup,
2939
- anchorElement,
2940
- drawActivation,
2941
- drawLoop,
2942
- drawBackgroundRect: drawBackgroundRect2,
2943
- insertArrowHead,
2944
- insertArrowFilledHead,
2945
- insertSequenceNumber,
2946
- insertArrowCrossHead,
2947
- insertDatabaseIcon,
2948
- insertComputerIcon,
2949
- insertClockIcon,
2950
- getTextObj: getTextObj2,
2951
- getNoteRect: getNoteRect2,
2952
- fixLifeLineHeights,
2953
- sanitizeUrl: distExports.sanitizeUrl,
2954
- insertDropShadow,
2955
- insertSolidTopArrowHead,
2956
- insertSolidBottomArrowHead,
2957
- insertStickTopArrowHead,
2958
- insertStickBottomArrowHead
2959
- };
2960
- var conf = {};
2961
- var bounds = {
2962
- data: {
2963
- startx: void 0,
2964
- stopx: void 0,
2965
- starty: void 0,
2966
- stopy: void 0
2967
- },
2968
- verticalPos: 0,
2969
- sequenceItems: [],
2970
- activations: [],
2971
- models: {
2972
- getHeight: /* @__PURE__ */ __name(function() {
2973
- return Math.max.apply(
2974
- null,
2975
- this.actors.length === 0 ? [0] : this.actors.map((actor) => actor.height || 0)
2976
- ) + (this.loops.length === 0 ? 0 : this.loops.map((it) => it.height || 0).reduce((acc, h) => acc + h)) + (this.messages.length === 0 ? 0 : this.messages.map((it) => it.height || 0).reduce((acc, h) => acc + h)) + (this.notes.length === 0 ? 0 : this.notes.map((it) => it.height || 0).reduce((acc, h) => acc + h));
2977
- }, "getHeight"),
2978
- clear: /* @__PURE__ */ __name(function() {
2979
- this.actors = [];
2980
- this.boxes = [];
2981
- this.loops = [];
2982
- this.messages = [];
2983
- this.notes = [];
2984
- }, "clear"),
2985
- addBox: /* @__PURE__ */ __name(function(boxModel) {
2986
- this.boxes.push(boxModel);
2987
- }, "addBox"),
2988
- addActor: /* @__PURE__ */ __name(function(actorModel) {
2989
- this.actors.push(actorModel);
2990
- }, "addActor"),
2991
- addLoop: /* @__PURE__ */ __name(function(loopModel) {
2992
- this.loops.push(loopModel);
2993
- }, "addLoop"),
2994
- addMessage: /* @__PURE__ */ __name(function(msgModel) {
2995
- this.messages.push(msgModel);
2996
- }, "addMessage"),
2997
- addNote: /* @__PURE__ */ __name(function(noteModel) {
2998
- this.notes.push(noteModel);
2999
- }, "addNote"),
3000
- lastActor: /* @__PURE__ */ __name(function() {
3001
- return this.actors[this.actors.length - 1];
3002
- }, "lastActor"),
3003
- lastLoop: /* @__PURE__ */ __name(function() {
3004
- return this.loops[this.loops.length - 1];
3005
- }, "lastLoop"),
3006
- lastMessage: /* @__PURE__ */ __name(function() {
3007
- return this.messages[this.messages.length - 1];
3008
- }, "lastMessage"),
3009
- lastNote: /* @__PURE__ */ __name(function() {
3010
- return this.notes[this.notes.length - 1];
3011
- }, "lastNote"),
3012
- actors: [],
3013
- boxes: [],
3014
- loops: [],
3015
- messages: [],
3016
- notes: []
3017
- },
3018
- init: /* @__PURE__ */ __name(function() {
3019
- this.sequenceItems = [];
3020
- this.activations = [];
3021
- this.models.clear();
3022
- this.data = {
3023
- startx: void 0,
3024
- stopx: void 0,
3025
- starty: void 0,
3026
- stopy: void 0
3027
- };
3028
- this.verticalPos = 0;
3029
- setConf(getConfig2());
3030
- }, "init"),
3031
- updateVal: /* @__PURE__ */ __name(function(obj, key, val, fun) {
3032
- if (obj[key] === void 0) {
3033
- obj[key] = val;
3034
- } else {
3035
- obj[key] = fun(val, obj[key]);
3036
- }
3037
- }, "updateVal"),
3038
- updateBounds: /* @__PURE__ */ __name(function(startx, starty, stopx, stopy) {
3039
- const _self = this;
3040
- let cnt = 0;
3041
- function updateFn(type) {
3042
- return /* @__PURE__ */ __name(function updateItemBounds(item) {
3043
- cnt++;
3044
- const n = _self.sequenceItems.length - cnt + 1;
3045
- _self.updateVal(item, "starty", starty - n * conf.boxMargin, Math.min);
3046
- _self.updateVal(item, "stopy", stopy + n * conf.boxMargin, Math.max);
3047
- _self.updateVal(bounds.data, "startx", startx - n * conf.boxMargin, Math.min);
3048
- _self.updateVal(bounds.data, "stopx", stopx + n * conf.boxMargin, Math.max);
3049
- if (!(type === "activation")) {
3050
- _self.updateVal(item, "startx", startx - n * conf.boxMargin, Math.min);
3051
- _self.updateVal(item, "stopx", stopx + n * conf.boxMargin, Math.max);
3052
- _self.updateVal(bounds.data, "starty", starty - n * conf.boxMargin, Math.min);
3053
- _self.updateVal(bounds.data, "stopy", stopy + n * conf.boxMargin, Math.max);
3054
- }
3055
- }, "updateItemBounds");
3056
- }
3057
- __name(updateFn, "updateFn");
3058
- this.sequenceItems.forEach(updateFn());
3059
- this.activations.forEach(updateFn("activation"));
3060
- }, "updateBounds"),
3061
- insert: /* @__PURE__ */ __name(function(startx, starty, stopx, stopy) {
3062
- const _startx = common_default.getMin(startx, stopx);
3063
- const _stopx = common_default.getMax(startx, stopx);
3064
- const _starty = common_default.getMin(starty, stopy);
3065
- const _stopy = common_default.getMax(starty, stopy);
3066
- this.updateVal(bounds.data, "startx", _startx, Math.min);
3067
- this.updateVal(bounds.data, "starty", _starty, Math.min);
3068
- this.updateVal(bounds.data, "stopx", _stopx, Math.max);
3069
- this.updateVal(bounds.data, "stopy", _stopy, Math.max);
3070
- this.updateBounds(_startx, _starty, _stopx, _stopy);
3071
- }, "insert"),
3072
- newActivation: /* @__PURE__ */ __name(function(message, diagram2, actors) {
3073
- const actorRect = actors.get(message.from);
3074
- const stackedSize = actorActivations(message.from).length || 0;
3075
- const x = actorRect.x + actorRect.width / 2 + (stackedSize - 1) * conf.activationWidth / 2;
3076
- this.activations.push({
3077
- startx: x,
3078
- starty: this.verticalPos + 2,
3079
- stopx: x + conf.activationWidth,
3080
- stopy: void 0,
3081
- actor: message.from,
3082
- anchored: svgDraw_default.anchorElement(diagram2)
3083
- });
3084
- }, "newActivation"),
3085
- endActivation: /* @__PURE__ */ __name(function(message) {
3086
- const lastActorActivationIdx = this.activations.map(function(activation) {
3087
- return activation.actor;
3088
- }).lastIndexOf(message.from);
3089
- return this.activations.splice(lastActorActivationIdx, 1)[0];
3090
- }, "endActivation"),
3091
- createLoop: /* @__PURE__ */ __name(function(title = { message: void 0, wrap: false, width: void 0 }, fill) {
3092
- return {
3093
- startx: void 0,
3094
- starty: this.verticalPos,
3095
- stopx: void 0,
3096
- stopy: void 0,
3097
- title: title.message,
3098
- wrap: title.wrap,
3099
- width: title.width,
3100
- height: 0,
3101
- fill
3102
- };
3103
- }, "createLoop"),
3104
- newLoop: /* @__PURE__ */ __name(function(title = { message: void 0, wrap: false, width: void 0 }, fill) {
3105
- this.sequenceItems.push(this.createLoop(title, fill));
3106
- }, "newLoop"),
3107
- endLoop: /* @__PURE__ */ __name(function() {
3108
- return this.sequenceItems.pop();
3109
- }, "endLoop"),
3110
- isLoopOverlap: /* @__PURE__ */ __name(function() {
3111
- return this.sequenceItems.length ? this.sequenceItems[this.sequenceItems.length - 1].overlap : false;
3112
- }, "isLoopOverlap"),
3113
- addSectionToLoop: /* @__PURE__ */ __name(function(message) {
3114
- const loop = this.sequenceItems.pop();
3115
- loop.sections = loop.sections || [];
3116
- loop.sectionTitles = loop.sectionTitles || [];
3117
- loop.sections.push({ y: bounds.getVerticalPos(), height: 0 });
3118
- loop.sectionTitles.push(message);
3119
- this.sequenceItems.push(loop);
3120
- }, "addSectionToLoop"),
3121
- saveVerticalPos: /* @__PURE__ */ __name(function() {
3122
- if (this.isLoopOverlap()) {
3123
- this.savedVerticalPos = this.verticalPos;
3124
- }
3125
- }, "saveVerticalPos"),
3126
- resetVerticalPos: /* @__PURE__ */ __name(function() {
3127
- if (this.isLoopOverlap()) {
3128
- this.verticalPos = this.savedVerticalPos;
3129
- }
3130
- }, "resetVerticalPos"),
3131
- bumpVerticalPos: /* @__PURE__ */ __name(function(bump) {
3132
- this.verticalPos = this.verticalPos + bump;
3133
- this.data.stopy = common_default.getMax(this.data.stopy, this.verticalPos);
3134
- }, "bumpVerticalPos"),
3135
- getVerticalPos: /* @__PURE__ */ __name(function() {
3136
- return this.verticalPos;
3137
- }, "getVerticalPos"),
3138
- getBounds: /* @__PURE__ */ __name(function() {
3139
- return { bounds: this.data, models: this.models };
3140
- }, "getBounds")
3141
- };
3142
- var drawNote = /* @__PURE__ */ __name(async function(elem, noteModel, id) {
3143
- bounds.bumpVerticalPos(conf.boxMargin);
3144
- noteModel.height = conf.boxMargin;
3145
- noteModel.starty = bounds.getVerticalPos();
3146
- const rect = getNoteRect();
3147
- rect.x = noteModel.startx;
3148
- rect.y = noteModel.starty;
3149
- rect.width = noteModel.width || conf.width;
3150
- rect.class = "note";
3151
- const g = elem.append("g");
3152
- g.attr("data-et", "note");
3153
- g.attr("data-id", "i" + id);
3154
- const rectElem = svgDraw_default.drawRect(g, rect);
3155
- const textObj = getTextObj();
3156
- textObj.x = noteModel.startx;
3157
- textObj.y = noteModel.starty;
3158
- textObj.width = rect.width;
3159
- textObj.dy = "1em";
3160
- textObj.text = noteModel.message;
3161
- textObj.class = "noteText";
3162
- textObj.fontFamily = conf.noteFontFamily;
3163
- textObj.fontSize = conf.noteFontSize;
3164
- textObj.fontWeight = conf.noteFontWeight;
3165
- textObj.anchor = conf.noteAlign;
3166
- textObj.textMargin = conf.noteMargin;
3167
- textObj.valign = "center";
3168
- const textElem = hasKatex(textObj.text) ? await drawKatex(g, textObj) : drawText(g, textObj);
3169
- const textHeight = Math.round(
3170
- textElem.map((te) => (te._groups || te)[0][0].getBBox().height).reduce((acc, curr) => acc + curr)
3171
- );
3172
- rectElem.attr("height", textHeight + 2 * conf.noteMargin);
3173
- noteModel.height += textHeight + 2 * conf.noteMargin;
3174
- bounds.bumpVerticalPos(textHeight + 2 * conf.noteMargin);
3175
- noteModel.stopy = noteModel.starty + textHeight + 2 * conf.noteMargin;
3176
- noteModel.stopx = noteModel.startx + rect.width;
3177
- bounds.insert(noteModel.startx, noteModel.starty, noteModel.stopx, noteModel.stopy);
3178
- bounds.models.addNote(noteModel);
3179
- }, "drawNote");
3180
- var drawCentralConnection = /* @__PURE__ */ __name(function(elem, msg, msgModel, diagObj, startx, stopx, lineStartY) {
3181
- const actors = diagObj.db.getActors();
3182
- const fromActor = actors.get(msg.from);
3183
- const toActor = actors.get(msg.to);
3184
- const isAutoNumberOn = msgModel.sequenceVisible;
3185
- let fromCenter = fromActor.x + fromActor.width / 2;
3186
- let toCenter = toActor.x + toActor.width / 2;
3187
- const isLeftToRight = fromCenter <= toCenter;
3188
- const isReverse = isReverseArrowType(msg, diagObj);
3189
- const g = elem.append("g");
3190
- const CENTRAL_CONNECTION_CIRCLE_OFFSET = 16.5;
3191
- const getCircleOffset = /* @__PURE__ */ __name((isLeftToRight2, isReverse2) => {
3192
- const baseOffset = isLeftToRight2 ? CENTRAL_CONNECTION_CIRCLE_OFFSET : -CENTRAL_CONNECTION_CIRCLE_OFFSET;
3193
- return isReverse2 ? -baseOffset : baseOffset;
3194
- }, "getCircleOffset");
3195
- const drawCircle = /* @__PURE__ */ __name((cx) => {
3196
- g.append("circle").attr("cx", cx).attr("cy", lineStartY).attr("r", 5).attr("width", 10).attr("height", 10);
3197
- }, "drawCircle");
3198
- const { CENTRAL_CONNECTION, CENTRAL_CONNECTION_REVERSE, CENTRAL_CONNECTION_DUAL } = diagObj.db.LINETYPE;
3199
- if (isAutoNumberOn) {
3200
- switch (msg.centralConnection) {
3201
- case CENTRAL_CONNECTION:
3202
- if (isReverse) {
3203
- toCenter += getCircleOffset(isLeftToRight, true);
3204
- }
3205
- break;
3206
- case CENTRAL_CONNECTION_REVERSE:
3207
- if (!isReverse) {
3208
- fromCenter += getCircleOffset(isLeftToRight, false);
3209
- }
3210
- break;
3211
- case CENTRAL_CONNECTION_DUAL:
3212
- if (isReverse) {
3213
- toCenter += getCircleOffset(isLeftToRight, true);
3214
- } else {
3215
- fromCenter += getCircleOffset(isLeftToRight, false);
3216
- }
3217
- break;
3218
- }
3219
- }
3220
- switch (msg.centralConnection) {
3221
- case CENTRAL_CONNECTION:
3222
- drawCircle(toCenter);
3223
- break;
3224
- case CENTRAL_CONNECTION_REVERSE:
3225
- drawCircle(fromCenter);
3226
- break;
3227
- case CENTRAL_CONNECTION_DUAL:
3228
- drawCircle(fromCenter);
3229
- drawCircle(toCenter);
3230
- break;
3231
- }
3232
- }, "drawCentralConnection");
3233
- var messageFont = /* @__PURE__ */ __name((cnf) => {
3234
- return {
3235
- fontFamily: cnf.messageFontFamily,
3236
- fontSize: cnf.messageFontSize,
3237
- fontWeight: cnf.messageFontWeight
3238
- };
3239
- }, "messageFont");
3240
- var noteFont = /* @__PURE__ */ __name((cnf) => {
3241
- return {
3242
- fontFamily: cnf.noteFontFamily,
3243
- fontSize: cnf.noteFontSize,
3244
- fontWeight: cnf.noteFontWeight
3245
- };
3246
- }, "noteFont");
3247
- var actorFont = /* @__PURE__ */ __name((cnf) => {
3248
- return {
3249
- fontFamily: cnf.actorFontFamily,
3250
- fontSize: cnf.actorFontSize,
3251
- fontWeight: cnf.actorFontWeight
3252
- };
3253
- }, "actorFont");
3254
- async function boundMessage(_diagram, msgModel) {
3255
- bounds.bumpVerticalPos(10);
3256
- const { startx, stopx, message } = msgModel;
3257
- const lines = common_default.splitBreaks(message).length;
3258
- const isKatexMsg = hasKatex(message);
3259
- const textDims = isKatexMsg ? await calculateMathMLDimensions(message, getConfig2()) : utils_default.calculateTextDimensions(message, messageFont(conf));
3260
- if (!isKatexMsg) {
3261
- const lineHeight = textDims.height / lines;
3262
- msgModel.height += lineHeight;
3263
- bounds.bumpVerticalPos(lineHeight);
3264
- }
3265
- let lineStartY;
3266
- let totalOffset = textDims.height - 10;
3267
- const textWidth = textDims.width;
3268
- if (startx === stopx) {
3269
- lineStartY = bounds.getVerticalPos() + totalOffset;
3270
- if (!conf.rightAngles) {
3271
- totalOffset += conf.boxMargin;
3272
- lineStartY = bounds.getVerticalPos() + totalOffset;
3273
- }
3274
- totalOffset += 30;
3275
- const dx = common_default.getMax(textWidth / 2, conf.width / 2);
3276
- bounds.insert(
3277
- startx - dx,
3278
- bounds.getVerticalPos() - 10 + totalOffset,
3279
- stopx + dx,
3280
- bounds.getVerticalPos() + 30 + totalOffset
3281
- );
3282
- } else {
3283
- totalOffset += conf.boxMargin;
3284
- lineStartY = bounds.getVerticalPos() + totalOffset;
3285
- bounds.insert(startx, lineStartY - 10, stopx, lineStartY);
3286
- }
3287
- bounds.bumpVerticalPos(totalOffset);
3288
- msgModel.height += totalOffset;
3289
- msgModel.stopy = msgModel.starty + msgModel.height;
3290
- bounds.insert(msgModel.fromBounds, msgModel.starty, msgModel.toBounds, msgModel.stopy);
3291
- return lineStartY;
3292
- }
3293
- __name(boundMessage, "boundMessage");
3294
- var drawMessage = /* @__PURE__ */ __name(async function(diagram2, msgModel, lineStartY, diagObj, msg, diagramId) {
3295
- const { startx, stopx, starty, message, type, sequenceIndex, sequenceVisible } = msgModel;
3296
- const textDims = utils_default.calculateTextDimensions(message, messageFont(conf));
3297
- const textObj = getTextObj();
3298
- textObj.x = Math.min(startx, stopx);
3299
- textObj.y = starty + 10;
3300
- textObj.width = Math.abs(stopx - startx);
3301
- textObj.class = "messageText";
3302
- textObj.dy = "1em";
3303
- textObj.text = message;
3304
- textObj.fontFamily = conf.messageFontFamily;
3305
- textObj.fontSize = conf.messageFontSize;
3306
- textObj.fontWeight = conf.messageFontWeight;
3307
- textObj.anchor = conf.messageAlign;
3308
- textObj.valign = "center";
3309
- textObj.textMargin = conf.wrapPadding;
3310
- textObj.tspan = false;
3311
- if (hasKatex(textObj.text)) {
3312
- await drawKatex(diagram2, textObj, { startx, stopx, starty: lineStartY });
3313
- } else {
3314
- drawText(diagram2, textObj);
3315
- }
3316
- const textWidth = textDims.width;
3317
- let line;
3318
- if (startx === stopx) {
3319
- const isAutoNumberOn = sequenceVisible || conf.showSequenceNumbers;
3320
- const isReverse = isReverseArrowType(msg, diagObj);
3321
- const isBidirectional = isBidirectionalArrowType(msg, diagObj);
3322
- const lineStartX = startx + (isAutoNumberOn && (isReverse || isBidirectional) ? 10 : 0);
3323
- if (conf.rightAngles) {
3324
- line = diagram2.append("path").attr(
3325
- "d",
3326
- `M ${lineStartX},${lineStartY} H ${startx + common_default.getMax(conf.width / 2, textWidth / 2)} V ${lineStartY + 25} H ${startx}`
3327
- );
3328
- } else {
3329
- line = diagram2.append("path").attr(
3330
- "d",
3331
- "M " + lineStartX + "," + lineStartY + " C " + (lineStartX + 60) + "," + (lineStartY - 10) + " " + (startx + 60) + "," + (lineStartY + 30) + " " + startx + "," + (lineStartY + 20)
3332
- );
3333
- }
3334
- if (hasCentralConnection(msg, diagObj)) {
3335
- drawCentralConnection(diagram2, msg, msgModel, diagObj, startx, stopx, lineStartY);
3336
- }
3337
- } else {
3338
- line = diagram2.append("line");
3339
- line.attr("x1", startx);
3340
- line.attr("y1", lineStartY);
3341
- line.attr("x2", stopx);
3342
- line.attr("y2", lineStartY);
3343
- if (hasCentralConnection(msg, diagObj)) {
3344
- drawCentralConnection(diagram2, msg, msgModel, diagObj, startx, stopx, lineStartY);
3345
- }
3346
- }
3347
- if (type === diagObj.db.LINETYPE.DOTTED || type === diagObj.db.LINETYPE.DOTTED_CROSS || type === diagObj.db.LINETYPE.DOTTED_POINT || type === diagObj.db.LINETYPE.DOTTED_OPEN || type === diagObj.db.LINETYPE.BIDIRECTIONAL_DOTTED || type === diagObj.db.LINETYPE.SOLID_TOP_DOTTED || type === diagObj.db.LINETYPE.SOLID_BOTTOM_DOTTED || type === diagObj.db.LINETYPE.STICK_TOP_DOTTED || type === diagObj.db.LINETYPE.STICK_BOTTOM_DOTTED || type === diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED || type === diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED || type === diagObj.db.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED || type === diagObj.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED) {
3348
- line.style("stroke-dasharray", "3, 3");
3349
- line.attr("class", "messageLine1");
3350
- } else {
3351
- line.attr("class", "messageLine0");
3352
- }
3353
- line.attr("data-et", "message");
3354
- line.attr("data-id", "i" + msgModel.id);
3355
- line.attr("data-from", msgModel.from);
3356
- line.attr("data-to", msgModel.to);
3357
- let url = "";
3358
- if (conf.arrowMarkerAbsolute) {
3359
- url = getUrl(true);
3360
- }
3361
- line.attr("stroke-width", 2);
3362
- line.attr("stroke", "none");
3363
- line.style("fill", "none");
3364
- if (type === diagObj.db.LINETYPE.SOLID_TOP || type === diagObj.db.LINETYPE.SOLID_TOP_DOTTED) {
3365
- line.attr("marker-end", "url(" + url + "#" + diagramId + "-solidTopArrowHead)");
3366
- }
3367
- if (type === diagObj.db.LINETYPE.SOLID_BOTTOM || type === diagObj.db.LINETYPE.SOLID_BOTTOM_DOTTED) {
3368
- line.attr("marker-end", "url(" + url + "#" + diagramId + "-solidBottomArrowHead)");
3369
- }
3370
- if (type === diagObj.db.LINETYPE.STICK_TOP || type === diagObj.db.LINETYPE.STICK_TOP_DOTTED) {
3371
- line.attr("marker-end", "url(" + url + "#" + diagramId + "-stickTopArrowHead)");
3372
- }
3373
- if (type === diagObj.db.LINETYPE.STICK_BOTTOM || type === diagObj.db.LINETYPE.STICK_BOTTOM_DOTTED) {
3374
- line.attr("marker-end", "url(" + url + "#" + diagramId + "-stickBottomArrowHead)");
3375
- }
3376
- if (type === diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE || type === diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED) {
3377
- line.attr("marker-start", "url(" + url + "#" + diagramId + "-solidBottomArrowHead)");
3378
- }
3379
- if (type === diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE || type === diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED) {
3380
- line.attr("marker-start", "url(" + url + "#" + diagramId + "-solidTopArrowHead)");
3381
- }
3382
- if (type === diagObj.db.LINETYPE.STICK_ARROW_TOP_REVERSE || type === diagObj.db.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED) {
3383
- line.attr("marker-start", "url(" + url + "#" + diagramId + "-stickBottomArrowHead)");
3384
- }
3385
- if (type === diagObj.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE || type === diagObj.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED) {
3386
- line.attr("marker-start", "url(" + url + "#" + diagramId + "-stickTopArrowHead)");
3387
- }
3388
- if (type === diagObj.db.LINETYPE.SOLID || type === diagObj.db.LINETYPE.DOTTED) {
3389
- line.attr("marker-end", "url(" + url + "#" + diagramId + "-arrowhead)");
3390
- }
3391
- if (type === diagObj.db.LINETYPE.BIDIRECTIONAL_SOLID || type === diagObj.db.LINETYPE.BIDIRECTIONAL_DOTTED) {
3392
- line.attr("marker-start", "url(" + url + "#" + diagramId + "-arrowhead)");
3393
- line.attr("marker-end", "url(" + url + "#" + diagramId + "-arrowhead)");
3394
- }
3395
- if (type === diagObj.db.LINETYPE.SOLID_POINT || type === diagObj.db.LINETYPE.DOTTED_POINT) {
3396
- line.attr("marker-end", "url(" + url + "#" + diagramId + "-filled-head)");
3397
- }
3398
- if (type === diagObj.db.LINETYPE.SOLID_CROSS || type === diagObj.db.LINETYPE.DOTTED_CROSS) {
3399
- line.attr("marker-end", "url(" + url + "#" + diagramId + "-crosshead)");
3400
- }
3401
- if (sequenceVisible || conf.showSequenceNumbers) {
3402
- const isBidirectional = type === diagObj.db.LINETYPE.BIDIRECTIONAL_SOLID || type === diagObj.db.LINETYPE.BIDIRECTIONAL_DOTTED;
3403
- const isReverseArrowType2 = type === diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE || type === diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED || type === diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE || type === diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED || type === diagObj.db.LINETYPE.STICK_ARROW_TOP_REVERSE || type === diagObj.db.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED || type === diagObj.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE || type === diagObj.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED;
3404
- const SEQUENCE_NUMBER_RADIUS = 6;
3405
- const hasCentralConn = hasCentralConnection(msg, diagObj);
3406
- let lineStartX = startx;
3407
- let lineStopX = stopx;
3408
- if (isBidirectional) {
3409
- if (startx < stopx) {
3410
- lineStartX = startx + SEQUENCE_NUMBER_RADIUS * 2;
3411
- } else {
3412
- lineStartX = startx - SEQUENCE_NUMBER_RADIUS + (hasCentralConn ? -5 : 0);
3413
- lineStartX += msg?.centralConnection === diagObj.db.LINETYPE.CENTRAL_CONNECTION_DUAL || msg?.centralConnection === diagObj.db.LINETYPE.CENTRAL_CONNECTION_REVERSE ? -7.5 : 0;
3414
- }
3415
- line.attr("x1", lineStartX);
3416
- } else if (isReverseArrowType2) {
3417
- if (stopx > startx) {
3418
- lineStopX = stopx - 2 * SEQUENCE_NUMBER_RADIUS;
3419
- } else {
3420
- lineStopX = stopx - SEQUENCE_NUMBER_RADIUS;
3421
- lineStartX += msg?.centralConnection === diagObj.db.LINETYPE.CENTRAL_CONNECTION_DUAL || msg?.centralConnection === diagObj.db.LINETYPE.CENTRAL_CONNECTION_REVERSE ? -7.5 : 0;
3422
- }
3423
- lineStopX += hasCentralConn ? 15 : 0;
3424
- line.attr("x2", lineStopX);
3425
- line.attr("x1", lineStartX);
3426
- } else {
3427
- line.attr("x1", startx + SEQUENCE_NUMBER_RADIUS);
3428
- }
3429
- let autonumberX = 0;
3430
- const isSelfMessage = startx === stopx;
3431
- const isLeftToRight = startx <= stopx;
3432
- if (isSelfMessage) {
3433
- autonumberX = msgModel.fromBounds + 1;
3434
- } else if (isReverseArrowType2) {
3435
- autonumberX = isLeftToRight ? msgModel.toBounds - 1 : msgModel.fromBounds + 1;
3436
- } else {
3437
- autonumberX = isLeftToRight ? msgModel.fromBounds + 1 : msgModel.toBounds - 1;
3438
- }
3439
- let fontSize = "12px";
3440
- const sequenceIndexLength = sequenceIndex.toString().length;
3441
- if (sequenceIndexLength > 5) {
3442
- fontSize = "7px";
3443
- } else if (sequenceIndexLength > 3) {
3444
- fontSize = "9px";
3445
- }
3446
- diagram2.append("line").attr("x1", autonumberX).attr("y1", lineStartY).attr("x2", autonumberX).attr("y2", lineStartY).attr("stroke-width", 0).attr("marker-start", "url(" + url + "#" + diagramId + "-sequencenumber)");
3447
- diagram2.append("text").attr("x", autonumberX).attr("y", lineStartY + 4).attr("font-family", "sans-serif").attr("font-size", fontSize).attr("text-anchor", "middle").attr("class", "sequenceNumber").text(sequenceIndex);
3448
- }
3449
- }, "drawMessage");
3450
- var addActorRenderingData = /* @__PURE__ */ __name(function(diagram2, actors, createdActors, actorKeys, verticalPos, messages, isFooter) {
3451
- let prevWidth = 0;
3452
- let prevMargin = 0;
3453
- let prevBox = void 0;
3454
- let maxHeight = 0;
3455
- for (const actorKey of actorKeys) {
3456
- const actor = actors.get(actorKey);
3457
- const box = actor.box;
3458
- if (prevBox && prevBox != box) {
3459
- if (!isFooter) {
3460
- bounds.models.addBox(prevBox);
3461
- }
3462
- prevMargin += conf.boxMargin + prevBox.margin;
3463
- }
3464
- if (box && box != prevBox) {
3465
- if (!isFooter) {
3466
- box.x = prevWidth + prevMargin;
3467
- box.y = verticalPos;
3468
- }
3469
- prevMargin += box.margin;
3470
- }
3471
- actor.width = common_default.getMax(actor.width || conf.width, conf.width);
3472
- actor.height = common_default.getMax(actor.height || conf.height, conf.height);
3473
- actor.margin = actor.margin || conf.actorMargin;
3474
- maxHeight = common_default.getMax(maxHeight, actor.height);
3475
- if (createdActors.get(actor.name)) {
3476
- prevMargin += actor.width / 2;
3477
- }
3478
- actor.x = prevWidth + prevMargin;
3479
- actor.starty = bounds.getVerticalPos();
3480
- bounds.insert(actor.x, verticalPos, actor.x + actor.width, actor.height);
3481
- prevWidth += actor.width + prevMargin;
3482
- if (actor.box) {
3483
- actor.box.width = prevWidth + box.margin - actor.box.x;
3484
- }
3485
- prevMargin = actor.margin;
3486
- prevBox = actor.box;
3487
- bounds.models.addActor(actor);
3488
- }
3489
- if (prevBox && !isFooter) {
3490
- bounds.models.addBox(prevBox);
3491
- }
3492
- bounds.bumpVerticalPos(maxHeight);
3493
- }, "addActorRenderingData");
3494
- var drawActors = /* @__PURE__ */ __name(async function(diagram2, actors, actorKeys, isFooter, diagramId, diagObj, actorIndexMap) {
3495
- if (!isFooter) {
3496
- for (const actorKey of actorKeys) {
3497
- const actor = actors.get(actorKey);
3498
- await svgDraw_default.drawActor(diagram2, actor, conf, false, diagramId, diagObj, actorIndexMap);
3499
- }
3500
- } else {
3501
- let maxHeight = 0;
3502
- bounds.bumpVerticalPos(conf.boxMargin * 2);
3503
- for (const actorKey of actorKeys) {
3504
- const actor = actors.get(actorKey);
3505
- if (!actor.stopy) {
3506
- actor.stopy = bounds.getVerticalPos();
3507
- }
3508
- const height = await svgDraw_default.drawActor(
3509
- diagram2,
3510
- actor,
3511
- conf,
3512
- true,
3513
- diagramId,
3514
- diagObj,
3515
- actorIndexMap
3516
- );
3517
- maxHeight = common_default.getMax(maxHeight, height);
3518
- }
3519
- bounds.bumpVerticalPos(maxHeight + conf.boxMargin);
3520
- }
3521
- }, "drawActors");
3522
- var drawActorsPopup = /* @__PURE__ */ __name(function(diagram2, actors, actorKeys, doc) {
3523
- let maxHeight = 0;
3524
- let maxWidth = 0;
3525
- for (const actorKey of actorKeys) {
3526
- const actor = actors.get(actorKey);
3527
- const minMenuWidth = getRequiredPopupWidth(actor);
3528
- const menuDimensions = svgDraw_default.drawPopup(
3529
- diagram2,
3530
- actor,
3531
- minMenuWidth,
3532
- conf,
3533
- conf.forceMenus,
3534
- doc
3535
- );
3536
- if (menuDimensions.height > maxHeight) {
3537
- maxHeight = menuDimensions.height;
3538
- }
3539
- if (menuDimensions.width + actor.x > maxWidth) {
3540
- maxWidth = menuDimensions.width + actor.x;
3541
- }
3542
- }
3543
- return { maxHeight, maxWidth };
3544
- }, "drawActorsPopup");
3545
- var setConf = /* @__PURE__ */ __name(function(cnf) {
3546
- assignWithDepth_default(conf, cnf);
3547
- if (cnf.fontFamily) {
3548
- conf.actorFontFamily = conf.noteFontFamily = conf.messageFontFamily = cnf.fontFamily;
3549
- }
3550
- if (cnf.fontSize) {
3551
- conf.actorFontSize = conf.noteFontSize = conf.messageFontSize = cnf.fontSize;
3552
- }
3553
- if (cnf.fontWeight) {
3554
- conf.actorFontWeight = conf.noteFontWeight = conf.messageFontWeight = cnf.fontWeight;
3555
- }
3556
- }, "setConf");
3557
- var actorActivations = /* @__PURE__ */ __name(function(actor) {
3558
- return bounds.activations.filter(function(activation) {
3559
- return activation.actor === actor;
3560
- });
3561
- }, "actorActivations");
3562
- var activationBounds = /* @__PURE__ */ __name(function(actor, actors) {
3563
- const actorObj = actors.get(actor);
3564
- const activations = actorActivations(actor);
3565
- const left = activations.reduce(
3566
- function(acc, activation) {
3567
- return common_default.getMin(acc, activation.startx);
3568
- },
3569
- actorObj.x + actorObj.width / 2 - 1
3570
- );
3571
- const right = activations.reduce(
3572
- function(acc, activation) {
3573
- return common_default.getMax(acc, activation.stopx);
3574
- },
3575
- actorObj.x + actorObj.width / 2 + 1
3576
- );
3577
- return [left, right];
3578
- }, "activationBounds");
3579
- function adjustLoopHeightForWrap(loopWidths, msg, preMargin, postMargin, addLoopFn) {
3580
- bounds.bumpVerticalPos(preMargin);
3581
- let heightAdjust = postMargin;
3582
- if (msg.id && msg.message && loopWidths[msg.id]) {
3583
- const loopWidth = loopWidths[msg.id].width;
3584
- const textConf = messageFont(conf);
3585
- msg.message = utils_default.wrapLabel(`[${msg.message}]`, loopWidth - 2 * conf.wrapPadding, textConf);
3586
- msg.width = loopWidth;
3587
- msg.wrap = true;
3588
- const textDims = utils_default.calculateTextDimensions(msg.message, textConf);
3589
- const totalOffset = common_default.getMax(textDims.height, conf.labelBoxHeight);
3590
- heightAdjust = postMargin + totalOffset;
3591
- log.debug(`${totalOffset} - ${msg.message}`);
3592
- }
3593
- addLoopFn(msg);
3594
- bounds.bumpVerticalPos(heightAdjust);
3595
- }
3596
- __name(adjustLoopHeightForWrap, "adjustLoopHeightForWrap");
3597
- function adjustCreatedDestroyedData(msg, msgModel, lineStartY, index, actors, createdActors, destroyedActors) {
3598
- function receiverAdjustment(actor, adjustment) {
3599
- if (actor.x < actors.get(msg.from).x) {
3600
- bounds.insert(
3601
- msgModel.stopx - adjustment,
3602
- msgModel.starty,
3603
- msgModel.startx,
3604
- msgModel.stopy + actor.height / 2 + conf.noteMargin
3605
- );
3606
- msgModel.stopx = msgModel.stopx + adjustment;
3607
- } else {
3608
- bounds.insert(
3609
- msgModel.startx,
3610
- msgModel.starty,
3611
- msgModel.stopx + adjustment,
3612
- msgModel.stopy + actor.height / 2 + conf.noteMargin
3613
- );
3614
- msgModel.stopx = msgModel.stopx - adjustment;
3615
- }
3616
- }
3617
- __name(receiverAdjustment, "receiverAdjustment");
3618
- function senderAdjustment(actor, adjustment) {
3619
- if (actor.x < actors.get(msg.to).x) {
3620
- bounds.insert(
3621
- msgModel.startx - adjustment,
3622
- msgModel.starty,
3623
- msgModel.stopx,
3624
- msgModel.stopy + actor.height / 2 + conf.noteMargin
3625
- );
3626
- msgModel.startx = msgModel.startx + adjustment;
3627
- } else {
3628
- bounds.insert(
3629
- msgModel.stopx,
3630
- msgModel.starty,
3631
- msgModel.startx + adjustment,
3632
- msgModel.stopy + actor.height / 2 + conf.noteMargin
3633
- );
3634
- msgModel.startx = msgModel.startx - adjustment;
3635
- }
3636
- }
3637
- __name(senderAdjustment, "senderAdjustment");
3638
- const actorArray = [
3639
- PARTICIPANT_TYPE.ACTOR,
3640
- PARTICIPANT_TYPE.CONTROL,
3641
- PARTICIPANT_TYPE.ENTITY,
3642
- PARTICIPANT_TYPE.DATABASE
3643
- ];
3644
- if (createdActors.get(msg.to) == index) {
3645
- const actor = actors.get(msg.to);
3646
- const adjustment = actorArray.includes(actor.type) ? ACTOR_TYPE_WIDTH / 2 + 3 : actor.width / 2 + 3;
3647
- receiverAdjustment(actor, adjustment);
3648
- actor.starty = lineStartY - actor.height / 2;
3649
- bounds.bumpVerticalPos(actor.height / 2);
3650
- } else if (destroyedActors.get(msg.from) == index) {
3651
- const actor = actors.get(msg.from);
3652
- if (conf.mirrorActors) {
3653
- const adjustment = actorArray.includes(actor.type) ? ACTOR_TYPE_WIDTH / 2 : actor.width / 2;
3654
- senderAdjustment(actor, adjustment);
3655
- }
3656
- actor.stopy = lineStartY - actor.height / 2;
3657
- bounds.bumpVerticalPos(actor.height / 2);
3658
- } else if (destroyedActors.get(msg.to) == index) {
3659
- const actor = actors.get(msg.to);
3660
- if (conf.mirrorActors) {
3661
- const adjustment = actorArray.includes(actor.type) ? ACTOR_TYPE_WIDTH / 2 + 3 : actor.width / 2 + 3;
3662
- receiverAdjustment(actor, adjustment);
3663
- }
3664
- actor.stopy = lineStartY - actor.height / 2;
3665
- bounds.bumpVerticalPos(actor.height / 2);
3666
- }
3667
- }
3668
- __name(adjustCreatedDestroyedData, "adjustCreatedDestroyedData");
3669
- var draw = /* @__PURE__ */ __name(async function(_text, id, _version, diagObj) {
3670
- const { securityLevel, sequence, look, themeVariables } = getConfig2();
3671
- conf = sequence;
3672
- let sandboxElement;
3673
- if (securityLevel === "sandbox") {
3674
- sandboxElement = select("#i" + id);
3675
- }
3676
- const root = securityLevel === "sandbox" ? select(sandboxElement.nodes()[0].contentDocument.body) : select("body");
3677
- const doc = securityLevel === "sandbox" ? sandboxElement.nodes()[0].contentDocument : document;
3678
- bounds.init();
3679
- log.debug(diagObj.db);
3680
- const diagram2 = securityLevel === "sandbox" ? root.select(`[id="${id}"]`) : select(`[id="${id}"]`);
3681
- const actors = diagObj.db.getActors();
3682
- const createdActors = diagObj.db.getCreatedActors();
3683
- const destroyedActors = diagObj.db.getDestroyedActors();
3684
- const boxes = diagObj.db.getBoxes();
3685
- let actorKeys = diagObj.db.getActorKeys();
3686
- const messages = diagObj.db.getMessages();
3687
- const title = diagObj.db.getDiagramTitle();
3688
- const hasBoxes = diagObj.db.hasAtLeastOneBox();
3689
- const hasBoxTitles = diagObj.db.hasAtLeastOneBoxWithTitle();
3690
- const maxMessageWidthPerActor = await getMaxMessageWidthPerActor(actors, messages, diagObj);
3691
- conf.height = await calculateActorMargins(actors, maxMessageWidthPerActor, boxes);
3692
- svgDraw_default.insertComputerIcon(diagram2, id);
3693
- svgDraw_default.insertDatabaseIcon(diagram2, id);
3694
- svgDraw_default.insertClockIcon(diagram2, id);
3695
- if (hasBoxes) {
3696
- bounds.bumpVerticalPos(conf.boxMargin);
3697
- if (hasBoxTitles) {
3698
- bounds.bumpVerticalPos(boxes[0].textMaxHeight);
3699
- }
3700
- }
3701
- if (conf.hideUnusedParticipants === true) {
3702
- const newActors = /* @__PURE__ */ new Set();
3703
- messages.forEach((message) => {
3704
- newActors.add(message.from);
3705
- newActors.add(message.to);
3706
- });
3707
- actorKeys = actorKeys.filter((actorKey) => newActors.has(actorKey));
3708
- }
3709
- const actorIndexMap = new Map(
3710
- actorKeys.map((actorKey, index2) => [actors.get(actorKey)?.name ?? actorKey, index2])
3711
- );
3712
- addActorRenderingData(diagram2, actors, createdActors, actorKeys, 0, messages, false);
3713
- const loopWidths = await calculateLoopBounds(messages, actors, maxMessageWidthPerActor, diagObj);
3714
- svgDraw_default.insertArrowHead(diagram2, id);
3715
- svgDraw_default.insertArrowCrossHead(diagram2, id);
3716
- svgDraw_default.insertArrowFilledHead(diagram2, id);
3717
- svgDraw_default.insertSequenceNumber(diagram2, id);
3718
- svgDraw_default.insertSolidTopArrowHead(diagram2, id);
3719
- svgDraw_default.insertSolidBottomArrowHead(diagram2, id);
3720
- svgDraw_default.insertStickTopArrowHead(diagram2, id);
3721
- svgDraw_default.insertStickBottomArrowHead(diagram2, id);
3722
- if (look === "neo") {
3723
- svgDraw_default.insertDropShadow(diagram2, conf);
3724
- }
3725
- function activeEnd(msg, verticalPos) {
3726
- const activationData = bounds.endActivation(msg);
3727
- if (activationData.starty + 18 > verticalPos) {
3728
- activationData.starty = verticalPos - 6;
3729
- verticalPos += 12;
3730
- }
3731
- svgDraw_default.drawActivation(
3732
- diagram2,
3733
- activationData,
3734
- verticalPos,
3735
- conf,
3736
- actorActivations(msg.from).length,
3737
- diagObj,
3738
- actorIndexMap
3739
- );
3740
- bounds.insert(activationData.startx, verticalPos - 10, activationData.stopx, verticalPos);
3741
- }
3742
- __name(activeEnd, "activeEnd");
3743
- let sequenceIndex = 1;
3744
- let sequenceIndexStep = 1;
3745
- const messagesToDraw = [];
3746
- const backgrounds = [];
3747
- let index = 0;
3748
- for (const msg of messages) {
3749
- let loopModel, noteModel, msgModel;
3750
- switch (msg.type) {
3751
- case diagObj.db.LINETYPE.NOTE:
3752
- bounds.resetVerticalPos();
3753
- noteModel = msg.noteModel;
3754
- await drawNote(diagram2, noteModel, msg.id);
3755
- break;
3756
- case diagObj.db.LINETYPE.ACTIVE_START:
3757
- bounds.newActivation(msg, diagram2, actors);
3758
- break;
3759
- case diagObj.db.LINETYPE.CENTRAL_CONNECTION:
3760
- bounds.newActivation(msg, diagram2, actors);
3761
- break;
3762
- case diagObj.db.LINETYPE.CENTRAL_CONNECTION_REVERSE:
3763
- bounds.newActivation(msg, diagram2, actors);
3764
- break;
3765
- case diagObj.db.LINETYPE.ACTIVE_END:
3766
- activeEnd(msg, bounds.getVerticalPos());
3767
- break;
3768
- case diagObj.db.LINETYPE.LOOP_START:
3769
- adjustLoopHeightForWrap(
3770
- loopWidths,
3771
- msg,
3772
- conf.boxMargin,
3773
- conf.boxMargin + conf.boxTextMargin,
3774
- (message) => bounds.newLoop(message)
3775
- );
3776
- break;
3777
- case diagObj.db.LINETYPE.LOOP_END:
3778
- loopModel = bounds.endLoop();
3779
- await svgDraw_default.drawLoop(diagram2, loopModel, "loop", conf, msg);
3780
- bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
3781
- bounds.models.addLoop(loopModel);
3782
- break;
3783
- case diagObj.db.LINETYPE.RECT_START:
3784
- adjustLoopHeightForWrap(loopWidths, msg, conf.boxMargin, conf.boxMargin, (message) => {
3785
- let fill = message.message;
3786
- if (!fill) {
3787
- fill = themeVariables?.rectBkgColor || themeVariables?.actorBkg || "rgba(128, 128, 128, 0.5)";
3788
- }
3789
- bounds.newLoop(void 0, fill);
3790
- });
3791
- break;
3792
- case diagObj.db.LINETYPE.RECT_END:
3793
- loopModel = bounds.endLoop();
3794
- backgrounds.push(loopModel);
3795
- bounds.models.addLoop(loopModel);
3796
- bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
3797
- break;
3798
- case diagObj.db.LINETYPE.OPT_START:
3799
- adjustLoopHeightForWrap(
3800
- loopWidths,
3801
- msg,
3802
- conf.boxMargin,
3803
- conf.boxMargin + conf.boxTextMargin,
3804
- (message) => bounds.newLoop(message)
3805
- );
3806
- break;
3807
- case diagObj.db.LINETYPE.OPT_END:
3808
- loopModel = bounds.endLoop();
3809
- await svgDraw_default.drawLoop(diagram2, loopModel, "opt", conf, msg);
3810
- bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
3811
- bounds.models.addLoop(loopModel);
3812
- break;
3813
- case diagObj.db.LINETYPE.ALT_START:
3814
- adjustLoopHeightForWrap(
3815
- loopWidths,
3816
- msg,
3817
- conf.boxMargin,
3818
- conf.boxMargin + conf.boxTextMargin,
3819
- (message) => bounds.newLoop(message)
3820
- );
3821
- break;
3822
- case diagObj.db.LINETYPE.ALT_ELSE:
3823
- adjustLoopHeightForWrap(
3824
- loopWidths,
3825
- msg,
3826
- conf.boxMargin + conf.boxTextMargin,
3827
- conf.boxMargin,
3828
- (message) => bounds.addSectionToLoop(message)
3829
- );
3830
- break;
3831
- case diagObj.db.LINETYPE.ALT_END:
3832
- loopModel = bounds.endLoop();
3833
- await svgDraw_default.drawLoop(diagram2, loopModel, "alt", conf, msg);
3834
- bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
3835
- bounds.models.addLoop(loopModel);
3836
- break;
3837
- case diagObj.db.LINETYPE.PAR_START:
3838
- case diagObj.db.LINETYPE.PAR_OVER_START:
3839
- adjustLoopHeightForWrap(
3840
- loopWidths,
3841
- msg,
3842
- conf.boxMargin,
3843
- conf.boxMargin + conf.boxTextMargin,
3844
- (message) => bounds.newLoop(message)
3845
- );
3846
- bounds.saveVerticalPos();
3847
- break;
3848
- case diagObj.db.LINETYPE.PAR_AND:
3849
- adjustLoopHeightForWrap(
3850
- loopWidths,
3851
- msg,
3852
- conf.boxMargin + conf.boxTextMargin,
3853
- conf.boxMargin,
3854
- (message) => bounds.addSectionToLoop(message)
3855
- );
3856
- break;
3857
- case diagObj.db.LINETYPE.PAR_END:
3858
- loopModel = bounds.endLoop();
3859
- await svgDraw_default.drawLoop(diagram2, loopModel, "par", conf, msg);
3860
- bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
3861
- bounds.models.addLoop(loopModel);
3862
- break;
3863
- case diagObj.db.LINETYPE.AUTONUMBER:
3864
- sequenceIndex = msg.message.start || sequenceIndex;
3865
- sequenceIndexStep = msg.message.step || sequenceIndexStep;
3866
- if (msg.message.visible) {
3867
- diagObj.db.enableSequenceNumbers();
3868
- } else {
3869
- diagObj.db.disableSequenceNumbers();
3870
- }
3871
- break;
3872
- case diagObj.db.LINETYPE.CRITICAL_START:
3873
- adjustLoopHeightForWrap(
3874
- loopWidths,
3875
- msg,
3876
- conf.boxMargin,
3877
- conf.boxMargin + conf.boxTextMargin,
3878
- (message) => bounds.newLoop(message)
3879
- );
3880
- break;
3881
- case diagObj.db.LINETYPE.CRITICAL_OPTION:
3882
- adjustLoopHeightForWrap(
3883
- loopWidths,
3884
- msg,
3885
- conf.boxMargin + conf.boxTextMargin,
3886
- conf.boxMargin,
3887
- (message) => bounds.addSectionToLoop(message)
3888
- );
3889
- break;
3890
- case diagObj.db.LINETYPE.CRITICAL_END:
3891
- loopModel = bounds.endLoop();
3892
- await svgDraw_default.drawLoop(diagram2, loopModel, "critical", conf, msg);
3893
- bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
3894
- bounds.models.addLoop(loopModel);
3895
- break;
3896
- case diagObj.db.LINETYPE.BREAK_START:
3897
- adjustLoopHeightForWrap(
3898
- loopWidths,
3899
- msg,
3900
- conf.boxMargin,
3901
- conf.boxMargin + conf.boxTextMargin,
3902
- (message) => bounds.newLoop(message)
3903
- );
3904
- break;
3905
- case diagObj.db.LINETYPE.BREAK_END:
3906
- loopModel = bounds.endLoop();
3907
- await svgDraw_default.drawLoop(diagram2, loopModel, "break", conf, msg);
3908
- bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
3909
- bounds.models.addLoop(loopModel);
3910
- break;
3911
- default:
3912
- try {
3913
- msgModel = msg.msgModel;
3914
- msgModel.starty = bounds.getVerticalPos();
3915
- msgModel.sequenceIndex = sequenceIndex;
3916
- msgModel.sequenceVisible = diagObj.db.showSequenceNumbers();
3917
- msgModel.id = msg.id;
3918
- msgModel.from = msg.from;
3919
- msgModel.to = msg.to;
3920
- const lineStartY = await boundMessage(diagram2, msgModel);
3921
- adjustCreatedDestroyedData(
3922
- msg,
3923
- msgModel,
3924
- lineStartY,
3925
- index,
3926
- actors,
3927
- createdActors,
3928
- destroyedActors
3929
- );
3930
- messagesToDraw.push({ messageModel: msgModel, lineStartY, msg });
3931
- bounds.models.addMessage(msgModel);
3932
- } catch (e) {
3933
- log.error("error while drawing message", e);
3934
- }
3935
- }
3936
- if ([
3937
- diagObj.db.LINETYPE.SOLID_OPEN,
3938
- diagObj.db.LINETYPE.DOTTED_OPEN,
3939
- diagObj.db.LINETYPE.SOLID,
3940
- diagObj.db.LINETYPE.SOLID_TOP,
3941
- diagObj.db.LINETYPE.SOLID_BOTTOM,
3942
- diagObj.db.LINETYPE.STICK_TOP,
3943
- diagObj.db.LINETYPE.STICK_BOTTOM,
3944
- diagObj.db.LINETYPE.SOLID_TOP_DOTTED,
3945
- diagObj.db.LINETYPE.SOLID_BOTTOM_DOTTED,
3946
- diagObj.db.LINETYPE.STICK_TOP_DOTTED,
3947
- diagObj.db.LINETYPE.STICK_BOTTOM_DOTTED,
3948
- diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE,
3949
- diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE,
3950
- diagObj.db.LINETYPE.STICK_ARROW_TOP_REVERSE,
3951
- diagObj.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE,
3952
- diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED,
3953
- diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED,
3954
- diagObj.db.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED,
3955
- diagObj.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED,
3956
- diagObj.db.LINETYPE.DOTTED,
3957
- diagObj.db.LINETYPE.SOLID_CROSS,
3958
- diagObj.db.LINETYPE.DOTTED_CROSS,
3959
- diagObj.db.LINETYPE.SOLID_POINT,
3960
- diagObj.db.LINETYPE.DOTTED_POINT,
3961
- diagObj.db.LINETYPE.BIDIRECTIONAL_SOLID,
3962
- diagObj.db.LINETYPE.BIDIRECTIONAL_DOTTED
3963
- ].includes(msg.type)) {
3964
- sequenceIndex = Math.round((sequenceIndex + sequenceIndexStep) * 100) / 100;
3965
- }
3966
- index++;
3967
- }
3968
- log.debug("createdActors", createdActors);
3969
- log.debug("destroyedActors", destroyedActors);
3970
- await drawActors(diagram2, actors, actorKeys, false, id, diagObj, actorIndexMap);
3971
- for (const e of messagesToDraw) {
3972
- await drawMessage(diagram2, e.messageModel, e.lineStartY, diagObj, e.msg, id);
3973
- }
3974
- if (conf.mirrorActors) {
3975
- await drawActors(diagram2, actors, actorKeys, true, id, diagObj, actorIndexMap);
3976
- }
3977
- backgrounds.forEach((e) => svgDraw_default.drawBackgroundRect(diagram2, e));
3978
- fixLifeLineHeights(diagram2, actors, actorKeys, conf);
3979
- for (const box2 of bounds.models.boxes) {
3980
- box2.height = bounds.getVerticalPos() - box2.y;
3981
- bounds.insert(box2.x, box2.y, box2.x + box2.width, box2.height);
3982
- const boxPadding = conf.boxMargin * 2;
3983
- box2.startx = box2.x - boxPadding;
3984
- box2.starty = box2.y - boxPadding * 0.25;
3985
- box2.stopx = box2.startx + box2.width + 2 * boxPadding;
3986
- box2.stopy = box2.starty + box2.height + boxPadding * 0.75;
3987
- box2.stroke = "rgb(0,0,0, 0.5)";
3988
- svgDraw_default.drawBox(diagram2, box2, conf);
3989
- }
3990
- if (hasBoxes) {
3991
- bounds.bumpVerticalPos(conf.boxMargin);
3992
- }
3993
- const requiredBoxSize = drawActorsPopup(diagram2, actors, actorKeys, doc);
3994
- const { bounds: box } = bounds.getBounds();
3995
- if (box.startx === void 0) {
3996
- box.startx = 0;
3997
- }
3998
- if (box.starty === void 0) {
3999
- box.starty = 0;
4000
- }
4001
- if (box.stopx === void 0) {
4002
- box.stopx = 0;
4003
- }
4004
- if (box.stopy === void 0) {
4005
- box.stopy = 0;
4006
- }
4007
- let boxHeight = box.stopy - box.starty;
4008
- if (boxHeight < requiredBoxSize.maxHeight) {
4009
- boxHeight = requiredBoxSize.maxHeight;
4010
- }
4011
- let height = boxHeight + 2 * conf.diagramMarginY;
4012
- if (conf.mirrorActors) {
4013
- height = height - conf.boxMargin + conf.bottomMarginAdj;
4014
- }
4015
- let boxWidth = box.stopx - box.startx;
4016
- if (boxWidth < requiredBoxSize.maxWidth) {
4017
- boxWidth = requiredBoxSize.maxWidth;
4018
- }
4019
- const width = boxWidth + 2 * conf.diagramMarginX;
4020
- if (title) {
4021
- diagram2.append("text").text(title).attr("x", (box.stopx - box.startx) / 2 - 2 * conf.diagramMarginX).attr("y", -25);
4022
- }
4023
- configureSvgSize(diagram2, height, width, conf.useMaxWidth);
4024
- const extraVertForTitle = title ? 40 : 0;
4025
- const extraHeightForNeoActors = actors.size && look === "neo" ? 30 : 0;
4026
- diagram2.attr(
4027
- "viewBox",
4028
- box.startx - conf.diagramMarginX + " -" + (conf.diagramMarginY + extraVertForTitle) + " " + width + " " + (height + extraVertForTitle + extraHeightForNeoActors)
4029
- );
4030
- log.debug(`models:`, bounds.models);
4031
- }, "draw");
4032
- async function getMaxMessageWidthPerActor(actors, messages, diagObj) {
4033
- const maxMessageWidthPerActor = {};
4034
- for (const msg of messages) {
4035
- if (actors.get(msg.to) && actors.get(msg.from)) {
4036
- const actor = actors.get(msg.to);
4037
- if (msg.placement === diagObj.db.PLACEMENT.LEFTOF && !actor.prevActor) {
4038
- continue;
4039
- }
4040
- if (msg.placement === diagObj.db.PLACEMENT.RIGHTOF && !actor.nextActor) {
4041
- continue;
4042
- }
4043
- const isNote = msg.placement !== void 0;
4044
- const isMessage = !isNote;
4045
- const textFont = isNote ? noteFont(conf) : messageFont(conf);
4046
- const wrappedMessage = msg.wrap ? utils_default.wrapLabel(msg.message, conf.width - 2 * conf.wrapPadding, textFont) : msg.message;
4047
- const messageDimensions = hasKatex(wrappedMessage) ? await calculateMathMLDimensions(msg.message, getConfig2()) : utils_default.calculateTextDimensions(wrappedMessage, textFont);
4048
- const messageWidth = messageDimensions.width + 2 * conf.wrapPadding;
4049
- if (isMessage && msg.from === actor.nextActor) {
4050
- maxMessageWidthPerActor[msg.to] = common_default.getMax(
4051
- maxMessageWidthPerActor[msg.to] || 0,
4052
- messageWidth
4053
- );
4054
- } else if (isMessage && msg.from === actor.prevActor) {
4055
- maxMessageWidthPerActor[msg.from] = common_default.getMax(
4056
- maxMessageWidthPerActor[msg.from] || 0,
4057
- messageWidth
4058
- );
4059
- } else if (isMessage && msg.from === msg.to) {
4060
- maxMessageWidthPerActor[msg.from] = common_default.getMax(
4061
- maxMessageWidthPerActor[msg.from] || 0,
4062
- messageWidth / 2
4063
- );
4064
- maxMessageWidthPerActor[msg.to] = common_default.getMax(
4065
- maxMessageWidthPerActor[msg.to] || 0,
4066
- messageWidth / 2
4067
- );
4068
- } else if (msg.placement === diagObj.db.PLACEMENT.RIGHTOF) {
4069
- maxMessageWidthPerActor[msg.from] = common_default.getMax(
4070
- maxMessageWidthPerActor[msg.from] || 0,
4071
- messageWidth
4072
- );
4073
- } else if (msg.placement === diagObj.db.PLACEMENT.LEFTOF) {
4074
- maxMessageWidthPerActor[actor.prevActor] = common_default.getMax(
4075
- maxMessageWidthPerActor[actor.prevActor] || 0,
4076
- messageWidth
4077
- );
4078
- } else if (msg.placement === diagObj.db.PLACEMENT.OVER) {
4079
- if (actor.prevActor) {
4080
- maxMessageWidthPerActor[actor.prevActor] = common_default.getMax(
4081
- maxMessageWidthPerActor[actor.prevActor] || 0,
4082
- messageWidth / 2
4083
- );
4084
- }
4085
- if (actor.nextActor) {
4086
- maxMessageWidthPerActor[msg.from] = common_default.getMax(
4087
- maxMessageWidthPerActor[msg.from] || 0,
4088
- messageWidth / 2
4089
- );
4090
- }
4091
- }
4092
- }
4093
- }
4094
- log.debug("maxMessageWidthPerActor:", maxMessageWidthPerActor);
4095
- return maxMessageWidthPerActor;
4096
- }
4097
- __name(getMaxMessageWidthPerActor, "getMaxMessageWidthPerActor");
4098
- var getRequiredPopupWidth = /* @__PURE__ */ __name(function(actor) {
4099
- let requiredPopupWidth = 0;
4100
- const textFont = actorFont(conf);
4101
- for (const key in actor.links) {
4102
- const labelDimensions = utils_default.calculateTextDimensions(key, textFont);
4103
- const labelWidth = labelDimensions.width + 2 * conf.wrapPadding + 2 * conf.boxMargin;
4104
- if (requiredPopupWidth < labelWidth) {
4105
- requiredPopupWidth = labelWidth;
4106
- }
4107
- }
4108
- return requiredPopupWidth;
4109
- }, "getRequiredPopupWidth");
4110
- async function calculateActorMargins(actors, actorToMessageWidth, boxes) {
4111
- let maxHeight = 0;
4112
- for (const prop of actors.keys()) {
4113
- const actor = actors.get(prop);
4114
- if (actor.wrap) {
4115
- actor.description = utils_default.wrapLabel(
4116
- actor.description,
4117
- conf.width - 2 * conf.wrapPadding,
4118
- actorFont(conf)
4119
- );
4120
- }
4121
- const actDims = hasKatex(actor.description) ? await calculateMathMLDimensions(actor.description, getConfig2()) : utils_default.calculateTextDimensions(actor.description, actorFont(conf));
4122
- actor.width = actor.wrap ? conf.width : common_default.getMax(conf.width, actDims.width + 2 * conf.wrapPadding);
4123
- actor.height = actor.wrap ? common_default.getMax(actDims.height, conf.height) : conf.height;
4124
- maxHeight = common_default.getMax(maxHeight, actor.height);
4125
- }
4126
- for (const actorKey in actorToMessageWidth) {
4127
- const actor = actors.get(actorKey);
4128
- if (!actor) {
4129
- continue;
4130
- }
4131
- const nextActor = actors.get(actor.nextActor);
4132
- if (!nextActor) {
4133
- const messageWidth2 = actorToMessageWidth[actorKey];
4134
- const actorWidth2 = messageWidth2 + conf.actorMargin - actor.width / 2;
4135
- actor.margin = common_default.getMax(actorWidth2, conf.actorMargin);
4136
- continue;
4137
- }
4138
- const messageWidth = actorToMessageWidth[actorKey];
4139
- const actorWidth = messageWidth + conf.actorMargin - actor.width / 2 - nextActor.width / 2;
4140
- actor.margin = common_default.getMax(actorWidth, conf.actorMargin);
4141
- }
4142
- let maxBoxHeight = 0;
4143
- boxes.forEach((box) => {
4144
- const textFont = messageFont(conf);
4145
- let totalWidth = box.actorKeys.reduce((total, aKey) => {
4146
- return total += actors.get(aKey).width + (actors.get(aKey).margin || 0);
4147
- }, 0);
4148
- const standardBoxPadding = conf.boxMargin * 8;
4149
- totalWidth += standardBoxPadding;
4150
- totalWidth -= 2 * conf.boxTextMargin;
4151
- if (box.wrap) {
4152
- box.name = utils_default.wrapLabel(box.name, totalWidth - 2 * conf.wrapPadding, textFont);
4153
- }
4154
- const boxMsgDimensions = utils_default.calculateTextDimensions(box.name, textFont);
4155
- maxBoxHeight = common_default.getMax(boxMsgDimensions.height, maxBoxHeight);
4156
- const minWidth = common_default.getMax(totalWidth, boxMsgDimensions.width + 2 * conf.wrapPadding);
4157
- box.margin = conf.boxTextMargin;
4158
- if (totalWidth < minWidth) {
4159
- const missing = (minWidth - totalWidth) / 2;
4160
- box.margin += missing;
4161
- }
4162
- });
4163
- boxes.forEach((box) => box.textMaxHeight = maxBoxHeight);
4164
- return common_default.getMax(maxHeight, conf.height);
4165
- }
4166
- __name(calculateActorMargins, "calculateActorMargins");
4167
- var buildNoteModel = /* @__PURE__ */ __name(async function(msg, actors, diagObj) {
4168
- const fromActor = actors.get(msg.from);
4169
- const toActor = actors.get(msg.to);
4170
- const startx = fromActor.x;
4171
- const stopx = toActor.x;
4172
- const shouldWrap = msg.wrap && msg.message;
4173
- let textDimensions = hasKatex(msg.message) ? await calculateMathMLDimensions(msg.message, getConfig2()) : utils_default.calculateTextDimensions(
4174
- shouldWrap ? utils_default.wrapLabel(msg.message, conf.width, noteFont(conf)) : msg.message,
4175
- noteFont(conf)
4176
- );
4177
- const noteModel = {
4178
- width: shouldWrap ? conf.width : common_default.getMax(conf.width, textDimensions.width + 2 * conf.noteMargin),
4179
- height: 0,
4180
- startx: fromActor.x,
4181
- stopx: 0,
4182
- starty: 0,
4183
- stopy: 0,
4184
- message: msg.message
4185
- };
4186
- if (msg.placement === diagObj.db.PLACEMENT.RIGHTOF) {
4187
- noteModel.width = shouldWrap ? common_default.getMax(conf.width, textDimensions.width) : common_default.getMax(
4188
- fromActor.width / 2 + toActor.width / 2,
4189
- textDimensions.width + 2 * conf.noteMargin
4190
- );
4191
- noteModel.startx = startx + (fromActor.width + conf.actorMargin) / 2;
4192
- } else if (msg.placement === diagObj.db.PLACEMENT.LEFTOF) {
4193
- noteModel.width = shouldWrap ? common_default.getMax(conf.width, textDimensions.width + 2 * conf.noteMargin) : common_default.getMax(
4194
- fromActor.width / 2 + toActor.width / 2,
4195
- textDimensions.width + 2 * conf.noteMargin
4196
- );
4197
- noteModel.startx = startx - noteModel.width + (fromActor.width - conf.actorMargin) / 2;
4198
- } else if (msg.to === msg.from) {
4199
- textDimensions = utils_default.calculateTextDimensions(
4200
- shouldWrap ? utils_default.wrapLabel(msg.message, common_default.getMax(conf.width, fromActor.width), noteFont(conf)) : msg.message,
4201
- noteFont(conf)
4202
- );
4203
- noteModel.width = shouldWrap ? common_default.getMax(conf.width, fromActor.width) : common_default.getMax(fromActor.width, conf.width, textDimensions.width + 2 * conf.noteMargin);
4204
- noteModel.startx = startx + (fromActor.width - noteModel.width) / 2;
4205
- } else {
4206
- noteModel.width = Math.abs(startx + fromActor.width / 2 - (stopx + toActor.width / 2)) + conf.actorMargin;
4207
- noteModel.startx = startx < stopx ? startx + fromActor.width / 2 - conf.actorMargin / 2 : stopx + toActor.width / 2 - conf.actorMargin / 2;
4208
- }
4209
- if (shouldWrap) {
4210
- noteModel.message = utils_default.wrapLabel(
4211
- msg.message,
4212
- noteModel.width - 2 * conf.wrapPadding,
4213
- noteFont(conf)
4214
- );
4215
- }
4216
- log.debug(
4217
- `NM:[${noteModel.startx},${noteModel.stopx},${noteModel.starty},${noteModel.stopy}:${noteModel.width},${noteModel.height}=${msg.message}]`
4218
- );
4219
- return noteModel;
4220
- }, "buildNoteModel");
4221
- var CENTRAL_CONNECTION_BASE_OFFSET = 4;
4222
- var hasCentralConnection = /* @__PURE__ */ __name(function(msg, diagObj) {
4223
- const { CENTRAL_CONNECTION, CENTRAL_CONNECTION_REVERSE, CENTRAL_CONNECTION_DUAL } = diagObj.db.LINETYPE;
4224
- return [CENTRAL_CONNECTION, CENTRAL_CONNECTION_REVERSE, CENTRAL_CONNECTION_DUAL].includes(
4225
- msg.centralConnection
4226
- );
4227
- }, "hasCentralConnection");
4228
- var calculateCentralConnectionOffset = /* @__PURE__ */ __name(function(msg, diagObj, isArrowToRight) {
4229
- const {
4230
- CENTRAL_CONNECTION_REVERSE,
4231
- CENTRAL_CONNECTION_DUAL,
4232
- BIDIRECTIONAL_SOLID,
4233
- BIDIRECTIONAL_DOTTED
4234
- } = diagObj.db.LINETYPE;
4235
- let offset = 0;
4236
- if (msg.centralConnection === CENTRAL_CONNECTION_REVERSE || msg.centralConnection === CENTRAL_CONNECTION_DUAL) {
4237
- offset += CENTRAL_CONNECTION_BASE_OFFSET;
4238
- }
4239
- if ((msg.centralConnection === CENTRAL_CONNECTION_REVERSE || msg.centralConnection === CENTRAL_CONNECTION_DUAL) && (msg.type === BIDIRECTIONAL_SOLID || msg.type === BIDIRECTIONAL_DOTTED)) {
4240
- offset += isArrowToRight ? 0 : -6;
4241
- }
4242
- return offset;
4243
- }, "calculateCentralConnectionOffset");
4244
- var isReverseArrowType = /* @__PURE__ */ __name(function(msg, diagObj) {
4245
- const {
4246
- SOLID_ARROW_TOP_REVERSE,
4247
- SOLID_ARROW_TOP_REVERSE_DOTTED,
4248
- SOLID_ARROW_BOTTOM_REVERSE,
4249
- SOLID_ARROW_BOTTOM_REVERSE_DOTTED,
4250
- STICK_ARROW_TOP_REVERSE,
4251
- STICK_ARROW_TOP_REVERSE_DOTTED,
4252
- STICK_ARROW_BOTTOM_REVERSE,
4253
- STICK_ARROW_BOTTOM_REVERSE_DOTTED
4254
- } = diagObj.db.LINETYPE;
4255
- return [
4256
- SOLID_ARROW_TOP_REVERSE,
4257
- SOLID_ARROW_TOP_REVERSE_DOTTED,
4258
- SOLID_ARROW_BOTTOM_REVERSE,
4259
- SOLID_ARROW_BOTTOM_REVERSE_DOTTED,
4260
- STICK_ARROW_TOP_REVERSE,
4261
- STICK_ARROW_TOP_REVERSE_DOTTED,
4262
- STICK_ARROW_BOTTOM_REVERSE,
4263
- STICK_ARROW_BOTTOM_REVERSE_DOTTED
4264
- ].includes(msg.type);
4265
- }, "isReverseArrowType");
4266
- var isBidirectionalArrowType = /* @__PURE__ */ __name(function(msg, diagObj) {
4267
- const { BIDIRECTIONAL_SOLID, BIDIRECTIONAL_DOTTED } = diagObj.db.LINETYPE;
4268
- return [BIDIRECTIONAL_SOLID, BIDIRECTIONAL_DOTTED].includes(msg.type);
4269
- }, "isBidirectionalArrowType");
4270
- var buildMessageModel = /* @__PURE__ */ __name(function(msg, actors, diagObj) {
4271
- const { look } = getConfig2();
4272
- if (![
4273
- diagObj.db.LINETYPE.SOLID_OPEN,
4274
- diagObj.db.LINETYPE.DOTTED_OPEN,
4275
- diagObj.db.LINETYPE.SOLID,
4276
- diagObj.db.LINETYPE.SOLID_TOP,
4277
- diagObj.db.LINETYPE.SOLID_BOTTOM,
4278
- diagObj.db.LINETYPE.STICK_TOP,
4279
- diagObj.db.LINETYPE.STICK_BOTTOM,
4280
- diagObj.db.LINETYPE.SOLID_TOP_DOTTED,
4281
- diagObj.db.LINETYPE.SOLID_BOTTOM_DOTTED,
4282
- diagObj.db.LINETYPE.STICK_TOP_DOTTED,
4283
- diagObj.db.LINETYPE.STICK_BOTTOM_DOTTED,
4284
- diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE,
4285
- diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE,
4286
- diagObj.db.LINETYPE.STICK_ARROW_TOP_REVERSE,
4287
- diagObj.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE,
4288
- diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED,
4289
- diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED,
4290
- diagObj.db.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED,
4291
- diagObj.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED,
4292
- diagObj.db.LINETYPE.DOTTED,
4293
- diagObj.db.LINETYPE.SOLID_CROSS,
4294
- diagObj.db.LINETYPE.DOTTED_CROSS,
4295
- diagObj.db.LINETYPE.SOLID_POINT,
4296
- diagObj.db.LINETYPE.DOTTED_POINT,
4297
- diagObj.db.LINETYPE.BIDIRECTIONAL_SOLID,
4298
- diagObj.db.LINETYPE.BIDIRECTIONAL_DOTTED
4299
- ].includes(msg.type)) {
4300
- return {};
4301
- }
4302
- const [fromLeft, fromRight] = activationBounds(msg.from, actors);
4303
- const [toLeft, toRight] = activationBounds(msg.to, actors);
4304
- const isArrowToRight = fromLeft <= toLeft;
4305
- let startx = isArrowToRight ? fromRight : fromLeft;
4306
- let stopx = isArrowToRight ? toLeft : toRight;
4307
- if (look === "neo") {
4308
- const offset = 3;
4309
- if (msg.type !== diagObj.db.LINETYPE.SOLID_OPEN) {
4310
- stopx += isArrowToRight ? -offset : offset;
4311
- }
4312
- if (msg.type === diagObj.db.LINETYPE.BIDIRECTIONAL_SOLID || msg.type === diagObj.db.LINETYPE.BIDIRECTIONAL_DOTTED) {
4313
- startx += isArrowToRight ? offset : -offset;
4314
- }
4315
- }
4316
- startx += calculateCentralConnectionOffset(msg, diagObj, isArrowToRight);
4317
- const isArrowToActivation = Math.abs(toLeft - toRight) > 2;
4318
- const adjustValue = /* @__PURE__ */ __name((value) => {
4319
- return isArrowToRight ? -value : value;
4320
- }, "adjustValue");
4321
- if (msg.from === msg.to) {
4322
- stopx = startx;
4323
- } else {
4324
- if (msg.activate && !isArrowToActivation) {
4325
- stopx += adjustValue(conf.activationWidth / 2 - 1);
4326
- }
4327
- if (![
4328
- diagObj.db.LINETYPE.SOLID_OPEN,
4329
- diagObj.db.LINETYPE.DOTTED_OPEN,
4330
- diagObj.db.LINETYPE.STICK_TOP,
4331
- diagObj.db.LINETYPE.STICK_BOTTOM,
4332
- diagObj.db.LINETYPE.STICK_TOP_DOTTED,
4333
- diagObj.db.LINETYPE.STICK_BOTTOM_DOTTED,
4334
- diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED,
4335
- diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED,
4336
- diagObj.db.LINETYPE.STICK_ARROW_TOP_REVERSE,
4337
- diagObj.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE,
4338
- diagObj.db.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED,
4339
- diagObj.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED,
4340
- diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE,
4341
- diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE
4342
- ].includes(msg.type)) {
4343
- stopx += adjustValue(3);
4344
- }
4345
- if ([
4346
- diagObj.db.LINETYPE.BIDIRECTIONAL_SOLID,
4347
- diagObj.db.LINETYPE.BIDIRECTIONAL_DOTTED,
4348
- diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED,
4349
- diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED,
4350
- diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE,
4351
- diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE
4352
- ].includes(msg.type)) {
4353
- startx -= adjustValue(3);
4354
- }
4355
- }
4356
- const allBounds = [fromLeft, fromRight, toLeft, toRight];
4357
- const boundedWidth = Math.abs(startx - stopx);
4358
- if (msg.wrap && msg.message) {
4359
- msg.message = utils_default.wrapLabel(
4360
- msg.message,
4361
- common_default.getMax(boundedWidth + 2 * conf.wrapPadding, conf.width),
4362
- messageFont(conf)
4363
- );
4364
- }
4365
- const msgDims = utils_default.calculateTextDimensions(msg.message, messageFont(conf));
4366
- return {
4367
- width: common_default.getMax(
4368
- msg.wrap ? 0 : msgDims.width + 2 * conf.wrapPadding,
4369
- boundedWidth + 2 * conf.wrapPadding,
4370
- conf.width
4371
- ),
4372
- height: 0,
4373
- startx,
4374
- stopx,
4375
- starty: 0,
4376
- stopy: 0,
4377
- message: msg.message,
4378
- type: msg.type,
4379
- wrap: msg.wrap,
4380
- fromBounds: Math.min.apply(null, allBounds),
4381
- toBounds: Math.max.apply(null, allBounds)
4382
- };
4383
- }, "buildMessageModel");
4384
- var calculateLoopBounds = /* @__PURE__ */ __name(async function(messages, actors, _maxWidthPerActor, diagObj) {
4385
- const loops = {};
4386
- const stack = [];
4387
- let current, noteModel, msgModel;
4388
- for (const msg of messages) {
4389
- switch (msg.type) {
4390
- case diagObj.db.LINETYPE.LOOP_START:
4391
- case diagObj.db.LINETYPE.ALT_START:
4392
- case diagObj.db.LINETYPE.OPT_START:
4393
- case diagObj.db.LINETYPE.PAR_START:
4394
- case diagObj.db.LINETYPE.PAR_OVER_START:
4395
- case diagObj.db.LINETYPE.CRITICAL_START:
4396
- case diagObj.db.LINETYPE.BREAK_START:
4397
- stack.push({
4398
- id: msg.id,
4399
- msg: msg.message,
4400
- from: Number.MAX_SAFE_INTEGER,
4401
- to: Number.MIN_SAFE_INTEGER,
4402
- width: 0
4403
- });
4404
- break;
4405
- case diagObj.db.LINETYPE.ALT_ELSE:
4406
- case diagObj.db.LINETYPE.PAR_AND:
4407
- case diagObj.db.LINETYPE.CRITICAL_OPTION:
4408
- if (msg.message) {
4409
- current = stack.pop();
4410
- loops[current.id] = current;
4411
- loops[msg.id] = current;
4412
- stack.push(current);
4413
- }
4414
- break;
4415
- case diagObj.db.LINETYPE.LOOP_END:
4416
- case diagObj.db.LINETYPE.ALT_END:
4417
- case diagObj.db.LINETYPE.OPT_END:
4418
- case diagObj.db.LINETYPE.PAR_END:
4419
- case diagObj.db.LINETYPE.CRITICAL_END:
4420
- case diagObj.db.LINETYPE.BREAK_END:
4421
- current = stack.pop();
4422
- loops[current.id] = current;
4423
- break;
4424
- case diagObj.db.LINETYPE.ACTIVE_START:
4425
- {
4426
- const actorRect = actors.get(msg.from ? msg.from : msg.to.actor);
4427
- const stackedSize = actorActivations(msg.from ? msg.from : msg.to.actor).length;
4428
- const x = actorRect.x + actorRect.width / 2 + (stackedSize - 1) * conf.activationWidth / 2;
4429
- const toAdd = {
4430
- startx: x,
4431
- stopx: x + conf.activationWidth,
4432
- actor: msg.from,
4433
- enabled: true
4434
- };
4435
- bounds.activations.push(toAdd);
4436
- }
4437
- break;
4438
- case diagObj.db.LINETYPE.ACTIVE_END:
4439
- {
4440
- const lastActorActivationIdx = bounds.activations.map((a) => a.actor).lastIndexOf(msg.from);
4441
- bounds.activations.splice(lastActorActivationIdx, 1).splice(0, 1);
4442
- }
4443
- break;
4444
- }
4445
- const isNote = msg.placement !== void 0;
4446
- if (isNote) {
4447
- noteModel = await buildNoteModel(msg, actors, diagObj);
4448
- msg.noteModel = noteModel;
4449
- stack.forEach((stk) => {
4450
- current = stk;
4451
- current.from = common_default.getMin(current.from, noteModel.startx);
4452
- current.to = common_default.getMax(current.to, noteModel.startx + noteModel.width);
4453
- current.width = common_default.getMax(current.width, Math.abs(current.from - current.to)) - conf.labelBoxWidth;
4454
- });
4455
- } else {
4456
- msgModel = buildMessageModel(msg, actors, diagObj);
4457
- msg.msgModel = msgModel;
4458
- if (msgModel.startx && msgModel.stopx && stack.length > 0) {
4459
- stack.forEach((stk) => {
4460
- current = stk;
4461
- if (msgModel.startx === msgModel.stopx) {
4462
- const from = actors.get(msg.from);
4463
- const to = actors.get(msg.to);
4464
- current.from = common_default.getMin(
4465
- from.x - msgModel.width / 2,
4466
- from.x - from.width / 2,
4467
- current.from
4468
- );
4469
- current.to = common_default.getMax(
4470
- to.x + msgModel.width / 2,
4471
- to.x + from.width / 2,
4472
- current.to
4473
- );
4474
- current.width = common_default.getMax(current.width, Math.abs(current.to - current.from)) - conf.labelBoxWidth;
4475
- } else {
4476
- current.from = common_default.getMin(msgModel.startx, current.from);
4477
- current.to = common_default.getMax(msgModel.stopx, current.to);
4478
- current.width = common_default.getMax(current.width, msgModel.width) - conf.labelBoxWidth;
4479
- }
4480
- });
4481
- }
4482
- }
4483
- }
4484
- bounds.activations = [];
4485
- log.debug("Loop type widths:", loops);
4486
- return loops;
4487
- }, "calculateLoopBounds");
4488
- var sequenceRenderer_default = {
4489
- bounds,
4490
- drawActors,
4491
- drawActorsPopup,
4492
- setConf,
4493
- draw
4494
- };
4495
- var diagram = {
4496
- parser: sequenceDiagram_default,
4497
- get db() {
4498
- return new SequenceDB();
4499
- },
4500
- renderer: sequenceRenderer_default,
4501
- styles: styles_default,
4502
- init: /* @__PURE__ */ __name((cnf) => {
4503
- if (!cnf.sequence) {
4504
- cnf.sequence = {};
4505
- }
4506
- if (cnf.wrap) {
4507
- cnf.sequence.wrap = cnf.wrap;
4508
- setConfig2({ sequence: { wrap: cnf.wrap } });
4509
- }
4510
- }, "init")
4511
- };
4512
- export {
4513
- diagram
4514
- };