@legionworks/facet 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (327) hide show
  1. package/LICENSE-APACHE +202 -0
  2. package/LICENSE-MIT +23 -0
  3. package/README.md +158 -0
  4. package/dist/gallery/chunk-4g8rem85.css +656 -0
  5. package/dist/gallery/chunk-c6s9k9ty.js +5970 -0
  6. package/dist/gallery/frame/artifact.css +8424 -0
  7. package/dist/gallery/frame/chunks/abnfDiagram-N423BO3Z-jj74szbm.js +155 -0
  8. package/dist/gallery/frame/chunks/architecture-TIHT7OUA-cvdjn7dt.js +10 -0
  9. package/dist/gallery/frame/chunks/architectureDiagram-T3A2C74G-n4z77eg6.js +8675 -0
  10. package/dist/gallery/frame/chunks/blockDiagram-VBNYF7ZC-7xsqzrd1.js +3529 -0
  11. package/dist/gallery/frame/chunks/c4Diagram-5PPSVZJV-z2zjs7wx.js +2413 -0
  12. package/dist/gallery/frame/chunks/classDiagram-JCYQIIEL-ve8rngqp.js +47 -0
  13. package/dist/gallery/frame/chunks/classDiagram-v2-OCEON4UE-8cfaxb8z.js +47 -0
  14. package/dist/gallery/frame/chunks/cose-bilkent-JH36ORCC-sn92qexx.js +4822 -0
  15. package/dist/gallery/frame/chunks/cynefin-VYW2F7L2-tqjv913d.js +10 -0
  16. package/dist/gallery/frame/chunks/cynefinDiagram-MW4NZA55-c1c0dj12.js +500 -0
  17. package/dist/gallery/frame/chunks/dagre-VZM6K2ZE-7tyg4yt2.js +476 -0
  18. package/dist/gallery/frame/chunks/diagram-7IWD3JNH-y4eng9sc.js +526 -0
  19. package/dist/gallery/frame/chunks/diagram-B4RE2ZJO-rn3p7j5h.js +673 -0
  20. package/dist/gallery/frame/chunks/diagram-LBJQPF4R-w4a2cm9q.js +255 -0
  21. package/dist/gallery/frame/chunks/diagram-Q27KOJAE-aqc2v7wy.js +575 -0
  22. package/dist/gallery/frame/chunks/diagram-UB23O5K3-xncy8nyd.js +355 -0
  23. package/dist/gallery/frame/chunks/ebnfDiagram-BXEA7PRR-acwgxz16.js +175 -0
  24. package/dist/gallery/frame/chunks/erDiagram-JOGREHBK-mzp5nswt.js +1332 -0
  25. package/dist/gallery/frame/chunks/eventmodeling-45OFAUF4-sg07qr0c.js +10 -0
  26. package/dist/gallery/frame/chunks/flowDiagram-UKHOOZJN-2e5ygs44.js +29 -0
  27. package/dist/gallery/frame/chunks/ganttDiagram-PKOTCBZU-p2hhh7hr.js +2620 -0
  28. package/dist/gallery/frame/chunks/gitGraph-TEB2WS4Q-j6kw0naa.js +10 -0
  29. package/dist/gallery/frame/chunks/gitGraphDiagram-DS77QQ5N-4z9z8wjm.js +1347 -0
  30. package/dist/gallery/frame/chunks/info-DKCQHKI2-mpt80jd3.js +10 -0
  31. package/dist/gallery/frame/chunks/infoDiagram-6WML65LV-5rqm3mgg.js +65 -0
  32. package/dist/gallery/frame/chunks/ishikawaDiagram-WSZJBQD7-b51z96jy.js +975 -0
  33. package/dist/gallery/frame/chunks/journeyDiagram-NVQOT4AX-9jbfp0pk.js +1272 -0
  34. package/dist/gallery/frame/chunks/kanban-definition-27J2QSJJ-4x0vx4se.js +1116 -0
  35. package/dist/gallery/frame/chunks/katex-xfgk95tv.js +14034 -0
  36. package/dist/gallery/frame/chunks/markdown-1s5vwkf2.js +9 -0
  37. package/dist/gallery/frame/chunks/markdown-2h6bwsms.js +3239 -0
  38. package/dist/gallery/frame/chunks/markdown-2x113yh8.js +107 -0
  39. package/dist/gallery/frame/chunks/markdown-30b7rwmp.js +1943 -0
  40. package/dist/gallery/frame/chunks/markdown-356bfj4g.js +2031 -0
  41. package/dist/gallery/frame/chunks/markdown-44n9ea69.js +2406 -0
  42. package/dist/gallery/frame/chunks/markdown-56enrf2r.js +39 -0
  43. package/dist/gallery/frame/chunks/markdown-5avymm8t.js +725 -0
  44. package/dist/gallery/frame/chunks/markdown-6r4svars.js +33 -0
  45. package/dist/gallery/frame/chunks/markdown-6zz8efx2.js +24 -0
  46. package/dist/gallery/frame/chunks/markdown-7jp6prnb.js +19 -0
  47. package/dist/gallery/frame/chunks/markdown-809k7q41.js +55 -0
  48. package/dist/gallery/frame/chunks/markdown-82xmzhzd.js +1076 -0
  49. package/dist/gallery/frame/chunks/markdown-92n37gd4.js +7627 -0
  50. package/dist/gallery/frame/chunks/markdown-ag2sssf8.js +36 -0
  51. package/dist/gallery/frame/chunks/markdown-b4s7ntq2.js +19 -0
  52. package/dist/gallery/frame/chunks/markdown-c9k0fvp1.js +100 -0
  53. package/dist/gallery/frame/chunks/markdown-ceefymn8.js +125 -0
  54. package/dist/gallery/frame/chunks/markdown-d1wfbs70.js +243 -0
  55. package/dist/gallery/frame/chunks/markdown-dy5sgjhc.js +11022 -0
  56. package/dist/gallery/frame/chunks/markdown-dz3z5w30.js +30868 -0
  57. package/dist/gallery/frame/chunks/markdown-eg6ngz7y.js +30340 -0
  58. package/dist/gallery/frame/chunks/markdown-ff5wvb43.js +1149 -0
  59. package/dist/gallery/frame/chunks/markdown-ffg06nfz.js +86 -0
  60. package/dist/gallery/frame/chunks/markdown-fvfncadf.js +472 -0
  61. package/dist/gallery/frame/chunks/markdown-gvyszqpv.js +19 -0
  62. package/dist/gallery/frame/chunks/markdown-gx1p0ew0.js +88 -0
  63. package/dist/gallery/frame/chunks/markdown-gxye5frz.js +65 -0
  64. package/dist/gallery/frame/chunks/markdown-h7pzv34e.js +105 -0
  65. package/dist/gallery/frame/chunks/markdown-hab789t9.js +47 -0
  66. package/dist/gallery/frame/chunks/markdown-hjp6sj8t.js +125 -0
  67. package/dist/gallery/frame/chunks/markdown-jka64qgp.js +1993 -0
  68. package/dist/gallery/frame/chunks/markdown-k8xkn8mw.js +56 -0
  69. package/dist/gallery/frame/chunks/markdown-m7frq8x8.js +112 -0
  70. package/dist/gallery/frame/chunks/markdown-p740v4qm.js +36 -0
  71. package/dist/gallery/frame/chunks/markdown-pxfeh231.js +57 -0
  72. package/dist/gallery/frame/chunks/markdown-pzgd8z3s.js +87 -0
  73. package/dist/gallery/frame/chunks/markdown-qx3cngz2.js +1673 -0
  74. package/dist/gallery/frame/chunks/markdown-rawhfvvc.js +85 -0
  75. package/dist/gallery/frame/chunks/markdown-rd8w0ng9.js +49 -0
  76. package/dist/gallery/frame/chunks/markdown-rm2yxfjj.js +2773 -0
  77. package/dist/gallery/frame/chunks/markdown-s1jatrnk.js +993 -0
  78. package/dist/gallery/frame/chunks/markdown-sgfg5vvq.js +59 -0
  79. package/dist/gallery/frame/chunks/markdown-t4ethv9d.js +409 -0
  80. package/dist/gallery/frame/chunks/markdown-tnmabqvz.js +36 -0
  81. package/dist/gallery/frame/chunks/markdown-tvdpppw8.js +5292 -0
  82. package/dist/gallery/frame/chunks/markdown-v0x27twr.js +22 -0
  83. package/dist/gallery/frame/chunks/markdown-v14td68x.js +36 -0
  84. package/dist/gallery/frame/chunks/markdown-w6sgd54z.js +36 -0
  85. package/dist/gallery/frame/chunks/markdown-xw8dsk8b.js +2125 -0
  86. package/dist/gallery/frame/chunks/markdown-y18mve73.js +85 -0
  87. package/dist/gallery/frame/chunks/markdown-yengsms5.js +427 -0
  88. package/dist/gallery/frame/chunks/markdown-z1wc0v0d.js +1826 -0
  89. package/dist/gallery/frame/chunks/markdown-zazx9h4n.js +329 -0
  90. package/dist/gallery/frame/chunks/mermaid-de7p4v0x.js +30 -0
  91. package/dist/gallery/frame/chunks/mindmap-definition-FAOFIHXS-ra44cbem.js +1216 -0
  92. package/dist/gallery/frame/chunks/packet-7NZHBO7P-xppm5913.js +10 -0
  93. package/dist/gallery/frame/chunks/pegDiagram-VL7TDLO6-a2a4wg03.js +163 -0
  94. package/dist/gallery/frame/chunks/pie-RZYD4A2V-hnbxk152.js +10 -0
  95. package/dist/gallery/frame/chunks/pieDiagram-7S7Q4E2Y-f1vxjtmx.js +311 -0
  96. package/dist/gallery/frame/chunks/quadrantDiagram-CIZ2JOQS-ywafa6kh.js +1390 -0
  97. package/dist/gallery/frame/chunks/radar-I7S5WNFK-ewqd27se.js +10 -0
  98. package/dist/gallery/frame/chunks/railroad-3IZDKUUU-5hy4bdx3.js +10 -0
  99. package/dist/gallery/frame/chunks/railroad-abnf-AHOZXSZD-bh5sxz0d.js +10 -0
  100. package/dist/gallery/frame/chunks/railroad-ebnf-EBAXGLYW-6b9c3zeh.js +10 -0
  101. package/dist/gallery/frame/chunks/railroad-peg-LSFZ7HO6-avc8v39s.js +10 -0
  102. package/dist/gallery/frame/chunks/railroadDiagram-AXF67PYL-qc61wax4.js +131 -0
  103. package/dist/gallery/frame/chunks/requirementDiagram-LRYGKXZP-9bs4786c.js +1295 -0
  104. package/dist/gallery/frame/chunks/sankeyDiagram-W5VNT64P-awt1em8b.js +1339 -0
  105. package/dist/gallery/frame/chunks/sequenceDiagram-SI44F4Z6-qaf9mz3t.js +4324 -0
  106. package/dist/gallery/frame/chunks/sizeCapture-X5ZJPWSS-9fq685xd.js +64 -0
  107. package/dist/gallery/frame/chunks/stateDiagram-OKZ733FA-vx7a7hh0.js +456 -0
  108. package/dist/gallery/frame/chunks/stateDiagram-v2-UEYNNEHI-x4m6ws5t.js +46 -0
  109. package/dist/gallery/frame/chunks/swimlanes-SLNWSIFB-e4mxm1gh.js +8287 -0
  110. package/dist/gallery/frame/chunks/swimlanesDiagram-ULZ7WXOC-0h93e2qq.js +42 -0
  111. package/dist/gallery/frame/chunks/timeline-definition-Z64GVDOM-wp0bhbzg.js +1549 -0
  112. package/dist/gallery/frame/chunks/treeView-QDETBFTQ-hcx7n0vt.js +10 -0
  113. package/dist/gallery/frame/chunks/treemap-6X3UGDF4-av02skdw.js +10 -0
  114. package/dist/gallery/frame/chunks/vennDiagram-T6HMQDX7-pmvk1p7n.js +2566 -0
  115. package/dist/gallery/frame/chunks/wardley-OPB4EBWU-njsp6e40.js +10 -0
  116. package/dist/gallery/frame/chunks/wardleyDiagram-T6FBY63Y-eggmnv4z.js +979 -0
  117. package/dist/gallery/frame/chunks/xychartDiagram-ELKLHX3M-q40tnpe5.js +1954 -0
  118. package/dist/gallery/frame/frame.css +183 -0
  119. package/dist/gallery/frame/runtime/chart.js +42744 -0
  120. package/dist/gallery/frame/runtime/html.js +14 -0
  121. package/dist/gallery/frame/runtime/markdown.js +1403 -0
  122. package/dist/gallery/frame/runtime/mermaid.js +32 -0
  123. package/dist/gallery/frame/runtime/svg.js +14 -0
  124. package/dist/gallery/frame/runtime/tsx.js +52 -0
  125. package/dist/gallery/index.html +104 -0
  126. package/docs/reference/cli.md +163 -0
  127. package/docs/reference/export.md +106 -0
  128. package/docs/reference/html.md +215 -0
  129. package/docs/reference/http.md +85 -0
  130. package/docs/reference/mcp.md +78 -0
  131. package/docs/reference/security.md +119 -0
  132. package/docs/reference/storage.md +93 -0
  133. package/docs/reference/tsx.md +101 -0
  134. package/docs/reference/validation.md +212 -0
  135. package/package.json +89 -0
  136. package/scripts/build-gallery.ts +127 -0
  137. package/scripts/launch-netns.sh +67 -0
  138. package/skills/facet/SKILL.md +100 -0
  139. package/src/cli/client.ts +311 -0
  140. package/src/cli/commands/create.ts +49 -0
  141. package/src/cli/commands/doctor.ts +249 -0
  142. package/src/cli/commands/export.ts +179 -0
  143. package/src/cli/commands/instantiate.ts +35 -0
  144. package/src/cli/commands/list.ts +49 -0
  145. package/src/cli/commands/open.ts +75 -0
  146. package/src/cli/commands/pin.ts +39 -0
  147. package/src/cli/commands/promote.ts +49 -0
  148. package/src/cli/commands/publish.ts +122 -0
  149. package/src/cli/commands/read-back.ts +56 -0
  150. package/src/cli/commands/status.ts +114 -0
  151. package/src/cli/commands/watch.ts +146 -0
  152. package/src/cli/main.ts +522 -0
  153. package/src/cli/output.ts +106 -0
  154. package/src/cli/parser.ts +376 -0
  155. package/src/cli/presenter.ts +212 -0
  156. package/src/cli/service-metadata.ts +134 -0
  157. package/src/cli/spawn-service.ts +326 -0
  158. package/src/css.d.ts +4 -0
  159. package/src/gallery-web/app.ts +1581 -0
  160. package/src/gallery-web/export-menu.ts +121 -0
  161. package/src/gallery-web/export.ts +112 -0
  162. package/src/gallery-web/favicon.ts +54 -0
  163. package/src/gallery-web/frame/entries/chart.ts +6 -0
  164. package/src/gallery-web/frame/entries/html.ts +6 -0
  165. package/src/gallery-web/frame/entries/markdown.ts +6 -0
  166. package/src/gallery-web/frame/entries/mermaid.ts +6 -0
  167. package/src/gallery-web/frame/entries/svg.ts +6 -0
  168. package/src/gallery-web/frame/entries/tsx.ts +6 -0
  169. package/src/gallery-web/frame/frame-payload.ts +91 -0
  170. package/src/gallery-web/frame/renderer-validation.ts +13 -0
  171. package/src/gallery-web/frame/renderers/chart.ts +182 -0
  172. package/src/gallery-web/frame/renderers/dompurify-shim.ts +112 -0
  173. package/src/gallery-web/frame/renderers/html.ts +48 -0
  174. package/src/gallery-web/frame/renderers/markdown.ts +81 -0
  175. package/src/gallery-web/frame/renderers/mermaid.ts +120 -0
  176. package/src/gallery-web/frame/renderers/registry.ts +260 -0
  177. package/src/gallery-web/frame/renderers/svg.ts +393 -0
  178. package/src/gallery-web/frame/renderers/tsx.ts +61 -0
  179. package/src/gallery-web/frame/runtime.ts +501 -0
  180. package/src/gallery-web/frame/styles/artifact.css +8424 -0
  181. package/src/gallery-web/frame/styles/frame.css +183 -0
  182. package/src/gallery-web/frame/styles/html-source.css +23 -0
  183. package/src/gallery-web/frame/view-box.ts +33 -0
  184. package/src/gallery-web/frame-html.ts +72 -0
  185. package/src/gallery-web/index.html +104 -0
  186. package/src/gallery-web/session.ts +107 -0
  187. package/src/gallery-web/sse-client.ts +212 -0
  188. package/src/gallery-web/styles/app.css +420 -0
  189. package/src/gallery-web/styles/tokens.css +112 -0
  190. package/src/gallery-web/styles/verdict.css +186 -0
  191. package/src/gallery-web/swap.ts +64 -0
  192. package/src/gallery-web/theme.ts +40 -0
  193. package/src/gallery-web/view-state.ts +93 -0
  194. package/src/harness-adapters/claude-code/README.md +10 -0
  195. package/src/harness-adapters/claude-code/facet.sh +4 -0
  196. package/src/harness-adapters/codex/README.md +10 -0
  197. package/src/harness-adapters/codex/facet.sh +4 -0
  198. package/src/harness-adapters/mcp/README.md +13 -0
  199. package/src/harness-adapters/mcp/cli-bridge.ts +216 -0
  200. package/src/harness-adapters/mcp/main.ts +15 -0
  201. package/src/harness-adapters/mcp/server.ts +164 -0
  202. package/src/harness-adapters/mcp/tool-schemas.ts +53 -0
  203. package/src/harness-adapters/opencode/README.md +10 -0
  204. package/src/harness-adapters/opencode/facet.sh +4 -0
  205. package/src/runtime/compiled-entrypoints.ts +69 -0
  206. package/src/service/dispatcher.ts +717 -0
  207. package/src/service/export.ts +218 -0
  208. package/src/service/http-utils.ts +55 -0
  209. package/src/service/lexical/expectations.ts +210 -0
  210. package/src/service/lifecycle/idle-controller.ts +125 -0
  211. package/src/service/lifecycle/orphan-cleanup.ts +128 -0
  212. package/src/service/lifecycle/process-lock.ts +235 -0
  213. package/src/service/main.ts +136 -0
  214. package/src/service/process.ts +240 -0
  215. package/src/service/router-guards.ts +239 -0
  216. package/src/service/router.ts +627 -0
  217. package/src/service/security/auth.ts +168 -0
  218. package/src/service/security/host-origin.ts +138 -0
  219. package/src/service/security/http-guards.ts +13 -0
  220. package/src/service/security/leases.ts +182 -0
  221. package/src/service/security/token-store.ts +138 -0
  222. package/src/service/server.ts +356 -0
  223. package/src/service/store/database.ts +61 -0
  224. package/src/service/store/evidence-retention.ts +234 -0
  225. package/src/service/store/migrations.ts +167 -0
  226. package/src/service/store/repository-lifecycle.ts +121 -0
  227. package/src/service/store/repository.ts +732 -0
  228. package/src/service/store/schema.ts +218 -0
  229. package/src/service/stored-verdict.ts +97 -0
  230. package/src/service/stream.ts +301 -0
  231. package/src/service/verdict-enrichment.ts +45 -0
  232. package/src/shared/build/frame-bundle-plugins.ts +61 -0
  233. package/src/shared/build-mode.ts +28 -0
  234. package/src/shared/config/evidence-read.ts +98 -0
  235. package/src/shared/config/limits.ts +56 -0
  236. package/src/shared/config/paths.ts +96 -0
  237. package/src/shared/contracts/artifact-types.ts +2 -0
  238. package/src/shared/contracts/artifact.ts +98 -0
  239. package/src/shared/contracts/commands/_shared.ts +59 -0
  240. package/src/shared/contracts/commands/guards.ts +86 -0
  241. package/src/shared/contracts/commands/index.ts +204 -0
  242. package/src/shared/contracts/commands/names.ts +35 -0
  243. package/src/shared/contracts/commands/requests.ts +149 -0
  244. package/src/shared/contracts/commands/results.ts +200 -0
  245. package/src/shared/contracts/envelope.ts +140 -0
  246. package/src/shared/contracts/events.ts +41 -0
  247. package/src/shared/contracts/observed-counts.ts +19 -0
  248. package/src/shared/contracts/renderers.ts +6 -0
  249. package/src/shared/contracts/validation.ts +296 -0
  250. package/src/shared/errors/facet-error.ts +127 -0
  251. package/src/shared/errors/store-error.ts +68 -0
  252. package/src/shared/evidence-image.ts +37 -0
  253. package/src/shared/export.ts +31 -0
  254. package/src/shared/html/policy.ts +108 -0
  255. package/src/shared/html/style-vocabulary.ts +352 -0
  256. package/src/shared/logging/logger.ts +108 -0
  257. package/src/shared/logging/redact.ts +49 -0
  258. package/src/shared/security/frozen-csp.ts +13 -0
  259. package/src/shared/storage-version.ts +2 -0
  260. package/src/shared/tsx/execution.ts +29 -0
  261. package/src/shared/tsx/import-policy.ts +94 -0
  262. package/src/shared/util/dir-permissions.ts +94 -0
  263. package/src/shared/util/mermaid-nodes.ts +230 -0
  264. package/src/shared/util/process.ts +67 -0
  265. package/src/shared/util/time.ts +21 -0
  266. package/src/shared/version.ts +3 -0
  267. package/src/validation/sandbox/limits.ts +41 -0
  268. package/src/validation/sandbox/netns.ts +177 -0
  269. package/src/validation/tier0/chart.ts +177 -0
  270. package/src/validation/tier0/dom-shim.ts +54 -0
  271. package/src/validation/tier0/html.ts +408 -0
  272. package/src/validation/tier0/markdown.ts +285 -0
  273. package/src/validation/tier0/mermaid.ts +98 -0
  274. package/src/validation/tier0/runner.ts +504 -0
  275. package/src/validation/tier0/svg.ts +321 -0
  276. package/src/validation/tier0/tsx/allowlist-resolver.ts +77 -0
  277. package/src/validation/tier0/tsx/ast-policy-capabilities.ts +238 -0
  278. package/src/validation/tier0/tsx/ast-policy-shared.ts +71 -0
  279. package/src/validation/tier0/tsx/ast-policy.ts +181 -0
  280. package/src/validation/tier0/tsx/compiler.ts +156 -0
  281. package/src/validation/tier0/worker-dispatch.ts +211 -0
  282. package/src/validation/tier0/worker-entry.ts +96 -0
  283. package/src/validation/tier0/worker-input.ts +75 -0
  284. package/src/validation/tier1/browser-process.ts +147 -0
  285. package/src/validation/tier1/cdp-pipe.ts +281 -0
  286. package/src/validation/tier1/entries/chart.ts +5 -0
  287. package/src/validation/tier1/entries/html.ts +6 -0
  288. package/src/validation/tier1/entries/markdown.ts +5 -0
  289. package/src/validation/tier1/entries/mermaid.ts +5 -0
  290. package/src/validation/tier1/entries/svg.ts +5 -0
  291. package/src/validation/tier1/entries/tsx.ts +5 -0
  292. package/src/validation/tier1/frame-target.ts +162 -0
  293. package/src/validation/tier1/harness-entry.ts +261 -0
  294. package/src/validation/tier1/harness.ts +215 -0
  295. package/src/validation/tier1/isolated-probe.ts +94 -0
  296. package/src/validation/tier1/launcher.ts +177 -0
  297. package/src/validation/tier1/limits.ts +80 -0
  298. package/src/validation/tier1/nonce.ts +17 -0
  299. package/src/validation/tier1/protocol-probe.ts +519 -0
  300. package/src/validation/tier1/runner.ts +1122 -0
  301. package/src/validation/tier1/verdict.ts +246 -0
  302. package/src/validation/tier1/webp.ts +69 -0
  303. package/templates/README.md +88 -0
  304. package/templates/bar-compare.vl.json +63 -0
  305. package/templates/capacity-report.tsx +102 -0
  306. package/templates/decision-record.md +24 -0
  307. package/templates/deployment-state.mmd +40 -0
  308. package/templates/exemplar.md +91 -0
  309. package/templates/facet-story.tsx +799 -0
  310. package/templates/fleet-dashboard.html +141 -0
  311. package/templates/html-release-ledger.html +91 -0
  312. package/templates/html-status-report.html +114 -0
  313. package/templates/incident-console.tsx +147 -0
  314. package/templates/legion-boundaries.mmd +23 -0
  315. package/templates/legion-flow.mmd +15 -0
  316. package/templates/legion-sequence.mmd +14 -0
  317. package/templates/legion-state.mmd +7 -0
  318. package/templates/metric-card.svg +29 -0
  319. package/templates/observability-map.svg +101 -0
  320. package/templates/pipeline-audit.md +108 -0
  321. package/templates/release-metrics.vl.json +98 -0
  322. package/templates/service-topology.mmd +47 -0
  323. package/templates/status-report.md +32 -0
  324. package/templates/system-map.svg +53 -0
  325. package/templates/timeseries.vl.json +71 -0
  326. package/templates/tsx-interactive-counter.tsx +19 -0
  327. package/templates/tsx-status-report.tsx +31 -0
@@ -0,0 +1,1272 @@
1
+ import {
2
+ getIconStyles
3
+ } from "./markdown-v0x27twr.js";
4
+ import {
5
+ drawBackgroundRect,
6
+ drawRect,
7
+ drawText,
8
+ getNoteRect
9
+ } from "./markdown-hjp6sj8t.js";
10
+ import"./markdown-pzgd8z3s.js";
11
+ import {
12
+ clear,
13
+ configureSvgSize,
14
+ getAccDescription,
15
+ getAccTitle,
16
+ getConfig2,
17
+ getDiagramTitle,
18
+ setAccDescription,
19
+ setAccTitle,
20
+ setDiagramTitle
21
+ } from "./markdown-92n37gd4.js";
22
+ import {
23
+ select_default
24
+ } from "./markdown-xw8dsk8b.js";
25
+ import {
26
+ __name
27
+ } from "./markdown-1s5vwkf2.js";
28
+ import {
29
+ arc_default
30
+ } from "./markdown-dy5sgjhc.js";
31
+ import"./markdown-809k7q41.js";
32
+
33
+ // node_modules/mermaid/dist/chunks/mermaid.core/journeyDiagram-NVQOT4AX.mjs
34
+ var parser = function() {
35
+ var o = /* @__PURE__ */ __name(function(k, v, o2, l) {
36
+ for (o2 = o2 || {}, l = k.length;l--; o2[k[l]] = v)
37
+ ;
38
+ return o2;
39
+ }, "o"), $V0 = [6, 8, 10, 11, 12, 14, 16, 17, 18], $V1 = [1, 9], $V2 = [1, 10], $V3 = [1, 11], $V4 = [1, 12], $V5 = [1, 13], $V6 = [1, 14];
40
+ var parser2 = {
41
+ trace: /* @__PURE__ */ __name(function trace() {}, "trace"),
42
+ yy: {},
43
+ symbols_: { error: 2, start: 3, journey: 4, document: 5, EOF: 6, line: 7, SPACE: 8, statement: 9, NEWLINE: 10, title: 11, acc_title: 12, acc_title_value: 13, acc_descr: 14, acc_descr_value: 15, acc_descr_multiline_value: 16, section: 17, taskName: 18, taskData: 19, $accept: 0, $end: 1 },
44
+ terminals_: { 2: "error", 4: "journey", 6: "EOF", 8: "SPACE", 10: "NEWLINE", 11: "title", 12: "acc_title", 13: "acc_title_value", 14: "acc_descr", 15: "acc_descr_value", 16: "acc_descr_multiline_value", 17: "section", 18: "taskName", 19: "taskData" },
45
+ productions_: [0, [3, 3], [5, 0], [5, 2], [7, 2], [7, 1], [7, 1], [7, 1], [9, 1], [9, 2], [9, 2], [9, 1], [9, 1], [9, 2]],
46
+ performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
47
+ var $0 = $$.length - 1;
48
+ switch (yystate) {
49
+ case 1:
50
+ return $$[$0 - 1];
51
+ break;
52
+ case 2:
53
+ this.$ = [];
54
+ break;
55
+ case 3:
56
+ $$[$0 - 1].push($$[$0]);
57
+ this.$ = $$[$0 - 1];
58
+ break;
59
+ case 4:
60
+ case 5:
61
+ this.$ = $$[$0];
62
+ break;
63
+ case 6:
64
+ case 7:
65
+ this.$ = [];
66
+ break;
67
+ case 8:
68
+ yy.setDiagramTitle($$[$0].substr(6));
69
+ this.$ = $$[$0].substr(6);
70
+ break;
71
+ case 9:
72
+ this.$ = $$[$0].trim();
73
+ yy.setAccTitle(this.$);
74
+ break;
75
+ case 10:
76
+ case 11:
77
+ this.$ = $$[$0].trim();
78
+ yy.setAccDescription(this.$);
79
+ break;
80
+ case 12:
81
+ yy.addSection($$[$0].substr(8));
82
+ this.$ = $$[$0].substr(8);
83
+ break;
84
+ case 13:
85
+ yy.addTask($$[$0 - 1], $$[$0]);
86
+ this.$ = "task";
87
+ break;
88
+ }
89
+ }, "anonymous"),
90
+ table: [{ 3: 1, 4: [1, 2] }, { 1: [3] }, o($V0, [2, 2], { 5: 3 }), { 6: [1, 4], 7: 5, 8: [1, 6], 9: 7, 10: [1, 8], 11: $V1, 12: $V2, 14: $V3, 16: $V4, 17: $V5, 18: $V6 }, o($V0, [2, 7], { 1: [2, 1] }), o($V0, [2, 3]), { 9: 15, 11: $V1, 12: $V2, 14: $V3, 16: $V4, 17: $V5, 18: $V6 }, o($V0, [2, 5]), o($V0, [2, 6]), o($V0, [2, 8]), { 13: [1, 16] }, { 15: [1, 17] }, o($V0, [2, 11]), o($V0, [2, 12]), { 19: [1, 18] }, o($V0, [2, 4]), o($V0, [2, 9]), o($V0, [2, 10]), o($V0, [2, 13])],
91
+ defaultActions: {},
92
+ parseError: /* @__PURE__ */ __name(function parseError(str, hash) {
93
+ if (hash.recoverable) {
94
+ this.trace(str);
95
+ } else {
96
+ var error = new Error(str);
97
+ error.hash = hash;
98
+ throw error;
99
+ }
100
+ }, "parseError"),
101
+ parse: /* @__PURE__ */ __name(function parse(input) {
102
+ var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
103
+ var args = lstack.slice.call(arguments, 1);
104
+ var lexer2 = Object.create(this.lexer);
105
+ var sharedState = { yy: {} };
106
+ for (var k in this.yy) {
107
+ if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
108
+ sharedState.yy[k] = this.yy[k];
109
+ }
110
+ }
111
+ lexer2.setInput(input, sharedState.yy);
112
+ sharedState.yy.lexer = lexer2;
113
+ sharedState.yy.parser = this;
114
+ if (typeof lexer2.yylloc == "undefined") {
115
+ lexer2.yylloc = {};
116
+ }
117
+ var yyloc = lexer2.yylloc;
118
+ lstack.push(yyloc);
119
+ var ranges = lexer2.options && lexer2.options.ranges;
120
+ if (typeof sharedState.yy.parseError === "function") {
121
+ this.parseError = sharedState.yy.parseError;
122
+ } else {
123
+ this.parseError = Object.getPrototypeOf(this).parseError;
124
+ }
125
+ function popStack(n) {
126
+ stack.length = stack.length - 2 * n;
127
+ vstack.length = vstack.length - n;
128
+ lstack.length = lstack.length - n;
129
+ }
130
+ __name(popStack, "popStack");
131
+ function lex() {
132
+ var token;
133
+ token = tstack.pop() || lexer2.lex() || EOF;
134
+ if (typeof token !== "number") {
135
+ if (token instanceof Array) {
136
+ tstack = token;
137
+ token = tstack.pop();
138
+ }
139
+ token = self.symbols_[token] || token;
140
+ }
141
+ return token;
142
+ }
143
+ __name(lex, "lex");
144
+ var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
145
+ while (true) {
146
+ state = stack[stack.length - 1];
147
+ if (this.defaultActions[state]) {
148
+ action = this.defaultActions[state];
149
+ } else {
150
+ if (symbol === null || typeof symbol == "undefined") {
151
+ symbol = lex();
152
+ }
153
+ action = table[state] && table[state][symbol];
154
+ }
155
+ if (typeof action === "undefined" || !action.length || !action[0]) {
156
+ var errStr = "";
157
+ expected = [];
158
+ for (p in table[state]) {
159
+ if (this.terminals_[p] && p > TERROR) {
160
+ expected.push("'" + this.terminals_[p] + "'");
161
+ }
162
+ }
163
+ if (lexer2.showPosition) {
164
+ errStr = "Parse error on line " + (yylineno + 1) + `:
165
+ ` + lexer2.showPosition() + `
166
+ Expecting ` + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
167
+ } else {
168
+ errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
169
+ }
170
+ this.parseError(errStr, {
171
+ text: lexer2.match,
172
+ token: this.terminals_[symbol] || symbol,
173
+ line: lexer2.yylineno,
174
+ loc: yyloc,
175
+ expected
176
+ });
177
+ }
178
+ if (action[0] instanceof Array && action.length > 1) {
179
+ throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
180
+ }
181
+ switch (action[0]) {
182
+ case 1:
183
+ stack.push(symbol);
184
+ vstack.push(lexer2.yytext);
185
+ lstack.push(lexer2.yylloc);
186
+ stack.push(action[1]);
187
+ symbol = null;
188
+ if (!preErrorSymbol) {
189
+ yyleng = lexer2.yyleng;
190
+ yytext = lexer2.yytext;
191
+ yylineno = lexer2.yylineno;
192
+ yyloc = lexer2.yylloc;
193
+ if (recovering > 0) {
194
+ recovering--;
195
+ }
196
+ } else {
197
+ symbol = preErrorSymbol;
198
+ preErrorSymbol = null;
199
+ }
200
+ break;
201
+ case 2:
202
+ len = this.productions_[action[1]][1];
203
+ yyval.$ = vstack[vstack.length - len];
204
+ yyval._$ = {
205
+ first_line: lstack[lstack.length - (len || 1)].first_line,
206
+ last_line: lstack[lstack.length - 1].last_line,
207
+ first_column: lstack[lstack.length - (len || 1)].first_column,
208
+ last_column: lstack[lstack.length - 1].last_column
209
+ };
210
+ if (ranges) {
211
+ yyval._$.range = [
212
+ lstack[lstack.length - (len || 1)].range[0],
213
+ lstack[lstack.length - 1].range[1]
214
+ ];
215
+ }
216
+ r = this.performAction.apply(yyval, [
217
+ yytext,
218
+ yyleng,
219
+ yylineno,
220
+ sharedState.yy,
221
+ action[1],
222
+ vstack,
223
+ lstack
224
+ ].concat(args));
225
+ if (typeof r !== "undefined") {
226
+ return r;
227
+ }
228
+ if (len) {
229
+ stack = stack.slice(0, -1 * len * 2);
230
+ vstack = vstack.slice(0, -1 * len);
231
+ lstack = lstack.slice(0, -1 * len);
232
+ }
233
+ stack.push(this.productions_[action[1]][0]);
234
+ vstack.push(yyval.$);
235
+ lstack.push(yyval._$);
236
+ newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
237
+ stack.push(newState);
238
+ break;
239
+ case 3:
240
+ return true;
241
+ }
242
+ }
243
+ return true;
244
+ }, "parse")
245
+ };
246
+ var lexer = /* @__PURE__ */ function() {
247
+ var lexer2 = {
248
+ EOF: 1,
249
+ parseError: /* @__PURE__ */ __name(function parseError(str, hash) {
250
+ if (this.yy.parser) {
251
+ this.yy.parser.parseError(str, hash);
252
+ } else {
253
+ throw new Error(str);
254
+ }
255
+ }, "parseError"),
256
+ setInput: /* @__PURE__ */ __name(function(input, yy) {
257
+ this.yy = yy || this.yy || {};
258
+ this._input = input;
259
+ this._more = this._backtrack = this.done = false;
260
+ this.yylineno = this.yyleng = 0;
261
+ this.yytext = this.matched = this.match = "";
262
+ this.conditionStack = ["INITIAL"];
263
+ this.yylloc = {
264
+ first_line: 1,
265
+ first_column: 0,
266
+ last_line: 1,
267
+ last_column: 0
268
+ };
269
+ if (this.options.ranges) {
270
+ this.yylloc.range = [0, 0];
271
+ }
272
+ this.offset = 0;
273
+ return this;
274
+ }, "setInput"),
275
+ input: /* @__PURE__ */ __name(function() {
276
+ var ch = this._input[0];
277
+ this.yytext += ch;
278
+ this.yyleng++;
279
+ this.offset++;
280
+ this.match += ch;
281
+ this.matched += ch;
282
+ var lines = ch.match(/(?:\r\n?|\n).*/g);
283
+ if (lines) {
284
+ this.yylineno++;
285
+ this.yylloc.last_line++;
286
+ } else {
287
+ this.yylloc.last_column++;
288
+ }
289
+ if (this.options.ranges) {
290
+ this.yylloc.range[1]++;
291
+ }
292
+ this._input = this._input.slice(1);
293
+ return ch;
294
+ }, "input"),
295
+ unput: /* @__PURE__ */ __name(function(ch) {
296
+ var len = ch.length;
297
+ var lines = ch.split(/(?:\r\n?|\n)/g);
298
+ this._input = ch + this._input;
299
+ this.yytext = this.yytext.substr(0, this.yytext.length - len);
300
+ this.offset -= len;
301
+ var oldLines = this.match.split(/(?:\r\n?|\n)/g);
302
+ this.match = this.match.substr(0, this.match.length - 1);
303
+ this.matched = this.matched.substr(0, this.matched.length - 1);
304
+ if (lines.length - 1) {
305
+ this.yylineno -= lines.length - 1;
306
+ }
307
+ var r = this.yylloc.range;
308
+ this.yylloc = {
309
+ first_line: this.yylloc.first_line,
310
+ last_line: this.yylineno + 1,
311
+ first_column: this.yylloc.first_column,
312
+ 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
313
+ };
314
+ if (this.options.ranges) {
315
+ this.yylloc.range = [r[0], r[0] + this.yyleng - len];
316
+ }
317
+ this.yyleng = this.yytext.length;
318
+ return this;
319
+ }, "unput"),
320
+ more: /* @__PURE__ */ __name(function() {
321
+ this._more = true;
322
+ return this;
323
+ }, "more"),
324
+ reject: /* @__PURE__ */ __name(function() {
325
+ if (this.options.backtrack_lexer) {
326
+ this._backtrack = true;
327
+ } else {
328
+ 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).
329
+ ` + this.showPosition(), {
330
+ text: "",
331
+ token: null,
332
+ line: this.yylineno
333
+ });
334
+ }
335
+ return this;
336
+ }, "reject"),
337
+ less: /* @__PURE__ */ __name(function(n) {
338
+ this.unput(this.match.slice(n));
339
+ }, "less"),
340
+ pastInput: /* @__PURE__ */ __name(function() {
341
+ var past = this.matched.substr(0, this.matched.length - this.match.length);
342
+ return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
343
+ }, "pastInput"),
344
+ upcomingInput: /* @__PURE__ */ __name(function() {
345
+ var next = this.match;
346
+ if (next.length < 20) {
347
+ next += this._input.substr(0, 20 - next.length);
348
+ }
349
+ return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
350
+ }, "upcomingInput"),
351
+ showPosition: /* @__PURE__ */ __name(function() {
352
+ var pre = this.pastInput();
353
+ var c = new Array(pre.length + 1).join("-");
354
+ return pre + this.upcomingInput() + `
355
+ ` + c + "^";
356
+ }, "showPosition"),
357
+ test_match: /* @__PURE__ */ __name(function(match, indexed_rule) {
358
+ var token, lines, backup;
359
+ if (this.options.backtrack_lexer) {
360
+ backup = {
361
+ yylineno: this.yylineno,
362
+ yylloc: {
363
+ first_line: this.yylloc.first_line,
364
+ last_line: this.last_line,
365
+ first_column: this.yylloc.first_column,
366
+ last_column: this.yylloc.last_column
367
+ },
368
+ yytext: this.yytext,
369
+ match: this.match,
370
+ matches: this.matches,
371
+ matched: this.matched,
372
+ yyleng: this.yyleng,
373
+ offset: this.offset,
374
+ _more: this._more,
375
+ _input: this._input,
376
+ yy: this.yy,
377
+ conditionStack: this.conditionStack.slice(0),
378
+ done: this.done
379
+ };
380
+ if (this.options.ranges) {
381
+ backup.yylloc.range = this.yylloc.range.slice(0);
382
+ }
383
+ }
384
+ lines = match[0].match(/(?:\r\n?|\n).*/g);
385
+ if (lines) {
386
+ this.yylineno += lines.length;
387
+ }
388
+ this.yylloc = {
389
+ first_line: this.yylloc.last_line,
390
+ last_line: this.yylineno + 1,
391
+ first_column: this.yylloc.last_column,
392
+ last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length
393
+ };
394
+ this.yytext += match[0];
395
+ this.match += match[0];
396
+ this.matches = match;
397
+ this.yyleng = this.yytext.length;
398
+ if (this.options.ranges) {
399
+ this.yylloc.range = [this.offset, this.offset += this.yyleng];
400
+ }
401
+ this._more = false;
402
+ this._backtrack = false;
403
+ this._input = this._input.slice(match[0].length);
404
+ this.matched += match[0];
405
+ token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
406
+ if (this.done && this._input) {
407
+ this.done = false;
408
+ }
409
+ if (token) {
410
+ return token;
411
+ } else if (this._backtrack) {
412
+ for (var k in backup) {
413
+ this[k] = backup[k];
414
+ }
415
+ return false;
416
+ }
417
+ return false;
418
+ }, "test_match"),
419
+ next: /* @__PURE__ */ __name(function() {
420
+ if (this.done) {
421
+ return this.EOF;
422
+ }
423
+ if (!this._input) {
424
+ this.done = true;
425
+ }
426
+ var token, match, tempMatch, index;
427
+ if (!this._more) {
428
+ this.yytext = "";
429
+ this.match = "";
430
+ }
431
+ var rules = this._currentRules();
432
+ for (var i = 0;i < rules.length; i++) {
433
+ tempMatch = this._input.match(this.rules[rules[i]]);
434
+ if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
435
+ match = tempMatch;
436
+ index = i;
437
+ if (this.options.backtrack_lexer) {
438
+ token = this.test_match(tempMatch, rules[i]);
439
+ if (token !== false) {
440
+ return token;
441
+ } else if (this._backtrack) {
442
+ match = false;
443
+ continue;
444
+ } else {
445
+ return false;
446
+ }
447
+ } else if (!this.options.flex) {
448
+ break;
449
+ }
450
+ }
451
+ }
452
+ if (match) {
453
+ token = this.test_match(match, rules[index]);
454
+ if (token !== false) {
455
+ return token;
456
+ }
457
+ return false;
458
+ }
459
+ if (this._input === "") {
460
+ return this.EOF;
461
+ } else {
462
+ return this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
463
+ ` + this.showPosition(), {
464
+ text: "",
465
+ token: null,
466
+ line: this.yylineno
467
+ });
468
+ }
469
+ }, "next"),
470
+ lex: /* @__PURE__ */ __name(function lex() {
471
+ var r = this.next();
472
+ if (r) {
473
+ return r;
474
+ } else {
475
+ return this.lex();
476
+ }
477
+ }, "lex"),
478
+ begin: /* @__PURE__ */ __name(function begin(condition) {
479
+ this.conditionStack.push(condition);
480
+ }, "begin"),
481
+ popState: /* @__PURE__ */ __name(function popState() {
482
+ var n = this.conditionStack.length - 1;
483
+ if (n > 0) {
484
+ return this.conditionStack.pop();
485
+ } else {
486
+ return this.conditionStack[0];
487
+ }
488
+ }, "popState"),
489
+ _currentRules: /* @__PURE__ */ __name(function _currentRules() {
490
+ if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
491
+ return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
492
+ } else {
493
+ return this.conditions["INITIAL"].rules;
494
+ }
495
+ }, "_currentRules"),
496
+ topState: /* @__PURE__ */ __name(function topState(n) {
497
+ n = this.conditionStack.length - 1 - Math.abs(n || 0);
498
+ if (n >= 0) {
499
+ return this.conditionStack[n];
500
+ } else {
501
+ return "INITIAL";
502
+ }
503
+ }, "topState"),
504
+ pushState: /* @__PURE__ */ __name(function pushState(condition) {
505
+ this.begin(condition);
506
+ }, "pushState"),
507
+ stateStackSize: /* @__PURE__ */ __name(function stateStackSize() {
508
+ return this.conditionStack.length;
509
+ }, "stateStackSize"),
510
+ options: { "case-insensitive": true },
511
+ performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
512
+ var YYSTATE = YY_START;
513
+ switch ($avoiding_name_collisions) {
514
+ case 0:
515
+ break;
516
+ case 1:
517
+ break;
518
+ case 2:
519
+ return 10;
520
+ break;
521
+ case 3:
522
+ break;
523
+ case 4:
524
+ break;
525
+ case 5:
526
+ return 4;
527
+ break;
528
+ case 6:
529
+ return 11;
530
+ break;
531
+ case 7:
532
+ this.begin("acc_title");
533
+ return 12;
534
+ break;
535
+ case 8:
536
+ this.popState();
537
+ return "acc_title_value";
538
+ break;
539
+ case 9:
540
+ this.begin("acc_descr");
541
+ return 14;
542
+ break;
543
+ case 10:
544
+ this.popState();
545
+ return "acc_descr_value";
546
+ break;
547
+ case 11:
548
+ this.begin("acc_descr_multiline");
549
+ break;
550
+ case 12:
551
+ this.popState();
552
+ break;
553
+ case 13:
554
+ return "acc_descr_multiline_value";
555
+ break;
556
+ case 14:
557
+ return 17;
558
+ break;
559
+ case 15:
560
+ return 18;
561
+ break;
562
+ case 16:
563
+ return 19;
564
+ break;
565
+ case 17:
566
+ return ":";
567
+ break;
568
+ case 18:
569
+ return 6;
570
+ break;
571
+ case 19:
572
+ return "INVALID";
573
+ break;
574
+ }
575
+ }, "anonymous"),
576
+ rules: [/^(?:%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:[\n]+)/i, /^(?:\s+)/i, /^(?:#[^\n]*)/i, /^(?:journey\b)/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, /^(?:section\s[^#:\n;]+)/i, /^(?:[^#:\n;]+)/i, /^(?::[^#\n;]+)/i, /^(?::)/i, /^(?:$)/i, /^(?:.)/i],
577
+ conditions: { acc_descr_multiline: { rules: [12, 13], inclusive: false }, acc_descr: { rules: [10], inclusive: false }, acc_title: { rules: [8], inclusive: false }, INITIAL: { rules: [0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 18, 19], inclusive: true } }
578
+ };
579
+ return lexer2;
580
+ }();
581
+ parser2.lexer = lexer;
582
+ function Parser() {
583
+ this.yy = {};
584
+ }
585
+ __name(Parser, "Parser");
586
+ Parser.prototype = parser2;
587
+ parser2.Parser = Parser;
588
+ return new Parser;
589
+ }();
590
+ parser.parser = parser;
591
+ var journey_default = parser;
592
+ var currentSection = "";
593
+ var sections = [];
594
+ var tasks = [];
595
+ var rawTasks = [];
596
+ var clear2 = /* @__PURE__ */ __name(function() {
597
+ sections.length = 0;
598
+ tasks.length = 0;
599
+ currentSection = "";
600
+ rawTasks.length = 0;
601
+ clear();
602
+ }, "clear");
603
+ var addSection = /* @__PURE__ */ __name(function(txt) {
604
+ currentSection = txt;
605
+ sections.push(txt);
606
+ }, "addSection");
607
+ var getSections = /* @__PURE__ */ __name(function() {
608
+ return sections;
609
+ }, "getSections");
610
+ var getTasks = /* @__PURE__ */ __name(function() {
611
+ let allItemsProcessed = compileTasks();
612
+ const maxDepth = 100;
613
+ let iterationCount = 0;
614
+ while (!allItemsProcessed && iterationCount < maxDepth) {
615
+ allItemsProcessed = compileTasks();
616
+ iterationCount++;
617
+ }
618
+ tasks.push(...rawTasks);
619
+ return tasks;
620
+ }, "getTasks");
621
+ var updateActors = /* @__PURE__ */ __name(function() {
622
+ const tempActors = [];
623
+ tasks.forEach((task) => {
624
+ if (task.people) {
625
+ tempActors.push(...task.people);
626
+ }
627
+ });
628
+ const unique = new Set(tempActors);
629
+ return [...unique].sort();
630
+ }, "updateActors");
631
+ var addTask = /* @__PURE__ */ __name(function(descr, taskData) {
632
+ const pieces = taskData.substr(1).split(":");
633
+ let score = 0;
634
+ let peeps = [];
635
+ if (pieces.length === 1) {
636
+ score = Number(pieces[0]);
637
+ peeps = [];
638
+ } else {
639
+ score = Number(pieces[0]);
640
+ peeps = pieces[1].split(",");
641
+ }
642
+ const peopleList = peeps.map((s) => s.trim());
643
+ const rawTask = {
644
+ section: currentSection,
645
+ type: currentSection,
646
+ people: peopleList,
647
+ task: descr,
648
+ score
649
+ };
650
+ rawTasks.push(rawTask);
651
+ }, "addTask");
652
+ var addTaskOrg = /* @__PURE__ */ __name(function(descr) {
653
+ const newTask = {
654
+ section: currentSection,
655
+ type: currentSection,
656
+ description: descr,
657
+ task: descr,
658
+ classes: []
659
+ };
660
+ tasks.push(newTask);
661
+ }, "addTaskOrg");
662
+ var compileTasks = /* @__PURE__ */ __name(function() {
663
+ const compileTask = /* @__PURE__ */ __name(function(pos) {
664
+ return rawTasks[pos].processed;
665
+ }, "compileTask");
666
+ let allProcessed = true;
667
+ for (const [i, rawTask] of rawTasks.entries()) {
668
+ compileTask(i);
669
+ allProcessed = allProcessed && rawTask.processed;
670
+ }
671
+ return allProcessed;
672
+ }, "compileTasks");
673
+ var getActors = /* @__PURE__ */ __name(function() {
674
+ return updateActors();
675
+ }, "getActors");
676
+ var journeyDb_default = {
677
+ getConfig: /* @__PURE__ */ __name(() => getConfig2().journey, "getConfig"),
678
+ clear: clear2,
679
+ setDiagramTitle,
680
+ getDiagramTitle,
681
+ setAccTitle,
682
+ getAccTitle,
683
+ setAccDescription,
684
+ getAccDescription,
685
+ addSection,
686
+ getSections,
687
+ getTasks,
688
+ addTask,
689
+ addTaskOrg,
690
+ getActors
691
+ };
692
+ var getStyles = /* @__PURE__ */ __name((options) => `.label {
693
+ font-family: ${options.fontFamily};
694
+ color: ${options.textColor};
695
+ }
696
+ .mouth {
697
+ stroke: #666;
698
+ }
699
+
700
+ line {
701
+ stroke: ${options.textColor}
702
+ }
703
+
704
+ .legend {
705
+ fill: ${options.textColor};
706
+ font-family: ${options.fontFamily};
707
+ }
708
+
709
+ .label text {
710
+ fill: #333;
711
+ }
712
+ .label {
713
+ color: ${options.textColor}
714
+ }
715
+
716
+ .face {
717
+ ${options.faceColor ? `fill: ${options.faceColor}` : "fill: #FFF8DC"};
718
+ stroke: #999;
719
+ }
720
+
721
+ .node rect,
722
+ .node circle,
723
+ .node ellipse,
724
+ .node polygon,
725
+ .node path {
726
+ fill: ${options.mainBkg};
727
+ stroke: ${options.nodeBorder};
728
+ stroke-width: 1px;
729
+ }
730
+
731
+ .node .label {
732
+ text-align: center;
733
+ }
734
+ .node.clickable {
735
+ cursor: pointer;
736
+ }
737
+
738
+ .arrowheadPath {
739
+ fill: ${options.arrowheadColor};
740
+ }
741
+
742
+ .edgePath .path {
743
+ stroke: ${options.lineColor};
744
+ stroke-width: 1.5px;
745
+ }
746
+
747
+ .flowchart-link {
748
+ stroke: ${options.lineColor};
749
+ fill: none;
750
+ }
751
+
752
+ .edgeLabel {
753
+ background-color: ${options.edgeLabelBackground};
754
+ rect {
755
+ opacity: 0.5;
756
+ }
757
+ text-align: center;
758
+ }
759
+
760
+ .cluster rect {
761
+ }
762
+
763
+ .cluster text {
764
+ fill: ${options.titleColor};
765
+ }
766
+
767
+ div.mermaidTooltip {
768
+ position: absolute;
769
+ text-align: center;
770
+ max-width: 200px;
771
+ padding: 2px;
772
+ font-family: ${options.fontFamily};
773
+ font-size: 12px;
774
+ background: ${options.tertiaryColor};
775
+ border: 1px solid ${options.border2};
776
+ border-radius: 2px;
777
+ pointer-events: none;
778
+ z-index: 100;
779
+ }
780
+
781
+ .task-type-0, .section-type-0 {
782
+ ${options.fillType0 ? `fill: ${options.fillType0}` : ""};
783
+ }
784
+ .task-type-1, .section-type-1 {
785
+ ${options.fillType0 ? `fill: ${options.fillType1}` : ""};
786
+ }
787
+ .task-type-2, .section-type-2 {
788
+ ${options.fillType0 ? `fill: ${options.fillType2}` : ""};
789
+ }
790
+ .task-type-3, .section-type-3 {
791
+ ${options.fillType0 ? `fill: ${options.fillType3}` : ""};
792
+ }
793
+ .task-type-4, .section-type-4 {
794
+ ${options.fillType0 ? `fill: ${options.fillType4}` : ""};
795
+ }
796
+ .task-type-5, .section-type-5 {
797
+ ${options.fillType0 ? `fill: ${options.fillType5}` : ""};
798
+ }
799
+ .task-type-6, .section-type-6 {
800
+ ${options.fillType0 ? `fill: ${options.fillType6}` : ""};
801
+ }
802
+ .task-type-7, .section-type-7 {
803
+ ${options.fillType0 ? `fill: ${options.fillType7}` : ""};
804
+ }
805
+
806
+ .actor-0 {
807
+ ${options.actor0 ? `fill: ${options.actor0}` : ""};
808
+ }
809
+ .actor-1 {
810
+ ${options.actor1 ? `fill: ${options.actor1}` : ""};
811
+ }
812
+ .actor-2 {
813
+ ${options.actor2 ? `fill: ${options.actor2}` : ""};
814
+ }
815
+ .actor-3 {
816
+ ${options.actor3 ? `fill: ${options.actor3}` : ""};
817
+ }
818
+ .actor-4 {
819
+ ${options.actor4 ? `fill: ${options.actor4}` : ""};
820
+ }
821
+ .actor-5 {
822
+ ${options.actor5 ? `fill: ${options.actor5}` : ""};
823
+ }
824
+ ${getIconStyles()}
825
+ `, "getStyles");
826
+ var styles_default = getStyles;
827
+ var drawRect2 = /* @__PURE__ */ __name(function(elem, rectData) {
828
+ return drawRect(elem, rectData);
829
+ }, "drawRect");
830
+ var drawFace = /* @__PURE__ */ __name(function(element, faceData) {
831
+ const radius = 15;
832
+ const circleElement = element.append("circle").attr("cx", faceData.cx).attr("cy", faceData.cy).attr("class", "face").attr("r", radius).attr("stroke-width", 2).attr("overflow", "visible");
833
+ const face = element.append("g");
834
+ face.append("circle").attr("cx", faceData.cx - radius / 3).attr("cy", faceData.cy - radius / 3).attr("r", 1.5).attr("stroke-width", 2).attr("fill", "#666").attr("stroke", "#666");
835
+ face.append("circle").attr("cx", faceData.cx + radius / 3).attr("cy", faceData.cy - radius / 3).attr("r", 1.5).attr("stroke-width", 2).attr("fill", "#666").attr("stroke", "#666");
836
+ function smile(face2) {
837
+ const arc = arc_default().startAngle(Math.PI / 2).endAngle(3 * (Math.PI / 2)).innerRadius(radius / 2).outerRadius(radius / 2.2);
838
+ face2.append("path").attr("class", "mouth").attr("d", arc).attr("transform", "translate(" + faceData.cx + "," + (faceData.cy + 2) + ")");
839
+ }
840
+ __name(smile, "smile");
841
+ function sad(face2) {
842
+ const arc = arc_default().startAngle(3 * Math.PI / 2).endAngle(5 * (Math.PI / 2)).innerRadius(radius / 2).outerRadius(radius / 2.2);
843
+ face2.append("path").attr("class", "mouth").attr("d", arc).attr("transform", "translate(" + faceData.cx + "," + (faceData.cy + 7) + ")");
844
+ }
845
+ __name(sad, "sad");
846
+ function ambivalent(face2) {
847
+ face2.append("line").attr("class", "mouth").attr("stroke", 2).attr("x1", faceData.cx - 5).attr("y1", faceData.cy + 7).attr("x2", faceData.cx + 5).attr("y2", faceData.cy + 7).attr("class", "mouth").attr("stroke-width", "1px").attr("stroke", "#666");
848
+ }
849
+ __name(ambivalent, "ambivalent");
850
+ if (faceData.score > 3) {
851
+ smile(face);
852
+ } else if (faceData.score < 3) {
853
+ sad(face);
854
+ } else {
855
+ ambivalent(face);
856
+ }
857
+ return circleElement;
858
+ }, "drawFace");
859
+ var drawCircle = /* @__PURE__ */ __name(function(element, circleData) {
860
+ const circleElement = element.append("circle");
861
+ circleElement.attr("cx", circleData.cx);
862
+ circleElement.attr("cy", circleData.cy);
863
+ circleElement.attr("class", "actor-" + circleData.pos);
864
+ circleElement.attr("fill", circleData.fill);
865
+ circleElement.attr("stroke", circleData.stroke);
866
+ circleElement.attr("r", circleData.r);
867
+ if (circleElement.class !== undefined) {
868
+ circleElement.attr("class", circleElement.class);
869
+ }
870
+ if (circleData.title !== undefined) {
871
+ circleElement.append("title").text(circleData.title);
872
+ }
873
+ return circleElement;
874
+ }, "drawCircle");
875
+ var drawText2 = /* @__PURE__ */ __name(function(elem, textData) {
876
+ return drawText(elem, textData);
877
+ }, "drawText");
878
+ var drawLabel = /* @__PURE__ */ __name(function(elem, txtObject) {
879
+ function genPoints(x, y, width, height, cut) {
880
+ return x + "," + y + " " + (x + width) + "," + y + " " + (x + width) + "," + (y + height - cut) + " " + (x + width - cut * 1.2) + "," + (y + height) + " " + x + "," + (y + height);
881
+ }
882
+ __name(genPoints, "genPoints");
883
+ const polygon = elem.append("polygon");
884
+ polygon.attr("points", genPoints(txtObject.x, txtObject.y, 50, 20, 7));
885
+ polygon.attr("class", "labelBox");
886
+ txtObject.y = txtObject.y + txtObject.labelMargin;
887
+ txtObject.x = txtObject.x + 0.5 * txtObject.labelMargin;
888
+ drawText2(elem, txtObject);
889
+ }, "drawLabel");
890
+ var drawSection = /* @__PURE__ */ __name(function(elem, section, conf2) {
891
+ const g = elem.append("g");
892
+ const rect = getNoteRect();
893
+ rect.x = section.x;
894
+ rect.y = section.y;
895
+ rect.fill = section.fill;
896
+ rect.width = conf2.width * section.taskCount + conf2.diagramMarginX * (section.taskCount - 1);
897
+ rect.height = conf2.height;
898
+ rect.class = "journey-section section-type-" + section.num;
899
+ rect.rx = 3;
900
+ rect.ry = 3;
901
+ drawRect2(g, rect);
902
+ _drawTextCandidateFunc(conf2)(section.text, g, rect.x, rect.y, rect.width, rect.height, { class: "journey-section section-type-" + section.num }, conf2, section.colour);
903
+ }, "drawSection");
904
+ var taskCount = -1;
905
+ var drawTask = /* @__PURE__ */ __name(function(elem, task, conf2, diagramId) {
906
+ const center = task.x + conf2.width / 2;
907
+ const g = elem.append("g");
908
+ taskCount++;
909
+ const maxHeight = 300 + 5 * 30;
910
+ g.append("line").attr("id", diagramId + "-task" + taskCount).attr("x1", center).attr("y1", task.y).attr("x2", center).attr("y2", maxHeight).attr("class", "task-line").attr("stroke-width", "1px").attr("stroke-dasharray", "4 2").attr("stroke", "#666");
911
+ drawFace(g, {
912
+ cx: center,
913
+ cy: 300 + (5 - task.score) * 30,
914
+ score: task.score
915
+ });
916
+ const rect = getNoteRect();
917
+ rect.x = task.x;
918
+ rect.y = task.y;
919
+ rect.fill = task.fill;
920
+ rect.width = conf2.width;
921
+ rect.height = conf2.height;
922
+ rect.class = "task task-type-" + task.num;
923
+ rect.rx = 3;
924
+ rect.ry = 3;
925
+ drawRect2(g, rect);
926
+ let xPos = task.x + 14;
927
+ task.people.forEach((person) => {
928
+ const colour = task.actors[person].color;
929
+ const circle = {
930
+ cx: xPos,
931
+ cy: task.y,
932
+ r: 7,
933
+ fill: colour,
934
+ stroke: "#000",
935
+ title: person,
936
+ pos: task.actors[person].position
937
+ };
938
+ drawCircle(g, circle);
939
+ xPos += 10;
940
+ });
941
+ _drawTextCandidateFunc(conf2)(task.task, g, rect.x, rect.y, rect.width, rect.height, { class: "task" }, conf2, task.colour);
942
+ }, "drawTask");
943
+ var drawBackgroundRect2 = /* @__PURE__ */ __name(function(elem, bounds2) {
944
+ drawBackgroundRect(elem, bounds2);
945
+ }, "drawBackgroundRect");
946
+ var _drawTextCandidateFunc = /* @__PURE__ */ function() {
947
+ function byText(content, g, x, y, width, height, textAttrs, colour) {
948
+ const text = g.append("text").attr("x", x + width / 2).attr("y", y + height / 2 + 5).style("font-color", colour).style("text-anchor", "middle").text(content);
949
+ _setTextAttrs(text, textAttrs);
950
+ }
951
+ __name(byText, "byText");
952
+ function byTspan(content, g, x, y, width, height, textAttrs, conf2, colour) {
953
+ const { taskFontSize, taskFontFamily } = conf2;
954
+ const lines = content.split(/<br\s*\/?>/gi);
955
+ for (let i = 0;i < lines.length; i++) {
956
+ const dy = i * taskFontSize - taskFontSize * (lines.length - 1) / 2;
957
+ const text = g.append("text").attr("x", x + width / 2).attr("y", y).attr("fill", colour).style("text-anchor", "middle").style("font-size", taskFontSize).style("font-family", taskFontFamily);
958
+ text.append("tspan").attr("x", x + width / 2).attr("dy", dy).text(lines[i]);
959
+ text.attr("y", y + height / 2).attr("dominant-baseline", "central").attr("alignment-baseline", "central");
960
+ _setTextAttrs(text, textAttrs);
961
+ }
962
+ }
963
+ __name(byTspan, "byTspan");
964
+ function byFo(content, g, x, y, width, height, textAttrs, conf2) {
965
+ const body = g.append("switch");
966
+ const f = body.append("foreignObject").attr("x", x).attr("y", y).attr("width", width).attr("height", height).attr("position", "fixed");
967
+ const text = f.append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%");
968
+ text.append("div").attr("class", "label").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(content);
969
+ byTspan(content, body, x, y, width, height, textAttrs, conf2);
970
+ _setTextAttrs(text, textAttrs);
971
+ }
972
+ __name(byFo, "byFo");
973
+ function _setTextAttrs(toText, fromTextAttrsDict) {
974
+ for (const key in fromTextAttrsDict) {
975
+ if (key in fromTextAttrsDict) {
976
+ toText.attr(key, fromTextAttrsDict[key]);
977
+ }
978
+ }
979
+ }
980
+ __name(_setTextAttrs, "_setTextAttrs");
981
+ return function(conf2) {
982
+ return conf2.textPlacement === "fo" ? byFo : conf2.textPlacement === "old" ? byText : byTspan;
983
+ };
984
+ }();
985
+ var initGraphics = /* @__PURE__ */ __name(function(graphics, id) {
986
+ taskCount = -1;
987
+ graphics.append("defs").append("marker").attr("id", id + "-arrowhead").attr("refX", 5).attr("refY", 2).attr("markerWidth", 6).attr("markerHeight", 4).attr("orient", "auto").append("path").attr("d", "M 0,0 V 4 L6,2 Z");
988
+ }, "initGraphics");
989
+ var svgDraw_default = {
990
+ drawRect: drawRect2,
991
+ drawCircle,
992
+ drawSection,
993
+ drawText: drawText2,
994
+ drawLabel,
995
+ drawTask,
996
+ drawBackgroundRect: drawBackgroundRect2,
997
+ initGraphics
998
+ };
999
+ var setConf = /* @__PURE__ */ __name(function(cnf) {
1000
+ const keys = Object.keys(cnf);
1001
+ keys.forEach(function(key) {
1002
+ conf[key] = cnf[key];
1003
+ });
1004
+ }, "setConf");
1005
+ var actors = {};
1006
+ var maxWidth = 0;
1007
+ function drawActorLegend(diagram2) {
1008
+ const conf2 = getConfig2().journey;
1009
+ const maxLabelWidth = conf2.maxLabelWidth;
1010
+ maxWidth = 0;
1011
+ let yPos = 60;
1012
+ Object.keys(actors).forEach((person) => {
1013
+ const colour = actors[person].color;
1014
+ const circleData = {
1015
+ cx: 20,
1016
+ cy: yPos,
1017
+ r: 7,
1018
+ fill: colour,
1019
+ stroke: "#000",
1020
+ pos: actors[person].position
1021
+ };
1022
+ svgDraw_default.drawCircle(diagram2, circleData);
1023
+ let measureText = diagram2.append("text").attr("visibility", "hidden").text(person);
1024
+ const fullTextWidth = measureText.node().getBoundingClientRect().width;
1025
+ measureText.remove();
1026
+ let lines = [];
1027
+ if (fullTextWidth <= maxLabelWidth) {
1028
+ lines = [person];
1029
+ } else {
1030
+ const words = person.split(" ");
1031
+ let currentLine = "";
1032
+ measureText = diagram2.append("text").attr("visibility", "hidden");
1033
+ words.forEach((word) => {
1034
+ const testLine = currentLine ? `${currentLine} ${word}` : word;
1035
+ measureText.text(testLine);
1036
+ const textWidth = measureText.node().getBoundingClientRect().width;
1037
+ if (textWidth > maxLabelWidth) {
1038
+ if (currentLine) {
1039
+ lines.push(currentLine);
1040
+ }
1041
+ currentLine = word;
1042
+ measureText.text(word);
1043
+ if (measureText.node().getBoundingClientRect().width > maxLabelWidth) {
1044
+ let brokenWord = "";
1045
+ for (const char of word) {
1046
+ brokenWord += char;
1047
+ measureText.text(brokenWord + "-");
1048
+ if (measureText.node().getBoundingClientRect().width > maxLabelWidth) {
1049
+ lines.push(brokenWord.slice(0, -1) + "-");
1050
+ brokenWord = char;
1051
+ }
1052
+ }
1053
+ currentLine = brokenWord;
1054
+ }
1055
+ } else {
1056
+ currentLine = testLine;
1057
+ }
1058
+ });
1059
+ if (currentLine) {
1060
+ lines.push(currentLine);
1061
+ }
1062
+ measureText.remove();
1063
+ }
1064
+ lines.forEach((line, index) => {
1065
+ const labelData = {
1066
+ x: 40,
1067
+ y: yPos + 7 + index * 20,
1068
+ fill: "#666",
1069
+ text: line,
1070
+ textMargin: conf2.boxTextMargin ?? 5
1071
+ };
1072
+ const textElement = svgDraw_default.drawText(diagram2, labelData);
1073
+ const lineWidth = textElement.node().getBoundingClientRect().width;
1074
+ if (lineWidth > maxWidth && lineWidth > conf2.leftMargin - lineWidth) {
1075
+ maxWidth = lineWidth;
1076
+ }
1077
+ });
1078
+ yPos += Math.max(20, lines.length * 20);
1079
+ });
1080
+ }
1081
+ __name(drawActorLegend, "drawActorLegend");
1082
+ var conf = getConfig2().journey;
1083
+ var leftMargin = 0;
1084
+ var draw = /* @__PURE__ */ __name(function(text, id, version, diagObj) {
1085
+ const configObject = getConfig2();
1086
+ const titleColor = configObject.journey.titleColor;
1087
+ const titleFontSize = configObject.journey.titleFontSize;
1088
+ const titleFontFamily = configObject.journey.titleFontFamily;
1089
+ const securityLevel = configObject.securityLevel;
1090
+ let sandboxElement;
1091
+ if (securityLevel === "sandbox") {
1092
+ sandboxElement = select_default("#i" + id);
1093
+ }
1094
+ const root = securityLevel === "sandbox" ? select_default(sandboxElement.nodes()[0].contentDocument.body) : select_default("body");
1095
+ bounds.init();
1096
+ const diagram2 = root.select("#" + id);
1097
+ svgDraw_default.initGraphics(diagram2, id);
1098
+ const tasks2 = diagObj.db.getTasks();
1099
+ const title = diagObj.db.getDiagramTitle();
1100
+ const actorNames = diagObj.db.getActors();
1101
+ for (const member in actors) {
1102
+ delete actors[member];
1103
+ }
1104
+ let actorPos = 0;
1105
+ actorNames.forEach((actorName) => {
1106
+ actors[actorName] = {
1107
+ color: conf.actorColours[actorPos % conf.actorColours.length],
1108
+ position: actorPos
1109
+ };
1110
+ actorPos++;
1111
+ });
1112
+ drawActorLegend(diagram2);
1113
+ leftMargin = conf.leftMargin + maxWidth;
1114
+ bounds.insert(0, 0, leftMargin, Object.keys(actors).length * 50);
1115
+ drawTasks(diagram2, tasks2, 0, id);
1116
+ const box = bounds.getBounds();
1117
+ if (title) {
1118
+ diagram2.append("text").text(title).attr("x", leftMargin).attr("font-size", titleFontSize).attr("font-weight", "bold").attr("y", 25).attr("fill", titleColor).attr("font-family", titleFontFamily);
1119
+ }
1120
+ const height = box.stopy - box.starty + 2 * conf.diagramMarginY;
1121
+ const width = leftMargin + box.stopx + 2 * conf.diagramMarginX;
1122
+ configureSvgSize(diagram2, height, width, conf.useMaxWidth);
1123
+ diagram2.append("line").attr("x1", leftMargin).attr("y1", conf.height * 4).attr("x2", width - leftMargin - 4).attr("y2", conf.height * 4).attr("stroke-width", 4).attr("stroke", "black").attr("marker-end", "url(#" + id + "-arrowhead)");
1124
+ const extraVertForTitle = title ? 70 : 0;
1125
+ diagram2.attr("viewBox", `${box.startx} -25 ${width} ${height + extraVertForTitle}`);
1126
+ diagram2.attr("preserveAspectRatio", "xMinYMin meet");
1127
+ diagram2.attr("height", height + extraVertForTitle + 25);
1128
+ }, "draw");
1129
+ var bounds = {
1130
+ data: {
1131
+ startx: undefined,
1132
+ stopx: undefined,
1133
+ starty: undefined,
1134
+ stopy: undefined
1135
+ },
1136
+ verticalPos: 0,
1137
+ sequenceItems: [],
1138
+ init: /* @__PURE__ */ __name(function() {
1139
+ this.sequenceItems = [];
1140
+ this.data = {
1141
+ startx: undefined,
1142
+ stopx: undefined,
1143
+ starty: undefined,
1144
+ stopy: undefined
1145
+ };
1146
+ this.verticalPos = 0;
1147
+ }, "init"),
1148
+ updateVal: /* @__PURE__ */ __name(function(obj, key, val, fun) {
1149
+ if (obj[key] === undefined) {
1150
+ obj[key] = val;
1151
+ } else {
1152
+ obj[key] = fun(val, obj[key]);
1153
+ }
1154
+ }, "updateVal"),
1155
+ updateBounds: /* @__PURE__ */ __name(function(startx, starty, stopx, stopy) {
1156
+ const conf2 = getConfig2().journey;
1157
+ const _self = this;
1158
+ let cnt = 0;
1159
+ function updateFn(type) {
1160
+ return /* @__PURE__ */ __name(function updateItemBounds(item) {
1161
+ cnt++;
1162
+ const n = _self.sequenceItems.length - cnt + 1;
1163
+ _self.updateVal(item, "starty", starty - n * conf2.boxMargin, Math.min);
1164
+ _self.updateVal(item, "stopy", stopy + n * conf2.boxMargin, Math.max);
1165
+ _self.updateVal(bounds.data, "startx", startx - n * conf2.boxMargin, Math.min);
1166
+ _self.updateVal(bounds.data, "stopx", stopx + n * conf2.boxMargin, Math.max);
1167
+ if (!(type === "activation")) {
1168
+ _self.updateVal(item, "startx", startx - n * conf2.boxMargin, Math.min);
1169
+ _self.updateVal(item, "stopx", stopx + n * conf2.boxMargin, Math.max);
1170
+ _self.updateVal(bounds.data, "starty", starty - n * conf2.boxMargin, Math.min);
1171
+ _self.updateVal(bounds.data, "stopy", stopy + n * conf2.boxMargin, Math.max);
1172
+ }
1173
+ }, "updateItemBounds");
1174
+ }
1175
+ __name(updateFn, "updateFn");
1176
+ this.sequenceItems.forEach(updateFn());
1177
+ }, "updateBounds"),
1178
+ insert: /* @__PURE__ */ __name(function(startx, starty, stopx, stopy) {
1179
+ const _startx = Math.min(startx, stopx);
1180
+ const _stopx = Math.max(startx, stopx);
1181
+ const _starty = Math.min(starty, stopy);
1182
+ const _stopy = Math.max(starty, stopy);
1183
+ this.updateVal(bounds.data, "startx", _startx, Math.min);
1184
+ this.updateVal(bounds.data, "starty", _starty, Math.min);
1185
+ this.updateVal(bounds.data, "stopx", _stopx, Math.max);
1186
+ this.updateVal(bounds.data, "stopy", _stopy, Math.max);
1187
+ this.updateBounds(_startx, _starty, _stopx, _stopy);
1188
+ }, "insert"),
1189
+ bumpVerticalPos: /* @__PURE__ */ __name(function(bump) {
1190
+ this.verticalPos = this.verticalPos + bump;
1191
+ this.data.stopy = this.verticalPos;
1192
+ }, "bumpVerticalPos"),
1193
+ getVerticalPos: /* @__PURE__ */ __name(function() {
1194
+ return this.verticalPos;
1195
+ }, "getVerticalPos"),
1196
+ getBounds: /* @__PURE__ */ __name(function() {
1197
+ return this.data;
1198
+ }, "getBounds")
1199
+ };
1200
+ var fills = conf.sectionFills;
1201
+ var textColours = conf.sectionColours;
1202
+ var drawTasks = /* @__PURE__ */ __name(function(diagram2, tasks2, verticalPos, diagramId) {
1203
+ const conf2 = getConfig2().journey;
1204
+ let lastSection = "";
1205
+ const sectionVHeight = conf2.height * 2 + conf2.diagramMarginY;
1206
+ const taskPos = verticalPos + sectionVHeight;
1207
+ let sectionNumber = 0;
1208
+ let fill = "#CCC";
1209
+ let colour = "black";
1210
+ let num = 0;
1211
+ for (const [i, task] of tasks2.entries()) {
1212
+ if (lastSection !== task.section) {
1213
+ fill = fills[sectionNumber % fills.length];
1214
+ num = sectionNumber % fills.length;
1215
+ colour = textColours[sectionNumber % textColours.length];
1216
+ let taskInSectionCount = 0;
1217
+ const currentSection2 = task.section;
1218
+ for (let taskIndex = i;taskIndex < tasks2.length; taskIndex++) {
1219
+ if (tasks2[taskIndex].section == currentSection2) {
1220
+ taskInSectionCount = taskInSectionCount + 1;
1221
+ } else {
1222
+ break;
1223
+ }
1224
+ }
1225
+ const section = {
1226
+ x: i * conf2.taskMargin + i * conf2.width + leftMargin,
1227
+ y: 50,
1228
+ text: task.section,
1229
+ fill,
1230
+ num,
1231
+ colour,
1232
+ taskCount: taskInSectionCount
1233
+ };
1234
+ svgDraw_default.drawSection(diagram2, section, conf2);
1235
+ lastSection = task.section;
1236
+ sectionNumber++;
1237
+ }
1238
+ const taskActors = task.people.reduce((acc, actorName) => {
1239
+ if (actors[actorName]) {
1240
+ acc[actorName] = actors[actorName];
1241
+ }
1242
+ return acc;
1243
+ }, {});
1244
+ task.x = i * conf2.taskMargin + i * conf2.width + leftMargin;
1245
+ task.y = taskPos;
1246
+ task.width = conf2.diagramMarginX;
1247
+ task.height = conf2.diagramMarginY;
1248
+ task.colour = colour;
1249
+ task.fill = fill;
1250
+ task.num = num;
1251
+ task.actors = taskActors;
1252
+ svgDraw_default.drawTask(diagram2, task, conf2, diagramId);
1253
+ bounds.insert(task.x, task.y, task.x + task.width + conf2.taskMargin, 300 + 5 * 30);
1254
+ }
1255
+ }, "drawTasks");
1256
+ var journeyRenderer_default = {
1257
+ setConf,
1258
+ draw
1259
+ };
1260
+ var diagram = {
1261
+ parser: journey_default,
1262
+ db: journeyDb_default,
1263
+ renderer: journeyRenderer_default,
1264
+ styles: styles_default,
1265
+ init: /* @__PURE__ */ __name((cnf) => {
1266
+ journeyRenderer_default.setConf(cnf.journey);
1267
+ journeyDb_default.clear();
1268
+ }, "init")
1269
+ };
1270
+ export {
1271
+ diagram
1272
+ };