import{ref as l,onBeforeUnmount as $,createElementBlock as w,createCommentVNode as k,unref as s,openBlock as M,normalizeStyle as v,createElementVNode as z,toDisplayString as b}from"/vue.js";import{z as A,J as C}from"./nc-main.DEgIQeOo.js";import"./service-worker.DGZzV4eE.js";const D={class:"memory"},I=["viewBox"],N=["points"],T=Object.assign({name:"NcMemoryStats"},{__name:"nc-memory-stats",setup(V){const f=l(""),h=l(""),c=l(40),n=[],y=l(null);let u=!0;const{style:B}=C(y,{initialValue:{x:window.innerWidth-82-16,y:window.innerHeight-62-100}}),t=window.performance||{};if(!t&&!t.memory&&(t.memory={usedJSHeapSize:0}),t&&!t.memory&&(t.memory={usedJSHeapSize:0}),t.memory.usedJSHeapSize===0&&(console.log("usedJSHeapSize === 0... performance.memory is only available in Chrome -based browsers."),u=!1),u){let H=function(){const e=a;r=Math.min(r,e),d=Math.max(d,e),n.shift(),n.push(e),h.value=n.map(o=>o?(o-r)/(d-r):null).reduce((o,i,m)=>i?`${o}${m},${(1-i)*c.value} `:"","")},g=function(e,o){const i=["Bytes","KB","MB","GB","TB"];if(e===0)return"n/a";o=o!==void 0?o:0;const m=Math.pow(10,o),_=Math.floor(Math.log(e)/Math.log(1024));return`${Math.round(e*m/Math.pow(1024,_))/m} ${i[_]}`},x=function(){if(Date.now()-p<1e3/30)return;p=Date.now(),a=t.memory.usedJSHeapSize;const e=t.memory.usedJSHeapSize;f.value=g(e,2),n.length<60&&n.push(e)},p=Date.now(),a=t.memory.usedJSHeapSize,r=a,d=a,S=!0;requestAnimationFrame(function e(){x(),S&&requestAnimationFrame(e)});const J=setInterval(H,1e3);$(()=>{S=!1,clearInterval(J)})}return(p,a)=>s(u)?(M(),w("div",{key:0,ref_key:"el",ref:y,class:"stats",style:v(s(B))},[z("div",D,"Mem: "+b(s(f)),1),(M(),w("svg",{viewBox:"0 0 60 "+s(c),class:"chart",style:v("height: "+s(c)+"px;")},[z("polyline",{points:s(h)},null,8,N)],12,I))],4)):k("",!0)}}),j=A(T,[["__scopeId","data-v-d813d34a"]]);export{j as default};
