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