@bkm016/basalt 0.1.7 → 0.1.9

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 (290) hide show
  1. package/README.md +1 -1
  2. package/{chunk-0039s4jt.js → chunk-02d3x4mj.js} +3 -3
  3. package/{chunk-sjjtxpg2.js → chunk-0xd9mnc2.js} +394 -341
  4. package/{chunk-npez1492.js → chunk-13gvs0ax.js} +2 -2
  5. package/{chunk-n981vx1t.js → chunk-1n7dat03.js} +6 -6
  6. package/{chunk-6ptv4g5e.js → chunk-1zj3zvw5.js} +3 -3
  7. package/{chunk-zxkq9m8e.js → chunk-29qrxygd.js} +2 -2
  8. package/{chunk-y8dkfpmj.js → chunk-30rjf7my.js} +4 -4
  9. package/{chunk-39vwrg8n.js → chunk-38g3gctw.js} +2 -2
  10. package/{chunk-benrzwea.js → chunk-4dw43syb.js} +1 -1
  11. package/{chunk-w67dvqtb.js → chunk-4gtgqcct.js} +2 -2
  12. package/chunk-66h5qpc6.js +479 -0
  13. package/{chunk-8wj32837.js → chunk-755sy11p.js} +1 -1
  14. package/chunk-7zkswxvk.js +2 -0
  15. package/{chunk-ebpyvs1d.js → chunk-82v8jh1h.js} +2 -2
  16. package/chunk-95964592.js +25 -0
  17. package/{chunk-gv7wqkey.js → chunk-9as0p561.js} +2 -2
  18. package/{chunk-fx7f4m3c.js → chunk-a1352w87.js} +1 -1
  19. package/{chunk-8wv5t0w6.js → chunk-a1rb1a48.js} +6 -6
  20. package/{chunk-bdy4jksd.js → chunk-a98wma9j.js} +1 -1
  21. package/{chunk-peja51xv.js → chunk-asyr3gnq.js} +2 -2
  22. package/{chunk-7hr6zw2m.js → chunk-ax04trym.js} +1 -1
  23. package/chunk-b2bxqeb4.js +2 -0
  24. package/{chunk-6kdgk70p.js → chunk-bdjr0kfr.js} +4 -4
  25. package/{chunk-dnx91jrd.js → chunk-bk4rpnm8.js} +2 -2
  26. package/{chunk-8x21n7y9.js → chunk-c0zfefq8.js} +1 -1
  27. package/{chunk-pg5nkf1y.js → chunk-c6q04xrd.js} +2 -2
  28. package/chunk-c71173py.js +25 -0
  29. package/{chunk-c7rcw9fb.js → chunk-cmwdjes8.js} +5 -5
  30. package/{chunk-j7yvh0ae.js → chunk-d0a1jxk5.js} +1 -1
  31. package/{chunk-0javrjcm.js → chunk-d5j74pcp.js} +22 -22
  32. package/{chunk-ca982n62.js → chunk-dfh9m9n7.js} +1 -1
  33. package/{chunk-s6dejhfj.js → chunk-dq01v5eq.js} +1 -1
  34. package/{chunk-ecf896fz.js → chunk-e1x629v0.js} +2 -2
  35. package/{chunk-053vb71h.js → chunk-en218k4y.js} +1 -1
  36. package/{chunk-ey15ye2h.js → chunk-fgwda4m0.js} +1 -1
  37. package/chunk-gbjn6d81.js +2 -0
  38. package/{chunk-n85qs7cs.js → chunk-gkf5jwvj.js} +1 -1
  39. package/{chunk-d48bfd2e.js → chunk-h1kb8b49.js} +2 -2
  40. package/{chunk-whj87h4r.js → chunk-hb4f2v34.js} +3 -3
  41. package/{chunk-10p3mb40.js → chunk-hbnmymaq.js} +1 -1
  42. package/{chunk-818nd6s1.js → chunk-jj4hqbrx.js} +2 -2
  43. package/{chunk-r8vvcp6c.js → chunk-jn5pqy5v.js} +1 -1
  44. package/{chunk-f544p9rh.js → chunk-jtsve11b.js} +10 -10
  45. package/chunk-m1eam0s5.js +2 -0
  46. package/{chunk-g0t9c3gv.js → chunk-mbpb5c7w.js} +1 -1
  47. package/{chunk-prgm07j4.js → chunk-msm9hmk9.js} +2 -2
  48. package/{chunk-dpz4hwqb.js → chunk-n0ybj4h9.js} +2 -2
  49. package/{chunk-z02sj1je.js → chunk-n2jcx65v.js} +2 -2
  50. package/{chunk-x4874m8e.js → chunk-nrsd810j.js} +2 -2
  51. package/chunk-pnspvnyd.js +2 -0
  52. package/chunk-pz2afna8.js +2 -0
  53. package/{chunk-f156y565.js → chunk-q9f4xb0w.js} +3 -3
  54. package/{chunk-arcqjt91.js → chunk-qaeyhe65.js} +1 -1
  55. package/chunk-qnkrrwmg.js +2 -0
  56. package/{chunk-063vbmtp.js → chunk-r4ttdkrz.js} +2 -2
  57. package/{chunk-r9aatvwm.js → chunk-stj493dn.js} +2 -2
  58. package/{chunk-q9dd6fhj.js → chunk-tevejprz.js} +4 -4
  59. package/{chunk-75434aay.js → chunk-v3ee9z3f.js} +1 -1
  60. package/chunk-vtqr7dm8.js +3 -0
  61. package/chunk-xh444pfn.js +16 -0
  62. package/{chunk-y69ewdn2.js → chunk-ypqjfv3a.js} +2 -2
  63. package/{chunk-d6p2hgxh.js → chunk-zc9ar0r4.js} +1 -1
  64. package/{chunk-s7skpgm2.js → chunk-zyyzk5ha.js} +1 -1
  65. package/compiled.js +9 -9
  66. package/package.json +1 -1
  67. package/ui-test-worker.js +19 -19
  68. package/web/chunk-08sq3cwm.js +1 -0
  69. package/web/chunk-0pghpg4y.js +2 -0
  70. package/web/{chunk-z1geewdf.js → chunk-0zwc2rvh.js} +2 -2
  71. package/web/chunk-12qf1r6m.js +1 -0
  72. package/web/chunk-24fjnnee.js +1 -0
  73. package/web/chunk-24jhbz82.js +24 -0
  74. package/web/{chunk-5wbnjjhg.js → chunk-2dvbeqt0.js} +1 -1
  75. package/web/chunk-2hrswh3d.js +2 -0
  76. package/web/chunk-2j2atyjw.js +1 -0
  77. package/web/{chunk-n754s8xd.js → chunk-2x4g9t37.js} +8 -8
  78. package/web/{chunk-tfn0rqg9.js → chunk-3ak5dg10.js} +25 -25
  79. package/web/chunk-3ecrkvr3.js +106 -0
  80. package/web/chunk-3h3g3ca3.js +1 -0
  81. package/web/chunk-3hr3ew9w.js +1 -0
  82. package/web/chunk-3pcrxg6m.js +1 -0
  83. package/web/{chunk-xckxtfp8.js → chunk-3pd0qt83.js} +72 -72
  84. package/web/chunk-3txxt0a7.js +1 -0
  85. package/web/chunk-43g4wd7a.js +1 -0
  86. package/web/chunk-4a6gdrbs.js +1 -0
  87. package/web/{chunk-twdy2f67.js → chunk-5a4mj3qz.js} +1 -1
  88. package/web/{chunk-q97hn4j5.js → chunk-5baeh8q7.js} +38 -38
  89. package/web/{chunk-4fm55fgb.js → chunk-5dr4tkem.js} +7 -7
  90. package/web/{chunk-wqsczy57.js → chunk-5jdrev9p.js} +9 -9
  91. package/web/{chunk-dg3p8db5.js → chunk-5v2c0aqk.js} +1 -1
  92. package/web/chunk-5z2n4z9x.css +1 -0
  93. package/web/{chunk-pjz30xcp.js → chunk-601k823s.js} +23 -23
  94. package/web/{chunk-2cem4sv7.js → chunk-60axh4sa.js} +25 -25
  95. package/web/chunk-66wb0p6e.js +62 -0
  96. package/web/{chunk-qcge7d6s.js → chunk-6e87m0nm.js} +2 -2
  97. package/web/chunk-6y55gk1n.js +1 -0
  98. package/web/chunk-79e08rk1.js +2 -0
  99. package/web/chunk-7qkav30b.js +2 -0
  100. package/web/chunk-7qq1ypvj.js +1 -0
  101. package/web/{chunk-h6k1x096.js → chunk-7tkgbbf9.js} +2 -2
  102. package/web/chunk-814kkkmq.js +8 -0
  103. package/web/chunk-8jcvdd5d.js +2 -0
  104. package/web/{chunk-gksf7cek.js → chunk-8w7fyb3v.js} +7 -7
  105. package/web/chunk-8w8atrdh.js +1 -0
  106. package/web/{chunk-czjk218p.js → chunk-8z0r0wtk.js} +62 -62
  107. package/web/chunk-935mjq1c.js +39 -0
  108. package/web/chunk-942g3eqn.js +1 -0
  109. package/web/{chunk-ht4mx2dt.js → chunk-98y92vmh.js} +9 -9
  110. package/web/chunk-9ctg0f30.js +3 -0
  111. package/web/chunk-9fnr00kv.js +4 -0
  112. package/web/{chunk-5nda24gv.js → chunk-9yfftz38.js} +1 -1
  113. package/web/chunk-a0ryzdnp.js +7 -0
  114. package/web/chunk-a61zrp66.js +1 -0
  115. package/web/{chunk-nfvqjzz5.js → chunk-af9evdza.js} +1 -1
  116. package/web/chunk-arnzrqnm.js +1 -0
  117. package/web/chunk-avxk6jpc.js +2 -0
  118. package/web/{chunk-c01176kn.js → chunk-awkdw9rw.js} +2 -2
  119. package/web/{chunk-sy7e4dmq.js → chunk-b5h52neg.js} +1 -1
  120. package/web/chunk-bwy3e58v.js +1 -0
  121. package/web/{chunk-ja7w629n.js → chunk-c57f714b.js} +2 -2
  122. package/web/chunk-c6yacwbc.js +30 -0
  123. package/web/chunk-ctzkqx2g.js +169 -0
  124. package/web/chunk-db3twjvk.js +21 -0
  125. package/web/{chunk-femhej5w.js → chunk-ddyyc20r.js} +57 -57
  126. package/web/chunk-dnv8dx72.js +1 -0
  127. package/web/chunk-dwjmr0zj.js +2 -0
  128. package/web/chunk-dz7g1gnv.js +2 -0
  129. package/web/chunk-eadfxfkw.js +1 -0
  130. package/web/{chunk-d9wdsjkk.js → chunk-eqndhs21.js} +2 -2
  131. package/web/chunk-ewx42c11.js +55 -0
  132. package/web/chunk-f7jpakwh.js +1 -0
  133. package/web/{chunk-4sve9xrj.js → chunk-ff1pmd3g.js} +1 -1
  134. package/web/chunk-fjb3ksfd.js +78 -0
  135. package/web/chunk-fpb2dd2d.js +2 -0
  136. package/web/{chunk-fv6vm14n.js → chunk-frnh4zqf.js} +2 -2
  137. package/web/chunk-gn8kyz76.js +7 -0
  138. package/web/chunk-gv99c8zv.js +1 -0
  139. package/web/chunk-h0767tjv.js +1 -0
  140. package/web/chunk-hqynf99g.js +1 -0
  141. package/web/{chunk-jam45rqg.js → chunk-jccz14ye.js} +2 -2
  142. package/web/chunk-kcjz03h5.js +2 -0
  143. package/web/chunk-ket6g0yd.js +1 -0
  144. package/web/chunk-m9q5nr8f.js +1 -0
  145. package/web/chunk-mbwwj216.js +1 -0
  146. package/web/chunk-mdfksj61.js +1 -0
  147. package/web/chunk-me7dza1c.js +1 -0
  148. package/web/{chunk-gyp6v7jd.js → chunk-myd6sc76.js} +2 -2
  149. package/web/{chunk-sf101c23.js → chunk-mykrm8ba.js} +2 -2
  150. package/web/chunk-mzzaet63.js +1 -0
  151. package/web/chunk-n0wazxgz.js +1 -0
  152. package/web/chunk-nnyc889n.js +292 -0
  153. package/web/{chunk-e8yj05t1.js → chunk-nvpp0ghj.js} +6 -6
  154. package/web/chunk-nvt9tkt4.js +1139 -0
  155. package/web/{chunk-sn3tkwme.js → chunk-p9hfcamx.js} +37 -37
  156. package/web/chunk-ph1dgffm.js +1 -0
  157. package/web/chunk-q34as3v6.js +1 -0
  158. package/web/{chunk-sd3cdqcm.js → chunk-qh62nkem.js} +2 -2
  159. package/web/{chunk-j1bw5v1g.js → chunk-qq6m2my8.js} +2 -2
  160. package/web/{chunk-tmndcktk.js → chunk-qsqtwf34.js} +15 -15
  161. package/web/chunk-qz6r9v1z.js +1 -0
  162. package/web/chunk-rad2s9ha.js +1 -0
  163. package/web/{chunk-y99ed8rd.js → chunk-rasjtvsb.js} +16 -16
  164. package/web/chunk-rayf24gy.js +370 -0
  165. package/web/chunk-rrpn5r5w.js +2 -0
  166. package/web/chunk-s37beysw.js +1 -0
  167. package/web/chunk-s60s09mb.js +1 -0
  168. package/web/chunk-sk1wkgjw.js +4 -0
  169. package/web/chunk-spbs56wz.js +34 -0
  170. package/web/chunk-t893141g.js +2 -0
  171. package/web/chunk-tftc5v89.js +24 -0
  172. package/web/chunk-tfvcs2xx.js +1 -0
  173. package/web/chunk-tj1fn8v2.js +1 -0
  174. package/web/chunk-ts6jsfdk.js +41 -0
  175. package/web/chunk-v1exk5wd.js +324 -0
  176. package/web/chunk-veam6vk4.js +303 -0
  177. package/web/chunk-vqmj6peg.js +1 -0
  178. package/web/{chunk-t6sq85s6.js → chunk-vsjpnwsr.js} +2 -2
  179. package/web/{chunk-0whceqes.js → chunk-vvvd3grf.js} +2 -2
  180. package/web/{chunk-svh4n157.js → chunk-w3w18stt.js} +5 -5
  181. package/web/chunk-wdq2tp9e.js +1 -0
  182. package/web/chunk-wkf5xfyr.js +1 -0
  183. package/web/{chunk-4q7wf0wd.js → chunk-wzd2a4k5.js} +9 -9
  184. package/web/chunk-xa43ndfj.js +2 -0
  185. package/web/chunk-xh4xn1az.js +1 -0
  186. package/web/chunk-xx11yv61.js +89 -0
  187. package/web/chunk-xzwxcxb4.js +1 -0
  188. package/web/chunk-y1qty77a.js +1 -0
  189. package/web/{chunk-da7m1kva.js → chunk-y2rzeb4v.js} +2 -2
  190. package/web/chunk-ys2tns0p.js +1 -0
  191. package/web/chunk-z05x9cbm.js +1 -0
  192. package/web/chunk-zb2bkr7f.js +2 -0
  193. package/web/{chunk-aangfjqc.js → chunk-zdyys4ar.js} +38 -38
  194. package/web/chunk-zgavhnt8.js +1 -0
  195. package/web/index.html +1 -1
  196. package/worker.js +1 -1
  197. package/chunk-654cny9a.js +0 -480
  198. package/chunk-8gw5bvh3.js +0 -25
  199. package/chunk-8saewt61.js +0 -3
  200. package/chunk-a0c989ky.js +0 -2
  201. package/chunk-a5apjjcn.js +0 -16
  202. package/chunk-a81p46j7.js +0 -2
  203. package/chunk-agsfy9w7.js +0 -2
  204. package/chunk-d20p02ny.js +0 -2
  205. package/chunk-ejsneb6f.js +0 -2
  206. package/chunk-fmq3zwzk.js +0 -2
  207. package/chunk-rfb85nj7.js +0 -2
  208. package/chunk-rfdt992v.js +0 -25
  209. package/web/chunk-079091ar.js +0 -39
  210. package/web/chunk-083r4f80.js +0 -1
  211. package/web/chunk-0cng7r2x.js +0 -2
  212. package/web/chunk-0k0ande6.js +0 -1
  213. package/web/chunk-14deqqhr.js +0 -2
  214. package/web/chunk-1s53190z.js +0 -303
  215. package/web/chunk-2b63adsj.js +0 -89
  216. package/web/chunk-3baypnwn.js +0 -4
  217. package/web/chunk-4067nwjp.js +0 -19
  218. package/web/chunk-4vjnrz87.js +0 -34
  219. package/web/chunk-59678wmg.js +0 -1
  220. package/web/chunk-5k8sv4f5.js +0 -1
  221. package/web/chunk-5vjhvw1m.js +0 -2
  222. package/web/chunk-6bwgdvf6.js +0 -1
  223. package/web/chunk-6ft5pz3c.js +0 -1
  224. package/web/chunk-7c8rwqtx.js +0 -1
  225. package/web/chunk-7qzz025k.js +0 -1
  226. package/web/chunk-7xbaqqd7.css +0 -1
  227. package/web/chunk-80eyv2mk.js +0 -1
  228. package/web/chunk-89paytbk.js +0 -4
  229. package/web/chunk-8ceej2g7.js +0 -1
  230. package/web/chunk-8nyhy122.js +0 -1
  231. package/web/chunk-8r0s8tx7.js +0 -1
  232. package/web/chunk-989jq2h8.js +0 -2
  233. package/web/chunk-9w5tf22s.js +0 -1
  234. package/web/chunk-ahztazsg.js +0 -1
  235. package/web/chunk-bdydzbqk.js +0 -324
  236. package/web/chunk-c3nn0vvc.js +0 -1
  237. package/web/chunk-cpwtt6ny.js +0 -1
  238. package/web/chunk-d22wq71s.js +0 -1
  239. package/web/chunk-dsw5t58p.js +0 -1
  240. package/web/chunk-dv72fat3.js +0 -1
  241. package/web/chunk-dvvs1jjq.js +0 -3
  242. package/web/chunk-e131rg6p.js +0 -2
  243. package/web/chunk-ekw54h1q.js +0 -1
  244. package/web/chunk-geh05ghh.js +0 -55
  245. package/web/chunk-hwsvhst3.js +0 -1
  246. package/web/chunk-jfvxxp5c.js +0 -1
  247. package/web/chunk-k02b36g1.js +0 -62
  248. package/web/chunk-kjacapzd.js +0 -7
  249. package/web/chunk-kkfrs7d1.js +0 -41
  250. package/web/chunk-kkyn8yhj.js +0 -106
  251. package/web/chunk-mh4rx5cf.js +0 -1
  252. package/web/chunk-mz9b5bsa.js +0 -1
  253. package/web/chunk-n448vaba.js +0 -1
  254. package/web/chunk-n8j88qxy.js +0 -1
  255. package/web/chunk-nmpbsvwb.js +0 -2
  256. package/web/chunk-nws1s56b.js +0 -1
  257. package/web/chunk-p7126wwy.js +0 -7
  258. package/web/chunk-phnqnhj9.js +0 -1
  259. package/web/chunk-q3jevm51.js +0 -292
  260. package/web/chunk-qg31p6cn.js +0 -1
  261. package/web/chunk-qhm3cfq9.js +0 -1
  262. package/web/chunk-qsd595b9.js +0 -1
  263. package/web/chunk-r7frwjqx.js +0 -2
  264. package/web/chunk-rddft5ce.js +0 -1139
  265. package/web/chunk-rgbdf2m9.js +0 -370
  266. package/web/chunk-rsbkbg6x.js +0 -78
  267. package/web/chunk-s2bs5vxh.js +0 -2
  268. package/web/chunk-sgwccs54.js +0 -1
  269. package/web/chunk-sjh8gtm9.js +0 -30
  270. package/web/chunk-t3658ehb.js +0 -2
  271. package/web/chunk-t81p4wqc.js +0 -24
  272. package/web/chunk-tewmsd7t.js +0 -1
  273. package/web/chunk-tf57s7ry.js +0 -1
  274. package/web/chunk-thbqwq6b.js +0 -1
  275. package/web/chunk-tqr80b5w.js +0 -2
  276. package/web/chunk-tz4twwmw.js +0 -2
  277. package/web/chunk-v282r683.js +0 -24
  278. package/web/chunk-v4vjjtn7.js +0 -1
  279. package/web/chunk-vbwdwcdp.js +0 -1
  280. package/web/chunk-vjngfh0q.js +0 -1
  281. package/web/chunk-vnt34mkb.js +0 -1
  282. package/web/chunk-wbgkwxrc.js +0 -1
  283. package/web/chunk-wjbk50hn.js +0 -2
  284. package/web/chunk-wjy848e2.js +0 -1
  285. package/web/chunk-wvfmmw1v.js +0 -8
  286. package/web/chunk-x1jm4zsg.js +0 -1
  287. package/web/chunk-xbpc6x9m.js +0 -169
  288. package/web/chunk-xce8n339.js +0 -1
  289. package/web/chunk-xmsb2g71.js +0 -1
  290. package/web/chunk-xtss82z2.js +0 -1
@@ -0,0 +1,7 @@
1
+ import{g,o,v,i,r,f,e,n,y,at}from"./chunk-nvt9tkt4.js";var V="__chat__";function M(t){if(!Number.isFinite(t)||t<=0)return"0";if(t<1000)return Math.round(t).toString();if(t<1e6)return`${(t/1000).toFixed(1)}K`;if(t<1e9)return`${(t/1e6).toFixed(2)}M`;return`${(t/1e9).toFixed(2)}B`}function L(t){let u=Number.isFinite(t)?Math.max(0,t):0;return Math.round(u).toLocaleString("en-US")}function P(t){if(!Number.isFinite(t)||t<=0)return"0s";if(t<1000)return"<1s";if(t<60000)return`${Math.floor(t/1000)}s`;if(t<3600000){let c=Math.floor(t/1000),a=Math.floor(c/60),d=c%60;return d>0?`${a}m ${d}s`:`${a}m`}if(t<259200000){let c=Math.floor(t/60000),a=Math.floor(c/60),d=c%60;return d>0?`${a}h ${d}m`:`${a}h`}let u=Math.floor(t/3600000),b=Math.floor(u/24),p=u%24;return p>0?`${b}d ${p}h`:`${b}d`}function ae(t){if(!Number.isFinite(t)||t<=0)return"0s";if(t<1000)return"<1s";if(t<60000)return`${Math.round(t/1000)}s`;if(t<3600000)return`${Math.round(t/60000)}m`;if(t<86400000){let p=t/3600000;return`${p>=10?Math.round(p).toString():p.toFixed(1).replace(/\.0$/,"")}h`}let u=t/86400000;return`${u>=10?Math.round(u).toString():u.toFixed(1).replace(/\.0$/,"")}d`}function B(t,u=1){if(!Number.isFinite(t)||t<=0)return"0%";let b=10**-u/100;if(t<b)return`<${(b*100).toFixed(u)}%`;return`${(t*100).toFixed(u)}%`}function Q(t){if(!Number.isFinite(t)||t<=0)return"0 B";if(t<1024)return`${Math.round(t)} B`;if(t<1048576)return`${(t/1024).toFixed(1)} KB`;if(t<1073741824)return`${(t/1048576).toFixed(2)} MB`;return`${(t/1073741824).toFixed(2)} GB`}function W(t){let u=t.split("-"),b=u[1],p=u[2];if(b!==void 0&&p!==void 0)return`${b}/${p}`;return t}function Z(t){let u=t.split("-"),b=u[0],p=u[1],c=u[2];if(b===void 0||p===void 0||c===void 0)return t;let a=Number(b),d=Number(p)-1,h=Number(c),w=new Date(Date.UTC(a,d,h)),C=["周日","周一","周二","周三","周四","周五","周六"],D=w.getUTCDay(),F=C[D]??"";return`${t} ${F}`}function se(t,u=Date.now()){if(t===null||t===void 0||!Number.isFinite(t)||t<=0)return"从未";let b=Math.max(0,u-t);if(b<60000)return"刚刚";if(b<3600000)return`${Math.max(1,Math.floor(b/60000))} 分钟前`;if(b<86400000)return`${Math.max(1,Math.floor(b/3600000))} 小时前`;if(b<2592000000)return`${Math.max(1,Math.floor(b/86400000))} 天前`;let p=new Date(t),c=p.getFullYear(),a=String(p.getMonth()+1).padStart(2,"0"),d=String(p.getDate()).padStart(2,"0");return`${c}-${a}-${d}`}function K(t){return e("div",{className:"h-1.5 w-full overflow-hidden rounded-full bg-raised",children:e("div",{className:"h-full rounded-full bg-accent transition-all duration-300",style:{width:`${t.percent}%`}})})}function Y(t){return e("div",{className:"flex flex-wrap items-center justify-between gap-x-4 gap-y-1 font-mono text-[11px] text-dim tabular-nums",children:t.children})}function G(t){return e("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:t.children})}function J(t){return n(G,{children:[n("span",{children:["输入 ",e("span",{className:"text-ink",children:M(t.stat.inputTokens)})]}),n("span",{children:["输出 ",e("span",{className:"text-ink",children:M(t.stat.outputTokens)})]}),n("span",{children:["缓存读 ",e("span",{className:"text-ink",children:M(t.stat.cacheReadTokens)}),t.cacheHitRate!==void 0&&n("span",{className:"text-faint",children:[" (",B(t.cacheHitRate),")"]})]})]})}function oe(t){let{projects:u,selectedProjectID:b,onSelectProject:p}=t,{style:c}=y();if(u.length===0)return e("div",{className:c("surface.empty"),children:"暂无项目统计数据"});return e("div",{className:"divide-y divide-line",children:u.map((a)=>{let d=a.projectID??V,h=b===d,w=Math.max(a.tokenShare>0?1:0,a.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:[e("span",{className:"font-medium text-sm text-ink truncate",children:a.name}),e("span",{className:c("control.badge","font-mono truncate max-w-[240px]"),title:a.directory||"未绑定项目目录",children:a.directory||"独立会话"}),e("button",{type:"button",onClick:()=>p(h?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:h?"取消筛选":"筛选"})]}),n("div",{className:"flex items-baseline gap-1.5 font-mono tabular-nums shrink-0",children:[e("span",{className:"text-xs font-medium text-ink",title:L(a.totalTokens),children:M(a.totalTokens)}),n("span",{className:"text-[11px] text-faint",children:["(",B(a.tokenShare),")"]})]})]}),e(K,{percent:w}),n(Y,{children:[e(J,{stat:a,cacheHitRate:a.cacheHitRate}),n(G,{children:[n("span",{children:["耗时 ",e("span",{className:"text-ink",children:P(a.activeDurationMs)})]}),n("span",{children:[e("span",{className:"text-ink",children:a.sessionCount.toLocaleString()})," 会话"]}),n("span",{children:["工具 ",e("span",{className:"text-ink",children:a.toolCalls.toLocaleString()})," 次"]})]})]})]},d)})})}function re(t){let{models:u}=t,{ModelIcon:b,style:p}=y();if(u.length===0)return e("div",{className:p("surface.empty"),children:"暂无模型调用数据"});return e("div",{className:"divide-y divide-line",children:u.map((c)=>{let a=Math.max(c.share>0?1:0,c.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:[e(b,{modelID:c.model,className:"size-4 shrink-0"}),e("span",{className:"font-mono text-sm font-medium text-ink truncate",children:c.shortName}),e("span",{className:p("control.badge","font-mono shrink-0"),children:c.provider})]}),n("div",{className:"flex items-baseline gap-2.5 font-mono tabular-nums shrink-0",children:[c.avgTps!==null&&n("span",{className:"text-[11px] text-dim",children:[c.avgTps.toFixed(1)," tok/s"]}),n("span",{className:"text-xs font-medium text-ink",title:L(c.totalTokens),children:[M(c.totalTokens)," ",n("span",{className:"text-[11px] font-normal text-faint",children:["(",B(c.share),")"]})]})]})]}),e(K,{percent:a}),n(Y,{children:[e(J,{stat:c,cacheHitRate:c.cacheHitRate}),n(G,{children:[n("span",{children:[e("span",{className:"text-ink",children:c.turns.toLocaleString()})," 轮",c.errors>0?n("span",{className:"text-danger",children:[" (",c.errors," 错)"]}):null]}),n("span",{children:["工具 ",e("span",{className:"text-ink",children:c.toolCalls.toLocaleString()})," 次"]}),c.generationMs>0&&n("span",{children:["推理 ",e("span",{className:"text-ink",children:ae(c.generationMs)})]})]})]})]},c.model)})})}function ie(t){let{tools:u}=t,{StatusChip:b,style:p}=y();if(u.length===0)return e("div",{className:p("surface.empty"),children:"暂无工具调用数据"});return e("div",{className:"divide-y divide-line",children:u.map((c)=>{let a=Math.max(c.share>0?1:0,c.share*100),d=c.successRate>=0.95?"success":c.successRate>=0.8?"warning":"danger",h=Math.max(0,c.calls-c.errors),w=c.calls>0?Math.round(c.outputBytes/c.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:[e("span",{className:"font-mono text-sm font-medium text-ink truncate",children:c.name}),n(b,{tone:d,children:["成功率 ",B(c.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:[c.calls.toLocaleString()," 次"]}),n("span",{className:"text-[11px] text-faint",children:["(",B(c.share),")"]})]})]}),e(K,{percent:a}),n(Y,{children:[n(G,{children:[n("span",{children:["成功 ",e("span",{className:"text-ink",children:h.toLocaleString()})," 次"]}),n("span",{children:["失败 ",e("span",{className:c.errors>0?"text-danger":"text-ink",children:c.errors.toLocaleString()})," 次"]})]}),n(G,{children:[n("span",{children:["累计输出 ",e("span",{className:"text-ink",children:Q(c.outputBytes)})]}),n("span",{children:["单次均值 ",e("span",{className:"text-ink",children:Q(w)})]})]})]})]},c.name)})})}function le(t){let{sessions:u,onOpenSession:b}=t,{style:p}=y();if(u.length===0)return e("div",{className:p("surface.empty"),children:"暂无高消耗会话记录"});let c=Math.max(1,...u.map((a)=>a.totalTokens));return e("div",{className:"divide-y divide-line",children:u.map((a)=>{let d=c>0?Math.max(1,a.totalTokens/c*100):0,h=a.model.split("/").pop()??a.model;return n("button",{type:"button",onClick:()=>b(a.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:[e("span",{className:"font-medium text-sm text-ink truncate group-hover:text-accent transition-colors",children:a.title.trim()||"新会话"}),e("span",{className:p("control.badge","font-mono truncate max-w-[140px] shrink-0"),title:a.projectName,children:a.projectName}),a.kind==="sub"&&e("span",{className:"rounded bg-accent/15 px-1.5 py-0.5 text-[10.5px] text-accent shrink-0",children:"子代理"}),a.archivedAt!==null&&e("span",{className:p("control.badge","shrink-0"),children:"已归档"})]}),n("div",{className:"flex items-center gap-1.5 font-mono tabular-nums shrink-0",children:[e("span",{className:"text-xs font-medium text-ink",title:L(a.totalTokens),children:M(a.totalTokens)}),e(at,{className:"size-3.5 text-faint group-hover:text-ink group-hover:translate-x-0.5 transition-all"})]})]}),e(K,{percent:d}),n(Y,{children:[e(J,{stat:a}),n(G,{children:[e("span",{className:"text-ink",children:h}),n("span",{children:["耗时 ",e("span",{className:"text-ink",children:P(a.activeDurationMs)})]}),n("span",{children:[e("span",{className:"text-ink",children:a.assistantTurns})," 轮"]}),e("span",{className:"text-faint",children:se(a.updated)})]})]})]},a.id)})})}var ce=[{value:"tokens",label:"Token 用量"},{value:"duration",label:"活跃耗时"},{value:"activity",label:"交互轮次"}];function ue(t){let{cn:u,Segmented:b,SettingGroup:p,style:c}=y(),{daily:a}=t,[d,h]=r("tokens"),[w,C]=r(null),D=v(()=>a.some((s)=>s.totalTokens>0||s.activeDurationMs>0||s.runs>0),[a]),F=v(()=>{if(a.length===0)return{totalText:"0",avgText:"0",peakDate:"—",peakValueText:"0"};if(d==="tokens"){let S=a.reduce((_,A)=>_+A.totalTokens,0),R=a.filter((_)=>_.totalTokens>0).length,N=a[0];for(let _ of a)if(!N||_.totalTokens>N.totalTokens)N=_;return{totalText:M(S),totalFullText:L(S),avgText:R>0?M(Math.round(S/R)):"0",peakDate:N&&N.totalTokens>0?W(N.date):"—",peakValueText:N&&N.totalTokens>0?M(N.totalTokens):"0"}}if(d==="duration"){let S=a.reduce((_,A)=>_+A.activeDurationMs,0),R=a.filter((_)=>_.activeDurationMs>0).length,N=a[0];for(let _ of a)if(!N||_.activeDurationMs>N.activeDurationMs)N=_;return{totalText:P(S),totalFullText:P(S),avgText:R>0?P(Math.round(S/R)):"0s",peakDate:N&&N.activeDurationMs>0?W(N.date):"—",peakValueText:N&&N.activeDurationMs>0?P(N.activeDurationMs):"0s"}}let s=a.reduce((S,R)=>S+R.assistantTurns,0),l=a.reduce((S,R)=>S+R.userMessages,0),x=s+l,T=a.filter((S)=>S.assistantTurns>0||S.userMessages>0).length,k=a[0];for(let S of a){let R=k?k.assistantTurns+k.userMessages:0;if(!k||S.assistantTurns+S.userMessages>R)k=S}let H=k?k.assistantTurns+k.userMessages:0;return{totalText:`${x.toLocaleString()} 轮`,totalFullText:`助手 ${s.toLocaleString()} 轮 · 用户 ${l.toLocaleString()} 问`,avgText:T>0?`${(x/T).toFixed(1)} 轮/天`:"0 轮/天",peakDate:k&&H>0?W(k.date):"—",peakValueText:k&&H>0?`${H.toLocaleString()} 轮`:"0 轮"}},[a,d]),j=v(()=>{if(w){let s=a.find((l)=>l.date===w);if(s)return s}for(let s=a.length-1;s>=0;s--){let l=a[s];if(l&&(l.totalTokens>0||l.activeDurationMs>0||l.runs>0))return l}return a[a.length-1]},[a,w]),z=v(()=>{if(d==="tokens")return Math.max(1,...a.map((s)=>s.totalTokens));if(d==="duration")return Math.max(1000,...a.map((s)=>s.activeDurationMs));return Math.max(1,...a.map((s)=>s.assistantTurns+s.userMessages))},[a,d]),m=v(()=>{if(a.length<=7)return a.map((x)=>x.date);let s=6,l=[];for(let x=0;x<s;x++){let T=Math.round(x*(a.length-1)/(s-1)),k=a[T];if(k)l.push(k.date)}return l},[a]);if(!D)return e(p,{title:"每日趋势",action:e(b,{value:d,onChange:(s)=>h(s),options:ce}),children:e("div",{className:c("surface.empty"),children:"当前时间范围内暂无活跃数据"})});return e(p,{title:"每日趋势",action:e(b,{value:d,onChange:(s)=>h(s),options:ce}),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:["汇总 ",e("span",{className:"text-ink",children:F.totalText})]}),n("span",{children:["日均 ",e("span",{className:"text-ink",children:F.avgText})]}),n("span",{children:["峰值 ",e("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(f,{children:[n("span",{className:"inline-flex items-center gap-1.5",children:[e("span",{className:"size-2 rounded-full bg-accent/40"}),"缓存读"]}),n("span",{className:"inline-flex items-center gap-1.5",children:[e("span",{className:"size-2 rounded-full bg-accent"}),"输入"]}),n("span",{className:"inline-flex items-center gap-1.5",children:[e("span",{className:"size-2 rounded-full bg-success"}),"输出"]})]}),d==="duration"&&n(f,{children:[n("span",{className:"inline-flex items-center gap-1.5",children:[e("span",{className:"size-2 rounded-full bg-accent"}),"工作调度"]}),n("span",{className:"inline-flex items-center gap-1.5",children:[e("span",{className:"size-2 rounded-full bg-success"}),"模型推理"]})]}),d==="activity"&&n(f,{children:[n("span",{className:"inline-flex items-center gap-1.5",children:[e("span",{className:"size-2 rounded-full bg-accent"}),"助手回复"]}),n("span",{className:"inline-flex items-center gap-1.5",children:[e("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:[e("div",{className:"border-b border-line/40 w-full"}),e("div",{className:"border-b border-line/30 w-full"}),e("div",{className:"border-b border-line/40 w-full"})]}),n("section",{"aria-label":"每日趋势柱状序列",className:"relative h-full flex flex-col justify-between",onMouseLeave:()=>C(null),children:[e("div",{className:"flex-1 flex items-end gap-1 sm:gap-1.5 pb-2",children:a.map((s)=>{let l=s.totalTokens;if(d==="duration")l=s.activeDurationMs;else if(d==="activity")l=s.assistantTurns+s.userMessages;let x=l<=0,T=x?0:Math.max(3,Math.min(100,l/z*100)),k=j?.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:()=>C(s.date),onFocus:()=>C(s.date),onClick:()=>C(s.date),children:[e("div",{className:u("absolute inset-y-0 w-full rounded-xs transition-colors pointer-events-none",k?"bg-accent/10":"group-hover:bg-raised/60")}),x?e("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:`${T}%`},children:[d==="tokens"&&n(f,{children:[s.outputTokens>0&&e("div",{className:"bg-success transition-all duration-200",style:{height:`${s.outputTokens/s.totalTokens*100}%`}}),s.inputTokens+s.cacheWriteTokens>0&&e("div",{className:"bg-accent transition-all duration-200",style:{height:`${(s.inputTokens+s.cacheWriteTokens)/s.totalTokens*100}%`}}),s.cacheReadTokens>0&&e("div",{className:"bg-accent/40 transition-all duration-200",style:{height:`${s.cacheReadTokens/s.totalTokens*100}%`}})]}),d==="duration"&&n(f,{children:[s.generationMs>0&&e("div",{className:"bg-success transition-all duration-200",style:{height:`${Math.min(100,s.generationMs/Math.max(1,s.activeDurationMs)*100)}%`}}),e("div",{className:"bg-accent flex-1 transition-all duration-200"})]}),d==="activity"&&n(f,{children:[s.userMessages>0&&e("div",{className:"bg-success transition-all duration-200",style:{height:`${s.userMessages/Math.max(1,s.assistantTurns+s.userMessages)*100}%`}}),e("div",{className:"bg-accent flex-1 transition-all duration-200"})]})]}),k&&e("div",{className:"absolute -bottom-1 size-1 rounded-full bg-accent"})]},s.date)})}),e("div",{className:u("flex items-center pt-1.5 text-[10px] text-faint font-mono tabular-nums",a.length<=7?"gap-1 sm:gap-1.5":"justify-between"),children:m.map((s)=>e("div",{className:u("whitespace-nowrap",a.length<=7&&"flex-1 text-center"),children:W(s)},s))})]})]}),e("div",{className:"flex flex-wrap items-center justify-between gap-2 border-t border-line pt-3 font-mono text-xs tabular-nums",children:j?n(f,{children:[e("span",{className:"text-ink",children:Z(j.date)}),n("div",{className:"flex flex-wrap items-center gap-x-3.5 gap-y-1 text-dim",children:[n("span",{children:["Token ",e("span",{className:"text-ink",children:M(j.totalTokens)})]}),n("span",{children:["耗时 ",e("span",{className:"text-ink",children:P(j.activeDurationMs)})]}),n("span",{children:["交互 ",n("span",{className:"text-ink",children:[j.assistantTurns+j.userMessages," 轮"]})]}),n("span",{children:["工具 ",n("span",{className:"text-ink",children:[j.toolCalls," 次"]})]})]})]}):e("span",{className:"font-sans text-faint",children:"悬停柱状图查看单日明细"})})]})})}function pe(t){let{cn:u,SettingGroup:b}=y(),{daily:p,hourly:c}=t,[a,d]=r(null),h=v(()=>{let l=new Map;for(let T of c)l.set(T.hour,T);let x=[];for(let T=0;T<24;T++){let k=l.get(T);if(k)x.push(k);else x.push({hour:T,totalTokens:0,activeDurationMs:0,userMessages:0,assistantTurns:0,runs:0})}return x},[c]),w=v(()=>{let l=h[0];for(let x of h)if(!l||x.totalTokens>l.totalTokens)l=x;return l&&l.totalTokens>0?l:null},[h]),C=v(()=>h.reduce((l,x)=>l+x.totalTokens,0),[h]),D=v(()=>Math.max(1,...h.map((l)=>l.totalTokens)),[h]),F=v(()=>{if(C<=0)return 0;return h.filter((x)=>x.hour>=8&&x.hour<20).reduce((x,T)=>x+T.totalTokens,0)/C},[h,C]),j=v(()=>Math.max(1,...p.map((l)=>l.totalTokens)),[p]),z=v(()=>{let l=0,x=0;for(let T of p)if(T.totalTokens>0||T.activeDurationMs>0||T.runs>0){if(x++,x>l)l=x}else x=0;return l},[p]),m=v(()=>p.filter((l)=>l.totalTokens>0||l.activeDurationMs>0||l.runs>0).length,[p]),s=a!==null?h[a]:w;return n(b,{title:"活跃时段与热力",action:n("div",{className:"flex items-center gap-3 font-mono text-xs text-faint tabular-nums",children:[n("span",{children:["日间占比 ",B(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:[e("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:[a!==null?"时段 ":"高峰 ",String(s.hour).padStart(2,"0"),":00 -"," ",String((s.hour+1)%24).padStart(2,"0"),":00"]}),e("span",{className:"text-ink",children:M(s.totalTokens)}),s.activeDurationMs>0&&e("span",{children:P(s.activeDurationMs)})]}):e("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:[e("div",{className:"flex-1 flex items-end gap-1.5 pb-1.5",children:h.map((l)=>{let x=w?.hour===l.hour,T=a===l.hour,k=l.totalTokens>0?Math.max(6,l.totalTokens/D*100):0,H=`${String(l.hour).padStart(2,"0")}:00 - ${String((l.hour+1)%24).padStart(2,"0")}:00
2
+ 消耗: ${L(l.totalTokens)} Token
3
+ 耗时: ${P(l.activeDurationMs)}
4
+ 助手轮次: ${l.assistantTurns} 轮`;return e("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:H,onMouseEnter:()=>d(l.hour),onFocus:()=>d(l.hour),onClick:()=>d(l.hour),children:k>0?e("div",{className:u("w-full max-w-[20px] rounded-t-xs transition-all duration-200",x||T?"bg-accent":"bg-accent/55 group-hover:bg-accent"),style:{height:`${k}%`}}):e("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:[e("span",{children:"00:00"}),e("span",{children:"04:00"}),e("span",{children:"08:00"}),e("span",{children:"12:00"}),e("span",{children:"16:00"}),e("span",{children:"20:00"}),e("span",{children:"23:00"})]})]})]}),n("div",{className:"p-4 space-y-2.5",children:[n("div",{className:"text-xs text-dim",children:["自然日热力 (",p.length," 天)"]}),e("div",{className:"flex flex-wrap items-center gap-1.5",children:p.map((l)=>{let x="bg-raised";if(l.totalTokens>0){let k=l.totalTokens/j;if(k<=0.33)x="bg-accent/30";else if(k<=0.66)x="bg-accent/60";else x="bg-accent"}let T=`${Z(l.date)}
5
+ 消耗: ${L(l.totalTokens)} Token
6
+ 耗时: ${P(l.activeDurationMs)}
7
+ 助手轮次: ${l.assistantTurns} 轮`;return e("div",{className:u("size-3.5 rounded-xs transition-transform hover:scale-125 cursor-pointer",x),title:T},l.date)})})]})]})}var xe=[{value:"7d",label:"近 7 天"},{value:"30d",label:"近 30 天"},{value:"90d",label:"近 90 天"},{value:"all",label:"全部"}],q=new Map,me=[];function X(t,u){return`${t}:${u??"all"}`}function Le(t){let{connection:u,onOpen:b}=t,{Button:p,PageLayout:c,Segmented:a,SettingGroup:d,style:h}=y(),[w,C]=r("30d"),[D,F]=r(null),[j,z]=r("projects"),[m,s]=r(()=>q.get(X("30d",null))??null),[l,x]=r(()=>!q.has(X("30d",null))),[T,k]=r(null),[H,S]=r(()=>me),R=i(0),N=g(async()=>{let A=++R.current,O=X(w,D),ee=q.get(O);if(ee)s(ee);x(!0);try{let E=new URLSearchParams({range:w,tzOffset:String(new Date().getTimezoneOffset())});if(D)E.set("projectID",D);let U=await u.request(`/api/stats?${E.toString()}`);if(A!==R.current)return;if(q.set(O,U),s(U),k(null),U.projects)S((de)=>{let te=new Map(de.map((I)=>[I.id,I.name]));for(let I of U.projects)if(I.projectID)te.set(I.projectID,I.name);let ne=Array.from(te.entries()).map(([I,fe])=>({id:I,name:fe}));return me=ne,ne})}catch(E){if(A===R.current)k(E instanceof Error?E.message:"加载统计数据失败")}finally{if(A===R.current)x(!1)}},[u,w,D]);o(()=>(N(),()=>{R.current++}),[N]);let _=v(()=>{if(!D)return null;if(D===V)return"独立聊天";return(H.find((O)=>O.id===D)??m?.projects.find((O)=>O.projectID===D))?.name??"指定项目"},[D,H,m]);return n(c,{title:_?n(f,{children:["统计 ",n("span",{className:"text-dim",children:["· ",_]})]}):"统计",description:"按项目、模型与工具统计活跃耗时与 Token 消耗。",actions:n(f,{children:[D&&e(p,{size:"sm",variant:"ghost",onClick:()=>F(null),children:"返回全部"}),e(a,{value:w,onChange:C,options:xe})]}),children:[T&&n("div",{className:"mb-4 flex items-center justify-between rounded-lg bg-danger/10 px-3 py-2 text-xs text-danger",children:[e("span",{children:T}),e(p,{size:"sm",variant:"ghost",onClick:()=>{N()},className:"text-danger hover:text-danger",children:"重试"})]}),l&&!m?e("div",{className:"flex justify-center py-12 text-xs text-faint",children:"正在加载统计…"}):!m?e("div",{className:h("surface.card","p-12 text-center text-sm text-dim"),children:"暂无统计数据"}):n("div",{className:"space-y-8",children:[e(d,{title:"核心总览",unboxed:!0,children:n("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[n("div",{className:h("surface.card","p-4"),children:[n("div",{className:"flex items-center justify-between gap-2 text-xs text-faint",children:[e("span",{children:"总 Token 消耗"}),n("span",{className:"font-mono tabular-nums",children:["缓存命中 ",B(m.overview.cacheHitRate)]})]}),e("div",{className:"mt-1.5 font-mono text-xl font-semibold tracking-tight text-ink tabular-nums",title:`${L(m.overview.totalTokens)} Token`,children:M(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:["输入 ",M(m.overview.inputTokens)]}),n("span",{children:["输出 ",M(m.overview.outputTokens)]}),n("span",{children:["缓存读 ",M(m.overview.cacheReadTokens)]})]})]}),n("div",{className:h("surface.card","p-4"),children:[n("div",{className:"flex items-center justify-between gap-2 text-xs text-faint",children:[e("span",{children:"活跃工作耗时"}),n("span",{className:"font-mono tabular-nums",children:["日均"," ",m.overview.activeDays>0?P(m.overview.activeDurationMs/m.overview.activeDays):"0s"]})]}),e("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:h("surface.card","p-4"),children:[n("div",{className:"flex items-center justify-between gap-2 text-xs text-faint",children:[e("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:h("surface.card","p-4"),children:[n("div",{className:"flex items-center justify-between gap-2 text-xs text-faint",children:[e("span",{children:"吞吐效率与调用"}),n("span",{className:"font-mono tabular-nums",children:[m.overview.compactions," 次折叠"]})]}),e("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()," 次运行"]})]})]})]})}),e(ue,{daily:m.daily}),e(pe,{daily:m.daily,hourly:m.hourly}),e(d,{title:"分类明细",action:e(a,{value:j,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:[j==="projects"&&e(oe,{projects:m.projects,selectedProjectID:D,onSelectProject:F,onOpenSession:b}),j==="models"&&e(re,{models:m.models}),j==="tools"&&e(ie,{tools:m.tools}),j==="sessions"&&e(le,{sessions:m.topSessions,onOpenSession:b})]},j)})]})]})}export{Le as StatsPage};
@@ -0,0 +1 @@
1
+ import{g,o,i,r,f,e,n,y,bt,Q}from"./chunk-nvt9tkt4.js";import{Or,$r,Br}from"./chunk-fpb2dd2d.js";var ee={global:"全局",project:"项目",custom:"自定义",builtin:"内置"};function F({skill:s,issue:N,connection:S}){let{Button:E,CopyButton:d,style:v,useTheme:w}=y();w();let[p,L]=r(),[P,x]=r(),[D,z]=r(0);return o(()=>{let c=!0;x(void 0),L(void 0);let m=new URLSearchParams;if(s.projectID)m.set("projectID",s.projectID);if(s.location)m.set("location",s.location);let I=m.toString()?`?${m.toString()}`:"";return Promise.all([S.request(`/api/skills/${encodeURIComponent(s.name)}/content${I}`),S.request(`/api/skills/${encodeURIComponent(s.name)}/files${I}`)]).then(([b,O])=>{if(c)L({text:b.text,files:O.files})}).catch((b)=>{if(c)x(b instanceof Error?b.message:"读取失败")}),()=>{c=!1}},[S,s.name,s.projectID,s.location,D]),n("div",{className:"min-w-0 space-y-5 text-sm text-ink",children:[e("p",{className:"whitespace-pre-wrap break-words [overflow-wrap:anywhere] text-dim",children:s.description||"暂无描述"}),n("div",{children:[n("p",{className:"break-all text-xs text-dim",children:[ee[s.scope],s.projectName?` · ${s.projectName}`:""]}),n("div",{className:"mt-1 flex min-w-0 items-center gap-2",children:[e("code",{className:v("markdown.inlineCode","min-w-0 flex-1 break-all text-xs"),children:s.location}),e(d,{text:s.location,label:"复制完整路径",className:"size-10"})]})]}),n("ul",{className:"space-y-1 break-words text-xs text-dim",children:[e("li",{children:"启用状态按名称生效,影响所有同名技能的新会话可用性。"}),s.disableModelInvocation&&e("li",{children:"仅手动:可由用户调用,不向模型自动提供。"}),s.platforms&&n("li",{children:["平台限制:",s.platforms.join("、")]}),s.disabled&&e("li",{children:"已禁用:不会提供给新会话。"}),N?.overriddenBy&&n("li",{className:"break-all",children:["被覆盖:同名技能优先使用 ",N.overriddenBy]})]}),s.commands?.length?n("div",{children:[e("h3",{className:"font-medium",children:"bin 命令"}),e("p",{className:"mt-1 text-xs text-dim",children:"技能目录中的可执行命令。"}),e("ul",{className:"mt-2 space-y-1 font-mono text-xs",children:s.commands.map((c)=>e("li",{className:"break-all",children:c},c))})]}):null,P?n("div",{role:"alert",className:"space-y-2",children:[n("p",{className:"break-words text-danger",children:["读取失败:",P]}),e(E,{className:"h-10",onClick:()=>z(D+1),children:"重试"})]}):!p?e("p",{role:"status",className:"text-dim",children:"正在读取文件…"}):n(f,{children:[n("section",{children:[n("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e("h3",{className:"font-medium",children:"SKILL.md 原文"}),e(d,{text:p.text,label:"复制 SKILL.md 原文",className:"size-10"})]}),n("p",{className:"mb-2 text-xs text-faint",children:[p.text.length.toLocaleString()," 字符 · 约 ",Math.ceil(p.text.length/4).toLocaleString()," ","tokens(估算)"]}),e("pre",{className:v("surface.subtle",v("chat.toolOutput"),"rounded-lg bg-raised p-3 text-xs leading-5 break-all"),children:p.text})]}),n("section",{children:[n("h3",{className:"font-medium",children:["目录文件 · ",p.files.length,p.files.length===200?"(最多显示 200 个)":""]}),e("ul",{className:"mt-2 space-y-1 font-mono text-xs text-dim",children:p.files.map((c)=>e("li",{className:"break-all",children:c},c))})]})]})]})}var A="all",G="non-project",te="size-4 cursor-pointer rounded border-line text-accent accent-accent focus-visible:outline-2 focus-visible:outline-accent";function me({connection:s}){let{Button:N,Select:S,Dialog:E,style:d,useTheme:v}=y();v();let[w,p]=r([]),[L,P]=r([]),[x,D]=r(A),[z,c]=r([]),[m,I]=r(),[b,O]=r(""),[k,B]=r(),[h,T]=r(!0),[K,R]=r(),[W,H]=r(),u=i(0),j=i(!1),C=g(async(t=!1)=>{let l=++u.current;j.current=!0,T(!0);try{if(t)await s.request("/api/skills/rescan",{method:"POST"});let[a,U,q]=await Promise.all([s.request("/api/skills?all=true"),s.request("/api/skills/settings"),s.request("/api/projects")]);if(l!==u.current)return;p(a.skills),P(q),c(a.issues),I(U),H(new Date),R(void 0)}catch(a){if(l===u.current)R(a instanceof Error?a.message:"读取失败")}finally{if(l===u.current)j.current=!1,T(!1)}},[s]);o(()=>(C(),()=>{u.current++}),[C]);async function V(t){if(j.current)return;j.current=!0;let l=++u.current;T(!0);try{let a=await s.request("/api/skills/settings",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(t)});if(l!==u.current)return;I(a),await C()}catch(a){if(l!==u.current)return;R(a instanceof Error?a.message:"保存设置失败"),j.current=!1,T(!1)}}let X=b.trim().toLocaleLowerCase(),J=x===A?w:w.filter((t)=>{if(t.scope!=="project")return!0;return x!==G&&t.projectID===x}),M=J.filter((t)=>`${t.name} ${t.description??""}`.toLocaleLowerCase().includes(X)),_=(t)=>z.find((l)=>l.kind==="overridden"&&(l.path==="<built-in>"?t.scope==="builtin":l.path.replace(/\\/g,"/")===`${t.location.replace(/\\/g,"/")}/SKILL.md`));return n("div",{className:"min-w-0 space-y-6",children:[n("section",{className:"min-w-0",children:[n("div",{className:"mb-2.5 flex flex-wrap items-end justify-between gap-3 px-0.5",children:[n("div",{className:"min-w-0 flex-1 basis-48",children:[e("h2",{className:d("settings.groupTitle"),children:"技能"}),e("p",{"aria-live":"polite",className:d("settings.groupDesc"),children:W&&`找到 ${J.length} 个 · ${W.toLocaleTimeString("zh-CN",{hour12:!1})}`})]}),n("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[e(S,{value:x,disabled:h,onValueChange:(t)=>{B(void 0),D(t)},groups:[{options:[{value:A,label:"全部来源"},{value:G,label:"非项目技能"}]},...Or(L)],className:"w-44"}),n(N,{variant:"ghost",disabled:h,onClick:()=>C(!0),className:"h-9 px-2.5 text-xs",children:[e(Q,{className:`size-3.5 ${h?"animate-spin":""}`}),e("span",{className:"ml-1",children:"重新扫描"})]})]})]}),K&&n("div",{role:"alert",className:"mb-3 flex flex-wrap items-center gap-2 rounded-xl border border-line p-3",children:[n("p",{className:"min-w-0 flex-1 break-words text-sm text-danger",children:["无法更新技能:",K]}),e(N,{disabled:h,onClick:()=>C(),children:"重试"})]}),e($r,{label:"搜索技能",placeholder:"搜索技能",value:b,onChange:O}),e("div",{className:d("settings.groupBox"),children:h&&!w.length?e(Br,{}):M.length===0?e("p",{className:"p-4 text-sm text-dim",children:"没有找到匹配的技能"}):e("ul",{className:"divide-y divide-line",children:M.map((t)=>{let l=_(t),a=t.disabled;return n("li",{className:`flex min-w-0 items-center justify-between gap-3 px-4 py-2.5 transition-colors hover:bg-raised/40 ${a?"opacity-55":""}`,children:[n("button",{type:"button",className:"group flex min-h-12 min-w-0 flex-1 cursor-pointer items-center gap-3 py-1 text-left focus-visible:outline-2 focus-visible:outline-accent","aria-label":`查看技能 ${t.name}`,onClick:()=>B(t),children:[n("span",{className:"min-w-0 flex-1",children:[n("span",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[e("span",{className:"truncate text-sm font-medium text-ink",title:t.name,children:t.name}),l&&n("span",{className:"flex shrink-0 items-center gap-1 text-xs text-warning",children:[e(bt,{className:"size-3.5"}),"被覆盖"]})]}),t.description&&e("span",{className:"mt-0.5 block truncate text-xs text-dim",title:t.description,children:t.description})]}),e("span",{className:d("control.badge","shrink-0 text-[11px] text-dim"),children:t.scope==="project"?"项目":t.scope==="builtin"?"built-in":"全局"})]}),e("span",{className:"relative flex size-10 shrink-0 items-center justify-center",children:e("input",{type:"checkbox","aria-label":`启用技能 ${t.name}`,className:te,disabled:h,checked:!a,onChange:(U)=>{if(!m)return;let q=m.disabled??[],Y=U.target.checked?q.filter((Z)=>Z!==t.name):[...q,t.name];V({...m,disabled:Y})}})})]},`${t.scope}:${t.projectID??""}:${t.name}`)})})})]}),e(E,{open:Boolean(k),onOpenChange:(t)=>{if(!t)B(void 0)},title:k?.name??"",size:"lg",footer:e("div",{className:"flex w-full justify-end",children:e(N,{variant:"primary",onClick:()=>B(void 0),children:"关闭"})}),children:k&&e(F,{skill:k,issue:_(k),connection:s})})]})}export{me as SkillsSection};