@bkm016/basalt 0.1.4 → 0.1.6

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 (288) hide show
  1. package/README.md +61 -11
  2. package/{chunk-y648fzx0.js → chunk-0039s4jt.js} +3 -3
  3. package/{chunk-rmj5b73e.js → chunk-053vb71h.js} +1 -1
  4. package/{chunk-whvj83b7.js → chunk-063vbmtp.js} +2 -2
  5. package/{chunk-7tbya5b5.js → chunk-0javrjcm.js} +22 -22
  6. package/{chunk-y7nma9rk.js → chunk-10p3mb40.js} +2 -2
  7. package/{chunk-jk25nt60.js → chunk-39vwrg8n.js} +2 -2
  8. package/chunk-3k627vf2.js +3 -0
  9. package/{chunk-q7t30zz2.js → chunk-6kdgk70p.js} +5 -5
  10. package/{chunk-3x94302m.js → chunk-6ptv4g5e.js} +3 -3
  11. package/chunk-75434aay.js +2 -0
  12. package/{chunk-2zp1mv3q.js → chunk-7hr6zw2m.js} +1 -1
  13. package/{chunk-g2t6t8fk.js → chunk-7jezts2n.js} +2 -2
  14. package/{chunk-y58ygzn9.js → chunk-818nd6s1.js} +3 -3
  15. package/{chunk-k23t7vhs.js → chunk-8gw5bvh3.js} +5 -5
  16. package/{chunk-vv7fp27r.js → chunk-8mezk0cb.js} +2 -2
  17. package/{chunk-zggzfa7j.js → chunk-8saewt61.js} +2 -2
  18. package/{chunk-362g64pd.js → chunk-8wj32837.js} +1 -1
  19. package/{chunk-fjtvjrkg.js → chunk-8wv5t0w6.js} +5 -5
  20. package/{chunk-vk1gxk1t.js → chunk-8x21n7y9.js} +1 -1
  21. package/chunk-a0c989ky.js +2 -0
  22. package/{chunk-4w17tzp5.js → chunk-a5apjjcn.js} +12 -12
  23. package/chunk-a81p46j7.js +2 -0
  24. package/chunk-agsfy9w7.js +2 -0
  25. package/{chunk-fw2bpqmw.js → chunk-arcqjt91.js} +1 -1
  26. package/chunk-bdy4jksd.js +2 -0
  27. package/{chunk-qe0teyn1.js → chunk-benrzwea.js} +1 -1
  28. package/{chunk-0y7ne3d0.js → chunk-bwawt15q.js} +2 -2
  29. package/{chunk-pxsrqrd0.js → chunk-c4qr1f41.js} +2 -2
  30. package/{chunk-981f9dw8.js → chunk-c7rcw9fb.js} +6 -6
  31. package/{chunk-cjc90f84.js → chunk-ca982n62.js} +3 -3
  32. package/chunk-d20p02ny.js +2 -0
  33. package/{chunk-97rzj7f6.js → chunk-d6p2hgxh.js} +1 -1
  34. package/{chunk-k6w6y71k.js → chunk-dnx91jrd.js} +2 -2
  35. package/{chunk-8d46jtbj.js → chunk-dpz4hwqb.js} +2 -2
  36. package/{chunk-aky4tztg.js → chunk-ebpyvs1d.js} +2 -2
  37. package/{chunk-m40gxwq4.js → chunk-ecf896fz.js} +3 -3
  38. package/{chunk-pjyn2s97.js → chunk-ejsneb6f.js} +1 -1
  39. package/{chunk-pbcy6zdt.js → chunk-ey15ye2h.js} +1 -1
  40. package/{chunk-kp22kaez.js → chunk-f156y565.js} +2 -2
  41. package/{chunk-9rmqgc3c.js → chunk-f544p9rh.js} +15 -15
  42. package/chunk-fmq3zwzk.js +2 -0
  43. package/{chunk-em187cy3.js → chunk-fx7f4m3c.js} +2 -2
  44. package/{chunk-r7fpkb49.js → chunk-g0t9c3gv.js} +1 -1
  45. package/{chunk-mvfsxdx6.js → chunk-gv7wqkey.js} +10 -10
  46. package/chunk-hksqjts3.js +3884 -0
  47. package/{chunk-ztsjgssj.js → chunk-j7yvh0ae.js} +1 -1
  48. package/chunk-kns4kv7b.js +3 -0
  49. package/{chunk-nmca5h6m.js → chunk-n85qs7cs.js} +1 -1
  50. package/{chunk-8wc8qdx8.js → chunk-n981vx1t.js} +6 -6
  51. package/{chunk-3ct2tkr8.js → chunk-npez1492.js} +2 -2
  52. package/{chunk-t6zs4kw0.js → chunk-peja51xv.js} +2 -2
  53. package/{chunk-r0scgfwx.js → chunk-pg5nkf1y.js} +2 -2
  54. package/{chunk-7afmgncg.js → chunk-prgm07j4.js} +1 -1
  55. package/{chunk-jwdb0ccj.js → chunk-q9dd6fhj.js} +3 -3
  56. package/{chunk-ykens1hy.js → chunk-r8vvcp6c.js} +1 -1
  57. package/chunk-rfb85nj7.js +2 -0
  58. package/{chunk-ev6yvy5y.js → chunk-rfdt992v.js} +15 -15
  59. package/{chunk-xfvvh1s5.js → chunk-s6dejhfj.js} +1 -1
  60. package/{chunk-xh3vr5vz.js → chunk-s7skpgm2.js} +1 -1
  61. package/chunk-tgfbtehh.js +480 -0
  62. package/{chunk-m8vkwdgr.js → chunk-w67dvqtb.js} +4 -4
  63. package/{chunk-f3xadvab.js → chunk-whj87h4r.js} +2 -2
  64. package/{chunk-2hbfk5xd.js → chunk-wnzvnskb.js} +2 -2
  65. package/{chunk-vexrrw1b.js → chunk-xtq1xpq0.js} +2 -2
  66. package/{chunk-1vd0f74z.js → chunk-y8dkfpmj.js} +5 -5
  67. package/{chunk-shadcb9z.js → chunk-z02sj1je.js} +2 -2
  68. package/{chunk-akr0a8nc.js → chunk-zxkq9m8e.js} +1 -1
  69. package/compiled.js +12 -12
  70. package/package.json +1 -1
  71. package/ui-test-worker.js +32 -32
  72. package/web/{chunk-t4c8xavd.js → chunk-03dmzvaq.js} +7 -7
  73. package/web/{chunk-n8sky2q6.js → chunk-07agqp8h.js} +1 -1
  74. package/web/chunk-0fgaepwm.js +3 -0
  75. package/web/chunk-0gg00f86.js +292 -0
  76. package/web/chunk-0pecj6d7.js +1 -0
  77. package/web/{chunk-ts7zrf5b.js → chunk-0whceqes.js} +2 -2
  78. package/web/chunk-0wt1dgny.js +1 -0
  79. package/web/{chunk-sfg2wkhe.js → chunk-12xxh71x.js} +6 -6
  80. package/web/chunk-1ves7sq5.js +1 -0
  81. package/web/chunk-1yj79b48.js +1 -0
  82. package/web/chunk-296hgy6k.js +370 -0
  83. package/web/{chunk-f4tacm06.js → chunk-2bmq1whf.js} +1 -1
  84. package/web/chunk-2wqxhqr9.js +1 -0
  85. package/web/{chunk-2j4m0bh1.js → chunk-30b33r2w.js} +2 -2
  86. package/web/{chunk-sspfxp5e.js → chunk-30zfw7zg.js} +1 -1
  87. package/web/chunk-39ng8zwx.css +1 -0
  88. package/web/chunk-3de552rg.js +70 -0
  89. package/web/chunk-3nbzj48p.js +36 -0
  90. package/web/{chunk-0z0y25zf.js → chunk-3zebd9fq.js} +3 -3
  91. package/web/chunk-4r1n98zx.js +2 -0
  92. package/web/chunk-59678wmg.js +1 -0
  93. package/web/{chunk-ds7srg4p.js → chunk-5nda24gv.js} +1 -1
  94. package/web/chunk-5v44qv67.js +303 -0
  95. package/web/chunk-5wdk97mk.js +4 -0
  96. package/web/chunk-64rafq66.js +78 -0
  97. package/web/chunk-6bwgdvf6.js +1 -0
  98. package/web/chunk-6kkw9ptc.js +1 -0
  99. package/web/chunk-718mr5gc.js +2 -0
  100. package/web/chunk-7hs57qdr.js +1 -0
  101. package/web/chunk-7kp237t3.js +106 -0
  102. package/web/chunk-86p42kym.js +1 -0
  103. package/web/chunk-8n79cqyd.js +1 -0
  104. package/web/chunk-8r0s8tx7.js +1 -0
  105. package/web/chunk-96v2avmw.js +40 -0
  106. package/web/chunk-9an6wcnr.js +1 -0
  107. package/web/{chunk-5z4jcqct.js → chunk-9c1yt2ex.js} +20 -20
  108. package/web/chunk-9w5tf22s.js +1 -0
  109. package/web/{chunk-pws2seas.js → chunk-a7gtb4kg.js} +19 -19
  110. package/web/chunk-ahztazsg.js +1 -0
  111. package/web/chunk-b985y17w.js +2 -0
  112. package/web/chunk-bz2v64xe.js +1 -0
  113. package/web/{chunk-n1dmrz44.js → chunk-c01176kn.js} +2 -2
  114. package/web/chunk-c3nn0vvc.js +1 -0
  115. package/web/chunk-cb2rxtq9.js +2 -0
  116. package/web/{chunk-b1bgzz66.js → chunk-ck8rr0sr.js} +1 -1
  117. package/web/{chunk-aqfpnhmt.js → chunk-cktmyc13.js} +19 -19
  118. package/web/{chunk-rvrf0f3h.js → chunk-cm92fyr3.js} +2 -2
  119. package/web/chunk-cwtn2kdm.js +1 -0
  120. package/web/chunk-czq1yz51.js +99 -0
  121. package/web/chunk-d22wq71s.js +1 -0
  122. package/web/{chunk-pjkdrgm0.js → chunk-d4z2rgpx.js} +1 -1
  123. package/web/{chunk-hvw3gn2a.js → chunk-d6tbw8br.js} +20 -20
  124. package/web/{chunk-cg3jterp.js → chunk-d9wdsjkk.js} +2 -2
  125. package/web/{chunk-ttg6tbwx.js → chunk-da7m1kva.js} +2 -2
  126. package/web/chunk-dpkyygej.js +1 -0
  127. package/web/{chunk-0b47eyrf.js → chunk-dwajwrpk.js} +1 -1
  128. package/web/chunk-et5ess72.js +1 -0
  129. package/web/chunk-ez8b6neq.js +1 -0
  130. package/web/{chunk-bhsaj6qq.js → chunk-f5txt81n.js} +1 -1
  131. package/web/chunk-fd1kqwe3.js +1 -0
  132. package/web/chunk-fmthkpff.js +1 -0
  133. package/web/chunk-fp48zz2e.js +2 -0
  134. package/web/{chunk-n90cqdvg.js → chunk-fv6vm14n.js} +2 -2
  135. package/web/chunk-fx0n2g22.js +89 -0
  136. package/web/{chunk-9cx1be43.js → chunk-fxs4nb93.js} +16 -16
  137. package/web/chunk-g6k9z8zt.js +1 -0
  138. package/web/{chunk-42e3b9hv.js → chunk-g81h1e6n.js} +19 -19
  139. package/web/{chunk-pz9ps2jm.js → chunk-gsh80797.js} +12 -12
  140. package/web/{chunk-54thej0t.js → chunk-gyp6v7jd.js} +2 -2
  141. package/web/chunk-h0c42zy3.js +1 -0
  142. package/web/{chunk-6m69hczt.js → chunk-h6k1x096.js} +2 -2
  143. package/web/chunk-hs5x78fb.js +1 -0
  144. package/web/{chunk-zx8zec24.js → chunk-ht1dzftc.js} +56 -56
  145. package/web/{chunk-d11v5s7w.js → chunk-hy4m34qp.js} +6 -6
  146. package/web/chunk-hyd5hzpa.js +1 -0
  147. package/web/chunk-hyt1nkaw.js +1 -0
  148. package/web/{chunk-24mfx6w1.js → chunk-j1bw5v1g.js} +2 -2
  149. package/web/chunk-j6a4z530.js +1139 -0
  150. package/web/{chunk-0pbjgdgp.js → chunk-ja7w629n.js} +2 -2
  151. package/web/{chunk-zbj1trar.js → chunk-jam45rqg.js} +2 -2
  152. package/web/chunk-jfvxxp5c.js +1 -0
  153. package/web/{chunk-kmr7r9xj.js → chunk-jve1zc80.js} +2 -2
  154. package/web/chunk-kegv14sg.js +2 -0
  155. package/web/chunk-kw9emsqw.js +1 -0
  156. package/web/{chunk-df5zx17h.js → chunk-kyawkpv2.js} +1 -1
  157. package/web/chunk-m2prjwk3.js +4 -0
  158. package/web/chunk-m9bzz9m0.js +19 -0
  159. package/web/chunk-mqsyzzgt.js +30 -0
  160. package/web/chunk-mz9b5bsa.js +1 -0
  161. package/web/chunk-n1jpg57t.js +169 -0
  162. package/web/{chunk-ybrf9mhz.js → chunk-nyn9tghz.js} +4 -4
  163. package/web/{chunk-1eg9sbbt.js → chunk-nywdeb4m.js} +2 -2
  164. package/web/chunk-prvh9syp.js +324 -0
  165. package/web/chunk-pxkhm40r.js +2 -0
  166. package/web/{chunk-6cnek1xh.js → chunk-q9ekgjh6.js} +1 -1
  167. package/web/{chunk-xzp7jf7e.js → chunk-qcge7d6s.js} +2 -2
  168. package/web/chunk-r3mj50zs.js +1 -0
  169. package/web/{chunk-wnskxerq.js → chunk-rf9dt6bg.js} +5 -5
  170. package/web/{chunk-nvhmq4z5.js → chunk-s2920f21.js} +6 -6
  171. package/web/chunk-sc0ghp25.js +24 -0
  172. package/web/{chunk-ydtrc1ay.js → chunk-sd3cdqcm.js} +2 -2
  173. package/web/{chunk-rykfak98.js → chunk-sf101c23.js} +2 -2
  174. package/web/{chunk-4gavbw65.js → chunk-sy7e4dmq.js} +1 -1
  175. package/web/chunk-t74r2n8h.js +1 -0
  176. package/web/{chunk-0h0vb6gt.js → chunk-t851gdjh.js} +4 -4
  177. package/web/{chunk-a408enpy.js → chunk-t9mvsgt9.js} +1 -1
  178. package/web/chunk-thbqwq6b.js +1 -0
  179. package/web/{chunk-v5cnt7c8.js → chunk-twdy2f67.js} +1 -1
  180. package/web/chunk-v4yqrx5y.js +140 -0
  181. package/web/{chunk-b53bfkys.js → chunk-vf4vkcf9.js} +1 -1
  182. package/web/chunk-vnt34mkb.js +1 -0
  183. package/web/chunk-vtxw9rmr.js +1 -0
  184. package/web/{chunk-92ssjk2y.js → chunk-vw1pbv1x.js} +40 -40
  185. package/web/chunk-x19v2sxv.js +1 -0
  186. package/web/{chunk-3re8y26v.js → chunk-x5s7zr5f.js} +7 -7
  187. package/web/chunk-xc2sq3t5.js +2 -0
  188. package/web/chunk-xce8n339.js +1 -0
  189. package/web/chunk-xtss82z2.js +1 -0
  190. package/web/chunk-xvcfp1zh.js +2 -0
  191. package/web/chunk-y21zy3eh.js +1 -0
  192. package/web/chunk-ya3ghn3n.js +2 -0
  193. package/web/chunk-yd74yxzt.js +8 -0
  194. package/web/{chunk-74j07k8k.js → chunk-z1geewdf.js} +2 -2
  195. package/web/chunk-z4ha8181.js +1 -0
  196. package/web/chunk-z8rarqe6.js +1 -0
  197. package/web/{chunk-kwccs9f6.js → chunk-zp3qrrkb.js} +11 -11
  198. package/web/chunk-zsxw5fj7.js +39 -0
  199. package/web/index.html +1 -1
  200. package/worker.js +1 -1
  201. package/chunk-06hdzq5n.js +0 -2
  202. package/chunk-5dfbezv9.js +0 -2
  203. package/chunk-5x1sankd.js +0 -3753
  204. package/chunk-71h08f4g.js +0 -2
  205. package/chunk-7nzhdrv9.js +0 -2
  206. package/chunk-7q51n619.js +0 -2
  207. package/chunk-9mmz6wt3.js +0 -2
  208. package/chunk-fvn32nzj.js +0 -478
  209. package/chunk-n6e43rvk.js +0 -3
  210. package/chunk-ry0z4ev6.js +0 -2
  211. package/chunk-vkpvcxjr.js +0 -2
  212. package/web/chunk-0rmkpsgp.js +0 -1
  213. package/web/chunk-0s80zw00.js +0 -1
  214. package/web/chunk-0xkyryrq.js +0 -1
  215. package/web/chunk-1gbd61z0.js +0 -2
  216. package/web/chunk-2s0bmrkv.js +0 -39
  217. package/web/chunk-2z1rwr28.js +0 -2
  218. package/web/chunk-344bq59c.js +0 -89
  219. package/web/chunk-3t0211rw.js +0 -1
  220. package/web/chunk-44rmrmcn.js +0 -1
  221. package/web/chunk-4bzqrwr0.js +0 -1139
  222. package/web/chunk-4d3a7xs2.js +0 -1
  223. package/web/chunk-4jmazh6x.js +0 -370
  224. package/web/chunk-4re74xwm.js +0 -140
  225. package/web/chunk-4rm1vy7w.js +0 -1
  226. package/web/chunk-59kqahb3.js +0 -1
  227. package/web/chunk-5qtyq3ce.js +0 -292
  228. package/web/chunk-5z6x2n5h.js +0 -1
  229. package/web/chunk-6beqrmtq.js +0 -1
  230. package/web/chunk-6f5ke0x9.js +0 -1
  231. package/web/chunk-6xaqxcq8.js +0 -1
  232. package/web/chunk-7q6wvv2x.js +0 -1
  233. package/web/chunk-7qsa4p8h.js +0 -1
  234. package/web/chunk-8nja0ygy.js +0 -1
  235. package/web/chunk-8y64fkpz.js +0 -24
  236. package/web/chunk-9ad7v7bm.js +0 -8
  237. package/web/chunk-9dzxv335.js +0 -4
  238. package/web/chunk-9t5dnjaz.js +0 -19
  239. package/web/chunk-a497tykb.js +0 -70
  240. package/web/chunk-b6k9w215.js +0 -2
  241. package/web/chunk-cjfssg3m.js +0 -2
  242. package/web/chunk-cqp1d4p0.js +0 -1
  243. package/web/chunk-dy2gm1fs.js +0 -1
  244. package/web/chunk-e0zre35a.js +0 -1
  245. package/web/chunk-e9twvs9n.js +0 -3
  246. package/web/chunk-f2kgtyfp.js +0 -1
  247. package/web/chunk-f8bn5tzf.js +0 -1
  248. package/web/chunk-f91wzwtk.js +0 -1
  249. package/web/chunk-fdp9bsj7.js +0 -1
  250. package/web/chunk-fh2vj0wv.js +0 -2
  251. package/web/chunk-g1ev11wx.js +0 -1
  252. package/web/chunk-gmzqdm7v.js +0 -1
  253. package/web/chunk-hfaffkrh.js +0 -1
  254. package/web/chunk-j2vt8c8v.js +0 -1
  255. package/web/chunk-ka3q31t1.js +0 -1
  256. package/web/chunk-khxcn8tt.js +0 -106
  257. package/web/chunk-kqqmp1am.js +0 -1
  258. package/web/chunk-m2d1sp30.js +0 -1
  259. package/web/chunk-nbgqbxcy.js +0 -1
  260. package/web/chunk-ncpnpe9w.js +0 -99
  261. package/web/chunk-ne0v8mfb.js +0 -2
  262. package/web/chunk-ngx2cp8x.js +0 -2
  263. package/web/chunk-nxcgf7ec.js +0 -1
  264. package/web/chunk-p0kvmf28.js +0 -2
  265. package/web/chunk-p3k7m5nr.js +0 -1
  266. package/web/chunk-pggaffrh.js +0 -169
  267. package/web/chunk-pxe3vna4.js +0 -1
  268. package/web/chunk-qh15dxav.css +0 -1
  269. package/web/chunk-qpmbxhh6.js +0 -1
  270. package/web/chunk-r0rctnxz.js +0 -1
  271. package/web/chunk-rn3dnqm8.js +0 -1
  272. package/web/chunk-rtf2zzzv.js +0 -1
  273. package/web/chunk-srrfphes.js +0 -1
  274. package/web/chunk-tdr6x2xc.js +0 -1
  275. package/web/chunk-tncvg1nn.js +0 -1
  276. package/web/chunk-vyp0ns1f.js +0 -2
  277. package/web/chunk-wvdehm9y.js +0 -303
  278. package/web/chunk-x7ahcpj7.js +0 -1
  279. package/web/chunk-y38bf0wm.js +0 -1
  280. package/web/chunk-y56aaba5.js +0 -2
  281. package/web/chunk-ye58t45p.js +0 -4
  282. package/web/chunk-yqbnps3a.js +0 -1
  283. package/web/chunk-z1h20s8c.js +0 -78
  284. package/web/chunk-zj4q9jth.js +0 -36
  285. package/web/chunk-zj5k94dk.js +0 -40
  286. package/web/chunk-zqch0sc8.js +0 -30
  287. package/web/install.ps1 +0 -91
  288. package/web/install.sh +0 -177
@@ -0,0 +1,36 @@
1
+ import{G}from"./chunk-ya3ghn3n.js";import{e,a,D,b,O,ht,C,S,E,T,A,R,L,l,p,V,Fi,Dn,nt,U,ze,Ie}from"./chunk-5v44qv67.js";import{X}from"./chunk-cktmyc13.js";import{ut,lr}from"./chunk-x5s7zr5f.js";import{Se,Te}from"./chunk-j6a4z530.js";var ft=Te(function(rt,st){(function(i,s){if(typeof rt==="object"&&typeof st==="object")st.exports=s(lr());else if(typeof define==="function"&&define.amd)define(["cose-base"],s);else if(typeof rt==="object")rt.cytoscapeFcose=s(lr());else i.cytoscapeFcose=s(i.coseBase)})(rt,function(t){return(()=>{var i={658:(N)=>{N.exports=Object.assign!=null?Object.assign.bind(Object):function(B){for(var v=arguments.length,I=Array(v>1?v-1:0),c=1;c<v;c++)I[c-1]=arguments[c];return I.forEach(function(y){Object.keys(y).forEach(function(d){return B[d]=y[d]})}),B}},548:(N,B,v)=>{var I=function(){function d(f,u){var g=[],r=!0,_=!1,F=void 0;try{for(var o=f[Symbol.iterator](),h;!(r=(h=o.next()).done);r=!0)if(g.push(h.value),u&&g.length===u)break}catch(k){_=!0,F=k}finally{try{if(!r&&o.return)o.return()}finally{if(_)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(r,_){if(typeof r==="number")r=_;var F=r.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 r=new c,_=new Set,F=[],o=void 0,h=void 0,k=void 0,n=!1,P=1,j=[],M=[],q=function(){var x=d.collection();M.push(x);var H=u[0],Z=d.collection();Z.merge(H).merge(H.descendants().intersection(f)),F.push(H),Z.forEach(function(re){r.push(re),_.add(re),x.merge(re)});var Q=function(){H=r.shift();var ue=d.collection();H.neighborhood().nodes().forEach(function(W){if(f.intersection(H.edgesWith(W)).length>0)ue.merge(W)});for(var Le=0;Le<ue.length;Le++){var $e=ue[Le];if(o=u.intersection($e.union($e.ancestors())),o!=null&&!_.has(o[0])){var de=o.union(o.descendants());de.forEach(function(W){if(r.push(W),_.add(W),x.merge(W),u.has(W))F.push(W)})}}};while(r.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)n=!0;if(!n||n&&P>1){h=F[0],k=h.connectedEdges().length,F.forEach(function(re){if(re.connectedEdges().length<k)k=re.connectedEdges().length,h=re}),j.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 q();while(!n);if(g){if(j.length>0)g.set("dummy"+(g.size+1),j)}return M},y.relocateComponent=function(d,f,u){if(!u.fixedNodeConstraint){var{POSITIVE_INFINITY:g,NEGATIVE_INFINITY:r,POSITIVE_INFINITY:_,NEGATIVE_INFINITY:F}=Number;if(u.quality=="draft"){var o=!0,h=!1,k=void 0;try{for(var n=f.nodeIndexes[Symbol.iterator](),P;!(o=(P=n.next()).done);o=!0){var j=P.value,M=I(j,2),q=M[0],Y=M[1],x=u.cy.getElementById(q);if(x){var H=x.boundingBox(),Z=f.xCoords[Y]-H.w/2,Q=f.xCoords[Y]+H.w/2,se=f.yCoords[Y]-H.h/2,re=f.yCoords[Y]+H.h/2;if(Z<g)g=Z;if(Q>r)r=Q;if(se<_)_=se;if(re>F)F=re}}}catch(W){h=!0,k=W}finally{try{if(!o&&n.return)n.return()}finally{if(h)throw k}}var ue=d.x-(r+g)/2,Le=d.y-(F+_)/2;f.xCoords=f.xCoords.map(function(W){return W+ue}),f.yCoords=f.yCoords.map(function(W){return W+Le})}else{Object.keys(f).forEach(function(W){var oe=f[W],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>r)r=ke;if(De<_)_=De;if(xe>F)F=xe});var $e=d.x-(r+g)/2,de=d.y-(F+_)/2;Object.keys(f).forEach(function(W){var oe=f[W];oe.setCenter(oe.getCenterX()+$e,oe.getCenterY()+de)})}}},y.calcBoundingBox=function(d,f,u,g){var{MAX_SAFE_INTEGER:r,MIN_SAFE_INTEGER:_,MAX_SAFE_INTEGER:F,MIN_SAFE_INTEGER:o}=Number,h=void 0,k=void 0,n=void 0,P=void 0,j=d.descendants().not(":parent"),M=j.length;for(var q=0;q<M;q++){var Y=j[q];if(h=f[g.get(Y.id())]-Y.width()/2,k=f[g.get(Y.id())]+Y.width()/2,n=u[g.get(Y.id())]-Y.height()/2,P=u[g.get(Y.id())]+Y.height()/2,r>h)r=h;if(_<k)_=k;if(F>n)F=n;if(o<P)o=P}var x={};return x.topLeftX=r,x.topLeftY=F,x.width=_-r,x.height=o-F,x},y.calcParentsWithoutChildren=function(d,f){var u=d.collection();return f.nodes(":parent").forEach(function(g){var r=!1;if(g.children().forEach(function(_){if(_.css("display")!="none")r=!0}),!r)u.merge(g)}),u},N.exports=y},816:(N,B,v)=>{var I=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,r=v(140).CoSEConstants,_=function(o,h){var{cy:k,eles:n}=o,P=n.nodes(),j=n.edges(),M=void 0,q=void 0,Y=void 0,x={};if(o.randomize)M=h.nodeIndexes,q=h.xCoords,Y=h.yCoords;var H=function(W){return typeof W==="function"},Z=function(W,oe){if(H(W))return W(oe);else return W},Q=I.calcParentsWithoutChildren(k,n),se=function de(W,oe,Ne,ke){var De=oe.length;for(var xe=0;xe<De;xe++){var J=oe[xe],Ae=null;if(J.intersection(Q).length==0)Ae=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=W.add(new y(Ne.graphManager,new d(q[M.get(J.id())]-ve.w/2,Y[M.get(J.id())]-ve.h/2),new f(parseFloat(ve.w),parseFloat(ve.h))));else{var Me=I.calcBoundingBox(J,q,Y,M);if(J.intersection(Q).length==0)ie=W.add(new y(Ne.graphManager,new d(Me.topLeftX,Me.topLeftY),new f(Me.width,Me.height)));else ie=W.add(new y(Ne.graphManager,new d(Me.topLeftX,Me.topLeftY),new f(parseFloat(ve.w),parseFloat(ve.h))))}else ie=W.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=W.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(Ae!=null&&Ae.length>0){var Ge=void 0;Ge=Ne.getGraphManager().add(Ne.newGraph(),ie),de(Ge,Ae,Ne,ke)}}},re=function(W,oe,Ne){var ke=0,De=0;for(var xe=0;xe<Ne.length;xe++){var J=Ne[xe],Ae=x[J.data("source")],ie=x[J.data("target")];if(Ae&&ie&&Ae!==ie&&Ae.getEdgesBetween(ie).length==0){var ve=oe.add(W.newEdge(),Ae,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)r.DEFAULT_EDGE_LENGTH=g.DEFAULT_EDGE_LENGTH=ke/De;else if(!H(o.idealEdgeLength))r.DEFAULT_EDGE_LENGTH=g.DEFAULT_EDGE_LENGTH=o.idealEdgeLength;else r.DEFAULT_EDGE_LENGTH=g.DEFAULT_EDGE_LENGTH=50;r.MIN_REPULSION_DIST=g.MIN_REPULSION_DIST=g.DEFAULT_EDGE_LENGTH/10,r.DEFAULT_RADIAL_SEPARATION=g.DEFAULT_EDGE_LENGTH}},ue=function(W,oe){if(oe.fixedNodeConstraint)W.constraints.fixedNodeConstraint=oe.fixedNodeConstraint;if(oe.alignmentConstraint)W.constraints.alignmentConstraint=oe.alignmentConstraint;if(oe.relativePlacementConstraint)W.constraints.relativePlacementConstraint=oe.relativePlacementConstraint};if(o.nestingFactor!=null)r.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=g.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=o.nestingFactor;if(o.gravity!=null)r.DEFAULT_GRAVITY_STRENGTH=g.DEFAULT_GRAVITY_STRENGTH=o.gravity;if(o.numIter!=null)r.MAX_ITERATIONS=g.MAX_ITERATIONS=o.numIter;if(o.gravityRange!=null)r.DEFAULT_GRAVITY_RANGE_FACTOR=g.DEFAULT_GRAVITY_RANGE_FACTOR=o.gravityRange;if(o.gravityCompound!=null)r.DEFAULT_COMPOUND_GRAVITY_STRENGTH=g.DEFAULT_COMPOUND_GRAVITY_STRENGTH=o.gravityCompound;if(o.gravityRangeCompound!=null)r.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=g.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=o.gravityRangeCompound;if(o.initialEnergyOnIncremental!=null)r.DEFAULT_COOLING_FACTOR_INCREMENTAL=g.DEFAULT_COOLING_FACTOR_INCREMENTAL=o.initialEnergyOnIncremental;if(o.tilingCompareBy!=null)r.TILING_COMPARE_BY=o.tilingCompareBy;if(o.quality=="proof")u.QUALITY=2;else u.QUALITY=0;if(r.NODE_DIMENSIONS_INCLUDE_LABELS=g.NODE_DIMENSIONS_INCLUDE_LABELS=u.NODE_DIMENSIONS_INCLUDE_LABELS=o.nodeDimensionsIncludeLabels,r.DEFAULT_INCREMENTAL=g.DEFAULT_INCREMENTAL=u.DEFAULT_INCREMENTAL=!o.randomize,r.ANIMATE=g.ANIMATE=u.ANIMATE=o.animate,r.TILE=o.tile,r.TILING_PADDING_VERTICAL=typeof o.tilingPaddingVertical==="function"?o.tilingPaddingVertical.call():o.tilingPaddingVertical,r.TILING_PADDING_HORIZONTAL=typeof o.tilingPaddingHorizontal==="function"?o.tilingPaddingHorizontal.call():o.tilingPaddingHorizontal,r.DEFAULT_INCREMENTAL=g.DEFAULT_INCREMENTAL=u.DEFAULT_INCREMENTAL=!0,r.PURE_INCREMENTAL=!o.randomize,u.DEFAULT_UNIFORM_LEAF_NODE_SIZES=o.uniformNodeDimensions,o.step=="transformed")r.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,r.ENFORCE_CONSTRAINTS=!1,r.APPLY_LAYOUT=!1;if(o.step=="enforced")r.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,r.ENFORCE_CONSTRAINTS=!0,r.APPLY_LAYOUT=!1;if(o.step=="cose")r.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,r.ENFORCE_CONSTRAINTS=!1,r.APPLY_LAYOUT=!0;if(o.step=="all"){if(o.randomize)r.TRANSFORM_ON_CONSTRAINT_HANDLING=!0;else r.TRANSFORM_ON_CONSTRAINT_HANDLING=!1;r.ENFORCE_CONSTRAINTS=!0,r.APPLY_LAYOUT=!0}if(o.fixedNodeConstraint||o.alignmentConstraint||o.relativePlacementConstraint)r.TREE_REDUCTION_ON_INCREMENTAL=!1;else r.TREE_REDUCTION_ON_INCREMENTAL=!0;var Le=new c,$e=Le.newGraphManager();return se($e.addRoot(),I.getTopMostNodes(P),Le,o),re(Le,$e,j),ue(Le,o),Le.runLayout(),x};N.exports={coseLayout:_}},212:(N,B,v)=>{var I=function(){function o(h,k){for(var n=0;n<k.length;n++){var P=k[n];if(P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P)P.writable=!0;Object.defineProperty(h,P.key,P)}}return function(h,k,n){if(k)o(h.prototype,k);if(n)o(h,n);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),r=g.coseLayout,_=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({},_,h)}return I(o,[{key:"run",value:function(){var k=this,n=this.options,{cy:P,eles:j}=n,M=[],q=void 0,Y=void 0,x=[],H=void 0,Z=[];if(n.fixedNodeConstraint&&(!Array.isArray(n.fixedNodeConstraint)||n.fixedNodeConstraint.length==0))n.fixedNodeConstraint=void 0;if(n.alignmentConstraint){if(n.alignmentConstraint.vertical&&(!Array.isArray(n.alignmentConstraint.vertical)||n.alignmentConstraint.vertical.length==0))n.alignmentConstraint.vertical=void 0;if(n.alignmentConstraint.horizontal&&(!Array.isArray(n.alignmentConstraint.horizontal)||n.alignmentConstraint.horizontal.length==0))n.alignmentConstraint.horizontal=void 0}if(n.relativePlacementConstraint&&(!Array.isArray(n.relativePlacementConstraint)||n.relativePlacementConstraint.length==0))n.relativePlacementConstraint=void 0;var Q=n.fixedNodeConstraint||n.alignmentConstraint||n.relativePlacementConstraint;if(Q)n.tile=!1,n.packComponents=!1;var se=void 0,re=!1;if(P.layoutUtilities&&n.packComponents){if(se=P.layoutUtilities("get"),!se)se=P.layoutUtilities();re=!0}if(j.nodes().length>0)if(!re){var ue=n.eles.boundingBox();if(Z.push({x:ue.x1+ue.w/2,y:ue.y1+ue.h/2}),n.randomize){var Le=u(n);M.push(Le)}if(n.quality=="default"||n.quality=="proof")x.push(r(n,M[0])),d.relocateComponent(Z[0],x[0],n);else d.relocateComponent(Z[0],M[0],n)}else{var $e=d.getTopMostNodes(n.eles.nodes());if(H=d.connectComponents(P,n.eles,$e),H.forEach(function(K){var z=K.boundingBox();Z.push({x:z.x1+z.w/2,y:z.y1+z.h/2})}),n.randomize)H.forEach(function(K){n.eles=K,M.push(u(n))});if(n.quality=="default"||n.quality=="proof"){var de=P.collection();if(n.tile){var W=new Map,oe=[],Ne=[],ke=0,De={nodeIndexes:W,xCoords:oe,yCoords:Ne},xe=[];if(H.forEach(function(K,z){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(z)}),de.length>1){var J=de.boundingBox();Z.push({x:J.x1+J.w/2,y:J.y1+J.h/2}),H.push(de),M.push(De);for(var Ae=xe.length-1;Ae>=0;Ae--)H.splice(xe[Ae],1),M.splice(xe[Ae],1),Z.splice(xe[Ae],1)}}H.forEach(function(K,z){n.eles=K,x.push(r(n,M[z])),d.relocateComponent(Z[z],x[z],n)})}else H.forEach(function(K,z){d.relocateComponent(Z[z],M[z],n)});var ie=new Set;if(H.length>1){var ve=[],Me=j.filter(function(K){return K.css("display")=="none"});H.forEach(function(K,z){var pe=void 0;if(n.quality=="draft")pe=M[z].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(n.quality=="draft")if(!fe.isParent())me=pe.get(fe.id()),le.nodes.push({x:M[z].xCoords[me]-fe.boundingbox().w/2,y:M[z].yCoords[me]-fe.boundingbox().h/2,width:fe.boundingbox().w,height:fe.boundingbox().h});else{var he=d.calcBoundingBox(fe,M[z].xCoords,M[z].yCoords,pe);le.nodes.push({x:he.topLeftX,y:he.topLeftY,width:he.width,height:he.height})}else if(x[z][fe.id()])le.nodes.push({x:x[z][fe.id()].getLeft(),y:x[z][fe.id()].getTop(),width:x[z][fe.id()].getWidth(),height:x[z][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(n.quality=="draft"){var Be=pe.get(he.id()),et=pe.get(Ee.id()),Pe=[],Ye=[];if(he.isParent()){var We=d.calcBoundingBox(he,M[z].xCoords,M[z].yCoords,pe);Pe.push(We.topLeftX+We.width/2),Pe.push(We.topLeftY+We.height/2)}else Pe.push(M[z].xCoords[Be]),Pe.push(M[z].yCoords[Be]);if(Ee.isParent()){var Je=d.calcBoundingBox(Ee,M[z].xCoords,M[z].yCoords,pe);Ye.push(Je.topLeftX+Je.width/2),Ye.push(Je.topLeftY+Je.height/2)}else Ye.push(M[z].xCoords[et]),Ye.push(M[z].yCoords[et]);le.edges.push({startX:Pe[0],startY:Pe[1],endX:Ye[0],endY:Ye[1]})}else if(x[z][he.id()]&&x[z][Ee.id()])le.edges.push({startX:x[z][he.id()].getCenterX(),startY:x[z][he.id()].getCenterY(),endX:x[z][Ee.id()].getCenterX(),endY:x[z][Ee.id()].getCenterY()})}}),le.nodes.length>0)ve.push(le),ie.add(z)}});var Ge=se.packComponents(ve,n.randomize).shifts;if(n.quality=="draft")M.forEach(function(K,z){var pe=K.xCoords.map(function(me){return me+Ge[z].dx}),le=K.yCoords.map(function(me){return me+Ge[z].dy});K.xCoords=pe,K.yCoords=le});else{var Ke=0;ie.forEach(function(K){Object.keys(x[K]).forEach(function(z){var pe=x[K][z];pe.setCenter(pe.getCenterX()+Ge[Ke].dx,pe.getCenterY()+Ge[Ke].dy)}),Ke++})}}}var je=function(z,pe){if(n.quality=="default"||n.quality=="proof"){if(typeof z==="number")z=pe;var le=void 0,me=void 0,fe=z.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]}),n.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:z.position("x"),y:z.position("y")};return{x:le.x,y:le.y}}else{var he=void 0;if(M.forEach(function(Ee){var Be=Ee.nodeIndexes.get(z.id());if(Be!=null)he={x:Ee.xCoords[Be],y:Ee.yCoords[Be]}}),he==null)he={x:z.position("x"),y:z.position("y")};return{x:he.x,y:he.y}}};if(n.quality=="default"||n.quality=="proof"||n.randomize){var at=d.calcParentsWithoutChildren(P,j),qe=j.filter(function(K){return K.css("display")=="none"});if(n.eles=j.not(qe),j.nodes().not(":parent").not(qe).layoutPositions(k,n,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}();N.exports=F},657:(N,B,v)=>{var I=v(548),c=v(140).layoutBase.Matrix,y=v(140).layoutBase.SVD,d=function(u){var{cy:g,eles:r}=u,_=r.nodes(),F=r.nodes(":parent"),o=new Map,h=new Map,k=new Map,n=[],P=[],j=[],M=[],q=[],Y=[],x=[],H=[],Z=void 0,Q=void 0,se=1e8,re=0.000000001,{piTol:ue,samplingType:Le,nodeSeparation:$e}=u,de=void 0,W=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,Ce=void 0,be=[],Fe=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=n[ce];for(var He=0;He<Xe.length;He++)if(Ce=h.get(Xe[He]),be[Ce]==se)be[Ce]=be[ce]+1,ae[++ge]=Ce;Y[ce][te]=be[ce]*$e}if(ne){for(var Oe=0;Oe<Q;Oe++)if(Y[Oe][te]<q[Oe])q[Oe]=Y[Oe][te];for(var tt=0;tt<Q;tt++)if(q[tt]>Fe)Fe=q[tt],_e=tt}return _e},Ne=function(ee){var te=void 0;if(!ee){W();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++)q[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++)Y[ge][ce]*=Y[ge][ce];for(var Ce=0;Ce<de;Ce++)x[Ce]=[];for(var be=0;be<de;be++)for(var Fe=0;Fe<de;Fe++)x[be][Fe]=Y[M[Fe]][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 Ce=0;Ce<de;Ce++)if(ge[ce][Ce]=0,ce==Ce)ge[ce][Ce]=te[ce]/(te[ce]*te[ce]+we/(te[ce]*te[ce]))}H=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 Ce=0,be=re,Fe=re,_e=void 0;while(!0){Ce++;for(var Ue=0;Ue<Q;Ue++)we[Ue]=ne[Ue];if(ne=c.multGamma(c.multL(c.multGamma(we),Y,H)),ee=c.dotProduct(we,ne),ne=c.normalize(ne),be=c.dotProduct(we,ne),_e=Math.abs(be/Fe),_e<=1+ue&&_e>=1)break;Fe=be}for(var Xe=0;Xe<Q;Xe++)we[Xe]=ne[Xe];Ce=0,Fe=re;while(!0){Ce++;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,H)),te=c.dotProduct(ge,ae),ae=c.normalize(ae),be=c.dotProduct(ge,ae),_e=Math.abs(be/Fe),_e<=1+ue&&_e>=1)break;Fe=be}for(var Oe=0;Oe<Q;Oe++)ge[Oe]=ae[Oe];P=c.multCons(we,Math.sqrt(Math.abs(ee))),j=c.multCons(ge,Math.sqrt(Math.abs(te)))};I.connectComponents(g,r,I.getTopMostNodes(_),o),F.forEach(function(ye){I.connectComponents(g,r,I.getTopMostNodes(ye.descendants().intersection(r)),o)});var xe=0;for(var J=0;J<_.length;J++)if(!_[J].isParent())h.set(_[J].id(),xe++);var Ae=!0,ie=!1,ve=void 0;try{for(var Me=o.keys()[Symbol.iterator](),Ge;!(Ae=(Ge=Me.next()).done);Ae=!0){var Ke=Ge.value;h.set(Ke,xe++)}}catch(ye){ie=!0,ve=ye}finally{try{if(!Ae&&Me.return)Me.return()}finally{if(ie)throw ve}}for(var je=0;je<h.size;je++)n[je]=[];F.forEach(function(ye){var ee=ye.children().intersection(r);while(ee.nodes(":childless").length==0)ee=ee.nodes()[0].children().intersection(r);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}),k.set(ye.id(),ee.nodes(":childless")[te].id())}),_.forEach(function(ye){var ee=void 0;if(ye.isParent())ee=h.get(k.get(ye.id()));else ee=h.get(ye.id());ye.neighborhood().nodes().forEach(function(te){if(r.intersection(ye.edgesWith(te)).length>0)if(te.isParent())n[ee].push(k.get(te.id()));else n[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=k.get(ae);else ne=ae;n[te].push(ne),n[h.get(ne)].push(ee)})},qe=!0,K=!1,z=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,z=ye}finally{try{if(!qe&&pe.return)pe.return()}finally{if(K)throw z}}Q=h.size;var fe=void 0;if(Q>2){de=Q<u.sampleSize?Q:u.sampleSize;for(var he=0;he<Q;he++)Y[he]=[];for(var Ee=0;Ee<de;Ee++)H[Ee]=[];if(u.quality=="draft"||u.step=="all")Ne(Le),ke(),De(),fe={nodeIndexes:h,xCoords:P,yCoords:j};else h.forEach(function(ye,ee){P.push(g.getElementById(ee).position("x")),j.push(g.getElementById(ee).position("y"))}),fe={nodeIndexes:h,xCoords:P,yCoords:j};return fe}else{var Be=h.keys(),et=g.getElementById(Be.next().value),Pe=et.position(),Ye=et.outerWidth();if(P.push(Pe.x),j.push(Pe.y),Q==2){var We=g.getElementById(Be.next().value),Je=We.outerWidth();P.push(Pe.x+Ye/2+Je/2+u.idealEdgeLength),j.push(Pe.y)}return fe={nodeIndexes:h,xCoords:P,yCoords:j},fe}};N.exports={spectralLayout:d}},579:(N,B,v)=>{var I=v(212),c=function(d){if(!d)return;d("layout","fcose",I)};if(typeof cytoscape<"u")c(cytoscape);N.exports=c},140:(N)=>{N.exports=t}},s={};function w(N){var B=s[N];if(B!==void 0)return B.exports;var v=s[N]={exports:{}};return i[N](v,v.exports,w),v.exports}var m=w(579);return m})()})});var xt=Se(ft(),1);var gt={L:"left",R:"right",T:"top",B:"bottom"},vt={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,i)=>t-i+2,"L"),R:e((t,i)=>t-2,"R"),T:e((t,i)=>t-i+2,"T"),B:e((t,i)=>t-2,"B")},kt=e(function(t){if(Re(t))return t==="L"?"R":"L";else return t==="T"?"B":"T"},"getOppositeArchitectureDirection"),pt=e(function(t){let i=t;return i==="L"||i==="R"||i==="T"||i==="B"},"isArchitectureDirection"),Re=e(function(t){let i=t;return i==="L"||i==="R"},"isArchitectureDirectionX"),Ve=e(function(t){let i=t;return i==="T"||i==="B"},"isArchitectureDirectionY"),dt=e(function(t,i){let s=Re(t)&&Ve(i),w=Ve(t)&&Re(i);return s||w},"isArchitectureDirectionXY"),Dt=e(function(t){let i=t[0],s=t[1],w=Re(i)&&Ve(s),m=Ve(i)&&Re(s);return w||m},"isArchitecturePairXY"),Rt=e(function(t){return t!=="LL"&&t!=="RR"&&t!=="TT"&&t!=="BB"},"isValidArchitectureDirectionPair"),lt=e(function(t,i){let s=`${t}${i}`;return Rt(s)?s:void 0},"getArchitectureDirectionPair"),Mt=e(function([t,i],s){let w=s[0],m=s[1];if(Re(w))if(Ve(m))return[t+(w==="L"?-1:1),i+(m==="T"?1:-1)];else return[t+(w==="L"?-1:1),i];else if(Re(m))return[t+(m==="L"?1:-1),i+(w==="T"?1:-1)];else return[t,i+(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,i){if(dt(t,i))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"),mt=e((t,i)=>{let[s,w]=[t,i].sort();return`${JSON.stringify(s)}-${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=R,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:i,in:s,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(s!==void 0){if(t===s)throw Error(`The service [${t}] cannot be placed within itself`);if(!this.registeredIds.has(s))throw Error(`The service [${t}]'s parent does not exist. Please make sure the parent is created before this service`);if(this.registeredIds.get(s)==="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:i,iconText:m,title:w,edges:[],in:s})}getServices(){return[...this.nodes.values()].filter(Pt)}addJunction({id:t,in:i}){if(this.registeredIds.has(t))throw Error(`The junction id [${t}] is already in use by another ${this.registeredIds.get(t)}`);if(i!==void 0){if(t===i)throw Error(`The junction [${t}] cannot be placed within itself`);if(!this.registeredIds.has(i))throw Error(`The junction [${t}]'s parent does not exist. Please make sure the parent is created before this junction`);if(this.registeredIds.get(i)==="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:i})}getJunctions(){return[...this.nodes.values()].filter(Ot)}getNodes(){return[...this.nodes.values()]}getNode(t){return this.nodes.get(t)??null}addGroup({id:t,icon:i,in:s,title:w}){if(this.registeredIds.has(t))throw Error(`The group id [${t}] is already in use by another ${this.registeredIds.get(t)}`);if(s!==void 0){if(t===s)throw Error(`The group [${t}] cannot be placed within itself`);if(!this.registeredIds.has(s))throw Error(`The group [${t}]'s parent does not exist. Please make sure the parent is created before this group`);if(this.registeredIds.get(s)==="node")throw Error(`The group [${t}]'s parent is not a group`)}this.registeredIds.set(t,"group"),this.groups.set(t,{id:t,icon:i,title:w,in:s})}getGroups(){return[...this.groups.values()]}addEdge({lhsId:t,rhsId:i,lhsDir:s,rhsDir:w,lhsInto:m,rhsInto:N,lhsGroup:B,rhsGroup:v,title:I}){if(!pt(s))throw Error(`Invalid direction given for left hand side of edge ${t}--${i}. Expected (L,R,T,B) got ${String(s)}`);if(!pt(w))throw Error(`Invalid direction given for right hand side of edge ${t}--${i}. 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(i)&&!this.groups.has(i))throw Error(`The right-hand id [${i}] 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(i).in;if(B&&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 [${i}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);let d={lhsId:t,lhsDir:s,lhsInto:m,lhsGroup:B,rhsId:i,rhsDir:w,rhsInto:N,rhsGroup:v,title:I};this.edges.push(d);let f=this.nodes.get(t),u=this.nodes.get(i);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 i=new Set;t.members.forEach((s)=>{if(this.registeredIds.get(s)!=="node")throw Error(`align ${t.direction} references [${s}], which is not a service or junction`);if(i.has(s))throw Error(`align ${t.direction} lists [${s}] more than once`);i.add(s)}),this.layoutHints.push(t)}getLayoutHints(){return this.layoutHints}getDataStructures(){if(this.dataStructures===void 0){let t=new Map,i=new Map;for(let[B,v]of this.nodes.entries()){let I=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(mt(y,d),f)}if(c.lhsId===B){let f=lt(c.lhsDir,c.rhsDir);if(f)I.set(f,c.rhsId)}else{let f=lt(c.rhsDir,c.lhsDir);if(f)I.set(f,c.lhsId)}}i.set(B,I)}let s=new Set,w=new Set(i.keys()),m=e((B)=>{let v=new Map([[B,[0,0]]]),I=[B];while(I.length>0){let c=I.shift();if(c){s.add(c),w.delete(c);let y=i.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,r)=>{if(!s.has(g))v.set(g,Mt([f,u],r)),I.push(g)})}}return v},"BFS"),N=[];while(w.size>0){let B=w.values().next().value;N.push(m(B))}this.dataStructures={adjList:i,spatialMaps:N,groupAlignments:t}}return this.dataStructures}setElementForId(t,i){this.elements.set(t,i)}getElementById(t){return this.elements.get(t)}getConfig(){return U({...Gt,...b().architecture})}getConfigField(t){return this.getConfig()[t]}},zt=e((t,i)=>{G(t,i),t.groups.map((s)=>i.addGroup(s)),t.services.map((s)=>i.addService({...s,type:"service"})),t.junctions.map((s)=>i.addJunction({...s,type:"junction"})),t.edges.map((s)=>i.addEdge(s)),t.alignments?.map((s)=>i.addLayoutHint({direction:s.direction,members:[...s.members]}))},"populateDb"),wt={parser:{yy:void 0},parse:e(async(t)=>{let i=await X("architecture",t);a.debug(i);let s=wt.parser?.yy;if(!(s 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(i,s)},"parse")},Bt=e((t)=>`
2
+ .edge {
3
+ stroke-width: ${t.archEdgeWidth};
4
+ stroke: ${t.archEdgeColor};
5
+ fill: none;
6
+ }
7
+
8
+ .arrow {
9
+ fill: ${t.archEdgeArrowColor};
10
+ }
11
+
12
+ .node-bkg {
13
+ fill: none;
14
+ stroke: ${t.archGroupBorderColor};
15
+ stroke-width: ${t.archGroupBorderWidth};
16
+ stroke-dasharray: 8;
17
+ }
18
+ .node-icon-text {
19
+ display: flex;
20
+ align-items: center;
21
+ }
22
+
23
+ .node-icon-text > div {
24
+ color: #fff;
25
+ margin: 1px;
26
+ height: fit-content;
27
+ text-align: center;
28
+ overflow: hidden;
29
+ display: -webkit-box;
30
+ -webkit-box-orient: vertical;
31
+ }
32
+ `,"getStyles"),_t=Bt;function ct(t,i){if(t===0)return i();let s=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 i()}finally{Math.random=s}}e(ct,"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:Fi,blank:{body:Ze("")}}},Yt=e(async function(t,i,s,w){let m=s.getConfigField("padding"),N=s.getConfigField("iconSize"),B=N/2,v=N/6,I=v/2;await Promise.all(i.edges().map(async(c)=>{let{source:y,sourceDir:d,sourceArrow:f,sourceGroup:u,target:g,targetDir:r,targetArrow:_,targetGroup:F,label:o}=yt(c),{x:h,y:k}=c[0].sourceEndpoint(),{x:n,y:P}=c[0].midpoint(),{x:j,y:M}=c[0].targetEndpoint(),q=m+4;if(u)if(Re(d))h+=d==="L"?-q:q;else k+=d==="T"?-q:q+18;if(F)if(Re(r))j+=r==="L"?-q:q;else M+=r==="T"?-q:q+18;if(!u&&s.getNode(y)?.type==="junction")if(Re(d))h+=d==="L"?B:-B;else k+=d==="T"?B:-B;if(!F&&s.getNode(g)?.type==="junction")if(Re(r))j+=r==="L"?B:-B;else M+=r==="T"?B:-B;if(c[0]._private.rscratch){let Y=t.insert("g");if(Y.insert("path").attr("d",`M ${h},${k} L ${n},${P} L${j},${M} `).attr("class","edge").attr("id",`${w}-${ze(y,g,{prefix:"L"})}`),f){let x=Re(d)?ot[d](h,v):h-I,H=Ve(d)?ot[d](k,v):k-I;Y.insert("polygon").attr("points",vt[d](v)).attr("transform",`translate(${x},${H})`).attr("class","arrow")}if(_){let x=Re(r)?ot[r](j,v):j-I,H=Ve(r)?ot[r](M,v):M-I;Y.insert("polygon").attr("points",vt[r](v)).attr("transform",`translate(${x},${H})`).attr("class","arrow")}if(o){let x=!dt(d,r)?Re(d)?"X":"Y":"XY",H=0;if(x==="X")H=Math.abs(h-j);else if(x==="Y")H=Math.abs(k-M)/1.5;else H=Math.abs(h-j)/2;let Z=Y.append("g");if(await Ie(Z,o,{useHtmlLabels:!1,width:H,classes:"architecture-service-label"},l()),Z.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle"),x==="X")Z.attr("transform","translate("+n+", "+P+")");else if(x==="Y")Z.attr("transform","translate("+n+", "+P+") rotate(-90)");else if(x==="XY"){let Q=lt(d,r);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 Le=Z.node().getBoundingClientRect();Z.attr("transform",`
33
+ translate(${n}, ${P-se.height/2})
34
+ translate(${re*Le.width/2}, ${ue*Le.height/2})
35
+ rotate(${-1*re*ue*45}, 0, ${se.height/2})
36
+ `)}}}}}))},"drawEdges"),Ut=e(async function(t,i,s,w){let N=s.getConfigField("padding")*0.75,B=s.getConfigField("fontSize"),I=s.getConfigField("iconSize")/2;await Promise.all(i.nodes().map(async(c)=>{let y=Qe(c);if(y.type==="group"){let{h:d,w:f,x1:u,y1:g}=c.boundingBox(),r=t.append("rect");r.attr("id",`${w}-group-${y.id}`).attr("x",u+I).attr("y",g+I).attr("width",f).attr("height",d).attr("class","node-bkg");let _=t.append("g"),F=u,o=g;if(y.icon){let h=_.append("g");h.html(`<g>${await nt(y.icon,{height:N,width:N,fallbackPrefix:it.prefix})}</g>`),h.attr("transform","translate("+(F+I+1)+", "+(o+I+1)+")"),F+=N,o+=B/2-1-2}if(y.label){let h=_.append("g");await Ie(h,y.label,{useHtmlLabels:!1,width:f,classes:"architecture-service-label"},l()),h.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","start").attr("text-anchor","start"),h.attr("transform","translate("+(F+I+4)+", "+(o+I+2)+")")}s.setElementForId(y.id,r)}}))},"drawGroups"),Ht=e(async function(t,i,s,w){let m=l();for(let N of s){let B=i.append("g"),v=t.getConfigField("iconSize");if(N.title){let d=B.append("g");await Ie(d,N.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 I=B.append("g");if(N.icon)I.html(`<g>${await nt(N.icon,{height:v,width:v,fallbackPrefix:it.prefix})}</g>`);else if(N.iconText){I.html(`<g>${await nt("blank",{height:v,width:v,fallbackPrefix:it.prefix})}</g>`);let u=I.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(N.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 I.append("path").attr("class","node-bkg").attr("id",`${w}-node-${N.id}`).attr("d",`M0,${v} V5 Q0,0 5,0 H${v-5} Q${v},0 ${v},5 V${v} Z`);B.attr("id",`${w}-service-${N.id}`).attr("class","architecture-service");let{width:c,height:y}=B.node().getBBox();N.width=c,N.height=y,t.setElementForId(N.id,B)}return 0},"drawServices"),Vt=e(function(t,i,s,w){s.forEach((m)=>{let N=i.append("g"),B=t.getConfigField("iconSize");N.append("g").append("rect").attr("id",`${w}-node-${m.id}`).attr("fill-opacity","0").attr("width",B).attr("height",B),N.attr("class","architecture-junction");let{width:I,height:c}=N._groups[0][0].getBBox();N.width=I,N.height=c,t.setElementForId(m.id,N)})},"drawJunctions");Dn([{name:it.prefix,icons:it}]);ut.use(xt.default);function Tt(t,i,s){t.forEach((w)=>{i.add({group:"nodes",data:{type:"service",id:w.id,icon:w.icon,label:w.title,parent:w.in,width:s.getConfigField("iconSize"),height:s.getConfigField("iconSize")},classes:"node-service"})})}e(Tt,"addServices");function At(t,i,s){t.forEach((w)=>{i.add({group:"nodes",data:{type:"junction",id:w.id,parent:w.in,width:s.getConfigField("iconSize"),height:s.getConfigField("iconSize")},classes:"node-junction"})})}e(At,"addJunctions");function Lt(t,i){i.nodes().map((s)=>{let w=Qe(s);if(w.type==="group")return;w.x=s.position().x,w.y=s.position().y,t.getElementById(w.id).attr("transform","translate("+(w.x||0)+","+(w.y||0)+")")})}e(Lt,"positionNodes");function Ct(t,i){t.forEach((s)=>{i.add({group:"nodes",data:{type:"group",id:s.id,icon:s.icon,label:s.title,parent:s.in},classes:"node-group"})})}e(Ct,"addGroups");function It(t,i){t.forEach((s)=>{let{lhsId:w,rhsId:m,lhsInto:N,lhsGroup:B,rhsInto:v,lhsDir:I,rhsDir:c,rhsGroup:y,title:d}=s,f=dt(s.lhsDir,s.rhsDir)?"segments":"straight",u={id:`${w}-${m}`,label:d,source:w,sourceDir:I,sourceArrow:N,sourceGroup:B,sourceEndpoint:I==="L"?"0 50%":I==="R"?"100% 50%":I==="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%"};i.add({group:"edges",data:u,classes:f})})}e(It,"addEdges");function bt(t,i,s,w=[]){let m=e((f,u)=>{let g=new Map;for(let[r,_]of f.entries()){let F=`${r}`,o=0,h=[..._.entries()];if(h.length===1){g.set(F,h[0][1]);continue}for(let k=0;k<h.length-1;k++)for(let n=k+1;n<h.length;n++){let[P,j]=h[k],[M,q]=h[n];if(s.get(mt(P,M))===u)g.set(F,[...g.get(F)??[],...j,...q]);else if(P==="default"||M==="default")g.set(F,[...g.get(F)??[],...j,...q]);else{let x=`${F}-${o++}`;g.set(x,j);let H=`${F}-${o++}`;g.set(H,q)}}}return g},"flattenAlignments"),N=i.map((f)=>{let u=new Map,g=new Map;return f.forEach(([r,_],F)=>{let o=t.getNode(F)?.in??"default",h=u.get(_)??new Map;if(!u.has(_))u.set(_,h);let k=g.get(r)??new Map;if(!g.has(r))g.set(r,k);for(let n of[h,k]){let P=n.get(o)??[];if(!n.has(o))n.set(o,P);P.push(F)}}),{horiz:[...m(u,"horizontal").values()].filter((r)=>r.length>1),vert:[...m(g,"vertical").values()].filter((r)=>r.length>1)}}),[B,v]=N.reduce(([f,u],{horiz:g,vert:r})=>[[...f,...g],[...u,...r]],[[],[]]),I=new Set;w.forEach((f)=>f.members.forEach((u)=>I.add(u)));let c=e((f)=>f.filter((u)=>!u.some((g)=>I.has(g))),"dropOverlapping"),y=c(B),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,i,s=[]){let w=[],m=i.getConfigField("iconSize"),N=i.getConfigField("idealEdgeLengthMultiplier"),B=N*m,v=new Set;s.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:B});else w.push({top:f,bottom:u,gap:B})}});let I=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(([r,_])=>[I(_),r])),f=[I([0,0])],u={},g={L:[-1,0],R:[1,0],T:[0,1],B:[0,-1]};while(f.length>0){let r=f.shift();if(r){u[r]=1;let _=d.get(r);if(_){let F=c(r);Object.entries(g).forEach(([o,h])=>{let k=I([F[0]+h[0],F[1]+h[1]]),n=d.get(k);if(n&&!u[k]){if(f.push(k),v.has(`${_}|${n}`))return;w.push({[gt[o]]:n,[gt[kt(o)]]:_,gap:N*m})}})}}}}),w}e(Nt,"getRelativeConstraints");function St(t,i,s,w,m,{spatialMaps:N,groupAlignments:B}){return new Promise((v)=>{let I=p("body").append("div").attr("id","cy").attr("style","display:none"),c=ut({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}}});I.remove(),Ct(s,c),Tt(t,c,m),At(i,c,m),It(w,c);let y=m.getLayoutHints(),d=bt(m,N,B,y),f=Nt(N,m,y),u=m.getConfigField("iconSize"),g=m.getConfigField("idealEdgeLengthMultiplier")*u,r=0.5*u,_=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[k,n]=h.connectedNodes(),{parent:P}=Qe(k),{parent:j}=Qe(n);return P===j?g:r},edgeElasticity(h){let[k,n]=h.connectedNodes(),{parent:P}=Qe(k),{parent:j}=Qe(n);return P===j?_:0.001},alignmentConstraint:d,relativePlacementConstraint:f});o.one("layoutstop",()=>{function h(k,n,P,j){let M,q,{x:Y,y:x}=k,{x:H,y:Z}=n;q=(j-x+(Y-P)*(x-Z)/(Y-H))/Math.sqrt(1+Math.pow((x-Z)/(Y-H),2)),M=Math.sqrt(Math.pow(j-x,2)+Math.pow(P-Y,2)-Math.pow(q,2));let Q=Math.sqrt(Math.pow(H-Y,2)+Math.pow(Z-x,2));M=M/Q;let se=(H-Y)*(j-x)-(Z-x)*(P-Y);switch(!0){case se>=0:se=1;break;case se<0:se=-1;break}let re=(H-Y)*(P-Y)+(Z-x)*(j-x);switch(!0){case re>=0:re=1;break;case re<0:re=-1;break}return q=Math.abs(q)*se,M=M*re,{distances:q,weights:M}}e(h,"getSegmentWeights"),c.startBatch();for(let k of Object.values(c.edges()))if(k.data?.()){let{x:n,y:P}=k.source().position(),{x:j,y:M}=k.target().position();if(n!==j&&P!==M){let q=k.sourceEndpoint(),Y=k.targetEndpoint(),{sourceDir:x}=yt(k),[H,Z]=Ve(x)?[q.x,Y.y]:[Y.x,q.y],{weights:Q,distances:se}=h(q,Y,H,Z);k.style("segment-distances",se),k.style("segment-weights",Q)}}c.endBatch(),ct(F,()=>o.run())});try{ct(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)=>{a.info("Ready",h),v(c)})})}e(St,"layoutArchitecture");var Xt=e(async(t,i,s,w)=>{let m=w.db;m.setDiagramId(i);let N=m.getServices(),B=m.getJunctions(),v=m.getGroups(),I=m.getEdges(),c=m.getDataStructures(),y=V(i),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,N,i),Vt(m,f,B,i);let g=await St(N,B,v,I,m,c);await Yt(d,g,m,i),await Ut(u,g,m,i),Lt(m,g),ht(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,7 +1,7 @@
1
- import{h,o,g,i,a,v,t,n,_,yt}from"./chunk-4bzqrwr0.js";var U="__chat__";function T(s){if(!Number.isFinite(s)||s<=0)return"0";if(s<1000)return Math.round(s).toString();if(s<1e6)return`${(s/1000).toFixed(1)}K`;if(s<1e9)return`${(s/1e6).toFixed(2)}M`;return`${(s/1e9).toFixed(2)}B`}function B(s){let c=Number.isFinite(s)?Math.max(0,s):0;return Math.round(c).toLocaleString("en-US")}function P(s){if(!Number.isFinite(s)||s<=0)return"0s";if(s<1000)return"<1s";if(s<60000)return`${Math.floor(s/1000)}s`;if(s<3600000){let u=Math.floor(s/1000),e=Math.floor(u/60),d=u%60;return d>0?`${e}m ${d}s`:`${e}m`}if(s<259200000){let u=Math.floor(s/60000),e=Math.floor(u/60),d=u%60;return d>0?`${e}h ${d}m`:`${e}h`}let c=Math.floor(s/3600000),x=Math.floor(c/24),p=c%24;return p>0?`${x}d ${p}h`:`${x}d`}function X(s){if(!Number.isFinite(s)||s<=0)return"0s";if(s<1000)return"<1s";if(s<60000)return`${Math.round(s/1000)}s`;if(s<3600000)return`${Math.round(s/60000)}m`;if(s<86400000){let p=s/3600000;return`${p>=10?Math.round(p).toString():p.toFixed(1).replace(/\.0$/,"")}h`}let c=s/86400000;return`${c>=10?Math.round(c).toString():c.toFixed(1).replace(/\.0$/,"")}d`}function L(s,c=1){if(!Number.isFinite(s)||s<=0)return"0%";let x=10**-c/100;if(s<x)return`<${(x*100).toFixed(c)}%`;return`${(s*100).toFixed(c)}%`}function K(s){if(!Number.isFinite(s)||s<=0)return"0 B";if(s<1024)return`${Math.round(s)} B`;if(s<1048576)return`${(s/1024).toFixed(1)} KB`;if(s<1073741824)return`${(s/1048576).toFixed(2)} MB`;return`${(s/1073741824).toFixed(2)} GB`}function G(s){let c=s.split("-"),x=c[1],p=c[2];if(x!==void 0&&p!==void 0)return`${x}/${p}`;return s}function Y(s){let c=s.split("-"),x=c[0],p=c[1],u=c[2];if(x===void 0||p===void 0||u===void 0)return s;let e=Number(x),d=Number(p)-1,b=Number(u),w=new Date(Date.UTC(e,d,b)),R=["周日","周一","周二","周三","周四","周五","周六"],M=w.getUTCDay(),F=R[M]??"";return`${s} ${F}`}function ee(s,c=Date.now()){if(s===null||s===void 0||!Number.isFinite(s)||s<=0)return"从未";let x=Math.max(0,c-s);if(x<60000)return"刚刚";if(x<3600000)return`${Math.max(1,Math.floor(x/60000))} 分钟前`;if(x<86400000)return`${Math.max(1,Math.floor(x/3600000))} 小时前`;if(x<2592000000)return`${Math.max(1,Math.floor(x/86400000))} 天前`;let p=new Date(s),u=p.getFullYear(),e=String(p.getMonth()+1).padStart(2,"0"),d=String(p.getDate()).padStart(2,"0");return`${u}-${e}-${d}`}function te(s){let{projects:c,selectedProjectID:x,onSelectProject:p}=s,{style:u}=_();if(c.length===0)return t("div",{className:u("surface.empty"),children:"暂无项目统计数据"});return t("div",{className:"divide-y divide-line",children:c.map((e)=>{let d=e.projectID??U,b=x===d,w=Math.max(e.tokenShare>0?1:0,e.tokenShare*100);return n("div",{className:"p-4 space-y-2.5",children:[n("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs",children:[n("div",{className:"flex min-w-0 items-center gap-2",children:[t("span",{className:"font-medium text-sm text-ink truncate",children:e.name}),t("span",{className:u("control.badge","font-mono truncate max-w-[240px]"),title:e.directory||"未绑定项目目录",children:e.directory||"独立会话"}),t("button",{type:"button",onClick:()=>p(b?null:d),className:"rounded px-1.5 py-0.5 text-[11px] text-accent hover:bg-accent/10 transition-colors cursor-pointer shrink-0",children:b?"取消筛选":"筛选"})]}),n("div",{className:"flex items-baseline gap-1.5 font-mono tabular-nums shrink-0",children:[t("span",{className:"text-xs font-medium text-ink",title:B(e.totalTokens),children:T(e.totalTokens)}),n("span",{className:"text-[11px] text-faint",children:["(",L(e.tokenShare),")"]})]})]}),t("div",{className:"h-1.5 w-full overflow-hidden rounded-full bg-raised",children:t("div",{className:"h-full rounded-full bg-accent transition-all duration-300",style:{width:`${w}%`}})}),n("div",{className:"flex flex-wrap items-center justify-between gap-x-4 gap-y-1 font-mono text-[11px] text-dim tabular-nums",children:[n("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[n("span",{children:["输入 ",t("span",{className:"text-ink",children:T(e.inputTokens)})]}),n("span",{children:["输出 ",t("span",{className:"text-ink",children:T(e.outputTokens)})]}),n("span",{children:["缓存读 ",t("span",{className:"text-ink",children:T(e.cacheReadTokens)}),n("span",{className:"text-faint",children:[" (",L(e.cacheHitRate),")"]})]})]}),n("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[n("span",{children:["耗时 ",t("span",{className:"text-ink",children:P(e.activeDurationMs)})]}),n("span",{children:[t("span",{className:"text-ink",children:e.sessionCount.toLocaleString()})," 会话"]}),n("span",{children:["工具 ",t("span",{className:"text-ink",children:e.toolCalls.toLocaleString()})," 次"]})]})]})]},d)})})}function ae(s){let{models:c}=s,{ModelIcon:x,style:p}=_();if(c.length===0)return t("div",{className:p("surface.empty"),children:"暂无模型调用数据"});return t("div",{className:"divide-y divide-line",children:c.map((u)=>{let e=Math.max(u.share>0?1:0,u.share*100);return n("div",{className:"p-4 space-y-2.5",children:[n("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs",children:[n("div",{className:"flex min-w-0 items-center gap-2",children:[t(x,{modelID:u.model,className:"size-4 shrink-0"}),t("span",{className:"font-mono text-sm font-medium text-ink truncate",children:u.shortName}),t("span",{className:p("control.badge","font-mono shrink-0"),children:u.provider})]}),n("div",{className:"flex items-baseline gap-2.5 font-mono tabular-nums shrink-0",children:[u.avgTps!==null&&n("span",{className:"text-[11px] text-dim",children:[u.avgTps.toFixed(1)," tok/s"]}),n("span",{className:"text-xs font-medium text-ink",title:B(u.totalTokens),children:[T(u.totalTokens)," ",n("span",{className:"text-[11px] font-normal text-faint",children:["(",L(u.share),")"]})]})]})]}),t("div",{className:"h-1.5 w-full overflow-hidden rounded-full bg-raised",children:t("div",{className:"h-full rounded-full bg-accent transition-all duration-300",style:{width:`${e}%`}})}),n("div",{className:"flex flex-wrap items-center justify-between gap-x-4 gap-y-1 font-mono text-[11px] text-dim tabular-nums",children:[n("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[n("span",{children:["输入 ",t("span",{className:"text-ink",children:T(u.inputTokens)})]}),n("span",{children:["输出 ",t("span",{className:"text-ink",children:T(u.outputTokens)})]}),n("span",{children:["缓存读 ",t("span",{className:"text-ink",children:T(u.cacheReadTokens)}),n("span",{className:"text-faint",children:[" (",L(u.cacheHitRate),")"]})]})]}),n("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[n("span",{children:[t("span",{className:"text-ink",children:u.turns.toLocaleString()})," 轮",u.errors>0?n("span",{className:"text-danger",children:[" (",u.errors," 错)"]}):null]}),n("span",{children:["工具 ",t("span",{className:"text-ink",children:u.toolCalls.toLocaleString()})," 次"]}),u.generationMs>0&&n("span",{children:["推理 ",t("span",{className:"text-ink",children:X(u.generationMs)})]})]})]})]},u.model)})})}function ne(s){let{tools:c}=s,{StatusChip:x,style:p}=_();if(c.length===0)return t("div",{className:p("surface.empty"),children:"暂无工具调用数据"});return t("div",{className:"divide-y divide-line",children:c.map((u)=>{let e=Math.max(u.share>0?1:0,u.share*100),d=u.successRate>=0.95?"success":u.successRate>=0.8?"warning":"danger",b=Math.max(0,u.calls-u.errors),w=u.calls>0?Math.round(u.outputBytes/u.calls):0;return n("div",{className:"p-4 space-y-2.5",children:[n("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs",children:[n("div",{className:"flex min-w-0 items-center gap-2",children:[t("span",{className:"font-mono text-sm font-medium text-ink truncate",children:u.name}),n(x,{tone:d,children:["成功率 ",L(u.successRate)]})]}),n("div",{className:"flex items-baseline gap-1.5 font-mono tabular-nums shrink-0",children:[n("span",{className:"text-xs font-medium text-ink",children:[u.calls.toLocaleString()," 次"]}),n("span",{className:"text-[11px] text-faint",children:["(",L(u.share),")"]})]})]}),t("div",{className:"h-1.5 w-full overflow-hidden rounded-full bg-raised",children:t("div",{className:"h-full rounded-full bg-accent transition-all duration-300",style:{width:`${e}%`}})}),n("div",{className:"flex flex-wrap items-center justify-between gap-x-4 gap-y-1 font-mono text-[11px] text-dim tabular-nums",children:[n("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[n("span",{children:["成功 ",t("span",{className:"text-ink",children:b.toLocaleString()})," 次"]}),n("span",{children:["失败 ",t("span",{className:u.errors>0?"text-danger":"text-ink",children:u.errors.toLocaleString()})," 次"]})]}),n("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[n("span",{children:["累计输出 ",t("span",{className:"text-ink",children:K(u.outputBytes)})]}),n("span",{children:["单次均值 ",t("span",{className:"text-ink",children:K(w)})]})]})]})]},u.name)})})}function se(s){let{sessions:c,onOpenSession:x}=s,{style:p}=_();if(c.length===0)return t("div",{className:p("surface.empty"),children:"暂无高消耗会话记录"});let u=Math.max(1,...c.map((e)=>e.totalTokens));return t("div",{className:"divide-y divide-line",children:c.map((e)=>{let d=u>0?Math.max(1,e.totalTokens/u*100):0,b=e.model.split("/").pop()??e.model;return n("button",{type:"button",onClick:()=>x(e.id),className:"group block w-full p-4 text-left space-y-2.5 hover:bg-raised/40 transition-colors cursor-pointer",children:[n("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs",children:[n("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[t("span",{className:"font-medium text-sm text-ink truncate group-hover:text-accent transition-colors",children:e.title.trim()||"新会话"}),t("span",{className:p("control.badge","font-mono truncate max-w-[140px] shrink-0"),title:e.projectName,children:e.projectName}),e.kind==="sub"&&t("span",{className:"rounded bg-accent/15 px-1.5 py-0.5 text-[10.5px] text-accent shrink-0",children:"子代理"}),e.archivedAt!==null&&t("span",{className:p("control.badge","shrink-0"),children:"已归档"})]}),n("div",{className:"flex items-center gap-1.5 font-mono tabular-nums shrink-0",children:[t("span",{className:"text-xs font-medium text-ink",title:B(e.totalTokens),children:T(e.totalTokens)}),t(yt,{className:"size-3.5 text-faint group-hover:text-ink group-hover:translate-x-0.5 transition-all"})]})]}),t("div",{className:"h-1.5 w-full overflow-hidden rounded-full bg-raised",children:t("div",{className:"h-full rounded-full bg-accent transition-all duration-300",style:{width:`${d}%`}})}),n("div",{className:"flex flex-wrap items-center justify-between gap-x-4 gap-y-1 font-mono text-[11px] text-dim tabular-nums",children:[n("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[n("span",{children:["输入 ",t("span",{className:"text-ink",children:T(e.inputTokens)})]}),n("span",{children:["输出 ",t("span",{className:"text-ink",children:T(e.outputTokens)})]}),n("span",{children:["缓存读 ",t("span",{className:"text-ink",children:T(e.cacheReadTokens)})]})]}),n("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[t("span",{className:"text-ink",children:b}),n("span",{children:["耗时 ",t("span",{className:"text-ink",children:P(e.activeDurationMs)})]}),n("span",{children:[t("span",{className:"text-ink",children:e.assistantTurns})," 轮"]}),t("span",{className:"text-faint",children:ee(e.updated)})]})]})]},e.id)})})}var oe=[{value:"tokens",label:"Token 用量"},{value:"duration",label:"活跃耗时"},{value:"activity",label:"交互轮次"}];function re(s){let{cn:c,Segmented:x,SettingGroup:p,style:u}=_(),{daily:e}=s,[d,b]=a("tokens"),[w,R]=a(null),M=g(()=>e.some((r)=>r.totalTokens>0||r.activeDurationMs>0||r.runs>0),[e]),F=g(()=>{if(e.length===0)return{totalText:"0",avgText:"0",peakDate:"—",peakValueText:"0"};if(d==="tokens"){let S=e.reduce((C,I)=>C+I.totalTokens,0),j=e.filter((C)=>C.totalTokens>0).length,y=e[0];for(let C of e)if(!y||C.totalTokens>y.totalTokens)y=C;return{totalText:T(S),totalFullText:B(S),avgText:j>0?T(Math.round(S/j)):"0",peakDate:y&&y.totalTokens>0?G(y.date):"—",peakValueText:y&&y.totalTokens>0?T(y.totalTokens):"0"}}if(d==="duration"){let S=e.reduce((C,I)=>C+I.activeDurationMs,0),j=e.filter((C)=>C.activeDurationMs>0).length,y=e[0];for(let C of e)if(!y||C.activeDurationMs>y.activeDurationMs)y=C;return{totalText:P(S),totalFullText:P(S),avgText:j>0?P(Math.round(S/j)):"0s",peakDate:y&&y.activeDurationMs>0?G(y.date):"—",peakValueText:y&&y.activeDurationMs>0?P(y.activeDurationMs):"0s"}}let r=e.reduce((S,j)=>S+j.assistantTurns,0),l=e.reduce((S,j)=>S+j.userMessages,0),f=r+l,N=e.filter((S)=>S.assistantTurns>0||S.userMessages>0).length,k=e[0];for(let S of e){let j=k?k.assistantTurns+k.userMessages:0;if(!k||S.assistantTurns+S.userMessages>j)k=S}let A=k?k.assistantTurns+k.userMessages:0;return{totalText:`${f.toLocaleString()} 轮`,totalFullText:`助手 ${r.toLocaleString()} 轮 · 用户 ${l.toLocaleString()} 问`,avgText:N>0?`${(f/N).toFixed(1)} 轮/天`:"0 轮/天",peakDate:k&&A>0?G(k.date):"—",peakValueText:k&&A>0?`${A.toLocaleString()} 轮`:"0 轮"}},[e,d]),D=g(()=>{if(w){let r=e.find((l)=>l.date===w);if(r)return r}for(let r=e.length-1;r>=0;r--){let l=e[r];if(l&&(l.totalTokens>0||l.activeDurationMs>0||l.runs>0))return l}return e[e.length-1]},[e,w]),z=g(()=>{if(d==="tokens")return Math.max(1,...e.map((r)=>r.totalTokens));if(d==="duration")return Math.max(1000,...e.map((r)=>r.activeDurationMs));return Math.max(1,...e.map((r)=>r.assistantTurns+r.userMessages))},[e,d]),m=g(()=>{if(e.length<=7)return e.map((f)=>f.date);let r=6,l=[];for(let f=0;f<r;f++){let N=Math.round(f*(e.length-1)/(r-1)),k=e[N];if(k)l.push(k.date)}return l},[e]);if(!M)return t(p,{title:"每日趋势",action:t(x,{value:d,onChange:(r)=>b(r),options:oe}),children:t("div",{className:u("surface.empty"),children:"当前时间范围内暂无活跃数据"})});return t(p,{title:"每日趋势",action:t(x,{value:d,onChange:(r)=>b(r),options:oe}),children:n("div",{className:"p-4 space-y-4",children:[n("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs",children:[n("div",{className:"flex flex-wrap items-center gap-x-3.5 gap-y-1 font-mono text-dim tabular-nums",children:[n("span",{children:["汇总 ",t("span",{className:"text-ink",children:F.totalText})]}),n("span",{children:["日均 ",t("span",{className:"text-ink",children:F.avgText})]}),n("span",{children:["峰值 ",t("span",{className:"text-ink",children:F.peakValueText}),F.peakDate!=="—"?n("span",{className:"text-faint",children:[" (",F.peakDate,")"]}):null]})]}),n("div",{className:"flex items-center gap-3 text-[11px] text-dim",children:[d==="tokens"&&n(v,{children:[n("span",{className:"inline-flex items-center gap-1.5",children:[t("span",{className:"size-2 rounded-full bg-accent/40"}),"缓存读"]}),n("span",{className:"inline-flex items-center gap-1.5",children:[t("span",{className:"size-2 rounded-full bg-accent"}),"输入"]}),n("span",{className:"inline-flex items-center gap-1.5",children:[t("span",{className:"size-2 rounded-full bg-success"}),"输出"]})]}),d==="duration"&&n(v,{children:[n("span",{className:"inline-flex items-center gap-1.5",children:[t("span",{className:"size-2 rounded-full bg-accent"}),"工作调度"]}),n("span",{className:"inline-flex items-center gap-1.5",children:[t("span",{className:"size-2 rounded-full bg-success"}),"模型推理"]})]}),d==="activity"&&n(v,{children:[n("span",{className:"inline-flex items-center gap-1.5",children:[t("span",{className:"size-2 rounded-full bg-accent"}),"助手回复"]}),n("span",{className:"inline-flex items-center gap-1.5",children:[t("span",{className:"size-2 rounded-full bg-success"}),"用户提问"]})]})]})]}),n("div",{className:"relative h-44 w-full pt-1",children:[n("div",{className:"absolute inset-0 flex flex-col justify-between pointer-events-none pb-5 text-[10px] text-faint/60",children:[t("div",{className:"border-b border-line/40 w-full"}),t("div",{className:"border-b border-line/30 w-full"}),t("div",{className:"border-b border-line/40 w-full"})]}),n("section",{"aria-label":"每日趋势柱状序列",className:"relative h-full flex flex-col justify-between",onMouseLeave:()=>R(null),children:[t("div",{className:"flex-1 flex items-end gap-1 sm:gap-1.5 pb-2",children:e.map((r)=>{let l=r.totalTokens;if(d==="duration")l=r.activeDurationMs;else if(d==="activity")l=r.assistantTurns+r.userMessages;let f=l<=0,N=f?0:Math.max(3,Math.min(100,l/z*100)),k=D?.date===r.date;return n("button",{type:"button","aria-label":`${r.date} 统计数据`,className:"flex-1 h-full flex flex-col justify-end items-center group cursor-pointer relative min-w-0 bg-transparent p-0 border-0 focus:outline-hidden",onMouseEnter:()=>R(r.date),onFocus:()=>R(r.date),onClick:()=>R(r.date),children:[t("div",{className:c("absolute inset-y-0 w-full rounded-xs transition-colors pointer-events-none",k?"bg-accent/10":"group-hover:bg-raised/60")}),f?t("div",{className:"h-1 w-full max-w-[24px] rounded-full bg-raised group-hover:bg-dim/30"}):n("div",{className:"w-full max-w-[24px] rounded-t-xs overflow-hidden flex flex-col justify-end transition-all duration-150",style:{height:`${N}%`},children:[d==="tokens"&&n(v,{children:[r.outputTokens>0&&t("div",{className:"bg-success transition-all duration-200",style:{height:`${r.outputTokens/r.totalTokens*100}%`}}),r.inputTokens+r.cacheWriteTokens>0&&t("div",{className:"bg-accent transition-all duration-200",style:{height:`${(r.inputTokens+r.cacheWriteTokens)/r.totalTokens*100}%`}}),r.cacheReadTokens>0&&t("div",{className:"bg-accent/40 transition-all duration-200",style:{height:`${r.cacheReadTokens/r.totalTokens*100}%`}})]}),d==="duration"&&n(v,{children:[r.generationMs>0&&t("div",{className:"bg-success transition-all duration-200",style:{height:`${Math.min(100,r.generationMs/Math.max(1,r.activeDurationMs)*100)}%`}}),t("div",{className:"bg-accent flex-1 transition-all duration-200"})]}),d==="activity"&&n(v,{children:[r.userMessages>0&&t("div",{className:"bg-success transition-all duration-200",style:{height:`${r.userMessages/Math.max(1,r.assistantTurns+r.userMessages)*100}%`}}),t("div",{className:"bg-accent flex-1 transition-all duration-200"})]})]}),k&&t("div",{className:"absolute -bottom-1 size-1 rounded-full bg-accent"})]},r.date)})}),t("div",{className:c("flex items-center pt-1.5 text-[10px] text-faint font-mono tabular-nums",e.length<=7?"gap-1 sm:gap-1.5":"justify-between"),children:m.map((r)=>t("div",{className:c("whitespace-nowrap",e.length<=7&&"flex-1 text-center"),children:G(r)},r))})]})]}),t("div",{className:"flex flex-wrap items-center justify-between gap-2 border-t border-line pt-3 font-mono text-xs tabular-nums",children:D?n(v,{children:[t("span",{className:"text-ink",children:Y(D.date)}),n("div",{className:"flex flex-wrap items-center gap-x-3.5 gap-y-1 text-dim",children:[n("span",{children:["Token ",t("span",{className:"text-ink",children:T(D.totalTokens)})]}),n("span",{children:["耗时 ",t("span",{className:"text-ink",children:P(D.activeDurationMs)})]}),n("span",{children:["交互 ",n("span",{className:"text-ink",children:[D.assistantTurns+D.userMessages," 轮"]})]}),n("span",{children:["工具 ",n("span",{className:"text-ink",children:[D.toolCalls," 次"]})]})]})]}):t("span",{className:"font-sans text-faint",children:"悬停柱状图查看单日明细"})})]})})}function ie(s){let{cn:c,SettingGroup:x}=_(),{daily:p,hourly:u}=s,[e,d]=a(null),b=g(()=>{let l=new Map;for(let N of u)l.set(N.hour,N);let f=[];for(let N=0;N<24;N++){let k=l.get(N);if(k)f.push(k);else f.push({hour:N,totalTokens:0,activeDurationMs:0,userMessages:0,assistantTurns:0,runs:0})}return f},[u]),w=g(()=>{let l=b[0];for(let f of b)if(!l||f.totalTokens>l.totalTokens)l=f;return l&&l.totalTokens>0?l:null},[b]),R=g(()=>b.reduce((l,f)=>l+f.totalTokens,0),[b]),M=g(()=>Math.max(1,...b.map((l)=>l.totalTokens)),[b]),F=g(()=>{if(R<=0)return 0;return b.filter((f)=>f.hour>=8&&f.hour<20).reduce((f,N)=>f+N.totalTokens,0)/R},[b,R]),D=g(()=>Math.max(1,...p.map((l)=>l.totalTokens)),[p]),z=g(()=>{let l=0,f=0;for(let N of p)if(N.totalTokens>0||N.activeDurationMs>0||N.runs>0){if(f++,f>l)l=f}else f=0;return l},[p]),m=g(()=>p.filter((l)=>l.totalTokens>0||l.activeDurationMs>0||l.runs>0).length,[p]),r=e!==null?b[e]:w;return n(x,{title:"活跃时段与热力",action:n("div",{className:"flex items-center gap-3 font-mono text-xs text-faint tabular-nums",children:[n("span",{children:["日间占比 ",L(F)]}),n("span",{children:["连续活跃 ",z," 天"]}),n("span",{children:["活跃 ",m,"/",p.length," 天"]})]}),children:[n("div",{className:"p-4 space-y-3",children:[n("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs",children:[t("span",{className:"text-dim",children:"24 小时分布"}),r?n("div",{className:"flex items-center gap-3 font-mono text-dim tabular-nums",children:[n("span",{className:"text-ink",children:[e!==null?"时段 ":"高峰 ",String(r.hour).padStart(2,"0"),":00 -"," ",String((r.hour+1)%24).padStart(2,"0"),":00"]}),t("span",{className:"text-ink",children:T(r.totalTokens)}),r.activeDurationMs>0&&t("span",{children:P(r.activeDurationMs)})]}):t("span",{className:"text-faint",children:"暂无时段分布"})]}),n("section",{"aria-label":"24 小时活跃分布序列",className:"h-28 w-full flex flex-col justify-between pt-1",onMouseLeave:()=>d(null),children:[t("div",{className:"flex-1 flex items-end gap-1.5 pb-1.5",children:b.map((l)=>{let f=w?.hour===l.hour,N=e===l.hour,k=l.totalTokens>0?Math.max(6,l.totalTokens/M*100):0,A=`${String(l.hour).padStart(2,"0")}:00 - ${String((l.hour+1)%24).padStart(2,"0")}:00
1
+ import{h,o,g,i,r,y,t,n,_,rt}from"./chunk-j6a4z530.js";var U="__chat__";function N(a){if(!Number.isFinite(a)||a<=0)return"0";if(a<1000)return Math.round(a).toString();if(a<1e6)return`${(a/1000).toFixed(1)}K`;if(a<1e9)return`${(a/1e6).toFixed(2)}M`;return`${(a/1e9).toFixed(2)}B`}function B(a){let c=Number.isFinite(a)?Math.max(0,a):0;return Math.round(c).toLocaleString("en-US")}function P(a){if(!Number.isFinite(a)||a<=0)return"0s";if(a<1000)return"<1s";if(a<60000)return`${Math.floor(a/1000)}s`;if(a<3600000){let u=Math.floor(a/1000),e=Math.floor(u/60),d=u%60;return d>0?`${e}m ${d}s`:`${e}m`}if(a<259200000){let u=Math.floor(a/60000),e=Math.floor(u/60),d=u%60;return d>0?`${e}h ${d}m`:`${e}h`}let c=Math.floor(a/3600000),x=Math.floor(c/24),p=c%24;return p>0?`${x}d ${p}h`:`${x}d`}function X(a){if(!Number.isFinite(a)||a<=0)return"0s";if(a<1000)return"<1s";if(a<60000)return`${Math.round(a/1000)}s`;if(a<3600000)return`${Math.round(a/60000)}m`;if(a<86400000){let p=a/3600000;return`${p>=10?Math.round(p).toString():p.toFixed(1).replace(/\.0$/,"")}h`}let c=a/86400000;return`${c>=10?Math.round(c).toString():c.toFixed(1).replace(/\.0$/,"")}d`}function L(a,c=1){if(!Number.isFinite(a)||a<=0)return"0%";let x=10**-c/100;if(a<x)return`<${(x*100).toFixed(c)}%`;return`${(a*100).toFixed(c)}%`}function K(a){if(!Number.isFinite(a)||a<=0)return"0 B";if(a<1024)return`${Math.round(a)} B`;if(a<1048576)return`${(a/1024).toFixed(1)} KB`;if(a<1073741824)return`${(a/1048576).toFixed(2)} MB`;return`${(a/1073741824).toFixed(2)} GB`}function G(a){let c=a.split("-"),x=c[1],p=c[2];if(x!==void 0&&p!==void 0)return`${x}/${p}`;return a}function Y(a){let c=a.split("-"),x=c[0],p=c[1],u=c[2];if(x===void 0||p===void 0||u===void 0)return a;let e=Number(x),d=Number(p)-1,v=Number(u),w=new Date(Date.UTC(e,d,v)),R=["周日","周一","周二","周三","周四","周五","周六"],M=w.getUTCDay(),F=R[M]??"";return`${a} ${F}`}function ee(a,c=Date.now()){if(a===null||a===void 0||!Number.isFinite(a)||a<=0)return"从未";let x=Math.max(0,c-a);if(x<60000)return"刚刚";if(x<3600000)return`${Math.max(1,Math.floor(x/60000))} 分钟前`;if(x<86400000)return`${Math.max(1,Math.floor(x/3600000))} 小时前`;if(x<2592000000)return`${Math.max(1,Math.floor(x/86400000))} 天前`;let p=new Date(a),u=p.getFullYear(),e=String(p.getMonth()+1).padStart(2,"0"),d=String(p.getDate()).padStart(2,"0");return`${u}-${e}-${d}`}function te(a){let{projects:c,selectedProjectID:x,onSelectProject:p}=a,{style:u}=_();if(c.length===0)return t("div",{className:u("surface.empty"),children:"暂无项目统计数据"});return t("div",{className:"divide-y divide-line",children:c.map((e)=>{let d=e.projectID??U,v=x===d,w=Math.max(e.tokenShare>0?1:0,e.tokenShare*100);return n("div",{className:"p-4 space-y-2.5",children:[n("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs",children:[n("div",{className:"flex min-w-0 items-center gap-2",children:[t("span",{className:"font-medium text-sm text-ink truncate",children:e.name}),t("span",{className:u("control.badge","font-mono truncate max-w-[240px]"),title:e.directory||"未绑定项目目录",children:e.directory||"独立会话"}),t("button",{type:"button",onClick:()=>p(v?null:d),className:"rounded px-1.5 py-0.5 text-[11px] text-accent hover:bg-accent/10 transition-colors cursor-pointer shrink-0",children:v?"取消筛选":"筛选"})]}),n("div",{className:"flex items-baseline gap-1.5 font-mono tabular-nums shrink-0",children:[t("span",{className:"text-xs font-medium text-ink",title:B(e.totalTokens),children:N(e.totalTokens)}),n("span",{className:"text-[11px] text-faint",children:["(",L(e.tokenShare),")"]})]})]}),t("div",{className:"h-1.5 w-full overflow-hidden rounded-full bg-raised",children:t("div",{className:"h-full rounded-full bg-accent transition-all duration-300",style:{width:`${w}%`}})}),n("div",{className:"flex flex-wrap items-center justify-between gap-x-4 gap-y-1 font-mono text-[11px] text-dim tabular-nums",children:[n("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[n("span",{children:["输入 ",t("span",{className:"text-ink",children:N(e.inputTokens)})]}),n("span",{children:["输出 ",t("span",{className:"text-ink",children:N(e.outputTokens)})]}),n("span",{children:["缓存读 ",t("span",{className:"text-ink",children:N(e.cacheReadTokens)}),n("span",{className:"text-faint",children:[" (",L(e.cacheHitRate),")"]})]})]}),n("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[n("span",{children:["耗时 ",t("span",{className:"text-ink",children:P(e.activeDurationMs)})]}),n("span",{children:[t("span",{className:"text-ink",children:e.sessionCount.toLocaleString()})," 会话"]}),n("span",{children:["工具 ",t("span",{className:"text-ink",children:e.toolCalls.toLocaleString()})," 次"]})]})]})]},d)})})}function ae(a){let{models:c}=a,{ModelIcon:x,style:p}=_();if(c.length===0)return t("div",{className:p("surface.empty"),children:"暂无模型调用数据"});return t("div",{className:"divide-y divide-line",children:c.map((u)=>{let e=Math.max(u.share>0?1:0,u.share*100);return n("div",{className:"p-4 space-y-2.5",children:[n("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs",children:[n("div",{className:"flex min-w-0 items-center gap-2",children:[t(x,{modelID:u.model,className:"size-4 shrink-0"}),t("span",{className:"font-mono text-sm font-medium text-ink truncate",children:u.shortName}),t("span",{className:p("control.badge","font-mono shrink-0"),children:u.provider})]}),n("div",{className:"flex items-baseline gap-2.5 font-mono tabular-nums shrink-0",children:[u.avgTps!==null&&n("span",{className:"text-[11px] text-dim",children:[u.avgTps.toFixed(1)," tok/s"]}),n("span",{className:"text-xs font-medium text-ink",title:B(u.totalTokens),children:[N(u.totalTokens)," ",n("span",{className:"text-[11px] font-normal text-faint",children:["(",L(u.share),")"]})]})]})]}),t("div",{className:"h-1.5 w-full overflow-hidden rounded-full bg-raised",children:t("div",{className:"h-full rounded-full bg-accent transition-all duration-300",style:{width:`${e}%`}})}),n("div",{className:"flex flex-wrap items-center justify-between gap-x-4 gap-y-1 font-mono text-[11px] text-dim tabular-nums",children:[n("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[n("span",{children:["输入 ",t("span",{className:"text-ink",children:N(u.inputTokens)})]}),n("span",{children:["输出 ",t("span",{className:"text-ink",children:N(u.outputTokens)})]}),n("span",{children:["缓存读 ",t("span",{className:"text-ink",children:N(u.cacheReadTokens)}),n("span",{className:"text-faint",children:[" (",L(u.cacheHitRate),")"]})]})]}),n("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[n("span",{children:[t("span",{className:"text-ink",children:u.turns.toLocaleString()})," 轮",u.errors>0?n("span",{className:"text-danger",children:[" (",u.errors," 错)"]}):null]}),n("span",{children:["工具 ",t("span",{className:"text-ink",children:u.toolCalls.toLocaleString()})," 次"]}),u.generationMs>0&&n("span",{children:["推理 ",t("span",{className:"text-ink",children:X(u.generationMs)})]})]})]})]},u.model)})})}function ne(a){let{tools:c}=a,{StatusChip:x,style:p}=_();if(c.length===0)return t("div",{className:p("surface.empty"),children:"暂无工具调用数据"});return t("div",{className:"divide-y divide-line",children:c.map((u)=>{let e=Math.max(u.share>0?1:0,u.share*100),d=u.successRate>=0.95?"success":u.successRate>=0.8?"warning":"danger",v=Math.max(0,u.calls-u.errors),w=u.calls>0?Math.round(u.outputBytes/u.calls):0;return n("div",{className:"p-4 space-y-2.5",children:[n("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs",children:[n("div",{className:"flex min-w-0 items-center gap-2",children:[t("span",{className:"font-mono text-sm font-medium text-ink truncate",children:u.name}),n(x,{tone:d,children:["成功率 ",L(u.successRate)]})]}),n("div",{className:"flex items-baseline gap-1.5 font-mono tabular-nums shrink-0",children:[n("span",{className:"text-xs font-medium text-ink",children:[u.calls.toLocaleString()," 次"]}),n("span",{className:"text-[11px] text-faint",children:["(",L(u.share),")"]})]})]}),t("div",{className:"h-1.5 w-full overflow-hidden rounded-full bg-raised",children:t("div",{className:"h-full rounded-full bg-accent transition-all duration-300",style:{width:`${e}%`}})}),n("div",{className:"flex flex-wrap items-center justify-between gap-x-4 gap-y-1 font-mono text-[11px] text-dim tabular-nums",children:[n("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[n("span",{children:["成功 ",t("span",{className:"text-ink",children:v.toLocaleString()})," 次"]}),n("span",{children:["失败 ",t("span",{className:u.errors>0?"text-danger":"text-ink",children:u.errors.toLocaleString()})," 次"]})]}),n("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[n("span",{children:["累计输出 ",t("span",{className:"text-ink",children:K(u.outputBytes)})]}),n("span",{children:["单次均值 ",t("span",{className:"text-ink",children:K(w)})]})]})]})]},u.name)})})}function se(a){let{sessions:c,onOpenSession:x}=a,{style:p}=_();if(c.length===0)return t("div",{className:p("surface.empty"),children:"暂无高消耗会话记录"});let u=Math.max(1,...c.map((e)=>e.totalTokens));return t("div",{className:"divide-y divide-line",children:c.map((e)=>{let d=u>0?Math.max(1,e.totalTokens/u*100):0,v=e.model.split("/").pop()??e.model;return n("button",{type:"button",onClick:()=>x(e.id),className:"group block w-full p-4 text-left space-y-2.5 hover:bg-raised/40 transition-colors cursor-pointer",children:[n("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs",children:[n("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[t("span",{className:"font-medium text-sm text-ink truncate group-hover:text-accent transition-colors",children:e.title.trim()||"新会话"}),t("span",{className:p("control.badge","font-mono truncate max-w-[140px] shrink-0"),title:e.projectName,children:e.projectName}),e.kind==="sub"&&t("span",{className:"rounded bg-accent/15 px-1.5 py-0.5 text-[10.5px] text-accent shrink-0",children:"子代理"}),e.archivedAt!==null&&t("span",{className:p("control.badge","shrink-0"),children:"已归档"})]}),n("div",{className:"flex items-center gap-1.5 font-mono tabular-nums shrink-0",children:[t("span",{className:"text-xs font-medium text-ink",title:B(e.totalTokens),children:N(e.totalTokens)}),t(rt,{className:"size-3.5 text-faint group-hover:text-ink group-hover:translate-x-0.5 transition-all"})]})]}),t("div",{className:"h-1.5 w-full overflow-hidden rounded-full bg-raised",children:t("div",{className:"h-full rounded-full bg-accent transition-all duration-300",style:{width:`${d}%`}})}),n("div",{className:"flex flex-wrap items-center justify-between gap-x-4 gap-y-1 font-mono text-[11px] text-dim tabular-nums",children:[n("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[n("span",{children:["输入 ",t("span",{className:"text-ink",children:N(e.inputTokens)})]}),n("span",{children:["输出 ",t("span",{className:"text-ink",children:N(e.outputTokens)})]}),n("span",{children:["缓存读 ",t("span",{className:"text-ink",children:N(e.cacheReadTokens)})]})]}),n("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[t("span",{className:"text-ink",children:v}),n("span",{children:["耗时 ",t("span",{className:"text-ink",children:P(e.activeDurationMs)})]}),n("span",{children:[t("span",{className:"text-ink",children:e.assistantTurns})," 轮"]}),t("span",{className:"text-faint",children:ee(e.updated)})]})]})]},e.id)})})}var oe=[{value:"tokens",label:"Token 用量"},{value:"duration",label:"活跃耗时"},{value:"activity",label:"交互轮次"}];function re(a){let{cn:c,Segmented:x,SettingGroup:p,style:u}=_(),{daily:e}=a,[d,v]=r("tokens"),[w,R]=r(null),M=g(()=>e.some((s)=>s.totalTokens>0||s.activeDurationMs>0||s.runs>0),[e]),F=g(()=>{if(e.length===0)return{totalText:"0",avgText:"0",peakDate:"—",peakValueText:"0"};if(d==="tokens"){let S=e.reduce((C,I)=>C+I.totalTokens,0),j=e.filter((C)=>C.totalTokens>0).length,T=e[0];for(let C of e)if(!T||C.totalTokens>T.totalTokens)T=C;return{totalText:N(S),totalFullText:B(S),avgText:j>0?N(Math.round(S/j)):"0",peakDate:T&&T.totalTokens>0?G(T.date):"—",peakValueText:T&&T.totalTokens>0?N(T.totalTokens):"0"}}if(d==="duration"){let S=e.reduce((C,I)=>C+I.activeDurationMs,0),j=e.filter((C)=>C.activeDurationMs>0).length,T=e[0];for(let C of e)if(!T||C.activeDurationMs>T.activeDurationMs)T=C;return{totalText:P(S),totalFullText:P(S),avgText:j>0?P(Math.round(S/j)):"0s",peakDate:T&&T.activeDurationMs>0?G(T.date):"—",peakValueText:T&&T.activeDurationMs>0?P(T.activeDurationMs):"0s"}}let s=e.reduce((S,j)=>S+j.assistantTurns,0),l=e.reduce((S,j)=>S+j.userMessages,0),f=s+l,k=e.filter((S)=>S.assistantTurns>0||S.userMessages>0).length,b=e[0];for(let S of e){let j=b?b.assistantTurns+b.userMessages:0;if(!b||S.assistantTurns+S.userMessages>j)b=S}let A=b?b.assistantTurns+b.userMessages:0;return{totalText:`${f.toLocaleString()} 轮`,totalFullText:`助手 ${s.toLocaleString()} 轮 · 用户 ${l.toLocaleString()} 问`,avgText:k>0?`${(f/k).toFixed(1)} 轮/天`:"0 轮/天",peakDate:b&&A>0?G(b.date):"—",peakValueText:b&&A>0?`${A.toLocaleString()} 轮`:"0 轮"}},[e,d]),D=g(()=>{if(w){let s=e.find((l)=>l.date===w);if(s)return s}for(let s=e.length-1;s>=0;s--){let l=e[s];if(l&&(l.totalTokens>0||l.activeDurationMs>0||l.runs>0))return l}return e[e.length-1]},[e,w]),z=g(()=>{if(d==="tokens")return Math.max(1,...e.map((s)=>s.totalTokens));if(d==="duration")return Math.max(1000,...e.map((s)=>s.activeDurationMs));return Math.max(1,...e.map((s)=>s.assistantTurns+s.userMessages))},[e,d]),m=g(()=>{if(e.length<=7)return e.map((f)=>f.date);let s=6,l=[];for(let f=0;f<s;f++){let k=Math.round(f*(e.length-1)/(s-1)),b=e[k];if(b)l.push(b.date)}return l},[e]);if(!M)return t(p,{title:"每日趋势",action:t(x,{value:d,onChange:(s)=>v(s),options:oe}),children:t("div",{className:u("surface.empty"),children:"当前时间范围内暂无活跃数据"})});return t(p,{title:"每日趋势",action:t(x,{value:d,onChange:(s)=>v(s),options:oe}),children:n("div",{className:"p-4 space-y-4",children:[n("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs",children:[n("div",{className:"flex flex-wrap items-center gap-x-3.5 gap-y-1 font-mono text-dim tabular-nums",children:[n("span",{children:["汇总 ",t("span",{className:"text-ink",children:F.totalText})]}),n("span",{children:["日均 ",t("span",{className:"text-ink",children:F.avgText})]}),n("span",{children:["峰值 ",t("span",{className:"text-ink",children:F.peakValueText}),F.peakDate!=="—"?n("span",{className:"text-faint",children:[" (",F.peakDate,")"]}):null]})]}),n("div",{className:"flex items-center gap-3 text-[11px] text-dim",children:[d==="tokens"&&n(y,{children:[n("span",{className:"inline-flex items-center gap-1.5",children:[t("span",{className:"size-2 rounded-full bg-accent/40"}),"缓存读"]}),n("span",{className:"inline-flex items-center gap-1.5",children:[t("span",{className:"size-2 rounded-full bg-accent"}),"输入"]}),n("span",{className:"inline-flex items-center gap-1.5",children:[t("span",{className:"size-2 rounded-full bg-success"}),"输出"]})]}),d==="duration"&&n(y,{children:[n("span",{className:"inline-flex items-center gap-1.5",children:[t("span",{className:"size-2 rounded-full bg-accent"}),"工作调度"]}),n("span",{className:"inline-flex items-center gap-1.5",children:[t("span",{className:"size-2 rounded-full bg-success"}),"模型推理"]})]}),d==="activity"&&n(y,{children:[n("span",{className:"inline-flex items-center gap-1.5",children:[t("span",{className:"size-2 rounded-full bg-accent"}),"助手回复"]}),n("span",{className:"inline-flex items-center gap-1.5",children:[t("span",{className:"size-2 rounded-full bg-success"}),"用户提问"]})]})]})]}),n("div",{className:"relative h-44 w-full pt-1",children:[n("div",{className:"absolute inset-0 flex flex-col justify-between pointer-events-none pb-5 text-[10px] text-faint/60",children:[t("div",{className:"border-b border-line/40 w-full"}),t("div",{className:"border-b border-line/30 w-full"}),t("div",{className:"border-b border-line/40 w-full"})]}),n("section",{"aria-label":"每日趋势柱状序列",className:"relative h-full flex flex-col justify-between",onMouseLeave:()=>R(null),children:[t("div",{className:"flex-1 flex items-end gap-1 sm:gap-1.5 pb-2",children:e.map((s)=>{let l=s.totalTokens;if(d==="duration")l=s.activeDurationMs;else if(d==="activity")l=s.assistantTurns+s.userMessages;let f=l<=0,k=f?0:Math.max(3,Math.min(100,l/z*100)),b=D?.date===s.date;return n("button",{type:"button","aria-label":`${s.date} 统计数据`,className:"flex-1 h-full flex flex-col justify-end items-center group cursor-pointer relative min-w-0 bg-transparent p-0 border-0 focus:outline-hidden",onMouseEnter:()=>R(s.date),onFocus:()=>R(s.date),onClick:()=>R(s.date),children:[t("div",{className:c("absolute inset-y-0 w-full rounded-xs transition-colors pointer-events-none",b?"bg-accent/10":"group-hover:bg-raised/60")}),f?t("div",{className:"h-1 w-full max-w-[24px] rounded-full bg-raised group-hover:bg-dim/30"}):n("div",{className:"w-full max-w-[24px] rounded-t-xs overflow-hidden flex flex-col justify-end transition-all duration-150",style:{height:`${k}%`},children:[d==="tokens"&&n(y,{children:[s.outputTokens>0&&t("div",{className:"bg-success transition-all duration-200",style:{height:`${s.outputTokens/s.totalTokens*100}%`}}),s.inputTokens+s.cacheWriteTokens>0&&t("div",{className:"bg-accent transition-all duration-200",style:{height:`${(s.inputTokens+s.cacheWriteTokens)/s.totalTokens*100}%`}}),s.cacheReadTokens>0&&t("div",{className:"bg-accent/40 transition-all duration-200",style:{height:`${s.cacheReadTokens/s.totalTokens*100}%`}})]}),d==="duration"&&n(y,{children:[s.generationMs>0&&t("div",{className:"bg-success transition-all duration-200",style:{height:`${Math.min(100,s.generationMs/Math.max(1,s.activeDurationMs)*100)}%`}}),t("div",{className:"bg-accent flex-1 transition-all duration-200"})]}),d==="activity"&&n(y,{children:[s.userMessages>0&&t("div",{className:"bg-success transition-all duration-200",style:{height:`${s.userMessages/Math.max(1,s.assistantTurns+s.userMessages)*100}%`}}),t("div",{className:"bg-accent flex-1 transition-all duration-200"})]})]}),b&&t("div",{className:"absolute -bottom-1 size-1 rounded-full bg-accent"})]},s.date)})}),t("div",{className:c("flex items-center pt-1.5 text-[10px] text-faint font-mono tabular-nums",e.length<=7?"gap-1 sm:gap-1.5":"justify-between"),children:m.map((s)=>t("div",{className:c("whitespace-nowrap",e.length<=7&&"flex-1 text-center"),children:G(s)},s))})]})]}),t("div",{className:"flex flex-wrap items-center justify-between gap-2 border-t border-line pt-3 font-mono text-xs tabular-nums",children:D?n(y,{children:[t("span",{className:"text-ink",children:Y(D.date)}),n("div",{className:"flex flex-wrap items-center gap-x-3.5 gap-y-1 text-dim",children:[n("span",{children:["Token ",t("span",{className:"text-ink",children:N(D.totalTokens)})]}),n("span",{children:["耗时 ",t("span",{className:"text-ink",children:P(D.activeDurationMs)})]}),n("span",{children:["交互 ",n("span",{className:"text-ink",children:[D.assistantTurns+D.userMessages," 轮"]})]}),n("span",{children:["工具 ",n("span",{className:"text-ink",children:[D.toolCalls," 次"]})]})]})]}):t("span",{className:"font-sans text-faint",children:"悬停柱状图查看单日明细"})})]})})}function ie(a){let{cn:c,SettingGroup:x}=_(),{daily:p,hourly:u}=a,[e,d]=r(null),v=g(()=>{let l=new Map;for(let k of u)l.set(k.hour,k);let f=[];for(let k=0;k<24;k++){let b=l.get(k);if(b)f.push(b);else f.push({hour:k,totalTokens:0,activeDurationMs:0,userMessages:0,assistantTurns:0,runs:0})}return f},[u]),w=g(()=>{let l=v[0];for(let f of v)if(!l||f.totalTokens>l.totalTokens)l=f;return l&&l.totalTokens>0?l:null},[v]),R=g(()=>v.reduce((l,f)=>l+f.totalTokens,0),[v]),M=g(()=>Math.max(1,...v.map((l)=>l.totalTokens)),[v]),F=g(()=>{if(R<=0)return 0;return v.filter((f)=>f.hour>=8&&f.hour<20).reduce((f,k)=>f+k.totalTokens,0)/R},[v,R]),D=g(()=>Math.max(1,...p.map((l)=>l.totalTokens)),[p]),z=g(()=>{let l=0,f=0;for(let k of p)if(k.totalTokens>0||k.activeDurationMs>0||k.runs>0){if(f++,f>l)l=f}else f=0;return l},[p]),m=g(()=>p.filter((l)=>l.totalTokens>0||l.activeDurationMs>0||l.runs>0).length,[p]),s=e!==null?v[e]:w;return n(x,{title:"活跃时段与热力",action:n("div",{className:"flex items-center gap-3 font-mono text-xs text-faint tabular-nums",children:[n("span",{children:["日间占比 ",L(F)]}),n("span",{children:["连续活跃 ",z," 天"]}),n("span",{children:["活跃 ",m,"/",p.length," 天"]})]}),children:[n("div",{className:"p-4 space-y-3",children:[n("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs",children:[t("span",{className:"text-dim",children:"24 小时分布"}),s?n("div",{className:"flex items-center gap-3 font-mono text-dim tabular-nums",children:[n("span",{className:"text-ink",children:[e!==null?"时段 ":"高峰 ",String(s.hour).padStart(2,"0"),":00 -"," ",String((s.hour+1)%24).padStart(2,"0"),":00"]}),t("span",{className:"text-ink",children:N(s.totalTokens)}),s.activeDurationMs>0&&t("span",{children:P(s.activeDurationMs)})]}):t("span",{className:"text-faint",children:"暂无时段分布"})]}),n("section",{"aria-label":"24 小时活跃分布序列",className:"h-28 w-full flex flex-col justify-between pt-1",onMouseLeave:()=>d(null),children:[t("div",{className:"flex-1 flex items-end gap-1.5 pb-1.5",children:v.map((l)=>{let f=w?.hour===l.hour,k=e===l.hour,b=l.totalTokens>0?Math.max(6,l.totalTokens/M*100):0,A=`${String(l.hour).padStart(2,"0")}:00 - ${String((l.hour+1)%24).padStart(2,"0")}:00
2
2
  消耗: ${B(l.totalTokens)} Token
3
3
  耗时: ${P(l.activeDurationMs)}
4
- 助手轮次: ${l.assistantTurns} 轮`;return t("button",{type:"button","aria-label":`${String(l.hour).padStart(2,"0")}:00 时段统计`,className:"flex-1 h-full flex flex-col justify-end items-center group relative cursor-pointer bg-transparent p-0 border-0 focus:outline-hidden",title:A,onMouseEnter:()=>d(l.hour),onFocus:()=>d(l.hour),onClick:()=>d(l.hour),children:k>0?t("div",{className:c("w-full max-w-[20px] rounded-t-xs transition-all duration-200",f||N?"bg-accent":"bg-accent/55 group-hover:bg-accent"),style:{height:`${k}%`}}):t("div",{className:"h-1 w-full max-w-[20px] rounded-full bg-raised group-hover:bg-dim/30"})},l.hour)})}),n("div",{className:"flex justify-between items-center text-[10px] text-faint font-mono pt-1.5 border-t border-line/40",children:[t("span",{children:"00:00"}),t("span",{children:"04:00"}),t("span",{children:"08:00"}),t("span",{children:"12:00"}),t("span",{children:"16:00"}),t("span",{children:"20:00"}),t("span",{children:"23:00"})]})]})]}),n("div",{className:"p-4 space-y-2.5",children:[n("div",{className:"text-xs text-dim",children:["自然日热力 (",p.length," 天)"]}),t("div",{className:"flex flex-wrap items-center gap-1.5",children:p.map((l)=>{let f="bg-raised";if(l.totalTokens>0){let k=l.totalTokens/D;if(k<=0.33)f="bg-accent/30";else if(k<=0.66)f="bg-accent/60";else f="bg-accent"}let N=`${Y(l.date)}
4
+ 助手轮次: ${l.assistantTurns} 轮`;return t("button",{type:"button","aria-label":`${String(l.hour).padStart(2,"0")}:00 时段统计`,className:"flex-1 h-full flex flex-col justify-end items-center group relative cursor-pointer bg-transparent p-0 border-0 focus:outline-hidden",title:A,onMouseEnter:()=>d(l.hour),onFocus:()=>d(l.hour),onClick:()=>d(l.hour),children:b>0?t("div",{className:c("w-full max-w-[20px] rounded-t-xs transition-all duration-200",f||k?"bg-accent":"bg-accent/55 group-hover:bg-accent"),style:{height:`${b}%`}}):t("div",{className:"h-1 w-full max-w-[20px] rounded-full bg-raised group-hover:bg-dim/30"})},l.hour)})}),n("div",{className:"flex justify-between items-center text-[10px] text-faint font-mono pt-1.5 border-t border-line/40",children:[t("span",{children:"00:00"}),t("span",{children:"04:00"}),t("span",{children:"08:00"}),t("span",{children:"12:00"}),t("span",{children:"16:00"}),t("span",{children:"20:00"}),t("span",{children:"23:00"})]})]})]}),n("div",{className:"p-4 space-y-2.5",children:[n("div",{className:"text-xs text-dim",children:["自然日热力 (",p.length," 天)"]}),t("div",{className:"flex flex-wrap items-center gap-1.5",children:p.map((l)=>{let f="bg-raised";if(l.totalTokens>0){let b=l.totalTokens/D;if(b<=0.33)f="bg-accent/30";else if(b<=0.66)f="bg-accent/60";else f="bg-accent"}let k=`${Y(l.date)}
5
5
  消耗: ${B(l.totalTokens)} Token
6
6
  耗时: ${P(l.activeDurationMs)}
7
- 助手轮次: ${l.assistantTurns} 轮`;return t("div",{className:c("size-3.5 rounded-xs transition-transform hover:scale-125 cursor-pointer",f),title:N},l.date)})})]})]})}var pe=[{value:"7d",label:"近 7 天"},{value:"30d",label:"近 30 天"},{value:"90d",label:"近 90 天"},{value:"all",label:"全部"}],V=new Map,le=[];function q(s,c){return`${s}:${c??"all"}`}function _e(s){let{connection:c,onOpen:x}=s,{Button:p,PageLayout:u,Segmented:e,SettingGroup:d,style:b}=_(),[w,R]=a("30d"),[M,F]=a(null),[D,z]=a("projects"),[m,r]=a(()=>V.get(q("30d",null))??null),[l,f]=a(()=>!V.has(q("30d",null))),[N,k]=a(null),[A,S]=a(()=>le),j=i(0),y=h(async()=>{let I=++j.current,O=q(w,M),Q=V.get(O);if(Q)r(Q);f(!0);try{let E=new URLSearchParams({range:w,tzOffset:String(new Date().getTimezoneOffset())});if(M)E.set("projectID",M);let W=await c.request(`/api/stats?${E.toString()}`);if(I!==j.current)return;if(V.set(O,W),r(W),k(null),W.projects)S((ue)=>{let Z=new Map(ue.map((H)=>[H.id,H.name]));for(let H of W.projects)if(H.projectID)Z.set(H.projectID,H.name);let J=Array.from(Z.entries()).map(([H,ce])=>({id:H,name:ce}));return le=J,J})}catch(E){if(I===j.current)k(E instanceof Error?E.message:"加载统计数据失败")}finally{if(I===j.current)f(!1)}},[c,w,M]);o(()=>(y(),()=>{j.current++}),[y]);let C=g(()=>{if(!M)return null;if(M===U)return"独立聊天";return(A.find((O)=>O.id===M)??m?.projects.find((O)=>O.projectID===M))?.name??"指定项目"},[M,A,m]);return n(u,{title:C?n(v,{children:["统计 ",n("span",{className:"text-dim",children:["· ",C]})]}):"统计",description:"按项目、模型与工具统计活跃耗时与 Token 消耗。",actions:n(v,{children:[M&&t(p,{size:"sm",variant:"ghost",onClick:()=>F(null),children:"返回全部"}),t(e,{value:w,onChange:R,options:pe})]}),children:[N&&n("div",{className:"mb-4 flex items-center justify-between rounded-lg bg-danger/10 px-3 py-2 text-xs text-danger",children:[t("span",{children:N}),t(p,{size:"sm",variant:"ghost",onClick:()=>{y()},className:"text-danger hover:text-danger",children:"重试"})]}),l&&!m?t("div",{className:"flex justify-center py-12 text-xs text-faint",children:"正在加载统计…"}):!m?t("div",{className:b("surface.card","p-12 text-center text-sm text-dim"),children:"暂无统计数据"}):n("div",{className:"space-y-8",children:[t(d,{title:"核心总览",unboxed:!0,children:n("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[n("div",{className:b("surface.card","p-4"),children:[n("div",{className:"flex items-center justify-between gap-2 text-xs text-faint",children:[t("span",{children:"总 Token 消耗"}),n("span",{className:"font-mono tabular-nums",children:["缓存命中 ",L(m.overview.cacheHitRate)]})]}),t("div",{className:"mt-1.5 font-mono text-xl font-semibold tracking-tight text-ink tabular-nums",title:`${B(m.overview.totalTokens)} Token`,children:T(m.overview.totalTokens)}),n("div",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 font-mono text-[11px] text-dim tabular-nums",children:[n("span",{children:["输入 ",T(m.overview.inputTokens)]}),n("span",{children:["输出 ",T(m.overview.outputTokens)]}),n("span",{children:["缓存读 ",T(m.overview.cacheReadTokens)]})]})]}),n("div",{className:b("surface.card","p-4"),children:[n("div",{className:"flex items-center justify-between gap-2 text-xs text-faint",children:[t("span",{children:"活跃工作耗时"}),n("span",{className:"font-mono tabular-nums",children:["日均"," ",m.overview.activeDays>0?P(m.overview.activeDurationMs/m.overview.activeDays):"0s"]})]}),t("div",{className:"mt-1.5 font-mono text-xl font-semibold tracking-tight text-ink tabular-nums",children:P(m.overview.activeDurationMs)}),n("div",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 font-mono text-[11px] text-dim tabular-nums",children:[n("span",{children:["模型推理 ",P(m.overview.generationMs)]}),n("span",{children:["并发累计 ",P(m.overview.cumulativeRunDurationMs)]})]})]}),n("div",{className:b("surface.card","p-4"),children:[n("div",{className:"flex items-center justify-between gap-2 text-xs text-faint",children:[t("span",{children:"会话与工作流"}),n("span",{className:"font-mono tabular-nums",children:[m.overview.activeProjects,"/",m.overview.totalProjects," 活跃项目"]})]}),n("div",{className:"mt-1.5 font-mono text-xl font-semibold tracking-tight text-ink tabular-nums",children:[m.overview.sessionCount.toLocaleString()," 个会话"]}),n("div",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 font-mono text-[11px] text-dim tabular-nums",children:[n("span",{children:[m.overview.mainSessionCount," 主会话 / ",m.overview.subSessionCount," 子代理"]}),n("span",{children:[m.overview.userMessages," 提问 / ",m.overview.assistantTurns," 回复"]})]})]}),n("div",{className:b("surface.card","p-4"),children:[n("div",{className:"flex items-center justify-between gap-2 text-xs text-faint",children:[t("span",{children:"吞吐效率与调用"}),n("span",{className:"font-mono tabular-nums",children:[m.overview.compactions," 次折叠"]})]}),t("div",{className:"mt-1.5 font-mono text-xl font-semibold tracking-tight text-ink tabular-nums",children:m.overview.avgTps!==null?`${m.overview.avgTps.toFixed(1)} tok/s`:`${m.overview.toolCalls.toLocaleString()} 次调用`}),n("div",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 font-mono text-[11px] text-dim tabular-nums",children:[n("span",{children:[m.overview.toolCalls.toLocaleString()," 次工具调用"]}),n("span",{children:[m.overview.runCount.toLocaleString()," 次运行"]})]})]})]})}),t(re,{daily:m.daily}),t(ie,{daily:m.daily,hourly:m.hourly}),t(d,{title:"分类明细",action:t(e,{value:D,onChange:z,options:[{value:"projects",label:`项目消耗 (${m.projects.length})`},{value:"models",label:`模型分析 (${m.models.length})`},{value:"tools",label:`工具调用 (${m.tools.length})`},{value:"sessions",label:`高消耗会话 (${m.topSessions.length})`}]}),children:n("div",{className:"animate-fade",children:[D==="projects"&&t(te,{projects:m.projects,selectedProjectID:M,onSelectProject:F,onOpenSession:x}),D==="models"&&t(ae,{models:m.models}),D==="tools"&&t(ne,{tools:m.tools}),D==="sessions"&&t(se,{sessions:m.topSessions,onOpenSession:x})]},D)})]})]})}export{_e as StatsPage};
7
+ 助手轮次: ${l.assistantTurns} 轮`;return t("div",{className:c("size-3.5 rounded-xs transition-transform hover:scale-125 cursor-pointer",f),title:k},l.date)})})]})]})}var pe=[{value:"7d",label:"近 7 天"},{value:"30d",label:"近 30 天"},{value:"90d",label:"近 90 天"},{value:"all",label:"全部"}],V=new Map,le=[];function q(a,c){return`${a}:${c??"all"}`}function _e(a){let{connection:c,onOpen:x}=a,{Button:p,PageLayout:u,Segmented:e,SettingGroup:d,style:v}=_(),[w,R]=r("30d"),[M,F]=r(null),[D,z]=r("projects"),[m,s]=r(()=>V.get(q("30d",null))??null),[l,f]=r(()=>!V.has(q("30d",null))),[k,b]=r(null),[A,S]=r(()=>le),j=i(0),T=h(async()=>{let I=++j.current,O=q(w,M),Q=V.get(O);if(Q)s(Q);f(!0);try{let E=new URLSearchParams({range:w,tzOffset:String(new Date().getTimezoneOffset())});if(M)E.set("projectID",M);let W=await c.request(`/api/stats?${E.toString()}`);if(I!==j.current)return;if(V.set(O,W),s(W),b(null),W.projects)S((ue)=>{let Z=new Map(ue.map((H)=>[H.id,H.name]));for(let H of W.projects)if(H.projectID)Z.set(H.projectID,H.name);let J=Array.from(Z.entries()).map(([H,ce])=>({id:H,name:ce}));return le=J,J})}catch(E){if(I===j.current)b(E instanceof Error?E.message:"加载统计数据失败")}finally{if(I===j.current)f(!1)}},[c,w,M]);o(()=>(T(),()=>{j.current++}),[T]);let C=g(()=>{if(!M)return null;if(M===U)return"独立聊天";return(A.find((O)=>O.id===M)??m?.projects.find((O)=>O.projectID===M))?.name??"指定项目"},[M,A,m]);return n(u,{title:C?n(y,{children:["统计 ",n("span",{className:"text-dim",children:["· ",C]})]}):"统计",description:"按项目、模型与工具统计活跃耗时与 Token 消耗。",actions:n(y,{children:[M&&t(p,{size:"sm",variant:"ghost",onClick:()=>F(null),children:"返回全部"}),t(e,{value:w,onChange:R,options:pe})]}),children:[k&&n("div",{className:"mb-4 flex items-center justify-between rounded-lg bg-danger/10 px-3 py-2 text-xs text-danger",children:[t("span",{children:k}),t(p,{size:"sm",variant:"ghost",onClick:()=>{T()},className:"text-danger hover:text-danger",children:"重试"})]}),l&&!m?t("div",{className:"flex justify-center py-12 text-xs text-faint",children:"正在加载统计…"}):!m?t("div",{className:v("surface.card","p-12 text-center text-sm text-dim"),children:"暂无统计数据"}):n("div",{className:"space-y-8",children:[t(d,{title:"核心总览",unboxed:!0,children:n("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[n("div",{className:v("surface.card","p-4"),children:[n("div",{className:"flex items-center justify-between gap-2 text-xs text-faint",children:[t("span",{children:"总 Token 消耗"}),n("span",{className:"font-mono tabular-nums",children:["缓存命中 ",L(m.overview.cacheHitRate)]})]}),t("div",{className:"mt-1.5 font-mono text-xl font-semibold tracking-tight text-ink tabular-nums",title:`${B(m.overview.totalTokens)} Token`,children:N(m.overview.totalTokens)}),n("div",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 font-mono text-[11px] text-dim tabular-nums",children:[n("span",{children:["输入 ",N(m.overview.inputTokens)]}),n("span",{children:["输出 ",N(m.overview.outputTokens)]}),n("span",{children:["缓存读 ",N(m.overview.cacheReadTokens)]})]})]}),n("div",{className:v("surface.card","p-4"),children:[n("div",{className:"flex items-center justify-between gap-2 text-xs text-faint",children:[t("span",{children:"活跃工作耗时"}),n("span",{className:"font-mono tabular-nums",children:["日均"," ",m.overview.activeDays>0?P(m.overview.activeDurationMs/m.overview.activeDays):"0s"]})]}),t("div",{className:"mt-1.5 font-mono text-xl font-semibold tracking-tight text-ink tabular-nums",children:P(m.overview.activeDurationMs)}),n("div",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 font-mono text-[11px] text-dim tabular-nums",children:[n("span",{children:["模型推理 ",P(m.overview.generationMs)]}),n("span",{children:["并发累计 ",P(m.overview.cumulativeRunDurationMs)]})]})]}),n("div",{className:v("surface.card","p-4"),children:[n("div",{className:"flex items-center justify-between gap-2 text-xs text-faint",children:[t("span",{children:"会话与工作流"}),n("span",{className:"font-mono tabular-nums",children:[m.overview.activeProjects,"/",m.overview.totalProjects," 活跃项目"]})]}),n("div",{className:"mt-1.5 font-mono text-xl font-semibold tracking-tight text-ink tabular-nums",children:[m.overview.sessionCount.toLocaleString()," 个会话"]}),n("div",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 font-mono text-[11px] text-dim tabular-nums",children:[n("span",{children:[m.overview.mainSessionCount," 主会话 / ",m.overview.subSessionCount," 子代理"]}),n("span",{children:[m.overview.userMessages," 提问 / ",m.overview.assistantTurns," 回复"]})]})]}),n("div",{className:v("surface.card","p-4"),children:[n("div",{className:"flex items-center justify-between gap-2 text-xs text-faint",children:[t("span",{children:"吞吐效率与调用"}),n("span",{className:"font-mono tabular-nums",children:[m.overview.compactions," 次折叠"]})]}),t("div",{className:"mt-1.5 font-mono text-xl font-semibold tracking-tight text-ink tabular-nums",children:m.overview.avgTps!==null?`${m.overview.avgTps.toFixed(1)} tok/s`:`${m.overview.toolCalls.toLocaleString()} 次调用`}),n("div",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 font-mono text-[11px] text-dim tabular-nums",children:[n("span",{children:[m.overview.toolCalls.toLocaleString()," 次工具调用"]}),n("span",{children:[m.overview.runCount.toLocaleString()," 次运行"]})]})]})]})}),t(re,{daily:m.daily}),t(ie,{daily:m.daily,hourly:m.hourly}),t(d,{title:"分类明细",action:t(e,{value:D,onChange:z,options:[{value:"projects",label:`项目消耗 (${m.projects.length})`},{value:"models",label:`模型分析 (${m.models.length})`},{value:"tools",label:`工具调用 (${m.tools.length})`},{value:"sessions",label:`高消耗会话 (${m.topSessions.length})`}]}),children:n("div",{className:"animate-fade",children:[D==="projects"&&t(te,{projects:m.projects,selectedProjectID:M,onSelectProject:F,onOpenSession:x}),D==="models"&&t(ae,{models:m.models}),D==="tools"&&t(ne,{tools:m.tools}),D==="sessions"&&t(se,{sessions:m.topSessions,onOpenSession:x})]},D)})]})]})}export{_e as StatsPage};
@@ -0,0 +1,2 @@
1
+ import{o,r,y,t,n,_,rn,qt,ve,Le}from"./chunk-j6a4z530.js";var L={running:"运行中",waiting:"等待回答",context_exhausted:"上下文耗尽",done:"完成",error:"失败",failed:"失败",aborted:"已取消",cancelled:"已取消",interrupted:"已中断"},W={running:"warning",waiting:"warning",context_exhausted:"warning",done:"success",error:"danger",failed:"danger",aborted:"neutral",cancelled:"neutral",interrupted:"warning"},N=(a)=>a>=1000?`${(a/1000).toFixed(a>=1e4?0:1)}k`:String(a),H=(a)=>a>=60000?`${Math.floor(a/60000)} 分 ${Math.round(a%60000/1000)} 秒`:`${Math.round(a/1000)} 秒`;function X(a){let{Button:I,Panel:R,StatusChip:T,Markdown:z,ModelIcon:M,cn:c,style:B,useTheme:U}=_();U();let{connection:h,sessionID:x,payload:A,onOpen:E}=a,e=A,[s,Q]=r(),[f,k]=r(),[S,C]=r(!1),[d,q]=r(!1),[F,O]=r(!1),p=F||e.state==="aborted"||e.state==="cancelled",m=p?"aborted":e.state,u=(e.state==="running"||e.state==="waiting")&&!p;o(()=>{let i,v=!1,D=()=>{h.request(`/api/sessions/${encodeURIComponent(x)}/tasks/${encodeURIComponent(e.childSessionID)}`).then((g)=>{if(!v)Q(g),k(void 0)}).catch((g)=>{if(!v)k(g instanceof Error?g.message:"任务详情加载失败")})};if(D(),u)i=setInterval(D,1500);return()=>{if(v=!0,i)clearInterval(i)}},[h,x,e.childSessionID,u]);let j=async()=>{if(S)return;C(!0);try{await h.request(`/api/sessions/${encodeURIComponent(x)}/tasks/${encodeURIComponent(e.childSessionID)}/kill`,{method:"POST"}),O(!0)}catch(i){k(i instanceof Error?i.message:"取消任务失败")}finally{C(!1)}},l=e.summary?.trim()||e.handoff?.conclusion.trim()||"",b=l.length>360||l.split(`
2
+ `).length>8,w=[s&&u&&s.lastTool&&`最近 ${s.lastTool}`,s&&H(s.elapsedMs),s&&`输入 ${N(s.usage.input)}`,s&&`输出 ${N(s.usage.output)}`,s&&s.usage.cacheRead>0&&`缓存 ${N(s.usage.cacheRead)}`,s&&s.usage.cost>0&&`$${s.usage.cost.toFixed(4)}`].filter(Boolean),G=Boolean(l||e.state==="waiting"&&!p||f),P=e.model||s?.session.model;return t(R,{className:"my-2 animate-fade",header:n(y,{children:[P?t(M,{modelID:P,className:"size-3.5 shrink-0",size:14}):t(Le,{className:c("size-3.5 shrink-0",u?"text-warning":"text-faint")}),t("h4",{className:"truncate font-medium text-ink",title:e.description,children:e.description}),w.length>0&&n("span",{className:"min-w-0 truncate text-faint tabular-nums",title:w.join(" · "),children:["· ",w.join(" · ")]})]}),actions:n(y,{children:[t(T,{tone:W[m]??"neutral",pulse:m==="running",children:L[m]??m}),u&&t(I,{size:"sm",variant:"danger-ghost",className:"h-6 rounded-md px-2 text-xs",disabled:S,onClick:()=>{j()},children:"取消"}),n(I,{size:"sm",variant:"ghost",className:"h-6 gap-1 rounded-md px-2 text-xs text-faint hover:text-ink",onClick:()=>E(e.childSessionID),children:["进入子会话",t(qt,{className:"size-3.5"})]})]}),children:G&&n(y,{children:[e.state==="waiting"&&!p&&n("div",{className:c("px-4 py-3",l&&"border-b border-line"),children:[n("p",{className:"flex items-center gap-1.5 text-xs font-medium text-warning",children:[t(rn,{className:"size-3.5"}),"子任务向主代理提问,等待回答"]}),e.pendingQuestions&&e.pendingQuestions.length>0&&t("ul",{className:"mt-1.5 flex flex-col gap-1 text-[13px] leading-relaxed text-ink",children:e.pendingQuestions.map((i)=>t("li",{className:"break-words",children:i.text},i.askedAt))})]}),l&&n("div",{className:"px-4 py-3",children:[n("div",{className:c("relative text-[13.5px] leading-[1.65] break-words text-ink/90 overflow-hidden transition-[max-height] duration-300 ease-out-quint [&_p]:my-1.5 [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",b&&!d?"max-h-40":"max-h-[1800px]"),children:[t(z,{text:l}),b&&t("div",{className:c("pointer-events-none absolute inset-x-0 bottom-0 h-10 bg-gradient-to-t from-panel via-panel/70 to-transparent transition-opacity duration-300",d?"opacity-0":"opacity-100")})]}),b&&n("button",{type:"button",className:B("chat.timelineRow","cursor-pointer select-none"),onClick:()=>q(!d),children:[t("span",{children:d?"收起":"展开全部"}),t(ve,{className:c("size-3.5 transition-transform duration-300 ease-out-quint",d&&"rotate-180")})]})]}),f&&t("p",{role:"status",className:"px-4 py-2.5 text-xs text-danger",children:f})]})})}export{X as TaskCard};
@@ -0,0 +1 @@
1
+ import{Qn}from"./chunk-z1geewdf.js";export{Qn as default};
@@ -1 +1 @@
1
- function C(t){return Math.abs(t=Math.round(t))>=1000000000000000000000?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function g(t,r){if(!isFinite(t)||t===0)return null;var i=(t=r?t.toExponential(r-1):t.toExponential()).indexOf("e"),e=t.slice(0,i);return[e.length>1?e[0]+e.slice(2):e,+t.slice(i+1)]}function Dt(t){return t=g(Math.abs(t)),t?t[1]:NaN}function G(t,r){return function(i,e){var o=i.length,a=[],c=0,u=t[0],M=0;while(o>0&&u>0){if(M+u+1>e)u=Math.max(1,e-M);if(a.push(i.substring(o-=u,o+u)),(M+=u+1)>e)break;u=t[c=(c+1)%t.length]}return a.reverse().join(r)}}function I(t){return function(r){return r.replace(/[0-9]/g,function(i){return t[+i]})}}var tt=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function fn(t){if(!(r=tt.exec(t)))throw Error("invalid format: "+t);var r;return new E({fill:r[1],align:r[2],sign:r[3],symbol:r[4],zero:r[5],width:r[6],comma:r[7],precision:r[8]&&r[8].slice(1),trim:r[9],type:r[10]})}fn.prototype=E.prototype;function E(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}E.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function R(t){t:for(var r=t.length,i=1,e=-1,o;i<r;++i)switch(t[i]){case".":e=o=i;break;case"0":if(e===0)e=i;o=i;break;default:if(!+t[i])break t;if(e>0)e=0;break}return e>0?t.slice(0,e)+t.slice(o+1):t}var P;function X(t,r){var i=g(t,r);if(!i)return P=void 0,t.toPrecision(r);var e=i[0],o=i[1],a=o-(P=Math.max(-8,Math.min(8,Math.floor(o/3)))*3)+1,c=e.length;return a===c?e:a>c?e+Array(a-c+1).join("0"):a>0?e.slice(0,a)+"."+e.slice(a):"0."+Array(1-a).join("0")+g(t,Math.max(0,r+a-1))[0]}function F(t,r){var i=g(t,r);if(!i)return t+"";var e=i[0],o=i[1];return o<0?"0."+Array(-o).join("0")+e:e.length>o+1?e.slice(0,o+1)+"."+e.slice(o+1):e+Array(o-e.length+2).join("0")}var O={"%":(t,r)=>(t*100).toFixed(r),b:(t)=>Math.round(t).toString(2),c:(t)=>t+"",d:C,e:(t,r)=>t.toExponential(r),f:(t,r)=>t.toFixed(r),g:(t,r)=>t.toPrecision(r),o:(t)=>Math.round(t).toString(8),p:(t,r)=>F(t*100,r),r:F,s:X,X:(t)=>Math.round(t).toString(16).toUpperCase(),x:(t)=>Math.round(t).toString(16)};function N(t){return t}var K=Array.prototype.map,Q=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function U(t){var r=t.grouping===void 0||t.thousands===void 0?N:G(K.call(t.grouping,Number),t.thousands+""),i=t.currency===void 0?"":t.currency[0]+"",e=t.currency===void 0?"":t.currency[1]+"",o=t.decimal===void 0?".":t.decimal+"",a=t.numerals===void 0?N:I(K.call(t.numerals,String)),c=t.percent===void 0?"%":t.percent+"",u=t.minus===void 0?"−":t.minus+"",M=t.nan===void 0?"NaN":t.nan+"";function Z(f,p){f=fn(f);var y=f.fill,w=f.align,s=f.sign,S=f.symbol,k=f.zero,L=f.width,T=f.comma,x=f.precision,q=f.trim,m=f.type;if(m==="n")T=!0,m="g";else if(!O[m])x===void 0&&(x=12),q=!0,m="g";if(k||y==="0"&&w==="=")k=!0,y="0",w="=";var W=(p&&p.prefix!==void 0?p.prefix:"")+(S==="$"?i:S==="#"&&/[boxX]/.test(m)?"0"+m.toLowerCase():""),_=(S==="$"?e:/[%p]/.test(m)?c:"")+(p&&p.suffix!==void 0?p.suffix:""),B=O[m],v=/[defgprs%]/.test(m);x=x===void 0?6:/[gprs]/.test(m)?Math.max(1,Math.min(21,x)):Math.max(0,Math.min(20,x));function H(n){var l=W,d=_,b,J,z;if(m==="c")d=B(n)+d,n="";else{n=+n;var A=n<0||1/n<0;if(n=isNaN(n)?M:B(Math.abs(n),x),q)n=R(n);if(A&&+n===0&&s!=="+")A=!1;if(l=(A?s==="("?s:u:s==="-"||s==="("?"":s)+l,d=(m==="s"&&!isNaN(n)&&P!==void 0?Q[8+P/3]:"")+d+(A&&s==="("?")":""),v){b=-1,J=n.length;while(++b<J)if(z=n.charCodeAt(b),48>z||z>57){d=(z===46?o+n.slice(b+1):n.slice(b))+d,n=n.slice(0,b);break}}}if(T&&!k)n=r(n,1/0);var j=l.length+n.length+d.length,h=j<L?Array(L-j+1).join(y):"";if(T&&k)n=r(h+n,h.length?L-d.length:1/0),h="";switch(w){case"<":n=l+n+d+h;break;case"=":n=l+h+n+d;break;case"^":n=h.slice(0,j=h.length>>1)+l+n+d+h.slice(j);break;default:n=h+l+n+d;break}return a(n)}return H.toString=function(){return f+""},H}function V(f,p){var y=Math.max(-8,Math.min(8,Math.floor(Dt(p)/3)))*3,w=Math.pow(10,-y),s=Z((f=fn(f),f.type="f",f),{suffix:Q[8+y/3]});return function(S){return s(w*S)}}return{format:Z,formatPrefix:V}}var D,Nt,ra;Y({thousands:",",grouping:[3],currency:["$",""]});function Y(t){return D=U(t),Nt=D.format,ra=D.formatPrefix,D}export{Dt,fn,Nt,ra};
1
+ function C(t){return Math.abs(t=Math.round(t))>=1000000000000000000000?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function g(t,r){if(!isFinite(t)||t===0)return null;var i=(t=r?t.toExponential(r-1):t.toExponential()).indexOf("e"),e=t.slice(0,i);return[e.length>1?e[0]+e.slice(2):e,+t.slice(i+1)]}function Nt(t){return t=g(Math.abs(t)),t?t[1]:NaN}function G(t,r){return function(i,e){var o=i.length,a=[],c=0,u=t[0],M=0;while(o>0&&u>0){if(M+u+1>e)u=Math.max(1,e-M);if(a.push(i.substring(o-=u,o+u)),(M+=u+1)>e)break;u=t[c=(c+1)%t.length]}return a.reverse().join(r)}}function I(t){return function(r){return r.replace(/[0-9]/g,function(i){return t[+i]})}}var tt=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function gn(t){if(!(r=tt.exec(t)))throw Error("invalid format: "+t);var r;return new E({fill:r[1],align:r[2],sign:r[3],symbol:r[4],zero:r[5],width:r[6],comma:r[7],precision:r[8]&&r[8].slice(1),trim:r[9],type:r[10]})}gn.prototype=E.prototype;function E(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}E.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function R(t){t:for(var r=t.length,i=1,e=-1,o;i<r;++i)switch(t[i]){case".":e=o=i;break;case"0":if(e===0)e=i;o=i;break;default:if(!+t[i])break t;if(e>0)e=0;break}return e>0?t.slice(0,e)+t.slice(o+1):t}var P;function X(t,r){var i=g(t,r);if(!i)return P=void 0,t.toPrecision(r);var e=i[0],o=i[1],a=o-(P=Math.max(-8,Math.min(8,Math.floor(o/3)))*3)+1,c=e.length;return a===c?e:a>c?e+Array(a-c+1).join("0"):a>0?e.slice(0,a)+"."+e.slice(a):"0."+Array(1-a).join("0")+g(t,Math.max(0,r+a-1))[0]}function F(t,r){var i=g(t,r);if(!i)return t+"";var e=i[0],o=i[1];return o<0?"0."+Array(-o).join("0")+e:e.length>o+1?e.slice(0,o+1)+"."+e.slice(o+1):e+Array(o-e.length+2).join("0")}var O={"%":(t,r)=>(t*100).toFixed(r),b:(t)=>Math.round(t).toString(2),c:(t)=>t+"",d:C,e:(t,r)=>t.toExponential(r),f:(t,r)=>t.toFixed(r),g:(t,r)=>t.toPrecision(r),o:(t)=>Math.round(t).toString(8),p:(t,r)=>F(t*100,r),r:F,s:X,X:(t)=>Math.round(t).toString(16).toUpperCase(),x:(t)=>Math.round(t).toString(16)};function N(t){return t}var K=Array.prototype.map,Q=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function U(t){var r=t.grouping===void 0||t.thousands===void 0?N:G(K.call(t.grouping,Number),t.thousands+""),i=t.currency===void 0?"":t.currency[0]+"",e=t.currency===void 0?"":t.currency[1]+"",o=t.decimal===void 0?".":t.decimal+"",a=t.numerals===void 0?N:I(K.call(t.numerals,String)),c=t.percent===void 0?"%":t.percent+"",u=t.minus===void 0?"−":t.minus+"",M=t.nan===void 0?"NaN":t.nan+"";function Z(f,p){f=gn(f);var y=f.fill,w=f.align,s=f.sign,S=f.symbol,k=f.zero,L=f.width,T=f.comma,x=f.precision,q=f.trim,m=f.type;if(m==="n")T=!0,m="g";else if(!O[m])x===void 0&&(x=12),q=!0,m="g";if(k||y==="0"&&w==="=")k=!0,y="0",w="=";var W=(p&&p.prefix!==void 0?p.prefix:"")+(S==="$"?i:S==="#"&&/[boxX]/.test(m)?"0"+m.toLowerCase():""),_=(S==="$"?e:/[%p]/.test(m)?c:"")+(p&&p.suffix!==void 0?p.suffix:""),B=O[m],v=/[defgprs%]/.test(m);x=x===void 0?6:/[gprs]/.test(m)?Math.max(1,Math.min(21,x)):Math.max(0,Math.min(20,x));function H(n){var l=W,d=_,b,J,z;if(m==="c")d=B(n)+d,n="";else{n=+n;var A=n<0||1/n<0;if(n=isNaN(n)?M:B(Math.abs(n),x),q)n=R(n);if(A&&+n===0&&s!=="+")A=!1;if(l=(A?s==="("?s:u:s==="-"||s==="("?"":s)+l,d=(m==="s"&&!isNaN(n)&&P!==void 0?Q[8+P/3]:"")+d+(A&&s==="("?")":""),v){b=-1,J=n.length;while(++b<J)if(z=n.charCodeAt(b),48>z||z>57){d=(z===46?o+n.slice(b+1):n.slice(b))+d,n=n.slice(0,b);break}}}if(T&&!k)n=r(n,1/0);var j=l.length+n.length+d.length,h=j<L?Array(L-j+1).join(y):"";if(T&&k)n=r(h+n,h.length?L-d.length:1/0),h="";switch(w){case"<":n=l+n+d+h;break;case"=":n=l+h+n+d;break;case"^":n=h.slice(0,j=h.length>>1)+l+n+d+h.slice(j);break;default:n=h+l+n+d;break}return a(n)}return H.toString=function(){return f+""},H}function V(f,p){var y=Math.max(-8,Math.min(8,Math.floor(Nt(p)/3)))*3,w=Math.pow(10,-y),s=Z((f=gn(f),f.type="f",f),{suffix:Q[8+y/3]});return function(S){return s(w*S)}}return{format:Z,formatPrefix:V}}var D,Pt,aa;Y({thousands:",",grouping:[3],currency:["$",""]});function Y(t){return D=U(t),Pt=D.format,aa=D.formatPrefix,D}export{Nt,gn,Pt,aa};