import t from"node:process";import{s as e}from"../../../_virtual/index17.mjs";const n=["#","Rule","Time (ms)","Relative"];function i(){const e=t.env.TIMING;if(void 0===e)return 0;if("all"===e.toLowerCase())return Number.POSITIVE_INFINITY;const n=Number.parseInt(e,10);return!Number.isNaN(n)&&n>=1?n:0}const r=i(),o=0!==r;function s(t){let e=0;const i=Object.keys(t).map(n=>{const i=t[n]??0;return e+=i,[n,i]});i.sort((t,e)=>e[1]-t[1]);i.slice(0,r).map((t,n)=>{const i=e>0?`${(100*t[1]/e).toFixed(1)}%`:"0.0%",r=t[1].toFixed(3);return[n+1,t[0],r,i]}).unshift(n)}const u=Object.create(null);o&&t.on("exit",()=>{s(u)});const c={display:s,enabled:o,getListSize:i,tableConfig:{columns:[{alignment:"right"},{alignment:"left"},{alignment:"right"},{alignment:"right"}]},time:function(e,n){return function(...i){const r=t.hrtime.bigint(),o=n(...i),s=function(e){const n=t.hrtime.bigint()-e;return Number(n)/1e6}(r);return u[e]=(u[e]??0)+s,o}}};export{c as default};