@bkm016/basalt 0.1.1 → 0.1.3

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 (196) hide show
  1. package/README.md +16 -22
  2. package/chunk-06hdzq5n.js +2 -0
  3. package/chunk-09rj27b2.js +2 -0
  4. package/{chunk-qnr1f5pj.js → chunk-0y7ne3d0.js} +2 -2
  5. package/{chunk-vgvq3q12.js → chunk-10xzzn07.js} +2 -2
  6. package/{chunk-6qertm2t.js → chunk-1qpces5a.js} +1 -1
  7. package/{chunk-nt2gntad.js → chunk-1zdwrgd4.js} +1 -1
  8. package/{chunk-sh74qzvt.js → chunk-27gntzs5.js} +4 -4
  9. package/{chunk-1v7st27a.js → chunk-2esbgxps.js} +14 -14
  10. package/{chunk-exnn1867.js → chunk-362g64pd.js} +1 -1
  11. package/{chunk-1aspj1hn.js → chunk-3cjsd292.js} +2 -2
  12. package/chunk-5c9j8qe4.js +478 -0
  13. package/{chunk-8dxzqwq3.js → chunk-5j1krv9v.js} +1 -1
  14. package/{chunk-vkkj4awb.js → chunk-6hssbcgj.js} +1 -1
  15. package/{chunk-1b7gbe8g.js → chunk-75m78j7x.js} +2 -2
  16. package/{chunk-kfq8wyd3.js → chunk-8296hw9m.js} +1 -1
  17. package/{chunk-szat3vp4.js → chunk-8d46jtbj.js} +2 -2
  18. package/{chunk-qczbfccb.js → chunk-8tjad3r0.js} +4 -4
  19. package/{chunk-agntrqs9.js → chunk-97rzj7f6.js} +1 -1
  20. package/{chunk-k7w7ac9q.js → chunk-981f9dw8.js} +8 -8
  21. package/{chunk-xysny0ve.js → chunk-aefadsy6.js} +2 -2
  22. package/{chunk-jhd54p1b.js → chunk-bannb9xm.js} +1 -1
  23. package/{chunk-0qqb6v41.js → chunk-bxn5kmpz.js} +120 -120
  24. package/{chunk-a3tqx584.js → chunk-c7x1zq39.js} +1 -1
  25. package/{chunk-rv06x0kn.js → chunk-cjc90f84.js} +1 -1
  26. package/{chunk-x3dnb9sz.js → chunk-d2j735sd.js} +2 -2
  27. package/{chunk-yskm0hsy.js → chunk-d8gtbw9g.js} +1 -1
  28. package/{chunk-rm3kcxq9.js → chunk-fjtvjrkg.js} +13 -13
  29. package/{chunk-h6sw8fbt.js → chunk-fm0k0qtz.js} +1 -1
  30. package/{chunk-1yzt0qm0.js → chunk-fw2bpqmw.js} +1 -1
  31. package/{chunk-45cz26ap.js → chunk-gp7y0fja.js} +13 -13
  32. package/{chunk-2bb01ddq.js → chunk-gzxnene8.js} +1 -1
  33. package/{chunk-a8nyk4k9.js → chunk-hwr56pfj.js} +1 -1
  34. package/{chunk-0hbjv3y6.js → chunk-jwdb0ccj.js} +3 -3
  35. package/{chunk-kf8hq21a.js → chunk-k23t7vhs.js} +5 -5
  36. package/{chunk-bhqyxyap.js → chunk-k506w58v.js} +1 -1
  37. package/{chunk-44ek81ad.js → chunk-k6w6y71k.js} +2 -2
  38. package/chunk-m40gxwq4.js +5 -0
  39. package/chunk-m8vkwdgr.js +5 -0
  40. package/{chunk-f7egr55n.js → chunk-mvfsxdx6.js} +13 -13
  41. package/{chunk-pvncysbb.js → chunk-nbb9trwz.js} +1 -1
  42. package/{chunk-0szjy61m.js → chunk-pbcy6zdt.js} +1 -1
  43. package/chunk-pmqtkqsf.js +2 -0
  44. package/{chunk-hat3s3pr.js → chunk-pxsrqrd0.js} +1 -1
  45. package/{chunk-xsbxykr4.js → chunk-qe0teyn1.js} +1 -1
  46. package/{chunk-2zqny2sy.js → chunk-r7fpkb49.js} +1 -1
  47. package/{chunk-3m7qwfm3.js → chunk-rtzqqngy.js} +3 -3
  48. package/{chunk-6e49xsf5.js → chunk-shadcb9z.js} +2 -2
  49. package/{chunk-cv5wsd9m.js → chunk-t6zs4kw0.js} +2 -2
  50. package/{chunk-hcn9cf6v.js → chunk-v258nxcz.js} +1 -1
  51. package/{chunk-a6r4z44b.js → chunk-vk1gxk1t.js} +1 -1
  52. package/{chunk-s37s3k24.js → chunk-x1xss1d7.js} +2 -2
  53. package/{chunk-dakrpbe6.js → chunk-x4874m8e.js} +2 -2
  54. package/{chunk-wx7kdf0b.js → chunk-xfvvh1s5.js} +1 -1
  55. package/{chunk-0yytz0r1.js → chunk-y0m980k3.js} +5 -5
  56. package/{chunk-dhm42y04.js → chunk-y58ygzn9.js} +3 -3
  57. package/{chunk-2wkaw73s.js → chunk-y648fzx0.js} +5 -5
  58. package/{chunk-32at88hc.js → chunk-y7nma9rk.js} +1 -1
  59. package/{chunk-pmc3y1z8.js → chunk-ykens1hy.js} +1 -1
  60. package/{chunk-q8zx3kt6.js → chunk-z55bmysw.js} +1 -1
  61. package/{chunk-qx0m82rw.js → chunk-zmsgwr3s.js} +1 -1
  62. package/{chunk-501zkf9b.js → chunk-ztsjgssj.js} +1 -1
  63. package/compiled.js +5 -5
  64. package/package.json +1 -1
  65. package/ui-test-worker.js +63 -63
  66. package/web/{chunk-b4wbk7vc.js → chunk-0xc2c540.js} +3 -3
  67. package/web/{chunk-dt462hk9.js → chunk-0z0jycs8.js} +1 -1
  68. package/web/chunk-166qe5j6.js +2 -0
  69. package/web/chunk-1c95wfvq.js +1 -0
  70. package/web/{chunk-qnaqf0cr.js → chunk-23c1df7e.js} +1 -1
  71. package/web/{chunk-jrcyc9s9.js → chunk-24h1rfje.js} +1 -1
  72. package/web/{chunk-fscafg24.js → chunk-2hd1pe9w.js} +5 -5
  73. package/web/chunk-329rtxa9.js +1 -0
  74. package/web/{chunk-9yakxvjb.js → chunk-33qwz9bc.js} +2 -2
  75. package/web/{chunk-qd8bxxdj.js → chunk-3qjnwsph.js} +1 -1
  76. package/web/{chunk-p3b9crsa.js → chunk-47q4hmfp.js} +2 -2
  77. package/web/{chunk-y49fhfda.js → chunk-4fzj0azw.js} +1 -1
  78. package/web/{chunk-22a4ety5.js → chunk-5b2nw6j1.js} +1 -1
  79. package/web/{chunk-bgnnrpna.js → chunk-5hmfk69r.js} +4 -4
  80. package/web/{chunk-tqmwd9qp.js → chunk-5qqw2e0t.js} +1 -1
  81. package/web/{chunk-3jhyzmnf.js → chunk-61jahh35.js} +3 -3
  82. package/web/chunk-6gxf3vsg.js +1 -0
  83. package/web/{chunk-qefasa1j.js → chunk-6parf7sy.js} +1 -1
  84. package/web/{chunk-2m12wyrb.js → chunk-7520nrbb.js} +1 -1
  85. package/web/{chunk-9p12mgs6.js → chunk-7ba8vrfc.js} +1 -1
  86. package/web/{chunk-fm2ybfj5.js → chunk-7qxhk1kz.js} +4 -4
  87. package/web/{chunk-w880psmw.js → chunk-7v5rxabp.js} +1 -1
  88. package/web/{chunk-kdyjnwdx.js → chunk-7xk0ntav.js} +2 -2
  89. package/web/{chunk-q0p5xqe1.js → chunk-7yc083xj.js} +4 -4
  90. package/web/{chunk-b1pe46zz.js → chunk-89fkdgbp.js} +1 -1
  91. package/web/{chunk-v28fx2nd.js → chunk-8qgpfxkz.js} +1 -1
  92. package/web/{chunk-2ps6mepk.js → chunk-90xqeczk.js} +3 -3
  93. package/web/{chunk-fz06t6km.js → chunk-97b62pvb.js} +1 -1
  94. package/web/{chunk-a1z5qx1r.js → chunk-9a3q0jsh.js} +3 -3
  95. package/web/{chunk-xjxv8dg8.js → chunk-9bgey148.js} +4 -4
  96. package/web/{chunk-70qwwwak.js → chunk-9xh96b33.js} +1 -1
  97. package/web/{chunk-e6jxqbv7.js → chunk-a5sg33w2.js} +1 -1
  98. package/web/chunk-a91vxtx4.js +1 -0
  99. package/web/{chunk-pf2ab8p8.js → chunk-acybsx44.js} +1 -1
  100. package/web/chunk-agec7jj4.js +1 -0
  101. package/web/{chunk-e53wfgb8.js → chunk-axkyft9f.js} +1 -1
  102. package/web/{chunk-bc78qf1m.js → chunk-b0a8nbj0.js} +5 -5
  103. package/web/chunk-c516cghj.js +1 -0
  104. package/web/chunk-cqp1d4p0.js +1 -0
  105. package/web/{chunk-05w4fyzc.js → chunk-cwtdnacf.js} +1 -1
  106. package/web/chunk-dg1vas6z.js +8 -0
  107. package/web/{chunk-0mrkjnte.js → chunk-ds7srg4p.js} +1 -1
  108. package/web/{chunk-bjkc94mv.js → chunk-ep37qp12.js} +1 -1
  109. package/web/{chunk-90kp4pnz.js → chunk-eqsd8zta.js} +1 -1
  110. package/web/{chunk-ss1bcb0n.js → chunk-es28k2t7.js} +2 -2
  111. package/web/chunk-fc0nx23g.js +1 -0
  112. package/web/chunk-fhnypcrm.js +1139 -0
  113. package/web/{chunk-2scce33n.js → chunk-fv60p68p.js} +1 -1
  114. package/web/{chunk-rpmpttbk.js → chunk-g46f421r.js} +1 -1
  115. package/web/{chunk-2msj52w6.js → chunk-h18tnrf2.js} +1 -1
  116. package/web/{chunk-a5x2zveg.js → chunk-h288yd5w.js} +1 -1
  117. package/web/{chunk-8p4tc9f4.js → chunk-hszjc2ny.js} +3 -3
  118. package/web/{chunk-4ks96e4r.js → chunk-j0bwwc1g.js} +1 -1
  119. package/web/{chunk-9dxjafp2.js → chunk-jqa39f8t.js} +2 -2
  120. package/web/chunk-jvbbrnpa.js +1 -0
  121. package/web/{chunk-wptv8atc.js → chunk-jzfd7cyh.js} +1 -1
  122. package/web/chunk-ka9ak8wr.js +1 -0
  123. package/web/{chunk-9an7cjd9.js → chunk-mb4qx9hy.js} +2 -2
  124. package/web/chunk-mnjd59jk.js +1 -0
  125. package/web/{chunk-xbty0rv7.js → chunk-mwj9tpkz.js} +1 -1
  126. package/web/{chunk-taynqrgq.js → chunk-n8gfjj9a.js} +2 -2
  127. package/web/{chunk-20q90epj.js → chunk-n8sky2q6.js} +1 -1
  128. package/web/chunk-ng0nbfhh.js +1 -0
  129. package/web/chunk-nz9nxk48.js +1 -0
  130. package/web/{chunk-0vt9fg48.js → chunk-p9hsd3rn.js} +2 -2
  131. package/web/chunk-phw908hn.js +1 -0
  132. package/web/chunk-pjmmma1k.js +1 -0
  133. package/web/chunk-q7yn4m3t.js +1 -0
  134. package/web/chunk-qh15dxav.css +1 -0
  135. package/web/chunk-qnhqexe0.js +1 -0
  136. package/web/{chunk-bj90t5gh.js → chunk-rcx1aee5.js} +4 -4
  137. package/web/chunk-rjqj6ffe.js +1 -0
  138. package/web/{chunk-g4azyef7.js → chunk-rks7ksv3.js} +1 -1
  139. package/web/{chunk-q5ke7a33.js → chunk-sb1cjpq8.js} +1 -1
  140. package/web/{chunk-e32y85kx.js → chunk-sgvp8vge.js} +1 -1
  141. package/web/chunk-sjjwte12.js +1 -0
  142. package/web/{chunk-xrxne80b.js → chunk-sn9ecfvy.js} +1 -1
  143. package/web/{chunk-z7dcbxws.js → chunk-t7bwsdbr.js} +1 -1
  144. package/web/{chunk-fk0dh93x.js → chunk-tse9gvyq.js} +5 -5
  145. package/web/{chunk-a3verqw9.js → chunk-tx8240k4.js} +5 -5
  146. package/web/{chunk-dzwxgqgm.js → chunk-vd6y2pcm.js} +2 -2
  147. package/web/{chunk-5vw9rs4r.js → chunk-vpa55vje.js} +3 -3
  148. package/web/{chunk-y0m8hrwz.js → chunk-vymqrpm3.js} +77 -77
  149. package/web/{chunk-tmvakq7n.js → chunk-w7snhcyg.js} +4 -4
  150. package/web/{chunk-qh7265qw.js → chunk-wdtnhpd6.js} +2 -2
  151. package/web/{chunk-3ee04tmm.js → chunk-wmvd6j0b.js} +5 -5
  152. package/web/{chunk-yd46jhqv.js → chunk-xnq41dgs.js} +1 -1
  153. package/web/{chunk-45fzdcgz.js → chunk-xvsmtetz.js} +5 -5
  154. package/web/{chunk-ca682sm6.js → chunk-y3ajqthy.js} +14 -14
  155. package/web/{chunk-f26smjjf.js → chunk-yd1ez3wd.js} +1 -1
  156. package/web/chunk-yfbxtg5p.js +1 -0
  157. package/web/{chunk-4v8en1yw.js → chunk-ywp4s71k.js} +1 -1
  158. package/web/{chunk-gqw3f02j.js → chunk-z4x331rx.js} +5 -5
  159. package/web/{chunk-jwzd9tzk.js → chunk-z6bpamwq.js} +2 -2
  160. package/web/{chunk-hev4hq89.js → chunk-zmdnxn6m.js} +2 -2
  161. package/web/{icon-yx2p2pye.svg → icon-1wgy7kzy.svg} +13 -13
  162. package/web/icon.svg +13 -13
  163. package/web/index.html +2 -2
  164. package/web/install.sh +0 -0
  165. package/web/sw.js +9 -0
  166. package/worker.js +1 -1
  167. package/chunk-09vr609h.js +0 -2
  168. package/chunk-58vz2qsq.js +0 -2
  169. package/chunk-c25s4w6a.js +0 -5
  170. package/chunk-t057xfrt.js +0 -5
  171. package/chunk-wjd9fr23.js +0 -2
  172. package/chunk-zef13k3h.js +0 -471
  173. package/web/chunk-2pver6r4.js +0 -1
  174. package/web/chunk-37ajk6zg.js +0 -2
  175. package/web/chunk-4wkm9fda.js +0 -1
  176. package/web/chunk-amzgyy1k.js +0 -1
  177. package/web/chunk-cff5hcm8.js +0 -8
  178. package/web/chunk-esp1mmgr.js +0 -1
  179. package/web/chunk-ew3cgdtd.js +0 -1
  180. package/web/chunk-gjq1pxw3.js +0 -1
  181. package/web/chunk-h5ejbf6e.js +0 -1
  182. package/web/chunk-jjh5jvva.js +0 -1
  183. package/web/chunk-k5btcvbg.js +0 -1
  184. package/web/chunk-kpvgecwy.js +0 -1
  185. package/web/chunk-kq40ss39.js +0 -1
  186. package/web/chunk-q7dsnvpf.js +0 -1
  187. package/web/chunk-rg426vkf.js +0 -1
  188. package/web/chunk-ry9256r7.js +0 -1
  189. package/web/chunk-scpwc9ev.js +0 -1
  190. package/web/chunk-ssy07dd2.js +0 -1
  191. package/web/chunk-tgpbhzn9.js +0 -1
  192. package/web/chunk-vt40e1kp.js +0 -1136
  193. package/web/chunk-w53rba6g.js +0 -1
  194. package/web/chunk-w86n42dy.js +0 -1
  195. package/web/chunk-wtawdeej.css +0 -1
  196. package/web/chunk-zde7mj43.js +0 -1
@@ -1,5 +1,5 @@
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=`
1
+ import{W}from"./chunk-89fkdgbp.js";import{e,r,we,b,B,C,S,E,T,A,I,L,s,V,U}from"./chunk-vymqrpm3.js";import{X}from"./chunk-n8gfjj9a.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"),j=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=j(n.visibility,n.evolution,`Anchor "${n.name}"`);d.addNode(n.name,n.name,y.x,y.y,"anchor")}),a.components.forEach((n)=>{let y=j(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=j(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=j(n.x,n.y,"Annotations box");d.setAnnotationsBox(y.x,y.y)}a.annotation.forEach((n)=>{let y=j(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=j(n.x,n.y,`Accelerator "${n.name}"`);d.addAccelerator(n.name,y.x,y.y)}),a.deaccelerators.forEach((n)=>{let y=j(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=V(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 q=R.filter((t)=>t.sourceStrategy==="market");q.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(q.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),q.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),q.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),q.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),q.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),q.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
3
  M ${i} ${c-15}
4
4
  L ${i+60-20} ${c-15}
5
5
  L ${i+60-20} ${c-15-8}
@@ -0,0 +1 @@
1
+ import{ar}from"./chunk-n8gfjj9a.js";export{ar as createRailroadEbnfServices};
@@ -1,2 +1,2 @@
1
- import{e,r,b,s,N,M,Ct,St,go,ht,Kt,yo,Wn,Me,vo,Vi,Tt,Gi,Qt,Yn}from"./chunk-y0m8hrwz.js";import{Q}from"./chunk-kdyjnwdx.js";import{x}from"./chunk-vt40e1kp.js";function sa(t,{edgePathsClass:i="edges edgePaths"}={}){let n=t.insert("g").attr("class","root"),a=n.insert("g").attr("class","clusters"),o=n.insert("g").attr("class",i),c=n.insert("g").attr("class","edgeLabels"),u=n.insert("g").attr("class","nodes");return{clusters:a,edgePaths:o,edgeLabels:c,nodes:u,rootGroups:n}}e(sa,"createLayoutElementGroups");async function S(t,i,n){if(i.label){let{shapeSvg:a,bbox:o}=await M(t,n===void 0?i:{...i,width:n});i.labelBBox={width:o.width,height:o.height},a.remove()}else i.labelBBox={width:0,height:0}}e(S,"measureGroupLabel");async function la(t,i,n){let a=await St(t,i,n),o=a.node()?.getBBox()??{width:0,height:0};return i.width=o.width,i.height=o.height,a}e(la,"insertMeasuredNode");function k(t,i,n){let a=t,o=new Set;while(a){if(a.dir)return a.dir;if(!a.parentId||o.has(a.parentId))break;o.add(a.parentId),a=i.get(a.parentId)}return n}e(k,"resolveNodeDir");async function R(t,i,n={}){let a=new Q({multigraph:!0,compound:!0}),o=[...i.edges],c=s(),u=sa(t),{edgeLabels:d,nodes:l}=u,g=new Map,h=new Map(i.nodes.map((f)=>[f.id,f])),C=i.direction,w=t.node()!=null;await Promise.all(i.nodes.map(async(f)=>{if(f.isGroup){if(w){let p=n.unwrapGroupLabels&&f.labelType!=="markdown";await S(l,f,p?Number.POSITIVE_INFINITY:void 0)}a.setNode(f.id,{...f})}else{if(w){let p=await la(l,f,{config:c,dir:k(f,h,C)});g.set(f.id,p)}a.setNode(f.id,{...f})}}));for(let f of o){if(w&&Vi(f))await Tt(d,f);if(a.setEdge(f.start,f.end,{...f},f.id),!i.edges.some((E)=>E.id===f.id))i.edges.push(f)}if(globalThis.mermaidCaptureSizes){let{captureNodeSizes:f}=await (x("22a4ety5"),import("./chunk-22a4ety5.js"));f(t,i)}return{graph:a,groups:u,nodeElements:g}}e(R,"createGraphWithElements");var G=new Map,m=new Map,T=new Map,Z=e(()=>{m.clear(),T.clear(),G.clear()},"clear"),v=e((t,i)=>{let n=m.get(i)||[];return r.trace("In isDescendant",i," ",t," = ",n.includes(t)),n.includes(t)},"isDescendant"),I=e((t,i)=>{let n=m.get(i)||[];if(r.info("Descendants of ",i," is ",n),r.info("Edge is ",t),t.v===i||t.w===i)return!1;if(!n)return r.debug("Tilt, ",i,",not in descendants"),!1;return n.includes(t.v)||v(t.v,i)||v(t.w,i)||n.includes(t.w)},"edgeInCluster"),P=e((t,i,n,a)=>{r.debug("Copying children of ",t,"root",a,"data",i.node(t),a);let o=i.children(t)||[];if(t!==a)o.push(t);r.debug("Copying (nodes) clusterId",t,"nodes",o),o.forEach((c)=>{if(i.children(c).length>0)P(c,i,n,a);else{let u=i.node(c);if(r.info("cp ",c," to ",a," with parent ",t),n.setNode(c,u),a!==i.parent(c))r.debug("Setting parent",c,i.parent(c)),n.setParent(c,i.parent(c));if(t!==a&&c!==t)r.debug("Setting parent",c,t),n.setParent(c,t);else r.info("In copy ",t,"root",a,"data",i.node(t),a),r.debug("Not Setting parent for node=",c,"cluster!==rootId",t!==a,"node!==clusterId",c!==t);let d=i.edges(c);r.debug("Copying Edges",d),d.forEach((l)=>{r.info("Edge",l);let g=i.edge(l.v,l.w,l.name);r.info("Edge data",g,a);try{if(I(l,a))r.info("Copying as ",l.v,l.w,g,l.name),n.setEdge(l.v,l.w,g,l.name),r.info("newGraph edges ",n.edges(),n.edge(n.edges()[0]));else r.info("Skipping copy of edge ",l.v,"-->",l.w," rootId: ",a," clusterId:",t)}catch(h){r.error(h)}})}r.debug("Removing node",c),i.removeNode(c)})},"copy"),B=e((t,i)=>{let n=i.children(t),a=[...n];for(let o of n)T.set(o,t),a=[...a,...B(o,i)];return a},"extractDescendants"),ee=e((t,i,n)=>{let a=t.edges().filter((l)=>l.v===i||l.w===i),o=t.edges().filter((l)=>l.v===n||l.w===n),c=a.map((l)=>({v:l.v===i?n:l.v,w:l.w===i?i:l.w})),u=o.map((l)=>({v:l.v,w:l.w}));return c.filter((l)=>u.some((g)=>l.v===g.v&&l.w===g.w))},"findCommonEdges"),$n=e((t,i,n)=>{let a=i.children(t);if(r.trace("Searching children of id ",t,a),a.length<1)return t;let o;for(let c of a){let u=$n(c,i,n),d=ee(i,n,u);if(u)if(d.length>0)o=u;else return u}return o},"findNonClusterChild"),D=e((t)=>{if(!G.has(t))return t;if(!G.get(t).externalConnections)return t;if(G.has(t))return G.get(t).id;return t},"getAnchorId"),eo=e((t,i)=>{if(!t||i>10){r.debug("Opting out, no graph ");return}else r.debug("Opting in, graph ");t.nodes().forEach(function(n){if(t.children(n).length>0)r.debug("Cluster identified",n," Replacement id in edges: ",$n(n,t,n)),m.set(n,B(n,t)),G.set(n,{id:$n(n,t,n),clusterData:t.node(n)})}),t.nodes().forEach(function(n){let a=t.children(n),o=t.edges();if(a.length>0)r.debug("Cluster identified",n,m),o.forEach((c)=>{let u=v(c.v,n),d=v(c.w,n);if(u^d)r.debug("Edge: ",c," leaves cluster ",n),r.debug("Descendants of XXX ",n,": ",m.get(n)),G.get(n).externalConnections=!0});else r.debug("Not a cluster ",n,m)});for(let n of G.keys()){let a=G.get(n).id,o=t.parent(a);if(o!==n&&G.has(o)&&!G.get(o).externalConnections)G.get(n).id=o;let c=t.edges().some((u)=>u.v===n);if(a&&G.get(n)?.externalConnections&&c&&_(t,a,n)){let u=te(t,n,t.parent(a));if(u)G.get(n).id=u}}t.edges().forEach(function(n){let a=t.edge(n);r.debug("Edge "+n.v+" -> "+n.w+": "+JSON.stringify(n)),r.debug("Edge "+n.v+" -> "+n.w+": "+JSON.stringify(t.edge(n)));let{v:o,w:c}=n;if(r.debug("Fix XXX",G,"ids:",n.v,n.w,"Translating: ",G.get(n.v)," --- ",G.get(n.w)),G.get(n.v)||G.get(n.w)){if(r.debug("Fixing and trying - removing XXX",n.v,n.w,n.name),o=D(n.v),c=D(n.w),t.removeEdge(n.v,n.w,n.name),o!==n.v){let u=t.parent(o);G.get(u).externalConnections=!0,a.fromCluster=n.v}if(c!==n.w){let u=t.parent(c);G.get(u).externalConnections=!0,a.toCluster=n.w}r.debug("Fix Replacing with XXX",o,c,n.name),t.setEdge(o,c,a,n.name)}}),A(t,0),r.trace(G)},"adjustClustersAndEdges"),A=e((t,i)=>{if(i>10){r.error("Bailing out");return}let n=t.nodes(),a=!1;for(let o of n){let c=t.children(o);a=a||c.length>0}if(!a){r.debug("Done, no node has children",t.nodes());return}r.debug("Nodes = ",n,i);for(let o of n)if(r.debug("Extracting node",o,G,G.has(o)&&!G.get(o).externalConnections,!t.parent(o),t.node(o),t.children("D")," Depth ",i),!G.has(o))r.debug("Not a cluster",o,i);else if(!G.get(o).externalConnections&&t.children(o)&&t.children(o).length>0){r.debug("Cluster without external connections, without a parent and with children",o,i);let u=t.graph().rankdir==="TB"?"LR":"TB";if(G.get(o)?.clusterData?.dir)u=G.get(o).clusterData.dir,r.debug("Fixing dir",G.get(o).clusterData.dir,u);let d=new Q({multigraph:!0,compound:!0}).setGraph({rankdir:u,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});P(o,t,d,o),t.setNode(o,{clusterNode:!0,id:o,clusterData:G.get(o).clusterData,label:G.get(o).label,graph:d})}else r.debug("Cluster ** ",o," **not meeting the criteria !externalConnections:",!G.get(o).externalConnections," no parent: ",!t.parent(o)," children ",t.children(o)&&t.children(o).length>0,t.children("D"),i),r.debug(G);n=t.nodes(),r.debug("New list of nodes",n);for(let o of n){let c=t.node(o);if(r.debug(" Now next level",o,c),c?.clusterNode)A(c.graph,i+1)}},"extractor"),X=e((t,i)=>{if(i.length===0)return[];let n=Object.assign([],i);return i.forEach((a)=>{let o=t.children(a),c=X(t,o);n=[...n,...c]}),n},"sorter"),ca=e((t)=>X(t,t.children()),"sortNodesByHierarchy"),_=e((t,i,n)=>{let a=t.parent(i);while(a&&a!==n){let o=G.get(a);if(o&&!o.externalConnections)return!0;a=t.parent(a)}return!1},"isNodeInExtractableCluster"),te=e((t,i,n)=>{let a=t.children(i)??[];for(let o of a){if(o===n||v(o,n))continue;let c=$n(o,t,i);if(!c)continue;if(!_(t,c,i))return c}return null},"findSafeAnchorNode");function lr({prepareLayout:t,measureLayout:i,runLayoutCore:n,paintLayout:a,afterPaint:o,paintOptions:c}){let u=i??F;return e(async function(l,g,h,C){let w=g.select("g");(h?.insertMarkers??Yn)(w,l.markers,l.type,l.diagramId),O();let f={element:w,helpers:h,options:C};f.preparedLayout=await t?.(l,f);let p=await u(l,f),E=await n(l,f),y={...f,measure:p};if(a)await a(l,y,E);else await j(l,y,c);await o?.(l,y,E)},"render")}e(lr,"createCommonLayoutRenderer");function O(){go(),vo(),yo(),Z()}e(O,"clearLayoutRenderState");async function F(t,{element:i},n){return await R(i,t,n)}e(F,"defaultMeasureLayout");async function j(t,i,n={}){let{measure:a}=i,{groups:o}=a;for(let u of n.getNodes?.(t,i)??t.nodes){if(n.skipNode?.(u,i))continue;await H(o,u,i,n)}let c=J(t.nodes);for(let u of t.edges){if(W(u,n))continue;await V(o,u,c,t,n,i)}}e(j,"paintLayoutData");async function H(t,i,n,a){if(i.clusterNode)ht(i);else if(z(i,n,a))await Kt(t.clusters,i);else ht(i)}e(H,"paintLayoutNode");function z(t,i,n){return t.isGroup===!0&&(n.isCluster?.(t,i)??!0)}e(z,"shouldPaintAsCluster");function J(t){let i=new Map;for(let n of t)if(n?.id)i.set(n.id,n);return i}e(J,"buildNodeLookup");function W(t,i){return t.isLayoutOnly||Boolean(i.skipEdge?.(t))}e(W,"shouldSkipPaintEdge");async function V(t,i,n,a,o,c){let u=Qt(t.edgePaths,{...i},o.clusterDb??new Map,a.type,L(i.start,i,n,c,o),L(i.end,i,n,c,o),a.diagramId,Y(i,o),a.layoutAlgorithm);if(Vi(i)){if(!Wn.has(i.id))await Tt(t.edgeLabels,i);q(i,u)}}e(V,"paintLayoutEdge");function L(t,i,n,a,o){return o.getEdgeNode?.(t,i,a)??(t?n.get(t)??{}:{})}e(L,"getRenderedNode");function Y(t,i){return typeof i.skipIntersect==="function"?i.skipIntersect(t):i.skipIntersect??!1}e(Y,"shouldSkipIntersect");function q(t,i){let n=i?.updatedPath??i?.originalPath,a=b(),{subGraphTitleTotalMargin:o}=Ct({flowchart:a.flowchart??{}});if(t.label){let c=Wn.get(t.id),{x:u,y:d}=Gi(t,i);c.attr("transform",`translate(${u}, ${d+o/2})`)}for(let[c,u]of[["startLeft",t.startLabelLeft],["startRight",t.startLabelRight],["endLeft",t.endLabelLeft],["endRight",t.endLabelRight]])if(u){let{x:d,y:l}=K(t,c,n);Me.get(t.id)[c].attr("transform",`translate(${d}, ${l})`)}}e(q,"positionRenderedEdgeLabel");var ne={startLeft:"start_left",startRight:"start_right",endLeft:"end_left",endRight:"end_right"};function K(t,i,n){let a=t.terminalLabelCenters?.[i];if(a)return{...a};if(!n)return{x:t.x,y:t.y};let o=i.startsWith("start")?t.arrowTypeStart:t.arrowTypeEnd;return N.calcTerminalLabelPosition(o?10:0,ne[i],n)}e(K,"terminalLabelTranslate");
1
+ import{e,r,b,s,N,M,Ct,St,go,ht,Qt,yo,Wn,Me,vo,Vi,Tt,Gi,Jt,Yn}from"./chunk-vymqrpm3.js";import{Q}from"./chunk-7xk0ntav.js";import{x}from"./chunk-fhnypcrm.js";function sa(t,{edgePathsClass:i="edges edgePaths"}={}){let n=t.insert("g").attr("class","root"),a=n.insert("g").attr("class","clusters"),o=n.insert("g").attr("class",i),c=n.insert("g").attr("class","edgeLabels"),u=n.insert("g").attr("class","nodes");return{clusters:a,edgePaths:o,edgeLabels:c,nodes:u,rootGroups:n}}e(sa,"createLayoutElementGroups");async function S(t,i,n){if(i.label){let{shapeSvg:a,bbox:o}=await M(t,n===void 0?i:{...i,width:n});i.labelBBox={width:o.width,height:o.height},a.remove()}else i.labelBBox={width:0,height:0}}e(S,"measureGroupLabel");async function la(t,i,n){let a=await St(t,i,n),o=a.node()?.getBBox()??{width:0,height:0};return i.width=o.width,i.height=o.height,a}e(la,"insertMeasuredNode");function k(t,i,n){let a=t,o=new Set;while(a){if(a.dir)return a.dir;if(!a.parentId||o.has(a.parentId))break;o.add(a.parentId),a=i.get(a.parentId)}return n}e(k,"resolveNodeDir");async function R(t,i,n={}){let a=new Q({multigraph:!0,compound:!0}),o=[...i.edges],c=s(),u=sa(t),{edgeLabels:d,nodes:l}=u,g=new Map,h=new Map(i.nodes.map((f)=>[f.id,f])),C=i.direction,w=t.node()!=null;await Promise.all(i.nodes.map(async(f)=>{if(f.isGroup){if(w){let p=n.unwrapGroupLabels&&f.labelType!=="markdown";await S(l,f,p?Number.POSITIVE_INFINITY:void 0)}a.setNode(f.id,{...f})}else{if(w){let p=await la(l,f,{config:c,dir:k(f,h,C)});g.set(f.id,p)}a.setNode(f.id,{...f})}}));for(let f of o){if(w&&Vi(f))await Tt(d,f);if(a.setEdge(f.start,f.end,{...f},f.id),!i.edges.some((E)=>E.id===f.id))i.edges.push(f)}if(globalThis.mermaidCaptureSizes){let{captureNodeSizes:f}=await (x("5b2nw6j1"),import("./chunk-5b2nw6j1.js"));f(t,i)}return{graph:a,groups:u,nodeElements:g}}e(R,"createGraphWithElements");var G=new Map,m=new Map,T=new Map,Z=e(()=>{m.clear(),T.clear(),G.clear()},"clear"),v=e((t,i)=>{let n=m.get(i)||[];return r.trace("In isDescendant",i," ",t," = ",n.includes(t)),n.includes(t)},"isDescendant"),I=e((t,i)=>{let n=m.get(i)||[];if(r.info("Descendants of ",i," is ",n),r.info("Edge is ",t),t.v===i||t.w===i)return!1;if(!n)return r.debug("Tilt, ",i,",not in descendants"),!1;return n.includes(t.v)||v(t.v,i)||v(t.w,i)||n.includes(t.w)},"edgeInCluster"),P=e((t,i,n,a)=>{r.debug("Copying children of ",t,"root",a,"data",i.node(t),a);let o=i.children(t)||[];if(t!==a)o.push(t);r.debug("Copying (nodes) clusterId",t,"nodes",o),o.forEach((c)=>{if(i.children(c).length>0)P(c,i,n,a);else{let u=i.node(c);if(r.info("cp ",c," to ",a," with parent ",t),n.setNode(c,u),a!==i.parent(c))r.debug("Setting parent",c,i.parent(c)),n.setParent(c,i.parent(c));if(t!==a&&c!==t)r.debug("Setting parent",c,t),n.setParent(c,t);else r.info("In copy ",t,"root",a,"data",i.node(t),a),r.debug("Not Setting parent for node=",c,"cluster!==rootId",t!==a,"node!==clusterId",c!==t);let d=i.edges(c);r.debug("Copying Edges",d),d.forEach((l)=>{r.info("Edge",l);let g=i.edge(l.v,l.w,l.name);r.info("Edge data",g,a);try{if(I(l,a))r.info("Copying as ",l.v,l.w,g,l.name),n.setEdge(l.v,l.w,g,l.name),r.info("newGraph edges ",n.edges(),n.edge(n.edges()[0]));else r.info("Skipping copy of edge ",l.v,"-->",l.w," rootId: ",a," clusterId:",t)}catch(h){r.error(h)}})}r.debug("Removing node",c),i.removeNode(c)})},"copy"),B=e((t,i)=>{let n=i.children(t),a=[...n];for(let o of n)T.set(o,t),a=[...a,...B(o,i)];return a},"extractDescendants"),ee=e((t,i,n)=>{let a=t.edges().filter((l)=>l.v===i||l.w===i),o=t.edges().filter((l)=>l.v===n||l.w===n),c=a.map((l)=>({v:l.v===i?n:l.v,w:l.w===i?i:l.w})),u=o.map((l)=>({v:l.v,w:l.w}));return c.filter((l)=>u.some((g)=>l.v===g.v&&l.w===g.w))},"findCommonEdges"),$n=e((t,i,n)=>{let a=i.children(t);if(r.trace("Searching children of id ",t,a),a.length<1)return t;let o;for(let c of a){let u=$n(c,i,n),d=ee(i,n,u);if(u)if(d.length>0)o=u;else return u}return o},"findNonClusterChild"),D=e((t)=>{if(!G.has(t))return t;if(!G.get(t).externalConnections)return t;if(G.has(t))return G.get(t).id;return t},"getAnchorId"),eo=e((t,i)=>{if(!t||i>10){r.debug("Opting out, no graph ");return}else r.debug("Opting in, graph ");t.nodes().forEach(function(n){if(t.children(n).length>0)r.debug("Cluster identified",n," Replacement id in edges: ",$n(n,t,n)),m.set(n,B(n,t)),G.set(n,{id:$n(n,t,n),clusterData:t.node(n)})}),t.nodes().forEach(function(n){let a=t.children(n),o=t.edges();if(a.length>0)r.debug("Cluster identified",n,m),o.forEach((c)=>{let u=v(c.v,n),d=v(c.w,n);if(u^d)r.debug("Edge: ",c," leaves cluster ",n),r.debug("Descendants of XXX ",n,": ",m.get(n)),G.get(n).externalConnections=!0});else r.debug("Not a cluster ",n,m)});for(let n of G.keys()){let a=G.get(n).id,o=t.parent(a);if(o!==n&&G.has(o)&&!G.get(o).externalConnections)G.get(n).id=o;let c=t.edges().some((u)=>u.v===n);if(a&&G.get(n)?.externalConnections&&c&&_(t,a,n)){let u=te(t,n,t.parent(a));if(u)G.get(n).id=u}}t.edges().forEach(function(n){let a=t.edge(n);r.debug("Edge "+n.v+" -> "+n.w+": "+JSON.stringify(n)),r.debug("Edge "+n.v+" -> "+n.w+": "+JSON.stringify(t.edge(n)));let{v:o,w:c}=n;if(r.debug("Fix XXX",G,"ids:",n.v,n.w,"Translating: ",G.get(n.v)," --- ",G.get(n.w)),G.get(n.v)||G.get(n.w)){if(r.debug("Fixing and trying - removing XXX",n.v,n.w,n.name),o=D(n.v),c=D(n.w),t.removeEdge(n.v,n.w,n.name),o!==n.v){let u=t.parent(o);G.get(u).externalConnections=!0,a.fromCluster=n.v}if(c!==n.w){let u=t.parent(c);G.get(u).externalConnections=!0,a.toCluster=n.w}r.debug("Fix Replacing with XXX",o,c,n.name),t.setEdge(o,c,a,n.name)}}),A(t,0),r.trace(G)},"adjustClustersAndEdges"),A=e((t,i)=>{if(i>10){r.error("Bailing out");return}let n=t.nodes(),a=!1;for(let o of n){let c=t.children(o);a=a||c.length>0}if(!a){r.debug("Done, no node has children",t.nodes());return}r.debug("Nodes = ",n,i);for(let o of n)if(r.debug("Extracting node",o,G,G.has(o)&&!G.get(o).externalConnections,!t.parent(o),t.node(o),t.children("D")," Depth ",i),!G.has(o))r.debug("Not a cluster",o,i);else if(!G.get(o).externalConnections&&t.children(o)&&t.children(o).length>0){r.debug("Cluster without external connections, without a parent and with children",o,i);let u=t.graph().rankdir==="TB"?"LR":"TB";if(G.get(o)?.clusterData?.dir)u=G.get(o).clusterData.dir,r.debug("Fixing dir",G.get(o).clusterData.dir,u);let d=new Q({multigraph:!0,compound:!0}).setGraph({rankdir:u,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});P(o,t,d,o),t.setNode(o,{clusterNode:!0,id:o,clusterData:G.get(o).clusterData,label:G.get(o).label,graph:d})}else r.debug("Cluster ** ",o," **not meeting the criteria !externalConnections:",!G.get(o).externalConnections," no parent: ",!t.parent(o)," children ",t.children(o)&&t.children(o).length>0,t.children("D"),i),r.debug(G);n=t.nodes(),r.debug("New list of nodes",n);for(let o of n){let c=t.node(o);if(r.debug(" Now next level",o,c),c?.clusterNode)A(c.graph,i+1)}},"extractor"),X=e((t,i)=>{if(i.length===0)return[];let n=Object.assign([],i);return i.forEach((a)=>{let o=t.children(a),c=X(t,o);n=[...n,...c]}),n},"sorter"),ca=e((t)=>X(t,t.children()),"sortNodesByHierarchy"),_=e((t,i,n)=>{let a=t.parent(i);while(a&&a!==n){let o=G.get(a);if(o&&!o.externalConnections)return!0;a=t.parent(a)}return!1},"isNodeInExtractableCluster"),te=e((t,i,n)=>{let a=t.children(i)??[];for(let o of a){if(o===n||v(o,n))continue;let c=$n(o,t,i);if(!c)continue;if(!_(t,c,i))return c}return null},"findSafeAnchorNode");function lr({prepareLayout:t,measureLayout:i,runLayoutCore:n,paintLayout:a,afterPaint:o,paintOptions:c}){let u=i??F;return e(async function(l,g,h,C){let w=g.select("g");(h?.insertMarkers??Yn)(w,l.markers,l.type,l.diagramId),O();let f={element:w,helpers:h,options:C};f.preparedLayout=await t?.(l,f);let p=await u(l,f),E=await n(l,f),y={...f,measure:p};if(a)await a(l,y,E);else await j(l,y,c);await o?.(l,y,E)},"render")}e(lr,"createCommonLayoutRenderer");function O(){go(),vo(),yo(),Z()}e(O,"clearLayoutRenderState");async function F(t,{element:i},n){return await R(i,t,n)}e(F,"defaultMeasureLayout");async function j(t,i,n={}){let{measure:a}=i,{groups:o}=a;for(let u of n.getNodes?.(t,i)??t.nodes){if(n.skipNode?.(u,i))continue;await H(o,u,i,n)}let c=J(t.nodes);for(let u of t.edges){if(W(u,n))continue;await V(o,u,c,t,n,i)}}e(j,"paintLayoutData");async function H(t,i,n,a){if(i.clusterNode)ht(i);else if(z(i,n,a))await Qt(t.clusters,i);else ht(i)}e(H,"paintLayoutNode");function z(t,i,n){return t.isGroup===!0&&(n.isCluster?.(t,i)??!0)}e(z,"shouldPaintAsCluster");function J(t){let i=new Map;for(let n of t)if(n?.id)i.set(n.id,n);return i}e(J,"buildNodeLookup");function W(t,i){return t.isLayoutOnly||Boolean(i.skipEdge?.(t))}e(W,"shouldSkipPaintEdge");async function V(t,i,n,a,o,c){let u=Jt(t.edgePaths,{...i},o.clusterDb??new Map,a.type,L(i.start,i,n,c,o),L(i.end,i,n,c,o),a.diagramId,Y(i,o),a.layoutAlgorithm);if(Vi(i)){if(!Wn.has(i.id))await Tt(t.edgeLabels,i);q(i,u)}}e(V,"paintLayoutEdge");function L(t,i,n,a,o){return o.getEdgeNode?.(t,i,a)??(t?n.get(t)??{}:{})}e(L,"getRenderedNode");function Y(t,i){return typeof i.skipIntersect==="function"?i.skipIntersect(t):i.skipIntersect??!1}e(Y,"shouldSkipIntersect");function q(t,i){let n=i?.updatedPath??i?.originalPath,a=b(),{subGraphTitleTotalMargin:o}=Ct({flowchart:a.flowchart??{}});if(t.label){let c=Wn.get(t.id),{x:u,y:d}=Gi(t,i);c.attr("transform",`translate(${u}, ${d+o/2})`)}for(let[c,u]of[["startLeft",t.startLabelLeft],["startRight",t.startLabelRight],["endLeft",t.endLabelLeft],["endRight",t.endLabelRight]])if(u){let{x:d,y:l}=K(t,c,n);Me.get(t.id)[c].attr("transform",`translate(${d}, ${l})`)}}e(q,"positionRenderedEdgeLabel");var ne={startLeft:"start_left",startRight:"start_right",endLeft:"end_left",endRight:"end_right"};function K(t,i,n){let a=t.terminalLabelCenters?.[i];if(a)return{...a};if(!n)return{x:t.x,y:t.y};let o=i.startsWith("start")?t.arrowTypeStart:t.arrowTypeEnd;return N.calcTerminalLabelPosition(o?10:0,ne[i],n)}e(K,"terminalLabelTranslate");
2
2
  export{sa,la,G,$n,eo,ca,lr};
@@ -0,0 +1 @@
1
+ import{rr}from"./chunk-n8gfjj9a.js";export{rr as createRailroadServices};
@@ -1,9 +1,9 @@
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)+`:
1
+ import{e,r,Le,y,C,S,E,T,A,I,L,s,p,zi,N,ce,ae,ie,ft,ge,ye}from"./chunk-vymqrpm3.js";import{Pt}from"./chunk-47q4hmfp.js";import{he}from"./chunk-es28k2t7.js";import{se}from"./chunk-zmdnxn6m.js";var Bt=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],Mt=[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(Mt,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(Mt,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
2
  `+O.showPosition()+`
3
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
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
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+=`
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}();Bt.parser=Bt;var Ee=Bt,_e="TB",qt="TB",Ut="dir",ot="state",nt="root",Gt="relation",ve="classDef",De="style",Ce="applyClass",ut="default",Qt="divider",Zt="fill:none",te="fill: #333",ee="c",re="markdown",ne="normal",$t="rect",Ft="rectWithTitle",Ae="stateStart",xe="stateEnd",Yt="divider",Ht="roundedWithTitle",we="note",Ie="noteGroup",pt="statediagram",Ne="state",Oe=`${pt}-${Ne}`,oe="transition",Re="note",$e="note-edge",Fe=`${oe} ${$e}`,Pe=`${pt}-${Re}`,Be="cluster",Ge=`${pt}-${Be}`,Ye="cluster-alt",Ve=`${pt}-${Ye}`,le="parent",de="note",Me="state",Vt="----",We=`${Vt}${de}`,zt=`${Vt}${le}`,At=new Map,Z=0,ue=0,ct=new Map,je=e((t,i,c,a)=>{if(t===Yt&&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=Vt){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 Gt:{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:re,thickness:ne,classes:oe,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 fe(t){return t?.classes?.join(" ")??""}e(fe,"getClassesFromDbInfo");function pe(t){return t?.styles??[]}e(pe,"getStylesFromDbInfo");var dt=e((t,i,c,a,u,f,b,k)=>{let l=i.id,D=c.get(l),x=fe(D),Y=pe(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?Yt: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===Yt)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,le),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:re,thickness:ne,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"),Se=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=he(i,u);if(k.type=a.type,k.layoutAlgorithm=ye(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 ge(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()),se(l,x,pt,f?.useMaxWidth??!0)},"draw"),Xe={getClasses:ze,draw:Ke,getDir:Se},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 Gt: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===Gt){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=Pt();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:Se(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=ce(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
7
 
8
8
  /* The title strip: \`rect.outer\` spans the whole composite and \`rect.inner\` covers
9
9
  the body, so what stays visible of \`outer\` is the band behind the label. */
@@ -0,0 +1 @@
1
+ import{xi}from"./chunk-n8gfjj9a.js";export{xi as createGitGraphServices};
@@ -1,4 +1,4 @@
1
- import{W}from"./chunk-b1pe46zz.js";import{e,r,we,D,b,B,C,S,E,T,A,I,L,q,U}from"./chunk-y0m8hrwz.js";import{X}from"./chunk-taynqrgq.js";var h={showLegend:!0,ticks:5,max:null,min:0,graticule:"circle"},M=32,k={axes:[],curves:[],options:h},x=structuredClone(k),V=D.radar,H=e(()=>U({...V,...b().radar}),"getConfig"),O=e(()=>x.axes,"getAxes"),j=e(()=>x.curves,"getCurves"),K=e(()=>x.options,"getOptions"),N=e((n)=>{x.axes=n.map((t)=>({name:t.name,label:t.label??t.name}))},"setAxes"),Y=e((n)=>{x.curves=n.map((t)=>({name:t.name,label:t.label??t.name,entries:Z(t.entries)}))},"setCurves"),Z=e((n)=>{if(n[0].axis==null)return n.map((a)=>a.value);let t=O();if(t.length===0)throw Error("Axes must be populated before curves for reference entries");return t.map((a)=>{let s=n.find((o)=>o.axis?.$refText===a.name);if(s===void 0)throw Error("Missing entry for axis "+a.label);return s.value})},"computeCurveEntries"),J=e((n)=>{let t=n.reduce((a,s)=>(a[s.name]=s,a),{});if(x.options={showLegend:t.showLegend?.value??h.showLegend,ticks:t.ticks?.value??h.ticks,max:t.max?.value??h.max,min:t.min?.value??h.min,graticule:t.graticule?.value??h.graticule},x.options.ticks>M)r.warn(`Radar diagram ticks (${x.options.ticks}) exceeds maximum allowed (${M}). Using ${M} instead.`),x.options.ticks=M},"setOptions"),Q=e(()=>{C(),x=structuredClone(k)},"clear"),y={getAxes:O,getCurves:j,getOptions:K,setAxes:N,setCurves:Y,setOptions:J,getConfig:H,clear:Q,setAccTitle:S,getAccTitle:E,setDiagramTitle:I,getDiagramTitle:L,getAccDescription:A,setAccDescription:T},tt=e((n)=>{W(n,y);let{axes:t,curves:a,options:s}=n;y.setAxes(t),y.setCurves(a),y.setOptions(s)},"populate"),et={parse:e(async(n)=>{let t=await X("radar",n);r.debug(t),tt(t)},"parse")},at=e((n,t,a,s)=>{let o=s.db,c=o.getAxes(),d=o.getCurves(),i=o.getOptions(),l=o.getConfig(),u=o.getDiagramTitle(),m=q(t),p=rt(m,l),g=i.max??Math.max(...d.map((w)=>Math.max(...w.entries))),v=i.min,f=Math.min(l.width,l.height)/2;nt(p,c,f,i.ticks,i.graticule),st(p,c,f,l),R(p,c,d,v,g,i.graticule,l),P(p,d,i.showLegend,l),p.append("text").attr("class","radarTitle").text(u).attr("x",0).attr("y",-l.height/2-l.marginTop)},"draw"),rt=e((n,t)=>{let a=t.width+t.marginLeft+t.marginRight,s=t.height+t.marginTop+t.marginBottom,o={x:t.marginLeft+t.width/2,y:t.marginTop+t.height/2};return B(n,s,a,t.useMaxWidth??!0),n.attr("viewBox",`0 0 ${a} ${s}`).attr("overflow","visible"),n.append("g").attr("transform",`translate(${o.x}, ${o.y})`)},"drawFrame"),nt=e((n,t,a,s,o)=>{if(o==="circle")for(let c=0;c<s;c++){let d=a*(c+1)/s;n.append("circle").attr("r",d).attr("class","radarGraticule")}else if(o==="polygon"){let c=t.length;for(let d=0;d<s;d++){let i=a*(d+1)/s,l=t.map((u,m)=>{let p=2*m*Math.PI/c-Math.PI/2,g=i*Math.cos(p),v=i*Math.sin(p);return`${g},${v}`}).join(" ");n.append("polygon").attr("points",l).attr("class","radarGraticule")}}},"drawGraticule"),st=e((n,t,a,s)=>{let o=t.length;for(let c=0;c<o;c++){let d=t[c].label,i=2*c*Math.PI/o-Math.PI/2,l=Math.cos(i),u=Math.sin(i);n.append("line").attr("x1",0).attr("y1",0).attr("x2",a*s.axisScaleFactor*l).attr("y2",a*s.axisScaleFactor*u).attr("class","radarAxisLine");let m=l>0.01?"start":l<-0.01?"end":"middle",p=u>0.01?"hanging":u<-0.01?"auto":"central",g=4;n.append("text").text(d).attr("x",a*s.axisLabelFactor*l+g*l).attr("y",a*s.axisLabelFactor*u+g*u).attr("text-anchor",m).attr("dominant-baseline",p).attr("class","radarAxisLabel")}},"drawAxes");function R(n,t,a,s,o,c,d){let i=t.length,l=Math.min(d.width,d.height)/2;a.forEach((u,m)=>{if(u.entries.length!==i)return;let p=u.entries.map((g,v)=>{let f=2*Math.PI*v/i-Math.PI/2,w=_(g,s,o,l),z=w*Math.cos(f),G=w*Math.sin(f);return{x:z,y:G}});if(c==="circle")n.append("path").attr("d",F(p,d.curveTension)).attr("class",`radarCurve-${m}`);else if(c==="polygon")n.append("polygon").attr("points",p.map((g)=>`${g.x},${g.y}`).join(" ")).attr("class",`radarCurve-${m}`)})}e(R,"drawCurves");function _(n,t,a,s){let o=Math.min(Math.max(n,t),a);return s*(o-t)/(a-t)}e(_,"relativeRadius");function F(n,t){let a=n.length,s=`M${n[0].x},${n[0].y}`;for(let o=0;o<a;o++){let c=n[(o-1+a)%a],d=n[o],i=n[(o+1)%a],l=n[(o+2)%a],u={x:d.x+(i.x-c.x)*t,y:d.y+(i.y-c.y)*t},m={x:i.x-(l.x-d.x)*t,y:i.y-(l.y-d.y)*t};s+=` C${u.x},${u.y} ${m.x},${m.y} ${i.x},${i.y}`}return`${s} Z`}e(F,"closedRoundCurve");function P(n,t,a,s){if(!a)return;let o=(s.width/2+s.marginRight)*3/4,c=-(s.height/2+s.marginTop)*3/4,d=20;t.forEach((i,l)=>{let u=n.append("g").attr("transform",`translate(${o}, ${c+l*d})`);u.append("rect").attr("width",12).attr("height",12).attr("class",`radarLegendBox-${l}`),u.append("text").attr("x",16).attr("y",0).attr("class","radarLegendText").text(i.label)})}e(P,"drawLegend");var ot={draw:at},it=e((n,t)=>{let a="";for(let s=0;s<n.THEME_COLOR_LIMIT;s++){let o=n[`cScale${s}`];a+=`
1
+ import{W}from"./chunk-89fkdgbp.js";import{e,r,we,D,b,B,C,S,E,T,A,I,L,V,U}from"./chunk-vymqrpm3.js";import{X}from"./chunk-n8gfjj9a.js";var h={showLegend:!0,ticks:5,max:null,min:0,graticule:"circle"},M=32,k={axes:[],curves:[],options:h},x=structuredClone(k),H=D.radar,j=e(()=>U({...H,...b().radar}),"getConfig"),O=e(()=>x.axes,"getAxes"),K=e(()=>x.curves,"getCurves"),N=e(()=>x.options,"getOptions"),Y=e((n)=>{x.axes=n.map((t)=>({name:t.name,label:t.label??t.name}))},"setAxes"),Z=e((n)=>{x.curves=n.map((t)=>({name:t.name,label:t.label??t.name,entries:q(t.entries)}))},"setCurves"),q=e((n)=>{if(n[0].axis==null)return n.map((a)=>a.value);let t=O();if(t.length===0)throw Error("Axes must be populated before curves for reference entries");return t.map((a)=>{let s=n.find((o)=>o.axis?.$refText===a.name);if(s===void 0)throw Error("Missing entry for axis "+a.label);return s.value})},"computeCurveEntries"),J=e((n)=>{let t=n.reduce((a,s)=>(a[s.name]=s,a),{});if(x.options={showLegend:t.showLegend?.value??h.showLegend,ticks:t.ticks?.value??h.ticks,max:t.max?.value??h.max,min:t.min?.value??h.min,graticule:t.graticule?.value??h.graticule},x.options.ticks>M)r.warn(`Radar diagram ticks (${x.options.ticks}) exceeds maximum allowed (${M}). Using ${M} instead.`),x.options.ticks=M},"setOptions"),Q=e(()=>{C(),x=structuredClone(k)},"clear"),y={getAxes:O,getCurves:K,getOptions:N,setAxes:Y,setCurves:Z,setOptions:J,getConfig:j,clear:Q,setAccTitle:S,getAccTitle:E,setDiagramTitle:I,getDiagramTitle:L,getAccDescription:A,setAccDescription:T},tt=e((n)=>{W(n,y);let{axes:t,curves:a,options:s}=n;y.setAxes(t),y.setCurves(a),y.setOptions(s)},"populate"),et={parse:e(async(n)=>{let t=await X("radar",n);r.debug(t),tt(t)},"parse")},at=e((n,t,a,s)=>{let o=s.db,c=o.getAxes(),d=o.getCurves(),i=o.getOptions(),l=o.getConfig(),u=o.getDiagramTitle(),m=V(t),p=rt(m,l),g=i.max??Math.max(...d.map((w)=>Math.max(...w.entries))),v=i.min,f=Math.min(l.width,l.height)/2;nt(p,c,f,i.ticks,i.graticule),st(p,c,f,l),R(p,c,d,v,g,i.graticule,l),P(p,d,i.showLegend,l),p.append("text").attr("class","radarTitle").text(u).attr("x",0).attr("y",-l.height/2-l.marginTop)},"draw"),rt=e((n,t)=>{let a=t.width+t.marginLeft+t.marginRight,s=t.height+t.marginTop+t.marginBottom,o={x:t.marginLeft+t.width/2,y:t.marginTop+t.height/2};return B(n,s,a,t.useMaxWidth??!0),n.attr("viewBox",`0 0 ${a} ${s}`).attr("overflow","visible"),n.append("g").attr("transform",`translate(${o.x}, ${o.y})`)},"drawFrame"),nt=e((n,t,a,s,o)=>{if(o==="circle")for(let c=0;c<s;c++){let d=a*(c+1)/s;n.append("circle").attr("r",d).attr("class","radarGraticule")}else if(o==="polygon"){let c=t.length;for(let d=0;d<s;d++){let i=a*(d+1)/s,l=t.map((u,m)=>{let p=2*m*Math.PI/c-Math.PI/2,g=i*Math.cos(p),v=i*Math.sin(p);return`${g},${v}`}).join(" ");n.append("polygon").attr("points",l).attr("class","radarGraticule")}}},"drawGraticule"),st=e((n,t,a,s)=>{let o=t.length;for(let c=0;c<o;c++){let d=t[c].label,i=2*c*Math.PI/o-Math.PI/2,l=Math.cos(i),u=Math.sin(i);n.append("line").attr("x1",0).attr("y1",0).attr("x2",a*s.axisScaleFactor*l).attr("y2",a*s.axisScaleFactor*u).attr("class","radarAxisLine");let m=l>0.01?"start":l<-0.01?"end":"middle",p=u>0.01?"hanging":u<-0.01?"auto":"central",g=4;n.append("text").text(d).attr("x",a*s.axisLabelFactor*l+g*l).attr("y",a*s.axisLabelFactor*u+g*u).attr("text-anchor",m).attr("dominant-baseline",p).attr("class","radarAxisLabel")}},"drawAxes");function R(n,t,a,s,o,c,d){let i=t.length,l=Math.min(d.width,d.height)/2;a.forEach((u,m)=>{if(u.entries.length!==i)return;let p=u.entries.map((g,v)=>{let f=2*Math.PI*v/i-Math.PI/2,w=_(g,s,o,l),z=w*Math.cos(f),G=w*Math.sin(f);return{x:z,y:G}});if(c==="circle")n.append("path").attr("d",F(p,d.curveTension)).attr("class",`radarCurve-${m}`);else if(c==="polygon")n.append("polygon").attr("points",p.map((g)=>`${g.x},${g.y}`).join(" ")).attr("class",`radarCurve-${m}`)})}e(R,"drawCurves");function _(n,t,a,s){let o=Math.min(Math.max(n,t),a);return s*(o-t)/(a-t)}e(_,"relativeRadius");function F(n,t){let a=n.length,s=`M${n[0].x},${n[0].y}`;for(let o=0;o<a;o++){let c=n[(o-1+a)%a],d=n[o],i=n[(o+1)%a],l=n[(o+2)%a],u={x:d.x+(i.x-c.x)*t,y:d.y+(i.y-c.y)*t},m={x:i.x-(l.x-d.x)*t,y:i.y-(l.y-d.y)*t};s+=` C${u.x},${u.y} ${m.x},${m.y} ${i.x},${i.y}`}return`${s} Z`}e(F,"closedRoundCurve");function P(n,t,a,s){if(!a)return;let o=(s.width/2+s.marginRight)*3/4,c=-(s.height/2+s.marginTop)*3/4,d=20;t.forEach((i,l)=>{let u=n.append("g").attr("transform",`translate(${o}, ${c+l*d})`);u.append("rect").attr("width",12).attr("height",12).attr("class",`radarLegendBox-${l}`),u.append("text").attr("x",16).attr("y",0).attr("class","radarLegendText").text(i.label)})}e(P,"drawLegend");var ot={draw:at},it=e((n,t)=>{let a="";for(let s=0;s<n.THEME_COLOR_LIMIT;s++){let o=n[`cScale${s}`];a+=`
2
2
  .radarCurve-${s} {
3
3
  color: ${o};
4
4
  fill: ${o};