| 123456789 |
- import{_ as e}from"./uni-easyinput.YEgcl_I6.js";import{d as n,u as i,c as t,r,aJ as s,f as o,g as u,i as c,j as a,k as f,l,n as d,t as h,m as p,x as g,z as m,_ as w}from"./index-DnnxUWW3.js";import{_ as v,a as N}from"./uni-forms.MkLHlTWf.js";import{_ as b}from"./cwg-page-wrapper.CiaPLP20.js";import{s as y}from"./toast.BCiXvXO0.js";import{u as x}from"./useEmailCountdown.NdOYHAuK.js";const E=w(n({__name:"cwg-email-code-popup",props:{visible:{type:Boolean,default:!1},email:{type:String,default:""},country:{type:String,default:""},api:{type:Function,default:()=>{}}},emits:["update:visible","confirm"],setup(n,{emit:w}){const{time:E,text:M,canSend:_,start:q,restore:O}=x({storageKey:"emailCodeTimer"}),{t:C}=i(),F=n,S=w,k=t({get:()=>F.visible,set:e=>S("update:visible",e)}),A=r(null),D=r(!1),Z=r({emailCode:""}),R=t(()=>({emailCode:{rules:[{required:!0,errorMessage:C("vaildate.code.empty")},{validateFunction:(e,n,i,t)=>n&&!!/^\d{6}$/.test(n)||(t(C("vaildate.code.empty")),!1)}]}}));async function T(){_.value&&!D.value&&await async function(){try{return D.value=!0,200===(await F.api({email:F.email||void 0,country:F.country||void 0})).code?(y(C("Msg.CodeSuccess")),q(),!0):(y(C("Msg.CodeFail")),!1)}catch(e){return y(C("Msg.CodeFail")),!1}finally{D.value=!1}}()}const P=async()=>{if(A.value)try{await A.value.validate(),k.value=!1,console.log(Z.value.emailCode,12121),S("confirm",Z.value.emailCode)}catch(e){if(e instanceof Array)return void y(e[0].errorMessage);y(C("Msg.CodeFail"))}};return s(()=>{O()}),(n,i)=>{const t=o(u("uni-easyinput"),e),r=o(u("uni-forms-item"),v),s=g,w=m,y=o(u("uni-forms"),N),x=o(u("cwg-popup"),b);return c(),a(x,{visible:k.value,"onUpdate:visible":i[2]||(i[2]=e=>k.value=e),type:"center","mask-click":!1,"show-footers":!0,title:p(C)("signup.form.code")},{footer:f(()=>[l(w,{onClick:i[1]||(i[1]=e=>k.value=!1)},{default:f(()=>[d(h(p(C)("Btn.Cancel")),1)]),_:1}),l(w,{type:"primary",onClick:P},{default:f(()=>[d(h(p(C)("Btn.Confirm")),1)]),_:1})]),default:f(()=>[l(s,{class:"popup-content"},{default:f(()=>[l(s,{class:"card-handle-dialog-content"},{default:f(()=>[l(y,{ref_key:"formRef1",ref:A,model:Z.value,rules:R.value,"label-position":"top","validate-trigger":"submit","label-width":200,class:"base-info-form"},{default:f(()=>[l(s,{class:"code-input-wrapper"},{default:f(()=>[l(s,{class:"code-input"},{default:f(()=>[l(r,{label:p(C)("signup.form.code"),name:"emailCode"},{default:f(()=>[l(t,{type:"number",modelValue:Z.value.emailCode,"onUpdate:modelValue":i[0]||(i[0]=e=>Z.value.emailCode=e),placeholder:p(C)("signup.form.code")},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1}),l(s,{class:"get-code-btn"},{default:f(()=>[l(s,{class:"cwg-button ok-button"},{default:f(()=>[l(w,{type:"primary",block:"",disabled:!p(_)||D.value,onClick:T},{default:f(()=>[d(h(p(M)),1)]),_:1},8,["disabled"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model","rules"])]),_:1})]),_:1})]),_:1},8,["visible","title"])}}}),[["__scopeId","data-v-1e9df2f1"]]);
- /*!
- * decimal.js v10.6.0
- * An arbitrary-precision Decimal type for JavaScript.
- * https://github.com/MikeMcl/decimal.js
- * Copyright (c) 2025 Michael Mclaughlin <M8ch88l@gmail.com>
- * MIT Licence
- */
- var M,_,q=9e15,O=1e9,C="0123456789abcdef",F="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",S="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",k={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-q,maxE:q,crypto:!1},A=!0,D="[DecimalError] ",Z=D+"Invalid argument: ",R=D+"Precision limit exceeded",T=D+"crypto unavailable",P="[object Decimal]",U=Math.floor,L=Math.pow,I=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,j=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,B=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,H=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,V=1e7,$=F.length-1,J=S.length-1,W={toStringTag:P};function z(e){var n,i,t,r=e.length-1,s="",o=e[0];if(r>0){for(s+=o,n=1;n<r;n++)(i=7-(t=e[n]+"").length)&&(s+=se(i)),s+=t;(i=7-(t=(o=e[n])+"").length)&&(s+=se(i))}else if(0===o)return"0";for(;o%10==0;)o/=10;return s+o}function K(e,n,i){if(e!==~~e||e<n||e>i)throw Error(Z+e)}function G(e,n,i,t){var r,s,o,u;for(s=e[0];s>=10;s/=10)--n;return--n<0?(n+=7,r=0):(r=Math.ceil((n+1)/7),n%=7),s=L(10,7-n),u=e[r]%s|0,null==t?n<3?(0==n?u=u/100|0:1==n&&(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)&&(e[r+1]/s/100|0)==L(10,n-2)-1||(u==s/2||0==u)&&!(e[r+1]/s/100|0):n<4?(0==n?u=u/1e3|0:1==n?u=u/100|0:2==n&&(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)&&(e[r+1]/s/1e3|0)==L(10,n-3)-1,o}function Q(e,n,i){for(var t,r,s=[0],o=0,u=e.length;o<u;){for(r=s.length;r--;)s[r]*=n;for(s[0]+=C.indexOf(e.charAt(o++)),t=0;t<s.length;t++)s[t]>i-1&&(void 0===s[t+1]&&(s[t+1]=0),s[t+1]+=s[t]/i|0,s[t]%=i)}return s.reverse()}W.absoluteValue=W.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),Y(e)},W.ceil=function(){return Y(new this.constructor(this),this.e+1,2)},W.clampedTo=W.clamp=function(e,n){var i=this,t=i.constructor;if(e=new t(e),n=new t(n),!e.s||!n.s)return new t(NaN);if(e.gt(n))throw Error(Z+n);return i.cmp(e)<0?e:i.cmp(n)>0?n:new t(i)},W.comparedTo=W.cmp=function(e){var n,i,t,r,s=this,o=s.d,u=(e=new s.constructor(e)).d,c=s.s,a=e.s;if(!o||!u)return c&&a?c!==a?c:o===u?0:!o^c<0?1:-1:NaN;if(!o[0]||!u[0])return o[0]?c:u[0]?-a:0;if(c!==a)return c;if(s.e!==e.e)return s.e>e.e^c<0?1:-1;for(n=0,i=(t=o.length)<(r=u.length)?t:r;n<i;++n)if(o[n]!==u[n])return o[n]>u[n]^c<0?1:-1;return t===r?0:t>r^c<0?1:-1},W.cosine=W.cos=function(){var e,n,i=this,t=i.constructor;return i.d?i.d[0]?(e=t.precision,n=t.rounding,t.precision=e+Math.max(i.e,i.sd())+7,t.rounding=1,i=function(e,n){var i,t,r;if(n.isZero())return n;t=n.d.length,t<32?r=(1/pe(4,i=Math.ceil(t/3))).toString():(i=16,r="2.3283064365386962890625e-10");e.precision+=i,n=he(e,1,n.times(r),new e(1));for(var s=i;s--;){var o=n.times(n);n=o.times(o).minus(o).times(8).plus(1)}return e.precision-=i,n}(t,ge(t,i)),t.precision=e,t.rounding=n,Y(2==_||3==_?i.neg():i,e,n,!0)):new t(1):new t(NaN)},W.cubeRoot=W.cbrt=function(){var e,n,i,t,r,s,o,u,c,a,f=this,l=f.constructor;if(!f.isFinite()||f.isZero())return new l(f);for(A=!1,(s=f.s*L(f.s*f,1/3))&&Math.abs(s)!=1/0?t=new l(s.toString()):(i=z(f.d),(s=((e=f.e)-i.length+1)%3)&&(i+=1==s||-2==s?"0":"00"),s=L(i,1/3),e=U((e+1)/3)-(e%3==(e<0?-1:2)),(t=new l(i=s==1/0?"5e"+e:(i=s.toExponential()).slice(0,i.indexOf("e")+1)+e)).s=f.s),o=(e=l.precision)+3;;)if(a=(c=(u=t).times(u).times(u)).plus(f),t=X(a.plus(f).times(u),a.plus(c),o+2,1),z(u.d).slice(0,o)===(i=z(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))||(Y(t,e+1,1),n=!t.times(t).times(t).eq(f));break}if(!r&&(Y(u,e+1,0),u.times(u).times(u).eq(f))){t=u;break}o+=4,r=1}return A=!0,Y(t,e,l.rounding,n)},W.decimalPlaces=W.dp=function(){var e,n=this.d,i=NaN;if(n){if(i=7*((e=n.length-1)-U(this.e/7)),e=n[e])for(;e%10==0;e/=10)i--;i<0&&(i=0)}return i},W.dividedBy=W.div=function(e){return X(this,new this.constructor(e))},W.dividedToIntegerBy=W.divToInt=function(e){var n=this.constructor;return Y(X(this,new n(e),0,1,1),n.precision,n.rounding)},W.equals=W.eq=function(e){return 0===this.cmp(e)},W.floor=function(){return Y(new this.constructor(this),this.e+1,3)},W.greaterThan=W.gt=function(e){return this.cmp(e)>0},W.greaterThanOrEqualTo=W.gte=function(e){var n=this.cmp(e);return 1==n||0===n},W.hyperbolicCosine=W.cosh=function(){var e,n,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?n=(1/pe(4,e=Math.ceil(r/3))).toString():(e=16,n="2.3283064365386962890625e-10"),s=he(o,1,s.times(n),new o(1),!0);for(var c,a=e,f=new o(8);a--;)c=s.times(s),s=u.minus(c.times(f.minus(c.times(f))));return Y(s,o.precision=i,o.rounding=t,!0)},W.hyperbolicSine=W.sinh=function(){var e,n,i,t,r=this,s=r.constructor;if(!r.isFinite()||r.isZero())return new s(r);if(n=s.precision,i=s.rounding,s.precision=n+Math.max(r.e,r.sd())+4,s.rounding=1,(t=r.d.length)<3)r=he(s,2,r,r,!0);else{e=(e=1.4*Math.sqrt(t))>16?16:0|e,r=he(s,2,r=r.times(1/pe(5,e)),r,!0);for(var o,u=new s(5),c=new s(16),a=new s(20);e--;)o=r.times(r),r=r.times(u.plus(o.times(c.times(o).plus(a))))}return s.precision=n,s.rounding=i,Y(r,n,i,!0)},W.hyperbolicTangent=W.tanh=function(){var e,n,i=this,t=i.constructor;return i.isFinite()?i.isZero()?new t(i):(e=t.precision,n=t.rounding,t.precision=e+7,t.rounding=1,X(i.sinh(),i.cosh(),t.precision=e,t.rounding=n)):new t(i.s)},W.inverseCosine=W.acos=function(){var e=this,n=e.constructor,i=e.abs().cmp(1),t=n.precision,r=n.rounding;return-1!==i?0===i?e.isNeg()?te(n,t,r):new n(0):new n(NaN):e.isZero()?te(n,t+4,r).times(.5):(n.precision=t+6,n.rounding=1,e=new n(1).minus(e).div(e.plus(1)).sqrt().atan(),n.precision=t,n.rounding=r,e.times(2))},W.inverseHyperbolicCosine=W.acosh=function(){var e,n,i=this,t=i.constructor;return i.lte(1)?new t(i.eq(1)?0:NaN):i.isFinite()?(e=t.precision,n=t.rounding,t.precision=e+Math.max(Math.abs(i.e),i.sd())+4,t.rounding=1,A=!1,i=i.times(i).minus(1).sqrt().plus(i),A=!0,t.precision=e,t.rounding=n,i.ln()):new t(i)},W.inverseHyperbolicSine=W.asinh=function(){var e,n,i=this,t=i.constructor;return!i.isFinite()||i.isZero()?new t(i):(e=t.precision,n=t.rounding,t.precision=e+2*Math.max(Math.abs(i.e),i.sd())+6,t.rounding=1,A=!1,i=i.times(i).plus(1).sqrt().plus(i),A=!0,t.precision=e,t.rounding=n,i.ln())},W.inverseHyperbolicTangent=W.atanh=function(){var e,n,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):(e=s.precision,n=s.rounding,t=r.sd(),Math.max(t,e)<2*-r.e-1?Y(new s(r),e,n,!0):(s.precision=i=t-r.e,r=X(r.plus(1),new s(1).minus(r),i+e,1),s.precision=e+4,s.rounding=1,r=r.ln(),s.precision=e,s.rounding=n,r.times(.5))):new s(NaN)},W.inverseSine=W.asin=function(){var e,n,i,t,r=this,s=r.constructor;return r.isZero()?new s(r):(n=r.abs().cmp(1),i=s.precision,t=s.rounding,-1!==n?0===n?((e=te(s,i+4,t).times(.5)).s=r.s,e):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)))},W.inverseTangent=W.atan=function(){var e,n,i,t,r,s,o,u,c,a=this,f=a.constructor,l=f.precision,d=f.rounding;if(a.isFinite()){if(a.isZero())return new f(a);if(a.abs().eq(1)&&l+4<=J)return(o=te(f,l+4,d).times(.25)).s=a.s,o}else{if(!a.s)return new f(NaN);if(l+4<=J)return(o=te(f,l+4,d).times(.5)).s=a.s,o}for(f.precision=u=l+10,f.rounding=1,e=i=Math.min(28,u/7+2|0);e;--e)a=a.div(a.times(a).plus(1).sqrt().plus(1));for(A=!1,n=Math.ceil(u/7),t=1,c=a.times(a),o=new f(a),r=a;-1!==e;)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[n])for(e=n;o.d[e]===s.d[e]&&e--;);return i&&(o=o.times(2<<i-1)),A=!0,Y(o,f.precision=l,f.rounding=d,!0)},W.isFinite=function(){return!!this.d},W.isInteger=W.isInt=function(){return!!this.d&&U(this.e/7)>this.d.length-2},W.isNaN=function(){return!this.s},W.isNegative=W.isNeg=function(){return this.s<0},W.isPositive=W.isPos=function(){return this.s>0},W.isZero=function(){return!!this.d&&0===this.d[0]},W.lessThan=W.lt=function(e){return this.cmp(e)<0},W.lessThanOrEqualTo=W.lte=function(e){return this.cmp(e)<1},W.logarithm=W.log=function(e){var n,i,t,r,s,o,u,c,a=this,f=a.constructor,l=f.precision,d=f.rounding;if(null==e)e=new f(10),n=!0;else{if(i=(e=new f(e)).d,e.s<0||!i||!i[0]||e.eq(1))return new f(NaN);n=e.eq(10)}if(i=a.d,a.s<0||!i||!i[0]||a.eq(1))return new f(i&&!i[0]?-1/0:1!=a.s?NaN:i?0:1/0);if(n)if(i.length>1)s=!0;else{for(r=i[0];r%10==0;)r/=10;s=1!==r}if(A=!1,o=fe(a,u=l+5),t=n?ie(f,u+10):fe(e,u),G((c=X(o,t,u,1)).d,r=l,d))do{if(o=fe(a,u+=10),t=n?ie(f,u+10):fe(e,u),c=X(o,t,u,1),!s){+z(c.d).slice(r+1,r+15)+1==1e14&&(c=Y(c,l+1,0));break}}while(G(c.d,r+=10,d));return A=!0,Y(c,l,d)},W.minus=W.sub=function(e){var n,i,t,r,s,o,u,c,a,f,l,d,h=this,p=h.constructor;if(e=new p(e),!h.d||!e.d)return h.s&&e.s?h.d?e.s=-e.s:e=new p(e.d||h.s!==e.s?h:NaN):e=new p(NaN),e;if(h.s!=e.s)return e.s=-e.s,h.plus(e);if(a=h.d,d=e.d,u=p.precision,c=p.rounding,!a[0]||!d[0]){if(d[0])e.s=-e.s;else{if(!a[0])return new p(3===c?-0:0);e=new p(h)}return A?Y(e,u,c):e}if(i=U(e.e/7),f=U(h.e/7),a=a.slice(),s=f-i){for((l=s<0)?(n=a,s=-s,o=d.length):(n=d,i=f,o=a.length),s>(t=Math.max(Math.ceil(u/7),o)+2)&&(s=t,n.length=1),n.reverse(),t=s;t--;)n.push(0);n.reverse()}else{for((l=(t=a.length)<(o=d.length))&&(o=t),t=0;t<o;t++)if(a[t]!=d[t]){l=a[t]<d[t];break}s=0}for(l&&(n=a,a=d,d=n,e.s=-e.s),o=a.length,t=d.length-o;t>0;--t)a[o++]=0;for(t=d.length;t>s;){if(a[--t]<d[t]){for(r=t;r&&0===a[--r];)a[r]=V-1;--a[r],a[t]+=V}a[t]-=d[t]}for(;0===a[--o];)a.pop();for(;0===a[0];a.shift())--i;return a[0]?(e.d=a,e.e=ne(a,i),A?Y(e,u,c):e):new p(3===c?-0:0)},W.modulo=W.mod=function(e){var n,i=this,t=i.constructor;return e=new t(e),!i.d||!e.s||e.d&&!e.d[0]?new t(NaN):!e.d||i.d&&!i.d[0]?Y(new t(i),t.precision,t.rounding):(A=!1,9==t.modulo?(n=X(i,e.abs(),0,3,1)).s*=e.s:n=X(i,e,0,t.modulo,1),n=n.times(e),A=!0,i.minus(n))},W.naturalExponential=W.exp=function(){return ae(this)},W.naturalLogarithm=W.ln=function(){return fe(this)},W.negated=W.neg=function(){var e=new this.constructor(this);return e.s=-e.s,Y(e)},W.plus=W.add=function(e){var n,i,t,r,s,o,u,c,a,f,l=this,d=l.constructor;if(e=new d(e),!l.d||!e.d)return l.s&&e.s?l.d||(e=new d(e.d||l.s===e.s?l:NaN)):e=new d(NaN),e;if(l.s!=e.s)return e.s=-e.s,l.minus(e);if(a=l.d,f=e.d,u=d.precision,c=d.rounding,!a[0]||!f[0])return f[0]||(e=new d(l)),A?Y(e,u,c):e;if(s=U(l.e/7),t=U(e.e/7),a=a.slice(),r=s-t){for(r<0?(i=a,r=-r,o=f.length):(i=f,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=f.length)<0&&(r=o,i=f,f=a,a=i),n=0;r;)n=(a[--r]=a[r]+f[r]+n)/V|0,a[r]%=V;for(n&&(a.unshift(n),++t),o=a.length;0==a[--o];)a.pop();return e.d=a,e.e=ne(a,t),A?Y(e,u,c):e},W.precision=W.sd=function(e){var n,i=this;if(void 0!==e&&e!==!!e&&1!==e&&0!==e)throw Error(Z+e);return i.d?(n=re(i.d),e&&i.e+1>n&&(n=i.e+1)):n=NaN,n},W.round=function(){var e=this,n=e.constructor;return Y(new n(e),e.e+1,n.rounding)},W.sine=W.sin=function(){var e,n,i=this,t=i.constructor;return i.isFinite()?i.isZero()?new t(i):(e=t.precision,n=t.rounding,t.precision=e+Math.max(i.e,i.sd())+7,t.rounding=1,i=function(e,n){var i,t=n.d.length;if(t<3)return n.isZero()?n:he(e,2,n,n);i=(i=1.4*Math.sqrt(t))>16?16:0|i,n=n.times(1/pe(5,i)),n=he(e,2,n,n);for(var r,s=new e(5),o=new e(16),u=new e(20);i--;)r=n.times(n),n=n.times(s.plus(r.times(o.times(r).minus(u))));return n}(t,ge(t,i)),t.precision=e,t.rounding=n,Y(_>2?i.neg():i,e,n,!0)):new t(NaN)},W.squareRoot=W.sqrt=function(){var e,n,i,t,r,s,o=this,u=o.d,c=o.e,a=o.s,f=o.constructor;if(1!==a||!u||!u[0])return new f(!a||a<0&&(!u||u[0])?NaN:u?o:1/0);for(A=!1,0==(a=Math.sqrt(+o))||a==1/0?(((n=z(u)).length+c)%2==0&&(n+="0"),a=Math.sqrt(n),c=U((c+1)/2)-(c<0||c%2),t=new f(n=a==1/0?"5e"+c:(n=a.toExponential()).slice(0,n.indexOf("e")+1)+c)):t=new f(a.toString()),i=(c=f.precision)+3;;)if(t=(s=t).plus(X(o,s,i+2,1)).times(.5),z(s.d).slice(0,i)===(n=z(t.d)).slice(0,i)){if("9999"!=(n=n.slice(i-3,i+1))&&(r||"4999"!=n)){+n&&(+n.slice(1)||"5"!=n.charAt(0))||(Y(t,c+1,1),e=!t.times(t).eq(o));break}if(!r&&(Y(s,c+1,0),s.times(s).eq(o))){t=s;break}i+=4,r=1}return A=!0,Y(t,c,f.rounding,e)},W.tangent=W.tan=function(){var e,n,i=this,t=i.constructor;return i.isFinite()?i.isZero()?new t(i):(e=t.precision,n=t.rounding,t.precision=e+10,t.rounding=1,(i=i.sin()).s=1,i=X(i,new t(1).minus(i.times(i)).sqrt(),e+10,0),t.precision=e,t.rounding=n,Y(2==_||4==_?i.neg():i,e,n,!0)):new t(NaN)},W.times=W.mul=function(e){var n,i,t,r,s,o,u,c,a,f=this,l=f.constructor,d=f.d,h=(e=new l(e)).d;if(e.s*=f.s,!(d&&d[0]&&h&&h[0]))return new l(!e.s||d&&!d[0]&&!h||h&&!h[0]&&!d?NaN:d&&h?0*e.s:e.s/0);for(i=U(f.e/7)+U(e.e/7),(c=d.length)<(a=h.length)&&(s=d,d=h,h=s,o=c,c=a,a=o),s=[],t=o=c+a;t--;)s.push(0);for(t=a;--t>=0;){for(n=0,r=c+t;r>t;)u=s[r]+h[t]*d[r-t-1]+n,s[r--]=u%V|0,n=u/V|0;s[r]=(s[r]+n)%V|0}for(;!s[--o];)s.pop();return n?++i:s.shift(),e.d=s,e.e=ne(s,i),A?Y(e,l.precision,l.rounding):e},W.toBinary=function(e,n){return me(this,2,e,n)},W.toDecimalPlaces=W.toDP=function(e,n){var i=this,t=i.constructor;return i=new t(i),void 0===e?i:(K(e,0,O),void 0===n?n=t.rounding:K(n,0,8),Y(i,e+i.e+1,n))},W.toExponential=function(e,n){var i,t=this,r=t.constructor;return void 0===e?i=ee(t,!0):(K(e,0,O),void 0===n?n=r.rounding:K(n,0,8),i=ee(t=Y(new r(t),e+1,n),!0,e+1)),t.isNeg()&&!t.isZero()?"-"+i:i},W.toFixed=function(e,n){var i,t,r=this,s=r.constructor;return void 0===e?i=ee(r):(K(e,0,O),void 0===n?n=s.rounding:K(n,0,8),i=ee(t=Y(new s(r),e+r.e+1,n),!1,e+t.e+1)),r.isNeg()&&!r.isZero()?"-"+i:i},W.toFraction=function(e){var n,i,t,r,s,o,u,c,a,f,l,d,h=this,p=h.d,g=h.constructor;if(!p)return new g(h);if(a=i=new g(1),t=c=new g(0),o=(s=(n=new g(t)).e=re(p)-h.e-1)%7,n.d[0]=L(10,o<0?7+o:o),null==e)e=s>0?n:a;else{if(!(u=new g(e)).isInt()||u.lt(a))throw Error(Z+u);e=u.gt(n)?s>0?n:a:u}for(A=!1,u=new g(z(p)),f=g.precision,g.precision=s=7*p.length*2;l=X(u,n,0,1,1),1!=(r=i.plus(l.times(t))).cmp(e);)i=t,t=r,r=a,a=c.plus(l.times(r)),c=r,r=n,n=u.minus(l.times(r)),u=r;return r=X(e.minus(i),t,0,1,1),c=c.plus(r.times(a)),i=i.plus(r.times(t)),c.s=a.s=h.s,d=X(a,t,s,1).minus(h).abs().cmp(X(c,i,s,1).minus(h).abs())<1?[a,t]:[c,i],g.precision=f,A=!0,d},W.toHexadecimal=W.toHex=function(e,n){return me(this,16,e,n)},W.toNearest=function(e,n){var i=this,t=i.constructor;if(i=new t(i),null==e){if(!i.d)return i;e=new t(1),n=t.rounding}else{if(e=new t(e),void 0===n?n=t.rounding:K(n,0,8),!i.d)return e.s?i:e;if(!e.d)return e.s&&(e.s=i.s),e}return e.d[0]?(A=!1,i=X(i,e,0,n,1).times(e),A=!0,Y(i)):(e.s=i.s,i=e),i},W.toNumber=function(){return+this},W.toOctal=function(e,n){return me(this,8,e,n)},W.toPower=W.pow=function(e){var n,i,t,r,s,o,u=this,c=u.constructor,a=+(e=new c(e));if(!(u.d&&e.d&&u.d[0]&&e.d[0]))return new c(L(+u,a));if((u=new c(u)).eq(1))return u;if(t=c.precision,s=c.rounding,e.eq(1))return Y(u,t,s);if((n=U(e.e/7))>=e.d.length-1&&(i=a<0?-a:a)<=9007199254740991)return r=oe(c,u,i,t),e.s<0?new c(1).div(r):Y(r,t,s);if((o=u.s)<0){if(n<e.d.length-1)return new c(NaN);if(1&e.d[n]||(o=1),0==u.e&&1==u.d[0]&&1==u.d.length)return u.s=o,u}return(n=0!=(i=L(+u,a))&&isFinite(i)?new c(i+"").e:U(a*(Math.log("0."+z(u.d))/Math.LN10+u.e+1)))>c.maxE+1||n<c.minE-1?new c(n>0?o/0:0):(A=!1,c.rounding=u.s=1,i=Math.min(12,(n+"").length),(r=ae(e.times(fe(u,t+i)),t)).d&&G((r=Y(r,t+5,1)).d,t,s)&&(n=t+10,+z((r=Y(ae(e.times(fe(u,n+i)),n),n+5,1)).d).slice(t+1,t+15)+1==1e14&&(r=Y(r,t+1,0))),r.s=o,A=!0,c.rounding=s,Y(r,t,s))},W.toPrecision=function(e,n){var i,t=this,r=t.constructor;return void 0===e?i=ee(t,t.e<=r.toExpNeg||t.e>=r.toExpPos):(K(e,1,O),void 0===n?n=r.rounding:K(n,0,8),i=ee(t=Y(new r(t),e,n),e<=t.e||t.e<=r.toExpNeg,e)),t.isNeg()&&!t.isZero()?"-"+i:i},W.toSignificantDigits=W.toSD=function(e,n){var i=this.constructor;return void 0===e?(e=i.precision,n=i.rounding):(K(e,1,O),void 0===n?n=i.rounding:K(n,0,8)),Y(new i(this),e,n)},W.toString=function(){var e=this,n=e.constructor,i=ee(e,e.e<=n.toExpNeg||e.e>=n.toExpPos);return e.isNeg()&&!e.isZero()?"-"+i:i},W.truncated=W.trunc=function(){return Y(new this.constructor(this),this.e+1,1)},W.valueOf=W.toJSON=function(){var e=this,n=e.constructor,i=ee(e,e.e<=n.toExpNeg||e.e>=n.toExpPos);return e.isNeg()?"-"+i:i};var X=function(){function e(e,n,i){var t,r=0,s=e.length;for(e=e.slice();s--;)t=e[s]*n+r,e[s]=t%i|0,r=t/i|0;return r&&e.unshift(r),e}function n(e,n,i,t){var r,s;if(i!=t)s=i>t?1:-1;else for(r=s=0;r<i;r++)if(e[r]!=n[r]){s=e[r]>n[r]?1:-1;break}return s}function i(e,n,i,t){for(var r=0;i--;)e[i]-=r,r=e[i]<n[i]?1:0,e[i]=r*t+e[i]-n[i];for(;!e[0]&&e.length>1;)e.shift()}return function(t,r,s,o,u,c){var a,f,l,d,h,p,g,m,w,v,N,b,y,x,E,_,q,O,C,F,S=t.constructor,k=t.s==r.s?1:-1,A=t.d,D=r.d;if(!(A&&A[0]&&D&&D[0]))return new S(t.s&&r.s&&(A?!D||A[0]!=D[0]:D)?A&&0==A[0]||!D?0*k:k/0:NaN);for(c?(h=1,f=t.e-r.e):(c=V,h=7,f=U(t.e/h)-U(r.e/h)),C=D.length,q=A.length,v=(w=new S(k)).d=[],l=0;D[l]==(A[l]||0);l++);if(D[l]>(A[l]||0)&&f--,null==s?(x=s=S.precision,o=S.rounding):x=u?s+(t.e-r.e)+1:s,x<0)v.push(1),p=!0;else{if(x=x/h+2|0,l=0,1==C){for(d=0,D=D[0],x++;(l<q||d)&&x--;l++)E=d*c+(A[l]||0),v[l]=E/D|0,d=E%D|0;p=d||l<q}else{for((d=c/(D[0]+1)|0)>1&&(D=e(D,d,c),A=e(A,d,c),C=D.length,q=A.length),_=C,b=(N=A.slice(0,C)).length;b<C;)N[b++]=0;(F=D.slice()).unshift(0),O=D[0],D[1]>=c/2&&++O;do{d=0,(a=n(D,N,C,b))<0?(y=N[0],C!=b&&(y=y*c+(N[1]||0)),(d=y/O|0)>1?(d>=c&&(d=c-1),1==(a=n(g=e(D,d,c),N,m=g.length,b=N.length))&&(d--,i(g,C<m?F:D,m,c))):(0==d&&(a=d=1),g=D.slice()),(m=g.length)<b&&g.unshift(0),i(N,g,b,c),-1==a&&(a=n(D,N,C,b=N.length))<1&&(d++,i(N,C<b?F:D,b,c)),b=N.length):0===a&&(d++,N=[0]),v[l++]=d,a&&N[0]?N[b++]=A[_]||0:(N=[A[_]],b=1)}while((_++<q||void 0!==N[0])&&x--);p=void 0!==N[0]}v[0]||v.shift()}if(1==h)w.e=f,M=p;else{for(l=1,d=v[0];d>=10;d/=10)l++;w.e=l+f*h-1,Y(w,u?s+w.e+1:s,o,p)}return w}}();function Y(e,n,i,t){var r,s,o,u,c,a,f,l,d,h=e.constructor;e:if(null!=n){if(!(l=e.d))return e;for(r=1,u=l[0];u>=10;u/=10)r++;if((s=n-r)<0)s+=7,o=n,c=(f=l[d=0])/L(10,r-o-1)%10|0;else if((d=Math.ceil((s+1)/7))>=(u=l.length)){if(!t)break e;for(;u++<=d;)l.push(0);f=c=0,r=1,o=(s%=7)-7+1}else{for(f=u=l[d],r=1;u>=10;u/=10)r++;c=(o=(s%=7)-7+r)<0?0:f/L(10,r-o-1)%10|0}if(t=t||n<0||void 0!==l[d+1]||(o<0?f:f%L(10,r-o-1)),a=i<4?(c||t)&&(0==i||i==(e.s<0?3:2)):c>5||5==c&&(4==i||t||6==i&&(s>0?o>0?f/L(10,r-o):0:l[d-1])%10&1||i==(e.s<0?8:7)),n<1||!l[0])return l.length=0,a?(n-=e.e+1,l[0]=L(10,(7-n%7)%7),e.e=-n||0):l[0]=e.e=0,e;if(0==s?(l.length=d,u=1,d--):(l.length=d+1,u=L(10,7-s),l[d]=o>0?(f/L(10,r-o)%L(10,o)|0)*u:0),a)for(;;){if(0==d){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&&(e.e++,l[0]==V&&(l[0]=1));break}if(l[d]+=u,l[d]!=V)break;l[d--]=0,u=1}for(s=l.length;0===l[--s];)l.pop()}return A&&(e.e>h.maxE?(e.d=null,e.e=NaN):e.e<h.minE&&(e.e=0,e.d=[0])),e}function ee(e,n,i){if(!e.isFinite())return le(e);var t,r=e.e,s=z(e.d),o=s.length;return n?(i&&(t=i-o)>0?s=s.charAt(0)+"."+s.slice(1)+se(t):o>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(e.e<0?"e":"e+")+e.e):r<0?(s="0."+se(-r-1)+s,i&&(t=i-o)>0&&(s+=se(t))):r>=o?(s+=se(r+1-o),i&&(t=i-r-1)>0&&(s=s+"."+se(t))):((t=r+1)<o&&(s=s.slice(0,t)+"."+s.slice(t)),i&&(t=i-o)>0&&(r+1===o&&(s+="."),s+=se(t))),s}function ne(e,n){var i=e[0];for(n*=7;i>=10;i/=10)n++;return n}function ie(e,n,i){if(n>$)throw A=!0,i&&(e.precision=i),Error(R);return Y(new e(F),n,1,!0)}function te(e,n,i){if(n>J)throw Error(R);return Y(new e(S),n,i,!0)}function re(e){var n=e.length-1,i=7*n+1;if(n=e[n]){for(;n%10==0;n/=10)i--;for(n=e[0];n>=10;n/=10)i++}return i}function se(e){for(var n="";e--;)n+="0";return n}function oe(e,n,i,t){var r,s=new e(1),o=Math.ceil(t/7+4);for(A=!1;;){if(i%2&&we((s=s.times(n)).d,o)&&(r=!0),0===(i=U(i/2))){i=s.d.length-1,r&&0===s.d[i]&&++s.d[i];break}we((n=n.times(n)).d,o)}return A=!0,s}function ue(e){return 1&e.d[e.d.length-1]}function ce(e,n,i){for(var t,r,s=new e(n[0]),o=0;++o<n.length;){if(!(r=new e(n[o])).s){s=r;break}((t=s.cmp(r))===i||0===t&&s.s===i)&&(s=r)}return s}function ae(e,n){var i,t,r,s,o,u,c,a=0,f=0,l=0,d=e.constructor,h=d.rounding,p=d.precision;if(!e.d||!e.d[0]||e.e>17)return new d(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:NaN);for(null==n?(A=!1,c=p):c=n,u=new d(.03125);e.e>-2;)e=e.times(u),l+=5;for(c+=t=Math.log(L(2,l))/Math.LN10*2+5|0,i=s=o=new d(1),d.precision=c;;){if(s=Y(s.times(e),c,1),i=i.times(++f),z((u=o.plus(X(s,i,c,1))).d).slice(0,c)===z(o.d).slice(0,c)){for(r=l;r--;)o=Y(o.times(o),c,1);if(null!=n)return d.precision=p,o;if(!(a<3&&G(o.d,c-t,h,a)))return Y(o,d.precision=p,h,A=!0);d.precision=c+=10,i=s=u=new d(1),f=0,a++}o=u}}function fe(e,n){var i,t,r,s,o,u,c,a,f,l,d,h=1,p=e,g=p.d,m=p.constructor,w=m.rounding,v=m.precision;if(p.s<0||!g||!g[0]||!p.e&&1==g[0]&&1==g.length)return new m(g&&!g[0]?-1/0:1!=p.s?NaN:g?0:p);if(null==n?(A=!1,f=v):f=n,m.precision=f+=10,t=(i=z(g)).charAt(0),!(Math.abs(s=p.e)<15e14))return a=ie(m,f+2,v).times(s+""),p=fe(new m(t+"."+i.slice(1)),f-10).plus(a),m.precision=v,null==n?Y(p,v,w,A=!0):p;for(;t<7&&1!=t||1==t&&i.charAt(1)>3;)t=(i=z((p=p.times(e)).d)).charAt(0),h++;for(s=p.e,t>1?(p=new m("0."+i),s++):p=new m(t+"."+i.slice(1)),l=p,c=o=p=X(p.minus(1),p.plus(1),f,1),d=Y(p.times(p),f,1),r=3;;){if(o=Y(o.times(d),f,1),z((a=c.plus(X(o,new m(r),f,1))).d).slice(0,f)===z(c.d).slice(0,f)){if(c=c.times(2),0!==s&&(c=c.plus(ie(m,f+2,v).times(s+""))),c=X(c,new m(h),f,1),null!=n)return m.precision=v,c;if(!G(c.d,f-10,w,u))return Y(c,m.precision=v,w,A=!0);m.precision=f+=10,a=o=p=X(l.minus(1),l.plus(1),f,1),d=Y(p.times(p),f,1),r=u=1}c=a,r+=2}}function le(e){return String(e.s*e.s/0)}function de(e,n){var i,t,r;for((i=n.indexOf("."))>-1&&(n=n.replace(".","")),(t=n.search(/e/i))>0?(i<0&&(i=t),i+=+n.slice(t+1),n=n.substring(0,t)):i<0&&(i=n.length),t=0;48===n.charCodeAt(t);t++);for(r=n.length;48===n.charCodeAt(r-1);--r);if(n=n.slice(t,r)){if(r-=t,e.e=i=i-t-1,e.d=[],t=(i+1)%7,i<0&&(t+=7),t<r){for(t&&e.d.push(+n.slice(0,t)),r-=7;t<r;)e.d.push(+n.slice(t,t+=7));t=7-(n=n.slice(t)).length}else t-=r;for(;t--;)n+="0";e.d.push(+n),A&&(e.e>e.constructor.maxE?(e.d=null,e.e=NaN):e.e<e.constructor.minE&&(e.e=0,e.d=[0]))}else e.e=0,e.d=[0];return e}function he(e,n,i,t,r){var s,o,u,c,a=e.precision,f=Math.ceil(a/7);for(A=!1,c=i.times(i),u=new e(t);;){if(o=X(u.times(c),new e(n++*n++),a,1),u=r?t.plus(o):t.minus(o),t=X(o.times(c),new e(n++*n++),a,1),void 0!==(o=u.plus(t)).d[f]){for(s=f;o.d[s]===u.d[s]&&s--;);if(-1==s)break}s=u,u=t,t=o,o=s}return A=!0,o.d.length=f+1,o}function pe(e,n){for(var i=e;--n;)i*=e;return i}function ge(e,n){var i,t=n.s<0,r=te(e,e.precision,1),s=r.times(.5);if((n=n.abs()).lte(s))return _=t?4:1,n;if((i=n.divToInt(r)).isZero())_=t?3:2;else{if((n=n.minus(i.times(r))).lte(s))return _=ue(i)?t?2:3:t?4:1,n;_=ue(i)?t?1:4:t?3:2}return n.minus(r).abs()}function me(e,n,i,t){var r,s,o,u,c,a,f,l,d,h=e.constructor,p=void 0!==i;if(p?(K(i,1,O),void 0===t?t=h.rounding:K(t,0,8)):(i=h.precision,t=h.rounding),e.isFinite()){for(p?(r=2,16==n?i=4*i-3:8==n&&(i=3*i-2)):r=n,(o=(f=ee(e)).indexOf("."))>=0&&(f=f.replace(".",""),(d=new h(1)).e=f.length-o,d.d=Q(ee(d),10,r),d.e=d.d.length),s=c=(l=Q(f,10,r)).length;0==l[--c];)l.pop();if(l[0]){if(o<0?s--:((e=new h(e)).d=l,e.e=s,l=(e=X(e,d,i,t,0,r)).d,s=e.e,a=M),o=l[i],u=r/2,a=a||void 0!==l[i+1],a=t<4?(void 0!==o||a)&&(0===t||t===(e.s<0?3:2)):o>u||o===u&&(4===t||a||6===t&&1&l[i-1]||t===(e.s<0?8:7)),l.length=i,a)for(;++l[--i]>r-1;)l[i]=0,i||(++s,l.unshift(1));for(c=l.length;!l[c-1];--c);for(o=0,f="";o<c;o++)f+=C.charAt(l[o]);if(p){if(c>1)if(16==n||8==n){for(o=16==n?4:3,--c;c%o;c++)f+="0";for(c=(l=Q(f,r,n)).length;!l[c-1];--c);for(o=1,f="1.";o<c;o++)f+=C.charAt(l[o])}else f=f.charAt(0)+"."+f.slice(1);f=f+(s<0?"p":"p+")+s}else if(s<0){for(;++s;)f="0"+f;f="0."+f}else if(++s>c)for(s-=c;s--;)f+="0";else s<c&&(f=f.slice(0,s)+"."+f.slice(s))}else f=p?"0p+0":"0";f=(16==n?"0x":2==n?"0b":8==n?"0o":"")+f}else f=le(e);return e.s<0?"-"+f:f}function we(e,n){if(e.length>n)return e.length=n,!0}function ve(e){return new this(e).abs()}function Ne(e){return new this(e).acos()}function be(e){return new this(e).acosh()}function ye(e,n){return new this(e).plus(n)}function xe(e){return new this(e).asin()}function Ee(e){return new this(e).asinh()}function Me(e){return new this(e).atan()}function _e(e){return new this(e).atanh()}function qe(e,n){e=new this(e),n=new this(n);var i,t=this.precision,r=this.rounding,s=t+4;return e.s&&n.s?e.d||n.d?!n.d||e.isZero()?(i=n.s<0?te(this,t,r):new this(0)).s=e.s:!e.d||n.isZero()?(i=te(this,s,1).times(.5)).s=e.s:n.s<0?(this.precision=s,this.rounding=1,i=this.atan(X(e,n,s,1)),n=te(this,s,1),this.precision=t,this.rounding=r,i=e.s<0?i.minus(n):i.plus(n)):i=this.atan(X(e,n,s,1)):(i=te(this,s,1).times(n.s>0?.25:.75)).s=e.s:i=new this(NaN),i}function Oe(e){return new this(e).cbrt()}function Ce(e){return Y(e=new this(e),e.e+1,2)}function Fe(e,n,i){return new this(e).clamp(n,i)}function Se(e){if(!e||"object"!=typeof e)throw Error(D+"Object expected");var n,i,t,r=!0===e.defaults,s=["precision",1,O,"rounding",0,8,"toExpNeg",-q,0,"toExpPos",0,q,"maxE",0,q,"minE",-q,0,"modulo",0,9];for(n=0;n<s.length;n+=3)if(i=s[n],r&&(this[i]=k[i]),void 0!==(t=e[i])){if(!(U(t)===t&&t>=s[n+1]&&t<=s[n+2]))throw Error(Z+i+": "+t);this[i]=t}if(i="crypto",r&&(this[i]=k[i]),void 0!==(t=e[i])){if(!0!==t&&!1!==t&&0!==t&&1!==t)throw Error(Z+i+": "+t);if(t){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw Error(T);this[i]=!0}else this[i]=!1}return this}function ke(e){return new this(e).cos()}function Ae(e){return new this(e).cosh()}function De(e,n){return new this(e).div(n)}function Ze(e){return new this(e).exp()}function Re(e){return Y(e=new this(e),e.e+1,3)}function Te(){var e,n,i=new this(0);for(A=!1,e=0;e<arguments.length;)if((n=new this(arguments[e++])).d)i.d&&(i=i.plus(n.times(n)));else{if(n.s)return A=!0,new this(1/0);i=n}return A=!0,i.sqrt()}function Pe(e){return e instanceof sn||e&&e.toStringTag===P||!1}function Ue(e){return new this(e).ln()}function Le(e,n){return new this(e).log(n)}function Ie(e){return new this(e).log(2)}function je(e){return new this(e).log(10)}function Be(){return ce(this,arguments,-1)}function He(){return ce(this,arguments,1)}function Ve(e,n){return new this(e).mod(n)}function $e(e,n){return new this(e).mul(n)}function Je(e,n){return new this(e).pow(n)}function We(e){var n,i,t,r,s=0,o=new this(1),u=[];if(void 0===e?e=this.precision:K(e,1,O),t=Math.ceil(e/7),this.crypto)if(crypto.getRandomValues)for(n=crypto.getRandomValues(new Uint32Array(t));s<t;)(r=n[s])>=429e7?n[s]=crypto.getRandomValues(new Uint32Array(1))[0]:u[s++]=r%1e7;else{if(!crypto.randomBytes)throw Error(T);for(n=crypto.randomBytes(t*=4);s<t;)(r=n[s]+(n[s+1]<<8)+(n[s+2]<<16)+((127&n[s+3])<<24))>=214e7?crypto.randomBytes(4).copy(n,s):(u.push(r%1e7),s+=4);s=t/4}else for(;s<t;)u[s++]=1e7*Math.random()|0;for(e%=7,(t=u[--s])&&e&&(r=L(10,7-e),u[s]=(t/r|0)*r);0===u[s];s--)u.pop();if(s<0)i=0,u=[0];else{for(i=-1;0===u[0];i-=7)u.shift();for(t=1,r=u[0];r>=10;r/=10)t++;t<7&&(i-=7-t)}return o.e=i,o.d=u,o}function ze(e){return Y(e=new this(e),e.e+1,this.rounding)}function Ke(e){return(e=new this(e)).d?e.d[0]?e.s:0*e.s:e.s||NaN}function Ge(e){return new this(e).sin()}function Qe(e){return new this(e).sinh()}function Xe(e){return new this(e).sqrt()}function Ye(e,n){return new this(e).sub(n)}function en(){var e=0,n=arguments,i=new this(n[e]);for(A=!1;i.s&&++e<n.length;)i=i.plus(n[e]);return A=!0,Y(i,this.precision,this.rounding)}function nn(e){return new this(e).tan()}function tn(e){return new this(e).tanh()}function rn(e){return Y(e=new this(e),e.e+1,1)}W[Symbol.for("nodejs.util.inspect.custom")]=W.toString,W[Symbol.toStringTag]="Decimal";var sn=W.constructor=function e(n){var i,t,r;function s(e){var n,i,t,r=this;if(!(r instanceof s))return new s(e);if(r.constructor=s,Pe(e))return r.s=e.s,void(A?!e.d||e.e>s.maxE?(r.e=NaN,r.d=null):e.e<s.minE?(r.e=0,r.d=[0]):(r.e=e.e,r.d=e.d.slice()):(r.e=e.e,r.d=e.d?e.d.slice():e.d));if("number"===(t=typeof e)){if(0===e)return r.s=1/e<0?-1:1,r.e=0,void(r.d=[0]);if(e<0?(e=-e,r.s=-1):r.s=1,e===~~e&&e<1e7){for(n=0,i=e;i>=10;i/=10)n++;return void(A?n>s.maxE?(r.e=NaN,r.d=null):n<s.minE?(r.e=0,r.d=[0]):(r.e=n,r.d=[e]):(r.e=n,r.d=[e]))}return 0*e!=0?(e||(r.s=NaN),r.e=NaN,void(r.d=null)):de(r,e.toString())}if("string"===t)return 45===(i=e.charCodeAt(0))?(e=e.slice(1),r.s=-1):(43===i&&(e=e.slice(1)),r.s=1),H.test(e)?de(r,e):function(e,n){var i,t,r,s,o,u,c,a,f;if(n.indexOf("_")>-1){if(n=n.replace(/(\d)_(?=\d)/g,"$1"),H.test(n))return de(e,n)}else if("Infinity"===n||"NaN"===n)return+n||(e.s=NaN),e.e=NaN,e.d=null,e;if(j.test(n))i=16,n=n.toLowerCase();else if(I.test(n))i=2;else{if(!B.test(n))throw Error(Z+n);i=8}for((s=n.search(/p/i))>0?(c=+n.slice(s+1),n=n.substring(2,s)):n=n.slice(2),o=(s=n.indexOf("."))>=0,t=e.constructor,o&&(s=(u=(n=n.replace(".","")).length)-s,r=oe(t,new t(i),s,2*s)),s=f=(a=Q(n,i,V)).length-1;0===a[s];--s)a.pop();return s<0?new t(0*e.s):(e.e=ne(a,f),e.d=a,A=!1,o&&(e=X(e,r,4*u)),c&&(e=e.times(Math.abs(c)<54?L(2,c):sn.pow(2,c))),A=!0,e)}(r,e);if("bigint"===t)return e<0?(e=-e,r.s=-1):r.s=1,de(r,e.toString());throw Error(Z+e)}if(s.prototype=W,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=Se,s.clone=e,s.isDecimal=Pe,s.abs=ve,s.acos=Ne,s.acosh=be,s.add=ye,s.asin=xe,s.asinh=Ee,s.atan=Me,s.atanh=_e,s.atan2=qe,s.cbrt=Oe,s.ceil=Ce,s.clamp=Fe,s.cos=ke,s.cosh=Ae,s.div=De,s.exp=Ze,s.floor=Re,s.hypot=Te,s.ln=Ue,s.log=Le,s.log10=je,s.log2=Ie,s.max=Be,s.min=He,s.mod=Ve,s.mul=$e,s.pow=Je,s.random=We,s.round=ze,s.sign=Ke,s.sin=Ge,s.sinh=Qe,s.sqrt=Xe,s.sub=Ye,s.sum=en,s.tan=nn,s.tanh=tn,s.trunc=rn,void 0===n&&(n={}),n&&!0!==n.defaults)for(r=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],i=0;i<r.length;)n.hasOwnProperty(t=r[i++])||(n[t]=this[t]);return s.config(n),s}(k);F=new sn(F),S=new sn(S);export{sn as D,E as _};
|