@kabmo-labs/kabmo 0.34.0 → 0.36.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 (210) hide show
  1. package/dist/client/index.html +1 -1
  2. package/dist/client/index.js +435 -432
  3. package/dist/client/static/js/{CsvGrid-vze4m5ag.js → CsvGrid-1h3bcak7.js} +2 -2
  4. package/dist/client/static/js/{DocxView-jbf21gmh.js → DocxView-ndca8jch.js} +3 -3
  5. package/dist/client/static/js/{DrawioView-b52qybx5.js → DrawioView-kpzd6y0b.js} +2 -2
  6. package/dist/client/static/js/{ImageView-mdgzj8px.js → ImageView-79prn3dg.js} +1 -1
  7. package/dist/client/static/js/{LayoutWrapper-3c49dvtt.js → LayoutWrapper-v2wn2sb2.js} +2 -2
  8. package/dist/client/static/js/{Modal-sqp864vd.js → Modal-99j0zz3z.js} +16 -16
  9. package/dist/client/static/js/{PdfView-g06rxqb1.js → PdfView-2rjd87ay.js} +1 -1
  10. package/dist/client/static/js/{SessionsView-521adxyr.js → SessionsView-t7f3s71b.js} +1 -1
  11. package/dist/client/static/js/{SheetView-h8xmsz7q.js → SheetView-ehb976st.js} +4 -4
  12. package/dist/client/static/js/{SvgPreview-1j4jvcvz.js → SvgPreview-de2bbba6.js} +1 -1
  13. package/dist/client/static/js/{abnfDiagram-O67JEVCF-pasxh4b6.js → abnfDiagram-O67JEVCF-nx9jzn7m.js} +1 -1
  14. package/dist/client/static/js/architecture-7GRP2DOG-aqft2erp.js +1 -0
  15. package/dist/client/static/js/{architectureDiagram-NJMV4G6O-ms14g0bm.js → architectureDiagram-NJMV4G6O-170v67rr.js} +2 -2
  16. package/dist/client/static/js/{blockDiagram-BEXU5L5S-ycn78fcq.js → blockDiagram-BEXU5L5S-16q285n1.js} +2 -2
  17. package/dist/client/static/js/{c4Diagram-YGBWAQC7-vn2gpjfm.js → c4Diagram-YGBWAQC7-rn3qt45h.js} +1 -1
  18. package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-fyrm1pr5.js → classDiagram-v2-NBCMYWYE-r26wg74e.js} +3 -3
  19. package/dist/client/static/js/{cose-bilkent-JH36ORCC-ea5nwvgq.js → cose-bilkent-JH36ORCC-82kwe7ha.js} +1 -1
  20. package/dist/client/static/js/css-r2nhvzff.js +1 -0
  21. package/dist/client/static/js/cynefin-OW5HDTMX-v2sz60t6.js +1 -0
  22. package/dist/client/static/js/{cynefinDiagram-VND7K2PF-j6bsjpre.js → cynefinDiagram-VND7K2PF-tcxdn6pa.js} +1 -1
  23. package/dist/client/static/js/{dagre-6A5THRUB-4smdkwv8.js → dagre-6A5THRUB-g833ata3.js} +2 -2
  24. package/dist/client/static/js/{diagram-22UHCM2B-9sm4kqwc.js → diagram-22UHCM2B-f1fq8xec.js} +4 -4
  25. package/dist/client/static/js/{diagram-3UASUU5V-2h3qxaed.js → diagram-3UASUU5V-6j2w016f.js} +1 -1
  26. package/dist/client/static/js/{diagram-ATOU4E4O-1981bc94.js → diagram-ATOU4E4O-6t2qxsk4.js} +1 -1
  27. package/dist/client/static/js/{diagram-CDSNMT55-3vgsxavc.js → diagram-CDSNMT55-7abar8s7.js} +1 -1
  28. package/dist/client/static/js/{diagram-MLGK6HIB-c9gf2r3f.js → diagram-MLGK6HIB-s68rgy16.js} +1 -1
  29. package/dist/client/static/js/{diagram-MPIPVDR6-gjqeq92d.js → diagram-MPIPVDR6-azgkm6w8.js} +1 -1
  30. package/dist/client/static/js/{dockerfile-8v935dkn.js → dockerfile-47e33kqa.js} +1 -1
  31. package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-4vbsgh99.js → ebnfDiagram-ZINNZB2B-esrjz750.js} +1 -1
  32. package/dist/client/static/js/{elixir-vcbg60wv.js → elixir-rpa1g4gy.js} +1 -1
  33. package/dist/client/static/js/{elk-276RUBZZ-nca3t891.js → elk-276RUBZZ-fhr4b4jj.js} +1 -1
  34. package/dist/client/static/js/{erDiagram-OPXOYQCR-5kfkev03.js → erDiagram-OPXOYQCR-5r3fmdnz.js} +2 -2
  35. package/dist/client/static/js/{erlang-qt876zrq.js → erlang-bh5cbm8m.js} +1 -1
  36. package/dist/client/static/js/eventmodeling-NTZA5JFV-8qbefe4m.js +1 -0
  37. package/dist/client/static/js/flowDiagram-KWPJA3E3-krsvgcq7.js +1 -0
  38. package/dist/client/static/js/{ganttDiagram-FUAMR5RP-mxc73wmq.js → ganttDiagram-FUAMR5RP-j4pf6rdn.js} +2 -2
  39. package/dist/client/static/js/gitGraph-4MIJSDKK-9bx1a38k.js +1 -0
  40. package/dist/client/static/js/{gitGraphDiagram-X574FWY7-7en3ag0e.js → gitGraphDiagram-X574FWY7-x5epk0gr.js} +1 -1
  41. package/dist/client/static/js/graphql-xnpp5gn9.js +1 -0
  42. package/dist/client/static/js/html-pv88ny12.js +1 -0
  43. package/dist/client/static/js/{index-j51d5a5m.js → index-0b1kwsam.js} +28 -28
  44. package/dist/client/static/js/{index-52rqxgya.js → index-3kgrcaq1.js} +1 -1
  45. package/dist/client/static/js/{index-vhqe0y82.js → index-3vdmwpbh.js} +2 -2
  46. package/dist/client/static/js/{index-g2dyfze9.js → index-40ve7zzv.js} +1 -1
  47. package/dist/client/static/js/{index-eyfcm0cy.js → index-44qrckd2.js} +1 -1
  48. package/dist/client/static/js/{index-qckv9nte.js → index-55pqvh82.js} +2 -2
  49. package/dist/client/static/js/{index-r014brzs.js → index-5kjpacvd.js} +1 -1
  50. package/dist/client/static/js/{index-ev3yt353.js → index-5rzk1226.js} +1 -1
  51. package/dist/client/static/js/{index-p0nz38bm.js → index-60ceydzn.js} +1 -1
  52. package/dist/client/static/js/{index-ybm2x4vh.js → index-63c6t75t.js} +1 -1
  53. package/dist/client/static/js/{index-ahv9y42z.js → index-63jbb4kf.js} +2 -2
  54. package/dist/client/static/js/{index-nccwxv0s.js → index-6xzfta4b.js} +1 -1
  55. package/dist/client/static/js/{index-cgzrpvzj.js → index-75haaj8g.js} +169 -169
  56. package/dist/client/static/js/{index-ag2rmtas.js → index-7r1hw2gd.js} +1 -1
  57. package/dist/client/static/js/{index-hf52f59k.js → index-8cy3x2y8.js} +2 -2
  58. package/dist/client/static/js/{index-vy6termr.js → index-8e15fzax.js} +1 -1
  59. package/dist/client/static/js/{index-rzxcj7cg.js → index-97t3mv1v.js} +1 -1
  60. package/dist/client/static/js/{index-km2zb6wk.js → index-982jyfsb.js} +2 -2
  61. package/dist/client/static/js/{index-jsyekbx9.js → index-9gf8b73w.js} +1 -1
  62. package/dist/client/static/js/{index-s7gkkkyz.js → index-a293pdg7.js} +2 -2
  63. package/dist/client/static/js/{index-dbe6afkf.js → index-af24nes6.js} +2 -2
  64. package/dist/client/static/js/{index-ptcwae2n.js → index-b48p8d1j.js} +2 -2
  65. package/dist/client/static/js/{index-cd65zqba.js → index-be6gevq8.js} +1 -1
  66. package/dist/client/static/js/{index-231241f4.js → index-c09a5s1n.js} +9 -9
  67. package/dist/client/static/js/{index-fvmfge3p.js → index-c1j0xb0w.js} +1 -1
  68. package/dist/client/static/js/{index-fta1y9pc.js → index-ctgefatv.js} +10 -10
  69. package/dist/client/static/js/{index-7a64yjrm.js → index-d2km9egp.js} +4 -4
  70. package/dist/client/static/js/index-dh1vd0d9.js +1 -0
  71. package/dist/client/static/js/{index-j0r5hj0j.js → index-dmgawfhw.js} +2 -2
  72. package/dist/client/static/js/{index-1ksg88qf.js → index-h1e1abpt.js} +2 -2
  73. package/dist/client/static/js/{index-4g46wbdw.js → index-htt8qxm3.js} +1 -1
  74. package/dist/client/static/js/{index-c3ek61zv.js → index-k1xt92h4.js} +1 -1
  75. package/dist/client/static/js/{index-f7jhhqtk.js → index-ktvbsj6w.js} +1 -1
  76. package/dist/client/static/js/{index-a0fmsv1d.js → index-ky0prc71.js} +6 -6
  77. package/dist/client/static/js/{index-2svnq5gg.js → index-mm1rf116.js} +1 -1
  78. package/dist/client/static/js/{index-h5bn97p6.js → index-nws03exw.js} +1 -1
  79. package/dist/client/static/js/{index-xx6mqpxm.js → index-pyx8n25s.js} +2 -2
  80. package/dist/client/static/js/{index-rs80cwsv.js → index-q5t4sy22.js} +3 -3
  81. package/dist/client/static/js/{index-76zb4m0n.js → index-r8pckaqe.js} +2 -2
  82. package/dist/client/static/js/{index-4qwzxj81.js → index-sar2ggde.js} +1 -1
  83. package/dist/client/static/js/{index-1b0t1428.js → index-skm6k5w2.js} +3 -3
  84. package/dist/client/static/js/{index-b29afsjh.js → index-v5t761a1.js} +1 -1
  85. package/dist/client/static/js/{index-7y6rpsrp.js → index-v8qd8ypc.js} +2 -2
  86. package/dist/client/static/js/{index-354mqqra.js → index-w3n97x4b.js} +2 -2
  87. package/dist/client/static/js/{index-0vm41je9.js → index-ydvfc9td.js} +1 -1
  88. package/dist/client/static/js/{index-ptcrwswj.js → index-ye450a7z.js} +1 -1
  89. package/dist/client/static/js/{index-rytaa8ca.js → index-z6g74h7g.js} +2 -2
  90. package/dist/client/static/js/{index-sd66wv26.js → index-zdtsvnpq.js} +2 -2
  91. package/dist/client/static/js/{index-pm6xxwz1.js → index-zp73zexp.js} +2 -2
  92. package/dist/client/static/js/info-A6RAGUB7-j51t7jhh.js +1 -0
  93. package/dist/client/static/js/{infoDiagram-VRGFBTTK-sef80132.js → infoDiagram-VRGFBTTK-ktc8nb8g.js} +1 -1
  94. package/dist/client/static/js/ini-ygfyhprj.js +1 -0
  95. package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-yhvepp1q.js → ishikawaDiagram-OU5B5YK6-n3dk6227.js} +2 -2
  96. package/dist/client/static/js/java-gm49vw59.js +1 -0
  97. package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-5w77y95w.js → journeyDiagram-ZHPQQLJL-f0p1h8qn.js} +3 -3
  98. package/dist/client/static/js/jsx-ksxw1byz.js +1 -0
  99. package/dist/client/static/js/{julia-d4j6wgvf.js → julia-73zjh2w6.js} +1 -1
  100. package/dist/client/static/js/{kanban-definition-PNTS6WVX-02znqtna.js → kanban-definition-PNTS6WVX-7jdt7dv1.js} +2 -2
  101. package/dist/client/static/js/lua-53gzb9bx.js +1 -0
  102. package/dist/client/static/js/markdown-tk3cd3vs.js +1 -0
  103. package/dist/client/static/js/{mermaid.core-a6e6vck4.js → mermaid.core-e8rzrjt9.js} +6 -6
  104. package/dist/client/static/js/{mindmap-definition-NLK3R4M7-y4n74q9x.js → mindmap-definition-NLK3R4M7-7shv6ge0.js} +2 -2
  105. package/dist/client/static/js/one-dark-pro-39bt34v9.js +1 -0
  106. package/dist/client/static/js/one-light-xec0sehr.js +1 -0
  107. package/dist/client/static/js/packet-AYTQ26CC-n83gfj2g.js +1 -0
  108. package/dist/client/static/js/{pegDiagram-GJSIUBJH-pr7ehgzb.js → pegDiagram-GJSIUBJH-17ak2zx3.js} +1 -1
  109. package/dist/client/static/js/{perl-srptw5vm.js → perl-8z46dmze.js} +1 -1
  110. package/dist/client/static/js/{php-n89g3fk7.js → php-6qvnp2t6.js} +1 -1
  111. package/dist/client/static/js/pie-WAS4IAKB-5c5pctwz.js +1 -0
  112. package/dist/client/static/js/{pieDiagram-5QR66LMP-39wpsk08.js → pieDiagram-5QR66LMP-at4x1g4q.js} +2 -2
  113. package/dist/client/static/js/properties-2tcybqjk.js +1 -0
  114. package/dist/client/static/js/python-qph3dntq.js +1 -0
  115. package/dist/client/static/js/{quadrantDiagram-O4NWA36T-esm913km.js → quadrantDiagram-O4NWA36T-apzhwrn4.js} +1 -1
  116. package/dist/client/static/js/r-gd26x93y.js +1 -0
  117. package/dist/client/static/js/radar-RG4KPBEZ-52e5n99a.js +1 -0
  118. package/dist/client/static/js/railroad-74A4TZTK-44nqxxpy.js +1 -0
  119. package/dist/client/static/js/railroad-abnf-HS5TGJTU-25jxgwg7.js +1 -0
  120. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-64pqpf2y.js +1 -0
  121. package/dist/client/static/js/railroad-peg-WCYAUIDC-0p5sxzpx.js +1 -0
  122. package/dist/client/static/js/{railroadDiagram-XR7U4H2S-wy2mgya6.js → railroadDiagram-XR7U4H2S-rw8cj5f3.js} +1 -1
  123. package/dist/client/static/js/{requirementDiagram-PLB6GJNP-6z9xdgbq.js → requirementDiagram-PLB6GJNP-qyrse7mb.js} +1 -1
  124. package/dist/client/static/js/{ruby-r81ytgcm.js → ruby-qy8mhstq.js} +1 -1
  125. package/dist/client/static/js/{rust-frn3szvc.js → rust-fpshqnk0.js} +1 -1
  126. package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-rtmxk3ys.js → sankeyDiagram-IPEJSGJF-254qr59q.js} +1 -1
  127. package/dist/client/static/js/{sass-9bxped7y.js → sass-kbwea482.js} +1 -1
  128. package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-awzcrafg.js → sequenceDiagram-PO4LG4MO-y9xjxfc5.js} +3 -3
  129. package/dist/client/static/js/{sizeCapture-INFHLROL-03gy196j.js → sizeCapture-INFHLROL-sc5e60t3.js} +1 -1
  130. package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-an8v3q5n.js → stateDiagram-v2-GCMORJYK-r134s4xr.js} +2 -2
  131. package/dist/client/static/js/{swimlanes-2SLR337P-n9yb4wcs.js → swimlanes-2SLR337P-xc7rbawt.js} +1 -1
  132. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-kdcdamkj.js +8 -0
  133. package/dist/client/static/js/{timeline-definition-EJHVYXUP-jceb575g.js → timeline-definition-EJHVYXUP-cgjd8shk.js} +2 -2
  134. package/dist/client/static/js/treeView-Q6P3EWNA-8j14nnd1.js +1 -0
  135. package/dist/client/static/js/treemap-WGGIJYW6-esf993kk.js +1 -0
  136. package/dist/client/static/js/{usecaseDiagram-POWQR4AR-888h3100.js → usecaseDiagram-POWQR4AR-9qsmjhm6.js} +4 -4
  137. package/dist/client/static/js/{vennDiagram-UO4OBE2U-wbfz0rzv.js → vennDiagram-UO4OBE2U-4grw9awx.js} +1 -1
  138. package/dist/client/static/js/{vue-c0rtg1wf.js → vue-j8vb9d7r.js} +1 -1
  139. package/dist/client/static/js/wardley-WFR3VGLG-v4dxm2sb.js +1 -0
  140. package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-rn8c5qf9.js → wardleyDiagram-VNRHLVJA-8gxy0wat.js} +1 -1
  141. package/dist/client/static/js/xml-0py2vkw7.js +1 -0
  142. package/dist/client/static/js/{xychartDiagram-PMCCYNJV-8sn1apt6.js → xychartDiagram-PMCCYNJV-5sh7tdrx.js} +2 -2
  143. package/dist/client/static/js/yaml-vghdz0f0.js +1 -0
  144. package/package.json +1 -1
  145. package/src/client/components/settings/categories/ConnectSettings.tsx +8 -1
  146. package/src/client/components/settings/categories/connect-settings/CloudflareConfig.test.tsx +84 -0
  147. package/src/client/components/settings/categories/connect-settings/CloudflareConfig.tsx +68 -0
  148. package/src/client/components/settings/categories/connect-settings/PairDialog.test.tsx +159 -0
  149. package/src/client/components/settings/categories/connect-settings/PairDialog.tsx +40 -7
  150. package/src/client/components/workspace/git-panel/init-state.test.ts +5 -0
  151. package/src/client/hooks/chat/composer/speech-to-text.ts +24 -17
  152. package/src/client/hooks/connect/use-connect-status.ts +44 -19
  153. package/src/client/hooks/connect/use-pairing.ts +5 -0
  154. package/src/client/hooks/editor/file-actions.ts +3 -11
  155. package/src/client/hooks/editor/font.test.ts +2 -1
  156. package/src/client/hooks/editor/use-file-transfer.ts +2 -1
  157. package/src/client/lib/browser/download.ts +22 -0
  158. package/src/client/lib/notifications/watch.ts +4 -1
  159. package/src/server/lib/connect/cloudflared-config.server.ts +236 -0
  160. package/src/server/lib/connect/cloudflared-config.test.ts +245 -0
  161. package/src/server/lib/connect/cloudflared.lifecycle.test.ts +116 -15
  162. package/src/server/lib/connect/cloudflared.server.ts +53 -66
  163. package/src/server/lib/connect/pairing.server.ts +33 -0
  164. package/src/server/lib/connect/qr-png.server.test.ts +93 -0
  165. package/src/server/lib/connect/qr-png.server.ts +119 -0
  166. package/src/server/lib/connect/status.server.ts +10 -4
  167. package/src/server/routes/connect/index.ts +2 -0
  168. package/src/server/routes/connect/pair-qr.test.ts +72 -0
  169. package/src/server/routes/connect/pair-qr.ts +44 -0
  170. package/src/server/routes/connect/pair.ts +8 -2
  171. package/src/server/routes/connect/tunnels.test.ts +141 -0
  172. package/src/server/routes/connect/tunnels.ts +32 -7
  173. package/src/server/routes/notifications/stream.ts +11 -2
  174. package/src/shared/lib/connect/types.ts +7 -0
  175. package/src/shared/lib/dictation/capture-failure.test.ts +46 -0
  176. package/src/shared/lib/dictation/capture-failure.ts +36 -0
  177. package/dist/client/static/js/architecture-7GRP2DOG-fc9kmq1w.js +0 -1
  178. package/dist/client/static/js/css-6vj0d308.js +0 -1
  179. package/dist/client/static/js/cynefin-OW5HDTMX-a4t8992q.js +0 -1
  180. package/dist/client/static/js/eventmodeling-NTZA5JFV-18bdrkv5.js +0 -1
  181. package/dist/client/static/js/flowDiagram-KWPJA3E3-fg0yqx0h.js +0 -1
  182. package/dist/client/static/js/gitGraph-4MIJSDKK-8fa6y40p.js +0 -1
  183. package/dist/client/static/js/graphql-n43pd5fs.js +0 -1
  184. package/dist/client/static/js/html-dbrwss36.js +0 -1
  185. package/dist/client/static/js/index-6sf2vsp2.js +0 -1
  186. package/dist/client/static/js/info-A6RAGUB7-3hk844f7.js +0 -1
  187. package/dist/client/static/js/ini-j5dyq6gm.js +0 -1
  188. package/dist/client/static/js/java-g4dgwbfd.js +0 -1
  189. package/dist/client/static/js/jsx-7t5ecz9s.js +0 -1
  190. package/dist/client/static/js/lua-1g6w30de.js +0 -1
  191. package/dist/client/static/js/markdown-afx21x8c.js +0 -1
  192. package/dist/client/static/js/one-dark-pro-vwhfpzr8.js +0 -1
  193. package/dist/client/static/js/one-light-y5t9x6zh.js +0 -1
  194. package/dist/client/static/js/packet-AYTQ26CC-4nj2yy10.js +0 -1
  195. package/dist/client/static/js/pie-WAS4IAKB-k7rde3f9.js +0 -1
  196. package/dist/client/static/js/properties-thd83wey.js +0 -1
  197. package/dist/client/static/js/python-264ns4xw.js +0 -1
  198. package/dist/client/static/js/r-qw82kkv9.js +0 -1
  199. package/dist/client/static/js/radar-RG4KPBEZ-513dpw4f.js +0 -1
  200. package/dist/client/static/js/railroad-74A4TZTK-9bqnst9c.js +0 -1
  201. package/dist/client/static/js/railroad-abnf-HS5TGJTU-7367d5bv.js +0 -1
  202. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-b806b1mj.js +0 -1
  203. package/dist/client/static/js/railroad-peg-WCYAUIDC-5a67rwf8.js +0 -1
  204. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-nx5nfnf0.js +0 -8
  205. package/dist/client/static/js/treeView-Q6P3EWNA-kcy40evb.js +0 -1
  206. package/dist/client/static/js/treemap-WGGIJYW6-fsrvqxf4.js +0 -1
  207. package/dist/client/static/js/wardley-WFR3VGLG-36dmxww4.js +0 -1
  208. package/dist/client/static/js/xml-dz51p1m3.js +0 -1
  209. package/dist/client/static/js/yaml-2cfkd30t.js +0 -1
  210. package/src/server/lib/connect/cloudflared.server.test.ts +0 -65
@@ -1,9 +1,9 @@
1
- import{t,l,x,R,L,z,O,U,j,G,p,h,xf,W,st,Ye,Je,Mr,_t,St,Tt,lt}from"./index-fta1y9pc.js";import{Nt}from"./index-cgzrpvzj.js";import{Na}from"./index-1ksg88qf.js";var Mt=function(){var e=t(function(Q,c,S,a){for(S=S||{},a=Q.length;a--;S[Q[a]]=c);return S},"o"),s=[1,2],o=[1,3],r=[1,4],u=[2,4],f=[1,9],y=[1,11],m=[1,16],n=[1,17],T=[1,18],E=[1,19],N=[1,33],F=[1,20],Y=[1,21],C=[1,22],g=[1,23],P=[1,24],A=[1,26],H=[1,27],B=[1,28],K=[1,29],D=[1,30],rt=[1,31],yt=[1,32],mt=[1,35],bt=[1,36],kt=[1,37],Et=[1,38],it=[1,34],b=[1,4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],vt=[1,4,5,14,15,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,39,40,41,45,48,51,52,53,54,57],Ht=[4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],Rt={trace:t(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SPACE:4,NL:5,SD:6,document:7,line:8,statement:9,classDefStatement:10,styleStatement:11,cssClassStatement:12,idStatement:13,DESCR:14,"-->":15,HIDE_EMPTY:16,scale:17,WIDTH:18,COMPOSIT_STATE:19,STRUCT_START:20,STRUCT_STOP:21,STATE_DESCR:22,AS:23,ID:24,FORK:25,JOIN:26,CHOICE:27,CONCURRENT:28,note:29,notePosition:30,NOTE_TEXT:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,CLICK:38,STRING:39,HREF:40,classDef:41,CLASSDEF_ID:42,CLASSDEF_STYLEOPTS:43,DEFAULT:44,style:45,STYLE_IDS:46,STYLEDEF_STYLEOPTS:47,class:48,CLASSENTITY_IDS:49,STYLECLASS:50,direction_tb:51,direction_bt:52,direction_rl:53,direction_lr:54,eol:55,";":56,EDGE_STATE:57,STYLE_SEPARATOR:58,left_of:59,right_of:60,$accept:0,$end:1},terminals_:{2:"error",4:"SPACE",5:"NL",6:"SD",14:"DESCR",15:"-->",16:"HIDE_EMPTY",17:"scale",18:"WIDTH",19:"COMPOSIT_STATE",20:"STRUCT_START",21:"STRUCT_STOP",22:"STATE_DESCR",23:"AS",24:"ID",25:"FORK",26:"JOIN",27:"CHOICE",28:"CONCURRENT",29:"note",31:"NOTE_TEXT",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",38:"CLICK",39:"STRING",40:"HREF",41:"classDef",42:"CLASSDEF_ID",43:"CLASSDEF_STYLEOPTS",44:"DEFAULT",45:"style",46:"STYLE_IDS",47:"STYLEDEF_STYLEOPTS",48:"class",49:"CLASSENTITY_IDS",50:"STYLECLASS",51:"direction_tb",52:"direction_bt",53:"direction_rl",54:"direction_lr",56:";",57:"EDGE_STATE",58:"STYLE_SEPARATOR",59:"left_of",60:"right_of"},productions_:[0,[3,2],[3,2],[3,2],[7,0],[7,2],[8,2],[8,1],[8,1],[9,1],[9,1],[9,1],[9,1],[9,2],[9,3],[9,4],[9,1],[9,2],[9,1],[9,4],[9,3],[9,6],[9,1],[9,1],[9,1],[9,1],[9,4],[9,4],[9,1],[9,2],[9,2],[9,1],[9,5],[9,5],[10,3],[10,3],[11,3],[12,3],[32,1],[32,1],[32,1],[32,1],[55,1],[55,1],[13,1],[13,1],[13,3],[13,3],[30,1],[30,1]],performAction:t(function(c,S,a,k,_,i,at){var d=i.length-1;switch(_){case 3:return k.setRootDoc(i[d]),i[d];break;case 4:this.$=[];break;case 5:if(i[d]!="nl")i[d-1].push(i[d]),this.$=i[d-1];break;case 6:case 7:this.$=i[d];break;case 8:this.$="nl";break;case 12:this.$=i[d];break;case 13:let Ct=i[d-1];Ct.description=k.trimColon(i[d]),this.$=Ct;break;case 14:this.$={stmt:"relation",state1:i[d-2],state2:i[d]};break;case 15:let At=k.trimColon(i[d]);this.$={stmt:"relation",state1:i[d-3],state2:i[d-1],description:At};break;case 19:this.$={stmt:"state",id:i[d-3],type:"default",description:"",doc:i[d-1]};break;case 20:var X=i[d],J=i[d-2].trim();if(i[d].match(":")){var ht=i[d].split(":");X=ht[0],J=[J,ht[1]]}this.$={stmt:"state",id:X,type:"default",description:J};break;case 21:this.$={stmt:"state",id:i[d-3],type:"default",description:i[d-5],doc:i[d-1]};break;case 22:this.$={stmt:"state",id:i[d],type:"fork"};break;case 23:this.$={stmt:"state",id:i[d],type:"join"};break;case 24:this.$={stmt:"state",id:i[d],type:"choice"};break;case 25:this.$={stmt:"state",id:k.getDividerId(),type:"divider"};break;case 26:this.$={stmt:"state",id:i[d-1].trim(),note:{position:i[d-2].trim(),text:i[d].trim()}};break;case 29:this.$=i[d].trim(),k.setAccTitle(this.$);break;case 30:case 31:this.$=i[d].trim(),k.setAccDescription(this.$);break;case 32:this.$={stmt:"click",id:i[d-3],url:i[d-2],tooltip:i[d-1]};break;case 33:this.$={stmt:"click",id:i[d-3],url:i[d-1],tooltip:""};break;case 34:case 35:this.$={stmt:"classDef",id:i[d-1].trim(),classes:i[d].trim()};break;case 36:this.$={stmt:"style",id:i[d-1].trim(),styleClass:i[d].trim()};break;case 37:this.$={stmt:"applyClass",id:i[d-1].trim(),styleClass:i[d].trim()};break;case 38:k.setDirection("TB"),this.$={stmt:"dir",value:"TB"};break;case 39:k.setDirection("BT"),this.$={stmt:"dir",value:"BT"};break;case 40:k.setDirection("RL"),this.$={stmt:"dir",value:"RL"};break;case 41:k.setDirection("LR"),this.$={stmt:"dir",value:"LR"};break;case 44:case 45:this.$={stmt:"state",id:i[d].trim(),type:"default",description:""};break;case 46:this.$={stmt:"state",id:i[d-2].trim(),classes:[i[d].trim()],type:"default",description:""};break;case 47:this.$={stmt:"state",id:i[d-2].trim(),classes:[i[d].trim()],type:"default",description:""};break}},"anonymous"),table:[{3:1,4:s,5:o,6:r},{1:[3]},{3:5,4:s,5:o,6:r},{3:6,4:s,5:o,6:r},e([1,4,5,16,17,19,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],u,{7:7}),{1:[2,1]},{1:[2,2]},{1:[2,3],4:f,5:y,8:8,9:10,10:12,11:13,12:14,13:15,16:m,17:n,19:T,22:E,24:N,25:F,26:Y,27:C,28:g,29:P,32:25,33:A,35:H,37:B,38:K,41:D,45:rt,48:yt,51:mt,52:bt,53:kt,54:Et,57:it},e(b,[2,5]),{9:39,10:12,11:13,12:14,13:15,16:m,17:n,19:T,22:E,24:N,25:F,26:Y,27:C,28:g,29:P,32:25,33:A,35:H,37:B,38:K,41:D,45:rt,48:yt,51:mt,52:bt,53:kt,54:Et,57:it},e(b,[2,7]),e(b,[2,8]),e(b,[2,9]),e(b,[2,10]),e(b,[2,11]),e(b,[2,12],{14:[1,40],15:[1,41]}),e(b,[2,16]),{18:[1,42]},e(b,[2,18],{20:[1,43]}),{23:[1,44]},e(b,[2,22]),e(b,[2,23]),e(b,[2,24]),e(b,[2,25]),{30:45,31:[1,46],59:[1,47],60:[1,48]},e(b,[2,28]),{34:[1,49]},{36:[1,50]},e(b,[2,31]),{13:51,24:N,57:it},{42:[1,52],44:[1,53]},{46:[1,54]},{49:[1,55]},e(vt,[2,44],{58:[1,56]}),e(vt,[2,45],{58:[1,57]}),e(b,[2,38]),e(b,[2,39]),e(b,[2,40]),e(b,[2,41]),e(b,[2,6]),e(b,[2,13]),{13:58,24:N,57:it},e(b,[2,17]),e(Ht,u,{7:59}),{24:[1,60]},{24:[1,61]},{23:[1,62]},{24:[2,48]},{24:[2,49]},e(b,[2,29]),e(b,[2,30]),{39:[1,63],40:[1,64]},{43:[1,65]},{43:[1,66]},{47:[1,67]},{50:[1,68]},{24:[1,69]},{24:[1,70]},e(b,[2,14],{14:[1,71]}),{4:f,5:y,8:8,9:10,10:12,11:13,12:14,13:15,16:m,17:n,19:T,21:[1,72],22:E,24:N,25:F,26:Y,27:C,28:g,29:P,32:25,33:A,35:H,37:B,38:K,41:D,45:rt,48:yt,51:mt,52:bt,53:kt,54:Et,57:it},e(b,[2,20],{20:[1,73]}),{31:[1,74]},{24:[1,75]},{39:[1,76]},{39:[1,77]},e(b,[2,34]),e(b,[2,35]),e(b,[2,36]),e(b,[2,37]),e(vt,[2,46]),e(vt,[2,47]),e(b,[2,15]),e(b,[2,19]),e(Ht,u,{7:78}),e(b,[2,26]),e(b,[2,27]),{5:[1,79]},{5:[1,80]},{4:f,5:y,8:8,9:10,10:12,11:13,12:14,13:15,16:m,17:n,19:T,21:[1,81],22:E,24:N,25:F,26:Y,27:C,28:g,29:P,32:25,33:A,35:H,37:B,38:K,41:D,45:rt,48:yt,51:mt,52:bt,53:kt,54:Et,57:it},e(b,[2,32]),e(b,[2,33]),e(b,[2,21])],defaultActions:{5:[2,1],6:[2,2],47:[2,48],48:[2,49]},parseError:t(function(c,S){if(S.recoverable)this.trace(c);else{var a=Error(c);throw a.hash=S,a}},"parseError"),parse:t(function(c){var S=this,a=[0],k=[],_=[null],i=[],at=this.table,d="",X=0,J=0,ht=0,Ct=2,At=1,ge=i.slice.call(arguments,1),v=Object.create(this.lexer),tt={yy:{}};for(var $t in this.yy)if(Object.prototype.hasOwnProperty.call(this.yy,$t))tt.yy[$t]=this.yy[$t];if(v.setInput(c,tt.yy),tt.yy.lexer=v,tt.yy.parser=this,typeof v.yylloc>"u")v.yylloc={};var Ft=v.yylloc;i.push(Ft);var ye=v.options&&v.options.ranges;if(typeof tt.yy.parseError==="function")this.parseError=tt.yy.parseError;else this.parseError=Object.getPrototypeOf(this).parseError;function me(M){a.length=a.length-2*M,_.length=_.length-M,i.length=i.length-M}t(me,"popStack");function zt(){var M=k.pop()||v.lex()||At;if(typeof M!=="number"){if(M instanceof Array)k=M,M=k.pop();M=S.symbols_[M]||M}return M}t(zt,"lex");var w,Pt,et,V,Qe,Bt,nt={},xt,q,Kt,Lt;while(!0){if(et=a[a.length-1],this.defaultActions[et])V=this.defaultActions[et];else{if(w===null||typeof w>"u")w=zt();V=at[et]&&at[et][w]}if(typeof V>"u"||!V.length||!V[0]){var Gt="";Lt=[];for(xt in at[et])if(this.terminals_[xt]&&xt>Ct)Lt.push("'"+this.terminals_[xt]+"'");if(v.showPosition)Gt="Parse error on line "+(X+1)+`:
1
+ import{t,l,x,R,L,z,O,U,j,G,p,h,wf,W,st,Ye,Je,Mr,_t,St,Tt,lt}from"./index-ctgefatv.js";import{Nt}from"./index-75haaj8g.js";import{Na}from"./index-h1e1abpt.js";var Mt=function(){var e=t(function(Q,c,S,a){for(S=S||{},a=Q.length;a--;S[Q[a]]=c);return S},"o"),s=[1,2],o=[1,3],r=[1,4],u=[2,4],f=[1,9],y=[1,11],m=[1,16],n=[1,17],T=[1,18],E=[1,19],N=[1,33],F=[1,20],Y=[1,21],C=[1,22],g=[1,23],P=[1,24],A=[1,26],H=[1,27],B=[1,28],K=[1,29],D=[1,30],rt=[1,31],yt=[1,32],mt=[1,35],bt=[1,36],kt=[1,37],Et=[1,38],it=[1,34],b=[1,4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],vt=[1,4,5,14,15,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,39,40,41,45,48,51,52,53,54,57],Ht=[4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],Rt={trace:t(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SPACE:4,NL:5,SD:6,document:7,line:8,statement:9,classDefStatement:10,styleStatement:11,cssClassStatement:12,idStatement:13,DESCR:14,"-->":15,HIDE_EMPTY:16,scale:17,WIDTH:18,COMPOSIT_STATE:19,STRUCT_START:20,STRUCT_STOP:21,STATE_DESCR:22,AS:23,ID:24,FORK:25,JOIN:26,CHOICE:27,CONCURRENT:28,note:29,notePosition:30,NOTE_TEXT:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,CLICK:38,STRING:39,HREF:40,classDef:41,CLASSDEF_ID:42,CLASSDEF_STYLEOPTS:43,DEFAULT:44,style:45,STYLE_IDS:46,STYLEDEF_STYLEOPTS:47,class:48,CLASSENTITY_IDS:49,STYLECLASS:50,direction_tb:51,direction_bt:52,direction_rl:53,direction_lr:54,eol:55,";":56,EDGE_STATE:57,STYLE_SEPARATOR:58,left_of:59,right_of:60,$accept:0,$end:1},terminals_:{2:"error",4:"SPACE",5:"NL",6:"SD",14:"DESCR",15:"-->",16:"HIDE_EMPTY",17:"scale",18:"WIDTH",19:"COMPOSIT_STATE",20:"STRUCT_START",21:"STRUCT_STOP",22:"STATE_DESCR",23:"AS",24:"ID",25:"FORK",26:"JOIN",27:"CHOICE",28:"CONCURRENT",29:"note",31:"NOTE_TEXT",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",38:"CLICK",39:"STRING",40:"HREF",41:"classDef",42:"CLASSDEF_ID",43:"CLASSDEF_STYLEOPTS",44:"DEFAULT",45:"style",46:"STYLE_IDS",47:"STYLEDEF_STYLEOPTS",48:"class",49:"CLASSENTITY_IDS",50:"STYLECLASS",51:"direction_tb",52:"direction_bt",53:"direction_rl",54:"direction_lr",56:";",57:"EDGE_STATE",58:"STYLE_SEPARATOR",59:"left_of",60:"right_of"},productions_:[0,[3,2],[3,2],[3,2],[7,0],[7,2],[8,2],[8,1],[8,1],[9,1],[9,1],[9,1],[9,1],[9,2],[9,3],[9,4],[9,1],[9,2],[9,1],[9,4],[9,3],[9,6],[9,1],[9,1],[9,1],[9,1],[9,4],[9,4],[9,1],[9,2],[9,2],[9,1],[9,5],[9,5],[10,3],[10,3],[11,3],[12,3],[32,1],[32,1],[32,1],[32,1],[55,1],[55,1],[13,1],[13,1],[13,3],[13,3],[30,1],[30,1]],performAction:t(function(c,S,a,k,_,i,at){var d=i.length-1;switch(_){case 3:return k.setRootDoc(i[d]),i[d];break;case 4:this.$=[];break;case 5:if(i[d]!="nl")i[d-1].push(i[d]),this.$=i[d-1];break;case 6:case 7:this.$=i[d];break;case 8:this.$="nl";break;case 12:this.$=i[d];break;case 13:let Ct=i[d-1];Ct.description=k.trimColon(i[d]),this.$=Ct;break;case 14:this.$={stmt:"relation",state1:i[d-2],state2:i[d]};break;case 15:let At=k.trimColon(i[d]);this.$={stmt:"relation",state1:i[d-3],state2:i[d-1],description:At};break;case 19:this.$={stmt:"state",id:i[d-3],type:"default",description:"",doc:i[d-1]};break;case 20:var X=i[d],J=i[d-2].trim();if(i[d].match(":")){var ht=i[d].split(":");X=ht[0],J=[J,ht[1]]}this.$={stmt:"state",id:X,type:"default",description:J};break;case 21:this.$={stmt:"state",id:i[d-3],type:"default",description:i[d-5],doc:i[d-1]};break;case 22:this.$={stmt:"state",id:i[d],type:"fork"};break;case 23:this.$={stmt:"state",id:i[d],type:"join"};break;case 24:this.$={stmt:"state",id:i[d],type:"choice"};break;case 25:this.$={stmt:"state",id:k.getDividerId(),type:"divider"};break;case 26:this.$={stmt:"state",id:i[d-1].trim(),note:{position:i[d-2].trim(),text:i[d].trim()}};break;case 29:this.$=i[d].trim(),k.setAccTitle(this.$);break;case 30:case 31:this.$=i[d].trim(),k.setAccDescription(this.$);break;case 32:this.$={stmt:"click",id:i[d-3],url:i[d-2],tooltip:i[d-1]};break;case 33:this.$={stmt:"click",id:i[d-3],url:i[d-1],tooltip:""};break;case 34:case 35:this.$={stmt:"classDef",id:i[d-1].trim(),classes:i[d].trim()};break;case 36:this.$={stmt:"style",id:i[d-1].trim(),styleClass:i[d].trim()};break;case 37:this.$={stmt:"applyClass",id:i[d-1].trim(),styleClass:i[d].trim()};break;case 38:k.setDirection("TB"),this.$={stmt:"dir",value:"TB"};break;case 39:k.setDirection("BT"),this.$={stmt:"dir",value:"BT"};break;case 40:k.setDirection("RL"),this.$={stmt:"dir",value:"RL"};break;case 41:k.setDirection("LR"),this.$={stmt:"dir",value:"LR"};break;case 44:case 45:this.$={stmt:"state",id:i[d].trim(),type:"default",description:""};break;case 46:this.$={stmt:"state",id:i[d-2].trim(),classes:[i[d].trim()],type:"default",description:""};break;case 47:this.$={stmt:"state",id:i[d-2].trim(),classes:[i[d].trim()],type:"default",description:""};break}},"anonymous"),table:[{3:1,4:s,5:o,6:r},{1:[3]},{3:5,4:s,5:o,6:r},{3:6,4:s,5:o,6:r},e([1,4,5,16,17,19,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],u,{7:7}),{1:[2,1]},{1:[2,2]},{1:[2,3],4:f,5:y,8:8,9:10,10:12,11:13,12:14,13:15,16:m,17:n,19:T,22:E,24:N,25:F,26:Y,27:C,28:g,29:P,32:25,33:A,35:H,37:B,38:K,41:D,45:rt,48:yt,51:mt,52:bt,53:kt,54:Et,57:it},e(b,[2,5]),{9:39,10:12,11:13,12:14,13:15,16:m,17:n,19:T,22:E,24:N,25:F,26:Y,27:C,28:g,29:P,32:25,33:A,35:H,37:B,38:K,41:D,45:rt,48:yt,51:mt,52:bt,53:kt,54:Et,57:it},e(b,[2,7]),e(b,[2,8]),e(b,[2,9]),e(b,[2,10]),e(b,[2,11]),e(b,[2,12],{14:[1,40],15:[1,41]}),e(b,[2,16]),{18:[1,42]},e(b,[2,18],{20:[1,43]}),{23:[1,44]},e(b,[2,22]),e(b,[2,23]),e(b,[2,24]),e(b,[2,25]),{30:45,31:[1,46],59:[1,47],60:[1,48]},e(b,[2,28]),{34:[1,49]},{36:[1,50]},e(b,[2,31]),{13:51,24:N,57:it},{42:[1,52],44:[1,53]},{46:[1,54]},{49:[1,55]},e(vt,[2,44],{58:[1,56]}),e(vt,[2,45],{58:[1,57]}),e(b,[2,38]),e(b,[2,39]),e(b,[2,40]),e(b,[2,41]),e(b,[2,6]),e(b,[2,13]),{13:58,24:N,57:it},e(b,[2,17]),e(Ht,u,{7:59}),{24:[1,60]},{24:[1,61]},{23:[1,62]},{24:[2,48]},{24:[2,49]},e(b,[2,29]),e(b,[2,30]),{39:[1,63],40:[1,64]},{43:[1,65]},{43:[1,66]},{47:[1,67]},{50:[1,68]},{24:[1,69]},{24:[1,70]},e(b,[2,14],{14:[1,71]}),{4:f,5:y,8:8,9:10,10:12,11:13,12:14,13:15,16:m,17:n,19:T,21:[1,72],22:E,24:N,25:F,26:Y,27:C,28:g,29:P,32:25,33:A,35:H,37:B,38:K,41:D,45:rt,48:yt,51:mt,52:bt,53:kt,54:Et,57:it},e(b,[2,20],{20:[1,73]}),{31:[1,74]},{24:[1,75]},{39:[1,76]},{39:[1,77]},e(b,[2,34]),e(b,[2,35]),e(b,[2,36]),e(b,[2,37]),e(vt,[2,46]),e(vt,[2,47]),e(b,[2,15]),e(b,[2,19]),e(Ht,u,{7:78}),e(b,[2,26]),e(b,[2,27]),{5:[1,79]},{5:[1,80]},{4:f,5:y,8:8,9:10,10:12,11:13,12:14,13:15,16:m,17:n,19:T,21:[1,81],22:E,24:N,25:F,26:Y,27:C,28:g,29:P,32:25,33:A,35:H,37:B,38:K,41:D,45:rt,48:yt,51:mt,52:bt,53:kt,54:Et,57:it},e(b,[2,32]),e(b,[2,33]),e(b,[2,21])],defaultActions:{5:[2,1],6:[2,2],47:[2,48],48:[2,49]},parseError:t(function(c,S){if(S.recoverable)this.trace(c);else{var a=Error(c);throw a.hash=S,a}},"parseError"),parse:t(function(c){var S=this,a=[0],k=[],_=[null],i=[],at=this.table,d="",X=0,J=0,ht=0,Ct=2,At=1,ge=i.slice.call(arguments,1),v=Object.create(this.lexer),tt={yy:{}};for(var $t in this.yy)if(Object.prototype.hasOwnProperty.call(this.yy,$t))tt.yy[$t]=this.yy[$t];if(v.setInput(c,tt.yy),tt.yy.lexer=v,tt.yy.parser=this,typeof v.yylloc>"u")v.yylloc={};var Ft=v.yylloc;i.push(Ft);var ye=v.options&&v.options.ranges;if(typeof tt.yy.parseError==="function")this.parseError=tt.yy.parseError;else this.parseError=Object.getPrototypeOf(this).parseError;function me(M){a.length=a.length-2*M,_.length=_.length-M,i.length=i.length-M}t(me,"popStack");function zt(){var M=k.pop()||v.lex()||At;if(typeof M!=="number"){if(M instanceof Array)k=M,M=k.pop();M=S.symbols_[M]||M}return M}t(zt,"lex");var w,Pt,et,V,Qe,Bt,nt={},xt,q,Kt,Lt;while(!0){if(et=a[a.length-1],this.defaultActions[et])V=this.defaultActions[et];else{if(w===null||typeof w>"u")w=zt();V=at[et]&&at[et][w]}if(typeof V>"u"||!V.length||!V[0]){var Gt="";Lt=[];for(xt in at[et])if(this.terminals_[xt]&&xt>Ct)Lt.push("'"+this.terminals_[xt]+"'");if(v.showPosition)Gt="Parse error on line "+(X+1)+`:
2
2
  `+v.showPosition()+`
3
3
  Expecting `+Lt.join(", ")+", got '"+(this.terminals_[w]||w)+"'";else Gt="Parse error on line "+(X+1)+": Unexpected "+(w==At?"end of input":"'"+(this.terminals_[w]||w)+"'");this.parseError(Gt,{text:v.match,token:this.terminals_[w]||w,line:v.yylineno,loc:Ft,expected:Lt})}if(V[0]instanceof Array&&V.length>1)throw Error("Parse Error: multiple actions possible at state: "+et+", token: "+w);switch(V[0]){case 1:if(a.push(w),_.push(v.yytext),i.push(v.yylloc),a.push(V[1]),w=null,!Pt){if(J=v.yyleng,d=v.yytext,X=v.yylineno,Ft=v.yylloc,ht>0)ht--}else w=Pt,Pt=null;break;case 2:if(q=this.productions_[V[1]][1],nt.$=_[_.length-q],nt._$={first_line:i[i.length-(q||1)].first_line,last_line:i[i.length-1].last_line,first_column:i[i.length-(q||1)].first_column,last_column:i[i.length-1].last_column},ye)nt._$.range=[i[i.length-(q||1)].range[0],i[i.length-1].range[1]];if(Bt=this.performAction.apply(nt,[d,J,X,tt.yy,V[1],_,i].concat(ge)),typeof Bt<"u")return Bt;if(q)a=a.slice(0,-1*q*2),_=_.slice(0,-1*q),i=i.slice(0,-1*q);a.push(this.productions_[V[1]][0]),_.push(nt.$),i.push(nt._$),Kt=at[a[a.length-2]][a[a.length-1]],a.push(Kt);break;case 3:return!0}}return!0},"parse")},Se=function(){var Q={EOF:1,parseError:t(function(S,a){if(this.yy.parser)this.yy.parser.parseError(S,a);else throw Error(S)},"parseError"),setInput:t(function(c,S){if(this.yy=S||this.yy||{},this._input=c,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges)this.yylloc.range=[0,0];return this.offset=0,this},"setInput"),input:t(function(){var c=this._input[0];this.yytext+=c,this.yyleng++,this.offset++,this.match+=c,this.matched+=c;var S=c.match(/(?:\r\n?|\n).*/g);if(S)this.yylineno++,this.yylloc.last_line++;else this.yylloc.last_column++;if(this.options.ranges)this.yylloc.range[1]++;return this._input=this._input.slice(1),c},"input"),unput:t(function(c){var S=c.length,a=c.split(/(?:\r\n?|\n)/g);this._input=c+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-S),this.offset-=S;var k=this.match.split(/(?:\r\n?|\n)/g);if(this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),a.length-1)this.yylineno-=a.length-1;var _=this.yylloc.range;if(this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:a?(a.length===k.length?this.yylloc.first_column:0)+k[k.length-a.length].length-a[0].length:this.yylloc.first_column-S},this.options.ranges)this.yylloc.range=[_[0],_[0]+this.yyleng-S];return this.yyleng=this.yytext.length,this},"unput"),more:t(function(){return this._more=!0,this},"more"),reject:t(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else 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).
4
4
  `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:t(function(c){this.unput(this.match.slice(c))},"less"),pastInput:t(function(){var c=this.matched.substr(0,this.matched.length-this.match.length);return(c.length>20?"...":"")+c.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:t(function(){var c=this.match;if(c.length<20)c+=this._input.substr(0,20-c.length);return(c.substr(0,20)+(c.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:t(function(){var c=this.pastInput(),S=Array(c.length+1).join("-");return c+this.upcomingInput()+`
5
5
  `+S+"^"},"showPosition"),test_match:t(function(c,S){var a,k,_;if(this.options.backtrack_lexer){if(_={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges)_.yylloc.range=this.yylloc.range.slice(0)}if(k=c[0].match(/(?:\r\n?|\n).*/g),k)this.yylineno+=k.length;if(this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:k?k[k.length-1].length-k[k.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+c[0].length},this.yytext+=c[0],this.match+=c[0],this.matches=c,this.yyleng=this.yytext.length,this.options.ranges)this.yylloc.range=[this.offset,this.offset+=this.yyleng];if(this._more=!1,this._backtrack=!1,this._input=this._input.slice(c[0].length),this.matched+=c[0],a=this.performAction.call(this,this.yy,this,S,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input)this.done=!1;if(a)return a;else if(this._backtrack){for(var i in _)this[i]=_[i];return!1}return!1},"test_match"),next:t(function(){if(this.done)return this.EOF;if(!this._input)this.done=!0;var c,S,a,k;if(!this._more)this.yytext="",this.match="";var _=this._currentRules();for(var i=0;i<_.length;i++)if(a=this._input.match(this.rules[_[i]]),a&&(!S||a[0].length>S[0].length)){if(S=a,k=i,this.options.backtrack_lexer)if(c=this.test_match(a,_[i]),c!==!1)return c;else if(this._backtrack){S=!1;continue}else return!1;else if(!this.options.flex)break}if(S){if(c=this.test_match(S,_[k]),c!==!1)return c;return!1}if(this._input==="")return this.EOF;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
6
- `+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:t(function(){var S=this.next();if(S)return S;else return this.lex()},"lex"),begin:t(function(S){this.conditionStack.push(S)},"begin"),popState:t(function(){var S=this.conditionStack.length-1;if(S>0)return this.conditionStack.pop();else return this.conditionStack[0]},"popState"),_currentRules:t(function(){if(this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1])return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules;else return this.conditions.INITIAL.rules},"_currentRules"),topState:t(function(S){if(S=this.conditionStack.length-1-Math.abs(S||0),S>=0)return this.conditionStack[S];else return"INITIAL"},"topState"),pushState:t(function(S){this.begin(S)},"pushState"),stateStackSize:t(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:t(function(S,a,k,_){function i(){let d=a.yytext.indexOf("%%");if(d===0)return!1;if(d>0){let X=a.yytext.slice(0,d),J=a.yytext.slice(d);if(J)S.lexer.unput(J);a.yytext=X}return!0}t(i,"processId");var at=_;switch(k){case 0:return 38;case 1:return 40;case 2:return 39;case 3:return 44;case 4:return 51;case 5:return 52;case 6:return 53;case 7:return 54;case 8:return 5;case 9:break;case 10:break;case 11:break;case 12:break;case 13:return this.pushState("SCALE"),17;break;case 14:return 18;case 15:this.popState();break;case 16:return this.begin("acc_title"),33;break;case 17:return this.popState(),"acc_title_value";break;case 18:return this.begin("acc_descr"),35;break;case 19:return this.popState(),"acc_descr_value";break;case 20:this.begin("acc_descr_multiline");break;case 21:this.popState();break;case 22:return"acc_descr_multiline_value";case 23:return this.pushState("CLASSDEF"),41;break;case 24:return this.popState(),this.pushState("CLASSDEFID"),"DEFAULT_CLASSDEF_ID";break;case 25:return this.popState(),this.pushState("CLASSDEFID"),42;break;case 26:return this.popState(),43;break;case 27:return this.pushState("CLASS"),48;break;case 28:return this.popState(),this.pushState("CLASS_STYLE"),49;break;case 29:return this.popState(),50;break;case 30:return this.pushState("STYLE"),45;break;case 31:return this.popState(),this.pushState("STYLEDEF_STYLES"),46;break;case 32:return this.popState(),47;break;case 33:return this.pushState("SCALE"),17;break;case 34:return 18;case 35:this.popState();break;case 36:this.pushState("STATE");break;case 37:return this.popState(),a.yytext=a.yytext.slice(0,-8).trim(),25;break;case 38:return this.popState(),a.yytext=a.yytext.slice(0,-8).trim(),26;break;case 39:return this.popState(),a.yytext=a.yytext.slice(0,-10).trim(),27;break;case 40:return this.popState(),a.yytext=a.yytext.slice(0,-8).trim(),25;break;case 41:return this.popState(),a.yytext=a.yytext.slice(0,-8).trim(),26;break;case 42:return this.popState(),a.yytext=a.yytext.slice(0,-10).trim(),27;break;case 43:return 51;case 44:return 52;case 45:return 53;case 46:return 54;case 47:this.pushState("STATE_STRING");break;case 48:return this.pushState("STATE_ID"),"AS";break;case 49:if(!i())return;return this.popState(),"ID";break;case 50:this.popState();break;case 51:return"STATE_DESCR";case 52:throw Error('Error: State name must be a single word. Found: "'+a.yytext.trim()+'"');case 53:return 19;case 54:this.popState();break;case 55:return this.popState(),this.pushState("struct"),20;break;case 56:return this.popState(),21;break;case 57:break;case 58:return this.begin("NOTE"),29;break;case 59:return this.popState(),this.pushState("NOTE_ID"),59;break;case 60:return this.popState(),this.pushState("NOTE_ID"),60;break;case 61:this.popState(),this.pushState("FLOATING_NOTE");break;case 62:return this.popState(),this.pushState("FLOATING_NOTE_ID"),"AS";break;case 63:break;case 64:return"NOTE_TEXT";case 65:if(!i())return;return this.popState(),"ID";break;case 66:if(!i())return;return this.popState(),this.pushState("NOTE_TEXT"),24;break;case 67:return this.popState(),a.yytext=a.yytext.substr(2).trim(),31;break;case 68:return this.popState(),a.yytext=a.yytext.slice(0,-8).trim(),31;break;case 69:return 6;case 70:return 6;case 71:return 16;case 72:return 57;case 73:if(!i())return;return 24;case 74:return a.yytext=a.yytext.trim(),14;break;case 75:return 15;case 76:return 28;case 77:return 58;case 78:return 5;case 79:return"INVALID"}},"anonymous"),rules:[/^(?:click\b)/i,/^(?:href\b)/i,/^(?:"[^"]*")/i,/^(?:default\b)/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:[\n]+)/i,/^(?:[\s]+)/i,/^(?:((?!\n)\s)+)/i,/^(?:#[^\n]*)/i,/^(?:%%(?!\{)[^\n]*)/i,/^(?:scale\s+)/i,/^(?:\d+)/i,/^(?:\s+width\b)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:classDef\s+)/i,/^(?:DEFAULT\s+)/i,/^(?:\w+\s+)/i,/^(?:[^\n]*)/i,/^(?:class\s+)/i,/^(?:(\w+)+((,\s*\w+)*))/i,/^(?:[^\n]*)/i,/^(?:style\s+)/i,/^(?:[\w,]+\s+)/i,/^(?:[^\n]*)/i,/^(?:scale\s+)/i,/^(?:\d+)/i,/^(?:\s+width\b)/i,/^(?:state\s+)/i,/^(?:.*<<fork>>)/i,/^(?:.*<<join>>)/i,/^(?:.*<<choice>>)/i,/^(?:.*\[\[fork\]\])/i,/^(?:.*\[\[join\]\])/i,/^(?:.*\[\[choice\]\])/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:["])/i,/^(?:\s*as\s+)/i,/^(?:[^\n\{]*)/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:\w+\s+\w+.*?\{)/i,/^(?:[^\n\s\{]+)/i,/^(?:\n)/i,/^(?:\{)/i,/^(?:\})/i,/^(?:[\n])/i,/^(?:note\s+)/i,/^(?:left of\b)/i,/^(?:right of\b)/i,/^(?:")/i,/^(?:\s*as\s*)/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[^\n]*)/i,/^(?:\s*[^:\n\s\-]+)/i,/^(?:\s*:[^:\n;]+)/i,/^(?:[\s\S]*?\n\s*end note\b)/i,/^(?:stateDiagram\s+)/i,/^(?:stateDiagram-v2\s+)/i,/^(?:hide empty description\b)/i,/^(?:\[\*\])/i,/^(?:[^:\n\s\-\{]+)/i,/^(?:\s*:(?:[^:\n;]|:[^:\n;])+)/i,/^(?:-->)/i,/^(?:--)/i,/^(?::::)/i,/^(?:$)/i,/^(?:.)/i],conditions:{LINE:{rules:[10,11,12],inclusive:!1},struct:{rules:[10,11,12,23,27,30,36,43,44,45,46,56,57,58,72,73,74,75,76,77],inclusive:!1},FLOATING_NOTE_ID:{rules:[65],inclusive:!1},FLOATING_NOTE:{rules:[62,63,64],inclusive:!1},NOTE_TEXT:{rules:[67,68],inclusive:!1},NOTE_ID:{rules:[66],inclusive:!1},NOTE:{rules:[59,60,61],inclusive:!1},STYLEDEF_STYLEOPTS:{rules:[],inclusive:!1},STYLEDEF_STYLES:{rules:[32],inclusive:!1},STYLE_IDS:{rules:[],inclusive:!1},STYLE:{rules:[31],inclusive:!1},CLASS_STYLE:{rules:[29],inclusive:!1},CLASS:{rules:[28],inclusive:!1},CLASSDEFID:{rules:[26],inclusive:!1},CLASSDEF:{rules:[24,25],inclusive:!1},acc_descr_multiline:{rules:[21,22],inclusive:!1},acc_descr:{rules:[19],inclusive:!1},acc_title:{rules:[17],inclusive:!1},SCALE:{rules:[14,15,34,35],inclusive:!1},ALIAS:{rules:[],inclusive:!1},STATE_ID:{rules:[49],inclusive:!1},STATE_STRING:{rules:[50,51],inclusive:!1},FORK_STATE:{rules:[],inclusive:!1},STATE:{rules:[10,11,12,37,38,39,40,41,42,47,48,52,53,54,55],inclusive:!1},ID:{rules:[10,11,12],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,11,12,13,16,18,20,23,27,30,33,36,55,58,69,70,71,72,73,74,75,77,78,79],inclusive:!0}}};return Q}();Rt.lexer=Se;function Dt(){this.yy={}}return t(Dt,"Parser"),Dt.prototype=Rt,Rt.Parser=Dt,new Dt}();Mt.parser=Mt;var be=Mt,ke="TB",ee="TB",Xt="dir",ct="state",ot="root",Wt="relation",Te="classDef",Ee="style",_e="applyClass",pt="default",se="divider",re="fill:none",ie="fill: #333",ae="c",ne="markdown",oe="normal",Yt="rect",Vt="rectWithTitle",ve="stateStart",De="stateEnd",jt="divider",Jt="roundedWithTitle",Ce="note",Ae="noteGroup",gt="statediagram",xe="state",Le=`${gt}-${xe}`,le="transition",we="note",Ie="note-edge",Ne=`${le} ${Ie}`,Oe=`${gt}-${we}`,Re="cluster",$e=`${gt}-${Re}`,Fe="cluster-alt",Pe=`${gt}-${Fe}`,ce="parent",he="note",Be="state",Ut="----",Ge=`${Ut}${he}`,qt=`${Ut}${ce}`,It=new Map,Z=0,de=0,dt=new Map,Ve=t((e,s,o,r)=>{if(e===jt&&o?.id!==void 0&&dt.has(o.id)){let y=dt.get(o.id);return dt.set(s,y),y}let u=de++,f=r?void 0:u;return dt.set(s,f),f},"colorSlotFor");function Ot(e="",s=0,o="",r=Ut){let u=o!==null&&o.length>0?`${r}${o}`:"";return`${Be}-${e}${u}-${s}`}t(Ot,"stateDomId");var Me=t((e,s,o,r,u,f,y,m)=>{l.trace("items",s),s.forEach((n)=>{switch(n.stmt){case ct:ft(e,n,o,r,u,f,y,m);break;case pt:ft(e,n,o,r,u,f,y,m);break;case Wt:{ft(e,n.state1,o,r,u,f,y,m),ft(e,n.state2,o,r,u,f,y,m);let T=y==="neo",E={id:"edge"+Z,start:n.state1.id,end:n.state2.id,arrowhead:"normal",arrowTypeEnd:T?"arrow_barb_neo":"arrow_barb",style:re,labelStyle:"",label:x.sanitizeText(n.description??"",p()),arrowheadStyle:ie,labelpos:ae,labelType:ne,thickness:oe,classes:le,look:y};u.push(E),Z++}break}})},"setupDoc"),Qt=t((e,s=ee)=>{let o=s;if(e.doc){for(let r of e.doc)if(r.stmt==="dir")o=r.value}return o},"getDir");function ut(e,s,o){if(!s.id||s.id==="</join></fork>"||s.id==="</choice>")return;if(s.cssClasses){if(!Array.isArray(s.cssCompiledStyles))s.cssCompiledStyles=[];s.cssClasses.split(" ").forEach((u)=>{let f=o.get(u);if(f)s.cssCompiledStyles=[...s.cssCompiledStyles??[],...f.styles]})}let r=e.find((u)=>u.id===s.id);if(r)Object.assign(r,s);else e.push(s)}t(ut,"insertOrUpdateNode");function ue(e){return e?.classes?.join(" ")??""}t(ue,"getClassesFromDbInfo");function fe(e){return e?.styles??[]}t(fe,"getStylesFromDbInfo");var ft=t((e,s,o,r,u,f,y,m)=>{let n=s.id,T=o.get(n),E=ue(T),N=fe(T),F=p(),Y=E.trim()!==""||N.length>0;if(l.info("dataFetcher parsedItem",s,T,N),n!=="root"){let C=Yt;if(s.start===!0)C=ve;else if(s.start===!1)C=De;if(s.type!==pt)C=s.type;if(!It.get(n))It.set(n,{id:n,shape:C,description:x.sanitizeText(n,F),cssClasses:`${E} ${Le}`,cssStyles:N});let g=It.get(n);if(s.description){if(Array.isArray(g.description))g.shape=Vt,g.description.push(s.description);else if(g.description?.length&&g.description.length>0)if(g.shape=Vt,g.description===n)g.description=[s.description];else g.description=[g.description,s.description];else g.shape=Yt,g.description=s.description;g.description=x.sanitizeTextOrArray(g.description,F)}if(g.description?.length===1&&g.shape===Vt)if(g.type==="group")g.shape=Jt;else g.shape=Yt;if(!g.type&&s.doc)l.info("Setting cluster for XCX",n,Qt(s)),g.type="group",g.isGroup=!0,g.dir=Qt(s),g.shape=s.type===se?jt:Jt,g.colorIndex=Ve(g.shape,n,e,Y),g.cssClasses=`${g.cssClasses} ${$e} ${f?Pe:""}`;let P={labelStyle:"",shape:g.shape,label:g.description,cssClasses:g.cssClasses,cssCompiledStyles:[],cssStyles:g.cssStyles,id:n,dir:g.dir,domId:Ot(n,Z),type:g.type,isGroup:g.type==="group",colorIndex:g.colorIndex,padding:8,rx:10,ry:10,look:y,labelType:"markdown"};if(P.shape===jt)P.label="";if(e&&e.id!=="root")l.trace("Setting node ",n," to be child of its parent ",e.id),P.parentId=e.id;if(P.centerLabel=!0,s.note){let A={labelStyle:"",shape:Ce,label:s.note.text,labelType:"markdown",cssClasses:Oe,cssStyles:[],cssCompiledStyles:[],id:n+Ge+"-"+Z,domId:Ot(n,Z,he),type:"node",isGroup:!1,padding:F.flowchart?.padding,look:y,position:s.note.position},H=n+qt,B={labelStyle:"",shape:Ae,label:s.note.text,cssClasses:g.cssClasses,cssStyles:[],id:n+qt,domId:Ot(n,Z,ce),type:"group",isGroup:!0,padding:16,look:y,position:s.note.position};Z++,B.id=H,A.parentId=H,ut(r,B,m),ut(r,A,m),ut(r,P,m);let K=n,D=A.id;if(s.note.position==="left of")K=A.id,D=n;u.push({id:K+"-"+D,start:K,end:D,arrowhead:"none",arrowTypeEnd:"",style:re,labelStyle:"",classes:Ne,pattern:"dashed",arrowheadStyle:ie,labelpos:ae,labelType:ne,thickness:oe,look:y})}else ut(r,P,m)}if(s.doc)l.trace("Adding nodes children "),Me(s,s.doc,o,r,u,!f,y,m)},"dataFetcher"),We=t(()=>{It.clear(),Z=0,de=0,dt.clear()},"reset"),pe=t((e,s=ee)=>{if(!e.doc)return s;let o=s;for(let r of e.doc)if(r.stmt==="dir")o=r.value;return o},"getDir"),je=t(function(e,s){return s.db.getClasses()},"getClasses"),Ue=t(async function(e,s,o,r){l.info("REF0:"),l.info("Drawing state diagram (v2)",s);let{securityLevel:u,state:f,layout:y}=p();r.db.extract(r.db.getRootDocV2());let m=r.db.getData(),n=Tt(s,u);if(m.type=r.type,m.layoutAlgorithm=St(y),m.nodeSpacing=f?.nodeSpacing||50,m.rankSpacing=f?.rankSpacing||50,p().look==="neo")m.markers=["barbNeo"];else m.markers=["barb"];m.diagramId=s,await _t(m,n);let E=8;try{(typeof r.db.getLinks==="function"?r.db.getLinks():new Map).forEach((F,Y)=>{let C=typeof Y==="string"?Y:typeof Y?.id==="string"?Y.id:"",g=m.nodes.find((D)=>D.id===C);if(!C){l.warn("⚠️ Invalid or missing stateId from key:",JSON.stringify(Y));return}let P=n.node()?.querySelectorAll("g.node, g.rough-node"),A;if(P?.forEach((D)=>{let rt=D.textContent?.trim();if(D.id===g?.domId||rt===C)A=D}),!A){l.warn("⚠️ Could not find node matching text:",C);return}let H=A.parentNode;if(!H){l.warn("⚠️ Node has no parent, cannot wrap:",C);return}let B=document.createElementNS("http://www.w3.org/2000/svg","a"),K=F.url.replace(/^"+|"+$/g,"");if(B.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",K),B.setAttribute("target","_blank"),F.tooltip){let D=F.tooltip.replace(/^"+|"+$/g,"");B.setAttribute("title",D),A.setAttribute("title",D)}H.replaceChild(B,A),B.appendChild(A),l.info("\uD83D\uDD17 Wrapped node in <a> tag for:",C,F.url)})}catch(N){l.error("❌ Error injecting clickable links:",N)}W.insertTitle(n,"statediagramTitleText",f?.titleTopMargin??25,r.db.getDiagramTitle()),lt(n,E,gt,f?.useMaxWidth??!0)},"draw"),He={getClasses:je,draw:Ue,getDir:pe},I={START_NODE:"[*]",START_TYPE:"start",END_NODE:"[*]",END_TYPE:"end",COLOR_KEYWORD:"color",FILL_KEYWORD:"fill",BG_FILL:"bgFill",STYLECLASS_SEP:","},Zt=t(()=>new Map,"newClassesList"),te=t(()=>({relations:[],states:new Map,documents:{}}),"newDoc"),wt=t((e)=>JSON.parse(JSON.stringify(e)),"clone"),ze=class{constructor(e){this.version=e,this.nodes=[],this.edges=[],this.rootDoc=[],this.classes=Zt(),this.documents={root:te()},this.currentDocument=this.documents.root,this.startEndCount=0,this.dividerCnt=0,this.links=new Map,this.funs=[],this.getAccTitle=z,this.setAccTitle=L,this.getAccDescription=U,this.setAccDescription=O,this.setDiagramTitle=j,this.getDiagramTitle=G,this.clear(),this.setRootDoc=this.setRootDoc.bind(this),this.getDividerId=this.getDividerId.bind(this),this.setDirection=this.setDirection.bind(this),this.trimColon=this.trimColon.bind(this),this.bindFunctions=this.bindFunctions.bind(this)}static{t(this,"StateDB")}static{this.relationType={AGGREGATION:0,EXTENSION:1,COMPOSITION:2,DEPENDENCY:3}}extract(e){this.clear(!0);for(let r of Array.isArray(e)?e:e.doc)switch(r.stmt){case ct:this.addState(r.id.trim(),r.type,r.doc,r.description,r.note);break;case Wt:this.addRelation(r.state1,r.state2,r.description);break;case Te:this.addStyleClass(r.id.trim(),r.classes);break;case Ee:this.handleStyleDef(r);break;case _e:this.setCssClass(r.id.trim(),r.styleClass);break;case"click":this.addLink(r.id,r.url,r.tooltip);break}let s=this.getStates(),o=p();We(),ft(void 0,this.getRootDocV2(),s,this.nodes,this.edges,!0,o.look,this.classes);for(let r of this.nodes){if(!Array.isArray(r.label))continue;if(r.description=r.label.slice(1),r.isGroup&&r.description.length>0)throw Error(`Group nodes can only have label. Remove the additional description for node [${r.id}]`);r.label=r.label[0]}}handleStyleDef(e){let s=e.id.trim().split(","),o=e.styleClass.split(",");for(let r of s){let u=this.getState(r);if(!u){let f=r.trim();this.addState(f),u=this.getState(f)}if(u)u.styles=o.map((f)=>f.replace(/;/g,"")?.trim())}}setRootDoc(e){if(l.info("Setting root doc",e),this.rootDoc=e,this.version===1)this.extract(e);else this.extract(this.getRootDocV2())}docTranslator(e,s,o){if(s.stmt===Wt){this.docTranslator(e,s.state1,!0),this.docTranslator(e,s.state2,!1);return}if(s.stmt===ct)if(s.id===I.START_NODE)s.id=e.id+(o?"_start":"_end"),s.start=o;else s.id=s.id.trim();if(s.stmt!==ot&&s.stmt!==ct||!s.doc)return;let r=[],u=[];for(let f of s.doc)if(f.type===se){let y=wt(f);y.doc=wt(u),r.push(y),u=[]}else u.push(f);if(r.length>0&&u.length>0){let f={stmt:ct,id:xf(),type:"divider",doc:wt(u)};r.push(wt(f)),s.doc=r}s.doc.forEach((f)=>this.docTranslator(s,f,!0))}getRootDocV2(){return this.docTranslator({id:ot,stmt:ot},{id:ot,stmt:ot,doc:this.rootDoc},!0),{id:ot,doc:this.rootDoc}}addState(e,s=pt,o=void 0,r=void 0,u=void 0,f=void 0,y=void 0,m=void 0){let n=e?.trim();if(!this.currentDocument.states.has(n))l.info("Adding state ",n,r),this.currentDocument.states.set(n,{stmt:ct,id:n,descriptions:[],type:s,doc:o,note:u,classes:[],styles:[],textStyles:[]});else{let T=this.currentDocument.states.get(n);if(!T)throw Error(`State not found: ${n}`);if(!T.doc)T.doc=o;if(!T.type)T.type=s}if(r)l.info("Setting state description",n,r),(Array.isArray(r)?r:[r]).forEach((E)=>this.addDescription(n,E.trim()));if(u){let T=this.currentDocument.states.get(n);if(!T)throw Error(`State not found: ${n}`);T.note=u,T.note.text=x.sanitizeText(T.note.text,p())}if(f)l.info("Setting state classes",n,f),(Array.isArray(f)?f:[f]).forEach((E)=>this.setCssClass(n,E.trim()));if(y)l.info("Setting state styles",n,y),(Array.isArray(y)?y:[y]).forEach((E)=>this.setStyle(n,E.trim()));if(m)l.info("Setting state styles",n,y),(Array.isArray(m)?m:[m]).forEach((E)=>this.setTextStyle(n,E.trim()))}clear(e){if(this.nodes=[],this.edges=[],this.funs=[this.setupToolTips.bind(this)],this.documents={root:te()},this.currentDocument=this.documents.root,this.startEndCount=0,this.classes=Zt(),!e)this.links=new Map,R()}getState(e){return this.currentDocument.states.get(e)}getStates(){return this.currentDocument.states}logDocuments(){l.info("Documents = ",this.documents)}getRelations(){return this.currentDocument.relations}addLink(e,s,o){this.links.set(e,{url:s,tooltip:o}),l.warn("Adding link",e,s,o)}getLinks(){return this.links}startIdIfNeeded(e=""){if(e===I.START_NODE)return this.startEndCount++,`${I.START_TYPE}${this.startEndCount}`;return e}startTypeIfNeeded(e="",s=pt){return e===I.START_NODE?I.START_TYPE:s}endIdIfNeeded(e=""){if(e===I.END_NODE)return this.startEndCount++,`${I.END_TYPE}${this.startEndCount}`;return e}endTypeIfNeeded(e="",s=pt){return e===I.END_NODE?I.END_TYPE:s}addRelationObjs(e,s,o=""){let r=this.startIdIfNeeded(e.id.trim()),u=this.startTypeIfNeeded(e.id.trim(),e.type),f=this.startIdIfNeeded(s.id.trim()),y=this.startTypeIfNeeded(s.id.trim(),s.type);this.addState(r,u,e.doc,e.description,e.note,e.classes,e.styles,e.textStyles),this.addState(f,y,s.doc,s.description,s.note,s.classes,s.styles,s.textStyles),this.currentDocument.relations.push({id1:r,id2:f,relationTitle:x.sanitizeText(o,p())})}addRelation(e,s,o){if(typeof e==="object"&&typeof s==="object")this.addRelationObjs(e,s,o);else if(typeof e==="string"&&typeof s==="string"){let r=this.startIdIfNeeded(e.trim()),u=this.startTypeIfNeeded(e),f=this.endIdIfNeeded(s.trim()),y=this.endTypeIfNeeded(s);this.addState(r,u),this.addState(f,y),this.currentDocument.relations.push({id1:r,id2:f,relationTitle:o?x.sanitizeText(o,p()):void 0})}}addDescription(e,s){let o=this.currentDocument.states.get(e),r=s.startsWith(":")?s.replace(":","").trim():s;o?.descriptions?.push(x.sanitizeText(r,p()))}cleanupLabel(e){return e.startsWith(":")?e.slice(2).trim():e.trim()}getDividerId(){return this.dividerCnt++,`divider-id-${this.dividerCnt}`}addStyleClass(e,s=""){if(!this.classes.has(e))this.classes.set(e,{id:e,styles:[],textStyles:[]});let o=this.classes.get(e);if(s&&o)s.split(I.STYLECLASS_SEP).forEach((r)=>{let u=r.replace(/([^;]*);/,"$1").trim();if(RegExp(I.COLOR_KEYWORD).exec(r)){let y=u.replace(I.FILL_KEYWORD,I.BG_FILL).replace(I.COLOR_KEYWORD,I.FILL_KEYWORD);o.textStyles.push(y)}o.styles.push(u)})}getClasses(){return this.classes}setupToolTips(e){let s=Na();h(e).select("svg").selectAll("g.node, g.rough-node").on("mouseover",(u)=>{let f=h(u.currentTarget),y=f.attr("title");if(y===null)return;let m=u.currentTarget?.getBoundingClientRect();s.transition().duration(200).style("opacity",".9"),s.style("left",window.scrollX+m.left+(m.right-m.left)/2+"px").style("top",window.scrollY+m.bottom+"px"),s.html(Nt.sanitize(y)),f.classed("hover",!0)}).on("mouseout",(u)=>{s.transition().duration(500).style("opacity",0),h(u.currentTarget).classed("hover",!1)})}setCssClass(e,s){e.split(",").forEach((o)=>{let r=this.getState(o);if(!r){let u=o.trim();this.addState(u),r=this.getState(u)}r?.classes?.push(s)})}setStyle(e,s){this.getState(e)?.styles?.push(s)}setTextStyle(e,s){this.getState(e)?.textStyles?.push(s)}bindFunctions(e){this.funs.forEach((s)=>{s(e)})}getDirectionStatement(){return this.rootDoc.find((e)=>e.stmt===Xt)}getDirection(){return this.getDirectionStatement()?.value??ke}setDirection(e){let s=this.getDirectionStatement();if(s)s.value=e;else this.rootDoc.unshift({stmt:Xt,value:e})}trimColon(e){return e.startsWith(":")?e.slice(1).trim():e.trim()}getData(){let e=p();for(let s of this.nodes)if(s.wrappingWidth??=e.state?.wrappingWidth,!s.isGroup)s.minWidth??=e.state?.minNodeWidth;return{nodes:this.nodes,edges:this.edges,other:{},config:e,direction:pe(this.getRootDocV2())}}getConfig(){return p().state}},Ke=t((e)=>{let{theme:s,bkgColorArray:o,borderColorArray:r}=e;if(!Ye(s,r))return"";let u=Je(e.look),f=st(o),y="";for(let m=0;m<Mr(r);m++){let n=r[m],T=f?`fill: ${o[m%o.length]};`:"",E=`[data-look="${u}"][data-color-id="color-${m}"]`;y+=`
6
+ `+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:t(function(){var S=this.next();if(S)return S;else return this.lex()},"lex"),begin:t(function(S){this.conditionStack.push(S)},"begin"),popState:t(function(){var S=this.conditionStack.length-1;if(S>0)return this.conditionStack.pop();else return this.conditionStack[0]},"popState"),_currentRules:t(function(){if(this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1])return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules;else return this.conditions.INITIAL.rules},"_currentRules"),topState:t(function(S){if(S=this.conditionStack.length-1-Math.abs(S||0),S>=0)return this.conditionStack[S];else return"INITIAL"},"topState"),pushState:t(function(S){this.begin(S)},"pushState"),stateStackSize:t(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:t(function(S,a,k,_){function i(){let d=a.yytext.indexOf("%%");if(d===0)return!1;if(d>0){let X=a.yytext.slice(0,d),J=a.yytext.slice(d);if(J)S.lexer.unput(J);a.yytext=X}return!0}t(i,"processId");var at=_;switch(k){case 0:return 38;case 1:return 40;case 2:return 39;case 3:return 44;case 4:return 51;case 5:return 52;case 6:return 53;case 7:return 54;case 8:return 5;case 9:break;case 10:break;case 11:break;case 12:break;case 13:return this.pushState("SCALE"),17;break;case 14:return 18;case 15:this.popState();break;case 16:return this.begin("acc_title"),33;break;case 17:return this.popState(),"acc_title_value";break;case 18:return this.begin("acc_descr"),35;break;case 19:return this.popState(),"acc_descr_value";break;case 20:this.begin("acc_descr_multiline");break;case 21:this.popState();break;case 22:return"acc_descr_multiline_value";case 23:return this.pushState("CLASSDEF"),41;break;case 24:return this.popState(),this.pushState("CLASSDEFID"),"DEFAULT_CLASSDEF_ID";break;case 25:return this.popState(),this.pushState("CLASSDEFID"),42;break;case 26:return this.popState(),43;break;case 27:return this.pushState("CLASS"),48;break;case 28:return this.popState(),this.pushState("CLASS_STYLE"),49;break;case 29:return this.popState(),50;break;case 30:return this.pushState("STYLE"),45;break;case 31:return this.popState(),this.pushState("STYLEDEF_STYLES"),46;break;case 32:return this.popState(),47;break;case 33:return this.pushState("SCALE"),17;break;case 34:return 18;case 35:this.popState();break;case 36:this.pushState("STATE");break;case 37:return this.popState(),a.yytext=a.yytext.slice(0,-8).trim(),25;break;case 38:return this.popState(),a.yytext=a.yytext.slice(0,-8).trim(),26;break;case 39:return this.popState(),a.yytext=a.yytext.slice(0,-10).trim(),27;break;case 40:return this.popState(),a.yytext=a.yytext.slice(0,-8).trim(),25;break;case 41:return this.popState(),a.yytext=a.yytext.slice(0,-8).trim(),26;break;case 42:return this.popState(),a.yytext=a.yytext.slice(0,-10).trim(),27;break;case 43:return 51;case 44:return 52;case 45:return 53;case 46:return 54;case 47:this.pushState("STATE_STRING");break;case 48:return this.pushState("STATE_ID"),"AS";break;case 49:if(!i())return;return this.popState(),"ID";break;case 50:this.popState();break;case 51:return"STATE_DESCR";case 52:throw Error('Error: State name must be a single word. Found: "'+a.yytext.trim()+'"');case 53:return 19;case 54:this.popState();break;case 55:return this.popState(),this.pushState("struct"),20;break;case 56:return this.popState(),21;break;case 57:break;case 58:return this.begin("NOTE"),29;break;case 59:return this.popState(),this.pushState("NOTE_ID"),59;break;case 60:return this.popState(),this.pushState("NOTE_ID"),60;break;case 61:this.popState(),this.pushState("FLOATING_NOTE");break;case 62:return this.popState(),this.pushState("FLOATING_NOTE_ID"),"AS";break;case 63:break;case 64:return"NOTE_TEXT";case 65:if(!i())return;return this.popState(),"ID";break;case 66:if(!i())return;return this.popState(),this.pushState("NOTE_TEXT"),24;break;case 67:return this.popState(),a.yytext=a.yytext.substr(2).trim(),31;break;case 68:return this.popState(),a.yytext=a.yytext.slice(0,-8).trim(),31;break;case 69:return 6;case 70:return 6;case 71:return 16;case 72:return 57;case 73:if(!i())return;return 24;case 74:return a.yytext=a.yytext.trim(),14;break;case 75:return 15;case 76:return 28;case 77:return 58;case 78:return 5;case 79:return"INVALID"}},"anonymous"),rules:[/^(?:click\b)/i,/^(?:href\b)/i,/^(?:"[^"]*")/i,/^(?:default\b)/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:[\n]+)/i,/^(?:[\s]+)/i,/^(?:((?!\n)\s)+)/i,/^(?:#[^\n]*)/i,/^(?:%%(?!\{)[^\n]*)/i,/^(?:scale\s+)/i,/^(?:\d+)/i,/^(?:\s+width\b)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:classDef\s+)/i,/^(?:DEFAULT\s+)/i,/^(?:\w+\s+)/i,/^(?:[^\n]*)/i,/^(?:class\s+)/i,/^(?:(\w+)+((,\s*\w+)*))/i,/^(?:[^\n]*)/i,/^(?:style\s+)/i,/^(?:[\w,]+\s+)/i,/^(?:[^\n]*)/i,/^(?:scale\s+)/i,/^(?:\d+)/i,/^(?:\s+width\b)/i,/^(?:state\s+)/i,/^(?:.*<<fork>>)/i,/^(?:.*<<join>>)/i,/^(?:.*<<choice>>)/i,/^(?:.*\[\[fork\]\])/i,/^(?:.*\[\[join\]\])/i,/^(?:.*\[\[choice\]\])/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:["])/i,/^(?:\s*as\s+)/i,/^(?:[^\n\{]*)/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:\w+\s+\w+.*?\{)/i,/^(?:[^\n\s\{]+)/i,/^(?:\n)/i,/^(?:\{)/i,/^(?:\})/i,/^(?:[\n])/i,/^(?:note\s+)/i,/^(?:left of\b)/i,/^(?:right of\b)/i,/^(?:")/i,/^(?:\s*as\s*)/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[^\n]*)/i,/^(?:\s*[^:\n\s\-]+)/i,/^(?:\s*:[^:\n;]+)/i,/^(?:[\s\S]*?\n\s*end note\b)/i,/^(?:stateDiagram\s+)/i,/^(?:stateDiagram-v2\s+)/i,/^(?:hide empty description\b)/i,/^(?:\[\*\])/i,/^(?:[^:\n\s\-\{]+)/i,/^(?:\s*:(?:[^:\n;]|:[^:\n;])+)/i,/^(?:-->)/i,/^(?:--)/i,/^(?::::)/i,/^(?:$)/i,/^(?:.)/i],conditions:{LINE:{rules:[10,11,12],inclusive:!1},struct:{rules:[10,11,12,23,27,30,36,43,44,45,46,56,57,58,72,73,74,75,76,77],inclusive:!1},FLOATING_NOTE_ID:{rules:[65],inclusive:!1},FLOATING_NOTE:{rules:[62,63,64],inclusive:!1},NOTE_TEXT:{rules:[67,68],inclusive:!1},NOTE_ID:{rules:[66],inclusive:!1},NOTE:{rules:[59,60,61],inclusive:!1},STYLEDEF_STYLEOPTS:{rules:[],inclusive:!1},STYLEDEF_STYLES:{rules:[32],inclusive:!1},STYLE_IDS:{rules:[],inclusive:!1},STYLE:{rules:[31],inclusive:!1},CLASS_STYLE:{rules:[29],inclusive:!1},CLASS:{rules:[28],inclusive:!1},CLASSDEFID:{rules:[26],inclusive:!1},CLASSDEF:{rules:[24,25],inclusive:!1},acc_descr_multiline:{rules:[21,22],inclusive:!1},acc_descr:{rules:[19],inclusive:!1},acc_title:{rules:[17],inclusive:!1},SCALE:{rules:[14,15,34,35],inclusive:!1},ALIAS:{rules:[],inclusive:!1},STATE_ID:{rules:[49],inclusive:!1},STATE_STRING:{rules:[50,51],inclusive:!1},FORK_STATE:{rules:[],inclusive:!1},STATE:{rules:[10,11,12,37,38,39,40,41,42,47,48,52,53,54,55],inclusive:!1},ID:{rules:[10,11,12],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,11,12,13,16,18,20,23,27,30,33,36,55,58,69,70,71,72,73,74,75,77,78,79],inclusive:!0}}};return Q}();Rt.lexer=Se;function Dt(){this.yy={}}return t(Dt,"Parser"),Dt.prototype=Rt,Rt.Parser=Dt,new Dt}();Mt.parser=Mt;var be=Mt,ke="TB",ee="TB",Xt="dir",ct="state",ot="root",Wt="relation",Te="classDef",Ee="style",_e="applyClass",pt="default",se="divider",re="fill:none",ie="fill: #333",ae="c",ne="markdown",oe="normal",Yt="rect",Vt="rectWithTitle",ve="stateStart",De="stateEnd",jt="divider",Jt="roundedWithTitle",Ce="note",Ae="noteGroup",gt="statediagram",xe="state",Le=`${gt}-${xe}`,le="transition",we="note",Ie="note-edge",Ne=`${le} ${Ie}`,Oe=`${gt}-${we}`,Re="cluster",$e=`${gt}-${Re}`,Fe="cluster-alt",Pe=`${gt}-${Fe}`,ce="parent",he="note",Be="state",Ut="----",Ge=`${Ut}${he}`,qt=`${Ut}${ce}`,It=new Map,Z=0,de=0,dt=new Map,Ve=t((e,s,o,r)=>{if(e===jt&&o?.id!==void 0&&dt.has(o.id)){let y=dt.get(o.id);return dt.set(s,y),y}let u=de++,f=r?void 0:u;return dt.set(s,f),f},"colorSlotFor");function Ot(e="",s=0,o="",r=Ut){let u=o!==null&&o.length>0?`${r}${o}`:"";return`${Be}-${e}${u}-${s}`}t(Ot,"stateDomId");var Me=t((e,s,o,r,u,f,y,m)=>{l.trace("items",s),s.forEach((n)=>{switch(n.stmt){case ct:ft(e,n,o,r,u,f,y,m);break;case pt:ft(e,n,o,r,u,f,y,m);break;case Wt:{ft(e,n.state1,o,r,u,f,y,m),ft(e,n.state2,o,r,u,f,y,m);let T=y==="neo",E={id:"edge"+Z,start:n.state1.id,end:n.state2.id,arrowhead:"normal",arrowTypeEnd:T?"arrow_barb_neo":"arrow_barb",style:re,labelStyle:"",label:x.sanitizeText(n.description??"",p()),arrowheadStyle:ie,labelpos:ae,labelType:ne,thickness:oe,classes:le,look:y};u.push(E),Z++}break}})},"setupDoc"),Qt=t((e,s=ee)=>{let o=s;if(e.doc){for(let r of e.doc)if(r.stmt==="dir")o=r.value}return o},"getDir");function ut(e,s,o){if(!s.id||s.id==="</join></fork>"||s.id==="</choice>")return;if(s.cssClasses){if(!Array.isArray(s.cssCompiledStyles))s.cssCompiledStyles=[];s.cssClasses.split(" ").forEach((u)=>{let f=o.get(u);if(f)s.cssCompiledStyles=[...s.cssCompiledStyles??[],...f.styles]})}let r=e.find((u)=>u.id===s.id);if(r)Object.assign(r,s);else e.push(s)}t(ut,"insertOrUpdateNode");function ue(e){return e?.classes?.join(" ")??""}t(ue,"getClassesFromDbInfo");function fe(e){return e?.styles??[]}t(fe,"getStylesFromDbInfo");var ft=t((e,s,o,r,u,f,y,m)=>{let n=s.id,T=o.get(n),E=ue(T),N=fe(T),F=p(),Y=E.trim()!==""||N.length>0;if(l.info("dataFetcher parsedItem",s,T,N),n!=="root"){let C=Yt;if(s.start===!0)C=ve;else if(s.start===!1)C=De;if(s.type!==pt)C=s.type;if(!It.get(n))It.set(n,{id:n,shape:C,description:x.sanitizeText(n,F),cssClasses:`${E} ${Le}`,cssStyles:N});let g=It.get(n);if(s.description){if(Array.isArray(g.description))g.shape=Vt,g.description.push(s.description);else if(g.description?.length&&g.description.length>0)if(g.shape=Vt,g.description===n)g.description=[s.description];else g.description=[g.description,s.description];else g.shape=Yt,g.description=s.description;g.description=x.sanitizeTextOrArray(g.description,F)}if(g.description?.length===1&&g.shape===Vt)if(g.type==="group")g.shape=Jt;else g.shape=Yt;if(!g.type&&s.doc)l.info("Setting cluster for XCX",n,Qt(s)),g.type="group",g.isGroup=!0,g.dir=Qt(s),g.shape=s.type===se?jt:Jt,g.colorIndex=Ve(g.shape,n,e,Y),g.cssClasses=`${g.cssClasses} ${$e} ${f?Pe:""}`;let P={labelStyle:"",shape:g.shape,label:g.description,cssClasses:g.cssClasses,cssCompiledStyles:[],cssStyles:g.cssStyles,id:n,dir:g.dir,domId:Ot(n,Z),type:g.type,isGroup:g.type==="group",colorIndex:g.colorIndex,padding:8,rx:10,ry:10,look:y,labelType:"markdown"};if(P.shape===jt)P.label="";if(e&&e.id!=="root")l.trace("Setting node ",n," to be child of its parent ",e.id),P.parentId=e.id;if(P.centerLabel=!0,s.note){let A={labelStyle:"",shape:Ce,label:s.note.text,labelType:"markdown",cssClasses:Oe,cssStyles:[],cssCompiledStyles:[],id:n+Ge+"-"+Z,domId:Ot(n,Z,he),type:"node",isGroup:!1,padding:F.flowchart?.padding,look:y,position:s.note.position},H=n+qt,B={labelStyle:"",shape:Ae,label:s.note.text,cssClasses:g.cssClasses,cssStyles:[],id:n+qt,domId:Ot(n,Z,ce),type:"group",isGroup:!0,padding:16,look:y,position:s.note.position};Z++,B.id=H,A.parentId=H,ut(r,B,m),ut(r,A,m),ut(r,P,m);let K=n,D=A.id;if(s.note.position==="left of")K=A.id,D=n;u.push({id:K+"-"+D,start:K,end:D,arrowhead:"none",arrowTypeEnd:"",style:re,labelStyle:"",classes:Ne,pattern:"dashed",arrowheadStyle:ie,labelpos:ae,labelType:ne,thickness:oe,look:y})}else ut(r,P,m)}if(s.doc)l.trace("Adding nodes children "),Me(s,s.doc,o,r,u,!f,y,m)},"dataFetcher"),We=t(()=>{It.clear(),Z=0,de=0,dt.clear()},"reset"),pe=t((e,s=ee)=>{if(!e.doc)return s;let o=s;for(let r of e.doc)if(r.stmt==="dir")o=r.value;return o},"getDir"),je=t(function(e,s){return s.db.getClasses()},"getClasses"),Ue=t(async function(e,s,o,r){l.info("REF0:"),l.info("Drawing state diagram (v2)",s);let{securityLevel:u,state:f,layout:y}=p();r.db.extract(r.db.getRootDocV2());let m=r.db.getData(),n=Tt(s,u);if(m.type=r.type,m.layoutAlgorithm=St(y),m.nodeSpacing=f?.nodeSpacing||50,m.rankSpacing=f?.rankSpacing||50,p().look==="neo")m.markers=["barbNeo"];else m.markers=["barb"];m.diagramId=s,await _t(m,n);let E=8;try{(typeof r.db.getLinks==="function"?r.db.getLinks():new Map).forEach((F,Y)=>{let C=typeof Y==="string"?Y:typeof Y?.id==="string"?Y.id:"",g=m.nodes.find((D)=>D.id===C);if(!C){l.warn("⚠️ Invalid or missing stateId from key:",JSON.stringify(Y));return}let P=n.node()?.querySelectorAll("g.node, g.rough-node"),A;if(P?.forEach((D)=>{let rt=D.textContent?.trim();if(D.id===g?.domId||rt===C)A=D}),!A){l.warn("⚠️ Could not find node matching text:",C);return}let H=A.parentNode;if(!H){l.warn("⚠️ Node has no parent, cannot wrap:",C);return}let B=document.createElementNS("http://www.w3.org/2000/svg","a"),K=F.url.replace(/^"+|"+$/g,"");if(B.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",K),B.setAttribute("target","_blank"),F.tooltip){let D=F.tooltip.replace(/^"+|"+$/g,"");B.setAttribute("title",D),A.setAttribute("title",D)}H.replaceChild(B,A),B.appendChild(A),l.info("\uD83D\uDD17 Wrapped node in <a> tag for:",C,F.url)})}catch(N){l.error("❌ Error injecting clickable links:",N)}W.insertTitle(n,"statediagramTitleText",f?.titleTopMargin??25,r.db.getDiagramTitle()),lt(n,E,gt,f?.useMaxWidth??!0)},"draw"),He={getClasses:je,draw:Ue,getDir:pe},I={START_NODE:"[*]",START_TYPE:"start",END_NODE:"[*]",END_TYPE:"end",COLOR_KEYWORD:"color",FILL_KEYWORD:"fill",BG_FILL:"bgFill",STYLECLASS_SEP:","},Zt=t(()=>new Map,"newClassesList"),te=t(()=>({relations:[],states:new Map,documents:{}}),"newDoc"),wt=t((e)=>JSON.parse(JSON.stringify(e)),"clone"),ze=class{constructor(e){this.version=e,this.nodes=[],this.edges=[],this.rootDoc=[],this.classes=Zt(),this.documents={root:te()},this.currentDocument=this.documents.root,this.startEndCount=0,this.dividerCnt=0,this.links=new Map,this.funs=[],this.getAccTitle=z,this.setAccTitle=L,this.getAccDescription=U,this.setAccDescription=O,this.setDiagramTitle=j,this.getDiagramTitle=G,this.clear(),this.setRootDoc=this.setRootDoc.bind(this),this.getDividerId=this.getDividerId.bind(this),this.setDirection=this.setDirection.bind(this),this.trimColon=this.trimColon.bind(this),this.bindFunctions=this.bindFunctions.bind(this)}static{t(this,"StateDB")}static{this.relationType={AGGREGATION:0,EXTENSION:1,COMPOSITION:2,DEPENDENCY:3}}extract(e){this.clear(!0);for(let r of Array.isArray(e)?e:e.doc)switch(r.stmt){case ct:this.addState(r.id.trim(),r.type,r.doc,r.description,r.note);break;case Wt:this.addRelation(r.state1,r.state2,r.description);break;case Te:this.addStyleClass(r.id.trim(),r.classes);break;case Ee:this.handleStyleDef(r);break;case _e:this.setCssClass(r.id.trim(),r.styleClass);break;case"click":this.addLink(r.id,r.url,r.tooltip);break}let s=this.getStates(),o=p();We(),ft(void 0,this.getRootDocV2(),s,this.nodes,this.edges,!0,o.look,this.classes);for(let r of this.nodes){if(!Array.isArray(r.label))continue;if(r.description=r.label.slice(1),r.isGroup&&r.description.length>0)throw Error(`Group nodes can only have label. Remove the additional description for node [${r.id}]`);r.label=r.label[0]}}handleStyleDef(e){let s=e.id.trim().split(","),o=e.styleClass.split(",");for(let r of s){let u=this.getState(r);if(!u){let f=r.trim();this.addState(f),u=this.getState(f)}if(u)u.styles=o.map((f)=>f.replace(/;/g,"")?.trim())}}setRootDoc(e){if(l.info("Setting root doc",e),this.rootDoc=e,this.version===1)this.extract(e);else this.extract(this.getRootDocV2())}docTranslator(e,s,o){if(s.stmt===Wt){this.docTranslator(e,s.state1,!0),this.docTranslator(e,s.state2,!1);return}if(s.stmt===ct)if(s.id===I.START_NODE)s.id=e.id+(o?"_start":"_end"),s.start=o;else s.id=s.id.trim();if(s.stmt!==ot&&s.stmt!==ct||!s.doc)return;let r=[],u=[];for(let f of s.doc)if(f.type===se){let y=wt(f);y.doc=wt(u),r.push(y),u=[]}else u.push(f);if(r.length>0&&u.length>0){let f={stmt:ct,id:wf(),type:"divider",doc:wt(u)};r.push(wt(f)),s.doc=r}s.doc.forEach((f)=>this.docTranslator(s,f,!0))}getRootDocV2(){return this.docTranslator({id:ot,stmt:ot},{id:ot,stmt:ot,doc:this.rootDoc},!0),{id:ot,doc:this.rootDoc}}addState(e,s=pt,o=void 0,r=void 0,u=void 0,f=void 0,y=void 0,m=void 0){let n=e?.trim();if(!this.currentDocument.states.has(n))l.info("Adding state ",n,r),this.currentDocument.states.set(n,{stmt:ct,id:n,descriptions:[],type:s,doc:o,note:u,classes:[],styles:[],textStyles:[]});else{let T=this.currentDocument.states.get(n);if(!T)throw Error(`State not found: ${n}`);if(!T.doc)T.doc=o;if(!T.type)T.type=s}if(r)l.info("Setting state description",n,r),(Array.isArray(r)?r:[r]).forEach((E)=>this.addDescription(n,E.trim()));if(u){let T=this.currentDocument.states.get(n);if(!T)throw Error(`State not found: ${n}`);T.note=u,T.note.text=x.sanitizeText(T.note.text,p())}if(f)l.info("Setting state classes",n,f),(Array.isArray(f)?f:[f]).forEach((E)=>this.setCssClass(n,E.trim()));if(y)l.info("Setting state styles",n,y),(Array.isArray(y)?y:[y]).forEach((E)=>this.setStyle(n,E.trim()));if(m)l.info("Setting state styles",n,y),(Array.isArray(m)?m:[m]).forEach((E)=>this.setTextStyle(n,E.trim()))}clear(e){if(this.nodes=[],this.edges=[],this.funs=[this.setupToolTips.bind(this)],this.documents={root:te()},this.currentDocument=this.documents.root,this.startEndCount=0,this.classes=Zt(),!e)this.links=new Map,R()}getState(e){return this.currentDocument.states.get(e)}getStates(){return this.currentDocument.states}logDocuments(){l.info("Documents = ",this.documents)}getRelations(){return this.currentDocument.relations}addLink(e,s,o){this.links.set(e,{url:s,tooltip:o}),l.warn("Adding link",e,s,o)}getLinks(){return this.links}startIdIfNeeded(e=""){if(e===I.START_NODE)return this.startEndCount++,`${I.START_TYPE}${this.startEndCount}`;return e}startTypeIfNeeded(e="",s=pt){return e===I.START_NODE?I.START_TYPE:s}endIdIfNeeded(e=""){if(e===I.END_NODE)return this.startEndCount++,`${I.END_TYPE}${this.startEndCount}`;return e}endTypeIfNeeded(e="",s=pt){return e===I.END_NODE?I.END_TYPE:s}addRelationObjs(e,s,o=""){let r=this.startIdIfNeeded(e.id.trim()),u=this.startTypeIfNeeded(e.id.trim(),e.type),f=this.startIdIfNeeded(s.id.trim()),y=this.startTypeIfNeeded(s.id.trim(),s.type);this.addState(r,u,e.doc,e.description,e.note,e.classes,e.styles,e.textStyles),this.addState(f,y,s.doc,s.description,s.note,s.classes,s.styles,s.textStyles),this.currentDocument.relations.push({id1:r,id2:f,relationTitle:x.sanitizeText(o,p())})}addRelation(e,s,o){if(typeof e==="object"&&typeof s==="object")this.addRelationObjs(e,s,o);else if(typeof e==="string"&&typeof s==="string"){let r=this.startIdIfNeeded(e.trim()),u=this.startTypeIfNeeded(e),f=this.endIdIfNeeded(s.trim()),y=this.endTypeIfNeeded(s);this.addState(r,u),this.addState(f,y),this.currentDocument.relations.push({id1:r,id2:f,relationTitle:o?x.sanitizeText(o,p()):void 0})}}addDescription(e,s){let o=this.currentDocument.states.get(e),r=s.startsWith(":")?s.replace(":","").trim():s;o?.descriptions?.push(x.sanitizeText(r,p()))}cleanupLabel(e){return e.startsWith(":")?e.slice(2).trim():e.trim()}getDividerId(){return this.dividerCnt++,`divider-id-${this.dividerCnt}`}addStyleClass(e,s=""){if(!this.classes.has(e))this.classes.set(e,{id:e,styles:[],textStyles:[]});let o=this.classes.get(e);if(s&&o)s.split(I.STYLECLASS_SEP).forEach((r)=>{let u=r.replace(/([^;]*);/,"$1").trim();if(RegExp(I.COLOR_KEYWORD).exec(r)){let y=u.replace(I.FILL_KEYWORD,I.BG_FILL).replace(I.COLOR_KEYWORD,I.FILL_KEYWORD);o.textStyles.push(y)}o.styles.push(u)})}getClasses(){return this.classes}setupToolTips(e){let s=Na();h(e).select("svg").selectAll("g.node, g.rough-node").on("mouseover",(u)=>{let f=h(u.currentTarget),y=f.attr("title");if(y===null)return;let m=u.currentTarget?.getBoundingClientRect();s.transition().duration(200).style("opacity",".9"),s.style("left",window.scrollX+m.left+(m.right-m.left)/2+"px").style("top",window.scrollY+m.bottom+"px"),s.html(Nt.sanitize(y)),f.classed("hover",!0)}).on("mouseout",(u)=>{s.transition().duration(500).style("opacity",0),h(u.currentTarget).classed("hover",!1)})}setCssClass(e,s){e.split(",").forEach((o)=>{let r=this.getState(o);if(!r){let u=o.trim();this.addState(u),r=this.getState(u)}r?.classes?.push(s)})}setStyle(e,s){this.getState(e)?.styles?.push(s)}setTextStyle(e,s){this.getState(e)?.textStyles?.push(s)}bindFunctions(e){this.funs.forEach((s)=>{s(e)})}getDirectionStatement(){return this.rootDoc.find((e)=>e.stmt===Xt)}getDirection(){return this.getDirectionStatement()?.value??ke}setDirection(e){let s=this.getDirectionStatement();if(s)s.value=e;else this.rootDoc.unshift({stmt:Xt,value:e})}trimColon(e){return e.startsWith(":")?e.slice(1).trim():e.trim()}getData(){let e=p();for(let s of this.nodes)if(s.wrappingWidth??=e.state?.wrappingWidth,!s.isGroup)s.minWidth??=e.state?.minNodeWidth;return{nodes:this.nodes,edges:this.edges,other:{},config:e,direction:pe(this.getRootDocV2())}}getConfig(){return p().state}},Ke=t((e)=>{let{theme:s,bkgColorArray:o,borderColorArray:r}=e;if(!Ye(s,r))return"";let u=Je(e.look),f=st(o),y="";for(let m=0;m<Mr(r);m++){let n=r[m],T=f?`fill: ${o[m%o.length]};`:"",E=`[data-look="${u}"][data-color-id="color-${m}"]`;y+=`
7
7
 
8
8
  /* The title strip: \`rect.outer\` spans the whole composite and \`rect.inner\` covers
9
9
  the body, so what stays visible of \`outer\` is the band behind the label. */