var r,t=1e9,e=!0,n="[DecimalError] ",i=n+"Invalid argument: ",o=n+"Exponent out of range: ",s=Math.floor,u=Math.pow,f=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,c=1e7,h=s(1286742750677284.5),l={};function a(r,t){var n,i,o,s,u,f,h,l,a=r.constructor,d=a.precision;if(!r.s||!t.s)return t.s||(t=new a(r)),e?O(t,d):t;if(h=r.d,l=t.d,u=r.e,o=t.e,h=h.slice(),s=u-o){for(s<0?(i=h,s=-s,f=l.length):(i=l,o=u,f=h.length),s>(f=(u=Math.ceil(d/7))>f?u+1:f+1)&&(s=f,i.length=1),i.reverse();s--;)i.push(0);i.reverse()}for((f=h.length)-(s=l.length)<0&&(s=f,i=l,l=h,h=i),n=0;s;)n=(h[--s]=h[s]+l[s]+n)/c|0,h[s]%=c;for(n&&(h.unshift(n),++o),f=h.length;0==h[--f];)h.pop();return t.d=h,t.e=o,e?O(t,d):t}function d(r,t,e){if(r!==~~r||r<t||r>e)throw Error(i+r)}function g(r){var t,e,n,i=r.length-1,o="",s=r[0];if(i>0){for(o+=s,t=1;t<i;t++)(e=7-(n=r[t]+"").length)&&(o+=E(e)),o+=n;(e=7-(n=(s=r[t])+"").length)&&(o+=E(e))}else if(0===s)return"0";for(;s%10==0;)s/=10;return o+s}l.absoluteValue=l.abs=function(){var r=new this.constructor(this);return r.s&&(r.s=1),r},l.comparedTo=l.cmp=function(r){var t,e,n,i,o=this;if(r=new o.constructor(r),o.s!==r.s)return o.s||-r.s;if(o.e!==r.e)return o.e>r.e^o.s<0?1:-1;for(t=0,e=(n=o.d.length)<(i=r.d.length)?n:i;t<e;++t)if(o.d[t]!==r.d[t])return o.d[t]>r.d[t]^o.s<0?1:-1;return n===i?0:n>i^o.s<0?1:-1},l.decimalPlaces=l.dp=function(){var r=this,t=r.d.length-1,e=7*(t-r.e);if(t=r.d[t])for(;t%10==0;t/=10)e--;return e<0?0:e},l.dividedBy=l.div=function(r){return p(this,new this.constructor(r))},l.dividedToIntegerBy=l.idiv=function(r){var t=this.constructor;return O(p(this,new t(r),0,1),t.precision)},l.equals=l.eq=function(r){return!this.cmp(r)},l.exponent=function(){return w(this)},l.greaterThan=l.gt=function(r){return this.cmp(r)>0},l.greaterThanOrEqualTo=l.gte=function(r){return this.cmp(r)>=0},l.isInteger=l.isint=function(){return this.e>this.d.length-2},l.isNegative=l.isneg=function(){return this.s<0},l.isPositive=l.ispos=function(){return this.s>0},l.isZero=function(){return 0===this.s},l.lessThan=l.lt=function(r){return this.cmp(r)<0},l.lessThanOrEqualTo=l.lte=function(r){return this.cmp(r)<1},l.logarithm=l.log=function(t){var i,o=this,s=o.constructor,u=s.precision,f=u+5;if(void 0===t)t=new s(10);else if((t=new s(t)).s<1||t.eq(r))throw Error(n+"NaN");if(o.s<1)throw Error(n+(o.s?"NaN":"-Infinity"));return o.eq(r)?new s(0):(e=!1,i=p(N(o,f),N(t,f),f),e=!0,O(i,u))},l.minus=l.sub=function(r){var t=this;return r=new t.constructor(r),t.s==r.s?b(t,r):a(t,(r.s=-r.s,r))},l.modulo=l.mod=function(r){var t,i=this,o=i.constructor,s=o.precision;if(!(r=new o(r)).s)throw Error(n+"NaN");return i.s?(e=!1,t=p(i,r,0,1).times(r),e=!0,i.minus(t)):O(new o(i),s)},l.naturalExponential=l.exp=function(){return v(this)},l.naturalLogarithm=l.ln=function(){return N(this)},l.negated=l.neg=function(){var r=new this.constructor(this);return r.s=-r.s||0,r},l.plus=l.add=function(r){var t=this;return r=new t.constructor(r),t.s==r.s?a(t,r):b(t,(r.s=-r.s,r))},l.precision=l.sd=function(r){var t,e,n,o=this;if(void 0!==r&&r!==!!r&&1!==r&&0!==r)throw Error(i+r);if(t=w(o)+1,e=7*(n=o.d.length-1)+1,n=o.d[n]){for(;n%10==0;n/=10)e--;for(n=o.d[0];n>=10;n/=10)e++}return r&&t>e?t:e},l.squareRoot=l.sqrt=function(){var r,t,i,o,u,f,c,h=this,l=h.constructor;if(h.s<1){if(!h.s)return new l(0);throw Error(n+"NaN")}for(r=w(h),e=!1,0==(u=Math.sqrt(+h))||u==1/0?(((t=g(h.d)).length+r)%2==0&&(t+="0"),u=Math.sqrt(t),r=s((r+1)/2)-(r<0||r%2),o=new l(t=u==1/0?"5e"+r:(t=u.toExponential()).slice(0,t.indexOf("e")+1)+r)):o=new l(u.toString()),u=c=(i=l.precision)+3;;)if(o=(f=o).plus(p(h,f,c+2)).times(.5),g(f.d).slice(0,c)===(t=g(o.d)).slice(0,c)){if(t=t.slice(c-3,c+1),u==c&&"4999"==t){if(O(f,i+1,0),f.times(f).eq(h)){o=f;break}}else if("9999"!=t)break;c+=4}return e=!0,O(o,i)},l.times=l.mul=function(r){var t,n,i,o,s,u,f,h,l,a=this,d=a.constructor,g=a.d,p=(r=new d(r)).d;if(!a.s||!r.s)return new d(0);for(r.s*=a.s,n=a.e+r.e,(h=g.length)<(l=p.length)&&(s=g,g=p,p=s,u=h,h=l,l=u),s=[],i=u=h+l;i--;)s.push(0);for(i=l;--i>=0;){for(t=0,o=h+i;o>i;)f=s[o]+p[i]*g[o-i-1]+t,s[o--]=f%c|0,t=f/c|0;s[o]=(s[o]+t)%c|0}for(;!s[--u];)s.pop();return t?++n:s.shift(),r.d=s,r.e=n,e?O(r,d.precision):r},l.toDecimalPlaces=l.todp=function(r,e){var n=this,i=n.constructor;return n=new i(n),void 0===r?n:(d(r,0,t),void 0===e?e=i.rounding:d(e,0,8),O(n,r+w(n)+1,e))},l.toExponential=function(r,e){var n,i=this,o=i.constructor;return void 0===r?n=L(i,!0):(d(r,0,t),void 0===e?e=o.rounding:d(e,0,8),n=L(i=O(new o(i),r+1,e),!0,r+1)),n},l.toFixed=function(r,e){var n,i,o=this,s=o.constructor;return void 0===r?L(o):(d(r,0,t),void 0===e?e=s.rounding:d(e,0,8),n=L((i=O(new s(o),r+w(o)+1,e)).abs(),!1,r+w(i)+1),o.isneg()&&!o.isZero()?"-"+n:n)},l.toInteger=l.toint=function(){var r=this,t=r.constructor;return O(new t(r),w(r)+1,t.rounding)},l.toNumber=function(){return+this},l.toPower=l.pow=function(t){var i,o,u,f,c,h,l=this,a=l.constructor,d=+(t=new a(t));if(!t.s)return new a(r);if(!(l=new a(l)).s){if(t.s<1)throw Error(n+"Infinity");return l}if(l.eq(r))return l;if(u=a.precision,t.eq(r))return O(l,u);if(h=(i=t.e)>=(o=t.d.length-1),c=l.s,h){if((o=d<0?-d:d)<=9007199254740991){for(f=new a(r),i=Math.ceil(u/7+4),e=!1;o%2&&D((f=f.times(l)).d,i),0!==(o=s(o/2));)D((l=l.times(l)).d,i);return e=!0,t.s<0?new a(r).div(f):O(f,u)}}else if(c<0)throw Error(n+"NaN");return c=c<0&&1&t.d[Math.max(i,o)]?-1:1,l.s=1,e=!1,f=t.times(N(l,u+12)),e=!0,(f=v(f)).s=c,f},l.toPrecision=function(r,e){var n,i,o=this,s=o.constructor;return void 0===r?i=L(o,(n=w(o))<=s.toExpNeg||n>=s.toExpPos):(d(r,1,t),void 0===e?e=s.rounding:d(e,0,8),i=L(o=O(new s(o),r,e),r<=(n=w(o))||n<=s.toExpNeg,r)),i},l.toSignificantDigits=l.tosd=function(r,e){var n=this.constructor;return void 0===r?(r=n.precision,e=n.rounding):(d(r,1,t),void 0===e?e=n.rounding:d(e,0,8)),O(new n(this),r,e)},l.toString=l.valueOf=l.val=l.toJSON=l[Symbol.for("nodejs.util.inspect.custom")]=function(){var r=this,t=w(r),e=r.constructor;return L(r,t<=e.toExpNeg||t>=e.toExpPos)};var p=function(){function r(r,t){var e,n=0,i=r.length;for(r=r.slice();i--;)e=r[i]*t+n,r[i]=e%c|0,n=e/c|0;return n&&r.unshift(n),r}function t(r,t,e,n){var i,o;if(e!=n)o=e>n?1:-1;else for(i=o=0;i<e;i++)if(r[i]!=t[i]){o=r[i]>t[i]?1:-1;break}return o}function e(r,t,e){for(var n=0;e--;)r[e]-=n,n=r[e]<t[e]?1:0,r[e]=n*c+r[e]-t[e];for(;!r[0]&&r.length>1;)r.shift()}return function(i,o,s,u){var f,h,l,a,d,g,p,v,m,E,N,x,b,L,D,q,M,_,A=i.constructor,P=i.s==o.s?1:-1,y=i.d,R=o.d;if(!i.s)return new A(i);if(!o.s)throw Error(n+"Division by zero");for(h=i.e-o.e,M=R.length,D=y.length,v=(p=new A(P)).d=[],l=0;R[l]==(y[l]||0);)++l;if(R[l]>(y[l]||0)&&--h,(x=null==s?s=A.precision:u?s+(w(i)-w(o))+1:s)<0)return new A(0);if(x=x/7+2|0,l=0,1==M)for(a=0,R=R[0],x++;(l<D||a)&&x--;l++)b=a*c+(y[l]||0),v[l]=b/R|0,a=b%R|0;else{for((a=c/(R[0]+1)|0)>1&&(R=r(R,a),y=r(y,a),M=R.length,D=y.length),L=M,E=(m=y.slice(0,M)).length;E<M;)m[E++]=0;(_=R.slice()).unshift(0),q=R[0],R[1]>=c/2&&++q;do{a=0,(f=t(R,m,M,E))<0?(N=m[0],M!=E&&(N=N*c+(m[1]||0)),(a=N/q|0)>1?(a>=c&&(a=c-1),1==(f=t(d=r(R,a),m,g=d.length,E=m.length))&&(a--,e(d,M<g?_:R,g))):(0==a&&(f=a=1),d=R.slice()),(g=d.length)<E&&d.unshift(0),e(m,d,E),-1==f&&(f=t(R,m,M,E=m.length))<1&&(a++,e(m,M<E?_:R,E)),E=m.length):0===f&&(a++,m=[0]),v[l++]=a,f&&m[0]?m[E++]=y[L]||0:(m=[y[L]],E=1)}while((L++<D||void 0!==m[0])&&x--)}return v[0]||v.shift(),p.e=h,O(p,u?s+w(p)+1:s)}}();function v(t,n){var i,s,f,c,h,l=0,a=0,d=t.constructor,v=d.precision;if(w(t)>16)throw Error(o+w(t));if(!t.s)return new d(r);for(null==n?(e=!1,h=v):h=n,c=new d(.03125);t.abs().gte(.1);)t=t.times(c),a+=5;for(h+=Math.log(u(2,a))/Math.LN10*2+5|0,i=s=f=new d(r),d.precision=h;;){if(s=O(s.times(t),h),i=i.times(++l),g((c=f.plus(p(s,i,h))).d).slice(0,h)===g(f.d).slice(0,h)){for(;a--;)f=O(f.times(f),h);return d.precision=v,null==n?(e=!0,O(f,v)):f}f=c}}function w(r){for(var t=7*r.e,e=r.d[0];e>=10;e/=10)t++;return t}function m(r,t,i){if(t>r.LN10.sd())throw e=!0,i&&(r.precision=i),Error(n+"LN10 precision limit exceeded");return O(new r(r.LN10),t)}function E(r){for(var t="";r--;)t+="0";return t}function N(t,i){var o,s,u,f,c,h,l,a,d,v=1,E=t,x=E.d,b=E.constructor,L=b.precision;if(E.s<1)throw Error(n+(E.s?"NaN":"-Infinity"));if(E.eq(r))return new b(0);if(null==i?(e=!1,a=L):a=i,E.eq(10))return null==i&&(e=!0),m(b,a);if(a+=10,b.precision=a,s=(o=g(x)).charAt(0),f=w(E),!(Math.abs(f)<15e14))return l=m(b,a+2,L).times(f+""),E=N(new b(s+"."+o.slice(1)),a-10).plus(l),b.precision=L,null==i?(e=!0,O(E,L)):E;for(;s<7&&1!=s||1==s&&o.charAt(1)>3;)s=(o=g((E=E.times(t)).d)).charAt(0),v++;for(f=w(E),s>1?(E=new b("0."+o),f++):E=new b(s+"."+o.slice(1)),h=c=E=p(E.minus(r),E.plus(r),a),d=O(E.times(E),a),u=3;;){if(c=O(c.times(d),a),g((l=h.plus(p(c,new b(u),a))).d).slice(0,a)===g(h.d).slice(0,a))return h=h.times(2),0!==f&&(h=h.plus(m(b,a+2,L).times(f+""))),h=p(h,new b(v),a),b.precision=L,null==i?(e=!0,O(h,L)):h;h=l,u+=2}}function x(r,t){var n,i,u;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(i=t.search(/e/i))>0?(n<0&&(n=i),n+=+t.slice(i+1),t=t.substring(0,i)):n<0&&(n=t.length),i=0;48===t.charCodeAt(i);)++i;for(u=t.length;48===t.charCodeAt(u-1);)--u;if(t=t.slice(i,u)){if(u-=i,n=n-i-1,r.e=s(n/7),r.d=[],i=(n+1)%7,n<0&&(i+=7),i<u){for(i&&r.d.push(+t.slice(0,i)),u-=7;i<u;)r.d.push(+t.slice(i,i+=7));i=7-(t=t.slice(i)).length}else i-=u;for(;i--;)t+="0";if(r.d.push(+t),e&&(r.e>h||r.e<-h))throw Error(o+n)}else r.s=0,r.e=0,r.d=[0];return r}function O(r,t,n){var i,f,l,a,d,g,p,v,m=r.d;for(a=1,l=m[0];l>=10;l/=10)a++;if((i=t-a)<0)i+=7,f=t,p=m[v=0];else{if((v=Math.ceil((i+1)/7))>=(l=m.length))return r;for(p=l=m[v],a=1;l>=10;l/=10)a++;f=(i%=7)-7+a}if(void 0!==n&&(d=p/(l=u(10,a-f-1))%10|0,g=t<0||void 0!==m[v+1]||p%l,g=n<4?(d||g)&&(0==n||n==(r.s<0?3:2)):d>5||5==d&&(4==n||g||6==n&&(i>0?f>0?p/u(10,a-f):0:m[v-1])%10&1||n==(r.s<0?8:7))),t<1||!m[0])return g?(l=w(r),m.length=1,t=t-l-1,m[0]=u(10,(7-t%7)%7),r.e=s(-t/7)||0):(m.length=1,m[0]=r.e=r.s=0),r;if(0==i?(m.length=v,l=1,v--):(m.length=v+1,l=u(10,7-i),m[v]=f>0?(p/u(10,a-f)%u(10,f)|0)*l:0),g)for(;;){if(0==v){(m[0]+=l)==c&&(m[0]=1,++r.e);break}if(m[v]+=l,m[v]!=c)break;m[v--]=0,l=1}for(i=m.length;0===m[--i];)m.pop();if(e&&(r.e>h||r.e<-h))throw Error(o+w(r));return r}function b(r,t){var n,i,o,s,u,f,h,l,a,d,g=r.constructor,p=g.precision;if(!r.s||!t.s)return t.s?t.s=-t.s:t=new g(r),e?O(t,p):t;if(h=r.d,d=t.d,i=t.e,l=r.e,h=h.slice(),u=l-i){for((a=u<0)?(n=h,u=-u,f=d.length):(n=d,i=l,f=h.length),u>(o=Math.max(Math.ceil(p/7),f)+2)&&(u=o,n.length=1),n.reverse(),o=u;o--;)n.push(0);n.reverse()}else{for((a=(o=h.length)<(f=d.length))&&(f=o),o=0;o<f;o++)if(h[o]!=d[o]){a=h[o]<d[o];break}u=0}for(a&&(n=h,h=d,d=n,t.s=-t.s),f=h.length,o=d.length-f;o>0;--o)h[f++]=0;for(o=d.length;o>u;){if(h[--o]<d[o]){for(s=o;s&&0===h[--s];)h[s]=c-1;--h[s],h[o]+=c}h[o]-=d[o]}for(;0===h[--f];)h.pop();for(;0===h[0];h.shift())--i;return h[0]?(t.d=h,t.e=i,e?O(t,p):t):new g(0)}function L(r,t,e){var n,i=w(r),o=g(r.d),s=o.length;return t?(e&&(n=e-s)>0?o=o.charAt(0)+"."+o.slice(1)+E(n):s>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(i<0?"e":"e+")+i):i<0?(o="0."+E(-i-1)+o,e&&(n=e-s)>0&&(o+=E(n))):i>=s?(o+=E(i+1-s),e&&(n=e-i-1)>0&&(o=o+"."+E(n))):((n=i+1)<s&&(o=o.slice(0,n)+"."+o.slice(n)),e&&(n=e-s)>0&&(i+1===s&&(o+="."),o+=E(n))),r.s<0?"-"+o:o}function D(r,t){if(r.length>t)return r.length=t,!0}function q(r){if(!r||"object"!=typeof r)throw Error(n+"Object expected");var e,o,u,f=["precision",1,t,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(e=0;e<f.length;e+=3)if(void 0!==(u=r[o=f[e]])){if(!(s(u)===u&&u>=f[e+1]&&u<=f[e+2]))throw Error(i+o+": "+u);this[o]=u}if(void 0!==(u=r[o="LN10"])){if(u!=Math.LN10)throw Error(i+o+": "+u);this[o]=new this(u)}return this}var M=function r(t){var e,n,o;function s(r){var t=this;if(!(t instanceof s))return new s(r);if(t.constructor=s,r instanceof s)return t.s=r.s,t.e=r.e,void(t.d=(r=r.d)?r.slice():r);if("number"==typeof r){if(0*r!=0)throw Error(i+r);if(r>0)t.s=1;else{if(!(r<0))return t.s=0,t.e=0,void(t.d=[0]);r=-r,t.s=-1}return r===~~r&&r<1e7?(t.e=0,void(t.d=[r])):x(t,r.toString())}if("string"!=typeof r)throw Error(i+r);if(45===r.charCodeAt(0)?(r=r.slice(1),t.s=-1):t.s=1,!f.test(r))throw Error(i+r);x(t,r)}if(s.prototype=l,s.ROUND_UP=0,s.ROUND_DOWN=1,s.ROUND_CEIL=2,s.ROUND_FLOOR=3,s.ROUND_HALF_UP=4,s.ROUND_HALF_DOWN=5,s.ROUND_HALF_EVEN=6,s.ROUND_HALF_CEIL=7,s.ROUND_HALF_FLOOR=8,s.clone=r,s.config=s.set=q,void 0===t&&(t={}),t)for(o=["precision","rounding","toExpNeg","toExpPos","LN10"],e=0;e<o.length;)t.hasOwnProperty(n=o[e++])||(t[n]=this[n]);return s.config(t),s}({precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"});r=new M(1);const _=M;export{_ as D};
