@bkm016/basalt 0.1.13 → 0.1.14

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 (243) hide show
  1. package/README.md +3 -2
  2. package/{chunk-bng72094.js → chunk-03wzwnn6.js} +1 -1
  3. package/{chunk-9e8vhzy7.js → chunk-0crbhhna.js} +1 -1
  4. package/{chunk-h9zxqeqr.js → chunk-0rasqm8y.js} +2 -2
  5. package/{chunk-0x9netvr.js → chunk-1w4nh5t6.js} +1 -1
  6. package/{chunk-dk6fgprw.js → chunk-2eaehpp6.js} +1 -1
  7. package/{chunk-6sea12mw.js → chunk-30dxcr91.js} +1 -1
  8. package/{chunk-2zbj8ny6.js → chunk-343jsm46.js} +2 -2
  9. package/chunk-38g4jd6v.js +5 -0
  10. package/{chunk-zx75vnw8.js → chunk-39mh7h58.js} +22 -22
  11. package/chunk-44b9yx79.js +2 -0
  12. package/{chunk-r1jn77q6.js → chunk-4f6p4n7k.js} +2 -2
  13. package/{chunk-sgz87ht5.js → chunk-4w8j6n7z.js} +1 -1
  14. package/{chunk-szj85dqe.js → chunk-4yxd2kg1.js} +2 -2
  15. package/{chunk-bp61xdsc.js → chunk-59hg9a84.js} +1 -1
  16. package/{chunk-bq54argx.js → chunk-62ebm0bn.js} +1 -1
  17. package/{chunk-6d9r9p91.js → chunk-6ef085c1.js} +4 -4
  18. package/{chunk-zk91579b.js → chunk-6hx9y86d.js} +2 -2
  19. package/chunk-73t051r6.js +2 -0
  20. package/{chunk-pryvvs96.js → chunk-7mgkpn94.js} +22 -22
  21. package/{chunk-2q56egb8.js → chunk-81x8r8w4.js} +1 -1
  22. package/{chunk-rn3jwyh1.js → chunk-8np9b2y8.js} +2 -2
  23. package/{chunk-1q6e3mj7.js → chunk-9ew8cap5.js} +2 -2
  24. package/chunk-9v3b7jjv.js +2 -0
  25. package/{chunk-tjg0gcks.js → chunk-9vam83py.js} +1 -1
  26. package/{chunk-ct77cdg7.js → chunk-9xjecw6c.js} +1 -1
  27. package/{chunk-8cgz8xv7.js → chunk-b2wpj81x.js} +2 -2
  28. package/{chunk-302n9g7p.js → chunk-bjvv3403.js} +1 -1
  29. package/{chunk-tfhze1vq.js → chunk-c8g9jjqs.js} +2 -2
  30. package/{chunk-0a7ft50x.js → chunk-cs91rmbf.js} +8 -8
  31. package/{chunk-gpnqmtbk.js → chunk-edcf97ka.js} +1 -1
  32. package/{chunk-74wwdx3y.js → chunk-en7z6ne5.js} +2 -2
  33. package/{chunk-f0h2bv11.js → chunk-evnqkyt7.js} +10 -10
  34. package/{chunk-4rnmxtpx.js → chunk-ge38dhv9.js} +2 -2
  35. package/chunk-hggam3je.js +2 -0
  36. package/{chunk-mf04h0yy.js → chunk-k38jaz6c.js} +4 -4
  37. package/{chunk-jjtt9aq8.js → chunk-kcn05erf.js} +3 -3
  38. package/{chunk-y23dpz5e.js → chunk-m5km74eq.js} +2 -2
  39. package/{chunk-095adzn5.js → chunk-mfb3dgs8.js} +2 -2
  40. package/{chunk-0nedq669.js → chunk-mh4bjtfs.js} +3 -3
  41. package/{chunk-yy1f9jxc.js → chunk-nysatg77.js} +429 -312
  42. package/{chunk-bja7p3em.js → chunk-p886jr17.js} +13 -13
  43. package/{chunk-xvm0y99b.js → chunk-pdt65s31.js} +2 -2
  44. package/{chunk-ymg7mtcx.js → chunk-pjgt1bdx.js} +2 -2
  45. package/{chunk-959z9efn.js → chunk-pyj6avd5.js} +2 -2
  46. package/chunk-qd2enpr2.js +3 -0
  47. package/{chunk-tnj2kqb8.js → chunk-qe76naq9.js} +1 -1
  48. package/{chunk-z0c8ek0j.js → chunk-qjnx4fsn.js} +2 -2
  49. package/{chunk-2tf7qfbx.js → chunk-qs161f2q.js} +2 -2
  50. package/{chunk-nbjnwd54.js → chunk-rghqprav.js} +1 -1
  51. package/{chunk-7chv3knf.js → chunk-t33bm5aa.js} +1 -1
  52. package/chunk-vd5332ps.js +2 -0
  53. package/{chunk-22az84sh.js → chunk-w55cnj0f.js} +2 -2
  54. package/{chunk-4k9t9jvx.js → chunk-wnd3y4c0.js} +1 -1
  55. package/{chunk-snz19yc2.js → chunk-xafx1p7z.js} +2 -2
  56. package/{chunk-15ve3nmv.js → chunk-xf7zw32f.js} +12 -12
  57. package/chunk-xk3t5ves.js +482 -0
  58. package/{chunk-kbpbrr11.js → chunk-xq74x4gc.js} +2 -2
  59. package/{chunk-mdkfm1ak.js → chunk-y0274xr2.js} +3 -3
  60. package/{chunk-y4pvhes1.js → chunk-z9p6s986.js} +6 -6
  61. package/{chunk-41das1ty.js → chunk-zcwz44db.js} +1 -1
  62. package/{chunk-77c2cqp2.js → chunk-zhyzhekt.js} +1 -1
  63. package/compiled.js +12 -12
  64. package/package.json +1 -1
  65. package/ui-test-worker.js +51 -51
  66. package/web/chunk-15g9pnzy.js +1 -0
  67. package/web/{chunk-16jc5m0f.js → chunk-17wwzrp4.js} +1 -1
  68. package/web/chunk-19tkjg9w.js +1 -0
  69. package/web/chunk-1y387f45.js +1 -0
  70. package/web/{chunk-mykrm8ba.js → chunk-25sn840r.js} +2 -2
  71. package/web/chunk-26sp6jre.js +1 -0
  72. package/web/{chunk-wpxtkxjt.js → chunk-2c7kxr4v.js} +2 -2
  73. package/web/{chunk-et1rsgmp.js → chunk-2gsf89vs.js} +2 -2
  74. package/web/{chunk-jpem3qvs.js → chunk-2gvz70wr.js} +5 -5
  75. package/web/chunk-2s3my1jn.js +1 -0
  76. package/web/{chunk-yn4t5s9r.js → chunk-32dh0hft.js} +1 -1
  77. package/web/{chunk-5cwxhhae.js → chunk-3haw3wcw.js} +2 -2
  78. package/web/{chunk-t82sngk9.js → chunk-3rxhs9qm.js} +7 -7
  79. package/web/chunk-410qdvmv.js +1 -0
  80. package/web/chunk-4qehf2xx.js +2 -0
  81. package/web/{chunk-b9jry5a3.js → chunk-51b8n5e1.js} +1 -1
  82. package/web/{chunk-xe121vg7.js → chunk-54mgncq3.js} +1 -1
  83. package/web/{chunk-ze6azq7z.js → chunk-59g6rrew.js} +4 -4
  84. package/web/{chunk-h6k1x096.js → chunk-5d9veaef.js} +2 -2
  85. package/web/chunk-6481wt3t.js +1 -0
  86. package/web/chunk-6ehecat3.js +1 -0
  87. package/web/chunk-6m8hq6ph.js +1 -0
  88. package/web/chunk-73941p08.js +1 -0
  89. package/web/{chunk-0jbf73pr.js → chunk-783s8jds.js} +3 -3
  90. package/web/{chunk-qbmtah1x.js → chunk-78m018ya.js} +1 -1
  91. package/web/{chunk-3p9w8sg5.js → chunk-797bh7z6.js} +3 -3
  92. package/web/{chunk-1xm9x7d6.js → chunk-7hpqrfgg.js} +2 -2
  93. package/web/{chunk-zxrbbbtp.js → chunk-7kywe73f.js} +2 -2
  94. package/web/chunk-7qq1ypvj.js +1 -0
  95. package/web/{chunk-awkdw9rw.js → chunk-7wzszsf5.js} +2 -2
  96. package/web/{chunk-c57f714b.js → chunk-7zfqppsx.js} +2 -2
  97. package/web/{chunk-jh33m2mq.js → chunk-8sr9w61v.js} +3 -3
  98. package/web/{chunk-4py9sndw.js → chunk-8ttp8fh3.js} +6 -6
  99. package/web/chunk-8zg89764.js +1 -0
  100. package/web/{chunk-ct7z7bea.js → chunk-988e9wx6.js} +3 -3
  101. package/web/{chunk-vk7ch6fh.js → chunk-9h0f3gar.js} +2 -2
  102. package/web/{chunk-p6e2vr51.js → chunk-9vr6hpmk.js} +6 -6
  103. package/web/chunk-9vrp249f.js +2 -0
  104. package/web/{chunk-eqxy6535.js → chunk-a205cj09.js} +2 -2
  105. package/web/{chunk-980zhtht.js → chunk-ahn2frbt.js} +1 -1
  106. package/web/{chunk-xvm66b7v.js → chunk-aknsydan.js} +4 -4
  107. package/web/chunk-at0xtfhy.js +1 -0
  108. package/web/chunk-bahccwb9.js +1 -0
  109. package/web/{chunk-w4tfad6c.js → chunk-c7fqrs8j.js} +1 -1
  110. package/web/{chunk-zqcg6frm.js → chunk-d3hyf9yd.js} +1 -1
  111. package/web/chunk-dcegr80c.js +1 -0
  112. package/web/{chunk-v4cqc9f9.js → chunk-dwtatme7.js} +1 -1
  113. package/web/{chunk-cr04125j.js → chunk-ex8rmqn1.js} +12 -12
  114. package/web/{chunk-jh3k7xex.js → chunk-faskbfjf.js} +3 -3
  115. package/web/{chunk-zb61mf0a.js → chunk-feanedhx.js} +1 -1
  116. package/web/{chunk-xk1vkcj4.js → chunk-ffywf5w5.js} +4 -4
  117. package/web/chunk-fx3d48e6.js +1 -0
  118. package/web/{chunk-3jjksgze.js → chunk-g3szt4c4.js} +1 -1
  119. package/web/chunk-g7bcntpm.js +1 -0
  120. package/web/chunk-gr1tjqbd.js +1 -0
  121. package/web/{chunk-2sef2wft.js → chunk-hbwxtbq3.js} +2 -2
  122. package/web/{chunk-6e87m0nm.js → chunk-hdtvrh0f.js} +2 -2
  123. package/web/chunk-j031r08w.js +1 -0
  124. package/web/{chunk-5ym5ffd5.js → chunk-j6wcszxq.js} +2 -2
  125. package/web/{chunk-jccz14ye.js → chunk-jdx7qp2w.js} +2 -2
  126. package/web/chunk-jge7nn3s.js +1 -0
  127. package/web/chunk-jy8zat04.js +1 -0
  128. package/web/{chunk-0rhx7qb8.js → chunk-jzge034r.js} +1 -1
  129. package/web/{chunk-qq6m2my8.js → chunk-k4qrqmdk.js} +2 -2
  130. package/web/chunk-k8s7kye3.js +1 -0
  131. package/web/{chunk-ke8dffnk.js → chunk-k9fyqrhp.js} +2 -2
  132. package/web/chunk-k9zn1n6d.js +1 -0
  133. package/web/chunk-kg3tksv7.js +1 -0
  134. package/web/chunk-kk5rw81s.js +2 -0
  135. package/web/{chunk-y9waq403.js → chunk-kpmd893m.js} +2 -2
  136. package/web/chunk-md9j949p.js +1 -0
  137. package/web/{chunk-e57h40qa.js → chunk-mn2wv9ye.js} +2 -2
  138. package/web/{chunk-14vmr99v.js → chunk-mv7jgmnb.js} +3 -3
  139. package/web/{chunk-qq06x2ce.js → chunk-mvm68qtt.js} +2 -2
  140. package/web/chunk-nbcpbqq4.js +1 -0
  141. package/web/{chunk-6rsr2cyw.js → chunk-nfpff7yf.js} +8 -8
  142. package/web/chunk-nk7jkpam.js +1 -0
  143. package/web/chunk-nmvt1rn3.js +1 -0
  144. package/web/{chunk-3ctmehg4.js → chunk-npw1s1h2.js} +1 -1
  145. package/web/chunk-nzzxv84v.js +8 -0
  146. package/web/{chunk-a9er7a7c.js → chunk-p4pqtybm.js} +19 -19
  147. package/web/{chunk-ba9qy65y.js → chunk-p79c7aak.js} +1 -1
  148. package/web/{chunk-frnh4zqf.js → chunk-pafw34vg.js} +2 -2
  149. package/web/{chunk-ct90yf8z.js → chunk-pf65cank.js} +2 -2
  150. package/web/{chunk-g0be12na.js → chunk-ppa21760.js} +1 -1
  151. package/web/{chunk-g7hqafb8.js → chunk-ptpkv0te.js} +1 -1
  152. package/web/{chunk-ddg8rz82.js → chunk-qcdej581.js} +1 -1
  153. package/web/{chunk-xxmaqj1m.js → chunk-qftcdcps.js} +2 -2
  154. package/web/{chunk-eqndhs21.js → chunk-qv1w36ja.js} +2 -2
  155. package/web/{chunk-mnf4ngj9.js → chunk-r8p741qj.js} +2 -2
  156. package/web/chunk-rcexbkjj.js +1 -0
  157. package/web/{chunk-w28dn4dw.js → chunk-rjakb64x.js} +1 -1
  158. package/web/{chunk-k0cg4n2k.js → chunk-s0xy00v5.js} +2 -2
  159. package/web/{chunk-cr05dttm.js → chunk-s2ps0ct5.js} +1 -1
  160. package/web/{chunk-xcyqd7cn.js → chunk-s45g7fp6.js} +1 -1
  161. package/web/{chunk-h1k2kqbs.js → chunk-s70aj1v5.js} +4 -4
  162. package/web/chunk-say8bvkc.js +1 -0
  163. package/web/{chunk-qh62nkem.js → chunk-sd3cdqcm.js} +2 -2
  164. package/web/{chunk-a6g3nqp0.js → chunk-sgkevxdf.js} +2 -2
  165. package/web/chunk-sjffrcq9.js +1 -0
  166. package/web/{chunk-2y1avvqj.js → chunk-snaepr87.js} +3 -3
  167. package/web/{chunk-p7pa02k9.js → chunk-tdzh6nsz.js} +2 -2
  168. package/web/{chunk-ga07tv37.js → chunk-tjd8qp87.js} +1 -1
  169. package/web/chunk-tncc9e57.js +1 -0
  170. package/web/{chunk-ve8gy05p.js → chunk-ty2rmwda.js} +92 -92
  171. package/web/chunk-v22hp18w.js +1 -0
  172. package/web/{chunk-zh7193nq.js → chunk-ve9dz857.js} +2 -2
  173. package/web/{chunk-s935z8er.js → chunk-vg346gxc.js} +2 -2
  174. package/web/{chunk-b4gcpsbg.js → chunk-vpegzgzb.js} +5 -5
  175. package/web/{chunk-pzg25qqe.js → chunk-vvvd3grf.js} +2 -2
  176. package/web/{chunk-ss96cz1f.js → chunk-vwv6pqy7.js} +1 -1
  177. package/web/{chunk-sq75q603.js → chunk-vxm7n7w6.js} +6 -6
  178. package/web/{chunk-qb8mbptk.js → chunk-w5q7978e.js} +1 -1
  179. package/web/{chunk-97t3ngqf.js → chunk-we4mhfmq.js} +7 -7
  180. package/web/{chunk-20jxvmbw.js → chunk-wfgrdabk.js} +1 -1
  181. package/web/{chunk-3wpxymxa.js → chunk-wkhj4hsw.js} +3 -3
  182. package/web/{chunk-q4vy3dkk.js → chunk-wspk8qbg.js} +2 -2
  183. package/web/{chunk-9wz8jne3.js → chunk-xf1hnpme.js} +1 -1
  184. package/web/{chunk-fnvgdvrg.js → chunk-xhqvzmfj.js} +4 -4
  185. package/web/chunk-xq70hgre.js +1 -0
  186. package/web/chunk-xtss82z2.js +1 -0
  187. package/web/{chunk-8j4tzff5.js → chunk-y3tb6410.js} +3 -3
  188. package/web/{chunk-mkxeenph.js → chunk-y6mcxfm0.js} +1 -1
  189. package/web/{chunk-0rvwj2wh.js → chunk-ya696bfe.js} +2 -2
  190. package/web/{chunk-2x7vmhm0.js → chunk-ysw5fs45.js} +3 -3
  191. package/web/{chunk-atppv8fk.js → chunk-zkq1xknc.js} +1 -1
  192. package/web/chunk-zkv025s5.js +1 -0
  193. package/web/{chunk-dmha2y9c.js → chunk-zpzvz973.js} +18 -18
  194. package/web/{chunk-c6m4vfn5.js → chunk-zsat72qd.js} +68 -68
  195. package/web/{chunk-9k7fkx80.js → chunk-zx3h7v72.js} +1 -1
  196. package/web/index.html +1 -1
  197. package/chunk-1dbfmejf.js +0 -2
  198. package/chunk-4w9zqv0k.js +0 -2
  199. package/chunk-6f4ht2hw.js +0 -2
  200. package/chunk-edbq461k.js +0 -5
  201. package/chunk-m71pj3g1.js +0 -2
  202. package/chunk-n22vd4at.js +0 -2
  203. package/chunk-sgrrxsnz.js +0 -482
  204. package/chunk-ydzag81d.js +0 -3
  205. package/web/chunk-12qf1r6m.js +0 -1
  206. package/web/chunk-1m6fx2h7.js +0 -2
  207. package/web/chunk-2n5xbnrt.js +0 -1
  208. package/web/chunk-36s08nye.js +0 -1
  209. package/web/chunk-4swea9sn.js +0 -1
  210. package/web/chunk-4zz5a483.js +0 -1
  211. package/web/chunk-6y55gk1n.js +0 -1
  212. package/web/chunk-7aep7k4v.js +0 -1
  213. package/web/chunk-8tgavnwx.js +0 -1
  214. package/web/chunk-a00vg115.js +0 -1
  215. package/web/chunk-a4gbxnm3.js +0 -1
  216. package/web/chunk-bq6mep6p.js +0 -2
  217. package/web/chunk-bwy3e58v.js +0 -1
  218. package/web/chunk-de29pe57.js +0 -1
  219. package/web/chunk-eeesa5q1.js +0 -1
  220. package/web/chunk-f7jpakwh.js +0 -1
  221. package/web/chunk-fp62avjh.js +0 -1
  222. package/web/chunk-gr163fex.js +0 -1
  223. package/web/chunk-gx340asc.js +0 -1
  224. package/web/chunk-gxtz10wf.js +0 -1
  225. package/web/chunk-k9qnvx86.js +0 -2
  226. package/web/chunk-kcnj0gan.js +0 -1
  227. package/web/chunk-kpp5xqsb.js +0 -1
  228. package/web/chunk-m33yted6.js +0 -1
  229. package/web/chunk-me5jqqn6.js +0 -1
  230. package/web/chunk-mzqqwbmr.js +0 -1
  231. package/web/chunk-mzzaet63.js +0 -1
  232. package/web/chunk-q34as3v6.js +0 -1
  233. package/web/chunk-q6c8p73w.js +0 -1
  234. package/web/chunk-qn93we3a.js +0 -1
  235. package/web/chunk-r1f1egve.js +0 -1
  236. package/web/chunk-tt9410zw.js +0 -8
  237. package/web/chunk-vg1ebkce.js +0 -1
  238. package/web/chunk-vnt34mkb.js +0 -1
  239. package/web/chunk-xh4xn1az.js +0 -1
  240. package/web/chunk-xrk5ewsn.js +0 -1
  241. package/web/chunk-xzwxcxb4.js +0 -1
  242. package/web/chunk-ydhnkws0.js +0 -1
  243. package/web/chunk-ys2tns0p.js +0 -1
@@ -1,3 +1,3 @@
1
- import{H}from"./chunk-ba9qy65y.js";import{t,a,N,x,O,C,S,E,T,A,L,R,l,kr,p,Nn,Jr,U}from"./chunk-c6m4vfn5.js";import{zr,J}from"./chunk-a9er7a7c.js";var G="position frame",V="frame positioned",F="position relation",X="relation positioned",pe=t(function(e){a.debug("options str",e)},"setOptions"),ve=t(function(){return{}},"getOptions"),be=t(function(){j(),C()},"clear");function j(){M={}}t(j,"reset");var we=N.eventmodeling,ye=t(()=>U({...we,...x().eventmodeling}),"getConfig"),M={};function Y(){let e=Pe,{ast:i}=M,n=I();if(!i)throw Error("No data for EventModel");return i.frames.forEach((r,o)=>{let s=te(r,i.dataEntities,n);e=P(e,{$kind:G,index:o,frame:r,textProps:s});let c=void 0;if(se(r))a.debug("source frame",r.sourceFrames),c=i.frames.filter((m)=>r.sourceFrames.some((u)=>u.$refText===m.name)),c.forEach((m)=>{e=P(e,{$kind:F,index:o,frame:r,sourceFrame:m})});else e=P(e,{$kind:F,index:o,frame:r})}),e={...e,sortedSwimlanesArray:W(e.swimlanes)},e}t(Y,"getState");function z(e){M.ast=void 0;let i=new Set;for(let n of e.frames){if(i.has(n.name)){let r=n.$cstNode?.range.start.line,o=r===void 0?"":` on line ${r+1}`;throw Error(`Duplicate event modeling frame ID "${n.name}"${o}`)}i.add(n.name)}M.ast=e}t(z,"setAst");var d={swimlaneMinHeight:70,swimlanePadding:15,swimlaneGap:10,boxPadding:10,boxOverlap:90,boxDefaultY:0,boxMinWidth:80,boxMaxWidth:450,boxMinHeight:80,boxMaxHeight:750,contentStartX:250,textMaxWidth:430,boxTextFontWeight:"bold",boxTextPadding:10,swimlaneTextFontWeight:"bold",labelUiAutomation:"UI/Automation",labelUiAutomationPrefix:"UI/A: ",labelCommandReadModel:"Command/Read Model",labelCommandReadModelPrefix:"C/RM: ",labelEvents:"Events",labelEventsPrefix:"Stream: "};function I(){return d}t(I,"getDiagramProps");var Pe={boxes:[],swimlanes:{},relations:[],maxR:0,sortedSwimlanesArray:[]};function K(e){let i=e.split(".");if(i.length===2)return i[0];return}t(K,"extractNamespace");function q(e){let i=e.split(".");if(i.length===2)return i[1];return e}t(q,"extractName");function Q(e,i){if(!i||i.length===0)return;return Object.values(e).find((n)=>n.namespace===i)}t(Q,"findSwimlaneByNamespace");function y(e,i,n){return Math.max(i,...Object.keys(e).filter((r)=>{let o=Number.parseInt(r);return o>i&&o<n}).map((r)=>Number.parseInt(r)))+1}t(y,"findNextAvailableIndex");function Z(e,i){let n=K(e.entityIdentifier),r=Q(i,n);switch(e.modelEntityType){case"ui":case"pcr":case"processor":if(r)return{index:r.index,label:r.namespace||d.labelUiAutomation};else if(n)return{index:y(i,0,100),label:d.labelUiAutomationPrefix+n};return{index:0,label:d.labelUiAutomation};case"rmo":case"readmodel":case"cmd":case"command":if(r)return{index:r.index,label:r.namespace||d.labelCommandReadModel};else if(n)return{index:y(i,100,200),label:d.labelCommandReadModelPrefix+n};return{index:100,label:d.labelCommandReadModel};case"evt":case"event":default:if(r)return{index:r.index,label:r.namespace||d.labelEvents};else if(n)return{index:y(i,200,300),label:d.labelEventsPrefix+n};return{index:200,label:d.labelEvents}}}t(Z,"calculateSwimlaneProps");function ee(e){let{themeVariables:i}=x();switch(e.modelEntityType){case"ui":return{fill:i.emUiFill??"white",stroke:i.emUiStroke??"#dbdada"};case"pcr":case"processor":return{fill:i.emProcessorFill??"#edb3f6",stroke:i.emProcessorStroke??"#b88cbf"};case"rmo":case"readmodel":return{fill:i.emReadModelFill??"#d3f1a2",stroke:i.emReadModelStroke??"#a3b732"};case"cmd":case"command":return{fill:i.emCommandFill??"#bcd6fe",stroke:i.emCommandStroke??"#679ac3"};case"evt":case"event":return{fill:i.emEventFill??"#ffb778",stroke:i.emEventStroke??"#c19a0f"};default:return{fill:"red",stroke:"black"}}}t(ee,"calculateEntityVisualProps");function te(e,i,n){let r=x(),o=O(q(e.entityIdentifier)??"",r),s,c={fontSize:16,fontWeight:700,fontFamily:'"trebuchet ms", verdana, arial, sans-serif',joinWith:"<br/>"},u=`<b>${Nn(o,n.textMaxWidth,c)}</b>`;if(e.dataInlineValue)s=e.dataInlineValue,s=s.substring(s.indexOf("{")+1),s=s.substring(0,s.lastIndexOf("}")-1),s=O(s,r),s=Nn(s,n.textMaxWidth,c),s=s.replaceAll(" ","&nbsp;");if(e.dataReference){let w=i.find((k)=>k.name===e.dataReference?.$refText);if(w)s=w.dataBlockValue,s=s.substring(s.indexOf(`{
2
- `)+2),s=s.substring(0,s.lastIndexOf("}")-1),s=O(s,r),s=Nn(s,n.textMaxWidth,c),s=s.replaceAll(" ","&nbsp;"),s+="<br/>"}let f=s!==void 0;if(f)u+=`<br/><br/><code style="text-align: left; display: block;max-width:${n.textMaxWidth}px">${s}</code>`;let h={fontSize:c.fontSize,fontWeight:c.fontWeight,fontFamily:c.fontFamily},g=Jr(u,h),b=f?g.width/3:g.width,v={content:u,width:b,height:g.height};return a.debug(`[${e.name}] ${e.entityIdentifier} text`,v),v}t(te,"calculateTextProps");function ne(e,i){let n=i,r=ee(n.frame),o={width:n.textProps.width+2*d.boxTextPadding,height:n.textProps.height+2*d.boxTextPadding};return[{$kind:V,frame:n.frame,index:n.index,visual:r,dimension:o,textProps:n.textProps}]}t(ne,"decidePositionFrame");function ie(e,i,n){if(i===void 0)return d.contentStartX;if(i.index===e.index&&e.r)return e.r+d.boxPadding;if(n===void 0)return d.contentStartX;return n.r-d.boxOverlap+d.boxPadding}t(ie,"calculateX");function re(e,i){let n=[...e.map((r)=>r.r),i];return Math.max(...n)}t(re,"calculateMaxRight");function W(e){return Object.values(e).sort((i,n)=>i.index-n.index)}t(W,"sortedSwimlanesArray");function ae(e,i){let n=i,r=Z(n.frame,e.swimlanes),o;if(r.index in e.swimlanes)o=e.swimlanes[r.index];else o={index:r.index,label:r.label,r:0,y:r.index*d.swimlaneMinHeight+d.swimlaneGap,height:d.swimlaneMinHeight,maxHeight:d.swimlaneMinHeight};let s=e.boxes.length>0?e.boxes[e.boxes.length-1]:void 0,c=e.previousSwimlaneNumber!==void 0?e.swimlanes[e.previousSwimlaneNumber]:void 0,m={width:Math.max(d.boxMinWidth,Math.min(d.boxMaxWidth,n.dimension.width))+2*d.boxPadding,height:Math.max(d.boxMinHeight,Math.min(d.boxMaxHeight,n.dimension.height))+2*d.boxPadding},u=ie(o,c,s),f=u+m.width+d.boxPadding,h=re(Object.values(e.swimlanes),f);o.r=u+m.width,o.maxHeight=Math.max(o.maxHeight,m.height),o.height=Math.max(d.swimlaneMinHeight,o.maxHeight)+2*d.swimlanePadding;let g={x:u,y:d.swimlanePadding+o.y,r:f,dimension:m,leftSibling:!1,swimlane:o,visual:n.visual,text:n.textProps.content,frame:n.frame,index:n.index},b={...e,boxes:[...e.boxes,g],swimlanes:{...e.swimlanes,[`${o.index}`]:o},previousSwimlaneNumber:r.index,previousFrame:n.frame,maxR:h},v=W(b.swimlanes);if(v.length>0)v[0].y=0;for(let w=1;w<v.length;w++){let k=v[w],_=v[w-1];k.y=_.y+_.height+d.swimlaneGap}return b}t(ae,"evolveFramePositioned");function oe(e,i){if(e===0&&i.sourceFrames.length===0)return!0;return!1}t(oe,"isFirstFrame");function se(e){return e.sourceFrames!==void 0&&e.sourceFrames!==null&&e.sourceFrames.length>0}t(se,"hasSourceFrame");function B(e,i){if(i===void 0||i===null)return;return e.find((n)=>n.frame.name===i.name)}t(B,"findBoxByFrame");function de(e,i,n){if(n<0)return;for(let r=n;r>=0;r--){let o=e[r];if(o.swimlane.index!==i)return o}return}t(de,"findBoxByLineIndex");function le(e,i){let n=i;if(oe(n.index,n.frame))return[];let r=B(e.boxes,n.frame);if(r===void 0)throw Error(`Target box not found for frame ${n.frame.name}`);let o;if(n.sourceFrame)o=B(e.boxes,n.sourceFrame);else{if(zr(n.frame))return[];o=de(e.boxes,r.swimlane.index,n.index-1)}if(o===void 0)return[];return[{$kind:X,frame:n.frame,index:n.index,sourceBox:o,targetBox:r}]}t(le,"decidePositionRelation");function ce(e,i){let n=i,r={visual:{fill:"none",stroke:"#000"},source:{x:n.sourceBox.x,y:n.sourceBox.y},target:{x:n.targetBox.x,y:n.targetBox.y},sourceBox:n.sourceBox,targetBox:n.targetBox};return{...e,relations:[...e.relations,r]}}t(ce,"evolveRelationPositioned");var Se={[G]:ne,[F]:le},Me={[V]:ae,[X]:ce};function me(e,i){let n=Se[i.$kind];if(n===void 0||n===null)return[];let r=n(e,i);return a.debug("decided events",r),r}t(me,"decide");function ue(e,i){let n=i.reduce((r,o)=>{let s=Me[o.$kind];if(s===void 0||s===null)return r;return s(r,o)},e);return a.debug("evolve events",{state:e,newState:n,events:i}),n}t(ue,"evolve");function P(e,i){let n=me(e,i);return ue(e,n)}t(P,"dispatch");var D={getConfig:ye,preserveCommentsWhenParsing:!0,setOptions:pe,getOptions:ve,clear:be,setAccTitle:S,getAccTitle:E,getAccDescription:A,setAccDescription:T,setDiagramTitle:L,getDiagramTitle:R,setAst:z,getDiagramProps:I,getState:Y},ke={parse:t(async(e)=>{let i=await J("eventmodeling",e);a.debug(i),D.setAst(i),H(i,D)},"parse")},Fe=l(),Be=Fe?.eventmodeling;function xe(e,i){return(n)=>{let r=n.swimlane.y+i.swimlanePadding,o=e.append("g").attr("class","em-box");o.append("rect").attr("x",n.x).attr("y",r).attr("rx","3").attr("width",n.dimension.width).attr("height",n.dimension.height).attr("stroke",n.visual.stroke).attr("fill",n.visual.fill),o.append("foreignObject").attr("x",n.x+i.boxPadding).attr("y",r+10).attr("width",n.dimension.width-2*i.boxPadding).attr("height",n.dimension.height-2*i.boxPadding).append("xhtml:div").style("display","table").style("height","100%").style("width","100%").append("span").style("display","table-cell").style("text-align","center").style("vertical-align","middle").html(n.text)}}t(xe,"renderD3Box");function fe(e,i){return e>i}t(fe,"dirUpwards");function ge(e,i,n,r){return(o)=>{let s=o.sourceBox.swimlane.y+i.swimlanePadding,c=o.targetBox.swimlane.y+i.swimlanePadding,m=fe(s,c),u=o.sourceBox.x+o.sourceBox.dimension.width*2/3,f=o.targetBox.x+o.targetBox.dimension.width/3,h,g;if(a.debug(`rendering relation up=${m} for `,{sourceBox:o.sourceBox,targetBox:o.targetBox}),m)h=s,g=c+o.targetBox.dimension.height;else h=s+o.sourceBox.dimension.height,g=c;let b=r.emRelationStroke??o.visual.stroke;e.append("path").attr("class","em-relation").attr("fill",o.visual.fill).attr("stroke",b).attr("stroke-width","1").attr("marker-end",`url(#${n})`).attr("d",`M${u} ${h} L${f} ${g}`)}}t(ge,"renderD3Relation");function he(e,i,n,r){return(o)=>{let s=e.append("g").attr("class","em-swimlane"),c=r.emSwimlaneBackgroundOdd??"rgb(250,250,250)",m=r.emSwimlaneBackgroundStroke??"rgb(240,240,240)";s.append("rect").attr("x",0).attr("y",o.y).attr("rx","3").attr("width",i+n.swimlanePadding).attr("height",o.height).attr("fill",c).attr("stroke",m),s.append("text").attr("font-weight",n.swimlaneTextFontWeight).attr("x",30).attr("y",o.y+30).text(o.label)}}t(he,"renderD3Swimlane");var Ee=t(function(e,i,n,r){if(a.debug("in eventmodeling renderer",e+`
3
- `,"id:",i,n),!Be)throw Error("EventModeling config not found");let o=r.db,{themeVariables:s,eventmodeling:c}=l(),m=p(`[id="${i}"]`),u=o.getDiagramProps(),f=o.getState(),h=`em-arrowhead-${i}`,g=s.emArrowhead??"#000000";f.sortedSwimlanesArray.forEach(he(m,f.maxR,u,s)),f.boxes.forEach(xe(m,u)),f.relations.forEach(ge(m,u,h,s)),m.append("defs").append("marker").attr("id",h).attr("markerWidth","10").attr("markerHeight","7").attr("refX","10").attr("refY","3.5").attr("orient","auto").append("polygon").attr("points","0 0, 10 3.5, 0 7").attr("fill",g),kr(void 0,m,c?.padding??30,c?.useMaxWidth)},"draw"),Ae={draw:Ee},$e=t((e)=>"","getStyles"),Re=$e,Ue={parser:ke,db:D,renderer:Ae,styles:Re};export{Ue as diagram};
1
+ import{H}from"./chunk-p79c7aak.js";import{t,a,N,x,O,C,S,E,T,A,L,R,l,Sr,p,Mn,ta,j}from"./chunk-zsat72qd.js";import{jr,J}from"./chunk-p4pqtybm.js";var _="position frame",G="frame positioned",F="position relation",V="relation positioned",pe=t(function(e){a.debug("options str",e)},"setOptions"),ve=t(function(){return{}},"getOptions"),be=t(function(){X(),C()},"clear");function X(){M={}}t(X,"reset");var we=N.eventmodeling,ye=t(()=>j({...we,...x().eventmodeling}),"getConfig"),M={};function Y(){let e=Pe,{ast:i}=M,n=I();if(!i)throw Error("No data for EventModel");return i.frames.forEach((r,o)=>{let s=te(r,i.dataEntities,n);e=P(e,{$kind:_,index:o,frame:r,textProps:s});let c=void 0;if(se(r))a.debug("source frame",r.sourceFrames),c=i.frames.filter((m)=>r.sourceFrames.some((u)=>u.$refText===m.name)),c.forEach((m)=>{e=P(e,{$kind:F,index:o,frame:r,sourceFrame:m})});else e=P(e,{$kind:F,index:o,frame:r})}),e={...e,sortedSwimlanesArray:W(e.swimlanes)},e}t(Y,"getState");function z(e){M.ast=void 0;let i=new Set;for(let n of e.frames){if(i.has(n.name)){let r=n.$cstNode?.range.start.line,o=r===void 0?"":` on line ${r+1}`;throw Error(`Duplicate event modeling frame ID "${n.name}"${o}`)}i.add(n.name)}M.ast=e}t(z,"setAst");var d={swimlaneMinHeight:70,swimlanePadding:15,swimlaneGap:10,boxPadding:10,boxOverlap:90,boxDefaultY:0,boxMinWidth:80,boxMaxWidth:450,boxMinHeight:80,boxMaxHeight:750,contentStartX:250,textMaxWidth:430,boxTextFontWeight:"bold",boxTextPadding:10,swimlaneTextFontWeight:"bold",labelUiAutomation:"UI/Automation",labelUiAutomationPrefix:"UI/A: ",labelCommandReadModel:"Command/Read Model",labelCommandReadModelPrefix:"C/RM: ",labelEvents:"Events",labelEventsPrefix:"Stream: "};function I(){return d}t(I,"getDiagramProps");var Pe={boxes:[],swimlanes:{},relations:[],maxR:0,sortedSwimlanesArray:[]};function K(e){let i=e.split(".");if(i.length===2)return i[0];return}t(K,"extractNamespace");function q(e){let i=e.split(".");if(i.length===2)return i[1];return e}t(q,"extractName");function Q(e,i){if(!i||i.length===0)return;return Object.values(e).find((n)=>n.namespace===i)}t(Q,"findSwimlaneByNamespace");function y(e,i,n){return Math.max(i,...Object.keys(e).filter((r)=>{let o=Number.parseInt(r);return o>i&&o<n}).map((r)=>Number.parseInt(r)))+1}t(y,"findNextAvailableIndex");function Z(e,i){let n=K(e.entityIdentifier),r=Q(i,n);switch(e.modelEntityType){case"ui":case"pcr":case"processor":if(r)return{index:r.index,label:r.namespace||d.labelUiAutomation};else if(n)return{index:y(i,0,100),label:d.labelUiAutomationPrefix+n};return{index:0,label:d.labelUiAutomation};case"rmo":case"readmodel":case"cmd":case"command":if(r)return{index:r.index,label:r.namespace||d.labelCommandReadModel};else if(n)return{index:y(i,100,200),label:d.labelCommandReadModelPrefix+n};return{index:100,label:d.labelCommandReadModel};case"evt":case"event":default:if(r)return{index:r.index,label:r.namespace||d.labelEvents};else if(n)return{index:y(i,200,300),label:d.labelEventsPrefix+n};return{index:200,label:d.labelEvents}}}t(Z,"calculateSwimlaneProps");function ee(e){let{themeVariables:i}=x();switch(e.modelEntityType){case"ui":return{fill:i.emUiFill??"white",stroke:i.emUiStroke??"#dbdada"};case"pcr":case"processor":return{fill:i.emProcessorFill??"#edb3f6",stroke:i.emProcessorStroke??"#b88cbf"};case"rmo":case"readmodel":return{fill:i.emReadModelFill??"#d3f1a2",stroke:i.emReadModelStroke??"#a3b732"};case"cmd":case"command":return{fill:i.emCommandFill??"#bcd6fe",stroke:i.emCommandStroke??"#679ac3"};case"evt":case"event":return{fill:i.emEventFill??"#ffb778",stroke:i.emEventStroke??"#c19a0f"};default:return{fill:"red",stroke:"black"}}}t(ee,"calculateEntityVisualProps");function te(e,i,n){let r=x(),o=O(q(e.entityIdentifier)??"",r),s,c={fontSize:16,fontWeight:700,fontFamily:'"trebuchet ms", verdana, arial, sans-serif',joinWith:"<br/>"},u=`<b>${Mn(o,n.textMaxWidth,c)}</b>`;if(e.dataInlineValue)s=e.dataInlineValue,s=s.substring(s.indexOf("{")+1),s=s.substring(0,s.lastIndexOf("}")-1),s=O(s,r),s=Mn(s,n.textMaxWidth,c),s=s.replaceAll(" ","&nbsp;");if(e.dataReference){let w=i.find((k)=>k.name===e.dataReference?.$refText);if(w)s=w.dataBlockValue,s=s.substring(s.indexOf(`{
2
+ `)+2),s=s.substring(0,s.lastIndexOf("}")-1),s=O(s,r),s=Mn(s,n.textMaxWidth,c),s=s.replaceAll(" ","&nbsp;"),s+="<br/>"}let f=s!==void 0;if(f)u+=`<br/><br/><code style="text-align: left; display: block;max-width:${n.textMaxWidth}px">${s}</code>`;let h={fontSize:c.fontSize,fontWeight:c.fontWeight,fontFamily:c.fontFamily},g=ta(u,h),b=f?g.width/3:g.width,v={content:u,width:b,height:g.height};return a.debug(`[${e.name}] ${e.entityIdentifier} text`,v),v}t(te,"calculateTextProps");function ne(e,i){let n=i,r=ee(n.frame),o={width:n.textProps.width+2*d.boxTextPadding,height:n.textProps.height+2*d.boxTextPadding};return[{$kind:G,frame:n.frame,index:n.index,visual:r,dimension:o,textProps:n.textProps}]}t(ne,"decidePositionFrame");function ie(e,i,n){if(i===void 0)return d.contentStartX;if(i.index===e.index&&e.r)return e.r+d.boxPadding;if(n===void 0)return d.contentStartX;return n.r-d.boxOverlap+d.boxPadding}t(ie,"calculateX");function re(e,i){let n=[...e.map((r)=>r.r),i];return Math.max(...n)}t(re,"calculateMaxRight");function W(e){return Object.values(e).sort((i,n)=>i.index-n.index)}t(W,"sortedSwimlanesArray");function ae(e,i){let n=i,r=Z(n.frame,e.swimlanes),o;if(r.index in e.swimlanes)o=e.swimlanes[r.index];else o={index:r.index,label:r.label,r:0,y:r.index*d.swimlaneMinHeight+d.swimlaneGap,height:d.swimlaneMinHeight,maxHeight:d.swimlaneMinHeight};let s=e.boxes.length>0?e.boxes[e.boxes.length-1]:void 0,c=e.previousSwimlaneNumber!==void 0?e.swimlanes[e.previousSwimlaneNumber]:void 0,m={width:Math.max(d.boxMinWidth,Math.min(d.boxMaxWidth,n.dimension.width))+2*d.boxPadding,height:Math.max(d.boxMinHeight,Math.min(d.boxMaxHeight,n.dimension.height))+2*d.boxPadding},u=ie(o,c,s),f=u+m.width+d.boxPadding,h=re(Object.values(e.swimlanes),f);o.r=u+m.width,o.maxHeight=Math.max(o.maxHeight,m.height),o.height=Math.max(d.swimlaneMinHeight,o.maxHeight)+2*d.swimlanePadding;let g={x:u,y:d.swimlanePadding+o.y,r:f,dimension:m,leftSibling:!1,swimlane:o,visual:n.visual,text:n.textProps.content,frame:n.frame,index:n.index},b={...e,boxes:[...e.boxes,g],swimlanes:{...e.swimlanes,[`${o.index}`]:o},previousSwimlaneNumber:r.index,previousFrame:n.frame,maxR:h},v=W(b.swimlanes);if(v.length>0)v[0].y=0;for(let w=1;w<v.length;w++){let k=v[w],U=v[w-1];k.y=U.y+U.height+d.swimlaneGap}return b}t(ae,"evolveFramePositioned");function oe(e,i){if(e===0&&i.sourceFrames.length===0)return!0;return!1}t(oe,"isFirstFrame");function se(e){return e.sourceFrames!==void 0&&e.sourceFrames!==null&&e.sourceFrames.length>0}t(se,"hasSourceFrame");function B(e,i){if(i===void 0||i===null)return;return e.find((n)=>n.frame.name===i.name)}t(B,"findBoxByFrame");function de(e,i,n){if(n<0)return;for(let r=n;r>=0;r--){let o=e[r];if(o.swimlane.index!==i)return o}return}t(de,"findBoxByLineIndex");function le(e,i){let n=i;if(oe(n.index,n.frame))return[];let r=B(e.boxes,n.frame);if(r===void 0)throw Error(`Target box not found for frame ${n.frame.name}`);let o;if(n.sourceFrame)o=B(e.boxes,n.sourceFrame);else{if(jr(n.frame))return[];o=de(e.boxes,r.swimlane.index,n.index-1)}if(o===void 0)return[];return[{$kind:V,frame:n.frame,index:n.index,sourceBox:o,targetBox:r}]}t(le,"decidePositionRelation");function ce(e,i){let n=i,r={visual:{fill:"none",stroke:"#000"},source:{x:n.sourceBox.x,y:n.sourceBox.y},target:{x:n.targetBox.x,y:n.targetBox.y},sourceBox:n.sourceBox,targetBox:n.targetBox};return{...e,relations:[...e.relations,r]}}t(ce,"evolveRelationPositioned");var Se={[_]:ne,[F]:le},Me={[G]:ae,[V]:ce};function me(e,i){let n=Se[i.$kind];if(n===void 0||n===null)return[];let r=n(e,i);return a.debug("decided events",r),r}t(me,"decide");function ue(e,i){let n=i.reduce((r,o)=>{let s=Me[o.$kind];if(s===void 0||s===null)return r;return s(r,o)},e);return a.debug("evolve events",{state:e,newState:n,events:i}),n}t(ue,"evolve");function P(e,i){let n=me(e,i);return ue(e,n)}t(P,"dispatch");var D={getConfig:ye,preserveCommentsWhenParsing:!0,setOptions:pe,getOptions:ve,clear:be,setAccTitle:S,getAccTitle:E,getAccDescription:A,setAccDescription:T,setDiagramTitle:L,getDiagramTitle:R,setAst:z,getDiagramProps:I,getState:Y},ke={parse:t(async(e)=>{let i=await J("eventmodeling",e);a.debug(i),D.setAst(i),H(i,D)},"parse")},Fe=l(),Be=Fe?.eventmodeling;function xe(e,i){return(n)=>{let r=n.swimlane.y+i.swimlanePadding,o=e.append("g").attr("class","em-box");o.append("rect").attr("x",n.x).attr("y",r).attr("rx","3").attr("width",n.dimension.width).attr("height",n.dimension.height).attr("stroke",n.visual.stroke).attr("fill",n.visual.fill),o.append("foreignObject").attr("x",n.x+i.boxPadding).attr("y",r+10).attr("width",n.dimension.width-2*i.boxPadding).attr("height",n.dimension.height-2*i.boxPadding).append("xhtml:div").style("display","table").style("height","100%").style("width","100%").append("span").style("display","table-cell").style("text-align","center").style("vertical-align","middle").html(n.text)}}t(xe,"renderD3Box");function fe(e,i){return e>i}t(fe,"dirUpwards");function ge(e,i,n,r){return(o)=>{let s=o.sourceBox.swimlane.y+i.swimlanePadding,c=o.targetBox.swimlane.y+i.swimlanePadding,m=fe(s,c),u=o.sourceBox.x+o.sourceBox.dimension.width*2/3,f=o.targetBox.x+o.targetBox.dimension.width/3,h,g;if(a.debug(`rendering relation up=${m} for `,{sourceBox:o.sourceBox,targetBox:o.targetBox}),m)h=s,g=c+o.targetBox.dimension.height;else h=s+o.sourceBox.dimension.height,g=c;let b=r.emRelationStroke??o.visual.stroke;e.append("path").attr("class","em-relation").attr("fill",o.visual.fill).attr("stroke",b).attr("stroke-width","1").attr("marker-end",`url(#${n})`).attr("d",`M${u} ${h} L${f} ${g}`)}}t(ge,"renderD3Relation");function he(e,i,n,r){return(o)=>{let s=e.append("g").attr("class","em-swimlane"),c=r.emSwimlaneBackgroundOdd??"rgb(250,250,250)",m=r.emSwimlaneBackgroundStroke??"rgb(240,240,240)";s.append("rect").attr("x",0).attr("y",o.y).attr("rx","3").attr("width",i+n.swimlanePadding).attr("height",o.height).attr("fill",c).attr("stroke",m),s.append("text").attr("font-weight",n.swimlaneTextFontWeight).attr("x",30).attr("y",o.y+30).text(o.label)}}t(he,"renderD3Swimlane");var Ee=t(function(e,i,n,r){if(a.debug("in eventmodeling renderer",e+`
3
+ `,"id:",i,n),!Be)throw Error("EventModeling config not found");let o=r.db,{themeVariables:s,eventmodeling:c}=l(),m=p(`[id="${i}"]`),u=o.getDiagramProps(),f=o.getState(),h=`em-arrowhead-${i}`,g=s.emArrowhead??"#000000";f.sortedSwimlanesArray.forEach(he(m,f.maxR,u,s)),f.boxes.forEach(xe(m,u)),f.relations.forEach(ge(m,u,h,s)),m.append("defs").append("marker").attr("id",h).attr("markerWidth","10").attr("markerHeight","7").attr("refX","10").attr("refY","3.5").attr("orient","auto").append("polygon").attr("points","0 0, 10 3.5, 0 7").attr("fill",g),Sr(void 0,m,c?.padding??30,c?.useMaxWidth)},"draw"),Ae={draw:Ee},$e=t((e)=>"","getStyles"),Re=$e,Ue={parser:ke,db:D,renderer:Ae,styles:Re};export{Ue as diagram};
@@ -1 +1 @@
1
- import{o,i,r,it,m,e,n,y,Mr,s,K,pn,ot,ie,tr,Z}from"./chunk-ve8gy05p.js";var ke=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]],L=s("at-sign",ke);var Ce=[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]],pe=s("file-code-2",Ce);var we=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],ue=s("maximize-2",we);var Me=[["path",{d:"M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4",key:"re6nr2"}],["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["path",{d:"M21.378 5.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"pqwjuv"}]],te=s("notebook-pen",Me);var Ie=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],xe=s("user",Ie);var w={approve:{label:"通过",text:"text-success",ring:"ring-success/80",soft:"bg-success/12 text-success"},reject:{label:"反对",text:"text-danger",ring:"ring-danger/80",soft:"bg-danger/12 text-danger"},abstain:{label:"弃权",text:"text-dim",ring:"ring-line-strong",soft:"bg-raised text-dim"},pending:{label:"未表态",text:"text-faint",ring:"ring-line",soft:"bg-raised text-faint"}},ze={thinking:"思考中",reading:"查阅中",speaking:"发言中",idle:"等待中",error:"出错",aborted:"已中止"},F={success:"text-success",warning:"text-warning",danger:"text-danger",neutral:"text-faint"},ne={success:"bg-success",warning:"bg-warning",danger:"bg-danger",neutral:"bg-faint"};function V(t){return t==="thinking"||t==="reading"||t==="speaking"}function W(t){let u=V(t.status);return{busy:u,text:u&&t.activeTool?t.activeTool:ze[t.status]}}function se(t){let u=t.members.filter((b)=>b.verdict==="approve").length,f=t.members.filter((b)=>b.verdict==="reject").length;if(t.state==="running"){if(t.phase==="research")return{tone:"warning",label:"调研中"};if(t.phase==="opening")return{tone:"warning",label:"开场表态"};return{tone:"warning",label:"群聊交流"}}if(t.state==="consensus"){if(u===t.members.length)return{tone:"success",label:"全票通过"};if(f===t.members.length)return{tone:"danger",label:"全票反对"};if(f>u)return{tone:"danger",label:"共识:反对"};return{tone:"success",label:"共识:通过"}}if(t.state==="diverged")return{tone:"warning",label:"存在分歧"};if(t.state==="error")return{tone:"danger",label:"失败"};return{tone:"neutral",label:"已中止"}}function G(t){let u=Math.max(1,Math.round(t/1000));if(u<60)return`${u}s`;return`${Math.floor(u/60)}m ${String(u%60).padStart(2,"0")}s`}var De={research:"调研",opening:"开场表态",discussion:"群聊交流"};function J(t){let{cn:u}=y(),{room:f}=t,b=se(f),g=f.state==="running",v=f.research?["research","opening","discussion"]:["opening","discussion"],a=g?v.indexOf(f.phase==="closed"?"discussion":f.phase??"discussion"):-1,h=[...v.map((d,p)=>({key:d,label:De[d],done:!g||p<a,active:p===a})),{key:"closed",label:g?"结论":b.label,done:!g,active:!1}];return e("ol",{className:u("flex min-w-0 gap-1",t.className),children:h.map((d,p)=>{let c=p===h.length-1&&!g;return n("li",{className:"min-w-0 flex-1",children:[e("span",{className:u("block h-[3px] rounded-full transition-colors duration-300",c?ne[b.tone]:d.active?"bg-accent animate-pulse":d.done?"bg-line-strong":"bg-line/60")}),e("span",{className:u("mt-1.5 block truncate text-[11px]",c?u("font-medium",F[b.tone]):d.active?"font-medium text-ink":d.done?"text-dim":"text-faint"),children:d.label})]},d.key)})})}function ge(t){let{Collapsible:u,CollapsibleContent:f,Composer:b,Markdown:g,ModelIcon:v,ScrollArea:a,SessionView:h,cn:d,confirm:p}=y(),{room:c,onClose:C}=t,[M,x]=r(!1),[X,D]=r(""),[R,H]=r(!1),[_,E]=r(),[S,B]=r(!1),[N,I]=r(!0),[T,z]=r(),ae=i(!1);ae.current=T!==void 0;let[U,Y]=r(),[oe,A]=r(!1),re=i(!1);re.current=U!==void 0;let le=(l)=>{A(!1),Y(l)},ce=i(null),Q=i(null),P=c.state==="running",j=se(c),be=new Map(c.members.map((l)=>[l.id,l]));o(()=>{let l=(de)=>{if(de.key!=="Escape"||de.defaultPrevented||ae.current)return;if(re.current)A(!0);else x(!0)},k=document.body.style.overflow;return document.body.style.overflow="hidden",window.addEventListener("keydown",l),()=>{window.removeEventListener("keydown",l),document.body.style.overflow=k}},[]);let me=c.messages.length;o(()=>{let l=Q.current;if(!l||!N||me===0)return;l.scrollTo({top:l.scrollHeight,behavior:"smooth"})},[me,N]);let ve=async(l)=>{await t.onPost(l),I(!0)},he=async()=>{if(R)return;if(!await p({title:"中止理事会?",description:"所有成员会立即停止,已有发言保留。",action:"中止",danger:!0}))return;H(!0),E(void 0);try{await t.onAbort()}catch(k){E(k instanceof Error?k.message:"中止理事会失败")}finally{H(!1)}},ee=(l)=>{Y(void 0),D((k)=>k.includes(`@${l}`)?k:`${k?`${k.trimEnd()} `:""}@${l} `),requestAnimationFrame(()=>ce.current?.focus())},Ne=c.members.filter((l)=>l.verdict==="approve").length,ye=c.members.filter((l)=>l.verdict==="reject").length,q=c.members.find((l)=>l.id===T),O=c.members.find((l)=>l.id===U);return it(n("div",{role:"dialog","aria-modal":"true","aria-label":`理事会:${c.topic}`,onAnimationEnd:(l)=>{if(M&&l.target===l.currentTarget)C()},className:d("fixed inset-0 z-50 flex flex-col bg-bg pt-[env(safe-area-inset-top)] text-ink",M?"pointer-events-none animate-dialog-out":"animate-dialog-in"),children:[n(u,{open:S,onOpenChange:B,className:"shrink-0 border-b border-line px-4 pt-3 pb-3 sm:px-6",children:[n("div",{className:"flex items-start gap-3",children:[n("div",{className:"min-w-0 flex-1",children:[n("div",{className:"flex items-center gap-3 text-[11px] text-faint",children:[e("span",{className:"font-medium tracking-[0.2em] text-dim",children:"COUNCIL"}),e("span",{className:"tabular-nums",children:G(t.elapsedMs)}),n("span",{className:"tabular-nums",children:[c.messages.length," 条发言"]})]}),n("button",{type:"button","aria-expanded":S,onClick:()=>B((l)=>!l),className:"mt-0.5 flex max-w-full cursor-pointer items-start gap-1.5 text-left md:items-center",children:[e("h2",{className:"line-clamp-2 text-[15px] leading-snug font-semibold md:truncate md:text-lg",children:c.topic}),e(ie,{className:d("mt-0.5 size-4 shrink-0 text-faint transition-transform duration-300 ease-out-quint md:mt-0",!S&&"-rotate-90")})]})]}),n("div",{className:"flex shrink-0 items-center gap-1",children:[n("span",{className:d("inline-flex items-center gap-1.5 rounded-full border border-line px-2.5 py-1 text-xs font-medium",F[j.tone]),children:[e("span",{className:d("size-1.5 rounded-full",ne[j.tone],P&&"animate-pulse")}),j.label]}),e("button",{type:"button","aria-label":"关闭理事会页面",title:"关闭(Esc)",onClick:()=>x(!0),className:"ml-1 inline-flex size-10 -mr-2 cursor-pointer items-center justify-center rounded-full text-faint transition-colors hover:bg-raised hover:text-ink md:size-8 md:mr-0",children:e(Z,{className:"size-4"})})]})]}),e(f,{children:e("div",{className:"mt-2 max-h-[40dvh] overflow-y-auto overscroll-contain rounded-xl bg-panel px-3.5 py-2.5 text-[13px] leading-relaxed text-dim md:max-h-48",children:e(g,{text:c.brief})})}),e(J,{room:c,className:"mt-3"})]}),n("div",{className:"flex min-h-0 flex-1 flex-col md:flex-row",children:[e("div",{className:"flex shrink-0 gap-2 overflow-x-auto overscroll-x-contain border-b border-line px-4 py-2.5 [scrollbar-width:none] md:hidden",children:c.members.map((l)=>e(Se,{member:l,onSelect:()=>z(l.id)},l.id))}),n("aside",{className:"hidden w-72 shrink-0 flex-col gap-2 overflow-y-auto border-r border-line p-4 md:flex",children:[n("div",{className:"flex items-center justify-between text-[11px] text-faint",children:[e("span",{className:"font-medium tracking-wide",children:"席位"}),n("span",{className:"tabular-nums",children:[e("span",{className:"text-success",children:Ne})," / ",e("span",{className:"text-danger",children:ye})," /"," ",c.members.length]})]}),c.members.map((l)=>e(Re,{member:l,viewing:l.id===U,onMention:()=>ee(l.name),onOpen:()=>l.id===U?A(!0):le(l.id)},l.id))]}),O&&n("main",{onAnimationEnd:(l)=>{if(!oe||l.target!==l.currentTarget)return;A(!1),Y(void 0)},className:d("flex min-h-0 min-w-0 flex-1 flex-col",oe?"pointer-events-none animate-overlay-out":"animate-fade"),children:[n("div",{className:"flex shrink-0 items-center gap-2 border-b border-line px-3 py-2 sm:px-4",children:[n("button",{type:"button",onClick:()=>A(!0),className:"inline-flex h-8 cursor-pointer items-center gap-1.5 rounded-lg px-2 text-[13px] text-dim transition-colors hover:bg-raised hover:text-ink",children:[e(pn,{className:"size-4"}),"群聊"]}),e("span",{className:"text-line-strong",children:"/"}),n("span",{className:"flex min-w-0 flex-1 items-center gap-1.5 text-[13px] font-medium",children:[e(v,{modelID:O.model,className:"size-4 shrink-0",size:16}),n("span",{className:"truncate",children:[O.name," 的推理过程"]})]}),e("button",{type:"button","aria-label":"在完整页面打开",title:"在完整页面打开",onClick:()=>t.onOpenMember(O.childSessionID),className:"inline-flex size-8 cursor-pointer items-center justify-center rounded-lg text-faint transition-colors hover:bg-raised hover:text-ink",children:e(ot,{className:"size-4"})})]}),e(h,{sessionID:O.childSessionID},O.childSessionID)]}),n("main",{className:d("min-h-0 min-w-0 flex-1 flex-col animate-fade",O?"hidden":"flex"),children:[e(a,{viewportRef:Q,onScrollCapture:(l)=>{let k=Q.current;if(!k||l.target!==k)return;I(k.scrollHeight-k.scrollTop-k.clientHeight<80)},children:n("div",{className:"mx-auto w-full max-w-3xl px-4 py-4 sm:px-6 md:py-5",children:[c.messages.length===0?n("div",{className:"flex flex-col items-center justify-center gap-3 py-24 text-center text-faint",children:[P?e(K,{className:"size-5 animate-spin"}):null,e("p",{className:"text-sm",children:P?c.phase==="research"?"成员正在各自调研,笔记不会进入群聊":"成员正在独立准备开场观点,彼此不可见":"这场理事会没有产生发言"})]}):e("ol",{className:"space-y-5",children:c.messages.map((l)=>e(Te,{message:l,membersByID:be,onMention:()=>ee(l.senderName)},l.floor))}),c.summary&&!P&&n("section",{className:"mt-8 rounded-2xl border border-line bg-panel px-4 py-3",children:[n("h3",{className:d("text-xs font-semibold",F[j.tone]),children:["结论:",j.label]}),e("div",{className:"mt-1.5 text-[13px] leading-relaxed text-dim",children:e(g,{text:c.summary})})]})]})}),e("div",{className:"shrink-0 px-3 pb-[max(0.75rem,env(safe-area-inset-bottom))] sm:px-6 md:pb-4",children:n("div",{className:"mx-auto w-full max-w-3xl",children:[_&&e("p",{role:"status",className:"px-1 pb-2 text-[13px] text-danger",children:_}),e(b,{draftKey:`council:${c.roomID}`,placeholder:P?"插话,@ 某位成员会点名要求其回应":"理事会已结束,插话会重新唤醒成员",busy:P,allowAttachments:!1,text:X,onTextChange:D,inputRef:ce,onSend:ve,onAbort:()=>void he()})]})})]})]}),q&&e(Oe,{member:q,onClose:()=>z(void 0),onMention:()=>{z(void 0),ee(q.name)},onOpen:()=>{z(void 0),le(q.id)}})]}),document.body)}function Se(t){let{ModelIcon:u,cn:f}=y(),{member:b}=t,g=w[b.verdict]??w.pending,{busy:v}=W(b);return n("button",{type:"button",onClick:t.onSelect,"aria-label":`${b.name},${g.label},查看详情`,className:"flex h-11 max-w-[11rem] shrink-0 cursor-pointer items-center gap-2 rounded-full border border-line bg-panel/60 pr-3.5 pl-1.5 active:bg-raised",children:[n("span",{className:f("relative flex size-8 shrink-0 items-center justify-center rounded-full bg-raised ring-2",g.ring),children:[e(u,{modelID:b.model,className:"size-4",size:16}),v&&e(K,{className:"absolute -right-1 -bottom-1 size-3.5 animate-spin rounded-full bg-bg text-accent"})]}),n("span",{className:"min-w-0 text-left leading-tight",children:[e("span",{className:"block truncate text-[13px] font-medium",children:b.name}),e("span",{className:f("block text-[11px]",g.text),children:g.label})]})]})}function Oe(t){let{Button:u,Dialog:f,Markdown:b,ModelIcon:g,cn:v}=y(),{member:a}=t,h=w[a.verdict]??w.pending,d=W(a);return e(f,{open:!0,onOpenChange:(p)=>!p&&t.onClose(),title:n("span",{className:"flex min-w-0 items-center gap-2.5",children:[e("span",{className:v("flex size-8 shrink-0 items-center justify-center rounded-full bg-raised ring-2",h.ring),children:e(g,{modelID:a.model,className:"size-4",size:16})}),e("span",{className:"min-w-0 truncate",children:a.name}),e("span",{className:v("shrink-0 rounded px-1.5 py-px text-[11px] font-medium",h.soft),children:h.label})]}),description:a.model,footer:n(m,{children:[n(u,{variant:"secondary",onClick:t.onMention,children:[e(L,{className:"size-4"}),"点名"]}),n(u,{variant:"secondary",onClick:t.onOpen,children:[e(ot,{className:"size-4"}),"查看推理"]})]}),children:n("div",{className:"space-y-3 pb-1",children:[n("div",{className:"flex items-center gap-3 text-[13px]",children:[n("span",{className:v("flex min-w-0 flex-1 items-center gap-1.5",d.busy?"text-accent":"text-dim"),children:[d.busy&&e(K,{className:"size-3.5 shrink-0 animate-spin"}),e("span",{className:"truncate",children:d.text})]}),n("span",{className:"shrink-0 text-faint tabular-nums",children:["发言 ",a.turns??0," 次"]})]}),a.notes?n("section",{children:[n("h3",{className:"mb-1.5 flex items-center gap-1.5 text-xs font-medium text-faint",children:[e(te,{className:"size-3.5"}),"调研笔记"]}),e("div",{className:"rounded-xl bg-bg/60 px-3.5 py-2.5 text-[13px] leading-relaxed text-dim",children:e(b,{text:a.notes})})]}):e("p",{className:"text-[13px] text-faint",children:"没有调研笔记"})]})})}function Re(t){let{Collapsible:u,CollapsibleContent:f,Markdown:b,ModelIcon:g,cn:v}=y(),{member:a}=t,[h,d]=r(!1),p=w[a.verdict]??w.pending,{busy:c,text:C}=W(a);return n(u,{open:h,onOpenChange:d,className:v("relative shrink-0 rounded-xl border p-2.5 transition-colors",t.viewing?"border-line-strong bg-raised/60":"border-line bg-panel/60 hover:bg-raised/40"),children:[e("button",{type:"button","aria-label":t.viewing?"返回群聊":`查看 ${a.name} 的推理过程`,"aria-pressed":t.viewing,title:t.viewing?"返回群聊":"查看推理与工具调用",onClick:t.onOpen,className:"absolute inset-0 cursor-pointer rounded-xl"}),n("div",{className:"pointer-events-none relative flex items-center gap-2.5",children:[e("span",{className:v("relative flex size-8 shrink-0 items-center justify-center rounded-full bg-raised ring-2",p.ring),children:e(g,{modelID:a.model,className:"size-4",size:16})}),n("div",{className:"min-w-0 flex-1",children:[n("div",{className:"flex items-center gap-1.5",children:[e("span",{className:"truncate text-[13px] font-medium",title:a.model,children:a.name}),e("span",{className:v("shrink-0 rounded px-1 text-[10.5px] font-medium",p.soft),children:p.label})]}),n("div",{className:v("flex min-w-0 items-center gap-1 text-[11px]",c?"text-accent":"text-faint"),children:[c&&e(K,{className:"size-3 shrink-0 animate-spin"}),e("span",{className:"truncate",children:C})]})]})]}),n("div",{className:"pointer-events-none relative mt-2 flex items-center gap-1 text-[11px] text-faint",children:[n("span",{className:"tabular-nums",children:["发言 ",a.turns??0," 次"]}),e("span",{className:"ml-auto"}),a.notes&&n("button",{type:"button","aria-expanded":h,onClick:()=>d((M)=>!M),className:v("pointer-events-auto inline-flex cursor-pointer items-center gap-1 rounded px-1.5 py-0.5 hover:bg-raised hover:text-ink",h&&"text-ink"),children:[e(te,{className:"size-3"}),"笔记"]}),e("button",{type:"button","aria-label":`@ ${a.name}`,title:`@ ${a.name}`,onClick:t.onMention,className:"pointer-events-auto inline-flex cursor-pointer items-center rounded p-1 hover:bg-raised hover:text-ink",children:e(L,{className:"size-3"})})]}),a.notes&&e(f,{children:e("div",{className:"relative mt-2 max-h-56 overflow-y-auto rounded-lg bg-bg/60 px-2.5 py-2 text-xs leading-relaxed text-dim",children:e(b,{text:a.notes})})})]})}function Te(t){let{Code:u,Collapsible:f,CollapsibleContent:b,Markdown:g,cn:v}=y(),{message:a}=t,[h,d]=r(!1),p=a.senderID==="user"||a.senderID==="host",c=a.verdict&&a.verdict!=="pending"?w[a.verdict]:void 0,C=a.evidences??[],M=(a.mentions??[]).map((x)=>t.membersByID.get(x)).filter((x)=>x!==void 0);return n("li",{id:`council-floor-${a.floor}`,className:"group flex gap-3 animate-fade",children:[e(fe,{message:a,isHuman:p,className:"mt-0.5 hidden size-8 md:flex"}),n("div",{className:"min-w-0 flex-1",children:[n("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs",children:[e(fe,{message:a,isHuman:p,className:"flex size-6 md:hidden"}),e("span",{className:"font-semibold text-ink",title:a.senderModel,children:a.senderName}),n("a",{href:`#council-floor-${a.floor}`,className:"font-mono text-[11px] text-faint hover:text-dim",onClick:(x)=>x.preventDefault(),children:["#",a.floor]}),c&&e("span",{className:v("rounded px-1.5 py-px text-[10.5px] font-medium",c.soft),children:c.label}),!p&&n("button",{type:"button",onClick:t.onMention,className:"ml-auto inline-flex cursor-pointer items-center gap-1 rounded-md px-2 py-1 text-[11px] text-faint transition-opacity hover:bg-raised hover:text-ink focus-visible:opacity-100 md:px-1.5 md:py-0.5 md:opacity-0 md:group-hover:opacity-100",children:[e(L,{className:"size-3"}),"回复"]})]}),(a.replyToFloor||M.length>0)&&n("div",{className:"mt-1 flex flex-wrap items-center gap-1.5 text-[11px] text-faint",children:[a.replyToFloor&&n("button",{type:"button",onClick:()=>document.getElementById(`council-floor-${a.replyToFloor}`)?.scrollIntoView({block:"center",behavior:"smooth"}),className:"inline-flex min-w-0 max-w-full cursor-pointer items-center gap-1 rounded-md bg-raised/70 px-1.5 py-0.5 hover:text-ink",children:[e(tr,{className:"size-3 shrink-0"}),n("span",{className:"shrink-0 text-dim",children:["#",a.replyToFloor," ",a.replyToName]}),a.replyToPreview&&e("span",{className:"truncate",children:a.replyToPreview})]}),M.map((x)=>n("span",{className:"inline-flex items-center gap-1 rounded-md bg-accent/10 px-1.5 py-0.5 text-accent",children:[e(L,{className:"size-3"}),x.name]},x.id))]}),e("div",{className:"mt-1.5 break-words text-[14px] leading-relaxed text-ink/90 md:text-[13.5px] [&_p]:my-1.5 [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",children:e(g,{text:a.text})}),C.length>0&&n(f,{open:h,onOpenChange:d,className:"mt-2",children:[n("button",{type:"button","aria-expanded":h,onClick:()=>d((x)=>!x),className:"inline-flex max-w-full cursor-pointer items-center gap-1 text-[11px] text-faint hover:text-ink",children:[e(pe,{className:"size-3 shrink-0"}),n("span",{className:"shrink-0",children:["查阅 ",C.length," 处"]}),!h&&e("span",{className:"truncate font-mono",children:C.map((x)=>x.label).join(",")}),e(ie,{className:v("size-3 shrink-0 transition-transform duration-300 ease-out-quint",!h&&"-rotate-90")})]}),e(b,{children:e("div",{className:"mt-1.5 space-y-1.5",children:C.map((x)=>n("div",{className:"overflow-hidden rounded-lg border border-line bg-panel text-xs",children:[e("div",{className:"truncate border-b border-line/70 px-2.5 py-1 font-mono text-[11px] text-dim",children:x.label}),x.snippet&&e(u,{code:x.snippet,lang:x.lang||"ts",className:"max-h-40 overflow-auto px-2.5 py-1.5 text-[11.5px]"})]},`${x.tool}:${x.label}:${x.snippet?.slice(0,32)??""}`))})})]})]})]})}function fe(t){let{ModelIcon:u,cn:f}=y();return e("span",{className:f("shrink-0 items-center justify-center rounded-full",t.isHuman?"bg-accent/12 text-accent":"bg-raised",t.className),children:t.message.senderModel?e(u,{modelID:t.message.senderModel,className:"size-4",size:16}):e(xe,{className:"size-4"})})}function rt(t){let{ModelIcon:u,cn:f,useTheme:b}=y();b();let{connection:g,sessionID:v,payload:a,onOpen:h}=t,d=a,[p,c]=r(d),[C,M]=r(()=>{try{return sessionStorage.getItem(Mr)===d.roomID}catch{return!1}}),[x,X]=r(Date.now);o(()=>{c(d)},[d]),o(()=>{if(!C)return;try{if(sessionStorage.getItem(Mr)===d.roomID)sessionStorage.removeItem(Mr)}catch{}},[C,d.roomID]);let D=p.state==="running",R=`/api/sessions/${encodeURIComponent(v)}/council/${encodeURIComponent(p.roomID)}`;o(()=>{if(!D)return;let N=!1,T=setInterval(()=>{if(g.request(R).then((z)=>{if(!N&&z&&typeof z==="object"&&"roomID"in z)c(z)}).catch(()=>{}),!N)X(Date.now())},1200);return()=>{N=!0,clearInterval(T)}},[g,R,D]);let H=async(N)=>{let I=await g.request(`${R}/post`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({text:N})});c(I)},_=async()=>{let N=await g.request(`${R}/kill`,{method:"POST"});c(N)},E=(D?x:p.updatedAt)-p.createdAt,S=p.messages.at(-1),B=p.members.filter((N)=>V(N.status)).length;return n(m,{children:[n("button",{type:"button","aria-label":`进入理事会:${p.topic}`,onClick:()=>M(!0),className:"group relative my-2 block w-full cursor-pointer overflow-hidden rounded-2xl border border-line bg-panel text-left transition-colors hover:border-line-strong animate-fade",children:[n("div",{className:"px-4 pt-3.5",children:[n("div",{className:"flex items-center gap-1.5 text-[11px] text-faint",children:[e("span",{className:"font-medium text-dim",children:"理事会"}),e("span",{"aria-hidden":!0,children:"·"}),e("span",{className:"tabular-nums",children:G(E)}),n("span",{className:"ml-auto tabular-nums",children:[p.members.length," 位成员"]})]}),e("h4",{className:"mt-1 line-clamp-2 text-sm font-semibold text-ink md:truncate",title:p.topic,children:p.topic})]}),e(J,{room:p,className:"mt-3 px-4"}),e("div",{className:"mt-3 flex flex-wrap items-center gap-x-4 gap-y-2 px-4",children:p.members.map((N)=>{let I=w[N.verdict]??w.pending,T=V(N.status);return n("span",{className:"flex min-w-0 items-center gap-1.5 text-xs",title:N.model,children:[n("span",{className:f("relative flex size-6 shrink-0 items-center justify-center rounded-full bg-raised ring-2",I.ring),children:[e(u,{modelID:N.model,className:"size-3.5",size:14}),T&&e(K,{className:"absolute -right-1 -bottom-1 size-3 animate-spin rounded-full bg-panel text-accent"})]}),e("span",{className:"truncate text-dim",children:N.name}),e("span",{className:f("shrink-0 text-[11px]",I.text),children:I.label})]},N.id)})}),n("div",{className:"mt-3 flex items-center gap-2 border-t border-line/70 px-4 py-2.5 text-xs",children:[S?n(m,{children:[e("span",{className:"shrink-0 font-medium text-dim",children:S.senderName}),e("span",{className:"min-w-0 flex-1 truncate text-faint",children:S.text.replace(/\s+/g," ")})]}):e("span",{className:"min-w-0 flex-1 truncate text-faint",children:D?`${B} 位成员正在${p.phase==="research"?"调研":"思考"}…`:"没有发言"}),n("span",{className:"inline-flex shrink-0 items-center gap-1 text-faint transition-colors group-hover:text-ink",children:[p.messages.length>0&&n("span",{className:"tabular-nums",children:[p.messages.length," 条"]}),e(ue,{className:"size-3.5"})]})]})]}),C&&e(ge,{room:p,elapsedMs:E,onClose:()=>M(!1),onOpenMember:h,onPost:H,onAbort:_})]})}export{rt as CouncilCard};
1
+ import{o,i,r,it,m,e,n,y,Or,s,K,mn,ot,ie,rr,Z}from"./chunk-ty2rmwda.js";var ke=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]],L=s("at-sign",ke);var Ce=[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]],pe=s("file-code-2",Ce);var we=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],ue=s("maximize-2",we);var Me=[["path",{d:"M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4",key:"re6nr2"}],["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["path",{d:"M21.378 5.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"pqwjuv"}]],te=s("notebook-pen",Me);var Ie=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],xe=s("user",Ie);var w={approve:{label:"通过",text:"text-success",ring:"ring-success/80",soft:"bg-success/12 text-success"},reject:{label:"反对",text:"text-danger",ring:"ring-danger/80",soft:"bg-danger/12 text-danger"},abstain:{label:"弃权",text:"text-dim",ring:"ring-line-strong",soft:"bg-raised text-dim"},pending:{label:"未表态",text:"text-faint",ring:"ring-line",soft:"bg-raised text-faint"}},ze={thinking:"思考中",reading:"查阅中",speaking:"发言中",idle:"等待中",error:"出错",aborted:"已中止"},F={success:"text-success",warning:"text-warning",danger:"text-danger",neutral:"text-faint"},ne={success:"bg-success",warning:"bg-warning",danger:"bg-danger",neutral:"bg-faint"};function V(t){return t==="thinking"||t==="reading"||t==="speaking"}function W(t){let u=V(t.status);return{busy:u,text:u&&t.activeTool?t.activeTool:ze[t.status]}}function se(t){let u=t.members.filter((b)=>b.verdict==="approve").length,f=t.members.filter((b)=>b.verdict==="reject").length;if(t.state==="running"){if(t.phase==="research")return{tone:"warning",label:"调研中"};if(t.phase==="opening")return{tone:"warning",label:"开场表态"};return{tone:"warning",label:"群聊交流"}}if(t.state==="consensus"){if(u===t.members.length)return{tone:"success",label:"全票通过"};if(f===t.members.length)return{tone:"danger",label:"全票反对"};if(f>u)return{tone:"danger",label:"共识:反对"};return{tone:"success",label:"共识:通过"}}if(t.state==="diverged")return{tone:"warning",label:"存在分歧"};if(t.state==="error")return{tone:"danger",label:"失败"};return{tone:"neutral",label:"已中止"}}function G(t){let u=Math.max(1,Math.round(t/1000));if(u<60)return`${u}s`;return`${Math.floor(u/60)}m ${String(u%60).padStart(2,"0")}s`}var De={research:"调研",opening:"开场表态",discussion:"群聊交流"};function J(t){let{cn:u}=y(),{room:f}=t,b=se(f),g=f.state==="running",v=f.research?["research","opening","discussion"]:["opening","discussion"],a=g?v.indexOf(f.phase==="closed"?"discussion":f.phase??"discussion"):-1,h=[...v.map((d,p)=>({key:d,label:De[d],done:!g||p<a,active:p===a})),{key:"closed",label:g?"结论":b.label,done:!g,active:!1}];return e("ol",{className:u("flex min-w-0 gap-1",t.className),children:h.map((d,p)=>{let c=p===h.length-1&&!g;return n("li",{className:"min-w-0 flex-1",children:[e("span",{className:u("block h-[3px] rounded-full transition-colors duration-300",c?ne[b.tone]:d.active?"bg-accent animate-pulse":d.done?"bg-line-strong":"bg-line/60")}),e("span",{className:u("mt-1.5 block truncate text-[11px]",c?u("font-medium",F[b.tone]):d.active?"font-medium text-ink":d.done?"text-dim":"text-faint"),children:d.label})]},d.key)})})}function ge(t){let{Collapsible:u,CollapsibleContent:f,Composer:b,Markdown:g,ModelIcon:v,ScrollArea:a,SessionView:h,cn:d,confirm:p}=y(),{room:c,onClose:C}=t,[M,x]=r(!1),[X,D]=r(""),[R,H]=r(!1),[_,E]=r(),[S,B]=r(!1),[N,I]=r(!0),[T,z]=r(),ae=i(!1);ae.current=T!==void 0;let[U,Y]=r(),[oe,A]=r(!1),re=i(!1);re.current=U!==void 0;let le=(l)=>{A(!1),Y(l)},ce=i(null),Q=i(null),P=c.state==="running",j=se(c),be=new Map(c.members.map((l)=>[l.id,l]));o(()=>{let l=(de)=>{if(de.key!=="Escape"||de.defaultPrevented||ae.current)return;if(re.current)A(!0);else x(!0)},k=document.body.style.overflow;return document.body.style.overflow="hidden",window.addEventListener("keydown",l),()=>{window.removeEventListener("keydown",l),document.body.style.overflow=k}},[]);let me=c.messages.length;o(()=>{let l=Q.current;if(!l||!N||me===0)return;l.scrollTo({top:l.scrollHeight,behavior:"smooth"})},[me,N]);let ve=async(l)=>{await t.onPost(l),I(!0)},he=async()=>{if(R)return;if(!await p({title:"中止理事会?",description:"所有成员会立即停止,已有发言保留。",action:"中止",danger:!0}))return;H(!0),E(void 0);try{await t.onAbort()}catch(k){E(k instanceof Error?k.message:"中止理事会失败")}finally{H(!1)}},ee=(l)=>{Y(void 0),D((k)=>k.includes(`@${l}`)?k:`${k?`${k.trimEnd()} `:""}@${l} `),requestAnimationFrame(()=>ce.current?.focus())},Ne=c.members.filter((l)=>l.verdict==="approve").length,ye=c.members.filter((l)=>l.verdict==="reject").length,q=c.members.find((l)=>l.id===T),O=c.members.find((l)=>l.id===U);return it(n("div",{role:"dialog","aria-modal":"true","aria-label":`理事会:${c.topic}`,onAnimationEnd:(l)=>{if(M&&l.target===l.currentTarget)C()},className:d("fixed inset-0 z-50 flex flex-col bg-bg pt-[env(safe-area-inset-top)] text-ink",M?"pointer-events-none animate-dialog-out":"animate-dialog-in"),children:[n(u,{open:S,onOpenChange:B,className:"shrink-0 border-b border-line px-4 pt-3 pb-3 sm:px-6",children:[n("div",{className:"flex items-start gap-3",children:[n("div",{className:"min-w-0 flex-1",children:[n("div",{className:"flex items-center gap-3 text-[11px] text-faint",children:[e("span",{className:"font-medium tracking-[0.2em] text-dim",children:"COUNCIL"}),e("span",{className:"tabular-nums",children:G(t.elapsedMs)}),n("span",{className:"tabular-nums",children:[c.messages.length," 条发言"]})]}),n("button",{type:"button","aria-expanded":S,onClick:()=>B((l)=>!l),className:"mt-0.5 flex max-w-full cursor-pointer items-start gap-1.5 text-left md:items-center",children:[e("h2",{className:"line-clamp-2 text-[15px] leading-snug font-semibold md:truncate md:text-lg",children:c.topic}),e(ie,{className:d("mt-0.5 size-4 shrink-0 text-faint transition-transform duration-300 ease-out-quint md:mt-0",!S&&"-rotate-90")})]})]}),n("div",{className:"flex shrink-0 items-center gap-1",children:[n("span",{className:d("inline-flex items-center gap-1.5 rounded-full border border-line px-2.5 py-1 text-xs font-medium",F[j.tone]),children:[e("span",{className:d("size-1.5 rounded-full",ne[j.tone],P&&"animate-pulse")}),j.label]}),e("button",{type:"button","aria-label":"关闭理事会页面",title:"关闭(Esc)",onClick:()=>x(!0),className:"ml-1 inline-flex size-10 -mr-2 cursor-pointer items-center justify-center rounded-full text-faint transition-colors hover:bg-raised hover:text-ink md:size-8 md:mr-0",children:e(Z,{className:"size-4"})})]})]}),e(f,{children:e("div",{className:"mt-2 max-h-[40dvh] overflow-y-auto overscroll-contain rounded-xl bg-panel px-3.5 py-2.5 text-[13px] leading-relaxed text-dim md:max-h-48",children:e(g,{text:c.brief})})}),e(J,{room:c,className:"mt-3"})]}),n("div",{className:"flex min-h-0 flex-1 flex-col md:flex-row",children:[e("div",{className:"flex shrink-0 gap-2 overflow-x-auto overscroll-x-contain border-b border-line px-4 py-2.5 [scrollbar-width:none] md:hidden",children:c.members.map((l)=>e(Se,{member:l,onSelect:()=>z(l.id)},l.id))}),n("aside",{className:"hidden w-72 shrink-0 flex-col gap-2 overflow-y-auto border-r border-line p-4 md:flex",children:[n("div",{className:"flex items-center justify-between text-[11px] text-faint",children:[e("span",{className:"font-medium tracking-wide",children:"席位"}),n("span",{className:"tabular-nums",children:[e("span",{className:"text-success",children:Ne})," / ",e("span",{className:"text-danger",children:ye})," /"," ",c.members.length]})]}),c.members.map((l)=>e(Re,{member:l,viewing:l.id===U,onMention:()=>ee(l.name),onOpen:()=>l.id===U?A(!0):le(l.id)},l.id))]}),O&&n("main",{onAnimationEnd:(l)=>{if(!oe||l.target!==l.currentTarget)return;A(!1),Y(void 0)},className:d("flex min-h-0 min-w-0 flex-1 flex-col",oe?"pointer-events-none animate-overlay-out":"animate-fade"),children:[n("div",{className:"flex shrink-0 items-center gap-2 border-b border-line px-3 py-2 sm:px-4",children:[n("button",{type:"button",onClick:()=>A(!0),className:"inline-flex h-8 cursor-pointer items-center gap-1.5 rounded-lg px-2 text-[13px] text-dim transition-colors hover:bg-raised hover:text-ink",children:[e(mn,{className:"size-4"}),"群聊"]}),e("span",{className:"text-line-strong",children:"/"}),n("span",{className:"flex min-w-0 flex-1 items-center gap-1.5 text-[13px] font-medium",children:[e(v,{modelID:O.model,className:"size-4 shrink-0",size:16}),n("span",{className:"truncate",children:[O.name," 的推理过程"]})]}),e("button",{type:"button","aria-label":"在完整页面打开",title:"在完整页面打开",onClick:()=>t.onOpenMember(O.childSessionID),className:"inline-flex size-8 cursor-pointer items-center justify-center rounded-lg text-faint transition-colors hover:bg-raised hover:text-ink",children:e(ot,{className:"size-4"})})]}),e(h,{sessionID:O.childSessionID},O.childSessionID)]}),n("main",{className:d("min-h-0 min-w-0 flex-1 flex-col animate-fade",O?"hidden":"flex"),children:[e(a,{viewportRef:Q,onScrollCapture:(l)=>{let k=Q.current;if(!k||l.target!==k)return;I(k.scrollHeight-k.scrollTop-k.clientHeight<80)},children:n("div",{className:"mx-auto w-full max-w-3xl px-4 py-4 sm:px-6 md:py-5",children:[c.messages.length===0?n("div",{className:"flex flex-col items-center justify-center gap-3 py-24 text-center text-faint",children:[P?e(K,{className:"size-5 animate-spin"}):null,e("p",{className:"text-sm",children:P?c.phase==="research"?"成员正在各自调研,笔记不会进入群聊":"成员正在独立准备开场观点,彼此不可见":"这场理事会没有产生发言"})]}):e("ol",{className:"space-y-5",children:c.messages.map((l)=>e(Te,{message:l,membersByID:be,onMention:()=>ee(l.senderName)},l.floor))}),c.summary&&!P&&n("section",{className:"mt-8 rounded-2xl border border-line bg-panel px-4 py-3",children:[n("h3",{className:d("text-xs font-semibold",F[j.tone]),children:["结论:",j.label]}),e("div",{className:"mt-1.5 text-[13px] leading-relaxed text-dim",children:e(g,{text:c.summary})})]})]})}),e("div",{className:"shrink-0 px-3 pb-[max(0.75rem,env(safe-area-inset-bottom))] sm:px-6 md:pb-4",children:n("div",{className:"mx-auto w-full max-w-3xl",children:[_&&e("p",{role:"status",className:"px-1 pb-2 text-[13px] text-danger",children:_}),e(b,{draftKey:`council:${c.roomID}`,placeholder:P?"插话,@ 某位成员会点名要求其回应":"理事会已结束,插话会重新唤醒成员",busy:P,allowAttachments:!1,text:X,onTextChange:D,inputRef:ce,onSend:ve,onAbort:()=>void he()})]})})]})]}),q&&e(Oe,{member:q,onClose:()=>z(void 0),onMention:()=>{z(void 0),ee(q.name)},onOpen:()=>{z(void 0),le(q.id)}})]}),document.body)}function Se(t){let{ModelIcon:u,cn:f}=y(),{member:b}=t,g=w[b.verdict]??w.pending,{busy:v}=W(b);return n("button",{type:"button",onClick:t.onSelect,"aria-label":`${b.name},${g.label},查看详情`,className:"flex h-11 max-w-[11rem] shrink-0 cursor-pointer items-center gap-2 rounded-full border border-line bg-panel/60 pr-3.5 pl-1.5 active:bg-raised",children:[n("span",{className:f("relative flex size-8 shrink-0 items-center justify-center rounded-full bg-raised ring-2",g.ring),children:[e(u,{modelID:b.model,className:"size-4",size:16}),v&&e(K,{className:"absolute -right-1 -bottom-1 size-3.5 animate-spin rounded-full bg-bg text-accent"})]}),n("span",{className:"min-w-0 text-left leading-tight",children:[e("span",{className:"block truncate text-[13px] font-medium",children:b.name}),e("span",{className:f("block text-[11px]",g.text),children:g.label})]})]})}function Oe(t){let{Button:u,Dialog:f,Markdown:b,ModelIcon:g,cn:v}=y(),{member:a}=t,h=w[a.verdict]??w.pending,d=W(a);return e(f,{open:!0,onOpenChange:(p)=>!p&&t.onClose(),title:n("span",{className:"flex min-w-0 items-center gap-2.5",children:[e("span",{className:v("flex size-8 shrink-0 items-center justify-center rounded-full bg-raised ring-2",h.ring),children:e(g,{modelID:a.model,className:"size-4",size:16})}),e("span",{className:"min-w-0 truncate",children:a.name}),e("span",{className:v("shrink-0 rounded px-1.5 py-px text-[11px] font-medium",h.soft),children:h.label})]}),description:a.model,footer:n(m,{children:[n(u,{variant:"secondary",onClick:t.onMention,children:[e(L,{className:"size-4"}),"点名"]}),n(u,{variant:"secondary",onClick:t.onOpen,children:[e(ot,{className:"size-4"}),"查看推理"]})]}),children:n("div",{className:"space-y-3 pb-1",children:[n("div",{className:"flex items-center gap-3 text-[13px]",children:[n("span",{className:v("flex min-w-0 flex-1 items-center gap-1.5",d.busy?"text-accent":"text-dim"),children:[d.busy&&e(K,{className:"size-3.5 shrink-0 animate-spin"}),e("span",{className:"truncate",children:d.text})]}),n("span",{className:"shrink-0 text-faint tabular-nums",children:["发言 ",a.turns??0," 次"]})]}),a.notes?n("section",{children:[n("h3",{className:"mb-1.5 flex items-center gap-1.5 text-xs font-medium text-faint",children:[e(te,{className:"size-3.5"}),"调研笔记"]}),e("div",{className:"rounded-xl bg-bg/60 px-3.5 py-2.5 text-[13px] leading-relaxed text-dim",children:e(b,{text:a.notes})})]}):e("p",{className:"text-[13px] text-faint",children:"没有调研笔记"})]})})}function Re(t){let{Collapsible:u,CollapsibleContent:f,Markdown:b,ModelIcon:g,cn:v}=y(),{member:a}=t,[h,d]=r(!1),p=w[a.verdict]??w.pending,{busy:c,text:C}=W(a);return n(u,{open:h,onOpenChange:d,className:v("relative shrink-0 rounded-xl border p-2.5 transition-colors",t.viewing?"border-line-strong bg-raised/60":"border-line bg-panel/60 hover:bg-raised/40"),children:[e("button",{type:"button","aria-label":t.viewing?"返回群聊":`查看 ${a.name} 的推理过程`,"aria-pressed":t.viewing,title:t.viewing?"返回群聊":"查看推理与工具调用",onClick:t.onOpen,className:"absolute inset-0 cursor-pointer rounded-xl"}),n("div",{className:"pointer-events-none relative flex items-center gap-2.5",children:[e("span",{className:v("relative flex size-8 shrink-0 items-center justify-center rounded-full bg-raised ring-2",p.ring),children:e(g,{modelID:a.model,className:"size-4",size:16})}),n("div",{className:"min-w-0 flex-1",children:[n("div",{className:"flex items-center gap-1.5",children:[e("span",{className:"truncate text-[13px] font-medium",title:a.model,children:a.name}),e("span",{className:v("shrink-0 rounded px-1 text-[10.5px] font-medium",p.soft),children:p.label})]}),n("div",{className:v("flex min-w-0 items-center gap-1 text-[11px]",c?"text-accent":"text-faint"),children:[c&&e(K,{className:"size-3 shrink-0 animate-spin"}),e("span",{className:"truncate",children:C})]})]})]}),n("div",{className:"pointer-events-none relative mt-2 flex items-center gap-1 text-[11px] text-faint",children:[n("span",{className:"tabular-nums",children:["发言 ",a.turns??0," 次"]}),e("span",{className:"ml-auto"}),a.notes&&n("button",{type:"button","aria-expanded":h,onClick:()=>d((M)=>!M),className:v("pointer-events-auto inline-flex cursor-pointer items-center gap-1 rounded px-1.5 py-0.5 hover:bg-raised hover:text-ink",h&&"text-ink"),children:[e(te,{className:"size-3"}),"笔记"]}),e("button",{type:"button","aria-label":`@ ${a.name}`,title:`@ ${a.name}`,onClick:t.onMention,className:"pointer-events-auto inline-flex cursor-pointer items-center rounded p-1 hover:bg-raised hover:text-ink",children:e(L,{className:"size-3"})})]}),a.notes&&e(f,{children:e("div",{className:"relative mt-2 max-h-56 overflow-y-auto rounded-lg bg-bg/60 px-2.5 py-2 text-xs leading-relaxed text-dim",children:e(b,{text:a.notes})})})]})}function Te(t){let{Code:u,Collapsible:f,CollapsibleContent:b,Markdown:g,cn:v}=y(),{message:a}=t,[h,d]=r(!1),p=a.senderID==="user"||a.senderID==="host",c=a.verdict&&a.verdict!=="pending"?w[a.verdict]:void 0,C=a.evidences??[],M=(a.mentions??[]).map((x)=>t.membersByID.get(x)).filter((x)=>x!==void 0);return n("li",{id:`council-floor-${a.floor}`,className:"group flex gap-3 animate-fade",children:[e(fe,{message:a,isHuman:p,className:"mt-0.5 hidden size-8 md:flex"}),n("div",{className:"min-w-0 flex-1",children:[n("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs",children:[e(fe,{message:a,isHuman:p,className:"flex size-6 md:hidden"}),e("span",{className:"font-semibold text-ink",title:a.senderModel,children:a.senderName}),n("a",{href:`#council-floor-${a.floor}`,className:"font-mono text-[11px] text-faint hover:text-dim",onClick:(x)=>x.preventDefault(),children:["#",a.floor]}),c&&e("span",{className:v("rounded px-1.5 py-px text-[10.5px] font-medium",c.soft),children:c.label}),!p&&n("button",{type:"button",onClick:t.onMention,className:"ml-auto inline-flex cursor-pointer items-center gap-1 rounded-md px-2 py-1 text-[11px] text-faint transition-opacity hover:bg-raised hover:text-ink focus-visible:opacity-100 md:px-1.5 md:py-0.5 md:opacity-0 md:group-hover:opacity-100",children:[e(L,{className:"size-3"}),"回复"]})]}),(a.replyToFloor||M.length>0)&&n("div",{className:"mt-1 flex flex-wrap items-center gap-1.5 text-[11px] text-faint",children:[a.replyToFloor&&n("button",{type:"button",onClick:()=>document.getElementById(`council-floor-${a.replyToFloor}`)?.scrollIntoView({block:"center",behavior:"smooth"}),className:"inline-flex min-w-0 max-w-full cursor-pointer items-center gap-1 rounded-md bg-raised/70 px-1.5 py-0.5 hover:text-ink",children:[e(rr,{className:"size-3 shrink-0"}),n("span",{className:"shrink-0 text-dim",children:["#",a.replyToFloor," ",a.replyToName]}),a.replyToPreview&&e("span",{className:"truncate",children:a.replyToPreview})]}),M.map((x)=>n("span",{className:"inline-flex items-center gap-1 rounded-md bg-accent/10 px-1.5 py-0.5 text-accent",children:[e(L,{className:"size-3"}),x.name]},x.id))]}),e("div",{className:"mt-1.5 break-words text-[14px] leading-relaxed text-ink/90 md:text-[13.5px] [&_p]:my-1.5 [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",children:e(g,{text:a.text})}),C.length>0&&n(f,{open:h,onOpenChange:d,className:"mt-2",children:[n("button",{type:"button","aria-expanded":h,onClick:()=>d((x)=>!x),className:"inline-flex max-w-full cursor-pointer items-center gap-1 text-[11px] text-faint hover:text-ink",children:[e(pe,{className:"size-3 shrink-0"}),n("span",{className:"shrink-0",children:["查阅 ",C.length," 处"]}),!h&&e("span",{className:"truncate font-mono",children:C.map((x)=>x.label).join(",")}),e(ie,{className:v("size-3 shrink-0 transition-transform duration-300 ease-out-quint",!h&&"-rotate-90")})]}),e(b,{children:e("div",{className:"mt-1.5 space-y-1.5",children:C.map((x)=>n("div",{className:"overflow-hidden rounded-lg border border-line bg-panel text-xs",children:[e("div",{className:"truncate border-b border-line/70 px-2.5 py-1 font-mono text-[11px] text-dim",children:x.label}),x.snippet&&e(u,{code:x.snippet,lang:x.lang||"ts",className:"max-h-40 overflow-auto px-2.5 py-1.5 text-[11.5px]"})]},`${x.tool}:${x.label}:${x.snippet?.slice(0,32)??""}`))})})]})]})]})}function fe(t){let{ModelIcon:u,cn:f}=y();return e("span",{className:f("shrink-0 items-center justify-center rounded-full",t.isHuman?"bg-accent/12 text-accent":"bg-raised",t.className),children:t.message.senderModel?e(u,{modelID:t.message.senderModel,className:"size-4",size:16}):e(xe,{className:"size-4"})})}function rt(t){let{ModelIcon:u,cn:f,useTheme:b}=y();b();let{connection:g,sessionID:v,payload:a,onOpen:h}=t,d=a,[p,c]=r(d),[C,M]=r(()=>{try{return sessionStorage.getItem(Or)===d.roomID}catch{return!1}}),[x,X]=r(Date.now);o(()=>{c(d)},[d]),o(()=>{if(!C)return;try{if(sessionStorage.getItem(Or)===d.roomID)sessionStorage.removeItem(Or)}catch{}},[C,d.roomID]);let D=p.state==="running",R=`/api/sessions/${encodeURIComponent(v)}/council/${encodeURIComponent(p.roomID)}`;o(()=>{if(!D)return;let N=!1,T=setInterval(()=>{if(g.request(R).then((z)=>{if(!N&&z&&typeof z==="object"&&"roomID"in z)c(z)}).catch(()=>{}),!N)X(Date.now())},1200);return()=>{N=!0,clearInterval(T)}},[g,R,D]);let H=async(N)=>{let I=await g.request(`${R}/post`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({text:N})});c(I)},_=async()=>{let N=await g.request(`${R}/kill`,{method:"POST"});c(N)},E=(D?x:p.updatedAt)-p.createdAt,S=p.messages.at(-1),B=p.members.filter((N)=>V(N.status)).length;return n(m,{children:[n("button",{type:"button","aria-label":`进入理事会:${p.topic}`,onClick:()=>M(!0),className:"group relative my-2 block w-full cursor-pointer overflow-hidden rounded-2xl border border-line bg-panel text-left transition-colors hover:border-line-strong animate-fade",children:[n("div",{className:"px-4 pt-3.5",children:[n("div",{className:"flex items-center gap-1.5 text-[11px] text-faint",children:[e("span",{className:"font-medium text-dim",children:"理事会"}),e("span",{"aria-hidden":!0,children:"·"}),e("span",{className:"tabular-nums",children:G(E)}),n("span",{className:"ml-auto tabular-nums",children:[p.members.length," 位成员"]})]}),e("h4",{className:"mt-1 line-clamp-2 text-sm font-semibold text-ink md:truncate",title:p.topic,children:p.topic})]}),e(J,{room:p,className:"mt-3 px-4"}),e("div",{className:"mt-3 flex flex-wrap items-center gap-x-4 gap-y-2 px-4",children:p.members.map((N)=>{let I=w[N.verdict]??w.pending,T=V(N.status);return n("span",{className:"flex min-w-0 items-center gap-1.5 text-xs",title:N.model,children:[n("span",{className:f("relative flex size-6 shrink-0 items-center justify-center rounded-full bg-raised ring-2",I.ring),children:[e(u,{modelID:N.model,className:"size-3.5",size:14}),T&&e(K,{className:"absolute -right-1 -bottom-1 size-3 animate-spin rounded-full bg-panel text-accent"})]}),e("span",{className:"truncate text-dim",children:N.name}),e("span",{className:f("shrink-0 text-[11px]",I.text),children:I.label})]},N.id)})}),n("div",{className:"mt-3 flex items-center gap-2 border-t border-line/70 px-4 py-2.5 text-xs",children:[S?n(m,{children:[e("span",{className:"shrink-0 font-medium text-dim",children:S.senderName}),e("span",{className:"min-w-0 flex-1 truncate text-faint",children:S.text.replace(/\s+/g," ")})]}):e("span",{className:"min-w-0 flex-1 truncate text-faint",children:D?`${B} 位成员正在${p.phase==="research"?"调研":"思考"}…`:"没有发言"}),n("span",{className:"inline-flex shrink-0 items-center gap-1 text-faint transition-colors group-hover:text-ink",children:[p.messages.length>0&&n("span",{className:"tabular-nums",children:[p.messages.length," 条"]}),e(ue,{className:"size-3.5"})]})]})]}),C&&e(ge,{room:p,elapsedMs:E,onClose:()=>M(!1),onOpenMember:h,onPost:H,onAbort:_})]})}export{rt as CouncilCard};
@@ -1,4 +1,4 @@
1
- import{t,a,de,Re,b,C,S,E,T,A,L,R,l,sn,En,p,nt,rt,M,Fe,pe,le,ce,Ze,Nr,ge,ye}from"./chunk-c6m4vfn5.js";import{Ft}from"./chunk-ke8dffnk.js";import{qe}from"./chunk-qb8mbptk.js";import{Bt}from"./chunk-bq6mep6p.js";import{he}from"./chunk-mkxeenph.js";import{ue}from"./chunk-b9jry5a3.js";var Dt={SHAPE_UNSUPPORTED:"SHAPE_UNSUPPORTED",SHAPE_REMOVED:"SHAPE_REMOVED",EDGE_OPERATOR_UNSUPPORTED:"EDGE_OPERATOR_UNSUPPORTED",REFERENCE_EDGE_LABEL_REJECTED:"REFERENCE_EDGE_LABEL_REJECTED",CONNECTOR_REF_UNRESOLVED:"CONNECTOR_REF_UNRESOLVED",CONNECTOR_REF_NOT_A_CONNECTOR:"CONNECTOR_REF_NOT_A_CONNECTOR",METADATA_KEY_MISAPPLIED:"METADATA_KEY_MISAPPLIED",DUPLICATE_ID_NODE:"DUPLICATE_ID_NODE",RESERVED_SYNTHETIC_ID:"RESERVED_SYNTHETIC_ID",CONTAINMENT_VIOLATION:"CONTAINMENT_VIOLATION",EDGE_SEMANTIC_CONTRADICTION:"EDGE_SEMANTIC_CONTRADICTION",FLOW_NO_INPUT:"FLOW_NO_INPUT"},U1=new Set([Dt.SHAPE_UNSUPPORTED,Dt.SHAPE_REMOVED,Dt.CONTAINMENT_VIOLATION]),Ds=new Set(Object.values(Dt).filter((e)=>!U1.has(e))),j1=new Map([["task","roundedRect"],["tool","subroutine"],["input","lean-right"],["decision","diamond"],["refdoc","lin-doc"],["action","hexagon"],["round","rect"]]),z1=new Set(["doc","stadium","terminal","circle","trapezoid","inv_trapezoid","inv-trapezoid","doublecircle","double-circle","typeDeclaration","procs","lean_left","lean-left","in-out","cylinder","ellipse","odd","tag-rect","tagged-rectangle","delay","half-rounded-rectangle","lin-rect","lined-rectangle","win-pane","window-pane","curv-trap","curved-trapezoid"]),W1=new Set(["roundedRect","subroutine","subprocess","subproc","framed-rectangle","lean-right","diamond","lin-doc","lined-document","hexagon","hex","connector","collapsedGroup"]),xt="roundedRect";function Tt(e){if(!e)return e;return j1.get(e)??e}t(Tt,"resolveShapeAlias");function v1(e,r){for(let n of e){if(n.isGroup)continue;if(!n.shape||n.shape==="squareRect"||n.shape==="rect")n.shape=xt;if(z1.has(n.shape)){let o=`shape "${n.shape}" was removed in v0.8.1, using "${xt}"`;if(r?.emitError)r.emitError("SHAPE_REMOVED",o,{nodeId:n.id});else a.warn(`agentflow: ${o}`);n.shape=xt;continue}if(!W1.has(n.shape)){let o=`shape "${n.shape}" is not supported, using "${xt}"`;if(r?.emitWarning)r.emitWarning("SHAPE_UNSUPPORTED",o,{nodeId:n.id});else a.warn(`agentflow: ${o}`);n.shape=xt}}}t(v1,"normaliseNodeShapes");var i1=new Map([["tool",0],["task",1],["decision",2],["input",3],["refdoc",4],["connector",5],["action",6]]),F1=i1.size,V1=t((e)=>`af-kind-${e}`,"kindClass"),K1=[...i1.keys()],I1=t((e)=>Math.max(1,e-F1),"containerSlotCount"),L1=t((e,r)=>{let n=F1+e%I1(r);return r>0?n%r:n},"containerSlot");function B1(e,r,n){let o=l().themeVariables?.borderColorArray,d=Array.isArray(o)?o.length:0,h=n.size;for(let u of e??[]){if(u.isGroup||u.shape==="collapsedGroup"){let x=n.get(String(u.id))??h++;u.colorIndex=L1(x,d);continue}let f=r(String(u.id));if(f&&i1.has(f))u.cssClasses=`${u.cssClasses??""} ${V1(f)}`.replace(/\s+/g," ").trim()}}t(B1,"assignColorSlots");var _1="agentflow-",c1=new Set(["shape","view","icon","img","form","pos","w","h","class","style","labelType"]),H1=new Set(["subroutine","subprocess","subproc","framed-rectangle","tool"]),Y1={flow:"flowGroup"};function s1(e){if(Array.isArray(e))return e.map((n)=>s1(n));if(e===null||typeof e!=="object")return e;let r={};for(let n of Object.keys(e)){if(n==="__proto__"||n==="constructor"||n==="prototype")continue;r[n]=s1(e[n])}return r}t(s1,"stripPrototypeKeys");function M1(e){let r=!1,n=!1,o=0,d,h=[];for(let u of e.split(`
1
+ import{t,a,de,Re,b,C,S,E,T,A,L,R,l,ln,An,p,nt,rt,M,Fe,pe,le,ce,Ze,Pr,ge,ye}from"./chunk-zsat72qd.js";import{Ft}from"./chunk-k9fyqrhp.js";import{qe}from"./chunk-w5q7978e.js";import{Bt}from"./chunk-9vrp249f.js";import{he}from"./chunk-y6mcxfm0.js";import{ue}from"./chunk-51b8n5e1.js";var Dt={SHAPE_UNSUPPORTED:"SHAPE_UNSUPPORTED",SHAPE_REMOVED:"SHAPE_REMOVED",EDGE_OPERATOR_UNSUPPORTED:"EDGE_OPERATOR_UNSUPPORTED",REFERENCE_EDGE_LABEL_REJECTED:"REFERENCE_EDGE_LABEL_REJECTED",CONNECTOR_REF_UNRESOLVED:"CONNECTOR_REF_UNRESOLVED",CONNECTOR_REF_NOT_A_CONNECTOR:"CONNECTOR_REF_NOT_A_CONNECTOR",METADATA_KEY_MISAPPLIED:"METADATA_KEY_MISAPPLIED",DUPLICATE_ID_NODE:"DUPLICATE_ID_NODE",RESERVED_SYNTHETIC_ID:"RESERVED_SYNTHETIC_ID",CONTAINMENT_VIOLATION:"CONTAINMENT_VIOLATION",EDGE_SEMANTIC_CONTRADICTION:"EDGE_SEMANTIC_CONTRADICTION",FLOW_NO_INPUT:"FLOW_NO_INPUT"},U1=new Set([Dt.SHAPE_UNSUPPORTED,Dt.SHAPE_REMOVED,Dt.CONTAINMENT_VIOLATION]),Ds=new Set(Object.values(Dt).filter((e)=>!U1.has(e))),j1=new Map([["task","roundedRect"],["tool","subroutine"],["input","lean-right"],["decision","diamond"],["refdoc","lin-doc"],["action","hexagon"],["round","rect"]]),z1=new Set(["doc","stadium","terminal","circle","trapezoid","inv_trapezoid","inv-trapezoid","doublecircle","double-circle","typeDeclaration","procs","lean_left","lean-left","in-out","cylinder","ellipse","odd","tag-rect","tagged-rectangle","delay","half-rounded-rectangle","lin-rect","lined-rectangle","win-pane","window-pane","curv-trap","curved-trapezoid"]),W1=new Set(["roundedRect","subroutine","subprocess","subproc","framed-rectangle","lean-right","diamond","lin-doc","lined-document","hexagon","hex","connector","collapsedGroup"]),xt="roundedRect";function Tt(e){if(!e)return e;return j1.get(e)??e}t(Tt,"resolveShapeAlias");function v1(e,r){for(let n of e){if(n.isGroup)continue;if(!n.shape||n.shape==="squareRect"||n.shape==="rect")n.shape=xt;if(z1.has(n.shape)){let o=`shape "${n.shape}" was removed in v0.8.1, using "${xt}"`;if(r?.emitError)r.emitError("SHAPE_REMOVED",o,{nodeId:n.id});else a.warn(`agentflow: ${o}`);n.shape=xt;continue}if(!W1.has(n.shape)){let o=`shape "${n.shape}" is not supported, using "${xt}"`;if(r?.emitWarning)r.emitWarning("SHAPE_UNSUPPORTED",o,{nodeId:n.id});else a.warn(`agentflow: ${o}`);n.shape=xt}}}t(v1,"normaliseNodeShapes");var i1=new Map([["tool",0],["task",1],["decision",2],["input",3],["refdoc",4],["connector",5],["action",6]]),F1=i1.size,V1=t((e)=>`af-kind-${e}`,"kindClass"),K1=[...i1.keys()],I1=t((e)=>Math.max(1,e-F1),"containerSlotCount"),L1=t((e,r)=>{let n=F1+e%I1(r);return r>0?n%r:n},"containerSlot");function B1(e,r,n){let o=l().themeVariables?.borderColorArray,d=Array.isArray(o)?o.length:0,h=n.size;for(let u of e??[]){if(u.isGroup||u.shape==="collapsedGroup"){let x=n.get(String(u.id))??h++;u.colorIndex=L1(x,d);continue}let f=r(String(u.id));if(f&&i1.has(f))u.cssClasses=`${u.cssClasses??""} ${V1(f)}`.replace(/\s+/g," ").trim()}}t(B1,"assignColorSlots");var _1="agentflow-",c1=new Set(["shape","view","icon","img","form","pos","w","h","class","style","labelType"]),H1=new Set(["subroutine","subprocess","subproc","framed-rectangle","tool"]),Y1={flow:"flowGroup"};function s1(e){if(Array.isArray(e))return e.map((n)=>s1(n));if(e===null||typeof e!=="object")return e;let r={};for(let n of Object.keys(e)){if(n==="__proto__"||n==="constructor"||n==="prototype")continue;r[n]=s1(e[n])}return r}t(s1,"stripPrototypeKeys");function M1(e){let r=!1,n=!1,o=0,d,h=[];for(let u of e.split(`
2
2
  `)){if(d!==void 0){let D=u.length-u.trimStart().length;if(u.trim()===""||D>d){h.push(u);continue}d=void 0}let f=-1;for(let D=0;D<u.length;D++){let v=u[D];if(n){if(v==="\\")D++;else if(v==='"')n=!1}else if(r){if(v==="'")r=!1}else if(v==='"')n=!0;else if(v==="'")r=!0;else if(v==="#"&&(D===0||u[D-1]===" "||u[D-1]==="\t")){f=D;break}else if(v==="["||v==="{")o++;else if(v==="]"||v==="}")o=Math.max(0,o-1)}if(r||n||o>0){h.push(u);continue}let x=f>=0?u.slice(0,f):u,m=f>=0?u.slice(f):"";if(/:\s*[>|][\d+-]*\s*$/.test(x)){d=u.length-u.trimStart().length,h.push(u);continue}h.push(x.replace(/,([\t ]*)$/,"$1")+m)}return h.join(`
3
3
  `)}t(M1,"stripLineTrailingCommas");var q1=class{constructor(){this.vertexCounter=0,this.config=l(),this.vertices=new Map,this.edges=[],this.classes=new Map,this.subGraphs=[],this.subGraphLookup=new Map,this.globalNodes=new Set,this.connectors=new Map,this.tooltips=new Map,this.subCount=0,this.firstGraphFlag=!0,this.secCount=-1,this.posCrossRef=[],this.diagramId="",this.preserveCommentsWhenParsing=!0,this.frontmatterLineOffset=0,this.elementMappings=[],this.bareVertexMappings=new WeakSet,this.diagnostics=[],this.postParseValidationRun=!1,this.funs=[],this.setAccTitle=S,this.setAccDescription=T,this.setDiagramTitle=L,this.getAccTitle=E,this.getAccDescription=A,this.getDiagramTitle=R,this.funs.push(this.setupToolTips.bind(this)),this.addVertex=this.addVertex.bind(this),this.firstGraph=this.firstGraph.bind(this),this.setDirection=this.setDirection.bind(this),this.addSubGraph=this.addSubGraph.bind(this),this.addGlobal=this.addGlobal.bind(this),this.addConnector=this.addConnector.bind(this),this.addConnectorMapping=this.addConnectorMapping.bind(this),this.addLink=this.addLink.bind(this),this.setLink=this.setLink.bind(this),this.updateLink=this.updateLink.bind(this),this.addClass=this.addClass.bind(this),this.setClass=this.setClass.bind(this),this.destructLink=this.destructLink.bind(this),this.setClickEvent=this.setClickEvent.bind(this),this.setTooltip=this.setTooltip.bind(this),this.updateLinkInterpolate=this.updateLinkInterpolate.bind(this),this.setClickFun=this.setClickFun.bind(this),this.bindFunctions=this.bindFunctions.bind(this),this.setFrontmatterLineOffset=this.setFrontmatterLineOffset.bind(this),this.addVertexMapping=this.addVertexMapping.bind(this),this.extendVertexMapping=this.extendVertexMapping.bind(this),this.addEdgeMapping=this.addEdgeMapping.bind(this),this.addSubgraphMapping=this.addSubgraphMapping.bind(this),this.emitWarning=this.emitWarning.bind(this),this.emitError=this.emitError.bind(this),this.getDiagnostics=this.getDiagnostics.bind(this),this.lex={firstGraph:this.firstGraph.bind(this)},this.clear(),this.setGen("gen-2")}static{t(this,"AgentFlowDB")}sanitizeText(e){return b.sanitizeText(e,this.config)}sanitizeNodeLabelType(e){switch(e){case"markdown":case"string":case"text":return e;default:return"markdown"}}setDiagramId(e){this.diagramId=e}lookUpDomId(e){for(let r of this.vertices.values())if(r.id===e)return this.diagramId?`${this.diagramId}-${r.domId}`:r.domId;return this.diagramId?`${this.diagramId}-${e}`:e}addVertex(e,r,n,o,d,h,u={},f,x){if(!e||e.trim().length===0)return;let m;if(f!==void 0){let _;if(!f.includes(`
4
4
  `))_=`{
@@ -6,7 +6,7 @@ import{t,a,de,Re,b,C,S,E,T,A,L,R,l,sn,En,p,nt,rt,M,Fe,pe,le,ce,Ze,Nr,ge,ye}from"
6
6
  }`;else _=f+`
7
7
  `;try{m=rt(_,{schema:nt})??{}}catch(g){let k=f.includes(`
8
8
  `)?M1(f):f;if(k!==f)try{m=rt(k+`
9
- `,{schema:nt})??{}}catch{this.rethrowMetadataYamlError(g,f,x)}else this.rethrowMetadataYamlError(g,f,x)}m=s1(m)}let D;if(m&&typeof m.shape==="string"){let _=m;D=_.shape;let g=Tt(D);if(g&&g!==D)_.shape=g}let v=this.subGraphLookup.get(e);if(v&&m){v.metadata={...v.metadata,...m};return}let P=this.connectors.get(e);if(P&&m){P.metadata={...P.metadata,...m};return}if(e==="connectors")return;let B=this.edges.find((_)=>_.id===e);if(B){let _=m;if(_?.animate!==void 0)B.animate=_.animate;if(_?.animation!==void 0)B.animation=_.animation;if(_?.curve!==void 0)B.interpolate=_.curve;if(m)B.metadata={...B.metadata,...m};return}let W,w=this.vertices.get(e);if(w===void 0)w={id:e,labelType:"text",domId:_1+e+"-"+this.vertexCounter,styles:[],classes:[]},this.vertices.set(e,w);if(this.vertexCounter++,r!==void 0){if(this.config=l(),W=this.sanitizeText(r.text.trim()),w.labelType=r.type,W.startsWith('"')&&W.endsWith('"'))W=W.substring(1,W.length-1);w.text=W}else if(w.text===void 0)w.text=e;if(n!==void 0)w.type=n;if(o!==void 0&&o!==null)o.forEach((_)=>{w.styles.push(_)});if(d!==void 0&&d!==null)d.forEach((_)=>{w.classes.push(_)});if(h!==void 0)w.dir=h;if(w.props===void 0)w.props=u;else if(u!==void 0)Object.assign(w.props,u);if(m){if(w.metadata={...w.metadata,...m},m.shape){let _=D??m.shape;if(typeof _!=="string")throw this.positionedShapeError(`No such shape: ${JSON.stringify(_)}.`,x);if(_!==_.toLowerCase()||_.includes("_"))throw this.positionedShapeError(`No such shape: ${_}. Shape names should be lowercase.`,x);else if(!Nr(m.shape))throw this.positionedShapeError(`No such shape: ${m.shape}.`,x);w.type=m?.shape}if(m?.label)w.text=this.sanitizeText(m.label),w.labelType=this.sanitizeNodeLabelType(m?.labelType)}}positionedShapeError(e,r){let n=Error(e);if(!r)return n;let o=r.first_line+this.frontmatterLineOffset;return Object.assign(n,{hash:{text:"",token:null,line:o-1,loc:{first_line:o,last_line:r.last_line+this.frontmatterLineOffset,first_column:r.first_column,last_column:r.last_column},expected:[]}}),n}rethrowMetadataYamlError(e,r,n){let o=e;if(!o||o.name!=="YAMLException"||!o.mark||!n)throw e;let d;try{let h=!r.includes(`
9
+ `,{schema:nt})??{}}catch{this.rethrowMetadataYamlError(g,f,x)}else this.rethrowMetadataYamlError(g,f,x)}m=s1(m)}let D;if(m&&typeof m.shape==="string"){let _=m;D=_.shape;let g=Tt(D);if(g&&g!==D)_.shape=g}let v=this.subGraphLookup.get(e);if(v&&m){v.metadata={...v.metadata,...m};return}let P=this.connectors.get(e);if(P&&m){P.metadata={...P.metadata,...m};return}if(e==="connectors")return;let B=this.edges.find((_)=>_.id===e);if(B){let _=m;if(_?.animate!==void 0)B.animate=_.animate;if(_?.animation!==void 0)B.animation=_.animation;if(_?.curve!==void 0)B.interpolate=_.curve;if(m)B.metadata={...B.metadata,...m};return}let W,w=this.vertices.get(e);if(w===void 0)w={id:e,labelType:"text",domId:_1+e+"-"+this.vertexCounter,styles:[],classes:[]},this.vertices.set(e,w);if(this.vertexCounter++,r!==void 0){if(this.config=l(),W=this.sanitizeText(r.text.trim()),w.labelType=r.type,W.startsWith('"')&&W.endsWith('"'))W=W.substring(1,W.length-1);w.text=W}else if(w.text===void 0)w.text=e;if(n!==void 0)w.type=n;if(o!==void 0&&o!==null)o.forEach((_)=>{w.styles.push(_)});if(d!==void 0&&d!==null)d.forEach((_)=>{w.classes.push(_)});if(h!==void 0)w.dir=h;if(w.props===void 0)w.props=u;else if(u!==void 0)Object.assign(w.props,u);if(m){if(w.metadata={...w.metadata,...m},m.shape){let _=D??m.shape;if(typeof _!=="string")throw this.positionedShapeError(`No such shape: ${JSON.stringify(_)}.`,x);if(_!==_.toLowerCase()||_.includes("_"))throw this.positionedShapeError(`No such shape: ${_}. Shape names should be lowercase.`,x);else if(!Pr(m.shape))throw this.positionedShapeError(`No such shape: ${m.shape}.`,x);w.type=m?.shape}if(m?.label)w.text=this.sanitizeText(m.label),w.labelType=this.sanitizeNodeLabelType(m?.labelType)}}positionedShapeError(e,r){let n=Error(e);if(!r)return n;let o=r.first_line+this.frontmatterLineOffset;return Object.assign(n,{hash:{text:"",token:null,line:o-1,loc:{first_line:o,last_line:r.last_line+this.frontmatterLineOffset,first_column:r.first_column,last_column:r.last_column},expected:[]}}),n}rethrowMetadataYamlError(e,r,n){let o=e;if(!o||o.name!=="YAMLException"||!o.mark||!n)throw e;let d;try{let h=!r.includes(`
10
10
  `),u=h?`{
11
11
  `+r+`
12
12
  }`:r+`
@@ -19,7 +19,7 @@ ${w.join(`
19
19
 
20
20
  Initialize mermaid with maxEdges set to a higher number to allow more edges.
21
21
  You cannot set this config via configuration inside the diagram as it is a secure config.
22
- You have to call mermaid.initialize.`)}isLinkData(e){return e!==null&&typeof e==="object"&&"id"in e&&typeof e.id==="string"}addLink(e,r,n){let o=this.isLinkData(n)?n.id.replace("@",""):void 0;a.info("addLink",e,r,o);for(let d of e)for(let h of r){let u=d===e[e.length-1],f=h===r[0];if(u&&f)this.addSingleLink(d,h,n,o);else this.addSingleLink(d,h,n,void 0)}}updateLinkInterpolate(e,r){e.forEach((n)=>{if(n==="default"){this.edges.defaultInterpolate=r;return}if(typeof n==="number"&&n>=this.edges.length)throw Error(`The index ${n} for linkStyle is out of bounds. Valid indices for linkStyle are between 0 and ${this.edges.length-1}. (Help: Ensure that the index is within the range of existing edges.)`);this.edges[n].interpolate=r})}updateLink(e,r){e.forEach((n)=>{if(typeof n==="number"&&n>=this.edges.length)throw Error(`The index ${n} for linkStyle is out of bounds. Valid indices for linkStyle are between 0 and ${this.edges.length-1}. (Help: Ensure that the index is within the range of existing edges.)`);if(n==="default")this.edges.defaultStyle=r;else if(this.edges[n].style=r,(this.edges[n]?.style?.length??0)>0&&!this.edges[n]?.style?.some((o)=>o?.startsWith("fill")))this.edges[n]?.style?.push("fill:none")})}addClass(e,r){let n=r.join().replace(/\\,/g,"§§§").replace(/,/g,";").replace(/§§§/g,",").split(";");e.split(",").forEach((o)=>{let d=this.classes.get(o);if(d===void 0)d={id:o,styles:[],textStyles:[]},this.classes.set(o,d);if(n!==void 0&&n!==null)n.forEach((h)=>{if(/color/.exec(h)){let u=h.replace("fill","bgFill");d.textStyles.push(u)}d.styles.push(h)})})}setDirection(e){if(this.direction=e.trim(),/.*</.exec(this.direction))this.direction="RL";if(/.*\^/.exec(this.direction))this.direction="BT";if(/.*>/.exec(this.direction))this.direction="LR";if(/.*v/.exec(this.direction))this.direction="TB";if(this.direction==="TD")this.direction="TB"}setClass(e,r){for(let n of e.split(",")){let o=this.vertices.get(n);if(o)o.classes.push(r);let d=this.edges.find((u)=>u.id===n);if(d)d.classes.push(r);let h=this.subGraphLookup.get(n);if(h)h.classes.push(r)}}setTooltip(e,r){if(r===void 0)return;r=this.sanitizeText(r);for(let n of e.split(","))this.tooltips.set(this.version==="gen-1"?this.lookUpDomId(n):n,r)}setClickFun(e,r,n){if(l().securityLevel!=="loose")return;if(r===void 0)return;let o=[];if(typeof n==="string"){o=n.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);for(let h=0;h<o.length;h++){let u=o[h].trim();if(u.startsWith('"')&&u.endsWith('"'))u=u.substr(1,u.length-2);o[h]=u}}if(o.length===0)o.push(e);let d=this.vertices.get(e);if(d)d.haveCallback=!0,this.funs.push(()=>{let h=this.lookUpDomId(e),u=document.querySelector(`[id="${h}"]`);if(u!==null)u.addEventListener("click",()=>{M.runFunc(r,...o)},!1)})}setLink(e,r,n){e.split(",").forEach((o)=>{let d=this.vertices.get(o);if(d!==void 0)d.link=M.formatUrl(r,this.config),d.linkTarget=n}),this.setClass(e,"clickable")}getTooltip(e){return this.tooltips.get(e)}setClickEvent(e,r,n){e.split(",").forEach((o)=>{this.setClickFun(o,r,n)}),this.setClass(e,"clickable")}bindFunctions(e){this.funs.forEach((r)=>{r(e)})}getDirection(){return this.direction?.trim()}getVertices(){return this.vertices}getEdges(){return this.edges}isToolDefinition(e){return H1.has(e.type)}getTools(){let e=[];for(let r of this.vertices.values())if(this.isToolDefinition(r))e.push(r);return e}getClasses(){return this.classes}setupToolTips(e){let r=Ft();p(e).select("svg").selectAll("g.node").on("mouseover",(d)=>{let h=p(d.currentTarget),u=h.attr("title");if(u===null)return;let f=d.currentTarget?.getBoundingClientRect();r.transition().duration(200).style("opacity",".9"),r.text(h.attr("title")).style("left",window.scrollX+f.left+(f.right-f.left)/2+"px").style("top",window.scrollY+f.bottom+"px"),r.html(Re.sanitize(u)),h.classed("hover",!0)}).on("mouseout",(d)=>{r.transition().duration(500).style("opacity",0),p(d.currentTarget).classed("hover",!1)})}clear(e="gen-2"){this.vertices=new Map,this.classes=new Map,this.edges=[],this.funs=[this.setupToolTips.bind(this)],this.subGraphs=[],this.subGraphLookup=new Map,this.globalNodes=new Set,this.connectors=new Map,this.subCount=0,this.tooltips=new Map,this.firstGraphFlag=!0,this.version=e,this.config=l(),this.diagramId="",this.vertexCounter=0,this.direction=void 0,this.secCount=-1,this.posCrossRef=[],this.frontmatterLineOffset=0,this.elementMappings=[],this.bareVertexMappings=new WeakSet,this.diagnostics=[],this.postParseValidationRun=!1,C()}setGen(e){this.version=e||"gen-2"}defaultStyle(){return"fill:#ffa;stroke: #f66; stroke-width: 3px; stroke-dasharray: 5, 5;fill:#ffa;stroke: #666;"}addSubGraph(e,r,n,o){let d=e?.text?.trim(),h=n?.text;if(e===n&&n?.text&&/\s/.exec(n.text))d=void 0;let f=t((B)=>{let W={boolean:{},number:{},string:{}},w=[],_;return{nodeList:B.filter(function(k){let y=typeof k;if(k.stmt&&k.stmt==="dir")return _=k.value,!1;if(k.trim()==="")return!1;if(y in W)return W[y].hasOwnProperty(k)?!1:W[y][k]=!0;else return w.includes(k)?!1:w.push(k)}),dir:_}},"uniq")(r.flat()),{nodeList:x,dir:m}=f,D=l().flowchart??{};if(m=m??(D.inheritDir?this.getDirection()??l().direction??void 0:void 0),this.version==="gen-1")for(let B=0;B<x.length;B++)x[B]=this.lookUpDomId(x[B]);d=d??"subGraph"+this.subCount,h=h||"",h=this.sanitizeText(h),this.subCount=this.subCount+1;let v={id:d,nodes:x.filter((B)=>B!==d&&!this.globalNodes.has(B)),title:h.trim(),classes:[],dir:m,labelType:this.sanitizeNodeLabelType(n?.type),type:o??"flow"};a.info("Adding",v.id,v.nodes,v.dir),v.nodes=this.makeUniq(v,this.subGraphs).nodes;let P=this.getPosForId(d);if(P!==-1){let B=this.subGraphs[P];for(let W of v.nodes)if(!B.nodes.includes(W))B.nodes.push(W);if(v.title)B.title=v.title;if(v.dir)B.dir=v.dir;if(v.type)B.type=v.type;this.subGraphLookup.set(d,B)}else this.subGraphs.push(v),this.subGraphLookup.set(d,v);return d}addGlobal(e){for(let r of e.flat()){if(typeof r!=="string")continue;let n=r.trim();if(n!=="")this.globalNodes.add(n)}for(let r of this.subGraphs)r.nodes=r.nodes.filter((n)=>!this.globalNodes.has(n))}getPosForId(e){for(let[r,n]of this.subGraphs.entries())if(n.id===e)return r;return-1}indexNodes2(e,r){let n=this.subGraphs[r].nodes;if(this.secCount=this.secCount+1,this.secCount>2000)return{result:!1,count:0};if(this.posCrossRef[this.secCount]=r,this.subGraphs[r].id===e)return{result:!0,count:0};let o=0,d=1;while(o<n.length){let h=this.getPosForId(n[o]);if(h>=0){let u=this.indexNodes2(e,h);if(u.result)return{result:!0,count:d+u.count};else d=d+u.count}o=o+1}return{result:!1,count:d}}getDepthFirstPos(e){return this.posCrossRef[e]}indexNodes(){if(this.secCount=-1,this.subGraphs.length>0)this.indexNodes2("none",this.subGraphs.length-1)}addConnector(e,r){let n=e?.text?.trim();if(!n)return"";let o=r?.text?.trim()??"",d=o.length>0?this.sanitizeText(o):n,h=this.connectors.get(n);if(!h)h={id:n,labelType:"text",domId:_1+n+"-"+this.vertexCounter,styles:[],classes:[],isConnector:!0,text:d},this.connectors.set(n,h),this.vertices.set(n,h),this.vertexCounter++;else if(o.length>0)h.text=d;return n}getSubGraphs(){return this.subGraphs}getConnectors(){return[...this.connectors.values()]}firstGraph(){if(this.firstGraphFlag)return this.firstGraphFlag=!1,!0;return!1}computeEdgeSemantic(e,r){if(e==="arrow_point"&&r==="normal")return"sequence";if(e==="arrow_cross"&&r==="normal")return"failure";if(e==="arrow_open"&&r==="dotted")return"reference";return}destructStartLink(e){let r=e.trim(),n="arrow_open",o="normal";if(r.includes("."))o="dotted";return{type:"arrow_open",stroke:o}}countChar(e,r){let n=r.length,o=0;for(let d=0;d<n;++d)if(r[d]===e)++o;return o}destructEndLink(e){let r=e.trim(),n=r.slice(0,-1),o="arrow_open";switch(r.slice(-1)){case"x":o="arrow_cross";break;case">":o="arrow_point";break;case"-":case".":o="arrow_open",n=r;break}let d="normal",h=n.length-1,u=this.countChar(".",n);if(u>0)d="dotted",h=u;return{type:o,stroke:d,length:h}}destructLink(e,r){let n=this.destructEndLink(e),o;if(r){if(o=this.destructStartLink(r),o.stroke!==n.stroke)return{type:"INVALID",stroke:"INVALID"};return o.type=n.type,o.length=n.length,{...o,edgeSemantic:this.computeEdgeSemantic(o.type,o.stroke)}}return{...n,edgeSemantic:this.computeEdgeSemantic(n.type,n.stroke)}}exists(e,r){for(let n of e)if(n.nodes.includes(r))return!0;return!1}makeUniq(e,r){let n=[];return e.nodes.forEach((o,d)=>{if(!this.exists(r,o))n.push(e.nodes[d])}),{nodes:n}}getTypeFromVertex(e){let r=typeof e.type==="string"?Tt(e.type):e.type;switch(r){case"square":case void 0:return"squareRect";case"round":return"roundedRect";case"ellipse":return"ellipse";default:return r}}findNode(e,r){return e.find((n)=>n.id===r)}destructEdgeType(e){let r="none",n="arrow_point";switch(e){case"arrow_point":case"arrow_circle":case"arrow_cross":case"arrow_hierarchy":n=e;break;case"double_arrow_point":case"double_arrow_circle":case"double_arrow_cross":r=e.replace("double_",""),n=r;break}return{arrowTypeStart:r,arrowTypeEnd:n}}addNodeFromVertex(e,r,n,o,d,h){let u=n.get(e.id),f=o.get(e.id)??!1,x=this.findNode(r,e.id);if(x)x.cssStyles=e.styles,x.cssCompiledStyles=this.getCompiledStyles(e.classes),x.cssClasses=e.classes.join(" ");else{let m={id:e.id,label:e.text,labelType:e.labelType,labelStyle:"",parentId:u,padding:d.flowchart?.padding||8,cssStyles:e.styles,cssCompiledStyles:this.getCompiledStyles(["default","node",...e.classes]),cssClasses:"default "+e.classes.join(" "),dir:e.dir,domId:e.domId,look:h,link:e.link,linkTarget:e.linkTarget,tooltip:this.getTooltip(e.id),metadata:e.metadata};if(f)r.push({...m,isGroup:!0,shape:"rect"});else r.push({...m,isGroup:!1,shape:this.getTypeFromVertex(e),wrappingWidth:d.agentflow?.wrappingWidth,minWidth:d.agentflow?.minNodeWidth})}}getCompiledStyles(e){let r=[];for(let n of e){let o=this.classes.get(n);if(o?.styles)r=[...r,...o.styles??[]].map((d)=>d.trim());if(o?.textStyles)r=[...r,...o.textStyles??[]].map((d)=>d.trim())}return r}runPostParseValidators(){if(this.postParseValidationRun)return;this.postParseValidationRun=!0}getData(){this.runPostParseValidators();let e=l(),r=[],n=[],o=this.getSubGraphs(),d=new Map,h=new Map,u=new Set,f=new Map,x=t((g,k,y=new Set)=>{if(y.has(g))return;y.add(g);let q=this.subGraphLookup.get(g);if(!q)return;for(let Ce of q.nodes){if(Ce===k||y.has(Ce))continue;u.add(Ce),f.set(Ce,k),x(Ce,k,y)}},"collectDescendants");for(let g of o)if(g.metadata?.view==="collapsed"&&!u.has(g.id))x(g.id,g.id);let m=t((g,k)=>{let y=new Set,q=k;while(q!==void 0&&!y.has(q)){if(q===g)return!0;y.add(q),q=d.get(q)}return!1},"wouldCloseContainmentCycle");for(let g=o.length-1;g>=0;g--){let k=o[g];if(u.has(k.id))continue;if(k.nodes.length>0)h.set(k.id,!0);for(let y of k.nodes){if(m(y,k.id)){this.emitWarning(Dt.CONTAINMENT_VIOLATION,`Container "${k.id}" cannot contain "${y}" because "${y}" already contains it. The nesting that would close the loop is dropped.`,{nodeId:y});continue}d.set(y,k.id)}}for(let g=o.length-1;g>=0;g--){let k=o[g];if(u.has(k.id))continue;if(k.metadata?.view==="collapsed"){let q={...k.metadata,containerType:k.type};r.push({id:k.id,label:k.title,labelStyle:"",labelType:k.labelType,parentId:d.get(k.id),padding:8,cssCompiledStyles:this.getCompiledStyles(k.classes),cssClasses:k.classes.join(" "),shape:"collapsedGroup",dir:k.dir,isGroup:!1,look:e.look,metadata:q})}else r.push({id:k.id,label:k.title,labelStyle:"",labelType:k.labelType,parentId:d.get(k.id),padding:8,cssCompiledStyles:this.getCompiledStyles(k.classes),cssClasses:k.classes.join(" "),shape:Y1[k.type??"flow"],dir:k.dir,isGroup:!0,look:e.look,metadata:k.metadata})}this.getVertices().forEach((g)=>{if(u.has(g.id))return;this.addNodeFromVertex(g,r,d,h,e,e.look||"classic")});let v=this.getEdges();v.forEach((g,k)=>{let y=f.get(g.start)??g.start,q=f.get(g.end)??g.end;if(y===q&&g.start!==g.end)return;let{arrowTypeStart:Ce,arrowTypeEnd:Ie}=this.destructEdgeType(g.type),ve=[...v.defaultStyle??[]];if(g.style)ve.push(...g.style);let Le={id:Fe(y,q,{counter:k,prefix:"L"},g.id),isUserDefinedId:g.isUserDefinedId,start:y,end:q,type:g.type??"normal",label:g.text,labelType:g.labelType,labelpos:"c",thickness:g.stroke,minlen:g.length,classes:g?.stroke==="invisible"?"":"edge-thickness-normal edge-pattern-solid flowchart-link",arrowTypeStart:g?.stroke==="invisible"||g?.type==="arrow_open"?"none":Ce,arrowTypeEnd:g?.stroke==="invisible"||g?.type==="arrow_open"?"none":Ie,arrowheadStyle:"fill: #333",cssCompiledStyles:this.getCompiledStyles(g.classes),labelStyle:ve,style:ve,pattern:g.stroke,look:e.look,animate:g.animate,animation:g.animation,curve:g.interpolate||this.edges.defaultInterpolate||e.flowchart?.curve,metadata:g.metadata};n.push(Le)}),v1(r,this);let P=new Map,B=new Map;for(let g of o){let k=d.get(g.id);if(k!==void 0)B.set(k,[...B.get(k)??[],g.id])}let W=0,w=t((g)=>{if(P.has(g))return;P.set(g,W++);for(let k of B.get(g)??[])w(k)},"walkContainers");for(let g of o)if(d.get(g.id)===void 0)w(g.id);let _=new Set(this.getConnectors().map((g)=>g.id));return B1(r,(g)=>{if(_.has(g))return"connector";let k=this.vertices.get(g);return k?this.deriveVertexKind(k,Tt(k.type)):void 0},P),{nodes:r,edges:n,other:{},config:e,connectors:this.getConnectors()}}defaultConfig(){return En.flowchart}deriveVertexKind(e,r){if(this.isToolDefinition(e))return"tool";if(r==="hexagon"||r==="hex")return"action";if(r==="lean-right"||r==="lean_right")return"input";if(r==="lin-doc"||r==="lined-document")return"refdoc";if(r==="diamond")return"decision";return"task"}getSemanticModel(){this.runPostParseValidators();let e=new Set(this.subGraphs.map((u)=>u.id)),r=[],n=[];for(let[u,f]of this.vertices){if(e.has(u))continue;if(f.isConnector){let D={id:u};if(f.text!==void 0&&f.text!==u)D.title=f.text;if(f.metadata&&Object.keys(f.metadata).length>0){let v={};for(let[P,B]of Object.entries(f.metadata)){if(c1.has(P))continue;v[P]=B}if(Object.keys(v).length>0)D.metadata=v}n.push(D);continue}let x={id:u};if(f.text!==void 0)x.label=f.text;let m=typeof f.type==="string"?Tt(f.type):f.type;if(m!==void 0)x.shape=m;if(x.vertexKind=this.deriveVertexKind(f,m),f.metadata&&Object.keys(f.metadata).length>0){let D={};for(let[v,P]of Object.entries(f.metadata)){if(c1.has(v))continue;D[v]=P}if(Object.keys(D).length>0)x.metadata=D}r.push(x)}let o=this.edges.map((u)=>{let f={start:u.start,end:u.end};if(u.id!==void 0)f.id=u.id;if(typeof u.text==="string"&&u.text.length>0)f.label=u.text;if(u.type!==void 0)f.type=u.type;if(u.stroke!==void 0)f.stroke=u.stroke;if(u.edgeSemantic!==void 0)f.edgeSemantic=u.edgeSemantic;if(u.length!==void 0)f.length=u.length;if(u.metadata&&Object.keys(u.metadata).length>0)f.metadata={...u.metadata};return f}),d=this.subGraphs.map((u)=>{let f={id:u.id,nodes:[...u.nodes]};if(u.type!==void 0)f.type=u.type;if(u.title!==void 0)f.title=u.title;if(u.dir!==void 0)f.direction=u.dir;if(u.metadata&&Object.keys(u.metadata).length>0){let x={};for(let[m,D]of Object.entries(u.metadata)){if(c1.has(m))continue;x[m]=D}if(Object.keys(x).length>0)f.metadata=x}return f}),h={vertices:r,edges:o,subGraphs:d,connectors:n,diagnostics:this.diagnostics};if(this.direction!==void 0)h.direction=this.direction;return h}setFrontmatterLineOffset(e){this.frontmatterLineOffset=e??0}toElementPosition(e){let r=e?.first_line??0,n=e?.first_column??0,o=e?.last_line??r,d=e?.last_column??n,[h,u]=e?.range??[0,0];return{startLine:r+this.frontmatterLineOffset,startColumn:n,endLine:o+this.frontmatterLineOffset,endColumn:d,startIndex:h,endIndex:u}}pushMapping(e,r,n){if(!e)return;let o={id:e,type:r,position:this.toElementPosition(n)};return this.elementMappings.push(o),o}addVertexMapping(e,r,n,o){let d=this.pushMapping(e,"vertex",o);if(d&&n==null)this.bareVertexMappings.add(d)}extendVertexMapping(e,r){if(!e||!r)return;let n=this.toElementPosition(r);for(let o=this.elementMappings.length-1;o>=0;o--){let d=this.elementMappings[o];if(d.type==="vertex"&&d.id===e){if(this.bareVertexMappings.has(d))d.type="attachment",this.bareVertexMappings.delete(d);if(n.endLine>d.position.endLine||n.endLine===d.position.endLine&&n.endColumn>d.position.endColumn)d.position.endLine=n.endLine,d.position.endColumn=n.endColumn,d.position.endIndex=n.endIndex;return}}this.pushMapping(e,"attachment",r)}addEdgeMapping(e,r,n,o){let d=Array.isArray(r)?r.map((u)=>typeof u==="string"?u:u?.id??"").filter(Boolean):[],h=d.length>0?d.join(">"):"edge";this.pushMapping(h,"edge",o)}addSubgraphMapping(e,r,n,o){let d=(typeof e==="string"?e:e?.text)??"",h=this.toElementPosition(n),u=o?this.toElementPosition(o):h;if(!d)return;this.elementMappings.push({id:d,type:"subgraph",position:{startLine:h.startLine,startColumn:h.startColumn,endLine:u.endLine,endColumn:u.endColumn,startIndex:h.startIndex,endIndex:u.endIndex}})}addConnectorMapping(e,r,n,o){let d=e?.text?.trim()??"";if(!d)return;let h=this.toElementPosition(n),u=o?this.toElementPosition(o):h;this.elementMappings.push({id:d,type:"connector",position:{startLine:h.startLine,startColumn:h.startColumn,endLine:u.endLine,endColumn:u.endColumn,startIndex:h.startIndex,endIndex:u.endIndex}})}getElementMappings(){return[...this.elementMappings]}getElementById(e){return this.elementMappings.find((r)=>r.id===e)}getElementsOnLine(e){return this.elementMappings.filter((r)=>e>=r.position.startLine&&e<=r.position.endLine)}getElementAtPosition(e,r){let n=this.elementMappings.filter((d)=>{let{startLine:h,startColumn:u,endLine:f,endColumn:x}=d.position;if(e<h||e>f)return!1;if(e===h&&r<u)return!1;if(e===f&&r>x)return!1;return!0});if(n.length===0)return;let o=t(({position:d})=>[d.endLine-d.startLine,d.endColumn-d.startColumn],"span");return n.reduce((d,h)=>{let[u,f]=o(d),[x,m]=o(h);if(x!==u)return x<u?h:d;return m<f?h:d})}getMappingStats(){let e=0,r=0,n=0,o=0,d=0;for(let h of this.elementMappings)if(h.type==="vertex")e++;else if(h.type==="edge")r++;else if(h.type==="subgraph")n++;else if(h.type==="connector")o++;else if(h.type==="attachment")d++;return{vertices:e,edges:r,subgraphs:n,connectors:o,attachments:d,totalElements:this.elementMappings.length}}emitDiagnostic(e,r,n,o){let d=o?.nodeId??o?.edgeId,h=d?this.getElementById(d):void 0,u={id:e,severity:r,message:n,...o?.nodeId?{nodeId:o.nodeId}:{},...o?.edgeId&&!o?.nodeId?{edgeId:o.edgeId}:{},...h?{position:h.position}:{}};if(this.diagnostics.some((m)=>m.id===u.id&&m.severity===u.severity&&m.message===u.message&&m.nodeId===u.nodeId&&m.edgeId===u.edgeId))return;this.diagnostics.push(u);let x=`agentflow[${e}]: ${n}`;if(r==="error")a.error(x);else a.warn(x)}emitWarning(e,r,n){this.emitDiagnostic(e,"warning",r,n)}emitError(e,r,n){this.emitDiagnostic(e,"error",r,n)}getDiagnostics(){return[...this.diagnostics]}},X1=t(function(e,r){return r.db.getClasses()},"getClasses"),Q1=t(async function(e,r,n,o){a.debug("Drawing agentflow diagram",r);let{securityLevel:d,agentflow:h,layout:u}=l();o.db.setDiagramId(r),a.debug("Before getData: ");let f=o.db.getData();a.debug("Data: ",f);let x=he(r,d),m=o.db.getDirection();if(f.type=o.type,f.layoutAlgorithm=ye(u),f.layoutAlgorithm==="dagre"&&u==="elk")a.warn("flowchart-elk was moved to an external package in Mermaid v11. Please refer [release notes](https://github.com/mermaid-js/mermaid/releases/tag/v11.0.0) for more details. This diagram will be rendered using `dagre` layout as a fallback.");f.direction=m,f.nodeSpacing=h?.nodeSpacing||50,f.rankSpacing=h?.rankSpacing||50,f.markers=["point","circle","cross","hierarchy"],f.diagramId=r,a.debug("REF1:",f),await ge(f,x);let D=h?.diagramPadding??8;M.insertTitle(x,"agentflowTitleText",h?.titleTopMargin??0,o.db.getDiagramTitle()),ue(x,D,"agentflow",h?.useMaxWidth??!0)},"draw"),J1={getClasses:X1,draw:Q1},d1=function(){var e=t(function(Ke,F,V,I){for(V=V||{},I=Ke.length;I--;V[Ke[I]]=F);return V},"o"),r=[1,5],n=[1,4],o=[1,3],d=[1,6],h=[1,8,9,10,11,12,28,35,36,38,40,42,47,63,87,88,89,90,91,92,105,108,109,112,114,117,118,119,124,125,126,127,128],u=[2,2],f=[1,15],x=[1,16],m=[1,17],D=[1,18],v=[1,19],P=[1,26],B=[1,27],W=[1,28],w=[1,30],_=[1,31],g=[1,32],k=[1,55],y=[1,54],q=[1,34],Ce=[1,35],Ie=[1,36],ve=[1,37],Le=[1,38],Q=[1,50],J=[1,52],Z=[1,48],ee=[1,53],te=[1,49],se=[1,56],ie=[1,51],re=[1,57],ne=[1,58],He=[1,39],Ye=[1,40],Xe=[1,41],Qe=[1,42],Je=[1,43],ze=[1,64],N=[1,8,9,10,11,12,28,33,35,36,38,40,42,47,63,87,88,89,90,91,92,105,108,109,112,114,117,118,119,124,125,126,127,128],ke=[1,70],me=[1,68],Ae=[1,67],Ee=[1,69],st=[8,9,10,12,78,80,81],it=[1,88],at=[1,101],ot=[1,106],ut=[1,105],lt=[1,102],ct=[1,98],dt=[1,104],ht=[1,100],pt=[1,107],ft=[1,103],gt=[1,108],bt=[1,99],$e=[8,9,10,11,12,43,78,80,81],oe=[8,9,10,11,12,43,49,78,80,81],xe=[8,9,10,11,12,30,43,47,49,51,53,55,57,59,61,63,66,68,70,71,73,78,80,81,92,105,108,109,112,114,117,118,119],h1=[8,9,10,12,47,63,78,80,81,92,105,108,109,112,114,117,118,119],kt=[47,63,92,105,108,109,112,114,117,118,119],p1=[1,131],f1=[1,132],_t=[1,134],vt=[1,133],g1=[47,63,65,77,92,105,108,109,112,114,117,118,119],Vt=[1,143],It=[1,157],Lt=[1,158],Mt=[1,159],yt=[1,162],wt=[1,161],Nt=[1,160],Rt=[1,145],Ot=[1,147],Pt=[1,151],b1=[1,139],k1=[1,140],Gt=[1,152],Ut=[1,153],jt=[1,154],zt=[1,155],Wt=[1,156],Kt=[1,163],Ht=[1,164],Yt=[1,141],qt=[1,142],Xt=[1,149],Qt=[1,144],Jt=[1,148],Zt=[1,146],mt=[8,9,10,11,12,28,33,35,36,38,40,42,47,63,87,88,89,90,91,92,105,108,109,112,114,117,118,119,124,125,126,127,128],m1=[1,168],At=[1,170],X=[8,9,10,12],Te=[8,9,10,11,12,15,47,63,92,108,109,112,114,117,118,119],G=[1,190],fe=[1,186],be=[1,187],U=[1,191],j=[1,188],z=[1,189],Et=[80,119,122],K=[8,9,10,11,12,13,15,28,30,33,35,36,43,47,63,78,87,88,89,90,91,92,93,108,112,114,117,118,119],A1=[11,109],We=[32,52,54,56,58,60,65,67,69,70,72,74,119,120,121],Be=[1,269],Me=[1,267],we=[1,271],Ne=[1,265],Oe=[1,266],Pe=[1,268],Ge=[1,270],Ue=[1,272],Ct=[1,292],E1=[8,9,10,12,109],Ve=[8,9,10,11,12,63,87,108,109,112,113,114,115],r1={trace:t(function(){},"trace"),yy:{},symbols_:{error:2,start:3,graphConfig:4,document:5,line:6,statement:7,COMMENT:8,SEMI:9,NEWLINE:10,SPACE:11,EOF:12,GRAPH:13,NODIR:14,DIR:15,FirstStmtSeparator:16,ending:17,endToken:18,spaceList:19,spaceListNewline:20,vertexStatement:21,separator:22,styleStatement:23,linkStyleStatement:24,classDefStatement:25,classStatement:26,clickStatement:27,flow:28,textNoTags:29,SQS:30,text:31,SQE:32,end:33,shapeData:34,global:35,connector:36,direction:37,acc_title:38,acc_title_value:39,acc_descr:40,acc_descr_value:41,acc_descr_multiline_value:42,SHAPE_DATA:43,link:44,node:45,styledVertex:46,AMP:47,vertex:48,STYLE_SEPARATOR:49,idString:50,DOUBLECIRCLESTART:51,DOUBLECIRCLEEND:52,PS:53,PE:54,"(-":55,"-)":56,STADIUMSTART:57,STADIUMEND:58,SUBROUTINESTART:59,SUBROUTINEEND:60,VERTEX_WITH_PROPS_START:61,"NODE_STRING[field]":62,COLON:63,"NODE_STRING[value]":64,PIPE:65,CYLINDERSTART:66,CYLINDEREND:67,DIAMOND_START:68,DIAMOND_STOP:69,TAGEND:70,TRAPSTART:71,TRAPEND:72,INVTRAPSTART:73,INVTRAPEND:74,linkStatement:75,arrowText:76,TESTSTR:77,START_LINK:78,edgeText:79,LINK:80,LINK_ID:81,edgeTextToken:82,STR:83,MD_STR:84,textToken:85,keywords:86,STYLE:87,LINKSTYLE:88,CLASSDEF:89,CLASS:90,CLICK:91,DOWN:92,UP:93,textNoTagsToken:94,stylesOpt:95,"idString[vertex]":96,"idString[class]":97,CALLBACKNAME:98,CALLBACKARGS:99,HREF:100,LINK_TARGET:101,"STR[link]":102,"STR[tooltip]":103,alphaNum:104,DEFAULT:105,numList:106,INTERPOLATE:107,NUM:108,COMMA:109,style:110,styleComponent:111,NODE_STRING:112,UNIT:113,BRKT:114,PCT:115,idStringToken:116,MINUS:117,MULT:118,UNICODE_TEXT:119,TEXT:120,TAGSTART:121,EDGE_TEXT:122,alphaNumToken:123,direction_tb:124,direction_bt:125,direction_rl:126,direction_lr:127,direction_td:128,$accept:0,$end:1},terminals_:{2:"error",8:"COMMENT",9:"SEMI",10:"NEWLINE",11:"SPACE",12:"EOF",13:"GRAPH",14:"NODIR",15:"DIR",28:"flow",30:"SQS",32:"SQE",33:"end",35:"global",36:"connector",38:"acc_title",39:"acc_title_value",40:"acc_descr",41:"acc_descr_value",42:"acc_descr_multiline_value",43:"SHAPE_DATA",47:"AMP",49:"STYLE_SEPARATOR",51:"DOUBLECIRCLESTART",52:"DOUBLECIRCLEEND",53:"PS",54:"PE",55:"(-",56:"-)",57:"STADIUMSTART",58:"STADIUMEND",59:"SUBROUTINESTART",60:"SUBROUTINEEND",61:"VERTEX_WITH_PROPS_START",62:"NODE_STRING[field]",63:"COLON",64:"NODE_STRING[value]",65:"PIPE",66:"CYLINDERSTART",67:"CYLINDEREND",68:"DIAMOND_START",69:"DIAMOND_STOP",70:"TAGEND",71:"TRAPSTART",72:"TRAPEND",73:"INVTRAPSTART",74:"INVTRAPEND",77:"TESTSTR",78:"START_LINK",80:"LINK",81:"LINK_ID",83:"STR",84:"MD_STR",87:"STYLE",88:"LINKSTYLE",89:"CLASSDEF",90:"CLASS",91:"CLICK",92:"DOWN",93:"UP",96:"idString[vertex]",97:"idString[class]",98:"CALLBACKNAME",99:"CALLBACKARGS",100:"HREF",101:"LINK_TARGET",102:"STR[link]",103:"STR[tooltip]",105:"DEFAULT",107:"INTERPOLATE",108:"NUM",109:"COMMA",112:"NODE_STRING",113:"UNIT",114:"BRKT",115:"PCT",117:"MINUS",118:"MULT",119:"UNICODE_TEXT",120:"TEXT",121:"TAGSTART",122:"EDGE_TEXT",124:"direction_tb",125:"direction_bt",126:"direction_rl",127:"direction_lr",128:"direction_td"},productions_:[0,[3,2],[5,0],[5,2],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[4,2],[4,2],[4,2],[4,2],[4,3],[17,2],[17,1],[18,1],[18,1],[18,1],[16,1],[16,1],[16,2],[16,1],[20,2],[20,2],[20,2],[20,1],[20,1],[20,1],[19,2],[19,1],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,9],[7,10],[7,6],[7,7],[7,4],[7,4],[7,7],[7,8],[7,4],[7,5],[7,1],[7,2],[7,2],[7,1],[22,1],[22,1],[22,1],[22,1],[34,2],[34,1],[21,4],[21,3],[21,4],[21,2],[21,2],[21,1],[45,1],[45,6],[45,5],[46,1],[46,3],[48,4],[48,4],[48,6],[48,4],[48,4],[48,4],[48,8],[48,4],[48,4],[48,4],[48,6],[48,4],[48,4],[48,4],[48,4],[48,4],[48,1],[44,2],[44,3],[44,3],[44,1],[44,3],[44,4],[79,1],[79,2],[79,1],[79,1],[75,1],[75,2],[76,3],[31,1],[31,2],[31,1],[31,1],[86,1],[86,1],[86,1],[86,1],[86,1],[86,1],[86,1],[86,1],[86,1],[86,1],[86,1],[86,1],[86,1],[29,1],[29,2],[29,1],[29,1],[25,5],[26,5],[27,2],[27,4],[27,3],[27,5],[27,3],[27,5],[27,5],[27,7],[27,2],[27,4],[27,2],[27,4],[27,4],[27,6],[23,5],[24,5],[24,5],[24,9],[24,9],[24,7],[24,7],[106,1],[106,3],[95,1],[95,3],[110,1],[110,2],[111,1],[111,1],[111,1],[111,1],[111,1],[111,1],[111,1],[111,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[85,1],[85,1],[85,1],[85,1],[94,1],[94,1],[94,1],[94,1],[94,1],[94,1],[94,1],[94,1],[94,1],[94,1],[94,1],[82,1],[82,1],[123,1],[123,1],[123,1],[123,1],[123,1],[123,1],[123,1],[123,1],[123,1],[123,1],[123,1],[50,1],[50,2],[104,1],[104,2],[37,1],[37,1],[37,1],[37,1],[37,1]],performAction:t(function(F,V,I,c,H,s,O){var i=s.length-1;switch(H){case 2:this.$=[];break;case 3:if(!Array.isArray(s[i])||s[i].length>0)s[i-1].push(s[i]);this.$=s[i-1];break;case 4:case 198:this.$=s[i];break;case 5:case 33:case 34:case 35:case 36:case 37:this.$=[];break;case 13:c.setDirection("TB"),this.$="TB";break;case 14:c.setDirection(s[i-1]),this.$=s[i-1];break;case 32:this.$=s[i-1].nodes;break;case 38:if(this.$=c.addSubGraph(s[i-6],s[i-1],s[i-4],"flow"),c.addSubgraphMapping)c.addSubgraphMapping(s[i-6],s[i-4],O[i-8],O[i]);break;case 39:if(this.$=c.addSubGraph(s[i-7],s[i-1],s[i-5],"flow"),c.addVertex(this.$,void 0,void 0,void 0,void 0,void 0,void 0,s[i-3],O[i-3]),c.addSubgraphMapping)c.addSubgraphMapping(s[i-7],s[i-5],O[i-9],O[i]);break;case 40:if(this.$=c.addSubGraph(s[i-3],s[i-1],{text:"",type:"text"},"flow"),c.addSubgraphMapping)c.addSubgraphMapping(s[i-3],{text:"",type:"text"},O[i-5],O[i]);break;case 41:if(this.$=c.addSubGraph(s[i-4],s[i-1],{text:"",type:"text"},"flow"),c.addVertex(this.$,void 0,void 0,void 0,void 0,void 0,void 0,s[i-3],O[i-3]),c.addSubgraphMapping)c.addSubgraphMapping(s[i-4],{text:"",type:"text"},O[i-6],O[i]);break;case 42:if(this.$=c.addSubGraph(void 0,s[i-1],void 0,"flow"),c.addSubgraphMapping)c.addSubgraphMapping(void 0,void 0,O[i-3],O[i]);break;case 43:c.addGlobal(s[i-1]),this.$=[];break;case 44:if(this.$=c.addConnector(s[i-4],s[i-2]),c.addConnectorMapping)c.addConnectorMapping(s[i-4],s[i-2],O[i-6],O[i]);break;case 45:if(this.$=c.addConnector(s[i-5],s[i-3]),c.addVertex(this.$,void 0,void 0,void 0,void 0,void 0,void 0,s[i-1],O[i-1]),c.addConnectorMapping)c.addConnectorMapping(s[i-5],s[i-3],O[i-7],O[i]);break;case 46:if(this.$=c.addConnector(s[i-1],{text:"",type:"text"}),c.addConnectorMapping)c.addConnectorMapping(s[i-1],{text:"",type:"text"},O[i-3],O[i]);break;case 47:if(this.$=c.addConnector(s[i-2],{text:"",type:"text"}),c.addVertex(this.$,void 0,void 0,void 0,void 0,void 0,void 0,s[i-1],O[i-1]),c.addConnectorMapping)c.addConnectorMapping(s[i-2],{text:"",type:"text"},O[i-4],O[i]);break;case 49:this.$=s[i].trim(),c.setAccTitle(this.$);break;case 50:case 51:this.$=s[i].trim(),c.setAccDescription(this.$);break;case 56:this.$=s[i-1]+s[i];break;case 57:this.$=s[i];break;case 58:if(c.addVertex(s[i-1][s[i-1].length-1],void 0,void 0,void 0,void 0,void 0,void 0,s[i],O[i]),c.extendVertexMapping)c.extendVertexMapping(s[i-1][s[i-1].length-1],O[i]);if(c.addLink(s[i-3].stmt,s[i-1],s[i-2]),c.addEdgeMapping)c.addEdgeMapping(s[i-3].stmt,s[i-1],s[i-2],this._$);this.$={stmt:s[i-1],nodes:s[i-1].concat(s[i-3].nodes)};break;case 59:if(c.addLink(s[i-2].stmt,s[i],s[i-1]),c.addEdgeMapping)c.addEdgeMapping(s[i-2].stmt,s[i],s[i-1],this._$);this.$={stmt:s[i],nodes:s[i].concat(s[i-2].nodes)};break;case 60:if(c.addLink(s[i-3].stmt,s[i-1],s[i-2]),c.addEdgeMapping)c.addEdgeMapping(s[i-3].stmt,s[i-1],s[i-2],this._$);this.$={stmt:s[i-1],nodes:s[i-1].concat(s[i-3].nodes)};break;case 61:this.$={stmt:s[i-1],nodes:s[i-1]};break;case 62:if(c.addVertex(s[i-1][s[i-1].length-1],void 0,void 0,void 0,void 0,void 0,void 0,s[i],O[i]),c.extendVertexMapping)c.extendVertexMapping(s[i-1][s[i-1].length-1],O[i]);this.$={stmt:s[i-1],nodes:s[i-1],shapeData:s[i]};break;case 63:this.$={stmt:s[i],nodes:s[i]};break;case 64:this.$=[s[i]];break;case 65:if(c.addVertex(s[i-5][s[i-5].length-1],void 0,void 0,void 0,void 0,void 0,void 0,s[i-4],O[i-4]),c.extendVertexMapping)c.extendVertexMapping(s[i-5][s[i-5].length-1],O[i-4]);this.$=s[i-5].concat(s[i]);break;case 66:this.$=s[i-4].concat(s[i]);break;case 67:this.$=s[i];break;case 68:this.$=s[i-2],c.setClass(s[i-2],s[i]);break;case 69:if(this.$=s[i-3],c.addVertex(s[i-3],s[i-1],"square"),c.addVertexMapping)c.addVertexMapping(s[i-3],s[i-1],"square",this._$);break;case 70:if(this.$=s[i-3],c.addVertex(s[i-3],s[i-1],"doublecircle"),c.addVertexMapping)c.addVertexMapping(s[i-3],s[i-1],"doublecircle",this._$);break;case 71:if(this.$=s[i-5],c.addVertex(s[i-5],s[i-2],"circle"),c.addVertexMapping)c.addVertexMapping(s[i-5],s[i-2],"circle",this._$);break;case 72:if(this.$=s[i-3],c.addVertex(s[i-3],s[i-1],"ellipse"),c.addVertexMapping)c.addVertexMapping(s[i-3],s[i-1],"ellipse",this._$);break;case 73:if(this.$=s[i-3],c.addVertex(s[i-3],s[i-1],"stadium"),c.addVertexMapping)c.addVertexMapping(s[i-3],s[i-1],"stadium",this._$);break;case 74:if(this.$=s[i-3],c.addVertex(s[i-3],s[i-1],"subroutine"),c.addVertexMapping)c.addVertexMapping(s[i-3],s[i-1],"subroutine",this._$);break;case 75:if(this.$=s[i-7],c.addVertex(s[i-7],s[i-1],"rect",void 0,void 0,void 0,Object.fromEntries([[s[i-5],s[i-3]]])),c.addVertexMapping)c.addVertexMapping(s[i-7],s[i-1],"rect",this._$);break;case 76:if(this.$=s[i-3],c.addVertex(s[i-3],s[i-1],"cylinder"),c.addVertexMapping)c.addVertexMapping(s[i-3],s[i-1],"cylinder",this._$);break;case 77:if(this.$=s[i-3],c.addVertex(s[i-3],s[i-1],"round"),c.addVertexMapping)c.addVertexMapping(s[i-3],s[i-1],"round",this._$);break;case 78:if(this.$=s[i-3],c.addVertex(s[i-3],s[i-1],"diamond"),c.addVertexMapping)c.addVertexMapping(s[i-3],s[i-1],"diamond",this._$);break;case 79:if(this.$=s[i-5],c.addVertex(s[i-5],s[i-2],"hexagon"),c.addVertexMapping)c.addVertexMapping(s[i-5],s[i-2],"hexagon",this._$);break;case 80:if(this.$=s[i-3],c.addVertex(s[i-3],s[i-1],"odd"),c.addVertexMapping)c.addVertexMapping(s[i-3],s[i-1],"odd",this._$);break;case 81:if(this.$=s[i-3],c.addVertex(s[i-3],s[i-1],"trapezoid"),c.addVertexMapping)c.addVertexMapping(s[i-3],s[i-1],"trapezoid",this._$);break;case 82:if(this.$=s[i-3],c.addVertex(s[i-3],s[i-1],"inv_trapezoid"),c.addVertexMapping)c.addVertexMapping(s[i-3],s[i-1],"inv_trapezoid",this._$);break;case 83:if(this.$=s[i-3],c.addVertex(s[i-3],s[i-1],"lean_right"),c.addVertexMapping)c.addVertexMapping(s[i-3],s[i-1],"lean_right",this._$);break;case 84:if(this.$=s[i-3],c.addVertex(s[i-3],s[i-1],"lean_left"),c.addVertexMapping)c.addVertexMapping(s[i-3],s[i-1],"lean_left",this._$);break;case 85:if(this.$=s[i],c.addVertex(s[i]),c.addVertexMapping)c.addVertexMapping(s[i],void 0,void 0,this._$);break;case 86:s[i-1].text=s[i],this.$=s[i-1];break;case 87:case 88:s[i-2].text=s[i-1],this.$=s[i-2];break;case 89:this.$=s[i];break;case 90:var Y=c.destructLink(s[i],s[i-2]);this.$={type:Y.type,stroke:Y.stroke,length:Y.length,edgeSemantic:Y.edgeSemantic,text:s[i-1]};break;case 91:var Y=c.destructLink(s[i],s[i-2]);this.$={type:Y.type,stroke:Y.stroke,length:Y.length,edgeSemantic:Y.edgeSemantic,text:s[i-1],id:s[i-3]};break;case 92:this.$={text:s[i],type:"text"};break;case 93:this.$={text:s[i-1].text+""+s[i],type:s[i-1].type};break;case 94:this.$={text:s[i],type:"string"};break;case 95:this.$={text:s[i],type:"markdown"};break;case 96:var Y=c.destructLink(s[i]);this.$={type:Y.type,stroke:Y.stroke,length:Y.length,edgeSemantic:Y.edgeSemantic};break;case 97:var Y=c.destructLink(s[i]);this.$={type:Y.type,stroke:Y.stroke,length:Y.length,edgeSemantic:Y.edgeSemantic,id:s[i-1]};break;case 98:this.$=s[i-1];break;case 99:this.$={text:s[i],type:"text"};break;case 100:this.$={text:s[i-1].text+""+s[i],type:s[i-1].type};break;case 101:this.$={text:s[i],type:"string"};break;case 102:case 119:this.$={text:s[i],type:"markdown"};break;case 116:this.$={text:s[i],type:"text"};break;case 117:this.$={text:s[i-1].text+""+s[i],type:s[i-1].type};break;case 118:this.$={text:s[i],type:"text"};break;case 120:this.$=s[i-4],c.addClass(s[i-2],s[i]);break;case 121:this.$=s[i-4],c.setClass(s[i-2],s[i]);break;case 122:case 130:this.$=s[i-1],c.setClickEvent(s[i-1],s[i]);break;case 123:case 131:this.$=s[i-3],c.setClickEvent(s[i-3],s[i-2]),c.setTooltip(s[i-3],s[i]);break;case 124:this.$=s[i-2],c.setClickEvent(s[i-2],s[i-1],s[i]);break;case 125:this.$=s[i-4],c.setClickEvent(s[i-4],s[i-3],s[i-2]),c.setTooltip(s[i-4],s[i]);break;case 126:this.$=s[i-2],c.setLink(s[i-2],s[i]);break;case 127:this.$=s[i-4],c.setLink(s[i-4],s[i-2]),c.setTooltip(s[i-4],s[i]);break;case 128:this.$=s[i-4],c.setLink(s[i-4],s[i-2],s[i]);break;case 129:this.$=s[i-6],c.setLink(s[i-6],s[i-4],s[i]),c.setTooltip(s[i-6],s[i-2]);break;case 132:this.$=s[i-1],c.setLink(s[i-1],s[i]);break;case 133:this.$=s[i-3],c.setLink(s[i-3],s[i-2]),c.setTooltip(s[i-3],s[i]);break;case 134:this.$=s[i-3],c.setLink(s[i-3],s[i-2],s[i]);break;case 135:this.$=s[i-5],c.setLink(s[i-5],s[i-4],s[i]),c.setTooltip(s[i-5],s[i-2]);break;case 136:this.$=s[i-4],c.addVertex(s[i-2],void 0,void 0,s[i]);break;case 137:this.$=s[i-4],c.updateLink([s[i-2]],s[i]);break;case 138:this.$=s[i-4],c.updateLink(s[i-2],s[i]);break;case 139:this.$=s[i-8],c.updateLinkInterpolate([s[i-6]],s[i-2]),c.updateLink([s[i-6]],s[i]);break;case 140:this.$=s[i-8],c.updateLinkInterpolate(s[i-6],s[i-2]),c.updateLink(s[i-6],s[i]);break;case 141:this.$=s[i-6],c.updateLinkInterpolate([s[i-4]],s[i]);break;case 142:this.$=s[i-6],c.updateLinkInterpolate(s[i-4],s[i]);break;case 143:case 145:this.$=[s[i]];break;case 144:case 146:s[i-2].push(s[i]),this.$=s[i-2];break;case 148:this.$=s[i-1]+s[i];break;case 196:this.$=s[i];break;case 197:this.$=s[i-1]+""+s[i];break;case 199:this.$=s[i-1]+""+s[i];break;case 200:this.$={stmt:"dir",value:"TB"};break;case 201:this.$={stmt:"dir",value:"BT"};break;case 202:this.$={stmt:"dir",value:"RL"};break;case 203:this.$={stmt:"dir",value:"LR"};break;case 204:this.$={stmt:"dir",value:"TD"};break}},"anonymous"),table:[{3:1,4:2,8:r,10:n,11:o,13:d},{1:[3]},e(h,u,{5:7}),{4:8,8:r,10:n,11:o,13:d},{4:9,8:r,10:n,11:o,13:d},{4:10,8:r,10:n,11:o,13:d},{14:[1,11],15:[1,12]},{1:[2,1],6:13,7:14,8:f,9:x,10:m,11:D,12:v,21:20,23:21,24:22,25:23,26:24,27:25,28:P,35:B,36:W,37:29,38:w,40:_,42:g,45:33,46:44,47:k,48:45,50:46,63:y,87:q,88:Ce,89:Ie,90:ve,91:Le,92:Q,105:J,108:Z,109:ee,112:te,114:se,116:47,117:ie,118:re,119:ne,124:He,125:Ye,126:Xe,127:Qe,128:Je},e(h,[2,10]),e(h,[2,11]),e(h,[2,12]),e(h,[2,13]),{8:[1,63],9:[1,60],10:[1,61],11:ze,16:59,19:62},e(N,[2,3]),e(N,[2,4]),e(N,[2,5]),e(N,[2,6]),e(N,[2,7]),e(N,[2,8]),e(N,[2,9]),{8:ke,9:me,10:Ae,12:Ee,22:65,44:66,75:71,78:[1,72],80:[1,74],81:[1,73]},{8:ke,9:me,10:Ae,12:Ee,22:75},{8:ke,9:me,10:Ae,12:Ee,22:76},{8:ke,9:me,10:Ae,12:Ee,22:77},{8:ke,9:me,10:Ae,12:Ee,22:78},{8:ke,9:me,10:Ae,12:Ee,22:79},{8:ke,9:me,10:Ae,11:[1,80],12:Ee,22:81},{8:ke,9:me,10:Ae,12:Ee,22:82},{11:[1,83]},e(N,[2,48]),{39:[1,84]},{41:[1,85]},e(N,[2,51]),e(st,[2,63],{19:86,34:87,11:ze,43:it}),{11:[1,89]},{11:[1,90]},{11:[1,91]},{11:[1,92]},{15:at,47:ot,63:ut,83:[1,96],92:lt,98:[1,93],100:[1,94],104:95,108:ct,109:dt,112:ht,114:pt,117:ft,118:gt,119:bt,123:97},e(N,[2,200]),e(N,[2,201]),e(N,[2,202]),e(N,[2,203]),e(N,[2,204]),e($e,[2,64]),e($e,[2,67],{49:[1,109]}),e(oe,[2,85],{116:122,30:[1,110],47:k,51:[1,111],53:[1,112],55:[1,113],57:[1,114],59:[1,115],61:[1,116],63:y,66:[1,117],68:[1,118],70:[1,119],71:[1,120],73:[1,121],92:Q,105:J,108:Z,109:ee,112:te,114:se,117:ie,118:re,119:ne}),e(xe,[2,196]),e(xe,[2,157]),e(xe,[2,158]),e(xe,[2,159]),e(xe,[2,160]),e(xe,[2,161]),e(xe,[2,162]),e(xe,[2,163]),e(xe,[2,164]),e(xe,[2,165]),e(xe,[2,166]),e(xe,[2,167]),e(h,[2,14]),e(h,[2,20]),e(h,[2,21]),{10:[1,123]},e(h,[2,23]),e(h1,[2,31],{19:124,11:ze}),e(N,[2,32]),{45:125,46:44,47:k,48:45,50:46,63:y,92:Q,105:J,108:Z,109:ee,112:te,114:se,116:47,117:ie,118:re,119:ne},e(N,[2,52]),e(N,[2,53]),e(N,[2,54]),e(N,[2,55]),e(kt,[2,89],{76:126,65:[1,128],77:[1,127]}),{79:129,82:130,83:p1,84:f1,119:_t,122:vt},{78:[1,135],80:[1,136]},e(g1,[2,96]),e(N,[2,33]),e(N,[2,34]),e(N,[2,35]),e(N,[2,36]),e(N,[2,37]),{11:Vt,13:It,15:Lt,28:Mt,29:137,33:yt,35:wt,36:Nt,47:Rt,63:Ot,78:Pt,83:b1,84:k1,86:150,87:Gt,88:Ut,89:jt,90:zt,91:Wt,92:Kt,93:Ht,94:138,108:Yt,112:qt,114:Xt,117:Qt,118:Jt,119:Zt},e(mt,u,{5:165}),e(mt,u,{5:166}),{11:Vt,13:It,15:Lt,28:Mt,29:167,33:yt,35:wt,36:Nt,47:Rt,63:Ot,78:Pt,83:b1,84:k1,86:150,87:Gt,88:Ut,89:jt,90:zt,91:Wt,92:Kt,93:Ht,94:138,108:Yt,112:qt,114:Xt,117:Qt,118:Jt,119:Zt},e(N,[2,49]),e(N,[2,50]),e(st,[2,61],{47:m1}),e(st,[2,62],{19:169,11:ze,43:At}),e($e,[2,57]),{47:k,50:171,63:y,92:Q,105:J,108:Z,109:ee,112:te,114:se,116:47,117:ie,118:re,119:ne},{105:[1,172],106:173,108:[1,174]},{47:k,50:175,63:y,92:Q,105:J,108:Z,109:ee,112:te,114:se,116:47,117:ie,118:re,119:ne},{47:k,50:176,63:y,92:Q,105:J,108:Z,109:ee,112:te,114:se,116:47,117:ie,118:re,119:ne},e(X,[2,122],{11:[1,177],99:[1,178]}),{83:[1,179]},e(X,[2,130],{123:181,11:[1,180],15:at,47:ot,63:ut,92:lt,108:ct,109:dt,112:ht,114:pt,117:ft,118:gt,119:bt}),e(X,[2,132],{11:[1,182]}),e(Te,[2,198]),e(Te,[2,185]),e(Te,[2,186]),e(Te,[2,187]),e(Te,[2,188]),e(Te,[2,189]),e(Te,[2,190]),e(Te,[2,191]),e(Te,[2,192]),e(Te,[2,193]),e(Te,[2,194]),e(Te,[2,195]),{47:k,50:183,63:y,92:Q,105:J,108:Z,109:ee,112:te,114:se,116:47,117:ie,118:re,119:ne},{31:184,70:G,83:fe,84:be,85:185,119:U,120:j,121:z},{31:192,70:G,83:fe,84:be,85:185,119:U,120:j,121:z},{31:194,53:[1,193],70:G,83:fe,84:be,85:185,119:U,120:j,121:z},{31:195,70:G,83:fe,84:be,85:185,119:U,120:j,121:z},{31:196,70:G,83:fe,84:be,85:185,119:U,120:j,121:z},{31:197,70:G,83:fe,84:be,85:185,119:U,120:j,121:z},{112:[1,198]},{31:199,70:G,83:fe,84:be,85:185,119:U,120:j,121:z},{31:200,68:[1,201],70:G,83:fe,84:be,85:185,119:U,120:j,121:z},{31:202,70:G,83:fe,84:be,85:185,119:U,120:j,121:z},{31:203,70:G,83:fe,84:be,85:185,119:U,120:j,121:z},{31:204,70:G,83:fe,84:be,85:185,119:U,120:j,121:z},e(xe,[2,197]),e(h,[2,22]),e(h1,[2,30]),e(st,[2,59],{34:205,19:206,11:ze,43:it}),e(kt,[2,86],{11:[1,207]}),{11:[1,208]},{31:209,70:G,83:fe,84:be,85:185,119:U,120:j,121:z},{80:[1,210],82:211,119:_t,122:vt},e(Et,[2,92]),e(Et,[2,94]),e(Et,[2,95]),e(Et,[2,183]),e(Et,[2,184]),{79:212,82:130,83:p1,84:f1,119:_t,122:vt},e(g1,[2,97]),{8:ke,9:me,10:Ae,11:Vt,12:Ee,13:It,15:Lt,22:214,28:Mt,30:[1,213],33:yt,34:215,35:wt,36:Nt,43:it,47:Rt,63:Ot,78:Pt,86:150,87:Gt,88:Ut,89:jt,90:zt,91:Wt,92:Kt,93:Ht,94:216,108:Yt,112:qt,114:Xt,117:Qt,118:Jt,119:Zt},e(K,[2,116]),e(K,[2,118]),e(K,[2,119]),e(K,[2,172]),e(K,[2,173]),e(K,[2,174]),e(K,[2,175]),e(K,[2,176]),e(K,[2,177]),e(K,[2,178]),e(K,[2,179]),e(K,[2,180]),e(K,[2,181]),e(K,[2,182]),e(K,[2,103]),e(K,[2,104]),e(K,[2,105]),e(K,[2,106]),e(K,[2,107]),e(K,[2,108]),e(K,[2,109]),e(K,[2,110]),e(K,[2,111]),e(K,[2,112]),e(K,[2,113]),e(K,[2,114]),e(K,[2,115]),{6:13,7:14,8:f,9:x,10:m,11:D,12:v,21:20,23:21,24:22,25:23,26:24,27:25,28:P,33:[1,217],35:B,36:W,37:29,38:w,40:_,42:g,45:33,46:44,47:k,48:45,50:46,63:y,87:q,88:Ce,89:Ie,90:ve,91:Le,92:Q,105:J,108:Z,109:ee,112:te,114:se,116:47,117:ie,118:re,119:ne,124:He,125:Ye,126:Xe,127:Qe,128:Je},{6:13,7:14,8:f,9:x,10:m,11:D,12:v,21:20,23:21,24:22,25:23,26:24,27:25,28:P,33:[1,218],35:B,36:W,37:29,38:w,40:_,42:g,45:33,46:44,47:k,48:45,50:46,63:y,87:q,88:Ce,89:Ie,90:ve,91:Le,92:Q,105:J,108:Z,109:ee,112:te,114:se,116:47,117:ie,118:re,119:ne,124:He,125:Ye,126:Xe,127:Qe,128:Je},{8:ke,9:me,10:Ae,11:Vt,12:Ee,13:It,15:Lt,22:220,28:Mt,30:[1,219],33:yt,34:221,35:wt,36:Nt,43:it,47:Rt,63:Ot,78:Pt,86:150,87:Gt,88:Ut,89:jt,90:zt,91:Wt,92:Kt,93:Ht,94:216,108:Yt,112:qt,114:Xt,117:Qt,118:Jt,119:Zt},{11:ze,19:222},{47:[1,223]},e($e,[2,56]),{11:[1,224],47:k,63:y,92:Q,105:J,108:Z,109:ee,112:te,114:se,116:122,117:ie,118:re,119:ne},{11:[1,225]},{11:[1,226],109:[1,227]},e(A1,[2,143]),{11:[1,228],47:k,63:y,92:Q,105:J,108:Z,109:ee,112:te,114:se,116:122,117:ie,118:re,119:ne},{11:[1,229],47:k,63:y,92:Q,105:J,108:Z,109:ee,112:te,114:se,116:122,117:ie,118:re,119:ne},{83:[1,230]},e(X,[2,124],{11:[1,231]}),e(X,[2,126],{11:[1,232]}),{83:[1,233]},e(Te,[2,199]),{83:[1,234],101:[1,235]},e($e,[2,68],{116:122,47:k,63:y,92:Q,105:J,108:Z,109:ee,112:te,114:se,117:ie,118:re,119:ne}),{32:[1,236],70:G,85:237,119:U,120:j,121:z},e(We,[2,99]),e(We,[2,101]),e(We,[2,102]),e(We,[2,168]),e(We,[2,169]),e(We,[2,170]),e(We,[2,171]),{52:[1,238],70:G,85:237,119:U,120:j,121:z},{31:239,70:G,83:fe,84:be,85:185,119:U,120:j,121:z},{54:[1,240],70:G,85:237,119:U,120:j,121:z},{56:[1,241],70:G,85:237,119:U,120:j,121:z},{58:[1,242],70:G,85:237,119:U,120:j,121:z},{60:[1,243],70:G,85:237,119:U,120:j,121:z},{63:[1,244]},{67:[1,245],70:G,85:237,119:U,120:j,121:z},{69:[1,246],70:G,85:237,119:U,120:j,121:z},{31:247,70:G,83:fe,84:be,85:185,119:U,120:j,121:z},{32:[1,248],70:G,85:237,119:U,120:j,121:z},{70:G,72:[1,249],74:[1,250],85:237,119:U,120:j,121:z},{70:G,72:[1,252],74:[1,251],85:237,119:U,120:j,121:z},e(st,[2,58],{19:169,11:ze,43:At}),e(st,[2,60],{47:m1}),e(kt,[2,88]),e(kt,[2,87]),{65:[1,253],70:G,85:237,119:U,120:j,121:z},e(kt,[2,90]),e(Et,[2,93]),{80:[1,254],82:211,119:_t,122:vt},{31:255,70:G,83:fe,84:be,85:185,119:U,120:j,121:z},e(mt,u,{5:256}),{8:ke,9:me,10:Ae,12:Ee,22:257,43:At},e(K,[2,117]),e(N,[2,42]),e(N,[2,43]),{31:258,70:G,83:fe,84:be,85:185,119:U,120:j,121:z},e(N,[2,46]),{8:ke,9:me,10:Ae,12:Ee,22:259,43:At},{46:260,47:k,48:45,50:46,63:y,92:Q,105:J,108:Z,109:ee,112:te,114:se,116:47,117:ie,118:re,119:ne},{11:ze,19:261},{11:Be,63:Me,87:we,95:262,108:Ne,110:263,111:264,112:Oe,113:Pe,114:Ge,115:Ue},{11:Be,63:Me,87:we,95:273,107:[1,274],108:Ne,110:263,111:264,112:Oe,113:Pe,114:Ge,115:Ue},{11:Be,63:Me,87:we,95:275,107:[1,276],108:Ne,110:263,111:264,112:Oe,113:Pe,114:Ge,115:Ue},{108:[1,277]},{11:Be,63:Me,87:we,95:278,108:Ne,110:263,111:264,112:Oe,113:Pe,114:Ge,115:Ue},{47:k,50:279,63:y,92:Q,105:J,108:Z,109:ee,112:te,114:se,116:47,117:ie,118:re,119:ne},e(X,[2,123]),{83:[1,280]},{83:[1,281],101:[1,282]},e(X,[2,131]),e(X,[2,133],{11:[1,283]}),e(X,[2,134]),e(oe,[2,69]),e(We,[2,100]),e(oe,[2,70]),{54:[1,284],70:G,85:237,119:U,120:j,121:z},e(oe,[2,77]),e(oe,[2,72]),e(oe,[2,73]),e(oe,[2,74]),{112:[1,285]},e(oe,[2,76]),e(oe,[2,78]),{69:[1,286],70:G,85:237,119:U,120:j,121:z},e(oe,[2,80]),e(oe,[2,81]),e(oe,[2,83]),e(oe,[2,82]),e(oe,[2,84]),e([11,47,63,92,105,108,109,112,114,117,118,119],[2,98]),e(kt,[2,91]),{32:[1,287],70:G,85:237,119:U,120:j,121:z},{6:13,7:14,8:f,9:x,10:m,11:D,12:v,21:20,23:21,24:22,25:23,26:24,27:25,28:P,33:[1,288],35:B,36:W,37:29,38:w,40:_,42:g,45:33,46:44,47:k,48:45,50:46,63:y,87:q,88:Ce,89:Ie,90:ve,91:Le,92:Q,105:J,108:Z,109:ee,112:te,114:se,116:47,117:ie,118:re,119:ne,124:He,125:Ye,126:Xe,127:Qe,128:Je},e(mt,u,{5:289}),{32:[1,290],70:G,85:237,119:U,120:j,121:z},e(N,[2,47]),e($e,[2,66]),{46:291,47:k,48:45,50:46,63:y,92:Q,105:J,108:Z,109:ee,112:te,114:se,116:47,117:ie,118:re,119:ne},e(X,[2,136],{109:Ct}),e(E1,[2,145],{111:293,11:Be,63:Me,87:we,108:Ne,112:Oe,113:Pe,114:Ge,115:Ue}),e(Ve,[2,147]),e(Ve,[2,149]),e(Ve,[2,150]),e(Ve,[2,151]),e(Ve,[2,152]),e(Ve,[2,153]),e(Ve,[2,154]),e(Ve,[2,155]),e(Ve,[2,156]),e(X,[2,137],{109:Ct}),{11:[1,294]},e(X,[2,138],{109:Ct}),{11:[1,295]},e(A1,[2,144]),e(X,[2,120],{109:Ct}),e(X,[2,121],{116:122,47:k,63:y,92:Q,105:J,108:Z,109:ee,112:te,114:se,117:ie,118:re,119:ne}),e(X,[2,125]),e(X,[2,127],{11:[1,296]}),e(X,[2,128]),{101:[1,297]},{54:[1,298]},{65:[1,299]},{69:[1,300]},{8:ke,9:me,10:Ae,12:Ee,22:301,34:302,43:it},e(N,[2,40]),{6:13,7:14,8:f,9:x,10:m,11:D,12:v,21:20,23:21,24:22,25:23,26:24,27:25,28:P,33:[1,303],35:B,36:W,37:29,38:w,40:_,42:g,45:33,46:44,47:k,48:45,50:46,63:y,87:q,88:Ce,89:Ie,90:ve,91:Le,92:Q,105:J,108:Z,109:ee,112:te,114:se,116:47,117:ie,118:re,119:ne,124:He,125:Ye,126:Xe,127:Qe,128:Je},{8:ke,9:me,10:Ae,12:Ee,22:304,34:305,43:it},e($e,[2,65]),{11:Be,63:Me,87:we,108:Ne,110:306,111:264,112:Oe,113:Pe,114:Ge,115:Ue},e(Ve,[2,148]),{15:at,47:ot,63:ut,92:lt,104:307,108:ct,109:dt,112:ht,114:pt,117:ft,118:gt,119:bt,123:97},{15:at,47:ot,63:ut,92:lt,104:308,108:ct,109:dt,112:ht,114:pt,117:ft,118:gt,119:bt,123:97},{101:[1,309]},e(X,[2,135]),e(oe,[2,71]),{31:310,70:G,83:fe,84:be,85:185,119:U,120:j,121:z},e(oe,[2,79]),e(mt,u,{5:311}),{8:ke,9:me,10:Ae,12:Ee,22:312,43:At},e(N,[2,41]),e(N,[2,44]),{8:ke,9:me,10:Ae,12:Ee,22:313,43:At},e(E1,[2,146],{111:293,11:Be,63:Me,87:we,108:Ne,112:Oe,113:Pe,114:Ge,115:Ue}),e(X,[2,141],{123:181,11:[1,314],15:at,47:ot,63:ut,92:lt,108:ct,109:dt,112:ht,114:pt,117:ft,118:gt,119:bt}),e(X,[2,142],{123:181,11:[1,315],15:at,47:ot,63:ut,92:lt,108:ct,109:dt,112:ht,114:pt,117:ft,118:gt,119:bt}),e(X,[2,129]),{32:[1,316],70:G,85:237,119:U,120:j,121:z},{6:13,7:14,8:f,9:x,10:m,11:D,12:v,21:20,23:21,24:22,25:23,26:24,27:25,28:P,33:[1,317],35:B,36:W,37:29,38:w,40:_,42:g,45:33,46:44,47:k,48:45,50:46,63:y,87:q,88:Ce,89:Ie,90:ve,91:Le,92:Q,105:J,108:Z,109:ee,112:te,114:se,116:47,117:ie,118:re,119:ne,124:He,125:Ye,126:Xe,127:Qe,128:Je},e(mt,u,{5:318}),e(N,[2,45]),{11:Be,63:Me,87:we,95:319,108:Ne,110:263,111:264,112:Oe,113:Pe,114:Ge,115:Ue},{11:Be,63:Me,87:we,95:320,108:Ne,110:263,111:264,112:Oe,113:Pe,114:Ge,115:Ue},e(oe,[2,75]),e(N,[2,38]),{6:13,7:14,8:f,9:x,10:m,11:D,12:v,21:20,23:21,24:22,25:23,26:24,27:25,28:P,33:[1,321],35:B,36:W,37:29,38:w,40:_,42:g,45:33,46:44,47:k,48:45,50:46,63:y,87:q,88:Ce,89:Ie,90:ve,91:Le,92:Q,105:J,108:Z,109:ee,112:te,114:se,116:47,117:ie,118:re,119:ne,124:He,125:Ye,126:Xe,127:Qe,128:Je},e(X,[2,139],{109:Ct}),e(X,[2,140],{109:Ct}),e(N,[2,39])],defaultActions:{},parseError:t(function(F,V){if(V.recoverable)this.trace(F);else{var I=Error(F);throw I.hash=V,I}},"parseError"),parse:t(function(F){var V=this,I=[0],c=[],H=[null],s=[],O=this.table,i="",Y=0,C1=0,S1=0,R1=2,x1=1,O1=s.slice.call(arguments,1),ae=Object.create(this.lexer),et={yy:{}};for(var n1 in this.yy)if(Object.prototype.hasOwnProperty.call(this.yy,n1))et.yy[n1]=this.yy[n1];if(ae.setInput(F,et.yy),et.yy.lexer=ae,et.yy.parser=this,typeof ae.yylloc>"u")ae.yylloc={};var a1=ae.yylloc;s.push(a1);var P1=ae.options&&ae.options.ranges;if(typeof et.yy.parseError==="function")this.parseError=et.yy.parseError;else this.parseError=Object.getPrototypeOf(this).parseError;function G1(_e){I.length=I.length-2*_e,H.length=H.length-_e,s.length=s.length-_e}t(G1,"popStack");function T1(){var _e=c.pop()||ae.lex()||x1;if(typeof _e!=="number"){if(_e instanceof Array)c=_e,_e=c.pop();_e=V.symbols_[_e]||_e}return _e}t(T1,"lex");var Se,o1,tt,De,is,u1,St={},e1,je,D1,t1;while(!0){if(tt=I[I.length-1],this.defaultActions[tt])De=this.defaultActions[tt];else{if(Se===null||typeof Se>"u")Se=T1();De=O[tt]&&O[tt][Se]}if(typeof De>"u"||!De.length||!De[0]){var l1="";t1=[];for(e1 in O[tt])if(this.terminals_[e1]&&e1>R1)t1.push("'"+this.terminals_[e1]+"'");if(ae.showPosition)l1="Parse error on line "+(Y+1)+`:
22
+ You have to call mermaid.initialize.`)}isLinkData(e){return e!==null&&typeof e==="object"&&"id"in e&&typeof e.id==="string"}addLink(e,r,n){let o=this.isLinkData(n)?n.id.replace("@",""):void 0;a.info("addLink",e,r,o);for(let d of e)for(let h of r){let u=d===e[e.length-1],f=h===r[0];if(u&&f)this.addSingleLink(d,h,n,o);else this.addSingleLink(d,h,n,void 0)}}updateLinkInterpolate(e,r){e.forEach((n)=>{if(n==="default"){this.edges.defaultInterpolate=r;return}if(typeof n==="number"&&n>=this.edges.length)throw Error(`The index ${n} for linkStyle is out of bounds. Valid indices for linkStyle are between 0 and ${this.edges.length-1}. (Help: Ensure that the index is within the range of existing edges.)`);this.edges[n].interpolate=r})}updateLink(e,r){e.forEach((n)=>{if(typeof n==="number"&&n>=this.edges.length)throw Error(`The index ${n} for linkStyle is out of bounds. Valid indices for linkStyle are between 0 and ${this.edges.length-1}. (Help: Ensure that the index is within the range of existing edges.)`);if(n==="default")this.edges.defaultStyle=r;else if(this.edges[n].style=r,(this.edges[n]?.style?.length??0)>0&&!this.edges[n]?.style?.some((o)=>o?.startsWith("fill")))this.edges[n]?.style?.push("fill:none")})}addClass(e,r){let n=r.join().replace(/\\,/g,"§§§").replace(/,/g,";").replace(/§§§/g,",").split(";");e.split(",").forEach((o)=>{let d=this.classes.get(o);if(d===void 0)d={id:o,styles:[],textStyles:[]},this.classes.set(o,d);if(n!==void 0&&n!==null)n.forEach((h)=>{if(/color/.exec(h)){let u=h.replace("fill","bgFill");d.textStyles.push(u)}d.styles.push(h)})})}setDirection(e){if(this.direction=e.trim(),/.*</.exec(this.direction))this.direction="RL";if(/.*\^/.exec(this.direction))this.direction="BT";if(/.*>/.exec(this.direction))this.direction="LR";if(/.*v/.exec(this.direction))this.direction="TB";if(this.direction==="TD")this.direction="TB"}setClass(e,r){for(let n of e.split(",")){let o=this.vertices.get(n);if(o)o.classes.push(r);let d=this.edges.find((u)=>u.id===n);if(d)d.classes.push(r);let h=this.subGraphLookup.get(n);if(h)h.classes.push(r)}}setTooltip(e,r){if(r===void 0)return;r=this.sanitizeText(r);for(let n of e.split(","))this.tooltips.set(this.version==="gen-1"?this.lookUpDomId(n):n,r)}setClickFun(e,r,n){if(l().securityLevel!=="loose")return;if(r===void 0)return;let o=[];if(typeof n==="string"){o=n.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);for(let h=0;h<o.length;h++){let u=o[h].trim();if(u.startsWith('"')&&u.endsWith('"'))u=u.substr(1,u.length-2);o[h]=u}}if(o.length===0)o.push(e);let d=this.vertices.get(e);if(d)d.haveCallback=!0,this.funs.push(()=>{let h=this.lookUpDomId(e),u=document.querySelector(`[id="${h}"]`);if(u!==null)u.addEventListener("click",()=>{M.runFunc(r,...o)},!1)})}setLink(e,r,n){e.split(",").forEach((o)=>{let d=this.vertices.get(o);if(d!==void 0)d.link=M.formatUrl(r,this.config),d.linkTarget=n}),this.setClass(e,"clickable")}getTooltip(e){return this.tooltips.get(e)}setClickEvent(e,r,n){e.split(",").forEach((o)=>{this.setClickFun(o,r,n)}),this.setClass(e,"clickable")}bindFunctions(e){this.funs.forEach((r)=>{r(e)})}getDirection(){return this.direction?.trim()}getVertices(){return this.vertices}getEdges(){return this.edges}isToolDefinition(e){return H1.has(e.type)}getTools(){let e=[];for(let r of this.vertices.values())if(this.isToolDefinition(r))e.push(r);return e}getClasses(){return this.classes}setupToolTips(e){let r=Ft();p(e).select("svg").selectAll("g.node").on("mouseover",(d)=>{let h=p(d.currentTarget),u=h.attr("title");if(u===null)return;let f=d.currentTarget?.getBoundingClientRect();r.transition().duration(200).style("opacity",".9"),r.text(h.attr("title")).style("left",window.scrollX+f.left+(f.right-f.left)/2+"px").style("top",window.scrollY+f.bottom+"px"),r.html(Re.sanitize(u)),h.classed("hover",!0)}).on("mouseout",(d)=>{r.transition().duration(500).style("opacity",0),p(d.currentTarget).classed("hover",!1)})}clear(e="gen-2"){this.vertices=new Map,this.classes=new Map,this.edges=[],this.funs=[this.setupToolTips.bind(this)],this.subGraphs=[],this.subGraphLookup=new Map,this.globalNodes=new Set,this.connectors=new Map,this.subCount=0,this.tooltips=new Map,this.firstGraphFlag=!0,this.version=e,this.config=l(),this.diagramId="",this.vertexCounter=0,this.direction=void 0,this.secCount=-1,this.posCrossRef=[],this.frontmatterLineOffset=0,this.elementMappings=[],this.bareVertexMappings=new WeakSet,this.diagnostics=[],this.postParseValidationRun=!1,C()}setGen(e){this.version=e||"gen-2"}defaultStyle(){return"fill:#ffa;stroke: #f66; stroke-width: 3px; stroke-dasharray: 5, 5;fill:#ffa;stroke: #666;"}addSubGraph(e,r,n,o){let d=e?.text?.trim(),h=n?.text;if(e===n&&n?.text&&/\s/.exec(n.text))d=void 0;let f=t((B)=>{let W={boolean:{},number:{},string:{}},w=[],_;return{nodeList:B.filter(function(k){let y=typeof k;if(k.stmt&&k.stmt==="dir")return _=k.value,!1;if(k.trim()==="")return!1;if(y in W)return W[y].hasOwnProperty(k)?!1:W[y][k]=!0;else return w.includes(k)?!1:w.push(k)}),dir:_}},"uniq")(r.flat()),{nodeList:x,dir:m}=f,D=l().flowchart??{};if(m=m??(D.inheritDir?this.getDirection()??l().direction??void 0:void 0),this.version==="gen-1")for(let B=0;B<x.length;B++)x[B]=this.lookUpDomId(x[B]);d=d??"subGraph"+this.subCount,h=h||"",h=this.sanitizeText(h),this.subCount=this.subCount+1;let v={id:d,nodes:x.filter((B)=>B!==d&&!this.globalNodes.has(B)),title:h.trim(),classes:[],dir:m,labelType:this.sanitizeNodeLabelType(n?.type),type:o??"flow"};a.info("Adding",v.id,v.nodes,v.dir),v.nodes=this.makeUniq(v,this.subGraphs).nodes;let P=this.getPosForId(d);if(P!==-1){let B=this.subGraphs[P];for(let W of v.nodes)if(!B.nodes.includes(W))B.nodes.push(W);if(v.title)B.title=v.title;if(v.dir)B.dir=v.dir;if(v.type)B.type=v.type;this.subGraphLookup.set(d,B)}else this.subGraphs.push(v),this.subGraphLookup.set(d,v);return d}addGlobal(e){for(let r of e.flat()){if(typeof r!=="string")continue;let n=r.trim();if(n!=="")this.globalNodes.add(n)}for(let r of this.subGraphs)r.nodes=r.nodes.filter((n)=>!this.globalNodes.has(n))}getPosForId(e){for(let[r,n]of this.subGraphs.entries())if(n.id===e)return r;return-1}indexNodes2(e,r){let n=this.subGraphs[r].nodes;if(this.secCount=this.secCount+1,this.secCount>2000)return{result:!1,count:0};if(this.posCrossRef[this.secCount]=r,this.subGraphs[r].id===e)return{result:!0,count:0};let o=0,d=1;while(o<n.length){let h=this.getPosForId(n[o]);if(h>=0){let u=this.indexNodes2(e,h);if(u.result)return{result:!0,count:d+u.count};else d=d+u.count}o=o+1}return{result:!1,count:d}}getDepthFirstPos(e){return this.posCrossRef[e]}indexNodes(){if(this.secCount=-1,this.subGraphs.length>0)this.indexNodes2("none",this.subGraphs.length-1)}addConnector(e,r){let n=e?.text?.trim();if(!n)return"";let o=r?.text?.trim()??"",d=o.length>0?this.sanitizeText(o):n,h=this.connectors.get(n);if(!h)h={id:n,labelType:"text",domId:_1+n+"-"+this.vertexCounter,styles:[],classes:[],isConnector:!0,text:d},this.connectors.set(n,h),this.vertices.set(n,h),this.vertexCounter++;else if(o.length>0)h.text=d;return n}getSubGraphs(){return this.subGraphs}getConnectors(){return[...this.connectors.values()]}firstGraph(){if(this.firstGraphFlag)return this.firstGraphFlag=!1,!0;return!1}computeEdgeSemantic(e,r){if(e==="arrow_point"&&r==="normal")return"sequence";if(e==="arrow_cross"&&r==="normal")return"failure";if(e==="arrow_open"&&r==="dotted")return"reference";return}destructStartLink(e){let r=e.trim(),n="arrow_open",o="normal";if(r.includes("."))o="dotted";return{type:"arrow_open",stroke:o}}countChar(e,r){let n=r.length,o=0;for(let d=0;d<n;++d)if(r[d]===e)++o;return o}destructEndLink(e){let r=e.trim(),n=r.slice(0,-1),o="arrow_open";switch(r.slice(-1)){case"x":o="arrow_cross";break;case">":o="arrow_point";break;case"-":case".":o="arrow_open",n=r;break}let d="normal",h=n.length-1,u=this.countChar(".",n);if(u>0)d="dotted",h=u;return{type:o,stroke:d,length:h}}destructLink(e,r){let n=this.destructEndLink(e),o;if(r){if(o=this.destructStartLink(r),o.stroke!==n.stroke)return{type:"INVALID",stroke:"INVALID"};return o.type=n.type,o.length=n.length,{...o,edgeSemantic:this.computeEdgeSemantic(o.type,o.stroke)}}return{...n,edgeSemantic:this.computeEdgeSemantic(n.type,n.stroke)}}exists(e,r){for(let n of e)if(n.nodes.includes(r))return!0;return!1}makeUniq(e,r){let n=[];return e.nodes.forEach((o,d)=>{if(!this.exists(r,o))n.push(e.nodes[d])}),{nodes:n}}getTypeFromVertex(e){let r=typeof e.type==="string"?Tt(e.type):e.type;switch(r){case"square":case void 0:return"squareRect";case"round":return"roundedRect";case"ellipse":return"ellipse";default:return r}}findNode(e,r){return e.find((n)=>n.id===r)}destructEdgeType(e){let r="none",n="arrow_point";switch(e){case"arrow_point":case"arrow_circle":case"arrow_cross":case"arrow_hierarchy":n=e;break;case"double_arrow_point":case"double_arrow_circle":case"double_arrow_cross":r=e.replace("double_",""),n=r;break}return{arrowTypeStart:r,arrowTypeEnd:n}}addNodeFromVertex(e,r,n,o,d,h){let u=n.get(e.id),f=o.get(e.id)??!1,x=this.findNode(r,e.id);if(x)x.cssStyles=e.styles,x.cssCompiledStyles=this.getCompiledStyles(e.classes),x.cssClasses=e.classes.join(" ");else{let m={id:e.id,label:e.text,labelType:e.labelType,labelStyle:"",parentId:u,padding:d.flowchart?.padding||8,cssStyles:e.styles,cssCompiledStyles:this.getCompiledStyles(["default","node",...e.classes]),cssClasses:"default "+e.classes.join(" "),dir:e.dir,domId:e.domId,look:h,link:e.link,linkTarget:e.linkTarget,tooltip:this.getTooltip(e.id),metadata:e.metadata};if(f)r.push({...m,isGroup:!0,shape:"rect"});else r.push({...m,isGroup:!1,shape:this.getTypeFromVertex(e),wrappingWidth:d.agentflow?.wrappingWidth,minWidth:d.agentflow?.minNodeWidth})}}getCompiledStyles(e){let r=[];for(let n of e){let o=this.classes.get(n);if(o?.styles)r=[...r,...o.styles??[]].map((d)=>d.trim());if(o?.textStyles)r=[...r,...o.textStyles??[]].map((d)=>d.trim())}return r}runPostParseValidators(){if(this.postParseValidationRun)return;this.postParseValidationRun=!0}getData(){this.runPostParseValidators();let e=l(),r=[],n=[],o=this.getSubGraphs(),d=new Map,h=new Map,u=new Set,f=new Map,x=t((g,k,y=new Set)=>{if(y.has(g))return;y.add(g);let q=this.subGraphLookup.get(g);if(!q)return;for(let Ce of q.nodes){if(Ce===k||y.has(Ce))continue;u.add(Ce),f.set(Ce,k),x(Ce,k,y)}},"collectDescendants");for(let g of o)if(g.metadata?.view==="collapsed"&&!u.has(g.id))x(g.id,g.id);let m=t((g,k)=>{let y=new Set,q=k;while(q!==void 0&&!y.has(q)){if(q===g)return!0;y.add(q),q=d.get(q)}return!1},"wouldCloseContainmentCycle");for(let g=o.length-1;g>=0;g--){let k=o[g];if(u.has(k.id))continue;if(k.nodes.length>0)h.set(k.id,!0);for(let y of k.nodes){if(m(y,k.id)){this.emitWarning(Dt.CONTAINMENT_VIOLATION,`Container "${k.id}" cannot contain "${y}" because "${y}" already contains it. The nesting that would close the loop is dropped.`,{nodeId:y});continue}d.set(y,k.id)}}for(let g=o.length-1;g>=0;g--){let k=o[g];if(u.has(k.id))continue;if(k.metadata?.view==="collapsed"){let q={...k.metadata,containerType:k.type};r.push({id:k.id,label:k.title,labelStyle:"",labelType:k.labelType,parentId:d.get(k.id),padding:8,cssCompiledStyles:this.getCompiledStyles(k.classes),cssClasses:k.classes.join(" "),shape:"collapsedGroup",dir:k.dir,isGroup:!1,look:e.look,metadata:q})}else r.push({id:k.id,label:k.title,labelStyle:"",labelType:k.labelType,parentId:d.get(k.id),padding:8,cssCompiledStyles:this.getCompiledStyles(k.classes),cssClasses:k.classes.join(" "),shape:Y1[k.type??"flow"],dir:k.dir,isGroup:!0,look:e.look,metadata:k.metadata})}this.getVertices().forEach((g)=>{if(u.has(g.id))return;this.addNodeFromVertex(g,r,d,h,e,e.look||"classic")});let v=this.getEdges();v.forEach((g,k)=>{let y=f.get(g.start)??g.start,q=f.get(g.end)??g.end;if(y===q&&g.start!==g.end)return;let{arrowTypeStart:Ce,arrowTypeEnd:Ie}=this.destructEdgeType(g.type),ve=[...v.defaultStyle??[]];if(g.style)ve.push(...g.style);let Le={id:Fe(y,q,{counter:k,prefix:"L"},g.id),isUserDefinedId:g.isUserDefinedId,start:y,end:q,type:g.type??"normal",label:g.text,labelType:g.labelType,labelpos:"c",thickness:g.stroke,minlen:g.length,classes:g?.stroke==="invisible"?"":"edge-thickness-normal edge-pattern-solid flowchart-link",arrowTypeStart:g?.stroke==="invisible"||g?.type==="arrow_open"?"none":Ce,arrowTypeEnd:g?.stroke==="invisible"||g?.type==="arrow_open"?"none":Ie,arrowheadStyle:"fill: #333",cssCompiledStyles:this.getCompiledStyles(g.classes),labelStyle:ve,style:ve,pattern:g.stroke,look:e.look,animate:g.animate,animation:g.animation,curve:g.interpolate||this.edges.defaultInterpolate||e.flowchart?.curve,metadata:g.metadata};n.push(Le)}),v1(r,this);let P=new Map,B=new Map;for(let g of o){let k=d.get(g.id);if(k!==void 0)B.set(k,[...B.get(k)??[],g.id])}let W=0,w=t((g)=>{if(P.has(g))return;P.set(g,W++);for(let k of B.get(g)??[])w(k)},"walkContainers");for(let g of o)if(d.get(g.id)===void 0)w(g.id);let _=new Set(this.getConnectors().map((g)=>g.id));return B1(r,(g)=>{if(_.has(g))return"connector";let k=this.vertices.get(g);return k?this.deriveVertexKind(k,Tt(k.type)):void 0},P),{nodes:r,edges:n,other:{},config:e,connectors:this.getConnectors()}}defaultConfig(){return An.flowchart}deriveVertexKind(e,r){if(this.isToolDefinition(e))return"tool";if(r==="hexagon"||r==="hex")return"action";if(r==="lean-right"||r==="lean_right")return"input";if(r==="lin-doc"||r==="lined-document")return"refdoc";if(r==="diamond")return"decision";return"task"}getSemanticModel(){this.runPostParseValidators();let e=new Set(this.subGraphs.map((u)=>u.id)),r=[],n=[];for(let[u,f]of this.vertices){if(e.has(u))continue;if(f.isConnector){let D={id:u};if(f.text!==void 0&&f.text!==u)D.title=f.text;if(f.metadata&&Object.keys(f.metadata).length>0){let v={};for(let[P,B]of Object.entries(f.metadata)){if(c1.has(P))continue;v[P]=B}if(Object.keys(v).length>0)D.metadata=v}n.push(D);continue}let x={id:u};if(f.text!==void 0)x.label=f.text;let m=typeof f.type==="string"?Tt(f.type):f.type;if(m!==void 0)x.shape=m;if(x.vertexKind=this.deriveVertexKind(f,m),f.metadata&&Object.keys(f.metadata).length>0){let D={};for(let[v,P]of Object.entries(f.metadata)){if(c1.has(v))continue;D[v]=P}if(Object.keys(D).length>0)x.metadata=D}r.push(x)}let o=this.edges.map((u)=>{let f={start:u.start,end:u.end};if(u.id!==void 0)f.id=u.id;if(typeof u.text==="string"&&u.text.length>0)f.label=u.text;if(u.type!==void 0)f.type=u.type;if(u.stroke!==void 0)f.stroke=u.stroke;if(u.edgeSemantic!==void 0)f.edgeSemantic=u.edgeSemantic;if(u.length!==void 0)f.length=u.length;if(u.metadata&&Object.keys(u.metadata).length>0)f.metadata={...u.metadata};return f}),d=this.subGraphs.map((u)=>{let f={id:u.id,nodes:[...u.nodes]};if(u.type!==void 0)f.type=u.type;if(u.title!==void 0)f.title=u.title;if(u.dir!==void 0)f.direction=u.dir;if(u.metadata&&Object.keys(u.metadata).length>0){let x={};for(let[m,D]of Object.entries(u.metadata)){if(c1.has(m))continue;x[m]=D}if(Object.keys(x).length>0)f.metadata=x}return f}),h={vertices:r,edges:o,subGraphs:d,connectors:n,diagnostics:this.diagnostics};if(this.direction!==void 0)h.direction=this.direction;return h}setFrontmatterLineOffset(e){this.frontmatterLineOffset=e??0}toElementPosition(e){let r=e?.first_line??0,n=e?.first_column??0,o=e?.last_line??r,d=e?.last_column??n,[h,u]=e?.range??[0,0];return{startLine:r+this.frontmatterLineOffset,startColumn:n,endLine:o+this.frontmatterLineOffset,endColumn:d,startIndex:h,endIndex:u}}pushMapping(e,r,n){if(!e)return;let o={id:e,type:r,position:this.toElementPosition(n)};return this.elementMappings.push(o),o}addVertexMapping(e,r,n,o){let d=this.pushMapping(e,"vertex",o);if(d&&n==null)this.bareVertexMappings.add(d)}extendVertexMapping(e,r){if(!e||!r)return;let n=this.toElementPosition(r);for(let o=this.elementMappings.length-1;o>=0;o--){let d=this.elementMappings[o];if(d.type==="vertex"&&d.id===e){if(this.bareVertexMappings.has(d))d.type="attachment",this.bareVertexMappings.delete(d);if(n.endLine>d.position.endLine||n.endLine===d.position.endLine&&n.endColumn>d.position.endColumn)d.position.endLine=n.endLine,d.position.endColumn=n.endColumn,d.position.endIndex=n.endIndex;return}}this.pushMapping(e,"attachment",r)}addEdgeMapping(e,r,n,o){let d=Array.isArray(r)?r.map((u)=>typeof u==="string"?u:u?.id??"").filter(Boolean):[],h=d.length>0?d.join(">"):"edge";this.pushMapping(h,"edge",o)}addSubgraphMapping(e,r,n,o){let d=(typeof e==="string"?e:e?.text)??"",h=this.toElementPosition(n),u=o?this.toElementPosition(o):h;if(!d)return;this.elementMappings.push({id:d,type:"subgraph",position:{startLine:h.startLine,startColumn:h.startColumn,endLine:u.endLine,endColumn:u.endColumn,startIndex:h.startIndex,endIndex:u.endIndex}})}addConnectorMapping(e,r,n,o){let d=e?.text?.trim()??"";if(!d)return;let h=this.toElementPosition(n),u=o?this.toElementPosition(o):h;this.elementMappings.push({id:d,type:"connector",position:{startLine:h.startLine,startColumn:h.startColumn,endLine:u.endLine,endColumn:u.endColumn,startIndex:h.startIndex,endIndex:u.endIndex}})}getElementMappings(){return[...this.elementMappings]}getElementById(e){return this.elementMappings.find((r)=>r.id===e)}getElementsOnLine(e){return this.elementMappings.filter((r)=>e>=r.position.startLine&&e<=r.position.endLine)}getElementAtPosition(e,r){let n=this.elementMappings.filter((d)=>{let{startLine:h,startColumn:u,endLine:f,endColumn:x}=d.position;if(e<h||e>f)return!1;if(e===h&&r<u)return!1;if(e===f&&r>x)return!1;return!0});if(n.length===0)return;let o=t(({position:d})=>[d.endLine-d.startLine,d.endColumn-d.startColumn],"span");return n.reduce((d,h)=>{let[u,f]=o(d),[x,m]=o(h);if(x!==u)return x<u?h:d;return m<f?h:d})}getMappingStats(){let e=0,r=0,n=0,o=0,d=0;for(let h of this.elementMappings)if(h.type==="vertex")e++;else if(h.type==="edge")r++;else if(h.type==="subgraph")n++;else if(h.type==="connector")o++;else if(h.type==="attachment")d++;return{vertices:e,edges:r,subgraphs:n,connectors:o,attachments:d,totalElements:this.elementMappings.length}}emitDiagnostic(e,r,n,o){let d=o?.nodeId??o?.edgeId,h=d?this.getElementById(d):void 0,u={id:e,severity:r,message:n,...o?.nodeId?{nodeId:o.nodeId}:{},...o?.edgeId&&!o?.nodeId?{edgeId:o.edgeId}:{},...h?{position:h.position}:{}};if(this.diagnostics.some((m)=>m.id===u.id&&m.severity===u.severity&&m.message===u.message&&m.nodeId===u.nodeId&&m.edgeId===u.edgeId))return;this.diagnostics.push(u);let x=`agentflow[${e}]: ${n}`;if(r==="error")a.error(x);else a.warn(x)}emitWarning(e,r,n){this.emitDiagnostic(e,"warning",r,n)}emitError(e,r,n){this.emitDiagnostic(e,"error",r,n)}getDiagnostics(){return[...this.diagnostics]}},X1=t(function(e,r){return r.db.getClasses()},"getClasses"),Q1=t(async function(e,r,n,o){a.debug("Drawing agentflow diagram",r);let{securityLevel:d,agentflow:h,layout:u}=l();o.db.setDiagramId(r),a.debug("Before getData: ");let f=o.db.getData();a.debug("Data: ",f);let x=he(r,d),m=o.db.getDirection();if(f.type=o.type,f.layoutAlgorithm=ye(u),f.layoutAlgorithm==="dagre"&&u==="elk")a.warn("flowchart-elk was moved to an external package in Mermaid v11. Please refer [release notes](https://github.com/mermaid-js/mermaid/releases/tag/v11.0.0) for more details. This diagram will be rendered using `dagre` layout as a fallback.");f.direction=m,f.nodeSpacing=h?.nodeSpacing||50,f.rankSpacing=h?.rankSpacing||50,f.markers=["point","circle","cross","hierarchy"],f.diagramId=r,a.debug("REF1:",f),await ge(f,x);let D=h?.diagramPadding??8;M.insertTitle(x,"agentflowTitleText",h?.titleTopMargin??0,o.db.getDiagramTitle()),ue(x,D,"agentflow",h?.useMaxWidth??!0)},"draw"),J1={getClasses:X1,draw:Q1},d1=function(){var e=t(function(Ke,F,V,I){for(V=V||{},I=Ke.length;I--;V[Ke[I]]=F);return V},"o"),r=[1,5],n=[1,4],o=[1,3],d=[1,6],h=[1,8,9,10,11,12,28,35,36,38,40,42,47,63,87,88,89,90,91,92,105,108,109,112,114,117,118,119,124,125,126,127,128],u=[2,2],f=[1,15],x=[1,16],m=[1,17],D=[1,18],v=[1,19],P=[1,26],B=[1,27],W=[1,28],w=[1,30],_=[1,31],g=[1,32],k=[1,55],y=[1,54],q=[1,34],Ce=[1,35],Ie=[1,36],ve=[1,37],Le=[1,38],Q=[1,50],J=[1,52],Z=[1,48],ee=[1,53],te=[1,49],se=[1,56],ie=[1,51],re=[1,57],ne=[1,58],He=[1,39],Ye=[1,40],Xe=[1,41],Qe=[1,42],Je=[1,43],ze=[1,64],N=[1,8,9,10,11,12,28,33,35,36,38,40,42,47,63,87,88,89,90,91,92,105,108,109,112,114,117,118,119,124,125,126,127,128],ke=[1,70],me=[1,68],Ae=[1,67],Ee=[1,69],st=[8,9,10,12,78,80,81],it=[1,88],at=[1,101],ot=[1,106],ut=[1,105],lt=[1,102],ct=[1,98],dt=[1,104],ht=[1,100],pt=[1,107],ft=[1,103],gt=[1,108],bt=[1,99],$e=[8,9,10,11,12,43,78,80,81],oe=[8,9,10,11,12,43,49,78,80,81],xe=[8,9,10,11,12,30,43,47,49,51,53,55,57,59,61,63,66,68,70,71,73,78,80,81,92,105,108,109,112,114,117,118,119],h1=[8,9,10,12,47,63,78,80,81,92,105,108,109,112,114,117,118,119],kt=[47,63,92,105,108,109,112,114,117,118,119],p1=[1,131],f1=[1,132],_t=[1,134],vt=[1,133],g1=[47,63,65,77,92,105,108,109,112,114,117,118,119],Vt=[1,143],It=[1,157],Lt=[1,158],Mt=[1,159],yt=[1,162],wt=[1,161],Nt=[1,160],Rt=[1,145],Ot=[1,147],Pt=[1,151],b1=[1,139],k1=[1,140],Gt=[1,152],Ut=[1,153],jt=[1,154],zt=[1,155],Wt=[1,156],Kt=[1,163],Ht=[1,164],Yt=[1,141],qt=[1,142],Xt=[1,149],Qt=[1,144],Jt=[1,148],Zt=[1,146],mt=[8,9,10,11,12,28,33,35,36,38,40,42,47,63,87,88,89,90,91,92,105,108,109,112,114,117,118,119,124,125,126,127,128],m1=[1,168],At=[1,170],X=[8,9,10,12],Te=[8,9,10,11,12,15,47,63,92,108,109,112,114,117,118,119],G=[1,190],fe=[1,186],be=[1,187],U=[1,191],j=[1,188],z=[1,189],Et=[80,119,122],K=[8,9,10,11,12,13,15,28,30,33,35,36,43,47,63,78,87,88,89,90,91,92,93,108,112,114,117,118,119],A1=[11,109],We=[32,52,54,56,58,60,65,67,69,70,72,74,119,120,121],Be=[1,269],Me=[1,267],we=[1,271],Ne=[1,265],Oe=[1,266],Pe=[1,268],Ge=[1,270],Ue=[1,272],Ct=[1,292],E1=[8,9,10,12,109],Ve=[8,9,10,11,12,63,87,108,109,112,113,114,115],r1={trace:t(function(){},"trace"),yy:{},symbols_:{error:2,start:3,graphConfig:4,document:5,line:6,statement:7,COMMENT:8,SEMI:9,NEWLINE:10,SPACE:11,EOF:12,GRAPH:13,NODIR:14,DIR:15,FirstStmtSeparator:16,ending:17,endToken:18,spaceList:19,spaceListNewline:20,vertexStatement:21,separator:22,styleStatement:23,linkStyleStatement:24,classDefStatement:25,classStatement:26,clickStatement:27,flow:28,textNoTags:29,SQS:30,text:31,SQE:32,end:33,shapeData:34,global:35,connector:36,direction:37,acc_title:38,acc_title_value:39,acc_descr:40,acc_descr_value:41,acc_descr_multiline_value:42,SHAPE_DATA:43,link:44,node:45,styledVertex:46,AMP:47,vertex:48,STYLE_SEPARATOR:49,idString:50,DOUBLECIRCLESTART:51,DOUBLECIRCLEEND:52,PS:53,PE:54,"(-":55,"-)":56,STADIUMSTART:57,STADIUMEND:58,SUBROUTINESTART:59,SUBROUTINEEND:60,VERTEX_WITH_PROPS_START:61,"NODE_STRING[field]":62,COLON:63,"NODE_STRING[value]":64,PIPE:65,CYLINDERSTART:66,CYLINDEREND:67,DIAMOND_START:68,DIAMOND_STOP:69,TAGEND:70,TRAPSTART:71,TRAPEND:72,INVTRAPSTART:73,INVTRAPEND:74,linkStatement:75,arrowText:76,TESTSTR:77,START_LINK:78,edgeText:79,LINK:80,LINK_ID:81,edgeTextToken:82,STR:83,MD_STR:84,textToken:85,keywords:86,STYLE:87,LINKSTYLE:88,CLASSDEF:89,CLASS:90,CLICK:91,DOWN:92,UP:93,textNoTagsToken:94,stylesOpt:95,"idString[vertex]":96,"idString[class]":97,CALLBACKNAME:98,CALLBACKARGS:99,HREF:100,LINK_TARGET:101,"STR[link]":102,"STR[tooltip]":103,alphaNum:104,DEFAULT:105,numList:106,INTERPOLATE:107,NUM:108,COMMA:109,style:110,styleComponent:111,NODE_STRING:112,UNIT:113,BRKT:114,PCT:115,idStringToken:116,MINUS:117,MULT:118,UNICODE_TEXT:119,TEXT:120,TAGSTART:121,EDGE_TEXT:122,alphaNumToken:123,direction_tb:124,direction_bt:125,direction_rl:126,direction_lr:127,direction_td:128,$accept:0,$end:1},terminals_:{2:"error",8:"COMMENT",9:"SEMI",10:"NEWLINE",11:"SPACE",12:"EOF",13:"GRAPH",14:"NODIR",15:"DIR",28:"flow",30:"SQS",32:"SQE",33:"end",35:"global",36:"connector",38:"acc_title",39:"acc_title_value",40:"acc_descr",41:"acc_descr_value",42:"acc_descr_multiline_value",43:"SHAPE_DATA",47:"AMP",49:"STYLE_SEPARATOR",51:"DOUBLECIRCLESTART",52:"DOUBLECIRCLEEND",53:"PS",54:"PE",55:"(-",56:"-)",57:"STADIUMSTART",58:"STADIUMEND",59:"SUBROUTINESTART",60:"SUBROUTINEEND",61:"VERTEX_WITH_PROPS_START",62:"NODE_STRING[field]",63:"COLON",64:"NODE_STRING[value]",65:"PIPE",66:"CYLINDERSTART",67:"CYLINDEREND",68:"DIAMOND_START",69:"DIAMOND_STOP",70:"TAGEND",71:"TRAPSTART",72:"TRAPEND",73:"INVTRAPSTART",74:"INVTRAPEND",77:"TESTSTR",78:"START_LINK",80:"LINK",81:"LINK_ID",83:"STR",84:"MD_STR",87:"STYLE",88:"LINKSTYLE",89:"CLASSDEF",90:"CLASS",91:"CLICK",92:"DOWN",93:"UP",96:"idString[vertex]",97:"idString[class]",98:"CALLBACKNAME",99:"CALLBACKARGS",100:"HREF",101:"LINK_TARGET",102:"STR[link]",103:"STR[tooltip]",105:"DEFAULT",107:"INTERPOLATE",108:"NUM",109:"COMMA",112:"NODE_STRING",113:"UNIT",114:"BRKT",115:"PCT",117:"MINUS",118:"MULT",119:"UNICODE_TEXT",120:"TEXT",121:"TAGSTART",122:"EDGE_TEXT",124:"direction_tb",125:"direction_bt",126:"direction_rl",127:"direction_lr",128:"direction_td"},productions_:[0,[3,2],[5,0],[5,2],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[4,2],[4,2],[4,2],[4,2],[4,3],[17,2],[17,1],[18,1],[18,1],[18,1],[16,1],[16,1],[16,2],[16,1],[20,2],[20,2],[20,2],[20,1],[20,1],[20,1],[19,2],[19,1],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,9],[7,10],[7,6],[7,7],[7,4],[7,4],[7,7],[7,8],[7,4],[7,5],[7,1],[7,2],[7,2],[7,1],[22,1],[22,1],[22,1],[22,1],[34,2],[34,1],[21,4],[21,3],[21,4],[21,2],[21,2],[21,1],[45,1],[45,6],[45,5],[46,1],[46,3],[48,4],[48,4],[48,6],[48,4],[48,4],[48,4],[48,8],[48,4],[48,4],[48,4],[48,6],[48,4],[48,4],[48,4],[48,4],[48,4],[48,1],[44,2],[44,3],[44,3],[44,1],[44,3],[44,4],[79,1],[79,2],[79,1],[79,1],[75,1],[75,2],[76,3],[31,1],[31,2],[31,1],[31,1],[86,1],[86,1],[86,1],[86,1],[86,1],[86,1],[86,1],[86,1],[86,1],[86,1],[86,1],[86,1],[86,1],[29,1],[29,2],[29,1],[29,1],[25,5],[26,5],[27,2],[27,4],[27,3],[27,5],[27,3],[27,5],[27,5],[27,7],[27,2],[27,4],[27,2],[27,4],[27,4],[27,6],[23,5],[24,5],[24,5],[24,9],[24,9],[24,7],[24,7],[106,1],[106,3],[95,1],[95,3],[110,1],[110,2],[111,1],[111,1],[111,1],[111,1],[111,1],[111,1],[111,1],[111,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[85,1],[85,1],[85,1],[85,1],[94,1],[94,1],[94,1],[94,1],[94,1],[94,1],[94,1],[94,1],[94,1],[94,1],[94,1],[82,1],[82,1],[123,1],[123,1],[123,1],[123,1],[123,1],[123,1],[123,1],[123,1],[123,1],[123,1],[123,1],[50,1],[50,2],[104,1],[104,2],[37,1],[37,1],[37,1],[37,1],[37,1]],performAction:t(function(F,V,I,c,H,s,O){var i=s.length-1;switch(H){case 2:this.$=[];break;case 3:if(!Array.isArray(s[i])||s[i].length>0)s[i-1].push(s[i]);this.$=s[i-1];break;case 4:case 198:this.$=s[i];break;case 5:case 33:case 34:case 35:case 36:case 37:this.$=[];break;case 13:c.setDirection("TB"),this.$="TB";break;case 14:c.setDirection(s[i-1]),this.$=s[i-1];break;case 32:this.$=s[i-1].nodes;break;case 38:if(this.$=c.addSubGraph(s[i-6],s[i-1],s[i-4],"flow"),c.addSubgraphMapping)c.addSubgraphMapping(s[i-6],s[i-4],O[i-8],O[i]);break;case 39:if(this.$=c.addSubGraph(s[i-7],s[i-1],s[i-5],"flow"),c.addVertex(this.$,void 0,void 0,void 0,void 0,void 0,void 0,s[i-3],O[i-3]),c.addSubgraphMapping)c.addSubgraphMapping(s[i-7],s[i-5],O[i-9],O[i]);break;case 40:if(this.$=c.addSubGraph(s[i-3],s[i-1],{text:"",type:"text"},"flow"),c.addSubgraphMapping)c.addSubgraphMapping(s[i-3],{text:"",type:"text"},O[i-5],O[i]);break;case 41:if(this.$=c.addSubGraph(s[i-4],s[i-1],{text:"",type:"text"},"flow"),c.addVertex(this.$,void 0,void 0,void 0,void 0,void 0,void 0,s[i-3],O[i-3]),c.addSubgraphMapping)c.addSubgraphMapping(s[i-4],{text:"",type:"text"},O[i-6],O[i]);break;case 42:if(this.$=c.addSubGraph(void 0,s[i-1],void 0,"flow"),c.addSubgraphMapping)c.addSubgraphMapping(void 0,void 0,O[i-3],O[i]);break;case 43:c.addGlobal(s[i-1]),this.$=[];break;case 44:if(this.$=c.addConnector(s[i-4],s[i-2]),c.addConnectorMapping)c.addConnectorMapping(s[i-4],s[i-2],O[i-6],O[i]);break;case 45:if(this.$=c.addConnector(s[i-5],s[i-3]),c.addVertex(this.$,void 0,void 0,void 0,void 0,void 0,void 0,s[i-1],O[i-1]),c.addConnectorMapping)c.addConnectorMapping(s[i-5],s[i-3],O[i-7],O[i]);break;case 46:if(this.$=c.addConnector(s[i-1],{text:"",type:"text"}),c.addConnectorMapping)c.addConnectorMapping(s[i-1],{text:"",type:"text"},O[i-3],O[i]);break;case 47:if(this.$=c.addConnector(s[i-2],{text:"",type:"text"}),c.addVertex(this.$,void 0,void 0,void 0,void 0,void 0,void 0,s[i-1],O[i-1]),c.addConnectorMapping)c.addConnectorMapping(s[i-2],{text:"",type:"text"},O[i-4],O[i]);break;case 49:this.$=s[i].trim(),c.setAccTitle(this.$);break;case 50:case 51:this.$=s[i].trim(),c.setAccDescription(this.$);break;case 56:this.$=s[i-1]+s[i];break;case 57:this.$=s[i];break;case 58:if(c.addVertex(s[i-1][s[i-1].length-1],void 0,void 0,void 0,void 0,void 0,void 0,s[i],O[i]),c.extendVertexMapping)c.extendVertexMapping(s[i-1][s[i-1].length-1],O[i]);if(c.addLink(s[i-3].stmt,s[i-1],s[i-2]),c.addEdgeMapping)c.addEdgeMapping(s[i-3].stmt,s[i-1],s[i-2],this._$);this.$={stmt:s[i-1],nodes:s[i-1].concat(s[i-3].nodes)};break;case 59:if(c.addLink(s[i-2].stmt,s[i],s[i-1]),c.addEdgeMapping)c.addEdgeMapping(s[i-2].stmt,s[i],s[i-1],this._$);this.$={stmt:s[i],nodes:s[i].concat(s[i-2].nodes)};break;case 60:if(c.addLink(s[i-3].stmt,s[i-1],s[i-2]),c.addEdgeMapping)c.addEdgeMapping(s[i-3].stmt,s[i-1],s[i-2],this._$);this.$={stmt:s[i-1],nodes:s[i-1].concat(s[i-3].nodes)};break;case 61:this.$={stmt:s[i-1],nodes:s[i-1]};break;case 62:if(c.addVertex(s[i-1][s[i-1].length-1],void 0,void 0,void 0,void 0,void 0,void 0,s[i],O[i]),c.extendVertexMapping)c.extendVertexMapping(s[i-1][s[i-1].length-1],O[i]);this.$={stmt:s[i-1],nodes:s[i-1],shapeData:s[i]};break;case 63:this.$={stmt:s[i],nodes:s[i]};break;case 64:this.$=[s[i]];break;case 65:if(c.addVertex(s[i-5][s[i-5].length-1],void 0,void 0,void 0,void 0,void 0,void 0,s[i-4],O[i-4]),c.extendVertexMapping)c.extendVertexMapping(s[i-5][s[i-5].length-1],O[i-4]);this.$=s[i-5].concat(s[i]);break;case 66:this.$=s[i-4].concat(s[i]);break;case 67:this.$=s[i];break;case 68:this.$=s[i-2],c.setClass(s[i-2],s[i]);break;case 69:if(this.$=s[i-3],c.addVertex(s[i-3],s[i-1],"square"),c.addVertexMapping)c.addVertexMapping(s[i-3],s[i-1],"square",this._$);break;case 70:if(this.$=s[i-3],c.addVertex(s[i-3],s[i-1],"doublecircle"),c.addVertexMapping)c.addVertexMapping(s[i-3],s[i-1],"doublecircle",this._$);break;case 71:if(this.$=s[i-5],c.addVertex(s[i-5],s[i-2],"circle"),c.addVertexMapping)c.addVertexMapping(s[i-5],s[i-2],"circle",this._$);break;case 72:if(this.$=s[i-3],c.addVertex(s[i-3],s[i-1],"ellipse"),c.addVertexMapping)c.addVertexMapping(s[i-3],s[i-1],"ellipse",this._$);break;case 73:if(this.$=s[i-3],c.addVertex(s[i-3],s[i-1],"stadium"),c.addVertexMapping)c.addVertexMapping(s[i-3],s[i-1],"stadium",this._$);break;case 74:if(this.$=s[i-3],c.addVertex(s[i-3],s[i-1],"subroutine"),c.addVertexMapping)c.addVertexMapping(s[i-3],s[i-1],"subroutine",this._$);break;case 75:if(this.$=s[i-7],c.addVertex(s[i-7],s[i-1],"rect",void 0,void 0,void 0,Object.fromEntries([[s[i-5],s[i-3]]])),c.addVertexMapping)c.addVertexMapping(s[i-7],s[i-1],"rect",this._$);break;case 76:if(this.$=s[i-3],c.addVertex(s[i-3],s[i-1],"cylinder"),c.addVertexMapping)c.addVertexMapping(s[i-3],s[i-1],"cylinder",this._$);break;case 77:if(this.$=s[i-3],c.addVertex(s[i-3],s[i-1],"round"),c.addVertexMapping)c.addVertexMapping(s[i-3],s[i-1],"round",this._$);break;case 78:if(this.$=s[i-3],c.addVertex(s[i-3],s[i-1],"diamond"),c.addVertexMapping)c.addVertexMapping(s[i-3],s[i-1],"diamond",this._$);break;case 79:if(this.$=s[i-5],c.addVertex(s[i-5],s[i-2],"hexagon"),c.addVertexMapping)c.addVertexMapping(s[i-5],s[i-2],"hexagon",this._$);break;case 80:if(this.$=s[i-3],c.addVertex(s[i-3],s[i-1],"odd"),c.addVertexMapping)c.addVertexMapping(s[i-3],s[i-1],"odd",this._$);break;case 81:if(this.$=s[i-3],c.addVertex(s[i-3],s[i-1],"trapezoid"),c.addVertexMapping)c.addVertexMapping(s[i-3],s[i-1],"trapezoid",this._$);break;case 82:if(this.$=s[i-3],c.addVertex(s[i-3],s[i-1],"inv_trapezoid"),c.addVertexMapping)c.addVertexMapping(s[i-3],s[i-1],"inv_trapezoid",this._$);break;case 83:if(this.$=s[i-3],c.addVertex(s[i-3],s[i-1],"lean_right"),c.addVertexMapping)c.addVertexMapping(s[i-3],s[i-1],"lean_right",this._$);break;case 84:if(this.$=s[i-3],c.addVertex(s[i-3],s[i-1],"lean_left"),c.addVertexMapping)c.addVertexMapping(s[i-3],s[i-1],"lean_left",this._$);break;case 85:if(this.$=s[i],c.addVertex(s[i]),c.addVertexMapping)c.addVertexMapping(s[i],void 0,void 0,this._$);break;case 86:s[i-1].text=s[i],this.$=s[i-1];break;case 87:case 88:s[i-2].text=s[i-1],this.$=s[i-2];break;case 89:this.$=s[i];break;case 90:var Y=c.destructLink(s[i],s[i-2]);this.$={type:Y.type,stroke:Y.stroke,length:Y.length,edgeSemantic:Y.edgeSemantic,text:s[i-1]};break;case 91:var Y=c.destructLink(s[i],s[i-2]);this.$={type:Y.type,stroke:Y.stroke,length:Y.length,edgeSemantic:Y.edgeSemantic,text:s[i-1],id:s[i-3]};break;case 92:this.$={text:s[i],type:"text"};break;case 93:this.$={text:s[i-1].text+""+s[i],type:s[i-1].type};break;case 94:this.$={text:s[i],type:"string"};break;case 95:this.$={text:s[i],type:"markdown"};break;case 96:var Y=c.destructLink(s[i]);this.$={type:Y.type,stroke:Y.stroke,length:Y.length,edgeSemantic:Y.edgeSemantic};break;case 97:var Y=c.destructLink(s[i]);this.$={type:Y.type,stroke:Y.stroke,length:Y.length,edgeSemantic:Y.edgeSemantic,id:s[i-1]};break;case 98:this.$=s[i-1];break;case 99:this.$={text:s[i],type:"text"};break;case 100:this.$={text:s[i-1].text+""+s[i],type:s[i-1].type};break;case 101:this.$={text:s[i],type:"string"};break;case 102:case 119:this.$={text:s[i],type:"markdown"};break;case 116:this.$={text:s[i],type:"text"};break;case 117:this.$={text:s[i-1].text+""+s[i],type:s[i-1].type};break;case 118:this.$={text:s[i],type:"text"};break;case 120:this.$=s[i-4],c.addClass(s[i-2],s[i]);break;case 121:this.$=s[i-4],c.setClass(s[i-2],s[i]);break;case 122:case 130:this.$=s[i-1],c.setClickEvent(s[i-1],s[i]);break;case 123:case 131:this.$=s[i-3],c.setClickEvent(s[i-3],s[i-2]),c.setTooltip(s[i-3],s[i]);break;case 124:this.$=s[i-2],c.setClickEvent(s[i-2],s[i-1],s[i]);break;case 125:this.$=s[i-4],c.setClickEvent(s[i-4],s[i-3],s[i-2]),c.setTooltip(s[i-4],s[i]);break;case 126:this.$=s[i-2],c.setLink(s[i-2],s[i]);break;case 127:this.$=s[i-4],c.setLink(s[i-4],s[i-2]),c.setTooltip(s[i-4],s[i]);break;case 128:this.$=s[i-4],c.setLink(s[i-4],s[i-2],s[i]);break;case 129:this.$=s[i-6],c.setLink(s[i-6],s[i-4],s[i]),c.setTooltip(s[i-6],s[i-2]);break;case 132:this.$=s[i-1],c.setLink(s[i-1],s[i]);break;case 133:this.$=s[i-3],c.setLink(s[i-3],s[i-2]),c.setTooltip(s[i-3],s[i]);break;case 134:this.$=s[i-3],c.setLink(s[i-3],s[i-2],s[i]);break;case 135:this.$=s[i-5],c.setLink(s[i-5],s[i-4],s[i]),c.setTooltip(s[i-5],s[i-2]);break;case 136:this.$=s[i-4],c.addVertex(s[i-2],void 0,void 0,s[i]);break;case 137:this.$=s[i-4],c.updateLink([s[i-2]],s[i]);break;case 138:this.$=s[i-4],c.updateLink(s[i-2],s[i]);break;case 139:this.$=s[i-8],c.updateLinkInterpolate([s[i-6]],s[i-2]),c.updateLink([s[i-6]],s[i]);break;case 140:this.$=s[i-8],c.updateLinkInterpolate(s[i-6],s[i-2]),c.updateLink(s[i-6],s[i]);break;case 141:this.$=s[i-6],c.updateLinkInterpolate([s[i-4]],s[i]);break;case 142:this.$=s[i-6],c.updateLinkInterpolate(s[i-4],s[i]);break;case 143:case 145:this.$=[s[i]];break;case 144:case 146:s[i-2].push(s[i]),this.$=s[i-2];break;case 148:this.$=s[i-1]+s[i];break;case 196:this.$=s[i];break;case 197:this.$=s[i-1]+""+s[i];break;case 199:this.$=s[i-1]+""+s[i];break;case 200:this.$={stmt:"dir",value:"TB"};break;case 201:this.$={stmt:"dir",value:"BT"};break;case 202:this.$={stmt:"dir",value:"RL"};break;case 203:this.$={stmt:"dir",value:"LR"};break;case 204:this.$={stmt:"dir",value:"TD"};break}},"anonymous"),table:[{3:1,4:2,8:r,10:n,11:o,13:d},{1:[3]},e(h,u,{5:7}),{4:8,8:r,10:n,11:o,13:d},{4:9,8:r,10:n,11:o,13:d},{4:10,8:r,10:n,11:o,13:d},{14:[1,11],15:[1,12]},{1:[2,1],6:13,7:14,8:f,9:x,10:m,11:D,12:v,21:20,23:21,24:22,25:23,26:24,27:25,28:P,35:B,36:W,37:29,38:w,40:_,42:g,45:33,46:44,47:k,48:45,50:46,63:y,87:q,88:Ce,89:Ie,90:ve,91:Le,92:Q,105:J,108:Z,109:ee,112:te,114:se,116:47,117:ie,118:re,119:ne,124:He,125:Ye,126:Xe,127:Qe,128:Je},e(h,[2,10]),e(h,[2,11]),e(h,[2,12]),e(h,[2,13]),{8:[1,63],9:[1,60],10:[1,61],11:ze,16:59,19:62},e(N,[2,3]),e(N,[2,4]),e(N,[2,5]),e(N,[2,6]),e(N,[2,7]),e(N,[2,8]),e(N,[2,9]),{8:ke,9:me,10:Ae,12:Ee,22:65,44:66,75:71,78:[1,72],80:[1,74],81:[1,73]},{8:ke,9:me,10:Ae,12:Ee,22:75},{8:ke,9:me,10:Ae,12:Ee,22:76},{8:ke,9:me,10:Ae,12:Ee,22:77},{8:ke,9:me,10:Ae,12:Ee,22:78},{8:ke,9:me,10:Ae,12:Ee,22:79},{8:ke,9:me,10:Ae,11:[1,80],12:Ee,22:81},{8:ke,9:me,10:Ae,12:Ee,22:82},{11:[1,83]},e(N,[2,48]),{39:[1,84]},{41:[1,85]},e(N,[2,51]),e(st,[2,63],{19:86,34:87,11:ze,43:it}),{11:[1,89]},{11:[1,90]},{11:[1,91]},{11:[1,92]},{15:at,47:ot,63:ut,83:[1,96],92:lt,98:[1,93],100:[1,94],104:95,108:ct,109:dt,112:ht,114:pt,117:ft,118:gt,119:bt,123:97},e(N,[2,200]),e(N,[2,201]),e(N,[2,202]),e(N,[2,203]),e(N,[2,204]),e($e,[2,64]),e($e,[2,67],{49:[1,109]}),e(oe,[2,85],{116:122,30:[1,110],47:k,51:[1,111],53:[1,112],55:[1,113],57:[1,114],59:[1,115],61:[1,116],63:y,66:[1,117],68:[1,118],70:[1,119],71:[1,120],73:[1,121],92:Q,105:J,108:Z,109:ee,112:te,114:se,117:ie,118:re,119:ne}),e(xe,[2,196]),e(xe,[2,157]),e(xe,[2,158]),e(xe,[2,159]),e(xe,[2,160]),e(xe,[2,161]),e(xe,[2,162]),e(xe,[2,163]),e(xe,[2,164]),e(xe,[2,165]),e(xe,[2,166]),e(xe,[2,167]),e(h,[2,14]),e(h,[2,20]),e(h,[2,21]),{10:[1,123]},e(h,[2,23]),e(h1,[2,31],{19:124,11:ze}),e(N,[2,32]),{45:125,46:44,47:k,48:45,50:46,63:y,92:Q,105:J,108:Z,109:ee,112:te,114:se,116:47,117:ie,118:re,119:ne},e(N,[2,52]),e(N,[2,53]),e(N,[2,54]),e(N,[2,55]),e(kt,[2,89],{76:126,65:[1,128],77:[1,127]}),{79:129,82:130,83:p1,84:f1,119:_t,122:vt},{78:[1,135],80:[1,136]},e(g1,[2,96]),e(N,[2,33]),e(N,[2,34]),e(N,[2,35]),e(N,[2,36]),e(N,[2,37]),{11:Vt,13:It,15:Lt,28:Mt,29:137,33:yt,35:wt,36:Nt,47:Rt,63:Ot,78:Pt,83:b1,84:k1,86:150,87:Gt,88:Ut,89:jt,90:zt,91:Wt,92:Kt,93:Ht,94:138,108:Yt,112:qt,114:Xt,117:Qt,118:Jt,119:Zt},e(mt,u,{5:165}),e(mt,u,{5:166}),{11:Vt,13:It,15:Lt,28:Mt,29:167,33:yt,35:wt,36:Nt,47:Rt,63:Ot,78:Pt,83:b1,84:k1,86:150,87:Gt,88:Ut,89:jt,90:zt,91:Wt,92:Kt,93:Ht,94:138,108:Yt,112:qt,114:Xt,117:Qt,118:Jt,119:Zt},e(N,[2,49]),e(N,[2,50]),e(st,[2,61],{47:m1}),e(st,[2,62],{19:169,11:ze,43:At}),e($e,[2,57]),{47:k,50:171,63:y,92:Q,105:J,108:Z,109:ee,112:te,114:se,116:47,117:ie,118:re,119:ne},{105:[1,172],106:173,108:[1,174]},{47:k,50:175,63:y,92:Q,105:J,108:Z,109:ee,112:te,114:se,116:47,117:ie,118:re,119:ne},{47:k,50:176,63:y,92:Q,105:J,108:Z,109:ee,112:te,114:se,116:47,117:ie,118:re,119:ne},e(X,[2,122],{11:[1,177],99:[1,178]}),{83:[1,179]},e(X,[2,130],{123:181,11:[1,180],15:at,47:ot,63:ut,92:lt,108:ct,109:dt,112:ht,114:pt,117:ft,118:gt,119:bt}),e(X,[2,132],{11:[1,182]}),e(Te,[2,198]),e(Te,[2,185]),e(Te,[2,186]),e(Te,[2,187]),e(Te,[2,188]),e(Te,[2,189]),e(Te,[2,190]),e(Te,[2,191]),e(Te,[2,192]),e(Te,[2,193]),e(Te,[2,194]),e(Te,[2,195]),{47:k,50:183,63:y,92:Q,105:J,108:Z,109:ee,112:te,114:se,116:47,117:ie,118:re,119:ne},{31:184,70:G,83:fe,84:be,85:185,119:U,120:j,121:z},{31:192,70:G,83:fe,84:be,85:185,119:U,120:j,121:z},{31:194,53:[1,193],70:G,83:fe,84:be,85:185,119:U,120:j,121:z},{31:195,70:G,83:fe,84:be,85:185,119:U,120:j,121:z},{31:196,70:G,83:fe,84:be,85:185,119:U,120:j,121:z},{31:197,70:G,83:fe,84:be,85:185,119:U,120:j,121:z},{112:[1,198]},{31:199,70:G,83:fe,84:be,85:185,119:U,120:j,121:z},{31:200,68:[1,201],70:G,83:fe,84:be,85:185,119:U,120:j,121:z},{31:202,70:G,83:fe,84:be,85:185,119:U,120:j,121:z},{31:203,70:G,83:fe,84:be,85:185,119:U,120:j,121:z},{31:204,70:G,83:fe,84:be,85:185,119:U,120:j,121:z},e(xe,[2,197]),e(h,[2,22]),e(h1,[2,30]),e(st,[2,59],{34:205,19:206,11:ze,43:it}),e(kt,[2,86],{11:[1,207]}),{11:[1,208]},{31:209,70:G,83:fe,84:be,85:185,119:U,120:j,121:z},{80:[1,210],82:211,119:_t,122:vt},e(Et,[2,92]),e(Et,[2,94]),e(Et,[2,95]),e(Et,[2,183]),e(Et,[2,184]),{79:212,82:130,83:p1,84:f1,119:_t,122:vt},e(g1,[2,97]),{8:ke,9:me,10:Ae,11:Vt,12:Ee,13:It,15:Lt,22:214,28:Mt,30:[1,213],33:yt,34:215,35:wt,36:Nt,43:it,47:Rt,63:Ot,78:Pt,86:150,87:Gt,88:Ut,89:jt,90:zt,91:Wt,92:Kt,93:Ht,94:216,108:Yt,112:qt,114:Xt,117:Qt,118:Jt,119:Zt},e(K,[2,116]),e(K,[2,118]),e(K,[2,119]),e(K,[2,172]),e(K,[2,173]),e(K,[2,174]),e(K,[2,175]),e(K,[2,176]),e(K,[2,177]),e(K,[2,178]),e(K,[2,179]),e(K,[2,180]),e(K,[2,181]),e(K,[2,182]),e(K,[2,103]),e(K,[2,104]),e(K,[2,105]),e(K,[2,106]),e(K,[2,107]),e(K,[2,108]),e(K,[2,109]),e(K,[2,110]),e(K,[2,111]),e(K,[2,112]),e(K,[2,113]),e(K,[2,114]),e(K,[2,115]),{6:13,7:14,8:f,9:x,10:m,11:D,12:v,21:20,23:21,24:22,25:23,26:24,27:25,28:P,33:[1,217],35:B,36:W,37:29,38:w,40:_,42:g,45:33,46:44,47:k,48:45,50:46,63:y,87:q,88:Ce,89:Ie,90:ve,91:Le,92:Q,105:J,108:Z,109:ee,112:te,114:se,116:47,117:ie,118:re,119:ne,124:He,125:Ye,126:Xe,127:Qe,128:Je},{6:13,7:14,8:f,9:x,10:m,11:D,12:v,21:20,23:21,24:22,25:23,26:24,27:25,28:P,33:[1,218],35:B,36:W,37:29,38:w,40:_,42:g,45:33,46:44,47:k,48:45,50:46,63:y,87:q,88:Ce,89:Ie,90:ve,91:Le,92:Q,105:J,108:Z,109:ee,112:te,114:se,116:47,117:ie,118:re,119:ne,124:He,125:Ye,126:Xe,127:Qe,128:Je},{8:ke,9:me,10:Ae,11:Vt,12:Ee,13:It,15:Lt,22:220,28:Mt,30:[1,219],33:yt,34:221,35:wt,36:Nt,43:it,47:Rt,63:Ot,78:Pt,86:150,87:Gt,88:Ut,89:jt,90:zt,91:Wt,92:Kt,93:Ht,94:216,108:Yt,112:qt,114:Xt,117:Qt,118:Jt,119:Zt},{11:ze,19:222},{47:[1,223]},e($e,[2,56]),{11:[1,224],47:k,63:y,92:Q,105:J,108:Z,109:ee,112:te,114:se,116:122,117:ie,118:re,119:ne},{11:[1,225]},{11:[1,226],109:[1,227]},e(A1,[2,143]),{11:[1,228],47:k,63:y,92:Q,105:J,108:Z,109:ee,112:te,114:se,116:122,117:ie,118:re,119:ne},{11:[1,229],47:k,63:y,92:Q,105:J,108:Z,109:ee,112:te,114:se,116:122,117:ie,118:re,119:ne},{83:[1,230]},e(X,[2,124],{11:[1,231]}),e(X,[2,126],{11:[1,232]}),{83:[1,233]},e(Te,[2,199]),{83:[1,234],101:[1,235]},e($e,[2,68],{116:122,47:k,63:y,92:Q,105:J,108:Z,109:ee,112:te,114:se,117:ie,118:re,119:ne}),{32:[1,236],70:G,85:237,119:U,120:j,121:z},e(We,[2,99]),e(We,[2,101]),e(We,[2,102]),e(We,[2,168]),e(We,[2,169]),e(We,[2,170]),e(We,[2,171]),{52:[1,238],70:G,85:237,119:U,120:j,121:z},{31:239,70:G,83:fe,84:be,85:185,119:U,120:j,121:z},{54:[1,240],70:G,85:237,119:U,120:j,121:z},{56:[1,241],70:G,85:237,119:U,120:j,121:z},{58:[1,242],70:G,85:237,119:U,120:j,121:z},{60:[1,243],70:G,85:237,119:U,120:j,121:z},{63:[1,244]},{67:[1,245],70:G,85:237,119:U,120:j,121:z},{69:[1,246],70:G,85:237,119:U,120:j,121:z},{31:247,70:G,83:fe,84:be,85:185,119:U,120:j,121:z},{32:[1,248],70:G,85:237,119:U,120:j,121:z},{70:G,72:[1,249],74:[1,250],85:237,119:U,120:j,121:z},{70:G,72:[1,252],74:[1,251],85:237,119:U,120:j,121:z},e(st,[2,58],{19:169,11:ze,43:At}),e(st,[2,60],{47:m1}),e(kt,[2,88]),e(kt,[2,87]),{65:[1,253],70:G,85:237,119:U,120:j,121:z},e(kt,[2,90]),e(Et,[2,93]),{80:[1,254],82:211,119:_t,122:vt},{31:255,70:G,83:fe,84:be,85:185,119:U,120:j,121:z},e(mt,u,{5:256}),{8:ke,9:me,10:Ae,12:Ee,22:257,43:At},e(K,[2,117]),e(N,[2,42]),e(N,[2,43]),{31:258,70:G,83:fe,84:be,85:185,119:U,120:j,121:z},e(N,[2,46]),{8:ke,9:me,10:Ae,12:Ee,22:259,43:At},{46:260,47:k,48:45,50:46,63:y,92:Q,105:J,108:Z,109:ee,112:te,114:se,116:47,117:ie,118:re,119:ne},{11:ze,19:261},{11:Be,63:Me,87:we,95:262,108:Ne,110:263,111:264,112:Oe,113:Pe,114:Ge,115:Ue},{11:Be,63:Me,87:we,95:273,107:[1,274],108:Ne,110:263,111:264,112:Oe,113:Pe,114:Ge,115:Ue},{11:Be,63:Me,87:we,95:275,107:[1,276],108:Ne,110:263,111:264,112:Oe,113:Pe,114:Ge,115:Ue},{108:[1,277]},{11:Be,63:Me,87:we,95:278,108:Ne,110:263,111:264,112:Oe,113:Pe,114:Ge,115:Ue},{47:k,50:279,63:y,92:Q,105:J,108:Z,109:ee,112:te,114:se,116:47,117:ie,118:re,119:ne},e(X,[2,123]),{83:[1,280]},{83:[1,281],101:[1,282]},e(X,[2,131]),e(X,[2,133],{11:[1,283]}),e(X,[2,134]),e(oe,[2,69]),e(We,[2,100]),e(oe,[2,70]),{54:[1,284],70:G,85:237,119:U,120:j,121:z},e(oe,[2,77]),e(oe,[2,72]),e(oe,[2,73]),e(oe,[2,74]),{112:[1,285]},e(oe,[2,76]),e(oe,[2,78]),{69:[1,286],70:G,85:237,119:U,120:j,121:z},e(oe,[2,80]),e(oe,[2,81]),e(oe,[2,83]),e(oe,[2,82]),e(oe,[2,84]),e([11,47,63,92,105,108,109,112,114,117,118,119],[2,98]),e(kt,[2,91]),{32:[1,287],70:G,85:237,119:U,120:j,121:z},{6:13,7:14,8:f,9:x,10:m,11:D,12:v,21:20,23:21,24:22,25:23,26:24,27:25,28:P,33:[1,288],35:B,36:W,37:29,38:w,40:_,42:g,45:33,46:44,47:k,48:45,50:46,63:y,87:q,88:Ce,89:Ie,90:ve,91:Le,92:Q,105:J,108:Z,109:ee,112:te,114:se,116:47,117:ie,118:re,119:ne,124:He,125:Ye,126:Xe,127:Qe,128:Je},e(mt,u,{5:289}),{32:[1,290],70:G,85:237,119:U,120:j,121:z},e(N,[2,47]),e($e,[2,66]),{46:291,47:k,48:45,50:46,63:y,92:Q,105:J,108:Z,109:ee,112:te,114:se,116:47,117:ie,118:re,119:ne},e(X,[2,136],{109:Ct}),e(E1,[2,145],{111:293,11:Be,63:Me,87:we,108:Ne,112:Oe,113:Pe,114:Ge,115:Ue}),e(Ve,[2,147]),e(Ve,[2,149]),e(Ve,[2,150]),e(Ve,[2,151]),e(Ve,[2,152]),e(Ve,[2,153]),e(Ve,[2,154]),e(Ve,[2,155]),e(Ve,[2,156]),e(X,[2,137],{109:Ct}),{11:[1,294]},e(X,[2,138],{109:Ct}),{11:[1,295]},e(A1,[2,144]),e(X,[2,120],{109:Ct}),e(X,[2,121],{116:122,47:k,63:y,92:Q,105:J,108:Z,109:ee,112:te,114:se,117:ie,118:re,119:ne}),e(X,[2,125]),e(X,[2,127],{11:[1,296]}),e(X,[2,128]),{101:[1,297]},{54:[1,298]},{65:[1,299]},{69:[1,300]},{8:ke,9:me,10:Ae,12:Ee,22:301,34:302,43:it},e(N,[2,40]),{6:13,7:14,8:f,9:x,10:m,11:D,12:v,21:20,23:21,24:22,25:23,26:24,27:25,28:P,33:[1,303],35:B,36:W,37:29,38:w,40:_,42:g,45:33,46:44,47:k,48:45,50:46,63:y,87:q,88:Ce,89:Ie,90:ve,91:Le,92:Q,105:J,108:Z,109:ee,112:te,114:se,116:47,117:ie,118:re,119:ne,124:He,125:Ye,126:Xe,127:Qe,128:Je},{8:ke,9:me,10:Ae,12:Ee,22:304,34:305,43:it},e($e,[2,65]),{11:Be,63:Me,87:we,108:Ne,110:306,111:264,112:Oe,113:Pe,114:Ge,115:Ue},e(Ve,[2,148]),{15:at,47:ot,63:ut,92:lt,104:307,108:ct,109:dt,112:ht,114:pt,117:ft,118:gt,119:bt,123:97},{15:at,47:ot,63:ut,92:lt,104:308,108:ct,109:dt,112:ht,114:pt,117:ft,118:gt,119:bt,123:97},{101:[1,309]},e(X,[2,135]),e(oe,[2,71]),{31:310,70:G,83:fe,84:be,85:185,119:U,120:j,121:z},e(oe,[2,79]),e(mt,u,{5:311}),{8:ke,9:me,10:Ae,12:Ee,22:312,43:At},e(N,[2,41]),e(N,[2,44]),{8:ke,9:me,10:Ae,12:Ee,22:313,43:At},e(E1,[2,146],{111:293,11:Be,63:Me,87:we,108:Ne,112:Oe,113:Pe,114:Ge,115:Ue}),e(X,[2,141],{123:181,11:[1,314],15:at,47:ot,63:ut,92:lt,108:ct,109:dt,112:ht,114:pt,117:ft,118:gt,119:bt}),e(X,[2,142],{123:181,11:[1,315],15:at,47:ot,63:ut,92:lt,108:ct,109:dt,112:ht,114:pt,117:ft,118:gt,119:bt}),e(X,[2,129]),{32:[1,316],70:G,85:237,119:U,120:j,121:z},{6:13,7:14,8:f,9:x,10:m,11:D,12:v,21:20,23:21,24:22,25:23,26:24,27:25,28:P,33:[1,317],35:B,36:W,37:29,38:w,40:_,42:g,45:33,46:44,47:k,48:45,50:46,63:y,87:q,88:Ce,89:Ie,90:ve,91:Le,92:Q,105:J,108:Z,109:ee,112:te,114:se,116:47,117:ie,118:re,119:ne,124:He,125:Ye,126:Xe,127:Qe,128:Je},e(mt,u,{5:318}),e(N,[2,45]),{11:Be,63:Me,87:we,95:319,108:Ne,110:263,111:264,112:Oe,113:Pe,114:Ge,115:Ue},{11:Be,63:Me,87:we,95:320,108:Ne,110:263,111:264,112:Oe,113:Pe,114:Ge,115:Ue},e(oe,[2,75]),e(N,[2,38]),{6:13,7:14,8:f,9:x,10:m,11:D,12:v,21:20,23:21,24:22,25:23,26:24,27:25,28:P,33:[1,321],35:B,36:W,37:29,38:w,40:_,42:g,45:33,46:44,47:k,48:45,50:46,63:y,87:q,88:Ce,89:Ie,90:ve,91:Le,92:Q,105:J,108:Z,109:ee,112:te,114:se,116:47,117:ie,118:re,119:ne,124:He,125:Ye,126:Xe,127:Qe,128:Je},e(X,[2,139],{109:Ct}),e(X,[2,140],{109:Ct}),e(N,[2,39])],defaultActions:{},parseError:t(function(F,V){if(V.recoverable)this.trace(F);else{var I=Error(F);throw I.hash=V,I}},"parseError"),parse:t(function(F){var V=this,I=[0],c=[],H=[null],s=[],O=this.table,i="",Y=0,C1=0,S1=0,R1=2,x1=1,O1=s.slice.call(arguments,1),ae=Object.create(this.lexer),et={yy:{}};for(var n1 in this.yy)if(Object.prototype.hasOwnProperty.call(this.yy,n1))et.yy[n1]=this.yy[n1];if(ae.setInput(F,et.yy),et.yy.lexer=ae,et.yy.parser=this,typeof ae.yylloc>"u")ae.yylloc={};var a1=ae.yylloc;s.push(a1);var P1=ae.options&&ae.options.ranges;if(typeof et.yy.parseError==="function")this.parseError=et.yy.parseError;else this.parseError=Object.getPrototypeOf(this).parseError;function G1(_e){I.length=I.length-2*_e,H.length=H.length-_e,s.length=s.length-_e}t(G1,"popStack");function T1(){var _e=c.pop()||ae.lex()||x1;if(typeof _e!=="number"){if(_e instanceof Array)c=_e,_e=c.pop();_e=V.symbols_[_e]||_e}return _e}t(T1,"lex");var Se,o1,tt,De,is,u1,St={},e1,je,D1,t1;while(!0){if(tt=I[I.length-1],this.defaultActions[tt])De=this.defaultActions[tt];else{if(Se===null||typeof Se>"u")Se=T1();De=O[tt]&&O[tt][Se]}if(typeof De>"u"||!De.length||!De[0]){var l1="";t1=[];for(e1 in O[tt])if(this.terminals_[e1]&&e1>R1)t1.push("'"+this.terminals_[e1]+"'");if(ae.showPosition)l1="Parse error on line "+(Y+1)+`:
23
23
  `+ae.showPosition()+`
24
24
  Expecting `+t1.join(", ")+", got '"+(this.terminals_[Se]||Se)+"'";else l1="Parse error on line "+(Y+1)+": Unexpected "+(Se==x1?"end of input":"'"+(this.terminals_[Se]||Se)+"'");this.parseError(l1,{text:ae.match,token:this.terminals_[Se]||Se,line:ae.yylineno,loc:a1,expected:t1})}if(De[0]instanceof Array&&De.length>1)throw Error("Parse Error: multiple actions possible at state: "+tt+", token: "+Se);switch(De[0]){case 1:if(I.push(Se),H.push(ae.yytext),s.push(ae.yylloc),I.push(De[1]),Se=null,!o1){if(C1=ae.yyleng,i=ae.yytext,Y=ae.yylineno,a1=ae.yylloc,S1>0)S1--}else Se=o1,o1=null;break;case 2:if(je=this.productions_[De[1]][1],St.$=H[H.length-je],St._$={first_line:s[s.length-(je||1)].first_line,last_line:s[s.length-1].last_line,first_column:s[s.length-(je||1)].first_column,last_column:s[s.length-1].last_column},P1)St._$.range=[s[s.length-(je||1)].range[0],s[s.length-1].range[1]];if(u1=this.performAction.apply(St,[i,C1,Y,et.yy,De[1],H,s].concat(O1)),typeof u1<"u")return u1;if(je)I=I.slice(0,-1*je*2),H=H.slice(0,-1*je),s=s.slice(0,-1*je);I.push(this.productions_[De[1]][0]),H.push(St.$),s.push(St._$),D1=O[I[I.length-2]][I[I.length-1]],I.push(D1);break;case 3:return!0}}return!0},"parse")},N1=function(){var Ke={EOF:1,parseError:t(function(V,I){if(this.yy.parser)this.yy.parser.parseError(V,I);else throw Error(V)},"parseError"),setInput:t(function(F,V){if(this.yy=V||this.yy||{},this._input=F,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges)this.yylloc.range=[0,0];return this.offset=0,this},"setInput"),input:t(function(){var F=this._input[0];this.yytext+=F,this.yyleng++,this.offset++,this.match+=F,this.matched+=F;var V=F.match(/(?:\r\n?|\n).*/g);if(V)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),F},"input"),unput:t(function(F){var V=F.length,I=F.split(/(?:\r\n?|\n)/g);this._input=F+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-V),this.offset-=V;var c=this.match.split(/(?:\r\n?|\n)/g);if(this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),I.length-1)this.yylineno-=I.length-1;var H=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:I?(I.length===c.length?this.yylloc.first_column:0)+c[c.length-I.length].length-I[0].length:this.yylloc.first_column-V},this.options.ranges)this.yylloc.range=[H[0],H[0]+this.yyleng-V];return this.yyleng=this.yytext.length,this},"unput"),more:t(function(){return this._more=!0,this},"more"),reject:t(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
25
25
  `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:t(function(F){this.unput(this.match.slice(F))},"less"),pastInput:t(function(){var F=this.matched.substr(0,this.matched.length-this.match.length);return(F.length>20?"...":"")+F.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:t(function(){var F=this.match;if(F.length<20)F+=this._input.substr(0,20-F.length);return(F.substr(0,20)+(F.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:t(function(){var F=this.pastInput(),V=Array(F.length+1).join("-");return F+this.upcomingInput()+`
@@ -197,4 +197,4 @@ Expecting `+t1.join(", ")+", got '"+(this.terminals_[Se]||Se)+"'";else l1="Parse
197
197
  text-align: center;
198
198
  }
199
199
  ${qe()}
200
- `,"getStyles"),ss=ts,vs={parser:Z1,get db(){return new q1},renderer:J1,styles:ss,init:t((e)=>{if(e.agentflow??={},e.layout)sn({layout:e.layout});e.flowchart??={},e.flowchart.arrowMarkerAbsolute=e.arrowMarkerAbsolute,sn({flowchart:{arrowMarkerAbsolute:e.arrowMarkerAbsolute}})},"init")};export{vs as diagram};
200
+ `,"getStyles"),ss=ts,vs={parser:Z1,get db(){return new q1},renderer:J1,styles:ss,init:t((e)=>{if(e.agentflow??={},e.layout)ln({layout:e.layout});e.flowchart??={},e.flowchart.arrowMarkerAbsolute=e.arrowMarkerAbsolute,ln({flowchart:{arrowMarkerAbsolute:e.arrowMarkerAbsolute}})},"init")};export{vs as diagram};
@@ -0,0 +1 @@
1
+ import{h,o,G,i,r,e,n,y,Vt,ne}from"./chunk-ty2rmwda.js";import{qt}from"./chunk-r8p741qj.js";import"./chunk-4qehf2xx.js";var H={config:"自定义路径",env:"环境变量",system:"系统预装"},x="chrome://inspect/#remote-debugging";function M({connection:d}){let{Button:w,Input:B,Switch:E,SettingGroup:S,SettingRow:b,cn:v}=y(),N=G(),[f,R]=r({}),[s,g]=r({}),[a,C]=r(null),[u,I]=r(!0),[k,O]=r(!1),[p,P]=r(!1),[D,c]=r(null),T=i(null),q=(s.executable??"")!==(f.executable??"")||Boolean(s.noSandbox)!==Boolean(f.noSandbox)||Boolean(s.ignoreCertErrors)!==Boolean(f.ignoreCertErrors)||(s.cdpEndpoint??"")!==(f.cdpEndpoint??""),z=h(async(t)=>{O(!0);try{let l=await d.request("/api/plugins/browser/status",{signal:t});C(l)}catch(l){if(!t?.aborted)C({available:!1,error:l instanceof Error?l.message:"无法获取浏览器状态"})}finally{if(!t?.aborted)O(!1)}},[d]);o(()=>{let t=new AbortController;return T.current=t,Promise.all([d.request("/api/plugins/browser/settings",{signal:t.signal}),d.request("/api/plugins/browser/status",{signal:t.signal})]).then(([l,m])=>{if(!t.signal.aborted)R(l),g(l),C(m)}).catch((l)=>{if(!t.signal.aborted)c({type:"error",text:l instanceof Error?l.message:"读取浏览器设置失败"})}).finally(()=>{if(!t.signal.aborted)I(!1)}),()=>t.abort()},[d]);let U=async(t)=>{if(t?.preventDefault(),p||u)return;let l=new AbortController;P(!0),c(null);try{if(await d.request("/api/plugins/browser/settings",{method:"PATCH",signal:l.signal,headers:{"Content-Type":"application/json"},body:JSON.stringify(s)}),!l.signal.aborted)R(s),c({type:"success",text:"设置已保存,将在浏览器进程下次启动时生效。"}),await z(l.signal)}catch(m){if(!l.signal.aborted)c({type:"error",text:m instanceof Error?m.message:"保存设置失败"})}finally{if(!l.signal.aborted)P(!1)}},L=()=>{g(f),c(null)},_=async()=>{try{await navigator.clipboard.writeText(x),c({type:"success",text:"已复制,粘贴到 Chrome 地址栏打开后开启远程调试。"})}catch{c({type:"error",text:`无法写入剪贴板,请手动复制:${x}`})}},F=a?.user?.available===!1,A="首次连接时在 Chrome 弹窗中点「允许」";if(F)A=s.cdpEndpoint?e("span",{className:"break-words text-danger",children:a?.user?.error}):"在 Chrome 打开远程调试设置页并开启";return n("form",{id:N,onSubmit:U,className:"min-w-0 space-y-5",children:[e(S,{title:"运行环境",children:e(b,{title:n("span",{className:"flex items-center gap-2",children:[e("span",{className:v("size-2 shrink-0 rounded-full",a?.available?"bg-success":"bg-danger")}),a?a.available?"浏览器可用":"未检测到可用浏览器":"正在检测…"]}),description:a&&!a.available&&a.error?e("span",{className:"text-danger",children:a.error}):a?.available&&a.source?`来源:${H[a.source]??a.source}`:void 0,children:n(w,{type:"button",size:"sm",variant:"ghost",disabled:u||k,onClick:()=>void z(),className:"text-dim",children:[e(ne,{className:v("size-3.5",k&&"animate-spin")}),"重新检测"]})})}),n(S,{title:"用户浏览器",children:[e(b,{title:n("span",{className:"flex items-center gap-2",children:[e("span",{className:v("size-2 shrink-0 rounded-full",a?.user?.available?"bg-success":"bg-danger")}),a?.user?a.user.available?"可以连接":"暂不可连接":"正在检测…"]}),description:A,children:!s.cdpEndpoint&&n(w,{type:"button",size:"sm",variant:"secondary",title:x,onClick:()=>void _(),children:[e(Vt,{className:"size-3.5"}),"复制远程调试地址"]})}),e(b,{vertical:!0,title:"调试地址",description:"可选,连接以 --remote-debugging-port 启动的本机浏览器",children:e(B,{id:"browser-cdp-endpoint","aria-label":"浏览器调试地址",disabled:u||p,value:s.cdpEndpoint??"",placeholder:"留空连接日常 Chrome",onChange:(t)=>{g({...s,cdpEndpoint:t.target.value}),c(null)}})})]}),n(S,{title:"启动参数",children:[e(b,{vertical:!0,title:"可执行文件路径",description:"留空时自动探测系统浏览器",children:n("div",{className:"flex gap-2",children:[e(B,{id:"browser-executable",disabled:u||p,value:s.executable??"",placeholder:"自动探测",onChange:(t)=>{g({...s,executable:t.target.value}),c(null)}}),s.executable&&e(w,{type:"button",variant:"ghost",size:"sm",disabled:u||p,onClick:()=>{g({...s,executable:""}),c(null)},className:"shrink-0",children:"清空"})]})}),e(b,{title:"禁用沙箱 (--no-sandbox)",description:"容器或 root 环境使用",children:e(E,{label:"禁用沙箱",disabled:u||p,checked:s.noSandbox??!1,onCheckedChange:(t)=>{g({...s,noSandbox:t}),c(null)}})}),e(b,{title:"忽略证书错误 (--ignore-certificate-errors)",description:"跳过自签名与证书有效性检查",children:e(E,{label:"忽略证书错误",disabled:u||p,checked:s.ignoreCertErrors??!1,onCheckedChange:(t)=>{g({...s,ignoreCertErrors:t}),c(null)}})})]}),e(qt,{formID:N,notice:D,dirty:q,busy:u||p,saving:p,onReset:L})]})}export{M as default};
@@ -1 +1 @@
1
- import{D,r,e,n,Ae,It,q,ie,ro}from"./chunk-ve8gy05p.js";function T(s){let a=D(Ae);a?.useTheme?.();let t=s.payload,[i,m]=r(!1);if(!t||t.state==="pending")return null;let h=t.questions.map((o)=>o.header).join(" · "),l=t.state==="answered",u=l?q:It,d=l?"text-success":"text-faint",f=l?"已回答":t.state==="dismissed"?"已忽略提问":"提问已取消",p=l?g(t):h;if(a){let{Collapsible:o,CollapsibleTrigger:y,CollapsibleContent:N,Chevron:v,cn:b}=a;return n(o,{open:i,onOpenChange:m,className:"w-full text-xs text-ink/90 animate-fade",children:[n(y,{className:a.style("chat.timelineRow","cursor-pointer select-none"),children:[e("span",{className:"flex size-4 shrink-0 items-center justify-center",children:e(u,{className:b("size-3.5",d)})}),e("span",{className:"shrink-0",children:f}),e("span",{className:"min-w-0 flex-1 truncate opacity-80",title:p,children:p}),e(v,{className:"size-3.5 shrink-0 text-faint opacity-0 transition-opacity group-hover/collapsible:opacity-100 group-data-[state=open]/collapsible:opacity-100"})]}),e(N,{children:e("div",{className:"mt-0.5 mb-1.5 ml-2 border-l border-line py-1 pl-[15px]",children:e(x,{question:t})})})]})}return n("div",{role:"status",className:"w-full animate-fade",children:[n("button",{type:"button","aria-expanded":i,className:"group -mx-2 flex w-[calc(100%+1rem)] cursor-pointer items-center gap-2 rounded-lg px-2 py-1 text-left text-[12.5px] text-faint transition-colors select-none hover:bg-raised/60 hover:text-dim",onClick:()=>m((o)=>!o),children:[e("span",{className:"flex size-4 shrink-0 items-center justify-center",children:e(u,{className:`size-3.5 shrink-0 ${d}`})}),e("span",{className:"shrink-0",children:f}),e("span",{className:"min-w-0 flex-1 truncate opacity-80",title:p,children:p}),e(ie,{className:`size-3.5 shrink-0 text-faint opacity-0 transition-[opacity,transform] group-hover:opacity-100 ${i?"rotate-180 opacity-100":""}`})]}),i&&e("div",{className:"mt-0.5 mb-1.5 ml-2 border-l border-line py-1 pl-[15px]",children:e(x,{question:t})})]})}function c(s){if(!s)return"未作答";let a=s.selected.map((t)=>ro(t).title);if(s.other)a.push(`其他:${s.other}`);return a.length?a.join("、"):"未作答"}function g(s){if(s.questions.length===1)return`${s.questions[0]?.header??""} · ${c(s.answers?.[0])}`;return s.questions.map((a,t)=>`${a.header} → ${c(s.answers?.[t])}`).join(";")}function x(s){let a=s.question;return e("div",{className:"space-y-2 text-xs",children:a.questions.map((t,i)=>n("div",{className:"space-y-0.5",children:[n("div",{className:"text-dim",children:[e("span",{className:"font-medium text-ink/90",children:t.header})," · ",t.question]}),e("div",{className:"text-ink",children:c(a.answers?.[i])})]},t.header))})}export{T as QuestionCard};
1
+ import{D,r,e,n,Ae,st,U,ie,io}from"./chunk-ty2rmwda.js";function Q(s){let a=D(Ae);a?.useTheme?.();let t=s.payload,[i,m]=r(!1);if(!t||t.state==="pending")return null;let h=t.questions.map((o)=>o.header).join(" · "),l=t.state==="answered",u=l?U:st,d=l?"text-success":"text-faint",f=l?"已回答":t.state==="dismissed"?"已忽略提问":"提问已取消",p=l?g(t):h;if(a){let{Collapsible:o,CollapsibleTrigger:y,CollapsibleContent:N,Chevron:v,cn:b}=a;return n(o,{open:i,onOpenChange:m,className:"w-full text-xs text-ink/90 animate-fade",children:[n(y,{className:a.style("chat.timelineRow","cursor-pointer select-none"),children:[e("span",{className:"flex size-4 shrink-0 items-center justify-center",children:e(u,{className:b("size-3.5",d)})}),e("span",{className:"shrink-0",children:f}),e("span",{className:"min-w-0 flex-1 truncate opacity-80",title:p,children:p}),e(v,{className:"size-3.5 shrink-0 text-faint opacity-0 transition-opacity group-hover/collapsible:opacity-100 group-data-[state=open]/collapsible:opacity-100"})]}),e(N,{children:e("div",{className:"mt-0.5 mb-1.5 ml-2 border-l border-line py-1 pl-[15px]",children:e(x,{question:t})})})]})}return n("div",{role:"status",className:"w-full animate-fade",children:[n("button",{type:"button","aria-expanded":i,className:"group -mx-2 flex w-[calc(100%+1rem)] cursor-pointer items-center gap-2 rounded-lg px-2 py-1 text-left text-[12.5px] text-faint transition-colors select-none hover:bg-raised/60 hover:text-dim",onClick:()=>m((o)=>!o),children:[e("span",{className:"flex size-4 shrink-0 items-center justify-center",children:e(u,{className:`size-3.5 shrink-0 ${d}`})}),e("span",{className:"shrink-0",children:f}),e("span",{className:"min-w-0 flex-1 truncate opacity-80",title:p,children:p}),e(ie,{className:`size-3.5 shrink-0 text-faint opacity-0 transition-[opacity,transform] group-hover:opacity-100 ${i?"rotate-180 opacity-100":""}`})]}),i&&e("div",{className:"mt-0.5 mb-1.5 ml-2 border-l border-line py-1 pl-[15px]",children:e(x,{question:t})})]})}function c(s){if(!s)return"未作答";let a=s.selected.map((t)=>io(t).title);if(s.other)a.push(`其他:${s.other}`);return a.length?a.join("、"):"未作答"}function g(s){if(s.questions.length===1)return`${s.questions[0]?.header??""} · ${c(s.answers?.[0])}`;return s.questions.map((a,t)=>`${a.header} → ${c(s.answers?.[t])}`).join(";")}function x(s){let a=s.question;return e("div",{className:"space-y-2 text-xs",children:a.questions.map((t,i)=>n("div",{className:"space-y-0.5",children:[n("div",{className:"text-dim",children:[e("span",{className:"font-medium text-ink/90",children:t.header})," · ",t.question]}),e("div",{className:"text-ink",children:c(a.answers?.[i])})]},t.header))})}export{Q as QuestionCard};
@@ -0,0 +1 @@
1
+ import{ki}from"./chunk-pafw34vg.js";export{ki as default};
@@ -0,0 +1 @@
1
+ import{Ai}from"./chunk-p4pqtybm.js";export{Ai as createWardleyServices};