const s=["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],a=["B","Ki","Mi","Gi","Ti","Pi","Ei","Zi","Yi"];function f(i,n=!1){const t=Number.parseInt(i,10)||0;return l(t,n)}function l(i,n=!1){const t=Math.floor(Math.log(i)/Math.log(1024))||0;return t<0?"0 B":`${(i/1024**t).toFixed(1)} ${n?a[t]:s[t]}`}function B(i,n,t=!1){return u(i,n,t).toString(10)}function u(i,n,t=!1){const e=Number.parseFloat(i),r=(t?a:s).findIndex(c=>c===n);return r===-1?0:e*1024**r}function g(i=20){let n="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";const t=n.split("");for(let e=t.length-1;e>0;e--){const o=Math.floor(Math.random()*(e+1));[t[e],t[o]]=[t[o],t[e]]}return n=t.join(""),n.slice(0,i)}export{l as f,B as g,g as m,f as n};
