function Q(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function A(t,i){if((o=(t=i?t.toExponential(i-1):t.toExponential()).indexOf("e"))<0)return null;var o,n=t.slice(0,o);return[n.length>1?n[0]+n.slice(2):n,+t.slice(o+1)]}function T(t){return t=A(Math.abs(t)),t?t[1]:NaN}function R(t,i){return function(o,n){for(var a=o.length,c=[],m=0,f=t[0],y=0;a>0&&f>0&&(y+f+1>n&&(f=Math.max(1,n-y)),c.push(o.substring(a-=f,a+f)),!((y+=f+1)>n));)f=t[m=(m+1)%t.length];return c.reverse().join(i)}}function V(t){return function(i){return i.replace(/[0-9]/g,function(o){return t[+o]})}}var W=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function N(t){if(!(i=W.exec(t)))throw Error("invalid format: "+t);var i;return new $({fill:i[1],align:i[2],sign:i[3],symbol:i[4],zero:i[5],width:i[6],comma:i[7],precision:i[8]&&i[8].slice(1),trim:i[9],type:i[10]})}N.prototype=$.prototype;function $(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}$.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function tt(t){t:for(var i=t.length,o=1,n=-1,a;o<i;++o)switch(t[o]){case".":n=a=o;break;case"0":n===0&&(n=o),a=o;break;default:if(!+t[o])break t;n>0&&(n=0);break}return n>0?t.slice(0,n)+t.slice(a+1):t}var X;function it(t,i){var o=A(t,i);if(!o)return t+"";var n=o[0],a=o[1],c=a-(X=Math.max(-8,Math.min(8,Math.floor(a/3)))*3)+1,m=n.length;return c===m?n:c>m?n+Array(c-m+1).join("0"):c>0?n.slice(0,c)+"."+n.slice(c):"0."+Array(1-c).join("0")+A(t,Math.max(0,i+c-1))[0]}function _(t,i){var o=A(t,i);if(!o)return t+"";var n=o[0],a=o[1];return a<0?"0."+Array(-a).join("0")+n:n.length>a+1?n.slice(0,a+1)+"."+n.slice(a+1):n+Array(a-n.length+2).join("0")}var D={"%":(t,i)=>(t*100).toFixed(i),b:t=>Math.round(t).toString(2),c:t=>t+"",d:Q,e:(t,i)=>t.toExponential(i),f:(t,i)=>t.toFixed(i),g:(t,i)=>t.toPrecision(i),o:t=>Math.round(t).toString(8),p:(t,i)=>_(t*100,i),r:_,s:it,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function G(t){return t}var U=Array.prototype.map,Y=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function Z(t){var i=t.grouping===void 0||t.thousands===void 0?G:R(U.call(t.grouping,Number),t.thousands+""),o=t.currency===void 0?"":t.currency[0]+"",n=t.currency===void 0?"":t.currency[1]+"",a=t.decimal===void 0?".":t.decimal+"",c=t.numerals===void 0?G:V(U.call(t.numerals,String)),m=t.percent===void 0?"%":t.percent+"",f=t.minus===void 0?"\u2212":t.minus+"",y=t.nan===void 0?"NaN":t.nan+"";function C(s){s=N(s);var b=s.fill,M=s.align,u=s.sign,x=s.symbol,p=s.zero,w=s.width,E=s.comma,g=s.precision,P=s.trim,l=s.type;l==="n"?(E=!0,l="g"):D[l]||(g===void 0&&(g=12),P=!0,l="g"),(p||b==="0"&&M==="=")&&(p=!0,b="0",M="=");var I=x==="$"?o:x==="#"&&/[boxX]/.test(l)?"0"+l.toLowerCase():"",J=x==="$"?n:/[%p]/.test(l)?m:"",O=D[l],K=/[defgprs%]/.test(l);g=g===void 0?6:/[gprs]/.test(l)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g));function F(r){var v=I,h=J,e,L,k;if(l==="c")h=O(r)+h,r="";else{r=+r;var S=r<0||1/r<0;if(r=isNaN(r)?y:O(Math.abs(r),g),P&&(r=tt(r)),S&&+r==0&&u!=="+"&&(S=!1),v=(S?u==="("?u:f:u==="-"||u==="("?"":u)+v,h=(l==="s"?Y[8+X/3]:"")+h+(S&&u==="("?")":""),K){for(e=-1,L=r.length;++e<L;)if(k=r.charCodeAt(e),48>k||k>57){h=(k===46?a+r.slice(e+1):r.slice(e))+h,r=r.slice(0,e);break}}}E&&!p&&(r=i(r,1/0));var z=v.length+r.length+h.length,d=z<w?Array(w-z+1).join(b):"";switch(E&&p&&(r=i(d+r,d.length?w-h.length:1/0),d=""),M){case"<":r=v+r+h+d;break;case"=":r=v+d+r+h;break;case"^":r=d.slice(0,z=d.length>>1)+v+r+h+d.slice(z);break;default:r=d+v+r+h;break}return c(r)}return F.toString=function(){return s+""},F}function H(s,b){var M=C((s=N(s),s.type="f",s)),u=Math.max(-8,Math.min(8,Math.floor(T(b)/3)))*3,x=10**-u,p=Y[8+u/3];return function(w){return M(x*w)+p}}return{format:C,formatPrefix:H}}var j,q,B;rt({thousands:",",grouping:[3],currency:["$",""]});function rt(t){return j=Z(t),q=j.format,B=j.formatPrefix,j}export{T as a,N as i,B as n,Z as r,q as t};
