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