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,1745 @@
1
+ import { l as log, s as setAccTitle, g as getAccTitle, q as setDiagramTitle, t as getDiagramTitle, a as getAccDescription, b as setAccDescription, E as getThemeVariables, F as getConfig, C as cleanAndMerge, B as defaultConfig, v as clear$1, d as sanitizeText, A as selectSvgElement, i as configureSvgSize } from "./mermaid-6dc72991.js";
2
+ import { c as computeDimensionOfText } from "./createText-ca0c5216.js";
3
+ import { scaleBand, scaleLinear, line } from "d3";
4
+ import "ts-dedent";
5
+ import "dayjs";
6
+ import "@braintree/sanitize-url";
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
+ import "mdast-util-from-markdown";
14
+ var parser = function() {
15
+ var o = function(k, v, o2, l) {
16
+ for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v)
17
+ ;
18
+ return o2;
19
+ }, $V0 = [1, 10, 12, 14, 16, 18, 19, 21, 23], $V1 = [2, 6], $V2 = [1, 3], $V3 = [1, 5], $V4 = [1, 6], $V5 = [1, 7], $V6 = [1, 5, 10, 12, 14, 16, 18, 19, 21, 23, 34, 35, 36], $V7 = [1, 25], $V8 = [1, 26], $V9 = [1, 28], $Va = [1, 29], $Vb = [1, 30], $Vc = [1, 31], $Vd = [1, 32], $Ve = [1, 33], $Vf = [1, 34], $Vg = [1, 35], $Vh = [1, 36], $Vi = [1, 37], $Vj = [1, 43], $Vk = [1, 42], $Vl = [1, 47], $Vm = [1, 50], $Vn = [1, 10, 12, 14, 16, 18, 19, 21, 23, 34, 35, 36], $Vo = [1, 10, 12, 14, 16, 18, 19, 21, 23, 24, 26, 27, 28, 34, 35, 36], $Vp = [1, 10, 12, 14, 16, 18, 19, 21, 23, 24, 26, 27, 28, 34, 35, 36, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50], $Vq = [1, 64];
20
+ var parser2 = {
21
+ trace: function trace() {
22
+ },
23
+ yy: {},
24
+ symbols_: { "error": 2, "start": 3, "eol": 4, "XYCHART": 5, "chartConfig": 6, "document": 7, "CHART_ORIENTATION": 8, "statement": 9, "title": 10, "text": 11, "X_AXIS": 12, "parseXAxis": 13, "Y_AXIS": 14, "parseYAxis": 15, "LINE": 16, "plotData": 17, "BAR": 18, "acc_title": 19, "acc_title_value": 20, "acc_descr": 21, "acc_descr_value": 22, "acc_descr_multiline_value": 23, "SQUARE_BRACES_START": 24, "commaSeparatedNumbers": 25, "SQUARE_BRACES_END": 26, "NUMBER_WITH_DECIMAL": 27, "COMMA": 28, "xAxisData": 29, "bandData": 30, "ARROW_DELIMITER": 31, "commaSeparatedTexts": 32, "yAxisData": 33, "NEWLINE": 34, "SEMI": 35, "EOF": 36, "alphaNum": 37, "STR": 38, "MD_STR": 39, "alphaNumToken": 40, "AMP": 41, "NUM": 42, "ALPHA": 43, "PLUS": 44, "EQUALS": 45, "MULT": 46, "DOT": 47, "BRKT": 48, "MINUS": 49, "UNDERSCORE": 50, "$accept": 0, "$end": 1 },
25
+ terminals_: { 2: "error", 5: "XYCHART", 8: "CHART_ORIENTATION", 10: "title", 12: "X_AXIS", 14: "Y_AXIS", 16: "LINE", 18: "BAR", 19: "acc_title", 20: "acc_title_value", 21: "acc_descr", 22: "acc_descr_value", 23: "acc_descr_multiline_value", 24: "SQUARE_BRACES_START", 26: "SQUARE_BRACES_END", 27: "NUMBER_WITH_DECIMAL", 28: "COMMA", 31: "ARROW_DELIMITER", 34: "NEWLINE", 35: "SEMI", 36: "EOF", 38: "STR", 39: "MD_STR", 41: "AMP", 42: "NUM", 43: "ALPHA", 44: "PLUS", 45: "EQUALS", 46: "MULT", 47: "DOT", 48: "BRKT", 49: "MINUS", 50: "UNDERSCORE" },
26
+ productions_: [0, [3, 2], [3, 3], [3, 2], [3, 1], [6, 1], [7, 0], [7, 2], [9, 2], [9, 2], [9, 2], [9, 2], [9, 2], [9, 3], [9, 2], [9, 3], [9, 2], [9, 2], [9, 1], [17, 3], [25, 3], [25, 1], [13, 1], [13, 2], [13, 1], [29, 1], [29, 3], [30, 3], [32, 3], [32, 1], [15, 1], [15, 2], [15, 1], [33, 3], [4, 1], [4, 1], [4, 1], [11, 1], [11, 1], [11, 1], [37, 1], [37, 2], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1]],
27
+ performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
28
+ var $0 = $$.length - 1;
29
+ switch (yystate) {
30
+ case 5:
31
+ yy.setOrientation($$[$0]);
32
+ break;
33
+ case 9:
34
+ yy.setDiagramTitle($$[$0].text.trim());
35
+ break;
36
+ case 12:
37
+ yy.setLineData({ text: "", type: "text" }, $$[$0]);
38
+ break;
39
+ case 13:
40
+ yy.setLineData($$[$0 - 1], $$[$0]);
41
+ break;
42
+ case 14:
43
+ yy.setBarData({ text: "", type: "text" }, $$[$0]);
44
+ break;
45
+ case 15:
46
+ yy.setBarData($$[$0 - 1], $$[$0]);
47
+ break;
48
+ case 16:
49
+ this.$ = $$[$0].trim();
50
+ yy.setAccTitle(this.$);
51
+ break;
52
+ case 17:
53
+ case 18:
54
+ this.$ = $$[$0].trim();
55
+ yy.setAccDescription(this.$);
56
+ break;
57
+ case 19:
58
+ this.$ = $$[$0 - 1];
59
+ break;
60
+ case 20:
61
+ this.$ = [Number($$[$0 - 2]), ...$$[$0]];
62
+ break;
63
+ case 21:
64
+ this.$ = [Number($$[$0])];
65
+ break;
66
+ case 22:
67
+ yy.setXAxisTitle($$[$0]);
68
+ break;
69
+ case 23:
70
+ yy.setXAxisTitle($$[$0 - 1]);
71
+ break;
72
+ case 24:
73
+ yy.setXAxisTitle({ type: "text", text: "" });
74
+ break;
75
+ case 25:
76
+ yy.setXAxisBand($$[$0]);
77
+ break;
78
+ case 26:
79
+ yy.setXAxisRangeData(Number($$[$0 - 2]), Number($$[$0]));
80
+ break;
81
+ case 27:
82
+ this.$ = $$[$0 - 1];
83
+ break;
84
+ case 28:
85
+ this.$ = [$$[$0 - 2], ...$$[$0]];
86
+ break;
87
+ case 29:
88
+ this.$ = [$$[$0]];
89
+ break;
90
+ case 30:
91
+ yy.setYAxisTitle($$[$0]);
92
+ break;
93
+ case 31:
94
+ yy.setYAxisTitle($$[$0 - 1]);
95
+ break;
96
+ case 32:
97
+ yy.setYAxisTitle({ type: "text", text: "" });
98
+ break;
99
+ case 33:
100
+ yy.setYAxisRangeData(Number($$[$0 - 2]), Number($$[$0]));
101
+ break;
102
+ case 37:
103
+ this.$ = { text: $$[$0], type: "text" };
104
+ break;
105
+ case 38:
106
+ this.$ = { text: $$[$0], type: "text" };
107
+ break;
108
+ case 39:
109
+ this.$ = { text: $$[$0], type: "markdown" };
110
+ break;
111
+ case 40:
112
+ this.$ = $$[$0];
113
+ break;
114
+ case 41:
115
+ this.$ = $$[$0 - 1] + "" + $$[$0];
116
+ break;
117
+ }
118
+ },
119
+ table: [o($V0, $V1, { 3: 1, 4: 2, 7: 4, 5: $V2, 34: $V3, 35: $V4, 36: $V5 }), { 1: [3] }, o($V0, $V1, { 4: 2, 7: 4, 3: 8, 5: $V2, 34: $V3, 35: $V4, 36: $V5 }), o($V0, $V1, { 4: 2, 7: 4, 6: 9, 3: 10, 5: $V2, 8: [1, 11], 34: $V3, 35: $V4, 36: $V5 }), { 1: [2, 4], 9: 12, 10: [1, 13], 12: [1, 14], 14: [1, 15], 16: [1, 16], 18: [1, 17], 19: [1, 18], 21: [1, 19], 23: [1, 20] }, o($V6, [2, 34]), o($V6, [2, 35]), o($V6, [2, 36]), { 1: [2, 1] }, o($V0, $V1, { 4: 2, 7: 4, 3: 21, 5: $V2, 34: $V3, 35: $V4, 36: $V5 }), { 1: [2, 3] }, o($V6, [2, 5]), o($V0, [2, 7], { 4: 22, 34: $V3, 35: $V4, 36: $V5 }), { 11: 23, 37: 24, 38: $V7, 39: $V8, 40: 27, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }, { 11: 39, 13: 38, 24: $Vj, 27: $Vk, 29: 40, 30: 41, 37: 24, 38: $V7, 39: $V8, 40: 27, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }, { 11: 45, 15: 44, 27: $Vl, 33: 46, 37: 24, 38: $V7, 39: $V8, 40: 27, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }, { 11: 49, 17: 48, 24: $Vm, 37: 24, 38: $V7, 39: $V8, 40: 27, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }, { 11: 52, 17: 51, 24: $Vm, 37: 24, 38: $V7, 39: $V8, 40: 27, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }, { 20: [1, 53] }, { 22: [1, 54] }, o($Vn, [2, 18]), { 1: [2, 2] }, o($Vn, [2, 8]), o($Vn, [2, 9]), o($Vo, [2, 37], { 40: 55, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }), o($Vo, [2, 38]), o($Vo, [2, 39]), o($Vp, [2, 40]), o($Vp, [2, 42]), o($Vp, [2, 43]), o($Vp, [2, 44]), o($Vp, [2, 45]), o($Vp, [2, 46]), o($Vp, [2, 47]), o($Vp, [2, 48]), o($Vp, [2, 49]), o($Vp, [2, 50]), o($Vp, [2, 51]), o($Vn, [2, 10]), o($Vn, [2, 22], { 30: 41, 29: 56, 24: $Vj, 27: $Vk }), o($Vn, [2, 24]), o($Vn, [2, 25]), { 31: [1, 57] }, { 11: 59, 32: 58, 37: 24, 38: $V7, 39: $V8, 40: 27, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }, o($Vn, [2, 11]), o($Vn, [2, 30], { 33: 60, 27: $Vl }), o($Vn, [2, 32]), { 31: [1, 61] }, o($Vn, [2, 12]), { 17: 62, 24: $Vm }, { 25: 63, 27: $Vq }, o($Vn, [2, 14]), { 17: 65, 24: $Vm }, o($Vn, [2, 16]), o($Vn, [2, 17]), o($Vp, [2, 41]), o($Vn, [2, 23]), { 27: [1, 66] }, { 26: [1, 67] }, { 26: [2, 29], 28: [1, 68] }, o($Vn, [2, 31]), { 27: [1, 69] }, o($Vn, [2, 13]), { 26: [1, 70] }, { 26: [2, 21], 28: [1, 71] }, o($Vn, [2, 15]), o($Vn, [2, 26]), o($Vn, [2, 27]), { 11: 59, 32: 72, 37: 24, 38: $V7, 39: $V8, 40: 27, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }, o($Vn, [2, 33]), o($Vn, [2, 19]), { 25: 73, 27: $Vq }, { 26: [2, 28] }, { 26: [2, 20] }],
120
+ defaultActions: { 8: [2, 1], 10: [2, 3], 21: [2, 2], 72: [2, 28], 73: [2, 20] },
121
+ parseError: function parseError(str, hash) {
122
+ if (hash.recoverable) {
123
+ this.trace(str);
124
+ } else {
125
+ var error = new Error(str);
126
+ error.hash = hash;
127
+ throw error;
128
+ }
129
+ },
130
+ parse: function parse(input) {
131
+ var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, TERROR = 2, EOF = 1;
132
+ var args = lstack.slice.call(arguments, 1);
133
+ var lexer2 = Object.create(this.lexer);
134
+ var sharedState = { yy: {} };
135
+ for (var k in this.yy) {
136
+ if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
137
+ sharedState.yy[k] = this.yy[k];
138
+ }
139
+ }
140
+ lexer2.setInput(input, sharedState.yy);
141
+ sharedState.yy.lexer = lexer2;
142
+ sharedState.yy.parser = this;
143
+ if (typeof lexer2.yylloc == "undefined") {
144
+ lexer2.yylloc = {};
145
+ }
146
+ var yyloc = lexer2.yylloc;
147
+ lstack.push(yyloc);
148
+ var ranges = lexer2.options && lexer2.options.ranges;
149
+ if (typeof sharedState.yy.parseError === "function") {
150
+ this.parseError = sharedState.yy.parseError;
151
+ } else {
152
+ this.parseError = Object.getPrototypeOf(this).parseError;
153
+ }
154
+ function lex() {
155
+ var token;
156
+ token = tstack.pop() || lexer2.lex() || EOF;
157
+ if (typeof token !== "number") {
158
+ if (token instanceof Array) {
159
+ tstack = token;
160
+ token = tstack.pop();
161
+ }
162
+ token = self.symbols_[token] || token;
163
+ }
164
+ return token;
165
+ }
166
+ var symbol, state, action, r, yyval = {}, p, len, newState, expected;
167
+ while (true) {
168
+ state = stack[stack.length - 1];
169
+ if (this.defaultActions[state]) {
170
+ action = this.defaultActions[state];
171
+ } else {
172
+ if (symbol === null || typeof symbol == "undefined") {
173
+ symbol = lex();
174
+ }
175
+ action = table[state] && table[state][symbol];
176
+ }
177
+ if (typeof action === "undefined" || !action.length || !action[0]) {
178
+ var errStr = "";
179
+ expected = [];
180
+ for (p in table[state]) {
181
+ if (this.terminals_[p] && p > TERROR) {
182
+ expected.push("'" + this.terminals_[p] + "'");
183
+ }
184
+ }
185
+ if (lexer2.showPosition) {
186
+ errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
187
+ } else {
188
+ errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
189
+ }
190
+ this.parseError(errStr, {
191
+ text: lexer2.match,
192
+ token: this.terminals_[symbol] || symbol,
193
+ line: lexer2.yylineno,
194
+ loc: yyloc,
195
+ expected
196
+ });
197
+ }
198
+ if (action[0] instanceof Array && action.length > 1) {
199
+ throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
200
+ }
201
+ switch (action[0]) {
202
+ case 1:
203
+ stack.push(symbol);
204
+ vstack.push(lexer2.yytext);
205
+ lstack.push(lexer2.yylloc);
206
+ stack.push(action[1]);
207
+ symbol = null;
208
+ {
209
+ yyleng = lexer2.yyleng;
210
+ yytext = lexer2.yytext;
211
+ yylineno = lexer2.yylineno;
212
+ yyloc = lexer2.yylloc;
213
+ }
214
+ break;
215
+ case 2:
216
+ len = this.productions_[action[1]][1];
217
+ yyval.$ = vstack[vstack.length - len];
218
+ yyval._$ = {
219
+ first_line: lstack[lstack.length - (len || 1)].first_line,
220
+ last_line: lstack[lstack.length - 1].last_line,
221
+ first_column: lstack[lstack.length - (len || 1)].first_column,
222
+ last_column: lstack[lstack.length - 1].last_column
223
+ };
224
+ if (ranges) {
225
+ yyval._$.range = [
226
+ lstack[lstack.length - (len || 1)].range[0],
227
+ lstack[lstack.length - 1].range[1]
228
+ ];
229
+ }
230
+ r = this.performAction.apply(yyval, [
231
+ yytext,
232
+ yyleng,
233
+ yylineno,
234
+ sharedState.yy,
235
+ action[1],
236
+ vstack,
237
+ lstack
238
+ ].concat(args));
239
+ if (typeof r !== "undefined") {
240
+ return r;
241
+ }
242
+ if (len) {
243
+ stack = stack.slice(0, -1 * len * 2);
244
+ vstack = vstack.slice(0, -1 * len);
245
+ lstack = lstack.slice(0, -1 * len);
246
+ }
247
+ stack.push(this.productions_[action[1]][0]);
248
+ vstack.push(yyval.$);
249
+ lstack.push(yyval._$);
250
+ newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
251
+ stack.push(newState);
252
+ break;
253
+ case 3:
254
+ return true;
255
+ }
256
+ }
257
+ return true;
258
+ }
259
+ };
260
+ var lexer = function() {
261
+ var lexer2 = {
262
+ EOF: 1,
263
+ parseError: function parseError(str, hash) {
264
+ if (this.yy.parser) {
265
+ this.yy.parser.parseError(str, hash);
266
+ } else {
267
+ throw new Error(str);
268
+ }
269
+ },
270
+ // resets the lexer, sets new input
271
+ setInput: function(input, yy) {
272
+ this.yy = yy || this.yy || {};
273
+ this._input = input;
274
+ this._more = this._backtrack = this.done = false;
275
+ this.yylineno = this.yyleng = 0;
276
+ this.yytext = this.matched = this.match = "";
277
+ this.conditionStack = ["INITIAL"];
278
+ this.yylloc = {
279
+ first_line: 1,
280
+ first_column: 0,
281
+ last_line: 1,
282
+ last_column: 0
283
+ };
284
+ if (this.options.ranges) {
285
+ this.yylloc.range = [0, 0];
286
+ }
287
+ this.offset = 0;
288
+ return this;
289
+ },
290
+ // consumes and returns one char from the input
291
+ input: function() {
292
+ var ch = this._input[0];
293
+ this.yytext += ch;
294
+ this.yyleng++;
295
+ this.offset++;
296
+ this.match += ch;
297
+ this.matched += ch;
298
+ var lines = ch.match(/(?:\r\n?|\n).*/g);
299
+ if (lines) {
300
+ this.yylineno++;
301
+ this.yylloc.last_line++;
302
+ } else {
303
+ this.yylloc.last_column++;
304
+ }
305
+ if (this.options.ranges) {
306
+ this.yylloc.range[1]++;
307
+ }
308
+ this._input = this._input.slice(1);
309
+ return ch;
310
+ },
311
+ // unshifts one char (or a string) into the input
312
+ unput: function(ch) {
313
+ var len = ch.length;
314
+ var lines = ch.split(/(?:\r\n?|\n)/g);
315
+ this._input = ch + this._input;
316
+ this.yytext = this.yytext.substr(0, this.yytext.length - len);
317
+ this.offset -= len;
318
+ var oldLines = this.match.split(/(?:\r\n?|\n)/g);
319
+ this.match = this.match.substr(0, this.match.length - 1);
320
+ this.matched = this.matched.substr(0, this.matched.length - 1);
321
+ if (lines.length - 1) {
322
+ this.yylineno -= lines.length - 1;
323
+ }
324
+ var r = this.yylloc.range;
325
+ this.yylloc = {
326
+ first_line: this.yylloc.first_line,
327
+ last_line: this.yylineno + 1,
328
+ first_column: this.yylloc.first_column,
329
+ 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
330
+ };
331
+ if (this.options.ranges) {
332
+ this.yylloc.range = [r[0], r[0] + this.yyleng - len];
333
+ }
334
+ this.yyleng = this.yytext.length;
335
+ return this;
336
+ },
337
+ // When called from action, caches matched text and appends it on next action
338
+ more: function() {
339
+ this._more = true;
340
+ return this;
341
+ },
342
+ // 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.
343
+ reject: function() {
344
+ if (this.options.backtrack_lexer) {
345
+ this._backtrack = true;
346
+ } else {
347
+ 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(), {
348
+ text: "",
349
+ token: null,
350
+ line: this.yylineno
351
+ });
352
+ }
353
+ return this;
354
+ },
355
+ // retain first n characters of the match
356
+ less: function(n) {
357
+ this.unput(this.match.slice(n));
358
+ },
359
+ // displays already matched input, i.e. for error messages
360
+ pastInput: function() {
361
+ var past = this.matched.substr(0, this.matched.length - this.match.length);
362
+ return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
363
+ },
364
+ // displays upcoming input, i.e. for error messages
365
+ upcomingInput: function() {
366
+ var next = this.match;
367
+ if (next.length < 20) {
368
+ next += this._input.substr(0, 20 - next.length);
369
+ }
370
+ return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
371
+ },
372
+ // displays the character position where the lexing error occurred, i.e. for error messages
373
+ showPosition: function() {
374
+ var pre = this.pastInput();
375
+ var c = new Array(pre.length + 1).join("-");
376
+ return pre + this.upcomingInput() + "\n" + c + "^";
377
+ },
378
+ // test the lexed token: return FALSE when not a match, otherwise return token
379
+ test_match: function(match, indexed_rule) {
380
+ var token, lines, backup;
381
+ if (this.options.backtrack_lexer) {
382
+ backup = {
383
+ yylineno: this.yylineno,
384
+ yylloc: {
385
+ first_line: this.yylloc.first_line,
386
+ last_line: this.last_line,
387
+ first_column: this.yylloc.first_column,
388
+ last_column: this.yylloc.last_column
389
+ },
390
+ yytext: this.yytext,
391
+ match: this.match,
392
+ matches: this.matches,
393
+ matched: this.matched,
394
+ yyleng: this.yyleng,
395
+ offset: this.offset,
396
+ _more: this._more,
397
+ _input: this._input,
398
+ yy: this.yy,
399
+ conditionStack: this.conditionStack.slice(0),
400
+ done: this.done
401
+ };
402
+ if (this.options.ranges) {
403
+ backup.yylloc.range = this.yylloc.range.slice(0);
404
+ }
405
+ }
406
+ lines = match[0].match(/(?:\r\n?|\n).*/g);
407
+ if (lines) {
408
+ this.yylineno += lines.length;
409
+ }
410
+ this.yylloc = {
411
+ first_line: this.yylloc.last_line,
412
+ last_line: this.yylineno + 1,
413
+ first_column: this.yylloc.last_column,
414
+ last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length
415
+ };
416
+ this.yytext += match[0];
417
+ this.match += match[0];
418
+ this.matches = match;
419
+ this.yyleng = this.yytext.length;
420
+ if (this.options.ranges) {
421
+ this.yylloc.range = [this.offset, this.offset += this.yyleng];
422
+ }
423
+ this._more = false;
424
+ this._backtrack = false;
425
+ this._input = this._input.slice(match[0].length);
426
+ this.matched += match[0];
427
+ token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
428
+ if (this.done && this._input) {
429
+ this.done = false;
430
+ }
431
+ if (token) {
432
+ return token;
433
+ } else if (this._backtrack) {
434
+ for (var k in backup) {
435
+ this[k] = backup[k];
436
+ }
437
+ return false;
438
+ }
439
+ return false;
440
+ },
441
+ // return next match in input
442
+ next: function() {
443
+ if (this.done) {
444
+ return this.EOF;
445
+ }
446
+ if (!this._input) {
447
+ this.done = true;
448
+ }
449
+ var token, match, tempMatch, index;
450
+ if (!this._more) {
451
+ this.yytext = "";
452
+ this.match = "";
453
+ }
454
+ var rules = this._currentRules();
455
+ for (var i = 0; i < rules.length; i++) {
456
+ tempMatch = this._input.match(this.rules[rules[i]]);
457
+ if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
458
+ match = tempMatch;
459
+ index = i;
460
+ if (this.options.backtrack_lexer) {
461
+ token = this.test_match(tempMatch, rules[i]);
462
+ if (token !== false) {
463
+ return token;
464
+ } else if (this._backtrack) {
465
+ match = false;
466
+ continue;
467
+ } else {
468
+ return false;
469
+ }
470
+ } else if (!this.options.flex) {
471
+ break;
472
+ }
473
+ }
474
+ }
475
+ if (match) {
476
+ token = this.test_match(match, rules[index]);
477
+ if (token !== false) {
478
+ return token;
479
+ }
480
+ return false;
481
+ }
482
+ if (this._input === "") {
483
+ return this.EOF;
484
+ } else {
485
+ return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
486
+ text: "",
487
+ token: null,
488
+ line: this.yylineno
489
+ });
490
+ }
491
+ },
492
+ // return next match that has a token
493
+ lex: function lex() {
494
+ var r = this.next();
495
+ if (r) {
496
+ return r;
497
+ } else {
498
+ return this.lex();
499
+ }
500
+ },
501
+ // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
502
+ begin: function begin(condition) {
503
+ this.conditionStack.push(condition);
504
+ },
505
+ // pop the previously active lexer condition state off the condition stack
506
+ popState: function popState() {
507
+ var n = this.conditionStack.length - 1;
508
+ if (n > 0) {
509
+ return this.conditionStack.pop();
510
+ } else {
511
+ return this.conditionStack[0];
512
+ }
513
+ },
514
+ // produce the lexer rule set which is active for the currently active lexer condition state
515
+ _currentRules: function _currentRules() {
516
+ if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
517
+ return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
518
+ } else {
519
+ return this.conditions["INITIAL"].rules;
520
+ }
521
+ },
522
+ // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
523
+ topState: function topState(n) {
524
+ n = this.conditionStack.length - 1 - Math.abs(n || 0);
525
+ if (n >= 0) {
526
+ return this.conditionStack[n];
527
+ } else {
528
+ return "INITIAL";
529
+ }
530
+ },
531
+ // alias for begin(condition)
532
+ pushState: function pushState(condition) {
533
+ this.begin(condition);
534
+ },
535
+ // return the number of states currently on the stack
536
+ stateStackSize: function stateStackSize() {
537
+ return this.conditionStack.length;
538
+ },
539
+ options: { "case-insensitive": true },
540
+ performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
541
+ switch ($avoiding_name_collisions) {
542
+ case 0:
543
+ break;
544
+ case 1:
545
+ break;
546
+ case 2:
547
+ this.popState();
548
+ return 34;
549
+ case 3:
550
+ this.popState();
551
+ return 34;
552
+ case 4:
553
+ return 34;
554
+ case 5:
555
+ break;
556
+ case 6:
557
+ return 10;
558
+ case 7:
559
+ this.pushState("acc_title");
560
+ return 19;
561
+ case 8:
562
+ this.popState();
563
+ return "acc_title_value";
564
+ case 9:
565
+ this.pushState("acc_descr");
566
+ return 21;
567
+ case 10:
568
+ this.popState();
569
+ return "acc_descr_value";
570
+ case 11:
571
+ this.pushState("acc_descr_multiline");
572
+ break;
573
+ case 12:
574
+ this.popState();
575
+ break;
576
+ case 13:
577
+ return "acc_descr_multiline_value";
578
+ case 14:
579
+ return 5;
580
+ case 15:
581
+ return 8;
582
+ case 16:
583
+ this.pushState("axis_data");
584
+ return "X_AXIS";
585
+ case 17:
586
+ this.pushState("axis_data");
587
+ return "Y_AXIS";
588
+ case 18:
589
+ this.pushState("axis_band_data");
590
+ return 24;
591
+ case 19:
592
+ return 31;
593
+ case 20:
594
+ this.pushState("data");
595
+ return 16;
596
+ case 21:
597
+ this.pushState("data");
598
+ return 18;
599
+ case 22:
600
+ this.pushState("data_inner");
601
+ return 24;
602
+ case 23:
603
+ return 27;
604
+ case 24:
605
+ this.popState();
606
+ return 26;
607
+ case 25:
608
+ this.popState();
609
+ break;
610
+ case 26:
611
+ this.pushState("string");
612
+ break;
613
+ case 27:
614
+ this.popState();
615
+ break;
616
+ case 28:
617
+ return "STR";
618
+ case 29:
619
+ return 24;
620
+ case 30:
621
+ return 26;
622
+ case 31:
623
+ return 43;
624
+ case 32:
625
+ return "COLON";
626
+ case 33:
627
+ return 44;
628
+ case 34:
629
+ return 28;
630
+ case 35:
631
+ return 45;
632
+ case 36:
633
+ return 46;
634
+ case 37:
635
+ return 48;
636
+ case 38:
637
+ return 50;
638
+ case 39:
639
+ return 47;
640
+ case 40:
641
+ return 41;
642
+ case 41:
643
+ return 49;
644
+ case 42:
645
+ return 42;
646
+ case 43:
647
+ break;
648
+ case 44:
649
+ return 35;
650
+ case 45:
651
+ return 36;
652
+ }
653
+ },
654
+ rules: [/^(?:%%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:(\r?\n))/i, /^(?:(\r?\n))/i, /^(?:[\n\r]+)/i, /^(?:%%[^\n]*)/i, /^(?:title\b)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:\{)/i, /^(?:[^\}]*)/i, /^(?:xychart-beta\b)/i, /^(?:(?:vertical|horizontal))/i, /^(?:x-axis\b)/i, /^(?:y-axis\b)/i, /^(?:\[)/i, /^(?:-->)/i, /^(?:line\b)/i, /^(?:bar\b)/i, /^(?:\[)/i, /^(?:[+-]?(?:\d+(?:\.\d+)?|\.\d+))/i, /^(?:\])/i, /^(?:(?:`\) \{ this\.pushState\(md_string\); \}\n<md_string>\(\?:\(\?!`"\)\.\)\+ \{ return MD_STR; \}\n<md_string>\(\?:`))/i, /^(?:["])/i, /^(?:["])/i, /^(?:[^"]*)/i, /^(?:\[)/i, /^(?:\])/i, /^(?:[A-Za-z]+)/i, /^(?::)/i, /^(?:\+)/i, /^(?:,)/i, /^(?:=)/i, /^(?:\*)/i, /^(?:#)/i, /^(?:[\_])/i, /^(?:\.)/i, /^(?:&)/i, /^(?:-)/i, /^(?:[0-9]+)/i, /^(?:\s+)/i, /^(?:;)/i, /^(?:$)/i],
655
+ conditions: { "data_inner": { "rules": [0, 1, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 20, 21, 23, 24, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45], "inclusive": true }, "data": { "rules": [0, 1, 3, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 20, 21, 22, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45], "inclusive": true }, "axis_band_data": { "rules": [0, 1, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 20, 21, 24, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45], "inclusive": true }, "axis_data": { "rules": [0, 1, 2, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 18, 19, 20, 21, 23, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45], "inclusive": true }, "acc_descr_multiline": { "rules": [12, 13], "inclusive": false }, "acc_descr": { "rules": [10], "inclusive": false }, "acc_title": { "rules": [8], "inclusive": false }, "title": { "rules": [], "inclusive": false }, "md_string": { "rules": [], "inclusive": false }, "string": { "rules": [27, 28], "inclusive": false }, "INITIAL": { "rules": [0, 1, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 20, 21, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45], "inclusive": true } }
656
+ };
657
+ return lexer2;
658
+ }();
659
+ parser2.lexer = lexer;
660
+ function Parser() {
661
+ this.yy = {};
662
+ }
663
+ Parser.prototype = parser2;
664
+ parser2.Parser = Parser;
665
+ return new Parser();
666
+ }();
667
+ parser.parser = parser;
668
+ const parser$1 = parser;
669
+ function isBarPlot(data) {
670
+ return data.type === "bar";
671
+ }
672
+ function isBandAxisData(data) {
673
+ return data.type === "band";
674
+ }
675
+ function isLinearAxisData(data) {
676
+ return data.type === "linear";
677
+ }
678
+ class TextDimensionCalculatorWithFont {
679
+ constructor(parentGroup) {
680
+ this.parentGroup = parentGroup;
681
+ }
682
+ getMaxDimension(texts, fontSize) {
683
+ if (!this.parentGroup) {
684
+ return {
685
+ width: texts.reduce((acc, cur) => Math.max(cur.length, acc), 0) * fontSize,
686
+ height: fontSize
687
+ };
688
+ }
689
+ const dimension = {
690
+ width: 0,
691
+ height: 0
692
+ };
693
+ const elem = this.parentGroup.append("g").attr("visibility", "hidden").attr("font-size", fontSize);
694
+ for (const t of texts) {
695
+ const bbox = computeDimensionOfText(elem, 1, t);
696
+ const width = bbox ? bbox.width : t.length * fontSize;
697
+ const height = bbox ? bbox.height : fontSize;
698
+ dimension.width = Math.max(dimension.width, width);
699
+ dimension.height = Math.max(dimension.height, height);
700
+ }
701
+ elem.remove();
702
+ return dimension;
703
+ }
704
+ }
705
+ const BAR_WIDTH_TO_TICK_WIDTH_RATIO = 0.7;
706
+ const MAX_OUTER_PADDING_PERCENT_FOR_WRT_LABEL = 0.2;
707
+ class BaseAxis {
708
+ constructor(axisConfig, title, textDimensionCalculator, axisThemeConfig) {
709
+ this.axisConfig = axisConfig;
710
+ this.title = title;
711
+ this.textDimensionCalculator = textDimensionCalculator;
712
+ this.axisThemeConfig = axisThemeConfig;
713
+ this.boundingRect = { x: 0, y: 0, width: 0, height: 0 };
714
+ this.axisPosition = "left";
715
+ this.showTitle = false;
716
+ this.showLabel = false;
717
+ this.showTick = false;
718
+ this.showAxisLine = false;
719
+ this.outerPadding = 0;
720
+ this.titleTextHeight = 0;
721
+ this.labelTextHeight = 0;
722
+ this.range = [0, 10];
723
+ this.boundingRect = { x: 0, y: 0, width: 0, height: 0 };
724
+ this.axisPosition = "left";
725
+ }
726
+ setRange(range) {
727
+ this.range = range;
728
+ if (this.axisPosition === "left" || this.axisPosition === "right") {
729
+ this.boundingRect.height = range[1] - range[0];
730
+ } else {
731
+ this.boundingRect.width = range[1] - range[0];
732
+ }
733
+ this.recalculateScale();
734
+ }
735
+ getRange() {
736
+ return [this.range[0] + this.outerPadding, this.range[1] - this.outerPadding];
737
+ }
738
+ setAxisPosition(axisPosition) {
739
+ this.axisPosition = axisPosition;
740
+ this.setRange(this.range);
741
+ }
742
+ getTickDistance() {
743
+ const range = this.getRange();
744
+ return Math.abs(range[0] - range[1]) / this.getTickValues().length;
745
+ }
746
+ getAxisOuterPadding() {
747
+ return this.outerPadding;
748
+ }
749
+ getLabelDimension() {
750
+ return this.textDimensionCalculator.getMaxDimension(
751
+ this.getTickValues().map((tick) => tick.toString()),
752
+ this.axisConfig.labelFontSize
753
+ );
754
+ }
755
+ recalculateOuterPaddingToDrawBar() {
756
+ if (BAR_WIDTH_TO_TICK_WIDTH_RATIO * this.getTickDistance() > this.outerPadding * 2) {
757
+ this.outerPadding = Math.floor(BAR_WIDTH_TO_TICK_WIDTH_RATIO * this.getTickDistance() / 2);
758
+ }
759
+ this.recalculateScale();
760
+ }
761
+ calculateSpaceIfDrawnHorizontally(availableSpace) {
762
+ let availableHeight = availableSpace.height;
763
+ if (this.axisConfig.showAxisLine && availableHeight > this.axisConfig.axisLineWidth) {
764
+ availableHeight -= this.axisConfig.axisLineWidth;
765
+ this.showAxisLine = true;
766
+ }
767
+ if (this.axisConfig.showLabel) {
768
+ const spaceRequired = this.getLabelDimension();
769
+ const maxPadding = MAX_OUTER_PADDING_PERCENT_FOR_WRT_LABEL * availableSpace.width;
770
+ this.outerPadding = Math.min(spaceRequired.width / 2, maxPadding);
771
+ const heightRequired = spaceRequired.height + this.axisConfig.labelPadding * 2;
772
+ this.labelTextHeight = spaceRequired.height;
773
+ if (heightRequired <= availableHeight) {
774
+ availableHeight -= heightRequired;
775
+ this.showLabel = true;
776
+ }
777
+ }
778
+ if (this.axisConfig.showTick && availableHeight >= this.axisConfig.tickLength) {
779
+ this.showTick = true;
780
+ availableHeight -= this.axisConfig.tickLength;
781
+ }
782
+ if (this.axisConfig.showTitle && this.title) {
783
+ const spaceRequired = this.textDimensionCalculator.getMaxDimension(
784
+ [this.title],
785
+ this.axisConfig.titleFontSize
786
+ );
787
+ const heightRequired = spaceRequired.height + this.axisConfig.titlePadding * 2;
788
+ this.titleTextHeight = spaceRequired.height;
789
+ if (heightRequired <= availableHeight) {
790
+ availableHeight -= heightRequired;
791
+ this.showTitle = true;
792
+ }
793
+ }
794
+ this.boundingRect.width = availableSpace.width;
795
+ this.boundingRect.height = availableSpace.height - availableHeight;
796
+ }
797
+ calculateSpaceIfDrawnVertical(availableSpace) {
798
+ let availableWidth = availableSpace.width;
799
+ if (this.axisConfig.showAxisLine && availableWidth > this.axisConfig.axisLineWidth) {
800
+ availableWidth -= this.axisConfig.axisLineWidth;
801
+ this.showAxisLine = true;
802
+ }
803
+ if (this.axisConfig.showLabel) {
804
+ const spaceRequired = this.getLabelDimension();
805
+ const maxPadding = MAX_OUTER_PADDING_PERCENT_FOR_WRT_LABEL * availableSpace.height;
806
+ this.outerPadding = Math.min(spaceRequired.height / 2, maxPadding);
807
+ const widthRequired = spaceRequired.width + this.axisConfig.labelPadding * 2;
808
+ if (widthRequired <= availableWidth) {
809
+ availableWidth -= widthRequired;
810
+ this.showLabel = true;
811
+ }
812
+ }
813
+ if (this.axisConfig.showTick && availableWidth >= this.axisConfig.tickLength) {
814
+ this.showTick = true;
815
+ availableWidth -= this.axisConfig.tickLength;
816
+ }
817
+ if (this.axisConfig.showTitle && this.title) {
818
+ const spaceRequired = this.textDimensionCalculator.getMaxDimension(
819
+ [this.title],
820
+ this.axisConfig.titleFontSize
821
+ );
822
+ const widthRequired = spaceRequired.height + this.axisConfig.titlePadding * 2;
823
+ this.titleTextHeight = spaceRequired.height;
824
+ if (widthRequired <= availableWidth) {
825
+ availableWidth -= widthRequired;
826
+ this.showTitle = true;
827
+ }
828
+ }
829
+ this.boundingRect.width = availableSpace.width - availableWidth;
830
+ this.boundingRect.height = availableSpace.height;
831
+ }
832
+ calculateSpace(availableSpace) {
833
+ if (this.axisPosition === "left" || this.axisPosition === "right") {
834
+ this.calculateSpaceIfDrawnVertical(availableSpace);
835
+ } else {
836
+ this.calculateSpaceIfDrawnHorizontally(availableSpace);
837
+ }
838
+ this.recalculateScale();
839
+ return {
840
+ width: this.boundingRect.width,
841
+ height: this.boundingRect.height
842
+ };
843
+ }
844
+ setBoundingBoxXY(point) {
845
+ this.boundingRect.x = point.x;
846
+ this.boundingRect.y = point.y;
847
+ }
848
+ getDrawableElementsForLeftAxis() {
849
+ const drawableElement = [];
850
+ if (this.showAxisLine) {
851
+ const x = this.boundingRect.x + this.boundingRect.width - this.axisConfig.axisLineWidth / 2;
852
+ drawableElement.push({
853
+ type: "path",
854
+ groupTexts: ["left-axis", "axisl-line"],
855
+ data: [
856
+ {
857
+ path: `M ${x},${this.boundingRect.y} L ${x},${this.boundingRect.y + this.boundingRect.height} `,
858
+ strokeFill: this.axisThemeConfig.axisLineColor,
859
+ strokeWidth: this.axisConfig.axisLineWidth
860
+ }
861
+ ]
862
+ });
863
+ }
864
+ if (this.showLabel) {
865
+ drawableElement.push({
866
+ type: "text",
867
+ groupTexts: ["left-axis", "label"],
868
+ data: this.getTickValues().map((tick) => ({
869
+ text: tick.toString(),
870
+ x: this.boundingRect.x + this.boundingRect.width - (this.showLabel ? this.axisConfig.labelPadding : 0) - (this.showTick ? this.axisConfig.tickLength : 0) - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0),
871
+ y: this.getScaleValue(tick),
872
+ fill: this.axisThemeConfig.labelColor,
873
+ fontSize: this.axisConfig.labelFontSize,
874
+ rotation: 0,
875
+ verticalPos: "middle",
876
+ horizontalPos: "right"
877
+ }))
878
+ });
879
+ }
880
+ if (this.showTick) {
881
+ const x = this.boundingRect.x + this.boundingRect.width - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0);
882
+ drawableElement.push({
883
+ type: "path",
884
+ groupTexts: ["left-axis", "ticks"],
885
+ data: this.getTickValues().map((tick) => ({
886
+ path: `M ${x},${this.getScaleValue(tick)} L ${x - this.axisConfig.tickLength},${this.getScaleValue(tick)}`,
887
+ strokeFill: this.axisThemeConfig.tickColor,
888
+ strokeWidth: this.axisConfig.tickWidth
889
+ }))
890
+ });
891
+ }
892
+ if (this.showTitle) {
893
+ drawableElement.push({
894
+ type: "text",
895
+ groupTexts: ["left-axis", "title"],
896
+ data: [
897
+ {
898
+ text: this.title,
899
+ x: this.boundingRect.x + this.axisConfig.titlePadding,
900
+ y: this.boundingRect.y + this.boundingRect.height / 2,
901
+ fill: this.axisThemeConfig.titleColor,
902
+ fontSize: this.axisConfig.titleFontSize,
903
+ rotation: 270,
904
+ verticalPos: "top",
905
+ horizontalPos: "center"
906
+ }
907
+ ]
908
+ });
909
+ }
910
+ return drawableElement;
911
+ }
912
+ getDrawableElementsForBottomAxis() {
913
+ const drawableElement = [];
914
+ if (this.showAxisLine) {
915
+ const y = this.boundingRect.y + this.axisConfig.axisLineWidth / 2;
916
+ drawableElement.push({
917
+ type: "path",
918
+ groupTexts: ["bottom-axis", "axis-line"],
919
+ data: [
920
+ {
921
+ path: `M ${this.boundingRect.x},${y} L ${this.boundingRect.x + this.boundingRect.width},${y}`,
922
+ strokeFill: this.axisThemeConfig.axisLineColor,
923
+ strokeWidth: this.axisConfig.axisLineWidth
924
+ }
925
+ ]
926
+ });
927
+ }
928
+ if (this.showLabel) {
929
+ drawableElement.push({
930
+ type: "text",
931
+ groupTexts: ["bottom-axis", "label"],
932
+ data: this.getTickValues().map((tick) => ({
933
+ text: tick.toString(),
934
+ x: this.getScaleValue(tick),
935
+ y: this.boundingRect.y + this.axisConfig.labelPadding + (this.showTick ? this.axisConfig.tickLength : 0) + (this.showAxisLine ? this.axisConfig.axisLineWidth : 0),
936
+ fill: this.axisThemeConfig.labelColor,
937
+ fontSize: this.axisConfig.labelFontSize,
938
+ rotation: 0,
939
+ verticalPos: "top",
940
+ horizontalPos: "center"
941
+ }))
942
+ });
943
+ }
944
+ if (this.showTick) {
945
+ const y = this.boundingRect.y + (this.showAxisLine ? this.axisConfig.axisLineWidth : 0);
946
+ drawableElement.push({
947
+ type: "path",
948
+ groupTexts: ["bottom-axis", "ticks"],
949
+ data: this.getTickValues().map((tick) => ({
950
+ path: `M ${this.getScaleValue(tick)},${y} L ${this.getScaleValue(tick)},${y + this.axisConfig.tickLength}`,
951
+ strokeFill: this.axisThemeConfig.tickColor,
952
+ strokeWidth: this.axisConfig.tickWidth
953
+ }))
954
+ });
955
+ }
956
+ if (this.showTitle) {
957
+ drawableElement.push({
958
+ type: "text",
959
+ groupTexts: ["bottom-axis", "title"],
960
+ data: [
961
+ {
962
+ text: this.title,
963
+ x: this.range[0] + (this.range[1] - this.range[0]) / 2,
964
+ y: this.boundingRect.y + this.boundingRect.height - this.axisConfig.titlePadding - this.titleTextHeight,
965
+ fill: this.axisThemeConfig.titleColor,
966
+ fontSize: this.axisConfig.titleFontSize,
967
+ rotation: 0,
968
+ verticalPos: "top",
969
+ horizontalPos: "center"
970
+ }
971
+ ]
972
+ });
973
+ }
974
+ return drawableElement;
975
+ }
976
+ getDrawableElementsForTopAxis() {
977
+ const drawableElement = [];
978
+ if (this.showAxisLine) {
979
+ const y = this.boundingRect.y + this.boundingRect.height - this.axisConfig.axisLineWidth / 2;
980
+ drawableElement.push({
981
+ type: "path",
982
+ groupTexts: ["top-axis", "axis-line"],
983
+ data: [
984
+ {
985
+ path: `M ${this.boundingRect.x},${y} L ${this.boundingRect.x + this.boundingRect.width},${y}`,
986
+ strokeFill: this.axisThemeConfig.axisLineColor,
987
+ strokeWidth: this.axisConfig.axisLineWidth
988
+ }
989
+ ]
990
+ });
991
+ }
992
+ if (this.showLabel) {
993
+ drawableElement.push({
994
+ type: "text",
995
+ groupTexts: ["top-axis", "label"],
996
+ data: this.getTickValues().map((tick) => ({
997
+ text: tick.toString(),
998
+ x: this.getScaleValue(tick),
999
+ y: this.boundingRect.y + (this.showTitle ? this.titleTextHeight + this.axisConfig.titlePadding * 2 : 0) + this.axisConfig.labelPadding,
1000
+ fill: this.axisThemeConfig.labelColor,
1001
+ fontSize: this.axisConfig.labelFontSize,
1002
+ rotation: 0,
1003
+ verticalPos: "top",
1004
+ horizontalPos: "center"
1005
+ }))
1006
+ });
1007
+ }
1008
+ if (this.showTick) {
1009
+ const y = this.boundingRect.y;
1010
+ drawableElement.push({
1011
+ type: "path",
1012
+ groupTexts: ["top-axis", "ticks"],
1013
+ data: this.getTickValues().map((tick) => ({
1014
+ path: `M ${this.getScaleValue(tick)},${y + this.boundingRect.height - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0)} L ${this.getScaleValue(tick)},${y + this.boundingRect.height - this.axisConfig.tickLength - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0)}`,
1015
+ strokeFill: this.axisThemeConfig.tickColor,
1016
+ strokeWidth: this.axisConfig.tickWidth
1017
+ }))
1018
+ });
1019
+ }
1020
+ if (this.showTitle) {
1021
+ drawableElement.push({
1022
+ type: "text",
1023
+ groupTexts: ["top-axis", "title"],
1024
+ data: [
1025
+ {
1026
+ text: this.title,
1027
+ x: this.boundingRect.x + this.boundingRect.width / 2,
1028
+ y: this.boundingRect.y + this.axisConfig.titlePadding,
1029
+ fill: this.axisThemeConfig.titleColor,
1030
+ fontSize: this.axisConfig.titleFontSize,
1031
+ rotation: 0,
1032
+ verticalPos: "top",
1033
+ horizontalPos: "center"
1034
+ }
1035
+ ]
1036
+ });
1037
+ }
1038
+ return drawableElement;
1039
+ }
1040
+ getDrawableElements() {
1041
+ if (this.axisPosition === "left") {
1042
+ return this.getDrawableElementsForLeftAxis();
1043
+ }
1044
+ if (this.axisPosition === "right") {
1045
+ throw Error("Drawing of right axis is not implemented");
1046
+ }
1047
+ if (this.axisPosition === "bottom") {
1048
+ return this.getDrawableElementsForBottomAxis();
1049
+ }
1050
+ if (this.axisPosition === "top") {
1051
+ return this.getDrawableElementsForTopAxis();
1052
+ }
1053
+ return [];
1054
+ }
1055
+ }
1056
+ class BandAxis extends BaseAxis {
1057
+ constructor(axisConfig, axisThemeConfig, categories, title, textDimensionCalculator) {
1058
+ super(axisConfig, title, textDimensionCalculator, axisThemeConfig);
1059
+ this.categories = categories;
1060
+ this.scale = scaleBand().domain(this.categories).range(this.getRange());
1061
+ }
1062
+ setRange(range) {
1063
+ super.setRange(range);
1064
+ }
1065
+ recalculateScale() {
1066
+ this.scale = scaleBand().domain(this.categories).range(this.getRange()).paddingInner(1).paddingOuter(0).align(0.5);
1067
+ log.trace("BandAxis axis final categories, range: ", this.categories, this.getRange());
1068
+ }
1069
+ getTickValues() {
1070
+ return this.categories;
1071
+ }
1072
+ getScaleValue(value) {
1073
+ return this.scale(value) || this.getRange()[0];
1074
+ }
1075
+ }
1076
+ class LinearAxis extends BaseAxis {
1077
+ constructor(axisConfig, axisThemeConfig, domain, title, textDimensionCalculator) {
1078
+ super(axisConfig, title, textDimensionCalculator, axisThemeConfig);
1079
+ this.domain = domain;
1080
+ this.scale = scaleLinear().domain(this.domain).range(this.getRange());
1081
+ }
1082
+ getTickValues() {
1083
+ return this.scale.ticks();
1084
+ }
1085
+ recalculateScale() {
1086
+ const domain = [...this.domain];
1087
+ if (this.axisPosition === "left") {
1088
+ domain.reverse();
1089
+ }
1090
+ this.scale = scaleLinear().domain(domain).range(this.getRange());
1091
+ }
1092
+ getScaleValue(value) {
1093
+ return this.scale(value);
1094
+ }
1095
+ }
1096
+ function getAxis(data, axisConfig, axisThemeConfig, tmpSVGGroup2) {
1097
+ const textDimensionCalculator = new TextDimensionCalculatorWithFont(tmpSVGGroup2);
1098
+ if (isBandAxisData(data)) {
1099
+ return new BandAxis(
1100
+ axisConfig,
1101
+ axisThemeConfig,
1102
+ data.categories,
1103
+ data.title,
1104
+ textDimensionCalculator
1105
+ );
1106
+ }
1107
+ return new LinearAxis(
1108
+ axisConfig,
1109
+ axisThemeConfig,
1110
+ [data.min, data.max],
1111
+ data.title,
1112
+ textDimensionCalculator
1113
+ );
1114
+ }
1115
+ class ChartTitle {
1116
+ constructor(textDimensionCalculator, chartConfig, chartData, chartThemeConfig) {
1117
+ this.textDimensionCalculator = textDimensionCalculator;
1118
+ this.chartConfig = chartConfig;
1119
+ this.chartData = chartData;
1120
+ this.chartThemeConfig = chartThemeConfig;
1121
+ this.boundingRect = {
1122
+ x: 0,
1123
+ y: 0,
1124
+ width: 0,
1125
+ height: 0
1126
+ };
1127
+ this.showChartTitle = false;
1128
+ }
1129
+ setBoundingBoxXY(point) {
1130
+ this.boundingRect.x = point.x;
1131
+ this.boundingRect.y = point.y;
1132
+ }
1133
+ calculateSpace(availableSpace) {
1134
+ const titleDimension = this.textDimensionCalculator.getMaxDimension(
1135
+ [this.chartData.title],
1136
+ this.chartConfig.titleFontSize
1137
+ );
1138
+ const widthRequired = Math.max(titleDimension.width, availableSpace.width);
1139
+ const heightRequired = titleDimension.height + 2 * this.chartConfig.titlePadding;
1140
+ if (titleDimension.width <= widthRequired && titleDimension.height <= heightRequired && this.chartConfig.showTitle && this.chartData.title) {
1141
+ this.boundingRect.width = widthRequired;
1142
+ this.boundingRect.height = heightRequired;
1143
+ this.showChartTitle = true;
1144
+ }
1145
+ return {
1146
+ width: this.boundingRect.width,
1147
+ height: this.boundingRect.height
1148
+ };
1149
+ }
1150
+ getDrawableElements() {
1151
+ const drawableElem = [];
1152
+ if (this.showChartTitle) {
1153
+ drawableElem.push({
1154
+ groupTexts: ["chart-title"],
1155
+ type: "text",
1156
+ data: [
1157
+ {
1158
+ fontSize: this.chartConfig.titleFontSize,
1159
+ text: this.chartData.title,
1160
+ verticalPos: "middle",
1161
+ horizontalPos: "center",
1162
+ x: this.boundingRect.x + this.boundingRect.width / 2,
1163
+ y: this.boundingRect.y + this.boundingRect.height / 2,
1164
+ fill: this.chartThemeConfig.titleColor,
1165
+ rotation: 0
1166
+ }
1167
+ ]
1168
+ });
1169
+ }
1170
+ return drawableElem;
1171
+ }
1172
+ }
1173
+ function getChartTitleComponent(chartConfig, chartData, chartThemeConfig, tmpSVGGroup2) {
1174
+ const textDimensionCalculator = new TextDimensionCalculatorWithFont(tmpSVGGroup2);
1175
+ return new ChartTitle(textDimensionCalculator, chartConfig, chartData, chartThemeConfig);
1176
+ }
1177
+ class LinePlot {
1178
+ constructor(plotData, xAxis, yAxis, orientation, plotIndex2) {
1179
+ this.plotData = plotData;
1180
+ this.xAxis = xAxis;
1181
+ this.yAxis = yAxis;
1182
+ this.orientation = orientation;
1183
+ this.plotIndex = plotIndex2;
1184
+ }
1185
+ getDrawableElement() {
1186
+ const finalData = this.plotData.data.map((d) => [
1187
+ this.xAxis.getScaleValue(d[0]),
1188
+ this.yAxis.getScaleValue(d[1])
1189
+ ]);
1190
+ let path;
1191
+ if (this.orientation === "horizontal") {
1192
+ path = line().y((d) => d[0]).x((d) => d[1])(finalData);
1193
+ } else {
1194
+ path = line().x((d) => d[0]).y((d) => d[1])(finalData);
1195
+ }
1196
+ if (!path) {
1197
+ return [];
1198
+ }
1199
+ return [
1200
+ {
1201
+ groupTexts: ["plot", `line-plot-${this.plotIndex}`],
1202
+ type: "path",
1203
+ data: [
1204
+ {
1205
+ path,
1206
+ strokeFill: this.plotData.strokeFill,
1207
+ strokeWidth: this.plotData.strokeWidth
1208
+ }
1209
+ ]
1210
+ }
1211
+ ];
1212
+ }
1213
+ }
1214
+ class BarPlot {
1215
+ constructor(barData, boundingRect, xAxis, yAxis, orientation, plotIndex2) {
1216
+ this.barData = barData;
1217
+ this.boundingRect = boundingRect;
1218
+ this.xAxis = xAxis;
1219
+ this.yAxis = yAxis;
1220
+ this.orientation = orientation;
1221
+ this.plotIndex = plotIndex2;
1222
+ }
1223
+ getDrawableElement() {
1224
+ const finalData = this.barData.data.map((d) => [
1225
+ this.xAxis.getScaleValue(d[0]),
1226
+ this.yAxis.getScaleValue(d[1])
1227
+ ]);
1228
+ const barPaddingPercent = 0.05;
1229
+ const barWidth = Math.min(this.xAxis.getAxisOuterPadding() * 2, this.xAxis.getTickDistance()) * (1 - barPaddingPercent);
1230
+ const barWidthHalf = barWidth / 2;
1231
+ if (this.orientation === "horizontal") {
1232
+ return [
1233
+ {
1234
+ groupTexts: ["plot", `bar-plot-${this.plotIndex}`],
1235
+ type: "rect",
1236
+ data: finalData.map((data) => ({
1237
+ x: this.boundingRect.x,
1238
+ y: data[0] - barWidthHalf,
1239
+ height: barWidth,
1240
+ width: data[1] - this.boundingRect.x,
1241
+ fill: this.barData.fill,
1242
+ strokeWidth: 0,
1243
+ strokeFill: this.barData.fill
1244
+ }))
1245
+ }
1246
+ ];
1247
+ }
1248
+ return [
1249
+ {
1250
+ groupTexts: ["plot", `bar-plot-${this.plotIndex}`],
1251
+ type: "rect",
1252
+ data: finalData.map((data) => ({
1253
+ x: data[0] - barWidthHalf,
1254
+ y: data[1],
1255
+ width: barWidth,
1256
+ height: this.boundingRect.y + this.boundingRect.height - data[1],
1257
+ fill: this.barData.fill,
1258
+ strokeWidth: 0,
1259
+ strokeFill: this.barData.fill
1260
+ }))
1261
+ }
1262
+ ];
1263
+ }
1264
+ }
1265
+ class BasePlot {
1266
+ constructor(chartConfig, chartData, chartThemeConfig) {
1267
+ this.chartConfig = chartConfig;
1268
+ this.chartData = chartData;
1269
+ this.chartThemeConfig = chartThemeConfig;
1270
+ this.boundingRect = {
1271
+ x: 0,
1272
+ y: 0,
1273
+ width: 0,
1274
+ height: 0
1275
+ };
1276
+ }
1277
+ setAxes(xAxis, yAxis) {
1278
+ this.xAxis = xAxis;
1279
+ this.yAxis = yAxis;
1280
+ }
1281
+ setBoundingBoxXY(point) {
1282
+ this.boundingRect.x = point.x;
1283
+ this.boundingRect.y = point.y;
1284
+ }
1285
+ calculateSpace(availableSpace) {
1286
+ this.boundingRect.width = availableSpace.width;
1287
+ this.boundingRect.height = availableSpace.height;
1288
+ return {
1289
+ width: this.boundingRect.width,
1290
+ height: this.boundingRect.height
1291
+ };
1292
+ }
1293
+ getDrawableElements() {
1294
+ if (!(this.xAxis && this.yAxis)) {
1295
+ throw Error("Axes must be passed to render Plots");
1296
+ }
1297
+ const drawableElem = [];
1298
+ for (const [i, plot] of this.chartData.plots.entries()) {
1299
+ switch (plot.type) {
1300
+ case "line":
1301
+ {
1302
+ const linePlot = new LinePlot(
1303
+ plot,
1304
+ this.xAxis,
1305
+ this.yAxis,
1306
+ this.chartConfig.chartOrientation,
1307
+ i
1308
+ );
1309
+ drawableElem.push(...linePlot.getDrawableElement());
1310
+ }
1311
+ break;
1312
+ case "bar":
1313
+ {
1314
+ const barPlot = new BarPlot(
1315
+ plot,
1316
+ this.boundingRect,
1317
+ this.xAxis,
1318
+ this.yAxis,
1319
+ this.chartConfig.chartOrientation,
1320
+ i
1321
+ );
1322
+ drawableElem.push(...barPlot.getDrawableElement());
1323
+ }
1324
+ break;
1325
+ }
1326
+ }
1327
+ return drawableElem;
1328
+ }
1329
+ }
1330
+ function getPlotComponent(chartConfig, chartData, chartThemeConfig) {
1331
+ return new BasePlot(chartConfig, chartData, chartThemeConfig);
1332
+ }
1333
+ class Orchestrator {
1334
+ constructor(chartConfig, chartData, chartThemeConfig, tmpSVGGroup2) {
1335
+ this.chartConfig = chartConfig;
1336
+ this.chartData = chartData;
1337
+ this.componentStore = {
1338
+ title: getChartTitleComponent(chartConfig, chartData, chartThemeConfig, tmpSVGGroup2),
1339
+ plot: getPlotComponent(chartConfig, chartData, chartThemeConfig),
1340
+ xAxis: getAxis(
1341
+ chartData.xAxis,
1342
+ chartConfig.xAxis,
1343
+ {
1344
+ titleColor: chartThemeConfig.xAxisTitleColor,
1345
+ labelColor: chartThemeConfig.xAxisLabelColor,
1346
+ tickColor: chartThemeConfig.xAxisTickColor,
1347
+ axisLineColor: chartThemeConfig.xAxisLineColor
1348
+ },
1349
+ tmpSVGGroup2
1350
+ ),
1351
+ yAxis: getAxis(
1352
+ chartData.yAxis,
1353
+ chartConfig.yAxis,
1354
+ {
1355
+ titleColor: chartThemeConfig.yAxisTitleColor,
1356
+ labelColor: chartThemeConfig.yAxisLabelColor,
1357
+ tickColor: chartThemeConfig.yAxisTickColor,
1358
+ axisLineColor: chartThemeConfig.yAxisLineColor
1359
+ },
1360
+ tmpSVGGroup2
1361
+ )
1362
+ };
1363
+ }
1364
+ calculateVerticalSpace() {
1365
+ let availableWidth = this.chartConfig.width;
1366
+ let availableHeight = this.chartConfig.height;
1367
+ let plotX = 0;
1368
+ let plotY = 0;
1369
+ let chartWidth = Math.floor(availableWidth * this.chartConfig.plotReservedSpacePercent / 100);
1370
+ let chartHeight = Math.floor(
1371
+ availableHeight * this.chartConfig.plotReservedSpacePercent / 100
1372
+ );
1373
+ let spaceUsed = this.componentStore.plot.calculateSpace({
1374
+ width: chartWidth,
1375
+ height: chartHeight
1376
+ });
1377
+ availableWidth -= spaceUsed.width;
1378
+ availableHeight -= spaceUsed.height;
1379
+ spaceUsed = this.componentStore.title.calculateSpace({
1380
+ width: this.chartConfig.width,
1381
+ height: availableHeight
1382
+ });
1383
+ plotY = spaceUsed.height;
1384
+ availableHeight -= spaceUsed.height;
1385
+ this.componentStore.xAxis.setAxisPosition("bottom");
1386
+ spaceUsed = this.componentStore.xAxis.calculateSpace({
1387
+ width: availableWidth,
1388
+ height: availableHeight
1389
+ });
1390
+ availableHeight -= spaceUsed.height;
1391
+ this.componentStore.yAxis.setAxisPosition("left");
1392
+ spaceUsed = this.componentStore.yAxis.calculateSpace({
1393
+ width: availableWidth,
1394
+ height: availableHeight
1395
+ });
1396
+ plotX = spaceUsed.width;
1397
+ availableWidth -= spaceUsed.width;
1398
+ if (availableWidth > 0) {
1399
+ chartWidth += availableWidth;
1400
+ availableWidth = 0;
1401
+ }
1402
+ if (availableHeight > 0) {
1403
+ chartHeight += availableHeight;
1404
+ availableHeight = 0;
1405
+ }
1406
+ this.componentStore.plot.calculateSpace({
1407
+ width: chartWidth,
1408
+ height: chartHeight
1409
+ });
1410
+ this.componentStore.plot.setBoundingBoxXY({ x: plotX, y: plotY });
1411
+ this.componentStore.xAxis.setRange([plotX, plotX + chartWidth]);
1412
+ this.componentStore.xAxis.setBoundingBoxXY({ x: plotX, y: plotY + chartHeight });
1413
+ this.componentStore.yAxis.setRange([plotY, plotY + chartHeight]);
1414
+ this.componentStore.yAxis.setBoundingBoxXY({ x: 0, y: plotY });
1415
+ if (this.chartData.plots.some((p) => isBarPlot(p))) {
1416
+ this.componentStore.xAxis.recalculateOuterPaddingToDrawBar();
1417
+ }
1418
+ }
1419
+ calculateHorizontalSpace() {
1420
+ let availableWidth = this.chartConfig.width;
1421
+ let availableHeight = this.chartConfig.height;
1422
+ let titleYEnd = 0;
1423
+ let plotX = 0;
1424
+ let plotY = 0;
1425
+ let chartWidth = Math.floor(availableWidth * this.chartConfig.plotReservedSpacePercent / 100);
1426
+ let chartHeight = Math.floor(
1427
+ availableHeight * this.chartConfig.plotReservedSpacePercent / 100
1428
+ );
1429
+ let spaceUsed = this.componentStore.plot.calculateSpace({
1430
+ width: chartWidth,
1431
+ height: chartHeight
1432
+ });
1433
+ availableWidth -= spaceUsed.width;
1434
+ availableHeight -= spaceUsed.height;
1435
+ spaceUsed = this.componentStore.title.calculateSpace({
1436
+ width: this.chartConfig.width,
1437
+ height: availableHeight
1438
+ });
1439
+ titleYEnd = spaceUsed.height;
1440
+ availableHeight -= spaceUsed.height;
1441
+ this.componentStore.xAxis.setAxisPosition("left");
1442
+ spaceUsed = this.componentStore.xAxis.calculateSpace({
1443
+ width: availableWidth,
1444
+ height: availableHeight
1445
+ });
1446
+ availableWidth -= spaceUsed.width;
1447
+ plotX = spaceUsed.width;
1448
+ this.componentStore.yAxis.setAxisPosition("top");
1449
+ spaceUsed = this.componentStore.yAxis.calculateSpace({
1450
+ width: availableWidth,
1451
+ height: availableHeight
1452
+ });
1453
+ availableHeight -= spaceUsed.height;
1454
+ plotY = titleYEnd + spaceUsed.height;
1455
+ if (availableWidth > 0) {
1456
+ chartWidth += availableWidth;
1457
+ availableWidth = 0;
1458
+ }
1459
+ if (availableHeight > 0) {
1460
+ chartHeight += availableHeight;
1461
+ availableHeight = 0;
1462
+ }
1463
+ this.componentStore.plot.calculateSpace({
1464
+ width: chartWidth,
1465
+ height: chartHeight
1466
+ });
1467
+ this.componentStore.plot.setBoundingBoxXY({ x: plotX, y: plotY });
1468
+ this.componentStore.yAxis.setRange([plotX, plotX + chartWidth]);
1469
+ this.componentStore.yAxis.setBoundingBoxXY({ x: plotX, y: titleYEnd });
1470
+ this.componentStore.xAxis.setRange([plotY, plotY + chartHeight]);
1471
+ this.componentStore.xAxis.setBoundingBoxXY({ x: 0, y: plotY });
1472
+ if (this.chartData.plots.some((p) => isBarPlot(p))) {
1473
+ this.componentStore.xAxis.recalculateOuterPaddingToDrawBar();
1474
+ }
1475
+ }
1476
+ calculateSpace() {
1477
+ if (this.chartConfig.chartOrientation === "horizontal") {
1478
+ this.calculateHorizontalSpace();
1479
+ } else {
1480
+ this.calculateVerticalSpace();
1481
+ }
1482
+ }
1483
+ getDrawableElement() {
1484
+ this.calculateSpace();
1485
+ const drawableElem = [];
1486
+ this.componentStore.plot.setAxes(this.componentStore.xAxis, this.componentStore.yAxis);
1487
+ for (const component of Object.values(this.componentStore)) {
1488
+ drawableElem.push(...component.getDrawableElements());
1489
+ }
1490
+ return drawableElem;
1491
+ }
1492
+ }
1493
+ class XYChartBuilder {
1494
+ static build(config, chartData, chartThemeConfig, tmpSVGGroup2) {
1495
+ const orchestrator = new Orchestrator(config, chartData, chartThemeConfig, tmpSVGGroup2);
1496
+ return orchestrator.getDrawableElement();
1497
+ }
1498
+ }
1499
+ let plotIndex = 0;
1500
+ let tmpSVGGroup;
1501
+ let xyChartConfig = getChartDefaultConfig();
1502
+ let xyChartThemeConfig = getChartDefaultThemeConfig();
1503
+ let xyChartData = getChartDefaultData();
1504
+ let plotColorPalette = xyChartThemeConfig.plotColorPalette.split(",").map((color) => color.trim());
1505
+ let hasSetXAxis = false;
1506
+ let hasSetYAxis = false;
1507
+ function getChartDefaultThemeConfig() {
1508
+ const defaultThemeVariables = getThemeVariables();
1509
+ const config = getConfig();
1510
+ return cleanAndMerge(defaultThemeVariables.xyChart, config.themeVariables.xyChart);
1511
+ }
1512
+ function getChartDefaultConfig() {
1513
+ const config = getConfig();
1514
+ return cleanAndMerge(
1515
+ defaultConfig.xyChart,
1516
+ config.xyChart
1517
+ );
1518
+ }
1519
+ function getChartDefaultData() {
1520
+ return {
1521
+ yAxis: {
1522
+ type: "linear",
1523
+ title: "",
1524
+ min: Infinity,
1525
+ max: -Infinity
1526
+ },
1527
+ xAxis: {
1528
+ type: "band",
1529
+ title: "",
1530
+ categories: []
1531
+ },
1532
+ title: "",
1533
+ plots: []
1534
+ };
1535
+ }
1536
+ function textSanitizer(text) {
1537
+ const config = getConfig();
1538
+ return sanitizeText(text.trim(), config);
1539
+ }
1540
+ function setTmpSVGG(SVGG) {
1541
+ tmpSVGGroup = SVGG;
1542
+ }
1543
+ function setOrientation(orientation) {
1544
+ if (orientation === "horizontal") {
1545
+ xyChartConfig.chartOrientation = "horizontal";
1546
+ } else {
1547
+ xyChartConfig.chartOrientation = "vertical";
1548
+ }
1549
+ }
1550
+ function setXAxisTitle(title) {
1551
+ xyChartData.xAxis.title = textSanitizer(title.text);
1552
+ }
1553
+ function setXAxisRangeData(min, max) {
1554
+ xyChartData.xAxis = { type: "linear", title: xyChartData.xAxis.title, min, max };
1555
+ hasSetXAxis = true;
1556
+ }
1557
+ function setXAxisBand(categories) {
1558
+ xyChartData.xAxis = {
1559
+ type: "band",
1560
+ title: xyChartData.xAxis.title,
1561
+ categories: categories.map((c) => textSanitizer(c.text))
1562
+ };
1563
+ hasSetXAxis = true;
1564
+ }
1565
+ function setYAxisTitle(title) {
1566
+ xyChartData.yAxis.title = textSanitizer(title.text);
1567
+ }
1568
+ function setYAxisRangeData(min, max) {
1569
+ xyChartData.yAxis = { type: "linear", title: xyChartData.yAxis.title, min, max };
1570
+ hasSetYAxis = true;
1571
+ }
1572
+ function setYAxisRangeFromPlotData(data) {
1573
+ const minValue = Math.min(...data);
1574
+ const maxValue = Math.max(...data);
1575
+ const prevMinValue = isLinearAxisData(xyChartData.yAxis) ? xyChartData.yAxis.min : Infinity;
1576
+ const prevMaxValue = isLinearAxisData(xyChartData.yAxis) ? xyChartData.yAxis.max : -Infinity;
1577
+ xyChartData.yAxis = {
1578
+ type: "linear",
1579
+ title: xyChartData.yAxis.title,
1580
+ min: Math.min(prevMinValue, minValue),
1581
+ max: Math.max(prevMaxValue, maxValue)
1582
+ };
1583
+ }
1584
+ function transformDataWithoutCategory(data) {
1585
+ let retData = [];
1586
+ if (data.length === 0) {
1587
+ return retData;
1588
+ }
1589
+ if (!hasSetXAxis) {
1590
+ const prevMinValue = isLinearAxisData(xyChartData.xAxis) ? xyChartData.xAxis.min : Infinity;
1591
+ const prevMaxValue = isLinearAxisData(xyChartData.xAxis) ? xyChartData.xAxis.max : -Infinity;
1592
+ setXAxisRangeData(Math.min(prevMinValue, 1), Math.max(prevMaxValue, data.length));
1593
+ }
1594
+ if (!hasSetYAxis) {
1595
+ setYAxisRangeFromPlotData(data);
1596
+ }
1597
+ if (isBandAxisData(xyChartData.xAxis)) {
1598
+ retData = xyChartData.xAxis.categories.map((c, i) => [c, data[i]]);
1599
+ }
1600
+ if (isLinearAxisData(xyChartData.xAxis)) {
1601
+ const min = xyChartData.xAxis.min;
1602
+ const max = xyChartData.xAxis.max;
1603
+ const step = (max - min + 1) / data.length;
1604
+ const categories = [];
1605
+ for (let i = min; i <= max; i += step) {
1606
+ categories.push(`${i}`);
1607
+ }
1608
+ retData = categories.map((c, i) => [c, data[i]]);
1609
+ }
1610
+ return retData;
1611
+ }
1612
+ function getPlotColorFromPalette(plotIndex2) {
1613
+ return plotColorPalette[plotIndex2 === 0 ? 0 : plotIndex2 % plotColorPalette.length];
1614
+ }
1615
+ function setLineData(title, data) {
1616
+ const plotData = transformDataWithoutCategory(data);
1617
+ xyChartData.plots.push({
1618
+ type: "line",
1619
+ strokeFill: getPlotColorFromPalette(plotIndex),
1620
+ strokeWidth: 2,
1621
+ data: plotData
1622
+ });
1623
+ plotIndex++;
1624
+ }
1625
+ function setBarData(title, data) {
1626
+ const plotData = transformDataWithoutCategory(data);
1627
+ xyChartData.plots.push({
1628
+ type: "bar",
1629
+ fill: getPlotColorFromPalette(plotIndex),
1630
+ data: plotData
1631
+ });
1632
+ plotIndex++;
1633
+ }
1634
+ function getDrawableElem() {
1635
+ if (xyChartData.plots.length === 0) {
1636
+ throw Error("No Plot to render, please provide a plot with some data");
1637
+ }
1638
+ xyChartData.title = getDiagramTitle();
1639
+ return XYChartBuilder.build(xyChartConfig, xyChartData, xyChartThemeConfig, tmpSVGGroup);
1640
+ }
1641
+ function getChartThemeConfig() {
1642
+ return xyChartThemeConfig;
1643
+ }
1644
+ function getChartConfig() {
1645
+ return xyChartConfig;
1646
+ }
1647
+ const clear = function() {
1648
+ clear$1();
1649
+ plotIndex = 0;
1650
+ xyChartConfig = getChartDefaultConfig();
1651
+ xyChartData = getChartDefaultData();
1652
+ xyChartThemeConfig = getChartDefaultThemeConfig();
1653
+ plotColorPalette = xyChartThemeConfig.plotColorPalette.split(",").map((color) => color.trim());
1654
+ hasSetXAxis = false;
1655
+ hasSetYAxis = false;
1656
+ };
1657
+ const db = {
1658
+ getDrawableElem,
1659
+ clear,
1660
+ setAccTitle,
1661
+ getAccTitle,
1662
+ setDiagramTitle,
1663
+ getDiagramTitle,
1664
+ getAccDescription,
1665
+ setAccDescription,
1666
+ setOrientation,
1667
+ setXAxisTitle,
1668
+ setXAxisRangeData,
1669
+ setXAxisBand,
1670
+ setYAxisTitle,
1671
+ setYAxisRangeData,
1672
+ setLineData,
1673
+ setBarData,
1674
+ setTmpSVGG,
1675
+ getChartThemeConfig,
1676
+ getChartConfig
1677
+ };
1678
+ const draw = (txt, id, _version, diagObj) => {
1679
+ const db2 = diagObj.db;
1680
+ const themeConfig = db2.getChartThemeConfig();
1681
+ const chartConfig = db2.getChartConfig();
1682
+ function getDominantBaseLine(horizontalPos) {
1683
+ return horizontalPos === "top" ? "text-before-edge" : "middle";
1684
+ }
1685
+ function getTextAnchor(verticalPos) {
1686
+ return verticalPos === "left" ? "start" : verticalPos === "right" ? "end" : "middle";
1687
+ }
1688
+ function getTextTransformation(data) {
1689
+ return `translate(${data.x}, ${data.y}) rotate(${data.rotation || 0})`;
1690
+ }
1691
+ log.debug("Rendering xychart chart\n" + txt);
1692
+ const svg = selectSvgElement(id);
1693
+ const group = svg.append("g").attr("class", "main");
1694
+ const background = group.append("rect").attr("width", chartConfig.width).attr("height", chartConfig.height).attr("class", "background");
1695
+ configureSvgSize(svg, chartConfig.height, chartConfig.width, true);
1696
+ svg.attr("viewBox", `0 0 ${chartConfig.width} ${chartConfig.height}`);
1697
+ background.attr("fill", themeConfig.backgroundColor);
1698
+ db2.setTmpSVGG(svg.append("g").attr("class", "mermaid-tmp-group"));
1699
+ const shapes = db2.getDrawableElem();
1700
+ const groups = {};
1701
+ function getGroup(gList) {
1702
+ let elem = group;
1703
+ let prefix = "";
1704
+ for (const [i] of gList.entries()) {
1705
+ let parent = group;
1706
+ if (i > 0 && groups[prefix]) {
1707
+ parent = groups[prefix];
1708
+ }
1709
+ prefix += gList[i];
1710
+ elem = groups[prefix];
1711
+ if (!elem) {
1712
+ elem = groups[prefix] = parent.append("g").attr("class", gList[i]);
1713
+ }
1714
+ }
1715
+ return elem;
1716
+ }
1717
+ for (const shape of shapes) {
1718
+ if (shape.data.length === 0) {
1719
+ continue;
1720
+ }
1721
+ const shapeGroup = getGroup(shape.groupTexts);
1722
+ switch (shape.type) {
1723
+ case "rect":
1724
+ shapeGroup.selectAll("rect").data(shape.data).enter().append("rect").attr("x", (data) => data.x).attr("y", (data) => data.y).attr("width", (data) => data.width).attr("height", (data) => data.height).attr("fill", (data) => data.fill).attr("stroke", (data) => data.strokeFill).attr("stroke-width", (data) => data.strokeWidth);
1725
+ break;
1726
+ case "text":
1727
+ shapeGroup.selectAll("text").data(shape.data).enter().append("text").attr("x", 0).attr("y", 0).attr("fill", (data) => data.fill).attr("font-size", (data) => data.fontSize).attr("dominant-baseline", (data) => getDominantBaseLine(data.verticalPos)).attr("text-anchor", (data) => getTextAnchor(data.horizontalPos)).attr("transform", (data) => getTextTransformation(data)).text((data) => data.text);
1728
+ break;
1729
+ case "path":
1730
+ shapeGroup.selectAll("path").data(shape.data).enter().append("path").attr("d", (data) => data.path).attr("fill", (data) => data.fill ? data.fill : "none").attr("stroke", (data) => data.strokeFill).attr("stroke-width", (data) => data.strokeWidth);
1731
+ break;
1732
+ }
1733
+ }
1734
+ };
1735
+ const renderer = {
1736
+ draw
1737
+ };
1738
+ const diagram = {
1739
+ parser: parser$1,
1740
+ db,
1741
+ renderer
1742
+ };
1743
+ export {
1744
+ diagram
1745
+ };