import{C as e,Cn as t,I as n,Mn as r,O as i,On as a,T as o,U as s,bn as c,d as l,dt as u,f as d,ft as f,jn as p,kn as m,lt as h,mt as g,ot as _,pt as v,ut as y,vn as b,w as x}from"./index-BZbSGIBZ.js";var S=t(`<div class="stat flex-1 place-items-center"><div class="stat-title text-primary-content"></div><div class="stat-value w-full truncate text-center text-2xl text-primary-content lg:text-3xl">`),C=t(`<div class="flex flex-col gap-2 lg:h-full"><div class="stats w-full shrink-0 stats-vertical grid-cols-2 bg-primary shadow lg:flex lg:stats-horizontal"></div><div class="grid grid-cols-1 gap-2 rounded-box bg-base-300 py-4 lg:grid-cols-3"><div class=h-80></div><div class=h-80></div><div class=h-80></div></div><footer class="mx-auto mt-4 footer block footer-horizontal rounded-box bg-neutral p-4 text-center text-lg font-bold text-neutral-content">`),w=e=>(()=>{var t=S(),n=t.firstChild,r=n.nextSibling;return b(n,()=>e.label),b(r,()=>a(()=>e.children)()),t})(),T=()=>{let[t]=s(),a,S,T=g.download.length>0?g.download[g.download.length-1][0]:0,E=v.length>0?v[v.length-1][0]:0;p(()=>{let e=f();if(e&&a){let t=Date.now();t>T&&(a.addPoints([{seriesIndex:0,time:t,value:e.down},{seriesIndex:1,time:t,value:e.up}]),y(t,e.down,e.up),T=t)}}),p(()=>{let e=u()?.inuse;if(e&&S){let t=Date.now();t>E&&(S.addPoint(0,t,e),h(t,e),E=t)}});let D=r(()=>{let e=n();return{chart:{type:`pie`,backgroundColor:e.backgroundColor,animation:!1},credits:{enabled:!1},title:{text:t(`flow`),style:{color:e.textColor}},tooltip:{pointFormatter:function(){let e=this.y||0,t=this.percentage||0;return`${this.name}<br/>${x(e).toString()} (${t.toFixed(1)}%)`}},plotOptions:{pie:{allowPointSelect:!0,cursor:`pointer`,dataLabels:{enabled:!1},showInLegend:!0,animation:!1}},legend:{itemStyle:{color:e.textColor},itemHoverStyle:{color:e.textColorHover}},series:[{type:`pie`,name:t(`flow`),data:[{name:t(`downloadTotal`),y:_()?.downloadTotal||0,color:e.seriesColors[0]},{name:t(`uploadTotal`),y:_()?.uploadTotal||0,color:e.seriesColors[1]}]}]}});return[m(l,{get children(){return t(`overview`)}}),(()=>{var n=C(),r=n.firstChild,s=r.nextSibling,l=s.firstChild,p=l.nextSibling,h=p.nextSibling,y=s.nextSibling;return b(r,m(w,{get label(){return t(`upload`)},get children(){return[c(()=>x(f()?.up||0).toString()),`/s`]}}),null),b(r,m(w,{get label(){return t(`download`)},get children(){return[c(()=>x(f()?.down||0).toString()),`/s`]}}),null),b(r,m(w,{get label(){return t(`uploadTotal`)},get children(){return x(_()?.uploadTotal||0).toString()}}),null),b(r,m(w,{get label(){return t(`downloadTotal`)},get children(){return x(_()?.downloadTotal||0).toString()}}),null),b(r,m(w,{get label(){return t(`activeConnections`)},get children(){return _()?.connections?.length||0}}),null),b(r,m(w,{get label(){return t(`memoryUsage`)},get children(){return x(u()?.inuse||0).toString()}}),null),b(l,m(e,{ref:e=>a=e,get title(){return t(`traffic`)},get seriesConfig(){return[{name:t(`down`),color:`#7cb5ec`},{name:t(`up`),color:`#90ed7d`}]},get initialData(){return[[...g.download],[...g.upload]]},get isLoading(){return!f()}})),b(p,m(o,{get isLoading(){return _()?.connections?.length===0},get options(){return D()}})),b(h,m(e,{ref:e=>S=e,get title(){return t(`memory`)},get seriesConfig(){return[{name:t(`memory`),color:`#f7a35c`}]},get initialData(){return[[...v]]},get isLoading(){return!u()}})),b(n,m(d,{}),y),b(y,()=>i()?.url),n})()]};export{T as default};