function e(e,t={}){if(!Number.isFinite(e))return`unknown`;let n=t.decimals??1,r=t.unit??`s`,i=(Math.max(0,e)/1e3).toFixed(Math.max(0,n)).replace(/\.0+$/,``).replace(/(\.\d*[1-9])0+$/,`$1`);return r===`seconds`?`${i} seconds`:`${i}s`}function t(t,n={}){return Number.isFinite(t)?t<1e3?`${t}ms`:e(t,{decimals:n.decimals??2,unit:n.unit??`s`}):`unknown`}function n(e,t){if(e==null||!Number.isFinite(e)||e<=0)return;if(e<1e3)return`${Math.round(e)}ms`;let n=t?.spaced?` `:``,r=Math.round(e/1e3),i=Math.floor(r/3600),a=Math.floor(r%3600/60),o=r%60;if(i>=24){let e=Math.floor(i/24),t=i%24;return t>0?`${e}d${n}${t}h`:`${e}d`}return i>0?a>0?`${i}h${n}${a}m`:`${i}h`:a>0?o>0?`${a}m${n}${o}s`:`${a}m`:`${o}s`}function r(e,t=`n/a`){if(e==null||!Number.isFinite(e)||e<0)return t;if(e<1e3)return`${Math.round(e)}ms`;let n=Math.round(e/1e3);if(n<60)return`${n}s`;let r=Math.round(n/60);if(r<60)return`${r}m`;let i=Math.round(r/60);return i<24?`${i}h`:`${Math.round(i/24)}d`}export{e as i,r as n,t as r,n as t};
