comercioeletronico-cotacao-api/node_modules/bignumber.js/bignumber.min.js

3 lines
17 KiB
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/* bignumber.js v3.1.2 https://github.com/MikeMcl/bignumber.js/LICENCE */
!function(e){"use strict";function n(e){function h(e,n){var t,r,i,o,u,s,f=this;if(!(f instanceof h))return V&&I(26,"constructor call without new",e),new h(e,n);if(null!=n&&j(n,2,64,C,"base")){if(n=0|n,s=e+"",10==n)return f=new h(e instanceof h?e:s),L(f,P+f.e+1,q);if((o="number"==typeof e)&&0*e!=0||!new RegExp("^-?"+(t="["+N.slice(0,n)+"]+")+"(?:\\."+t+")?$",37>n?"i":"").test(s))return B(f,s,o,n);o?(f.s=0>1/e?(s=s.slice(1),-1):1,V&&s.replace(/^0\.0*|\./,"").length>15&&I(C,v,e),o=!1):f.s=45===s.charCodeAt(0)?(s=s.slice(1),-1):1,s=E(s,10,n,f.s)}else{if(e instanceof h)return f.s=e.s,f.e=e.e,f.c=(e=e.c)?e.slice():e,void(C=0);if((o="number"==typeof e)&&0*e==0){if(f.s=0>1/e?(e=-e,-1):1,e===~~e){for(r=0,i=e;i>=10;i/=10,r++);return f.e=r,f.c=[e],void(C=0)}s=e+""}else{if(!g.test(s=e+""))return B(f,s,o);f.s=45===s.charCodeAt(0)?(s=s.slice(1),-1):1}}for((r=s.indexOf("."))>-1&&(s=s.replace(".","")),(i=s.search(/e/i))>0?(0>r&&(r=i),r+=+s.slice(i+1),s=s.substring(0,i)):0>r&&(r=s.length),i=0;48===s.charCodeAt(i);i++);for(u=s.length;48===s.charCodeAt(--u););if(s=s.slice(i,u+1))if(u=s.length,o&&V&&u>15&&(e>O||e!==d(e))&&I(C,v,f.s*e),r=r-i-1,r>z)f.c=f.e=null;else if(G>r)f.c=[f.e=0];else{if(f.e=r,f.c=[],i=(r+1)%y,0>r&&(i+=y),u>i){for(i&&f.c.push(+s.slice(0,i)),u-=y;u>i;)f.c.push(+s.slice(i,i+=y));s=s.slice(i),i=y-s.length}else i-=u;for(;i--;s+="0");f.c.push(+s)}else f.c=[f.e=0];C=0}function E(e,n,t,i){var o,u,s,l,a,g,p,d=e.indexOf("."),m=P,w=q;for(37>t&&(e=e.toLowerCase()),d>=0&&(s=J,J=0,e=e.replace(".",""),p=new h(t),a=p.pow(e.length-d),J=s,p.c=f(c(r(a.c),a.e),10,n),p.e=p.c.length),g=f(e,t,n),u=s=g.length;0==g[--s];g.pop());if(!g[0])return"0";if(0>d?--u:(a.c=g,a.e=u,a.s=i,a=U(a,p,m,w,n),g=a.c,l=a.r,u=a.e),o=u+m+1,d=g[o],s=n/2,l=l||0>o||null!=g[o+1],l=4>w?(null!=d||l)&&(0==w||w==(a.s<0?3:2)):d>s||d==s&&(4==w||l||6==w&&1&g[o-1]||w==(a.s<0?8:7)),1>o||!g[0])e=l?c("1",-m):"0";else{if(g.length=o,l)for(--n;++g[--o]>n;)g[o]=0,o||(++u,g.unshift(1));for(s=g.length;!g[--s];);for(d=0,e="";s>=d;e+=N.charAt(g[d++]));e=c(e,u)}return e}function D(e,n,t,i){var o,u,s,f,a;if(t=null!=t&&j(t,0,8,i,w)?0|t:q,!e.c)return e.toString();if(o=e.c[0],s=e.e,null==n)a=r(e.c),a=19==i||24==i&&k>=s?l(a,s):c(a,s);else if(e=L(new h(e),n,t),u=e.e,a=r(e.c),f=a.length,19==i||24==i&&(u>=n||k>=u)){for(;n>f;a+="0",f++);a=l(a,u)}else if(n-=s,a=c(a,u),u+1>f){if(--n>0)for(a+=".";n--;a+="0");}else if(n+=u-f,n>0)for(u+1==f&&(a+=".");n--;a+="0");return e.s<0&&o?"-"+a:a}function F(e,n){var t,r,i=0;for(u(e[0])&&(e=e[0]),t=new h(e[0]);++i<e.length;){if(r=new h(e[i]),!r.s){t=r;break}n.call(t,r)&&(t=r)}return t}function _(e,n,t,r,i){return(n>e||e>t||e!=a(e))&&I(r,(i||"decimal places")+(n>e||e>t?" out of range":" not an integer"),e),!0}function x(e,n,t){for(var r=1,i=n.length;!n[--i];n.pop());for(i=n[0];i>=10;i/=10,r++);return(t=r+t*y-1)>z?e.c=e.e=null:G>t?e.c=[e.e=0]:(e.e=t,e.c=n),e}function I(e,n,t){var r=new Error(["new BigNumber","cmp","config","div","divToInt","eq","gt","gte","lt","lte","minus","mod","plus","precision","random","round","shift","times","toDigits","toExponential","toFixed","toFormat","toFraction","pow","toPrecision","toString","BigNumber"][e]+"() "+n+": "+t);throw r.name="BigNumber Error",C=0,r}function L(e,n,t,r){var i,o,u,s,f,l,c,a=e.c,h=R;if(a){e:{for(i=1,s=a[0];s>=10;s/=10,i++);if(o=n-i,0>o)o+=y,u=n,f=a[l=0],c=f/h[i-u-1]%10|0;else if(l=p((o+1)/y),l>=a.length){if(!r)break e;for(;a.length<=l;a.push(0));f=c=0,i=1,o%=y,u=o-y+1}else{for(f=s=a[l],i=1;s>=10;s/=10,i++);o%=y,u=o-y+i,c=0>u?0:f/h[i-u-1]%10|0}if(r=r||0>n||null!=a[l+1]||(0>u?f:f%h[i-u-1]),r=4>t?(c||r)&&(0==t||t==(e.s<0?3:2)):c>5||5==c&&(4==t||r||6==t&&(o>0?u>0?f/h[i-u]:0:a[l-1])%10&1||t==(e.s<0?8:7)),1>n||!a[0])return a.length=0,r?(n-=e.e+1,a[0]=h[(y-n%y)%y],e.e=-n||0):a[0]=e.e=0,e;if(0==o?(a.length=l,s=1,l--):(a.length=l+1,s=h[y-o],a[l]=u>0?d(f/h[i-u]%h[u])*s:0),r)for(;;){if(0==l){for(o=1,u=a[0];u>=10;u/=10,o++);for(u=a[0]+=s,s=1;u>=10;u/=10,s++);o!=s&&(e.e++,a[0]==b&&(a[0]=1));break}if(a[l]+=s,a[l]!=b)break;a[l--]=0,s=1}for(o=a.length;0===a[--o];a.pop());}e.e>z?e.c=e.e=null:e.e<G&&(e.c=[e.e=0])}return e}var U,B,C=0,M=h.prototype,T=new h(1),P=20,q=4,k=-7,$=21,G=-1e7,z=1e7,V=!0,j=_,H=!1,W=1,J=0,X={decimalSeparator:".",groupSeparator:",",groupSize:3,secondaryGroupSize:0,fractionGroupSeparator:" ",fractionGroupSize:0};return h.another=n,h.ROUND_UP=0,h.ROUND_DOWN=1,h.ROUND_CEIL=2,h.ROUND_FLOOR=3,h.ROUND_HALF_UP=4,h.ROUND_HALF_DOWN=5,h.ROUND_HALF_EVEN=6,h.ROUND_HALF_CEIL=7,h.ROUND_HALF_FLOOR=8,h.EUCLID=9,h.config=h.set=function(){var e,n,t=0,r={},i=arguments,s=i[0],f=s&&"object"==typeof s?function(){return s.hasOwnProperty(n)?null!=(e=s[n]):void 0}:function(){return i.length>t?null!=(e=i[t++]):void 0};return f(n="DECIMAL_PLACES")&&j(e,0,A,2,n)&&(P=0|e),r[n]=P,f(n="ROUNDING_MODE")&&j(e,0,8,2,n)&&(q=0|e),r[n]=q,f(n="EXPONENTIAL_AT")&&(u(e)?j(e[0],-A,0,2,n)&&j(e[1],0,A,2,n)&&(k=0|e[0],$=0|e[1]):j(e,-A,A,2,n)&&(k=-($=0|(0>e?-e:e)))),r[n]=[k,$],f(n="RANGE")&&(u(e)?j(e[0],-A,-1,2,n)&&j(e[1],1,A,2,n)&&(G=0|e[0],z=0|e[1]):j(e,-A,A,2,n)&&(0|e?G=-(z=0|(0>e?-e:e)):V&&I(2,n+" cannot be zero",e))),r[n]=[G,z],f(n="ERRORS")&&(e===!!e||1===e||0===e?(C=0,j=(V=!!e)?_:o):V&&I(2,n+m,e)),r[n]=V,f(n="CRYPTO")&&(e===!0||e===!1||1===e||0===e?e?(e="undefined"==typeof crypto,!e&&crypto&&(crypto.getRandomValues||crypto.randomBytes)?H=!0:V?I(2,"crypto unavailable",e?void 0:crypto):H=!1):H=!1:V&&I(2,n+m,e)),r[n]=H,f(n="MODULO_MODE")&&j(e,0,9,2,n)&&(W=0|e),r[n]=W,f(n="POW_PRECISION")&&j(e,0,A,2,n)&&(J=0|e),r[n]=J,f(n="FORMAT")&&("object"==typeof e?X=e:V&&I(2,n+" not an object",e)),r[n]=X,r},h.isBigNumber=s,h.max=function(){return F(arguments,M.lt)},h.min=function(){return F(arguments,M.gt)},h.random=function(){var e=9007199254740992,n=Math.random()*e&2097151?function(){return d(Math.random()*e)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)};return function(e){var t,r,i,o,u,s=0,f=[],l=new h(T);if(e=null!=e&&j(e,0,A,14)?0|e:P,o=p(e/y),H)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(o*=2));o>s;)u=131072*t[s]+(t[s+1]>>>11),u>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),t[s]=r[0],t[s+1]=r[1]):(f.push(u%1e14),s+=2);s=o/2}else if(crypto.randomBytes){for(t=crypto.randomBytes(o*=7);o>s;)u=281474976710656*(31&t[s])+1099511627776*t[s+1]+4294967296*t[s+2]+16777216*t[s+3]+(t[s+4]<<16)+(t[s+5]<<8)+t[s+6],u>=9e15?crypto.randomBytes(7).copy(t,s):(f.push(u%1e14),s+=7);s=o/7}else H=!1,V&&I(14,"crypto unavailable",crypto);if(!H)for(;o>s;)u=n(),9e15>u&&(f[s++]=u%1e14);for(o=f[--s],e%=y,o&&e&&(u=R[y-e],f[s]=d(o/u)*u);0===f[s];f.pop(),s--);if(0>s)f=[i=0];else{for(i=-1;0===f[0];f.shift(),i-=y);for(s=1,u=f[0];u>=10;u/=10,s++);y>s&&(i-=y-s)}return l.e=i,l.c=f,l}}(),U=function(){function e(e,n,t){var r,i,o,u,s=0,f=e.length,l=n%S,c=n/S|0;for(e=e.slice();f--;)o=e[f]%S,u=e[f]/S|0,r=c*o+u*l,i=l*o+r%S*S+s,s=(i/t|0)+(r/S|0)+c*u,e[f]=i%t;return s&&e.unshift(s),e}function n(e,n,t,r){var i,o;if(t!=r)o=t>r?1:-1;else for(i=o=0;t>i;i++)if(e[i]!=n[i]){o=e[i]>n[i]?1:-1;break}return o}function r(e,n,t,r){for(var i=0;t--;)e[t]-=i,i=e[t]<n[t]?1:0,e[t]=i*r+e[t]-n[t];for(;!e[0]&&e.length>1;e.shift());}return function(i,o,u,s,f){var l,c,a,g,p,m,w,v,N,O,R,S,A,E,D,F,_,x=i.s==o.s?1:-1,I=i.c,U=o.c;if(!(I&&I[0]&&U&&U[0]))return new h(i.s&&o.s&&(I?!U||I[0]!=U[0]:U)?I&&0==I[0]||!U?0*x:x/0:NaN);for(v=new h(x),N=v.c=[],c=i.e-o.e,x=u+c+1,f||(f=b,c=t(i.e/y)-t(o.e/y),x=x/y|0),a=0;U[a]==(I[a]||0);a++);if(U[a]>(I[a]||0)&&c--,0>x)N.push(1),g=!0;else{for(E=I.length,F=U.length,a=0,x+=2,p=d(f/(U[0]+1)),p>1&&(U=e(U,p,f),I=e(I,p,f),F=U.length,E=I.length),A=F,O=I.slice(0,F),R=O.length;F>R;O[R++]=0);_=U.slice(),_.unshift(0),D=U[0],U[1]>=f/2&&D++;do{if(p=0,l=n(U,O,F,R),0>l){if(S=O[0],F!=R&&(S=S*f+(O[1]||0)),p=d(S/D),p>1)for(p>=f&&(p=f-1),m=e(U,p,f),w=m.length,R=O.length;1==n(m,O,w,R);)p--,r(m,w>F?_:U,w,f),w=m.length,l=1;else 0==p&&(l=p=1),m=U.slice(),w=m.length;if(R>w&&m.unshift(0),r(O,m,R,f),R=O.length,-1==l)for(;n(U,O,F,R)<1;)p++,r(O,R>F?_:U,R,f),R=O.length}else 0===l&&(p++,O=[0]);N[a++]=p,O[0]?O[R++]=I[A]||0:(O=[I[A]],R=1)}while((A++<E||null!=O[0])&&x--);g=null!=O[0],N[0]||N.shift()}if(f==b){for(a=1,x=N[0];x>=10;x/=10,a++);L(v,u+(v.e=a+c*y-1)+1,s,g)}else v.e=c,v.r=+g;return v}}(),B=function(){var e=/^(-?)0([xbo])(?=\w[\w.]*$)/i,n=/^([^.]+)\.$/,t=/^\.([^.]+)$/,r=/^-?(Infinity|NaN)$/,i=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(o,u,s,f){var l,c=s?u:u.replace(i,"");if(r.test(c))o.s=isNaN(c)?null:0>c?-1:1;else{if(!s&&(c=c.replace(e,function(e,n,t){return l="x"==(t=t.toLowerCase())?16:"b"==t?2:8,f&&f!=l?e:n}),f&&(l=f,c=c.replace(n,"$1").replace(t,"0.$1")),u!=c))return new h(c,l);V&&I(C,"not a"+(f?" base "+f:"")+" number",u),o.s=null}o.c=o.e=null,C=0}}(),M.absoluteValue=M.abs=function(){var e=new h(this);return e.s<0&&(e.s=1),e},M.ceil=function(){return L(new h(this),this.e+1,2)},M.comparedTo=M.cmp=function(e,n){return C=1,i(this,new h(e,n))},M.decimalPlaces=M.dp=function(){var e,n,r=this.c;if(!r)return null;if(e=((n=r.length-1)-t(this.e/y))*y,n=r[n])for(;n%10==0;n/=10,e--);return 0>e&&(e=0),e},M.dividedBy=M.div=function(e,n){return C=3,U(this,new h(e,n),P,q)},M.dividedToIntegerBy=M.divToInt=function(e,n){return C=4,U(this,new h(e,n),0,1)},M.equals=M.eq=function(e,n){return C=5,0===i(this,new h(e,n))},M.floor=function(){return L(new h(this),this.e+1,3)},M.greaterThan=M.gt=function(e,n){return C=6,i(this,new h(e,n))>0},M.greaterThanOrEqualTo=M.gte=function(e,n){return C=7,1===(n=i(this,new h(e,n)))||0===n},M.isFinite=function(){return!!this.c},M.isInteger=M.isInt=function(){return!!this.c&&t(this.e/y)>this.c.length-2},M.isNaN=function(){return!this.s},M.isNegative=M.isNeg=function(){return this.s<0},M.isZero=function(){return!!this.c&&0==this.c[0]},M.lessThan=M.lt=function(e,n){return C=8,i(this,new h(e,n))<0},M.lessThanOrEqualTo=M.lte=function(e,n){return C=9,-1===(n=i(this,new h(e,n)))||0===n},M.minus=M.sub=function(e,n){var r,i,o,u,s=this,f=s.s;if(C=10,e=new h(e,n),n=e.s,!f||!n)return new h(NaN);if(f!=n)return e.s=-n,s.plus(e);var l=s.e/y,c=e.e/y,a=s.c,g=e.c;if(!l||!c){if(!a||!g)return a?(e.s=-n,e):new h(g?s:NaN);if(!a[0]||!g[0])return g[0]?(e.s=-n,e):new h(a[0]?s:3==q?-0:0)}if(l=t(l),c=t(c),a=a.slice(),f=l-c){for((u=0>f)?(f=-f,o=a):(c=l,o=g),o.reverse(),n=f;n--;o.push(0));o.reverse()}else for(i=(u=(f=a.length)<(n=g.length))?f:n,f=n=0;i>n;n++)if(a[n]!=g[n]){u=a[n]<g[n];break}if(u&&(o=a,a=g,g=o,e.s=-e.s),n=(i=g.length)-(r=a.length),n>0)for(;n--;a[r++]=0);for(n=b-1;i>f;){if(a[--i]<g[i]){for(r=i;r&&!a[--r];a[r]=n);--a[r],a[i]+=b}a[i]-=g[i]}for(;0==a[0];a.shift(),--c);return a[0]?x(e,a,c):(e.s=3==q?-1:1,e.c=[e.e=0],e)},M.modulo=M.mod=function(e,n){var t,r,i=this;return C=11,e=new h(e,n),!i.c||!e.s||e.c&&!e.c[0]?new h(NaN):!e.c||i.c&&!i.c[0]?new h(i):(9==W?(r=e.s,e.s=1,t=U(i,e,0,3),e.s=r,t.s*=r):t=U(i,e,0,W),i.minus(t.times(e)))},M.negated=M.neg=function(){var e=new h(this);return e.s=-e.s||null,e},M.plus=M.add=function(e,n){var r,i=this,o=i.s;if(C=12,e=new h(e,n),n=e.s,!o||!n)return new h(NaN);if(o!=n)return e.s=-n,i.minus(e);var u=i.e/y,s=e.e/y,f=i.c,l=e.c;if(!u||!s){if(!f||!l)return new h(o/0);if(!f[0]||!l[0])return l[0]?e:new h(f[0]?i:0*o)}if(u=t(u),s=t(s),f=f.slice(),o=u-s){for(o>0?(s=u,r=l):(o=-o,r=f),r.reverse();o--;r.push(0));r.reverse()}for(o=f.length,n=l.length,0>o-n&&(r=l,l=f,f=r,n=o),o=0;n;)o=(f[--n]=f[n]+l[n]+o)/b|0,f[n]=b===f[n]?0:f[n]%b;return o&&(f.unshift(o),++s),x(e,f,s)},M.precision=M.sd=function(e){var n,t,r=this,i=r.c;if(null!=e&&e!==!!e&&1!==e&&0!==e&&(V&&I(13,"argument"+m,e),e!=!!e&&(e=null)),!i)return null;if(t=i.length-1,n=t*y+1,t=i[t]){for(;t%10==0;t/=10,n--);for(t=i[0];t>=10;t/=10,n++);}return e&&r.e+1>n&&(n=r.e+1),n},M.round=function(e,n){var t=new h(this);return(null==e||j(e,0,A,15))&&L(t,~~e+this.e+1,null!=n&&j(n,0,8,15,w)?0|n:q),t},M.shift=function(e){var n=this;return j(e,-O,O,16,"argument")?n.times("1e"+a(e)):new h(n.c&&n.c[0]&&(-O>e||e>O)?n.s*(0>e?0:1/0):n)},M.squareRoot=M.sqrt=function(){var e,n,i,o,u,s=this,f=s.c,l=s.s,c=s.e,a=P+4,g=new h("0.5");if(1!==l||!f||!f[0])return new h(!l||0>l&&(!f||f[0])?NaN:f?s:1/0);if(l=Math.sqrt(+s),0==l||l==1/0?(n=r(f),(n.length+c)%2==0&&(n+="0"),l=Math.sqrt(n),c=t((c+1)/2)-(0>c||c%2),l==1/0?n="1e"+c:(n=l.toExponential(),n=n.slice(0,n.indexOf("e")+1)+c),i=new h(n)):i=new h(l+""),i.c[0])for(c=i.e,l=c+a,3>l&&(l=0);;)if(u=i,i=g.times(u.plus(U(s,u,a,1))),r(u.c).slice(0,l)===(n=r(i.c)).slice(0,l)){if(i.e<c&&--l,n=n.slice(l-3,l+1),"9999"!=n&&(o||"4999"!=n)){(!+n||!+n.slice(1)&&"5"==n.charAt(0))&&(L(i,i.e+P+2,1),e=!i.times(i).eq(s));break}if(!o&&(L(u,u.e+P+2,0),u.times(u).eq(s))){i=u;break}a+=4,l+=4,o=1}return L(i,i.e+P+1,q,e)},M.times=M.mul=function(e,n){var r,i,o,u,s,f,l,c,a,g,p,d,m,w,v,N=this,O=N.c,R=(C=17,e=new h(e,n)).c;if(!(O&&R&&O[0]&&R[0]))return!N.s||!e.s||O&&!O[0]&&!R||R&&!R[0]&&!O?e.c=e.e=e.s=null:(e.s*=N.s,O&&R?(e.c=[0],e.e=0):e.c=e.e=null),e;for(i=t(N.e/y)+t(e.e/y),e.s*=N.s,l=O.length,g=R.length,g>l&&(m=O,O=R,R=m,o=l,l=g,g=o),o=l+g,m=[];o--;m.push(0));for(w=b,v=S,o=g;--o>=0;){for(r=0,p=R[o]%v,d=R[o]/v|0,s=l,u=o+s;u>o;)c=O[--s]%v,a=O[s]/v|0,f=d*c+a*p,c=p*c+f%v*v+m[u]+r,r=(c/w|0)+(f/v|0)+d*a,m[u--]=c%w;m[u]=r}return r?++i:m.shift(),x(e,m,i)},M.toDigits=function(e,n){var t=new h(this);return e=null!=e&&j(e,1,A,18,"precision")?0|e:null,n=null!=n&&j(n,0,8,18,w)?0|n:q,e?L(t,e,n):t},M.toExponential=function(e,n){return D(this,null!=e&&j(e,0,A,19)?~~e+1:null,n,19)},M.toFixed=function(e,n){return D(this,null!=e&&j(e,0,A,20)?~~e+this.e+1:null,n,20)},M.toFormat=function(e,n){var t=D(this,null!=e&&j(e,0,A,21)?~~e+this.e+1:null,n,21);if(this.c){var r,i=t.split("."),o=+X.groupSize,u=+X.secondaryGroupSize,s=X.groupSeparator,f=i[0],l=i[1],c=this.s<0,a=c?f.slice(1):f,h=a.length;if(u&&(r=o,o=u,u=r,h-=r),o>0&&h>0){for(r=h%o||o,f=a.substr(0,r);h>r;r+=o)f+=s+a.substr(r,o);u>0&&(f+=s+a.slice(r)),c&&(f="-"+f)}t=l?f+X.decimalSeparator+((u=+X.fractionGroupSize)?l.replace(new RegExp("\\d{"+u+"}\\B","g"),"$&"+X.fractionGroupSeparator):l):f}return t},M.toFraction=function(e){var n,t,i,o,u,s,f,l,c,a=V,g=this,p=g.c,d=new h(T),m=t=new h(T),w=f=new h(T);if(null!=e&&(V=!1,s=new h(e),V=a,(!(a=s.isInt())||s.lt(T))&&(V&&I(22,"max denominator "+(a?"out of range":"not an integer"),e),e=!a&&s.c&&L(s,s.e+1,1).gte(T)?s:null)),!p)return g.toString();for(c=r(p),o=d.e=c.length-g.e-1,d.c[0]=R[(u=o%y)<0?y+u:u],e=!e||s.cmp(d)>0?o>0?d:m:s,u=z,z=1/0,s=new h(c),f.c[0]=0;l=U(s,d,0,1),i=t.plus(l.times(w)),1!=i.cmp(e);)t=w,w=i,m=f.plus(l.times(i=m)),f=i,d=s.minus(l.times(i=d)),s=i;return i=U(e.minus(t),w,0,1),f=f.plus(i.times(m)),t=t.plus(i.times(w)),f.s=m.s=g.s,o*=2,n=U(m,w,o,q).minus(g).abs().cmp(U(f,t,o,q).minus(g).abs())<1?[m.toString(),w.toString()]:[f.toString(),t.toString()],z=u,n},M.toNumber=function(){return+this},M.toPower=M.pow=function(e,n){var t,r,i,o=d(0>e?-e:+e),u=this;if(null!=n&&(C=23,n=new h(n)),!j(e,-O,O,23,"exponent")&&(!isFinite(e)||o>O&&(e/=0)||parseFloat(e)!=e&&!(e=NaN))||0==e)return t=Math.pow(+u,e),new h(n?t%n:t);for(n?e>1&&u.gt(T)&&u.isInt()&&n.gt(T)&&n.isInt()?u=u.mod(n):(i=n,n=null):J&&(t=p(J/y+2)),r=new h(T);;){if(o%2){if(r=r.times(u),!r.c)break;t?r.c.length>t&&(r.c.length=t):n&&(r=r.mod(n))}if(o=d(o/2),!o)break;u=u.times(u),t?u.c&&u.c.length>t&&(u.c.length=t):n&&(u=u.mod(n))}return n?r:(0>e&&(r=T.div(r)),i?r.mod(i):t?L(r,J,q):r)},M.toPrecision=function(e,n){return D(this,null!=e&&j(e,1,A,24,"precision")?0|e:null,n,24)},M.toString=function(e){var n,t=this,i=t.s,o=t.e;return null===o?i?(n="Infinity",0>i&&(n="-"+n)):n="NaN":(n=r(t.c),n=null!=e&&j(e,2,64,25,"base")?E(c(n,o),0|e,10,i):k>=o||o>=$?l(n,o):c(n,o),0>i&&t.c[0]&&(n="-"+n)),n},M.truncated=M.trunc=function(){return L(new h(this),this.e+1,1)},M.valueOf=M.toJSON=function(){var e,n=this,t=n.e;return null===t?n.toString():(e=r(n.c),e=k>=t||t>=$?l(e,t):c(e,t),n.s<0?"-"+e:e)},null!=e&&h.config(e),h}function t(e){var n=0|e;return e>0||e===n?n:n-1}function r(e){for(var n,t,r=1,i=e.length,o=e[0]+"";i>r;){for(n=e[r++]+"",t=y-n.length;t--;n="0"+n);o+=n}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function i(e,n){var t,r,i=e.c,o=n.c,u=e.s,s=n.s,f=e.e,l=n.e;if(!u||!s)return null;if(t=i&&!i[0],r=o&&!o[0],t||r)return t?r?0:-s:u;if(u!=s)return u;if(t=0>u,r=f==l,!i||!o)return r?0:!i^t?1:-1;if(!r)return f>l^t?1:-1;for(s=(f=i.length)<(l=o.length)?f:l,u=0;s>u;u++)if(i[u]!=o[u])return i[u]>o[u]^t?1:-1;return f==l?0:f>l^t?1:-1}function o(e,n,t){return(e=a(e))>=n&&t>=e}function u(e){return"[object Array]"==Object.prototype.toString.call(e)}function s(e){return!(!e||!e.constructor||e.constructor.isBigNumber!==s)}function f(e,n,t){for(var r,i,o=[0],u=0,s=e.length;s>u;){for(i=o.length;i--;o[i]*=n);for(o[r=0]+=N.indexOf(e.charAt(u++));r<o.length;r++)o[r]>t-1&&(null==o[r+1]&&(o[r+1]=0),o[r+1]+=o[r]/t|0,o[r]%=t)}return o.reverse()}function l(e,n){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(0>n?"e":"e+")+n}function c(e,n){var t,r;if(0>n){for(r="0.";++n;r+="0");e=r+e}else if(t=e.length,++n>t){for(r="0",n-=t;--n;r+="0");e+=r}else t>n&&(e=e.slice(0,n)+"."+e.slice(n));return e}function a(e){return e=parseFloat(e),0>e?p(e):d(e)}var h,g=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,p=Math.ceil,d=Math.floor,m=" not a boolean or binary digit",w="rounding mode",v="number type has more than 15 significant digits",N="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_",b=1e14,y=14,O=9007199254740991,R=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],S=1e7,A=1e9;h=n(),h["default"]=h.BigNumber=h,"function"==typeof define&&define.amd?define(function(){return h}):"undefined"!=typeof module&&module.exports?module.exports=h:(e||(e="undefined"!=typeof self?self:Function("return this")()),e.BigNumber=h)}(this);
//# sourceMappingURL=bignumber.js.map