@bkm016/basalt 0.1.0 → 0.1.2

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 (214) hide show
  1. package/README.md +16 -22
  2. package/chunk-06hdzq5n.js +2 -0
  3. package/chunk-09rj27b2.js +2 -0
  4. package/{chunk-qnr1f5pj.js → chunk-0y7ne3d0.js} +2 -2
  5. package/{chunk-8wjgbd9k.js → chunk-10xzzn07.js} +2 -2
  6. package/{chunk-bj14jshr.js → chunk-1qpces5a.js} +2 -2
  7. package/chunk-1zdwrgd4.js +2 -0
  8. package/chunk-27gntzs5.js +5 -0
  9. package/chunk-2esbgxps.js +25 -0
  10. package/{chunk-913tfr9c.js → chunk-362g64pd.js} +1 -1
  11. package/{chunk-rjdhaasf.js → chunk-3cjsd292.js} +2 -2
  12. package/chunk-5c9j8qe4.js +478 -0
  13. package/chunk-5j1krv9v.js +2 -0
  14. package/{chunk-vkkj4awb.js → chunk-6hssbcgj.js} +1 -1
  15. package/chunk-75m78j7x.js +10 -0
  16. package/{chunk-zt1wvkyf.js → chunk-8296hw9m.js} +1 -1
  17. package/{chunk-9y69ywyg.js → chunk-8d46jtbj.js} +2 -2
  18. package/{chunk-sf13azm4.js → chunk-8tjad3r0.js} +4 -4
  19. package/{chunk-agntrqs9.js → chunk-97rzj7f6.js} +1 -1
  20. package/{chunk-k7w7ac9q.js → chunk-981f9dw8.js} +8 -8
  21. package/chunk-9mmz6wt3.js +2 -0
  22. package/chunk-aefadsy6.js +3 -0
  23. package/chunk-bannb9xm.js +3 -0
  24. package/chunk-bpw6q7g0.js +3 -0
  25. package/{chunk-3jz9g8ab.js → chunk-c7x1zq39.js} +3 -3
  26. package/{chunk-rv06x0kn.js → chunk-cjc90f84.js} +1 -1
  27. package/{chunk-6gyhajhx.js → chunk-d2j735sd.js} +2 -2
  28. package/{chunk-qcwnkr5y.js → chunk-d8gtbw9g.js} +1 -1
  29. package/{chunk-rm3kcxq9.js → chunk-fjtvjrkg.js} +13 -13
  30. package/{chunk-qbf8x2ft.js → chunk-fm0k0qtz.js} +1 -1
  31. package/{chunk-1yzt0qm0.js → chunk-fw2bpqmw.js} +1 -1
  32. package/{chunk-kgdrjqsy.js → chunk-g2t6t8fk.js} +2 -2
  33. package/{chunk-wc5j0hfw.js → chunk-gp7y0fja.js} +13 -13
  34. package/{chunk-5fdgy0q2.js → chunk-gzxnene8.js} +10 -10
  35. package/{chunk-y9xe9ct2.js → chunk-hwr56pfj.js} +1 -1
  36. package/{chunk-0hbjv3y6.js → chunk-jwdb0ccj.js} +3 -3
  37. package/{chunk-x9982ek7.js → chunk-k23t7vhs.js} +5 -5
  38. package/{chunk-qffb7een.js → chunk-k506w58v.js} +2 -2
  39. package/{chunk-0tdv0t5q.js → chunk-k6w6y71k.js} +2 -2
  40. package/chunk-m40gxwq4.js +5 -0
  41. package/chunk-m8vkwdgr.js +5 -0
  42. package/{chunk-7yw8aa5j.js → chunk-mvfsxdx6.js} +13 -13
  43. package/{chunk-3p7q2pyp.js → chunk-nbb9trwz.js} +1 -1
  44. package/{chunk-0szjy61m.js → chunk-pbcy6zdt.js} +1 -1
  45. package/chunk-pmqtkqsf.js +2 -0
  46. package/{chunk-hat3s3pr.js → chunk-pxsrqrd0.js} +1 -1
  47. package/{chunk-xsbxykr4.js → chunk-qe0teyn1.js} +1 -1
  48. package/{chunk-2zqny2sy.js → chunk-r7fpkb49.js} +1 -1
  49. package/{chunk-xhk54h2q.js → chunk-rtzqqngy.js} +4 -4
  50. package/chunk-ry0z4ev6.js +2 -0
  51. package/{chunk-0rya8cxe.js → chunk-shadcb9z.js} +2 -2
  52. package/chunk-shhrr741.js +3753 -0
  53. package/{chunk-tnrqkc7b.js → chunk-t6zs4kw0.js} +2 -2
  54. package/chunk-tvm4zmgj.js +3 -0
  55. package/{chunk-hcn9cf6v.js → chunk-v258nxcz.js} +1 -1
  56. package/{chunk-a6r4z44b.js → chunk-vk1gxk1t.js} +1 -1
  57. package/{chunk-d913kpyw.js → chunk-vv7fp27r.js} +2 -2
  58. package/{chunk-g2k3yhgh.js → chunk-x1xss1d7.js} +3 -3
  59. package/{chunk-dakrpbe6.js → chunk-x4874m8e.js} +2 -2
  60. package/{chunk-wx7kdf0b.js → chunk-xfvvh1s5.js} +1 -1
  61. package/{chunk-1egbcp85.js → chunk-y0m980k3.js} +7 -7
  62. package/{chunk-5wp4egky.js → chunk-y58ygzn9.js} +4 -4
  63. package/{chunk-kjr81mrd.js → chunk-y648fzx0.js} +5 -5
  64. package/{chunk-32at88hc.js → chunk-y7nma9rk.js} +1 -1
  65. package/{chunk-wd9zxhza.js → chunk-ykens1hy.js} +1 -1
  66. package/chunk-z55bmysw.js +2 -0
  67. package/chunk-zmsgwr3s.js +2 -0
  68. package/{chunk-501zkf9b.js → chunk-ztsjgssj.js} +1 -1
  69. package/cli.js +89 -0
  70. package/compiled.js +12 -3762
  71. package/package.json +4 -3
  72. package/ui-test-worker.js +67 -67
  73. package/web/chunk-0sewdyz1.js +1 -0
  74. package/web/{chunk-g9qv15hq.js → chunk-1z5p7a1h.js} +1 -1
  75. package/web/chunk-21ke27j6.js +1 -0
  76. package/web/{chunk-svmhj9hd.js → chunk-24k0r5aq.js} +1 -1
  77. package/web/{chunk-vqjs551t.js → chunk-284a17k8.js} +1 -1
  78. package/web/{chunk-3cfabjey.js → chunk-2pjdtesn.js} +14 -14
  79. package/web/{chunk-ngpq43vn.js → chunk-3mvr2gwh.js} +1 -1
  80. package/web/chunk-3t3zwx9j.js +1 -0
  81. package/web/{chunk-ezyvv4ab.js → chunk-3z93efr4.js} +1 -1
  82. package/web/{chunk-rkesqprv.js → chunk-43jqvsrg.js} +1 -1
  83. package/web/{chunk-4y2td14d.js → chunk-4bry4xds.js} +2 -2
  84. package/web/{chunk-ea9swkkt.js → chunk-5e7ygjdn.js} +1 -1
  85. package/web/{chunk-3ahpr030.js → chunk-5jbf7n5q.js} +1 -1
  86. package/web/{chunk-bhe4jzha.js → chunk-5rx8rtsa.js} +1 -1
  87. package/web/chunk-5xc9d5ft.js +1 -0
  88. package/web/{chunk-fdkp6tzq.js → chunk-693m9kt7.js} +3 -3
  89. package/web/{chunk-mq92vqb1.js → chunk-6qejm5s2.js} +1 -1
  90. package/web/{chunk-z1jtv4c0.js → chunk-8ah6ce1b.js} +2 -2
  91. package/web/{chunk-zk2f7x5e.js → chunk-8e43yaq3.js} +3 -3
  92. package/web/{chunk-hejz98gw.js → chunk-8wye0wbb.js} +1 -1
  93. package/web/{chunk-pz934t6t.js → chunk-986z0p48.js} +5 -5
  94. package/web/{chunk-jtwhjp20.js → chunk-9dd1c37b.js} +77 -77
  95. package/web/{chunk-sc63gh9d.js → chunk-9re6yttj.js} +2 -2
  96. package/web/{chunk-1t760bg0.js → chunk-abbvjt4e.js} +1 -1
  97. package/web/{chunk-1v3d60pp.js → chunk-agmkx996.js} +3 -3
  98. package/web/{chunk-kbtbbarw.js → chunk-anbn2ttv.js} +2 -2
  99. package/web/chunk-aqm3spxt.js +1139 -0
  100. package/web/{chunk-jvhmna7z.js → chunk-avwpjsxw.js} +5 -5
  101. package/web/chunk-b470hvpk.js +1 -0
  102. package/web/{chunk-29e1trsq.js → chunk-bt1m87ck.js} +2 -2
  103. package/web/chunk-cqp1d4p0.js +1 -0
  104. package/web/{chunk-b5brnfv9.js → chunk-ctcrk3qn.js} +2 -2
  105. package/web/{chunk-zakv2xdf.js → chunk-ctd8bfg2.js} +1 -1
  106. package/web/{chunk-5hex8g0y.js → chunk-cwvtraca.js} +1 -1
  107. package/web/{chunk-1x8fn8w9.js → chunk-dk90px7g.js} +1 -1
  108. package/web/{chunk-0mrkjnte.js → chunk-ds7srg4p.js} +1 -1
  109. package/web/{chunk-6r912gfj.js → chunk-dt8ss97f.js} +5 -5
  110. package/web/{chunk-ykxpb3wv.js → chunk-ezkqa7we.js} +1 -1
  111. package/web/{chunk-svdzmaxb.js → chunk-f078k1ej.js} +1 -1
  112. package/web/chunk-fekjj24p.css +1 -0
  113. package/web/{chunk-v6v831tc.js → chunk-fqj9kry9.js} +5 -5
  114. package/web/chunk-frjfamx7.js +8 -0
  115. package/web/{chunk-rz6wwdd5.js → chunk-fy8ey195.js} +1 -1
  116. package/web/{chunk-p8y0hjx9.js → chunk-g8ee1csm.js} +1 -1
  117. package/web/{chunk-ktqt87qw.js → chunk-h31p43qa.js} +1 -1
  118. package/web/chunk-h5p5jsrw.js +1 -0
  119. package/web/chunk-h9fmr6ch.js +1 -0
  120. package/web/{chunk-x9q4kh67.js → chunk-jf2ehmvp.js} +2 -2
  121. package/web/{chunk-canbct9d.js → chunk-jmnaq7c1.js} +1 -1
  122. package/web/chunk-jq0pw0k2.js +1 -0
  123. package/web/{chunk-ghxe4gam.js → chunk-jvj66qhs.js} +2 -2
  124. package/web/{chunk-7f0m2yrd.js → chunk-jzmzhj8z.js} +4 -4
  125. package/web/chunk-k4cfnvyq.js +1 -0
  126. package/web/{chunk-942prjb6.js → chunk-kgerjbn4.js} +1 -1
  127. package/web/{chunk-3bqh2dkw.js → chunk-kww4azv5.js} +5 -5
  128. package/web/chunk-m29dhjkh.js +1 -0
  129. package/web/chunk-mj6tee5h.js +1 -0
  130. package/web/{chunk-a3xt6840.js → chunk-mjpjkyd1.js} +1 -1
  131. package/web/{chunk-20q90epj.js → chunk-n8sky2q6.js} +1 -1
  132. package/web/{chunk-3pf33xsm.js → chunk-pk3ap3wh.js} +4 -4
  133. package/web/{chunk-tfyxp2qs.js → chunk-q1pkntc6.js} +4 -4
  134. package/web/{chunk-gxn0bey7.js → chunk-qryrg2pq.js} +2 -2
  135. package/web/{chunk-0xck277j.js → chunk-r92sbgwv.js} +5 -5
  136. package/web/{chunk-ev1g5cqw.js → chunk-raqqscwa.js} +2 -2
  137. package/web/{chunk-c85wxnpw.js → chunk-rc2vq9wz.js} +3 -3
  138. package/web/{chunk-rsn8j7xv.js → chunk-rkj743fg.js} +3 -3
  139. package/web/{chunk-v47rhg7b.js → chunk-rrws61wf.js} +1 -1
  140. package/web/{chunk-ytpwz01r.js → chunk-s3hwejnr.js} +2 -2
  141. package/web/{chunk-bwyw10wx.js → chunk-s3rdx28k.js} +2 -2
  142. package/web/{chunk-hryhthxr.js → chunk-shbw6wg8.js} +1 -1
  143. package/web/chunk-szcy5z56.js +1 -0
  144. package/web/{chunk-ejd43q75.js → chunk-t1xk6hca.js} +4 -4
  145. package/web/chunk-t2hhdg9r.js +1 -0
  146. package/web/chunk-tj4cmkwe.js +1 -0
  147. package/web/{chunk-mdsgekpk.js → chunk-tn1xzmgx.js} +1 -1
  148. package/web/{chunk-0k0hvh59.js → chunk-tnv7z83q.js} +1 -1
  149. package/web/chunk-v2b5q0n5.js +1 -0
  150. package/web/{chunk-haphmhz8.js → chunk-vj6kstpp.js} +5 -5
  151. package/web/{chunk-e5rmr47n.js → chunk-vjqmnkh2.js} +1 -1
  152. package/web/{chunk-vfqe8298.js → chunk-vkc149rb.js} +1 -1
  153. package/web/{chunk-n5fn9khr.js → chunk-vny496ba.js} +1 -1
  154. package/web/{chunk-s8vapqgr.js → chunk-vz5ck6x9.js} +1 -1
  155. package/web/{chunk-6atq9qtt.js → chunk-xa88zgkr.js} +1 -1
  156. package/web/{chunk-d4d3mnak.js → chunk-xdcs8qz3.js} +4 -4
  157. package/web/chunk-y5x74t89.js +1 -0
  158. package/web/{chunk-x3zwjkwg.js → chunk-yen2kkn2.js} +1 -1
  159. package/web/{chunk-vadqkz3x.js → chunk-yjv2c45j.js} +4 -4
  160. package/web/chunk-yx3dh5hg.js +1 -0
  161. package/web/chunk-yz4fmtk2.js +1 -0
  162. package/web/{chunk-4b5mt5pd.js → chunk-z24vs8q9.js} +3 -3
  163. package/web/chunk-z5j6x6j8.js +2 -0
  164. package/web/chunk-z5stjrhc.js +1 -0
  165. package/web/{chunk-3pm4645m.js → chunk-z760wagr.js} +1 -1
  166. package/web/{chunk-nerx2q12.js → chunk-znvnb9dh.js} +1 -1
  167. package/web/{chunk-55kw67nv.js → chunk-zrzq29e6.js} +1 -1
  168. package/web/{icon-yx2p2pye.svg → icon-1wgy7kzy.svg} +13 -13
  169. package/web/icon.svg +13 -13
  170. package/web/index.html +2 -2
  171. package/web/install.sh +0 -0
  172. package/web/sw.js +9 -0
  173. package/worker.js +1 -1
  174. package/chunk-1fv27j4b.js +0 -3
  175. package/chunk-356q8e0y.js +0 -10
  176. package/chunk-58vz2qsq.js +0 -2
  177. package/chunk-665jzf2w.js +0 -25
  178. package/chunk-97kjn55j.js +0 -2
  179. package/chunk-b9bg5fhd.js +0 -2
  180. package/chunk-c25s4w6a.js +0 -5
  181. package/chunk-j2x0g1vg.js +0 -2
  182. package/chunk-k0t23cmx.js +0 -2
  183. package/chunk-m38ber71.js +0 -2
  184. package/chunk-rad3dm0q.js +0 -2
  185. package/chunk-sytpmbfp.js +0 -471
  186. package/chunk-t057xfrt.js +0 -5
  187. package/chunk-tjpvayr1.js +0 -2
  188. package/chunk-ve7qx8wm.js +0 -3
  189. package/chunk-y8ced1jm.js +0 -5
  190. package/chunk-yb1jxgnk.js +0 -2
  191. package/web/chunk-00mq7bhx.js +0 -1
  192. package/web/chunk-0atfn8jf.js +0 -1
  193. package/web/chunk-310yey4q.js +0 -1
  194. package/web/chunk-32ezm0ry.js +0 -1136
  195. package/web/chunk-3hvgs5aw.js +0 -1
  196. package/web/chunk-3kh6zefg.js +0 -1
  197. package/web/chunk-401v5ht6.js +0 -8
  198. package/web/chunk-5r5kv4gh.js +0 -1
  199. package/web/chunk-95q1bwxn.js +0 -1
  200. package/web/chunk-9s7c178f.js +0 -1
  201. package/web/chunk-benmmqt2.js +0 -1
  202. package/web/chunk-bgqdcnke.js +0 -1
  203. package/web/chunk-eqegxtdt.js +0 -1
  204. package/web/chunk-gmfp7fg4.js +0 -1
  205. package/web/chunk-gxay64d5.js +0 -1
  206. package/web/chunk-jg6nzn6q.js +0 -1
  207. package/web/chunk-kx2xk3bb.js +0 -1
  208. package/web/chunk-ry9256r7.js +0 -1
  209. package/web/chunk-vfqdy860.js +0 -1
  210. package/web/chunk-wtawdeej.css +0 -1
  211. package/web/chunk-x59p8sg2.js +0 -1
  212. package/web/chunk-y7z144e3.js +0 -1
  213. package/web/chunk-ydgqrfvw.js +0 -2
  214. package/web/chunk-yj1a2d37.js +0 -1
@@ -1 +1 @@
1
- import{e,r}from"./chunk-jtwhjp20.js";import{K,Lt,It}from"./chunk-jvhmna7z.js";import{W}from"./chunk-e5rmr47n.js";import{or,_t}from"./chunk-gxn0bey7.js";var i=or().RailroadPeg.parser.LangiumParser,s=e((t)=>{let a=t.alternatives.map(l);if(a.length===1)return a[0];return{type:"choice",alternatives:a}},"transformOrderedChoice"),l=e((t)=>{let a=t.elements.map(m);if(a.length===1)return a[0];return{type:"sequence",elements:a}},"transformSequence"),m=e((t)=>{let a=p(t.suffix);if(!t.operator)return a;return{type:"special",text:t.operator==="&"?`&${o(a)}`:`!${o(a)}`}},"transformPrefix"),o=e((t)=>{switch(t.type){case"terminal":return`"${t.value}"`;case"nonterminal":return t.name;case"special":return t.text;default:return"(...)"}},"nodeToLabel"),p=e((t)=>{let a=u(t.primary);if(!t.operator)return a;switch(t.operator){case"?":return{type:"optional",element:a};case"*":return{type:"repetition",element:a,min:0,max:1/0};case"+":return{type:"repetition",element:a,min:1,max:1/0};default:throw Error(`Unsupported PEG suffix operator: ${t.operator}`)}},"transformSuffix"),u=e((t)=>{switch(t.$type){case"PegLiteral":return{type:"terminal",value:t.value};case"PegIdentifier":return{type:"nonterminal",name:t.name};case"PegGroup":return s(t.element);case"PegAny":return{type:"special",text:t.dot};default:throw Error(`Unsupported PEG primary node: ${t.$type}`)}},"transformPrimary"),c=e((t)=>({name:t.name,definition:s(t.definition)}),"transformRule"),f=e((t)=>{if(W(t,K),t.title)K.setTitle(t.title);t.rules.map((a)=>K.addRule(c(a)))},"populateDb"),d={parse:e((t)=>{K.clear(),r.debug("[PEG Parser] Starting Langium parse");let a=i.parse(t);if(a.lexerErrors.length>0||a.parserErrors.length>0)throw new _t(a);let n=a.value;r.debug("[PEG Parser] Parsed rules:",n.rules.length),f(n),r.debug("[PEG Parser] Parse complete")},"parse"),parser:{yy:K}},w={parser:d,db:K,renderer:It,styles:Lt};export{w as diagram};
1
+ import{e,r}from"./chunk-9dd1c37b.js";import{K,It,Rt}from"./chunk-avwpjsxw.js";import{W}from"./chunk-vjqmnkh2.js";import{or,_t}from"./chunk-qryrg2pq.js";var i=or().RailroadPeg.parser.LangiumParser,s=e((t)=>{let a=t.alternatives.map(l);if(a.length===1)return a[0];return{type:"choice",alternatives:a}},"transformOrderedChoice"),l=e((t)=>{let a=t.elements.map(m);if(a.length===1)return a[0];return{type:"sequence",elements:a}},"transformSequence"),m=e((t)=>{let a=p(t.suffix);if(!t.operator)return a;return{type:"special",text:t.operator==="&"?`&${o(a)}`:`!${o(a)}`}},"transformPrefix"),o=e((t)=>{switch(t.type){case"terminal":return`"${t.value}"`;case"nonterminal":return t.name;case"special":return t.text;default:return"(...)"}},"nodeToLabel"),p=e((t)=>{let a=u(t.primary);if(!t.operator)return a;switch(t.operator){case"?":return{type:"optional",element:a};case"*":return{type:"repetition",element:a,min:0,max:1/0};case"+":return{type:"repetition",element:a,min:1,max:1/0};default:throw Error(`Unsupported PEG suffix operator: ${t.operator}`)}},"transformSuffix"),u=e((t)=>{switch(t.$type){case"PegLiteral":return{type:"terminal",value:t.value};case"PegIdentifier":return{type:"nonterminal",name:t.name};case"PegGroup":return s(t.element);case"PegAny":return{type:"special",text:t.dot};default:throw Error(`Unsupported PEG primary node: ${t.$type}`)}},"transformPrimary"),c=e((t)=>({name:t.name,definition:s(t.definition)}),"transformRule"),f=e((t)=>{if(W(t,K),t.title)K.setTitle(t.title);t.rules.map((a)=>K.addRule(c(a)))},"populateDb"),d={parse:e((t)=>{K.clear(),r.debug("[PEG Parser] Starting Langium parse");let a=i.parse(t);if(a.lexerErrors.length>0||a.parserErrors.length>0)throw new _t(a);let n=a.value;r.debug("[PEG Parser] Parsed rules:",n.rules.length),f(n),r.debug("[PEG Parser] Parse complete")},"parse"),parser:{yy:K}},w={parser:d,db:K,renderer:Rt,styles:It};export{w as diagram};
@@ -0,0 +1 @@
1
+ import{Ki,Co,Qi,So,To,Ji}from"./chunk-jf2ehmvp.js";import"./chunk-g8ee1csm.js";import"./chunk-8ah6ce1b.js";import"./chunk-9dd1c37b.js";export{Co as applyDagreLayoutResult,Ki as getEdgesToRender,So as measureDagreLayout,Qi as prepareLayoutForDagre,Ji as render,To as runDagreLayoutCore};
@@ -1,3 +1,3 @@
1
- import{W}from"./chunk-e5rmr47n.js";import{e,r,D,b,O,C,S,E,T,A,I,L,s,wr,p,Dn,Zr,U}from"./chunk-jtwhjp20.js";import{$r,X}from"./chunk-gxn0bey7.js";var G="position frame",V="frame positioned",F="position relation",j="relation positioned",pe=e(function(t){r.debug("options str",t)},"setOptions"),ve=e(function(){return{}},"getOptions"),be=e(function(){Y(),C()},"clear");function Y(){M={}}e(Y,"reset");var we=D.eventmodeling,ye=e(()=>U({...we,...b().eventmodeling}),"getConfig"),M={};function z(){let t=Pe,{ast:i}=M,n=N();if(!i)throw Error("No data for EventModel");return i.frames.forEach((a,o)=>{let d=te(a,i.dataEntities,n);t=P(t,{$kind:G,index:o,frame:a,textProps:d});let c=void 0;if(se(a))r.debug("source frame",a.sourceFrames),c=i.frames.filter((m)=>a.sourceFrames.some((u)=>u.$refText===m.name)),c.forEach((m)=>{t=P(t,{$kind:F,index:o,frame:a,sourceFrame:m})});else t=P(t,{$kind:F,index:o,frame:a})}),t={...t,sortedSwimlanesArray:H(t.swimlanes)},t}e(z,"getState");function K(t){M.ast=void 0;let i=new Set;for(let n of t.frames){if(i.has(n.name)){let a=n.$cstNode?.range.start.line,o=a===void 0?"":` on line ${a+1}`;throw Error(`Duplicate event modeling frame ID "${n.name}"${o}`)}i.add(n.name)}M.ast=t}e(K,"setAst");var l={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 N(){return l}e(N,"getDiagramProps");var Pe={boxes:[],swimlanes:{},relations:[],maxR:0,sortedSwimlanesArray:[]};function q(t){let i=t.split(".");if(i.length===2)return i[0];return}e(q,"extractNamespace");function J(t){let i=t.split(".");if(i.length===2)return i[1];return t}e(J,"extractName");function Q(t,i){if(!i||i.length===0)return;return Object.values(t).find((n)=>n.namespace===i)}e(Q,"findSwimlaneByNamespace");function y(t,i,n){return Math.max(i,...Object.keys(t).filter((a)=>{let o=Number.parseInt(a);return o>i&&o<n}).map((a)=>Number.parseInt(a)))+1}e(y,"findNextAvailableIndex");function Z(t,i){let n=q(t.entityIdentifier),a=Q(i,n);switch(t.modelEntityType){case"ui":case"pcr":case"processor":if(a)return{index:a.index,label:a.namespace||l.labelUiAutomation};else if(n)return{index:y(i,0,100),label:l.labelUiAutomationPrefix+n};return{index:0,label:l.labelUiAutomation};case"rmo":case"readmodel":case"cmd":case"command":if(a)return{index:a.index,label:a.namespace||l.labelCommandReadModel};else if(n)return{index:y(i,100,200),label:l.labelCommandReadModelPrefix+n};return{index:100,label:l.labelCommandReadModel};case"evt":case"event":default:if(a)return{index:a.index,label:a.namespace||l.labelEvents};else if(n)return{index:y(i,200,300),label:l.labelEventsPrefix+n};return{index:200,label:l.labelEvents}}}e(Z,"calculateSwimlaneProps");function ee(t){let{themeVariables:i}=b();switch(t.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"}}}e(ee,"calculateEntityVisualProps");function te(t,i,n){let a=b(),o=O(J(t.entityIdentifier)??"",a),d,c={fontSize:16,fontWeight:700,fontFamily:'"trebuchet ms", verdana, arial, sans-serif',joinWith:"<br/>"},u=`<b>${Dn(o,n.textMaxWidth,c)}</b>`;if(t.dataInlineValue)d=t.dataInlineValue,d=d.substring(d.indexOf("{")+1),d=d.substring(0,d.lastIndexOf("}")-1),d=O(d,a),d=Dn(d,n.textMaxWidth,c),d=d.replaceAll(" ","&nbsp;");if(t.dataReference){let w=i.find((k)=>k.name===t.dataReference?.$refText);if(w)d=w.dataBlockValue,d=d.substring(d.indexOf(`{
1
+ import{W}from"./chunk-vjqmnkh2.js";import{e,r,D,b,O,C,S,E,T,A,I,L,s,wr,p,Dn,Zr,U}from"./chunk-9dd1c37b.js";import{$r,X}from"./chunk-qryrg2pq.js";var G="position frame",V="frame positioned",F="position relation",j="relation positioned",pe=e(function(t){r.debug("options str",t)},"setOptions"),ve=e(function(){return{}},"getOptions"),be=e(function(){Y(),C()},"clear");function Y(){M={}}e(Y,"reset");var we=D.eventmodeling,ye=e(()=>U({...we,...b().eventmodeling}),"getConfig"),M={};function z(){let t=Pe,{ast:i}=M,n=N();if(!i)throw Error("No data for EventModel");return i.frames.forEach((a,o)=>{let d=te(a,i.dataEntities,n);t=P(t,{$kind:G,index:o,frame:a,textProps:d});let c=void 0;if(se(a))r.debug("source frame",a.sourceFrames),c=i.frames.filter((m)=>a.sourceFrames.some((u)=>u.$refText===m.name)),c.forEach((m)=>{t=P(t,{$kind:F,index:o,frame:a,sourceFrame:m})});else t=P(t,{$kind:F,index:o,frame:a})}),t={...t,sortedSwimlanesArray:H(t.swimlanes)},t}e(z,"getState");function K(t){M.ast=void 0;let i=new Set;for(let n of t.frames){if(i.has(n.name)){let a=n.$cstNode?.range.start.line,o=a===void 0?"":` on line ${a+1}`;throw Error(`Duplicate event modeling frame ID "${n.name}"${o}`)}i.add(n.name)}M.ast=t}e(K,"setAst");var l={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 N(){return l}e(N,"getDiagramProps");var Pe={boxes:[],swimlanes:{},relations:[],maxR:0,sortedSwimlanesArray:[]};function q(t){let i=t.split(".");if(i.length===2)return i[0];return}e(q,"extractNamespace");function J(t){let i=t.split(".");if(i.length===2)return i[1];return t}e(J,"extractName");function Q(t,i){if(!i||i.length===0)return;return Object.values(t).find((n)=>n.namespace===i)}e(Q,"findSwimlaneByNamespace");function y(t,i,n){return Math.max(i,...Object.keys(t).filter((a)=>{let o=Number.parseInt(a);return o>i&&o<n}).map((a)=>Number.parseInt(a)))+1}e(y,"findNextAvailableIndex");function Z(t,i){let n=q(t.entityIdentifier),a=Q(i,n);switch(t.modelEntityType){case"ui":case"pcr":case"processor":if(a)return{index:a.index,label:a.namespace||l.labelUiAutomation};else if(n)return{index:y(i,0,100),label:l.labelUiAutomationPrefix+n};return{index:0,label:l.labelUiAutomation};case"rmo":case"readmodel":case"cmd":case"command":if(a)return{index:a.index,label:a.namespace||l.labelCommandReadModel};else if(n)return{index:y(i,100,200),label:l.labelCommandReadModelPrefix+n};return{index:100,label:l.labelCommandReadModel};case"evt":case"event":default:if(a)return{index:a.index,label:a.namespace||l.labelEvents};else if(n)return{index:y(i,200,300),label:l.labelEventsPrefix+n};return{index:200,label:l.labelEvents}}}e(Z,"calculateSwimlaneProps");function ee(t){let{themeVariables:i}=b();switch(t.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"}}}e(ee,"calculateEntityVisualProps");function te(t,i,n){let a=b(),o=O(J(t.entityIdentifier)??"",a),d,c={fontSize:16,fontWeight:700,fontFamily:'"trebuchet ms", verdana, arial, sans-serif',joinWith:"<br/>"},u=`<b>${Dn(o,n.textMaxWidth,c)}</b>`;if(t.dataInlineValue)d=t.dataInlineValue,d=d.substring(d.indexOf("{")+1),d=d.substring(0,d.lastIndexOf("}")-1),d=O(d,a),d=Dn(d,n.textMaxWidth,c),d=d.replaceAll(" ","&nbsp;");if(t.dataReference){let w=i.find((k)=>k.name===t.dataReference?.$refText);if(w)d=w.dataBlockValue,d=d.substring(d.indexOf(`{
2
2
  `)+2),d=d.substring(0,d.lastIndexOf("}")-1),d=O(d,a),d=Dn(d,n.textMaxWidth,c),d=d.replaceAll(" ","&nbsp;"),d+="<br/>"}let x=d!==void 0;if(x)u+=`<br/><br/><code style="text-align: left; display: block;max-width:${n.textMaxWidth}px">${d}</code>`;let g={fontSize:c.fontSize,fontWeight:c.fontWeight,fontFamily:c.fontFamily},f=Zr(u,g),v=x?f.width/3:f.width,h={content:u,width:v,height:f.height};return r.debug(`[${t.name}] ${t.entityIdentifier} text`,h),h}e(te,"calculateTextProps");function ne(t,i){let n=i,a=ee(n.frame),o={width:n.textProps.width+2*l.boxTextPadding,height:n.textProps.height+2*l.boxTextPadding};return[{$kind:V,frame:n.frame,index:n.index,visual:a,dimension:o,textProps:n.textProps}]}e(ne,"decidePositionFrame");function ie(t,i,n){if(i===void 0)return l.contentStartX;if(i.index===t.index&&t.r)return t.r+l.boxPadding;if(n===void 0)return l.contentStartX;return n.r-l.boxOverlap+l.boxPadding}e(ie,"calculateX");function re(t,i){let n=[...t.map((a)=>a.r),i];return Math.max(...n)}e(re,"calculateMaxRight");function H(t){return Object.values(t).sort((i,n)=>i.index-n.index)}e(H,"sortedSwimlanesArray");function ae(t,i){let n=i,a=Z(n.frame,t.swimlanes),o;if(a.index in t.swimlanes)o=t.swimlanes[a.index];else o={index:a.index,label:a.label,r:0,y:a.index*l.swimlaneMinHeight+l.swimlaneGap,height:l.swimlaneMinHeight,maxHeight:l.swimlaneMinHeight};let d=t.boxes.length>0?t.boxes[t.boxes.length-1]:void 0,c=t.previousSwimlaneNumber!==void 0?t.swimlanes[t.previousSwimlaneNumber]:void 0,m={width:Math.max(l.boxMinWidth,Math.min(l.boxMaxWidth,n.dimension.width))+2*l.boxPadding,height:Math.max(l.boxMinHeight,Math.min(l.boxMaxHeight,n.dimension.height))+2*l.boxPadding},u=ie(o,c,d),x=u+m.width+l.boxPadding,g=re(Object.values(t.swimlanes),x);o.r=u+m.width,o.maxHeight=Math.max(o.maxHeight,m.height),o.height=Math.max(l.swimlaneMinHeight,o.maxHeight)+2*l.swimlanePadding;let f={x:u,y:l.swimlanePadding+o.y,r:x,dimension:m,leftSibling:!1,swimlane:o,visual:n.visual,text:n.textProps.content,frame:n.frame,index:n.index},v={...t,boxes:[...t.boxes,f],swimlanes:{...t.swimlanes,[`${o.index}`]:o},previousSwimlaneNumber:a.index,previousFrame:n.frame,maxR:g},h=H(v.swimlanes);if(h.length>0)h[0].y=0;for(let w=1;w<h.length;w++){let k=h[w],_=h[w-1];k.y=_.y+_.height+l.swimlaneGap}return v}e(ae,"evolveFramePositioned");function oe(t,i){if(t===0&&i.sourceFrames.length===0)return!0;return!1}e(oe,"isFirstFrame");function se(t){return t.sourceFrames!==void 0&&t.sourceFrames!==null&&t.sourceFrames.length>0}e(se,"hasSourceFrame");function B(t,i){if(i===void 0||i===null)return;return t.find((n)=>n.frame.name===i.name)}e(B,"findBoxByFrame");function de(t,i,n){if(n<0)return;for(let a=n;a>=0;a--){let o=t[a];if(o.swimlane.index!==i)return o}return}e(de,"findBoxByLineIndex");function le(t,i){let n=i;if(oe(n.index,n.frame))return[];let a=B(t.boxes,n.frame);if(a===void 0)throw Error(`Target box not found for frame ${n.frame.name}`);let o;if(n.sourceFrame)o=B(t.boxes,n.sourceFrame);else{if($r(n.frame))return[];o=de(t.boxes,a.swimlane.index,n.index-1)}if(o===void 0)return[];return[{$kind:j,frame:n.frame,index:n.index,sourceBox:o,targetBox:a}]}e(le,"decidePositionRelation");function ce(t,i){let n=i,a={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{...t,relations:[...t.relations,a]}}e(ce,"evolveRelationPositioned");var Se={[G]:ne,[F]:le},Me={[V]:ae,[j]:ce};function me(t,i){let n=Se[i.$kind];if(n===void 0||n===null)return[];let a=n(t,i);return r.debug("decided events",a),a}e(me,"decide");function ue(t,i){let n=i.reduce((a,o)=>{let d=Me[o.$kind];if(d===void 0||d===null)return a;return d(a,o)},t);return r.debug("evolve events",{state:t,newState:n,events:i}),n}e(ue,"evolve");function P(t,i){let n=me(t,i);return ue(t,n)}e(P,"dispatch");var R={getConfig:ye,preserveCommentsWhenParsing:!0,setOptions:pe,getOptions:ve,clear:be,setAccTitle:S,getAccTitle:E,getAccDescription:A,setAccDescription:T,setDiagramTitle:I,getDiagramTitle:L,setAst:K,getDiagramProps:N,getState:z},ke={parse:e(async(t)=>{let i=await X("eventmodeling",t);r.debug(i),R.setAst(i),W(i,R)},"parse")},Fe=s(),Be=Fe?.eventmodeling;function xe(t,i){return(n)=>{let a=n.swimlane.y+i.swimlanePadding,o=t.append("g").attr("class","em-box");o.append("rect").attr("x",n.x).attr("y",a).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",a+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)}}e(xe,"renderD3Box");function fe(t,i){return t>i}e(fe,"dirUpwards");function ge(t,i,n,a){return(o)=>{let d=o.sourceBox.swimlane.y+i.swimlanePadding,c=o.targetBox.swimlane.y+i.swimlanePadding,m=fe(d,c),u=o.sourceBox.x+o.sourceBox.dimension.width*2/3,x=o.targetBox.x+o.targetBox.dimension.width/3,g,f;if(r.debug(`rendering relation up=${m} for `,{sourceBox:o.sourceBox,targetBox:o.targetBox}),m)g=d,f=c+o.targetBox.dimension.height;else g=d+o.sourceBox.dimension.height,f=c;let v=a.emRelationStroke??o.visual.stroke;t.append("path").attr("class","em-relation").attr("fill",o.visual.fill).attr("stroke",v).attr("stroke-width","1").attr("marker-end",`url(#${n})`).attr("d",`M${u} ${g} L${x} ${f}`)}}e(ge,"renderD3Relation");function he(t,i,n,a){return(o)=>{let d=t.append("g").attr("class","em-swimlane"),c=a.emSwimlaneBackgroundOdd??"rgb(250,250,250)",m=a.emSwimlaneBackgroundStroke??"rgb(240,240,240)";d.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),d.append("text").attr("font-weight",n.swimlaneTextFontWeight).attr("x",30).attr("y",o.y+30).text(o.label)}}e(he,"renderD3Swimlane");var Ee=e(function(t,i,n,a){if(r.debug("in eventmodeling renderer",t+`
3
3
  `,"id:",i,n),!Be)throw Error("EventModeling config not found");let o=a.db,{themeVariables:d,eventmodeling:c}=s(),m=p(`[id="${i}"]`),u=o.getDiagramProps(),x=o.getState(),g=`em-arrowhead-${i}`,f=d.emArrowhead??"#000000";x.sortedSwimlanesArray.forEach(he(m,x.maxR,u,d)),x.boxes.forEach(xe(m,u)),x.relations.forEach(ge(m,u,g,d)),m.append("defs").append("marker").attr("id",g).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",f),wr(void 0,m,c?.padding??30,c?.useMaxWidth)},"draw"),Ae={draw:Ee},$e=e((t)=>"","getStyles"),Re=$e,Ue={parser:ke,db:R,renderer:Ae,styles:Re};export{Ue as diagram};
@@ -1 +1 @@
1
- import{a,v,t,n,_,l,Z,ce,V,ot}from"./chunk-32ezm0ry.js";var P=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"9",x2:"15",y1:"15",y2:"9",key:"1dfufj"}]],g=l("circle-slash",P);function J(o){let{Button:h,Panel:N,style:y}=_(),e=o.payload,[i,r]=a(!1),[k,b]=a(!1),[c,p]=a();if(!e)return null;let s=k?"killed":e.state,m=s==="running",d=s==="exited"&&e.code===0,u=s==="killed"||s==="timeout",f=e.output?.trim(),C=async()=>{if(i)return;r(!0),p(void 0);try{await o.connection.request(`/api/sessions/${encodeURIComponent(o.sessionID)}/jobs/${encodeURIComponent(e.id)}/kill`,{method:"POST"}),b(!0)}catch(x){p(x instanceof Error?x.message:"停止失败,后台任务可能已结束")}finally{r(!1)}};return n(N,{className:"my-2",header:n(v,{children:[t(ot,{className:"size-3.5 shrink-0 text-faint"}),t("span",{className:"truncate font-mono text-ink/90",title:e.command??e.id,children:e.command??`任务 ${e.id}`})]}),actions:n(v,{children:[m&&n(v,{children:[n("span",{className:"flex items-center gap-1 text-warning",children:[t(ce,{className:"size-3.5 animate-spin"}),t("span",{children:"后台运行中"})]}),t(h,{size:"sm",variant:"danger-ghost",className:"h-6 rounded-md px-2 text-xs",disabled:i,onClick:()=>{C()},children:"停止"})]}),d&&n("span",{className:"flex items-center gap-1 text-success",children:[t(V,{className:"size-3.5"}),t("span",{children:"已完成"})]}),u&&n("span",{className:"flex items-center gap-1 text-faint",children:[t(g,{className:"size-3.5"}),t("span",{children:s==="timeout"?"已超时":"已停止"})]}),!m&&!d&&!u&&n("span",{className:"flex items-center gap-1 text-danger",children:[t(Z,{className:"size-3.5"}),n("span",{children:["退出码 ",e.code??"异常"]})]})]}),children:[c&&t("p",{role:"status",className:"border-b border-line px-4 py-2.5 text-xs text-danger",children:c}),f&&t("pre",{className:y("chat.toolOutput","max-h-60 text-ink/90 select-text"),children:f})]})}export{J as BashJobCard};
1
+ import{a,v,t,n,_,l,Z,ue,q,ot}from"./chunk-aqm3spxt.js";var P=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"9",x2:"15",y1:"15",y2:"9",key:"1dfufj"}]],g=l("circle-slash",P);function J(o){let{Button:h,Panel:N,style:y}=_(),e=o.payload,[i,r]=a(!1),[k,b]=a(!1),[c,p]=a();if(!e)return null;let s=k?"killed":e.state,m=s==="running",d=s==="exited"&&e.code===0,u=s==="killed"||s==="timeout",f=e.output?.trim(),C=async()=>{if(i)return;r(!0),p(void 0);try{await o.connection.request(`/api/sessions/${encodeURIComponent(o.sessionID)}/jobs/${encodeURIComponent(e.id)}/kill`,{method:"POST"}),b(!0)}catch(x){p(x instanceof Error?x.message:"停止失败,后台任务可能已结束")}finally{r(!1)}};return n(N,{className:"my-2",header:n(v,{children:[t(ot,{className:"size-3.5 shrink-0 text-faint"}),t("span",{className:"truncate font-mono text-ink/90",title:e.command??e.id,children:e.command??`任务 ${e.id}`})]}),actions:n(v,{children:[m&&n(v,{children:[n("span",{className:"flex items-center gap-1 text-warning",children:[t(ue,{className:"size-3.5 animate-spin"}),t("span",{children:"后台运行中"})]}),t(h,{size:"sm",variant:"danger-ghost",className:"h-6 rounded-md px-2 text-xs",disabled:i,onClick:()=>{C()},children:"停止"})]}),d&&n("span",{className:"flex items-center gap-1 text-success",children:[t(q,{className:"size-3.5"}),t("span",{children:"已完成"})]}),u&&n("span",{className:"flex items-center gap-1 text-faint",children:[t(g,{className:"size-3.5"}),t("span",{children:s==="timeout"?"已超时":"已停止"})]}),!m&&!d&&!u&&n("span",{className:"flex items-center gap-1 text-danger",children:[t(Z,{className:"size-3.5"}),n("span",{children:["退出码 ",e.code??"异常"]})]})]}),children:[c&&t("p",{role:"status",className:"border-b border-line px-4 py-2.5 text-xs text-danger",children:c}),f&&t("pre",{className:y("chat.toolOutput","max-h-60 text-ink/90 select-text"),children:f})]})}export{J as BashJobCard};
@@ -1,4 +1,4 @@
1
- import{W}from"./chunk-e5rmr47n.js";import{e,r,D,b,B,C,S,E,T,A,I,L,q,U}from"./chunk-jtwhjp20.js";import{X}from"./chunk-gxn0bey7.js";var M=D.packet,F=class{constructor(){this.packet=[],this.setAccTitle=S,this.getAccTitle=E,this.setDiagramTitle=I,this.getDiagramTitle=L,this.getAccDescription=A,this.setAccDescription=T}static{e(this,"PacketDB")}getConfig(){let t=U({...M,...b().packet});if(t.showBits)t.paddingY+=10;return t}getPacket(){return this.packet}pushWord(t){if(t.length>0)this.packet.push(t)}clear(){C(),this.packet=[]}},Y=1e4,O=e((t,a)=>{W(t,a);let i=-1,s=[],l=1,{bitsPerRow:d}=a.getConfig();for(let{start:o,end:n,bits:g,label:f}of t.blocks){if(o!==void 0&&n!==void 0&&n<o)throw Error(`Packet block ${o} - ${n} is invalid. End must be greater than start.`);if(o??=i+1,o!==i+1)throw Error(`Packet block ${o} - ${n??o} is not contiguous. It should start from ${i+1}.`);if(g===0)throw Error(`Packet block ${o} is invalid. Cannot have a zero bit field.`);n??=o+(g??1)-1,g??=n-o+1,i=n,r.debug(`Packet block ${o} - ${i} with label ${f}`);while(s.length<=d+1&&a.getPacket().length<Y){let[p,h]=j({start:o,end:n,bits:g,label:f},l,d);if(s.push(p),p.end+1===l*d)a.pushWord(s),s=[],l++;if(!h)break;({start:o,end:n,bits:g,label:f}=h)}}a.pushWord(s)},"populate"),j=e((t,a,i)=>{if(t.start===void 0)throw Error("start should have been set during first phase");if(t.end===void 0)throw Error("end should have been set during first phase");if(t.start>t.end)throw Error(`Block start ${t.start} is greater than block end ${t.end}.`);if(t.end+1<=a*i)return[t,void 0];let s=a*i-1,l=a*i;return[{start:t.start,end:s,label:t.label,bits:s-t.start},{start:l,end:t.end,label:t.label,bits:t.end-l}]},"getNextFittingBlock"),P={parser:{yy:void 0},parse:e(async(t)=>{let a=await X("packet",t),i=P.parser?.yy;if(!(i instanceof F))throw Error("parser.parser?.yy was not a PacketDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");r.debug(a),O(a,i)},"parse")},G=e((t,a,i,s)=>{let l=s.db,d=l.getConfig(),{rowHeight:o,paddingY:n,bitWidth:g,bitsPerRow:f}=d,p=l.getPacket(),h=l.getDiagramTitle(),w=o+n,c=w*(p.length+1)-(h?0:o),k=g*f+2,m=q(a);m.attr("viewBox",`0 0 ${k} ${c}`),B(m,c,k,d.useMaxWidth);for(let[y,u]of p.entries())H(m,u,y,d);m.append("text").text(h).attr("x",k/2).attr("y",c-w/2).attr("dominant-baseline","middle").attr("text-anchor","middle").attr("class","packetTitle")},"draw"),H=e((t,a,i,{rowHeight:s,paddingX:l,paddingY:d,bitWidth:o,bitsPerRow:n,showBits:g,bitOrder:f})=>{let p=t.append("g"),h=i*(s+d)+d,w=f==="descending";for(let c of a){let k=c.end-c.start+1,m=c.start%n,u=(w?n-m-k:m)*o+1,v=k*o-l;if(p.append("rect").attr("x",u).attr("y",h).attr("width",v).attr("height",s).attr("class","packetBlock"),p.append("text").attr("x",u+v/2).attr("y",h+s/2).attr("class","packetLabel").attr("dominant-baseline","middle").attr("text-anchor","middle").text(c.label),!g)continue;let[_,N]=w?[c.end,c.start]:[c.start,c.end],x=k===1,z=h-2;if(p.append("text").attr("x",u+(x?v/2:0)).attr("y",z).attr("class","packetByte start").attr("dominant-baseline","auto").attr("text-anchor",x?"middle":"start").text(_),!x)p.append("text").attr("x",u+v).attr("y",z).attr("class","packetByte end").attr("dominant-baseline","auto").attr("text-anchor","end").text(N)}},"drawWord"),K={draw:G},J={byteFontSize:"10px",startByteColor:"black",endByteColor:"black",labelColor:"black",labelFontSize:"12px",titleColor:"black",titleFontSize:"14px",blockStrokeColor:"black",blockStrokeWidth:"1",blockFillColor:"#efefef"},Q=e(({packet:t}={})=>{let a=U(J,t);return`
1
+ import{W}from"./chunk-vjqmnkh2.js";import{e,r,D,b,B,C,S,E,T,A,I,L,V,U}from"./chunk-9dd1c37b.js";import{X}from"./chunk-qryrg2pq.js";var M=D.packet,F=class{constructor(){this.packet=[],this.setAccTitle=S,this.getAccTitle=E,this.setDiagramTitle=I,this.getDiagramTitle=L,this.getAccDescription=A,this.setAccDescription=T}static{e(this,"PacketDB")}getConfig(){let t=U({...M,...b().packet});if(t.showBits)t.paddingY+=10;return t}getPacket(){return this.packet}pushWord(t){if(t.length>0)this.packet.push(t)}clear(){C(),this.packet=[]}},Y=1e4,O=e((t,a)=>{W(t,a);let i=-1,s=[],l=1,{bitsPerRow:d}=a.getConfig();for(let{start:o,end:n,bits:g,label:f}of t.blocks){if(o!==void 0&&n!==void 0&&n<o)throw Error(`Packet block ${o} - ${n} is invalid. End must be greater than start.`);if(o??=i+1,o!==i+1)throw Error(`Packet block ${o} - ${n??o} is not contiguous. It should start from ${i+1}.`);if(g===0)throw Error(`Packet block ${o} is invalid. Cannot have a zero bit field.`);n??=o+(g??1)-1,g??=n-o+1,i=n,r.debug(`Packet block ${o} - ${i} with label ${f}`);while(s.length<=d+1&&a.getPacket().length<Y){let[p,h]=j({start:o,end:n,bits:g,label:f},l,d);if(s.push(p),p.end+1===l*d)a.pushWord(s),s=[],l++;if(!h)break;({start:o,end:n,bits:g,label:f}=h)}}a.pushWord(s)},"populate"),j=e((t,a,i)=>{if(t.start===void 0)throw Error("start should have been set during first phase");if(t.end===void 0)throw Error("end should have been set during first phase");if(t.start>t.end)throw Error(`Block start ${t.start} is greater than block end ${t.end}.`);if(t.end+1<=a*i)return[t,void 0];let s=a*i-1,l=a*i;return[{start:t.start,end:s,label:t.label,bits:s-t.start},{start:l,end:t.end,label:t.label,bits:t.end-l}]},"getNextFittingBlock"),P={parser:{yy:void 0},parse:e(async(t)=>{let a=await X("packet",t),i=P.parser?.yy;if(!(i instanceof F))throw Error("parser.parser?.yy was not a PacketDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");r.debug(a),O(a,i)},"parse")},G=e((t,a,i,s)=>{let l=s.db,d=l.getConfig(),{rowHeight:o,paddingY:n,bitWidth:g,bitsPerRow:f}=d,p=l.getPacket(),h=l.getDiagramTitle(),w=o+n,c=w*(p.length+1)-(h?0:o),k=g*f+2,m=V(a);m.attr("viewBox",`0 0 ${k} ${c}`),B(m,c,k,d.useMaxWidth);for(let[y,u]of p.entries())H(m,u,y,d);m.append("text").text(h).attr("x",k/2).attr("y",c-w/2).attr("dominant-baseline","middle").attr("text-anchor","middle").attr("class","packetTitle")},"draw"),H=e((t,a,i,{rowHeight:s,paddingX:l,paddingY:d,bitWidth:o,bitsPerRow:n,showBits:g,bitOrder:f})=>{let p=t.append("g"),h=i*(s+d)+d,w=f==="descending";for(let c of a){let k=c.end-c.start+1,m=c.start%n,u=(w?n-m-k:m)*o+1,v=k*o-l;if(p.append("rect").attr("x",u).attr("y",h).attr("width",v).attr("height",s).attr("class","packetBlock"),p.append("text").attr("x",u+v/2).attr("y",h+s/2).attr("class","packetLabel").attr("dominant-baseline","middle").attr("text-anchor","middle").text(c.label),!g)continue;let[_,N]=w?[c.end,c.start]:[c.start,c.end],x=k===1,z=h-2;if(p.append("text").attr("x",u+(x?v/2:0)).attr("y",z).attr("class","packetByte start").attr("dominant-baseline","auto").attr("text-anchor",x?"middle":"start").text(_),!x)p.append("text").attr("x",u+v).attr("y",z).attr("class","packetByte end").attr("dominant-baseline","auto").attr("text-anchor","end").text(N)}},"drawWord"),K={draw:G},q={byteFontSize:"10px",startByteColor:"black",endByteColor:"black",labelColor:"black",labelFontSize:"12px",titleColor:"black",titleFontSize:"14px",blockStrokeColor:"black",blockStrokeWidth:"1",blockFillColor:"#efefef"},J=e(({packet:t}={})=>{let a=U(q,t);return`
2
2
  .packetByte {
3
3
  font-size: ${a.byteFontSize};
4
4
  }
@@ -21,4 +21,4 @@ import{W}from"./chunk-e5rmr47n.js";import{e,r,D,b,B,C,S,E,T,A,I,L,q,U}from"./chu
21
21
  stroke-width: ${a.blockStrokeWidth};
22
22
  fill: ${a.blockFillColor};
23
23
  }
24
- `},"styles"),ot={parser:P,get db(){return new F},renderer:K,styles:Q};export{ot as diagram};
24
+ `},"styles"),ot={parser:P,get db(){return new F},renderer:K,styles:J};export{ot as diagram};
@@ -1 +1 @@
1
- import{h,o,ee,i,a,v,t,n,_,zt,er,ze,Nn,Ue,dn,Re,re}from"./chunk-32ezm0ry.js";var M=[{label:"每天 9:00",cron:"0 9 * * *"},{label:"每个工作日 9:00",cron:"0 9 * * 1-5"},{label:"每周一 9:00",cron:"0 9 * * 1"},{label:"每小时",cron:"0 * * * *"},{label:"每天 18:00",cron:"0 18 * * *"},{label:"每月 1 号 9:00",cron:"0 9 1 * *"}],ae=["日","一","二","三","四","五","六","日"],ie=(r)=>r.padStart(2,"0");function Q(r){let p=M.find((I)=>I.cron===r.trim());if(p)return p.label;let N=r.trim().split(/\s+/);if(N.length!==5)return r;let[u="",y="",b="",D="",c=""]=N,C=(I)=>/^\d+$/.test(I);if(D!=="*")return r;if(C(u)&&y==="*"&&b==="*"&&c==="*")return`每小时第 ${u} 分`;let P=u.match(/^\*\/(\d+)$/);if(P&&y==="*"&&b==="*"&&c==="*")return`每 ${P[1]} 分钟`;if(!C(u)||!C(y))return r;let m=`${y}:${ie(u)}`;if(b==="*"&&c==="*")return`每天 ${m}`;if(b==="*"&&c==="1-5")return`每个工作日 ${m}`;if(b==="*"&&/^[0-7](,[0-7])*$/.test(c))return`每周${c.split(",").map((I)=>ae[Number(I)]).join("、")} ${m}`;if(C(b)&&c==="*")return`每月 ${b} 号 ${m}`;return r}function X(r){let p=Date.now()-r,N=Math.floor(Math.abs(p)/1000);if(N<60)return"刚刚";let u=Math.floor(N/60);if(u<60)return`${u} 分钟${p>0?"前":"后"}`;let y=Math.floor(u/60);if(y<24)return`${y} 小时${p>0?"前":"后"}`;return`${Math.floor(y/24)} 天${p>0?"前":"后"}`}function ge(r){let{Button:p,confirm:N,PageLayout:u,Switch:y,cn:b,style:D}=_(),{connection:c,onOpen:C}=r,[P,m]=a([]),[I,J]=a([]),[T,U]=a([]),[j,R]=a(),[B,V]=a([]),[F,W]=a(!0),[O,w]=a(),[z,L]=a(),[K,A]=a(!1),[Y,f]=a({}),s=i(0),q=h(async()=>{let e=++s.current;try{let[l,d,g,x]=await Promise.all([c.request("/api/automations"),c.request("/api/projects").catch(()=>[]),c.request("/api/info").catch(()=>{return}),c.request("/api/models").catch(()=>({models:[]}))]),oe=[...new Set(l.flatMap((S)=>S.lastSessionID?[S.lastSessionID]:[]))],se=(await Promise.all(oe.map(async(S)=>c.request(`/api/sessions/${encodeURIComponent(S)}`).catch((k)=>{if(k instanceof Error&&"status"in k&&k.status===404)return;throw k})))).filter((S)=>S!==void 0);if(e!==s.current)return;if(m(l.sort((S,k)=>S.created-k.created)),J(d),U(se),R(g),x?.models)V(x.models.map((S)=>S.id));w(void 0)}catch(l){if(e===s.current)w(l instanceof Error?l.message:"加载失败")}finally{if(e===s.current)W(!1)}},[c]);o(()=>(q(),()=>{s.current++}),[q]);let E=(e)=>{L(e),A(!0)},Z=async(e)=>{f((l)=>({...l,[e.id]:!0}));try{let l=await c.request(`/api/automations/${e.id}/run`,{method:"POST"});C(l.id)}catch(l){w(l instanceof Error?l.message:"运行失败")}finally{f((l)=>({...l,[e.id]:!1}))}},te=async(e)=>{if(!await N({title:`删除自动化「${e.name}」?`,description:"已经跑出来的会话会保留。",action:"删除",danger:!0}))return;try{await c.request(`/api/automations/${e.id}`,{method:"DELETE"}),m((d)=>d.filter((g)=>g.id!==e.id))}catch(d){w(d instanceof Error?d.message:"删除失败")}},ne=async(e,l)=>{try{let d=await c.request(`/api/automations/${e.id}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({enabled:l})});m((g)=>g.map((x)=>x.id===e.id?d:x))}catch(d){w(d instanceof Error?d.message:"状态切换失败")}};return n(u,{title:"自动化",description:n(v,{children:["到点自动开一个新会话执行提示词,跑完的结果在会话里查看。",j?.timezone&&n("span",{className:"text-faint",children:["按服务器时区 ",j.timezone,"。"]})]}),actions:n(p,{variant:"primary",onClick:()=>E(null),children:[t(Re,{className:"size-4"}),"新建"]}),children:[O&&t("div",{className:"mb-4 rounded-lg bg-danger/10 px-3 py-2 text-xs text-danger",children:O}),F?t("div",{className:"flex justify-center py-12 text-xs text-faint",children:"正在加载自动化…"}):P.length===0?n("div",{className:D("surface.emptyDashed","animate-fade"),children:[t("div",{className:"grid size-11 place-items-center rounded-xl bg-raised text-dim",children:t(zt,{className:"size-5"})}),n("div",{children:[t("p",{className:"text-[15px] font-medium",children:"还没有自动化"}),t("p",{className:"mt-1 text-sm text-dim",children:"比如「每个工作日 9 点总结昨天的提交」。"})]}),n(p,{size:"sm",onClick:()=>E(null),className:"mt-1",children:[t(Re,{className:"size-3.5"}),"新建自动化"]})]}):t("ul",{className:"flex animate-fade flex-col gap-3",children:P.map((e)=>{let l=e.projectID?I.find((x)=>x.id===e.projectID):void 0,d=e.lastSessionID?T.find((x)=>x.id===e.lastSessionID):void 0,g=Boolean(Y[e.id]);return t("li",{children:n("article",{className:D("surface.card","group p-4 transition-[border-color,box-shadow] duration-200 hover:border-line-strong hover:shadow-composer"),children:[n("div",{className:"flex items-start gap-3",children:[n("div",{className:b("min-w-0 flex-1 transition-opacity duration-200",!e.enabled&&"opacity-55"),children:[t("h2",{className:"truncate text-[15px] font-medium",children:e.name}),n("div",{className:"mt-1 flex flex-wrap items-center gap-x-3.5 gap-y-1 text-[13px] text-dim",children:[n("span",{className:"flex items-center gap-1.5 [&_svg]:size-3.5 [&_svg]:text-faint",children:[t(zt,{}),Q(e.schedule)]}),n("span",{className:"flex items-center gap-1.5 [&_svg]:size-3.5 [&_svg]:text-faint",children:[l?t(ze,{}):t(Nn,{}),l?l.name:"聊天"]}),e.enabled&&e.nextRun!==null&&n("span",{className:"flex items-center gap-1.5 [&_svg]:size-3.5 [&_svg]:text-faint",children:[t(er,{}),"下次 ",X(e.nextRun)]})]})]}),t(y,{checked:e.enabled,label:e.enabled?"停用":"启用",onCheckedChange:(x)=>ne(e,x),className:"mt-0.5"})]}),t("p",{className:b("mt-3 line-clamp-2 text-sm leading-6 whitespace-pre-wrap text-faint transition-opacity duration-200",!e.enabled&&"opacity-55"),children:e.prompt}),n("div",{className:"mt-3 -mb-1 flex items-center gap-1",children:[n(p,{size:"sm",onClick:()=>Z(e),disabled:g,children:[t(dn,{className:"size-3.5"}),g?"正在启动…":"立即运行"]}),n(p,{size:"sm",variant:"ghost",onClick:()=>E(e),children:[t(Ue,{className:"size-3.5"}),"编辑"]}),n(p,{size:"sm",variant:"danger-ghost",onClick:()=>te(e),children:[t(re,{className:"size-3.5"}),"删除"]}),t("div",{className:"flex-1"}),e.lastRun!==null&&n("button",{type:"button",disabled:!d,onClick:()=>d&&C(d.id),className:"rounded-md px-1.5 py-1 text-[13px] text-faint transition-colors enabled:hover:bg-raised enabled:hover:text-ink",children:["上次运行 ",X(e.lastRun),d?.archivedAt!=null?" · 已归档":"",!d?" · 会话已删除":""]})]})]})},e.id)})}),z!==void 0&&t(le,{open:K,onOpenChange:A,automation:z??void 0,projects:I,models:B,timezone:j?.timezone,onSaved:(e)=>{m((l)=>{let d=l.findIndex((g)=>g.id===e.id);if(d>=0){let g=[...l];return g[d]=e,g}return[...l,e].sort((g,x)=>g.created-x.created)}),A(!1)},connection:c},z?.id??"new")]})}var H="custom",G="chat";function le(r){let{Button:p,Dialog:N,Field:u,Form:y,FormError:b,Input:D,Select:c,Textarea:C}=_(),P=ee(),m=r.automation,[I,J]=a(m?.name??""),[T,U]=a(m?.prompt??""),[j,R]=a(m?.schedule??M[0]?.cron??"0 9 * * *"),[B,V]=a(()=>!M.some((f)=>f.cron===j)),[F,W]=a(m?.projectID??G),[O,w]=a(m?.model??""),[z,L]=a(!1),[K,A]=a();async function Y(f){f.preventDefault(),L(!0),A(void 0);try{let s=F===G?void 0:F,q={name:I,prompt:T,schedule:j,model:O||void 0},E;if(m)E=await r.connection.request(`/api/automations/${m.id}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({...q,projectID:s??null})});else E=await r.connection.request("/api/automations",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...q,projectID:s})});r.onSaved(E)}catch(s){A(s instanceof Error?s.message:"保存失败")}finally{L(!1)}}return t(N,{open:r.open,onOpenChange:r.onOpenChange,title:r.automation?"编辑自动化":"新建自动化",size:"lg",footer:n(v,{children:[t("div",{className:"flex-1 max-sm:hidden"}),t(p,{onClick:()=>r.onOpenChange(!1),children:"取消"}),t(p,{type:"submit",form:P,variant:"primary",disabled:z,children:z?"正在保存…":r.automation?"保存":"创建"})]}),children:n(y,{id:P,onSubmit:Y,children:[t(u,{label:"名称",children:(f)=>t(D,{id:f,autoFocus:!m,required:!0,value:I,onChange:(s)=>J(s.target.value),placeholder:"例如:每日提交总结"})}),t(u,{label:"提示词",hint:"没人盯着运行,写清楚要做什么、结果怎么汇报。",children:(f)=>t(C,{id:f,required:!0,value:T,onChange:(s)=>U(s.target.value),rows:5,placeholder:"总结昨天到现在的 git 提交,按模块分组,列出需要我关注的改动。"})}),n("div",{className:"grid gap-x-3 gap-y-4 sm:grid-cols-2",children:[t(u,{label:"时间",children:(f)=>t(c,{id:f,value:B?H:j,onValueChange:(s)=>{if(V(s===H),s!==H)R(s)},groups:[{options:M.map((s)=>({value:s.cron,label:s.label}))},{options:[{value:H,label:"自定义(cron)"}]}]})}),t(u,{label:"在哪里运行",children:(f)=>t(c,{id:f,value:F,onValueChange:W,groups:[{options:[{value:G,label:"聊天",description:"不绑定目录",icon:t(Nn,{})}]},...r.projects.length?[{label:"项目",options:r.projects.map((s)=>({value:s.id,label:s.name,icon:t(ze,{})}))}]:[]]})})]}),B&&t(u,{label:"cron 表达式",hint:`分 时 日 月 周,例如 30 8 * * 1-5 是工作日 8:30。${r.timezone?`按 ${r.timezone} 时间。`:""}`,children:(f)=>t(D,{id:f,required:!0,value:j,onChange:(s)=>R(s.target.value),spellCheck:!1,className:"font-mono"})}),r.models.length>0&&t(u,{label:"模型",children:(f)=>t(c,{id:f,value:O||"default",onValueChange:(s)=>w(s==="default"?"":s),groups:[{options:[{value:"default",label:"默认模型"},...r.models.map((s)=>({value:s,label:s}))]}]})}),t(b,{children:K})]})})}export{ge as AutomationsPage};
1
+ import{h,o,ee,i,a,v,t,n,_,Ut,er,ze,Nn,Ue,dn,Re,re}from"./chunk-aqm3spxt.js";var M=[{label:"每天 9:00",cron:"0 9 * * *"},{label:"每个工作日 9:00",cron:"0 9 * * 1-5"},{label:"每周一 9:00",cron:"0 9 * * 1"},{label:"每小时",cron:"0 * * * *"},{label:"每天 18:00",cron:"0 18 * * *"},{label:"每月 1 号 9:00",cron:"0 9 1 * *"}],ae=["日","一","二","三","四","五","六","日"],ie=(r)=>r.padStart(2,"0");function Q(r){let p=M.find((I)=>I.cron===r.trim());if(p)return p.label;let N=r.trim().split(/\s+/);if(N.length!==5)return r;let[u="",y="",b="",D="",c=""]=N,C=(I)=>/^\d+$/.test(I);if(D!=="*")return r;if(C(u)&&y==="*"&&b==="*"&&c==="*")return`每小时第 ${u} 分`;let P=u.match(/^\*\/(\d+)$/);if(P&&y==="*"&&b==="*"&&c==="*")return`每 ${P[1]} 分钟`;if(!C(u)||!C(y))return r;let m=`${y}:${ie(u)}`;if(b==="*"&&c==="*")return`每天 ${m}`;if(b==="*"&&c==="1-5")return`每个工作日 ${m}`;if(b==="*"&&/^[0-7](,[0-7])*$/.test(c))return`每周${c.split(",").map((I)=>ae[Number(I)]).join("、")} ${m}`;if(C(b)&&c==="*")return`每月 ${b} 号 ${m}`;return r}function X(r){let p=Date.now()-r,N=Math.floor(Math.abs(p)/1000);if(N<60)return"刚刚";let u=Math.floor(N/60);if(u<60)return`${u} 分钟${p>0?"前":"后"}`;let y=Math.floor(u/60);if(y<24)return`${y} 小时${p>0?"前":"后"}`;return`${Math.floor(y/24)} 天${p>0?"前":"后"}`}function ge(r){let{Button:p,confirm:N,PageLayout:u,Switch:y,cn:b,style:D}=_(),{connection:c,onOpen:C}=r,[P,m]=a([]),[I,J]=a([]),[T,U]=a([]),[j,R]=a(),[B,V]=a([]),[F,W]=a(!0),[O,w]=a(),[z,L]=a(),[K,A]=a(!1),[Y,f]=a({}),s=i(0),q=h(async()=>{let e=++s.current;try{let[l,d,g,x]=await Promise.all([c.request("/api/automations"),c.request("/api/projects").catch(()=>[]),c.request("/api/info").catch(()=>{return}),c.request("/api/models").catch(()=>({models:[]}))]),oe=[...new Set(l.flatMap((S)=>S.lastSessionID?[S.lastSessionID]:[]))],se=(await Promise.all(oe.map(async(S)=>c.request(`/api/sessions/${encodeURIComponent(S)}`).catch((k)=>{if(k instanceof Error&&"status"in k&&k.status===404)return;throw k})))).filter((S)=>S!==void 0);if(e!==s.current)return;if(m(l.sort((S,k)=>S.created-k.created)),J(d),U(se),R(g),x?.models)V(x.models.map((S)=>S.id));w(void 0)}catch(l){if(e===s.current)w(l instanceof Error?l.message:"加载失败")}finally{if(e===s.current)W(!1)}},[c]);o(()=>(q(),()=>{s.current++}),[q]);let E=(e)=>{L(e),A(!0)},Z=async(e)=>{f((l)=>({...l,[e.id]:!0}));try{let l=await c.request(`/api/automations/${e.id}/run`,{method:"POST"});C(l.id)}catch(l){w(l instanceof Error?l.message:"运行失败")}finally{f((l)=>({...l,[e.id]:!1}))}},te=async(e)=>{if(!await N({title:`删除自动化「${e.name}」?`,description:"已经跑出来的会话会保留。",action:"删除",danger:!0}))return;try{await c.request(`/api/automations/${e.id}`,{method:"DELETE"}),m((d)=>d.filter((g)=>g.id!==e.id))}catch(d){w(d instanceof Error?d.message:"删除失败")}},ne=async(e,l)=>{try{let d=await c.request(`/api/automations/${e.id}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({enabled:l})});m((g)=>g.map((x)=>x.id===e.id?d:x))}catch(d){w(d instanceof Error?d.message:"状态切换失败")}};return n(u,{title:"自动化",description:n(v,{children:["到点自动开一个新会话执行提示词,跑完的结果在会话里查看。",j?.timezone&&n("span",{className:"text-faint",children:["按服务器时区 ",j.timezone,"。"]})]}),actions:n(p,{variant:"primary",onClick:()=>E(null),children:[t(Re,{className:"size-4"}),"新建"]}),children:[O&&t("div",{className:"mb-4 rounded-lg bg-danger/10 px-3 py-2 text-xs text-danger",children:O}),F?t("div",{className:"flex justify-center py-12 text-xs text-faint",children:"正在加载自动化…"}):P.length===0?n("div",{className:D("surface.emptyDashed","animate-fade"),children:[t("div",{className:"grid size-11 place-items-center rounded-xl bg-raised text-dim",children:t(Ut,{className:"size-5"})}),n("div",{children:[t("p",{className:"text-[15px] font-medium",children:"还没有自动化"}),t("p",{className:"mt-1 text-sm text-dim",children:"比如「每个工作日 9 点总结昨天的提交」。"})]}),n(p,{size:"sm",onClick:()=>E(null),className:"mt-1",children:[t(Re,{className:"size-3.5"}),"新建自动化"]})]}):t("ul",{className:"flex animate-fade flex-col gap-3",children:P.map((e)=>{let l=e.projectID?I.find((x)=>x.id===e.projectID):void 0,d=e.lastSessionID?T.find((x)=>x.id===e.lastSessionID):void 0,g=Boolean(Y[e.id]);return t("li",{children:n("article",{className:D("surface.card","group p-4 transition-[border-color,box-shadow] duration-200 hover:border-line-strong hover:shadow-composer"),children:[n("div",{className:"flex items-start gap-3",children:[n("div",{className:b("min-w-0 flex-1 transition-opacity duration-200",!e.enabled&&"opacity-55"),children:[t("h2",{className:"truncate text-[15px] font-medium",children:e.name}),n("div",{className:"mt-1 flex flex-wrap items-center gap-x-3.5 gap-y-1 text-[13px] text-dim",children:[n("span",{className:"flex items-center gap-1.5 [&_svg]:size-3.5 [&_svg]:text-faint",children:[t(Ut,{}),Q(e.schedule)]}),n("span",{className:"flex items-center gap-1.5 [&_svg]:size-3.5 [&_svg]:text-faint",children:[l?t(ze,{}):t(Nn,{}),l?l.name:"聊天"]}),e.enabled&&e.nextRun!==null&&n("span",{className:"flex items-center gap-1.5 [&_svg]:size-3.5 [&_svg]:text-faint",children:[t(er,{}),"下次 ",X(e.nextRun)]})]})]}),t(y,{checked:e.enabled,label:e.enabled?"停用":"启用",onCheckedChange:(x)=>ne(e,x),className:"mt-0.5"})]}),t("p",{className:b("mt-3 line-clamp-2 text-sm leading-6 whitespace-pre-wrap text-faint transition-opacity duration-200",!e.enabled&&"opacity-55"),children:e.prompt}),n("div",{className:"mt-3 -mb-1 flex items-center gap-1",children:[n(p,{size:"sm",onClick:()=>Z(e),disabled:g,children:[t(dn,{className:"size-3.5"}),g?"正在启动…":"立即运行"]}),n(p,{size:"sm",variant:"ghost",onClick:()=>E(e),children:[t(Ue,{className:"size-3.5"}),"编辑"]}),n(p,{size:"sm",variant:"danger-ghost",onClick:()=>te(e),children:[t(re,{className:"size-3.5"}),"删除"]}),t("div",{className:"flex-1"}),e.lastRun!==null&&n("button",{type:"button",disabled:!d,onClick:()=>d&&C(d.id),className:"rounded-md px-1.5 py-1 text-[13px] text-faint transition-colors enabled:hover:bg-raised enabled:hover:text-ink",children:["上次运行 ",X(e.lastRun),d?.archivedAt!=null?" · 已归档":"",!d?" · 会话已删除":""]})]})]})},e.id)})}),z!==void 0&&t(le,{open:K,onOpenChange:A,automation:z??void 0,projects:I,models:B,timezone:j?.timezone,onSaved:(e)=>{m((l)=>{let d=l.findIndex((g)=>g.id===e.id);if(d>=0){let g=[...l];return g[d]=e,g}return[...l,e].sort((g,x)=>g.created-x.created)}),A(!1)},connection:c},z?.id??"new")]})}var H="custom",G="chat";function le(r){let{Button:p,Dialog:N,Field:u,Form:y,FormError:b,Input:D,Select:c,Textarea:C}=_(),P=ee(),m=r.automation,[I,J]=a(m?.name??""),[T,U]=a(m?.prompt??""),[j,R]=a(m?.schedule??M[0]?.cron??"0 9 * * *"),[B,V]=a(()=>!M.some((f)=>f.cron===j)),[F,W]=a(m?.projectID??G),[O,w]=a(m?.model??""),[z,L]=a(!1),[K,A]=a();async function Y(f){f.preventDefault(),L(!0),A(void 0);try{let s=F===G?void 0:F,q={name:I,prompt:T,schedule:j,model:O||void 0},E;if(m)E=await r.connection.request(`/api/automations/${m.id}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({...q,projectID:s??null})});else E=await r.connection.request("/api/automations",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...q,projectID:s})});r.onSaved(E)}catch(s){A(s instanceof Error?s.message:"保存失败")}finally{L(!1)}}return t(N,{open:r.open,onOpenChange:r.onOpenChange,title:r.automation?"编辑自动化":"新建自动化",size:"lg",footer:n(v,{children:[t("div",{className:"flex-1 max-sm:hidden"}),t(p,{onClick:()=>r.onOpenChange(!1),children:"取消"}),t(p,{type:"submit",form:P,variant:"primary",disabled:z,children:z?"正在保存…":r.automation?"保存":"创建"})]}),children:n(y,{id:P,onSubmit:Y,children:[t(u,{label:"名称",children:(f)=>t(D,{id:f,autoFocus:!m,required:!0,value:I,onChange:(s)=>J(s.target.value),placeholder:"例如:每日提交总结"})}),t(u,{label:"提示词",hint:"没人盯着运行,写清楚要做什么、结果怎么汇报。",children:(f)=>t(C,{id:f,required:!0,value:T,onChange:(s)=>U(s.target.value),rows:5,placeholder:"总结昨天到现在的 git 提交,按模块分组,列出需要我关注的改动。"})}),n("div",{className:"grid gap-x-3 gap-y-4 sm:grid-cols-2",children:[t(u,{label:"时间",children:(f)=>t(c,{id:f,value:B?H:j,onValueChange:(s)=>{if(V(s===H),s!==H)R(s)},groups:[{options:M.map((s)=>({value:s.cron,label:s.label}))},{options:[{value:H,label:"自定义(cron)"}]}]})}),t(u,{label:"在哪里运行",children:(f)=>t(c,{id:f,value:F,onValueChange:W,groups:[{options:[{value:G,label:"聊天",description:"不绑定目录",icon:t(Nn,{})}]},...r.projects.length?[{label:"项目",options:r.projects.map((s)=>({value:s.id,label:s.name,icon:t(ze,{})}))}]:[]]})})]}),B&&t(u,{label:"cron 表达式",hint:`分 时 日 月 周,例如 30 8 * * 1-5 是工作日 8:30。${r.timezone?`按 ${r.timezone} 时间。`:""}`,children:(f)=>t(D,{id:f,required:!0,value:j,onChange:(s)=>R(s.target.value),spellCheck:!1,className:"font-mono"})}),r.models.length>0&&t(u,{label:"模型",children:(f)=>t(c,{id:f,value:O||"default",onValueChange:(s)=>w(s==="default"?"":s),groups:[{options:[{value:"default",label:"默认模型"},...r.models.map((s)=>({value:s,label:s}))]}]})}),t(b,{children:K})]})})}export{ge as AutomationsPage};
@@ -1,2 +1,2 @@
1
- import{J,Oi,Ve,Ln,co,La,Bt,zn,Be,Tr,Vr,Un,uo,$i,jn}from"./chunk-jtwhjp20.js";function k(l){return l.innerRadius}function b(l){return l.outerRadius}function _(l){return l.startAngle}function nn(l){return l.endAngle}function en(l){return l&&l.padAngle}function rn(l,d,q,P,x,h,S,r){var D=q-l,a=P-d,n=S-x,y=r-h,u=y*D-n*a;if(u*u<Be)return;return u=(n*(d-h)-y*(l-x))/u,[l+u*D,d+u*a]}function M(l,d,q,P,x,h,S){var r=l-q,D=d-P,a=(S?h:-h)/zn(r*r+D*D),n=a*D,y=-a*r,u=l+n,s=d+y,t=q+n,f=P+y,j=(u+t)/2,o=(s+f)/2,g=t-u,c=f-s,v=g*g+c*c,A=x-h,R=u*f-t*s,E=(c<0?-1:1)*zn(co(0,A*A*v-R*R)),I=(R*c-g*E)/v,O=(-R*g-c*E)/v,T=(R*c+g*E)/v,m=(-R*g+c*E)/v,p=I-j,e=O-o,i=T-j,z=m-o;if(p*p+e*e>i*i+z*z)I=T,O=m;return{cx:I,cy:O,x01:-n,y01:-y,x11:I*(x/A-1),y11:O*(x/A-1)}}function bt(){var l=k,d=b,q=J(0),P=null,x=_,h=nn,S=en,r=null,D=jn(a);function a(){var n,y,u=+l.apply(this,arguments),s=+d.apply(this,arguments),t=x.apply(this,arguments)-Vr,f=h.apply(this,arguments)-Vr,j=Oi(f-t),o=f>t;if(!r)r=n=D();if(s<u)y=s,s=u,u=y;if(!(s>Be))r.moveTo(0,0);else if(j>Un-Be){if(r.moveTo(s*Ln(t),s*Bt(t)),r.arc(0,0,s,t,f,!o),u>Be)r.moveTo(u*Ln(f),u*Bt(f)),r.arc(0,0,u,f,t,o)}else{var g=t,c=f,v=t,A=f,R=j,E=j,I=S.apply(this,arguments)/2,O=I>Be&&(P?+P.apply(this,arguments):zn(u*u+s*s)),T=La(Oi(s-u)/2,+q.apply(this,arguments)),m=T,p=T,e,i;if(O>Be){var z=$i(O/u*Bt(I)),F=$i(O/s*Bt(I));if((R-=z*2)>Be)z*=o?1:-1,v+=z,A-=z;else R=0,v=A=(t+f)/2;if((E-=F*2)>Be)F*=o?1:-1,g+=F,c-=F;else E=0,g=c=(t+f)/2}var B=s*Ln(g),C=s*Bt(g),G=u*Ln(A),H=u*Bt(A);if(T>Be){var K=s*Ln(c),L=s*Bt(c),N=u*Ln(v),Q=u*Bt(v),w;if(j<Tr)if(w=rn(B,C,N,Q,K,L,G,H)){var U=B-w[0],V=C-w[1],W=K-w[0],X=L-w[1],Y=1/Bt(uo((U*W+V*X)/(zn(U*U+V*V)*zn(W*W+X*X)))/2),Z=zn(w[0]*w[0]+w[1]*w[1]);m=La(T,(u-Z)/(Y-1)),p=La(T,(s-Z)/(Y+1))}else m=p=0}if(!(E>Be))r.moveTo(B,C);else if(p>Be)if(e=M(N,Q,B,C,s,p,o),i=M(K,L,G,H,s,p,o),r.moveTo(e.cx+e.x01,e.cy+e.y01),p<T)r.arc(e.cx,e.cy,p,Ve(e.y01,e.x01),Ve(i.y01,i.x01),!o);else r.arc(e.cx,e.cy,p,Ve(e.y01,e.x01),Ve(e.y11,e.x11),!o),r.arc(0,0,s,Ve(e.cy+e.y11,e.cx+e.x11),Ve(i.cy+i.y11,i.cx+i.x11),!o),r.arc(i.cx,i.cy,p,Ve(i.y11,i.x11),Ve(i.y01,i.x01),!o);else r.moveTo(B,C),r.arc(0,0,s,g,c,!o);if(!(u>Be)||!(R>Be))r.lineTo(G,H);else if(m>Be)if(e=M(G,H,K,L,u,-m,o),i=M(B,C,N,Q,u,-m,o),r.lineTo(e.cx+e.x01,e.cy+e.y01),m<T)r.arc(e.cx,e.cy,m,Ve(e.y01,e.x01),Ve(i.y01,i.x01),!o);else r.arc(e.cx,e.cy,m,Ve(e.y01,e.x01),Ve(e.y11,e.x11),!o),r.arc(0,0,u,Ve(e.cy+e.y11,e.cx+e.x11),Ve(i.cy+i.y11,i.cx+i.x11),o),r.arc(i.cx,i.cy,m,Ve(i.y11,i.x11),Ve(i.y01,i.x01),!o);else r.arc(0,0,u,A,v,o)}if(r.closePath(),n)return r=null,n+""||null}return a.centroid=function(){var n=(+l.apply(this,arguments)+ +d.apply(this,arguments))/2,y=(+x.apply(this,arguments)+ +h.apply(this,arguments))/2-Tr/2;return[Ln(y)*n,Bt(y)*n]},a.innerRadius=function(n){return arguments.length?(l=typeof n==="function"?n:J(+n),a):l},a.outerRadius=function(n){return arguments.length?(d=typeof n==="function"?n:J(+n),a):d},a.cornerRadius=function(n){return arguments.length?(q=typeof n==="function"?n:J(+n),a):q},a.padRadius=function(n){return arguments.length?(P=n==null?null:typeof n==="function"?n:J(+n),a):P},a.startAngle=function(n){return arguments.length?(x=typeof n==="function"?n:J(+n),a):x},a.endAngle=function(n){return arguments.length?(h=typeof n==="function"?n:J(+n),a):h},a.padAngle=function(n){return arguments.length?(S=typeof n==="function"?n:J(+n),a):S},a.context=function(n){return arguments.length?(r=n==null?null:n,a):r},a}
1
+ import{J,Oi,Ve,Ln,co,La,Ft,zn,Be,Tr,Vr,Un,uo,$i,jn}from"./chunk-9dd1c37b.js";function k(l){return l.innerRadius}function b(l){return l.outerRadius}function _(l){return l.startAngle}function nn(l){return l.endAngle}function en(l){return l&&l.padAngle}function rn(l,d,q,P,x,h,S,r){var D=q-l,a=P-d,n=S-x,y=r-h,u=y*D-n*a;if(u*u<Be)return;return u=(n*(d-h)-y*(l-x))/u,[l+u*D,d+u*a]}function M(l,d,q,P,x,h,S){var r=l-q,D=d-P,a=(S?h:-h)/zn(r*r+D*D),n=a*D,y=-a*r,u=l+n,s=d+y,t=q+n,f=P+y,j=(u+t)/2,o=(s+f)/2,g=t-u,c=f-s,v=g*g+c*c,A=x-h,R=u*f-t*s,E=(c<0?-1:1)*zn(co(0,A*A*v-R*R)),I=(R*c-g*E)/v,O=(-R*g-c*E)/v,T=(R*c+g*E)/v,m=(-R*g+c*E)/v,p=I-j,e=O-o,i=T-j,z=m-o;if(p*p+e*e>i*i+z*z)I=T,O=m;return{cx:I,cy:O,x01:-n,y01:-y,x11:I*(x/A-1),y11:O*(x/A-1)}}function bt(){var l=k,d=b,q=J(0),P=null,x=_,h=nn,S=en,r=null,D=jn(a);function a(){var n,y,u=+l.apply(this,arguments),s=+d.apply(this,arguments),t=x.apply(this,arguments)-Vr,f=h.apply(this,arguments)-Vr,j=Oi(f-t),o=f>t;if(!r)r=n=D();if(s<u)y=s,s=u,u=y;if(!(s>Be))r.moveTo(0,0);else if(j>Un-Be){if(r.moveTo(s*Ln(t),s*Ft(t)),r.arc(0,0,s,t,f,!o),u>Be)r.moveTo(u*Ln(f),u*Ft(f)),r.arc(0,0,u,f,t,o)}else{var g=t,c=f,v=t,A=f,R=j,E=j,I=S.apply(this,arguments)/2,O=I>Be&&(P?+P.apply(this,arguments):zn(u*u+s*s)),T=La(Oi(s-u)/2,+q.apply(this,arguments)),m=T,p=T,e,i;if(O>Be){var z=$i(O/u*Ft(I)),F=$i(O/s*Ft(I));if((R-=z*2)>Be)z*=o?1:-1,v+=z,A-=z;else R=0,v=A=(t+f)/2;if((E-=F*2)>Be)F*=o?1:-1,g+=F,c-=F;else E=0,g=c=(t+f)/2}var B=s*Ln(g),C=s*Ft(g),G=u*Ln(A),H=u*Ft(A);if(T>Be){var K=s*Ln(c),L=s*Ft(c),N=u*Ln(v),Q=u*Ft(v),w;if(j<Tr)if(w=rn(B,C,N,Q,K,L,G,H)){var U=B-w[0],V=C-w[1],W=K-w[0],X=L-w[1],Y=1/Ft(uo((U*W+V*X)/(zn(U*U+V*V)*zn(W*W+X*X)))/2),Z=zn(w[0]*w[0]+w[1]*w[1]);m=La(T,(u-Z)/(Y-1)),p=La(T,(s-Z)/(Y+1))}else m=p=0}if(!(E>Be))r.moveTo(B,C);else if(p>Be)if(e=M(N,Q,B,C,s,p,o),i=M(K,L,G,H,s,p,o),r.moveTo(e.cx+e.x01,e.cy+e.y01),p<T)r.arc(e.cx,e.cy,p,Ve(e.y01,e.x01),Ve(i.y01,i.x01),!o);else r.arc(e.cx,e.cy,p,Ve(e.y01,e.x01),Ve(e.y11,e.x11),!o),r.arc(0,0,s,Ve(e.cy+e.y11,e.cx+e.x11),Ve(i.cy+i.y11,i.cx+i.x11),!o),r.arc(i.cx,i.cy,p,Ve(i.y11,i.x11),Ve(i.y01,i.x01),!o);else r.moveTo(B,C),r.arc(0,0,s,g,c,!o);if(!(u>Be)||!(R>Be))r.lineTo(G,H);else if(m>Be)if(e=M(G,H,K,L,u,-m,o),i=M(B,C,N,Q,u,-m,o),r.lineTo(e.cx+e.x01,e.cy+e.y01),m<T)r.arc(e.cx,e.cy,m,Ve(e.y01,e.x01),Ve(i.y01,i.x01),!o);else r.arc(e.cx,e.cy,m,Ve(e.y01,e.x01),Ve(e.y11,e.x11),!o),r.arc(0,0,u,Ve(e.cy+e.y11,e.cx+e.x11),Ve(i.cy+i.y11,i.cx+i.x11),o),r.arc(i.cx,i.cy,m,Ve(i.y11,i.x11),Ve(i.y01,i.x01),!o);else r.arc(0,0,u,A,v,o)}if(r.closePath(),n)return r=null,n+""||null}return a.centroid=function(){var n=(+l.apply(this,arguments)+ +d.apply(this,arguments))/2,y=(+x.apply(this,arguments)+ +h.apply(this,arguments))/2-Tr/2;return[Ln(y)*n,Ft(y)*n]},a.innerRadius=function(n){return arguments.length?(l=typeof n==="function"?n:J(+n),a):l},a.outerRadius=function(n){return arguments.length?(d=typeof n==="function"?n:J(+n),a):d},a.cornerRadius=function(n){return arguments.length?(q=typeof n==="function"?n:J(+n),a):q},a.padRadius=function(n){return arguments.length?(P=n==null?null:typeof n==="function"?n:J(+n),a):P},a.startAngle=function(n){return arguments.length?(x=typeof n==="function"?n:J(+n),a):x},a.endAngle=function(n){return arguments.length?(h=typeof n==="function"?n:J(+n),a):h},a.padAngle=function(n){return arguments.length?(S=typeof n==="function"?n:J(+n),a):S},a.context=function(n){return arguments.length?(r=n==null?null:n,a):r},a}
2
2
  export{bt};
@@ -1 +1 @@
1
- import{e,r}from"./chunk-jtwhjp20.js";import{K,Lt,It}from"./chunk-jvhmna7z.js";import{W}from"./chunk-e5rmr47n.js";import{rr,_t}from"./chunk-gxn0bey7.js";var o=rr().Railroad.parser.LangiumParser,n=e((a)=>{switch(a.$type){case"RailroadTerminalExpr":return{type:"terminal",value:a.value};case"RailroadNonTerminalExpr":return{type:"nonterminal",name:a.name};case"RailroadSpecialExpr":return{type:"special",text:a.text};case"RailroadSequenceExpr":{let t=a.elements.map(n);return t.length===1?t[0]:{type:"sequence",elements:t}}case"RailroadChoiceExpr":{let t=a.alternatives.map(n);return t.length===1?t[0]:{type:"choice",alternatives:t}}case"RailroadOptionalExpr":return{type:"optional",element:n(a.element)};case"RailroadOneOrMoreExpr":return{type:"repetition",element:n(a.element),min:1,max:1/0};case"RailroadZeroOrMoreExpr":return{type:"repetition",element:n(a.element),min:0,max:1/0};default:throw Error(`Unsupported railroad expression: ${a.$type}`)}},"transformExpression"),l=e((a)=>({name:a.name,definition:n(a.definition)}),"transformRule"),s=e((a)=>{if(W(a,K),a.title)K.setTitle(a.title);a.rules.map((t)=>K.addRule(l(t)))},"populateDb"),m={parse:e((a)=>{K.clear(),r.debug("[Railroad Parser] Starting Langium parse");let t=o.parse(a);if(t.lexerErrors.length>0||t.parserErrors.length>0)throw new _t(t);let i=t.value;r.debug("[Railroad Parser] Parsed rules:",i.rules.length),s(i),r.debug("[Railroad Parser] Parse complete")},"parse"),parser:{yy:K}},R={parser:m,db:K,renderer:It,styles:Lt};export{R as diagram};
1
+ import{e,r}from"./chunk-9dd1c37b.js";import{K,It,Rt}from"./chunk-avwpjsxw.js";import{W}from"./chunk-vjqmnkh2.js";import{rr,_t}from"./chunk-qryrg2pq.js";var o=rr().Railroad.parser.LangiumParser,n=e((a)=>{switch(a.$type){case"RailroadTerminalExpr":return{type:"terminal",value:a.value};case"RailroadNonTerminalExpr":return{type:"nonterminal",name:a.name};case"RailroadSpecialExpr":return{type:"special",text:a.text};case"RailroadSequenceExpr":{let t=a.elements.map(n);return t.length===1?t[0]:{type:"sequence",elements:t}}case"RailroadChoiceExpr":{let t=a.alternatives.map(n);return t.length===1?t[0]:{type:"choice",alternatives:t}}case"RailroadOptionalExpr":return{type:"optional",element:n(a.element)};case"RailroadOneOrMoreExpr":return{type:"repetition",element:n(a.element),min:1,max:1/0};case"RailroadZeroOrMoreExpr":return{type:"repetition",element:n(a.element),min:0,max:1/0};default:throw Error(`Unsupported railroad expression: ${a.$type}`)}},"transformExpression"),l=e((a)=>({name:a.name,definition:n(a.definition)}),"transformRule"),s=e((a)=>{if(W(a,K),a.title)K.setTitle(a.title);a.rules.map((t)=>K.addRule(l(t)))},"populateDb"),m={parse:e((a)=>{K.clear(),r.debug("[Railroad Parser] Starting Langium parse");let t=o.parse(a);if(t.lexerErrors.length>0||t.parserErrors.length>0)throw new _t(t);let i=t.value;r.debug("[Railroad Parser] Parsed rules:",i.rules.length),s(i),r.debug("[Railroad Parser] Parse complete")},"parse"),parser:{yy:K}},R={parser:m,db:K,renderer:Rt,styles:It};export{R as diagram};
@@ -0,0 +1 @@
1
+ import{wo}from"./chunk-aqm3spxt.js";export{wo as QuestionDock};
@@ -1,4 +1,4 @@
1
- import{W}from"./chunk-e5rmr47n.js";import{e,r,D,b,O,mt,C,S,E,T,A,I,L,s,p,q,Bi,In,nt,U,Fe,Ie}from"./chunk-jtwhjp20.js";import{X}from"./chunk-gxn0bey7.js";import{lt,sr}from"./chunk-942prjb6.js";import{Ce,Se}from"./chunk-32ezm0ry.js";var ut=Se(function(rt,st){(function(n,l){if(typeof rt==="object"&&typeof st==="object")st.exports=l(sr());else if(typeof define==="function"&&define.amd)define(["cose-base"],l);else if(typeof rt==="object")rt.cytoscapeFcose=l(sr());else n.cytoscapeFcose=l(n.coseBase)})(rt,function(t){return(()=>{var n={658:(k)=>{k.exports=Object.assign!=null?Object.assign.bind(Object):function(z){for(var v=arguments.length,N=Array(v>1?v-1:0),c=1;c<v;c++)N[c-1]=arguments[c];return N.forEach(function(y){Object.keys(y).forEach(function(d){return z[d]=y[d]})}),z}},548:(k,z,v)=>{var N=function(){function d(f,u){var g=[],i=!0,B=!1,F=void 0;try{for(var o=f[Symbol.iterator](),h;!(i=(h=o.next()).done);i=!0)if(g.push(h.value),u&&g.length===u)break}catch(R){B=!0,F=R}finally{try{if(!i&&o.return)o.return()}finally{if(B)throw F}}return g}return function(f,u){if(Array.isArray(f))return f;else if(Symbol.iterator in Object(f))return d(f,u);else throw TypeError("Invalid attempt to destructure non-iterable instance")}}(),c=v(140).layoutBase.LinkedList,y={};y.getTopMostNodes=function(d){var f={};for(var u=0;u<d.length;u++)f[d[u].id()]=!0;var g=d.filter(function(i,B){if(typeof i==="number")i=B;var F=i.parent()[0];while(F!=null){if(f[F.id()])return!1;F=F.parent()[0]}return!0});return g},y.connectComponents=function(d,f,u,g){var i=new c,B=new Set,F=[],o=void 0,h=void 0,R=void 0,a=!1,P=1,H=[],M=[],V=function(){var x=d.collection();M.push(x);var Y=u[0],Z=d.collection();Z.merge(Y).merge(Y.descendants().intersection(f)),F.push(Y),Z.forEach(function(re){i.push(re),B.add(re),x.merge(re)});var Q=function(){Y=i.shift();var ue=d.collection();Y.neighborhood().nodes().forEach(function(j){if(f.intersection(Y.edgesWith(j)).length>0)ue.merge(j)});for(var Ae=0;Ae<ue.length;Ae++){var Pe=ue[Ae];if(o=u.intersection(Pe.union(Pe.ancestors())),o!=null&&!B.has(o[0])){var de=o.union(o.descendants());de.forEach(function(j){if(i.push(j),B.add(j),x.merge(j),u.has(j))F.push(j)})}}};while(i.length!=0)Q();if(x.forEach(function(re){f.intersection(re.connectedEdges()).forEach(function(ue){if(x.has(ue.source())&&x.has(ue.target()))x.merge(ue)})}),F.length==u.length)a=!0;if(!a||a&&P>1){h=F[0],R=h.connectedEdges().length,F.forEach(function(re){if(re.connectedEdges().length<R)R=re.connectedEdges().length,h=re}),H.push(h.id());var se=d.collection();se.merge(F[0]),F.forEach(function(re){se.merge(re)}),F=[],u=u.difference(se),P++}};do V();while(!a);if(g){if(H.length>0)g.set("dummy"+(g.size+1),H)}return M},y.relocateComponent=function(d,f,u){if(!u.fixedNodeConstraint){var{POSITIVE_INFINITY:g,NEGATIVE_INFINITY:i,POSITIVE_INFINITY:B,NEGATIVE_INFINITY:F}=Number;if(u.quality=="draft"){var o=!0,h=!1,R=void 0;try{for(var a=f.nodeIndexes[Symbol.iterator](),P;!(o=(P=a.next()).done);o=!0){var H=P.value,M=N(H,2),V=M[0],_=M[1],x=u.cy.getElementById(V);if(x){var Y=x.boundingBox(),Z=f.xCoords[_]-Y.w/2,Q=f.xCoords[_]+Y.w/2,se=f.yCoords[_]-Y.h/2,re=f.yCoords[_]+Y.h/2;if(Z<g)g=Z;if(Q>i)i=Q;if(se<B)B=se;if(re>F)F=re}}}catch(j){h=!0,R=j}finally{try{if(!o&&a.return)a.return()}finally{if(h)throw R}}var ue=d.x-(i+g)/2,Ae=d.y-(F+B)/2;f.xCoords=f.xCoords.map(function(j){return j+ue}),f.yCoords=f.yCoords.map(function(j){return j+Ae})}else{Object.keys(f).forEach(function(j){var oe=f[j],Ne=oe.getRect().x,ke=oe.getRect().x+oe.getRect().width,De=oe.getRect().y,xe=oe.getRect().y+oe.getRect().height;if(Ne<g)g=Ne;if(ke>i)i=ke;if(De<B)B=De;if(xe>F)F=xe});var Pe=d.x-(i+g)/2,de=d.y-(F+B)/2;Object.keys(f).forEach(function(j){var oe=f[j];oe.setCenter(oe.getCenterX()+Pe,oe.getCenterY()+de)})}}},y.calcBoundingBox=function(d,f,u,g){var{MAX_SAFE_INTEGER:i,MIN_SAFE_INTEGER:B,MAX_SAFE_INTEGER:F,MIN_SAFE_INTEGER:o}=Number,h=void 0,R=void 0,a=void 0,P=void 0,H=d.descendants().not(":parent"),M=H.length;for(var V=0;V<M;V++){var _=H[V];if(h=f[g.get(_.id())]-_.width()/2,R=f[g.get(_.id())]+_.width()/2,a=u[g.get(_.id())]-_.height()/2,P=u[g.get(_.id())]+_.height()/2,i>h)i=h;if(B<R)B=R;if(F>a)F=a;if(o<P)o=P}var x={};return x.topLeftX=i,x.topLeftY=F,x.width=B-i,x.height=o-F,x},y.calcParentsWithoutChildren=function(d,f){var u=d.collection();return f.nodes(":parent").forEach(function(g){var i=!1;if(g.children().forEach(function(B){if(B.css("display")!="none")i=!0}),!i)u.merge(g)}),u},k.exports=y},816:(k,z,v)=>{var N=v(548),c=v(140).CoSELayout,y=v(140).CoSENode,d=v(140).layoutBase.PointD,f=v(140).layoutBase.DimensionD,u=v(140).layoutBase.LayoutConstants,g=v(140).layoutBase.FDLayoutConstants,i=v(140).CoSEConstants,B=function(o,h){var{cy:R,eles:a}=o,P=a.nodes(),H=a.edges(),M=void 0,V=void 0,_=void 0,x={};if(o.randomize)M=h.nodeIndexes,V=h.xCoords,_=h.yCoords;var Y=function(j){return typeof j==="function"},Z=function(j,oe){if(Y(j))return j(oe);else return j},Q=N.calcParentsWithoutChildren(R,a),se=function de(j,oe,Ne,ke){var De=oe.length;for(var xe=0;xe<De;xe++){var J=oe[xe],Te=null;if(J.intersection(Q).length==0)Te=J.children();var ie=void 0,ve=J.layoutDimensions({nodeDimensionsIncludeLabels:ke.nodeDimensionsIncludeLabels});if(J.outerWidth()!=null&&J.outerHeight()!=null)if(ke.randomize)if(!J.isParent())ie=j.add(new y(Ne.graphManager,new d(V[M.get(J.id())]-ve.w/2,_[M.get(J.id())]-ve.h/2),new f(parseFloat(ve.w),parseFloat(ve.h))));else{var Me=N.calcBoundingBox(J,V,_,M);if(J.intersection(Q).length==0)ie=j.add(new y(Ne.graphManager,new d(Me.topLeftX,Me.topLeftY),new f(Me.width,Me.height)));else ie=j.add(new y(Ne.graphManager,new d(Me.topLeftX,Me.topLeftY),new f(parseFloat(ve.w),parseFloat(ve.h))))}else ie=j.add(new y(Ne.graphManager,new d(J.position("x")-ve.w/2,J.position("y")-ve.h/2),new f(parseFloat(ve.w),parseFloat(ve.h))));else ie=j.add(new y(this.graphManager));if(ie.id=J.data("id"),ie.nodeRepulsion=Z(ke.nodeRepulsion,J),ie.paddingLeft=parseInt(J.css("padding")),ie.paddingTop=parseInt(J.css("padding")),ie.paddingRight=parseInt(J.css("padding")),ie.paddingBottom=parseInt(J.css("padding")),ke.nodeDimensionsIncludeLabels)ie.labelWidth=J.boundingBox({includeLabels:!0,includeNodes:!1,includeOverlays:!1}).w,ie.labelHeight=J.boundingBox({includeLabels:!0,includeNodes:!1,includeOverlays:!1}).h,ie.labelPosVertical=J.css("text-valign"),ie.labelPosHorizontal=J.css("text-halign");if(x[J.data("id")]=ie,isNaN(ie.rect.x))ie.rect.x=0;if(isNaN(ie.rect.y))ie.rect.y=0;if(Te!=null&&Te.length>0){var ze=void 0;ze=Ne.getGraphManager().add(Ne.newGraph(),ie),de(ze,Te,Ne,ke)}}},re=function(j,oe,Ne){var ke=0,De=0;for(var xe=0;xe<Ne.length;xe++){var J=Ne[xe],Te=x[J.data("source")],ie=x[J.data("target")];if(Te&&ie&&Te!==ie&&Te.getEdgesBetween(ie).length==0){var ve=oe.add(j.newEdge(),Te,ie);ve.id=J.id(),ve.idealLength=Z(o.idealEdgeLength,J),ve.edgeElasticity=Z(o.edgeElasticity,J),ke+=ve.idealLength,De++}}if(o.idealEdgeLength!=null){if(De>0)i.DEFAULT_EDGE_LENGTH=g.DEFAULT_EDGE_LENGTH=ke/De;else if(!Y(o.idealEdgeLength))i.DEFAULT_EDGE_LENGTH=g.DEFAULT_EDGE_LENGTH=o.idealEdgeLength;else i.DEFAULT_EDGE_LENGTH=g.DEFAULT_EDGE_LENGTH=50;i.MIN_REPULSION_DIST=g.MIN_REPULSION_DIST=g.DEFAULT_EDGE_LENGTH/10,i.DEFAULT_RADIAL_SEPARATION=g.DEFAULT_EDGE_LENGTH}},ue=function(j,oe){if(oe.fixedNodeConstraint)j.constraints.fixedNodeConstraint=oe.fixedNodeConstraint;if(oe.alignmentConstraint)j.constraints.alignmentConstraint=oe.alignmentConstraint;if(oe.relativePlacementConstraint)j.constraints.relativePlacementConstraint=oe.relativePlacementConstraint};if(o.nestingFactor!=null)i.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=g.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=o.nestingFactor;if(o.gravity!=null)i.DEFAULT_GRAVITY_STRENGTH=g.DEFAULT_GRAVITY_STRENGTH=o.gravity;if(o.numIter!=null)i.MAX_ITERATIONS=g.MAX_ITERATIONS=o.numIter;if(o.gravityRange!=null)i.DEFAULT_GRAVITY_RANGE_FACTOR=g.DEFAULT_GRAVITY_RANGE_FACTOR=o.gravityRange;if(o.gravityCompound!=null)i.DEFAULT_COMPOUND_GRAVITY_STRENGTH=g.DEFAULT_COMPOUND_GRAVITY_STRENGTH=o.gravityCompound;if(o.gravityRangeCompound!=null)i.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=g.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=o.gravityRangeCompound;if(o.initialEnergyOnIncremental!=null)i.DEFAULT_COOLING_FACTOR_INCREMENTAL=g.DEFAULT_COOLING_FACTOR_INCREMENTAL=o.initialEnergyOnIncremental;if(o.tilingCompareBy!=null)i.TILING_COMPARE_BY=o.tilingCompareBy;if(o.quality=="proof")u.QUALITY=2;else u.QUALITY=0;if(i.NODE_DIMENSIONS_INCLUDE_LABELS=g.NODE_DIMENSIONS_INCLUDE_LABELS=u.NODE_DIMENSIONS_INCLUDE_LABELS=o.nodeDimensionsIncludeLabels,i.DEFAULT_INCREMENTAL=g.DEFAULT_INCREMENTAL=u.DEFAULT_INCREMENTAL=!o.randomize,i.ANIMATE=g.ANIMATE=u.ANIMATE=o.animate,i.TILE=o.tile,i.TILING_PADDING_VERTICAL=typeof o.tilingPaddingVertical==="function"?o.tilingPaddingVertical.call():o.tilingPaddingVertical,i.TILING_PADDING_HORIZONTAL=typeof o.tilingPaddingHorizontal==="function"?o.tilingPaddingHorizontal.call():o.tilingPaddingHorizontal,i.DEFAULT_INCREMENTAL=g.DEFAULT_INCREMENTAL=u.DEFAULT_INCREMENTAL=!0,i.PURE_INCREMENTAL=!o.randomize,u.DEFAULT_UNIFORM_LEAF_NODE_SIZES=o.uniformNodeDimensions,o.step=="transformed")i.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,i.ENFORCE_CONSTRAINTS=!1,i.APPLY_LAYOUT=!1;if(o.step=="enforced")i.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,i.ENFORCE_CONSTRAINTS=!0,i.APPLY_LAYOUT=!1;if(o.step=="cose")i.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,i.ENFORCE_CONSTRAINTS=!1,i.APPLY_LAYOUT=!0;if(o.step=="all"){if(o.randomize)i.TRANSFORM_ON_CONSTRAINT_HANDLING=!0;else i.TRANSFORM_ON_CONSTRAINT_HANDLING=!1;i.ENFORCE_CONSTRAINTS=!0,i.APPLY_LAYOUT=!0}if(o.fixedNodeConstraint||o.alignmentConstraint||o.relativePlacementConstraint)i.TREE_REDUCTION_ON_INCREMENTAL=!1;else i.TREE_REDUCTION_ON_INCREMENTAL=!0;var Ae=new c,Pe=Ae.newGraphManager();return se(Pe.addRoot(),N.getTopMostNodes(P),Ae,o),re(Ae,Pe,H),ue(Ae,o),Ae.runLayout(),x};k.exports={coseLayout:B}},212:(k,z,v)=>{var N=function(){function o(h,R){for(var a=0;a<R.length;a++){var P=R[a];if(P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P)P.writable=!0;Object.defineProperty(h,P.key,P)}}return function(h,R,a){if(R)o(h.prototype,R);if(a)o(h,a);return h}}();function c(o,h){if(!(o instanceof h))throw TypeError("Cannot call a class as a function")}var y=v(658),d=v(548),f=v(657),u=f.spectralLayout,g=v(816),i=g.coseLayout,B=Object.freeze({quality:"default",randomize:!0,animate:!0,animationDuration:1000,animationEasing:void 0,fit:!0,padding:30,nodeDimensionsIncludeLabels:!1,uniformNodeDimensions:!1,packComponents:!0,step:"all",samplingType:!0,sampleSize:25,nodeSeparation:75,piTol:0.0000001,nodeRepulsion:function(h){return 4500},idealEdgeLength:function(h){return 50},edgeElasticity:function(h){return 0.45},nestingFactor:0.1,gravity:0.25,numIter:2500,tile:!0,tilingCompareBy:void 0,tilingPaddingVertical:10,tilingPaddingHorizontal:10,gravityRangeCompound:1.5,gravityCompound:1,gravityRange:3.8,initialEnergyOnIncremental:0.3,fixedNodeConstraint:void 0,alignmentConstraint:void 0,relativePlacementConstraint:void 0,ready:function(){},stop:function(){}}),F=function(){function o(h){c(this,o),this.options=y({},B,h)}return N(o,[{key:"run",value:function(){var R=this,a=this.options,{cy:P,eles:H}=a,M=[],V=void 0,_=void 0,x=[],Y=void 0,Z=[];if(a.fixedNodeConstraint&&(!Array.isArray(a.fixedNodeConstraint)||a.fixedNodeConstraint.length==0))a.fixedNodeConstraint=void 0;if(a.alignmentConstraint){if(a.alignmentConstraint.vertical&&(!Array.isArray(a.alignmentConstraint.vertical)||a.alignmentConstraint.vertical.length==0))a.alignmentConstraint.vertical=void 0;if(a.alignmentConstraint.horizontal&&(!Array.isArray(a.alignmentConstraint.horizontal)||a.alignmentConstraint.horizontal.length==0))a.alignmentConstraint.horizontal=void 0}if(a.relativePlacementConstraint&&(!Array.isArray(a.relativePlacementConstraint)||a.relativePlacementConstraint.length==0))a.relativePlacementConstraint=void 0;var Q=a.fixedNodeConstraint||a.alignmentConstraint||a.relativePlacementConstraint;if(Q)a.tile=!1,a.packComponents=!1;var se=void 0,re=!1;if(P.layoutUtilities&&a.packComponents){if(se=P.layoutUtilities("get"),!se)se=P.layoutUtilities();re=!0}if(H.nodes().length>0)if(!re){var ue=a.eles.boundingBox();if(Z.push({x:ue.x1+ue.w/2,y:ue.y1+ue.h/2}),a.randomize){var Ae=u(a);M.push(Ae)}if(a.quality=="default"||a.quality=="proof")x.push(i(a,M[0])),d.relocateComponent(Z[0],x[0],a);else d.relocateComponent(Z[0],M[0],a)}else{var Pe=d.getTopMostNodes(a.eles.nodes());if(Y=d.connectComponents(P,a.eles,Pe),Y.forEach(function(K){var G=K.boundingBox();Z.push({x:G.x1+G.w/2,y:G.y1+G.h/2})}),a.randomize)Y.forEach(function(K){a.eles=K,M.push(u(a))});if(a.quality=="default"||a.quality=="proof"){var de=P.collection();if(a.tile){var j=new Map,oe=[],Ne=[],ke=0,De={nodeIndexes:j,xCoords:oe,yCoords:Ne},xe=[];if(Y.forEach(function(K,G){if(K.edges().length==0)K.nodes().forEach(function(pe,le){if(de.merge(K.nodes()[le]),!pe.isParent())De.nodeIndexes.set(K.nodes()[le].id(),ke++),De.xCoords.push(K.nodes()[0].position().x),De.yCoords.push(K.nodes()[0].position().y)}),xe.push(G)}),de.length>1){var J=de.boundingBox();Z.push({x:J.x1+J.w/2,y:J.y1+J.h/2}),Y.push(de),M.push(De);for(var Te=xe.length-1;Te>=0;Te--)Y.splice(xe[Te],1),M.splice(xe[Te],1),Z.splice(xe[Te],1)}}Y.forEach(function(K,G){a.eles=K,x.push(i(a,M[G])),d.relocateComponent(Z[G],x[G],a)})}else Y.forEach(function(K,G){d.relocateComponent(Z[G],M[G],a)});var ie=new Set;if(Y.length>1){var ve=[],Me=H.filter(function(K){return K.css("display")=="none"});Y.forEach(function(K,G){var pe=void 0;if(a.quality=="draft")pe=M[G].nodeIndexes;if(K.nodes().not(Me).length>0){var le={};le.edges=[],le.nodes=[];var me=void 0;if(K.nodes().not(Me).forEach(function(fe){if(a.quality=="draft")if(!fe.isParent())me=pe.get(fe.id()),le.nodes.push({x:M[G].xCoords[me]-fe.boundingbox().w/2,y:M[G].yCoords[me]-fe.boundingbox().h/2,width:fe.boundingbox().w,height:fe.boundingbox().h});else{var he=d.calcBoundingBox(fe,M[G].xCoords,M[G].yCoords,pe);le.nodes.push({x:he.topLeftX,y:he.topLeftY,width:he.width,height:he.height})}else if(x[G][fe.id()])le.nodes.push({x:x[G][fe.id()].getLeft(),y:x[G][fe.id()].getTop(),width:x[G][fe.id()].getWidth(),height:x[G][fe.id()].getHeight()})}),K.edges().forEach(function(fe){var he=fe.source(),Ee=fe.target();if(he.css("display")!="none"&&Ee.css("display")!="none"){if(a.quality=="draft"){var Be=pe.get(he.id()),et=pe.get(Ee.id()),Oe=[],Ye=[];if(he.isParent()){var We=d.calcBoundingBox(he,M[G].xCoords,M[G].yCoords,pe);Oe.push(We.topLeftX+We.width/2),Oe.push(We.topLeftY+We.height/2)}else Oe.push(M[G].xCoords[Be]),Oe.push(M[G].yCoords[Be]);if(Ee.isParent()){var Je=d.calcBoundingBox(Ee,M[G].xCoords,M[G].yCoords,pe);Ye.push(Je.topLeftX+Je.width/2),Ye.push(Je.topLeftY+Je.height/2)}else Ye.push(M[G].xCoords[et]),Ye.push(M[G].yCoords[et]);le.edges.push({startX:Oe[0],startY:Oe[1],endX:Ye[0],endY:Ye[1]})}else if(x[G][he.id()]&&x[G][Ee.id()])le.edges.push({startX:x[G][he.id()].getCenterX(),startY:x[G][he.id()].getCenterY(),endX:x[G][Ee.id()].getCenterX(),endY:x[G][Ee.id()].getCenterY()})}}),le.nodes.length>0)ve.push(le),ie.add(G)}});var ze=se.packComponents(ve,a.randomize).shifts;if(a.quality=="draft")M.forEach(function(K,G){var pe=K.xCoords.map(function(me){return me+ze[G].dx}),le=K.yCoords.map(function(me){return me+ze[G].dy});K.xCoords=pe,K.yCoords=le});else{var Ke=0;ie.forEach(function(K){Object.keys(x[K]).forEach(function(G){var pe=x[K][G];pe.setCenter(pe.getCenterX()+ze[Ke].dx,pe.getCenterY()+ze[Ke].dy)}),Ke++})}}}var je=function(G,pe){if(a.quality=="default"||a.quality=="proof"){if(typeof G==="number")G=pe;var le=void 0,me=void 0,fe=G.data("id");if(x.forEach(function(Ee){if(fe in Ee)le={x:Ee[fe].getRect().getCenterX(),y:Ee[fe].getRect().getCenterY()},me=Ee[fe]}),a.nodeDimensionsIncludeLabels){if(me.labelWidth){if(me.labelPosHorizontal=="left")le.x+=me.labelWidth/2;else if(me.labelPosHorizontal=="right")le.x-=me.labelWidth/2}if(me.labelHeight){if(me.labelPosVertical=="top")le.y+=me.labelHeight/2;else if(me.labelPosVertical=="bottom")le.y-=me.labelHeight/2}}if(le==null)le={x:G.position("x"),y:G.position("y")};return{x:le.x,y:le.y}}else{var he=void 0;if(M.forEach(function(Ee){var Be=Ee.nodeIndexes.get(G.id());if(Be!=null)he={x:Ee.xCoords[Be],y:Ee.yCoords[Be]}}),he==null)he={x:G.position("x"),y:G.position("y")};return{x:he.x,y:he.y}}};if(a.quality=="default"||a.quality=="proof"||a.randomize){var at=d.calcParentsWithoutChildren(P,H),qe=H.filter(function(K){return K.css("display")=="none"});if(a.eles=H.not(qe),H.nodes().not(":parent").not(qe).layoutPositions(R,a,je),at.length>0)at.forEach(function(K){K.position(je(K))})}else console.log("If randomize option is set to false, then quality option must be 'default' or 'proof'.")}}]),o}();k.exports=F},657:(k,z,v)=>{var N=v(548),c=v(140).layoutBase.Matrix,y=v(140).layoutBase.SVD,d=function(u){var{cy:g,eles:i}=u,B=i.nodes(),F=i.nodes(":parent"),o=new Map,h=new Map,R=new Map,a=[],P=[],H=[],M=[],V=[],_=[],x=[],Y=[],Z=void 0,Q=void 0,se=1e8,re=0.000000001,{piTol:ue,samplingType:Ae,nodeSeparation:Pe}=u,de=void 0,j=function(){var ee=0,te=0,ne=!1;while(te<de){ee=Math.floor(Math.random()*Q),ne=!1;for(var ae=0;ae<te;ae++)if(M[ae]==ee){ne=!0;break}if(!ne)M[te]=ee,te++;else continue}},oe=function(ee,te,ne){var ae=[],we=0,ge=0,ce=0,Le=void 0,be=[],$e=0,_e=1;for(var Ue=0;Ue<Q;Ue++)be[Ue]=se;ae[ge]=ee,be[ee]=0;while(ge>=we){ce=ae[we++];var Xe=a[ce];for(var He=0;He<Xe.length;He++)if(Le=h.get(Xe[He]),be[Le]==se)be[Le]=be[ce]+1,ae[++ge]=Le;_[ce][te]=be[ce]*Pe}if(ne){for(var Ge=0;Ge<Q;Ge++)if(_[Ge][te]<V[Ge])V[Ge]=_[Ge][te];for(var tt=0;tt<Q;tt++)if(V[tt]>$e)$e=V[tt],_e=tt}return _e},Ne=function(ee){var te=void 0;if(!ee){j();for(var ne=0;ne<de;ne++)oe(M[ne],ne,ee,!1)}else{te=Math.floor(Math.random()*Q),Z=te;for(var ae=0;ae<Q;ae++)V[ae]=se;for(var we=0;we<de;we++)M[we]=te,te=oe(te,we,ee)}for(var ge=0;ge<Q;ge++)for(var ce=0;ce<de;ce++)_[ge][ce]*=_[ge][ce];for(var Le=0;Le<de;Le++)x[Le]=[];for(var be=0;be<de;be++)for(var $e=0;$e<de;$e++)x[be][$e]=_[M[$e]][be]},ke=function(){var ee=y.svd(x),{S:te,U:ne,V:ae}=ee,we=te[0]*te[0]*te[0],ge=[];for(var ce=0;ce<de;ce++){ge[ce]=[];for(var Le=0;Le<de;Le++)if(ge[ce][Le]=0,ce==Le)ge[ce][Le]=te[ce]/(te[ce]*te[ce]+we/(te[ce]*te[ce]))}Y=c.multMat(c.multMat(ae,ge),c.transpose(ne))},De=function(){var ee=void 0,te=void 0,ne=[],ae=[],we=[],ge=[];for(var ce=0;ce<Q;ce++)ne[ce]=Math.random(),ae[ce]=Math.random();ne=c.normalize(ne),ae=c.normalize(ae);var Le=0,be=re,$e=re,_e=void 0;while(!0){Le++;for(var Ue=0;Ue<Q;Ue++)we[Ue]=ne[Ue];if(ne=c.multGamma(c.multL(c.multGamma(we),_,Y)),ee=c.dotProduct(we,ne),ne=c.normalize(ne),be=c.dotProduct(we,ne),_e=Math.abs(be/$e),_e<=1+ue&&_e>=1)break;$e=be}for(var Xe=0;Xe<Q;Xe++)we[Xe]=ne[Xe];Le=0,$e=re;while(!0){Le++;for(var He=0;He<Q;He++)ge[He]=ae[He];if(ge=c.minusOp(ge,c.multCons(we,c.dotProduct(we,ge))),ae=c.multGamma(c.multL(c.multGamma(ge),_,Y)),te=c.dotProduct(ge,ae),ae=c.normalize(ae),be=c.dotProduct(ge,ae),_e=Math.abs(be/$e),_e<=1+ue&&_e>=1)break;$e=be}for(var Ge=0;Ge<Q;Ge++)ge[Ge]=ae[Ge];P=c.multCons(we,Math.sqrt(Math.abs(ee))),H=c.multCons(ge,Math.sqrt(Math.abs(te)))};N.connectComponents(g,i,N.getTopMostNodes(B),o),F.forEach(function(ye){N.connectComponents(g,i,N.getTopMostNodes(ye.descendants().intersection(i)),o)});var xe=0;for(var J=0;J<B.length;J++)if(!B[J].isParent())h.set(B[J].id(),xe++);var Te=!0,ie=!1,ve=void 0;try{for(var Me=o.keys()[Symbol.iterator](),ze;!(Te=(ze=Me.next()).done);Te=!0){var Ke=ze.value;h.set(Ke,xe++)}}catch(ye){ie=!0,ve=ye}finally{try{if(!Te&&Me.return)Me.return()}finally{if(ie)throw ve}}for(var je=0;je<h.size;je++)a[je]=[];F.forEach(function(ye){var ee=ye.children().intersection(i);while(ee.nodes(":childless").length==0)ee=ee.nodes()[0].children().intersection(i);var te=0,ne=ee.nodes(":childless")[0].connectedEdges().length;ee.nodes(":childless").forEach(function(ae,we){if(ae.connectedEdges().length<ne)ne=ae.connectedEdges().length,te=we}),R.set(ye.id(),ee.nodes(":childless")[te].id())}),B.forEach(function(ye){var ee=void 0;if(ye.isParent())ee=h.get(R.get(ye.id()));else ee=h.get(ye.id());ye.neighborhood().nodes().forEach(function(te){if(i.intersection(ye.edgesWith(te)).length>0)if(te.isParent())a[ee].push(R.get(te.id()));else a[ee].push(te.id())})});var at=function(ee){var te=h.get(ee),ne=void 0;o.get(ee).forEach(function(ae){if(g.getElementById(ae).isParent())ne=R.get(ae);else ne=ae;a[te].push(ne),a[h.get(ne)].push(ee)})},qe=!0,K=!1,G=void 0;try{for(var pe=o.keys()[Symbol.iterator](),le;!(qe=(le=pe.next()).done);qe=!0){var me=le.value;at(me)}}catch(ye){K=!0,G=ye}finally{try{if(!qe&&pe.return)pe.return()}finally{if(K)throw G}}Q=h.size;var fe=void 0;if(Q>2){de=Q<u.sampleSize?Q:u.sampleSize;for(var he=0;he<Q;he++)_[he]=[];for(var Ee=0;Ee<de;Ee++)Y[Ee]=[];if(u.quality=="draft"||u.step=="all")Ne(Ae),ke(),De(),fe={nodeIndexes:h,xCoords:P,yCoords:H};else h.forEach(function(ye,ee){P.push(g.getElementById(ee).position("x")),H.push(g.getElementById(ee).position("y"))}),fe={nodeIndexes:h,xCoords:P,yCoords:H};return fe}else{var Be=h.keys(),et=g.getElementById(Be.next().value),Oe=et.position(),Ye=et.outerWidth();if(P.push(Oe.x),H.push(Oe.y),Q==2){var We=g.getElementById(Be.next().value),Je=We.outerWidth();P.push(Oe.x+Ye/2+Je/2+u.idealEdgeLength),H.push(Oe.y)}return fe={nodeIndexes:h,xCoords:P,yCoords:H},fe}};k.exports={spectralLayout:d}},579:(k,z,v)=>{var N=v(212),c=function(d){if(!d)return;d("layout","fcose",N)};if(typeof cytoscape<"u")c(cytoscape);k.exports=c},140:(k)=>{k.exports=t}},l={};function w(k){var z=l[k];if(z!==void 0)return z.exports;var v=l[k]={exports:{}};return n[k](v,v.exports,w),v.exports}var m=w(579);return m})()})});var xt=Ce(ut(),1);var gt={L:"left",R:"right",T:"top",B:"bottom"},ht={L:e((t)=>`${t},${t/2} 0,${t} 0,0`,"L"),R:e((t)=>`0,${t/2} ${t},0 ${t},${t}`,"R"),T:e((t)=>`0,0 ${t},0 ${t/2},${t}`,"T"),B:e((t)=>`${t/2},0 ${t},${t} 0,${t}`,"B")},ot={L:e((t,n)=>t-n+2,"L"),R:e((t,n)=>t-2,"R"),T:e((t,n)=>t-n+2,"T"),B:e((t,n)=>t-2,"B")},kt=e(function(t){if(Re(t))return t==="L"?"R":"L";else return t==="T"?"B":"T"},"getOppositeArchitectureDirection"),vt=e(function(t){let n=t;return n==="L"||n==="R"||n==="T"||n==="B"},"isArchitectureDirection"),Re=e(function(t){let n=t;return n==="L"||n==="R"},"isArchitectureDirectionX"),Ve=e(function(t){let n=t;return n==="T"||n==="B"},"isArchitectureDirectionY"),ft=e(function(t,n){let l=Re(t)&&Ve(n),w=Ve(t)&&Re(n);return l||w},"isArchitectureDirectionXY"),Dt=e(function(t){let n=t[0],l=t[1],w=Re(n)&&Ve(l),m=Ve(n)&&Re(l);return w||m},"isArchitecturePairXY"),Rt=e(function(t){return t!=="LL"&&t!=="RR"&&t!=="TT"&&t!=="BB"},"isValidArchitectureDirectionPair"),ct=e(function(t,n){let l=`${t}${n}`;return Rt(l)?l:void 0},"getArchitectureDirectionPair"),Mt=e(function([t,n],l){let w=l[0],m=l[1];if(Re(w))if(Ve(m))return[t+(w==="L"?-1:1),n+(m==="T"?1:-1)];else return[t+(w==="L"?-1:1),n];else if(Re(m))return[t+(m==="L"?1:-1),n+(w==="T"?1:-1)];else return[t,n+(w==="T"?1:-1)]},"shiftPositionByArchitectureDirectionPair"),Ft=e(function(t){if(t==="LT"||t==="TL")return[1,1];else if(t==="BL"||t==="LB")return[1,-1];else if(t==="BR"||t==="RB")return[-1,-1];else return[-1,1]},"getArchitectureDirectionXYFactors"),$t=e(function(t,n){if(ft(t,n))return"bend";else if(Re(t))return"horizontal";return"vertical"},"getArchitectureDirectionAlignment"),Pt=e(function(t){return t.type==="service"},"isArchitectureService"),Ot=e(function(t){return t.type==="junction"},"isArchitectureJunction"),pt=e((t,n)=>{let[l,w]=[t,n].sort();return`${JSON.stringify(l)}-${JSON.stringify(w)}`},"architectureGroupAlignmentKey"),yt=e((t)=>t.data(),"edgeData"),Qe=e((t)=>t.data(),"nodeData"),Gt=D.architecture,Et=class{constructor(){this.nodes=new Map,this.groups=new Map,this.edges=[],this.layoutHints=[],this.registeredIds=new Map,this.elements=new Map,this.diagramId="",this.setAccTitle=S,this.getAccTitle=E,this.setDiagramTitle=I,this.getDiagramTitle=L,this.getAccDescription=A,this.setAccDescription=T,this.clear()}static{e(this,"ArchitectureDB")}setDiagramId(t){this.diagramId=t}getDiagramId(){return this.diagramId}clear(){this.nodes=new Map,this.groups=new Map,this.edges=[],this.layoutHints=[],this.registeredIds=new Map,this.dataStructures=void 0,this.elements=new Map,this.diagramId="",C()}addService({id:t,icon:n,in:l,title:w,iconText:m}){if(this.registeredIds.has(t))throw Error(`The service id [${t}] is already in use by another ${this.registeredIds.get(t)}`);if(l!==void 0){if(t===l)throw Error(`The service [${t}] cannot be placed within itself`);if(!this.registeredIds.has(l))throw Error(`The service [${t}]'s parent does not exist. Please make sure the parent is created before this service`);if(this.registeredIds.get(l)==="node")throw Error(`The service [${t}]'s parent is not a group`)}this.registeredIds.set(t,"node"),this.nodes.set(t,{id:t,type:"service",icon:n,iconText:m,title:w,edges:[],in:l})}getServices(){return[...this.nodes.values()].filter(Pt)}addJunction({id:t,in:n}){if(this.registeredIds.has(t))throw Error(`The junction id [${t}] is already in use by another ${this.registeredIds.get(t)}`);if(n!==void 0){if(t===n)throw Error(`The junction [${t}] cannot be placed within itself`);if(!this.registeredIds.has(n))throw Error(`The junction [${t}]'s parent does not exist. Please make sure the parent is created before this junction`);if(this.registeredIds.get(n)==="node")throw Error(`The junction [${t}]'s parent is not a group`)}this.registeredIds.set(t,"node"),this.nodes.set(t,{id:t,type:"junction",edges:[],in:n})}getJunctions(){return[...this.nodes.values()].filter(Ot)}getNodes(){return[...this.nodes.values()]}getNode(t){return this.nodes.get(t)??null}addGroup({id:t,icon:n,in:l,title:w}){if(this.registeredIds.has(t))throw Error(`The group id [${t}] is already in use by another ${this.registeredIds.get(t)}`);if(l!==void 0){if(t===l)throw Error(`The group [${t}] cannot be placed within itself`);if(!this.registeredIds.has(l))throw Error(`The group [${t}]'s parent does not exist. Please make sure the parent is created before this group`);if(this.registeredIds.get(l)==="node")throw Error(`The group [${t}]'s parent is not a group`)}this.registeredIds.set(t,"group"),this.groups.set(t,{id:t,icon:n,title:w,in:l})}getGroups(){return[...this.groups.values()]}addEdge({lhsId:t,rhsId:n,lhsDir:l,rhsDir:w,lhsInto:m,rhsInto:k,lhsGroup:z,rhsGroup:v,title:N}){if(!vt(l))throw Error(`Invalid direction given for left hand side of edge ${t}--${n}. Expected (L,R,T,B) got ${String(l)}`);if(!vt(w))throw Error(`Invalid direction given for right hand side of edge ${t}--${n}. Expected (L,R,T,B) got ${String(w)}`);if(!this.nodes.has(t)&&!this.groups.has(t))throw Error(`The left-hand id [${t}] does not yet exist. Please create the service/group before declaring an edge to it.`);if(!this.nodes.has(n)&&!this.groups.has(n))throw Error(`The right-hand id [${n}] does not yet exist. Please create the service/group before declaring an edge to it.`);let c=this.nodes.get(t).in,y=this.nodes.get(n).in;if(z&&c&&y&&c==y)throw Error(`The left-hand id [${t}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);if(v&&c&&y&&c==y)throw Error(`The right-hand id [${n}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);let d={lhsId:t,lhsDir:l,lhsInto:m,lhsGroup:z,rhsId:n,rhsDir:w,rhsInto:k,rhsGroup:v,title:N};this.edges.push(d);let f=this.nodes.get(t),u=this.nodes.get(n);if(f&&u)f.edges.push(this.edges[this.edges.length-1]),u.edges.push(this.edges[this.edges.length-1])}getEdges(){return this.edges}addLayoutHint(t){if(t.members.length<2)throw Error(`An align directive requires at least two members; got ${t.members.length}`);let n=new Set;t.members.forEach((l)=>{if(this.registeredIds.get(l)!=="node")throw Error(`align ${t.direction} references [${l}], which is not a service or junction`);if(n.has(l))throw Error(`align ${t.direction} lists [${l}] more than once`);n.add(l)}),this.layoutHints.push(t)}getLayoutHints(){return this.layoutHints}getDataStructures(){if(this.dataStructures===void 0){let t=new Map,n=new Map;for(let[z,v]of this.nodes.entries()){let N=new Map;for(let c of v.edges){let y=this.getNode(c.lhsId)?.in,d=this.getNode(c.rhsId)?.in;if(y&&d&&y!==d){let f=$t(c.lhsDir,c.rhsDir);if(f!=="bend")t.set(pt(y,d),f)}if(c.lhsId===z){let f=ct(c.lhsDir,c.rhsDir);if(f)N.set(f,c.rhsId)}else{let f=ct(c.rhsDir,c.lhsDir);if(f)N.set(f,c.lhsId)}}n.set(z,N)}let l=new Set,w=new Set(n.keys()),m=e((z)=>{let v=new Map([[z,[0,0]]]),N=[z];while(N.length>0){let c=N.shift();if(c){l.add(c),w.delete(c);let y=n.get(c);if(!y)throw Error(`BFS error: adjacency list for id ${c} not found. Please report this as a bug.`);let d=v.get(c);if(!d)throw Error(`BFS error: position for id ${c} not found in spatial map. Please report this as a bug.`);let[f,u]=d;y.forEach((g,i)=>{if(!l.has(g))v.set(g,Mt([f,u],i)),N.push(g)})}}return v},"BFS"),k=[];while(w.size>0){let z=w.values().next().value;k.push(m(z))}this.dataStructures={adjList:n,spatialMaps:k,groupAlignments:t}}return this.dataStructures}setElementForId(t,n){this.elements.set(t,n)}getElementById(t){return this.elements.get(t)}getConfig(){return U({...Gt,...b().architecture})}getConfigField(t){return this.getConfig()[t]}},zt=e((t,n)=>{W(t,n),t.groups.map((l)=>n.addGroup(l)),t.services.map((l)=>n.addService({...l,type:"service"})),t.junctions.map((l)=>n.addJunction({...l,type:"junction"})),t.edges.map((l)=>n.addEdge(l)),t.alignments?.map((l)=>n.addLayoutHint({direction:l.direction,members:[...l.members]}))},"populateDb"),wt={parser:{yy:void 0},parse:e(async(t)=>{let n=await X("architecture",t);r.debug(n);let l=wt.parser?.yy;if(!(l instanceof Et))throw Error("parser.parser?.yy was not a ArchitectureDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");zt(n,l)},"parse")},Bt=e((t)=>`
1
+ import{W}from"./chunk-vjqmnkh2.js";import{e,r,D,b,O,mt,C,S,E,T,A,I,L,s,p,V,Bi,In,nt,U,Fe,Ie}from"./chunk-9dd1c37b.js";import{X}from"./chunk-qryrg2pq.js";import{lt,sr}from"./chunk-kgerjbn4.js";import{Ce,Se}from"./chunk-aqm3spxt.js";var ut=Se(function(rt,st){(function(n,l){if(typeof rt==="object"&&typeof st==="object")st.exports=l(sr());else if(typeof define==="function"&&define.amd)define(["cose-base"],l);else if(typeof rt==="object")rt.cytoscapeFcose=l(sr());else n.cytoscapeFcose=l(n.coseBase)})(rt,function(t){return(()=>{var n={658:(k)=>{k.exports=Object.assign!=null?Object.assign.bind(Object):function(z){for(var v=arguments.length,N=Array(v>1?v-1:0),c=1;c<v;c++)N[c-1]=arguments[c];return N.forEach(function(y){Object.keys(y).forEach(function(d){return z[d]=y[d]})}),z}},548:(k,z,v)=>{var N=function(){function d(f,u){var g=[],i=!0,B=!1,F=void 0;try{for(var o=f[Symbol.iterator](),h;!(i=(h=o.next()).done);i=!0)if(g.push(h.value),u&&g.length===u)break}catch(R){B=!0,F=R}finally{try{if(!i&&o.return)o.return()}finally{if(B)throw F}}return g}return function(f,u){if(Array.isArray(f))return f;else if(Symbol.iterator in Object(f))return d(f,u);else throw TypeError("Invalid attempt to destructure non-iterable instance")}}(),c=v(140).layoutBase.LinkedList,y={};y.getTopMostNodes=function(d){var f={};for(var u=0;u<d.length;u++)f[d[u].id()]=!0;var g=d.filter(function(i,B){if(typeof i==="number")i=B;var F=i.parent()[0];while(F!=null){if(f[F.id()])return!1;F=F.parent()[0]}return!0});return g},y.connectComponents=function(d,f,u,g){var i=new c,B=new Set,F=[],o=void 0,h=void 0,R=void 0,a=!1,P=1,H=[],M=[],j=function(){var x=d.collection();M.push(x);var Y=u[0],Z=d.collection();Z.merge(Y).merge(Y.descendants().intersection(f)),F.push(Y),Z.forEach(function(re){i.push(re),B.add(re),x.merge(re)});var Q=function(){Y=i.shift();var ue=d.collection();Y.neighborhood().nodes().forEach(function(q){if(f.intersection(Y.edgesWith(q)).length>0)ue.merge(q)});for(var Ae=0;Ae<ue.length;Ae++){var Pe=ue[Ae];if(o=u.intersection(Pe.union(Pe.ancestors())),o!=null&&!B.has(o[0])){var de=o.union(o.descendants());de.forEach(function(q){if(i.push(q),B.add(q),x.merge(q),u.has(q))F.push(q)})}}};while(i.length!=0)Q();if(x.forEach(function(re){f.intersection(re.connectedEdges()).forEach(function(ue){if(x.has(ue.source())&&x.has(ue.target()))x.merge(ue)})}),F.length==u.length)a=!0;if(!a||a&&P>1){h=F[0],R=h.connectedEdges().length,F.forEach(function(re){if(re.connectedEdges().length<R)R=re.connectedEdges().length,h=re}),H.push(h.id());var se=d.collection();se.merge(F[0]),F.forEach(function(re){se.merge(re)}),F=[],u=u.difference(se),P++}};do j();while(!a);if(g){if(H.length>0)g.set("dummy"+(g.size+1),H)}return M},y.relocateComponent=function(d,f,u){if(!u.fixedNodeConstraint){var{POSITIVE_INFINITY:g,NEGATIVE_INFINITY:i,POSITIVE_INFINITY:B,NEGATIVE_INFINITY:F}=Number;if(u.quality=="draft"){var o=!0,h=!1,R=void 0;try{for(var a=f.nodeIndexes[Symbol.iterator](),P;!(o=(P=a.next()).done);o=!0){var H=P.value,M=N(H,2),j=M[0],_=M[1],x=u.cy.getElementById(j);if(x){var Y=x.boundingBox(),Z=f.xCoords[_]-Y.w/2,Q=f.xCoords[_]+Y.w/2,se=f.yCoords[_]-Y.h/2,re=f.yCoords[_]+Y.h/2;if(Z<g)g=Z;if(Q>i)i=Q;if(se<B)B=se;if(re>F)F=re}}}catch(q){h=!0,R=q}finally{try{if(!o&&a.return)a.return()}finally{if(h)throw R}}var ue=d.x-(i+g)/2,Ae=d.y-(F+B)/2;f.xCoords=f.xCoords.map(function(q){return q+ue}),f.yCoords=f.yCoords.map(function(q){return q+Ae})}else{Object.keys(f).forEach(function(q){var oe=f[q],Ne=oe.getRect().x,ke=oe.getRect().x+oe.getRect().width,De=oe.getRect().y,xe=oe.getRect().y+oe.getRect().height;if(Ne<g)g=Ne;if(ke>i)i=ke;if(De<B)B=De;if(xe>F)F=xe});var Pe=d.x-(i+g)/2,de=d.y-(F+B)/2;Object.keys(f).forEach(function(q){var oe=f[q];oe.setCenter(oe.getCenterX()+Pe,oe.getCenterY()+de)})}}},y.calcBoundingBox=function(d,f,u,g){var{MAX_SAFE_INTEGER:i,MIN_SAFE_INTEGER:B,MAX_SAFE_INTEGER:F,MIN_SAFE_INTEGER:o}=Number,h=void 0,R=void 0,a=void 0,P=void 0,H=d.descendants().not(":parent"),M=H.length;for(var j=0;j<M;j++){var _=H[j];if(h=f[g.get(_.id())]-_.width()/2,R=f[g.get(_.id())]+_.width()/2,a=u[g.get(_.id())]-_.height()/2,P=u[g.get(_.id())]+_.height()/2,i>h)i=h;if(B<R)B=R;if(F>a)F=a;if(o<P)o=P}var x={};return x.topLeftX=i,x.topLeftY=F,x.width=B-i,x.height=o-F,x},y.calcParentsWithoutChildren=function(d,f){var u=d.collection();return f.nodes(":parent").forEach(function(g){var i=!1;if(g.children().forEach(function(B){if(B.css("display")!="none")i=!0}),!i)u.merge(g)}),u},k.exports=y},816:(k,z,v)=>{var N=v(548),c=v(140).CoSELayout,y=v(140).CoSENode,d=v(140).layoutBase.PointD,f=v(140).layoutBase.DimensionD,u=v(140).layoutBase.LayoutConstants,g=v(140).layoutBase.FDLayoutConstants,i=v(140).CoSEConstants,B=function(o,h){var{cy:R,eles:a}=o,P=a.nodes(),H=a.edges(),M=void 0,j=void 0,_=void 0,x={};if(o.randomize)M=h.nodeIndexes,j=h.xCoords,_=h.yCoords;var Y=function(q){return typeof q==="function"},Z=function(q,oe){if(Y(q))return q(oe);else return q},Q=N.calcParentsWithoutChildren(R,a),se=function de(q,oe,Ne,ke){var De=oe.length;for(var xe=0;xe<De;xe++){var J=oe[xe],Te=null;if(J.intersection(Q).length==0)Te=J.children();var ie=void 0,ve=J.layoutDimensions({nodeDimensionsIncludeLabels:ke.nodeDimensionsIncludeLabels});if(J.outerWidth()!=null&&J.outerHeight()!=null)if(ke.randomize)if(!J.isParent())ie=q.add(new y(Ne.graphManager,new d(j[M.get(J.id())]-ve.w/2,_[M.get(J.id())]-ve.h/2),new f(parseFloat(ve.w),parseFloat(ve.h))));else{var Me=N.calcBoundingBox(J,j,_,M);if(J.intersection(Q).length==0)ie=q.add(new y(Ne.graphManager,new d(Me.topLeftX,Me.topLeftY),new f(Me.width,Me.height)));else ie=q.add(new y(Ne.graphManager,new d(Me.topLeftX,Me.topLeftY),new f(parseFloat(ve.w),parseFloat(ve.h))))}else ie=q.add(new y(Ne.graphManager,new d(J.position("x")-ve.w/2,J.position("y")-ve.h/2),new f(parseFloat(ve.w),parseFloat(ve.h))));else ie=q.add(new y(this.graphManager));if(ie.id=J.data("id"),ie.nodeRepulsion=Z(ke.nodeRepulsion,J),ie.paddingLeft=parseInt(J.css("padding")),ie.paddingTop=parseInt(J.css("padding")),ie.paddingRight=parseInt(J.css("padding")),ie.paddingBottom=parseInt(J.css("padding")),ke.nodeDimensionsIncludeLabels)ie.labelWidth=J.boundingBox({includeLabels:!0,includeNodes:!1,includeOverlays:!1}).w,ie.labelHeight=J.boundingBox({includeLabels:!0,includeNodes:!1,includeOverlays:!1}).h,ie.labelPosVertical=J.css("text-valign"),ie.labelPosHorizontal=J.css("text-halign");if(x[J.data("id")]=ie,isNaN(ie.rect.x))ie.rect.x=0;if(isNaN(ie.rect.y))ie.rect.y=0;if(Te!=null&&Te.length>0){var ze=void 0;ze=Ne.getGraphManager().add(Ne.newGraph(),ie),de(ze,Te,Ne,ke)}}},re=function(q,oe,Ne){var ke=0,De=0;for(var xe=0;xe<Ne.length;xe++){var J=Ne[xe],Te=x[J.data("source")],ie=x[J.data("target")];if(Te&&ie&&Te!==ie&&Te.getEdgesBetween(ie).length==0){var ve=oe.add(q.newEdge(),Te,ie);ve.id=J.id(),ve.idealLength=Z(o.idealEdgeLength,J),ve.edgeElasticity=Z(o.edgeElasticity,J),ke+=ve.idealLength,De++}}if(o.idealEdgeLength!=null){if(De>0)i.DEFAULT_EDGE_LENGTH=g.DEFAULT_EDGE_LENGTH=ke/De;else if(!Y(o.idealEdgeLength))i.DEFAULT_EDGE_LENGTH=g.DEFAULT_EDGE_LENGTH=o.idealEdgeLength;else i.DEFAULT_EDGE_LENGTH=g.DEFAULT_EDGE_LENGTH=50;i.MIN_REPULSION_DIST=g.MIN_REPULSION_DIST=g.DEFAULT_EDGE_LENGTH/10,i.DEFAULT_RADIAL_SEPARATION=g.DEFAULT_EDGE_LENGTH}},ue=function(q,oe){if(oe.fixedNodeConstraint)q.constraints.fixedNodeConstraint=oe.fixedNodeConstraint;if(oe.alignmentConstraint)q.constraints.alignmentConstraint=oe.alignmentConstraint;if(oe.relativePlacementConstraint)q.constraints.relativePlacementConstraint=oe.relativePlacementConstraint};if(o.nestingFactor!=null)i.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=g.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=o.nestingFactor;if(o.gravity!=null)i.DEFAULT_GRAVITY_STRENGTH=g.DEFAULT_GRAVITY_STRENGTH=o.gravity;if(o.numIter!=null)i.MAX_ITERATIONS=g.MAX_ITERATIONS=o.numIter;if(o.gravityRange!=null)i.DEFAULT_GRAVITY_RANGE_FACTOR=g.DEFAULT_GRAVITY_RANGE_FACTOR=o.gravityRange;if(o.gravityCompound!=null)i.DEFAULT_COMPOUND_GRAVITY_STRENGTH=g.DEFAULT_COMPOUND_GRAVITY_STRENGTH=o.gravityCompound;if(o.gravityRangeCompound!=null)i.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=g.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=o.gravityRangeCompound;if(o.initialEnergyOnIncremental!=null)i.DEFAULT_COOLING_FACTOR_INCREMENTAL=g.DEFAULT_COOLING_FACTOR_INCREMENTAL=o.initialEnergyOnIncremental;if(o.tilingCompareBy!=null)i.TILING_COMPARE_BY=o.tilingCompareBy;if(o.quality=="proof")u.QUALITY=2;else u.QUALITY=0;if(i.NODE_DIMENSIONS_INCLUDE_LABELS=g.NODE_DIMENSIONS_INCLUDE_LABELS=u.NODE_DIMENSIONS_INCLUDE_LABELS=o.nodeDimensionsIncludeLabels,i.DEFAULT_INCREMENTAL=g.DEFAULT_INCREMENTAL=u.DEFAULT_INCREMENTAL=!o.randomize,i.ANIMATE=g.ANIMATE=u.ANIMATE=o.animate,i.TILE=o.tile,i.TILING_PADDING_VERTICAL=typeof o.tilingPaddingVertical==="function"?o.tilingPaddingVertical.call():o.tilingPaddingVertical,i.TILING_PADDING_HORIZONTAL=typeof o.tilingPaddingHorizontal==="function"?o.tilingPaddingHorizontal.call():o.tilingPaddingHorizontal,i.DEFAULT_INCREMENTAL=g.DEFAULT_INCREMENTAL=u.DEFAULT_INCREMENTAL=!0,i.PURE_INCREMENTAL=!o.randomize,u.DEFAULT_UNIFORM_LEAF_NODE_SIZES=o.uniformNodeDimensions,o.step=="transformed")i.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,i.ENFORCE_CONSTRAINTS=!1,i.APPLY_LAYOUT=!1;if(o.step=="enforced")i.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,i.ENFORCE_CONSTRAINTS=!0,i.APPLY_LAYOUT=!1;if(o.step=="cose")i.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,i.ENFORCE_CONSTRAINTS=!1,i.APPLY_LAYOUT=!0;if(o.step=="all"){if(o.randomize)i.TRANSFORM_ON_CONSTRAINT_HANDLING=!0;else i.TRANSFORM_ON_CONSTRAINT_HANDLING=!1;i.ENFORCE_CONSTRAINTS=!0,i.APPLY_LAYOUT=!0}if(o.fixedNodeConstraint||o.alignmentConstraint||o.relativePlacementConstraint)i.TREE_REDUCTION_ON_INCREMENTAL=!1;else i.TREE_REDUCTION_ON_INCREMENTAL=!0;var Ae=new c,Pe=Ae.newGraphManager();return se(Pe.addRoot(),N.getTopMostNodes(P),Ae,o),re(Ae,Pe,H),ue(Ae,o),Ae.runLayout(),x};k.exports={coseLayout:B}},212:(k,z,v)=>{var N=function(){function o(h,R){for(var a=0;a<R.length;a++){var P=R[a];if(P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P)P.writable=!0;Object.defineProperty(h,P.key,P)}}return function(h,R,a){if(R)o(h.prototype,R);if(a)o(h,a);return h}}();function c(o,h){if(!(o instanceof h))throw TypeError("Cannot call a class as a function")}var y=v(658),d=v(548),f=v(657),u=f.spectralLayout,g=v(816),i=g.coseLayout,B=Object.freeze({quality:"default",randomize:!0,animate:!0,animationDuration:1000,animationEasing:void 0,fit:!0,padding:30,nodeDimensionsIncludeLabels:!1,uniformNodeDimensions:!1,packComponents:!0,step:"all",samplingType:!0,sampleSize:25,nodeSeparation:75,piTol:0.0000001,nodeRepulsion:function(h){return 4500},idealEdgeLength:function(h){return 50},edgeElasticity:function(h){return 0.45},nestingFactor:0.1,gravity:0.25,numIter:2500,tile:!0,tilingCompareBy:void 0,tilingPaddingVertical:10,tilingPaddingHorizontal:10,gravityRangeCompound:1.5,gravityCompound:1,gravityRange:3.8,initialEnergyOnIncremental:0.3,fixedNodeConstraint:void 0,alignmentConstraint:void 0,relativePlacementConstraint:void 0,ready:function(){},stop:function(){}}),F=function(){function o(h){c(this,o),this.options=y({},B,h)}return N(o,[{key:"run",value:function(){var R=this,a=this.options,{cy:P,eles:H}=a,M=[],j=void 0,_=void 0,x=[],Y=void 0,Z=[];if(a.fixedNodeConstraint&&(!Array.isArray(a.fixedNodeConstraint)||a.fixedNodeConstraint.length==0))a.fixedNodeConstraint=void 0;if(a.alignmentConstraint){if(a.alignmentConstraint.vertical&&(!Array.isArray(a.alignmentConstraint.vertical)||a.alignmentConstraint.vertical.length==0))a.alignmentConstraint.vertical=void 0;if(a.alignmentConstraint.horizontal&&(!Array.isArray(a.alignmentConstraint.horizontal)||a.alignmentConstraint.horizontal.length==0))a.alignmentConstraint.horizontal=void 0}if(a.relativePlacementConstraint&&(!Array.isArray(a.relativePlacementConstraint)||a.relativePlacementConstraint.length==0))a.relativePlacementConstraint=void 0;var Q=a.fixedNodeConstraint||a.alignmentConstraint||a.relativePlacementConstraint;if(Q)a.tile=!1,a.packComponents=!1;var se=void 0,re=!1;if(P.layoutUtilities&&a.packComponents){if(se=P.layoutUtilities("get"),!se)se=P.layoutUtilities();re=!0}if(H.nodes().length>0)if(!re){var ue=a.eles.boundingBox();if(Z.push({x:ue.x1+ue.w/2,y:ue.y1+ue.h/2}),a.randomize){var Ae=u(a);M.push(Ae)}if(a.quality=="default"||a.quality=="proof")x.push(i(a,M[0])),d.relocateComponent(Z[0],x[0],a);else d.relocateComponent(Z[0],M[0],a)}else{var Pe=d.getTopMostNodes(a.eles.nodes());if(Y=d.connectComponents(P,a.eles,Pe),Y.forEach(function(K){var G=K.boundingBox();Z.push({x:G.x1+G.w/2,y:G.y1+G.h/2})}),a.randomize)Y.forEach(function(K){a.eles=K,M.push(u(a))});if(a.quality=="default"||a.quality=="proof"){var de=P.collection();if(a.tile){var q=new Map,oe=[],Ne=[],ke=0,De={nodeIndexes:q,xCoords:oe,yCoords:Ne},xe=[];if(Y.forEach(function(K,G){if(K.edges().length==0)K.nodes().forEach(function(pe,le){if(de.merge(K.nodes()[le]),!pe.isParent())De.nodeIndexes.set(K.nodes()[le].id(),ke++),De.xCoords.push(K.nodes()[0].position().x),De.yCoords.push(K.nodes()[0].position().y)}),xe.push(G)}),de.length>1){var J=de.boundingBox();Z.push({x:J.x1+J.w/2,y:J.y1+J.h/2}),Y.push(de),M.push(De);for(var Te=xe.length-1;Te>=0;Te--)Y.splice(xe[Te],1),M.splice(xe[Te],1),Z.splice(xe[Te],1)}}Y.forEach(function(K,G){a.eles=K,x.push(i(a,M[G])),d.relocateComponent(Z[G],x[G],a)})}else Y.forEach(function(K,G){d.relocateComponent(Z[G],M[G],a)});var ie=new Set;if(Y.length>1){var ve=[],Me=H.filter(function(K){return K.css("display")=="none"});Y.forEach(function(K,G){var pe=void 0;if(a.quality=="draft")pe=M[G].nodeIndexes;if(K.nodes().not(Me).length>0){var le={};le.edges=[],le.nodes=[];var me=void 0;if(K.nodes().not(Me).forEach(function(fe){if(a.quality=="draft")if(!fe.isParent())me=pe.get(fe.id()),le.nodes.push({x:M[G].xCoords[me]-fe.boundingbox().w/2,y:M[G].yCoords[me]-fe.boundingbox().h/2,width:fe.boundingbox().w,height:fe.boundingbox().h});else{var he=d.calcBoundingBox(fe,M[G].xCoords,M[G].yCoords,pe);le.nodes.push({x:he.topLeftX,y:he.topLeftY,width:he.width,height:he.height})}else if(x[G][fe.id()])le.nodes.push({x:x[G][fe.id()].getLeft(),y:x[G][fe.id()].getTop(),width:x[G][fe.id()].getWidth(),height:x[G][fe.id()].getHeight()})}),K.edges().forEach(function(fe){var he=fe.source(),Ee=fe.target();if(he.css("display")!="none"&&Ee.css("display")!="none"){if(a.quality=="draft"){var Be=pe.get(he.id()),et=pe.get(Ee.id()),Oe=[],Ye=[];if(he.isParent()){var We=d.calcBoundingBox(he,M[G].xCoords,M[G].yCoords,pe);Oe.push(We.topLeftX+We.width/2),Oe.push(We.topLeftY+We.height/2)}else Oe.push(M[G].xCoords[Be]),Oe.push(M[G].yCoords[Be]);if(Ee.isParent()){var Je=d.calcBoundingBox(Ee,M[G].xCoords,M[G].yCoords,pe);Ye.push(Je.topLeftX+Je.width/2),Ye.push(Je.topLeftY+Je.height/2)}else Ye.push(M[G].xCoords[et]),Ye.push(M[G].yCoords[et]);le.edges.push({startX:Oe[0],startY:Oe[1],endX:Ye[0],endY:Ye[1]})}else if(x[G][he.id()]&&x[G][Ee.id()])le.edges.push({startX:x[G][he.id()].getCenterX(),startY:x[G][he.id()].getCenterY(),endX:x[G][Ee.id()].getCenterX(),endY:x[G][Ee.id()].getCenterY()})}}),le.nodes.length>0)ve.push(le),ie.add(G)}});var ze=se.packComponents(ve,a.randomize).shifts;if(a.quality=="draft")M.forEach(function(K,G){var pe=K.xCoords.map(function(me){return me+ze[G].dx}),le=K.yCoords.map(function(me){return me+ze[G].dy});K.xCoords=pe,K.yCoords=le});else{var Ke=0;ie.forEach(function(K){Object.keys(x[K]).forEach(function(G){var pe=x[K][G];pe.setCenter(pe.getCenterX()+ze[Ke].dx,pe.getCenterY()+ze[Ke].dy)}),Ke++})}}}var je=function(G,pe){if(a.quality=="default"||a.quality=="proof"){if(typeof G==="number")G=pe;var le=void 0,me=void 0,fe=G.data("id");if(x.forEach(function(Ee){if(fe in Ee)le={x:Ee[fe].getRect().getCenterX(),y:Ee[fe].getRect().getCenterY()},me=Ee[fe]}),a.nodeDimensionsIncludeLabels){if(me.labelWidth){if(me.labelPosHorizontal=="left")le.x+=me.labelWidth/2;else if(me.labelPosHorizontal=="right")le.x-=me.labelWidth/2}if(me.labelHeight){if(me.labelPosVertical=="top")le.y+=me.labelHeight/2;else if(me.labelPosVertical=="bottom")le.y-=me.labelHeight/2}}if(le==null)le={x:G.position("x"),y:G.position("y")};return{x:le.x,y:le.y}}else{var he=void 0;if(M.forEach(function(Ee){var Be=Ee.nodeIndexes.get(G.id());if(Be!=null)he={x:Ee.xCoords[Be],y:Ee.yCoords[Be]}}),he==null)he={x:G.position("x"),y:G.position("y")};return{x:he.x,y:he.y}}};if(a.quality=="default"||a.quality=="proof"||a.randomize){var at=d.calcParentsWithoutChildren(P,H),qe=H.filter(function(K){return K.css("display")=="none"});if(a.eles=H.not(qe),H.nodes().not(":parent").not(qe).layoutPositions(R,a,je),at.length>0)at.forEach(function(K){K.position(je(K))})}else console.log("If randomize option is set to false, then quality option must be 'default' or 'proof'.")}}]),o}();k.exports=F},657:(k,z,v)=>{var N=v(548),c=v(140).layoutBase.Matrix,y=v(140).layoutBase.SVD,d=function(u){var{cy:g,eles:i}=u,B=i.nodes(),F=i.nodes(":parent"),o=new Map,h=new Map,R=new Map,a=[],P=[],H=[],M=[],j=[],_=[],x=[],Y=[],Z=void 0,Q=void 0,se=1e8,re=0.000000001,{piTol:ue,samplingType:Ae,nodeSeparation:Pe}=u,de=void 0,q=function(){var ee=0,te=0,ne=!1;while(te<de){ee=Math.floor(Math.random()*Q),ne=!1;for(var ae=0;ae<te;ae++)if(M[ae]==ee){ne=!0;break}if(!ne)M[te]=ee,te++;else continue}},oe=function(ee,te,ne){var ae=[],we=0,ge=0,ce=0,Le=void 0,be=[],$e=0,_e=1;for(var Ue=0;Ue<Q;Ue++)be[Ue]=se;ae[ge]=ee,be[ee]=0;while(ge>=we){ce=ae[we++];var Xe=a[ce];for(var He=0;He<Xe.length;He++)if(Le=h.get(Xe[He]),be[Le]==se)be[Le]=be[ce]+1,ae[++ge]=Le;_[ce][te]=be[ce]*Pe}if(ne){for(var Ge=0;Ge<Q;Ge++)if(_[Ge][te]<j[Ge])j[Ge]=_[Ge][te];for(var tt=0;tt<Q;tt++)if(j[tt]>$e)$e=j[tt],_e=tt}return _e},Ne=function(ee){var te=void 0;if(!ee){q();for(var ne=0;ne<de;ne++)oe(M[ne],ne,ee,!1)}else{te=Math.floor(Math.random()*Q),Z=te;for(var ae=0;ae<Q;ae++)j[ae]=se;for(var we=0;we<de;we++)M[we]=te,te=oe(te,we,ee)}for(var ge=0;ge<Q;ge++)for(var ce=0;ce<de;ce++)_[ge][ce]*=_[ge][ce];for(var Le=0;Le<de;Le++)x[Le]=[];for(var be=0;be<de;be++)for(var $e=0;$e<de;$e++)x[be][$e]=_[M[$e]][be]},ke=function(){var ee=y.svd(x),{S:te,U:ne,V:ae}=ee,we=te[0]*te[0]*te[0],ge=[];for(var ce=0;ce<de;ce++){ge[ce]=[];for(var Le=0;Le<de;Le++)if(ge[ce][Le]=0,ce==Le)ge[ce][Le]=te[ce]/(te[ce]*te[ce]+we/(te[ce]*te[ce]))}Y=c.multMat(c.multMat(ae,ge),c.transpose(ne))},De=function(){var ee=void 0,te=void 0,ne=[],ae=[],we=[],ge=[];for(var ce=0;ce<Q;ce++)ne[ce]=Math.random(),ae[ce]=Math.random();ne=c.normalize(ne),ae=c.normalize(ae);var Le=0,be=re,$e=re,_e=void 0;while(!0){Le++;for(var Ue=0;Ue<Q;Ue++)we[Ue]=ne[Ue];if(ne=c.multGamma(c.multL(c.multGamma(we),_,Y)),ee=c.dotProduct(we,ne),ne=c.normalize(ne),be=c.dotProduct(we,ne),_e=Math.abs(be/$e),_e<=1+ue&&_e>=1)break;$e=be}for(var Xe=0;Xe<Q;Xe++)we[Xe]=ne[Xe];Le=0,$e=re;while(!0){Le++;for(var He=0;He<Q;He++)ge[He]=ae[He];if(ge=c.minusOp(ge,c.multCons(we,c.dotProduct(we,ge))),ae=c.multGamma(c.multL(c.multGamma(ge),_,Y)),te=c.dotProduct(ge,ae),ae=c.normalize(ae),be=c.dotProduct(ge,ae),_e=Math.abs(be/$e),_e<=1+ue&&_e>=1)break;$e=be}for(var Ge=0;Ge<Q;Ge++)ge[Ge]=ae[Ge];P=c.multCons(we,Math.sqrt(Math.abs(ee))),H=c.multCons(ge,Math.sqrt(Math.abs(te)))};N.connectComponents(g,i,N.getTopMostNodes(B),o),F.forEach(function(ye){N.connectComponents(g,i,N.getTopMostNodes(ye.descendants().intersection(i)),o)});var xe=0;for(var J=0;J<B.length;J++)if(!B[J].isParent())h.set(B[J].id(),xe++);var Te=!0,ie=!1,ve=void 0;try{for(var Me=o.keys()[Symbol.iterator](),ze;!(Te=(ze=Me.next()).done);Te=!0){var Ke=ze.value;h.set(Ke,xe++)}}catch(ye){ie=!0,ve=ye}finally{try{if(!Te&&Me.return)Me.return()}finally{if(ie)throw ve}}for(var je=0;je<h.size;je++)a[je]=[];F.forEach(function(ye){var ee=ye.children().intersection(i);while(ee.nodes(":childless").length==0)ee=ee.nodes()[0].children().intersection(i);var te=0,ne=ee.nodes(":childless")[0].connectedEdges().length;ee.nodes(":childless").forEach(function(ae,we){if(ae.connectedEdges().length<ne)ne=ae.connectedEdges().length,te=we}),R.set(ye.id(),ee.nodes(":childless")[te].id())}),B.forEach(function(ye){var ee=void 0;if(ye.isParent())ee=h.get(R.get(ye.id()));else ee=h.get(ye.id());ye.neighborhood().nodes().forEach(function(te){if(i.intersection(ye.edgesWith(te)).length>0)if(te.isParent())a[ee].push(R.get(te.id()));else a[ee].push(te.id())})});var at=function(ee){var te=h.get(ee),ne=void 0;o.get(ee).forEach(function(ae){if(g.getElementById(ae).isParent())ne=R.get(ae);else ne=ae;a[te].push(ne),a[h.get(ne)].push(ee)})},qe=!0,K=!1,G=void 0;try{for(var pe=o.keys()[Symbol.iterator](),le;!(qe=(le=pe.next()).done);qe=!0){var me=le.value;at(me)}}catch(ye){K=!0,G=ye}finally{try{if(!qe&&pe.return)pe.return()}finally{if(K)throw G}}Q=h.size;var fe=void 0;if(Q>2){de=Q<u.sampleSize?Q:u.sampleSize;for(var he=0;he<Q;he++)_[he]=[];for(var Ee=0;Ee<de;Ee++)Y[Ee]=[];if(u.quality=="draft"||u.step=="all")Ne(Ae),ke(),De(),fe={nodeIndexes:h,xCoords:P,yCoords:H};else h.forEach(function(ye,ee){P.push(g.getElementById(ee).position("x")),H.push(g.getElementById(ee).position("y"))}),fe={nodeIndexes:h,xCoords:P,yCoords:H};return fe}else{var Be=h.keys(),et=g.getElementById(Be.next().value),Oe=et.position(),Ye=et.outerWidth();if(P.push(Oe.x),H.push(Oe.y),Q==2){var We=g.getElementById(Be.next().value),Je=We.outerWidth();P.push(Oe.x+Ye/2+Je/2+u.idealEdgeLength),H.push(Oe.y)}return fe={nodeIndexes:h,xCoords:P,yCoords:H},fe}};k.exports={spectralLayout:d}},579:(k,z,v)=>{var N=v(212),c=function(d){if(!d)return;d("layout","fcose",N)};if(typeof cytoscape<"u")c(cytoscape);k.exports=c},140:(k)=>{k.exports=t}},l={};function w(k){var z=l[k];if(z!==void 0)return z.exports;var v=l[k]={exports:{}};return n[k](v,v.exports,w),v.exports}var m=w(579);return m})()})});var xt=Ce(ut(),1);var gt={L:"left",R:"right",T:"top",B:"bottom"},ht={L:e((t)=>`${t},${t/2} 0,${t} 0,0`,"L"),R:e((t)=>`0,${t/2} ${t},0 ${t},${t}`,"R"),T:e((t)=>`0,0 ${t},0 ${t/2},${t}`,"T"),B:e((t)=>`${t/2},0 ${t},${t} 0,${t}`,"B")},ot={L:e((t,n)=>t-n+2,"L"),R:e((t,n)=>t-2,"R"),T:e((t,n)=>t-n+2,"T"),B:e((t,n)=>t-2,"B")},kt=e(function(t){if(Re(t))return t==="L"?"R":"L";else return t==="T"?"B":"T"},"getOppositeArchitectureDirection"),vt=e(function(t){let n=t;return n==="L"||n==="R"||n==="T"||n==="B"},"isArchitectureDirection"),Re=e(function(t){let n=t;return n==="L"||n==="R"},"isArchitectureDirectionX"),Ve=e(function(t){let n=t;return n==="T"||n==="B"},"isArchitectureDirectionY"),ft=e(function(t,n){let l=Re(t)&&Ve(n),w=Ve(t)&&Re(n);return l||w},"isArchitectureDirectionXY"),Dt=e(function(t){let n=t[0],l=t[1],w=Re(n)&&Ve(l),m=Ve(n)&&Re(l);return w||m},"isArchitecturePairXY"),Rt=e(function(t){return t!=="LL"&&t!=="RR"&&t!=="TT"&&t!=="BB"},"isValidArchitectureDirectionPair"),ct=e(function(t,n){let l=`${t}${n}`;return Rt(l)?l:void 0},"getArchitectureDirectionPair"),Mt=e(function([t,n],l){let w=l[0],m=l[1];if(Re(w))if(Ve(m))return[t+(w==="L"?-1:1),n+(m==="T"?1:-1)];else return[t+(w==="L"?-1:1),n];else if(Re(m))return[t+(m==="L"?1:-1),n+(w==="T"?1:-1)];else return[t,n+(w==="T"?1:-1)]},"shiftPositionByArchitectureDirectionPair"),Ft=e(function(t){if(t==="LT"||t==="TL")return[1,1];else if(t==="BL"||t==="LB")return[1,-1];else if(t==="BR"||t==="RB")return[-1,-1];else return[-1,1]},"getArchitectureDirectionXYFactors"),$t=e(function(t,n){if(ft(t,n))return"bend";else if(Re(t))return"horizontal";return"vertical"},"getArchitectureDirectionAlignment"),Pt=e(function(t){return t.type==="service"},"isArchitectureService"),Ot=e(function(t){return t.type==="junction"},"isArchitectureJunction"),pt=e((t,n)=>{let[l,w]=[t,n].sort();return`${JSON.stringify(l)}-${JSON.stringify(w)}`},"architectureGroupAlignmentKey"),yt=e((t)=>t.data(),"edgeData"),Qe=e((t)=>t.data(),"nodeData"),Gt=D.architecture,Et=class{constructor(){this.nodes=new Map,this.groups=new Map,this.edges=[],this.layoutHints=[],this.registeredIds=new Map,this.elements=new Map,this.diagramId="",this.setAccTitle=S,this.getAccTitle=E,this.setDiagramTitle=I,this.getDiagramTitle=L,this.getAccDescription=A,this.setAccDescription=T,this.clear()}static{e(this,"ArchitectureDB")}setDiagramId(t){this.diagramId=t}getDiagramId(){return this.diagramId}clear(){this.nodes=new Map,this.groups=new Map,this.edges=[],this.layoutHints=[],this.registeredIds=new Map,this.dataStructures=void 0,this.elements=new Map,this.diagramId="",C()}addService({id:t,icon:n,in:l,title:w,iconText:m}){if(this.registeredIds.has(t))throw Error(`The service id [${t}] is already in use by another ${this.registeredIds.get(t)}`);if(l!==void 0){if(t===l)throw Error(`The service [${t}] cannot be placed within itself`);if(!this.registeredIds.has(l))throw Error(`The service [${t}]'s parent does not exist. Please make sure the parent is created before this service`);if(this.registeredIds.get(l)==="node")throw Error(`The service [${t}]'s parent is not a group`)}this.registeredIds.set(t,"node"),this.nodes.set(t,{id:t,type:"service",icon:n,iconText:m,title:w,edges:[],in:l})}getServices(){return[...this.nodes.values()].filter(Pt)}addJunction({id:t,in:n}){if(this.registeredIds.has(t))throw Error(`The junction id [${t}] is already in use by another ${this.registeredIds.get(t)}`);if(n!==void 0){if(t===n)throw Error(`The junction [${t}] cannot be placed within itself`);if(!this.registeredIds.has(n))throw Error(`The junction [${t}]'s parent does not exist. Please make sure the parent is created before this junction`);if(this.registeredIds.get(n)==="node")throw Error(`The junction [${t}]'s parent is not a group`)}this.registeredIds.set(t,"node"),this.nodes.set(t,{id:t,type:"junction",edges:[],in:n})}getJunctions(){return[...this.nodes.values()].filter(Ot)}getNodes(){return[...this.nodes.values()]}getNode(t){return this.nodes.get(t)??null}addGroup({id:t,icon:n,in:l,title:w}){if(this.registeredIds.has(t))throw Error(`The group id [${t}] is already in use by another ${this.registeredIds.get(t)}`);if(l!==void 0){if(t===l)throw Error(`The group [${t}] cannot be placed within itself`);if(!this.registeredIds.has(l))throw Error(`The group [${t}]'s parent does not exist. Please make sure the parent is created before this group`);if(this.registeredIds.get(l)==="node")throw Error(`The group [${t}]'s parent is not a group`)}this.registeredIds.set(t,"group"),this.groups.set(t,{id:t,icon:n,title:w,in:l})}getGroups(){return[...this.groups.values()]}addEdge({lhsId:t,rhsId:n,lhsDir:l,rhsDir:w,lhsInto:m,rhsInto:k,lhsGroup:z,rhsGroup:v,title:N}){if(!vt(l))throw Error(`Invalid direction given for left hand side of edge ${t}--${n}. Expected (L,R,T,B) got ${String(l)}`);if(!vt(w))throw Error(`Invalid direction given for right hand side of edge ${t}--${n}. Expected (L,R,T,B) got ${String(w)}`);if(!this.nodes.has(t)&&!this.groups.has(t))throw Error(`The left-hand id [${t}] does not yet exist. Please create the service/group before declaring an edge to it.`);if(!this.nodes.has(n)&&!this.groups.has(n))throw Error(`The right-hand id [${n}] does not yet exist. Please create the service/group before declaring an edge to it.`);let c=this.nodes.get(t).in,y=this.nodes.get(n).in;if(z&&c&&y&&c==y)throw Error(`The left-hand id [${t}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);if(v&&c&&y&&c==y)throw Error(`The right-hand id [${n}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);let d={lhsId:t,lhsDir:l,lhsInto:m,lhsGroup:z,rhsId:n,rhsDir:w,rhsInto:k,rhsGroup:v,title:N};this.edges.push(d);let f=this.nodes.get(t),u=this.nodes.get(n);if(f&&u)f.edges.push(this.edges[this.edges.length-1]),u.edges.push(this.edges[this.edges.length-1])}getEdges(){return this.edges}addLayoutHint(t){if(t.members.length<2)throw Error(`An align directive requires at least two members; got ${t.members.length}`);let n=new Set;t.members.forEach((l)=>{if(this.registeredIds.get(l)!=="node")throw Error(`align ${t.direction} references [${l}], which is not a service or junction`);if(n.has(l))throw Error(`align ${t.direction} lists [${l}] more than once`);n.add(l)}),this.layoutHints.push(t)}getLayoutHints(){return this.layoutHints}getDataStructures(){if(this.dataStructures===void 0){let t=new Map,n=new Map;for(let[z,v]of this.nodes.entries()){let N=new Map;for(let c of v.edges){let y=this.getNode(c.lhsId)?.in,d=this.getNode(c.rhsId)?.in;if(y&&d&&y!==d){let f=$t(c.lhsDir,c.rhsDir);if(f!=="bend")t.set(pt(y,d),f)}if(c.lhsId===z){let f=ct(c.lhsDir,c.rhsDir);if(f)N.set(f,c.rhsId)}else{let f=ct(c.rhsDir,c.lhsDir);if(f)N.set(f,c.lhsId)}}n.set(z,N)}let l=new Set,w=new Set(n.keys()),m=e((z)=>{let v=new Map([[z,[0,0]]]),N=[z];while(N.length>0){let c=N.shift();if(c){l.add(c),w.delete(c);let y=n.get(c);if(!y)throw Error(`BFS error: adjacency list for id ${c} not found. Please report this as a bug.`);let d=v.get(c);if(!d)throw Error(`BFS error: position for id ${c} not found in spatial map. Please report this as a bug.`);let[f,u]=d;y.forEach((g,i)=>{if(!l.has(g))v.set(g,Mt([f,u],i)),N.push(g)})}}return v},"BFS"),k=[];while(w.size>0){let z=w.values().next().value;k.push(m(z))}this.dataStructures={adjList:n,spatialMaps:k,groupAlignments:t}}return this.dataStructures}setElementForId(t,n){this.elements.set(t,n)}getElementById(t){return this.elements.get(t)}getConfig(){return U({...Gt,...b().architecture})}getConfigField(t){return this.getConfig()[t]}},zt=e((t,n)=>{W(t,n),t.groups.map((l)=>n.addGroup(l)),t.services.map((l)=>n.addService({...l,type:"service"})),t.junctions.map((l)=>n.addJunction({...l,type:"junction"})),t.edges.map((l)=>n.addEdge(l)),t.alignments?.map((l)=>n.addLayoutHint({direction:l.direction,members:[...l.members]}))},"populateDb"),wt={parser:{yy:void 0},parse:e(async(t)=>{let n=await X("architecture",t);r.debug(n);let l=wt.parser?.yy;if(!(l instanceof Et))throw Error("parser.parser?.yy was not a ArchitectureDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");zt(n,l)},"parse")},Bt=e((t)=>`
2
2
  .edge {
3
3
  stroke-width: ${t.archEdgeWidth};
4
4
  stroke: ${t.archEdgeColor};
@@ -29,8 +29,8 @@ import{W}from"./chunk-e5rmr47n.js";import{e,r,D,b,O,mt,C,S,E,T,A,I,L,s,p,q,Bi,In
29
29
  display: -webkit-box;
30
30
  -webkit-box-orient: vertical;
31
31
  }
32
- `,"getStyles"),_t=Bt;function dt(t,n){if(t===0)return n();let l=Math.random,w=t>>>0;Math.random=function(){w=w+1831565813>>>0;let m=w;return m=Math.imul(m^m>>>15,m|1),m^=m+Math.imul(m^m>>>7,m|61),((m^m>>>14)>>>0)/4294967296};try{return n()}finally{Math.random=l}}e(dt,"withSeededRandom");var Ze=e((t)=>`<g><rect width="80" height="80" style="fill: #087ebf; stroke-width: 0px;"/>${t}</g>`,"wrapIcon"),it={prefix:"mermaid-architecture",height:80,width:80,icons:{database:{body:Ze('<path id="b" data-name="4" d="m20,57.86c0,3.94,8.95,7.14,20,7.14s20-3.2,20-7.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><path id="c" data-name="3" d="m20,45.95c0,3.94,8.95,7.14,20,7.14s20-3.2,20-7.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><path id="d" data-name="2" d="m20,34.05c0,3.94,8.95,7.14,20,7.14s20-3.2,20-7.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse id="e" data-name="1" cx="40" cy="22.14" rx="20" ry="7.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="20" y1="57.86" x2="20" y2="22.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="60" y1="57.86" x2="60" y2="22.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/>')},server:{body:Ze('<rect x="17.5" y="17.5" width="45" height="45" rx="2" ry="2" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="17.5" y1="32.5" x2="62.5" y2="32.5" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="17.5" y1="47.5" x2="62.5" y2="47.5" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><g><path d="m56.25,25c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: #fff; stroke-width: 0px;"/><path d="m56.25,25c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: none; stroke: #fff; stroke-miterlimit: 10;"/></g><g><path d="m56.25,40c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: #fff; stroke-width: 0px;"/><path d="m56.25,40c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: none; stroke: #fff; stroke-miterlimit: 10;"/></g><g><path d="m56.25,55c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: #fff; stroke-width: 0px;"/><path d="m56.25,55c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: none; stroke: #fff; stroke-miterlimit: 10;"/></g><g><circle cx="32.5" cy="25" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="27.5" cy="25" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="22.5" cy="25" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/></g><g><circle cx="32.5" cy="40" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="27.5" cy="40" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="22.5" cy="40" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/></g><g><circle cx="32.5" cy="55" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="27.5" cy="55" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="22.5" cy="55" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/></g>')},disk:{body:Ze('<rect x="20" y="15" width="40" height="50" rx="1" ry="1" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="24" cy="19.17" rx=".8" ry=".83" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="56" cy="19.17" rx=".8" ry=".83" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="24" cy="60.83" rx=".8" ry=".83" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="56" cy="60.83" rx=".8" ry=".83" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="40" cy="33.75" rx="14" ry="14.58" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="40" cy="33.75" rx="4" ry="4.17" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><path d="m37.51,42.52l-4.83,13.22c-.26.71-1.1,1.02-1.76.64l-4.18-2.42c-.66-.38-.81-1.26-.33-1.84l9.01-10.8c.88-1.05,2.56-.08,2.09,1.2Z" style="fill: #fff; stroke-width: 0px;"/>')},internet:{body:Ze('<circle cx="40" cy="40" r="22.5" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="40" y1="17.5" x2="40" y2="62.5" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="17.5" y1="40" x2="62.5" y2="40" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><path d="m39.99,17.51c-15.28,11.1-15.28,33.88,0,44.98" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><path d="m40.01,17.51c15.28,11.1,15.28,33.88,0,44.98" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="19.75" y1="30.1" x2="60.25" y2="30.1" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="19.75" y1="49.9" x2="60.25" y2="49.9" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/>')},cloud:{body:Ze('<path d="m65,47.5c0,2.76-2.24,5-5,5H20c-2.76,0-5-2.24-5-5,0-1.87,1.03-3.51,2.56-4.36-.04-.21-.06-.42-.06-.64,0-2.6,2.48-4.74,5.65-4.97,1.65-4.51,6.34-7.76,11.85-7.76.86,0,1.69.08,2.5.23,2.09-1.57,4.69-2.5,7.5-2.5,6.1,0,11.19,4.38,12.28,10.17,2.14.56,3.72,2.51,3.72,4.83,0,.03,0,.07-.01.1,2.29.46,4.01,2.48,4.01,4.9Z" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/>')},unknown:Bi,blank:{body:Ze("")}}},Yt=e(async function(t,n,l,w){let m=l.getConfigField("padding"),k=l.getConfigField("iconSize"),z=k/2,v=k/6,N=v/2;await Promise.all(n.edges().map(async(c)=>{let{source:y,sourceDir:d,sourceArrow:f,sourceGroup:u,target:g,targetDir:i,targetArrow:B,targetGroup:F,label:o}=yt(c),{x:h,y:R}=c[0].sourceEndpoint(),{x:a,y:P}=c[0].midpoint(),{x:H,y:M}=c[0].targetEndpoint(),V=m+4;if(u)if(Re(d))h+=d==="L"?-V:V;else R+=d==="T"?-V:V+18;if(F)if(Re(i))H+=i==="L"?-V:V;else M+=i==="T"?-V:V+18;if(!u&&l.getNode(y)?.type==="junction")if(Re(d))h+=d==="L"?z:-z;else R+=d==="T"?z:-z;if(!F&&l.getNode(g)?.type==="junction")if(Re(i))H+=i==="L"?z:-z;else M+=i==="T"?z:-z;if(c[0]._private.rscratch){let _=t.insert("g");if(_.insert("path").attr("d",`M ${h},${R} L ${a},${P} L${H},${M} `).attr("class","edge").attr("id",`${w}-${Fe(y,g,{prefix:"L"})}`),f){let x=Re(d)?ot[d](h,v):h-N,Y=Ve(d)?ot[d](R,v):R-N;_.insert("polygon").attr("points",ht[d](v)).attr("transform",`translate(${x},${Y})`).attr("class","arrow")}if(B){let x=Re(i)?ot[i](H,v):H-N,Y=Ve(i)?ot[i](M,v):M-N;_.insert("polygon").attr("points",ht[i](v)).attr("transform",`translate(${x},${Y})`).attr("class","arrow")}if(o){let x=!ft(d,i)?Re(d)?"X":"Y":"XY",Y=0;if(x==="X")Y=Math.abs(h-H);else if(x==="Y")Y=Math.abs(R-M)/1.5;else Y=Math.abs(h-H)/2;let Z=_.append("g");if(await Ie(Z,o,{useHtmlLabels:!1,width:Y,classes:"architecture-service-label"},s()),Z.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle"),x==="X")Z.attr("transform","translate("+a+", "+P+")");else if(x==="Y")Z.attr("transform","translate("+a+", "+P+") rotate(-90)");else if(x==="XY"){let Q=ct(d,i);if(Q&&Dt(Q)){let se=Z.node().getBoundingClientRect(),[re,ue]=Ft(Q);Z.attr("dominant-baseline","auto").attr("transform",`rotate(${-1*re*ue*45})`);let Ae=Z.node().getBoundingClientRect();Z.attr("transform",`
32
+ `,"getStyles"),_t=Bt;function dt(t,n){if(t===0)return n();let l=Math.random,w=t>>>0;Math.random=function(){w=w+1831565813>>>0;let m=w;return m=Math.imul(m^m>>>15,m|1),m^=m+Math.imul(m^m>>>7,m|61),((m^m>>>14)>>>0)/4294967296};try{return n()}finally{Math.random=l}}e(dt,"withSeededRandom");var Ze=e((t)=>`<g><rect width="80" height="80" style="fill: #087ebf; stroke-width: 0px;"/>${t}</g>`,"wrapIcon"),it={prefix:"mermaid-architecture",height:80,width:80,icons:{database:{body:Ze('<path id="b" data-name="4" d="m20,57.86c0,3.94,8.95,7.14,20,7.14s20-3.2,20-7.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><path id="c" data-name="3" d="m20,45.95c0,3.94,8.95,7.14,20,7.14s20-3.2,20-7.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><path id="d" data-name="2" d="m20,34.05c0,3.94,8.95,7.14,20,7.14s20-3.2,20-7.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse id="e" data-name="1" cx="40" cy="22.14" rx="20" ry="7.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="20" y1="57.86" x2="20" y2="22.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="60" y1="57.86" x2="60" y2="22.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/>')},server:{body:Ze('<rect x="17.5" y="17.5" width="45" height="45" rx="2" ry="2" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="17.5" y1="32.5" x2="62.5" y2="32.5" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="17.5" y1="47.5" x2="62.5" y2="47.5" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><g><path d="m56.25,25c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: #fff; stroke-width: 0px;"/><path d="m56.25,25c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: none; stroke: #fff; stroke-miterlimit: 10;"/></g><g><path d="m56.25,40c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: #fff; stroke-width: 0px;"/><path d="m56.25,40c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: none; stroke: #fff; stroke-miterlimit: 10;"/></g><g><path d="m56.25,55c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: #fff; stroke-width: 0px;"/><path d="m56.25,55c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: none; stroke: #fff; stroke-miterlimit: 10;"/></g><g><circle cx="32.5" cy="25" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="27.5" cy="25" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="22.5" cy="25" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/></g><g><circle cx="32.5" cy="40" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="27.5" cy="40" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="22.5" cy="40" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/></g><g><circle cx="32.5" cy="55" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="27.5" cy="55" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="22.5" cy="55" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/></g>')},disk:{body:Ze('<rect x="20" y="15" width="40" height="50" rx="1" ry="1" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="24" cy="19.17" rx=".8" ry=".83" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="56" cy="19.17" rx=".8" ry=".83" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="24" cy="60.83" rx=".8" ry=".83" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="56" cy="60.83" rx=".8" ry=".83" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="40" cy="33.75" rx="14" ry="14.58" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="40" cy="33.75" rx="4" ry="4.17" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><path d="m37.51,42.52l-4.83,13.22c-.26.71-1.1,1.02-1.76.64l-4.18-2.42c-.66-.38-.81-1.26-.33-1.84l9.01-10.8c.88-1.05,2.56-.08,2.09,1.2Z" style="fill: #fff; stroke-width: 0px;"/>')},internet:{body:Ze('<circle cx="40" cy="40" r="22.5" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="40" y1="17.5" x2="40" y2="62.5" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="17.5" y1="40" x2="62.5" y2="40" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><path d="m39.99,17.51c-15.28,11.1-15.28,33.88,0,44.98" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><path d="m40.01,17.51c15.28,11.1,15.28,33.88,0,44.98" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="19.75" y1="30.1" x2="60.25" y2="30.1" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="19.75" y1="49.9" x2="60.25" y2="49.9" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/>')},cloud:{body:Ze('<path d="m65,47.5c0,2.76-2.24,5-5,5H20c-2.76,0-5-2.24-5-5,0-1.87,1.03-3.51,2.56-4.36-.04-.21-.06-.42-.06-.64,0-2.6,2.48-4.74,5.65-4.97,1.65-4.51,6.34-7.76,11.85-7.76.86,0,1.69.08,2.5.23,2.09-1.57,4.69-2.5,7.5-2.5,6.1,0,11.19,4.38,12.28,10.17,2.14.56,3.72,2.51,3.72,4.83,0,.03,0,.07-.01.1,2.29.46,4.01,2.48,4.01,4.9Z" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/>')},unknown:Bi,blank:{body:Ze("")}}},Yt=e(async function(t,n,l,w){let m=l.getConfigField("padding"),k=l.getConfigField("iconSize"),z=k/2,v=k/6,N=v/2;await Promise.all(n.edges().map(async(c)=>{let{source:y,sourceDir:d,sourceArrow:f,sourceGroup:u,target:g,targetDir:i,targetArrow:B,targetGroup:F,label:o}=yt(c),{x:h,y:R}=c[0].sourceEndpoint(),{x:a,y:P}=c[0].midpoint(),{x:H,y:M}=c[0].targetEndpoint(),j=m+4;if(u)if(Re(d))h+=d==="L"?-j:j;else R+=d==="T"?-j:j+18;if(F)if(Re(i))H+=i==="L"?-j:j;else M+=i==="T"?-j:j+18;if(!u&&l.getNode(y)?.type==="junction")if(Re(d))h+=d==="L"?z:-z;else R+=d==="T"?z:-z;if(!F&&l.getNode(g)?.type==="junction")if(Re(i))H+=i==="L"?z:-z;else M+=i==="T"?z:-z;if(c[0]._private.rscratch){let _=t.insert("g");if(_.insert("path").attr("d",`M ${h},${R} L ${a},${P} L${H},${M} `).attr("class","edge").attr("id",`${w}-${Fe(y,g,{prefix:"L"})}`),f){let x=Re(d)?ot[d](h,v):h-N,Y=Ve(d)?ot[d](R,v):R-N;_.insert("polygon").attr("points",ht[d](v)).attr("transform",`translate(${x},${Y})`).attr("class","arrow")}if(B){let x=Re(i)?ot[i](H,v):H-N,Y=Ve(i)?ot[i](M,v):M-N;_.insert("polygon").attr("points",ht[i](v)).attr("transform",`translate(${x},${Y})`).attr("class","arrow")}if(o){let x=!ft(d,i)?Re(d)?"X":"Y":"XY",Y=0;if(x==="X")Y=Math.abs(h-H);else if(x==="Y")Y=Math.abs(R-M)/1.5;else Y=Math.abs(h-H)/2;let Z=_.append("g");if(await Ie(Z,o,{useHtmlLabels:!1,width:Y,classes:"architecture-service-label"},s()),Z.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle"),x==="X")Z.attr("transform","translate("+a+", "+P+")");else if(x==="Y")Z.attr("transform","translate("+a+", "+P+") rotate(-90)");else if(x==="XY"){let Q=ct(d,i);if(Q&&Dt(Q)){let se=Z.node().getBoundingClientRect(),[re,ue]=Ft(Q);Z.attr("dominant-baseline","auto").attr("transform",`rotate(${-1*re*ue*45})`);let Ae=Z.node().getBoundingClientRect();Z.attr("transform",`
33
33
  translate(${a}, ${P-se.height/2})
34
34
  translate(${re*Ae.width/2}, ${ue*Ae.height/2})
35
35
  rotate(${-1*re*ue*45}, 0, ${se.height/2})
36
- `)}}}}}))},"drawEdges"),Ut=e(async function(t,n,l,w){let k=l.getConfigField("padding")*0.75,z=l.getConfigField("fontSize"),N=l.getConfigField("iconSize")/2;await Promise.all(n.nodes().map(async(c)=>{let y=Qe(c);if(y.type==="group"){let{h:d,w:f,x1:u,y1:g}=c.boundingBox(),i=t.append("rect");i.attr("id",`${w}-group-${y.id}`).attr("x",u+N).attr("y",g+N).attr("width",f).attr("height",d).attr("class","node-bkg");let B=t.append("g"),F=u,o=g;if(y.icon){let h=B.append("g");h.html(`<g>${await nt(y.icon,{height:k,width:k,fallbackPrefix:it.prefix})}</g>`),h.attr("transform","translate("+(F+N+1)+", "+(o+N+1)+")"),F+=k,o+=z/2-1-2}if(y.label){let h=B.append("g");await Ie(h,y.label,{useHtmlLabels:!1,width:f,classes:"architecture-service-label"},s()),h.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","start").attr("text-anchor","start"),h.attr("transform","translate("+(F+N+4)+", "+(o+N+2)+")")}l.setElementForId(y.id,i)}}))},"drawGroups"),Ht=e(async function(t,n,l,w){let m=s();for(let k of l){let z=n.append("g"),v=t.getConfigField("iconSize");if(k.title){let d=z.append("g");await Ie(d,k.title,{useHtmlLabels:!1,width:v*1.5,classes:"architecture-service-label"},m),d.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle"),d.attr("transform","translate("+v/2+", "+v+")")}let N=z.append("g");if(k.icon)N.html(`<g>${await nt(k.icon,{height:v,width:v,fallbackPrefix:it.prefix})}</g>`);else if(k.iconText){N.html(`<g>${await nt("blank",{height:v,width:v,fallbackPrefix:it.prefix})}</g>`);let u=N.append("g").append("foreignObject").attr("width",v).attr("height",v).append("div").attr("class","node-icon-text").attr("style",`height: ${v}px;`).append("div").html(O(k.iconText,m)),g=parseInt(window.getComputedStyle(u.node(),null).getPropertyValue("font-size").replace(/\D/g,""))??16;u.attr("style",`-webkit-line-clamp: ${Math.floor((v-2)/g)};`)}else N.append("path").attr("class","node-bkg").attr("id",`${w}-node-${k.id}`).attr("d",`M0,${v} V5 Q0,0 5,0 H${v-5} Q${v},0 ${v},5 V${v} Z`);z.attr("id",`${w}-service-${k.id}`).attr("class","architecture-service");let{width:c,height:y}=z.node().getBBox();k.width=c,k.height=y,t.setElementForId(k.id,z)}return 0},"drawServices"),Vt=e(function(t,n,l,w){l.forEach((m)=>{let k=n.append("g"),z=t.getConfigField("iconSize");k.append("g").append("rect").attr("id",`${w}-node-${m.id}`).attr("fill-opacity","0").attr("width",z).attr("height",z),k.attr("class","architecture-junction");let{width:N,height:c}=k._groups[0][0].getBBox();k.width=N,k.height=c,t.setElementForId(m.id,k)})},"drawJunctions");In([{name:it.prefix,icons:it}]);lt.use(xt.default);function Tt(t,n,l){t.forEach((w)=>{n.add({group:"nodes",data:{type:"service",id:w.id,icon:w.icon,label:w.title,parent:w.in,width:l.getConfigField("iconSize"),height:l.getConfigField("iconSize")},classes:"node-service"})})}e(Tt,"addServices");function At(t,n,l){t.forEach((w)=>{n.add({group:"nodes",data:{type:"junction",id:w.id,parent:w.in,width:l.getConfigField("iconSize"),height:l.getConfigField("iconSize")},classes:"node-junction"})})}e(At,"addJunctions");function Lt(t,n){n.nodes().map((l)=>{let w=Qe(l);if(w.type==="group")return;w.x=l.position().x,w.y=l.position().y,t.getElementById(w.id).attr("transform","translate("+(w.x||0)+","+(w.y||0)+")")})}e(Lt,"positionNodes");function Ct(t,n){t.forEach((l)=>{n.add({group:"nodes",data:{type:"group",id:l.id,icon:l.icon,label:l.title,parent:l.in},classes:"node-group"})})}e(Ct,"addGroups");function It(t,n){t.forEach((l)=>{let{lhsId:w,rhsId:m,lhsInto:k,lhsGroup:z,rhsInto:v,lhsDir:N,rhsDir:c,rhsGroup:y,title:d}=l,f=ft(l.lhsDir,l.rhsDir)?"segments":"straight",u={id:`${w}-${m}`,label:d,source:w,sourceDir:N,sourceArrow:k,sourceGroup:z,sourceEndpoint:N==="L"?"0 50%":N==="R"?"100% 50%":N==="T"?"50% 0":"50% 100%",target:m,targetDir:c,targetArrow:v,targetGroup:y,targetEndpoint:c==="L"?"0 50%":c==="R"?"100% 50%":c==="T"?"50% 0":"50% 100%"};n.add({group:"edges",data:u,classes:f})})}e(It,"addEdges");function bt(t,n,l,w=[]){let m=e((f,u)=>{let g=new Map;for(let[i,B]of f.entries()){let F=`${i}`,o=0,h=[...B.entries()];if(h.length===1){g.set(F,h[0][1]);continue}for(let R=0;R<h.length-1;R++)for(let a=R+1;a<h.length;a++){let[P,H]=h[R],[M,V]=h[a];if(l.get(pt(P,M))===u)g.set(F,[...g.get(F)??[],...H,...V]);else if(P==="default"||M==="default")g.set(F,[...g.get(F)??[],...H,...V]);else{let x=`${F}-${o++}`;g.set(x,H);let Y=`${F}-${o++}`;g.set(Y,V)}}}return g},"flattenAlignments"),k=n.map((f)=>{let u=new Map,g=new Map;return f.forEach(([i,B],F)=>{let o=t.getNode(F)?.in??"default",h=u.get(B)??new Map;if(!u.has(B))u.set(B,h);let R=g.get(i)??new Map;if(!g.has(i))g.set(i,R);for(let a of[h,R]){let P=a.get(o)??[];if(!a.has(o))a.set(o,P);P.push(F)}}),{horiz:[...m(u,"horizontal").values()].filter((i)=>i.length>1),vert:[...m(g,"vertical").values()].filter((i)=>i.length>1)}}),[z,v]=k.reduce(([f,u],{horiz:g,vert:i})=>[[...f,...g],[...u,...i]],[[],[]]),N=new Set;w.forEach((f)=>f.members.forEach((u)=>N.add(u)));let c=e((f)=>f.filter((u)=>!u.some((g)=>N.has(g))),"dropOverlapping"),y=c(z),d=c(v);return w.forEach((f)=>{if(f.members.length<2)return;if(f.direction==="row")y.push([...f.members]);else d.push([...f.members])}),{horizontal:y,vertical:d}}e(bt,"getAlignments");function Nt(t,n,l=[]){let w=[],m=n.getConfigField("iconSize"),k=n.getConfigField("idealEdgeLengthMultiplier"),z=k*m,v=new Set;l.forEach((y)=>{for(let d=0;d<y.members.length-1;d++){let f=y.members[d],u=y.members[d+1];if(v.add(`${f}|${u}`),v.add(`${u}|${f}`),y.direction==="row")w.push({left:f,right:u,gap:z});else w.push({top:f,bottom:u,gap:z})}});let N=e((y)=>`${y[0]},${y[1]}`,"posToStr"),c=e((y)=>y.split(",").map((d)=>parseInt(d)),"strToPos");return t.forEach((y)=>{let d=new Map([...y.entries()].map(([i,B])=>[N(B),i])),f=[N([0,0])],u={},g={L:[-1,0],R:[1,0],T:[0,1],B:[0,-1]};while(f.length>0){let i=f.shift();if(i){u[i]=1;let B=d.get(i);if(B){let F=c(i);Object.entries(g).forEach(([o,h])=>{let R=N([F[0]+h[0],F[1]+h[1]]),a=d.get(R);if(a&&!u[R]){if(f.push(R),v.has(`${B}|${a}`))return;w.push({[gt[o]]:a,[gt[kt(o)]]:B,gap:k*m})}})}}}}),w}e(Nt,"getRelativeConstraints");function St(t,n,l,w,m,{spatialMaps:k,groupAlignments:z}){return new Promise((v)=>{let N=p("body").append("div").attr("id","cy").attr("style","display:none"),c=lt({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"straight","source-endpoint":"data(sourceEndpoint)","target-endpoint":"data(targetEndpoint)"}},{selector:"edge[label]",style:{label:"data(label)"}},{selector:"edge.segments",style:{"curve-style":"segments","segment-weights":"0","segment-distances":[0.5],"edge-distances":"endpoints","source-endpoint":"data(sourceEndpoint)","target-endpoint":"data(targetEndpoint)"}},{selector:"node",style:{"compound-sizing-wrt-labels":"include"}},{selector:"node[label]",style:{"text-valign":"bottom","text-halign":"center","font-size":`${m.getConfigField("fontSize")}px`}},{selector:".node-service",style:{label:"data(label)",width:"data(width)",height:"data(height)"}},{selector:".node-junction",style:{width:"data(width)",height:"data(height)"}},{selector:".node-group",style:{padding:`${m.getConfigField("padding")}px`}}],layout:{name:"grid",boundingBox:{x1:0,x2:100,y1:0,y2:100}}});N.remove(),Ct(l,c),Tt(t,c,m),At(n,c,m),It(w,c);let y=m.getLayoutHints(),d=bt(m,k,z,y),f=Nt(k,m,y),u=m.getConfigField("iconSize"),g=m.getConfigField("idealEdgeLengthMultiplier")*u,i=0.5*u,B=m.getConfigField("edgeElasticity"),F=m.getConfigField("seed"),o=c.layout({name:"fcose",quality:"proof",randomize:m.getConfigField("randomize"),nodeSeparation:m.getConfigField("nodeSeparation"),numIter:m.getConfigField("numIter"),styleEnabled:!1,animate:!1,nodeDimensionsIncludeLabels:!1,idealEdgeLength(h){let[R,a]=h.connectedNodes(),{parent:P}=Qe(R),{parent:H}=Qe(a);return P===H?g:i},edgeElasticity(h){let[R,a]=h.connectedNodes(),{parent:P}=Qe(R),{parent:H}=Qe(a);return P===H?B:0.001},alignmentConstraint:d,relativePlacementConstraint:f});o.one("layoutstop",()=>{function h(R,a,P,H){let M,V,{x:_,y:x}=R,{x:Y,y:Z}=a;V=(H-x+(_-P)*(x-Z)/(_-Y))/Math.sqrt(1+Math.pow((x-Z)/(_-Y),2)),M=Math.sqrt(Math.pow(H-x,2)+Math.pow(P-_,2)-Math.pow(V,2));let Q=Math.sqrt(Math.pow(Y-_,2)+Math.pow(Z-x,2));M=M/Q;let se=(Y-_)*(H-x)-(Z-x)*(P-_);switch(!0){case se>=0:se=1;break;case se<0:se=-1;break}let re=(Y-_)*(P-_)+(Z-x)*(H-x);switch(!0){case re>=0:re=1;break;case re<0:re=-1;break}return V=Math.abs(V)*se,M=M*re,{distances:V,weights:M}}e(h,"getSegmentWeights"),c.startBatch();for(let R of Object.values(c.edges()))if(R.data?.()){let{x:a,y:P}=R.source().position(),{x:H,y:M}=R.target().position();if(a!==H&&P!==M){let V=R.sourceEndpoint(),_=R.targetEndpoint(),{sourceDir:x}=yt(R),[Y,Z]=Ve(x)?[V.x,_.y]:[_.x,V.y],{weights:Q,distances:se}=h(V,_,Y,Z);R.style("segment-distances",se),R.style("segment-weights",Q)}}c.endBatch(),dt(F,()=>o.run())});try{dt(F,()=>o.run())}catch(h){if(h instanceof RangeError&&h.message.includes("Invalid array length"))throw Error("Architecture layout failed: a declared `align row|column` directive likely contradicts the edge directions, or two declared alignments overlap on a shared node. Check that the order of members in each `align` chain is consistent with the edges between them, and that no node appears in two `align` directives along the same axis.");throw h}c.ready((h)=>{r.info("Ready",h),v(c)})})}e(St,"layoutArchitecture");var Xt=e(async(t,n,l,w)=>{let m=w.db;m.setDiagramId(n);let k=m.getServices(),z=m.getJunctions(),v=m.getGroups(),N=m.getEdges(),c=m.getDataStructures(),y=q(n),d=y.append("g");d.attr("class","architecture-edges");let f=y.append("g");f.attr("class","architecture-services");let u=y.append("g");u.attr("class","architecture-groups"),await Ht(m,f,k,n),Vt(m,f,z,n);let g=await St(k,z,v,N,m,c);await Yt(d,g,m,n),await Ut(u,g,m,n),Lt(m,g),mt(void 0,y,m.getConfigField("padding"),m.getConfigField("useMaxWidth"))},"draw"),jt={draw:Xt},ar={parser:wt,get db(){return new Et},renderer:jt,styles:_t};export{ar as diagram};
36
+ `)}}}}}))},"drawEdges"),Ut=e(async function(t,n,l,w){let k=l.getConfigField("padding")*0.75,z=l.getConfigField("fontSize"),N=l.getConfigField("iconSize")/2;await Promise.all(n.nodes().map(async(c)=>{let y=Qe(c);if(y.type==="group"){let{h:d,w:f,x1:u,y1:g}=c.boundingBox(),i=t.append("rect");i.attr("id",`${w}-group-${y.id}`).attr("x",u+N).attr("y",g+N).attr("width",f).attr("height",d).attr("class","node-bkg");let B=t.append("g"),F=u,o=g;if(y.icon){let h=B.append("g");h.html(`<g>${await nt(y.icon,{height:k,width:k,fallbackPrefix:it.prefix})}</g>`),h.attr("transform","translate("+(F+N+1)+", "+(o+N+1)+")"),F+=k,o+=z/2-1-2}if(y.label){let h=B.append("g");await Ie(h,y.label,{useHtmlLabels:!1,width:f,classes:"architecture-service-label"},s()),h.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","start").attr("text-anchor","start"),h.attr("transform","translate("+(F+N+4)+", "+(o+N+2)+")")}l.setElementForId(y.id,i)}}))},"drawGroups"),Ht=e(async function(t,n,l,w){let m=s();for(let k of l){let z=n.append("g"),v=t.getConfigField("iconSize");if(k.title){let d=z.append("g");await Ie(d,k.title,{useHtmlLabels:!1,width:v*1.5,classes:"architecture-service-label"},m),d.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle"),d.attr("transform","translate("+v/2+", "+v+")")}let N=z.append("g");if(k.icon)N.html(`<g>${await nt(k.icon,{height:v,width:v,fallbackPrefix:it.prefix})}</g>`);else if(k.iconText){N.html(`<g>${await nt("blank",{height:v,width:v,fallbackPrefix:it.prefix})}</g>`);let u=N.append("g").append("foreignObject").attr("width",v).attr("height",v).append("div").attr("class","node-icon-text").attr("style",`height: ${v}px;`).append("div").html(O(k.iconText,m)),g=parseInt(window.getComputedStyle(u.node(),null).getPropertyValue("font-size").replace(/\D/g,""))??16;u.attr("style",`-webkit-line-clamp: ${Math.floor((v-2)/g)};`)}else N.append("path").attr("class","node-bkg").attr("id",`${w}-node-${k.id}`).attr("d",`M0,${v} V5 Q0,0 5,0 H${v-5} Q${v},0 ${v},5 V${v} Z`);z.attr("id",`${w}-service-${k.id}`).attr("class","architecture-service");let{width:c,height:y}=z.node().getBBox();k.width=c,k.height=y,t.setElementForId(k.id,z)}return 0},"drawServices"),Vt=e(function(t,n,l,w){l.forEach((m)=>{let k=n.append("g"),z=t.getConfigField("iconSize");k.append("g").append("rect").attr("id",`${w}-node-${m.id}`).attr("fill-opacity","0").attr("width",z).attr("height",z),k.attr("class","architecture-junction");let{width:N,height:c}=k._groups[0][0].getBBox();k.width=N,k.height=c,t.setElementForId(m.id,k)})},"drawJunctions");In([{name:it.prefix,icons:it}]);lt.use(xt.default);function Tt(t,n,l){t.forEach((w)=>{n.add({group:"nodes",data:{type:"service",id:w.id,icon:w.icon,label:w.title,parent:w.in,width:l.getConfigField("iconSize"),height:l.getConfigField("iconSize")},classes:"node-service"})})}e(Tt,"addServices");function At(t,n,l){t.forEach((w)=>{n.add({group:"nodes",data:{type:"junction",id:w.id,parent:w.in,width:l.getConfigField("iconSize"),height:l.getConfigField("iconSize")},classes:"node-junction"})})}e(At,"addJunctions");function Lt(t,n){n.nodes().map((l)=>{let w=Qe(l);if(w.type==="group")return;w.x=l.position().x,w.y=l.position().y,t.getElementById(w.id).attr("transform","translate("+(w.x||0)+","+(w.y||0)+")")})}e(Lt,"positionNodes");function Ct(t,n){t.forEach((l)=>{n.add({group:"nodes",data:{type:"group",id:l.id,icon:l.icon,label:l.title,parent:l.in},classes:"node-group"})})}e(Ct,"addGroups");function It(t,n){t.forEach((l)=>{let{lhsId:w,rhsId:m,lhsInto:k,lhsGroup:z,rhsInto:v,lhsDir:N,rhsDir:c,rhsGroup:y,title:d}=l,f=ft(l.lhsDir,l.rhsDir)?"segments":"straight",u={id:`${w}-${m}`,label:d,source:w,sourceDir:N,sourceArrow:k,sourceGroup:z,sourceEndpoint:N==="L"?"0 50%":N==="R"?"100% 50%":N==="T"?"50% 0":"50% 100%",target:m,targetDir:c,targetArrow:v,targetGroup:y,targetEndpoint:c==="L"?"0 50%":c==="R"?"100% 50%":c==="T"?"50% 0":"50% 100%"};n.add({group:"edges",data:u,classes:f})})}e(It,"addEdges");function bt(t,n,l,w=[]){let m=e((f,u)=>{let g=new Map;for(let[i,B]of f.entries()){let F=`${i}`,o=0,h=[...B.entries()];if(h.length===1){g.set(F,h[0][1]);continue}for(let R=0;R<h.length-1;R++)for(let a=R+1;a<h.length;a++){let[P,H]=h[R],[M,j]=h[a];if(l.get(pt(P,M))===u)g.set(F,[...g.get(F)??[],...H,...j]);else if(P==="default"||M==="default")g.set(F,[...g.get(F)??[],...H,...j]);else{let x=`${F}-${o++}`;g.set(x,H);let Y=`${F}-${o++}`;g.set(Y,j)}}}return g},"flattenAlignments"),k=n.map((f)=>{let u=new Map,g=new Map;return f.forEach(([i,B],F)=>{let o=t.getNode(F)?.in??"default",h=u.get(B)??new Map;if(!u.has(B))u.set(B,h);let R=g.get(i)??new Map;if(!g.has(i))g.set(i,R);for(let a of[h,R]){let P=a.get(o)??[];if(!a.has(o))a.set(o,P);P.push(F)}}),{horiz:[...m(u,"horizontal").values()].filter((i)=>i.length>1),vert:[...m(g,"vertical").values()].filter((i)=>i.length>1)}}),[z,v]=k.reduce(([f,u],{horiz:g,vert:i})=>[[...f,...g],[...u,...i]],[[],[]]),N=new Set;w.forEach((f)=>f.members.forEach((u)=>N.add(u)));let c=e((f)=>f.filter((u)=>!u.some((g)=>N.has(g))),"dropOverlapping"),y=c(z),d=c(v);return w.forEach((f)=>{if(f.members.length<2)return;if(f.direction==="row")y.push([...f.members]);else d.push([...f.members])}),{horizontal:y,vertical:d}}e(bt,"getAlignments");function Nt(t,n,l=[]){let w=[],m=n.getConfigField("iconSize"),k=n.getConfigField("idealEdgeLengthMultiplier"),z=k*m,v=new Set;l.forEach((y)=>{for(let d=0;d<y.members.length-1;d++){let f=y.members[d],u=y.members[d+1];if(v.add(`${f}|${u}`),v.add(`${u}|${f}`),y.direction==="row")w.push({left:f,right:u,gap:z});else w.push({top:f,bottom:u,gap:z})}});let N=e((y)=>`${y[0]},${y[1]}`,"posToStr"),c=e((y)=>y.split(",").map((d)=>parseInt(d)),"strToPos");return t.forEach((y)=>{let d=new Map([...y.entries()].map(([i,B])=>[N(B),i])),f=[N([0,0])],u={},g={L:[-1,0],R:[1,0],T:[0,1],B:[0,-1]};while(f.length>0){let i=f.shift();if(i){u[i]=1;let B=d.get(i);if(B){let F=c(i);Object.entries(g).forEach(([o,h])=>{let R=N([F[0]+h[0],F[1]+h[1]]),a=d.get(R);if(a&&!u[R]){if(f.push(R),v.has(`${B}|${a}`))return;w.push({[gt[o]]:a,[gt[kt(o)]]:B,gap:k*m})}})}}}}),w}e(Nt,"getRelativeConstraints");function St(t,n,l,w,m,{spatialMaps:k,groupAlignments:z}){return new Promise((v)=>{let N=p("body").append("div").attr("id","cy").attr("style","display:none"),c=lt({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"straight","source-endpoint":"data(sourceEndpoint)","target-endpoint":"data(targetEndpoint)"}},{selector:"edge[label]",style:{label:"data(label)"}},{selector:"edge.segments",style:{"curve-style":"segments","segment-weights":"0","segment-distances":[0.5],"edge-distances":"endpoints","source-endpoint":"data(sourceEndpoint)","target-endpoint":"data(targetEndpoint)"}},{selector:"node",style:{"compound-sizing-wrt-labels":"include"}},{selector:"node[label]",style:{"text-valign":"bottom","text-halign":"center","font-size":`${m.getConfigField("fontSize")}px`}},{selector:".node-service",style:{label:"data(label)",width:"data(width)",height:"data(height)"}},{selector:".node-junction",style:{width:"data(width)",height:"data(height)"}},{selector:".node-group",style:{padding:`${m.getConfigField("padding")}px`}}],layout:{name:"grid",boundingBox:{x1:0,x2:100,y1:0,y2:100}}});N.remove(),Ct(l,c),Tt(t,c,m),At(n,c,m),It(w,c);let y=m.getLayoutHints(),d=bt(m,k,z,y),f=Nt(k,m,y),u=m.getConfigField("iconSize"),g=m.getConfigField("idealEdgeLengthMultiplier")*u,i=0.5*u,B=m.getConfigField("edgeElasticity"),F=m.getConfigField("seed"),o=c.layout({name:"fcose",quality:"proof",randomize:m.getConfigField("randomize"),nodeSeparation:m.getConfigField("nodeSeparation"),numIter:m.getConfigField("numIter"),styleEnabled:!1,animate:!1,nodeDimensionsIncludeLabels:!1,idealEdgeLength(h){let[R,a]=h.connectedNodes(),{parent:P}=Qe(R),{parent:H}=Qe(a);return P===H?g:i},edgeElasticity(h){let[R,a]=h.connectedNodes(),{parent:P}=Qe(R),{parent:H}=Qe(a);return P===H?B:0.001},alignmentConstraint:d,relativePlacementConstraint:f});o.one("layoutstop",()=>{function h(R,a,P,H){let M,j,{x:_,y:x}=R,{x:Y,y:Z}=a;j=(H-x+(_-P)*(x-Z)/(_-Y))/Math.sqrt(1+Math.pow((x-Z)/(_-Y),2)),M=Math.sqrt(Math.pow(H-x,2)+Math.pow(P-_,2)-Math.pow(j,2));let Q=Math.sqrt(Math.pow(Y-_,2)+Math.pow(Z-x,2));M=M/Q;let se=(Y-_)*(H-x)-(Z-x)*(P-_);switch(!0){case se>=0:se=1;break;case se<0:se=-1;break}let re=(Y-_)*(P-_)+(Z-x)*(H-x);switch(!0){case re>=0:re=1;break;case re<0:re=-1;break}return j=Math.abs(j)*se,M=M*re,{distances:j,weights:M}}e(h,"getSegmentWeights"),c.startBatch();for(let R of Object.values(c.edges()))if(R.data?.()){let{x:a,y:P}=R.source().position(),{x:H,y:M}=R.target().position();if(a!==H&&P!==M){let j=R.sourceEndpoint(),_=R.targetEndpoint(),{sourceDir:x}=yt(R),[Y,Z]=Ve(x)?[j.x,_.y]:[_.x,j.y],{weights:Q,distances:se}=h(j,_,Y,Z);R.style("segment-distances",se),R.style("segment-weights",Q)}}c.endBatch(),dt(F,()=>o.run())});try{dt(F,()=>o.run())}catch(h){if(h instanceof RangeError&&h.message.includes("Invalid array length"))throw Error("Architecture layout failed: a declared `align row|column` directive likely contradicts the edge directions, or two declared alignments overlap on a shared node. Check that the order of members in each `align` chain is consistent with the edges between them, and that no node appears in two `align` directives along the same axis.");throw h}c.ready((h)=>{r.info("Ready",h),v(c)})})}e(St,"layoutArchitecture");var Xt=e(async(t,n,l,w)=>{let m=w.db;m.setDiagramId(n);let k=m.getServices(),z=m.getJunctions(),v=m.getGroups(),N=m.getEdges(),c=m.getDataStructures(),y=V(n),d=y.append("g");d.attr("class","architecture-edges");let f=y.append("g");f.attr("class","architecture-services");let u=y.append("g");u.attr("class","architecture-groups"),await Ht(m,f,k,n),Vt(m,f,z,n);let g=await St(k,z,v,N,m,c);await Yt(d,g,m,n),await Ut(u,g,m,n),Lt(m,g),mt(void 0,y,m.getConfigField("padding"),m.getConfigField("useMaxWidth"))},"draw"),jt={draw:Xt},ar={parser:wt,get db(){return new Et},renderer:jt,styles:_t};export{ar as diagram};
@@ -1,2 +1,2 @@
1
- import{a,v,t,n,_,l,Z,ce,Jn}from"./chunk-32ezm0ry.js";var u=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],s=l("code-xml",u);function Fr(e){let o=_();o.useTheme();let[m,c]=a("preview"),r=e.streaming&&!e.rendered,d=!e.streaming&&!e.rendered&&Boolean(e.error),i=m==="code"||r;return n(o.Panel,{"aria-label":e.title,"data-render-pending":e.pending&&!d?"true":void 0,className:"group/graph relative my-4 font-sans not-italic first:mt-0 last:mb-0",children:[t("div",{role:"toolbar","aria-label":`${e.title}操作`,className:r?"absolute top-2 right-2 z-10 flex items-center":o.style("surface.toolbarFloating","absolute top-2 right-2 z-10 opacity-0 transition-opacity duration-150 group-hover/graph:opacity-100 focus-within:opacity-100 [@media(hover:none)]:opacity-70"),children:r?n("span",{className:o.style("control.badge","gap-1.5 rounded-full px-2 py-0.5 text-[11px]"),children:[t(ce,{className:"size-3 animate-spin"}),"生成",e.title]}):n(v,{children:[t("button",{type:"button","aria-label":i?"查看图表":"查看代码",title:i?"查看图表":"查看代码",onClick:()=>c(i?"preview":"code"),className:"flex size-6 items-center justify-center rounded-md text-dim hover:bg-raised hover:text-ink [&_svg]:size-3.5",children:i?t(Jn,{}):t(s,{})}),t(o.CopyButton,{text:e.code,size:"icon-sm",label:"复制代码"})]})}),i&&t(o.Code,{code:e.code,lang:e.codeLang,className:"px-4 py-3"}),d&&!i&&n("div",{role:"alert",className:"flex flex-col items-center gap-2 px-4 py-8 text-center",children:[t(Z,{className:"size-5 text-warning"}),t("p",{className:"max-w-full text-xs break-words text-dim",children:e.error}),t("button",{type:"button",onClick:()=>c("code"),className:"text-xs text-accent-strong underline underline-offset-2",children:"查看代码"})]}),t("div",{hidden:i||d,children:e.children})]})}
1
+ import{a,v,t,n,_,l,Z,ue,Jn}from"./chunk-aqm3spxt.js";var u=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],s=l("code-xml",u);function Fr(e){let o=_();o.useTheme();let[m,c]=a("preview"),r=e.streaming&&!e.rendered,d=!e.streaming&&!e.rendered&&Boolean(e.error),i=m==="code"||r;return n(o.Panel,{"aria-label":e.title,"data-render-pending":e.pending&&!d?"true":void 0,className:"group/graph relative my-4 font-sans not-italic first:mt-0 last:mb-0",children:[t("div",{role:"toolbar","aria-label":`${e.title}操作`,className:r?"absolute top-2 right-2 z-10 flex items-center":o.style("surface.toolbarFloating","absolute top-2 right-2 z-10 opacity-0 transition-opacity duration-150 group-hover/graph:opacity-100 focus-within:opacity-100 [@media(hover:none)]:opacity-70"),children:r?n("span",{className:o.style("control.badge","gap-1.5 rounded-full px-2 py-0.5 text-[11px]"),children:[t(ue,{className:"size-3 animate-spin"}),"生成",e.title]}):n(v,{children:[t("button",{type:"button","aria-label":i?"查看图表":"查看代码",title:i?"查看图表":"查看代码",onClick:()=>c(i?"preview":"code"),className:"flex size-6 items-center justify-center rounded-md text-dim hover:bg-raised hover:text-ink [&_svg]:size-3.5",children:i?t(Jn,{}):t(s,{})}),t(o.CopyButton,{text:e.code,size:"icon-sm",label:"复制代码"})]})}),i&&t(o.Code,{code:e.code,lang:e.codeLang,className:"px-4 py-3"}),d&&!i&&n("div",{role:"alert",className:"flex flex-col items-center gap-2 px-4 py-8 text-center",children:[t(Z,{className:"size-5 text-warning"}),t("p",{className:"max-w-full text-xs break-words text-dim",children:e.error}),t("button",{type:"button",onClick:()=>c("code"),className:"text-xs text-accent-strong underline underline-offset-2",children:"查看代码"})]}),t("div",{hidden:i||d,children:e.children})]})}
2
2
  export{Fr};