@bkm016/basalt 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (196) hide show
  1. package/README.md +16 -22
  2. package/chunk-06hdzq5n.js +2 -0
  3. package/chunk-09rj27b2.js +2 -0
  4. package/{chunk-qnr1f5pj.js → chunk-0y7ne3d0.js} +2 -2
  5. package/{chunk-vgvq3q12.js → chunk-10xzzn07.js} +2 -2
  6. package/{chunk-6qertm2t.js → chunk-1qpces5a.js} +1 -1
  7. package/{chunk-nt2gntad.js → chunk-1zdwrgd4.js} +1 -1
  8. package/{chunk-sh74qzvt.js → chunk-27gntzs5.js} +4 -4
  9. package/{chunk-1v7st27a.js → chunk-2esbgxps.js} +14 -14
  10. package/{chunk-exnn1867.js → chunk-362g64pd.js} +1 -1
  11. package/{chunk-1aspj1hn.js → chunk-3cjsd292.js} +2 -2
  12. package/chunk-5c9j8qe4.js +478 -0
  13. package/{chunk-8dxzqwq3.js → chunk-5j1krv9v.js} +1 -1
  14. package/{chunk-vkkj4awb.js → chunk-6hssbcgj.js} +1 -1
  15. package/{chunk-1b7gbe8g.js → chunk-75m78j7x.js} +2 -2
  16. package/{chunk-kfq8wyd3.js → chunk-8296hw9m.js} +1 -1
  17. package/{chunk-szat3vp4.js → chunk-8d46jtbj.js} +2 -2
  18. package/{chunk-qczbfccb.js → chunk-8tjad3r0.js} +4 -4
  19. package/{chunk-agntrqs9.js → chunk-97rzj7f6.js} +1 -1
  20. package/{chunk-k7w7ac9q.js → chunk-981f9dw8.js} +8 -8
  21. package/{chunk-xysny0ve.js → chunk-aefadsy6.js} +2 -2
  22. package/{chunk-jhd54p1b.js → chunk-bannb9xm.js} +1 -1
  23. package/{chunk-a3tqx584.js → chunk-c7x1zq39.js} +1 -1
  24. package/{chunk-rv06x0kn.js → chunk-cjc90f84.js} +1 -1
  25. package/{chunk-x3dnb9sz.js → chunk-d2j735sd.js} +2 -2
  26. package/{chunk-yskm0hsy.js → chunk-d8gtbw9g.js} +1 -1
  27. package/{chunk-rm3kcxq9.js → chunk-fjtvjrkg.js} +13 -13
  28. package/{chunk-h6sw8fbt.js → chunk-fm0k0qtz.js} +1 -1
  29. package/{chunk-1yzt0qm0.js → chunk-fw2bpqmw.js} +1 -1
  30. package/{chunk-45cz26ap.js → chunk-gp7y0fja.js} +13 -13
  31. package/{chunk-2bb01ddq.js → chunk-gzxnene8.js} +1 -1
  32. package/{chunk-a8nyk4k9.js → chunk-hwr56pfj.js} +1 -1
  33. package/{chunk-0hbjv3y6.js → chunk-jwdb0ccj.js} +3 -3
  34. package/{chunk-kf8hq21a.js → chunk-k23t7vhs.js} +5 -5
  35. package/{chunk-bhqyxyap.js → chunk-k506w58v.js} +1 -1
  36. package/{chunk-44ek81ad.js → chunk-k6w6y71k.js} +2 -2
  37. package/chunk-m40gxwq4.js +5 -0
  38. package/chunk-m8vkwdgr.js +5 -0
  39. package/{chunk-f7egr55n.js → chunk-mvfsxdx6.js} +13 -13
  40. package/{chunk-pvncysbb.js → chunk-nbb9trwz.js} +1 -1
  41. package/{chunk-0szjy61m.js → chunk-pbcy6zdt.js} +1 -1
  42. package/chunk-pmqtkqsf.js +2 -0
  43. package/{chunk-hat3s3pr.js → chunk-pxsrqrd0.js} +1 -1
  44. package/{chunk-xsbxykr4.js → chunk-qe0teyn1.js} +1 -1
  45. package/{chunk-2zqny2sy.js → chunk-r7fpkb49.js} +1 -1
  46. package/{chunk-3m7qwfm3.js → chunk-rtzqqngy.js} +3 -3
  47. package/{chunk-6e49xsf5.js → chunk-shadcb9z.js} +2 -2
  48. package/{chunk-0qqb6v41.js → chunk-shhrr741.js} +120 -120
  49. package/{chunk-cv5wsd9m.js → chunk-t6zs4kw0.js} +2 -2
  50. package/{chunk-hcn9cf6v.js → chunk-v258nxcz.js} +1 -1
  51. package/{chunk-a6r4z44b.js → chunk-vk1gxk1t.js} +1 -1
  52. package/{chunk-s37s3k24.js → chunk-x1xss1d7.js} +2 -2
  53. package/{chunk-dakrpbe6.js → chunk-x4874m8e.js} +2 -2
  54. package/{chunk-wx7kdf0b.js → chunk-xfvvh1s5.js} +1 -1
  55. package/{chunk-0yytz0r1.js → chunk-y0m980k3.js} +5 -5
  56. package/{chunk-dhm42y04.js → chunk-y58ygzn9.js} +3 -3
  57. package/{chunk-2wkaw73s.js → chunk-y648fzx0.js} +5 -5
  58. package/{chunk-32at88hc.js → chunk-y7nma9rk.js} +1 -1
  59. package/{chunk-pmc3y1z8.js → chunk-ykens1hy.js} +1 -1
  60. package/{chunk-q8zx3kt6.js → chunk-z55bmysw.js} +1 -1
  61. package/{chunk-qx0m82rw.js → chunk-zmsgwr3s.js} +1 -1
  62. package/{chunk-501zkf9b.js → chunk-ztsjgssj.js} +1 -1
  63. package/compiled.js +5 -5
  64. package/package.json +1 -1
  65. package/ui-test-worker.js +63 -63
  66. package/web/chunk-0sewdyz1.js +1 -0
  67. package/web/{chunk-xbty0rv7.js → chunk-1z5p7a1h.js} +1 -1
  68. package/web/chunk-21ke27j6.js +1 -0
  69. package/web/{chunk-2msj52w6.js → chunk-24k0r5aq.js} +1 -1
  70. package/web/{chunk-a5x2zveg.js → chunk-284a17k8.js} +1 -1
  71. package/web/{chunk-ca682sm6.js → chunk-2pjdtesn.js} +14 -14
  72. package/web/{chunk-z7dcbxws.js → chunk-3mvr2gwh.js} +1 -1
  73. package/web/chunk-3t3zwx9j.js +1 -0
  74. package/web/{chunk-e6jxqbv7.js → chunk-3z93efr4.js} +1 -1
  75. package/web/{chunk-05w4fyzc.js → chunk-43jqvsrg.js} +1 -1
  76. package/web/{chunk-jwzd9tzk.js → chunk-4bry4xds.js} +2 -2
  77. package/web/{chunk-4ks96e4r.js → chunk-5e7ygjdn.js} +1 -1
  78. package/web/{chunk-qefasa1j.js → chunk-5jbf7n5q.js} +1 -1
  79. package/web/{chunk-e32y85kx.js → chunk-5rx8rtsa.js} +1 -1
  80. package/web/chunk-5xc9d5ft.js +1 -0
  81. package/web/{chunk-a1z5qx1r.js → chunk-693m9kt7.js} +3 -3
  82. package/web/{chunk-70qwwwak.js → chunk-6qejm5s2.js} +1 -1
  83. package/web/{chunk-kdyjnwdx.js → chunk-8ah6ce1b.js} +2 -2
  84. package/web/{chunk-5vw9rs4r.js → chunk-8e43yaq3.js} +3 -3
  85. package/web/{chunk-qnaqf0cr.js → chunk-8wye0wbb.js} +1 -1
  86. package/web/{chunk-45fzdcgz.js → chunk-986z0p48.js} +5 -5
  87. package/web/{chunk-y0m8hrwz.js → chunk-9dd1c37b.js} +77 -77
  88. package/web/{chunk-9yakxvjb.js → chunk-9re6yttj.js} +2 -2
  89. package/web/{chunk-2scce33n.js → chunk-abbvjt4e.js} +1 -1
  90. package/web/{chunk-b4wbk7vc.js → chunk-agmkx996.js} +3 -3
  91. package/web/{chunk-hev4hq89.js → chunk-anbn2ttv.js} +2 -2
  92. package/web/chunk-aqm3spxt.js +1139 -0
  93. package/web/{chunk-fk0dh93x.js → chunk-avwpjsxw.js} +5 -5
  94. package/web/chunk-b470hvpk.js +1 -0
  95. package/web/{chunk-9dxjafp2.js → chunk-bt1m87ck.js} +2 -2
  96. package/web/chunk-cqp1d4p0.js +1 -0
  97. package/web/{chunk-ss1bcb0n.js → chunk-ctcrk3qn.js} +2 -2
  98. package/web/{chunk-pf2ab8p8.js → chunk-ctd8bfg2.js} +1 -1
  99. package/web/{chunk-q5ke7a33.js → chunk-cwvtraca.js} +1 -1
  100. package/web/{chunk-yd46jhqv.js → chunk-dk90px7g.js} +1 -1
  101. package/web/{chunk-0mrkjnte.js → chunk-ds7srg4p.js} +1 -1
  102. package/web/{chunk-fscafg24.js → chunk-dt8ss97f.js} +5 -5
  103. package/web/{chunk-9p12mgs6.js → chunk-ezkqa7we.js} +1 -1
  104. package/web/{chunk-f26smjjf.js → chunk-f078k1ej.js} +1 -1
  105. package/web/chunk-fekjj24p.css +1 -0
  106. package/web/{chunk-a3verqw9.js → chunk-fqj9kry9.js} +5 -5
  107. package/web/chunk-frjfamx7.js +8 -0
  108. package/web/{chunk-g4azyef7.js → chunk-fy8ey195.js} +1 -1
  109. package/web/{chunk-wptv8atc.js → chunk-g8ee1csm.js} +1 -1
  110. package/web/{chunk-w880psmw.js → chunk-h31p43qa.js} +1 -1
  111. package/web/chunk-h5p5jsrw.js +1 -0
  112. package/web/chunk-h9fmr6ch.js +1 -0
  113. package/web/{chunk-qh7265qw.js → chunk-jf2ehmvp.js} +2 -2
  114. package/web/{chunk-fz06t6km.js → chunk-jmnaq7c1.js} +1 -1
  115. package/web/chunk-jq0pw0k2.js +1 -0
  116. package/web/{chunk-p3b9crsa.js → chunk-jvj66qhs.js} +2 -2
  117. package/web/{chunk-xjxv8dg8.js → chunk-jzmzhj8z.js} +4 -4
  118. package/web/chunk-k4cfnvyq.js +1 -0
  119. package/web/{chunk-dt462hk9.js → chunk-kgerjbn4.js} +1 -1
  120. package/web/{chunk-bc78qf1m.js → chunk-kww4azv5.js} +5 -5
  121. package/web/chunk-m29dhjkh.js +1 -0
  122. package/web/chunk-mj6tee5h.js +1 -0
  123. package/web/{chunk-jrcyc9s9.js → chunk-mjpjkyd1.js} +1 -1
  124. package/web/{chunk-20q90epj.js → chunk-n8sky2q6.js} +1 -1
  125. package/web/{chunk-fm2ybfj5.js → chunk-pk3ap3wh.js} +4 -4
  126. package/web/{chunk-bgnnrpna.js → chunk-q1pkntc6.js} +4 -4
  127. package/web/{chunk-taynqrgq.js → chunk-qryrg2pq.js} +2 -2
  128. package/web/{chunk-gqw3f02j.js → chunk-r92sbgwv.js} +5 -5
  129. package/web/{chunk-0vt9fg48.js → chunk-raqqscwa.js} +2 -2
  130. package/web/{chunk-3jhyzmnf.js → chunk-rc2vq9wz.js} +3 -3
  131. package/web/{chunk-2ps6mepk.js → chunk-rkj743fg.js} +3 -3
  132. package/web/{chunk-e53wfgb8.js → chunk-rrws61wf.js} +1 -1
  133. package/web/{chunk-9an7cjd9.js → chunk-s3hwejnr.js} +2 -2
  134. package/web/{chunk-dzwxgqgm.js → chunk-s3rdx28k.js} +2 -2
  135. package/web/{chunk-2m12wyrb.js → chunk-shbw6wg8.js} +1 -1
  136. package/web/chunk-szcy5z56.js +1 -0
  137. package/web/{chunk-tmvakq7n.js → chunk-t1xk6hca.js} +4 -4
  138. package/web/chunk-t2hhdg9r.js +1 -0
  139. package/web/chunk-tj4cmkwe.js +1 -0
  140. package/web/{chunk-bjkc94mv.js → chunk-tn1xzmgx.js} +1 -1
  141. package/web/{chunk-4v8en1yw.js → chunk-tnv7z83q.js} +1 -1
  142. package/web/chunk-v2b5q0n5.js +1 -0
  143. package/web/{chunk-3ee04tmm.js → chunk-vj6kstpp.js} +5 -5
  144. package/web/{chunk-b1pe46zz.js → chunk-vjqmnkh2.js} +1 -1
  145. package/web/{chunk-qd8bxxdj.js → chunk-vkc149rb.js} +1 -1
  146. package/web/{chunk-v28fx2nd.js → chunk-vny496ba.js} +1 -1
  147. package/web/{chunk-rpmpttbk.js → chunk-vz5ck6x9.js} +1 -1
  148. package/web/{chunk-y49fhfda.js → chunk-xa88zgkr.js} +1 -1
  149. package/web/{chunk-q0p5xqe1.js → chunk-xdcs8qz3.js} +4 -4
  150. package/web/chunk-y5x74t89.js +1 -0
  151. package/web/{chunk-xrxne80b.js → chunk-yen2kkn2.js} +1 -1
  152. package/web/{chunk-bj90t5gh.js → chunk-yjv2c45j.js} +4 -4
  153. package/web/chunk-yx3dh5hg.js +1 -0
  154. package/web/chunk-yz4fmtk2.js +1 -0
  155. package/web/{chunk-8p4tc9f4.js → chunk-z24vs8q9.js} +3 -3
  156. package/web/chunk-z5j6x6j8.js +2 -0
  157. package/web/chunk-z5stjrhc.js +1 -0
  158. package/web/{chunk-90kp4pnz.js → chunk-z760wagr.js} +1 -1
  159. package/web/{chunk-tqmwd9qp.js → chunk-znvnb9dh.js} +1 -1
  160. package/web/{chunk-22a4ety5.js → chunk-zrzq29e6.js} +1 -1
  161. package/web/{icon-yx2p2pye.svg → icon-1wgy7kzy.svg} +13 -13
  162. package/web/icon.svg +13 -13
  163. package/web/index.html +2 -2
  164. package/web/install.sh +0 -0
  165. package/web/sw.js +9 -0
  166. package/worker.js +1 -1
  167. package/chunk-09vr609h.js +0 -2
  168. package/chunk-58vz2qsq.js +0 -2
  169. package/chunk-c25s4w6a.js +0 -5
  170. package/chunk-t057xfrt.js +0 -5
  171. package/chunk-wjd9fr23.js +0 -2
  172. package/chunk-zef13k3h.js +0 -471
  173. package/web/chunk-2pver6r4.js +0 -1
  174. package/web/chunk-37ajk6zg.js +0 -2
  175. package/web/chunk-4wkm9fda.js +0 -1
  176. package/web/chunk-amzgyy1k.js +0 -1
  177. package/web/chunk-cff5hcm8.js +0 -8
  178. package/web/chunk-esp1mmgr.js +0 -1
  179. package/web/chunk-ew3cgdtd.js +0 -1
  180. package/web/chunk-gjq1pxw3.js +0 -1
  181. package/web/chunk-h5ejbf6e.js +0 -1
  182. package/web/chunk-jjh5jvva.js +0 -1
  183. package/web/chunk-k5btcvbg.js +0 -1
  184. package/web/chunk-kpvgecwy.js +0 -1
  185. package/web/chunk-kq40ss39.js +0 -1
  186. package/web/chunk-q7dsnvpf.js +0 -1
  187. package/web/chunk-rg426vkf.js +0 -1
  188. package/web/chunk-ry9256r7.js +0 -1
  189. package/web/chunk-scpwc9ev.js +0 -1
  190. package/web/chunk-ssy07dd2.js +0 -1
  191. package/web/chunk-tgpbhzn9.js +0 -1
  192. package/web/chunk-vt40e1kp.js +0 -1136
  193. package/web/chunk-w53rba6g.js +0 -1
  194. package/web/chunk-w86n42dy.js +0 -1
  195. package/web/chunk-wtawdeej.css +0 -1
  196. package/web/chunk-zde7mj43.js +0 -1
@@ -0,0 +1 @@
1
+ import"./chunk-9dd1c37b.js";import"./chunk-jvj66qhs.js";import{ko}from"./chunk-fqj9kry9.js";import"./chunk-shbw6wg8.js";import"./chunk-z5j6x6j8.js";import"./chunk-ctcrk3qn.js";import"./chunk-anbn2ttv.js";export{ko as diagram};
@@ -1,4 +1,4 @@
1
- import{W}from"./chunk-b1pe46zz.js";import{e,r,we,D,b,B,C,S,E,T,A,I,L,q,U}from"./chunk-y0m8hrwz.js";import{X}from"./chunk-taynqrgq.js";var h={showLegend:!0,ticks:5,max:null,min:0,graticule:"circle"},M=32,k={axes:[],curves:[],options:h},x=structuredClone(k),V=D.radar,H=e(()=>U({...V,...b().radar}),"getConfig"),O=e(()=>x.axes,"getAxes"),j=e(()=>x.curves,"getCurves"),K=e(()=>x.options,"getOptions"),N=e((n)=>{x.axes=n.map((t)=>({name:t.name,label:t.label??t.name}))},"setAxes"),Y=e((n)=>{x.curves=n.map((t)=>({name:t.name,label:t.label??t.name,entries:Z(t.entries)}))},"setCurves"),Z=e((n)=>{if(n[0].axis==null)return n.map((a)=>a.value);let t=O();if(t.length===0)throw Error("Axes must be populated before curves for reference entries");return t.map((a)=>{let s=n.find((o)=>o.axis?.$refText===a.name);if(s===void 0)throw Error("Missing entry for axis "+a.label);return s.value})},"computeCurveEntries"),J=e((n)=>{let t=n.reduce((a,s)=>(a[s.name]=s,a),{});if(x.options={showLegend:t.showLegend?.value??h.showLegend,ticks:t.ticks?.value??h.ticks,max:t.max?.value??h.max,min:t.min?.value??h.min,graticule:t.graticule?.value??h.graticule},x.options.ticks>M)r.warn(`Radar diagram ticks (${x.options.ticks}) exceeds maximum allowed (${M}). Using ${M} instead.`),x.options.ticks=M},"setOptions"),Q=e(()=>{C(),x=structuredClone(k)},"clear"),y={getAxes:O,getCurves:j,getOptions:K,setAxes:N,setCurves:Y,setOptions:J,getConfig:H,clear:Q,setAccTitle:S,getAccTitle:E,setDiagramTitle:I,getDiagramTitle:L,getAccDescription:A,setAccDescription:T},tt=e((n)=>{W(n,y);let{axes:t,curves:a,options:s}=n;y.setAxes(t),y.setCurves(a),y.setOptions(s)},"populate"),et={parse:e(async(n)=>{let t=await X("radar",n);r.debug(t),tt(t)},"parse")},at=e((n,t,a,s)=>{let o=s.db,c=o.getAxes(),d=o.getCurves(),i=o.getOptions(),l=o.getConfig(),u=o.getDiagramTitle(),m=q(t),p=rt(m,l),g=i.max??Math.max(...d.map((w)=>Math.max(...w.entries))),v=i.min,f=Math.min(l.width,l.height)/2;nt(p,c,f,i.ticks,i.graticule),st(p,c,f,l),R(p,c,d,v,g,i.graticule,l),P(p,d,i.showLegend,l),p.append("text").attr("class","radarTitle").text(u).attr("x",0).attr("y",-l.height/2-l.marginTop)},"draw"),rt=e((n,t)=>{let a=t.width+t.marginLeft+t.marginRight,s=t.height+t.marginTop+t.marginBottom,o={x:t.marginLeft+t.width/2,y:t.marginTop+t.height/2};return B(n,s,a,t.useMaxWidth??!0),n.attr("viewBox",`0 0 ${a} ${s}`).attr("overflow","visible"),n.append("g").attr("transform",`translate(${o.x}, ${o.y})`)},"drawFrame"),nt=e((n,t,a,s,o)=>{if(o==="circle")for(let c=0;c<s;c++){let d=a*(c+1)/s;n.append("circle").attr("r",d).attr("class","radarGraticule")}else if(o==="polygon"){let c=t.length;for(let d=0;d<s;d++){let i=a*(d+1)/s,l=t.map((u,m)=>{let p=2*m*Math.PI/c-Math.PI/2,g=i*Math.cos(p),v=i*Math.sin(p);return`${g},${v}`}).join(" ");n.append("polygon").attr("points",l).attr("class","radarGraticule")}}},"drawGraticule"),st=e((n,t,a,s)=>{let o=t.length;for(let c=0;c<o;c++){let d=t[c].label,i=2*c*Math.PI/o-Math.PI/2,l=Math.cos(i),u=Math.sin(i);n.append("line").attr("x1",0).attr("y1",0).attr("x2",a*s.axisScaleFactor*l).attr("y2",a*s.axisScaleFactor*u).attr("class","radarAxisLine");let m=l>0.01?"start":l<-0.01?"end":"middle",p=u>0.01?"hanging":u<-0.01?"auto":"central",g=4;n.append("text").text(d).attr("x",a*s.axisLabelFactor*l+g*l).attr("y",a*s.axisLabelFactor*u+g*u).attr("text-anchor",m).attr("dominant-baseline",p).attr("class","radarAxisLabel")}},"drawAxes");function R(n,t,a,s,o,c,d){let i=t.length,l=Math.min(d.width,d.height)/2;a.forEach((u,m)=>{if(u.entries.length!==i)return;let p=u.entries.map((g,v)=>{let f=2*Math.PI*v/i-Math.PI/2,w=_(g,s,o,l),z=w*Math.cos(f),G=w*Math.sin(f);return{x:z,y:G}});if(c==="circle")n.append("path").attr("d",F(p,d.curveTension)).attr("class",`radarCurve-${m}`);else if(c==="polygon")n.append("polygon").attr("points",p.map((g)=>`${g.x},${g.y}`).join(" ")).attr("class",`radarCurve-${m}`)})}e(R,"drawCurves");function _(n,t,a,s){let o=Math.min(Math.max(n,t),a);return s*(o-t)/(a-t)}e(_,"relativeRadius");function F(n,t){let a=n.length,s=`M${n[0].x},${n[0].y}`;for(let o=0;o<a;o++){let c=n[(o-1+a)%a],d=n[o],i=n[(o+1)%a],l=n[(o+2)%a],u={x:d.x+(i.x-c.x)*t,y:d.y+(i.y-c.y)*t},m={x:i.x-(l.x-d.x)*t,y:i.y-(l.y-d.y)*t};s+=` C${u.x},${u.y} ${m.x},${m.y} ${i.x},${i.y}`}return`${s} Z`}e(F,"closedRoundCurve");function P(n,t,a,s){if(!a)return;let o=(s.width/2+s.marginRight)*3/4,c=-(s.height/2+s.marginTop)*3/4,d=20;t.forEach((i,l)=>{let u=n.append("g").attr("transform",`translate(${o}, ${c+l*d})`);u.append("rect").attr("width",12).attr("height",12).attr("class",`radarLegendBox-${l}`),u.append("text").attr("x",16).attr("y",0).attr("class","radarLegendText").text(i.label)})}e(P,"drawLegend");var ot={draw:at},it=e((n,t)=>{let a="";for(let s=0;s<n.THEME_COLOR_LIMIT;s++){let o=n[`cScale${s}`];a+=`
1
+ import{W}from"./chunk-vjqmnkh2.js";import{e,r,we,D,b,B,C,S,E,T,A,I,L,V,U}from"./chunk-9dd1c37b.js";import{X}from"./chunk-qryrg2pq.js";var h={showLegend:!0,ticks:5,max:null,min:0,graticule:"circle"},M=32,k={axes:[],curves:[],options:h},x=structuredClone(k),H=D.radar,j=e(()=>U({...H,...b().radar}),"getConfig"),O=e(()=>x.axes,"getAxes"),K=e(()=>x.curves,"getCurves"),N=e(()=>x.options,"getOptions"),Y=e((n)=>{x.axes=n.map((t)=>({name:t.name,label:t.label??t.name}))},"setAxes"),Z=e((n)=>{x.curves=n.map((t)=>({name:t.name,label:t.label??t.name,entries:q(t.entries)}))},"setCurves"),q=e((n)=>{if(n[0].axis==null)return n.map((a)=>a.value);let t=O();if(t.length===0)throw Error("Axes must be populated before curves for reference entries");return t.map((a)=>{let s=n.find((o)=>o.axis?.$refText===a.name);if(s===void 0)throw Error("Missing entry for axis "+a.label);return s.value})},"computeCurveEntries"),J=e((n)=>{let t=n.reduce((a,s)=>(a[s.name]=s,a),{});if(x.options={showLegend:t.showLegend?.value??h.showLegend,ticks:t.ticks?.value??h.ticks,max:t.max?.value??h.max,min:t.min?.value??h.min,graticule:t.graticule?.value??h.graticule},x.options.ticks>M)r.warn(`Radar diagram ticks (${x.options.ticks}) exceeds maximum allowed (${M}). Using ${M} instead.`),x.options.ticks=M},"setOptions"),Q=e(()=>{C(),x=structuredClone(k)},"clear"),y={getAxes:O,getCurves:K,getOptions:N,setAxes:Y,setCurves:Z,setOptions:J,getConfig:j,clear:Q,setAccTitle:S,getAccTitle:E,setDiagramTitle:I,getDiagramTitle:L,getAccDescription:A,setAccDescription:T},tt=e((n)=>{W(n,y);let{axes:t,curves:a,options:s}=n;y.setAxes(t),y.setCurves(a),y.setOptions(s)},"populate"),et={parse:e(async(n)=>{let t=await X("radar",n);r.debug(t),tt(t)},"parse")},at=e((n,t,a,s)=>{let o=s.db,c=o.getAxes(),d=o.getCurves(),i=o.getOptions(),l=o.getConfig(),u=o.getDiagramTitle(),m=V(t),p=rt(m,l),g=i.max??Math.max(...d.map((w)=>Math.max(...w.entries))),v=i.min,f=Math.min(l.width,l.height)/2;nt(p,c,f,i.ticks,i.graticule),st(p,c,f,l),R(p,c,d,v,g,i.graticule,l),P(p,d,i.showLegend,l),p.append("text").attr("class","radarTitle").text(u).attr("x",0).attr("y",-l.height/2-l.marginTop)},"draw"),rt=e((n,t)=>{let a=t.width+t.marginLeft+t.marginRight,s=t.height+t.marginTop+t.marginBottom,o={x:t.marginLeft+t.width/2,y:t.marginTop+t.height/2};return B(n,s,a,t.useMaxWidth??!0),n.attr("viewBox",`0 0 ${a} ${s}`).attr("overflow","visible"),n.append("g").attr("transform",`translate(${o.x}, ${o.y})`)},"drawFrame"),nt=e((n,t,a,s,o)=>{if(o==="circle")for(let c=0;c<s;c++){let d=a*(c+1)/s;n.append("circle").attr("r",d).attr("class","radarGraticule")}else if(o==="polygon"){let c=t.length;for(let d=0;d<s;d++){let i=a*(d+1)/s,l=t.map((u,m)=>{let p=2*m*Math.PI/c-Math.PI/2,g=i*Math.cos(p),v=i*Math.sin(p);return`${g},${v}`}).join(" ");n.append("polygon").attr("points",l).attr("class","radarGraticule")}}},"drawGraticule"),st=e((n,t,a,s)=>{let o=t.length;for(let c=0;c<o;c++){let d=t[c].label,i=2*c*Math.PI/o-Math.PI/2,l=Math.cos(i),u=Math.sin(i);n.append("line").attr("x1",0).attr("y1",0).attr("x2",a*s.axisScaleFactor*l).attr("y2",a*s.axisScaleFactor*u).attr("class","radarAxisLine");let m=l>0.01?"start":l<-0.01?"end":"middle",p=u>0.01?"hanging":u<-0.01?"auto":"central",g=4;n.append("text").text(d).attr("x",a*s.axisLabelFactor*l+g*l).attr("y",a*s.axisLabelFactor*u+g*u).attr("text-anchor",m).attr("dominant-baseline",p).attr("class","radarAxisLabel")}},"drawAxes");function R(n,t,a,s,o,c,d){let i=t.length,l=Math.min(d.width,d.height)/2;a.forEach((u,m)=>{if(u.entries.length!==i)return;let p=u.entries.map((g,v)=>{let f=2*Math.PI*v/i-Math.PI/2,w=_(g,s,o,l),z=w*Math.cos(f),G=w*Math.sin(f);return{x:z,y:G}});if(c==="circle")n.append("path").attr("d",F(p,d.curveTension)).attr("class",`radarCurve-${m}`);else if(c==="polygon")n.append("polygon").attr("points",p.map((g)=>`${g.x},${g.y}`).join(" ")).attr("class",`radarCurve-${m}`)})}e(R,"drawCurves");function _(n,t,a,s){let o=Math.min(Math.max(n,t),a);return s*(o-t)/(a-t)}e(_,"relativeRadius");function F(n,t){let a=n.length,s=`M${n[0].x},${n[0].y}`;for(let o=0;o<a;o++){let c=n[(o-1+a)%a],d=n[o],i=n[(o+1)%a],l=n[(o+2)%a],u={x:d.x+(i.x-c.x)*t,y:d.y+(i.y-c.y)*t},m={x:i.x-(l.x-d.x)*t,y:i.y-(l.y-d.y)*t};s+=` C${u.x},${u.y} ${m.x},${m.y} ${i.x},${i.y}`}return`${s} Z`}e(F,"closedRoundCurve");function P(n,t,a,s){if(!a)return;let o=(s.width/2+s.marginRight)*3/4,c=-(s.height/2+s.marginTop)*3/4,d=20;t.forEach((i,l)=>{let u=n.append("g").attr("transform",`translate(${o}, ${c+l*d})`);u.append("rect").attr("width",12).attr("height",12).attr("class",`radarLegendBox-${l}`),u.append("text").attr("x",16).attr("y",0).attr("class","radarLegendText").text(i.label)})}e(P,"drawLegend");var ot={draw:at},it=e((n,t)=>{let a="";for(let s=0;s<n.THEME_COLOR_LIMIT;s++){let o=n[`cScale${s}`];a+=`
2
2
  .radarCurve-${s} {
3
3
  color: ${o};
4
4
  fill: ${o};
@@ -0,0 +1 @@
1
+ import{ir}from"./chunk-qryrg2pq.js";export{ir as createRailroadAbnfServices};
@@ -1 +1 @@
1
- import{P,a,t,n,Ee,en,V,de,Zi}from"./chunk-vt40e1kp.js";function Q(s){let i=P(Ee);i?.useTheme?.();let e=s.payload,[o,m]=a(!1);if(!e||e.state==="pending")return null;let h=e.questions.map((r)=>r.header).join(" · "),l=e.state==="answered",u=l?V:en,d=l?"text-success":"text-faint",f=l?"已回答":e.state==="dismissed"?"已忽略提问":"提问已取消",p=l?g(e):h;if(i){let{Collapsible:r,CollapsibleTrigger:y,CollapsibleContent:N,Chevron:v,cn:b}=i;return n(r,{open:o,onOpenChange:m,className:"w-full text-xs text-ink/90 animate-fade",children:[n(y,{className:i.style("chat.timelineRow","cursor-pointer select-none"),children:[t("span",{className:"flex size-4 shrink-0 items-center justify-center",children:t(u,{className:b("size-3.5",d)})}),t("span",{className:"shrink-0",children:f}),t("span",{className:"min-w-0 flex-1 truncate opacity-80",title:p,children:p}),t(v,{className:"size-3.5 shrink-0 text-faint opacity-0 transition-opacity group-hover/collapsible:opacity-100 group-data-[state=open]/collapsible:opacity-100"})]}),t(N,{children:t("div",{className:"mt-0.5 mb-1.5 ml-2 border-l border-line py-1 pl-[15px]",children:t(x,{question:e})})})]})}return n("div",{role:"status",className:"w-full animate-fade",children:[n("button",{type:"button","aria-expanded":o,className:"group -mx-2 flex w-[calc(100%+1rem)] cursor-pointer items-center gap-2 rounded-lg px-2 py-1 text-left text-[12.5px] text-faint transition-colors select-none hover:bg-raised/60 hover:text-dim",onClick:()=>m((r)=>!r),children:[t("span",{className:"flex size-4 shrink-0 items-center justify-center",children:t(u,{className:`size-3.5 shrink-0 ${d}`})}),t("span",{className:"shrink-0",children:f}),t("span",{className:"min-w-0 flex-1 truncate opacity-80",title:p,children:p}),t(de,{className:`size-3.5 shrink-0 text-faint opacity-0 transition-[opacity,transform] group-hover:opacity-100 ${o?"rotate-180 opacity-100":""}`})]}),o&&t("div",{className:"mt-0.5 mb-1.5 ml-2 border-l border-line py-1 pl-[15px]",children:t(x,{question:e})})]})}function c(s){if(!s)return"未作答";let i=s.selected.map((e)=>Zi(e).title);if(s.other)i.push(`其他:${s.other}`);return i.length?i.join("、"):"未作答"}function g(s){if(s.questions.length===1)return`${s.questions[0]?.header??""} · ${c(s.answers?.[0])}`;return s.questions.map((i,e)=>`${i.header} → ${c(s.answers?.[e])}`).join(";")}function x(s){let i=s.question;return t("div",{className:"space-y-2 text-xs",children:i.questions.map((e,o)=>n("div",{className:"space-y-0.5",children:[n("div",{className:"text-dim",children:[t("span",{className:"font-medium text-ink/90",children:e.header})," · ",e.question]}),t("div",{className:"text-ink",children:c(i.answers?.[o])})]},e.header))})}export{Q as QuestionCard};
1
+ import{P,a,t,n,Ee,Lt,q,pe,Zi}from"./chunk-aqm3spxt.js";function T(s){let i=P(Ee);i?.useTheme?.();let e=s.payload,[o,m]=a(!1);if(!e||e.state==="pending")return null;let h=e.questions.map((r)=>r.header).join(" · "),l=e.state==="answered",u=l?q:Lt,d=l?"text-success":"text-faint",f=l?"已回答":e.state==="dismissed"?"已忽略提问":"提问已取消",p=l?g(e):h;if(i){let{Collapsible:r,CollapsibleTrigger:y,CollapsibleContent:N,Chevron:v,cn:b}=i;return n(r,{open:o,onOpenChange:m,className:"w-full text-xs text-ink/90 animate-fade",children:[n(y,{className:i.style("chat.timelineRow","cursor-pointer select-none"),children:[t("span",{className:"flex size-4 shrink-0 items-center justify-center",children:t(u,{className:b("size-3.5",d)})}),t("span",{className:"shrink-0",children:f}),t("span",{className:"min-w-0 flex-1 truncate opacity-80",title:p,children:p}),t(v,{className:"size-3.5 shrink-0 text-faint opacity-0 transition-opacity group-hover/collapsible:opacity-100 group-data-[state=open]/collapsible:opacity-100"})]}),t(N,{children:t("div",{className:"mt-0.5 mb-1.5 ml-2 border-l border-line py-1 pl-[15px]",children:t(x,{question:e})})})]})}return n("div",{role:"status",className:"w-full animate-fade",children:[n("button",{type:"button","aria-expanded":o,className:"group -mx-2 flex w-[calc(100%+1rem)] cursor-pointer items-center gap-2 rounded-lg px-2 py-1 text-left text-[12.5px] text-faint transition-colors select-none hover:bg-raised/60 hover:text-dim",onClick:()=>m((r)=>!r),children:[t("span",{className:"flex size-4 shrink-0 items-center justify-center",children:t(u,{className:`size-3.5 shrink-0 ${d}`})}),t("span",{className:"shrink-0",children:f}),t("span",{className:"min-w-0 flex-1 truncate opacity-80",title:p,children:p}),t(pe,{className:`size-3.5 shrink-0 text-faint opacity-0 transition-[opacity,transform] group-hover:opacity-100 ${o?"rotate-180 opacity-100":""}`})]}),o&&t("div",{className:"mt-0.5 mb-1.5 ml-2 border-l border-line py-1 pl-[15px]",children:t(x,{question:e})})]})}function c(s){if(!s)return"未作答";let i=s.selected.map((e)=>Zi(e).title);if(s.other)i.push(`其他:${s.other}`);return i.length?i.join("、"):"未作答"}function g(s){if(s.questions.length===1)return`${s.questions[0]?.header??""} · ${c(s.answers?.[0])}`;return s.questions.map((i,e)=>`${i.header} → ${c(s.answers?.[e])}`).join(";")}function x(s){let i=s.question;return t("div",{className:"space-y-2 text-xs",children:i.questions.map((e,o)=>n("div",{className:"space-y-0.5",children:[n("div",{className:"text-dim",children:[t("span",{className:"font-medium text-ink/90",children:e.header})," · ",e.question]}),t("div",{className:"text-ink",children:c(i.answers?.[o])})]},e.header))})}export{T as QuestionCard};
@@ -1,4 +1,4 @@
1
- import{h,o,g,i,a,v,t,n,_,yt}from"./chunk-vt40e1kp.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,a,v,t,n,_,yt}from"./chunk-aqm3spxt.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
2
2
  消耗: ${B(l.totalTokens)} Token
3
3
  耗时: ${P(l.activeDurationMs)}
4
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)}