jekyll-ham 1.0.4 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (366) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +11 -2
  3. data/_layouts/default.html +6 -0
  4. data/_layouts/page.html +1 -1
  5. data/assets/mermaid/Diagram.d.ts +33 -0
  6. data/assets/mermaid/Tableau10-31042135.js +10 -0
  7. data/assets/mermaid/Tableau10-558cc280.js +9 -0
  8. data/assets/mermaid/__mocks__/mermaidAPI.d.ts +13 -0
  9. data/assets/mermaid/accessibility.d.ts +27 -0
  10. data/assets/mermaid/accessibility.spec.d.ts +1 -0
  11. data/assets/mermaid/arc-c0f908ab.js +148 -0
  12. data/assets/mermaid/arc-d1f6357e.js +86 -0
  13. data/assets/mermaid/array-2ff2c7a6.js +6 -0
  14. data/assets/mermaid/array-b7dcf730.js +6 -0
  15. data/assets/mermaid/assignWithDepth.d.ts +30 -0
  16. data/assets/mermaid/blockDiagram-5dc23a45.js +1230 -0
  17. data/assets/mermaid/blockDiagram-9f4a6865.js +1822 -0
  18. data/assets/mermaid/blockDiagram-efe38566.js +1818 -0
  19. data/assets/mermaid/c4Diagram-1e775db3.js +1579 -0
  20. data/assets/mermaid/c4Diagram-ae766693.js +2473 -0
  21. data/assets/mermaid/c4Diagram-af207393.js +2463 -0
  22. data/assets/mermaid/channel-ebbc4130.js +5 -0
  23. data/assets/mermaid/channel-f9001828.js +8 -0
  24. data/assets/mermaid/classDiagram-72b9c71d.js +356 -0
  25. data/assets/mermaid/classDiagram-f52caa06.js +220 -0
  26. data/assets/mermaid/classDiagram-fb54d2a0.js +363 -0
  27. data/assets/mermaid/classDiagram-v2-640c694e.js +206 -0
  28. data/assets/mermaid/classDiagram-v2-a2b738ad.js +298 -0
  29. data/assets/mermaid/classDiagram-v2-fedb80f6.js +290 -0
  30. data/assets/mermaid/clone-9ea6bfeb.js +8 -0
  31. data/assets/mermaid/clone-afc2f047.js +8 -0
  32. data/assets/mermaid/config.d.ts +98 -0
  33. data/assets/mermaid/config.spec.d.ts +1 -0
  34. data/assets/mermaid/config.type.d.ts +1534 -0
  35. data/assets/mermaid/createText-03b82060.js +2966 -0
  36. data/assets/mermaid/createText-b70fe78a.js +4929 -0
  37. data/assets/mermaid/createText-ca0c5216.js +251 -0
  38. data/assets/mermaid/dagre-wrapper/blockArrowHelper.d.ts +8 -0
  39. data/assets/mermaid/dagre-wrapper/clusters.d.ts +4 -0
  40. data/assets/mermaid/dagre-wrapper/createLabel.d.ts +9 -0
  41. data/assets/mermaid/dagre-wrapper/edgeMarker.d.ts +12 -0
  42. data/assets/mermaid/dagre-wrapper/edgeMarker.spec.d.ts +1 -0
  43. data/assets/mermaid/dagre-wrapper/edges.d.ts +14 -0
  44. data/assets/mermaid/dagre-wrapper/index.d.ts +1 -0
  45. data/assets/mermaid/dagre-wrapper/intersect/index.d.ts +13 -0
  46. data/assets/mermaid/dagre-wrapper/intersect/intersect-circle.d.ts +10 -0
  47. data/assets/mermaid/dagre-wrapper/intersect/intersect-ellipse.d.ts +11 -0
  48. data/assets/mermaid/dagre-wrapper/intersect/intersect-line.d.ts +13 -0
  49. data/assets/mermaid/dagre-wrapper/intersect/intersect-node.d.ts +6 -0
  50. data/assets/mermaid/dagre-wrapper/intersect/intersect-polygon.d.ts +10 -0
  51. data/assets/mermaid/dagre-wrapper/intersect/intersect-rect.d.ts +5 -0
  52. data/assets/mermaid/dagre-wrapper/markers.d.ts +2 -0
  53. data/assets/mermaid/dagre-wrapper/mermaid-graphlib.d.ts +8 -0
  54. data/assets/mermaid/dagre-wrapper/nodes.d.ts +4 -0
  55. data/assets/mermaid/dagre-wrapper/shapes/note.d.ts +2 -0
  56. data/assets/mermaid/dagre-wrapper/shapes/util.d.ts +14 -0
  57. data/assets/mermaid/defaultConfig.d.ts +12 -0
  58. data/assets/mermaid/diagram-api/comments.d.ts +6 -0
  59. data/assets/mermaid/diagram-api/comments.spec.d.ts +1 -0
  60. data/assets/mermaid/diagram-api/detectType.d.ts +42 -0
  61. data/assets/mermaid/diagram-api/diagram-orchestration.d.ts +1 -0
  62. data/assets/mermaid/diagram-api/diagram-orchestration.spec.d.ts +1 -0
  63. data/assets/mermaid/diagram-api/diagramAPI.d.ts +31 -0
  64. data/assets/mermaid/diagram-api/diagramAPI.spec.d.ts +1 -0
  65. data/assets/mermaid/diagram-api/frontmatter.d.ts +18 -0
  66. data/assets/mermaid/diagram-api/frontmatter.spec.d.ts +1 -0
  67. data/assets/mermaid/diagram-api/loadDiagram.d.ts +1 -0
  68. data/assets/mermaid/diagram-api/regexes.d.ts +3 -0
  69. data/assets/mermaid/diagram-api/types.d.ts +84 -0
  70. data/assets/mermaid/diagram.spec.d.ts +1 -0
  71. data/assets/mermaid/diagrams/block/blockDB.d.ts +54 -0
  72. data/assets/mermaid/diagrams/block/blockDetector.d.ts +3 -0
  73. data/assets/mermaid/diagrams/block/blockDiagram.d.ts +2 -0
  74. data/assets/mermaid/diagrams/block/blockRenderer.d.ts +15 -0
  75. data/assets/mermaid/diagrams/block/blockTypes.d.ts +36 -0
  76. data/assets/mermaid/diagrams/block/blockUtils.d.ts +1 -0
  77. data/assets/mermaid/diagrams/block/layout.d.ts +13 -0
  78. data/assets/mermaid/diagrams/block/layout.spec.d.ts +1 -0
  79. data/assets/mermaid/diagrams/block/parser/block.spec.d.ts +1 -0
  80. data/assets/mermaid/diagrams/block/renderHelpers.d.ts +10 -0
  81. data/assets/mermaid/diagrams/block/styles.d.ts +18 -0
  82. data/assets/mermaid/diagrams/c4/c4Db.d.ts +127 -0
  83. data/assets/mermaid/diagrams/c4/c4Detector.d.ts +3 -0
  84. data/assets/mermaid/diagrams/c4/c4Diagram.d.ts +2 -0
  85. data/assets/mermaid/diagrams/c4/c4Renderer.d.ts +12 -0
  86. data/assets/mermaid/diagrams/c4/styles.d.ts +2 -0
  87. data/assets/mermaid/diagrams/c4/svgDraw.d.ts +36 -0
  88. data/assets/mermaid/diagrams/class/classDb.d.ts +144 -0
  89. data/assets/mermaid/diagrams/class/classDetector-V2.d.ts +3 -0
  90. data/assets/mermaid/diagrams/class/classDetector.d.ts +3 -0
  91. data/assets/mermaid/diagrams/class/classDiagram-v2.d.ts +2 -0
  92. data/assets/mermaid/diagrams/class/classDiagram.d.ts +2 -0
  93. data/assets/mermaid/diagrams/class/classDiagram.spec.d.ts +1 -0
  94. data/assets/mermaid/diagrams/class/classRenderer-v2.d.ts +57 -0
  95. data/assets/mermaid/diagrams/class/classRenderer.d.ts +5 -0
  96. data/assets/mermaid/diagrams/class/classTypes.d.ts +78 -0
  97. data/assets/mermaid/diagrams/class/classTypes.spec.d.ts +1 -0
  98. data/assets/mermaid/diagrams/class/styles.d.ts +2 -0
  99. data/assets/mermaid/diagrams/class/svgDraw.d.ts +25 -0
  100. data/assets/mermaid/diagrams/common/common.d.ts +110 -0
  101. data/assets/mermaid/diagrams/common/common.spec.d.ts +1 -0
  102. data/assets/mermaid/diagrams/common/commonDb.d.ts +7 -0
  103. data/assets/mermaid/diagrams/common/commonTypes.d.ts +51 -0
  104. data/assets/mermaid/diagrams/common/svgDrawCommon.d.ts +15 -0
  105. data/assets/mermaid/diagrams/er/erDb.d.ts +49 -0
  106. data/assets/mermaid/diagrams/er/erDetector.d.ts +3 -0
  107. data/assets/mermaid/diagrams/er/erDiagram.d.ts +34 -0
  108. data/assets/mermaid/diagrams/er/erMarkers.d.ts +24 -0
  109. data/assets/mermaid/diagrams/er/erRenderer.d.ts +19 -0
  110. data/assets/mermaid/diagrams/er/erRenderer.spec.d.ts +1 -0
  111. data/assets/mermaid/diagrams/er/styles.d.ts +2 -0
  112. data/assets/mermaid/diagrams/error/errorDiagram.d.ts +3 -0
  113. data/assets/mermaid/diagrams/error/errorRenderer.d.ts +12 -0
  114. data/assets/mermaid/diagrams/flowchart/elk/detector.d.ts +3 -0
  115. data/assets/mermaid/diagrams/flowchart/elk/detector.spec.d.ts +1 -0
  116. data/assets/mermaid/diagrams/flowchart/elk/flowRenderer-elk.d.ts +10 -0
  117. data/assets/mermaid/diagrams/flowchart/elk/flowchart-elk-definition.d.ts +10 -0
  118. data/assets/mermaid/diagrams/flowchart/elk/render-utils.d.ts +5 -0
  119. data/assets/mermaid/diagrams/flowchart/elk/render-utils.spec.d.ts +1 -0
  120. data/assets/mermaid/diagrams/flowchart/elk/styles.d.ts +19 -0
  121. data/assets/mermaid/diagrams/flowchart/flowChartShapes.d.ts +9 -0
  122. data/assets/mermaid/diagrams/flowchart/flowDb.d.ts +87 -0
  123. data/assets/mermaid/diagrams/flowchart/flowDetector-v2.d.ts +3 -0
  124. data/assets/mermaid/diagrams/flowchart/flowDetector.d.ts +3 -0
  125. data/assets/mermaid/diagrams/flowchart/flowDiagram-v2.d.ts +57 -0
  126. data/assets/mermaid/diagrams/flowchart/flowDiagram.d.ts +57 -0
  127. data/assets/mermaid/diagrams/flowchart/flowRenderer-v2.d.ts +13 -0
  128. data/assets/mermaid/diagrams/flowchart/flowRenderer.d.ts +13 -0
  129. data/assets/mermaid/diagrams/flowchart/styles.d.ts +18 -0
  130. data/assets/mermaid/diagrams/gantt/ganttDb.d.ts +106 -0
  131. data/assets/mermaid/diagrams/gantt/ganttDb.spec.d.ts +1 -0
  132. data/assets/mermaid/diagrams/gantt/ganttDetector.d.ts +3 -0
  133. data/assets/mermaid/diagrams/gantt/ganttDiagram.d.ts +2 -0
  134. data/assets/mermaid/diagrams/gantt/ganttRenderer.d.ts +7 -0
  135. data/assets/mermaid/diagrams/gantt/styles.d.ts +2 -0
  136. data/assets/mermaid/diagrams/git/gitGraphAst.d.ts +61 -0
  137. data/assets/mermaid/diagrams/git/gitGraphDetector.d.ts +3 -0
  138. data/assets/mermaid/diagrams/git/gitGraphDiagram.d.ts +2 -0
  139. data/assets/mermaid/diagrams/git/gitGraphRenderer.d.ts +5 -0
  140. data/assets/mermaid/diagrams/git/styles.d.ts +2 -0
  141. data/assets/mermaid/diagrams/info/info.spec.d.ts +1 -0
  142. data/assets/mermaid/diagrams/info/infoDb.d.ts +5 -0
  143. data/assets/mermaid/diagrams/info/infoDetector.d.ts +2 -0
  144. data/assets/mermaid/diagrams/info/infoDiagram.d.ts +2 -0
  145. data/assets/mermaid/diagrams/info/infoRenderer.d.ts +4 -0
  146. data/assets/mermaid/diagrams/info/infoTypes.d.ts +9 -0
  147. data/assets/mermaid/diagrams/mindmap/detector.d.ts +3 -0
  148. data/assets/mermaid/diagrams/mindmap/mindmap-definition.d.ts +2 -0
  149. data/assets/mermaid/diagrams/mindmap/mindmap.spec.d.ts +1 -0
  150. data/assets/mermaid/diagrams/mindmap/mindmapDb.d.ts +30 -0
  151. data/assets/mermaid/diagrams/mindmap/mindmapRenderer.d.ts +21 -0
  152. data/assets/mermaid/diagrams/mindmap/mindmapTypes.d.ts +20 -0
  153. data/assets/mermaid/diagrams/mindmap/styles.d.ts +3 -0
  154. data/assets/mermaid/diagrams/mindmap/svgDraw.d.ts +13 -0
  155. data/assets/mermaid/diagrams/pie/pie.spec.d.ts +1 -0
  156. data/assets/mermaid/diagrams/pie/pieDb.d.ts +6 -0
  157. data/assets/mermaid/diagrams/pie/pieDetector.d.ts +2 -0
  158. data/assets/mermaid/diagrams/pie/pieDiagram.d.ts +2 -0
  159. data/assets/mermaid/diagrams/pie/pieRenderer.d.ts +13 -0
  160. data/assets/mermaid/diagrams/pie/pieStyles.d.ts +3 -0
  161. data/assets/mermaid/diagrams/pie/pieTypes.d.ts +53 -0
  162. data/assets/mermaid/diagrams/quadrant-chart/parser/quadrant.jison.spec.d.ts +1 -0
  163. data/assets/mermaid/diagrams/quadrant-chart/quadrantBuilder.d.ts +118 -0
  164. data/assets/mermaid/diagrams/quadrant-chart/quadrantDb.d.ts +38 -0
  165. data/assets/mermaid/diagrams/quadrant-chart/quadrantDetector.d.ts +3 -0
  166. data/assets/mermaid/diagrams/quadrant-chart/quadrantDiagram.d.ts +2 -0
  167. data/assets/mermaid/diagrams/quadrant-chart/quadrantRenderer.d.ts +6 -0
  168. data/assets/mermaid/diagrams/requirement/requirementDb.d.ts +70 -0
  169. data/assets/mermaid/diagrams/requirement/requirementDetector.d.ts +3 -0
  170. data/assets/mermaid/diagrams/requirement/requirementDiagram.d.ts +2 -0
  171. data/assets/mermaid/diagrams/requirement/requirementMarkers.d.ts +10 -0
  172. data/assets/mermaid/diagrams/requirement/requirementRenderer.d.ts +7 -0
  173. data/assets/mermaid/diagrams/requirement/styles.d.ts +2 -0
  174. data/assets/mermaid/diagrams/sankey/parser/sankey.spec.d.ts +1 -0
  175. data/assets/mermaid/diagrams/sankey/sankeyDB.d.ts +36 -0
  176. data/assets/mermaid/diagrams/sankey/sankeyDetector.d.ts +3 -0
  177. data/assets/mermaid/diagrams/sankey/sankeyDiagram.d.ts +2 -0
  178. data/assets/mermaid/diagrams/sankey/sankeyRenderer.d.ts +14 -0
  179. data/assets/mermaid/diagrams/sankey/sankeyUtils.d.ts +1 -0
  180. data/assets/mermaid/diagrams/sequence/sequenceDb.d.ts +153 -0
  181. data/assets/mermaid/diagrams/sequence/sequenceDetector.d.ts +3 -0
  182. data/assets/mermaid/diagrams/sequence/sequenceDiagram.d.ts +2 -0
  183. data/assets/mermaid/diagrams/sequence/sequenceRenderer.d.ts +202 -0
  184. data/assets/mermaid/diagrams/sequence/styles.d.ts +2 -0
  185. data/assets/mermaid/diagrams/sequence/svgDraw.d.ts +73 -0
  186. data/assets/mermaid/diagrams/state/id-cache.d.ts +11 -0
  187. data/assets/mermaid/diagrams/state/shapes.d.ts +14 -0
  188. data/assets/mermaid/diagrams/state/stateCommon.d.ts +22 -0
  189. data/assets/mermaid/diagrams/state/stateDb.d.ts +91 -0
  190. data/assets/mermaid/diagrams/state/stateDetector-V2.d.ts +3 -0
  191. data/assets/mermaid/diagrams/state/stateDetector.d.ts +3 -0
  192. data/assets/mermaid/diagrams/state/stateDiagram-v2.d.ts +2 -0
  193. data/assets/mermaid/diagrams/state/stateDiagram.d.ts +2 -0
  194. data/assets/mermaid/diagrams/state/stateRenderer-v2.d.ts +20 -0
  195. data/assets/mermaid/diagrams/state/stateRenderer.d.ts +7 -0
  196. data/assets/mermaid/diagrams/state/styles.d.ts +2 -0
  197. data/assets/mermaid/diagrams/timeline/detector.d.ts +3 -0
  198. data/assets/mermaid/diagrams/timeline/styles.d.ts +2 -0
  199. data/assets/mermaid/diagrams/timeline/svgDraw.d.ts +46 -0
  200. data/assets/mermaid/diagrams/timeline/timeline-definition.d.ts +10 -0
  201. data/assets/mermaid/diagrams/timeline/timelineDb.d.ts +20 -0
  202. data/assets/mermaid/diagrams/timeline/timelineRenderer.d.ts +19 -0
  203. data/assets/mermaid/diagrams/user-journey/journeyDb.d.ts +30 -0
  204. data/assets/mermaid/diagrams/user-journey/journeyDetector.d.ts +3 -0
  205. data/assets/mermaid/diagrams/user-journey/journeyDiagram.d.ts +2 -0
  206. data/assets/mermaid/diagrams/user-journey/journeyRenderer.d.ts +30 -0
  207. data/assets/mermaid/diagrams/user-journey/styles.d.ts +2 -0
  208. data/assets/mermaid/diagrams/user-journey/svgDraw.d.ts +20 -0
  209. data/assets/mermaid/diagrams/xychart/chartBuilder/components/axis/bandAxis.d.ts +12 -0
  210. data/assets/mermaid/diagrams/xychart/chartBuilder/components/axis/baseAxis.d.ts +38 -0
  211. data/assets/mermaid/diagrams/xychart/chartBuilder/components/axis/index.d.ts +12 -0
  212. data/assets/mermaid/diagrams/xychart/chartBuilder/components/axis/linearAxis.d.ts +11 -0
  213. data/assets/mermaid/diagrams/xychart/chartBuilder/components/chartTitle.d.ts +16 -0
  214. data/assets/mermaid/diagrams/xychart/chartBuilder/components/plot/barPlot.d.ts +12 -0
  215. data/assets/mermaid/diagrams/xychart/chartBuilder/components/plot/index.d.ts +20 -0
  216. data/assets/mermaid/diagrams/xychart/chartBuilder/components/plot/linePlot.d.ts +11 -0
  217. data/assets/mermaid/diagrams/xychart/chartBuilder/index.d.ts +5 -0
  218. data/assets/mermaid/diagrams/xychart/chartBuilder/interfaces.d.ts +132 -0
  219. data/assets/mermaid/diagrams/xychart/chartBuilder/orchestrator.d.ts +12 -0
  220. data/assets/mermaid/diagrams/xychart/chartBuilder/textDimensionCalculator.d.ts +10 -0
  221. data/assets/mermaid/diagrams/xychart/parser/xychart.jison.spec.d.ts +1 -0
  222. data/assets/mermaid/diagrams/xychart/xychartDb.d.ts +40 -0
  223. data/assets/mermaid/diagrams/xychart/xychartDetector.d.ts +3 -0
  224. data/assets/mermaid/diagrams/xychart/xychartDiagram.d.ts +2 -0
  225. data/assets/mermaid/diagrams/xychart/xychartRenderer.d.ts +6 -0
  226. data/assets/mermaid/docs/vite.config.d.ts +2 -0
  227. data/assets/mermaid/edges-066a5561.js +1840 -0
  228. data/assets/mermaid/edges-16357fde.js +1083 -0
  229. data/assets/mermaid/edges-ce5cfb7c.js +1840 -0
  230. data/assets/mermaid/erDiagram-09d1c15f.js +1176 -0
  231. data/assets/mermaid/erDiagram-543717f2.js +1321 -0
  232. data/assets/mermaid/erDiagram-c7ff1bec.js +931 -0
  233. data/assets/mermaid/errors.d.ts +3 -0
  234. data/assets/mermaid/flowDb-9a89ea33.js +1126 -0
  235. data/assets/mermaid/flowDb-ba9bd7fa.js +1713 -0
  236. data/assets/mermaid/flowDb-c1833063.js +1714 -0
  237. data/assets/mermaid/flowDiagram-aadb13b0.js +797 -0
  238. data/assets/mermaid/flowDiagram-b222e15a.js +614 -0
  239. data/assets/mermaid/flowDiagram-b5e7ba30.js +1278 -0
  240. data/assets/mermaid/flowDiagram-v2-13329dc7.js +40 -0
  241. data/assets/mermaid/flowDiagram-v2-54711e03.js +32 -0
  242. data/assets/mermaid/flowDiagram-v2-f2119625.js +25 -0
  243. data/assets/mermaid/flowchart-elk-definition-2d49707c.js +93397 -0
  244. data/assets/mermaid/flowchart-elk-definition-ae0efee6.js +814 -0
  245. data/assets/mermaid/flowchart-elk-definition-cf813a97.js +48407 -0
  246. data/assets/mermaid/ganttDiagram-12cf43db.js +3445 -0
  247. data/assets/mermaid/ganttDiagram-3c2fde2b.js +2501 -0
  248. data/assets/mermaid/ganttDiagram-b62c793e.js +2061 -0
  249. data/assets/mermaid/gitGraphDiagram-942e62fe.js +1800 -0
  250. data/assets/mermaid/gitGraphDiagram-b9392a12.js +1790 -0
  251. data/assets/mermaid/gitGraphDiagram-c3a0619c.js +1264 -0
  252. data/assets/mermaid/graph-0ee63739.js +881 -0
  253. data/assets/mermaid/graph-fe24fab6.js +1285 -0
  254. data/assets/mermaid/index-01f381cb.js +622 -0
  255. data/assets/mermaid/index-bb6d8841.js +373 -0
  256. data/assets/mermaid/index-fc479858.js +663 -0
  257. data/assets/mermaid/infoDiagram-2f5c50c0.js +319 -0
  258. data/assets/mermaid/infoDiagram-94cd232f.js +520 -0
  259. data/assets/mermaid/infoDiagram-d0d5c9bd.js +510 -0
  260. data/assets/mermaid/init-cc95ec8e.js +16 -0
  261. data/assets/mermaid/init-f9637058.js +16 -0
  262. data/assets/mermaid/interactionDb.d.ts +2 -0
  263. data/assets/mermaid/journeyDiagram-14fe341a.js +804 -0
  264. data/assets/mermaid/journeyDiagram-6625b456.js +1191 -0
  265. data/assets/mermaid/journeyDiagram-b56e6921.js +1183 -0
  266. data/assets/mermaid/katex-d90b6d29.js +11624 -0
  267. data/assets/mermaid/katex-ffb0e8f1.js +14432 -0
  268. data/assets/mermaid/layout-163b9689.js +2314 -0
  269. data/assets/mermaid/layout-fd473db2.js +1536 -0
  270. data/assets/mermaid/line-24d93f1b.js +34 -0
  271. data/assets/mermaid/line-87f517ef.js +50 -0
  272. data/assets/mermaid/linear-0ad15847.js +595 -0
  273. data/assets/mermaid/linear-9bcf74c4.js +447 -0
  274. data/assets/mermaid/logger.d.ts +9 -0
  275. data/assets/mermaid/mermaid-6dc72991.js +6461 -0
  276. data/assets/mermaid/mermaid-9f2aa176.js +8112 -0
  277. data/assets/mermaid/mermaid-dcacb631.js +12793 -0
  278. data/assets/mermaid/mermaid.core.mjs +14 -0
  279. data/assets/mermaid/mermaid.d.ts +146 -0
  280. data/assets/mermaid/mermaid.esm.min.mjs +4 -0
  281. data/assets/mermaid/mermaid.esm.mjs +4 -0
  282. data/assets/mermaid/mermaid.js +195755 -0
  283. data/assets/mermaid/mermaid.min.js +2029 -0
  284. data/assets/mermaid/mermaid.spec.d.ts +1 -0
  285. data/assets/mermaid/mermaidAPI.d.ts +170 -0
  286. data/assets/mermaid/mermaidAPI.spec.d.ts +1 -0
  287. data/assets/mermaid/mindmap-definition-307c710a.js +1177 -0
  288. data/assets/mermaid/mindmap-definition-696ddea4.js +32342 -0
  289. data/assets/mermaid/mindmap-definition-9399c7e6.js +18760 -0
  290. data/assets/mermaid/ordinal-475e0c0c.js +82 -0
  291. data/assets/mermaid/ordinal-5695958c.js +65 -0
  292. data/assets/mermaid/path-39bad7e2.js +118 -0
  293. data/assets/mermaid/path-428ebac9.js +91 -0
  294. data/assets/mermaid/pieDiagram-828dae43.js +502 -0
  295. data/assets/mermaid/pieDiagram-bb1d19e5.js +722 -0
  296. data/assets/mermaid/pieDiagram-e854eaf0.js +772 -0
  297. data/assets/mermaid/preprocess.d.ts +10 -0
  298. data/assets/mermaid/quadrantDiagram-25a9848b.js +1199 -0
  299. data/assets/mermaid/quadrantDiagram-5fa00455.js +904 -0
  300. data/assets/mermaid/quadrantDiagram-c759a472.js +1207 -0
  301. data/assets/mermaid/rendering-util/createText.d.ts +11 -0
  302. data/assets/mermaid/rendering-util/handle-markdown-text.d.ts +6 -0
  303. data/assets/mermaid/rendering-util/handle-markdown-text.spec.d.ts +1 -0
  304. data/assets/mermaid/rendering-util/selectSvgElement.d.ts +8 -0
  305. data/assets/mermaid/rendering-util/splitText.d.ts +24 -0
  306. data/assets/mermaid/rendering-util/splitText.spec.d.ts +1 -0
  307. data/assets/mermaid/rendering-util/uid.d.ts +8 -0
  308. data/assets/mermaid/requirementDiagram-03163dc4.js +769 -0
  309. data/assets/mermaid/requirementDiagram-87253d64.js +1098 -0
  310. data/assets/mermaid/requirementDiagram-a721e157.js +1091 -0
  311. data/assets/mermaid/sankeyDiagram-33525efb.js +1198 -0
  312. data/assets/mermaid/sankeyDiagram-52ec8976.js +818 -0
  313. data/assets/mermaid/sankeyDiagram-707fac0f.js +660 -0
  314. data/assets/mermaid/sequenceDiagram-6894f283.js +3346 -0
  315. data/assets/mermaid/sequenceDiagram-9813c129.js +3336 -0
  316. data/assets/mermaid/sequenceDiagram-b517d154.js +2234 -0
  317. data/assets/mermaid/setupGraphViewbox.d.ts +3 -0
  318. data/assets/mermaid/stateDiagram-5dee940d.js +474 -0
  319. data/assets/mermaid/stateDiagram-5ec31577.js +467 -0
  320. data/assets/mermaid/stateDiagram-fca82b5b.js +275 -0
  321. data/assets/mermaid/stateDiagram-v2-1992cada.js +333 -0
  322. data/assets/mermaid/stateDiagram-v2-992e82a1.js +325 -0
  323. data/assets/mermaid/stateDiagram-v2-ed04200a.js +190 -0
  324. data/assets/mermaid/styles-0784dbeb.js +1363 -0
  325. data/assets/mermaid/styles-11e81fdd.js +1089 -0
  326. data/assets/mermaid/styles-36a1a2e8.js +1483 -0
  327. data/assets/mermaid/styles-483fbfea.js +509 -0
  328. data/assets/mermaid/styles-727cdd61.js +571 -0
  329. data/assets/mermaid/styles-b83b31c9.js +1484 -0
  330. data/assets/mermaid/styles-cacbff60.js +960 -0
  331. data/assets/mermaid/styles-e75131e4.js +433 -0
  332. data/assets/mermaid/styles-f80da881.js +1363 -0
  333. data/assets/mermaid/styles.d.ts +12 -0
  334. data/assets/mermaid/styles.spec.d.ts +1 -0
  335. data/assets/mermaid/svgDrawCommon-5e1cfd1d.js +101 -0
  336. data/assets/mermaid/svgDrawCommon-d6ab583c.js +100 -0
  337. data/assets/mermaid/svgDrawCommon-ecc5f780.js +64 -0
  338. data/assets/mermaid/tests/MockedD3.d.ts +45 -0
  339. data/assets/mermaid/tests/setup.d.ts +1 -0
  340. data/assets/mermaid/tests/util.d.ts +3 -0
  341. data/assets/mermaid/themes/erDiagram-oldHardcodedValues.d.ts +7 -0
  342. data/assets/mermaid/themes/index.d.ts +24 -0
  343. data/assets/mermaid/themes/theme-base.d.ts +189 -0
  344. data/assets/mermaid/themes/theme-dark.d.ts +177 -0
  345. data/assets/mermaid/themes/theme-default.d.ts +188 -0
  346. data/assets/mermaid/themes/theme-forest.d.ts +185 -0
  347. data/assets/mermaid/themes/theme-helpers.d.ts +1 -0
  348. data/assets/mermaid/themes/theme-neutral.d.ts +182 -0
  349. data/assets/mermaid/timeline-definition-23ce0e2e.js +1211 -0
  350. data/assets/mermaid/timeline-definition-4ee9bff4.js +795 -0
  351. data/assets/mermaid/timeline-definition-bf702344.js +1219 -0
  352. data/assets/mermaid/types.d.ts +31 -0
  353. data/assets/mermaid/utils/imperativeState.d.ts +32 -0
  354. data/assets/mermaid/utils/imperativeState.spec.d.ts +1 -0
  355. data/assets/mermaid/utils/lineWithOffset.d.ts +5 -0
  356. data/assets/mermaid/utils/sanitizeDirective.d.ts +7 -0
  357. data/assets/mermaid/utils/subGraphTitleMargins.d.ts +8 -0
  358. data/assets/mermaid/utils/subGraphTitleMargins.spec.d.ts +1 -0
  359. data/assets/mermaid/utils.d.ts +286 -0
  360. data/assets/mermaid/utils.spec.d.ts +1 -0
  361. data/assets/mermaid/xychartDiagram-de2e5521.js +1800 -0
  362. data/assets/mermaid/xychartDiagram-e5e6b652.js +1284 -0
  363. data/assets/mermaid/xychartDiagram-f11f50a6.js +1745 -0
  364. data/assets/tables.css +23 -0
  365. data/assets/toURI.js +142 -0
  366. metadata +363 -2
@@ -0,0 +1,3336 @@
1
+ import { g as getAccTitle, D as getDiagramTitle, C as setDiagramTitle, c as getConfig, s as setAccTitle, b as setAccDescription, a as getAccDescription, E as clear$1, l as log, d as sanitizeText, e as dist, f as common, Y as parseFontSize, a4 as hasKatex, r as renderKatex, _ as getConfig$1, a5 as ZERO_WIDTH_SPACE, a6 as calculateMathMLDimensions, h as assignWithDepth, j as d3select, k as configureSvgSize, A as utils } from "./mermaid-dcacb631.js";
2
+ import { d as drawRect$1, a as drawBackgroundRect$1, b as drawEmbeddedImage, c as drawImage, e as getTextObj$1, g as getNoteRect$1 } from "./svgDrawCommon-d6ab583c.js";
3
+ var parser = function() {
4
+ var o = function(k, v, o2, l) {
5
+ for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v)
6
+ ;
7
+ return o2;
8
+ }, $V0 = [1, 2], $V1 = [1, 3], $V2 = [1, 4], $V3 = [2, 4], $V4 = [1, 9], $V5 = [1, 11], $V6 = [1, 13], $V7 = [1, 14], $V8 = [1, 16], $V9 = [1, 17], $Va = [1, 18], $Vb = [1, 24], $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, 41], $Vs = [1, 42], $Vt = [1, 43], $Vu = [1, 44], $Vv = [1, 45], $Vw = [1, 46], $Vx = [1, 4, 5, 13, 14, 16, 18, 21, 23, 29, 30, 31, 33, 35, 36, 37, 38, 39, 41, 43, 44, 46, 47, 48, 49, 50, 52, 53, 54, 59, 60, 61, 62, 70], $Vy = [4, 5, 16, 50, 52, 53], $Vz = [4, 5, 13, 14, 16, 18, 21, 23, 29, 30, 31, 33, 35, 36, 37, 38, 39, 41, 43, 44, 46, 50, 52, 53, 54, 59, 60, 61, 62, 70], $VA = [4, 5, 13, 14, 16, 18, 21, 23, 29, 30, 31, 33, 35, 36, 37, 38, 39, 41, 43, 44, 46, 49, 50, 52, 53, 54, 59, 60, 61, 62, 70], $VB = [4, 5, 13, 14, 16, 18, 21, 23, 29, 30, 31, 33, 35, 36, 37, 38, 39, 41, 43, 44, 46, 48, 50, 52, 53, 54, 59, 60, 61, 62, 70], $VC = [4, 5, 13, 14, 16, 18, 21, 23, 29, 30, 31, 33, 35, 36, 37, 38, 39, 41, 43, 44, 46, 47, 50, 52, 53, 54, 59, 60, 61, 62, 70], $VD = [68, 69, 70], $VE = [1, 120];
9
+ var parser2 = {
10
+ trace: function trace() {
11
+ },
12
+ yy: {},
13
+ symbols_: { "error": 2, "start": 3, "SPACE": 4, "NEWLINE": 5, "SD": 6, "document": 7, "line": 8, "statement": 9, "box_section": 10, "box_line": 11, "participant_statement": 12, "create": 13, "box": 14, "restOfLine": 15, "end": 16, "signal": 17, "autonumber": 18, "NUM": 19, "off": 20, "activate": 21, "actor": 22, "deactivate": 23, "note_statement": 24, "links_statement": 25, "link_statement": 26, "properties_statement": 27, "details_statement": 28, "title": 29, "legacy_title": 30, "acc_title": 31, "acc_title_value": 32, "acc_descr": 33, "acc_descr_value": 34, "acc_descr_multiline_value": 35, "loop": 36, "rect": 37, "opt": 38, "alt": 39, "else_sections": 40, "par": 41, "par_sections": 42, "par_over": 43, "critical": 44, "option_sections": 45, "break": 46, "option": 47, "and": 48, "else": 49, "participant": 50, "AS": 51, "participant_actor": 52, "destroy": 53, "note": 54, "placement": 55, "text2": 56, "over": 57, "actor_pair": 58, "links": 59, "link": 60, "properties": 61, "details": 62, "spaceList": 63, ",": 64, "left_of": 65, "right_of": 66, "signaltype": 67, "+": 68, "-": 69, "ACTOR": 70, "SOLID_OPEN_ARROW": 71, "DOTTED_OPEN_ARROW": 72, "SOLID_ARROW": 73, "DOTTED_ARROW": 74, "SOLID_CROSS": 75, "DOTTED_CROSS": 76, "SOLID_POINT": 77, "DOTTED_POINT": 78, "TXT": 79, "$accept": 0, "$end": 1 },
14
+ terminals_: { 2: "error", 4: "SPACE", 5: "NEWLINE", 6: "SD", 13: "create", 14: "box", 15: "restOfLine", 16: "end", 18: "autonumber", 19: "NUM", 20: "off", 21: "activate", 23: "deactivate", 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", 41: "par", 43: "par_over", 44: "critical", 46: "break", 47: "option", 48: "and", 49: "else", 50: "participant", 51: "AS", 52: "participant_actor", 53: "destroy", 54: "note", 57: "over", 59: "links", 60: "link", 61: "properties", 62: "details", 64: ",", 65: "left_of", 66: "right_of", 68: "+", 69: "-", 70: "ACTOR", 71: "SOLID_OPEN_ARROW", 72: "DOTTED_OPEN_ARROW", 73: "SOLID_ARROW", 74: "DOTTED_ARROW", 75: "SOLID_CROSS", 76: "DOTTED_CROSS", 77: "SOLID_POINT", 78: "DOTTED_POINT", 79: "TXT" },
15
+ productions_: [0, [3, 2], [3, 2], [3, 2], [7, 0], [7, 2], [8, 2], [8, 1], [8, 1], [10, 0], [10, 2], [11, 2], [11, 1], [11, 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], [45, 1], [45, 4], [42, 1], [42, 4], [40, 1], [40, 4], [12, 5], [12, 3], [12, 5], [12, 3], [12, 3], [24, 4], [24, 4], [25, 3], [26, 3], [27, 3], [28, 3], [63, 2], [63, 1], [58, 3], [58, 1], [55, 1], [55, 1], [17, 5], [17, 5], [17, 4], [22, 1], [67, 1], [67, 1], [67, 1], [67, 1], [67, 1], [67, 1], [67, 1], [67, 1], [56, 1]],
16
+ performAction: 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 9:
24
+ this.$ = [];
25
+ break;
26
+ case 5:
27
+ case 10:
28
+ $$[$0 - 1].push($$[$0]);
29
+ this.$ = $$[$0 - 1];
30
+ break;
31
+ case 6:
32
+ case 7:
33
+ case 11:
34
+ case 12:
35
+ this.$ = $$[$0];
36
+ break;
37
+ case 8:
38
+ case 13:
39
+ this.$ = [];
40
+ break;
41
+ case 15:
42
+ $$[$0].type = "createParticipant";
43
+ this.$ = $$[$0];
44
+ break;
45
+ case 16:
46
+ $$[$0 - 1].unshift({ type: "boxStart", boxData: yy.parseBoxData($$[$0 - 2]) });
47
+ $$[$0 - 1].push({ type: "boxEnd", boxText: $$[$0 - 2] });
48
+ this.$ = $$[$0 - 1];
49
+ break;
50
+ case 18:
51
+ this.$ = { type: "sequenceIndex", sequenceIndex: Number($$[$0 - 2]), sequenceIndexStep: Number($$[$0 - 1]), sequenceVisible: true, signalType: yy.LINETYPE.AUTONUMBER };
52
+ break;
53
+ case 19:
54
+ this.$ = { type: "sequenceIndex", sequenceIndex: Number($$[$0 - 1]), sequenceIndexStep: 1, sequenceVisible: true, signalType: yy.LINETYPE.AUTONUMBER };
55
+ break;
56
+ case 20:
57
+ this.$ = { type: "sequenceIndex", sequenceVisible: false, signalType: yy.LINETYPE.AUTONUMBER };
58
+ break;
59
+ case 21:
60
+ this.$ = { type: "sequenceIndex", sequenceVisible: true, signalType: yy.LINETYPE.AUTONUMBER };
61
+ break;
62
+ case 22:
63
+ this.$ = { type: "activeStart", signalType: yy.LINETYPE.ACTIVE_START, actor: $$[$0 - 1] };
64
+ break;
65
+ case 23:
66
+ this.$ = { type: "activeEnd", signalType: yy.LINETYPE.ACTIVE_END, actor: $$[$0 - 1] };
67
+ break;
68
+ case 29:
69
+ yy.setDiagramTitle($$[$0].substring(6));
70
+ this.$ = $$[$0].substring(6);
71
+ break;
72
+ case 30:
73
+ yy.setDiagramTitle($$[$0].substring(7));
74
+ this.$ = $$[$0].substring(7);
75
+ break;
76
+ case 31:
77
+ this.$ = $$[$0].trim();
78
+ yy.setAccTitle(this.$);
79
+ break;
80
+ case 32:
81
+ case 33:
82
+ this.$ = $$[$0].trim();
83
+ yy.setAccDescription(this.$);
84
+ break;
85
+ case 34:
86
+ $$[$0 - 1].unshift({ type: "loopStart", loopText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.LOOP_START });
87
+ $$[$0 - 1].push({ type: "loopEnd", loopText: $$[$0 - 2], signalType: yy.LINETYPE.LOOP_END });
88
+ this.$ = $$[$0 - 1];
89
+ break;
90
+ case 35:
91
+ $$[$0 - 1].unshift({ type: "rectStart", color: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.RECT_START });
92
+ $$[$0 - 1].push({ type: "rectEnd", color: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.RECT_END });
93
+ this.$ = $$[$0 - 1];
94
+ break;
95
+ case 36:
96
+ $$[$0 - 1].unshift({ type: "optStart", optText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.OPT_START });
97
+ $$[$0 - 1].push({ type: "optEnd", optText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.OPT_END });
98
+ this.$ = $$[$0 - 1];
99
+ break;
100
+ case 37:
101
+ $$[$0 - 1].unshift({ type: "altStart", altText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.ALT_START });
102
+ $$[$0 - 1].push({ type: "altEnd", signalType: yy.LINETYPE.ALT_END });
103
+ this.$ = $$[$0 - 1];
104
+ break;
105
+ case 38:
106
+ $$[$0 - 1].unshift({ type: "parStart", parText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.PAR_START });
107
+ $$[$0 - 1].push({ type: "parEnd", signalType: yy.LINETYPE.PAR_END });
108
+ this.$ = $$[$0 - 1];
109
+ break;
110
+ case 39:
111
+ $$[$0 - 1].unshift({ type: "parStart", parText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.PAR_OVER_START });
112
+ $$[$0 - 1].push({ type: "parEnd", signalType: yy.LINETYPE.PAR_END });
113
+ this.$ = $$[$0 - 1];
114
+ break;
115
+ case 40:
116
+ $$[$0 - 1].unshift({ type: "criticalStart", criticalText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.CRITICAL_START });
117
+ $$[$0 - 1].push({ type: "criticalEnd", signalType: yy.LINETYPE.CRITICAL_END });
118
+ this.$ = $$[$0 - 1];
119
+ break;
120
+ case 41:
121
+ $$[$0 - 1].unshift({ type: "breakStart", breakText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.BREAK_START });
122
+ $$[$0 - 1].push({ type: "breakEnd", optText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.BREAK_END });
123
+ this.$ = $$[$0 - 1];
124
+ break;
125
+ case 43:
126
+ this.$ = $$[$0 - 3].concat([{ type: "option", optionText: yy.parseMessage($$[$0 - 1]), signalType: yy.LINETYPE.CRITICAL_OPTION }, $$[$0]]);
127
+ break;
128
+ case 45:
129
+ this.$ = $$[$0 - 3].concat([{ type: "and", parText: yy.parseMessage($$[$0 - 1]), signalType: yy.LINETYPE.PAR_AND }, $$[$0]]);
130
+ break;
131
+ case 47:
132
+ this.$ = $$[$0 - 3].concat([{ type: "else", altText: yy.parseMessage($$[$0 - 1]), signalType: yy.LINETYPE.ALT_ELSE }, $$[$0]]);
133
+ break;
134
+ case 48:
135
+ $$[$0 - 3].draw = "participant";
136
+ $$[$0 - 3].type = "addParticipant";
137
+ $$[$0 - 3].description = yy.parseMessage($$[$0 - 1]);
138
+ this.$ = $$[$0 - 3];
139
+ break;
140
+ case 49:
141
+ $$[$0 - 1].draw = "participant";
142
+ $$[$0 - 1].type = "addParticipant";
143
+ this.$ = $$[$0 - 1];
144
+ break;
145
+ case 50:
146
+ $$[$0 - 3].draw = "actor";
147
+ $$[$0 - 3].type = "addParticipant";
148
+ $$[$0 - 3].description = yy.parseMessage($$[$0 - 1]);
149
+ this.$ = $$[$0 - 3];
150
+ break;
151
+ case 51:
152
+ $$[$0 - 1].draw = "actor";
153
+ $$[$0 - 1].type = "addParticipant";
154
+ this.$ = $$[$0 - 1];
155
+ break;
156
+ case 52:
157
+ $$[$0 - 1].type = "destroyParticipant";
158
+ this.$ = $$[$0 - 1];
159
+ break;
160
+ case 53:
161
+ this.$ = [$$[$0 - 1], { type: "addNote", placement: $$[$0 - 2], actor: $$[$0 - 1].actor, text: $$[$0] }];
162
+ break;
163
+ case 54:
164
+ $$[$0 - 2] = [].concat($$[$0 - 1], $$[$0 - 1]).slice(0, 2);
165
+ $$[$0 - 2][0] = $$[$0 - 2][0].actor;
166
+ $$[$0 - 2][1] = $$[$0 - 2][1].actor;
167
+ this.$ = [$$[$0 - 1], { type: "addNote", placement: yy.PLACEMENT.OVER, actor: $$[$0 - 2].slice(0, 2), text: $$[$0] }];
168
+ break;
169
+ case 55:
170
+ this.$ = [$$[$0 - 1], { type: "addLinks", actor: $$[$0 - 1].actor, text: $$[$0] }];
171
+ break;
172
+ case 56:
173
+ this.$ = [$$[$0 - 1], { type: "addALink", actor: $$[$0 - 1].actor, text: $$[$0] }];
174
+ break;
175
+ case 57:
176
+ this.$ = [$$[$0 - 1], { type: "addProperties", actor: $$[$0 - 1].actor, text: $$[$0] }];
177
+ break;
178
+ case 58:
179
+ this.$ = [$$[$0 - 1], { type: "addDetails", actor: $$[$0 - 1].actor, text: $$[$0] }];
180
+ break;
181
+ case 61:
182
+ this.$ = [$$[$0 - 2], $$[$0]];
183
+ break;
184
+ case 62:
185
+ this.$ = $$[$0];
186
+ break;
187
+ case 63:
188
+ this.$ = yy.PLACEMENT.LEFTOF;
189
+ break;
190
+ case 64:
191
+ this.$ = yy.PLACEMENT.RIGHTOF;
192
+ break;
193
+ case 65:
194
+ this.$ = [
195
+ $$[$0 - 4],
196
+ $$[$0 - 1],
197
+ { type: "addMessage", from: $$[$0 - 4].actor, to: $$[$0 - 1].actor, signalType: $$[$0 - 3], msg: $$[$0], activate: true },
198
+ { type: "activeStart", signalType: yy.LINETYPE.ACTIVE_START, actor: $$[$0 - 1] }
199
+ ];
200
+ break;
201
+ case 66:
202
+ this.$ = [
203
+ $$[$0 - 4],
204
+ $$[$0 - 1],
205
+ { type: "addMessage", from: $$[$0 - 4].actor, to: $$[$0 - 1].actor, signalType: $$[$0 - 3], msg: $$[$0] },
206
+ { type: "activeEnd", signalType: yy.LINETYPE.ACTIVE_END, actor: $$[$0 - 4] }
207
+ ];
208
+ break;
209
+ case 67:
210
+ this.$ = [$$[$0 - 3], $$[$0 - 1], { type: "addMessage", from: $$[$0 - 3].actor, to: $$[$0 - 1].actor, signalType: $$[$0 - 2], msg: $$[$0] }];
211
+ break;
212
+ case 68:
213
+ this.$ = { type: "addParticipant", actor: $$[$0] };
214
+ break;
215
+ case 69:
216
+ this.$ = yy.LINETYPE.SOLID_OPEN;
217
+ break;
218
+ case 70:
219
+ this.$ = yy.LINETYPE.DOTTED_OPEN;
220
+ break;
221
+ case 71:
222
+ this.$ = yy.LINETYPE.SOLID;
223
+ break;
224
+ case 72:
225
+ this.$ = yy.LINETYPE.DOTTED;
226
+ break;
227
+ case 73:
228
+ this.$ = yy.LINETYPE.SOLID_CROSS;
229
+ break;
230
+ case 74:
231
+ this.$ = yy.LINETYPE.DOTTED_CROSS;
232
+ break;
233
+ case 75:
234
+ this.$ = yy.LINETYPE.SOLID_POINT;
235
+ break;
236
+ case 76:
237
+ this.$ = yy.LINETYPE.DOTTED_POINT;
238
+ break;
239
+ case 77:
240
+ this.$ = yy.parseMessage($$[$0].trim().substring(1));
241
+ break;
242
+ }
243
+ },
244
+ 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, 13, 14, 18, 21, 23, 29, 30, 31, 33, 35, 36, 37, 38, 39, 41, 43, 44, 46, 50, 52, 53, 54, 59, 60, 61, 62, 70], $V3, { 7: 7 }), { 1: [2, 1] }, { 1: [2, 2] }, { 1: [2, 3], 4: $V4, 5: $V5, 8: 8, 9: 10, 12: 12, 13: $V6, 14: $V7, 17: 15, 18: $V8, 21: $V9, 22: 40, 23: $Va, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: $Vb, 30: $Vc, 31: $Vd, 33: $Ve, 35: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 41: $Vk, 43: $Vl, 44: $Vm, 46: $Vn, 50: $Vo, 52: $Vp, 53: $Vq, 54: $Vr, 59: $Vs, 60: $Vt, 61: $Vu, 62: $Vv, 70: $Vw }, o($Vx, [2, 5]), { 9: 47, 12: 12, 13: $V6, 14: $V7, 17: 15, 18: $V8, 21: $V9, 22: 40, 23: $Va, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: $Vb, 30: $Vc, 31: $Vd, 33: $Ve, 35: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 41: $Vk, 43: $Vl, 44: $Vm, 46: $Vn, 50: $Vo, 52: $Vp, 53: $Vq, 54: $Vr, 59: $Vs, 60: $Vt, 61: $Vu, 62: $Vv, 70: $Vw }, o($Vx, [2, 7]), o($Vx, [2, 8]), o($Vx, [2, 14]), { 12: 48, 50: $Vo, 52: $Vp, 53: $Vq }, { 15: [1, 49] }, { 5: [1, 50] }, { 5: [1, 53], 19: [1, 51], 20: [1, 52] }, { 22: 54, 70: $Vw }, { 22: 55, 70: $Vw }, { 5: [1, 56] }, { 5: [1, 57] }, { 5: [1, 58] }, { 5: [1, 59] }, { 5: [1, 60] }, o($Vx, [2, 29]), o($Vx, [2, 30]), { 32: [1, 61] }, { 34: [1, 62] }, o($Vx, [2, 33]), { 15: [1, 63] }, { 15: [1, 64] }, { 15: [1, 65] }, { 15: [1, 66] }, { 15: [1, 67] }, { 15: [1, 68] }, { 15: [1, 69] }, { 15: [1, 70] }, { 22: 71, 70: $Vw }, { 22: 72, 70: $Vw }, { 22: 73, 70: $Vw }, { 67: 74, 71: [1, 75], 72: [1, 76], 73: [1, 77], 74: [1, 78], 75: [1, 79], 76: [1, 80], 77: [1, 81], 78: [1, 82] }, { 55: 83, 57: [1, 84], 65: [1, 85], 66: [1, 86] }, { 22: 87, 70: $Vw }, { 22: 88, 70: $Vw }, { 22: 89, 70: $Vw }, { 22: 90, 70: $Vw }, o([5, 51, 64, 71, 72, 73, 74, 75, 76, 77, 78, 79], [2, 68]), o($Vx, [2, 6]), o($Vx, [2, 15]), o($Vy, [2, 9], { 10: 91 }), o($Vx, [2, 17]), { 5: [1, 93], 19: [1, 92] }, { 5: [1, 94] }, o($Vx, [2, 21]), { 5: [1, 95] }, { 5: [1, 96] }, o($Vx, [2, 24]), o($Vx, [2, 25]), o($Vx, [2, 26]), o($Vx, [2, 27]), o($Vx, [2, 28]), o($Vx, [2, 31]), o($Vx, [2, 32]), o($Vz, $V3, { 7: 97 }), o($Vz, $V3, { 7: 98 }), o($Vz, $V3, { 7: 99 }), o($VA, $V3, { 40: 100, 7: 101 }), o($VB, $V3, { 42: 102, 7: 103 }), o($VB, $V3, { 7: 103, 42: 104 }), o($VC, $V3, { 45: 105, 7: 106 }), o($Vz, $V3, { 7: 107 }), { 5: [1, 109], 51: [1, 108] }, { 5: [1, 111], 51: [1, 110] }, { 5: [1, 112] }, { 22: 115, 68: [1, 113], 69: [1, 114], 70: $Vw }, o($VD, [2, 69]), o($VD, [2, 70]), o($VD, [2, 71]), o($VD, [2, 72]), o($VD, [2, 73]), o($VD, [2, 74]), o($VD, [2, 75]), o($VD, [2, 76]), { 22: 116, 70: $Vw }, { 22: 118, 58: 117, 70: $Vw }, { 70: [2, 63] }, { 70: [2, 64] }, { 56: 119, 79: $VE }, { 56: 121, 79: $VE }, { 56: 122, 79: $VE }, { 56: 123, 79: $VE }, { 4: [1, 126], 5: [1, 128], 11: 125, 12: 127, 16: [1, 124], 50: $Vo, 52: $Vp, 53: $Vq }, { 5: [1, 129] }, o($Vx, [2, 19]), o($Vx, [2, 20]), o($Vx, [2, 22]), o($Vx, [2, 23]), { 4: $V4, 5: $V5, 8: 8, 9: 10, 12: 12, 13: $V6, 14: $V7, 16: [1, 130], 17: 15, 18: $V8, 21: $V9, 22: 40, 23: $Va, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: $Vb, 30: $Vc, 31: $Vd, 33: $Ve, 35: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 41: $Vk, 43: $Vl, 44: $Vm, 46: $Vn, 50: $Vo, 52: $Vp, 53: $Vq, 54: $Vr, 59: $Vs, 60: $Vt, 61: $Vu, 62: $Vv, 70: $Vw }, { 4: $V4, 5: $V5, 8: 8, 9: 10, 12: 12, 13: $V6, 14: $V7, 16: [1, 131], 17: 15, 18: $V8, 21: $V9, 22: 40, 23: $Va, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: $Vb, 30: $Vc, 31: $Vd, 33: $Ve, 35: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 41: $Vk, 43: $Vl, 44: $Vm, 46: $Vn, 50: $Vo, 52: $Vp, 53: $Vq, 54: $Vr, 59: $Vs, 60: $Vt, 61: $Vu, 62: $Vv, 70: $Vw }, { 4: $V4, 5: $V5, 8: 8, 9: 10, 12: 12, 13: $V6, 14: $V7, 16: [1, 132], 17: 15, 18: $V8, 21: $V9, 22: 40, 23: $Va, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: $Vb, 30: $Vc, 31: $Vd, 33: $Ve, 35: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 41: $Vk, 43: $Vl, 44: $Vm, 46: $Vn, 50: $Vo, 52: $Vp, 53: $Vq, 54: $Vr, 59: $Vs, 60: $Vt, 61: $Vu, 62: $Vv, 70: $Vw }, { 16: [1, 133] }, { 4: $V4, 5: $V5, 8: 8, 9: 10, 12: 12, 13: $V6, 14: $V7, 16: [2, 46], 17: 15, 18: $V8, 21: $V9, 22: 40, 23: $Va, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: $Vb, 30: $Vc, 31: $Vd, 33: $Ve, 35: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 41: $Vk, 43: $Vl, 44: $Vm, 46: $Vn, 49: [1, 134], 50: $Vo, 52: $Vp, 53: $Vq, 54: $Vr, 59: $Vs, 60: $Vt, 61: $Vu, 62: $Vv, 70: $Vw }, { 16: [1, 135] }, { 4: $V4, 5: $V5, 8: 8, 9: 10, 12: 12, 13: $V6, 14: $V7, 16: [2, 44], 17: 15, 18: $V8, 21: $V9, 22: 40, 23: $Va, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: $Vb, 30: $Vc, 31: $Vd, 33: $Ve, 35: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 41: $Vk, 43: $Vl, 44: $Vm, 46: $Vn, 48: [1, 136], 50: $Vo, 52: $Vp, 53: $Vq, 54: $Vr, 59: $Vs, 60: $Vt, 61: $Vu, 62: $Vv, 70: $Vw }, { 16: [1, 137] }, { 16: [1, 138] }, { 4: $V4, 5: $V5, 8: 8, 9: 10, 12: 12, 13: $V6, 14: $V7, 16: [2, 42], 17: 15, 18: $V8, 21: $V9, 22: 40, 23: $Va, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: $Vb, 30: $Vc, 31: $Vd, 33: $Ve, 35: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 41: $Vk, 43: $Vl, 44: $Vm, 46: $Vn, 47: [1, 139], 50: $Vo, 52: $Vp, 53: $Vq, 54: $Vr, 59: $Vs, 60: $Vt, 61: $Vu, 62: $Vv, 70: $Vw }, { 4: $V4, 5: $V5, 8: 8, 9: 10, 12: 12, 13: $V6, 14: $V7, 16: [1, 140], 17: 15, 18: $V8, 21: $V9, 22: 40, 23: $Va, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: $Vb, 30: $Vc, 31: $Vd, 33: $Ve, 35: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 41: $Vk, 43: $Vl, 44: $Vm, 46: $Vn, 50: $Vo, 52: $Vp, 53: $Vq, 54: $Vr, 59: $Vs, 60: $Vt, 61: $Vu, 62: $Vv, 70: $Vw }, { 15: [1, 141] }, o($Vx, [2, 49]), { 15: [1, 142] }, o($Vx, [2, 51]), o($Vx, [2, 52]), { 22: 143, 70: $Vw }, { 22: 144, 70: $Vw }, { 56: 145, 79: $VE }, { 56: 146, 79: $VE }, { 56: 147, 79: $VE }, { 64: [1, 148], 79: [2, 62] }, { 5: [2, 55] }, { 5: [2, 77] }, { 5: [2, 56] }, { 5: [2, 57] }, { 5: [2, 58] }, o($Vx, [2, 16]), o($Vy, [2, 10]), { 12: 149, 50: $Vo, 52: $Vp, 53: $Vq }, o($Vy, [2, 12]), o($Vy, [2, 13]), o($Vx, [2, 18]), o($Vx, [2, 34]), o($Vx, [2, 35]), o($Vx, [2, 36]), o($Vx, [2, 37]), { 15: [1, 150] }, o($Vx, [2, 38]), { 15: [1, 151] }, o($Vx, [2, 39]), o($Vx, [2, 40]), { 15: [1, 152] }, o($Vx, [2, 41]), { 5: [1, 153] }, { 5: [1, 154] }, { 56: 155, 79: $VE }, { 56: 156, 79: $VE }, { 5: [2, 67] }, { 5: [2, 53] }, { 5: [2, 54] }, { 22: 157, 70: $Vw }, o($Vy, [2, 11]), o($VA, $V3, { 7: 101, 40: 158 }), o($VB, $V3, { 7: 103, 42: 159 }), o($VC, $V3, { 7: 106, 45: 160 }), o($Vx, [2, 48]), o($Vx, [2, 50]), { 5: [2, 65] }, { 5: [2, 66] }, { 79: [2, 61] }, { 16: [2, 47] }, { 16: [2, 45] }, { 16: [2, 43] }],
245
+ defaultActions: { 5: [2, 1], 6: [2, 2], 85: [2, 63], 86: [2, 64], 119: [2, 55], 120: [2, 77], 121: [2, 56], 122: [2, 57], 123: [2, 58], 145: [2, 67], 146: [2, 53], 147: [2, 54], 155: [2, 65], 156: [2, 66], 157: [2, 61], 158: [2, 47], 159: [2, 45], 160: [2, 43] },
246
+ parseError: function parseError(str, hash) {
247
+ if (hash.recoverable) {
248
+ this.trace(str);
249
+ } else {
250
+ var error = new Error(str);
251
+ error.hash = hash;
252
+ throw error;
253
+ }
254
+ },
255
+ parse: function parse(input) {
256
+ var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, TERROR = 2, EOF = 1;
257
+ var args = lstack.slice.call(arguments, 1);
258
+ var lexer2 = Object.create(this.lexer);
259
+ var sharedState = { yy: {} };
260
+ for (var k in this.yy) {
261
+ if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
262
+ sharedState.yy[k] = this.yy[k];
263
+ }
264
+ }
265
+ lexer2.setInput(input, sharedState.yy);
266
+ sharedState.yy.lexer = lexer2;
267
+ sharedState.yy.parser = this;
268
+ if (typeof lexer2.yylloc == "undefined") {
269
+ lexer2.yylloc = {};
270
+ }
271
+ var yyloc = lexer2.yylloc;
272
+ lstack.push(yyloc);
273
+ var ranges = lexer2.options && lexer2.options.ranges;
274
+ if (typeof sharedState.yy.parseError === "function") {
275
+ this.parseError = sharedState.yy.parseError;
276
+ } else {
277
+ this.parseError = Object.getPrototypeOf(this).parseError;
278
+ }
279
+ function lex() {
280
+ var token;
281
+ token = tstack.pop() || lexer2.lex() || EOF;
282
+ if (typeof token !== "number") {
283
+ if (token instanceof Array) {
284
+ tstack = token;
285
+ token = tstack.pop();
286
+ }
287
+ token = self.symbols_[token] || token;
288
+ }
289
+ return token;
290
+ }
291
+ var symbol, state2, action, r, yyval = {}, p, len, newState, expected;
292
+ while (true) {
293
+ state2 = stack[stack.length - 1];
294
+ if (this.defaultActions[state2]) {
295
+ action = this.defaultActions[state2];
296
+ } else {
297
+ if (symbol === null || typeof symbol == "undefined") {
298
+ symbol = lex();
299
+ }
300
+ action = table[state2] && table[state2][symbol];
301
+ }
302
+ if (typeof action === "undefined" || !action.length || !action[0]) {
303
+ var errStr = "";
304
+ expected = [];
305
+ for (p in table[state2]) {
306
+ if (this.terminals_[p] && p > TERROR) {
307
+ expected.push("'" + this.terminals_[p] + "'");
308
+ }
309
+ }
310
+ if (lexer2.showPosition) {
311
+ errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
312
+ } else {
313
+ errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
314
+ }
315
+ this.parseError(errStr, {
316
+ text: lexer2.match,
317
+ token: this.terminals_[symbol] || symbol,
318
+ line: lexer2.yylineno,
319
+ loc: yyloc,
320
+ expected
321
+ });
322
+ }
323
+ if (action[0] instanceof Array && action.length > 1) {
324
+ throw new Error("Parse Error: multiple actions possible at state: " + state2 + ", token: " + symbol);
325
+ }
326
+ switch (action[0]) {
327
+ case 1:
328
+ stack.push(symbol);
329
+ vstack.push(lexer2.yytext);
330
+ lstack.push(lexer2.yylloc);
331
+ stack.push(action[1]);
332
+ symbol = null;
333
+ {
334
+ yyleng = lexer2.yyleng;
335
+ yytext = lexer2.yytext;
336
+ yylineno = lexer2.yylineno;
337
+ yyloc = lexer2.yylloc;
338
+ }
339
+ break;
340
+ case 2:
341
+ len = this.productions_[action[1]][1];
342
+ yyval.$ = vstack[vstack.length - len];
343
+ yyval._$ = {
344
+ first_line: lstack[lstack.length - (len || 1)].first_line,
345
+ last_line: lstack[lstack.length - 1].last_line,
346
+ first_column: lstack[lstack.length - (len || 1)].first_column,
347
+ last_column: lstack[lstack.length - 1].last_column
348
+ };
349
+ if (ranges) {
350
+ yyval._$.range = [
351
+ lstack[lstack.length - (len || 1)].range[0],
352
+ lstack[lstack.length - 1].range[1]
353
+ ];
354
+ }
355
+ r = this.performAction.apply(yyval, [
356
+ yytext,
357
+ yyleng,
358
+ yylineno,
359
+ sharedState.yy,
360
+ action[1],
361
+ vstack,
362
+ lstack
363
+ ].concat(args));
364
+ if (typeof r !== "undefined") {
365
+ return r;
366
+ }
367
+ if (len) {
368
+ stack = stack.slice(0, -1 * len * 2);
369
+ vstack = vstack.slice(0, -1 * len);
370
+ lstack = lstack.slice(0, -1 * len);
371
+ }
372
+ stack.push(this.productions_[action[1]][0]);
373
+ vstack.push(yyval.$);
374
+ lstack.push(yyval._$);
375
+ newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
376
+ stack.push(newState);
377
+ break;
378
+ case 3:
379
+ return true;
380
+ }
381
+ }
382
+ return true;
383
+ }
384
+ };
385
+ var lexer = function() {
386
+ var lexer2 = {
387
+ EOF: 1,
388
+ parseError: function parseError(str, hash) {
389
+ if (this.yy.parser) {
390
+ this.yy.parser.parseError(str, hash);
391
+ } else {
392
+ throw new Error(str);
393
+ }
394
+ },
395
+ // resets the lexer, sets new input
396
+ setInput: function(input, yy) {
397
+ this.yy = yy || this.yy || {};
398
+ this._input = input;
399
+ this._more = this._backtrack = this.done = false;
400
+ this.yylineno = this.yyleng = 0;
401
+ this.yytext = this.matched = this.match = "";
402
+ this.conditionStack = ["INITIAL"];
403
+ this.yylloc = {
404
+ first_line: 1,
405
+ first_column: 0,
406
+ last_line: 1,
407
+ last_column: 0
408
+ };
409
+ if (this.options.ranges) {
410
+ this.yylloc.range = [0, 0];
411
+ }
412
+ this.offset = 0;
413
+ return this;
414
+ },
415
+ // consumes and returns one char from the input
416
+ input: function() {
417
+ var ch = this._input[0];
418
+ this.yytext += ch;
419
+ this.yyleng++;
420
+ this.offset++;
421
+ this.match += ch;
422
+ this.matched += ch;
423
+ var lines = ch.match(/(?:\r\n?|\n).*/g);
424
+ if (lines) {
425
+ this.yylineno++;
426
+ this.yylloc.last_line++;
427
+ } else {
428
+ this.yylloc.last_column++;
429
+ }
430
+ if (this.options.ranges) {
431
+ this.yylloc.range[1]++;
432
+ }
433
+ this._input = this._input.slice(1);
434
+ return ch;
435
+ },
436
+ // unshifts one char (or a string) into the input
437
+ unput: function(ch) {
438
+ var len = ch.length;
439
+ var lines = ch.split(/(?:\r\n?|\n)/g);
440
+ this._input = ch + this._input;
441
+ this.yytext = this.yytext.substr(0, this.yytext.length - len);
442
+ this.offset -= len;
443
+ var oldLines = this.match.split(/(?:\r\n?|\n)/g);
444
+ this.match = this.match.substr(0, this.match.length - 1);
445
+ this.matched = this.matched.substr(0, this.matched.length - 1);
446
+ if (lines.length - 1) {
447
+ this.yylineno -= lines.length - 1;
448
+ }
449
+ var r = this.yylloc.range;
450
+ this.yylloc = {
451
+ first_line: this.yylloc.first_line,
452
+ last_line: this.yylineno + 1,
453
+ first_column: this.yylloc.first_column,
454
+ 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
455
+ };
456
+ if (this.options.ranges) {
457
+ this.yylloc.range = [r[0], r[0] + this.yyleng - len];
458
+ }
459
+ this.yyleng = this.yytext.length;
460
+ return this;
461
+ },
462
+ // When called from action, caches matched text and appends it on next action
463
+ more: function() {
464
+ this._more = true;
465
+ return this;
466
+ },
467
+ // 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.
468
+ reject: function() {
469
+ if (this.options.backtrack_lexer) {
470
+ this._backtrack = true;
471
+ } else {
472
+ 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(), {
473
+ text: "",
474
+ token: null,
475
+ line: this.yylineno
476
+ });
477
+ }
478
+ return this;
479
+ },
480
+ // retain first n characters of the match
481
+ less: function(n) {
482
+ this.unput(this.match.slice(n));
483
+ },
484
+ // displays already matched input, i.e. for error messages
485
+ pastInput: function() {
486
+ var past = this.matched.substr(0, this.matched.length - this.match.length);
487
+ return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
488
+ },
489
+ // displays upcoming input, i.e. for error messages
490
+ upcomingInput: function() {
491
+ var next = this.match;
492
+ if (next.length < 20) {
493
+ next += this._input.substr(0, 20 - next.length);
494
+ }
495
+ return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
496
+ },
497
+ // displays the character position where the lexing error occurred, i.e. for error messages
498
+ showPosition: function() {
499
+ var pre = this.pastInput();
500
+ var c = new Array(pre.length + 1).join("-");
501
+ return pre + this.upcomingInput() + "\n" + c + "^";
502
+ },
503
+ // test the lexed token: return FALSE when not a match, otherwise return token
504
+ test_match: function(match, indexed_rule) {
505
+ var token, lines, backup;
506
+ if (this.options.backtrack_lexer) {
507
+ backup = {
508
+ yylineno: this.yylineno,
509
+ yylloc: {
510
+ first_line: this.yylloc.first_line,
511
+ last_line: this.last_line,
512
+ first_column: this.yylloc.first_column,
513
+ last_column: this.yylloc.last_column
514
+ },
515
+ yytext: this.yytext,
516
+ match: this.match,
517
+ matches: this.matches,
518
+ matched: this.matched,
519
+ yyleng: this.yyleng,
520
+ offset: this.offset,
521
+ _more: this._more,
522
+ _input: this._input,
523
+ yy: this.yy,
524
+ conditionStack: this.conditionStack.slice(0),
525
+ done: this.done
526
+ };
527
+ if (this.options.ranges) {
528
+ backup.yylloc.range = this.yylloc.range.slice(0);
529
+ }
530
+ }
531
+ lines = match[0].match(/(?:\r\n?|\n).*/g);
532
+ if (lines) {
533
+ this.yylineno += lines.length;
534
+ }
535
+ this.yylloc = {
536
+ first_line: this.yylloc.last_line,
537
+ last_line: this.yylineno + 1,
538
+ first_column: this.yylloc.last_column,
539
+ last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length
540
+ };
541
+ this.yytext += match[0];
542
+ this.match += match[0];
543
+ this.matches = match;
544
+ this.yyleng = this.yytext.length;
545
+ if (this.options.ranges) {
546
+ this.yylloc.range = [this.offset, this.offset += this.yyleng];
547
+ }
548
+ this._more = false;
549
+ this._backtrack = false;
550
+ this._input = this._input.slice(match[0].length);
551
+ this.matched += match[0];
552
+ token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
553
+ if (this.done && this._input) {
554
+ this.done = false;
555
+ }
556
+ if (token) {
557
+ return token;
558
+ } else if (this._backtrack) {
559
+ for (var k in backup) {
560
+ this[k] = backup[k];
561
+ }
562
+ return false;
563
+ }
564
+ return false;
565
+ },
566
+ // return next match in input
567
+ next: function() {
568
+ if (this.done) {
569
+ return this.EOF;
570
+ }
571
+ if (!this._input) {
572
+ this.done = true;
573
+ }
574
+ var token, match, tempMatch, index;
575
+ if (!this._more) {
576
+ this.yytext = "";
577
+ this.match = "";
578
+ }
579
+ var rules = this._currentRules();
580
+ for (var i = 0; i < rules.length; i++) {
581
+ tempMatch = this._input.match(this.rules[rules[i]]);
582
+ if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
583
+ match = tempMatch;
584
+ index = i;
585
+ if (this.options.backtrack_lexer) {
586
+ token = this.test_match(tempMatch, rules[i]);
587
+ if (token !== false) {
588
+ return token;
589
+ } else if (this._backtrack) {
590
+ match = false;
591
+ continue;
592
+ } else {
593
+ return false;
594
+ }
595
+ } else if (!this.options.flex) {
596
+ break;
597
+ }
598
+ }
599
+ }
600
+ if (match) {
601
+ token = this.test_match(match, rules[index]);
602
+ if (token !== false) {
603
+ return token;
604
+ }
605
+ return false;
606
+ }
607
+ if (this._input === "") {
608
+ return this.EOF;
609
+ } else {
610
+ return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
611
+ text: "",
612
+ token: null,
613
+ line: this.yylineno
614
+ });
615
+ }
616
+ },
617
+ // return next match that has a token
618
+ lex: function lex() {
619
+ var r = this.next();
620
+ if (r) {
621
+ return r;
622
+ } else {
623
+ return this.lex();
624
+ }
625
+ },
626
+ // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
627
+ begin: function begin(condition) {
628
+ this.conditionStack.push(condition);
629
+ },
630
+ // pop the previously active lexer condition state off the condition stack
631
+ popState: function popState() {
632
+ var n = this.conditionStack.length - 1;
633
+ if (n > 0) {
634
+ return this.conditionStack.pop();
635
+ } else {
636
+ return this.conditionStack[0];
637
+ }
638
+ },
639
+ // produce the lexer rule set which is active for the currently active lexer condition state
640
+ _currentRules: function _currentRules() {
641
+ if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
642
+ return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
643
+ } else {
644
+ return this.conditions["INITIAL"].rules;
645
+ }
646
+ },
647
+ // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
648
+ topState: function topState(n) {
649
+ n = this.conditionStack.length - 1 - Math.abs(n || 0);
650
+ if (n >= 0) {
651
+ return this.conditionStack[n];
652
+ } else {
653
+ return "INITIAL";
654
+ }
655
+ },
656
+ // alias for begin(condition)
657
+ pushState: function pushState(condition) {
658
+ this.begin(condition);
659
+ },
660
+ // return the number of states currently on the stack
661
+ stateStackSize: function stateStackSize() {
662
+ return this.conditionStack.length;
663
+ },
664
+ options: { "case-insensitive": true },
665
+ performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
666
+ switch ($avoiding_name_collisions) {
667
+ case 0:
668
+ return 5;
669
+ case 1:
670
+ break;
671
+ case 2:
672
+ break;
673
+ case 3:
674
+ break;
675
+ case 4:
676
+ break;
677
+ case 5:
678
+ break;
679
+ case 6:
680
+ return 19;
681
+ case 7:
682
+ this.begin("LINE");
683
+ return 14;
684
+ case 8:
685
+ this.begin("ID");
686
+ return 50;
687
+ case 9:
688
+ this.begin("ID");
689
+ return 52;
690
+ case 10:
691
+ return 13;
692
+ case 11:
693
+ this.begin("ID");
694
+ return 53;
695
+ case 12:
696
+ yy_.yytext = yy_.yytext.trim();
697
+ this.begin("ALIAS");
698
+ return 70;
699
+ case 13:
700
+ this.popState();
701
+ this.popState();
702
+ this.begin("LINE");
703
+ return 51;
704
+ case 14:
705
+ this.popState();
706
+ this.popState();
707
+ return 5;
708
+ case 15:
709
+ this.begin("LINE");
710
+ return 36;
711
+ case 16:
712
+ this.begin("LINE");
713
+ return 37;
714
+ case 17:
715
+ this.begin("LINE");
716
+ return 38;
717
+ case 18:
718
+ this.begin("LINE");
719
+ return 39;
720
+ case 19:
721
+ this.begin("LINE");
722
+ return 49;
723
+ case 20:
724
+ this.begin("LINE");
725
+ return 41;
726
+ case 21:
727
+ this.begin("LINE");
728
+ return 43;
729
+ case 22:
730
+ this.begin("LINE");
731
+ return 48;
732
+ case 23:
733
+ this.begin("LINE");
734
+ return 44;
735
+ case 24:
736
+ this.begin("LINE");
737
+ return 47;
738
+ case 25:
739
+ this.begin("LINE");
740
+ return 46;
741
+ case 26:
742
+ this.popState();
743
+ return 15;
744
+ case 27:
745
+ return 16;
746
+ case 28:
747
+ return 65;
748
+ case 29:
749
+ return 66;
750
+ case 30:
751
+ return 59;
752
+ case 31:
753
+ return 60;
754
+ case 32:
755
+ return 61;
756
+ case 33:
757
+ return 62;
758
+ case 34:
759
+ return 57;
760
+ case 35:
761
+ return 54;
762
+ case 36:
763
+ this.begin("ID");
764
+ return 21;
765
+ case 37:
766
+ this.begin("ID");
767
+ return 23;
768
+ case 38:
769
+ return 29;
770
+ case 39:
771
+ return 30;
772
+ case 40:
773
+ this.begin("acc_title");
774
+ return 31;
775
+ case 41:
776
+ this.popState();
777
+ return "acc_title_value";
778
+ case 42:
779
+ this.begin("acc_descr");
780
+ return 33;
781
+ case 43:
782
+ this.popState();
783
+ return "acc_descr_value";
784
+ case 44:
785
+ this.begin("acc_descr_multiline");
786
+ break;
787
+ case 45:
788
+ this.popState();
789
+ break;
790
+ case 46:
791
+ return "acc_descr_multiline_value";
792
+ case 47:
793
+ return 6;
794
+ case 48:
795
+ return 18;
796
+ case 49:
797
+ return 20;
798
+ case 50:
799
+ return 64;
800
+ case 51:
801
+ return 5;
802
+ case 52:
803
+ yy_.yytext = yy_.yytext.trim();
804
+ return 70;
805
+ case 53:
806
+ return 73;
807
+ case 54:
808
+ return 74;
809
+ case 55:
810
+ return 71;
811
+ case 56:
812
+ return 72;
813
+ case 57:
814
+ return 75;
815
+ case 58:
816
+ return 76;
817
+ case 59:
818
+ return 77;
819
+ case 60:
820
+ return 78;
821
+ case 61:
822
+ return 79;
823
+ case 62:
824
+ return 68;
825
+ case 63:
826
+ return 69;
827
+ case 64:
828
+ return 5;
829
+ case 65:
830
+ return "INVALID";
831
+ }
832
+ },
833
+ rules: [/^(?:[\n]+)/i, /^(?:\s+)/i, /^(?:((?!\n)\s)+)/i, /^(?:#[^\n]*)/i, /^(?:%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:[0-9]+(?=[ \n]+))/i, /^(?:box\b)/i, /^(?:participant\b)/i, /^(?:actor\b)/i, /^(?:create\b)/i, /^(?:destroy\b)/i, /^(?:[^\->:\n,;]+?([\-]*[^\->:\n,;]+?)*?(?=((?!\n)\s)+as(?!\n)\s|[#\n;]|$))/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, /^(?:-[x])/i, /^(?:--[x])/i, /^(?:-[\)])/i, /^(?:--[\)])/i, /^(?::(?:(?:no)?wrap)?[^#\n;]+)/i, /^(?:\+)/i, /^(?:-)/i, /^(?:$)/i, /^(?:.)/i],
834
+ conditions: { "acc_descr_multiline": { "rules": [45, 46], "inclusive": false }, "acc_descr": { "rules": [43], "inclusive": false }, "acc_title": { "rules": [41], "inclusive": false }, "ID": { "rules": [2, 3, 12], "inclusive": false }, "ALIAS": { "rules": [2, 3, 13, 14], "inclusive": false }, "LINE": { "rules": [2, 3, 26], "inclusive": false }, "INITIAL": { "rules": [0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 42, 44, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65], "inclusive": true } }
835
+ };
836
+ return lexer2;
837
+ }();
838
+ parser2.lexer = lexer;
839
+ function Parser() {
840
+ this.yy = {};
841
+ }
842
+ Parser.prototype = parser2;
843
+ parser2.Parser = Parser;
844
+ return new Parser();
845
+ }();
846
+ parser.parser = parser;
847
+ const parser$1 = parser;
848
+ class ImperativeState {
849
+ /**
850
+ * @param init - Function that creates the default state.
851
+ */
852
+ constructor(init) {
853
+ this.init = init;
854
+ this.records = this.init();
855
+ }
856
+ reset() {
857
+ this.records = this.init();
858
+ }
859
+ }
860
+ const state = new ImperativeState(() => ({
861
+ prevActor: void 0,
862
+ actors: {},
863
+ createdActors: {},
864
+ destroyedActors: {},
865
+ boxes: [],
866
+ messages: [],
867
+ notes: [],
868
+ sequenceNumbersEnabled: false,
869
+ wrapEnabled: void 0,
870
+ currentBox: void 0,
871
+ lastCreated: void 0,
872
+ lastDestroyed: void 0
873
+ }));
874
+ const addBox = function(data) {
875
+ state.records.boxes.push({
876
+ name: data.text,
877
+ wrap: data.wrap === void 0 && autoWrap() || !!data.wrap,
878
+ fill: data.color,
879
+ actorKeys: []
880
+ });
881
+ state.records.currentBox = state.records.boxes.slice(-1)[0];
882
+ };
883
+ const addActor = function(id, name, description, type) {
884
+ let assignedBox = state.records.currentBox;
885
+ const old = state.records.actors[id];
886
+ if (old) {
887
+ if (state.records.currentBox && old.box && state.records.currentBox !== old.box) {
888
+ throw new Error(
889
+ "A same participant should only be defined in one Box: " + old.name + " can't be in '" + old.box.name + "' and in '" + state.records.currentBox.name + "' at the same time."
890
+ );
891
+ }
892
+ assignedBox = old.box ? old.box : state.records.currentBox;
893
+ old.box = assignedBox;
894
+ if (old && name === old.name && description == null) {
895
+ return;
896
+ }
897
+ }
898
+ if (description == null || description.text == null) {
899
+ description = { text: name, wrap: null, type };
900
+ }
901
+ if (type == null || description.text == null) {
902
+ description = { text: name, wrap: null, type };
903
+ }
904
+ state.records.actors[id] = {
905
+ box: assignedBox,
906
+ name,
907
+ description: description.text,
908
+ wrap: description.wrap === void 0 && autoWrap() || !!description.wrap,
909
+ prevActor: state.records.prevActor,
910
+ links: {},
911
+ properties: {},
912
+ actorCnt: null,
913
+ rectData: null,
914
+ type: type || "participant"
915
+ };
916
+ if (state.records.prevActor && state.records.actors[state.records.prevActor]) {
917
+ state.records.actors[state.records.prevActor].nextActor = id;
918
+ }
919
+ if (state.records.currentBox) {
920
+ state.records.currentBox.actorKeys.push(id);
921
+ }
922
+ state.records.prevActor = id;
923
+ };
924
+ const activationCount = (part) => {
925
+ let i;
926
+ let count = 0;
927
+ for (i = 0; i < state.records.messages.length; i++) {
928
+ if (state.records.messages[i].type === LINETYPE.ACTIVE_START && state.records.messages[i].from.actor === part) {
929
+ count++;
930
+ }
931
+ if (state.records.messages[i].type === LINETYPE.ACTIVE_END && state.records.messages[i].from.actor === part) {
932
+ count--;
933
+ }
934
+ }
935
+ return count;
936
+ };
937
+ const addMessage = function(idFrom, idTo, message, answer) {
938
+ state.records.messages.push({
939
+ from: idFrom,
940
+ to: idTo,
941
+ message: message.text,
942
+ wrap: message.wrap === void 0 && autoWrap() || !!message.wrap,
943
+ answer
944
+ });
945
+ };
946
+ const addSignal = function(idFrom, idTo, message = { text: void 0, wrap: void 0 }, messageType, activate = false) {
947
+ if (messageType === LINETYPE.ACTIVE_END) {
948
+ const cnt = activationCount(idFrom.actor);
949
+ if (cnt < 1) {
950
+ let error = new Error("Trying to inactivate an inactive participant (" + idFrom.actor + ")");
951
+ error.hash = {
952
+ text: "->>-",
953
+ token: "->>-",
954
+ line: "1",
955
+ loc: { first_line: 1, last_line: 1, first_column: 1, last_column: 1 },
956
+ expected: ["'ACTIVE_PARTICIPANT'"]
957
+ };
958
+ throw error;
959
+ }
960
+ }
961
+ state.records.messages.push({
962
+ from: idFrom,
963
+ to: idTo,
964
+ message: message.text,
965
+ wrap: message.wrap === void 0 && autoWrap() || !!message.wrap,
966
+ type: messageType,
967
+ activate
968
+ });
969
+ return true;
970
+ };
971
+ const hasAtLeastOneBox = function() {
972
+ return state.records.boxes.length > 0;
973
+ };
974
+ const hasAtLeastOneBoxWithTitle = function() {
975
+ return state.records.boxes.some((b) => b.name);
976
+ };
977
+ const getMessages = function() {
978
+ return state.records.messages;
979
+ };
980
+ const getBoxes = function() {
981
+ return state.records.boxes;
982
+ };
983
+ const getActors = function() {
984
+ return state.records.actors;
985
+ };
986
+ const getCreatedActors = function() {
987
+ return state.records.createdActors;
988
+ };
989
+ const getDestroyedActors = function() {
990
+ return state.records.destroyedActors;
991
+ };
992
+ const getActor = function(id) {
993
+ return state.records.actors[id];
994
+ };
995
+ const getActorKeys = function() {
996
+ return Object.keys(state.records.actors);
997
+ };
998
+ const enableSequenceNumbers = function() {
999
+ state.records.sequenceNumbersEnabled = true;
1000
+ };
1001
+ const disableSequenceNumbers = function() {
1002
+ state.records.sequenceNumbersEnabled = false;
1003
+ };
1004
+ const showSequenceNumbers = () => state.records.sequenceNumbersEnabled;
1005
+ const setWrap = function(wrapSetting) {
1006
+ state.records.wrapEnabled = wrapSetting;
1007
+ };
1008
+ const autoWrap = () => {
1009
+ if (state.records.wrapEnabled !== void 0) {
1010
+ return state.records.wrapEnabled;
1011
+ }
1012
+ return getConfig().sequence.wrap;
1013
+ };
1014
+ const clear = function() {
1015
+ state.reset();
1016
+ clear$1();
1017
+ };
1018
+ const parseMessage = function(str) {
1019
+ const _str = str.trim();
1020
+ const message = {
1021
+ text: _str.replace(/^:?(?:no)?wrap:/, "").trim(),
1022
+ wrap: _str.match(/^:?wrap:/) !== null ? true : _str.match(/^:?nowrap:/) !== null ? false : void 0
1023
+ };
1024
+ log.debug("parseMessage:", message);
1025
+ return message;
1026
+ };
1027
+ const parseBoxData = function(str) {
1028
+ const match = str.match(/^((?:rgba?|hsla?)\s*\(.*\)|\w*)(.*)$/);
1029
+ let color = match != null && match[1] ? match[1].trim() : "transparent";
1030
+ let title = match != null && match[2] ? match[2].trim() : void 0;
1031
+ if (window && window.CSS) {
1032
+ if (!window.CSS.supports("color", color)) {
1033
+ color = "transparent";
1034
+ title = str.trim();
1035
+ }
1036
+ } else {
1037
+ const style = new Option().style;
1038
+ style.color = color;
1039
+ if (style.color !== color) {
1040
+ color = "transparent";
1041
+ title = str.trim();
1042
+ }
1043
+ }
1044
+ return {
1045
+ color,
1046
+ text: title !== void 0 ? sanitizeText(title.replace(/^:?(?:no)?wrap:/, ""), getConfig()) : void 0,
1047
+ wrap: title !== void 0 ? title.match(/^:?wrap:/) !== null ? true : title.match(/^:?nowrap:/) !== null ? false : void 0 : void 0
1048
+ };
1049
+ };
1050
+ const LINETYPE = {
1051
+ SOLID: 0,
1052
+ DOTTED: 1,
1053
+ NOTE: 2,
1054
+ SOLID_CROSS: 3,
1055
+ DOTTED_CROSS: 4,
1056
+ SOLID_OPEN: 5,
1057
+ DOTTED_OPEN: 6,
1058
+ LOOP_START: 10,
1059
+ LOOP_END: 11,
1060
+ ALT_START: 12,
1061
+ ALT_ELSE: 13,
1062
+ ALT_END: 14,
1063
+ OPT_START: 15,
1064
+ OPT_END: 16,
1065
+ ACTIVE_START: 17,
1066
+ ACTIVE_END: 18,
1067
+ PAR_START: 19,
1068
+ PAR_AND: 20,
1069
+ PAR_END: 21,
1070
+ RECT_START: 22,
1071
+ RECT_END: 23,
1072
+ SOLID_POINT: 24,
1073
+ DOTTED_POINT: 25,
1074
+ AUTONUMBER: 26,
1075
+ CRITICAL_START: 27,
1076
+ CRITICAL_OPTION: 28,
1077
+ CRITICAL_END: 29,
1078
+ BREAK_START: 30,
1079
+ BREAK_END: 31,
1080
+ PAR_OVER_START: 32
1081
+ };
1082
+ const ARROWTYPE = {
1083
+ FILLED: 0,
1084
+ OPEN: 1
1085
+ };
1086
+ const PLACEMENT = {
1087
+ LEFTOF: 0,
1088
+ RIGHTOF: 1,
1089
+ OVER: 2
1090
+ };
1091
+ const addNote = function(actor, placement, message) {
1092
+ const note = {
1093
+ actor,
1094
+ placement,
1095
+ message: message.text,
1096
+ wrap: message.wrap === void 0 && autoWrap() || !!message.wrap
1097
+ };
1098
+ const actors = [].concat(actor, actor);
1099
+ state.records.notes.push(note);
1100
+ state.records.messages.push({
1101
+ from: actors[0],
1102
+ to: actors[1],
1103
+ message: message.text,
1104
+ wrap: message.wrap === void 0 && autoWrap() || !!message.wrap,
1105
+ type: LINETYPE.NOTE,
1106
+ placement
1107
+ });
1108
+ };
1109
+ const addLinks = function(actorId, text) {
1110
+ const actor = getActor(actorId);
1111
+ try {
1112
+ let sanitizedText = sanitizeText(text.text, getConfig());
1113
+ sanitizedText = sanitizedText.replace(/&amp;/g, "&");
1114
+ sanitizedText = sanitizedText.replace(/&equals;/g, "=");
1115
+ const links = JSON.parse(sanitizedText);
1116
+ insertLinks(actor, links);
1117
+ } catch (e) {
1118
+ log.error("error while parsing actor link text", e);
1119
+ }
1120
+ };
1121
+ const addALink = function(actorId, text) {
1122
+ const actor = getActor(actorId);
1123
+ try {
1124
+ const links = {};
1125
+ let sanitizedText = sanitizeText(text.text, getConfig());
1126
+ var sep = sanitizedText.indexOf("@");
1127
+ sanitizedText = sanitizedText.replace(/&amp;/g, "&");
1128
+ sanitizedText = sanitizedText.replace(/&equals;/g, "=");
1129
+ var label = sanitizedText.slice(0, sep - 1).trim();
1130
+ var link = sanitizedText.slice(sep + 1).trim();
1131
+ links[label] = link;
1132
+ insertLinks(actor, links);
1133
+ } catch (e) {
1134
+ log.error("error while parsing actor link text", e);
1135
+ }
1136
+ };
1137
+ function insertLinks(actor, links) {
1138
+ if (actor.links == null) {
1139
+ actor.links = links;
1140
+ } else {
1141
+ for (let key in links) {
1142
+ actor.links[key] = links[key];
1143
+ }
1144
+ }
1145
+ }
1146
+ const addProperties = function(actorId, text) {
1147
+ const actor = getActor(actorId);
1148
+ try {
1149
+ let sanitizedText = sanitizeText(text.text, getConfig());
1150
+ const properties = JSON.parse(sanitizedText);
1151
+ insertProperties(actor, properties);
1152
+ } catch (e) {
1153
+ log.error("error while parsing actor properties text", e);
1154
+ }
1155
+ };
1156
+ function insertProperties(actor, properties) {
1157
+ if (actor.properties == null) {
1158
+ actor.properties = properties;
1159
+ } else {
1160
+ for (let key in properties) {
1161
+ actor.properties[key] = properties[key];
1162
+ }
1163
+ }
1164
+ }
1165
+ function boxEnd() {
1166
+ state.records.currentBox = void 0;
1167
+ }
1168
+ const addDetails = function(actorId, text) {
1169
+ const actor = getActor(actorId);
1170
+ const elem = document.getElementById(text.text);
1171
+ try {
1172
+ const text2 = elem.innerHTML;
1173
+ const details = JSON.parse(text2);
1174
+ if (details["properties"]) {
1175
+ insertProperties(actor, details["properties"]);
1176
+ }
1177
+ if (details["links"]) {
1178
+ insertLinks(actor, details["links"]);
1179
+ }
1180
+ } catch (e) {
1181
+ log.error("error while parsing actor details text", e);
1182
+ }
1183
+ };
1184
+ const getActorProperty = function(actor, key) {
1185
+ if (actor !== void 0 && actor.properties !== void 0) {
1186
+ return actor.properties[key];
1187
+ }
1188
+ return void 0;
1189
+ };
1190
+ const apply = function(param) {
1191
+ if (Array.isArray(param)) {
1192
+ param.forEach(function(item) {
1193
+ apply(item);
1194
+ });
1195
+ } else {
1196
+ switch (param.type) {
1197
+ case "sequenceIndex":
1198
+ state.records.messages.push({
1199
+ from: void 0,
1200
+ to: void 0,
1201
+ message: {
1202
+ start: param.sequenceIndex,
1203
+ step: param.sequenceIndexStep,
1204
+ visible: param.sequenceVisible
1205
+ },
1206
+ wrap: false,
1207
+ type: param.signalType
1208
+ });
1209
+ break;
1210
+ case "addParticipant":
1211
+ addActor(param.actor, param.actor, param.description, param.draw);
1212
+ break;
1213
+ case "createParticipant":
1214
+ if (state.records.actors[param.actor]) {
1215
+ throw new Error(
1216
+ "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"
1217
+ );
1218
+ }
1219
+ state.records.lastCreated = param.actor;
1220
+ addActor(param.actor, param.actor, param.description, param.draw);
1221
+ state.records.createdActors[param.actor] = state.records.messages.length;
1222
+ break;
1223
+ case "destroyParticipant":
1224
+ state.records.lastDestroyed = param.actor;
1225
+ state.records.destroyedActors[param.actor] = state.records.messages.length;
1226
+ break;
1227
+ case "activeStart":
1228
+ addSignal(param.actor, void 0, void 0, param.signalType);
1229
+ break;
1230
+ case "activeEnd":
1231
+ addSignal(param.actor, void 0, void 0, param.signalType);
1232
+ break;
1233
+ case "addNote":
1234
+ addNote(param.actor, param.placement, param.text);
1235
+ break;
1236
+ case "addLinks":
1237
+ addLinks(param.actor, param.text);
1238
+ break;
1239
+ case "addALink":
1240
+ addALink(param.actor, param.text);
1241
+ break;
1242
+ case "addProperties":
1243
+ addProperties(param.actor, param.text);
1244
+ break;
1245
+ case "addDetails":
1246
+ addDetails(param.actor, param.text);
1247
+ break;
1248
+ case "addMessage":
1249
+ if (state.records.lastCreated) {
1250
+ if (param.to !== state.records.lastCreated) {
1251
+ throw new Error(
1252
+ "The created participant " + state.records.lastCreated + " does not have an associated creating message after its declaration. Please check the sequence diagram."
1253
+ );
1254
+ } else {
1255
+ state.records.lastCreated = void 0;
1256
+ }
1257
+ } else if (state.records.lastDestroyed) {
1258
+ if (param.to !== state.records.lastDestroyed && param.from !== state.records.lastDestroyed) {
1259
+ throw new Error(
1260
+ "The destroyed participant " + state.records.lastDestroyed + " does not have an associated destroying message after its declaration. Please check the sequence diagram."
1261
+ );
1262
+ } else {
1263
+ state.records.lastDestroyed = void 0;
1264
+ }
1265
+ }
1266
+ addSignal(param.from, param.to, param.msg, param.signalType, param.activate);
1267
+ break;
1268
+ case "boxStart":
1269
+ addBox(param.boxData);
1270
+ break;
1271
+ case "boxEnd":
1272
+ boxEnd();
1273
+ break;
1274
+ case "loopStart":
1275
+ addSignal(void 0, void 0, param.loopText, param.signalType);
1276
+ break;
1277
+ case "loopEnd":
1278
+ addSignal(void 0, void 0, void 0, param.signalType);
1279
+ break;
1280
+ case "rectStart":
1281
+ addSignal(void 0, void 0, param.color, param.signalType);
1282
+ break;
1283
+ case "rectEnd":
1284
+ addSignal(void 0, void 0, void 0, param.signalType);
1285
+ break;
1286
+ case "optStart":
1287
+ addSignal(void 0, void 0, param.optText, param.signalType);
1288
+ break;
1289
+ case "optEnd":
1290
+ addSignal(void 0, void 0, void 0, param.signalType);
1291
+ break;
1292
+ case "altStart":
1293
+ addSignal(void 0, void 0, param.altText, param.signalType);
1294
+ break;
1295
+ case "else":
1296
+ addSignal(void 0, void 0, param.altText, param.signalType);
1297
+ break;
1298
+ case "altEnd":
1299
+ addSignal(void 0, void 0, void 0, param.signalType);
1300
+ break;
1301
+ case "setAccTitle":
1302
+ setAccTitle(param.text);
1303
+ break;
1304
+ case "parStart":
1305
+ addSignal(void 0, void 0, param.parText, param.signalType);
1306
+ break;
1307
+ case "and":
1308
+ addSignal(void 0, void 0, param.parText, param.signalType);
1309
+ break;
1310
+ case "parEnd":
1311
+ addSignal(void 0, void 0, void 0, param.signalType);
1312
+ break;
1313
+ case "criticalStart":
1314
+ addSignal(void 0, void 0, param.criticalText, param.signalType);
1315
+ break;
1316
+ case "option":
1317
+ addSignal(void 0, void 0, param.optionText, param.signalType);
1318
+ break;
1319
+ case "criticalEnd":
1320
+ addSignal(void 0, void 0, void 0, param.signalType);
1321
+ break;
1322
+ case "breakStart":
1323
+ addSignal(void 0, void 0, param.breakText, param.signalType);
1324
+ break;
1325
+ case "breakEnd":
1326
+ addSignal(void 0, void 0, void 0, param.signalType);
1327
+ break;
1328
+ }
1329
+ }
1330
+ };
1331
+ const db = {
1332
+ addActor,
1333
+ addMessage,
1334
+ addSignal,
1335
+ addLinks,
1336
+ addDetails,
1337
+ addProperties,
1338
+ autoWrap,
1339
+ setWrap,
1340
+ enableSequenceNumbers,
1341
+ disableSequenceNumbers,
1342
+ showSequenceNumbers,
1343
+ getMessages,
1344
+ getActors,
1345
+ getCreatedActors,
1346
+ getDestroyedActors,
1347
+ getActor,
1348
+ getActorKeys,
1349
+ getActorProperty,
1350
+ getAccTitle,
1351
+ getBoxes,
1352
+ getDiagramTitle,
1353
+ setDiagramTitle,
1354
+ getConfig: () => getConfig().sequence,
1355
+ clear,
1356
+ parseMessage,
1357
+ parseBoxData,
1358
+ LINETYPE,
1359
+ ARROWTYPE,
1360
+ PLACEMENT,
1361
+ addNote,
1362
+ setAccTitle,
1363
+ apply,
1364
+ setAccDescription,
1365
+ getAccDescription,
1366
+ hasAtLeastOneBox,
1367
+ hasAtLeastOneBoxWithTitle
1368
+ };
1369
+ const getStyles = (options) => `.actor {
1370
+ stroke: ${options.actorBorder};
1371
+ fill: ${options.actorBkg};
1372
+ }
1373
+
1374
+ text.actor > tspan {
1375
+ fill: ${options.actorTextColor};
1376
+ stroke: none;
1377
+ }
1378
+
1379
+ .actor-line {
1380
+ stroke: ${options.actorLineColor};
1381
+ }
1382
+
1383
+ .messageLine0 {
1384
+ stroke-width: 1.5;
1385
+ stroke-dasharray: none;
1386
+ stroke: ${options.signalColor};
1387
+ }
1388
+
1389
+ .messageLine1 {
1390
+ stroke-width: 1.5;
1391
+ stroke-dasharray: 2, 2;
1392
+ stroke: ${options.signalColor};
1393
+ }
1394
+
1395
+ #arrowhead path {
1396
+ fill: ${options.signalColor};
1397
+ stroke: ${options.signalColor};
1398
+ }
1399
+
1400
+ .sequenceNumber {
1401
+ fill: ${options.sequenceNumberColor};
1402
+ }
1403
+
1404
+ #sequencenumber {
1405
+ fill: ${options.signalColor};
1406
+ }
1407
+
1408
+ #crosshead path {
1409
+ fill: ${options.signalColor};
1410
+ stroke: ${options.signalColor};
1411
+ }
1412
+
1413
+ .messageText {
1414
+ fill: ${options.signalTextColor};
1415
+ stroke: none;
1416
+ }
1417
+
1418
+ .labelBox {
1419
+ stroke: ${options.labelBoxBorderColor};
1420
+ fill: ${options.labelBoxBkgColor};
1421
+ }
1422
+
1423
+ .labelText, .labelText > tspan {
1424
+ fill: ${options.labelTextColor};
1425
+ stroke: none;
1426
+ }
1427
+
1428
+ .loopText, .loopText > tspan {
1429
+ fill: ${options.loopTextColor};
1430
+ stroke: none;
1431
+ }
1432
+
1433
+ .loopLine {
1434
+ stroke-width: 2px;
1435
+ stroke-dasharray: 2, 2;
1436
+ stroke: ${options.labelBoxBorderColor};
1437
+ fill: ${options.labelBoxBorderColor};
1438
+ }
1439
+
1440
+ .note {
1441
+ //stroke: #decc93;
1442
+ stroke: ${options.noteBorderColor};
1443
+ fill: ${options.noteBkgColor};
1444
+ }
1445
+
1446
+ .noteText, .noteText > tspan {
1447
+ fill: ${options.noteTextColor};
1448
+ stroke: none;
1449
+ }
1450
+
1451
+ .activation0 {
1452
+ fill: ${options.activationBkgColor};
1453
+ stroke: ${options.activationBorderColor};
1454
+ }
1455
+
1456
+ .activation1 {
1457
+ fill: ${options.activationBkgColor};
1458
+ stroke: ${options.activationBorderColor};
1459
+ }
1460
+
1461
+ .activation2 {
1462
+ fill: ${options.activationBkgColor};
1463
+ stroke: ${options.activationBorderColor};
1464
+ }
1465
+
1466
+ .actorPopupMenu {
1467
+ position: absolute;
1468
+ }
1469
+
1470
+ .actorPopupMenuPanel {
1471
+ position: absolute;
1472
+ fill: ${options.actorBkg};
1473
+ box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
1474
+ filter: drop-shadow(3px 5px 2px rgb(0 0 0 / 0.4));
1475
+ }
1476
+ .actor-man line {
1477
+ stroke: ${options.actorBorder};
1478
+ fill: ${options.actorBkg};
1479
+ }
1480
+ .actor-man circle, line {
1481
+ stroke: ${options.actorBorder};
1482
+ fill: ${options.actorBkg};
1483
+ stroke-width: 2px;
1484
+ }
1485
+ `;
1486
+ const styles = getStyles;
1487
+ const ACTOR_TYPE_WIDTH = 18 * 2;
1488
+ const TOP_ACTOR_CLASS = "actor-top";
1489
+ const BOTTOM_ACTOR_CLASS = "actor-bottom";
1490
+ const drawRect = function(elem, rectData) {
1491
+ return drawRect$1(elem, rectData);
1492
+ };
1493
+ const drawPopup = function(elem, actor, minMenuWidth, textAttrs, forceMenus) {
1494
+ if (actor.links === void 0 || actor.links === null || Object.keys(actor.links).length === 0) {
1495
+ return { height: 0, width: 0 };
1496
+ }
1497
+ const links = actor.links;
1498
+ const actorCnt2 = actor.actorCnt;
1499
+ const rectData = actor.rectData;
1500
+ var displayValue = "none";
1501
+ if (forceMenus) {
1502
+ displayValue = "block !important";
1503
+ }
1504
+ const g = elem.append("g");
1505
+ g.attr("id", "actor" + actorCnt2 + "_popup");
1506
+ g.attr("class", "actorPopupMenu");
1507
+ g.attr("display", displayValue);
1508
+ var actorClass = "";
1509
+ if (rectData.class !== void 0) {
1510
+ actorClass = " " + rectData.class;
1511
+ }
1512
+ let menuWidth = rectData.width > minMenuWidth ? rectData.width : minMenuWidth;
1513
+ const rectElem = g.append("rect");
1514
+ rectElem.attr("class", "actorPopupMenuPanel" + actorClass);
1515
+ rectElem.attr("x", rectData.x);
1516
+ rectElem.attr("y", rectData.height);
1517
+ rectElem.attr("fill", rectData.fill);
1518
+ rectElem.attr("stroke", rectData.stroke);
1519
+ rectElem.attr("width", menuWidth);
1520
+ rectElem.attr("height", rectData.height);
1521
+ rectElem.attr("rx", rectData.rx);
1522
+ rectElem.attr("ry", rectData.ry);
1523
+ if (links != null) {
1524
+ var linkY = 20;
1525
+ for (let key in links) {
1526
+ var linkElem = g.append("a");
1527
+ var sanitizedLink = dist.sanitizeUrl(links[key]);
1528
+ linkElem.attr("xlink:href", sanitizedLink);
1529
+ linkElem.attr("target", "_blank");
1530
+ _drawMenuItemTextCandidateFunc(textAttrs)(
1531
+ key,
1532
+ linkElem,
1533
+ rectData.x + 10,
1534
+ rectData.height + linkY,
1535
+ menuWidth,
1536
+ 20,
1537
+ { class: "actor" },
1538
+ textAttrs
1539
+ );
1540
+ linkY += 30;
1541
+ }
1542
+ }
1543
+ rectElem.attr("height", linkY);
1544
+ return { height: rectData.height + linkY, width: menuWidth };
1545
+ };
1546
+ const popupMenuToggle = function(popId) {
1547
+ return "var pu = document.getElementById('" + popId + "'); if (pu != null) { pu.style.display = pu.style.display == 'block' ? 'none' : 'block'; }";
1548
+ };
1549
+ const drawKatex = async function(elem, textData, msgModel = null) {
1550
+ let textElem = elem.append("foreignObject");
1551
+ const lines = await renderKatex(textData.text, getConfig$1());
1552
+ const divElem = textElem.append("xhtml:div").attr("style", "width: fit-content;").attr("xmlns", "http://www.w3.org/1999/xhtml").html(lines);
1553
+ const dim = divElem.node().getBoundingClientRect();
1554
+ textElem.attr("height", Math.round(dim.height)).attr("width", Math.round(dim.width));
1555
+ if (textData.class === "noteText") {
1556
+ const rectElem = elem.node().firstChild;
1557
+ rectElem.setAttribute("height", dim.height + 2 * textData.textMargin);
1558
+ const rectDim = rectElem.getBBox();
1559
+ 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));
1560
+ } else if (msgModel) {
1561
+ let { startx, stopx, starty } = msgModel;
1562
+ if (startx > stopx) {
1563
+ const temp = startx;
1564
+ startx = stopx;
1565
+ stopx = temp;
1566
+ }
1567
+ textElem.attr("x", Math.round(startx + Math.abs(startx - stopx) / 2 - dim.width / 2));
1568
+ if (textData.class === "loopText") {
1569
+ textElem.attr("y", Math.round(starty));
1570
+ } else {
1571
+ textElem.attr("y", Math.round(starty - dim.height));
1572
+ }
1573
+ }
1574
+ return [textElem];
1575
+ };
1576
+ const drawText = function(elem, textData) {
1577
+ let prevTextHeight = 0;
1578
+ let textHeight = 0;
1579
+ const lines = textData.text.split(common.lineBreakRegex);
1580
+ const [_textFontSize, _textFontSizePx] = parseFontSize(textData.fontSize);
1581
+ let textElems = [];
1582
+ let dy = 0;
1583
+ let yfunc = () => textData.y;
1584
+ if (textData.valign !== void 0 && textData.textMargin !== void 0 && textData.textMargin > 0) {
1585
+ switch (textData.valign) {
1586
+ case "top":
1587
+ case "start":
1588
+ yfunc = () => Math.round(textData.y + textData.textMargin);
1589
+ break;
1590
+ case "middle":
1591
+ case "center":
1592
+ yfunc = () => Math.round(textData.y + (prevTextHeight + textHeight + textData.textMargin) / 2);
1593
+ break;
1594
+ case "bottom":
1595
+ case "end":
1596
+ yfunc = () => Math.round(
1597
+ textData.y + (prevTextHeight + textHeight + 2 * textData.textMargin) - textData.textMargin
1598
+ );
1599
+ break;
1600
+ }
1601
+ }
1602
+ if (textData.anchor !== void 0 && textData.textMargin !== void 0 && textData.width !== void 0) {
1603
+ switch (textData.anchor) {
1604
+ case "left":
1605
+ case "start":
1606
+ textData.x = Math.round(textData.x + textData.textMargin);
1607
+ textData.anchor = "start";
1608
+ textData.dominantBaseline = "middle";
1609
+ textData.alignmentBaseline = "middle";
1610
+ break;
1611
+ case "middle":
1612
+ case "center":
1613
+ textData.x = Math.round(textData.x + textData.width / 2);
1614
+ textData.anchor = "middle";
1615
+ textData.dominantBaseline = "middle";
1616
+ textData.alignmentBaseline = "middle";
1617
+ break;
1618
+ case "right":
1619
+ case "end":
1620
+ textData.x = Math.round(textData.x + textData.width - textData.textMargin);
1621
+ textData.anchor = "end";
1622
+ textData.dominantBaseline = "middle";
1623
+ textData.alignmentBaseline = "middle";
1624
+ break;
1625
+ }
1626
+ }
1627
+ for (let [i, line] of lines.entries()) {
1628
+ if (textData.textMargin !== void 0 && textData.textMargin === 0 && _textFontSize !== void 0) {
1629
+ dy = i * _textFontSize;
1630
+ }
1631
+ const textElem = elem.append("text");
1632
+ textElem.attr("x", textData.x);
1633
+ textElem.attr("y", yfunc());
1634
+ if (textData.anchor !== void 0) {
1635
+ textElem.attr("text-anchor", textData.anchor).attr("dominant-baseline", textData.dominantBaseline).attr("alignment-baseline", textData.alignmentBaseline);
1636
+ }
1637
+ if (textData.fontFamily !== void 0) {
1638
+ textElem.style("font-family", textData.fontFamily);
1639
+ }
1640
+ if (_textFontSizePx !== void 0) {
1641
+ textElem.style("font-size", _textFontSizePx);
1642
+ }
1643
+ if (textData.fontWeight !== void 0) {
1644
+ textElem.style("font-weight", textData.fontWeight);
1645
+ }
1646
+ if (textData.fill !== void 0) {
1647
+ textElem.attr("fill", textData.fill);
1648
+ }
1649
+ if (textData.class !== void 0) {
1650
+ textElem.attr("class", textData.class);
1651
+ }
1652
+ if (textData.dy !== void 0) {
1653
+ textElem.attr("dy", textData.dy);
1654
+ } else if (dy !== 0) {
1655
+ textElem.attr("dy", dy);
1656
+ }
1657
+ const text = line || ZERO_WIDTH_SPACE;
1658
+ if (textData.tspan) {
1659
+ const span = textElem.append("tspan");
1660
+ span.attr("x", textData.x);
1661
+ if (textData.fill !== void 0) {
1662
+ span.attr("fill", textData.fill);
1663
+ }
1664
+ span.text(text);
1665
+ } else {
1666
+ textElem.text(text);
1667
+ }
1668
+ if (textData.valign !== void 0 && textData.textMargin !== void 0 && textData.textMargin > 0) {
1669
+ textHeight += (textElem._groups || textElem)[0][0].getBBox().height;
1670
+ prevTextHeight = textHeight;
1671
+ }
1672
+ textElems.push(textElem);
1673
+ }
1674
+ return textElems;
1675
+ };
1676
+ const drawLabel = function(elem, txtObject) {
1677
+ function genPoints(x, y, width, height, cut) {
1678
+ return x + "," + y + " " + (x + width) + "," + y + " " + (x + width) + "," + (y + height - cut) + " " + (x + width - cut * 1.2) + "," + (y + height) + " " + x + "," + (y + height);
1679
+ }
1680
+ const polygon = elem.append("polygon");
1681
+ polygon.attr("points", genPoints(txtObject.x, txtObject.y, txtObject.width, txtObject.height, 7));
1682
+ polygon.attr("class", "labelBox");
1683
+ txtObject.y = txtObject.y + txtObject.height / 2;
1684
+ drawText(elem, txtObject);
1685
+ return polygon;
1686
+ };
1687
+ let actorCnt = -1;
1688
+ const fixLifeLineHeights = (diagram2, actors, actorKeys, conf2) => {
1689
+ if (!diagram2.select) {
1690
+ return;
1691
+ }
1692
+ actorKeys.forEach((actorKey) => {
1693
+ const actor = actors[actorKey];
1694
+ const actorDOM = diagram2.select("#actor" + actor.actorCnt);
1695
+ if (!conf2.mirrorActors && actor.stopy) {
1696
+ actorDOM.attr("y2", actor.stopy + actor.height / 2);
1697
+ } else if (conf2.mirrorActors) {
1698
+ actorDOM.attr("y2", actor.stopy);
1699
+ }
1700
+ });
1701
+ };
1702
+ const drawActorTypeParticipant = async function(elem, actor, conf2, isFooter) {
1703
+ const actorY = isFooter ? actor.stopy : actor.starty;
1704
+ const center = actor.x + actor.width / 2;
1705
+ const centerY = actorY + 5;
1706
+ const boxplusLineGroup = elem.append("g").lower();
1707
+ var g = boxplusLineGroup;
1708
+ if (!isFooter) {
1709
+ actorCnt++;
1710
+ if (Object.keys(actor.links || {}).length && !conf2.forceMenus) {
1711
+ g.attr("onclick", popupMenuToggle(`actor${actorCnt}_popup`)).attr("cursor", "pointer");
1712
+ }
1713
+ g.append("line").attr("id", "actor" + actorCnt).attr("x1", center).attr("y1", centerY).attr("x2", center).attr("y2", 2e3).attr("class", "actor-line").attr("class", "200").attr("stroke-width", "0.5px").attr("stroke", "#999");
1714
+ g = boxplusLineGroup.append("g");
1715
+ actor.actorCnt = actorCnt;
1716
+ if (actor.links != null) {
1717
+ g.attr("id", "root-" + actorCnt);
1718
+ }
1719
+ }
1720
+ const rect = getNoteRect$1();
1721
+ var cssclass = "actor";
1722
+ if (actor.properties != null && actor.properties["class"]) {
1723
+ cssclass = actor.properties["class"];
1724
+ } else {
1725
+ rect.fill = "#eaeaea";
1726
+ }
1727
+ if (isFooter) {
1728
+ cssclass += ` ${BOTTOM_ACTOR_CLASS}`;
1729
+ } else {
1730
+ cssclass += ` ${TOP_ACTOR_CLASS}`;
1731
+ }
1732
+ rect.x = actor.x;
1733
+ rect.y = actorY;
1734
+ rect.width = actor.width;
1735
+ rect.height = actor.height;
1736
+ rect.class = cssclass;
1737
+ rect.rx = 3;
1738
+ rect.ry = 3;
1739
+ rect.name = actor.name;
1740
+ const rectElem = drawRect(g, rect);
1741
+ actor.rectData = rect;
1742
+ if (actor.properties != null && actor.properties["icon"]) {
1743
+ const iconSrc = actor.properties["icon"].trim();
1744
+ if (iconSrc.charAt(0) === "@") {
1745
+ drawEmbeddedImage(g, rect.x + rect.width - 20, rect.y + 10, iconSrc.substr(1));
1746
+ } else {
1747
+ drawImage(g, rect.x + rect.width - 20, rect.y + 10, iconSrc);
1748
+ }
1749
+ }
1750
+ await _drawTextCandidateFunc(conf2, hasKatex(actor.description))(
1751
+ actor.description,
1752
+ g,
1753
+ rect.x,
1754
+ rect.y,
1755
+ rect.width,
1756
+ rect.height,
1757
+ { class: "actor" },
1758
+ conf2
1759
+ );
1760
+ let height = actor.height;
1761
+ if (rectElem.node) {
1762
+ const bounds2 = rectElem.node().getBBox();
1763
+ actor.height = bounds2.height;
1764
+ height = bounds2.height;
1765
+ }
1766
+ return height;
1767
+ };
1768
+ const drawActorTypeActor = async function(elem, actor, conf2, isFooter) {
1769
+ const actorY = isFooter ? actor.stopy : actor.starty;
1770
+ const center = actor.x + actor.width / 2;
1771
+ const centerY = actorY + 80;
1772
+ elem.lower();
1773
+ if (!isFooter) {
1774
+ actorCnt++;
1775
+ elem.append("line").attr("id", "actor" + actorCnt).attr("x1", center).attr("y1", centerY).attr("x2", center).attr("y2", 2e3).attr("class", "actor-line").attr("class", "200").attr("stroke-width", "0.5px").attr("stroke", "#999");
1776
+ actor.actorCnt = actorCnt;
1777
+ }
1778
+ const actElem = elem.append("g");
1779
+ let cssClass = "actor-man";
1780
+ if (isFooter) {
1781
+ cssClass += ` ${BOTTOM_ACTOR_CLASS}`;
1782
+ } else {
1783
+ cssClass += ` ${TOP_ACTOR_CLASS}`;
1784
+ }
1785
+ actElem.attr("class", cssClass);
1786
+ actElem.attr("name", actor.name);
1787
+ const rect = getNoteRect$1();
1788
+ rect.x = actor.x;
1789
+ rect.y = actorY;
1790
+ rect.fill = "#eaeaea";
1791
+ rect.width = actor.width;
1792
+ rect.height = actor.height;
1793
+ rect.class = "actor";
1794
+ rect.rx = 3;
1795
+ rect.ry = 3;
1796
+ actElem.append("line").attr("id", "actor-man-torso" + actorCnt).attr("x1", center).attr("y1", actorY + 25).attr("x2", center).attr("y2", actorY + 45);
1797
+ actElem.append("line").attr("id", "actor-man-arms" + actorCnt).attr("x1", center - ACTOR_TYPE_WIDTH / 2).attr("y1", actorY + 33).attr("x2", center + ACTOR_TYPE_WIDTH / 2).attr("y2", actorY + 33);
1798
+ actElem.append("line").attr("x1", center - ACTOR_TYPE_WIDTH / 2).attr("y1", actorY + 60).attr("x2", center).attr("y2", actorY + 45);
1799
+ actElem.append("line").attr("x1", center).attr("y1", actorY + 45).attr("x2", center + ACTOR_TYPE_WIDTH / 2 - 2).attr("y2", actorY + 60);
1800
+ const circle = actElem.append("circle");
1801
+ circle.attr("cx", actor.x + actor.width / 2);
1802
+ circle.attr("cy", actorY + 10);
1803
+ circle.attr("r", 15);
1804
+ circle.attr("width", actor.width);
1805
+ circle.attr("height", actor.height);
1806
+ const bounds2 = actElem.node().getBBox();
1807
+ actor.height = bounds2.height;
1808
+ await _drawTextCandidateFunc(conf2, hasKatex(actor.description))(
1809
+ actor.description,
1810
+ actElem,
1811
+ rect.x,
1812
+ rect.y + 35,
1813
+ rect.width,
1814
+ rect.height,
1815
+ { class: "actor" },
1816
+ conf2
1817
+ );
1818
+ return actor.height;
1819
+ };
1820
+ const drawActor = async function(elem, actor, conf2, isFooter) {
1821
+ switch (actor.type) {
1822
+ case "actor":
1823
+ return await drawActorTypeActor(elem, actor, conf2, isFooter);
1824
+ case "participant":
1825
+ return await drawActorTypeParticipant(elem, actor, conf2, isFooter);
1826
+ }
1827
+ };
1828
+ const drawBox = async function(elem, box, conf2) {
1829
+ const boxplusTextGroup = elem.append("g");
1830
+ const g = boxplusTextGroup;
1831
+ drawBackgroundRect(g, box);
1832
+ if (box.name) {
1833
+ await _drawTextCandidateFunc(conf2)(
1834
+ box.name,
1835
+ g,
1836
+ box.x,
1837
+ box.y + (box.textMaxHeight || 0) / 2,
1838
+ box.width,
1839
+ 0,
1840
+ { class: "text" },
1841
+ conf2
1842
+ );
1843
+ }
1844
+ g.lower();
1845
+ };
1846
+ const anchorElement = function(elem) {
1847
+ return elem.append("g");
1848
+ };
1849
+ const drawActivation = function(elem, bounds2, verticalPos, conf2, actorActivations2) {
1850
+ const rect = getNoteRect$1();
1851
+ const g = bounds2.anchored;
1852
+ rect.x = bounds2.startx;
1853
+ rect.y = bounds2.starty;
1854
+ rect.class = "activation" + actorActivations2 % 3;
1855
+ rect.width = bounds2.stopx - bounds2.startx;
1856
+ rect.height = verticalPos - bounds2.starty;
1857
+ drawRect(g, rect);
1858
+ };
1859
+ const drawLoop = async function(elem, loopModel, labelText, conf2) {
1860
+ const {
1861
+ boxMargin,
1862
+ boxTextMargin,
1863
+ labelBoxHeight,
1864
+ labelBoxWidth,
1865
+ messageFontFamily: fontFamily,
1866
+ messageFontSize: fontSize,
1867
+ messageFontWeight: fontWeight
1868
+ } = conf2;
1869
+ const g = elem.append("g");
1870
+ const drawLoopLine = function(startx, starty, stopx, stopy) {
1871
+ return g.append("line").attr("x1", startx).attr("y1", starty).attr("x2", stopx).attr("y2", stopy).attr("class", "loopLine");
1872
+ };
1873
+ drawLoopLine(loopModel.startx, loopModel.starty, loopModel.stopx, loopModel.starty);
1874
+ drawLoopLine(loopModel.stopx, loopModel.starty, loopModel.stopx, loopModel.stopy);
1875
+ drawLoopLine(loopModel.startx, loopModel.stopy, loopModel.stopx, loopModel.stopy);
1876
+ drawLoopLine(loopModel.startx, loopModel.starty, loopModel.startx, loopModel.stopy);
1877
+ if (loopModel.sections !== void 0) {
1878
+ loopModel.sections.forEach(function(item) {
1879
+ drawLoopLine(loopModel.startx, item.y, loopModel.stopx, item.y).style(
1880
+ "stroke-dasharray",
1881
+ "3, 3"
1882
+ );
1883
+ });
1884
+ }
1885
+ let txt = getTextObj$1();
1886
+ txt.text = labelText;
1887
+ txt.x = loopModel.startx;
1888
+ txt.y = loopModel.starty;
1889
+ txt.fontFamily = fontFamily;
1890
+ txt.fontSize = fontSize;
1891
+ txt.fontWeight = fontWeight;
1892
+ txt.anchor = "middle";
1893
+ txt.valign = "middle";
1894
+ txt.tspan = false;
1895
+ txt.width = labelBoxWidth || 50;
1896
+ txt.height = labelBoxHeight || 20;
1897
+ txt.textMargin = boxTextMargin;
1898
+ txt.class = "labelText";
1899
+ drawLabel(g, txt);
1900
+ txt = getTextObj();
1901
+ txt.text = loopModel.title;
1902
+ txt.x = loopModel.startx + labelBoxWidth / 2 + (loopModel.stopx - loopModel.startx) / 2;
1903
+ txt.y = loopModel.starty + boxMargin + boxTextMargin;
1904
+ txt.anchor = "middle";
1905
+ txt.valign = "middle";
1906
+ txt.textMargin = boxTextMargin;
1907
+ txt.class = "loopText";
1908
+ txt.fontFamily = fontFamily;
1909
+ txt.fontSize = fontSize;
1910
+ txt.fontWeight = fontWeight;
1911
+ txt.wrap = true;
1912
+ let textElem = hasKatex(txt.text) ? await drawKatex(g, txt, loopModel) : drawText(g, txt);
1913
+ if (loopModel.sectionTitles !== void 0) {
1914
+ for (const [idx, item] of Object.entries(loopModel.sectionTitles)) {
1915
+ if (item.message) {
1916
+ txt.text = item.message;
1917
+ txt.x = loopModel.startx + (loopModel.stopx - loopModel.startx) / 2;
1918
+ txt.y = loopModel.sections[idx].y + boxMargin + boxTextMargin;
1919
+ txt.class = "loopText";
1920
+ txt.anchor = "middle";
1921
+ txt.valign = "middle";
1922
+ txt.tspan = false;
1923
+ txt.fontFamily = fontFamily;
1924
+ txt.fontSize = fontSize;
1925
+ txt.fontWeight = fontWeight;
1926
+ txt.wrap = loopModel.wrap;
1927
+ if (hasKatex(txt.text)) {
1928
+ loopModel.starty = loopModel.sections[idx].y;
1929
+ await drawKatex(g, txt, loopModel);
1930
+ } else {
1931
+ drawText(g, txt);
1932
+ }
1933
+ let sectionHeight = Math.round(
1934
+ textElem.map((te) => (te._groups || te)[0][0].getBBox().height).reduce((acc, curr) => acc + curr)
1935
+ );
1936
+ loopModel.sections[idx].height += sectionHeight - (boxMargin + boxTextMargin);
1937
+ }
1938
+ }
1939
+ }
1940
+ loopModel.height = Math.round(loopModel.stopy - loopModel.starty);
1941
+ return g;
1942
+ };
1943
+ const drawBackgroundRect = function(elem, bounds2) {
1944
+ drawBackgroundRect$1(elem, bounds2);
1945
+ };
1946
+ const insertDatabaseIcon = function(elem) {
1947
+ elem.append("defs").append("symbol").attr("id", "database").attr("fill-rule", "evenodd").attr("clip-rule", "evenodd").append("path").attr("transform", "scale(.5)").attr(
1948
+ "d",
1949
+ "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"
1950
+ );
1951
+ };
1952
+ const insertComputerIcon = function(elem) {
1953
+ elem.append("defs").append("symbol").attr("id", "computer").attr("width", "24").attr("height", "24").append("path").attr("transform", "scale(.5)").attr(
1954
+ "d",
1955
+ "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"
1956
+ );
1957
+ };
1958
+ const insertClockIcon = function(elem) {
1959
+ elem.append("defs").append("symbol").attr("id", "clock").attr("width", "24").attr("height", "24").append("path").attr("transform", "scale(.5)").attr(
1960
+ "d",
1961
+ "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"
1962
+ );
1963
+ };
1964
+ const insertArrowHead = function(elem) {
1965
+ elem.append("defs").append("marker").attr("id", "arrowhead").attr("refX", 7.9).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto").append("path").attr("d", "M 0 0 L 10 5 L 0 10 z");
1966
+ };
1967
+ const insertArrowFilledHead = function(elem) {
1968
+ elem.append("defs").append("marker").attr("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");
1969
+ };
1970
+ const insertSequenceNumber = function(elem) {
1971
+ elem.append("defs").append("marker").attr("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);
1972
+ };
1973
+ const insertArrowCrossHead = function(elem) {
1974
+ const defs = elem.append("defs");
1975
+ const marker = defs.append("marker").attr("id", "crosshead").attr("markerWidth", 15).attr("markerHeight", 8).attr("orient", "auto").attr("refX", 4).attr("refY", 4.5);
1976
+ 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");
1977
+ };
1978
+ const getTextObj = function() {
1979
+ return {
1980
+ x: 0,
1981
+ y: 0,
1982
+ fill: void 0,
1983
+ anchor: void 0,
1984
+ style: "#666",
1985
+ width: void 0,
1986
+ height: void 0,
1987
+ textMargin: 0,
1988
+ rx: 0,
1989
+ ry: 0,
1990
+ tspan: true,
1991
+ valign: void 0
1992
+ };
1993
+ };
1994
+ const getNoteRect = function() {
1995
+ return {
1996
+ x: 0,
1997
+ y: 0,
1998
+ fill: "#EDF2AE",
1999
+ stroke: "#666",
2000
+ width: 100,
2001
+ anchor: "start",
2002
+ height: 100,
2003
+ rx: 0,
2004
+ ry: 0
2005
+ };
2006
+ };
2007
+ const _drawTextCandidateFunc = function() {
2008
+ function byText(content, g, x, y, width, height, textAttrs) {
2009
+ const text = g.append("text").attr("x", x + width / 2).attr("y", y + height / 2 + 5).style("text-anchor", "middle").text(content);
2010
+ _setTextAttrs(text, textAttrs);
2011
+ }
2012
+ function byTspan(content, g, x, y, width, height, textAttrs, conf2) {
2013
+ const { actorFontSize, actorFontFamily, actorFontWeight } = conf2;
2014
+ const [_actorFontSize, _actorFontSizePx] = parseFontSize(actorFontSize);
2015
+ const lines = content.split(common.lineBreakRegex);
2016
+ for (let i = 0; i < lines.length; i++) {
2017
+ const dy = i * _actorFontSize - _actorFontSize * (lines.length - 1) / 2;
2018
+ 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);
2019
+ text.append("tspan").attr("x", x + width / 2).attr("dy", dy).text(lines[i]);
2020
+ text.attr("y", y + height / 2).attr("dominant-baseline", "central").attr("alignment-baseline", "central");
2021
+ _setTextAttrs(text, textAttrs);
2022
+ }
2023
+ }
2024
+ function byFo(content, g, x, y, width, height, textAttrs, conf2) {
2025
+ const s = g.append("switch");
2026
+ const f = s.append("foreignObject").attr("x", x).attr("y", y).attr("width", width).attr("height", height);
2027
+ const text = f.append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%");
2028
+ text.append("div").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(content);
2029
+ byTspan(content, s, x, y, width, height, textAttrs, conf2);
2030
+ _setTextAttrs(text, textAttrs);
2031
+ }
2032
+ async function byKatex(content, g, x, y, width, height, textAttrs, conf2) {
2033
+ const dim = await calculateMathMLDimensions(content, getConfig$1());
2034
+ const s = g.append("switch");
2035
+ 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);
2036
+ const text = f.append("xhtml:div").style("height", "100%").style("width", "100%");
2037
+ text.append("div").style("text-align", "center").style("vertical-align", "middle").html(await renderKatex(content, getConfig$1()));
2038
+ byTspan(content, s, x, y, width, height, textAttrs, conf2);
2039
+ _setTextAttrs(text, textAttrs);
2040
+ }
2041
+ function _setTextAttrs(toText, fromTextAttrsDict) {
2042
+ for (const key in fromTextAttrsDict) {
2043
+ if (fromTextAttrsDict.hasOwnProperty(key)) {
2044
+ toText.attr(key, fromTextAttrsDict[key]);
2045
+ }
2046
+ }
2047
+ }
2048
+ return function(conf2, hasKatex2 = false) {
2049
+ if (hasKatex2) {
2050
+ return byKatex;
2051
+ }
2052
+ return conf2.textPlacement === "fo" ? byFo : conf2.textPlacement === "old" ? byText : byTspan;
2053
+ };
2054
+ }();
2055
+ const _drawMenuItemTextCandidateFunc = function() {
2056
+ function byText(content, g, x, y, width, height, textAttrs) {
2057
+ const text = g.append("text").attr("x", x).attr("y", y).style("text-anchor", "start").text(content);
2058
+ _setTextAttrs(text, textAttrs);
2059
+ }
2060
+ function byTspan(content, g, x, y, width, height, textAttrs, conf2) {
2061
+ const { actorFontSize, actorFontFamily, actorFontWeight } = conf2;
2062
+ const lines = content.split(common.lineBreakRegex);
2063
+ for (let i = 0; i < lines.length; i++) {
2064
+ const dy = i * actorFontSize - actorFontSize * (lines.length - 1) / 2;
2065
+ 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);
2066
+ text.append("tspan").attr("x", x).attr("dy", dy).text(lines[i]);
2067
+ text.attr("y", y + height / 2).attr("dominant-baseline", "central").attr("alignment-baseline", "central");
2068
+ _setTextAttrs(text, textAttrs);
2069
+ }
2070
+ }
2071
+ function byFo(content, g, x, y, width, height, textAttrs, conf2) {
2072
+ const s = g.append("switch");
2073
+ const f = s.append("foreignObject").attr("x", x).attr("y", y).attr("width", width).attr("height", height);
2074
+ const text = f.append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%");
2075
+ text.append("div").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(content);
2076
+ byTspan(content, s, x, y, width, height, textAttrs, conf2);
2077
+ _setTextAttrs(text, textAttrs);
2078
+ }
2079
+ function _setTextAttrs(toText, fromTextAttrsDict) {
2080
+ for (const key in fromTextAttrsDict) {
2081
+ if (fromTextAttrsDict.hasOwnProperty(key)) {
2082
+ toText.attr(key, fromTextAttrsDict[key]);
2083
+ }
2084
+ }
2085
+ }
2086
+ return function(conf2) {
2087
+ return conf2.textPlacement === "fo" ? byFo : conf2.textPlacement === "old" ? byText : byTspan;
2088
+ };
2089
+ }();
2090
+ const svgDraw = {
2091
+ drawRect,
2092
+ drawText,
2093
+ drawLabel,
2094
+ drawActor,
2095
+ drawBox,
2096
+ drawPopup,
2097
+ anchorElement,
2098
+ drawActivation,
2099
+ drawLoop,
2100
+ drawBackgroundRect,
2101
+ insertArrowHead,
2102
+ insertArrowFilledHead,
2103
+ insertSequenceNumber,
2104
+ insertArrowCrossHead,
2105
+ insertDatabaseIcon,
2106
+ insertComputerIcon,
2107
+ insertClockIcon,
2108
+ getTextObj,
2109
+ getNoteRect,
2110
+ fixLifeLineHeights,
2111
+ sanitizeUrl: dist.sanitizeUrl
2112
+ };
2113
+ let conf = {};
2114
+ const bounds = {
2115
+ data: {
2116
+ startx: void 0,
2117
+ stopx: void 0,
2118
+ starty: void 0,
2119
+ stopy: void 0
2120
+ },
2121
+ verticalPos: 0,
2122
+ sequenceItems: [],
2123
+ activations: [],
2124
+ models: {
2125
+ getHeight: function() {
2126
+ return Math.max.apply(
2127
+ null,
2128
+ this.actors.length === 0 ? [0] : this.actors.map((actor) => actor.height || 0)
2129
+ ) + (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));
2130
+ },
2131
+ clear: function() {
2132
+ this.actors = [];
2133
+ this.boxes = [];
2134
+ this.loops = [];
2135
+ this.messages = [];
2136
+ this.notes = [];
2137
+ },
2138
+ addBox: function(boxModel) {
2139
+ this.boxes.push(boxModel);
2140
+ },
2141
+ addActor: function(actorModel) {
2142
+ this.actors.push(actorModel);
2143
+ },
2144
+ addLoop: function(loopModel) {
2145
+ this.loops.push(loopModel);
2146
+ },
2147
+ addMessage: function(msgModel) {
2148
+ this.messages.push(msgModel);
2149
+ },
2150
+ addNote: function(noteModel) {
2151
+ this.notes.push(noteModel);
2152
+ },
2153
+ lastActor: function() {
2154
+ return this.actors[this.actors.length - 1];
2155
+ },
2156
+ lastLoop: function() {
2157
+ return this.loops[this.loops.length - 1];
2158
+ },
2159
+ lastMessage: function() {
2160
+ return this.messages[this.messages.length - 1];
2161
+ },
2162
+ lastNote: function() {
2163
+ return this.notes[this.notes.length - 1];
2164
+ },
2165
+ actors: [],
2166
+ boxes: [],
2167
+ loops: [],
2168
+ messages: [],
2169
+ notes: []
2170
+ },
2171
+ init: function() {
2172
+ this.sequenceItems = [];
2173
+ this.activations = [];
2174
+ this.models.clear();
2175
+ this.data = {
2176
+ startx: void 0,
2177
+ stopx: void 0,
2178
+ starty: void 0,
2179
+ stopy: void 0
2180
+ };
2181
+ this.verticalPos = 0;
2182
+ setConf(getConfig());
2183
+ },
2184
+ updateVal: function(obj, key, val, fun) {
2185
+ if (obj[key] === void 0) {
2186
+ obj[key] = val;
2187
+ } else {
2188
+ obj[key] = fun(val, obj[key]);
2189
+ }
2190
+ },
2191
+ updateBounds: function(startx, starty, stopx, stopy) {
2192
+ const _self = this;
2193
+ let cnt = 0;
2194
+ function updateFn(type) {
2195
+ return function updateItemBounds(item) {
2196
+ cnt++;
2197
+ const n = _self.sequenceItems.length - cnt + 1;
2198
+ _self.updateVal(item, "starty", starty - n * conf.boxMargin, Math.min);
2199
+ _self.updateVal(item, "stopy", stopy + n * conf.boxMargin, Math.max);
2200
+ _self.updateVal(bounds.data, "startx", startx - n * conf.boxMargin, Math.min);
2201
+ _self.updateVal(bounds.data, "stopx", stopx + n * conf.boxMargin, Math.max);
2202
+ if (!(type === "activation")) {
2203
+ _self.updateVal(item, "startx", startx - n * conf.boxMargin, Math.min);
2204
+ _self.updateVal(item, "stopx", stopx + n * conf.boxMargin, Math.max);
2205
+ _self.updateVal(bounds.data, "starty", starty - n * conf.boxMargin, Math.min);
2206
+ _self.updateVal(bounds.data, "stopy", stopy + n * conf.boxMargin, Math.max);
2207
+ }
2208
+ };
2209
+ }
2210
+ this.sequenceItems.forEach(updateFn());
2211
+ this.activations.forEach(updateFn("activation"));
2212
+ },
2213
+ insert: function(startx, starty, stopx, stopy) {
2214
+ const _startx = common.getMin(startx, stopx);
2215
+ const _stopx = common.getMax(startx, stopx);
2216
+ const _starty = common.getMin(starty, stopy);
2217
+ const _stopy = common.getMax(starty, stopy);
2218
+ this.updateVal(bounds.data, "startx", _startx, Math.min);
2219
+ this.updateVal(bounds.data, "starty", _starty, Math.min);
2220
+ this.updateVal(bounds.data, "stopx", _stopx, Math.max);
2221
+ this.updateVal(bounds.data, "stopy", _stopy, Math.max);
2222
+ this.updateBounds(_startx, _starty, _stopx, _stopy);
2223
+ },
2224
+ newActivation: function(message, diagram2, actors) {
2225
+ const actorRect = actors[message.from.actor];
2226
+ const stackedSize = actorActivations(message.from.actor).length || 0;
2227
+ const x = actorRect.x + actorRect.width / 2 + (stackedSize - 1) * conf.activationWidth / 2;
2228
+ this.activations.push({
2229
+ startx: x,
2230
+ starty: this.verticalPos + 2,
2231
+ stopx: x + conf.activationWidth,
2232
+ stopy: void 0,
2233
+ actor: message.from.actor,
2234
+ anchored: svgDraw.anchorElement(diagram2)
2235
+ });
2236
+ },
2237
+ endActivation: function(message) {
2238
+ const lastActorActivationIdx = this.activations.map(function(activation) {
2239
+ return activation.actor;
2240
+ }).lastIndexOf(message.from.actor);
2241
+ return this.activations.splice(lastActorActivationIdx, 1)[0];
2242
+ },
2243
+ createLoop: function(title = { message: void 0, wrap: false, width: void 0 }, fill) {
2244
+ return {
2245
+ startx: void 0,
2246
+ starty: this.verticalPos,
2247
+ stopx: void 0,
2248
+ stopy: void 0,
2249
+ title: title.message,
2250
+ wrap: title.wrap,
2251
+ width: title.width,
2252
+ height: 0,
2253
+ fill
2254
+ };
2255
+ },
2256
+ newLoop: function(title = { message: void 0, wrap: false, width: void 0 }, fill) {
2257
+ this.sequenceItems.push(this.createLoop(title, fill));
2258
+ },
2259
+ endLoop: function() {
2260
+ return this.sequenceItems.pop();
2261
+ },
2262
+ isLoopOverlap: function() {
2263
+ return this.sequenceItems.length ? this.sequenceItems[this.sequenceItems.length - 1].overlap : false;
2264
+ },
2265
+ addSectionToLoop: function(message) {
2266
+ const loop = this.sequenceItems.pop();
2267
+ loop.sections = loop.sections || [];
2268
+ loop.sectionTitles = loop.sectionTitles || [];
2269
+ loop.sections.push({ y: bounds.getVerticalPos(), height: 0 });
2270
+ loop.sectionTitles.push(message);
2271
+ this.sequenceItems.push(loop);
2272
+ },
2273
+ saveVerticalPos: function() {
2274
+ if (this.isLoopOverlap()) {
2275
+ this.savedVerticalPos = this.verticalPos;
2276
+ }
2277
+ },
2278
+ resetVerticalPos: function() {
2279
+ if (this.isLoopOverlap()) {
2280
+ this.verticalPos = this.savedVerticalPos;
2281
+ }
2282
+ },
2283
+ bumpVerticalPos: function(bump) {
2284
+ this.verticalPos = this.verticalPos + bump;
2285
+ this.data.stopy = common.getMax(this.data.stopy, this.verticalPos);
2286
+ },
2287
+ getVerticalPos: function() {
2288
+ return this.verticalPos;
2289
+ },
2290
+ getBounds: function() {
2291
+ return { bounds: this.data, models: this.models };
2292
+ }
2293
+ };
2294
+ const drawNote = async function(elem, noteModel) {
2295
+ bounds.bumpVerticalPos(conf.boxMargin);
2296
+ noteModel.height = conf.boxMargin;
2297
+ noteModel.starty = bounds.getVerticalPos();
2298
+ const rect = getNoteRect$1();
2299
+ rect.x = noteModel.startx;
2300
+ rect.y = noteModel.starty;
2301
+ rect.width = noteModel.width || conf.width;
2302
+ rect.class = "note";
2303
+ const g = elem.append("g");
2304
+ const rectElem = svgDraw.drawRect(g, rect);
2305
+ const textObj = getTextObj$1();
2306
+ textObj.x = noteModel.startx;
2307
+ textObj.y = noteModel.starty;
2308
+ textObj.width = rect.width;
2309
+ textObj.dy = "1em";
2310
+ textObj.text = noteModel.message;
2311
+ textObj.class = "noteText";
2312
+ textObj.fontFamily = conf.noteFontFamily;
2313
+ textObj.fontSize = conf.noteFontSize;
2314
+ textObj.fontWeight = conf.noteFontWeight;
2315
+ textObj.anchor = conf.noteAlign;
2316
+ textObj.textMargin = conf.noteMargin;
2317
+ textObj.valign = "center";
2318
+ const textElem = hasKatex(textObj.text) ? await drawKatex(g, textObj) : drawText(g, textObj);
2319
+ const textHeight = Math.round(
2320
+ textElem.map((te) => (te._groups || te)[0][0].getBBox().height).reduce((acc, curr) => acc + curr)
2321
+ );
2322
+ rectElem.attr("height", textHeight + 2 * conf.noteMargin);
2323
+ noteModel.height += textHeight + 2 * conf.noteMargin;
2324
+ bounds.bumpVerticalPos(textHeight + 2 * conf.noteMargin);
2325
+ noteModel.stopy = noteModel.starty + textHeight + 2 * conf.noteMargin;
2326
+ noteModel.stopx = noteModel.startx + rect.width;
2327
+ bounds.insert(noteModel.startx, noteModel.starty, noteModel.stopx, noteModel.stopy);
2328
+ bounds.models.addNote(noteModel);
2329
+ };
2330
+ const messageFont = (cnf) => {
2331
+ return {
2332
+ fontFamily: cnf.messageFontFamily,
2333
+ fontSize: cnf.messageFontSize,
2334
+ fontWeight: cnf.messageFontWeight
2335
+ };
2336
+ };
2337
+ const noteFont = (cnf) => {
2338
+ return {
2339
+ fontFamily: cnf.noteFontFamily,
2340
+ fontSize: cnf.noteFontSize,
2341
+ fontWeight: cnf.noteFontWeight
2342
+ };
2343
+ };
2344
+ const actorFont = (cnf) => {
2345
+ return {
2346
+ fontFamily: cnf.actorFontFamily,
2347
+ fontSize: cnf.actorFontSize,
2348
+ fontWeight: cnf.actorFontWeight
2349
+ };
2350
+ };
2351
+ async function boundMessage(_diagram, msgModel) {
2352
+ bounds.bumpVerticalPos(10);
2353
+ const { startx, stopx, message } = msgModel;
2354
+ const lines = common.splitBreaks(message).length;
2355
+ const isKatexMsg = hasKatex(message);
2356
+ const textDims = isKatexMsg ? await calculateMathMLDimensions(message, getConfig()) : utils.calculateTextDimensions(message, messageFont(conf));
2357
+ if (!isKatexMsg) {
2358
+ const lineHeight = textDims.height / lines;
2359
+ msgModel.height += lineHeight;
2360
+ bounds.bumpVerticalPos(lineHeight);
2361
+ }
2362
+ let lineStartY;
2363
+ let totalOffset = textDims.height - 10;
2364
+ const textWidth = textDims.width;
2365
+ if (startx === stopx) {
2366
+ lineStartY = bounds.getVerticalPos() + totalOffset;
2367
+ if (!conf.rightAngles) {
2368
+ totalOffset += conf.boxMargin;
2369
+ lineStartY = bounds.getVerticalPos() + totalOffset;
2370
+ }
2371
+ totalOffset += 30;
2372
+ const dx = common.getMax(textWidth / 2, conf.width / 2);
2373
+ bounds.insert(
2374
+ startx - dx,
2375
+ bounds.getVerticalPos() - 10 + totalOffset,
2376
+ stopx + dx,
2377
+ bounds.getVerticalPos() + 30 + totalOffset
2378
+ );
2379
+ } else {
2380
+ totalOffset += conf.boxMargin;
2381
+ lineStartY = bounds.getVerticalPos() + totalOffset;
2382
+ bounds.insert(startx, lineStartY - 10, stopx, lineStartY);
2383
+ }
2384
+ bounds.bumpVerticalPos(totalOffset);
2385
+ msgModel.height += totalOffset;
2386
+ msgModel.stopy = msgModel.starty + msgModel.height;
2387
+ bounds.insert(msgModel.fromBounds, msgModel.starty, msgModel.toBounds, msgModel.stopy);
2388
+ return lineStartY;
2389
+ }
2390
+ const drawMessage = async function(diagram2, msgModel, lineStartY, diagObj) {
2391
+ const { startx, stopx, starty, message, type, sequenceIndex, sequenceVisible } = msgModel;
2392
+ const textDims = utils.calculateTextDimensions(message, messageFont(conf));
2393
+ const textObj = getTextObj$1();
2394
+ textObj.x = startx;
2395
+ textObj.y = starty + 10;
2396
+ textObj.width = stopx - startx;
2397
+ textObj.class = "messageText";
2398
+ textObj.dy = "1em";
2399
+ textObj.text = message;
2400
+ textObj.fontFamily = conf.messageFontFamily;
2401
+ textObj.fontSize = conf.messageFontSize;
2402
+ textObj.fontWeight = conf.messageFontWeight;
2403
+ textObj.anchor = conf.messageAlign;
2404
+ textObj.valign = "center";
2405
+ textObj.textMargin = conf.wrapPadding;
2406
+ textObj.tspan = false;
2407
+ hasKatex(textObj.text) ? await drawKatex(diagram2, textObj, { startx, stopx, starty: lineStartY }) : drawText(diagram2, textObj);
2408
+ const textWidth = textDims.width;
2409
+ let line;
2410
+ if (startx === stopx) {
2411
+ if (conf.rightAngles) {
2412
+ line = diagram2.append("path").attr(
2413
+ "d",
2414
+ `M ${startx},${lineStartY} H ${startx + common.getMax(conf.width / 2, textWidth / 2)} V ${lineStartY + 25} H ${startx}`
2415
+ );
2416
+ } else {
2417
+ line = diagram2.append("path").attr(
2418
+ "d",
2419
+ "M " + startx + "," + lineStartY + " C " + (startx + 60) + "," + (lineStartY - 10) + " " + (startx + 60) + "," + (lineStartY + 30) + " " + startx + "," + (lineStartY + 20)
2420
+ );
2421
+ }
2422
+ } else {
2423
+ line = diagram2.append("line");
2424
+ line.attr("x1", startx);
2425
+ line.attr("y1", lineStartY);
2426
+ line.attr("x2", stopx);
2427
+ line.attr("y2", lineStartY);
2428
+ }
2429
+ if (type === diagObj.db.LINETYPE.DOTTED || type === diagObj.db.LINETYPE.DOTTED_CROSS || type === diagObj.db.LINETYPE.DOTTED_POINT || type === diagObj.db.LINETYPE.DOTTED_OPEN) {
2430
+ line.style("stroke-dasharray", "3, 3");
2431
+ line.attr("class", "messageLine1");
2432
+ } else {
2433
+ line.attr("class", "messageLine0");
2434
+ }
2435
+ let url = "";
2436
+ if (conf.arrowMarkerAbsolute) {
2437
+ url = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search;
2438
+ url = url.replace(/\(/g, "\\(");
2439
+ url = url.replace(/\)/g, "\\)");
2440
+ }
2441
+ line.attr("stroke-width", 2);
2442
+ line.attr("stroke", "none");
2443
+ line.style("fill", "none");
2444
+ if (type === diagObj.db.LINETYPE.SOLID || type === diagObj.db.LINETYPE.DOTTED) {
2445
+ line.attr("marker-end", "url(" + url + "#arrowhead)");
2446
+ }
2447
+ if (type === diagObj.db.LINETYPE.SOLID_POINT || type === diagObj.db.LINETYPE.DOTTED_POINT) {
2448
+ line.attr("marker-end", "url(" + url + "#filled-head)");
2449
+ }
2450
+ if (type === diagObj.db.LINETYPE.SOLID_CROSS || type === diagObj.db.LINETYPE.DOTTED_CROSS) {
2451
+ line.attr("marker-end", "url(" + url + "#crosshead)");
2452
+ }
2453
+ if (sequenceVisible || conf.showSequenceNumbers) {
2454
+ line.attr("marker-start", "url(" + url + "#sequencenumber)");
2455
+ diagram2.append("text").attr("x", startx).attr("y", lineStartY + 4).attr("font-family", "sans-serif").attr("font-size", "12px").attr("text-anchor", "middle").attr("class", "sequenceNumber").text(sequenceIndex);
2456
+ }
2457
+ };
2458
+ const addActorRenderingData = async function(diagram2, actors, createdActors, actorKeys, verticalPos, messages, isFooter) {
2459
+ let prevWidth = 0;
2460
+ let prevMargin = 0;
2461
+ let prevBox = void 0;
2462
+ let maxHeight = 0;
2463
+ for (const actorKey of actorKeys) {
2464
+ const actor = actors[actorKey];
2465
+ const box = actor.box;
2466
+ if (prevBox && prevBox != box) {
2467
+ if (!isFooter) {
2468
+ bounds.models.addBox(prevBox);
2469
+ }
2470
+ prevMargin += conf.boxMargin + prevBox.margin;
2471
+ }
2472
+ if (box && box != prevBox) {
2473
+ if (!isFooter) {
2474
+ box.x = prevWidth + prevMargin;
2475
+ box.y = verticalPos;
2476
+ }
2477
+ prevMargin += box.margin;
2478
+ }
2479
+ actor.width = actor.width || conf.width;
2480
+ actor.height = common.getMax(actor.height || conf.height, conf.height);
2481
+ actor.margin = actor.margin || conf.actorMargin;
2482
+ maxHeight = common.getMax(maxHeight, actor.height);
2483
+ if (createdActors[actor.name]) {
2484
+ prevMargin += actor.width / 2;
2485
+ }
2486
+ actor.x = prevWidth + prevMargin;
2487
+ actor.starty = bounds.getVerticalPos();
2488
+ bounds.insert(actor.x, verticalPos, actor.x + actor.width, actor.height);
2489
+ prevWidth += actor.width + prevMargin;
2490
+ if (actor.box) {
2491
+ actor.box.width = prevWidth + box.margin - actor.box.x;
2492
+ }
2493
+ prevMargin = actor.margin;
2494
+ prevBox = actor.box;
2495
+ bounds.models.addActor(actor);
2496
+ }
2497
+ if (prevBox && !isFooter) {
2498
+ bounds.models.addBox(prevBox);
2499
+ }
2500
+ bounds.bumpVerticalPos(maxHeight);
2501
+ };
2502
+ const drawActors = async function(diagram2, actors, actorKeys, isFooter) {
2503
+ if (!isFooter) {
2504
+ for (const actorKey of actorKeys) {
2505
+ const actor = actors[actorKey];
2506
+ await svgDraw.drawActor(diagram2, actor, conf, false);
2507
+ }
2508
+ } else {
2509
+ let maxHeight = 0;
2510
+ bounds.bumpVerticalPos(conf.boxMargin * 2);
2511
+ for (const actorKey of actorKeys) {
2512
+ const actor = actors[actorKey];
2513
+ if (!actor.stopy) {
2514
+ actor.stopy = bounds.getVerticalPos();
2515
+ }
2516
+ const height = await svgDraw.drawActor(diagram2, actor, conf, true);
2517
+ maxHeight = common.getMax(maxHeight, height);
2518
+ }
2519
+ bounds.bumpVerticalPos(maxHeight + conf.boxMargin);
2520
+ }
2521
+ };
2522
+ const drawActorsPopup = function(diagram2, actors, actorKeys, doc) {
2523
+ let maxHeight = 0;
2524
+ let maxWidth = 0;
2525
+ for (const actorKey of actorKeys) {
2526
+ const actor = actors[actorKey];
2527
+ const minMenuWidth = getRequiredPopupWidth(actor);
2528
+ const menuDimensions = svgDraw.drawPopup(
2529
+ diagram2,
2530
+ actor,
2531
+ minMenuWidth,
2532
+ conf,
2533
+ conf.forceMenus,
2534
+ doc
2535
+ );
2536
+ if (menuDimensions.height > maxHeight) {
2537
+ maxHeight = menuDimensions.height;
2538
+ }
2539
+ if (menuDimensions.width + actor.x > maxWidth) {
2540
+ maxWidth = menuDimensions.width + actor.x;
2541
+ }
2542
+ }
2543
+ return { maxHeight, maxWidth };
2544
+ };
2545
+ const setConf = function(cnf) {
2546
+ assignWithDepth(conf, cnf);
2547
+ if (cnf.fontFamily) {
2548
+ conf.actorFontFamily = conf.noteFontFamily = conf.messageFontFamily = cnf.fontFamily;
2549
+ }
2550
+ if (cnf.fontSize) {
2551
+ conf.actorFontSize = conf.noteFontSize = conf.messageFontSize = cnf.fontSize;
2552
+ }
2553
+ if (cnf.fontWeight) {
2554
+ conf.actorFontWeight = conf.noteFontWeight = conf.messageFontWeight = cnf.fontWeight;
2555
+ }
2556
+ };
2557
+ const actorActivations = function(actor) {
2558
+ return bounds.activations.filter(function(activation) {
2559
+ return activation.actor === actor;
2560
+ });
2561
+ };
2562
+ const activationBounds = function(actor, actors) {
2563
+ const actorObj = actors[actor];
2564
+ const activations = actorActivations(actor);
2565
+ const left = activations.reduce(function(acc, activation) {
2566
+ return common.getMin(acc, activation.startx);
2567
+ }, actorObj.x + actorObj.width / 2 - 1);
2568
+ const right = activations.reduce(function(acc, activation) {
2569
+ return common.getMax(acc, activation.stopx);
2570
+ }, actorObj.x + actorObj.width / 2 + 1);
2571
+ return [left, right];
2572
+ };
2573
+ function adjustLoopHeightForWrap(loopWidths, msg, preMargin, postMargin, addLoopFn) {
2574
+ bounds.bumpVerticalPos(preMargin);
2575
+ let heightAdjust = postMargin;
2576
+ if (msg.id && msg.message && loopWidths[msg.id]) {
2577
+ const loopWidth = loopWidths[msg.id].width;
2578
+ const textConf = messageFont(conf);
2579
+ msg.message = utils.wrapLabel(`[${msg.message}]`, loopWidth - 2 * conf.wrapPadding, textConf);
2580
+ msg.width = loopWidth;
2581
+ msg.wrap = true;
2582
+ const textDims = utils.calculateTextDimensions(msg.message, textConf);
2583
+ const totalOffset = common.getMax(textDims.height, conf.labelBoxHeight);
2584
+ heightAdjust = postMargin + totalOffset;
2585
+ log.debug(`${totalOffset} - ${msg.message}`);
2586
+ }
2587
+ addLoopFn(msg);
2588
+ bounds.bumpVerticalPos(heightAdjust);
2589
+ }
2590
+ function adjustCreatedDestroyedData(msg, msgModel, lineStartY, index, actors, createdActors, destroyedActors) {
2591
+ function receiverAdjustment(actor, adjustment) {
2592
+ if (actor.x < actors[msg.from].x) {
2593
+ bounds.insert(
2594
+ msgModel.stopx - adjustment,
2595
+ msgModel.starty,
2596
+ msgModel.startx,
2597
+ msgModel.stopy + actor.height / 2 + conf.noteMargin
2598
+ );
2599
+ msgModel.stopx = msgModel.stopx + adjustment;
2600
+ } else {
2601
+ bounds.insert(
2602
+ msgModel.startx,
2603
+ msgModel.starty,
2604
+ msgModel.stopx + adjustment,
2605
+ msgModel.stopy + actor.height / 2 + conf.noteMargin
2606
+ );
2607
+ msgModel.stopx = msgModel.stopx - adjustment;
2608
+ }
2609
+ }
2610
+ function senderAdjustment(actor, adjustment) {
2611
+ if (actor.x < actors[msg.to].x) {
2612
+ bounds.insert(
2613
+ msgModel.startx - adjustment,
2614
+ msgModel.starty,
2615
+ msgModel.stopx,
2616
+ msgModel.stopy + actor.height / 2 + conf.noteMargin
2617
+ );
2618
+ msgModel.startx = msgModel.startx + adjustment;
2619
+ } else {
2620
+ bounds.insert(
2621
+ msgModel.stopx,
2622
+ msgModel.starty,
2623
+ msgModel.startx + adjustment,
2624
+ msgModel.stopy + actor.height / 2 + conf.noteMargin
2625
+ );
2626
+ msgModel.startx = msgModel.startx - adjustment;
2627
+ }
2628
+ }
2629
+ if (createdActors[msg.to] == index) {
2630
+ const actor = actors[msg.to];
2631
+ const adjustment = actor.type == "actor" ? ACTOR_TYPE_WIDTH / 2 + 3 : actor.width / 2 + 3;
2632
+ receiverAdjustment(actor, adjustment);
2633
+ actor.starty = lineStartY - actor.height / 2;
2634
+ bounds.bumpVerticalPos(actor.height / 2);
2635
+ } else if (destroyedActors[msg.from] == index) {
2636
+ const actor = actors[msg.from];
2637
+ if (conf.mirrorActors) {
2638
+ const adjustment = actor.type == "actor" ? ACTOR_TYPE_WIDTH / 2 : actor.width / 2;
2639
+ senderAdjustment(actor, adjustment);
2640
+ }
2641
+ actor.stopy = lineStartY - actor.height / 2;
2642
+ bounds.bumpVerticalPos(actor.height / 2);
2643
+ } else if (destroyedActors[msg.to] == index) {
2644
+ const actor = actors[msg.to];
2645
+ if (conf.mirrorActors) {
2646
+ const adjustment = actor.type == "actor" ? ACTOR_TYPE_WIDTH / 2 + 3 : actor.width / 2 + 3;
2647
+ receiverAdjustment(actor, adjustment);
2648
+ }
2649
+ actor.stopy = lineStartY - actor.height / 2;
2650
+ bounds.bumpVerticalPos(actor.height / 2);
2651
+ }
2652
+ }
2653
+ const draw = async function(_text, id, _version, diagObj) {
2654
+ const { securityLevel, sequence } = getConfig();
2655
+ conf = sequence;
2656
+ let sandboxElement;
2657
+ if (securityLevel === "sandbox") {
2658
+ sandboxElement = d3select("#i" + id);
2659
+ }
2660
+ const root = securityLevel === "sandbox" ? d3select(sandboxElement.nodes()[0].contentDocument.body) : d3select("body");
2661
+ const doc = securityLevel === "sandbox" ? sandboxElement.nodes()[0].contentDocument : document;
2662
+ bounds.init();
2663
+ log.debug(diagObj.db);
2664
+ const diagram2 = securityLevel === "sandbox" ? root.select(`[id="${id}"]`) : d3select(`[id="${id}"]`);
2665
+ const actors = diagObj.db.getActors();
2666
+ const createdActors = diagObj.db.getCreatedActors();
2667
+ const destroyedActors = diagObj.db.getDestroyedActors();
2668
+ const boxes = diagObj.db.getBoxes();
2669
+ let actorKeys = diagObj.db.getActorKeys();
2670
+ const messages = diagObj.db.getMessages();
2671
+ const title = diagObj.db.getDiagramTitle();
2672
+ const hasBoxes = diagObj.db.hasAtLeastOneBox();
2673
+ const hasBoxTitles = diagObj.db.hasAtLeastOneBoxWithTitle();
2674
+ const maxMessageWidthPerActor = await getMaxMessageWidthPerActor(actors, messages, diagObj);
2675
+ conf.height = await calculateActorMargins(actors, maxMessageWidthPerActor, boxes);
2676
+ svgDraw.insertComputerIcon(diagram2);
2677
+ svgDraw.insertDatabaseIcon(diagram2);
2678
+ svgDraw.insertClockIcon(diagram2);
2679
+ if (hasBoxes) {
2680
+ bounds.bumpVerticalPos(conf.boxMargin);
2681
+ if (hasBoxTitles) {
2682
+ bounds.bumpVerticalPos(boxes[0].textMaxHeight);
2683
+ }
2684
+ }
2685
+ if (conf.hideUnusedParticipants === true) {
2686
+ const newActors = /* @__PURE__ */ new Set();
2687
+ messages.forEach((message) => {
2688
+ newActors.add(message.from);
2689
+ newActors.add(message.to);
2690
+ });
2691
+ actorKeys = actorKeys.filter((actorKey) => newActors.has(actorKey));
2692
+ }
2693
+ await addActorRenderingData(diagram2, actors, createdActors, actorKeys, 0, messages, false);
2694
+ const loopWidths = await calculateLoopBounds(messages, actors, maxMessageWidthPerActor, diagObj);
2695
+ svgDraw.insertArrowHead(diagram2);
2696
+ svgDraw.insertArrowCrossHead(diagram2);
2697
+ svgDraw.insertArrowFilledHead(diagram2);
2698
+ svgDraw.insertSequenceNumber(diagram2);
2699
+ function activeEnd(msg, verticalPos) {
2700
+ const activationData = bounds.endActivation(msg);
2701
+ if (activationData.starty + 18 > verticalPos) {
2702
+ activationData.starty = verticalPos - 6;
2703
+ verticalPos += 12;
2704
+ }
2705
+ svgDraw.drawActivation(
2706
+ diagram2,
2707
+ activationData,
2708
+ verticalPos,
2709
+ conf,
2710
+ actorActivations(msg.from.actor).length
2711
+ );
2712
+ bounds.insert(activationData.startx, verticalPos - 10, activationData.stopx, verticalPos);
2713
+ }
2714
+ let sequenceIndex = 1;
2715
+ let sequenceIndexStep = 1;
2716
+ const messagesToDraw = [];
2717
+ const backgrounds = [];
2718
+ let index = 0;
2719
+ for (const msg of messages) {
2720
+ let loopModel, noteModel, msgModel;
2721
+ switch (msg.type) {
2722
+ case diagObj.db.LINETYPE.NOTE:
2723
+ bounds.resetVerticalPos();
2724
+ noteModel = msg.noteModel;
2725
+ await drawNote(diagram2, noteModel);
2726
+ break;
2727
+ case diagObj.db.LINETYPE.ACTIVE_START:
2728
+ bounds.newActivation(msg, diagram2, actors);
2729
+ break;
2730
+ case diagObj.db.LINETYPE.ACTIVE_END:
2731
+ activeEnd(msg, bounds.getVerticalPos());
2732
+ break;
2733
+ case diagObj.db.LINETYPE.LOOP_START:
2734
+ adjustLoopHeightForWrap(
2735
+ loopWidths,
2736
+ msg,
2737
+ conf.boxMargin,
2738
+ conf.boxMargin + conf.boxTextMargin,
2739
+ (message) => bounds.newLoop(message)
2740
+ );
2741
+ break;
2742
+ case diagObj.db.LINETYPE.LOOP_END:
2743
+ loopModel = bounds.endLoop();
2744
+ await svgDraw.drawLoop(diagram2, loopModel, "loop", conf);
2745
+ bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
2746
+ bounds.models.addLoop(loopModel);
2747
+ break;
2748
+ case diagObj.db.LINETYPE.RECT_START:
2749
+ adjustLoopHeightForWrap(
2750
+ loopWidths,
2751
+ msg,
2752
+ conf.boxMargin,
2753
+ conf.boxMargin,
2754
+ (message) => bounds.newLoop(void 0, message.message)
2755
+ );
2756
+ break;
2757
+ case diagObj.db.LINETYPE.RECT_END:
2758
+ loopModel = bounds.endLoop();
2759
+ backgrounds.push(loopModel);
2760
+ bounds.models.addLoop(loopModel);
2761
+ bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
2762
+ break;
2763
+ case diagObj.db.LINETYPE.OPT_START:
2764
+ adjustLoopHeightForWrap(
2765
+ loopWidths,
2766
+ msg,
2767
+ conf.boxMargin,
2768
+ conf.boxMargin + conf.boxTextMargin,
2769
+ (message) => bounds.newLoop(message)
2770
+ );
2771
+ break;
2772
+ case diagObj.db.LINETYPE.OPT_END:
2773
+ loopModel = bounds.endLoop();
2774
+ await svgDraw.drawLoop(diagram2, loopModel, "opt", conf);
2775
+ bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
2776
+ bounds.models.addLoop(loopModel);
2777
+ break;
2778
+ case diagObj.db.LINETYPE.ALT_START:
2779
+ adjustLoopHeightForWrap(
2780
+ loopWidths,
2781
+ msg,
2782
+ conf.boxMargin,
2783
+ conf.boxMargin + conf.boxTextMargin,
2784
+ (message) => bounds.newLoop(message)
2785
+ );
2786
+ break;
2787
+ case diagObj.db.LINETYPE.ALT_ELSE:
2788
+ adjustLoopHeightForWrap(
2789
+ loopWidths,
2790
+ msg,
2791
+ conf.boxMargin + conf.boxTextMargin,
2792
+ conf.boxMargin,
2793
+ (message) => bounds.addSectionToLoop(message)
2794
+ );
2795
+ break;
2796
+ case diagObj.db.LINETYPE.ALT_END:
2797
+ loopModel = bounds.endLoop();
2798
+ await svgDraw.drawLoop(diagram2, loopModel, "alt", conf);
2799
+ bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
2800
+ bounds.models.addLoop(loopModel);
2801
+ break;
2802
+ case diagObj.db.LINETYPE.PAR_START:
2803
+ case diagObj.db.LINETYPE.PAR_OVER_START:
2804
+ adjustLoopHeightForWrap(
2805
+ loopWidths,
2806
+ msg,
2807
+ conf.boxMargin,
2808
+ conf.boxMargin + conf.boxTextMargin,
2809
+ (message) => bounds.newLoop(message)
2810
+ );
2811
+ bounds.saveVerticalPos();
2812
+ break;
2813
+ case diagObj.db.LINETYPE.PAR_AND:
2814
+ adjustLoopHeightForWrap(
2815
+ loopWidths,
2816
+ msg,
2817
+ conf.boxMargin + conf.boxTextMargin,
2818
+ conf.boxMargin,
2819
+ (message) => bounds.addSectionToLoop(message)
2820
+ );
2821
+ break;
2822
+ case diagObj.db.LINETYPE.PAR_END:
2823
+ loopModel = bounds.endLoop();
2824
+ await svgDraw.drawLoop(diagram2, loopModel, "par", conf);
2825
+ bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
2826
+ bounds.models.addLoop(loopModel);
2827
+ break;
2828
+ case diagObj.db.LINETYPE.AUTONUMBER:
2829
+ sequenceIndex = msg.message.start || sequenceIndex;
2830
+ sequenceIndexStep = msg.message.step || sequenceIndexStep;
2831
+ if (msg.message.visible) {
2832
+ diagObj.db.enableSequenceNumbers();
2833
+ } else {
2834
+ diagObj.db.disableSequenceNumbers();
2835
+ }
2836
+ break;
2837
+ case diagObj.db.LINETYPE.CRITICAL_START:
2838
+ adjustLoopHeightForWrap(
2839
+ loopWidths,
2840
+ msg,
2841
+ conf.boxMargin,
2842
+ conf.boxMargin + conf.boxTextMargin,
2843
+ (message) => bounds.newLoop(message)
2844
+ );
2845
+ break;
2846
+ case diagObj.db.LINETYPE.CRITICAL_OPTION:
2847
+ adjustLoopHeightForWrap(
2848
+ loopWidths,
2849
+ msg,
2850
+ conf.boxMargin + conf.boxTextMargin,
2851
+ conf.boxMargin,
2852
+ (message) => bounds.addSectionToLoop(message)
2853
+ );
2854
+ break;
2855
+ case diagObj.db.LINETYPE.CRITICAL_END:
2856
+ loopModel = bounds.endLoop();
2857
+ await svgDraw.drawLoop(diagram2, loopModel, "critical", conf);
2858
+ bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
2859
+ bounds.models.addLoop(loopModel);
2860
+ break;
2861
+ case diagObj.db.LINETYPE.BREAK_START:
2862
+ adjustLoopHeightForWrap(
2863
+ loopWidths,
2864
+ msg,
2865
+ conf.boxMargin,
2866
+ conf.boxMargin + conf.boxTextMargin,
2867
+ (message) => bounds.newLoop(message)
2868
+ );
2869
+ break;
2870
+ case diagObj.db.LINETYPE.BREAK_END:
2871
+ loopModel = bounds.endLoop();
2872
+ await svgDraw.drawLoop(diagram2, loopModel, "break", conf);
2873
+ bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
2874
+ bounds.models.addLoop(loopModel);
2875
+ break;
2876
+ default:
2877
+ try {
2878
+ msgModel = msg.msgModel;
2879
+ msgModel.starty = bounds.getVerticalPos();
2880
+ msgModel.sequenceIndex = sequenceIndex;
2881
+ msgModel.sequenceVisible = diagObj.db.showSequenceNumbers();
2882
+ const lineStartY = await boundMessage(diagram2, msgModel);
2883
+ adjustCreatedDestroyedData(
2884
+ msg,
2885
+ msgModel,
2886
+ lineStartY,
2887
+ index,
2888
+ actors,
2889
+ createdActors,
2890
+ destroyedActors
2891
+ );
2892
+ messagesToDraw.push({ messageModel: msgModel, lineStartY });
2893
+ bounds.models.addMessage(msgModel);
2894
+ } catch (e) {
2895
+ log.error("error while drawing message", e);
2896
+ }
2897
+ }
2898
+ if ([
2899
+ diagObj.db.LINETYPE.SOLID_OPEN,
2900
+ diagObj.db.LINETYPE.DOTTED_OPEN,
2901
+ diagObj.db.LINETYPE.SOLID,
2902
+ diagObj.db.LINETYPE.DOTTED,
2903
+ diagObj.db.LINETYPE.SOLID_CROSS,
2904
+ diagObj.db.LINETYPE.DOTTED_CROSS,
2905
+ diagObj.db.LINETYPE.SOLID_POINT,
2906
+ diagObj.db.LINETYPE.DOTTED_POINT
2907
+ ].includes(msg.type)) {
2908
+ sequenceIndex = sequenceIndex + sequenceIndexStep;
2909
+ }
2910
+ index++;
2911
+ }
2912
+ log.debug("createdActors", createdActors);
2913
+ log.debug("destroyedActors", destroyedActors);
2914
+ await drawActors(diagram2, actors, actorKeys, false);
2915
+ for (const e of messagesToDraw) {
2916
+ await drawMessage(diagram2, e.messageModel, e.lineStartY, diagObj);
2917
+ }
2918
+ if (conf.mirrorActors) {
2919
+ await drawActors(diagram2, actors, actorKeys, true);
2920
+ }
2921
+ backgrounds.forEach((e) => svgDraw.drawBackgroundRect(diagram2, e));
2922
+ fixLifeLineHeights(diagram2, actors, actorKeys, conf);
2923
+ for (const box2 of bounds.models.boxes) {
2924
+ box2.height = bounds.getVerticalPos() - box2.y;
2925
+ bounds.insert(box2.x, box2.y, box2.x + box2.width, box2.height);
2926
+ box2.startx = box2.x;
2927
+ box2.starty = box2.y;
2928
+ box2.stopx = box2.startx + box2.width;
2929
+ box2.stopy = box2.starty + box2.height;
2930
+ box2.stroke = "rgb(0,0,0, 0.5)";
2931
+ await svgDraw.drawBox(diagram2, box2, conf);
2932
+ }
2933
+ if (hasBoxes) {
2934
+ bounds.bumpVerticalPos(conf.boxMargin);
2935
+ }
2936
+ const requiredBoxSize = drawActorsPopup(diagram2, actors, actorKeys, doc);
2937
+ const { bounds: box } = bounds.getBounds();
2938
+ let boxHeight = box.stopy - box.starty;
2939
+ if (boxHeight < requiredBoxSize.maxHeight) {
2940
+ boxHeight = requiredBoxSize.maxHeight;
2941
+ }
2942
+ let height = boxHeight + 2 * conf.diagramMarginY;
2943
+ if (conf.mirrorActors) {
2944
+ height = height - conf.boxMargin + conf.bottomMarginAdj;
2945
+ }
2946
+ let boxWidth = box.stopx - box.startx;
2947
+ if (boxWidth < requiredBoxSize.maxWidth) {
2948
+ boxWidth = requiredBoxSize.maxWidth;
2949
+ }
2950
+ const width = boxWidth + 2 * conf.diagramMarginX;
2951
+ if (title) {
2952
+ diagram2.append("text").text(title).attr("x", (box.stopx - box.startx) / 2 - 2 * conf.diagramMarginX).attr("y", -25);
2953
+ }
2954
+ configureSvgSize(diagram2, height, width, conf.useMaxWidth);
2955
+ const extraVertForTitle = title ? 40 : 0;
2956
+ diagram2.attr(
2957
+ "viewBox",
2958
+ box.startx - conf.diagramMarginX + " -" + (conf.diagramMarginY + extraVertForTitle) + " " + width + " " + (height + extraVertForTitle)
2959
+ );
2960
+ log.debug(`models:`, bounds.models);
2961
+ };
2962
+ async function getMaxMessageWidthPerActor(actors, messages, diagObj) {
2963
+ const maxMessageWidthPerActor = {};
2964
+ for (const msg of messages) {
2965
+ if (actors[msg.to] && actors[msg.from]) {
2966
+ const actor = actors[msg.to];
2967
+ if (msg.placement === diagObj.db.PLACEMENT.LEFTOF && !actor.prevActor) {
2968
+ continue;
2969
+ }
2970
+ if (msg.placement === diagObj.db.PLACEMENT.RIGHTOF && !actor.nextActor) {
2971
+ continue;
2972
+ }
2973
+ const isNote = msg.placement !== void 0;
2974
+ const isMessage = !isNote;
2975
+ const textFont = isNote ? noteFont(conf) : messageFont(conf);
2976
+ const wrappedMessage = msg.wrap ? utils.wrapLabel(msg.message, conf.width - 2 * conf.wrapPadding, textFont) : msg.message;
2977
+ const messageDimensions = hasKatex(wrappedMessage) ? await calculateMathMLDimensions(msg.message, getConfig()) : utils.calculateTextDimensions(wrappedMessage, textFont);
2978
+ const messageWidth = messageDimensions.width + 2 * conf.wrapPadding;
2979
+ if (isMessage && msg.from === actor.nextActor) {
2980
+ maxMessageWidthPerActor[msg.to] = common.getMax(
2981
+ maxMessageWidthPerActor[msg.to] || 0,
2982
+ messageWidth
2983
+ );
2984
+ } else if (isMessage && msg.from === actor.prevActor) {
2985
+ maxMessageWidthPerActor[msg.from] = common.getMax(
2986
+ maxMessageWidthPerActor[msg.from] || 0,
2987
+ messageWidth
2988
+ );
2989
+ } else if (isMessage && msg.from === msg.to) {
2990
+ maxMessageWidthPerActor[msg.from] = common.getMax(
2991
+ maxMessageWidthPerActor[msg.from] || 0,
2992
+ messageWidth / 2
2993
+ );
2994
+ maxMessageWidthPerActor[msg.to] = common.getMax(
2995
+ maxMessageWidthPerActor[msg.to] || 0,
2996
+ messageWidth / 2
2997
+ );
2998
+ } else if (msg.placement === diagObj.db.PLACEMENT.RIGHTOF) {
2999
+ maxMessageWidthPerActor[msg.from] = common.getMax(
3000
+ maxMessageWidthPerActor[msg.from] || 0,
3001
+ messageWidth
3002
+ );
3003
+ } else if (msg.placement === diagObj.db.PLACEMENT.LEFTOF) {
3004
+ maxMessageWidthPerActor[actor.prevActor] = common.getMax(
3005
+ maxMessageWidthPerActor[actor.prevActor] || 0,
3006
+ messageWidth
3007
+ );
3008
+ } else if (msg.placement === diagObj.db.PLACEMENT.OVER) {
3009
+ if (actor.prevActor) {
3010
+ maxMessageWidthPerActor[actor.prevActor] = common.getMax(
3011
+ maxMessageWidthPerActor[actor.prevActor] || 0,
3012
+ messageWidth / 2
3013
+ );
3014
+ }
3015
+ if (actor.nextActor) {
3016
+ maxMessageWidthPerActor[msg.from] = common.getMax(
3017
+ maxMessageWidthPerActor[msg.from] || 0,
3018
+ messageWidth / 2
3019
+ );
3020
+ }
3021
+ }
3022
+ }
3023
+ }
3024
+ log.debug("maxMessageWidthPerActor:", maxMessageWidthPerActor);
3025
+ return maxMessageWidthPerActor;
3026
+ }
3027
+ const getRequiredPopupWidth = function(actor) {
3028
+ let requiredPopupWidth = 0;
3029
+ const textFont = actorFont(conf);
3030
+ for (const key in actor.links) {
3031
+ const labelDimensions = utils.calculateTextDimensions(key, textFont);
3032
+ const labelWidth = labelDimensions.width + 2 * conf.wrapPadding + 2 * conf.boxMargin;
3033
+ if (requiredPopupWidth < labelWidth) {
3034
+ requiredPopupWidth = labelWidth;
3035
+ }
3036
+ }
3037
+ return requiredPopupWidth;
3038
+ };
3039
+ async function calculateActorMargins(actors, actorToMessageWidth, boxes) {
3040
+ let maxHeight = 0;
3041
+ for (const prop of Object.keys(actors)) {
3042
+ const actor = actors[prop];
3043
+ if (actor.wrap) {
3044
+ actor.description = utils.wrapLabel(
3045
+ actor.description,
3046
+ conf.width - 2 * conf.wrapPadding,
3047
+ actorFont(conf)
3048
+ );
3049
+ }
3050
+ const actDims = hasKatex(actor.description) ? await calculateMathMLDimensions(actor.description, getConfig()) : utils.calculateTextDimensions(actor.description, actorFont(conf));
3051
+ actor.width = actor.wrap ? conf.width : common.getMax(conf.width, actDims.width + 2 * conf.wrapPadding);
3052
+ actor.height = actor.wrap ? common.getMax(actDims.height, conf.height) : conf.height;
3053
+ maxHeight = common.getMax(maxHeight, actor.height);
3054
+ }
3055
+ for (const actorKey in actorToMessageWidth) {
3056
+ const actor = actors[actorKey];
3057
+ if (!actor) {
3058
+ continue;
3059
+ }
3060
+ const nextActor = actors[actor.nextActor];
3061
+ if (!nextActor) {
3062
+ const messageWidth2 = actorToMessageWidth[actorKey];
3063
+ const actorWidth2 = messageWidth2 + conf.actorMargin - actor.width / 2;
3064
+ actor.margin = common.getMax(actorWidth2, conf.actorMargin);
3065
+ continue;
3066
+ }
3067
+ const messageWidth = actorToMessageWidth[actorKey];
3068
+ const actorWidth = messageWidth + conf.actorMargin - actor.width / 2 - nextActor.width / 2;
3069
+ actor.margin = common.getMax(actorWidth, conf.actorMargin);
3070
+ }
3071
+ let maxBoxHeight = 0;
3072
+ boxes.forEach((box) => {
3073
+ const textFont = messageFont(conf);
3074
+ let totalWidth = box.actorKeys.reduce((total, aKey) => {
3075
+ return total += actors[aKey].width + (actors[aKey].margin || 0);
3076
+ }, 0);
3077
+ totalWidth -= 2 * conf.boxTextMargin;
3078
+ if (box.wrap) {
3079
+ box.name = utils.wrapLabel(box.name, totalWidth - 2 * conf.wrapPadding, textFont);
3080
+ }
3081
+ const boxMsgDimensions = utils.calculateTextDimensions(box.name, textFont);
3082
+ maxBoxHeight = common.getMax(boxMsgDimensions.height, maxBoxHeight);
3083
+ const minWidth = common.getMax(totalWidth, boxMsgDimensions.width + 2 * conf.wrapPadding);
3084
+ box.margin = conf.boxTextMargin;
3085
+ if (totalWidth < minWidth) {
3086
+ const missing = (minWidth - totalWidth) / 2;
3087
+ box.margin += missing;
3088
+ }
3089
+ });
3090
+ boxes.forEach((box) => box.textMaxHeight = maxBoxHeight);
3091
+ return common.getMax(maxHeight, conf.height);
3092
+ }
3093
+ const buildNoteModel = async function(msg, actors, diagObj) {
3094
+ const startx = actors[msg.from].x;
3095
+ const stopx = actors[msg.to].x;
3096
+ const shouldWrap = msg.wrap && msg.message;
3097
+ let textDimensions = hasKatex(msg.message) ? await calculateMathMLDimensions(msg.message, getConfig()) : utils.calculateTextDimensions(
3098
+ shouldWrap ? utils.wrapLabel(msg.message, conf.width, noteFont(conf)) : msg.message,
3099
+ noteFont(conf)
3100
+ );
3101
+ const noteModel = {
3102
+ width: shouldWrap ? conf.width : common.getMax(conf.width, textDimensions.width + 2 * conf.noteMargin),
3103
+ height: 0,
3104
+ startx: actors[msg.from].x,
3105
+ stopx: 0,
3106
+ starty: 0,
3107
+ stopy: 0,
3108
+ message: msg.message
3109
+ };
3110
+ if (msg.placement === diagObj.db.PLACEMENT.RIGHTOF) {
3111
+ noteModel.width = shouldWrap ? common.getMax(conf.width, textDimensions.width) : common.getMax(
3112
+ actors[msg.from].width / 2 + actors[msg.to].width / 2,
3113
+ textDimensions.width + 2 * conf.noteMargin
3114
+ );
3115
+ noteModel.startx = startx + (actors[msg.from].width + conf.actorMargin) / 2;
3116
+ } else if (msg.placement === diagObj.db.PLACEMENT.LEFTOF) {
3117
+ noteModel.width = shouldWrap ? common.getMax(conf.width, textDimensions.width + 2 * conf.noteMargin) : common.getMax(
3118
+ actors[msg.from].width / 2 + actors[msg.to].width / 2,
3119
+ textDimensions.width + 2 * conf.noteMargin
3120
+ );
3121
+ noteModel.startx = startx - noteModel.width + (actors[msg.from].width - conf.actorMargin) / 2;
3122
+ } else if (msg.to === msg.from) {
3123
+ textDimensions = utils.calculateTextDimensions(
3124
+ shouldWrap ? utils.wrapLabel(
3125
+ msg.message,
3126
+ common.getMax(conf.width, actors[msg.from].width),
3127
+ noteFont(conf)
3128
+ ) : msg.message,
3129
+ noteFont(conf)
3130
+ );
3131
+ noteModel.width = shouldWrap ? common.getMax(conf.width, actors[msg.from].width) : common.getMax(
3132
+ actors[msg.from].width,
3133
+ conf.width,
3134
+ textDimensions.width + 2 * conf.noteMargin
3135
+ );
3136
+ noteModel.startx = startx + (actors[msg.from].width - noteModel.width) / 2;
3137
+ } else {
3138
+ noteModel.width = Math.abs(startx + actors[msg.from].width / 2 - (stopx + actors[msg.to].width / 2)) + conf.actorMargin;
3139
+ noteModel.startx = startx < stopx ? startx + actors[msg.from].width / 2 - conf.actorMargin / 2 : stopx + actors[msg.to].width / 2 - conf.actorMargin / 2;
3140
+ }
3141
+ if (shouldWrap) {
3142
+ noteModel.message = utils.wrapLabel(
3143
+ msg.message,
3144
+ noteModel.width - 2 * conf.wrapPadding,
3145
+ noteFont(conf)
3146
+ );
3147
+ }
3148
+ log.debug(
3149
+ `NM:[${noteModel.startx},${noteModel.stopx},${noteModel.starty},${noteModel.stopy}:${noteModel.width},${noteModel.height}=${msg.message}]`
3150
+ );
3151
+ return noteModel;
3152
+ };
3153
+ const buildMessageModel = function(msg, actors, diagObj) {
3154
+ if (![
3155
+ diagObj.db.LINETYPE.SOLID_OPEN,
3156
+ diagObj.db.LINETYPE.DOTTED_OPEN,
3157
+ diagObj.db.LINETYPE.SOLID,
3158
+ diagObj.db.LINETYPE.DOTTED,
3159
+ diagObj.db.LINETYPE.SOLID_CROSS,
3160
+ diagObj.db.LINETYPE.DOTTED_CROSS,
3161
+ diagObj.db.LINETYPE.SOLID_POINT,
3162
+ diagObj.db.LINETYPE.DOTTED_POINT
3163
+ ].includes(msg.type)) {
3164
+ return {};
3165
+ }
3166
+ const [fromLeft, fromRight] = activationBounds(msg.from, actors);
3167
+ const [toLeft, toRight] = activationBounds(msg.to, actors);
3168
+ const isArrowToRight = fromLeft <= toLeft;
3169
+ const startx = isArrowToRight ? fromRight : fromLeft;
3170
+ let stopx = isArrowToRight ? toLeft : toRight;
3171
+ const isArrowToActivation = Math.abs(toLeft - toRight) > 2;
3172
+ const adjustValue = (value) => {
3173
+ return isArrowToRight ? -value : value;
3174
+ };
3175
+ if (msg.from === msg.to) {
3176
+ stopx = startx;
3177
+ } else {
3178
+ if (msg.activate && !isArrowToActivation) {
3179
+ stopx += adjustValue(conf.activationWidth / 2 - 1);
3180
+ }
3181
+ if (![diagObj.db.LINETYPE.SOLID_OPEN, diagObj.db.LINETYPE.DOTTED_OPEN].includes(msg.type)) {
3182
+ stopx += adjustValue(3);
3183
+ }
3184
+ }
3185
+ const allBounds = [fromLeft, fromRight, toLeft, toRight];
3186
+ const boundedWidth = Math.abs(startx - stopx);
3187
+ if (msg.wrap && msg.message) {
3188
+ msg.message = utils.wrapLabel(
3189
+ msg.message,
3190
+ common.getMax(boundedWidth + 2 * conf.wrapPadding, conf.width),
3191
+ messageFont(conf)
3192
+ );
3193
+ }
3194
+ const msgDims = utils.calculateTextDimensions(msg.message, messageFont(conf));
3195
+ return {
3196
+ width: common.getMax(
3197
+ msg.wrap ? 0 : msgDims.width + 2 * conf.wrapPadding,
3198
+ boundedWidth + 2 * conf.wrapPadding,
3199
+ conf.width
3200
+ ),
3201
+ height: 0,
3202
+ startx,
3203
+ stopx,
3204
+ starty: 0,
3205
+ stopy: 0,
3206
+ message: msg.message,
3207
+ type: msg.type,
3208
+ wrap: msg.wrap,
3209
+ fromBounds: Math.min.apply(null, allBounds),
3210
+ toBounds: Math.max.apply(null, allBounds)
3211
+ };
3212
+ };
3213
+ const calculateLoopBounds = async function(messages, actors, _maxWidthPerActor, diagObj) {
3214
+ const loops = {};
3215
+ const stack = [];
3216
+ let current, noteModel, msgModel;
3217
+ for (const msg of messages) {
3218
+ msg.id = utils.random({ length: 10 });
3219
+ switch (msg.type) {
3220
+ case diagObj.db.LINETYPE.LOOP_START:
3221
+ case diagObj.db.LINETYPE.ALT_START:
3222
+ case diagObj.db.LINETYPE.OPT_START:
3223
+ case diagObj.db.LINETYPE.PAR_START:
3224
+ case diagObj.db.LINETYPE.PAR_OVER_START:
3225
+ case diagObj.db.LINETYPE.CRITICAL_START:
3226
+ case diagObj.db.LINETYPE.BREAK_START:
3227
+ stack.push({
3228
+ id: msg.id,
3229
+ msg: msg.message,
3230
+ from: Number.MAX_SAFE_INTEGER,
3231
+ to: Number.MIN_SAFE_INTEGER,
3232
+ width: 0
3233
+ });
3234
+ break;
3235
+ case diagObj.db.LINETYPE.ALT_ELSE:
3236
+ case diagObj.db.LINETYPE.PAR_AND:
3237
+ case diagObj.db.LINETYPE.CRITICAL_OPTION:
3238
+ if (msg.message) {
3239
+ current = stack.pop();
3240
+ loops[current.id] = current;
3241
+ loops[msg.id] = current;
3242
+ stack.push(current);
3243
+ }
3244
+ break;
3245
+ case diagObj.db.LINETYPE.LOOP_END:
3246
+ case diagObj.db.LINETYPE.ALT_END:
3247
+ case diagObj.db.LINETYPE.OPT_END:
3248
+ case diagObj.db.LINETYPE.PAR_END:
3249
+ case diagObj.db.LINETYPE.CRITICAL_END:
3250
+ case diagObj.db.LINETYPE.BREAK_END:
3251
+ current = stack.pop();
3252
+ loops[current.id] = current;
3253
+ break;
3254
+ case diagObj.db.LINETYPE.ACTIVE_START:
3255
+ {
3256
+ const actorRect = actors[msg.from ? msg.from.actor : msg.to.actor];
3257
+ const stackedSize = actorActivations(msg.from ? msg.from.actor : msg.to.actor).length;
3258
+ const x = actorRect.x + actorRect.width / 2 + (stackedSize - 1) * conf.activationWidth / 2;
3259
+ const toAdd = {
3260
+ startx: x,
3261
+ stopx: x + conf.activationWidth,
3262
+ actor: msg.from.actor,
3263
+ enabled: true
3264
+ };
3265
+ bounds.activations.push(toAdd);
3266
+ }
3267
+ break;
3268
+ case diagObj.db.LINETYPE.ACTIVE_END:
3269
+ {
3270
+ const lastActorActivationIdx = bounds.activations.map((a) => a.actor).lastIndexOf(msg.from.actor);
3271
+ delete bounds.activations.splice(lastActorActivationIdx, 1)[0];
3272
+ }
3273
+ break;
3274
+ }
3275
+ const isNote = msg.placement !== void 0;
3276
+ if (isNote) {
3277
+ noteModel = await buildNoteModel(msg, actors, diagObj);
3278
+ msg.noteModel = noteModel;
3279
+ stack.forEach((stk) => {
3280
+ current = stk;
3281
+ current.from = common.getMin(current.from, noteModel.startx);
3282
+ current.to = common.getMax(current.to, noteModel.startx + noteModel.width);
3283
+ current.width = common.getMax(current.width, Math.abs(current.from - current.to)) - conf.labelBoxWidth;
3284
+ });
3285
+ } else {
3286
+ msgModel = buildMessageModel(msg, actors, diagObj);
3287
+ msg.msgModel = msgModel;
3288
+ if (msgModel.startx && msgModel.stopx && stack.length > 0) {
3289
+ stack.forEach((stk) => {
3290
+ current = stk;
3291
+ if (msgModel.startx === msgModel.stopx) {
3292
+ const from = actors[msg.from];
3293
+ const to = actors[msg.to];
3294
+ current.from = common.getMin(
3295
+ from.x - msgModel.width / 2,
3296
+ from.x - from.width / 2,
3297
+ current.from
3298
+ );
3299
+ current.to = common.getMax(
3300
+ to.x + msgModel.width / 2,
3301
+ to.x + from.width / 2,
3302
+ current.to
3303
+ );
3304
+ current.width = common.getMax(current.width, Math.abs(current.to - current.from)) - conf.labelBoxWidth;
3305
+ } else {
3306
+ current.from = common.getMin(msgModel.startx, current.from);
3307
+ current.to = common.getMax(msgModel.stopx, current.to);
3308
+ current.width = common.getMax(current.width, msgModel.width) - conf.labelBoxWidth;
3309
+ }
3310
+ });
3311
+ }
3312
+ }
3313
+ }
3314
+ bounds.activations = [];
3315
+ log.debug("Loop type widths:", loops);
3316
+ return loops;
3317
+ };
3318
+ const renderer = {
3319
+ bounds,
3320
+ drawActors,
3321
+ drawActorsPopup,
3322
+ setConf,
3323
+ draw
3324
+ };
3325
+ const diagram = {
3326
+ parser: parser$1,
3327
+ db,
3328
+ renderer,
3329
+ styles,
3330
+ init: ({ wrap }) => {
3331
+ db.setWrap(wrap);
3332
+ }
3333
+ };
3334
+ export {
3335
+ diagram
3336
+ };