@bkm016/basalt 0.0.0-stage → 0.1.1

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 (256) hide show
  1. package/README.md +275 -2
  2. package/chunk-09vr609h.js +2 -0
  3. package/chunk-0hbjv3y6.js +11 -0
  4. package/chunk-0qqb6v41.js +3753 -0
  5. package/chunk-0szjy61m.js +2 -0
  6. package/chunk-0yytz0r1.js +59 -0
  7. package/chunk-1aspj1hn.js +3 -0
  8. package/chunk-1b7gbe8g.js +10 -0
  9. package/chunk-1v7st27a.js +25 -0
  10. package/chunk-1yzt0qm0.js +2 -0
  11. package/chunk-2bb01ddq.js +16 -0
  12. package/chunk-2wkaw73s.js +9 -0
  13. package/chunk-2zqny2sy.js +2 -0
  14. package/chunk-32at88hc.js +3 -0
  15. package/chunk-3m7qwfm3.js +7 -0
  16. package/chunk-44ek81ad.js +3 -0
  17. package/chunk-45cz26ap.js +39 -0
  18. package/chunk-501zkf9b.js +3 -0
  19. package/chunk-58vz2qsq.js +2 -0
  20. package/chunk-6e49xsf5.js +3 -0
  21. package/chunk-6qertm2t.js +3 -0
  22. package/chunk-8dxzqwq3.js +2 -0
  23. package/chunk-9mmz6wt3.js +2 -0
  24. package/chunk-a3tqx584.js +10 -0
  25. package/chunk-a6r4z44b.js +2 -0
  26. package/chunk-a8nyk4k9.js +2 -0
  27. package/chunk-agntrqs9.js +2 -0
  28. package/chunk-bhqyxyap.js +3 -0
  29. package/chunk-bpw6q7g0.js +3 -0
  30. package/chunk-c25s4w6a.js +5 -0
  31. package/chunk-cv5wsd9m.js +8 -0
  32. package/chunk-d48bfd2e.js +3 -0
  33. package/chunk-dakrpbe6.js +3 -0
  34. package/chunk-dhm42y04.js +7 -0
  35. package/chunk-exnn1867.js +2 -0
  36. package/chunk-f7egr55n.js +31 -0
  37. package/chunk-g2t6t8fk.js +3 -0
  38. package/chunk-h6sw8fbt.js +5 -0
  39. package/chunk-hat3s3pr.js +3 -0
  40. package/chunk-hcn9cf6v.js +2 -0
  41. package/chunk-jhd54p1b.js +3 -0
  42. package/chunk-k7w7ac9q.js +18 -0
  43. package/chunk-kf8hq21a.js +25 -0
  44. package/chunk-kfq8wyd3.js +3 -0
  45. package/chunk-n6e43rvk.js +3 -0
  46. package/chunk-nt2gntad.js +2 -0
  47. package/chunk-pmc3y1z8.js +2 -0
  48. package/chunk-pvncysbb.js +3 -0
  49. package/chunk-q8zx3kt6.js +2 -0
  50. package/chunk-qczbfccb.js +12 -0
  51. package/chunk-qnr1f5pj.js +3 -0
  52. package/chunk-qx0m82rw.js +2 -0
  53. package/chunk-r9aatvwm.js +3 -0
  54. package/chunk-rm3kcxq9.js +20 -0
  55. package/chunk-rv06x0kn.js +7 -0
  56. package/chunk-ry0z4ev6.js +2 -0
  57. package/chunk-s37s3k24.js +12 -0
  58. package/chunk-sh74qzvt.js +5 -0
  59. package/chunk-szat3vp4.js +3 -0
  60. package/chunk-t057xfrt.js +5 -0
  61. package/chunk-tvm4zmgj.js +3 -0
  62. package/chunk-v9fea96h.js +3 -0
  63. package/chunk-vgvq3q12.js +3 -0
  64. package/chunk-vkkj4awb.js +2 -0
  65. package/chunk-vv7fp27r.js +3 -0
  66. package/chunk-wjd9fr23.js +2 -0
  67. package/chunk-wx7kdf0b.js +2 -0
  68. package/chunk-x3dnb9sz.js +3 -0
  69. package/chunk-xsbxykr4.js +2 -0
  70. package/chunk-xysny0ve.js +3 -0
  71. package/chunk-y69ewdn2.js +3 -0
  72. package/chunk-yskm0hsy.js +2 -0
  73. package/chunk-zef13k3h.js +471 -0
  74. package/cli.js +89 -0
  75. package/compiled.js +23 -0
  76. package/icon-dp9pmcvp.png +0 -0
  77. package/package.json +21 -4
  78. package/ui-test-worker.js +226 -0
  79. package/web/KaTeX_AMS-Regular-n7eqehx2.woff2 +0 -0
  80. package/web/KaTeX_Caligraphic-Bold-20r3b6fv.woff2 +0 -0
  81. package/web/KaTeX_Caligraphic-Regular-kkjm8f18.woff2 +0 -0
  82. package/web/KaTeX_Fraktur-Bold-pz5vg4t0.woff2 +0 -0
  83. package/web/KaTeX_Fraktur-Regular-a1e9wkwk.woff2 +0 -0
  84. package/web/KaTeX_Main-Bold-mcp098h8.woff2 +0 -0
  85. package/web/KaTeX_Main-BoldItalic-fy74z249.woff2 +0 -0
  86. package/web/KaTeX_Main-Italic-hw2gxy7f.woff2 +0 -0
  87. package/web/KaTeX_Main-Regular-xvp1b75c.woff2 +0 -0
  88. package/web/KaTeX_Math-BoldItalic-mf5nf33d.woff2 +0 -0
  89. package/web/KaTeX_Math-Italic-ap60jrna.woff2 +0 -0
  90. package/web/KaTeX_SansSerif-Bold-we3bymb6.woff2 +0 -0
  91. package/web/KaTeX_SansSerif-Italic-ent92bjx.woff2 +0 -0
  92. package/web/KaTeX_SansSerif-Regular-0573pbz9.woff2 +0 -0
  93. package/web/KaTeX_Script-Regular-z2rtj6vq.woff2 +0 -0
  94. package/web/KaTeX_Size1-Regular-dfr3w1hv.woff2 +0 -0
  95. package/web/KaTeX_Size2-Regular-kted78zb.woff2 +0 -0
  96. package/web/KaTeX_Size3-Regular-e6k1k5jk.woff2 +0 -0
  97. package/web/KaTeX_Size4-Regular-abedc1pd.woff2 +0 -0
  98. package/web/KaTeX_Typewriter-Regular-scw9zx1z.woff2 +0 -0
  99. package/web/apple-touch-icon-7dkm33qp.png +0 -0
  100. package/web/apple-touch-icon.png +0 -0
  101. package/web/chunk-05w4fyzc.js +1 -0
  102. package/web/chunk-0mrkjnte.js +1 -0
  103. package/web/chunk-0pbjgdgp.js +2 -0
  104. package/web/chunk-0s80zw00.js +1 -0
  105. package/web/chunk-0vt9fg48.js +2 -0
  106. package/web/chunk-20q90epj.js +2 -0
  107. package/web/chunk-22a4ety5.js +1 -0
  108. package/web/chunk-24mfx6w1.js +2 -0
  109. package/web/chunk-2j4m0bh1.js +2 -0
  110. package/web/chunk-2m12wyrb.js +16 -0
  111. package/web/chunk-2msj52w6.js +1 -0
  112. package/web/chunk-2ps6mepk.js +120 -0
  113. package/web/chunk-2pver6r4.js +1 -0
  114. package/web/chunk-2scce33n.js +1 -0
  115. package/web/chunk-37ajk6zg.js +2 -0
  116. package/web/chunk-3ee04tmm.js +200 -0
  117. package/web/chunk-3jhyzmnf.js +292 -0
  118. package/web/chunk-45fzdcgz.js +30 -0
  119. package/web/chunk-4gavbw65.js +1 -0
  120. package/web/chunk-4ks96e4r.js +1 -0
  121. package/web/chunk-4rm1vy7w.js +1 -0
  122. package/web/chunk-4v8en1yw.js +40 -0
  123. package/web/chunk-4wd9r73y.js +1 -0
  124. package/web/chunk-4wkm9fda.js +1 -0
  125. package/web/chunk-54thej0t.js +2 -0
  126. package/web/chunk-59kqahb3.js +1 -0
  127. package/web/chunk-5vw9rs4r.js +4 -0
  128. package/web/chunk-6beqrmtq.js +1 -0
  129. package/web/chunk-6m69hczt.js +2 -0
  130. package/web/chunk-70qwwwak.js +2 -0
  131. package/web/chunk-74j07k8k.js +2 -0
  132. package/web/chunk-8g239029.js +1 -0
  133. package/web/chunk-8p4tc9f4.js +70 -0
  134. package/web/chunk-90kp4pnz.js +2 -0
  135. package/web/chunk-9an7cjd9.js +291 -0
  136. package/web/chunk-9dxjafp2.js +78 -0
  137. package/web/chunk-9p12mgs6.js +2 -0
  138. package/web/chunk-9v1f6yc8.js +1 -0
  139. package/web/chunk-9yakxvjb.js +2 -0
  140. package/web/chunk-a1z5qx1r.js +36 -0
  141. package/web/chunk-a3verqw9.js +214 -0
  142. package/web/chunk-a5x2zveg.js +7 -0
  143. package/web/chunk-ad6x47yy.js +1 -0
  144. package/web/chunk-amzgyy1k.js +1 -0
  145. package/web/chunk-b1pe46zz.js +2 -0
  146. package/web/chunk-b4wbk7vc.js +217 -0
  147. package/web/chunk-bc78qf1m.js +7 -0
  148. package/web/chunk-bgnnrpna.js +89 -0
  149. package/web/chunk-bj90t5gh.js +99 -0
  150. package/web/chunk-bjkc94mv.js +1 -0
  151. package/web/chunk-ca682sm6.js +370 -0
  152. package/web/chunk-cff5hcm8.js +8 -0
  153. package/web/chunk-cg3jterp.js +2 -0
  154. package/web/chunk-d18r4m14.js +141 -0
  155. package/web/chunk-dmqtdeb4.js +1 -0
  156. package/web/chunk-dt462hk9.js +332 -0
  157. package/web/chunk-dy2gm1fs.js +1 -0
  158. package/web/chunk-dzwxgqgm.js +39 -0
  159. package/web/chunk-e32y85kx.js +1 -0
  160. package/web/chunk-e53wfgb8.js +1 -0
  161. package/web/chunk-e6jxqbv7.js +3 -0
  162. package/web/chunk-esp1mmgr.js +1 -0
  163. package/web/chunk-ew3cgdtd.js +1 -0
  164. package/web/chunk-f26smjjf.js +2 -0
  165. package/web/chunk-f91wzwtk.js +1 -0
  166. package/web/chunk-fk0dh93x.js +89 -0
  167. package/web/chunk-fm2ybfj5.js +98 -0
  168. package/web/chunk-fscafg24.js +34 -0
  169. package/web/chunk-fz06t6km.js +55 -0
  170. package/web/chunk-g1ev11wx.js +1 -0
  171. package/web/chunk-g4azyef7.js +106 -0
  172. package/web/chunk-gjq1pxw3.js +1 -0
  173. package/web/chunk-gqw3f02j.js +140 -0
  174. package/web/chunk-h5ejbf6e.js +1 -0
  175. package/web/chunk-hev4hq89.js +2 -0
  176. package/web/chunk-hfaffkrh.js +1 -0
  177. package/web/chunk-hp167dbv.js +1 -0
  178. package/web/chunk-j2vt8c8v.js +1 -0
  179. package/web/chunk-jjh5jvva.js +1 -0
  180. package/web/chunk-jrcyc9s9.js +38 -0
  181. package/web/chunk-jwzd9tzk.js +24 -0
  182. package/web/chunk-k5btcvbg.js +1 -0
  183. package/web/chunk-ka3q31t1.js +1 -0
  184. package/web/chunk-kdyjnwdx.js +2 -0
  185. package/web/chunk-kpvgecwy.js +1 -0
  186. package/web/chunk-kq40ss39.js +1 -0
  187. package/web/chunk-m2d1sp30.js +1 -0
  188. package/web/chunk-n1dmrz44.js +2 -0
  189. package/web/chunk-n90cqdvg.js +2 -0
  190. package/web/chunk-nj0cv1cq.js +257 -0
  191. package/web/chunk-nzey7cpv.js +1 -0
  192. package/web/chunk-p3b9crsa.js +2 -0
  193. package/web/chunk-pf2ab8p8.js +1 -0
  194. package/web/chunk-pxe3vna4.js +1 -0
  195. package/web/chunk-q0p5xqe1.js +84 -0
  196. package/web/chunk-q5ke7a33.js +24 -0
  197. package/web/chunk-q7dsnvpf.js +1 -0
  198. package/web/chunk-qd8bxxdj.js +1 -0
  199. package/web/chunk-qefasa1j.js +2 -0
  200. package/web/chunk-qh7265qw.js +4 -0
  201. package/web/chunk-qnaqf0cr.js +1 -0
  202. package/web/chunk-r1dnh0s8.js +1 -0
  203. package/web/chunk-r5eakmw6.js +1 -0
  204. package/web/chunk-rg426vkf.js +1 -0
  205. package/web/chunk-rpmpttbk.js +12 -0
  206. package/web/chunk-rtf2zzzv.js +1 -0
  207. package/web/chunk-ry9256r7.js +1 -0
  208. package/web/chunk-rykfak98.js +2 -0
  209. package/web/chunk-scpwc9ev.js +1 -0
  210. package/web/chunk-srrfphes.js +1 -0
  211. package/web/chunk-ss1bcb0n.js +2 -0
  212. package/web/chunk-ssy07dd2.js +1 -0
  213. package/web/chunk-t6agpn2z.js +1 -0
  214. package/web/chunk-taynqrgq.js +142 -0
  215. package/web/chunk-tgpbhzn9.js +1 -0
  216. package/web/chunk-tmvakq7n.js +19 -0
  217. package/web/chunk-tqmwd9qp.js +139 -0
  218. package/web/chunk-ts7zrf5b.js +2 -0
  219. package/web/chunk-ttg6tbwx.js +2 -0
  220. package/web/chunk-v28fx2nd.js +1 -0
  221. package/web/chunk-v5cnt7c8.js +1 -0
  222. package/web/chunk-vt40e1kp.js +1136 -0
  223. package/web/chunk-w53rba6g.js +1 -0
  224. package/web/chunk-w86n42dy.js +1 -0
  225. package/web/chunk-w880psmw.js +1 -0
  226. package/web/chunk-wptv8atc.js +2 -0
  227. package/web/chunk-wtawdeej.css +1 -0
  228. package/web/chunk-xbty0rv7.js +41 -0
  229. package/web/chunk-xet1jjy9.js +1 -0
  230. package/web/chunk-xjxv8dg8.js +169 -0
  231. package/web/chunk-xrxne80b.js +62 -0
  232. package/web/chunk-xzp7jf7e.js +2 -0
  233. package/web/chunk-y0m8hrwz.js +303 -0
  234. package/web/chunk-y49fhfda.js +7 -0
  235. package/web/chunk-yd46jhqv.js +1 -0
  236. package/web/chunk-ydtrc1ay.js +2 -0
  237. package/web/chunk-z09emmrb.js +1 -0
  238. package/web/chunk-z7dcbxws.js +1 -0
  239. package/web/chunk-zbj1trar.js +2 -0
  240. package/web/chunk-zde7mj43.js +1 -0
  241. package/web/icon-192.png +0 -0
  242. package/web/icon-512.png +0 -0
  243. package/web/icon-maskable-512.png +0 -0
  244. package/web/icon-yx2p2pye.svg +13 -0
  245. package/web/icon.svg +13 -0
  246. package/web/index.html +23 -0
  247. package/web/install.ps1 +91 -0
  248. package/web/install.sh +177 -0
  249. package/web/inter-latin-wght-normal-an0py913.woff2 +0 -0
  250. package/web/jetbrains-mono-latin-wght-normal-hj2e42wt.woff2 +0 -0
  251. package/web/manifest-txf6vfbq.webmanifest +35 -0
  252. package/web/manifest.webmanifest +35 -0
  253. package/web/source-serif-4-latin-wght-italic-ta5tqqvz.woff2 +0 -0
  254. package/web/source-serif-4-latin-wght-normal-1yyvbhsz.woff2 +0 -0
  255. package/web/sw.js +90 -0
  256. package/worker.js +2 -0
@@ -0,0 +1 @@
1
+ var n=Object.freeze(JSON.parse('{"displayName":"JSON with Comments","name":"jsonc","patterns":[{"include":"#value"}],"repository":{"array":{"begin":"\\\\[","beginCaptures":{"0":{"name":"punctuation.definition.array.begin.json.comments"}},"end":"]","endCaptures":{"0":{"name":"punctuation.definition.array.end.json.comments"}},"name":"meta.structure.array.json.comments","patterns":[{"include":"#value"},{"match":",","name":"punctuation.separator.array.json.comments"},{"match":"[^]\\\\s]","name":"invalid.illegal.expected-array-separator.json.comments"}]},"comments":{"patterns":[{"begin":"/\\\\*\\\\*(?!/)","captures":{"0":{"name":"punctuation.definition.comment.json.comments"}},"end":"\\\\*/","name":"comment.block.documentation.json.comments"},{"begin":"/\\\\*","captures":{"0":{"name":"punctuation.definition.comment.json.comments"}},"end":"\\\\*/","name":"comment.block.json.comments"},{"captures":{"1":{"name":"punctuation.definition.comment.json.comments"}},"match":"(//).*$\\\\n?","name":"comment.line.double-slash.js"}]},"constant":{"match":"\\\\b(?:true|false|null)\\\\b","name":"constant.language.json.comments"},"number":{"match":"-?(?:0|[1-9]\\\\d*)(?:(?:\\\\.\\\\d+)?(?:[Ee][-+]?\\\\d+)?)?","name":"constant.numeric.json.comments"},"object":{"begin":"\\\\{","beginCaptures":{"0":{"name":"punctuation.definition.dictionary.begin.json.comments"}},"end":"}","endCaptures":{"0":{"name":"punctuation.definition.dictionary.end.json.comments"}},"name":"meta.structure.dictionary.json.comments","patterns":[{"include":"#objectkey"},{"include":"#comments"},{"begin":":","beginCaptures":{"0":{"name":"punctuation.separator.dictionary.key-value.json.comments"}},"end":"(,)|(?=})","endCaptures":{"1":{"name":"punctuation.separator.dictionary.pair.json.comments"}},"name":"meta.structure.dictionary.value.json.comments","patterns":[{"include":"#value"},{"match":"[^,\\\\s]","name":"invalid.illegal.expected-dictionary-separator.json.comments"}]},{"match":"[^}\\\\s]","name":"invalid.illegal.expected-dictionary-separator.json.comments"}]},"objectkey":{"begin":"\\"","beginCaptures":{"0":{"name":"punctuation.support.type.property-name.begin.json.comments"}},"end":"\\"","endCaptures":{"0":{"name":"punctuation.support.type.property-name.end.json.comments"}},"name":"string.json.comments support.type.property-name.json.comments","patterns":[{"include":"#stringcontent"}]},"string":{"begin":"\\"","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.json.comments"}},"end":"\\"","endCaptures":{"0":{"name":"punctuation.definition.string.end.json.comments"}},"name":"string.quoted.double.json.comments","patterns":[{"include":"#stringcontent"}]},"stringcontent":{"patterns":[{"match":"\\\\\\\\(?:[\\"/\\\\\\\\bfnrt]|u\\\\h{4})","name":"constant.character.escape.json.comments"},{"match":"\\\\\\\\.","name":"invalid.illegal.unrecognized-string-escape.json.comments"}]},"value":{"patterns":[{"include":"#constant"},{"include":"#number"},{"include":"#string"},{"include":"#array"},{"include":"#object"},{"include":"#comments"}]}},"scopeName":"source.json.comments"}')),e=[n];export{e as default};
@@ -0,0 +1,70 @@
1
+ import{e,y,B,C,S,E,T,A,I,L,s,q,Ge,m}from"./chunk-y0m8hrwz.js";var dt=function(){var t=e(function(z,i,a,n){for(a=a||{},n=z.length;n--;a[z[n]]=i);return a},"o"),f=[1,4],l=[1,14],o=[1,12],h=[1,13],p=[6,7,8],k=[1,20],d=[1,18],x=[1,19],u=[6,7,11],_=[1,6,13,14],b=[1,23],M=[1,24],P=[1,6,7,11,13,14],U={trace:e(function(){},"trace"),yy:{},symbols_:{error:2,start:3,ishikawa:4,spaceLines:5,SPACELINE:6,NL:7,ISHIKAWA:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,TEXT:14,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"ISHIKAWA",11:"EOF",13:"SPACELIST",14:"TEXT"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,1],[12,1],[12,1]],performAction:e(function(i,a,n,c,g,r,N){var v=r.length-1;switch(g){case 6:case 7:return c;case 15:c.addNode(r[v-1].length,r[v].trim());break;case 16:c.addNode(0,r[v].trim());break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:f},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:f},{6:l,7:[1,10],9:9,12:11,13:o,14:h},t(p,[2,3]),{1:[2,2]},t(p,[2,4]),t(p,[2,5]),{1:[2,6],6:l,12:15,13:o,14:h},{6:l,9:16,12:11,13:o,14:h},{6:k,7:d,10:17,11:x},t(u,[2,18],{14:[1,21]}),t(u,[2,16]),t(u,[2,17]),{6:k,7:d,10:22,11:x},{1:[2,7],6:l,12:15,13:o,14:h},t(_,[2,14],{7:b,11:M}),t(P,[2,8]),t(P,[2,9]),t(P,[2,10]),t(u,[2,15]),t(_,[2,13],{7:b,11:M}),t(P,[2,11]),t(P,[2,12])],defaultActions:{2:[2,1],6:[2,2]},parseError:e(function(i,a){if(a.recoverable)this.trace(i);else{var n=Error(i);throw n.hash=a,n}},"parseError"),parse:e(function(i){var a=this,n=[0],c=[],g=[null],r=[],N=this.table,v="",W=0,D=0,R=0,F=2,X=1,rt=r.slice.call(arguments,1),w=Object.create(this.lexer),O={yy:{}};for(var K in this.yy)if(Object.prototype.hasOwnProperty.call(this.yy,K))O.yy[K]=this.yy[K];if(w.setInput(i,O.yy),O.yy.lexer=w,O.yy.parser=this,typeof w.yylloc>"u")w.yylloc={};var Q=w.yylloc;r.push(Q);var lt=w.options&&w.options.ranges;if(typeof O.yy.parseError==="function")this.parseError=O.yy.parseError;else this.parseError=Object.getPrototypeOf(this).parseError;function xt(G){n.length=n.length-2*G,g.length=g.length-G,r.length=r.length-G}e(xt,"popStack");function yt(){var G=c.pop()||w.lex()||X;if(typeof G!=="number"){if(G instanceof Array)c=G,G=c.pop();G=a.symbols_[G]||G}return G}e(yt,"lex");var j,ot,J,H,Vt,ht,tt={},st,Y,ft,nt;while(!0){if(J=n[n.length-1],this.defaultActions[J])H=this.defaultActions[J];else{if(j===null||typeof j>"u")j=yt();H=N[J]&&N[J][j]}if(typeof H>"u"||!H.length||!H[0]){var ct="";nt=[];for(st in N[J])if(this.terminals_[st]&&st>F)nt.push("'"+this.terminals_[st]+"'");if(w.showPosition)ct="Parse error on line "+(W+1)+`:
2
+ `+w.showPosition()+`
3
+ Expecting `+nt.join(", ")+", got '"+(this.terminals_[j]||j)+"'";else ct="Parse error on line "+(W+1)+": Unexpected "+(j==X?"end of input":"'"+(this.terminals_[j]||j)+"'");this.parseError(ct,{text:w.match,token:this.terminals_[j]||j,line:w.yylineno,loc:Q,expected:nt})}if(H[0]instanceof Array&&H.length>1)throw Error("Parse Error: multiple actions possible at state: "+J+", token: "+j);switch(H[0]){case 1:if(n.push(j),g.push(w.yytext),r.push(w.yylloc),n.push(H[1]),j=null,!ot){if(D=w.yyleng,v=w.yytext,W=w.yylineno,Q=w.yylloc,R>0)R--}else j=ot,ot=null;break;case 2:if(Y=this.productions_[H[1]][1],tt.$=g[g.length-Y],tt._$={first_line:r[r.length-(Y||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(Y||1)].first_column,last_column:r[r.length-1].last_column},lt)tt._$.range=[r[r.length-(Y||1)].range[0],r[r.length-1].range[1]];if(ht=this.performAction.apply(tt,[v,D,W,O.yy,H[1],g,r].concat(rt)),typeof ht<"u")return ht;if(Y)n=n.slice(0,-1*Y*2),g=g.slice(0,-1*Y),r=r.slice(0,-1*Y);n.push(this.productions_[H[1]][0]),g.push(tt.$),r.push(tt._$),ft=N[n[n.length-2]][n[n.length-1]],n.push(ft);break;case 3:return!0}}return!0},"parse")},Z=function(){var z={EOF:1,parseError:e(function(a,n){if(this.yy.parser)this.yy.parser.parseError(a,n);else throw Error(a)},"parseError"),setInput:e(function(i,a){if(this.yy=a||this.yy||{},this._input=i,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:e(function(){var i=this._input[0];this.yytext+=i,this.yyleng++,this.offset++,this.match+=i,this.matched+=i;var a=i.match(/(?:\r\n?|\n).*/g);if(a)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),i},"input"),unput:e(function(i){var a=i.length,n=i.split(/(?:\r\n?|\n)/g);this._input=i+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-a),this.offset-=a;var c=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),n.length-1)this.yylineno-=n.length-1;var g=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:n?(n.length===c.length?this.yylloc.first_column:0)+c[c.length-n.length].length-n[0].length:this.yylloc.first_column-a},this.options.ranges)this.yylloc.range=[g[0],g[0]+this.yyleng-a];return this.yyleng=this.yytext.length,this},"unput"),more:e(function(){return this._more=!0,this},"more"),reject:e(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
+ `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:e(function(i){this.unput(this.match.slice(i))},"less"),pastInput:e(function(){var i=this.matched.substr(0,this.matched.length-this.match.length);return(i.length>20?"...":"")+i.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:e(function(){var i=this.match;if(i.length<20)i+=this._input.substr(0,20-i.length);return(i.substr(0,20)+(i.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:e(function(){var i=this.pastInput(),a=Array(i.length+1).join("-");return i+this.upcomingInput()+`
5
+ `+a+"^"},"showPosition"),test_match:e(function(i,a){var n,c,g;if(this.options.backtrack_lexer){if(g={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)g.yylloc.range=this.yylloc.range.slice(0)}if(c=i[0].match(/(?:\r\n?|\n).*/g),c)this.yylineno+=c.length;if(this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:c?c[c.length-1].length-c[c.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+i[0].length},this.yytext+=i[0],this.match+=i[0],this.matches=i,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(i[0].length),this.matched+=i[0],n=this.performAction.call(this,this.yy,this,a,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input)this.done=!1;if(n)return n;else if(this._backtrack){for(var r in g)this[r]=g[r];return!1}return!1},"test_match"),next:e(function(){if(this.done)return this.EOF;if(!this._input)this.done=!0;var i,a,n,c;if(!this._more)this.yytext="",this.match="";var g=this._currentRules();for(var r=0;r<g.length;r++)if(n=this._input.match(this.rules[g[r]]),n&&(!a||n[0].length>a[0].length)){if(a=n,c=r,this.options.backtrack_lexer)if(i=this.test_match(n,g[r]),i!==!1)return i;else if(this._backtrack){a=!1;continue}else return!1;else if(!this.options.flex)break}if(a){if(i=this.test_match(a,g[c]),i!==!1)return i;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:e(function(){var a=this.next();if(a)return a;else return this.lex()},"lex"),begin:e(function(a){this.conditionStack.push(a)},"begin"),popState:e(function(){var a=this.conditionStack.length-1;if(a>0)return this.conditionStack.pop();else return this.conditionStack[0]},"popState"),_currentRules:e(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:e(function(a){if(a=this.conditionStack.length-1-Math.abs(a||0),a>=0)return this.conditionStack[a];else return"INITIAL"},"topState"),pushState:e(function(a){this.begin(a)},"pushState"),stateStackSize:e(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:e(function(a,n,c,g){var r=g;switch(c){case 0:return 6;case 1:return 8;case 2:return 8;case 3:return 6;case 4:return 7;case 5:return 13;case 6:return 14;case 7:return 11}},"anonymous"),rules:[/^(?:\s*%%.*)/i,/^(?:ishikawa-beta\b)/i,/^(?:ishikawa\b)/i,/^(?:[\s]+[\n])/i,/^(?:[\n]+)/i,/^(?:[\s]+)/i,/^(?:[^\n]+)/i,/^(?:$)/i],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7],inclusive:!0}}};return z}();U.lexer=Z;function V(){this.yy={}}return e(V,"Parser"),V.prototype=U,U.Parser=V,new V}();dt.parser=dt;var vt=dt,St=class{constructor(){this.stack=[],this.clear=this.clear.bind(this),this.addNode=this.addNode.bind(this),this.getRoot=this.getRoot.bind(this)}static{e(this,"IshikawaDB")}clear(){this.root=void 0,this.stack=[],this.baseLevel=void 0,C()}getRoot(){return this.root}addNode(t,f){let l=y.sanitizeText(f,s());if(!this.root){this.root={text:l,children:[]},this.stack=[{level:0,node:this.root}],I(l);return}this.baseLevel??=t;let o=t-this.baseLevel+1;if(o<=0)o=1;while(this.stack.length>1&&this.stack[this.stack.length-1].level>=o)this.stack.pop();let h=this.stack[this.stack.length-1].node,p={text:l,children:[]};h.children.push(p),this.stack.push({level:o,node:p})}getAccTitle(){return E()}setAccTitle(t){S(t)}getAccDescription(){return A()}setAccDescription(t){T(t)}getDiagramTitle(){return L()}setDiagramTitle(t){I(t)}},Et=14,et=250,$t=30,At=60,It=5,bt=82*Math.PI/180,pt=Math.cos(bt),gt=Math.sin(bt),kt=e((t,f,l)=>{let o=t.node().getBBox(),h=o.width+f*2,p=o.height+f*2;B(t,p,h,l),t.attr("viewBox",`${o.x-f} ${o.y-f} ${h} ${p}`)},"applyPaddedViewBox"),Lt=e((t,f,l,o)=>{let p=o.db.getRoot();if(!p)return;let k=s(),{look:d,handDrawnSeed:x,themeVariables:u}=k,_=Ge(k.fontSize)[0]??Et,b=d==="handDrawn",M=p.children??[],P=k.ishikawa?.diagramPadding??20,U=k.ishikawa?.useMaxWidth??!1,Z=q(f),V=Z.append("g").attr("class","ishikawa"),z=b?m.svg(Z.node()):void 0,i=z?{roughSvg:z,seed:x??0,lineColor:u?.lineColor??"#333",fillColor:u?.mainBkg??"#fff"}:void 0,a=`ishikawa-arrow-${f}`;if(!b)V.append("defs").append("marker").attr("id",a).attr("viewBox","0 0 10 10").attr("refX",0).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto").append("path").attr("d","M 10 0 L 0 5 L 10 10 Z").attr("class","ishikawa-arrow");let n=0,c=et,g=b?void 0:it(V,n,c,n,c,"ishikawa-spine");if(Tt(V,n,c,p.text,_,i),!M.length){if(b)it(V,n,c,n,c,"ishikawa-spine",i);kt(Z,P,U);return}n-=20;let r=M.filter((w,O)=>O%2===0),N=M.filter((w,O)=>O%2===1),v=mt(r),W=mt(N),D=v.total+W.total,R=et,F=et;if(D>0){let w=et*2,O=et*0.3;R=Math.max(O,w*(v.total/D)),F=Math.max(O,w*(W.total/D))}let X=_*2;if(R=Math.max(R,v.max*X),F=Math.max(F,W.max*X),c=Math.max(R,et),g)g.attr("y1",c).attr("y2",c);V.select(".ishikawa-head-group").attr("transform",`translate(0,${c})`);let rt=Math.ceil(M.length/2);for(let w=0;w<rt;w++){let O=V.append("g").attr("class","ishikawa-pair");for(let[K,Q,lt]of[[M[w*2],-1,R],[M[w*2+1],1,F]])if(K)Bt(O,K,n,c,Q,lt,_,i);n=O.selectAll("text").nodes().reduce((K,Q)=>Math.min(K,Q.getBBox().x),1/0)}if(b)it(V,n,c,0,c,"ishikawa-spine",i);else{g.attr("x1",n);let w=`url(#${a})`;V.selectAll("line.ishikawa-branch, line.ishikawa-sub-branch").attr("marker-start",w)}kt(Z,P,U)},"draw"),mt=e((t)=>{let f=e((l)=>l.children.reduce((o,h)=>o+1+f(h),0),"countDescendants");return t.reduce((l,o)=>{let h=f(o);return l.total+=h,l.max=Math.max(l.max,h),l},{total:0,max:0})},"sideStats"),Tt=e((t,f,l,o,h,p)=>{let k=Math.max(6,Math.floor(110/(h*0.6))),d=t.append("g").attr("class","ishikawa-head-group").attr("transform",`translate(${f},${l})`),x=at(d,_t(o,k),0,0,"ishikawa-head-label","start",h),u=x.node().getBBox(),_=Math.max(60,u.width+6),b=Math.max(40,u.height*2+40),M=`M 0 ${-b/2} L 0 ${b/2} Q ${_*2.4} 0 0 ${-b/2} Z`;if(p){let P=p.roughSvg.path(M,{roughness:1.5,seed:p.seed,fill:p.fillColor,fillStyle:"hachure",fillWeight:2.5,hachureGap:5,stroke:p.lineColor,strokeWidth:2});d.insert(()=>P,":first-child").attr("class","ishikawa-head")}else d.insert("path",":first-child").attr("class","ishikawa-head").attr("d",M);x.attr("transform",`translate(${(_-u.width)/2-u.x+3},${-u.y-u.height/2})`)},"drawHead"),Mt=e((t,f)=>{let l=[],o=[],h=e((p,k,d)=>{let x=f===-1?[...p].reverse():p;for(let u of x){let _=l.length,b=u.children??[];if(l.push({depth:d,text:_t(u.text,15),parentIndex:k,childCount:b.length}),d%2===0){if(o.push(_),b.length)h(b,_,d+1)}else{if(b.length)h(b,_,d+1);o.push(_)}}},"walk");return h(t,-1,2),{entries:l,yOrder:o}},"flattenTree"),Pt=e((t,f,l,o,h,p,k)=>{let d=t.append("g").attr("class","ishikawa-label-group"),u=at(d,f,l,o+11*h,"ishikawa-label cause","middle",p).node().getBBox();if(k){let _=k.roughSvg.rectangle(u.x-20,u.y-2,u.width+40,u.height+4,{roughness:1.5,seed:k.seed,fill:k.fillColor,fillStyle:"hachure",fillWeight:2.5,hachureGap:5,stroke:k.lineColor,strokeWidth:2});d.insert(()=>_,":first-child").attr("class","ishikawa-label-box")}else d.insert("rect",":first-child").attr("class","ishikawa-label-box").attr("x",u.x-20).attr("y",u.y-2).attr("width",u.width+40).attr("height",u.height+4)},"drawCauseLabel"),ut=e((t,f,l,o,h,p)=>{let k=Math.sqrt(o*o+h*h);if(k===0)return;let d=o/k,x=h/k,u=6,_=-x*u,b=d*u,M=f,P=l,U=`M ${M} ${P} L ${M-d*u*2+_} ${P-x*u*2+b} L ${M-d*u*2-_} ${P-x*u*2-b} Z`,Z=p.roughSvg.path(U,{roughness:1,seed:p.seed,fill:p.lineColor,fillStyle:"solid",stroke:p.lineColor,strokeWidth:1});t.append(()=>Z)},"drawArrowMarker"),Bt=e((t,f,l,o,h,p,k,d)=>{let x=f.children??[],u=p*(x.length?1:0.2),_=-pt*u,b=gt*u*h,M=l+_,P=o+b;if(it(t,l,o,M,P,"ishikawa-branch",d),d)ut(t,l,o,l-M,o-P,d);if(Pt(t,f.text,M,P,h,k,d),!x.length)return;let{entries:U,yOrder:Z}=Mt(x,h),V=U.length,z=Array(V);for(let[g,r]of Z.entries())z[r]=o+b*((g+1)/(V+1));let i=new Map;i.set(-1,{x0:l,y0:o,x1:M,y1:P,childCount:x.length,childrenDrawn:0});let a=-pt,n=gt*h,c=h<0?"ishikawa-label up":"ishikawa-label down";for(let[g,r]of U.entries()){let N=z[g],v=i.get(r.parentIndex),W=t.append("g").attr("class","ishikawa-sub-group"),D=0,R=0,F=0;if(r.depth%2===0){let X=v.y1-v.y0;if(D=wt(v.x0,v.x1,X?(N-v.y0)/X:0.5),R=N,F=D-(r.childCount>0?At+r.childCount*It:$t),it(W,D,N,F,N,"ishikawa-sub-branch",d),d)ut(W,D,N,1,0,d);at(W,r.text,F,N,"ishikawa-label align","end",k)}else{let X=v.childrenDrawn++;if(D=wt(v.x0,v.x1,(v.childCount-X)/(v.childCount+1)),R=v.y0,F=D+a*((N-R)/n),it(W,D,R,F,N,"ishikawa-sub-branch",d),d)ut(W,D,R,D-F,R-N,d);at(W,r.text,F,N,c,"end",k)}if(r.childCount>0)i.set(g,{x0:D,y0:R,x1:F,y1:N,childCount:r.childCount,childrenDrawn:0})}},"drawBranch"),Nt=e((t)=>t.split(/<br\s*\/?>|\n/),"splitLines"),_t=e((t,f)=>{if(t.length<=f)return t;let l=[];for(let o of t.split(/\s+/)){let h=l.length-1;if(h>=0&&l[h].length+1+o.length<=f)l[h]+=" "+o;else l.push(o)}return l.join(`
7
+ `)},"wrapText"),at=e((t,f,l,o,h,p,k)=>{let d=Nt(f),x=k*1.05,u=t.append("text").attr("class",h).attr("text-anchor",p).attr("x",l).attr("y",o-(d.length-1)*x/2);for(let[_,b]of d.entries())u.append("tspan").attr("x",l).attr("dy",_===0?0:x).text(b);return u},"drawMultilineText"),wt=e((t,f,l)=>t+(f-t)*l,"lerp"),it=e((t,f,l,o,h,p,k)=>{if(k){let d=k.roughSvg.line(f,l,o,h,{roughness:1.5,seed:k.seed,stroke:k.lineColor,strokeWidth:2});t.append(()=>d).attr("class",p);return}return t.append("line").attr("class",p).attr("x1",f).attr("y1",l).attr("x2",o).attr("y2",h)},"drawLine"),Dt={draw:Lt},Ot=e((t)=>`
8
+ .ishikawa .ishikawa-spine,
9
+ .ishikawa .ishikawa-branch,
10
+ .ishikawa .ishikawa-sub-branch {
11
+ stroke: ${t.lineColor};
12
+ stroke-width: 2;
13
+ fill: none;
14
+ }
15
+
16
+ .ishikawa .ishikawa-sub-branch {
17
+ stroke-width: 1;
18
+ }
19
+
20
+ .ishikawa .ishikawa-arrow {
21
+ fill: ${t.lineColor};
22
+ }
23
+
24
+ .ishikawa .ishikawa-head {
25
+ fill: ${t.mainBkg};
26
+ stroke: ${t.lineColor};
27
+ stroke-width: 2;
28
+ }
29
+
30
+ .ishikawa .ishikawa-label-box {
31
+ fill: ${t.mainBkg};
32
+ stroke: ${t.lineColor};
33
+ stroke-width: 2;
34
+ }
35
+
36
+ .ishikawa text {
37
+ font-family: ${t.fontFamily};
38
+ font-size: ${t.fontSize};
39
+ fill: ${t.textColor};
40
+ }
41
+
42
+ .ishikawa .ishikawa-head-label {
43
+ font-weight: 600;
44
+ text-anchor: middle;
45
+ dominant-baseline: middle;
46
+ font-size: 14px;
47
+ }
48
+
49
+ .ishikawa .ishikawa-label {
50
+ text-anchor: end;
51
+ }
52
+
53
+ .ishikawa .ishikawa-label.cause {
54
+ text-anchor: middle;
55
+ dominant-baseline: middle;
56
+ }
57
+
58
+ .ishikawa .ishikawa-label.align {
59
+ text-anchor: end;
60
+ dominant-baseline: middle;
61
+ }
62
+
63
+ .ishikawa .ishikawa-label.up {
64
+ dominant-baseline: baseline;
65
+ }
66
+
67
+ .ishikawa .ishikawa-label.down {
68
+ dominant-baseline: hanging;
69
+ }
70
+ `,"getStyles"),Ct=Ot,Gt={parser:vt,get db(){return new St},renderer:Dt,styles:Ct};export{Gt as diagram};
@@ -0,0 +1,2 @@
1
+ import{Rt,fn,Dt,ra}from"./chunk-0mrkjnte.js";import{Nt}from"./chunk-ry9256r7.js";import{$t,Cr,Fn,$e,Sr}from"./chunk-y0m8hrwz.js";function s(r,n){return r==null||n==null?NaN:r<n?-1:r>n?1:r>=n?0:NaN}function x(r,n){return r==null||n==null?NaN:n<r?-1:n>r?1:n>=r?0:NaN}function nr(r){let n,e,t;if(r.length!==2)n=s,e=(f,c)=>s(r(f),c),t=(f,c)=>r(f)-c;else n=r===s||r===x?r:O,e=r,t=r;function o(f,c,i=0,p=f.length){if(i<p){if(n(c,c)!==0)return p;do{let l=i+p>>>1;if(e(f[l],c)<0)i=l+1;else p=l}while(i<p)}return i}function a(f,c,i=0,p=f.length){if(i<p){if(n(c,c)!==0)return p;do{let l=i+p>>>1;if(e(f[l],c)<=0)i=l+1;else p=l}while(i<p)}return i}function u(f,c,i=0,p=f.length){let l=o(f,c,i,p-1);return l>i&&t(f[l-1],c)>-t(f[l],c)?l-1:l}return{left:o,center:u,right:a}}function O(){return 0}function y(r){return r===null?NaN:+r}var V=nr(s),{right:T,left:or}=V,ur=nr(y).center,z=T;var E=Math.sqrt(50),G=Math.sqrt(10),H=Math.sqrt(2);function g(r,n,e){let t=(n-r)/Math.max(0,e),o=Math.floor(Math.log10(t)),a=t/Math.pow(10,o),u=a>=E?10:a>=G?5:a>=H?2:1,f,c,i;if(o<0){if(i=Math.pow(10,-o)/u,f=Math.round(r*i),c=Math.round(n*i),f/i<r)++f;if(c/i>n)--c;i=-i}else{if(i=Math.pow(10,o)*u,f=Math.round(r/i),c=Math.round(n/i),f*i<r)++f;if(c*i>n)--c}if(c<f&&0.5<=e&&e<2)return g(r,n,e*2);return[f,c,i]}function v(r,n,e){if(n=+n,r=+r,e=+e,!(e>0))return[];if(r===n)return[r];let t=n<r,[o,a,u]=t?g(n,r,e):g(r,n,e);if(!(a>=o))return[];let f=a-o+1,c=Array(f);if(t)if(u<0)for(let i=0;i<f;++i)c[i]=(a-i)/-u;else for(let i=0;i<f;++i)c[i]=(a-i)*u;else if(u<0)for(let i=0;i<f;++i)c[i]=(o+i)/-u;else for(let i=0;i<f;++i)c[i]=(o+i)*u;return c}function M(r,n,e){return n=+n,r=+r,e=+e,g(r,n,e)[2]}function Pr(r,n,e){n=+n,r=+r,e=+e;let t=n<r,o=t?M(n,r,e):M(r,n,e);return(t?-1:1)*(o<0?1/-o:o)}function N(r,n){if(!n)n=[];var e=r?Math.min(n.length,r.length):0,t=n.slice(),o;return function(a){for(o=0;o<e;++o)t[o]=r[o]*(1-a)+n[o]*a;return t}}function B(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function P(r,n){var e=n?n.length:0,t=r?Math.min(e,r.length):0,o=Array(t),a=Array(e),u;for(u=0;u<t;++u)o[u]=h(r[u],n[u]);for(;u<e;++u)a[u]=n[u];return function(f){for(u=0;u<t;++u)a[u]=o[u](f);return a}}function w(r,n){var e=new Date;return r=+r,n=+n,function(t){return e.setTime(r*(1-t)+n*t),e}}function k(r,n){var e={},t={},o;if(r===null||typeof r!=="object")r={};if(n===null||typeof n!=="object")n={};for(o in n)if(o in r)e[o]=h(r[o],n[o]);else t[o]=n[o];return function(a){for(o in e)t[o]=e[o](a);return t}}function h(r,n){var e=typeof n,t;return n==null||e==="boolean"?Cr(n):(e==="number"?$e:e==="string"?(t=$t(n))?(n=t,Fn):Sr:n instanceof $t?Fn:n instanceof Date?w:B(n)?N:Array.isArray(n)?P:typeof n.valueOf!=="function"&&typeof n.toString!=="function"||isNaN(n)?k:$e)(r,n)}function A(r,n){return r=+r,n=+n,function(e){return Math.round(r*(1-e)+n*e)}}function R(r){return Math.max(0,-Rt(Math.abs(r)))}function S(r,n){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Rt(n)/3)))*3-Rt(Math.abs(r)))}function j(r,n){return r=Math.abs(r),n=Math.abs(n)-r,Math.max(0,Rt(n)-Rt(r))+1}function F(r){return function(){return r}}function q(r){return+r}var C=[0,1];function d(r){return r}function D(r,n){return(n-=r=+r)?function(e){return(e-r)/n}:F(isNaN(n)?NaN:0.5)}function J(r,n){var e;if(r>n)e=r,r=n,n=e;return function(t){return Math.max(r,Math.min(n,t))}}function K(r,n,e){var t=r[0],o=r[1],a=n[0],u=n[1];if(o<t)t=D(o,t),a=e(u,a);else t=D(t,o),a=e(a,u);return function(f){return a(t(f))}}function Q(r,n,e){var t=Math.min(r.length,n.length)-1,o=Array(t),a=Array(t),u=-1;if(r[t]<r[0])r=r.slice().reverse(),n=n.slice().reverse();while(++u<t)o[u]=D(r[u],r[u+1]),a[u]=e(n[u],n[u+1]);return function(f){var c=z(r,f,1,t)-1;return a[c](o[c](f))}}function na(r,n){return n.domain(r.domain()).range(r.range()).interpolate(r.interpolate()).clamp(r.clamp()).unknown(r.unknown())}function U(){var r=C,n=C,e=h,t,o,a,u=d,f,c,i;function p(){var m=Math.min(r.length,n.length);if(u!==d)u=J(r[0],r[m-1]);return f=m>2?Q:K,c=i=null,l}function l(m){return m==null||isNaN(m=+m)?a:(c||(c=f(r.map(t),n,e)))(t(u(m)))}return l.invert=function(m){return u(o((i||(i=f(n,r.map(t),$e)))(m)))},l.domain=function(m){return arguments.length?(r=Array.from(m,q),p()):r.slice()},l.range=function(m){return arguments.length?(n=Array.from(m),p()):n.slice()},l.rangeRound=function(m){return n=Array.from(m),e=A,p()},l.clamp=function(m){return arguments.length?(u=m?!0:d,p()):u!==d},l.interpolate=function(m){return arguments.length?(e=m,p()):e},l.unknown=function(m){return arguments.length?(a=m,l):a},function(m,L){return t=m,o=L,p()}}function Or(){return U()(d,d)}function I(r,n,e,t){var o=Pr(r,n,e),a;switch(t=fn(t==null?",f":t),t.type){case"s":{var u=Math.max(Math.abs(r),Math.abs(n));if(t.precision==null&&!isNaN(a=S(o,u)))t.precision=a;return ra(t,u)}case"":case"e":case"g":case"p":case"r":{if(t.precision==null&&!isNaN(a=j(o,Math.max(Math.abs(r),Math.abs(n)))))t.precision=a-(t.type==="e");break}case"f":case"%":{if(t.precision==null&&!isNaN(a=R(o)))t.precision=a-(t.type==="%")*2;break}}return Dt(t)}function W(r){var n=r.domain;return r.ticks=function(e){var t=n();return v(t[0],t[t.length-1],e==null?10:e)},r.tickFormat=function(e,t){var o=n();return I(o[0],o[o.length-1],e==null?10:e,t)},r.nice=function(e){if(e==null)e=10;var t=n(),o=0,a=t.length-1,u=t[o],f=t[a],c,i,p=10;if(f<u)i=u,u=f,f=i,i=o,o=a,a=i;while(p-- >0){if(i=M(u,f,e),i===c)return t[o]=u,t[a]=f,n(t);else if(i>0)u=Math.floor(u/i)*i,f=Math.ceil(f/i)*i;else if(i<0)u=Math.ceil(u*i)/i,f=Math.floor(f*i)/i;else break;c=i}return r},r}function xt(){var r=Or();return r.copy=function(){return na(r,xt())},Nt.apply(r,arguments),W(r)}
2
+ export{nr,Pr,na,Or,xt};
@@ -0,0 +1,291 @@
1
+ import{e,r,Le,y,C,S,E,T,A,I,L,s,p,zi,N,le,ae,ie,ft,he,ge}from"./chunk-y0m8hrwz.js";import{Mt}from"./chunk-p3b9crsa.js";import{fe}from"./chunk-ss1bcb0n.js";import{oe}from"./chunk-hev4hq89.js";var Pt=function(){var t=e(function(Q,h,g,o){for(g=g||{},o=Q.length;o--;g[Q[o]]=h);return g},"o"),i=[1,2],c=[1,3],a=[1,4],u=[2,4],f=[1,9],b=[1,11],k=[1,16],l=[1,17],D=[1,18],x=[1,19],Y=[1,33],V=[1,20],j=[1,21],F=[1,22],m=[1,23],M=[1,24],P=[1,26],z=[1,27],W=[1,28],K=[1,29],R=[1,30],st=[1,31],St=[1,32],gt=[1,35],yt=[1,36],mt=[1,37],bt=[1,38],rt=[1,34],_=[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],kt=[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],Vt=[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],Lt={trace:e(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:e(function(h,g,o,v,w,n,it){var d=n.length-1;switch(w){case 3:return v.setRootDoc(n[d]),n[d];break;case 4:this.$=[];break;case 5:if(n[d]!="nl")n[d-1].push(n[d]),this.$=n[d-1];break;case 6:case 7:this.$=n[d];break;case 8:this.$="nl";break;case 12:this.$=n[d];break;case 13:let Et=n[d-1];Et.description=v.trimColon(n[d]),this.$=Et;break;case 14:this.$={stmt:"relation",state1:n[d-2],state2:n[d]};break;case 15:let _t=v.trimColon(n[d]);this.$={stmt:"relation",state1:n[d-3],state2:n[d-1],description:_t};break;case 19:this.$={stmt:"state",id:n[d-3],type:"default",description:"",doc:n[d-1]};break;case 20:var X=n[d],J=n[d-2].trim();if(n[d].match(":")){var lt=n[d].split(":");X=lt[0],J=[J,lt[1]]}this.$={stmt:"state",id:X,type:"default",description:J};break;case 21:this.$={stmt:"state",id:n[d-3],type:"default",description:n[d-5],doc:n[d-1]};break;case 22:this.$={stmt:"state",id:n[d],type:"fork"};break;case 23:this.$={stmt:"state",id:n[d],type:"join"};break;case 24:this.$={stmt:"state",id:n[d],type:"choice"};break;case 25:this.$={stmt:"state",id:v.getDividerId(),type:"divider"};break;case 26:this.$={stmt:"state",id:n[d-1].trim(),note:{position:n[d-2].trim(),text:n[d].trim()}};break;case 29:this.$=n[d].trim(),v.setAccTitle(this.$);break;case 30:case 31:this.$=n[d].trim(),v.setAccDescription(this.$);break;case 32:this.$={stmt:"click",id:n[d-3],url:n[d-2],tooltip:n[d-1]};break;case 33:this.$={stmt:"click",id:n[d-3],url:n[d-1],tooltip:""};break;case 34:case 35:this.$={stmt:"classDef",id:n[d-1].trim(),classes:n[d].trim()};break;case 36:this.$={stmt:"style",id:n[d-1].trim(),styleClass:n[d].trim()};break;case 37:this.$={stmt:"applyClass",id:n[d-1].trim(),styleClass:n[d].trim()};break;case 38:v.setDirection("TB"),this.$={stmt:"dir",value:"TB"};break;case 39:v.setDirection("BT"),this.$={stmt:"dir",value:"BT"};break;case 40:v.setDirection("RL"),this.$={stmt:"dir",value:"RL"};break;case 41:v.setDirection("LR"),this.$={stmt:"dir",value:"LR"};break;case 44:case 45:this.$={stmt:"state",id:n[d].trim(),type:"default",description:""};break;case 46:this.$={stmt:"state",id:n[d-2].trim(),classes:[n[d].trim()],type:"default",description:""};break;case 47:this.$={stmt:"state",id:n[d-2].trim(),classes:[n[d].trim()],type:"default",description:""};break}},"anonymous"),table:[{3:1,4:i,5:c,6:a},{1:[3]},{3:5,4:i,5:c,6:a},{3:6,4:i,5:c,6:a},t([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:b,8:8,9:10,10:12,11:13,12:14,13:15,16:k,17:l,19:D,22:x,24:Y,25:V,26:j,27:F,28:m,29:M,32:25,33:P,35:z,37:W,38:K,41:R,45:st,48:St,51:gt,52:yt,53:mt,54:bt,57:rt},t(_,[2,5]),{9:39,10:12,11:13,12:14,13:15,16:k,17:l,19:D,22:x,24:Y,25:V,26:j,27:F,28:m,29:M,32:25,33:P,35:z,37:W,38:K,41:R,45:st,48:St,51:gt,52:yt,53:mt,54:bt,57:rt},t(_,[2,7]),t(_,[2,8]),t(_,[2,9]),t(_,[2,10]),t(_,[2,11]),t(_,[2,12],{14:[1,40],15:[1,41]}),t(_,[2,16]),{18:[1,42]},t(_,[2,18],{20:[1,43]}),{23:[1,44]},t(_,[2,22]),t(_,[2,23]),t(_,[2,24]),t(_,[2,25]),{30:45,31:[1,46],59:[1,47],60:[1,48]},t(_,[2,28]),{34:[1,49]},{36:[1,50]},t(_,[2,31]),{13:51,24:Y,57:rt},{42:[1,52],44:[1,53]},{46:[1,54]},{49:[1,55]},t(kt,[2,44],{58:[1,56]}),t(kt,[2,45],{58:[1,57]}),t(_,[2,38]),t(_,[2,39]),t(_,[2,40]),t(_,[2,41]),t(_,[2,6]),t(_,[2,13]),{13:58,24:Y,57:rt},t(_,[2,17]),t(Vt,u,{7:59}),{24:[1,60]},{24:[1,61]},{23:[1,62]},{24:[2,48]},{24:[2,49]},t(_,[2,29]),t(_,[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]},t(_,[2,14],{14:[1,71]}),{4:f,5:b,8:8,9:10,10:12,11:13,12:14,13:15,16:k,17:l,19:D,21:[1,72],22:x,24:Y,25:V,26:j,27:F,28:m,29:M,32:25,33:P,35:z,37:W,38:K,41:R,45:st,48:St,51:gt,52:yt,53:mt,54:bt,57:rt},t(_,[2,20],{20:[1,73]}),{31:[1,74]},{24:[1,75]},{39:[1,76]},{39:[1,77]},t(_,[2,34]),t(_,[2,35]),t(_,[2,36]),t(_,[2,37]),t(kt,[2,46]),t(kt,[2,47]),t(_,[2,15]),t(_,[2,19]),t(Vt,u,{7:78}),t(_,[2,26]),t(_,[2,27]),{5:[1,79]},{5:[1,80]},{4:f,5:b,8:8,9:10,10:12,11:13,12:14,13:15,16:k,17:l,19:D,21:[1,81],22:x,24:Y,25:V,26:j,27:F,28:m,29:M,32:25,33:P,35:z,37:W,38:K,41:R,45:st,48:St,51:gt,52:yt,53:mt,54:bt,57:rt},t(_,[2,32]),t(_,[2,33]),t(_,[2,21])],defaultActions:{5:[2,1],6:[2,2],47:[2,48],48:[2,49]},parseError:e(function(h,g){if(g.recoverable)this.trace(h);else{var o=Error(h);throw o.hash=g,o}},"parseError"),parse:e(function(h){var g=this,o=[0],v=[],w=[null],n=[],it=this.table,d="",X=0,J=0,lt=0,Et=2,_t=1,be=n.slice.call(arguments,1),O=Object.create(this.lexer),tt={yy:{}};for(var wt in this.yy)if(Object.prototype.hasOwnProperty.call(this.yy,wt))tt.yy[wt]=this.yy[wt];if(O.setInput(h,tt.yy),tt.yy.lexer=O,tt.yy.parser=this,typeof O.yylloc>"u")O.yylloc={};var It=O.yylloc;n.push(It);var ke=O.options&&O.options.ranges;if(typeof tt.yy.parseError==="function")this.parseError=tt.yy.parseError;else this.parseError=Object.getPrototypeOf(this).parseError;function Te(H){o.length=o.length-2*H,w.length=w.length-H,n.length=n.length-H}e(Te,"popStack");function Wt(){var H=v.pop()||O.lex()||_t;if(typeof H!=="number"){if(H instanceof Array)v=H,H=v.pop();H=g.symbols_[H]||H}return H}e(Wt,"lex");var B,Nt,et,U,ts,Ot,at={},vt,q,jt,Dt;while(!0){if(et=o[o.length-1],this.defaultActions[et])U=this.defaultActions[et];else{if(B===null||typeof B>"u")B=Wt();U=it[et]&&it[et][B]}if(typeof U>"u"||!U.length||!U[0]){var Rt="";Dt=[];for(vt in it[et])if(this.terminals_[vt]&&vt>Et)Dt.push("'"+this.terminals_[vt]+"'");if(O.showPosition)Rt="Parse error on line "+(X+1)+`:
2
+ `+O.showPosition()+`
3
+ Expecting `+Dt.join(", ")+", got '"+(this.terminals_[B]||B)+"'";else Rt="Parse error on line "+(X+1)+": Unexpected "+(B==_t?"end of input":"'"+(this.terminals_[B]||B)+"'");this.parseError(Rt,{text:O.match,token:this.terminals_[B]||B,line:O.yylineno,loc:It,expected:Dt})}if(U[0]instanceof Array&&U.length>1)throw Error("Parse Error: multiple actions possible at state: "+et+", token: "+B);switch(U[0]){case 1:if(o.push(B),w.push(O.yytext),n.push(O.yylloc),o.push(U[1]),B=null,!Nt){if(J=O.yyleng,d=O.yytext,X=O.yylineno,It=O.yylloc,lt>0)lt--}else B=Nt,Nt=null;break;case 2:if(q=this.productions_[U[1]][1],at.$=w[w.length-q],at._$={first_line:n[n.length-(q||1)].first_line,last_line:n[n.length-1].last_line,first_column:n[n.length-(q||1)].first_column,last_column:n[n.length-1].last_column},ke)at._$.range=[n[n.length-(q||1)].range[0],n[n.length-1].range[1]];if(Ot=this.performAction.apply(at,[d,J,X,tt.yy,U[1],w,n].concat(be)),typeof Ot<"u")return Ot;if(q)o=o.slice(0,-1*q*2),w=w.slice(0,-1*q),n=n.slice(0,-1*q);o.push(this.productions_[U[1]][0]),w.push(at.$),n.push(at._$),jt=it[o[o.length-2]][o[o.length-1]],o.push(jt);break;case 3:return!0}}return!0},"parse")},me=function(){var Q={EOF:1,parseError:e(function(g,o){if(this.yy.parser)this.yy.parser.parseError(g,o);else throw Error(g)},"parseError"),setInput:e(function(h,g){if(this.yy=g||this.yy||{},this._input=h,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:e(function(){var h=this._input[0];this.yytext+=h,this.yyleng++,this.offset++,this.match+=h,this.matched+=h;var g=h.match(/(?:\r\n?|\n).*/g);if(g)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),h},"input"),unput:e(function(h){var g=h.length,o=h.split(/(?:\r\n?|\n)/g);this._input=h+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-g),this.offset-=g;var v=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),o.length-1)this.yylineno-=o.length-1;var w=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:o?(o.length===v.length?this.yylloc.first_column:0)+v[v.length-o.length].length-o[0].length:this.yylloc.first_column-g},this.options.ranges)this.yylloc.range=[w[0],w[0]+this.yyleng-g];return this.yyleng=this.yytext.length,this},"unput"),more:e(function(){return this._more=!0,this},"more"),reject:e(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
+ `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:e(function(h){this.unput(this.match.slice(h))},"less"),pastInput:e(function(){var h=this.matched.substr(0,this.matched.length-this.match.length);return(h.length>20?"...":"")+h.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:e(function(){var h=this.match;if(h.length<20)h+=this._input.substr(0,20-h.length);return(h.substr(0,20)+(h.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:e(function(){var h=this.pastInput(),g=Array(h.length+1).join("-");return h+this.upcomingInput()+`
5
+ `+g+"^"},"showPosition"),test_match:e(function(h,g){var o,v,w;if(this.options.backtrack_lexer){if(w={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)w.yylloc.range=this.yylloc.range.slice(0)}if(v=h[0].match(/(?:\r\n?|\n).*/g),v)this.yylineno+=v.length;if(this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:v?v[v.length-1].length-v[v.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+h[0].length},this.yytext+=h[0],this.match+=h[0],this.matches=h,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(h[0].length),this.matched+=h[0],o=this.performAction.call(this,this.yy,this,g,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input)this.done=!1;if(o)return o;else if(this._backtrack){for(var n in w)this[n]=w[n];return!1}return!1},"test_match"),next:e(function(){if(this.done)return this.EOF;if(!this._input)this.done=!0;var h,g,o,v;if(!this._more)this.yytext="",this.match="";var w=this._currentRules();for(var n=0;n<w.length;n++)if(o=this._input.match(this.rules[w[n]]),o&&(!g||o[0].length>g[0].length)){if(g=o,v=n,this.options.backtrack_lexer)if(h=this.test_match(o,w[n]),h!==!1)return h;else if(this._backtrack){g=!1;continue}else return!1;else if(!this.options.flex)break}if(g){if(h=this.test_match(g,w[v]),h!==!1)return h;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:e(function(){var g=this.next();if(g)return g;else return this.lex()},"lex"),begin:e(function(g){this.conditionStack.push(g)},"begin"),popState:e(function(){var g=this.conditionStack.length-1;if(g>0)return this.conditionStack.pop();else return this.conditionStack[0]},"popState"),_currentRules:e(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:e(function(g){if(g=this.conditionStack.length-1-Math.abs(g||0),g>=0)return this.conditionStack[g];else return"INITIAL"},"topState"),pushState:e(function(g){this.begin(g)},"pushState"),stateStackSize:e(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:e(function(g,o,v,w){function n(){let d=o.yytext.indexOf("%%");if(d===0)return!1;if(d>0){let X=o.yytext.slice(0,d),J=o.yytext.slice(d);if(J)g.lexer.unput(J);o.yytext=X}return!0}e(n,"processId");var it=w;switch(v){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(),o.yytext=o.yytext.slice(0,-8).trim(),25;break;case 38:return this.popState(),o.yytext=o.yytext.slice(0,-8).trim(),26;break;case 39:return this.popState(),o.yytext=o.yytext.slice(0,-10).trim(),27;break;case 40:return this.popState(),o.yytext=o.yytext.slice(0,-8).trim(),25;break;case 41:return this.popState(),o.yytext=o.yytext.slice(0,-8).trim(),26;break;case 42:return this.popState(),o.yytext=o.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(!n())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: "'+o.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(!n())return;return this.popState(),"ID";break;case 66:if(!n())return;return this.popState(),this.pushState("NOTE_TEXT"),24;break;case 67:return this.popState(),o.yytext=o.yytext.substr(2).trim(),31;break;case 68:return this.popState(),o.yytext=o.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(!n())return;return 24;case 74:return o.yytext=o.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}();Lt.lexer=me;function Tt(){this.yy={}}return e(Tt,"Parser"),Tt.prototype=Lt,Lt.Parser=Tt,new Tt}();Pt.parser=Pt;var Ee=Pt,_e="TB",qt="TB",Ut="dir",ot="state",nt="root",Bt="relation",ve="classDef",De="style",Ce="applyClass",ut="default",Qt="divider",Zt="fill:none",te="fill: #333",ee="c",se="markdown",re="normal",$t="rect",Ft="rectWithTitle",Ae="stateStart",xe="stateEnd",Gt="divider",Ht="roundedWithTitle",we="note",Ie="noteGroup",pt="statediagram",Ne="state",Oe=`${pt}-${Ne}`,ne="transition",Re="note",$e="note-edge",Fe=`${ne} ${$e}`,Pe=`${pt}-${Re}`,Be="cluster",Ge=`${pt}-${Be}`,Ye="cluster-alt",Ve=`${pt}-${Ye}`,ce="parent",de="note",Me="state",Yt="----",We=`${Yt}${de}`,zt=`${Yt}${ce}`,At=new Map,Z=0,ue=0,ct=new Map,je=e((t,i,c,a)=>{if(t===Gt&&c?.id!==void 0&&ct.has(c.id)){let b=ct.get(c.id);return ct.set(i,b),b}let u=ue++,f=a?void 0:u;return ct.set(i,f),f},"colorSlotFor");function xt(t="",i=0,c="",a=Yt){let u=c!==null&&c.length>0?`${a}${c}`:"";return`${Me}-${t}${u}-${i}`}e(xt,"stateDomId");var Ue=e((t,i,c,a,u,f,b,k)=>{r.trace("items",i),i.forEach((l)=>{switch(l.stmt){case ot:dt(t,l,c,a,u,f,b,k);break;case ut:dt(t,l,c,a,u,f,b,k);break;case Bt:{dt(t,l.state1,c,a,u,f,b,k),dt(t,l.state2,c,a,u,f,b,k);let D=b==="neo",x={id:"edge"+Z,start:l.state1.id,end:l.state2.id,arrowhead:"normal",arrowTypeEnd:D?"arrow_barb_neo":"arrow_barb",style:Zt,labelStyle:"",label:y.sanitizeText(l.description??"",s()),arrowheadStyle:te,labelpos:ee,labelType:se,thickness:re,classes:ne,look:b};u.push(x),Z++}break}})},"setupDoc"),Kt=e((t,i=qt)=>{let c=i;if(t.doc){for(let a of t.doc)if(a.stmt==="dir")c=a.value}return c},"getDir");function ht(t,i,c){if(!i.id||i.id==="</join></fork>"||i.id==="</choice>")return;if(i.cssClasses){if(!Array.isArray(i.cssCompiledStyles))i.cssCompiledStyles=[];i.cssClasses.split(" ").forEach((u)=>{let f=c.get(u);if(f)i.cssCompiledStyles=[...i.cssCompiledStyles??[],...f.styles]})}let a=t.find((u)=>u.id===i.id);if(a)Object.assign(a,i);else t.push(i)}e(ht,"insertOrUpdateNode");function pe(t){return t?.classes?.join(" ")??""}e(pe,"getClassesFromDbInfo");function Se(t){return t?.styles??[]}e(Se,"getStylesFromDbInfo");var dt=e((t,i,c,a,u,f,b,k)=>{let l=i.id,D=c.get(l),x=pe(D),Y=Se(D),V=s(),j=x.trim()!==""||Y.length>0;if(r.info("dataFetcher parsedItem",i,D,Y),l!=="root"){let F=$t;if(i.start===!0)F=Ae;else if(i.start===!1)F=xe;if(i.type!==ut)F=i.type;if(!At.get(l))At.set(l,{id:l,shape:F,description:y.sanitizeText(l,V),cssClasses:`${x} ${Oe}`,cssStyles:Y});let m=At.get(l);if(i.description){if(Array.isArray(m.description))m.shape=Ft,m.description.push(i.description);else if(m.description?.length&&m.description.length>0)if(m.shape=Ft,m.description===l)m.description=[i.description];else m.description=[m.description,i.description];else m.shape=$t,m.description=i.description;m.description=y.sanitizeTextOrArray(m.description,V)}if(m.description?.length===1&&m.shape===Ft)if(m.type==="group")m.shape=Ht;else m.shape=$t;if(!m.type&&i.doc)r.info("Setting cluster for XCX",l,Kt(i)),m.type="group",m.isGroup=!0,m.dir=Kt(i),m.shape=i.type===Qt?Gt:Ht,m.colorIndex=je(m.shape,l,t,j),m.cssClasses=`${m.cssClasses} ${Ge} ${f?Ve:""}`;let M={labelStyle:"",shape:m.shape,label:m.description,cssClasses:m.cssClasses,cssCompiledStyles:[],cssStyles:m.cssStyles,id:l,dir:m.dir,domId:xt(l,Z),type:m.type,isGroup:m.type==="group",colorIndex:m.colorIndex,padding:8,rx:10,ry:10,look:b,labelType:"markdown"};if(M.shape===Gt)M.label="";if(t&&t.id!=="root")r.trace("Setting node ",l," to be child of its parent ",t.id),M.parentId=t.id;if(M.centerLabel=!0,i.note){let P={labelStyle:"",shape:we,label:i.note.text,labelType:"markdown",cssClasses:Pe,cssStyles:[],cssCompiledStyles:[],id:l+We+"-"+Z,domId:xt(l,Z,de),type:"node",isGroup:!1,padding:V.flowchart?.padding,look:b,position:i.note.position},z=l+zt,W={labelStyle:"",shape:Ie,label:i.note.text,cssClasses:m.cssClasses,cssStyles:[],id:l+zt,domId:xt(l,Z,ce),type:"group",isGroup:!0,padding:16,look:b,position:i.note.position};Z++,W.id=z,P.parentId=z,ht(a,W,k),ht(a,P,k),ht(a,M,k);let K=l,R=P.id;if(i.note.position==="left of")K=P.id,R=l;u.push({id:K+"-"+R,start:K,end:R,arrowhead:"none",arrowTypeEnd:"",style:Zt,labelStyle:"",classes:Fe,pattern:"dashed",arrowheadStyle:te,labelpos:ee,labelType:se,thickness:re,look:b})}else ht(a,M,k)}if(i.doc)r.trace("Adding nodes children "),Ue(i,i.doc,c,a,u,!f,b,k)},"dataFetcher"),He=e(()=>{At.clear(),Z=0,ue=0,ct.clear()},"reset"),ye=e((t,i=qt)=>{if(!t.doc)return i;let c=i;for(let a of t.doc)if(a.stmt==="dir")c=a.value;return c},"getDir"),ze=e(function(t,i){return i.db.getClasses()},"getClasses"),Ke=e(async function(t,i,c,a){r.info("REF0:"),r.info("Drawing state diagram (v2)",i);let{securityLevel:u,state:f,layout:b}=s();a.db.extract(a.db.getRootDocV2());let k=a.db.getData(),l=fe(i,u);if(k.type=a.type,k.layoutAlgorithm=ge(b),k.nodeSpacing=f?.nodeSpacing||50,k.rankSpacing=f?.rankSpacing||50,s().look==="neo")k.markers=["barbNeo"];else k.markers=["barb"];k.diagramId=i,await he(k,l);let x=8;try{(typeof a.db.getLinks==="function"?a.db.getLinks():new Map).forEach((V,j)=>{let F=typeof j==="string"?j:typeof j?.id==="string"?j.id:"",m=k.nodes.find((R)=>R.id===F);if(!F){r.warn("⚠️ Invalid or missing stateId from key:",JSON.stringify(j));return}let M=l.node()?.querySelectorAll("g.node, g.rough-node"),P;if(M?.forEach((R)=>{let st=R.textContent?.trim();if(R.id===m?.domId||st===F)P=R}),!P){r.warn("⚠️ Could not find node matching text:",F);return}let z=P.parentNode;if(!z){r.warn("⚠️ Node has no parent, cannot wrap:",F);return}let W=document.createElementNS("http://www.w3.org/2000/svg","a"),K=V.url.replace(/^"+|"+$/g,"");if(W.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",K),W.setAttribute("target","_blank"),V.tooltip){let R=V.tooltip.replace(/^"+|"+$/g,"");W.setAttribute("title",R),P.setAttribute("title",R)}z.replaceChild(W,P),W.appendChild(P),r.info("\uD83D\uDD17 Wrapped node in <a> tag for:",F,V.url)})}catch(Y){r.error("❌ Error injecting clickable links:",Y)}N.insertTitle(l,"statediagramTitleText",f?.titleTopMargin??25,a.db.getDiagramTitle()),oe(l,x,pt,f?.useMaxWidth??!0)},"draw"),Xe={getClasses:ze,draw:Ke,getDir:ye},G={START_NODE:"[*]",START_TYPE:"start",END_NODE:"[*]",END_TYPE:"end",COLOR_KEYWORD:"color",FILL_KEYWORD:"fill",BG_FILL:"bgFill",STYLECLASS_SEP:","},Xt=e(()=>new Map,"newClassesList"),Jt=e(()=>({relations:[],states:new Map,documents:{}}),"newDoc"),Ct=e((t)=>JSON.parse(JSON.stringify(t)),"clone"),Je=class{constructor(t){this.version=t,this.nodes=[],this.edges=[],this.rootDoc=[],this.classes=Xt(),this.documents={root:Jt()},this.currentDocument=this.documents.root,this.startEndCount=0,this.dividerCnt=0,this.links=new Map,this.funs=[],this.getAccTitle=E,this.setAccTitle=S,this.getAccDescription=A,this.setAccDescription=T,this.setDiagramTitle=I,this.getDiagramTitle=L,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{e(this,"StateDB")}static{this.relationType={AGGREGATION:0,EXTENSION:1,COMPOSITION:2,DEPENDENCY:3}}extract(t){this.clear(!0);for(let a of Array.isArray(t)?t:t.doc)switch(a.stmt){case ot:this.addState(a.id.trim(),a.type,a.doc,a.description,a.note);break;case Bt:this.addRelation(a.state1,a.state2,a.description);break;case ve:this.addStyleClass(a.id.trim(),a.classes);break;case De:this.handleStyleDef(a);break;case Ce:this.setCssClass(a.id.trim(),a.styleClass);break;case"click":this.addLink(a.id,a.url,a.tooltip);break}let i=this.getStates(),c=s();He(),dt(void 0,this.getRootDocV2(),i,this.nodes,this.edges,!0,c.look,this.classes);for(let a of this.nodes){if(!Array.isArray(a.label))continue;if(a.description=a.label.slice(1),a.isGroup&&a.description.length>0)throw Error(`Group nodes can only have label. Remove the additional description for node [${a.id}]`);a.label=a.label[0]}}handleStyleDef(t){let i=t.id.trim().split(","),c=t.styleClass.split(",");for(let a of i){let u=this.getState(a);if(!u){let f=a.trim();this.addState(f),u=this.getState(f)}if(u)u.styles=c.map((f)=>f.replace(/;/g,"")?.trim())}}setRootDoc(t){if(r.info("Setting root doc",t),this.rootDoc=t,this.version===1)this.extract(t);else this.extract(this.getRootDocV2())}docTranslator(t,i,c){if(i.stmt===Bt){this.docTranslator(t,i.state1,!0),this.docTranslator(t,i.state2,!1);return}if(i.stmt===ot)if(i.id===G.START_NODE)i.id=t.id+(c?"_start":"_end"),i.start=c;else i.id=i.id.trim();if(i.stmt!==nt&&i.stmt!==ot||!i.doc)return;let a=[],u=[];for(let f of i.doc)if(f.type===Qt){let b=Ct(f);b.doc=Ct(u),a.push(b),u=[]}else u.push(f);if(a.length>0&&u.length>0){let f={stmt:ot,id:zi(),type:"divider",doc:Ct(u)};a.push(Ct(f)),i.doc=a}i.doc.forEach((f)=>this.docTranslator(i,f,!0))}getRootDocV2(){return this.docTranslator({id:nt,stmt:nt},{id:nt,stmt:nt,doc:this.rootDoc},!0),{id:nt,doc:this.rootDoc}}addState(t,i=ut,c=void 0,a=void 0,u=void 0,f=void 0,b=void 0,k=void 0){let l=t?.trim();if(!this.currentDocument.states.has(l))r.info("Adding state ",l,a),this.currentDocument.states.set(l,{stmt:ot,id:l,descriptions:[],type:i,doc:c,note:u,classes:[],styles:[],textStyles:[]});else{let D=this.currentDocument.states.get(l);if(!D)throw Error(`State not found: ${l}`);if(!D.doc)D.doc=c;if(!D.type)D.type=i}if(a)r.info("Setting state description",l,a),(Array.isArray(a)?a:[a]).forEach((x)=>this.addDescription(l,x.trim()));if(u){let D=this.currentDocument.states.get(l);if(!D)throw Error(`State not found: ${l}`);D.note=u,D.note.text=y.sanitizeText(D.note.text,s())}if(f)r.info("Setting state classes",l,f),(Array.isArray(f)?f:[f]).forEach((x)=>this.setCssClass(l,x.trim()));if(b)r.info("Setting state styles",l,b),(Array.isArray(b)?b:[b]).forEach((x)=>this.setStyle(l,x.trim()));if(k)r.info("Setting state styles",l,b),(Array.isArray(k)?k:[k]).forEach((x)=>this.setTextStyle(l,x.trim()))}clear(t){if(this.nodes=[],this.edges=[],this.funs=[this.setupToolTips.bind(this)],this.documents={root:Jt()},this.currentDocument=this.documents.root,this.startEndCount=0,this.classes=Xt(),!t)this.links=new Map,C()}getState(t){return this.currentDocument.states.get(t)}getStates(){return this.currentDocument.states}logDocuments(){r.info("Documents = ",this.documents)}getRelations(){return this.currentDocument.relations}addLink(t,i,c){this.links.set(t,{url:i,tooltip:c}),r.warn("Adding link",t,i,c)}getLinks(){return this.links}startIdIfNeeded(t=""){if(t===G.START_NODE)return this.startEndCount++,`${G.START_TYPE}${this.startEndCount}`;return t}startTypeIfNeeded(t="",i=ut){return t===G.START_NODE?G.START_TYPE:i}endIdIfNeeded(t=""){if(t===G.END_NODE)return this.startEndCount++,`${G.END_TYPE}${this.startEndCount}`;return t}endTypeIfNeeded(t="",i=ut){return t===G.END_NODE?G.END_TYPE:i}addRelationObjs(t,i,c=""){let a=this.startIdIfNeeded(t.id.trim()),u=this.startTypeIfNeeded(t.id.trim(),t.type),f=this.startIdIfNeeded(i.id.trim()),b=this.startTypeIfNeeded(i.id.trim(),i.type);this.addState(a,u,t.doc,t.description,t.note,t.classes,t.styles,t.textStyles),this.addState(f,b,i.doc,i.description,i.note,i.classes,i.styles,i.textStyles),this.currentDocument.relations.push({id1:a,id2:f,relationTitle:y.sanitizeText(c,s())})}addRelation(t,i,c){if(typeof t==="object"&&typeof i==="object")this.addRelationObjs(t,i,c);else if(typeof t==="string"&&typeof i==="string"){let a=this.startIdIfNeeded(t.trim()),u=this.startTypeIfNeeded(t),f=this.endIdIfNeeded(i.trim()),b=this.endTypeIfNeeded(i);this.addState(a,u),this.addState(f,b),this.currentDocument.relations.push({id1:a,id2:f,relationTitle:c?y.sanitizeText(c,s()):void 0})}}addDescription(t,i){let c=this.currentDocument.states.get(t),a=i.startsWith(":")?i.replace(":","").trim():i;c?.descriptions?.push(y.sanitizeText(a,s()))}cleanupLabel(t){return t.startsWith(":")?t.slice(2).trim():t.trim()}getDividerId(){return this.dividerCnt++,`divider-id-${this.dividerCnt}`}addStyleClass(t,i=""){if(!this.classes.has(t))this.classes.set(t,{id:t,styles:[],textStyles:[]});let c=this.classes.get(t);if(i&&c)i.split(G.STYLECLASS_SEP).forEach((a)=>{let u=a.replace(/([^;]*);/,"$1").trim();if(RegExp(G.COLOR_KEYWORD).exec(a)){let b=u.replace(G.FILL_KEYWORD,G.BG_FILL).replace(G.COLOR_KEYWORD,G.FILL_KEYWORD);c.textStyles.push(b)}c.styles.push(u)})}getClasses(){return this.classes}setupToolTips(t){let i=Mt();p(t).select("svg").selectAll("g.node, g.rough-node").on("mouseover",(u)=>{let f=p(u.currentTarget),b=f.attr("title");if(b===null)return;let k=u.currentTarget?.getBoundingClientRect();i.transition().duration(200).style("opacity",".9"),i.style("left",window.scrollX+k.left+(k.right-k.left)/2+"px").style("top",window.scrollY+k.bottom+"px"),i.html(Le.sanitize(b)),f.classed("hover",!0)}).on("mouseout",(u)=>{i.transition().duration(500).style("opacity",0),p(u.currentTarget).classed("hover",!1)})}setCssClass(t,i){t.split(",").forEach((c)=>{let a=this.getState(c);if(!a){let u=c.trim();this.addState(u),a=this.getState(u)}a?.classes?.push(i)})}setStyle(t,i){this.getState(t)?.styles?.push(i)}setTextStyle(t,i){this.getState(t)?.textStyles?.push(i)}bindFunctions(t){this.funs.forEach((i)=>{i(t)})}getDirectionStatement(){return this.rootDoc.find((t)=>t.stmt===Ut)}getDirection(){return this.getDirectionStatement()?.value??_e}setDirection(t){let i=this.getDirectionStatement();if(i)i.value=t;else this.rootDoc.unshift({stmt:Ut,value:t})}trimColon(t){return t.startsWith(":")?t.slice(1).trim():t.trim()}getData(){let t=s();for(let i of this.nodes)if(i.wrappingWidth??=t.state?.wrappingWidth,!i.isGroup)i.minWidth??=t.state?.minNodeWidth;return{nodes:this.nodes,edges:this.edges,other:{},config:t,direction:ye(this.getRootDocV2())}}getConfig(){return s().state}},qe=e((t)=>{let{theme:i,bkgColorArray:c,borderColorArray:a}=t;if(!ae(i,a))return"";let u=ie(t.look),f=le(c),b="";for(let k=0;k<ft(a);k++){let l=a[k],D=f?`fill: ${c[k%c.length]};`:"",x=`[data-look="${u}"][data-color-id="color-${k}"]`;b+=`
7
+
8
+ /* The title strip: \`rect.outer\` spans the whole composite and \`rect.inner\` covers
9
+ the body, so what stays visible of \`outer\` is the band behind the label. */
10
+ ${x}.statediagram-cluster rect.outer {
11
+ stroke: ${l};
12
+ ${D}
13
+ }
14
+
15
+ ${x}.statediagram-cluster rect.inner {
16
+ stroke: ${l};
17
+ }
18
+
19
+ /* Concurrency regions. Siblings of one composite share a slot, so a divided composite
20
+ reads as one thing split into parts rather than as several composites. */
21
+ ${x}.statediagram-cluster rect.divider {
22
+ stroke: ${l};
23
+ ${D}
24
+ }
25
+
26
+ /* handDrawn draws the same container as roughjs shapes rather than plain rects, so it
27
+ needs its own rules. \`roundedWithTitle\` and \`divider\` name those groups \`outer\`,
28
+ \`inner\` and \`divider\` to match the classic branch, which is what lets these
29
+ discriminate -- a bare \`.statediagram-cluster path\` rule reached the body as well and
30
+ tinted the whole composite, losing \`compositeBackground\` and diverging from what
31
+ classic and neo do.
32
+
33
+ roughjs emits two paths per shape and marks them: the filled shape carries
34
+ \`stroke="none"\` and the sketched outline carries \`fill="none"\`. Splitting on that is
35
+ what keeps \`fill\` off the outline -- a rough outline is open squiggles, not a closed
36
+ region, so filling it produces smears -- and keeps \`stroke\` off the fill shape, which
37
+ would otherwise gain an edge it was drawn without. */
38
+ ${x}.statediagram-cluster .outer path[stroke='none'] {
39
+ ${D}
40
+ }
41
+
42
+ ${x}.statediagram-cluster .outer path[fill='none'] {
43
+ stroke: ${l};
44
+ }
45
+
46
+ /* No \`.inner\` rule on purpose. The body shape is left entirely alone under handDrawn,
47
+ where a rect's \`inner\` counterpart cannot be recoloured safely: roughjs draws a
48
+ hachure fill as *stroked* lines, so its fill paths carry \`fill="none"\` exactly like
49
+ the outline and no selector separates them. An \`.inner\` stroke rule therefore
50
+ repainted the hatching of every alt composite in the palette colour instead of
51
+ leaving it on \`altBackground\`. The container still reads as palette-coloured: the
52
+ \`outer\` shape spans the whole composite, so its outline already frames the body. */
53
+
54
+ /* Regions split the same way, which is why \`divider\` fills solid rather than taking
55
+ roughjs's default hachure -- see the note on that call. Hatched, both of its paths
56
+ carried \`fill="none"\` and these two rules degenerated: the tint matched nothing and
57
+ the border rule repainted the hatching. */
58
+ ${x}.statediagram-cluster .divider path[stroke='none'] {
59
+ ${D}
60
+ }
61
+
62
+ ${x}.statediagram-cluster .divider path[fill='none'] {
63
+ stroke: ${l};
64
+ }
65
+ `}return b},"genColor"),Qe=e((t)=>`
66
+ ${qe(t)}
67
+ defs [id$="-barbEnd"] {
68
+ fill: ${t.transitionColor};
69
+ stroke: ${t.transitionColor};
70
+ }
71
+ g.stateGroup text {
72
+ fill: ${t.nodeBorder};
73
+ stroke: none;
74
+ font-size: 10px;
75
+ }
76
+ g.stateGroup text {
77
+ fill: ${t.textColor};
78
+ stroke: none;
79
+ font-size: 10px;
80
+
81
+ }
82
+ g.stateGroup .state-title {
83
+ font-weight: bolder;
84
+ fill: ${t.stateLabelColor};
85
+ }
86
+
87
+ g.stateGroup rect {
88
+ fill: ${t.mainBkg};
89
+ stroke: ${t.nodeBorder};
90
+ }
91
+
92
+ g.stateGroup line {
93
+ stroke: ${t.lineColor};
94
+ stroke-width: ${t.strokeWidth||1};
95
+ }
96
+
97
+ .transition {
98
+ stroke: ${t.transitionColor};
99
+ stroke-width: ${t.strokeWidth||1};
100
+ fill: none;
101
+ }
102
+
103
+ .stateGroup .composit {
104
+ fill: ${t.background};
105
+ border-bottom: 1px
106
+ }
107
+
108
+ .stateGroup .alt-composit {
109
+ fill: #e0e0e0;
110
+ border-bottom: 1px
111
+ }
112
+
113
+ .state-note {
114
+ stroke: ${t.noteBorderColor};
115
+ fill: ${t.noteBkgColor};
116
+
117
+ text {
118
+ fill: ${t.noteTextColor};
119
+ stroke: none;
120
+ font-size: 10px;
121
+ }
122
+ }
123
+
124
+ .stateLabel .box {
125
+ stroke: none;
126
+ stroke-width: 0;
127
+ fill: ${t.mainBkg};
128
+ opacity: 0.5;
129
+ }
130
+
131
+ .edgeLabel .label rect {
132
+ fill: ${t.labelBackgroundColor};
133
+ opacity: 0.5;
134
+ }
135
+ .edgeLabel {
136
+ background-color: ${t.edgeLabelBackground};
137
+ p {
138
+ background-color: ${t.edgeLabelBackground};
139
+ }
140
+ rect {
141
+ opacity: 0.5;
142
+ background-color: ${t.edgeLabelBackground};
143
+ fill: ${t.edgeLabelBackground};
144
+ }
145
+ text-align: center;
146
+ }
147
+ .edgeLabel .label text {
148
+ fill: ${t.transitionLabelColor||t.tertiaryTextColor};
149
+ }
150
+ .label div .edgeLabel {
151
+ color: ${t.transitionLabelColor||t.tertiaryTextColor};
152
+ }
153
+
154
+ .stateLabel text {
155
+ fill: ${t.stateLabelColor};
156
+ font-size: 10px;
157
+ font-weight: bold;
158
+ }
159
+
160
+ .node circle.state-start {
161
+ fill: ${t.specialStateColor};
162
+ stroke: ${t.specialStateColor};
163
+ }
164
+
165
+ .node .fork-join {
166
+ fill: ${t.specialStateColor};
167
+ stroke: ${t.specialStateColor};
168
+ }
169
+
170
+ .node circle.state-end {
171
+ fill: ${t.innerEndBackground};
172
+ stroke: ${t.background};
173
+ stroke-width: 1.5
174
+ }
175
+ .end-state-inner {
176
+ fill: ${t.compositeBackground||t.background};
177
+ // stroke: ${t.background};
178
+ stroke-width: 1.5
179
+ }
180
+
181
+ .node rect {
182
+ fill: ${t.stateBkg||t.mainBkg};
183
+ stroke: ${t.stateBorder||t.nodeBorder};
184
+ stroke-width: ${t.strokeWidth||1}px;
185
+ }
186
+ .node polygon {
187
+ fill: ${t.mainBkg};
188
+ stroke: ${t.stateBorder||t.nodeBorder};;
189
+ stroke-width: ${t.strokeWidth||1}px;
190
+ }
191
+ [id$="-barbEnd"] {
192
+ fill: ${t.lineColor};
193
+ }
194
+
195
+ .statediagram-cluster rect {
196
+ fill: ${t.compositeTitleBackground};
197
+ stroke: ${t.stateBorder||t.nodeBorder};
198
+ stroke-width: ${t.strokeWidth||1}px;
199
+ }
200
+
201
+ .cluster-label, .nodeLabel {
202
+ color: ${t.stateLabelColor};
203
+ // line-height: 1;
204
+ }
205
+
206
+ .statediagram-cluster rect.outer {
207
+ rx: 5px;
208
+ ry: 5px;
209
+ }
210
+ .statediagram-state .divider {
211
+ stroke: ${t.stateBorder||t.nodeBorder};
212
+ }
213
+
214
+ .statediagram-state .title-state {
215
+ rx: 5px;
216
+ ry: 5px;
217
+ }
218
+ .statediagram-cluster.statediagram-cluster .inner {
219
+ fill: ${t.compositeBackground||t.background};
220
+ }
221
+ .statediagram-cluster.statediagram-cluster-alt .inner {
222
+ fill: ${t.altBackground?t.altBackground:"#efefef"};
223
+ }
224
+
225
+ .statediagram-cluster .inner {
226
+ rx:0;
227
+ ry:0;
228
+ }
229
+
230
+ .statediagram-state rect.basic {
231
+ rx: 5px;
232
+ ry: 5px;
233
+ }
234
+ .statediagram-state rect.divider {
235
+ stroke-dasharray: 10,10;
236
+ fill: ${t.altBackground?t.altBackground:"#efefef"};
237
+ }
238
+
239
+ .note-edge {
240
+ stroke-dasharray: 5;
241
+ }
242
+
243
+ .statediagram-note rect {
244
+ fill: ${t.noteBkgColor};
245
+ stroke: ${t.noteBorderColor};
246
+ stroke-width: 1px;
247
+ rx: 0;
248
+ ry: 0;
249
+ }
250
+ .statediagram-note rect {
251
+ fill: ${t.noteBkgColor};
252
+ stroke: ${t.noteBorderColor};
253
+ stroke-width: 1px;
254
+ rx: 0;
255
+ ry: 0;
256
+ }
257
+
258
+ .statediagram-note text {
259
+ fill: ${t.noteTextColor};
260
+ }
261
+
262
+ .statediagram-note .nodeLabel {
263
+ color: ${t.noteTextColor};
264
+ }
265
+ .statediagram .edgeLabel {
266
+ color: red; // ${t.noteTextColor};
267
+ }
268
+
269
+ [id$="-dependencyStart"], [id$="-dependencyEnd"] {
270
+ fill: ${t.lineColor};
271
+ stroke: ${t.lineColor};
272
+ stroke-width: ${t.strokeWidth||1};
273
+ }
274
+
275
+ .statediagramTitleText {
276
+ text-anchor: middle;
277
+ font-size: 18px;
278
+ fill: ${t.textColor};
279
+ }
280
+
281
+ [data-look="neo"].statediagram-cluster rect {
282
+ fill: ${t.mainBkg};
283
+ stroke: ${t.useGradient?"url("+t.svgId+"-gradient)":t.stateBorder||t.nodeBorder};
284
+ stroke-width: ${t.strokeWidth??1};
285
+ }
286
+ [data-look="neo"].statediagram-cluster rect.outer {
287
+ rx: ${t.radius}px;
288
+ ry: ${t.radius}px;
289
+ filter: ${t.dropShadow?t.dropShadow.replace("url(#drop-shadow)",`url(${t.svgId}-drop-shadow)`):"none"}
290
+ }
291
+ `,"getStyles"),Ze=Qe,ks={parser:Ee,get db(){return new Je(2)},renderer:Xe,styles:Ze,init:e((t)=>{if(!t.state)t.state={};t.state.arrowMarkerAbsolute=t.arrowMarkerAbsolute},"init")};export{ks as diagram};
@@ -0,0 +1,78 @@
1
+ import{W}from"./chunk-b1pe46zz.js";import{e,r,we,b,B,C,S,E,T,A,I,L,s,q,U}from"./chunk-y0m8hrwz.js";import{X}from"./chunk-taynqrgq.js";var ot=e((a,d)=>{let n=a<=1?a*100:a;if(n<0||n>100)throw Error(`${d} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${a}`);return n},"toPercent"),V=e((a,d,n)=>({x:ot(d,`${n} evolution`),y:ot(a,`${n} visibility`)}),"toCoordinates"),pt=e((a)=>{if(!a)return;if(a==="+<>")return"bidirectional";if(a==="+<")return"backward";if(a==="+>")return"forward";return},"getFlowFromPort"),Bt=e((a)=>{if(!a?.startsWith("+"))return{};let n=/^\+'([^']*)'/.exec(a)?.[1];if(a.includes("<>"))return{flow:"bidirectional",label:n};if(a.includes("<"))return{flow:"backward",label:n};if(a.includes(">"))return{flow:"forward",label:n};return{label:n}},"extractFlowFromArrow"),Ft=e((a,d)=>{if(W(a,d),a.size)d.setSize(a.size.width,a.size.height);if(a.evolution){let n=a.evolution.stages.map((o)=>{if(o.secondName)return`${o.name.trim()} / ${o.secondName.trim()}`;return o.name.trim()}),y=a.evolution.stages.filter((o)=>o.boundary!==void 0).map((o)=>o.boundary);d.updateAxes({stages:n,stageBoundaries:y})}if(a.anchors.forEach((n)=>{let y=V(n.visibility,n.evolution,`Anchor "${n.name}"`);d.addNode(n.name,n.name,y.x,y.y,"anchor")}),a.components.forEach((n)=>{let y=V(n.visibility,n.evolution,`Component "${n.name}"`),o=n.label?(n.label.negX?-1:1)*n.label.offsetX:void 0,p=n.label?(n.label.negY?-1:1)*n.label.offsetY:void 0,k=n.decorator?.strategy;d.addNode(n.name,n.name,y.x,y.y,"component",o,p,n.inertia,k)}),a.notes.forEach((n)=>{let y=V(n.visibility,n.evolution,`Note "${n.text}"`);d.addNote(n.text,y.x,y.y)}),a.pipelines.forEach((n)=>{let y=d.getNode(n.parent);if(!y||typeof y.y!=="number")throw Error(`Pipeline "${n.parent}" must reference an existing component with coordinates.`);let o=y.y;d.startPipeline(n.parent),n.components.forEach((p)=>{let k=`${n.parent}_${p.name}`,Y=p.label?(p.label.negX?-1:1)*p.label.offsetX:void 0,w=p.label?(p.label.negY?-1:1)*p.label.offsetY:void 0,tt=ot(p.evolution,`Pipeline component "${p.name}" evolution`);d.addNode(k,p.name,tt,o,"pipeline-component",Y,w),d.addPipelineComponent(n.parent,k)})}),a.links.forEach((n)=>{let y=!!n.arrow&&(n.arrow.includes("-.->")||n.arrow.includes(".-.")),o=pt(n.fromPort)??pt(n.toPort),{flow:p,label:k}=Bt(n.arrow);if(!o&&p)o=p;let Y=n.linkLabel,w=k??Y;d.addLink(d.resolveNodeId(n.from),d.resolveNodeId(n.to),y,w,o)}),a.evolves.forEach((n)=>{let y=d.getNode(n.component);if(y?.y!==void 0){let o=ot(n.target,`Evolve target for "${n.component}"`);d.addTrend(n.component,o,y.y)}}),a.annotations.length>0){let n=a.annotations[0],y=V(n.x,n.y,"Annotations box");d.setAnnotationsBox(y.x,y.y)}a.annotation.forEach((n)=>{let y=V(n.x,n.y,`Annotation ${n.number}`);d.addAnnotation(n.number,[{x:y.x,y:y.y}],n.text)}),a.accelerators.forEach((n)=>{let y=V(n.x,n.y,`Accelerator "${n.name}"`);d.addAccelerator(n.name,y.x,y.y)}),a.deaccelerators.forEach((n)=>{let y=V(n.x,n.y,`Deaccelerator "${n.name}"`);d.addDeaccelerator(n.name,y.x,y.y)})},"populateDb"),ht={parser:{yy:void 0},parse:e(async(a)=>{let d=await X("wardley",a);r.debug(d);let n=ht.parser?.yy;if(!n||typeof n.addNode!=="function")throw Error("parser.parser?.yy was not a WardleyDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Ft(d,n)},"parse")},Rt=class{constructor(){this.nodes=new Map,this.links=[],this.trends=new Map,this.pipelines=new Map,this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.axes={}}static{e(this,"WardleyBuilder")}addNode(a){let d=this.nodes.get(a.id)??{id:a.id,label:a.label},n={...d,...a,className:a.className??d.className,labelOffsetX:a.labelOffsetX??d.labelOffsetX,labelOffsetY:a.labelOffsetY??d.labelOffsetY};this.nodes.set(a.id,n)}addLink(a){this.links.push(a)}addTrend(a){this.trends.set(a.nodeId,a)}startPipeline(a){this.pipelines.set(a,{nodeId:a,componentIds:[]});let d=this.nodes.get(a);if(d)d.isPipelineParent=!0}addPipelineComponent(a,d){let n=this.pipelines.get(a);if(n)n.componentIds.push(d);let y=this.nodes.get(d);if(y)y.inPipeline=!0}addAnnotation(a){this.annotations.push(a)}addNote(a){this.notes.push(a)}addAccelerator(a){this.accelerators.push(a)}addDeaccelerator(a){this.deaccelerators.push(a)}setAnnotationsBox(a,d){this.annotationsBox={x:a,y:d}}setAxes(a){this.axes={...this.axes,...a}}setSize(a,d){this.size={width:a,height:d}}getNode(a){return this.nodes.get(a)}resolveNodeId(a){if(this.nodes.has(a))return a;for(let[d,n]of this.nodes)if(n.label===a)return d;return a}build(){let a=[];for(let d of this.nodes.values()){if(typeof d.x!=="number"||typeof d.y!=="number")throw Error(`Node "${d.label}" is missing coordinates`);a.push(d)}return{nodes:a,links:[...this.links],trends:[...this.trends.values()],pipelines:[...this.pipelines.values()],annotations:[...this.annotations],notes:[...this.notes],accelerators:[...this.accelerators],deaccelerators:[...this.deaccelerators],annotationsBox:this.annotationsBox,axes:{...this.axes},size:this.size}}clear(){this.nodes.clear(),this.links=[],this.trends.clear(),this.pipelines.clear(),this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.annotationsBox=void 0,this.axes={},this.size=void 0}},P=new Rt;function ft(){return s()["wardley-beta"]}e(ft,"getConfig");function xt(a,d,n,y,o,p,k,Y,w){P.addNode({id:a,label:d,x:n,y,className:o,labelOffsetX:p,labelOffsetY:k,inertia:Y,sourceStrategy:w})}e(xt,"addNode");function gt(a,d,n=!1,y,o){P.addLink({source:a,target:d,dashed:n,label:y,flow:o})}e(gt,"addLink");function yt(a,d,n){P.addTrend({nodeId:a,targetX:d,targetY:n})}e(yt,"addTrend");function ut(a,d,n){P.addAnnotation({number:a,coordinates:d,text:n})}e(ut,"addAnnotation");function wt(a,d,n){P.addNote({text:a,x:d,y:n})}e(wt,"addNote");function mt(a,d,n){P.addAccelerator({name:a,x:d,y:n})}e(mt,"addAccelerator");function kt(a,d,n){P.addDeaccelerator({name:a,x:d,y:n})}e(kt,"addDeaccelerator");function bt(a,d){P.setAnnotationsBox(a,d)}e(bt,"setAnnotationsBox");function $t(a,d){P.setSize(a,d)}e($t,"setSize");function vt(a){P.startPipeline(a)}e(vt,"startPipeline");function Pt(a,d){P.addPipelineComponent(a,d)}e(Pt,"addPipelineComponent");function Ct(a){P.setAxes(a)}e(Ct,"updateAxes");function St(a){return P.getNode(a)}e(St,"getNode");function Mt(a){return P.resolveNodeId(a)}e(Mt,"resolveNodeId");function Nt(){return P.build()}e(Nt,"getWardleyData");function zt(){P.clear(),C()}e(zt,"clear");var Ot={getConfig:ft,addNode:xt,addLink:gt,addTrend:yt,addAnnotation:ut,addNote:wt,addAccelerator:mt,addDeaccelerator:kt,setAnnotationsBox:bt,setSize:$t,startPipeline:vt,addPipelineComponent:Pt,updateAxes:Ct,getNode:St,resolveNodeId:Mt,getWardleyData:Nt,clear:zt,setAccTitle:S,getAccTitle:E,setDiagramTitle:I,getDiagramTitle:L,getAccDescription:A,setAccDescription:T},Dt=["Genesis","Custom Built","Product","Commodity"],Gt=e(()=>{let{themeVariables:a}=s();return{backgroundColor:a.wardley?.backgroundColor??a.background??"#fff",axisColor:a.wardley?.axisColor??"#000",axisTextColor:a.wardley?.axisTextColor??a.primaryTextColor??"#222",gridColor:a.wardley?.gridColor??"rgba(100, 100, 100, 0.2)",componentFill:a.wardley?.componentFill??"#fff",componentStroke:a.wardley?.componentStroke??"#000",componentLabelColor:a.wardley?.componentLabelColor??a.primaryTextColor??"#222",linkStroke:a.wardley?.linkStroke??"#000",evolutionStroke:a.wardley?.evolutionStroke??"#dc3545",annotationStroke:a.wardley?.annotationStroke??"#000",annotationTextColor:a.wardley?.annotationTextColor??a.primaryTextColor??"#222",annotationFill:a.wardley?.annotationFill??a.background??"#fff"}},"getTheme"),qt=e(()=>{let a=s()["wardley-beta"];return{width:a?.width??900,height:a?.height??600,padding:a?.padding??48,nodeRadius:a?.nodeRadius??6,nodeLabelOffset:a?.nodeLabelOffset??8,axisFontSize:a?.axisFontSize??12,labelFontSize:a?.labelFontSize??10,showGrid:a?.showGrid??!1,useMaxWidth:a?.useMaxWidth??!0}},"getConfigValues"),jt=e((a,d,n,y)=>{r.debug(`Rendering Wardley map
2
+ `+a);let o=qt(),p=Gt(),k=o.nodeRadius*1.6,Y=y.db,w=Y.getWardleyData(),tt=Y.getDiagramTitle(),F=w.size?.width??o.width,M=w.size?.height??o.height,Z=q(d);Z.selectAll("*").remove(),B(Z,M,F,o.useMaxWidth),Z.attr("viewBox",`0 0 ${F} ${M}`);let z=Z.append("g").attr("class","wardley-map"),nt=Z.append("defs");nt.append("marker").attr("id",`arrow-${d}`).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto-start-reverse").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("fill",p.evolutionStroke).attr("stroke","none"),nt.append("marker").attr("id",`link-arrow-end-${d}`).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("fill",p.linkStroke).attr("stroke","none"),nt.append("marker").attr("id",`link-arrow-start-${d}`).attr("viewBox","0 0 10 10").attr("refX",1).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 10 0 L 0 5 L 10 10 z").attr("fill",p.linkStroke).attr("stroke","none"),z.append("rect").attr("class","wardley-background").attr("width",F).attr("height",M).attr("fill",p.backgroundColor);let J=F-o.padding*2,K=M-o.padding*2;if(tt)z.append("text").attr("class","wardley-title").attr("x",F/2).attr("y",o.padding/2).attr("fill",p.axisTextColor).attr("font-size",o.axisFontSize*1.05).attr("font-weight","bold").attr("text-anchor","middle").attr("dominant-baseline","middle").text(tt);let D=e((t)=>o.padding+t/100*J,"projectX"),G=e((t)=>M-o.padding-t/100*K,"projectY"),et=z.append("g").attr("class","wardley-axes");et.append("line").attr("x1",o.padding).attr("x2",F-o.padding).attr("y1",M-o.padding).attr("y2",M-o.padding).attr("stroke",p.axisColor).attr("stroke-width",1),et.append("line").attr("x1",o.padding).attr("x2",o.padding).attr("y1",o.padding).attr("y2",M-o.padding).attr("stroke",p.axisColor).attr("stroke-width",1);let Lt=w.axes.xLabel??"Evolution",Tt=w.axes.yLabel??"Visibility";et.append("text").attr("class","wardley-axis-label wardley-axis-label-x").attr("x",o.padding+J/2).attr("y",M-o.padding/4).attr("fill",p.axisTextColor).attr("font-size",o.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").text(Lt),et.append("text").attr("class","wardley-axis-label wardley-axis-label-y").attr("x",o.padding/3).attr("y",o.padding+K/2).attr("fill",p.axisTextColor).attr("font-size",o.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").attr("transform",`rotate(-90 ${o.padding/3} ${o.padding+K/2})`).text(Tt);let Q=w.axes.stages&&w.axes.stages.length>0?w.axes.stages:Dt;if(Q.length>0){let t=z.append("g").attr("class","wardley-stages"),l=w.axes.stageBoundaries,i=[];if(l&&l.length===Q.length){let c=0;l.forEach((f)=>{i.push({start:c,end:f}),c=f})}else{let c=1/Q.length;Q.forEach((f,x)=>{i.push({start:x*c,end:(x+1)*c})})}Q.forEach((c,f)=>{let x=i[f],u=o.padding+x.start*J,g=o.padding+x.end*J,m=(u+g)/2;if(f>0)t.append("line").attr("x1",u).attr("x2",u).attr("y1",o.padding).attr("y2",M-o.padding).attr("stroke","#000").attr("stroke-width",1).attr("stroke-dasharray","5 5").attr("opacity",0.8);t.append("text").attr("class","wardley-stage-label").attr("x",m).attr("y",M-o.padding/1.5).attr("fill",p.axisTextColor).attr("font-size",o.axisFontSize-2).attr("text-anchor","middle").text(c)})}if(o.showGrid){let t=z.append("g").attr("class","wardley-grid");for(let l=1;l<4;l++){let i=l/4,c=o.padding+J*i;t.append("line").attr("x1",c).attr("x2",c).attr("y1",o.padding).attr("y2",M-o.padding).attr("stroke",p.gridColor).attr("stroke-dasharray","2 6"),t.append("line").attr("x1",o.padding).attr("x2",F-o.padding).attr("y1",M-o.padding-K*i).attr("y2",M-o.padding-K*i).attr("stroke",p.gridColor).attr("stroke-dasharray","2 6")}}let h=new Map;if(w.nodes.forEach((t)=>{h.set(t.id,{x:D(t.x),y:G(t.y),node:t})}),w.pipelines.length>0){let t=z.append("g").attr("class","wardley-pipelines"),l=z.append("g").attr("class","wardley-pipeline-links");w.pipelines.forEach((i)=>{if(i.componentIds.length===0)return;let c=i.componentIds.map((g)=>({id:g,pos:h.get(g),node:w.nodes.find((m)=>m.id===g)})).filter((g)=>g.pos&&g.node).sort((g,m)=>g.node.x-m.node.x);for(let g=0;g<c.length-1;g++){let m=c[g],v=c[g+1];l.append("line").attr("class","wardley-pipeline-evolution-link").attr("x1",m.pos.x).attr("y1",m.pos.y).attr("x2",v.pos.x).attr("y2",v.pos.y).attr("stroke",p.linkStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4")}let f=1/0,x=-1/0,u=0;if(i.componentIds.forEach((g)=>{let m=h.get(g);if(m)f=Math.min(f,m.x),x=Math.max(x,m.x),u=m.y}),f!==1/0&&x!==-1/0){let m=o.nodeRadius*4,v=u-m/2,H=h.get(i.nodeId);if(H){let O=(f+x)/2;H.x=O,H.y=v-k/6}t.append("rect").attr("class","wardley-pipeline-box").attr("x",f-15).attr("y",v).attr("width",x-f+30).attr("height",m).attr("fill","none").attr("stroke",p.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}})}let dt=z.append("g").attr("class","wardley-links"),lt=new Map;w.pipelines.forEach((t)=>{lt.set(t.nodeId,new Set(t.componentIds))});let ct=w.links.filter((t)=>{if(!h.has(t.source)||!h.has(t.target))return!1;if(lt.get(t.target)?.has(t.source))return!1;return!0});dt.selectAll("line").data(ct).enter().append("line").attr("class",(t)=>`wardley-link${t.dashed?" wardley-link--dashed":""}`).attr("x1",(t)=>{let l=h.get(t.source),i=h.get(t.target),f=w.nodes.find((m)=>m.id===t.source).isPipelineParent?k/Math.sqrt(2):o.nodeRadius,x=i.x-l.x,u=i.y-l.y,g=Math.sqrt(x*x+u*u);return l.x+x/g*f}).attr("y1",(t)=>{let l=h.get(t.source),i=h.get(t.target),f=w.nodes.find((m)=>m.id===t.source).isPipelineParent?k/Math.sqrt(2):o.nodeRadius,x=i.x-l.x,u=i.y-l.y,g=Math.sqrt(x*x+u*u);return l.y+u/g*f}).attr("x2",(t)=>{let l=h.get(t.source),i=h.get(t.target),f=w.nodes.find((m)=>m.id===t.target).isPipelineParent?k/Math.sqrt(2):o.nodeRadius,x=l.x-i.x,u=l.y-i.y,g=Math.sqrt(x*x+u*u);return i.x+x/g*f}).attr("y2",(t)=>{let l=h.get(t.source),i=h.get(t.target),f=w.nodes.find((m)=>m.id===t.target).isPipelineParent?k/Math.sqrt(2):o.nodeRadius,x=l.x-i.x,u=l.y-i.y,g=Math.sqrt(x*x+u*u);return i.y+u/g*f}).attr("stroke",p.linkStroke).attr("stroke-width",1).attr("stroke-dasharray",(t)=>t.dashed?"6 6":null).attr("marker-end",(t)=>{if(t.flow==="forward"||t.flow==="bidirectional")return`url(#link-arrow-end-${d})`;return null}).attr("marker-start",(t)=>{if(t.flow==="backward"||t.flow==="bidirectional")return`url(#link-arrow-start-${d})`;return null}),dt.selectAll("text").data(ct.filter((t)=>t.label)).enter().append("text").attr("class","wardley-link-label").attr("x",(t)=>{let l=h.get(t.source),i=h.get(t.target),c=(l.x+i.x)/2,f=i.y-l.y,x=i.x-l.x,u=Math.sqrt(x*x+f*f),g=8,m=f/u;return c+m*8}).attr("y",(t)=>{let l=h.get(t.source),i=h.get(t.target),c=(l.y+i.y)/2,f=i.x-l.x,x=i.y-l.y,u=Math.sqrt(f*f+x*x),g=8,m=-f/u;return c+m*8}).attr("fill",p.axisTextColor).attr("font-size",o.labelFontSize).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("transform",(t)=>{let l=h.get(t.source),i=h.get(t.target),c=(l.x+i.x)/2,f=(l.y+i.y)/2,x=i.x-l.x,u=i.y-l.y,g=Math.sqrt(x*x+u*u),m=8,v=u/g,H=-x/g,O=c+v*8,at=f+H*8,_=Math.atan2(u,x)*180/Math.PI;if(_>90||_<-90)_+=180;return`rotate(${_} ${O} ${at})`}).text((t)=>t.label);let Wt=z.append("g").attr("class","wardley-trends"),At=w.trends.map((t)=>{let l=h.get(t.nodeId);if(!l)return null;let i=D(t.targetX),c=G(t.targetY),f=i-l.x,x=c-l.y,u=Math.sqrt(f*f+x*x),g=o.nodeRadius+2,m=u>g?i-f/u*g:i,v=u>g?c-x/u*g:c;return{origin:l,targetX:i,targetY:c,adjustedX2:m,adjustedY2:v}}).filter((t)=>t!==null);Wt.selectAll("line").data(At).enter().append("line").attr("class","wardley-trend").attr("x1",(t)=>t.origin.x).attr("y1",(t)=>t.origin.y).attr("x2",(t)=>t.adjustedX2).attr("y2",(t)=>t.adjustedY2).attr("stroke",p.evolutionStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4").attr("marker-end",`url(#arrow-${d})`);let R=z.append("g").attr("class","wardley-nodes").selectAll("g").data(w.nodes).enter().append("g").attr("class",(t)=>["wardley-node",t.className?`wardley-node--${t.className}`:""].filter(Boolean).join(" "));R.filter((t)=>t.sourceStrategy==="outsource").append("circle").attr("class","wardley-outsource-overlay").attr("cx",(t)=>h.get(t.id).x).attr("cy",(t)=>h.get(t.id).y).attr("r",o.nodeRadius*2).attr("fill","#666").attr("stroke",p.componentStroke).attr("stroke-width",1),R.filter((t)=>t.sourceStrategy==="buy").append("circle").attr("class","wardley-buy-overlay").attr("cx",(t)=>h.get(t.id).x).attr("cy",(t)=>h.get(t.id).y).attr("r",o.nodeRadius*2).attr("fill","#ccc").attr("stroke",p.componentStroke).attr("stroke-width",1),R.filter((t)=>t.sourceStrategy==="build").append("circle").attr("class","wardley-build-overlay").attr("cx",(t)=>h.get(t.id).x).attr("cy",(t)=>h.get(t.id).y).attr("r",o.nodeRadius*2).attr("fill","#eee").attr("stroke","#000").attr("stroke-width",1);let j=R.filter((t)=>t.sourceStrategy==="market");j.append("circle").attr("class","wardley-market-overlay").attr("cx",(t)=>h.get(t.id).x).attr("cy",(t)=>h.get(t.id).y).attr("r",o.nodeRadius*2).attr("fill","white").attr("stroke",p.componentStroke).attr("stroke-width",1),R.filter((t)=>!t.isPipelineParent&&t.sourceStrategy!=="market"&&t.className!=="anchor").append("circle").attr("cx",(t)=>h.get(t.id).x).attr("cy",(t)=>h.get(t.id).y).attr("r",o.nodeRadius).attr("fill",p.componentFill).attr("stroke",p.componentStroke).attr("stroke-width",1);let st=o.nodeRadius*0.7,N=o.nodeRadius*1.2;if(j.append("line").attr("class","wardley-market-line").attr("x1",(t)=>h.get(t.id).x).attr("y1",(t)=>h.get(t.id).y-N).attr("x2",(t)=>h.get(t.id).x-N*Math.cos(Math.PI/6)).attr("y2",(t)=>h.get(t.id).y+N*Math.sin(Math.PI/6)).attr("stroke",p.componentStroke).attr("stroke-width",1),j.append("line").attr("class","wardley-market-line").attr("x1",(t)=>h.get(t.id).x-N*Math.cos(Math.PI/6)).attr("y1",(t)=>h.get(t.id).y+N*Math.sin(Math.PI/6)).attr("x2",(t)=>h.get(t.id).x+N*Math.cos(Math.PI/6)).attr("y2",(t)=>h.get(t.id).y+N*Math.sin(Math.PI/6)).attr("stroke",p.componentStroke).attr("stroke-width",1),j.append("line").attr("class","wardley-market-line").attr("x1",(t)=>h.get(t.id).x+N*Math.cos(Math.PI/6)).attr("y1",(t)=>h.get(t.id).y+N*Math.sin(Math.PI/6)).attr("x2",(t)=>h.get(t.id).x).attr("y2",(t)=>h.get(t.id).y-N).attr("stroke",p.componentStroke).attr("stroke-width",1),j.append("circle").attr("class","wardley-market-dot").attr("cx",(t)=>h.get(t.id).x).attr("cy",(t)=>h.get(t.id).y-N).attr("r",st).attr("fill","white").attr("stroke",p.componentStroke).attr("stroke-width",2),j.append("circle").attr("class","wardley-market-dot").attr("cx",(t)=>h.get(t.id).x-N*Math.cos(Math.PI/6)).attr("cy",(t)=>h.get(t.id).y+N*Math.sin(Math.PI/6)).attr("r",st).attr("fill","white").attr("stroke",p.componentStroke).attr("stroke-width",2),j.append("circle").attr("class","wardley-market-dot").attr("cx",(t)=>h.get(t.id).x+N*Math.cos(Math.PI/6)).attr("cy",(t)=>h.get(t.id).y+N*Math.sin(Math.PI/6)).attr("r",st).attr("fill","white").attr("stroke",p.componentStroke).attr("stroke-width",2),R.filter((t)=>t.isPipelineParent===!0).append("rect").attr("x",(t)=>h.get(t.id).x-k/2).attr("y",(t)=>h.get(t.id).y-k/2).attr("width",k).attr("height",k).attr("fill",p.componentFill).attr("stroke",p.componentStroke).attr("stroke-width",1),R.filter((t)=>t.inertia===!0).append("line").attr("class","wardley-inertia").attr("x1",(t)=>{let l=h.get(t.id),i=t.isPipelineParent?k/2+15:o.nodeRadius+15;if(t.sourceStrategy)i+=o.nodeRadius+10;return l.x+i}).attr("y1",(t)=>{let l=h.get(t.id),i=t.isPipelineParent?k:o.nodeRadius*2;return l.y-i/2}).attr("x2",(t)=>{let l=h.get(t.id),i=t.isPipelineParent?k/2+15:o.nodeRadius+15;if(t.sourceStrategy)i+=o.nodeRadius+10;return l.x+i}).attr("y2",(t)=>{let l=h.get(t.id),i=t.isPipelineParent?k:o.nodeRadius*2;return l.y+i/2}).attr("stroke",p.componentStroke).attr("stroke-width",6),R.append("text").attr("x",(t)=>{let l=h.get(t.id);if(t.className==="anchor")return t.labelOffsetX!==void 0?l.x+t.labelOffsetX:l.x;let i=o.nodeLabelOffset;if(t.sourceStrategy&&t.labelOffsetX===void 0)i+=10;let c=t.labelOffsetX??i;return l.x+c}).attr("y",(t)=>{let l=h.get(t.id);if(t.className==="anchor")return t.labelOffsetY!==void 0?l.y+t.labelOffsetY:l.y-3;let i=-o.nodeLabelOffset;if(t.sourceStrategy&&t.labelOffsetY===void 0)i-=10;let c=t.labelOffsetY??i;return l.y+c}).attr("class","wardley-node-label").attr("fill",(t)=>{if(t.className==="evolved")return p.evolutionStroke;if(t.className==="anchor")return"#000";return p.componentLabelColor}).attr("font-size",o.labelFontSize).attr("font-weight",(t)=>t.className==="anchor"?"bold":"normal").attr("text-anchor",(t)=>t.className==="anchor"?"middle":"start").attr("dominant-baseline",(t)=>t.className==="anchor"?"middle":"auto").text((t)=>t.label),w.annotations.length>0){let t=z.append("g").attr("class","wardley-annotations");if(w.annotations.forEach((l)=>{let i=l.coordinates.map((c)=>({x:D(c.x),y:G(c.y)}));if(i.length>1)for(let c=0;c<i.length-1;c++)t.append("line").attr("class","wardley-annotation-line").attr("x1",i[c].x).attr("y1",i[c].y).attr("x2",i[c+1].x).attr("y2",i[c+1].y).attr("stroke",p.axisColor).attr("stroke-width",1.5).attr("stroke-dasharray","4 4");i.forEach((c)=>{let f=t.append("g").attr("class","wardley-annotation");f.append("circle").attr("cx",c.x).attr("cy",c.y).attr("r",10).attr("fill","white").attr("stroke",p.axisColor).attr("stroke-width",1.5),f.append("text").attr("x",c.x).attr("y",c.y).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",10).attr("fill",p.axisTextColor).attr("font-weight","bold").text(l.number)})}),w.annotationsBox){let l=D(w.annotationsBox.x),i=G(w.annotationsBox.y),c=10,f=16,x=11,u=t.append("g").attr("class","wardley-annotations-box"),g=[...w.annotations].filter((v)=>v.text).sort((v,H)=>v.number-H.number),m=[];if(g.forEach((v,H)=>{let O=u.append("text").attr("x",l+c).attr("y",i+c+(H+1)*f).attr("font-size",x).attr("fill",p.axisTextColor).attr("text-anchor","start").attr("dominant-baseline","middle").text(`${v.number}. ${v.text}`);m.push(O)}),m.length>0){let v=0,H=0;m.forEach((it)=>{let rt=it.node(),Yt=rt.getComputedTextLength();v=Math.max(v,Yt);let It=rt.getBBox();H=Math.max(H,It.height)});let O=v+c*2+105,at=g.length*f+c*2+H/2,_=o.padding,Xt=F-o.padding-O,Et=o.padding,Ht=M-o.padding-at;l=Math.max(_,Math.min(l,Xt)),i=Math.max(Et,Math.min(i,Ht)),m.forEach((it,rt)=>{it.attr("x",l+c).attr("y",i+c+(rt+1)*f)}),u.insert("rect","text").attr("x",l).attr("y",i).attr("width",O).attr("height",at).attr("fill","white").attr("stroke",p.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}}}if(w.notes.length>0){let t=z.append("g").attr("class","wardley-notes");w.notes.forEach((l)=>{let i=D(l.x),c=G(l.y);t.append("text").attr("x",i).attr("y",c).attr("text-anchor","start").attr("font-size",11).attr("fill",p.axisTextColor).attr("font-weight","bold").text(l.text)})}if(w.accelerators.length>0){let t=z.append("g").attr("class","wardley-accelerators");w.accelerators.forEach((l)=>{let i=D(l.x),c=G(l.y),f=60,x=30,u=20,g=`
3
+ M ${i} ${c-15}
4
+ L ${i+60-20} ${c-15}
5
+ L ${i+60-20} ${c-15-8}
6
+ L ${i+60} ${c}
7
+ L ${i+60-20} ${c+15+8}
8
+ L ${i+60-20} ${c+15}
9
+ L ${i} ${c+15}
10
+ Z
11
+ `;t.append("path").attr("d",g).attr("fill","white").attr("stroke",p.componentStroke).attr("stroke-width",1),t.append("text").attr("x",i+30).attr("y",c+15+15).attr("text-anchor","middle").attr("font-size",10).attr("fill",p.axisTextColor).attr("font-weight","bold").text(l.name)})}if(w.deaccelerators.length>0){let t=z.append("g").attr("class","wardley-deaccelerators");w.deaccelerators.forEach((l)=>{let i=D(l.x),c=G(l.y),f=60,x=30,u=20,g=`
12
+ M ${i+60} ${c-15}
13
+ L ${i+20} ${c-15}
14
+ L ${i+20} ${c-15-8}
15
+ L ${i} ${c}
16
+ L ${i+20} ${c+15+8}
17
+ L ${i+20} ${c+15}
18
+ L ${i+60} ${c+15}
19
+ Z
20
+ `;t.append("path").attr("d",g).attr("fill","white").attr("stroke",p.componentStroke).attr("stroke-width",1),t.append("text").attr("x",i+30).attr("y",c+15+15).attr("text-anchor","middle").attr("font-size",10).attr("fill",p.axisTextColor).attr("font-weight","bold").text(l.name)})}},"draw"),Vt={draw:jt},_t=e(({wardley:a}={})=>{let d=we(),n=b(),y=U(d,n.themeVariables),o=U(y.wardley,a);return`
21
+ .wardley-background {
22
+ fill: ${o.backgroundColor};
23
+ }
24
+ .wardley-axes line, .wardley-axes path {
25
+ stroke: ${o.axisColor};
26
+ }
27
+ .wardley-axis-label {
28
+ fill: ${o.axisTextColor};
29
+ }
30
+ .wardley-stage-label {
31
+ fill: ${o.axisTextColor};
32
+ }
33
+ .wardley-grid line {
34
+ stroke: ${o.gridColor};
35
+ }
36
+ .wardley-node circle {
37
+ fill: ${o.componentFill};
38
+ stroke: ${o.componentStroke};
39
+ }
40
+ .wardley-node-label {
41
+ fill: ${o.componentLabelColor};
42
+ }
43
+ .wardley-link {
44
+ stroke: ${o.linkStroke};
45
+ }
46
+ .wardley-link--dashed {
47
+ stroke-dasharray: 4 4;
48
+ }
49
+ .wardley-link-label {
50
+ fill: ${o.axisTextColor};
51
+ }
52
+ .wardley-trend line {
53
+ stroke: ${o.evolutionStroke};
54
+ }
55
+ .wardley-annotation-line {
56
+ stroke: ${o.annotationStroke};
57
+ }
58
+ .wardley-annotation circle {
59
+ fill: ${o.annotationFill};
60
+ stroke: ${o.annotationStroke};
61
+ }
62
+ .wardley-annotation text {
63
+ fill: ${o.annotationTextColor};
64
+ }
65
+ .wardley-annotations-box rect {
66
+ fill: ${o.annotationFill};
67
+ stroke: ${o.annotationStroke};
68
+ }
69
+ .wardley-annotations-box text {
70
+ fill: ${o.annotationTextColor};
71
+ }
72
+ .wardley-pipeline-box {
73
+ stroke: ${o.componentStroke};
74
+ }
75
+ .wardley-notes text {
76
+ fill: ${o.axisTextColor};
77
+ }
78
+ `},"styles"),re={parser:ht,db:Ot,renderer:Vt,styles:_t};export{re as diagram};