UNPKG

timered-counter

Version:

Make the value change more vivid and natural

11 lines (10 loc) 33.1 kB
var n,e;n=this,e=function(n){ /*! * decimal.js v10.4.3 * An arbitrary-precision Decimal type for JavaScript. * https://github.com/MikeMcl/decimal.js * Copyright (c) 2022 Michael Mclaughlin <M8ch88l@gmail.com> * MIT Licence */ var e,i,t=9e15,r=1e9,s="0123456789abcdef",o="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",u="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",c={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-9e15,maxE:t,crypto:!1},f=!0,a="[DecimalError] ",d=a+"Invalid argument: ",l=a+"Precision limit exceeded",h=a+"crypto unavailable",g="[object Decimal]",p=Math.floor,m=Math.pow,w=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,v=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,N=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,b=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,x=1e7,E=o.length-1,y=u.length-1,M={toStringTag:g};function q(n){var e,i,t,r=n.length-1,s="",o=n[0];if(r>0){for(s+=o,e=1;e<r;e++)(i=7-(t=n[e]+"").length)&&(s+=L(i)),s+=t;(i=7-(t=(o=n[e])+"").length)&&(s+=L(i))}else if(0===o)return"0";for(;o%10==0;)o/=10;return s+o}function O(n,e,i){if(n!==~~n||n<e||n>i)throw Error(d+n)}function F(n,e,i,t){var r,s,o,u;for(s=n[0];s>=10;s/=10)--e;return--e<0?(e+=7,r=0):(r=Math.ceil((e+1)/7),e%=7),s=m(10,7-e),u=n[r]%s|0,null==t?e<3?(0==e?u=u/100|0:1==e&&(u=u/10|0),o=i<4&&99999==u||i>3&&49999==u||5e4==u||0==u):o=(i<4&&u+1==s||i>3&&u+1==s/2)&&(n[r+1]/s/100|0)==m(10,e-2)-1||(u==s/2||0==u)&&!(n[r+1]/s/100|0):e<4?(0==e?u=u/1e3|0:1==e?u=u/100|0:2==e&&(u=u/10|0),o=(t||i<4)&&9999==u||!t&&i>3&&4999==u):o=((t||i<4)&&u+1==s||!t&&i>3&&u+1==s/2)&&(n[r+1]/s/1e3|0)==m(10,e-3)-1,o}function A(n,e,i){for(var t,r,o=[0],u=0,c=n.length;u<c;){for(r=o.length;r--;)o[r]*=e;for(o[0]+=s.indexOf(n.charAt(u++)),t=0;t<o.length;t++)o[t]>i-1&&(void 0===o[t+1]&&(o[t+1]=0),o[t+1]+=o[t]/i|0,o[t]%=i)}return o.reverse()}M.absoluteValue=M.abs=function(){var n=new this.constructor(this);return n.s<0&&(n.s=1),Z(n)},M.ceil=function(){return Z(new this.constructor(this),this.e+1,2)},M.clampedTo=M.clamp=function(n,e){var i=this,t=i.constructor;if(n=new t(n),e=new t(e),!n.s||!e.s)return new t(NaN);if(n.gt(e))throw Error(d+e);return i.cmp(n)<0?n:i.cmp(e)>0?e:new t(i)},M.comparedTo=M.cmp=function(n){var e,i,t,r,s=this,o=s.d,u=(n=new s.constructor(n)).d,c=s.s,f=n.s;if(!o||!u)return c&&f?c!==f?c:o===u?0:!o^c<0?1:-1:NaN;if(!o[0]||!u[0])return o[0]?c:u[0]?-f:0;if(c!==f)return c;if(s.e!==n.e)return s.e>n.e^c<0?1:-1;for(e=0,i=(t=o.length)<(r=u.length)?t:r;e<i;++e)if(o[e]!==u[e])return o[e]>u[e]^c<0?1:-1;return t===r?0:t>r^c<0?1:-1},M.cosine=M.cos=function(){var n,e,t=this,r=t.constructor;return t.d?t.d[0]?(n=r.precision,e=r.rounding,r.precision=n+Math.max(t.e,t.sd())+7,r.rounding=1,t=function(n,e){var i,t,r;if(e.isZero())return e;(t=e.d.length)<32?r=(1/J(4,i=Math.ceil(t/3))).toString():(i=16,r="2.3283064365386962890625e-10"),n.precision+=i,e=$(n,1,e.times(r),new n(1));for(var s=i;s--;){var o=e.times(e);e=o.times(o).minus(o).times(8).plus(1)}return n.precision-=i,e}(r,W(r,t)),r.precision=n,r.rounding=e,Z(2==i||3==i?t.neg():t,n,e,!0)):new r(1):new r(NaN)},M.cubeRoot=M.cbrt=function(){var n,e,i,t,r,s,o,u,c,a,d=this,l=d.constructor;if(!d.isFinite()||d.isZero())return new l(d);for(f=!1,(s=d.s*m(d.s*d,1/3))&&Math.abs(s)!=1/0?t=new l(s.toString()):(i=q(d.d),(s=((n=d.e)-i.length+1)%3)&&(i+=1==s||-2==s?"0":"00"),s=m(i,1/3),n=p((n+1)/3)-(n%3==(n<0?-1:2)),(t=new l(i=s==1/0?"5e"+n:(i=s.toExponential()).slice(0,i.indexOf("e")+1)+n)).s=d.s),o=(n=l.precision)+3;;)if(a=(c=(u=t).times(u).times(u)).plus(d),t=D(a.plus(d).times(u),a.plus(c),o+2,1),q(u.d).slice(0,o)===(i=q(t.d)).slice(0,o)){if("9999"!=(i=i.slice(o-3,o+1))&&(r||"4999"!=i)){+i&&(+i.slice(1)||"5"!=i.charAt(0))||(Z(t,n+1,1),e=!t.times(t).times(t).eq(d));break}if(!r&&(Z(u,n+1,0),u.times(u).times(u).eq(d))){t=u;break}o+=4,r=1}return f=!0,Z(t,n,l.rounding,e)},M.decimalPlaces=M.dp=function(){var n,e=this.d,i=NaN;if(e){if(i=7*((n=e.length-1)-p(this.e/7)),n=e[n])for(;n%10==0;n/=10)i--;i<0&&(i=0)}return i},M.dividedBy=M.div=function(n){return D(this,new this.constructor(n))},M.dividedToIntegerBy=M.divToInt=function(n){var e=this.constructor;return Z(D(this,new e(n),0,1,1),e.precision,e.rounding)},M.equals=M.eq=function(n){return 0===this.cmp(n)},M.floor=function(){return Z(new this.constructor(this),this.e+1,3)},M.greaterThan=M.gt=function(n){return this.cmp(n)>0},M.greaterThanOrEqualTo=M.gte=function(n){var e=this.cmp(n);return 1==e||0===e},M.hyperbolicCosine=M.cosh=function(){var n,e,i,t,r,s=this,o=s.constructor,u=new o(1);if(!s.isFinite())return new o(s.s?1/0:NaN);if(s.isZero())return u;i=o.precision,t=o.rounding,o.precision=i+Math.max(s.e,s.sd())+4,o.rounding=1,(r=s.d.length)<32?e=(1/J(4,n=Math.ceil(r/3))).toString():(n=16,e="2.3283064365386962890625e-10"),s=$(o,1,s.times(e),new o(1),!0);for(var c,f=n,a=new o(8);f--;)c=s.times(s),s=u.minus(c.times(a.minus(c.times(a))));return Z(s,o.precision=i,o.rounding=t,!0)},M.hyperbolicSine=M.sinh=function(){var n,e,i,t,r=this,s=r.constructor;if(!r.isFinite()||r.isZero())return new s(r);if(e=s.precision,i=s.rounding,s.precision=e+Math.max(r.e,r.sd())+4,s.rounding=1,(t=r.d.length)<3)r=$(s,2,r,r,!0);else{n=(n=1.4*Math.sqrt(t))>16?16:0|n,r=$(s,2,r=r.times(1/J(5,n)),r,!0);for(var o,u=new s(5),c=new s(16),f=new s(20);n--;)o=r.times(r),r=r.times(u.plus(o.times(c.times(o).plus(f))))}return s.precision=e,s.rounding=i,Z(r,e,i,!0)},M.hyperbolicTangent=M.tanh=function(){var n,e,i=this,t=i.constructor;return i.isFinite()?i.isZero()?new t(i):(n=t.precision,e=t.rounding,t.precision=n+7,t.rounding=1,D(i.sinh(),i.cosh(),t.precision=n,t.rounding=e)):new t(i.s)},M.inverseCosine=M.acos=function(){var n,e=this,i=e.constructor,t=e.abs().cmp(1),r=i.precision,s=i.rounding;return-1!==t?0===t?e.isNeg()?_(i,r,s):new i(0):new i(NaN):e.isZero()?_(i,r+4,s).times(.5):(i.precision=r+6,i.rounding=1,e=e.asin(),n=_(i,r+4,s).times(.5),i.precision=r,i.rounding=s,n.minus(e))},M.inverseHyperbolicCosine=M.acosh=function(){var n,e,i=this,t=i.constructor;return i.lte(1)?new t(i.eq(1)?0:NaN):i.isFinite()?(n=t.precision,e=t.rounding,t.precision=n+Math.max(Math.abs(i.e),i.sd())+4,t.rounding=1,f=!1,i=i.times(i).minus(1).sqrt().plus(i),f=!0,t.precision=n,t.rounding=e,i.ln()):new t(i)},M.inverseHyperbolicSine=M.asinh=function(){var n,e,i=this,t=i.constructor;return!i.isFinite()||i.isZero()?new t(i):(n=t.precision,e=t.rounding,t.precision=n+2*Math.max(Math.abs(i.e),i.sd())+6,t.rounding=1,f=!1,i=i.times(i).plus(1).sqrt().plus(i),f=!0,t.precision=n,t.rounding=e,i.ln())},M.inverseHyperbolicTangent=M.atanh=function(){var n,e,i,t,r=this,s=r.constructor;return r.isFinite()?r.e>=0?new s(r.abs().eq(1)?r.s/0:r.isZero()?r:NaN):(n=s.precision,e=s.rounding,t=r.sd(),Math.max(t,n)<2*-r.e-1?Z(new s(r),n,e,!0):(s.precision=i=t-r.e,r=D(r.plus(1),new s(1).minus(r),i+n,1),s.precision=n+4,s.rounding=1,r=r.ln(),s.precision=n,s.rounding=e,r.times(.5))):new s(NaN)},M.inverseSine=M.asin=function(){var n,e,i,t,r=this,s=r.constructor;return r.isZero()?new s(r):(e=r.abs().cmp(1),i=s.precision,t=s.rounding,-1!==e?0===e?((n=_(s,i+4,t).times(.5)).s=r.s,n):new s(NaN):(s.precision=i+6,s.rounding=1,r=r.div(new s(1).minus(r.times(r)).sqrt().plus(1)).atan(),s.precision=i,s.rounding=t,r.times(2)))},M.inverseTangent=M.atan=function(){var n,e,i,t,r,s,o,u,c,a=this,d=a.constructor,l=d.precision,h=d.rounding;if(a.isFinite()){if(a.isZero())return new d(a);if(a.abs().eq(1)&&l+4<=y)return(o=_(d,l+4,h).times(.25)).s=a.s,o}else{if(!a.s)return new d(NaN);if(l+4<=y)return(o=_(d,l+4,h).times(.5)).s=a.s,o}for(d.precision=u=l+10,d.rounding=1,n=i=Math.min(28,u/7+2|0);n;--n)a=a.div(a.times(a).plus(1).sqrt().plus(1));for(f=!1,e=Math.ceil(u/7),t=1,c=a.times(a),o=new d(a),r=a;-1!==n;)if(r=r.times(c),s=o.minus(r.div(t+=2)),r=r.times(c),void 0!==(o=s.plus(r.div(t+=2))).d[e])for(n=e;o.d[n]===s.d[n]&&n--;);return i&&(o=o.times(2<<i-1)),f=!0,Z(o,d.precision=l,d.rounding=h,!0)},M.isFinite=function(){return!!this.d},M.isInteger=M.isInt=function(){return!!this.d&&p(this.e/7)>this.d.length-2},M.isNaN=function(){return!this.s},M.isNegative=M.isNeg=function(){return this.s<0},M.isPositive=M.isPos=function(){return this.s>0},M.isZero=function(){return!!this.d&&0===this.d[0]},M.lessThan=M.lt=function(n){return this.cmp(n)<0},M.lessThanOrEqualTo=M.lte=function(n){return this.cmp(n)<1},M.logarithm=M.log=function(n){var e,i,t,r,s,o,u,c,a=this,d=a.constructor,l=d.precision,h=d.rounding;if(null==n)n=new d(10),e=!0;else{if(i=(n=new d(n)).d,n.s<0||!i||!i[0]||n.eq(1))return new d(NaN);e=n.eq(10)}if(i=a.d,a.s<0||!i||!i[0]||a.eq(1))return new d(i&&!i[0]?-1/0:1!=a.s?NaN:i?0:1/0);if(e)if(i.length>1)s=!0;else{for(r=i[0];r%10==0;)r/=10;s=1!==r}if(f=!1,o=H(a,u=l+5),t=e?S(d,u+10):H(n,u),F((c=D(o,t,u,1)).d,r=l,h))do{if(o=H(a,u+=10),t=e?S(d,u+10):H(n,u),c=D(o,t,u,1),!s){+q(c.d).slice(r+1,r+15)+1==1e14&&(c=Z(c,l+1,0));break}}while(F(c.d,r+=10,h));return f=!0,Z(c,l,h)},M.minus=M.sub=function(n){var e,i,t,r,s,o,u,c,a,d,l,h,g=this,m=g.constructor;if(n=new m(n),!g.d||!n.d)return g.s&&n.s?g.d?n.s=-n.s:n=new m(n.d||g.s!==n.s?g:NaN):n=new m(NaN),n;if(g.s!=n.s)return n.s=-n.s,g.plus(n);if(a=g.d,h=n.d,u=m.precision,c=m.rounding,!a[0]||!h[0]){if(h[0])n.s=-n.s;else{if(!a[0])return new m(3===c?-0:0);n=new m(g)}return f?Z(n,u,c):n}if(i=p(n.e/7),d=p(g.e/7),a=a.slice(),s=d-i){for((l=s<0)?(e=a,s=-s,o=h.length):(e=h,i=d,o=a.length),s>(t=Math.max(Math.ceil(u/7),o)+2)&&(s=t,e.length=1),e.reverse(),t=s;t--;)e.push(0);e.reverse()}else{for((l=(t=a.length)<(o=h.length))&&(o=t),t=0;t<o;t++)if(a[t]!=h[t]){l=a[t]<h[t];break}s=0}for(l&&(e=a,a=h,h=e,n.s=-n.s),o=a.length,t=h.length-o;t>0;--t)a[o++]=0;for(t=h.length;t>s;){if(a[--t]<h[t]){for(r=t;r&&0===a[--r];)a[r]=x-1;--a[r],a[t]+=x}a[t]-=h[t]}for(;0===a[--o];)a.pop();for(;0===a[0];a.shift())--i;return a[0]?(n.d=a,n.e=P(a,i),f?Z(n,u,c):n):new m(3===c?-0:0)},M.modulo=M.mod=function(n){var e,i=this,t=i.constructor;return n=new t(n),!i.d||!n.s||n.d&&!n.d[0]?new t(NaN):!n.d||i.d&&!i.d[0]?Z(new t(i),t.precision,t.rounding):(f=!1,9==t.modulo?(e=D(i,n.abs(),0,3,1)).s*=n.s:e=D(i,n,0,t.modulo,1),e=e.times(n),f=!0,i.minus(e))},M.naturalExponential=M.exp=function(){return I(this)},M.naturalLogarithm=M.ln=function(){return H(this)},M.negated=M.neg=function(){var n=new this.constructor(this);return n.s=-n.s,Z(n)},M.plus=M.add=function(n){var e,i,t,r,s,o,u,c,a,d,l=this,h=l.constructor;if(n=new h(n),!l.d||!n.d)return l.s&&n.s?l.d||(n=new h(n.d||l.s===n.s?l:NaN)):n=new h(NaN),n;if(l.s!=n.s)return n.s=-n.s,l.minus(n);if(a=l.d,d=n.d,u=h.precision,c=h.rounding,!a[0]||!d[0])return d[0]||(n=new h(l)),f?Z(n,u,c):n;if(s=p(l.e/7),t=p(n.e/7),a=a.slice(),r=s-t){for(r<0?(i=a,r=-r,o=d.length):(i=d,t=s,o=a.length),r>(o=(s=Math.ceil(u/7))>o?s+1:o+1)&&(r=o,i.length=1),i.reverse();r--;)i.push(0);i.reverse()}for((o=a.length)-(r=d.length)<0&&(r=o,i=d,d=a,a=i),e=0;r;)e=(a[--r]=a[r]+d[r]+e)/x|0,a[r]%=x;for(e&&(a.unshift(e),++t),o=a.length;0==a[--o];)a.pop();return n.d=a,n.e=P(a,t),f?Z(n,u,c):n},M.precision=M.sd=function(n){var e,i=this;if(void 0!==n&&n!==!!n&&1!==n&&0!==n)throw Error(d+n);return i.d?(e=R(i.d),n&&i.e+1>e&&(e=i.e+1)):e=NaN,e},M.round=function(){var n=this,e=n.constructor;return Z(new e(n),n.e+1,e.rounding)},M.sine=M.sin=function(){var n,e,t=this,r=t.constructor;return t.isFinite()?t.isZero()?new r(t):(n=r.precision,e=r.rounding,r.precision=n+Math.max(t.e,t.sd())+7,r.rounding=1,t=function(n,e){var i,t=e.d.length;if(t<3)return e.isZero()?e:$(n,2,e,e);i=(i=1.4*Math.sqrt(t))>16?16:0|i,e=e.times(1/J(5,i)),e=$(n,2,e,e);for(var r,s=new n(5),o=new n(16),u=new n(20);i--;)r=e.times(e),e=e.times(s.plus(r.times(o.times(r).minus(u))));return e}(r,W(r,t)),r.precision=n,r.rounding=e,Z(i>2?t.neg():t,n,e,!0)):new r(NaN)},M.squareRoot=M.sqrt=function(){var n,e,i,t,r,s,o=this,u=o.d,c=o.e,a=o.s,d=o.constructor;if(1!==a||!u||!u[0])return new d(!a||a<0&&(!u||u[0])?NaN:u?o:1/0);for(f=!1,0==(a=Math.sqrt(+o))||a==1/0?(((e=q(u)).length+c)%2==0&&(e+="0"),a=Math.sqrt(e),c=p((c+1)/2)-(c<0||c%2),t=new d(e=a==1/0?"5e"+c:(e=a.toExponential()).slice(0,e.indexOf("e")+1)+c)):t=new d(a.toString()),i=(c=d.precision)+3;;)if(t=(s=t).plus(D(o,s,i+2,1)).times(.5),q(s.d).slice(0,i)===(e=q(t.d)).slice(0,i)){if("9999"!=(e=e.slice(i-3,i+1))&&(r||"4999"!=e)){+e&&(+e.slice(1)||"5"!=e.charAt(0))||(Z(t,c+1,1),n=!t.times(t).eq(o));break}if(!r&&(Z(s,c+1,0),s.times(s).eq(o))){t=s;break}i+=4,r=1}return f=!0,Z(t,c,d.rounding,n)},M.tangent=M.tan=function(){var n,e,t=this,r=t.constructor;return t.isFinite()?t.isZero()?new r(t):(n=r.precision,e=r.rounding,r.precision=n+10,r.rounding=1,(t=t.sin()).s=1,t=D(t,new r(1).minus(t.times(t)).sqrt(),n+10,0),r.precision=n,r.rounding=e,Z(2==i||4==i?t.neg():t,n,e,!0)):new r(NaN)},M.times=M.mul=function(n){var e,i,t,r,s,o,u,c,a,d=this,l=d.constructor,h=d.d,g=(n=new l(n)).d;if(n.s*=d.s,!(h&&h[0]&&g&&g[0]))return new l(!n.s||h&&!h[0]&&!g||g&&!g[0]&&!h?NaN:h&&g?0*n.s:n.s/0);for(i=p(d.e/7)+p(n.e/7),(c=h.length)<(a=g.length)&&(s=h,h=g,g=s,o=c,c=a,a=o),s=[],t=o=c+a;t--;)s.push(0);for(t=a;--t>=0;){for(e=0,r=c+t;r>t;)u=s[r]+g[t]*h[r-t-1]+e,s[r--]=u%x|0,e=u/x|0;s[r]=(s[r]+e)%x|0}for(;!s[--o];)s.pop();return e?++i:s.shift(),n.d=s,n.e=P(s,i),f?Z(n,l.precision,l.rounding):n},M.toBinary=function(n,e){return z(this,2,n,e)},M.toDecimalPlaces=M.toDP=function(n,e){var i=this,t=i.constructor;return i=new t(i),void 0===n?i:(O(n,0,r),void 0===e?e=t.rounding:O(e,0,8),Z(i,n+i.e+1,e))},M.toExponential=function(n,e){var i,t=this,s=t.constructor;return void 0===n?i=T(t,!0):(O(n,0,r),void 0===e?e=s.rounding:O(e,0,8),i=T(t=Z(new s(t),n+1,e),!0,n+1)),t.isNeg()&&!t.isZero()?"-"+i:i},M.toFixed=function(n,e){var i,t,s=this,o=s.constructor;return void 0===n?i=T(s):(O(n,0,r),void 0===e?e=o.rounding:O(e,0,8),i=T(t=Z(new o(s),n+s.e+1,e),!1,n+t.e+1)),s.isNeg()&&!s.isZero()?"-"+i:i},M.toFraction=function(n){var e,i,t,r,s,o,u,c,a,l,h,g,p=this,w=p.d,v=p.constructor;if(!w)return new v(p);if(a=i=new v(1),t=c=new v(0),o=(s=(e=new v(t)).e=R(w)-p.e-1)%7,e.d[0]=m(10,o<0?7+o:o),null==n)n=s>0?e:a;else{if(!(u=new v(n)).isInt()||u.lt(a))throw Error(d+u);n=u.gt(e)?s>0?e:a:u}for(f=!1,u=new v(q(w)),l=v.precision,v.precision=s=7*w.length*2;h=D(u,e,0,1,1),1!=(r=i.plus(h.times(t))).cmp(n);)i=t,t=r,r=a,a=c.plus(h.times(r)),c=r,r=e,e=u.minus(h.times(r)),u=r;return r=D(n.minus(i),t,0,1,1),c=c.plus(r.times(a)),i=i.plus(r.times(t)),c.s=a.s=p.s,g=D(a,t,s,1).minus(p).abs().cmp(D(c,i,s,1).minus(p).abs())<1?[a,t]:[c,i],v.precision=l,f=!0,g},M.toHexadecimal=M.toHex=function(n,e){return z(this,16,n,e)},M.toNearest=function(n,e){var i=this,t=i.constructor;if(i=new t(i),null==n){if(!i.d)return i;n=new t(1),e=t.rounding}else{if(n=new t(n),void 0===e?e=t.rounding:O(e,0,8),!i.d)return n.s?i:n;if(!n.d)return n.s&&(n.s=i.s),n}return n.d[0]?(f=!1,i=D(i,n,0,e,1).times(n),f=!0,Z(i)):(n.s=i.s,i=n),i},M.toNumber=function(){return+this},M.toOctal=function(n,e){return z(this,8,n,e)},M.toPower=M.pow=function(n){var e,i,t,r,s,o,u=this,c=u.constructor,a=+(n=new c(n));if(!(u.d&&n.d&&u.d[0]&&n.d[0]))return new c(m(+u,a));if((u=new c(u)).eq(1))return u;if(t=c.precision,s=c.rounding,n.eq(1))return Z(u,t,s);if((e=p(n.e/7))>=n.d.length-1&&(i=a<0?-a:a)<=9007199254740991)return r=U(c,u,i,t),n.s<0?new c(1).div(r):Z(r,t,s);if((o=u.s)<0){if(e<n.d.length-1)return new c(NaN);if(1&n.d[e]||(o=1),0==u.e&&1==u.d[0]&&1==u.d.length)return u.s=o,u}return(e=0!=(i=m(+u,a))&&isFinite(i)?new c(i+"").e:p(a*(Math.log("0."+q(u.d))/Math.LN10+u.e+1)))>c.maxE+1||e<c.minE-1?new c(e>0?o/0:0):(f=!1,c.rounding=u.s=1,i=Math.min(12,(e+"").length),(r=I(n.times(H(u,t+i)),t)).d&&F((r=Z(r,t+5,1)).d,t,s)&&(e=t+10,+q((r=Z(I(n.times(H(u,e+i)),e),e+5,1)).d).slice(t+1,t+15)+1==1e14&&(r=Z(r,t+1,0))),r.s=o,f=!0,c.rounding=s,Z(r,t,s))},M.toPrecision=function(n,e){var i,t=this,s=t.constructor;return void 0===n?i=T(t,t.e<=s.toExpNeg||t.e>=s.toExpPos):(O(n,1,r),void 0===e?e=s.rounding:O(e,0,8),i=T(t=Z(new s(t),n,e),n<=t.e||t.e<=s.toExpNeg,n)),t.isNeg()&&!t.isZero()?"-"+i:i},M.toSignificantDigits=M.toSD=function(n,e){var i=this.constructor;return void 0===n?(n=i.precision,e=i.rounding):(O(n,1,r),void 0===e?e=i.rounding:O(e,0,8)),Z(new i(this),n,e)},M.toString=function(){var n=this,e=n.constructor,i=T(n,n.e<=e.toExpNeg||n.e>=e.toExpPos);return n.isNeg()&&!n.isZero()?"-"+i:i},M.truncated=M.trunc=function(){return Z(new this.constructor(this),this.e+1,1)},M.valueOf=M.toJSON=function(){var n=this,e=n.constructor,i=T(n,n.e<=e.toExpNeg||n.e>=e.toExpPos);return n.isNeg()?"-"+i:i};var D=function(){function n(n,e,i){var t,r=0,s=n.length;for(n=n.slice();s--;)t=n[s]*e+r,n[s]=t%i|0,r=t/i|0;return r&&n.unshift(r),n}function i(n,e,i,t){var r,s;if(i!=t)s=i>t?1:-1;else for(r=s=0;r<i;r++)if(n[r]!=e[r]){s=n[r]>e[r]?1:-1;break}return s}function t(n,e,i,t){for(var r=0;i--;)n[i]-=r,r=n[i]<e[i]?1:0,n[i]=r*t+n[i]-e[i];for(;!n[0]&&n.length>1;)n.shift()}return function(r,s,o,u,c,f){var a,d,l,h,g,m,w,v,N,b,E,y,M,q,O,F,A,D,T,P,S=r.constructor,_=r.s==s.s?1:-1,R=r.d,L=s.d;if(!(R&&R[0]&&L&&L[0]))return new S(r.s&&s.s&&(R?!L||R[0]!=L[0]:L)?R&&0==R[0]||!L?0*_:_/0:NaN);for(f?(g=1,d=r.e-s.e):(f=x,g=7,d=p(r.e/g)-p(s.e/g)),T=L.length,A=R.length,b=(N=new S(_)).d=[],l=0;L[l]==(R[l]||0);l++);if(L[l]>(R[l]||0)&&d--,null==o?(q=o=S.precision,u=S.rounding):q=c?o+(r.e-s.e)+1:o,q<0)b.push(1),m=!0;else{if(q=q/g+2|0,l=0,1==T){for(h=0,L=L[0],q++;(l<A||h)&&q--;l++)O=h*f+(R[l]||0),b[l]=O/L|0,h=O%L|0;m=h||l<A}else{for((h=f/(L[0]+1)|0)>1&&(L=n(L,h,f),R=n(R,h,f),T=L.length,A=R.length),F=T,y=(E=R.slice(0,T)).length;y<T;)E[y++]=0;(P=L.slice()).unshift(0),D=L[0],L[1]>=f/2&&++D;do{h=0,(a=i(L,E,T,y))<0?(M=E[0],T!=y&&(M=M*f+(E[1]||0)),(h=M/D|0)>1?(h>=f&&(h=f-1),1==(a=i(w=n(L,h,f),E,v=w.length,y=E.length))&&(h--,t(w,T<v?P:L,v,f))):(0==h&&(a=h=1),w=L.slice()),(v=w.length)<y&&w.unshift(0),t(E,w,y,f),-1==a&&(a=i(L,E,T,y=E.length))<1&&(h++,t(E,T<y?P:L,y,f)),y=E.length):0===a&&(h++,E=[0]),b[l++]=h,a&&E[0]?E[y++]=R[F]||0:(E=[R[F]],y=1)}while((F++<A||void 0!==E[0])&&q--);m=void 0!==E[0]}b[0]||b.shift()}if(1==g)N.e=d,e=m;else{for(l=1,h=b[0];h>=10;h/=10)l++;N.e=l+d*g-1,Z(N,c?o+N.e+1:o,u,m)}return N}}();function Z(n,e,i,t){var r,s,o,u,c,a,d,l,h,g=n.constructor;n:if(null!=e){if(!(l=n.d))return n;for(r=1,u=l[0];u>=10;u/=10)r++;if((s=e-r)<0)s+=7,o=e,c=(d=l[h=0])/m(10,r-o-1)%10|0;else if((h=Math.ceil((s+1)/7))>=(u=l.length)){if(!t)break n;for(;u++<=h;)l.push(0);d=c=0,r=1,o=(s%=7)-7+1}else{for(d=u=l[h],r=1;u>=10;u/=10)r++;c=(o=(s%=7)-7+r)<0?0:d/m(10,r-o-1)%10|0}if(t=t||e<0||void 0!==l[h+1]||(o<0?d:d%m(10,r-o-1)),a=i<4?(c||t)&&(0==i||i==(n.s<0?3:2)):c>5||5==c&&(4==i||t||6==i&&(s>0?o>0?d/m(10,r-o):0:l[h-1])%10&1||i==(n.s<0?8:7)),e<1||!l[0])return l.length=0,a?(e-=n.e+1,l[0]=m(10,(7-e%7)%7),n.e=-e||0):l[0]=n.e=0,n;if(0==s?(l.length=h,u=1,h--):(l.length=h+1,u=m(10,7-s),l[h]=o>0?(d/m(10,r-o)%m(10,o)|0)*u:0),a)for(;;){if(0==h){for(s=1,o=l[0];o>=10;o/=10)s++;for(o=l[0]+=u,u=1;o>=10;o/=10)u++;s!=u&&(n.e++,l[0]==x&&(l[0]=1));break}if(l[h]+=u,l[h]!=x)break;l[h--]=0,u=1}for(s=l.length;0===l[--s];)l.pop()}return f&&(n.e>g.maxE?(n.d=null,n.e=NaN):n.e<g.minE&&(n.e=0,n.d=[0])),n}function T(n,e,i){if(!n.isFinite())return j(n);var t,r=n.e,s=q(n.d),o=s.length;return e?(i&&(t=i-o)>0?s=s.charAt(0)+"."+s.slice(1)+L(t):o>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(n.e<0?"e":"e+")+n.e):r<0?(s="0."+L(-r-1)+s,i&&(t=i-o)>0&&(s+=L(t))):r>=o?(s+=L(r+1-o),i&&(t=i-r-1)>0&&(s=s+"."+L(t))):((t=r+1)<o&&(s=s.slice(0,t)+"."+s.slice(t)),i&&(t=i-o)>0&&(r+1===o&&(s+="."),s+=L(t))),s}function P(n,e){var i=n[0];for(e*=7;i>=10;i/=10)e++;return e}function S(n,e,i){if(e>E)throw f=!0,i&&(n.precision=i),Error(l);return Z(new n(o),e,1,!0)}function _(n,e,i){if(e>y)throw Error(l);return Z(new n(u),e,i,!0)}function R(n){var e=n.length-1,i=7*e+1;if(e=n[e]){for(;e%10==0;e/=10)i--;for(e=n[0];e>=10;e/=10)i++}return i}function L(n){for(var e="";n--;)e+="0";return e}function U(n,e,i,t){var r,s=new n(1),o=Math.ceil(t/7+4);for(f=!1;;){if(i%2&&G((s=s.times(e)).d,o)&&(r=!0),0===(i=p(i/2))){i=s.d.length-1,r&&0===s.d[i]&&++s.d[i];break}G((e=e.times(e)).d,o)}return f=!0,s}function k(n){return 1&n.d[n.d.length-1]}function C(n,e,i){for(var t,r=new n(e[0]),s=0;++s<e.length;){if(!(t=new n(e[s])).s){r=t;break}r[i](t)&&(r=t)}return r}function I(n,e){var i,t,r,s,o,u,c,a=0,d=0,l=0,h=n.constructor,g=h.rounding,p=h.precision;if(!n.d||!n.d[0]||n.e>17)return new h(n.d?n.d[0]?n.s<0?0:1/0:1:n.s?n.s<0?0:n:NaN);for(null==e?(f=!1,c=p):c=e,u=new h(.03125);n.e>-2;)n=n.times(u),l+=5;for(c+=t=Math.log(m(2,l))/Math.LN10*2+5|0,i=s=o=new h(1),h.precision=c;;){if(s=Z(s.times(n),c,1),i=i.times(++d),q((u=o.plus(D(s,i,c,1))).d).slice(0,c)===q(o.d).slice(0,c)){for(r=l;r--;)o=Z(o.times(o),c,1);if(null!=e)return h.precision=p,o;if(!(a<3&&F(o.d,c-t,g,a)))return Z(o,h.precision=p,g,f=!0);h.precision=c+=10,i=s=u=new h(1),d=0,a++}o=u}}function H(n,e){var i,t,r,s,o,u,c,a,d,l,h,g=1,p=n,m=p.d,w=p.constructor,v=w.rounding,N=w.precision;if(p.s<0||!m||!m[0]||!p.e&&1==m[0]&&1==m.length)return new w(m&&!m[0]?-1/0:1!=p.s?NaN:m?0:p);if(null==e?(f=!1,d=N):d=e,w.precision=d+=10,t=(i=q(m)).charAt(0),!(Math.abs(s=p.e)<15e14))return a=S(w,d+2,N).times(s+""),p=H(new w(t+"."+i.slice(1)),d-10).plus(a),w.precision=N,null==e?Z(p,N,v,f=!0):p;for(;t<7&&1!=t||1==t&&i.charAt(1)>3;)t=(i=q((p=p.times(n)).d)).charAt(0),g++;for(s=p.e,t>1?(p=new w("0."+i),s++):p=new w(t+"."+i.slice(1)),l=p,c=o=p=D(p.minus(1),p.plus(1),d,1),h=Z(p.times(p),d,1),r=3;;){if(o=Z(o.times(h),d,1),q((a=c.plus(D(o,new w(r),d,1))).d).slice(0,d)===q(c.d).slice(0,d)){if(c=c.times(2),0!==s&&(c=c.plus(S(w,d+2,N).times(s+""))),c=D(c,new w(g),d,1),null!=e)return w.precision=N,c;if(!F(c.d,d-10,v,u))return Z(c,w.precision=N,v,f=!0);w.precision=d+=10,a=o=p=D(l.minus(1),l.plus(1),d,1),h=Z(p.times(p),d,1),r=u=1}c=a,r+=2}}function j(n){return String(n.s*n.s/0)}function B(n,e){var i,t,r;for((i=e.indexOf("."))>-1&&(e=e.replace(".","")),(t=e.search(/e/i))>0?(i<0&&(i=t),i+=+e.slice(t+1),e=e.substring(0,t)):i<0&&(i=e.length),t=0;48===e.charCodeAt(t);t++);for(r=e.length;48===e.charCodeAt(r-1);--r);if(e=e.slice(t,r)){if(r-=t,n.e=i=i-t-1,n.d=[],t=(i+1)%7,i<0&&(t+=7),t<r){for(t&&n.d.push(+e.slice(0,t)),r-=7;t<r;)n.d.push(+e.slice(t,t+=7));t=7-(e=e.slice(t)).length}else t-=r;for(;t--;)e+="0";n.d.push(+e),f&&(n.e>n.constructor.maxE?(n.d=null,n.e=NaN):n.e<n.constructor.minE&&(n.e=0,n.d=[0]))}else n.e=0,n.d=[0];return n}function V(n,e){var i,t,r,s,o,u,c,a,l;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),b.test(e))return B(n,e)}else if("Infinity"===e||"NaN"===e)return+e||(n.s=NaN),n.e=NaN,n.d=null,n;if(v.test(e))i=16,e=e.toLowerCase();else if(w.test(e))i=2;else{if(!N.test(e))throw Error(d+e);i=8}for((s=e.search(/p/i))>0?(c=+e.slice(s+1),e=e.substring(2,s)):e=e.slice(2),o=(s=e.indexOf("."))>=0,t=n.constructor,o&&(s=(u=(e=e.replace(".","")).length)-s,r=U(t,new t(i),s,2*s)),s=l=(a=A(e,i,x)).length-1;0===a[s];--s)a.pop();return s<0?new t(0*n.s):(n.e=P(a,l),n.d=a,f=!1,o&&(n=D(n,r,4*u)),c&&(n=n.times(Math.abs(c)<54?m(2,c):Un.pow(2,c))),f=!0,n)}function $(n,e,i,t,r){var s,o,u,c,a=n.precision,d=Math.ceil(a/7);for(f=!1,c=i.times(i),u=new n(t);;){if(o=D(u.times(c),new n(e++*e++),a,1),u=r?t.plus(o):t.minus(o),t=D(o.times(c),new n(e++*e++),a,1),void 0!==(o=u.plus(t)).d[d]){for(s=d;o.d[s]===u.d[s]&&s--;);if(-1==s)break}s=u,u=t,t=o,o=s}return f=!0,o.d.length=d+1,o}function J(n,e){for(var i=n;--e;)i*=n;return i}function W(n,e){var t,r=e.s<0,s=_(n,n.precision,1),o=s.times(.5);if((e=e.abs()).lte(o))return i=r?4:1,e;if((t=e.divToInt(s)).isZero())i=r?3:2;else{if((e=e.minus(t.times(s))).lte(o))return i=k(t)?r?2:3:r?4:1,e;i=k(t)?r?1:4:r?3:2}return e.minus(s).abs()}function z(n,i,t,o){var u,c,f,a,d,l,h,g,p,m=n.constructor,w=void 0!==t;if(w?(O(t,1,r),void 0===o?o=m.rounding:O(o,0,8)):(t=m.precision,o=m.rounding),n.isFinite()){for(w?(u=2,16==i?t=4*t-3:8==i&&(t=3*t-2)):u=i,(f=(h=T(n)).indexOf("."))>=0&&(h=h.replace(".",""),(p=new m(1)).e=h.length-f,p.d=A(T(p),10,u),p.e=p.d.length),c=d=(g=A(h,10,u)).length;0==g[--d];)g.pop();if(g[0]){if(f<0?c--:((n=new m(n)).d=g,n.e=c,g=(n=D(n,p,t,o,0,u)).d,c=n.e,l=e),f=g[t],a=u/2,l=l||void 0!==g[t+1],l=o<4?(void 0!==f||l)&&(0===o||o===(n.s<0?3:2)):f>a||f===a&&(4===o||l||6===o&&1&g[t-1]||o===(n.s<0?8:7)),g.length=t,l)for(;++g[--t]>u-1;)g[t]=0,t||(++c,g.unshift(1));for(d=g.length;!g[d-1];--d);for(f=0,h="";f<d;f++)h+=s.charAt(g[f]);if(w){if(d>1)if(16==i||8==i){for(f=16==i?4:3,--d;d%f;d++)h+="0";for(d=(g=A(h,u,i)).length;!g[d-1];--d);for(f=1,h="1.";f<d;f++)h+=s.charAt(g[f])}else h=h.charAt(0)+"."+h.slice(1);h=h+(c<0?"p":"p+")+c}else if(c<0){for(;++c;)h="0"+h;h="0."+h}else if(++c>d)for(c-=d;c--;)h+="0";else c<d&&(h=h.slice(0,c)+"."+h.slice(c))}else h=w?"0p+0":"0";h=(16==i?"0x":2==i?"0b":8==i?"0o":"")+h}else h=j(n);return n.s<0?"-"+h:h}function G(n,e){if(n.length>e)return n.length=e,!0}function K(n){return new this(n).abs()}function Q(n){return new this(n).acos()}function X(n){return new this(n).acosh()}function Y(n,e){return new this(n).plus(e)}function nn(n){return new this(n).asin()}function en(n){return new this(n).asinh()}function tn(n){return new this(n).atan()}function rn(n){return new this(n).atanh()}function sn(n,e){n=new this(n),e=new this(e);var i,t=this.precision,r=this.rounding,s=t+4;return n.s&&e.s?n.d||e.d?!e.d||n.isZero()?(i=e.s<0?_(this,t,r):new this(0)).s=n.s:!n.d||e.isZero()?(i=_(this,s,1).times(.5)).s=n.s:e.s<0?(this.precision=s,this.rounding=1,i=this.atan(D(n,e,s,1)),e=_(this,s,1),this.precision=t,this.rounding=r,i=n.s<0?i.minus(e):i.plus(e)):i=this.atan(D(n,e,s,1)):(i=_(this,s,1).times(e.s>0?.25:.75)).s=n.s:i=new this(NaN),i}function on(n){return new this(n).cbrt()}function un(n){return Z(n=new this(n),n.e+1,2)}function cn(n,e,i){return new this(n).clamp(e,i)}function fn(n){if(!n||"object"!=typeof n)throw Error(a+"Object expected");var e,i,s,o=!0===n.defaults,u=["precision",1,r,"rounding",0,8,"toExpNeg",-9e15,0,"toExpPos",0,t,"maxE",0,t,"minE",-9e15,0,"modulo",0,9];for(e=0;e<u.length;e+=3)if(i=u[e],o&&(this[i]=c[i]),void 0!==(s=n[i])){if(!(p(s)===s&&s>=u[e+1]&&s<=u[e+2]))throw Error(d+i+": "+s);this[i]=s}if(i="crypto",o&&(this[i]=c[i]),void 0!==(s=n[i])){if(!0!==s&&!1!==s&&0!==s&&1!==s)throw Error(d+i+": "+s);if(s){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw Error(h);this[i]=!0}else this[i]=!1}return this}function an(n){return new this(n).cos()}function dn(n){return new this(n).cosh()}function ln(n,e){return new this(n).div(e)}function hn(n){return new this(n).exp()}function gn(n){return Z(n=new this(n),n.e+1,3)}function pn(){var n,e,i=new this(0);for(f=!1,n=0;n<arguments.length;)if((e=new this(arguments[n++])).d)i.d&&(i=i.plus(e.times(e)));else{if(e.s)return f=!0,new this(1/0);i=e}return f=!0,i.sqrt()}function mn(n){return n instanceof Un||n&&n.toStringTag===g||!1}function wn(n){return new this(n).ln()}function vn(n,e){return new this(n).log(e)}function Nn(n){return new this(n).log(2)}function bn(n){return new this(n).log(10)}function xn(){return C(this,arguments,"lt")}function En(){return C(this,arguments,"gt")}function yn(n,e){return new this(n).mod(e)}function Mn(n,e){return new this(n).mul(e)}function qn(n,e){return new this(n).pow(e)}function On(n){var e,i,t,s,o=0,u=new this(1),c=[];if(void 0===n?n=this.precision:O(n,1,r),t=Math.ceil(n/7),this.crypto)if(crypto.getRandomValues)for(e=crypto.getRandomValues(new Uint32Array(t));o<t;)(s=e[o])>=429e7?e[o]=crypto.getRandomValues(new Uint32Array(1))[0]:c[o++]=s%1e7;else{if(!crypto.randomBytes)throw Error(h);for(e=crypto.randomBytes(t*=4);o<t;)(s=e[o]+(e[o+1]<<8)+(e[o+2]<<16)+((127&e[o+3])<<24))>=214e7?crypto.randomBytes(4).copy(e,o):(c.push(s%1e7),o+=4);o=t/4}else for(;o<t;)c[o++]=1e7*Math.random()|0;for(n%=7,(t=c[--o])&&n&&(s=m(10,7-n),c[o]=(t/s|0)*s);0===c[o];o--)c.pop();if(o<0)i=0,c=[0];else{for(i=-1;0===c[0];i-=7)c.shift();for(t=1,s=c[0];s>=10;s/=10)t++;t<7&&(i-=7-t)}return u.e=i,u.d=c,u}function Fn(n){return Z(n=new this(n),n.e+1,this.rounding)}function An(n){return(n=new this(n)).d?n.d[0]?n.s:0*n.s:n.s||NaN}function Dn(n){return new this(n).sin()}function Zn(n){return new this(n).sinh()}function Tn(n){return new this(n).sqrt()}function Pn(n,e){return new this(n).sub(e)}function Sn(){var n=0,e=arguments,i=new this(e[n]);for(f=!1;i.s&&++n<e.length;)i=i.plus(e[n]);return f=!0,Z(i,this.precision,this.rounding)}function _n(n){return new this(n).tan()}function Rn(n){return new this(n).tanh()}function Ln(n){return Z(n=new this(n),n.e+1,1)}M[Symbol.for("nodejs.util.inspect.custom")]=M.toString,M[Symbol.toStringTag]="Decimal";var Un=M.constructor=function n(e){var i,t,r;function s(n){var e,i,t,r=this;if(!(r instanceof s))return new s(n);if(r.constructor=s,mn(n))return r.s=n.s,void(f?!n.d||n.e>s.maxE?(r.e=NaN,r.d=null):n.e<s.minE?(r.e=0,r.d=[0]):(r.e=n.e,r.d=n.d.slice()):(r.e=n.e,r.d=n.d?n.d.slice():n.d));if("number"==(t=typeof n)){if(0===n)return r.s=1/n<0?-1:1,r.e=0,void(r.d=[0]);if(n<0?(n=-n,r.s=-1):r.s=1,n===~~n&&n<1e7){for(e=0,i=n;i>=10;i/=10)e++;return void(f?e>s.maxE?(r.e=NaN,r.d=null):e<s.minE?(r.e=0,r.d=[0]):(r.e=e,r.d=[n]):(r.e=e,r.d=[n]))}return 0*n!=0?(n||(r.s=NaN),r.e=NaN,void(r.d=null)):B(r,n.toString())}if("string"!==t)throw Error(d+n);return 45===(i=n.charCodeAt(0))?(n=n.slice(1),r.s=-1):(43===i&&(n=n.slice(1)),r.s=1),b.test(n)?B(r,n):V(r,n)}if(s.prototype=M,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.EUCLID=9,s.config=s.set=fn,s.clone=n,s.isDecimal=mn,s.abs=K,s.acos=Q,s.acosh=X,s.add=Y,s.asin=nn,s.asinh=en,s.atan=tn,s.atanh=rn,s.atan2=sn,s.cbrt=on,s.ceil=un,s.clamp=cn,s.cos=an,s.cosh=dn,s.div=ln,s.exp=hn,s.floor=gn,s.hypot=pn,s.ln=wn,s.log=vn,s.log10=bn,s.log2=Nn,s.max=xn,s.min=En,s.mod=yn,s.mul=Mn,s.pow=qn,s.random=On,s.round=Fn,s.sign=An,s.sin=Dn,s.sinh=Zn,s.sqrt=Tn,s.sub=Pn,s.sum=Sn,s.tan=_n,s.tanh=Rn,s.trunc=Ln,void 0===e&&(e={}),e&&!0!==e.defaults)for(r=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],i=0;i<r.length;)e.hasOwnProperty(t=r[i++])||(e[t]=this[t]);return s.config(e),s}(c);o=new Un(o),u=new Un(u);const kn=/^-?\d+(\.\d+)?$/,Cn=(n={precision:1e3})=>{const e=Un.clone(n);return{create:n=>("string"!=typeof n||kn.test(n)||(n=0),new e(n)),add:(n,e)=>n.plus(e),sub:(n,e)=>n.minus(e),mul:(n,e)=>n.times(e),div:(n,e)=>n.div(e),compare:(n,e)=>n.cmp(e),eq:(n,e)=>n.eq(e),gt:(n,e)=>n.gt(e),gte:(n,e)=>n.gte(e),lt:(n,e)=>n.lt(e),lte:(n,e)=>n.lte(e),isInteger:n=>n.isInteger(),isNegative:n=>n.isNegative(),isPositive:n=>n.isPositive(),isZero:n=>n.isZero(),isNaN:n=>n.isNaN(),isFinite:n=>n.isFinite(),abs:n=>n.abs(),ceil:n=>n.ceil(),floor:n=>n.floor(),round:n=>n.round(),max:(n,i)=>e.max(n,i),min:(n,i)=>e.min(n,i),toNumber:n=>n.toNumber(),toString:n=>n.toFixed()}};function In(n,e){n.registerNumberAdapter(["decimal.js","decimal-js","decimaljs"],(()=>Cn(e)))}var Hn={register:In,DecimalJsAdapter:Cn};n.DecimalJsAdapter=Cn,n.default=Hn,n.register=In,Object.defineProperty(n,"__esModule",{value:!0})},"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(((n="undefined"!=typeof globalThis?globalThis:n||self).TimeredCounterExternal=n.TimeredCounterExternal||{},n.TimeredCounterExternal.DecimalJsNumberAdapter={})); //# sourceMappingURL=decimal-js-number-adapter.global.js.map