import{$t as e,Dt as t,G as n,Kt as r,Qt as i,_n as a,_t as o,b as s,bn as c,c as l,cn as u,en as d,f,fn as p,gn as m,in as h,jt as g,ln as _,m as v,pn as y,rn as b,t as x,un as S,vn as C,wn as w,xt as T,yn as E,yt as D}from"./index-DIwJcTz_.js";const O=(e,t,n)=>{let r=n(e,t);return E(()=>clearInterval(r))};var k=w(g());function A(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null||Symbol.iterator in e?!1:Symbol.toStringTag in e?Object.prototype.toString.call(e)===`[object Module]`:!0}function j(e,t,n=`.`,r){if(!A(t))return j(e,{},n,r);let i=Object.assign({},t);for(let t in e){if(t===`__proto__`||t===`constructor`)continue;let a=e[t];if(a==null||r&&r(i,t,a,n))continue;Array.isArray(a)&&Array.isArray(i[t])?i[t]=[...a,...i[t]]:A(a)&&A(i[t])?i[t]=j(a,i[t],(n?`${n}.`:``)+t.toString(),r):i[t]=a}return i}function M(e){return(...t)=>t.reduce((t,n)=>j(t,n,``,e),{})}var N=M(),P=b(`<div>`),F=e=>{let t,n,i=a({height:`auto`,width:`100%`,series:[],type:`line`},e),o=async()=>{let a={chart:{type:i.type,height:i.height,width:i.width,events:{}},series:r(i.series)};for(let t in e)if(t.startsWith(`on`)){let n=t.charAt(2).toLowerCase()+t.slice(3);a.chart.events[n]=e[t]}let o=N(r(i.options),a),s=(await x(async()=>{let{default:e}=await import(`./apexcharts.esm-D-nlnKto.js`);return{default:e}},[],import.meta.url)).default;n=new s(t,o),e.ref?.(n),n.render()};return c(()=>{o()}),p(C(()=>i.series,e=>{n.updateSeries(e)},{defer:!0})),p(C(()=>i.options,e=>{n.updateOptions(e)},{defer:!0})),p(C(()=>[i.type,i.height,i.width],()=>{n.destroy(),o()},{defer:!0})),E(()=>{n.destroy()}),(()=>{var e=P(),n=t;return typeof n==`function`?h(n,e):t=e,e})()},I=b(`<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">`),L=b(`<div class="flex flex-col gap-2 lg:h-full"><div class="stats w-full flex-shrink-0 stats-vertical grid-cols-2 bg-primary shadow lg:flex lg:stats-horizontal"></div><div class="flex flex-col gap-2 rounded-box bg-base-300 py-4 lg:flex-row"><div class=flex-1></div><div class=flex-1></div><div class=flex-1></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">`),R=e=>(()=>{var t=I(),n=t.firstChild,r=n.nextSibling;return i(n,()=>e.label),i(r,()=>_(()=>e.children)()),t})(),z=()=>{let e=f();if(!v())return e(`/setup`,{replace:!0}),null;let[r]=o(),[a,c]=m([]),[h,g]=m([]);O(()=>{u(()=>{c(e=>e.slice(-10)),g(e=>e.slice(-10))})},60*1e3,setInterval);let _=s(`traffic`);p(()=>{let e=_();e&&c(t=>[...t,e])});let b=y(()=>(0,k.defaultsDeep)({title:{text:r(`traffic`)}},T)),x=y(()=>[{name:r(`down`),data:a().map(e=>e.down)},{name:r(`up`),data:a().map(e=>e.up)}]),C=y(()=>(0,k.defaultsDeep)({title:{text:r(`flow`)},labels:[r(`downloadTotal`),r(`uploadTotal`)],tooltip:{enabled:!0},chart:{animations:{enabled:!1}}},T)),w=y(()=>[n()?.downloadTotal||0,n()?.uploadTotal||0]),E=s(`memory`);p(()=>{let e=E()?.inuse;e&&g(t=>[...t,e])});let D=y(()=>(0,k.defaultsDeep)({title:{text:r(`memory`)}},T)),A=y(()=>[{name:r(`memory`),data:h()}]);return[S(l,{get children(){return r(`overview`)}}),(()=>{var e=L(),a=e.firstChild,o=a.nextSibling,s=o.firstChild,c=s.nextSibling,l=c.nextSibling,u=o.nextSibling;return i(a,S(R,{get label(){return r(`upload`)},get children(){return[d(()=>t(_()?.up||0).toString()),`/s`]}}),null),i(a,S(R,{get label(){return r(`download`)},get children(){return[d(()=>t(_()?.down||0).toString()),`/s`]}}),null),i(a,S(R,{get label(){return r(`uploadTotal`)},get children(){return t(n()?.uploadTotal||0).toString()}}),null),i(a,S(R,{get label(){return r(`downloadTotal`)},get children(){return t(n()?.downloadTotal||0).toString()}}),null),i(a,S(R,{get label(){return r(`activeConnections`)},get children(){return n()?.connections?.length||0}}),null),i(a,S(R,{get label(){return r(`memoryUsage`)},get children(){return t(E()?.inuse||0).toString()}}),null),i(s,S(F,{type:`line`,get options(){return b()},get series(){return x()}})),i(c,S(F,{type:`pie`,get options(){return C()},get series(){return w()}})),i(l,S(F,{type:`line`,get options(){return D()},get series(){return A()}})),i(u,()=>v()?.url),e})()]};export{z as default};