>16&255,a[c++]=i>>8&255,a[c++]=255&i;return 2===s?(i=o[e.charCodeAt(t)]<<2|o[e.charCodeAt(t+1)]>>4,a[c++]=255&i):1===s&&(i=o[e.charCodeAt(t)]<<10|o[e.charCodeAt(t+1)]<<4|o[e.charCodeAt(t+2)]>>2,a[c++]=i>>8&255,a[c++]=255&i),a},r.fromByteArray=function(e){for(var t,r=e.length,n=r%3,i="",o=[],u=0,l=r-n;ul?l:u+16383));return 1===n?(t=e[r-1],i+=a[t>>2],i+=a[t<<4&63],i+="=="):2===n&&(t=(e[r-2]<<8)+e[r-1],i+=a[t>>10],i+=a[t>>4&63],i+=a[t<<2&63],i+="="),o.push(i),o.join("")};for(var a=[],o=[],u="undefined"!=typeof Uint8Array?Uint8Array:Array,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",c=0,p=l.length;c=t}function c(e,t){var r=[],i=h("{","}",e);if(!i||/\$$/.test(i.pre))return[e];var f=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body),d=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body),y=f||d,g=i.body.indexOf(",")>=0;if(!y&&!g)return i.post.match(/,.*\}/)?(e=i.pre+"{"+i.body+m+i.post,c(e)):[e];var b;if(y)b=i.body.split(/\.\./);else if(1===(b=s(i.body)).length&&1===(b=c(b[0],!1).map(a)).length){return(E=i.post.length?c(i.post,!1):[""]).map(function(e){return i.pre+b[0]+e})}var v,x=i.pre,E=i.post.length?c(i.post,!1):[""];if(y){var A=n(b[0]),D=n(b[1]),S=Math.max(b[0].length,b[1].length),C=3==b.length?Math.abs(n(b[2])):1,_=u;D0){var P=new Array(T+1).join("0");F=k<0?"-"+P+F.slice(1):P+F}}v.push(F)}}else v=p(b,function(e){return c(e,!1)});for(var B=0;Bj)throw new RangeError("Invalid typed array length");var t=new Uint8Array(e);return t.__proto__=i.prototype,t}function i(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return o(e)}return s(e,t,r)}function s(e,t,r){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return T(e)?function(e,t,r){if(t<0||e.byteLength=j)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+j.toString(16)+" bytes");return 0|e}function c(e,t){if(i.isBuffer(e))return e.length;if(P(e)||T(e))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return w(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return k(e).length;default:if(n)return w(e).length;t=(""+t).toLowerCase(),n=!0}}function p(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,t>>>=0,r<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,r){var n=e.length;(!t||t<0)&&(t=0);(!r||r<0||r>n)&&(r=n);for(var i="",s=t;s2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,B(r)&&(r=s?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(s)return-1;r=e.length-1}else if(r<0){if(!s)return-1;r=0}if("string"==typeof t&&(t=i.from(t,n)),i.isBuffer(t))return 0===t.length?-1:d(e,t,r,n,s);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?s?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):d(e,[t],r,n,s);throw new TypeError("val must be string, number or Buffer")}function d(e,t,r,n,i){function s(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}var a=1,o=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;a=2,o/=2,u/=2,r/=2}var l;if(i){var c=-1;for(l=r;lo&&(r=o-u),l=r;l>=0;l--){for(var p=!0,h=0;hi&&(n=i):n=i;var s=t.length;if(s%2!=0)throw new TypeError("Invalid hex string");n>s/2&&(n=s/2);for(var a=0;a>8,i=r%256,s.push(i),s.push(n);return s}(t,e.length-r),e,r,n)}function E(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i239?4:s>223?3:s>191?2:1;if(i+o<=r){var u,l,c,p;switch(o){case 1:s<128&&(a=s);break;case 2:128==(192&(u=e[i+1]))&&(p=(31&s)<<6|63&u)>127&&(a=p);break;case 3:u=e[i+1],l=e[i+2],128==(192&u)&&128==(192&l)&&(p=(15&s)<<12|(63&u)<<6|63&l)>2047&&(p<55296||p>57343)&&(a=p);break;case 4:u=e[i+1],l=e[i+2],c=e[i+3],128==(192&u)&&128==(192&l)&&128==(192&c)&&(p=(15&s)<<18|(63&u)<<12|(63&l)<<6|63&c)>65535&&p<1114112&&(a=p)}}null===a?(a=65533,o=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|1023&a),n.push(a),i+=o}return function(e){var t=e.length;if(t<=I)return String.fromCharCode.apply(String,e);var r="",n=0;for(;nr)throw new RangeError("Trying to access beyond buffer length")}function D(e,t,r,n,s,a){if(!i.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>s||te.length)throw new RangeError("Index out of range")}function S(e,t,r,n,i,s){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function C(e,t,r,n,i){return t=+t,r>>>=0,i||S(e,0,r,4),N.write(e,t,r,n,23,4),r+4}function _(e,t,r,n,i){return t=+t,r>>>=0,i||S(e,0,r,8),N.write(e,t,r,n,52,8),r+8}function w(e,t){t=t||1/0;for(var r,n=e.length,i=null,s=[],a=0;a55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(a+1===n){(t-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&s.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;s.push(r)}else if(r<2048){if((t-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function k(e){return O.toByteArray(function(e){if((e=e.trim().replace(L,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function F(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function T(e){return e instanceof ArrayBuffer||null!=e&&null!=e.constructor&&"ArrayBuffer"===e.constructor.name&&"number"==typeof e.byteLength}function P(e){return"function"==typeof ArrayBuffer.isView&&ArrayBuffer.isView(e)}function B(e){return e!=e}var O=e("base64-js"),N=e("ieee754");r.Buffer=i,r.SlowBuffer=function(e){return+e!=e&&(e=0),i.alloc(+e)},r.INSPECT_MAX_BYTES=50;var j=2147483647;r.kMaxLength=j,(i.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()}catch(e){return!1}}())||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),i.poolSize=8192,i.from=function(e,t,r){return s(e,t,r)},i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,i.alloc=function(e,t,r){return function(e,t,r){return a(e),e<=0?n(e):void 0!==t?"string"==typeof r?n(e).fill(t,r):n(e).fill(t):n(e)}(e,t,r)},i.allocUnsafe=function(e){return o(e)},i.allocUnsafeSlow=function(e){return o(e)},i.isBuffer=function(e){return null!=e&&!0===e._isBuffer},i.compare=function(e,t){if(!i.isBuffer(e)||!i.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,s=0,a=Math.min(r,n);s0&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),""},i.prototype.compare=function(e,t,r,n,s){if(!i.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===s&&(s=this.length),t<0||r>e.length||n<0||s>this.length)throw new RangeError("out of range index");if(n>=s&&t>=r)return 0;if(n>=s)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,s>>>=0,this===e)return 0;for(var a=s-n,o=r-t,u=Math.min(a,o),l=this.slice(n,s),c=e.slice(t,r),p=0;p>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var s=!1;;)switch(n){case"hex":return m(this,e,t,r);case"utf8":case"utf-8":return y(this,e,t,r);case"ascii":return g(this,e,t,r);case"latin1":case"binary":return b(this,e,t,r);case"base64":return v(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,e,t,r);default:if(s)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),s=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var I=4096;i.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,r||A(e,t,this.length);for(var n=this[e],i=1,s=0;++s>>=0,t>>>=0,r||A(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},i.prototype.readUInt8=function(e,t){return e>>>=0,t||A(e,1,this.length),this[e]},i.prototype.readUInt16LE=function(e,t){return e>>>=0,t||A(e,2,this.length),this[e]|this[e+1]<<8},i.prototype.readUInt16BE=function(e,t){return e>>>=0,t||A(e,2,this.length),this[e]<<8|this[e+1]},i.prototype.readUInt32LE=function(e,t){return e>>>=0,t||A(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},i.prototype.readUInt32BE=function(e,t){return e>>>=0,t||A(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},i.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||A(e,t,this.length);for(var n=this[e],i=1,s=0;++s=i&&(n-=Math.pow(2,8*t)),n},i.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||A(e,t,this.length);for(var n=t,i=1,s=this[e+--n];n>0&&(i*=256);)s+=this[e+--n]*i;return i*=128,s>=i&&(s-=Math.pow(2,8*t)),s},i.prototype.readInt8=function(e,t){return e>>>=0,t||A(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},i.prototype.readInt16LE=function(e,t){e>>>=0,t||A(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt16BE=function(e,t){e>>>=0,t||A(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt32LE=function(e,t){return e>>>=0,t||A(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},i.prototype.readInt32BE=function(e,t){return e>>>=0,t||A(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},i.prototype.readFloatLE=function(e,t){return e>>>=0,t||A(e,4,this.length),N.read(this,e,!0,23,4)},i.prototype.readFloatBE=function(e,t){return e>>>=0,t||A(e,4,this.length),N.read(this,e,!1,23,4)},i.prototype.readDoubleLE=function(e,t){return e>>>=0,t||A(e,8,this.length),N.read(this,e,!0,52,8)},i.prototype.readDoubleBE=function(e,t){return e>>>=0,t||A(e,8,this.length),N.read(this,e,!1,52,8)},i.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t>>>=0,r>>>=0,!n){D(this,e,t,r,Math.pow(2,8*r)-1,0)}var i=1,s=0;for(this[t]=255&e;++s>>=0,r>>>=0,!n){D(this,e,t,r,Math.pow(2,8*r)-1,0)}var i=r-1,s=1;for(this[t+i]=255&e;--i>=0&&(s*=256);)this[t+i]=e/s&255;return t+r},i.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||D(this,e,t,1,255,0),this[t]=255&e,t+1},i.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||D(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},i.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||D(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},i.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||D(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},i.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||D(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},i.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);D(this,e,t,r,i-1,-i)}var s=0,a=1,o=0;for(this[t]=255&e;++s>0)-o&255;return t+r},i.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);D(this,e,t,r,i-1,-i)}var s=r-1,a=1,o=0;for(this[t+s]=255&e;--s>=0&&(a*=256);)e<0&&0===o&&0!==this[t+s+1]&&(o=1),this[t+s]=(e/a>>0)-o&255;return t+r},i.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||D(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},i.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||D(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},i.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||D(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},i.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||D(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},i.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||D(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},i.prototype.writeFloatLE=function(e,t,r){return C(this,e,t,!0,r)},i.prototype.writeFloatBE=function(e,t,r){return C(this,e,t,!1,r)},i.prototype.writeDoubleLE=function(e,t,r){return _(this,e,t,!0,r)},i.prototype.writeDoubleBE=function(e,t,r){return _(this,e,t,!1,r)},i.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--i)e[i+t]=this[i+r];else if(s<1e3)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,e||(e=0);var a;if("number"==typeof e)for(a=t;ac;)if((o=u[c++])!=o)return!0}else for(;l>c;c++)if((e||c in u)&&u[c]===r)return e||c||0;return!e&&-1}}},{"./_to-absolute-index":275,"./_to-iobject":277,"./_to-length":278}],216:[function(e,t,r){var n=e("./_ctx"),i=e("./_iobject"),s=e("./_to-object"),a=e("./_to-length"),o=e("./_array-species-create");t.exports=function(e,t){var r=1==e,u=2==e,l=3==e,c=4==e,p=6==e,h=5==e||p,f=t||o;return function(t,o,d){for(var m,y,g=s(t),b=i(g),v=n(o,d,3),x=a(b.length),E=0,A=r?f(t,x):u?f(t,0):void 0;x>E;E++)if((h||E in b)&&(m=b[E],y=v(m,E,g),e))if(r)A[E]=y;else if(y)switch(e){case 3:return!0;case 5:return m;case 6:return E;case 2:A.push(m)}else if(c)return!1;return p?-1:l||c?c:A}}},{"./_array-species-create":218,"./_ctx":226,"./_iobject":240,"./_to-length":278,"./_to-object":279}],217:[function(e,t,r){var n=e("./_is-object"),i=e("./_is-array"),s=e("./_wks")("species");t.exports=function(e){var t;return i(e)&&("function"!=typeof(t=e.constructor)||t!==Array&&!i(t.prototype)||(t=void 0),n(t)&&null===(t=t[s])&&(t=void 0)),void 0===t?Array:t}},{"./_is-array":242,"./_is-object":243,"./_wks":285}],218:[function(e,t,r){var n=e("./_array-species-constructor");t.exports=function(e,t){return new(n(e))(t)}},{"./_array-species-constructor":217}],219:[function(e,t,r){var n=e("./_cof"),i=e("./_wks")("toStringTag"),s="Arguments"==n(function(){return arguments}());t.exports=function(e){var t,r,a;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(e){}}(t=Object(e),i))?r:s?n(t):"Object"==(a=n(t))&&"function"==typeof t.callee?"Arguments":a}},{"./_cof":220,"./_wks":285}],220:[function(e,t,r){var n={}.toString;t.exports=function(e){return n.call(e).slice(8,-1)}},{}],221:[function(e,t,r){"use strict";var n=e("./_object-dp").f,i=e("./_object-create"),s=e("./_redefine-all"),a=e("./_ctx"),o=e("./_an-instance"),u=e("./_for-of"),l=e("./_iter-define"),c=e("./_iter-step"),p=e("./_set-species"),h=e("./_descriptors"),f=e("./_meta").fastKey,d=e("./_validate-collection"),m=h?"_s":"size",y=function(e,t){var r,n=f(t);if("F"!==n)return e._i[n];for(r=e._f;r;r=r.n)if(r.k==t)return r};t.exports={getConstructor:function(e,t,r,l){var c=e(function(e,n){o(e,c,t,"_i"),e._t=t,e._i=i(null),e._f=void 0,e._l=void 0,e[m]=0,void 0!=n&&u(n,r,e[l],e)});return s(c.prototype,{clear:function(){for(var e=d(this,t),r=e._i,n=e._f;n;n=n.n)n.r=!0,n.p&&(n.p=n.p.n=void 0),delete r[n.i];e._f=e._l=void 0,e[m]=0},delete:function(e){var r=d(this,t),n=y(r,e);if(n){var i=n.n,s=n.p;delete r._i[n.i],n.r=!0,s&&(s.n=i),i&&(i.p=s),r._f==n&&(r._f=i),r._l==n&&(r._l=s),r[m]--}return!!n},forEach:function(e){d(this,t);for(var r,n=a(e,arguments.length>1?arguments[1]:void 0,3);r=r?r.n:this._f;)for(n(r.v,r.k,this);r&&r.r;)r=r.p},has:function(e){return!!y(d(this,t),e)}}),h&&n(c.prototype,"size",{get:function(){return d(this,t)[m]}}),c},def:function(e,t,r){var n,i,s=y(e,t);return s?s.v=r:(e._l=s={i:i=f(t,!0),k:t,v:r,p:n=e._l,n:void 0,r:!1},e._f||(e._f=s),n&&(n.n=s),e[m]++,"F"!==i&&(e._i[i]=s)),e},getEntry:y,setStrong:function(e,t,r){l(e,t,function(e,r){this._t=d(e,t),this._k=r,this._l=void 0},function(){for(var e=this._k,t=this._l;t&&t.r;)t=t.p;return this._t&&(this._l=t=t?t.n:this._t._f)?c(0,"keys"==e?t.k:"values"==e?t.v:[t.k,t.v]):(this._t=void 0,c(1))},r?"entries":"values",!r,!0),p(t)}}},{"./_an-instance":212,"./_ctx":226,"./_descriptors":228,"./_for-of":234,"./_iter-define":246,"./_iter-step":247,"./_meta":250,"./_object-create":252,"./_object-dp":253,"./_redefine-all":265,"./_set-species":270,"./_validate-collection":282}],222:[function(e,t,r){var n=e("./_classof"),i=e("./_array-from-iterable");t.exports=function(e){return function(){if(n(this)!=e)throw TypeError(e+"#toJSON isn't generic");return i(this)}}},{"./_array-from-iterable":214,"./_classof":219}],223:[function(e,t,r){"use strict";var n=e("./_redefine-all"),i=e("./_meta").getWeak,s=e("./_an-object"),a=e("./_is-object"),o=e("./_an-instance"),u=e("./_for-of"),l=e("./_array-methods"),c=e("./_has"),p=e("./_validate-collection"),h=l(5),f=l(6),d=0,m=function(e){return e._l||(e._l=new y)},y=function(){this.a=[]},g=function(e,t){return h(e.a,function(e){return e[0]===t})};y.prototype={get:function(e){var t=g(this,e);if(t)return t[1]},has:function(e){return!!g(this,e)},set:function(e,t){var r=g(this,e);r?r[1]=t:this.a.push([e,t])},delete:function(e){var t=f(this.a,function(t){return t[0]===e});return~t&&this.a.splice(t,1),!!~t}},t.exports={getConstructor:function(e,t,r,s){var l=e(function(e,n){o(e,l,t,"_i"),e._t=t,e._i=d++,e._l=void 0,void 0!=n&&u(n,r,e[s],e)});return n(l.prototype,{delete:function(e){if(!a(e))return!1;var r=i(e);return!0===r?m(p(this,t)).delete(e):r&&c(r,this._i)&&delete r[this._i]},has:function(e){if(!a(e))return!1;var r=i(e);return!0===r?m(p(this,t)).has(e):r&&c(r,this._i)}}),l},def:function(e,t,r){var n=i(s(t),!0);return!0===n?m(e).set(t,r):n[e._i]=r,e},ufstore:m}},{"./_an-instance":212,"./_an-object":213,"./_array-methods":216,"./_for-of":234,"./_has":236,"./_is-object":243,"./_meta":250,"./_redefine-all":265,"./_validate-collection":282}],224:[function(e,t,r){"use strict";var n=e("./_global"),i=e("./_export"),s=e("./_meta"),a=e("./_fails"),o=e("./_hide"),u=e("./_redefine-all"),l=e("./_for-of"),c=e("./_an-instance"),p=e("./_is-object"),h=e("./_set-to-string-tag"),f=e("./_object-dp").f,d=e("./_array-methods")(0),m=e("./_descriptors");t.exports=function(e,t,r,y,g,b){var v=n[e],x=v,E=g?"set":"add",A=x&&x.prototype,D={};return m&&"function"==typeof x&&(b||A.forEach&&!a(function(){(new x).entries().next()}))?(x=t(function(t,r){c(t,x,e,"_c"),t._c=new v,void 0!=r&&l(r,g,t[E],t)}),d("add,clear,delete,forEach,get,has,set,keys,values,entries,toJSON".split(","),function(e){var t="add"==e||"set"==e;e in A&&(!b||"clear"!=e)&&o(x.prototype,e,function(r,n){if(c(this,x,e),!t&&b&&!p(r))return"get"==e&&void 0;var i=this._c[e](0===r?0:r,n);return t?this:i})}),b||f(x.prototype,"size",{get:function(){return this._c.size}})):(x=y.getConstructor(t,e,g,E),u(x.prototype,r),s.NEED=!0),h(x,e),D[e]=x,i(i.G+i.W+i.F,D),b||y.setStrong(x,e,g),x}},{"./_an-instance":212,"./_array-methods":216,"./_descriptors":228,"./_export":232,"./_fails":233,"./_for-of":234,"./_global":235,"./_hide":237,"./_is-object":243,"./_meta":250,"./_object-dp":253,"./_redefine-all":265,"./_set-to-string-tag":271}],225:[function(e,t,r){var n=t.exports={version:"2.5.3"};"number"==typeof __e&&(__e=n)},{}],226:[function(e,t,r){var n=e("./_a-function");t.exports=function(e,t,r){if(n(e),void 0===t)return e;switch(r){case 1:return function(r){return e.call(t,r)};case 2:return function(r,n){return e.call(t,r,n)};case 3:return function(r,n,i){return e.call(t,r,n,i)}}return function(){return e.apply(t,arguments)}}},{"./_a-function":210}],227:[function(e,t,r){t.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},{}],228:[function(e,t,r){t.exports=!e("./_fails")(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},{"./_fails":233}],229:[function(e,t,r){var n=e("./_is-object"),i=e("./_global").document,s=n(i)&&n(i.createElement);t.exports=function(e){return s?i.createElement(e):{}}},{"./_global":235,"./_is-object":243}],230:[function(e,t,r){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},{}],231:[function(e,t,r){var n=e("./_object-keys"),i=e("./_object-gops"),s=e("./_object-pie");t.exports=function(e){var t=n(e),r=i.f;if(r)for(var a,o=r(e),u=s.f,l=0;o.length>l;)u.call(e,a=o[l++])&&t.push(a);return t}},{"./_object-gops":258,"./_object-keys":261,"./_object-pie":262}],232:[function(e,t,r){var n=e("./_global"),i=e("./_core"),s=e("./_ctx"),a=e("./_hide"),o="prototype",u=function(e,t,r){var l,c,p,h=e&u.F,f=e&u.G,d=e&u.S,m=e&u.P,y=e&u.B,g=e&u.W,b=f?i:i[t]||(i[t]={}),v=b[o],x=f?n:d?n[t]:(n[t]||{})[o];f&&(r=t);for(l in r)(c=!h&&x&&void 0!==x[l])&&l in b||(p=c?x[l]:r[l],b[l]=f&&"function"!=typeof x[l]?r[l]:y&&c?s(p,n):g&&x[l]==p?function(e){var t=function(t,r,n){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,r)}return new e(t,r,n)}return e.apply(this,arguments)};return t[o]=e[o],t}(p):m&&"function"==typeof p?s(Function.call,p):p,m&&((b.virtual||(b.virtual={}))[l]=p,e&u.R&&v&&!v[l]&&a(v,l,p)))};u.F=1,u.G=2,u.S=4,u.P=8,u.B=16,u.W=32,u.U=64,u.R=128,t.exports=u},{"./_core":225,"./_ctx":226,"./_global":235,"./_hide":237}],233:[function(e,t,r){t.exports=function(e){try{return!!e()}catch(e){return!0}}},{}],234:[function(e,t,r){var n=e("./_ctx"),i=e("./_iter-call"),s=e("./_is-array-iter"),a=e("./_an-object"),o=e("./_to-length"),u=e("./core.get-iterator-method"),l={},c={};(r=t.exports=function(e,t,r,p,h){var f,d,m,y,g=h?function(){return e}:u(e),b=n(r,p,t?2:1),v=0;if("function"!=typeof g)throw TypeError(e+" is not iterable!");if(s(g)){for(f=o(e.length);f>v;v++)if((y=t?b(a(d=e[v])[0],d[1]):b(e[v]))===l||y===c)return y}else for(m=g.call(e);!(d=m.next()).done;)if((y=i(m,b,d.value,t))===l||y===c)return y}).BREAK=l,r.RETURN=c},{"./_an-object":213,"./_ctx":226,"./_is-array-iter":241,"./_iter-call":244,"./_to-length":278,"./core.get-iterator-method":286}],235:[function(e,t,r){var n=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},{}],236:[function(e,t,r){var n={}.hasOwnProperty;t.exports=function(e,t){return n.call(e,t)}},{}],237:[function(e,t,r){var n=e("./_object-dp"),i=e("./_property-desc");t.exports=e("./_descriptors")?function(e,t,r){return n.f(e,t,i(1,r))}:function(e,t,r){return e[t]=r,e}},{"./_descriptors":228,"./_object-dp":253,"./_property-desc":264}],238:[function(e,t,r){var n=e("./_global").document;t.exports=n&&n.documentElement},{"./_global":235}],239:[function(e,t,r){t.exports=!e("./_descriptors")&&!e("./_fails")(function(){return 7!=Object.defineProperty(e("./_dom-create")("div"),"a",{get:function(){return 7}}).a})},{"./_descriptors":228,"./_dom-create":229,"./_fails":233}],240:[function(e,t,r){var n=e("./_cof");t.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==n(e)?e.split(""):Object(e)}},{"./_cof":220}],241:[function(e,t,r){var n=e("./_iterators"),i=e("./_wks")("iterator"),s=Array.prototype;t.exports=function(e){return void 0!==e&&(n.Array===e||s[i]===e)}},{"./_iterators":248,"./_wks":285}],242:[function(e,t,r){var n=e("./_cof");t.exports=Array.isArray||function(e){return"Array"==n(e)}},{"./_cof":220}],243:[function(e,t,r){t.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},{}],244:[function(e,t,r){var n=e("./_an-object");t.exports=function(e,t,r,i){try{return i?t(n(r)[0],r[1]):t(r)}catch(t){var s=e.return;throw void 0!==s&&n(s.call(e)),t}}},{"./_an-object":213}],245:[function(e,t,r){"use strict";var n=e("./_object-create"),i=e("./_property-desc"),s=e("./_set-to-string-tag"),a={};e("./_hide")(a,e("./_wks")("iterator"),function(){return this}),t.exports=function(e,t,r){e.prototype=n(a,{next:i(1,r)}),s(e,t+" Iterator")}},{"./_hide":237,"./_object-create":252,"./_property-desc":264,"./_set-to-string-tag":271,"./_wks":285}],246:[function(e,t,r){"use strict";var n=e("./_library"),i=e("./_export"),s=e("./_redefine"),a=e("./_hide"),o=e("./_has"),u=e("./_iterators"),l=e("./_iter-create"),c=e("./_set-to-string-tag"),p=e("./_object-gpo"),h=e("./_wks")("iterator"),f=!([].keys&&"next"in[].keys()),d=function(){return this};t.exports=function(e,t,r,m,y,g,b){l(r,t,m);var v,x,E,A=function(e){if(!f&&e in _)return _[e];switch(e){case"keys":case"values":return function(){return new r(this,e)}}return function(){return new r(this,e)}},D=t+" Iterator",S="values"==y,C=!1,_=e.prototype,w=_[h]||_["@@iterator"]||y&&_[y],k=!f&&w||A(y),F=y?S?A("entries"):k:void 0,T="Array"==t?_.entries||w:w;if(T&&(E=p(T.call(new e)))!==Object.prototype&&E.next&&(c(E,D,!0),n||o(E,h)||a(E,h,d)),S&&w&&"values"!==w.name&&(C=!0,k=function(){return w.call(this)}),n&&!b||!f&&!C&&_[h]||a(_,h,k),u[t]=k,u[D]=d,y)if(v={values:S?k:A("values"),keys:g?k:A("keys"),entries:F},b)for(x in v)x in _||s(_,x,v[x]);else i(i.P+i.F*(f||C),t,v);return v}},{"./_export":232,"./_has":236,"./_hide":237,"./_iter-create":245,"./_iterators":248,"./_library":249,"./_object-gpo":259,"./_redefine":266,"./_set-to-string-tag":271,"./_wks":285}],247:[function(e,t,r){t.exports=function(e,t){return{value:t,done:!!e}}},{}],248:[function(e,t,r){t.exports={}},{}],249:[function(e,t,r){t.exports=!0},{}],250:[function(e,t,r){var n=e("./_uid")("meta"),i=e("./_is-object"),s=e("./_has"),a=e("./_object-dp").f,o=0,u=Object.isExtensible||function(){return!0},l=!e("./_fails")(function(){return u(Object.preventExtensions({}))}),c=function(e){a(e,n,{value:{i:"O"+ ++o,w:{}}})},p=t.exports={KEY:n,NEED:!1,fastKey:function(e,t){if(!i(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!s(e,n)){if(!u(e))return"F";if(!t)return"E";c(e)}return e[n].i},getWeak:function(e,t){if(!s(e,n)){if(!u(e))return!0;if(!t)return!1;c(e)}return e[n].w},onFreeze:function(e){return l&&p.NEED&&u(e)&&!s(e,n)&&c(e),e}}},{"./_fails":233,"./_has":236,"./_is-object":243,"./_object-dp":253,"./_uid":281}],251:[function(e,t,r){"use strict";var n=e("./_object-keys"),i=e("./_object-gops"),s=e("./_object-pie"),a=e("./_to-object"),o=e("./_iobject"),u=Object.assign;t.exports=!u||e("./_fails")(function(){var e={},t={},r=Symbol(),n="abcdefghijklmnopqrst";return e[r]=7,n.split("").forEach(function(e){t[e]=e}),7!=u({},e)[r]||Object.keys(u({},t)).join("")!=n})?function(e,t){for(var r=a(e),u=arguments.length,l=1,c=i.f,p=s.f;u>l;)for(var h,f=o(arguments[l++]),d=c?n(f).concat(c(f)):n(f),m=d.length,y=0;m>y;)p.call(f,h=d[y++])&&(r[h]=f[h]);return r}:u},{"./_fails":233,"./_iobject":240,"./_object-gops":258,"./_object-keys":261,"./_object-pie":262,"./_to-object":279}],252:[function(e,t,r){var n=e("./_an-object"),i=e("./_object-dps"),s=e("./_enum-bug-keys"),a=e("./_shared-key")("IE_PROTO"),o=function(){},u=function(){var t,r=e("./_dom-create")("iframe"),n=s.length;for(r.style.display="none",e("./_html").appendChild(r),r.src="javascript:",(t=r.contentWindow.document).open(),t.write("
-```
-
-For [Node.js](http://nodejs.org), the library is available from the [npm](https://npmjs.org/) registry
-
- $ npm install bignumber.js
-
-```javascript
-var BigNumber = require('bignumber.js');
-```
-
-To load with AMD loader libraries such as [requireJS](http://requirejs.org/):
-
-```javascript
-require(['path/to/bignumber'], function(BigNumber) {
- // Use BigNumber here in local scope. No global BigNumber.
-});
-```
-
-## Use
-
-*In all examples below, `var`, semicolons and `toString` calls are not shown.
-If a commented-out value is in quotes it means `toString` has been called on the preceding expression.*
-
-The library exports a single function: `BigNumber`, the constructor of BigNumber instances.
-
-It accepts a value of type number *(up to 15 significant digits only)*, string or BigNumber object,
-
-```javascript
-x = new BigNumber(123.4567)
-y = BigNumber('123456.7e-3')
-z = new BigNumber(x)
-x.equals(y) && y.equals(z) && x.equals(z) // true
-```
-
-
-and a base from 2 to 64 inclusive can be specified.
-
-```javascript
-x = new BigNumber(1011, 2) // "11"
-y = new BigNumber('zz.9', 36) // "1295.25"
-z = x.plus(y) // "1306.25"
-```
-
-A BigNumber is immutable in the sense that it is not changed by its methods.
-
-```javascript
-0.3 - 0.1 // 0.19999999999999998
-x = new BigNumber(0.3)
-x.minus(0.1) // "0.2"
-x // "0.3"
-```
-
-The methods that return a BigNumber can be chained.
-
-```javascript
-x.dividedBy(y).plus(z).times(9).floor()
-x.times('1.23456780123456789e+9').plus(9876.5432321).dividedBy('4444562598.111772').ceil()
-```
-
-Many method names have a shorter alias.
-
-```javascript
-x.squareRoot().dividedBy(y).toPower(3).equals(x.sqrt().div(y).pow(3)) // true
-x.cmp(y.mod(z).neg()) == 1 && x.comparedTo(y.modulo(z).negated()) == 1 // true
-```
-
-Like JavaScript's number type, there are `toExponential`, `toFixed` and `toPrecision` methods
-
-```javascript
-x = new BigNumber(255.5)
-x.toExponential(5) // "2.55500e+2"
-x.toFixed(5) // "255.50000"
-x.toPrecision(5) // "255.50"
-x.toNumber() // 255.5
-```
-
- and a base can be specified for `toString`.
-
- ```javascript
- x.toString(16) // "ff.8"
- ```
-
-There is also a `toFormat` method which may be useful for internationalisation
-
-```javascript
-y = new BigNumber('1234567.898765')
-y.toFormat(2) // "1,234,567.90"
-```
-
-The maximum number of decimal places of the result of an operation involving division (i.e. a division, square root, base conversion or negative power operation) is set using the `config` method of the `BigNumber` constructor.
-
-The other arithmetic operations always give the exact result.
-
-```javascript
-BigNumber.config({ DECIMAL_PLACES: 10, ROUNDING_MODE: 4 })
-// Alternatively, BigNumber.config( 10, 4 );
-
-x = new BigNumber(2);
-y = new BigNumber(3);
-z = x.div(y) // "0.6666666667"
-z.sqrt() // "0.8164965809"
-z.pow(-3) // "3.3749999995"
-z.toString(2) // "0.1010101011"
-z.times(z) // "0.44444444448888888889"
-z.times(z).round(10) // "0.4444444445"
-```
-
-There is a `toFraction` method with an optional *maximum denominator* argument
-
-```javascript
-y = new BigNumber(355)
-pi = y.dividedBy(113) // "3.1415929204"
-pi.toFraction() // [ "7853982301", "2500000000" ]
-pi.toFraction(1000) // [ "355", "113" ]
-```
-
-and `isNaN` and `isFinite` methods, as `NaN` and `Infinity` are valid `BigNumber` values.
-
-```javascript
-x = new BigNumber(NaN) // "NaN"
-y = new BigNumber(Infinity) // "Infinity"
-x.isNaN() && !y.isNaN() && !x.isFinite() && !y.isFinite() // true
-```
-
-The value of a BigNumber is stored in a decimal floating point format in terms of a coefficient, exponent and sign.
-
-
-```javascript
-x = new BigNumber(-123.456);
-x.c // [ 123, 45600000000000 ] coefficient (i.e. significand)
-x.e // 2 exponent
-x.s // -1 sign
-```
-
-
-Multiple BigNumber constructors can be created, each with their own independent configuration which applies to all BigNumber's created from it.
-
-```javascript
-// Set DECIMAL_PLACES for the original BigNumber constructor
-BigNumber.config({ DECIMAL_PLACES: 10 })
-
-// Create another BigNumber constructor, optionally passing in a configuration object
-BN = BigNumber.another({ DECIMAL_PLACES: 5 })
-
-x = new BigNumber(1)
-y = new BN(1)
-
-x.div(3) // '0.3333333333'
-y.div(3) // '0.33333'
-```
-
-For futher information see the [API](http://mikemcl.github.io/bignumber.js/) reference in the *doc* directory.
-
-## Test
-
-The *test* directory contains the test scripts for each method.
-
-The tests can be run with Node or a browser. For Node use
-
- $ npm test
-
-or
-
- $ node test/every-test
-
-To test a single method, e.g.
-
- $ node test/toFraction
-
-For the browser, see *every-test.html* and *single-test.html* in the *test/browser* directory.
-
-*bignumber-vs-number.html* enables some of the methods of bignumber.js to be compared with those of JavaScript's number type.
-
-## Versions
-
-This is version 2.x.x of the library, for version 1.x.x see the tagged releases or switch to the 'original' branch. The advantages of version 2 are that it is considerably faster for numbers with many digits and that there are a some added methods (see Change Log below). The disadvantages are more lines of code and increased code complexity, and the loss of simplicity in no longer having the coefficient of a BigNumber stored in base 10. The 'original' version will continue to be supported.
-
-## Performance
-
-See the [README](https://github.com/MikeMcl/bignumber.js/tree/master/perf) in the *perf* directory.
-
-## Build
-
-For Node, if [uglify-js](https://github.com/mishoo/UglifyJS2) is installed
-
- npm install uglify-js -g
-
-then
-
- npm run build
-
-will create *bignumber.min.js*.
-
-A source map will also be created in the root directory.
-
-## Feedback
-
-Open an issue, or email
-
-Michael
-
-M8ch88l@gmail.com
-
-## Licence
-
-MIT.
-
-See [LICENCE](https://github.com/MikeMcl/bignumber.js/blob/master/LICENCE).
-
-## Change Log
-
-####2.4.0
-* 14/07/2016
-* #97 Add exports to support ES6 imports.
-
-####2.3.0
-* 07/03/2016
-* #86 Add modulus parameter to `toPower`.
-
-####2.2.0
-* 03/03/2016
-* #91 Permit larger JS integers.
-
-####2.1.4
-* 15/12/2015
-* Correct UMD.
-
-####2.1.3
-* 13/12/2015
-* Refactor re global object and crypto availability when bundling.
-
-####2.1.2
-* 10/12/2015
-* Bugfix: `window.crypto` not assigned to `crypto`.
-
-####2.1.1
-* 09/12/2015
-* Prevent code bundler from adding `crypto` shim.
-
-####2.1.0
-* 26/10/2015
-* For `valueOf` and `toJSON`, include the minus sign with negative zero.
-
-####2.0.8
-* 2/10/2015
-* Internal round function bugfix.
-
-####2.0.6
-* 31/03/2015
-* Add bower.json. Tweak division after in-depth review.
-
-####2.0.5
-* 25/03/2015
-* Amend README. Remove bitcoin address.
-
-####2.0.4
-* 25/03/2015
-* Critical bugfix #58: division.
-
-####2.0.3
-* 18/02/2015
-* Amend README. Add source map.
-
-####2.0.2
-* 18/02/2015
-* Correct links.
-
-####2.0.1
-* 18/02/2015
-* Add `max`, `min`, `precision`, `random`, `shift`, `toDigits` and `truncated` methods.
-* Add the short-forms: `add`, `mul`, `sd`, `sub` and `trunc`.
-* Add an `another` method to enable multiple independent constructors to be created.
-* Add support for the base 2, 8 and 16 prefixes `0b`, `0o` and `0x`.
-* Enable a rounding mode to be specified as a second parameter to `toExponential`, `toFixed`, `toFormat` and `toPrecision`.
-* Add a `CRYPTO` configuration property so cryptographically-secure pseudo-random number generation can be specified.
-* Add a `MODULO_MODE` configuration property to enable the rounding mode used by the `modulo` operation to be specified.
-* Add a `POW_PRECISION` configuration property to enable the number of significant digits calculated by the power operation to be limited.
-* Improve code quality.
-* Improve documentation.
-
-####2.0.0
-* 29/12/2014
-* Add `dividedToIntegerBy`, `isInteger` and `toFormat` methods.
-* Remove the following short-forms: `isF`, `isZ`, `toE`, `toF`, `toFr`, `toN`, `toP`, `toS`.
-* Store a BigNumber's coefficient in base 1e14, rather than base 10.
-* Add fast path for integers to BigNumber constructor.
-* Incorporate the library into the online documentation.
-
-####1.5.0
-* 13/11/2014
-* Add `toJSON` and `decimalPlaces` methods.
-
-####1.4.1
-* 08/06/2014
-* Amend README.
-
-####1.4.0
-* 08/05/2014
-* Add `toNumber`.
-
-####1.3.0
-* 08/11/2013
-* Ensure correct rounding of `sqrt` in all, rather than almost all, cases.
-* Maximum radix to 64.
-
-####1.2.1
-* 17/10/2013
-* Sign of zero when x < 0 and x + (-x) = 0.
-
-####1.2.0
-* 19/9/2013
-* Throw Error objects for stack.
-
-####1.1.1
-* 22/8/2013
-* Show original value in constructor error message.
-
-####1.1.0
-* 1/8/2013
-* Allow numbers with trailing radix point.
-
-####1.0.1
-* Bugfix: error messages with incorrect method name
-
-####1.0.0
-* 8/11/2012
-* Initial release
diff --git a/app/node_modules/bignumber.js/bignumber.js b/app/node_modules/bignumber.js/bignumber.js
deleted file mode 100644
index 027c3c10..00000000
--- a/app/node_modules/bignumber.js/bignumber.js
+++ /dev/null
@@ -1,2737 +0,0 @@
-/*! bignumber.js v2.4.0 https://github.com/MikeMcl/bignumber.js/LICENCE */
-
-;(function (globalObj) {
- 'use strict';
-
- /*
- bignumber.js v2.4.0
- A JavaScript library for arbitrary-precision arithmetic.
- https://github.com/MikeMcl/bignumber.js
- Copyright (c) 2016 Michael Mclaughlin
- MIT Expat Licence
- */
-
-
- var BigNumber, cryptoObj, parseNumeric,
- isNumeric = /^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,
- mathceil = Math.ceil,
- mathfloor = Math.floor,
- notBool = ' not a boolean or binary digit',
- roundingMode = 'rounding mode',
- tooManyDigits = 'number type has more than 15 significant digits',
- ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_',
- BASE = 1e14,
- LOG_BASE = 14,
- MAX_SAFE_INTEGER = 0x1fffffffffffff, // 2^53 - 1
- // MAX_INT32 = 0x7fffffff, // 2^31 - 1
- POWS_TEN = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13],
- SQRT_BASE = 1e7,
-
- /*
- * The limit on the value of DECIMAL_PLACES, TO_EXP_NEG, TO_EXP_POS, MIN_EXP, MAX_EXP, and
- * the arguments to toExponential, toFixed, toFormat, and toPrecision, beyond which an
- * exception is thrown (if ERRORS is true).
- */
- MAX = 1E9; // 0 to MAX_INT32
-
- if ( typeof crypto != 'undefined' ) cryptoObj = crypto;
-
-
- /*
- * Create and return a BigNumber constructor.
- */
- function constructorFactory(configObj) {
- var div,
-
- // id tracks the caller function, so its name can be included in error messages.
- id = 0,
- P = BigNumber.prototype,
- ONE = new BigNumber(1),
-
-
- /********************************* EDITABLE DEFAULTS **********************************/
-
-
- /*
- * The default values below must be integers within the inclusive ranges stated.
- * The values can also be changed at run-time using BigNumber.config.
- */
-
- // The maximum number of decimal places for operations involving division.
- DECIMAL_PLACES = 20, // 0 to MAX
-
- /*
- * The rounding mode used when rounding to the above decimal places, and when using
- * toExponential, toFixed, toFormat and toPrecision, and round (default value).
- * UP 0 Away from zero.
- * DOWN 1 Towards zero.
- * CEIL 2 Towards +Infinity.
- * FLOOR 3 Towards -Infinity.
- * HALF_UP 4 Towards nearest neighbour. If equidistant, up.
- * HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.
- * HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.
- * HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.
- * HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.
- */
- ROUNDING_MODE = 4, // 0 to 8
-
- // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]
-
- // The exponent value at and beneath which toString returns exponential notation.
- // Number type: -7
- TO_EXP_NEG = -7, // 0 to -MAX
-
- // The exponent value at and above which toString returns exponential notation.
- // Number type: 21
- TO_EXP_POS = 21, // 0 to MAX
-
- // RANGE : [MIN_EXP, MAX_EXP]
-
- // The minimum exponent value, beneath which underflow to zero occurs.
- // Number type: -324 (5e-324)
- MIN_EXP = -1e7, // -1 to -MAX
-
- // The maximum exponent value, above which overflow to Infinity occurs.
- // Number type: 308 (1.7976931348623157e+308)
- // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.
- MAX_EXP = 1e7, // 1 to MAX
-
- // Whether BigNumber Errors are ever thrown.
- ERRORS = true, // true or false
-
- // Change to intValidatorNoErrors if ERRORS is false.
- isValidInt = intValidatorWithErrors, // intValidatorWithErrors/intValidatorNoErrors
-
- // Whether to use cryptographically-secure random number generation, if available.
- CRYPTO = false, // true or false
-
- /*
- * The modulo mode used when calculating the modulus: a mod n.
- * The quotient (q = a / n) is calculated according to the corresponding rounding mode.
- * The remainder (r) is calculated as: r = a - n * q.
- *
- * UP 0 The remainder is positive if the dividend is negative, else is negative.
- * DOWN 1 The remainder has the same sign as the dividend.
- * This modulo mode is commonly known as 'truncated division' and is
- * equivalent to (a % n) in JavaScript.
- * FLOOR 3 The remainder has the same sign as the divisor (Python %).
- * HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.
- * EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).
- * The remainder is always positive.
- *
- * The truncated division, floored division, Euclidian division and IEEE 754 remainder
- * modes are commonly used for the modulus operation.
- * Although the other rounding modes can also be used, they may not give useful results.
- */
- MODULO_MODE = 1, // 0 to 9
-
- // The maximum number of significant digits of the result of the toPower operation.
- // If POW_PRECISION is 0, there will be unlimited significant digits.
- POW_PRECISION = 100, // 0 to MAX
-
- // The format specification used by the BigNumber.prototype.toFormat method.
- FORMAT = {
- decimalSeparator: '.',
- groupSeparator: ',',
- groupSize: 3,
- secondaryGroupSize: 0,
- fractionGroupSeparator: '\xA0', // non-breaking space
- fractionGroupSize: 0
- };
-
-
- /******************************************************************************************/
-
-
- // CONSTRUCTOR
-
-
- /*
- * The BigNumber constructor and exported function.
- * Create and return a new instance of a BigNumber object.
- *
- * n {number|string|BigNumber} A numeric value.
- * [b] {number} The base of n. Integer, 2 to 64 inclusive.
- */
- function BigNumber( n, b ) {
- var c, e, i, num, len, str,
- x = this;
-
- // Enable constructor usage without new.
- if ( !( x instanceof BigNumber ) ) {
-
- // 'BigNumber() constructor call without new: {n}'
- if (ERRORS) raise( 26, 'constructor call without new', n );
- return new BigNumber( n, b );
- }
-
- // 'new BigNumber() base not an integer: {b}'
- // 'new BigNumber() base out of range: {b}'
- if ( b == null || !isValidInt( b, 2, 64, id, 'base' ) ) {
-
- // Duplicate.
- if ( n instanceof BigNumber ) {
- x.s = n.s;
- x.e = n.e;
- x.c = ( n = n.c ) ? n.slice() : n;
- id = 0;
- return;
- }
-
- if ( ( num = typeof n == 'number' ) && n * 0 == 0 ) {
- x.s = 1 / n < 0 ? ( n = -n, -1 ) : 1;
-
- // Fast path for integers.
- if ( n === ~~n ) {
- for ( e = 0, i = n; i >= 10; i /= 10, e++ );
- x.e = e;
- x.c = [n];
- id = 0;
- return;
- }
-
- str = n + '';
- } else {
- if ( !isNumeric.test( str = n + '' ) ) return parseNumeric( x, str, num );
- x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;
- }
- } else {
- b = b | 0;
- str = n + '';
-
- // Ensure return value is rounded to DECIMAL_PLACES as with other bases.
- // Allow exponential notation to be used with base 10 argument.
- if ( b == 10 ) {
- x = new BigNumber( n instanceof BigNumber ? n : str );
- return round( x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE );
- }
-
- // Avoid potential interpretation of Infinity and NaN as base 44+ values.
- // Any number in exponential form will fail due to the [Ee][+-].
- if ( ( num = typeof n == 'number' ) && n * 0 != 0 ||
- !( new RegExp( '^-?' + ( c = '[' + ALPHABET.slice( 0, b ) + ']+' ) +
- '(?:\\.' + c + ')?$',b < 37 ? 'i' : '' ) ).test(str) ) {
- return parseNumeric( x, str, num, b );
- }
-
- if (num) {
- x.s = 1 / n < 0 ? ( str = str.slice(1), -1 ) : 1;
-
- if ( ERRORS && str.replace( /^0\.0*|\./, '' ).length > 15 ) {
-
- // 'new BigNumber() number type has more than 15 significant digits: {n}'
- raise( id, tooManyDigits, n );
- }
-
- // Prevent later check for length on converted number.
- num = false;
- } else {
- x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;
- }
-
- str = convertBase( str, 10, b, x.s );
- }
-
- // Decimal point?
- if ( ( e = str.indexOf('.') ) > -1 ) str = str.replace( '.', '' );
-
- // Exponential form?
- if ( ( i = str.search( /e/i ) ) > 0 ) {
-
- // Determine exponent.
- if ( e < 0 ) e = i;
- e += +str.slice( i + 1 );
- str = str.substring( 0, i );
- } else if ( e < 0 ) {
-
- // Integer.
- e = str.length;
- }
-
- // Determine leading zeros.
- for ( i = 0; str.charCodeAt(i) === 48; i++ );
-
- // Determine trailing zeros.
- for ( len = str.length; str.charCodeAt(--len) === 48; );
- str = str.slice( i, len + 1 );
-
- if (str) {
- len = str.length;
-
- // Disallow numbers with over 15 significant digits if number type.
- // 'new BigNumber() number type has more than 15 significant digits: {n}'
- if ( num && ERRORS && len > 15 && ( n > MAX_SAFE_INTEGER || n !== mathfloor(n) ) ) {
- raise( id, tooManyDigits, x.s * n );
- }
-
- e = e - i - 1;
-
- // Overflow?
- if ( e > MAX_EXP ) {
-
- // Infinity.
- x.c = x.e = null;
-
- // Underflow?
- } else if ( e < MIN_EXP ) {
-
- // Zero.
- x.c = [ x.e = 0 ];
- } else {
- x.e = e;
- x.c = [];
-
- // Transform base
-
- // e is the base 10 exponent.
- // i is where to slice str to get the first element of the coefficient array.
- i = ( e + 1 ) % LOG_BASE;
- if ( e < 0 ) i += LOG_BASE;
-
- if ( i < len ) {
- if (i) x.c.push( +str.slice( 0, i ) );
-
- for ( len -= LOG_BASE; i < len; ) {
- x.c.push( +str.slice( i, i += LOG_BASE ) );
- }
-
- str = str.slice(i);
- i = LOG_BASE - str.length;
- } else {
- i -= len;
- }
-
- for ( ; i--; str += '0' );
- x.c.push( +str );
- }
- } else {
-
- // Zero.
- x.c = [ x.e = 0 ];
- }
-
- id = 0;
- }
-
-
- // CONSTRUCTOR PROPERTIES
-
-
- BigNumber.another = constructorFactory;
-
- BigNumber.ROUND_UP = 0;
- BigNumber.ROUND_DOWN = 1;
- BigNumber.ROUND_CEIL = 2;
- BigNumber.ROUND_FLOOR = 3;
- BigNumber.ROUND_HALF_UP = 4;
- BigNumber.ROUND_HALF_DOWN = 5;
- BigNumber.ROUND_HALF_EVEN = 6;
- BigNumber.ROUND_HALF_CEIL = 7;
- BigNumber.ROUND_HALF_FLOOR = 8;
- BigNumber.EUCLID = 9;
-
-
- /*
- * Configure infrequently-changing library-wide settings.
- *
- * Accept an object or an argument list, with one or many of the following properties or
- * parameters respectively:
- *
- * DECIMAL_PLACES {number} Integer, 0 to MAX inclusive
- * ROUNDING_MODE {number} Integer, 0 to 8 inclusive
- * EXPONENTIAL_AT {number|number[]} Integer, -MAX to MAX inclusive or
- * [integer -MAX to 0 incl., 0 to MAX incl.]
- * RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or
- * [integer -MAX to -1 incl., integer 1 to MAX incl.]
- * ERRORS {boolean|number} true, false, 1 or 0
- * CRYPTO {boolean|number} true, false, 1 or 0
- * MODULO_MODE {number} 0 to 9 inclusive
- * POW_PRECISION {number} 0 to MAX inclusive
- * FORMAT {object} See BigNumber.prototype.toFormat
- * decimalSeparator {string}
- * groupSeparator {string}
- * groupSize {number}
- * secondaryGroupSize {number}
- * fractionGroupSeparator {string}
- * fractionGroupSize {number}
- *
- * (The values assigned to the above FORMAT object properties are not checked for validity.)
- *
- * E.g.
- * BigNumber.config(20, 4) is equivalent to
- * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })
- *
- * Ignore properties/parameters set to null or undefined.
- * Return an object with the properties current values.
- */
- BigNumber.config = function () {
- var v, p,
- i = 0,
- r = {},
- a = arguments,
- o = a[0],
- has = o && typeof o == 'object'
- ? function () { if ( o.hasOwnProperty(p) ) return ( v = o[p] ) != null; }
- : function () { if ( a.length > i ) return ( v = a[i++] ) != null; };
-
- // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.
- // 'config() DECIMAL_PLACES not an integer: {v}'
- // 'config() DECIMAL_PLACES out of range: {v}'
- if ( has( p = 'DECIMAL_PLACES' ) && isValidInt( v, 0, MAX, 2, p ) ) {
- DECIMAL_PLACES = v | 0;
- }
- r[p] = DECIMAL_PLACES;
-
- // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.
- // 'config() ROUNDING_MODE not an integer: {v}'
- // 'config() ROUNDING_MODE out of range: {v}'
- if ( has( p = 'ROUNDING_MODE' ) && isValidInt( v, 0, 8, 2, p ) ) {
- ROUNDING_MODE = v | 0;
- }
- r[p] = ROUNDING_MODE;
-
- // EXPONENTIAL_AT {number|number[]}
- // Integer, -MAX to MAX inclusive or [integer -MAX to 0 inclusive, 0 to MAX inclusive].
- // 'config() EXPONENTIAL_AT not an integer: {v}'
- // 'config() EXPONENTIAL_AT out of range: {v}'
- if ( has( p = 'EXPONENTIAL_AT' ) ) {
-
- if ( isArray(v) ) {
- if ( isValidInt( v[0], -MAX, 0, 2, p ) && isValidInt( v[1], 0, MAX, 2, p ) ) {
- TO_EXP_NEG = v[0] | 0;
- TO_EXP_POS = v[1] | 0;
- }
- } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {
- TO_EXP_NEG = -( TO_EXP_POS = ( v < 0 ? -v : v ) | 0 );
- }
- }
- r[p] = [ TO_EXP_NEG, TO_EXP_POS ];
-
- // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or
- // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].
- // 'config() RANGE not an integer: {v}'
- // 'config() RANGE cannot be zero: {v}'
- // 'config() RANGE out of range: {v}'
- if ( has( p = 'RANGE' ) ) {
-
- if ( isArray(v) ) {
- if ( isValidInt( v[0], -MAX, -1, 2, p ) && isValidInt( v[1], 1, MAX, 2, p ) ) {
- MIN_EXP = v[0] | 0;
- MAX_EXP = v[1] | 0;
- }
- } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {
- if ( v | 0 ) MIN_EXP = -( MAX_EXP = ( v < 0 ? -v : v ) | 0 );
- else if (ERRORS) raise( 2, p + ' cannot be zero', v );
- }
- }
- r[p] = [ MIN_EXP, MAX_EXP ];
-
- // ERRORS {boolean|number} true, false, 1 or 0.
- // 'config() ERRORS not a boolean or binary digit: {v}'
- if ( has( p = 'ERRORS' ) ) {
-
- if ( v === !!v || v === 1 || v === 0 ) {
- id = 0;
- isValidInt = ( ERRORS = !!v ) ? intValidatorWithErrors : intValidatorNoErrors;
- } else if (ERRORS) {
- raise( 2, p + notBool, v );
- }
- }
- r[p] = ERRORS;
-
- // CRYPTO {boolean|number} true, false, 1 or 0.
- // 'config() CRYPTO not a boolean or binary digit: {v}'
- // 'config() crypto unavailable: {crypto}'
- if ( has( p = 'CRYPTO' ) ) {
-
- if ( v === !!v || v === 1 || v === 0 ) {
- CRYPTO = !!( v && cryptoObj );
- if ( v && !CRYPTO && ERRORS ) raise( 2, 'crypto unavailable', cryptoObj );
- } else if (ERRORS) {
- raise( 2, p + notBool, v );
- }
- }
- r[p] = CRYPTO;
-
- // MODULO_MODE {number} Integer, 0 to 9 inclusive.
- // 'config() MODULO_MODE not an integer: {v}'
- // 'config() MODULO_MODE out of range: {v}'
- if ( has( p = 'MODULO_MODE' ) && isValidInt( v, 0, 9, 2, p ) ) {
- MODULO_MODE = v | 0;
- }
- r[p] = MODULO_MODE;
-
- // POW_PRECISION {number} Integer, 0 to MAX inclusive.
- // 'config() POW_PRECISION not an integer: {v}'
- // 'config() POW_PRECISION out of range: {v}'
- if ( has( p = 'POW_PRECISION' ) && isValidInt( v, 0, MAX, 2, p ) ) {
- POW_PRECISION = v | 0;
- }
- r[p] = POW_PRECISION;
-
- // FORMAT {object}
- // 'config() FORMAT not an object: {v}'
- if ( has( p = 'FORMAT' ) ) {
-
- if ( typeof v == 'object' ) {
- FORMAT = v;
- } else if (ERRORS) {
- raise( 2, p + ' not an object', v );
- }
- }
- r[p] = FORMAT;
-
- return r;
- };
-
-
- /*
- * Return a new BigNumber whose value is the maximum of the arguments.
- *
- * arguments {number|string|BigNumber}
- */
- BigNumber.max = function () { return maxOrMin( arguments, P.lt ); };
-
-
- /*
- * Return a new BigNumber whose value is the minimum of the arguments.
- *
- * arguments {number|string|BigNumber}
- */
- BigNumber.min = function () { return maxOrMin( arguments, P.gt ); };
-
-
- /*
- * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,
- * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing
- * zeros are produced).
- *
- * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.
- *
- * 'random() decimal places not an integer: {dp}'
- * 'random() decimal places out of range: {dp}'
- * 'random() crypto unavailable: {crypto}'
- */
- BigNumber.random = (function () {
- var pow2_53 = 0x20000000000000;
-
- // Return a 53 bit integer n, where 0 <= n < 9007199254740992.
- // Check if Math.random() produces more than 32 bits of randomness.
- // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.
- // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.
- var random53bitInt = (Math.random() * pow2_53) & 0x1fffff
- ? function () { return mathfloor( Math.random() * pow2_53 ); }
- : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +
- (Math.random() * 0x800000 | 0); };
-
- return function (dp) {
- var a, b, e, k, v,
- i = 0,
- c = [],
- rand = new BigNumber(ONE);
-
- dp = dp == null || !isValidInt( dp, 0, MAX, 14 ) ? DECIMAL_PLACES : dp | 0;
- k = mathceil( dp / LOG_BASE );
-
- if (CRYPTO) {
-
- // Browsers supporting crypto.getRandomValues.
- if ( cryptoObj && cryptoObj.getRandomValues ) {
-
- a = cryptoObj.getRandomValues( new Uint32Array( k *= 2 ) );
-
- for ( ; i < k; ) {
-
- // 53 bits:
- // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)
- // 11111 11111111 11111111 11111111 11100000 00000000 00000000
- // ((Math.pow(2, 32) - 1) >>> 11).toString(2)
- // 11111 11111111 11111111
- // 0x20000 is 2^21.
- v = a[i] * 0x20000 + (a[i + 1] >>> 11);
-
- // Rejection sampling:
- // 0 <= v < 9007199254740992
- // Probability that v >= 9e15, is
- // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251
- if ( v >= 9e15 ) {
- b = cryptoObj.getRandomValues( new Uint32Array(2) );
- a[i] = b[0];
- a[i + 1] = b[1];
- } else {
-
- // 0 <= v <= 8999999999999999
- // 0 <= (v % 1e14) <= 99999999999999
- c.push( v % 1e14 );
- i += 2;
- }
- }
- i = k / 2;
-
- // Node.js supporting crypto.randomBytes.
- } else if ( cryptoObj && cryptoObj.randomBytes ) {
-
- // buffer
- a = cryptoObj.randomBytes( k *= 7 );
-
- for ( ; i < k; ) {
-
- // 0x1000000000000 is 2^48, 0x10000000000 is 2^40
- // 0x100000000 is 2^32, 0x1000000 is 2^24
- // 11111 11111111 11111111 11111111 11111111 11111111 11111111
- // 0 <= v < 9007199254740992
- v = ( ( a[i] & 31 ) * 0x1000000000000 ) + ( a[i + 1] * 0x10000000000 ) +
- ( a[i + 2] * 0x100000000 ) + ( a[i + 3] * 0x1000000 ) +
- ( a[i + 4] << 16 ) + ( a[i + 5] << 8 ) + a[i + 6];
-
- if ( v >= 9e15 ) {
- cryptoObj.randomBytes(7).copy( a, i );
- } else {
-
- // 0 <= (v % 1e14) <= 99999999999999
- c.push( v % 1e14 );
- i += 7;
- }
- }
- i = k / 7;
- } else if (ERRORS) {
- raise( 14, 'crypto unavailable', cryptoObj );
- }
- }
-
- // Use Math.random: CRYPTO is false or crypto is unavailable and ERRORS is false.
- if (!i) {
-
- for ( ; i < k; ) {
- v = random53bitInt();
- if ( v < 9e15 ) c[i++] = v % 1e14;
- }
- }
-
- k = c[--i];
- dp %= LOG_BASE;
-
- // Convert trailing digits to zeros according to dp.
- if ( k && dp ) {
- v = POWS_TEN[LOG_BASE - dp];
- c[i] = mathfloor( k / v ) * v;
- }
-
- // Remove trailing elements which are zero.
- for ( ; c[i] === 0; c.pop(), i-- );
-
- // Zero?
- if ( i < 0 ) {
- c = [ e = 0 ];
- } else {
-
- // Remove leading elements which are zero and adjust exponent accordingly.
- for ( e = -1 ; c[0] === 0; c.shift(), e -= LOG_BASE);
-
- // Count the digits of the first element of c to determine leading zeros, and...
- for ( i = 1, v = c[0]; v >= 10; v /= 10, i++);
-
- // adjust the exponent accordingly.
- if ( i < LOG_BASE ) e -= LOG_BASE - i;
- }
-
- rand.e = e;
- rand.c = c;
- return rand;
- };
- })();
-
-
- // PRIVATE FUNCTIONS
-
-
- // Convert a numeric string of baseIn to a numeric string of baseOut.
- function convertBase( str, baseOut, baseIn, sign ) {
- var d, e, k, r, x, xc, y,
- i = str.indexOf( '.' ),
- dp = DECIMAL_PLACES,
- rm = ROUNDING_MODE;
-
- if ( baseIn < 37 ) str = str.toLowerCase();
-
- // Non-integer.
- if ( i >= 0 ) {
- k = POW_PRECISION;
-
- // Unlimited precision.
- POW_PRECISION = 0;
- str = str.replace( '.', '' );
- y = new BigNumber(baseIn);
- x = y.pow( str.length - i );
- POW_PRECISION = k;
-
- // Convert str as if an integer, then restore the fraction part by dividing the
- // result by its base raised to a power.
- y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );
- y.e = y.c.length;
- }
-
- // Convert the number as integer.
- xc = toBaseOut( str, baseIn, baseOut );
- e = k = xc.length;
-
- // Remove trailing zeros.
- for ( ; xc[--k] == 0; xc.pop() );
- if ( !xc[0] ) return '0';
-
- if ( i < 0 ) {
- --e;
- } else {
- x.c = xc;
- x.e = e;
-
- // sign is needed for correct rounding.
- x.s = sign;
- x = div( x, y, dp, rm, baseOut );
- xc = x.c;
- r = x.r;
- e = x.e;
- }
-
- d = e + dp + 1;
-
- // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.
- i = xc[d];
- k = baseOut / 2;
- r = r || d < 0 || xc[d + 1] != null;
-
- r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )
- : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||
- rm == ( x.s < 0 ? 8 : 7 ) );
-
- if ( d < 1 || !xc[0] ) {
-
- // 1^-dp or 0.
- str = r ? toFixedPoint( '1', -dp ) : '0';
- } else {
- xc.length = d;
-
- if (r) {
-
- // Rounding up may mean the previous digit has to be rounded up and so on.
- for ( --baseOut; ++xc[--d] > baseOut; ) {
- xc[d] = 0;
-
- if ( !d ) {
- ++e;
- xc.unshift(1);
- }
- }
- }
-
- // Determine trailing zeros.
- for ( k = xc.length; !xc[--k]; );
-
- // E.g. [4, 11, 15] becomes 4bf.
- for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );
- str = toFixedPoint( str, e );
- }
-
- // The caller will add the sign.
- return str;
- }
-
-
- // Perform division in the specified base. Called by div and convertBase.
- div = (function () {
-
- // Assume non-zero x and k.
- function multiply( x, k, base ) {
- var m, temp, xlo, xhi,
- carry = 0,
- i = x.length,
- klo = k % SQRT_BASE,
- khi = k / SQRT_BASE | 0;
-
- for ( x = x.slice(); i--; ) {
- xlo = x[i] % SQRT_BASE;
- xhi = x[i] / SQRT_BASE | 0;
- m = khi * xlo + xhi * klo;
- temp = klo * xlo + ( ( m % SQRT_BASE ) * SQRT_BASE ) + carry;
- carry = ( temp / base | 0 ) + ( m / SQRT_BASE | 0 ) + khi * xhi;
- x[i] = temp % base;
- }
-
- if (carry) x.unshift(carry);
-
- return x;
- }
-
- function compare( a, b, aL, bL ) {
- var i, cmp;
-
- if ( aL != bL ) {
- cmp = aL > bL ? 1 : -1;
- } else {
-
- for ( i = cmp = 0; i < aL; i++ ) {
-
- if ( a[i] != b[i] ) {
- cmp = a[i] > b[i] ? 1 : -1;
- break;
- }
- }
- }
- return cmp;
- }
-
- function subtract( a, b, aL, base ) {
- var i = 0;
-
- // Subtract b from a.
- for ( ; aL--; ) {
- a[aL] -= i;
- i = a[aL] < b[aL] ? 1 : 0;
- a[aL] = i * base + a[aL] - b[aL];
- }
-
- // Remove leading zeros.
- for ( ; !a[0] && a.length > 1; a.shift() );
- }
-
- // x: dividend, y: divisor.
- return function ( x, y, dp, rm, base ) {
- var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,
- yL, yz,
- s = x.s == y.s ? 1 : -1,
- xc = x.c,
- yc = y.c;
-
- // Either NaN, Infinity or 0?
- if ( !xc || !xc[0] || !yc || !yc[0] ) {
-
- return new BigNumber(
-
- // Return NaN if either NaN, or both Infinity or 0.
- !x.s || !y.s || ( xc ? yc && xc[0] == yc[0] : !yc ) ? NaN :
-
- // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.
- xc && xc[0] == 0 || !yc ? s * 0 : s / 0
- );
- }
-
- q = new BigNumber(s);
- qc = q.c = [];
- e = x.e - y.e;
- s = dp + e + 1;
-
- if ( !base ) {
- base = BASE;
- e = bitFloor( x.e / LOG_BASE ) - bitFloor( y.e / LOG_BASE );
- s = s / LOG_BASE | 0;
- }
-
- // Result exponent may be one less then the current value of e.
- // The coefficients of the BigNumbers from convertBase may have trailing zeros.
- for ( i = 0; yc[i] == ( xc[i] || 0 ); i++ );
- if ( yc[i] > ( xc[i] || 0 ) ) e--;
-
- if ( s < 0 ) {
- qc.push(1);
- more = true;
- } else {
- xL = xc.length;
- yL = yc.length;
- i = 0;
- s += 2;
-
- // Normalise xc and yc so highest order digit of yc is >= base / 2.
-
- n = mathfloor( base / ( yc[0] + 1 ) );
-
- // Not necessary, but to handle odd bases where yc[0] == ( base / 2 ) - 1.
- // if ( n > 1 || n++ == 1 && yc[0] < base / 2 ) {
- if ( n > 1 ) {
- yc = multiply( yc, n, base );
- xc = multiply( xc, n, base );
- yL = yc.length;
- xL = xc.length;
- }
-
- xi = yL;
- rem = xc.slice( 0, yL );
- remL = rem.length;
-
- // Add zeros to make remainder as long as divisor.
- for ( ; remL < yL; rem[remL++] = 0 );
- yz = yc.slice();
- yz.unshift(0);
- yc0 = yc[0];
- if ( yc[1] >= base / 2 ) yc0++;
- // Not necessary, but to prevent trial digit n > base, when using base 3.
- // else if ( base == 3 && yc0 == 1 ) yc0 = 1 + 1e-15;
-
- do {
- n = 0;
-
- // Compare divisor and remainder.
- cmp = compare( yc, rem, yL, remL );
-
- // If divisor < remainder.
- if ( cmp < 0 ) {
-
- // Calculate trial digit, n.
-
- rem0 = rem[0];
- if ( yL != remL ) rem0 = rem0 * base + ( rem[1] || 0 );
-
- // n is how many times the divisor goes into the current remainder.
- n = mathfloor( rem0 / yc0 );
-
- // Algorithm:
- // 1. product = divisor * trial digit (n)
- // 2. if product > remainder: product -= divisor, n--
- // 3. remainder -= product
- // 4. if product was < remainder at 2:
- // 5. compare new remainder and divisor
- // 6. If remainder > divisor: remainder -= divisor, n++
-
- if ( n > 1 ) {
-
- // n may be > base only when base is 3.
- if (n >= base) n = base - 1;
-
- // product = divisor * trial digit.
- prod = multiply( yc, n, base );
- prodL = prod.length;
- remL = rem.length;
-
- // Compare product and remainder.
- // If product > remainder.
- // Trial digit n too high.
- // n is 1 too high about 5% of the time, and is not known to have
- // ever been more than 1 too high.
- while ( compare( prod, rem, prodL, remL ) == 1 ) {
- n--;
-
- // Subtract divisor from product.
- subtract( prod, yL < prodL ? yz : yc, prodL, base );
- prodL = prod.length;
- cmp = 1;
- }
- } else {
-
- // n is 0 or 1, cmp is -1.
- // If n is 0, there is no need to compare yc and rem again below,
- // so change cmp to 1 to avoid it.
- // If n is 1, leave cmp as -1, so yc and rem are compared again.
- if ( n == 0 ) {
-
- // divisor < remainder, so n must be at least 1.
- cmp = n = 1;
- }
-
- // product = divisor
- prod = yc.slice();
- prodL = prod.length;
- }
-
- if ( prodL < remL ) prod.unshift(0);
-
- // Subtract product from remainder.
- subtract( rem, prod, remL, base );
- remL = rem.length;
-
- // If product was < remainder.
- if ( cmp == -1 ) {
-
- // Compare divisor and new remainder.
- // If divisor < new remainder, subtract divisor from remainder.
- // Trial digit n too low.
- // n is 1 too low about 5% of the time, and very rarely 2 too low.
- while ( compare( yc, rem, yL, remL ) < 1 ) {
- n++;
-
- // Subtract divisor from remainder.
- subtract( rem, yL < remL ? yz : yc, remL, base );
- remL = rem.length;
- }
- }
- } else if ( cmp === 0 ) {
- n++;
- rem = [0];
- } // else cmp === 1 and n will be 0
-
- // Add the next digit, n, to the result array.
- qc[i++] = n;
-
- // Update the remainder.
- if ( rem[0] ) {
- rem[remL++] = xc[xi] || 0;
- } else {
- rem = [ xc[xi] ];
- remL = 1;
- }
- } while ( ( xi++ < xL || rem[0] != null ) && s-- );
-
- more = rem[0] != null;
-
- // Leading zero?
- if ( !qc[0] ) qc.shift();
- }
-
- if ( base == BASE ) {
-
- // To calculate q.e, first get the number of digits of qc[0].
- for ( i = 1, s = qc[0]; s >= 10; s /= 10, i++ );
- round( q, dp + ( q.e = i + e * LOG_BASE - 1 ) + 1, rm, more );
-
- // Caller is convertBase.
- } else {
- q.e = e;
- q.r = +more;
- }
-
- return q;
- };
- })();
-
-
- /*
- * Return a string representing the value of BigNumber n in fixed-point or exponential
- * notation rounded to the specified decimal places or significant digits.
- *
- * n is a BigNumber.
- * i is the index of the last digit required (i.e. the digit that may be rounded up).
- * rm is the rounding mode.
- * caller is caller id: toExponential 19, toFixed 20, toFormat 21, toPrecision 24.
- */
- function format( n, i, rm, caller ) {
- var c0, e, ne, len, str;
-
- rm = rm != null && isValidInt( rm, 0, 8, caller, roundingMode )
- ? rm | 0 : ROUNDING_MODE;
-
- if ( !n.c ) return n.toString();
- c0 = n.c[0];
- ne = n.e;
-
- if ( i == null ) {
- str = coeffToString( n.c );
- str = caller == 19 || caller == 24 && ne <= TO_EXP_NEG
- ? toExponential( str, ne )
- : toFixedPoint( str, ne );
- } else {
- n = round( new BigNumber(n), i, rm );
-
- // n.e may have changed if the value was rounded up.
- e = n.e;
-
- str = coeffToString( n.c );
- len = str.length;
-
- // toPrecision returns exponential notation if the number of significant digits
- // specified is less than the number of digits necessary to represent the integer
- // part of the value in fixed-point notation.
-
- // Exponential notation.
- if ( caller == 19 || caller == 24 && ( i <= e || e <= TO_EXP_NEG ) ) {
-
- // Append zeros?
- for ( ; len < i; str += '0', len++ );
- str = toExponential( str, e );
-
- // Fixed-point notation.
- } else {
- i -= ne;
- str = toFixedPoint( str, e );
-
- // Append zeros?
- if ( e + 1 > len ) {
- if ( --i > 0 ) for ( str += '.'; i--; str += '0' );
- } else {
- i += e - len;
- if ( i > 0 ) {
- if ( e + 1 == len ) str += '.';
- for ( ; i--; str += '0' );
- }
- }
- }
- }
-
- return n.s < 0 && c0 ? '-' + str : str;
- }
-
-
- // Handle BigNumber.max and BigNumber.min.
- function maxOrMin( args, method ) {
- var m, n,
- i = 0;
-
- if ( isArray( args[0] ) ) args = args[0];
- m = new BigNumber( args[0] );
-
- for ( ; ++i < args.length; ) {
- n = new BigNumber( args[i] );
-
- // If any number is NaN, return NaN.
- if ( !n.s ) {
- m = n;
- break;
- } else if ( method.call( m, n ) ) {
- m = n;
- }
- }
-
- return m;
- }
-
-
- /*
- * Return true if n is an integer in range, otherwise throw.
- * Use for argument validation when ERRORS is true.
- */
- function intValidatorWithErrors( n, min, max, caller, name ) {
- if ( n < min || n > max || n != truncate(n) ) {
- raise( caller, ( name || 'decimal places' ) +
- ( n < min || n > max ? ' out of range' : ' not an integer' ), n );
- }
-
- return true;
- }
-
-
- /*
- * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.
- * Called by minus, plus and times.
- */
- function normalise( n, c, e ) {
- var i = 1,
- j = c.length;
-
- // Remove trailing zeros.
- for ( ; !c[--j]; c.pop() );
-
- // Calculate the base 10 exponent. First get the number of digits of c[0].
- for ( j = c[0]; j >= 10; j /= 10, i++ );
-
- // Overflow?
- if ( ( e = i + e * LOG_BASE - 1 ) > MAX_EXP ) {
-
- // Infinity.
- n.c = n.e = null;
-
- // Underflow?
- } else if ( e < MIN_EXP ) {
-
- // Zero.
- n.c = [ n.e = 0 ];
- } else {
- n.e = e;
- n.c = c;
- }
-
- return n;
- }
-
-
- // Handle values that fail the validity test in BigNumber.
- parseNumeric = (function () {
- var basePrefix = /^(-?)0([xbo])(?=\w[\w.]*$)/i,
- dotAfter = /^([^.]+)\.$/,
- dotBefore = /^\.([^.]+)$/,
- isInfinityOrNaN = /^-?(Infinity|NaN)$/,
- whitespaceOrPlus = /^\s*\+(?=[\w.])|^\s+|\s+$/g;
-
- return function ( x, str, num, b ) {
- var base,
- s = num ? str : str.replace( whitespaceOrPlus, '' );
-
- // No exception on ±Infinity or NaN.
- if ( isInfinityOrNaN.test(s) ) {
- x.s = isNaN(s) ? null : s < 0 ? -1 : 1;
- } else {
- if ( !num ) {
-
- // basePrefix = /^(-?)0([xbo])(?=\w[\w.]*$)/i
- s = s.replace( basePrefix, function ( m, p1, p2 ) {
- base = ( p2 = p2.toLowerCase() ) == 'x' ? 16 : p2 == 'b' ? 2 : 8;
- return !b || b == base ? p1 : m;
- });
-
- if (b) {
- base = b;
-
- // E.g. '1.' to '1', '.1' to '0.1'
- s = s.replace( dotAfter, '$1' ).replace( dotBefore, '0.$1' );
- }
-
- if ( str != s ) return new BigNumber( s, base );
- }
-
- // 'new BigNumber() not a number: {n}'
- // 'new BigNumber() not a base {b} number: {n}'
- if (ERRORS) raise( id, 'not a' + ( b ? ' base ' + b : '' ) + ' number', str );
- x.s = null;
- }
-
- x.c = x.e = null;
- id = 0;
- }
- })();
-
-
- // Throw a BigNumber Error.
- function raise( caller, msg, val ) {
- var error = new Error( [
- 'new BigNumber', // 0
- 'cmp', // 1
- 'config', // 2
- 'div', // 3
- 'divToInt', // 4
- 'eq', // 5
- 'gt', // 6
- 'gte', // 7
- 'lt', // 8
- 'lte', // 9
- 'minus', // 10
- 'mod', // 11
- 'plus', // 12
- 'precision', // 13
- 'random', // 14
- 'round', // 15
- 'shift', // 16
- 'times', // 17
- 'toDigits', // 18
- 'toExponential', // 19
- 'toFixed', // 20
- 'toFormat', // 21
- 'toFraction', // 22
- 'pow', // 23
- 'toPrecision', // 24
- 'toString', // 25
- 'BigNumber' // 26
- ][caller] + '() ' + msg + ': ' + val );
-
- error.name = 'BigNumber Error';
- id = 0;
- throw error;
- }
-
-
- /*
- * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.
- * If r is truthy, it is known that there are more digits after the rounding digit.
- */
- function round( x, sd, rm, r ) {
- var d, i, j, k, n, ni, rd,
- xc = x.c,
- pows10 = POWS_TEN;
-
- // if x is not Infinity or NaN...
- if (xc) {
-
- // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.
- // n is a base 1e14 number, the value of the element of array x.c containing rd.
- // ni is the index of n within x.c.
- // d is the number of digits of n.
- // i is the index of rd within n including leading zeros.
- // j is the actual index of rd within n (if < 0, rd is a leading zero).
- out: {
-
- // Get the number of digits of the first element of xc.
- for ( d = 1, k = xc[0]; k >= 10; k /= 10, d++ );
- i = sd - d;
-
- // If the rounding digit is in the first element of xc...
- if ( i < 0 ) {
- i += LOG_BASE;
- j = sd;
- n = xc[ ni = 0 ];
-
- // Get the rounding digit at index j of n.
- rd = n / pows10[ d - j - 1 ] % 10 | 0;
- } else {
- ni = mathceil( ( i + 1 ) / LOG_BASE );
-
- if ( ni >= xc.length ) {
-
- if (r) {
-
- // Needed by sqrt.
- for ( ; xc.length <= ni; xc.push(0) );
- n = rd = 0;
- d = 1;
- i %= LOG_BASE;
- j = i - LOG_BASE + 1;
- } else {
- break out;
- }
- } else {
- n = k = xc[ni];
-
- // Get the number of digits of n.
- for ( d = 1; k >= 10; k /= 10, d++ );
-
- // Get the index of rd within n.
- i %= LOG_BASE;
-
- // Get the index of rd within n, adjusted for leading zeros.
- // The number of leading zeros of n is given by LOG_BASE - d.
- j = i - LOG_BASE + d;
-
- // Get the rounding digit at index j of n.
- rd = j < 0 ? 0 : n / pows10[ d - j - 1 ] % 10 | 0;
- }
- }
-
- r = r || sd < 0 ||
-
- // Are there any non-zero digits after the rounding digit?
- // The expression n % pows10[ d - j - 1 ] returns all digits of n to the right
- // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.
- xc[ni + 1] != null || ( j < 0 ? n : n % pows10[ d - j - 1 ] );
-
- r = rm < 4
- ? ( rd || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )
- : rd > 5 || rd == 5 && ( rm == 4 || r || rm == 6 &&
-
- // Check whether the digit to the left of the rounding digit is odd.
- ( ( i > 0 ? j > 0 ? n / pows10[ d - j ] : 0 : xc[ni - 1] ) % 10 ) & 1 ||
- rm == ( x.s < 0 ? 8 : 7 ) );
-
- if ( sd < 1 || !xc[0] ) {
- xc.length = 0;
-
- if (r) {
-
- // Convert sd to decimal places.
- sd -= x.e + 1;
-
- // 1, 0.1, 0.01, 0.001, 0.0001 etc.
- xc[0] = pows10[ ( LOG_BASE - sd % LOG_BASE ) % LOG_BASE ];
- x.e = -sd || 0;
- } else {
-
- // Zero.
- xc[0] = x.e = 0;
- }
-
- return x;
- }
-
- // Remove excess digits.
- if ( i == 0 ) {
- xc.length = ni;
- k = 1;
- ni--;
- } else {
- xc.length = ni + 1;
- k = pows10[ LOG_BASE - i ];
-
- // E.g. 56700 becomes 56000 if 7 is the rounding digit.
- // j > 0 means i > number of leading zeros of n.
- xc[ni] = j > 0 ? mathfloor( n / pows10[ d - j ] % pows10[j] ) * k : 0;
- }
-
- // Round up?
- if (r) {
-
- for ( ; ; ) {
-
- // If the digit to be rounded up is in the first element of xc...
- if ( ni == 0 ) {
-
- // i will be the length of xc[0] before k is added.
- for ( i = 1, j = xc[0]; j >= 10; j /= 10, i++ );
- j = xc[0] += k;
- for ( k = 1; j >= 10; j /= 10, k++ );
-
- // if i != k the length has increased.
- if ( i != k ) {
- x.e++;
- if ( xc[0] == BASE ) xc[0] = 1;
- }
-
- break;
- } else {
- xc[ni] += k;
- if ( xc[ni] != BASE ) break;
- xc[ni--] = 0;
- k = 1;
- }
- }
- }
-
- // Remove trailing zeros.
- for ( i = xc.length; xc[--i] === 0; xc.pop() );
- }
-
- // Overflow? Infinity.
- if ( x.e > MAX_EXP ) {
- x.c = x.e = null;
-
- // Underflow? Zero.
- } else if ( x.e < MIN_EXP ) {
- x.c = [ x.e = 0 ];
- }
- }
-
- return x;
- }
-
-
- // PROTOTYPE/INSTANCE METHODS
-
-
- /*
- * Return a new BigNumber whose value is the absolute value of this BigNumber.
- */
- P.absoluteValue = P.abs = function () {
- var x = new BigNumber(this);
- if ( x.s < 0 ) x.s = 1;
- return x;
- };
-
-
- /*
- * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole
- * number in the direction of Infinity.
- */
- P.ceil = function () {
- return round( new BigNumber(this), this.e + 1, 2 );
- };
-
-
- /*
- * Return
- * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),
- * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),
- * 0 if they have the same value,
- * or null if the value of either is NaN.
- */
- P.comparedTo = P.cmp = function ( y, b ) {
- id = 1;
- return compare( this, new BigNumber( y, b ) );
- };
-
-
- /*
- * Return the number of decimal places of the value of this BigNumber, or null if the value
- * of this BigNumber is ±Infinity or NaN.
- */
- P.decimalPlaces = P.dp = function () {
- var n, v,
- c = this.c;
-
- if ( !c ) return null;
- n = ( ( v = c.length - 1 ) - bitFloor( this.e / LOG_BASE ) ) * LOG_BASE;
-
- // Subtract the number of trailing zeros of the last number.
- if ( v = c[v] ) for ( ; v % 10 == 0; v /= 10, n-- );
- if ( n < 0 ) n = 0;
-
- return n;
- };
-
-
- /*
- * n / 0 = I
- * n / N = N
- * n / I = 0
- * 0 / n = 0
- * 0 / 0 = N
- * 0 / N = N
- * 0 / I = 0
- * N / n = N
- * N / 0 = N
- * N / N = N
- * N / I = N
- * I / n = I
- * I / 0 = I
- * I / N = N
- * I / I = N
- *
- * Return a new BigNumber whose value is the value of this BigNumber divided by the value of
- * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.
- */
- P.dividedBy = P.div = function ( y, b ) {
- id = 3;
- return div( this, new BigNumber( y, b ), DECIMAL_PLACES, ROUNDING_MODE );
- };
-
-
- /*
- * Return a new BigNumber whose value is the integer part of dividing the value of this
- * BigNumber by the value of BigNumber(y, b).
- */
- P.dividedToIntegerBy = P.divToInt = function ( y, b ) {
- id = 4;
- return div( this, new BigNumber( y, b ), 0, 1 );
- };
-
-
- /*
- * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),
- * otherwise returns false.
- */
- P.equals = P.eq = function ( y, b ) {
- id = 5;
- return compare( this, new BigNumber( y, b ) ) === 0;
- };
-
-
- /*
- * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole
- * number in the direction of -Infinity.
- */
- P.floor = function () {
- return round( new BigNumber(this), this.e + 1, 3 );
- };
-
-
- /*
- * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),
- * otherwise returns false.
- */
- P.greaterThan = P.gt = function ( y, b ) {
- id = 6;
- return compare( this, new BigNumber( y, b ) ) > 0;
- };
-
-
- /*
- * Return true if the value of this BigNumber is greater than or equal to the value of
- * BigNumber(y, b), otherwise returns false.
- */
- P.greaterThanOrEqualTo = P.gte = function ( y, b ) {
- id = 7;
- return ( b = compare( this, new BigNumber( y, b ) ) ) === 1 || b === 0;
-
- };
-
-
- /*
- * Return true if the value of this BigNumber is a finite number, otherwise returns false.
- */
- P.isFinite = function () {
- return !!this.c;
- };
-
-
- /*
- * Return true if the value of this BigNumber is an integer, otherwise return false.
- */
- P.isInteger = P.isInt = function () {
- return !!this.c && bitFloor( this.e / LOG_BASE ) > this.c.length - 2;
- };
-
-
- /*
- * Return true if the value of this BigNumber is NaN, otherwise returns false.
- */
- P.isNaN = function () {
- return !this.s;
- };
-
-
- /*
- * Return true if the value of this BigNumber is negative, otherwise returns false.
- */
- P.isNegative = P.isNeg = function () {
- return this.s < 0;
- };
-
-
- /*
- * Return true if the value of this BigNumber is 0 or -0, otherwise returns false.
- */
- P.isZero = function () {
- return !!this.c && this.c[0] == 0;
- };
-
-
- /*
- * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),
- * otherwise returns false.
- */
- P.lessThan = P.lt = function ( y, b ) {
- id = 8;
- return compare( this, new BigNumber( y, b ) ) < 0;
- };
-
-
- /*
- * Return true if the value of this BigNumber is less than or equal to the value of
- * BigNumber(y, b), otherwise returns false.
- */
- P.lessThanOrEqualTo = P.lte = function ( y, b ) {
- id = 9;
- return ( b = compare( this, new BigNumber( y, b ) ) ) === -1 || b === 0;
- };
-
-
- /*
- * n - 0 = n
- * n - N = N
- * n - I = -I
- * 0 - n = -n
- * 0 - 0 = 0
- * 0 - N = N
- * 0 - I = -I
- * N - n = N
- * N - 0 = N
- * N - N = N
- * N - I = N
- * I - n = I
- * I - 0 = I
- * I - N = N
- * I - I = N
- *
- * Return a new BigNumber whose value is the value of this BigNumber minus the value of
- * BigNumber(y, b).
- */
- P.minus = P.sub = function ( y, b ) {
- var i, j, t, xLTy,
- x = this,
- a = x.s;
-
- id = 10;
- y = new BigNumber( y, b );
- b = y.s;
-
- // Either NaN?
- if ( !a || !b ) return new BigNumber(NaN);
-
- // Signs differ?
- if ( a != b ) {
- y.s = -b;
- return x.plus(y);
- }
-
- var xe = x.e / LOG_BASE,
- ye = y.e / LOG_BASE,
- xc = x.c,
- yc = y.c;
-
- if ( !xe || !ye ) {
-
- // Either Infinity?
- if ( !xc || !yc ) return xc ? ( y.s = -b, y ) : new BigNumber( yc ? x : NaN );
-
- // Either zero?
- if ( !xc[0] || !yc[0] ) {
-
- // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.
- return yc[0] ? ( y.s = -b, y ) : new BigNumber( xc[0] ? x :
-
- // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity
- ROUNDING_MODE == 3 ? -0 : 0 );
- }
- }
-
- xe = bitFloor(xe);
- ye = bitFloor(ye);
- xc = xc.slice();
-
- // Determine which is the bigger number.
- if ( a = xe - ye ) {
-
- if ( xLTy = a < 0 ) {
- a = -a;
- t = xc;
- } else {
- ye = xe;
- t = yc;
- }
-
- t.reverse();
-
- // Prepend zeros to equalise exponents.
- for ( b = a; b--; t.push(0) );
- t.reverse();
- } else {
-
- // Exponents equal. Check digit by digit.
- j = ( xLTy = ( a = xc.length ) < ( b = yc.length ) ) ? a : b;
-
- for ( a = b = 0; b < j; b++ ) {
-
- if ( xc[b] != yc[b] ) {
- xLTy = xc[b] < yc[b];
- break;
- }
- }
- }
-
- // x < y? Point xc to the array of the bigger number.
- if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;
-
- b = ( j = yc.length ) - ( i = xc.length );
-
- // Append zeros to xc if shorter.
- // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.
- if ( b > 0 ) for ( ; b--; xc[i++] = 0 );
- b = BASE - 1;
-
- // Subtract yc from xc.
- for ( ; j > a; ) {
-
- if ( xc[--j] < yc[j] ) {
- for ( i = j; i && !xc[--i]; xc[i] = b );
- --xc[i];
- xc[j] += BASE;
- }
-
- xc[j] -= yc[j];
- }
-
- // Remove leading zeros and adjust exponent accordingly.
- for ( ; xc[0] == 0; xc.shift(), --ye );
-
- // Zero?
- if ( !xc[0] ) {
-
- // Following IEEE 754 (2008) 6.3,
- // n - n = +0 but n - n = -0 when rounding towards -Infinity.
- y.s = ROUNDING_MODE == 3 ? -1 : 1;
- y.c = [ y.e = 0 ];
- return y;
- }
-
- // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity
- // for finite x and y.
- return normalise( y, xc, ye );
- };
-
-
- /*
- * n % 0 = N
- * n % N = N
- * n % I = n
- * 0 % n = 0
- * -0 % n = -0
- * 0 % 0 = N
- * 0 % N = N
- * 0 % I = 0
- * N % n = N
- * N % 0 = N
- * N % N = N
- * N % I = N
- * I % n = N
- * I % 0 = N
- * I % N = N
- * I % I = N
- *
- * Return a new BigNumber whose value is the value of this BigNumber modulo the value of
- * BigNumber(y, b). The result depends on the value of MODULO_MODE.
- */
- P.modulo = P.mod = function ( y, b ) {
- var q, s,
- x = this;
-
- id = 11;
- y = new BigNumber( y, b );
-
- // Return NaN if x is Infinity or NaN, or y is NaN or zero.
- if ( !x.c || !y.s || y.c && !y.c[0] ) {
- return new BigNumber(NaN);
-
- // Return x if y is Infinity or x is zero.
- } else if ( !y.c || x.c && !x.c[0] ) {
- return new BigNumber(x);
- }
-
- if ( MODULO_MODE == 9 ) {
-
- // Euclidian division: q = sign(y) * floor(x / abs(y))
- // r = x - qy where 0 <= r < abs(y)
- s = y.s;
- y.s = 1;
- q = div( x, y, 0, 3 );
- y.s = s;
- q.s *= s;
- } else {
- q = div( x, y, 0, MODULO_MODE );
- }
-
- return x.minus( q.times(y) );
- };
-
-
- /*
- * Return a new BigNumber whose value is the value of this BigNumber negated,
- * i.e. multiplied by -1.
- */
- P.negated = P.neg = function () {
- var x = new BigNumber(this);
- x.s = -x.s || null;
- return x;
- };
-
-
- /*
- * n + 0 = n
- * n + N = N
- * n + I = I
- * 0 + n = n
- * 0 + 0 = 0
- * 0 + N = N
- * 0 + I = I
- * N + n = N
- * N + 0 = N
- * N + N = N
- * N + I = N
- * I + n = I
- * I + 0 = I
- * I + N = N
- * I + I = I
- *
- * Return a new BigNumber whose value is the value of this BigNumber plus the value of
- * BigNumber(y, b).
- */
- P.plus = P.add = function ( y, b ) {
- var t,
- x = this,
- a = x.s;
-
- id = 12;
- y = new BigNumber( y, b );
- b = y.s;
-
- // Either NaN?
- if ( !a || !b ) return new BigNumber(NaN);
-
- // Signs differ?
- if ( a != b ) {
- y.s = -b;
- return x.minus(y);
- }
-
- var xe = x.e / LOG_BASE,
- ye = y.e / LOG_BASE,
- xc = x.c,
- yc = y.c;
-
- if ( !xe || !ye ) {
-
- // Return ±Infinity if either ±Infinity.
- if ( !xc || !yc ) return new BigNumber( a / 0 );
-
- // Either zero?
- // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.
- if ( !xc[0] || !yc[0] ) return yc[0] ? y : new BigNumber( xc[0] ? x : a * 0 );
- }
-
- xe = bitFloor(xe);
- ye = bitFloor(ye);
- xc = xc.slice();
-
- // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.
- if ( a = xe - ye ) {
- if ( a > 0 ) {
- ye = xe;
- t = yc;
- } else {
- a = -a;
- t = xc;
- }
-
- t.reverse();
- for ( ; a--; t.push(0) );
- t.reverse();
- }
-
- a = xc.length;
- b = yc.length;
-
- // Point xc to the longer array, and b to the shorter length.
- if ( a - b < 0 ) t = yc, yc = xc, xc = t, b = a;
-
- // Only start adding at yc.length - 1 as the further digits of xc can be ignored.
- for ( a = 0; b; ) {
- a = ( xc[--b] = xc[b] + yc[b] + a ) / BASE | 0;
- xc[b] %= BASE;
- }
-
- if (a) {
- xc.unshift(a);
- ++ye;
- }
-
- // No need to check for zero, as +x + +y != 0 && -x + -y != 0
- // ye = MAX_EXP + 1 possible
- return normalise( y, xc, ye );
- };
-
-
- /*
- * Return the number of significant digits of the value of this BigNumber.
- *
- * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.
- */
- P.precision = P.sd = function (z) {
- var n, v,
- x = this,
- c = x.c;
-
- // 'precision() argument not a boolean or binary digit: {z}'
- if ( z != null && z !== !!z && z !== 1 && z !== 0 ) {
- if (ERRORS) raise( 13, 'argument' + notBool, z );
- if ( z != !!z ) z = null;
- }
-
- if ( !c ) return null;
- v = c.length - 1;
- n = v * LOG_BASE + 1;
-
- if ( v = c[v] ) {
-
- // Subtract the number of trailing zeros of the last element.
- for ( ; v % 10 == 0; v /= 10, n-- );
-
- // Add the number of digits of the first element.
- for ( v = c[0]; v >= 10; v /= 10, n++ );
- }
-
- if ( z && x.e + 1 > n ) n = x.e + 1;
-
- return n;
- };
-
-
- /*
- * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of
- * dp decimal places using rounding mode rm, or to 0 and ROUNDING_MODE respectively if
- * omitted.
- *
- * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.
- * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
- *
- * 'round() decimal places out of range: {dp}'
- * 'round() decimal places not an integer: {dp}'
- * 'round() rounding mode not an integer: {rm}'
- * 'round() rounding mode out of range: {rm}'
- */
- P.round = function ( dp, rm ) {
- var n = new BigNumber(this);
-
- if ( dp == null || isValidInt( dp, 0, MAX, 15 ) ) {
- round( n, ~~dp + this.e + 1, rm == null ||
- !isValidInt( rm, 0, 8, 15, roundingMode ) ? ROUNDING_MODE : rm | 0 );
- }
-
- return n;
- };
-
-
- /*
- * Return a new BigNumber whose value is the value of this BigNumber shifted by k places
- * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.
- *
- * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.
- *
- * If k is out of range and ERRORS is false, the result will be ±0 if k < 0, or ±Infinity
- * otherwise.
- *
- * 'shift() argument not an integer: {k}'
- * 'shift() argument out of range: {k}'
- */
- P.shift = function (k) {
- var n = this;
- return isValidInt( k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 16, 'argument' )
-
- // k < 1e+21, or truncate(k) will produce exponential notation.
- ? n.times( '1e' + truncate(k) )
- : new BigNumber( n.c && n.c[0] && ( k < -MAX_SAFE_INTEGER || k > MAX_SAFE_INTEGER )
- ? n.s * ( k < 0 ? 0 : 1 / 0 )
- : n );
- };
-
-
- /*
- * sqrt(-n) = N
- * sqrt( N) = N
- * sqrt(-I) = N
- * sqrt( I) = I
- * sqrt( 0) = 0
- * sqrt(-0) = -0
- *
- * Return a new BigNumber whose value is the square root of the value of this BigNumber,
- * rounded according to DECIMAL_PLACES and ROUNDING_MODE.
- */
- P.squareRoot = P.sqrt = function () {
- var m, n, r, rep, t,
- x = this,
- c = x.c,
- s = x.s,
- e = x.e,
- dp = DECIMAL_PLACES + 4,
- half = new BigNumber('0.5');
-
- // Negative/NaN/Infinity/zero?
- if ( s !== 1 || !c || !c[0] ) {
- return new BigNumber( !s || s < 0 && ( !c || c[0] ) ? NaN : c ? x : 1 / 0 );
- }
-
- // Initial estimate.
- s = Math.sqrt( +x );
-
- // Math.sqrt underflow/overflow?
- // Pass x to Math.sqrt as integer, then adjust the exponent of the result.
- if ( s == 0 || s == 1 / 0 ) {
- n = coeffToString(c);
- if ( ( n.length + e ) % 2 == 0 ) n += '0';
- s = Math.sqrt(n);
- e = bitFloor( ( e + 1 ) / 2 ) - ( e < 0 || e % 2 );
-
- if ( s == 1 / 0 ) {
- n = '1e' + e;
- } else {
- n = s.toExponential();
- n = n.slice( 0, n.indexOf('e') + 1 ) + e;
- }
-
- r = new BigNumber(n);
- } else {
- r = new BigNumber( s + '' );
- }
-
- // Check for zero.
- // r could be zero if MIN_EXP is changed after the this value was created.
- // This would cause a division by zero (x/t) and hence Infinity below, which would cause
- // coeffToString to throw.
- if ( r.c[0] ) {
- e = r.e;
- s = e + dp;
- if ( s < 3 ) s = 0;
-
- // Newton-Raphson iteration.
- for ( ; ; ) {
- t = r;
- r = half.times( t.plus( div( x, t, dp, 1 ) ) );
-
- if ( coeffToString( t.c ).slice( 0, s ) === ( n =
- coeffToString( r.c ) ).slice( 0, s ) ) {
-
- // The exponent of r may here be one less than the final result exponent,
- // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits
- // are indexed correctly.
- if ( r.e < e ) --s;
- n = n.slice( s - 3, s + 1 );
-
- // The 4th rounding digit may be in error by -1 so if the 4 rounding digits
- // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the
- // iteration.
- if ( n == '9999' || !rep && n == '4999' ) {
-
- // On the first iteration only, check to see if rounding up gives the
- // exact result as the nines may infinitely repeat.
- if ( !rep ) {
- round( t, t.e + DECIMAL_PLACES + 2, 0 );
-
- if ( t.times(t).eq(x) ) {
- r = t;
- break;
- }
- }
-
- dp += 4;
- s += 4;
- rep = 1;
- } else {
-
- // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact
- // result. If not, then there are further digits and m will be truthy.
- if ( !+n || !+n.slice(1) && n.charAt(0) == '5' ) {
-
- // Truncate to the first rounding digit.
- round( r, r.e + DECIMAL_PLACES + 2, 1 );
- m = !r.times(r).eq(x);
- }
-
- break;
- }
- }
- }
- }
-
- return round( r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m );
- };
-
-
- /*
- * n * 0 = 0
- * n * N = N
- * n * I = I
- * 0 * n = 0
- * 0 * 0 = 0
- * 0 * N = N
- * 0 * I = N
- * N * n = N
- * N * 0 = N
- * N * N = N
- * N * I = N
- * I * n = I
- * I * 0 = N
- * I * N = N
- * I * I = I
- *
- * Return a new BigNumber whose value is the value of this BigNumber times the value of
- * BigNumber(y, b).
- */
- P.times = P.mul = function ( y, b ) {
- var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,
- base, sqrtBase,
- x = this,
- xc = x.c,
- yc = ( id = 17, y = new BigNumber( y, b ) ).c;
-
- // Either NaN, ±Infinity or ±0?
- if ( !xc || !yc || !xc[0] || !yc[0] ) {
-
- // Return NaN if either is NaN, or one is 0 and the other is Infinity.
- if ( !x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc ) {
- y.c = y.e = y.s = null;
- } else {
- y.s *= x.s;
-
- // Return ±Infinity if either is ±Infinity.
- if ( !xc || !yc ) {
- y.c = y.e = null;
-
- // Return ±0 if either is ±0.
- } else {
- y.c = [0];
- y.e = 0;
- }
- }
-
- return y;
- }
-
- e = bitFloor( x.e / LOG_BASE ) + bitFloor( y.e / LOG_BASE );
- y.s *= x.s;
- xcL = xc.length;
- ycL = yc.length;
-
- // Ensure xc points to longer array and xcL to its length.
- if ( xcL < ycL ) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;
-
- // Initialise the result array with zeros.
- for ( i = xcL + ycL, zc = []; i--; zc.push(0) );
-
- base = BASE;
- sqrtBase = SQRT_BASE;
-
- for ( i = ycL; --i >= 0; ) {
- c = 0;
- ylo = yc[i] % sqrtBase;
- yhi = yc[i] / sqrtBase | 0;
-
- for ( k = xcL, j = i + k; j > i; ) {
- xlo = xc[--k] % sqrtBase;
- xhi = xc[k] / sqrtBase | 0;
- m = yhi * xlo + xhi * ylo;
- xlo = ylo * xlo + ( ( m % sqrtBase ) * sqrtBase ) + zc[j] + c;
- c = ( xlo / base | 0 ) + ( m / sqrtBase | 0 ) + yhi * xhi;
- zc[j--] = xlo % base;
- }
-
- zc[j] = c;
- }
-
- if (c) {
- ++e;
- } else {
- zc.shift();
- }
-
- return normalise( y, zc, e );
- };
-
-
- /*
- * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of
- * sd significant digits using rounding mode rm, or ROUNDING_MODE if rm is omitted.
- *
- * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.
- * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
- *
- * 'toDigits() precision out of range: {sd}'
- * 'toDigits() precision not an integer: {sd}'
- * 'toDigits() rounding mode not an integer: {rm}'
- * 'toDigits() rounding mode out of range: {rm}'
- */
- P.toDigits = function ( sd, rm ) {
- var n = new BigNumber(this);
- sd = sd == null || !isValidInt( sd, 1, MAX, 18, 'precision' ) ? null : sd | 0;
- rm = rm == null || !isValidInt( rm, 0, 8, 18, roundingMode ) ? ROUNDING_MODE : rm | 0;
- return sd ? round( n, sd, rm ) : n;
- };
-
-
- /*
- * Return a string representing the value of this BigNumber in exponential notation and
- * rounded using ROUNDING_MODE to dp fixed decimal places.
- *
- * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.
- * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
- *
- * 'toExponential() decimal places not an integer: {dp}'
- * 'toExponential() decimal places out of range: {dp}'
- * 'toExponential() rounding mode not an integer: {rm}'
- * 'toExponential() rounding mode out of range: {rm}'
- */
- P.toExponential = function ( dp, rm ) {
- return format( this,
- dp != null && isValidInt( dp, 0, MAX, 19 ) ? ~~dp + 1 : null, rm, 19 );
- };
-
-
- /*
- * Return a string representing the value of this BigNumber in fixed-point notation rounding
- * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.
- *
- * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',
- * but e.g. (-0.00001).toFixed(0) is '-0'.
- *
- * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.
- * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
- *
- * 'toFixed() decimal places not an integer: {dp}'
- * 'toFixed() decimal places out of range: {dp}'
- * 'toFixed() rounding mode not an integer: {rm}'
- * 'toFixed() rounding mode out of range: {rm}'
- */
- P.toFixed = function ( dp, rm ) {
- return format( this, dp != null && isValidInt( dp, 0, MAX, 20 )
- ? ~~dp + this.e + 1 : null, rm, 20 );
- };
-
-
- /*
- * Return a string representing the value of this BigNumber in fixed-point notation rounded
- * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties
- * of the FORMAT object (see BigNumber.config).
- *
- * FORMAT = {
- * decimalSeparator : '.',
- * groupSeparator : ',',
- * groupSize : 3,
- * secondaryGroupSize : 0,
- * fractionGroupSeparator : '\xA0', // non-breaking space
- * fractionGroupSize : 0
- * };
- *
- * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.
- * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
- *
- * 'toFormat() decimal places not an integer: {dp}'
- * 'toFormat() decimal places out of range: {dp}'
- * 'toFormat() rounding mode not an integer: {rm}'
- * 'toFormat() rounding mode out of range: {rm}'
- */
- P.toFormat = function ( dp, rm ) {
- var str = format( this, dp != null && isValidInt( dp, 0, MAX, 21 )
- ? ~~dp + this.e + 1 : null, rm, 21 );
-
- if ( this.c ) {
- var i,
- arr = str.split('.'),
- g1 = +FORMAT.groupSize,
- g2 = +FORMAT.secondaryGroupSize,
- groupSeparator = FORMAT.groupSeparator,
- intPart = arr[0],
- fractionPart = arr[1],
- isNeg = this.s < 0,
- intDigits = isNeg ? intPart.slice(1) : intPart,
- len = intDigits.length;
-
- if (g2) i = g1, g1 = g2, g2 = i, len -= i;
-
- if ( g1 > 0 && len > 0 ) {
- i = len % g1 || g1;
- intPart = intDigits.substr( 0, i );
-
- for ( ; i < len; i += g1 ) {
- intPart += groupSeparator + intDigits.substr( i, g1 );
- }
-
- if ( g2 > 0 ) intPart += groupSeparator + intDigits.slice(i);
- if (isNeg) intPart = '-' + intPart;
- }
-
- str = fractionPart
- ? intPart + FORMAT.decimalSeparator + ( ( g2 = +FORMAT.fractionGroupSize )
- ? fractionPart.replace( new RegExp( '\\d{' + g2 + '}\\B', 'g' ),
- '$&' + FORMAT.fractionGroupSeparator )
- : fractionPart )
- : intPart;
- }
-
- return str;
- };
-
-
- /*
- * Return a string array representing the value of this BigNumber as a simple fraction with
- * an integer numerator and an integer denominator. The denominator will be a positive
- * non-zero value less than or equal to the specified maximum denominator. If a maximum
- * denominator is not specified, the denominator will be the lowest value necessary to
- * represent the number exactly.
- *
- * [md] {number|string|BigNumber} Integer >= 1 and < Infinity. The maximum denominator.
- *
- * 'toFraction() max denominator not an integer: {md}'
- * 'toFraction() max denominator out of range: {md}'
- */
- P.toFraction = function (md) {
- var arr, d0, d2, e, exp, n, n0, q, s,
- k = ERRORS,
- x = this,
- xc = x.c,
- d = new BigNumber(ONE),
- n1 = d0 = new BigNumber(ONE),
- d1 = n0 = new BigNumber(ONE);
-
- if ( md != null ) {
- ERRORS = false;
- n = new BigNumber(md);
- ERRORS = k;
-
- if ( !( k = n.isInt() ) || n.lt(ONE) ) {
-
- if (ERRORS) {
- raise( 22,
- 'max denominator ' + ( k ? 'out of range' : 'not an integer' ), md );
- }
-
- // ERRORS is false:
- // If md is a finite non-integer >= 1, round it to an integer and use it.
- md = !k && n.c && round( n, n.e + 1, 1 ).gte(ONE) ? n : null;
- }
- }
-
- if ( !xc ) return x.toString();
- s = coeffToString(xc);
-
- // Determine initial denominator.
- // d is a power of 10 and the minimum max denominator that specifies the value exactly.
- e = d.e = s.length - x.e - 1;
- d.c[0] = POWS_TEN[ ( exp = e % LOG_BASE ) < 0 ? LOG_BASE + exp : exp ];
- md = !md || n.cmp(d) > 0 ? ( e > 0 ? d : n1 ) : n;
-
- exp = MAX_EXP;
- MAX_EXP = 1 / 0;
- n = new BigNumber(s);
-
- // n0 = d1 = 0
- n0.c[0] = 0;
-
- for ( ; ; ) {
- q = div( n, d, 0, 1 );
- d2 = d0.plus( q.times(d1) );
- if ( d2.cmp(md) == 1 ) break;
- d0 = d1;
- d1 = d2;
- n1 = n0.plus( q.times( d2 = n1 ) );
- n0 = d2;
- d = n.minus( q.times( d2 = d ) );
- n = d2;
- }
-
- d2 = div( md.minus(d0), d1, 0, 1 );
- n0 = n0.plus( d2.times(n1) );
- d0 = d0.plus( d2.times(d1) );
- n0.s = n1.s = x.s;
- e *= 2;
-
- // Determine which fraction is closer to x, n0/d0 or n1/d1
- arr = div( n1, d1, e, ROUNDING_MODE ).minus(x).abs().cmp(
- div( n0, d0, e, ROUNDING_MODE ).minus(x).abs() ) < 1
- ? [ n1.toString(), d1.toString() ]
- : [ n0.toString(), d0.toString() ];
-
- MAX_EXP = exp;
- return arr;
- };
-
-
- /*
- * Return the value of this BigNumber converted to a number primitive.
- */
- P.toNumber = function () {
- return +this;
- };
-
-
- /*
- * Return a BigNumber whose value is the value of this BigNumber raised to the power n.
- * If m is present, return the result modulo m.
- * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.
- * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using
- * ROUNDING_MODE.
- *
- * The modular power operation works efficiently when x, n, and m are positive integers,
- * otherwise it is equivalent to calculating x.toPower(n).modulo(m) (with POW_PRECISION 0).
- *
- * n {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.
- * [m] {number|string|BigNumber} The modulus.
- *
- * 'pow() exponent not an integer: {n}'
- * 'pow() exponent out of range: {n}'
- *
- * Performs 54 loop iterations for n of 9007199254740991.
- */
- P.toPower = P.pow = function ( n, m ) {
- var k, y, z,
- i = mathfloor( n < 0 ? -n : +n ),
- x = this;
-
- if ( m != null ) {
- id = 23;
- m = new BigNumber(m);
- }
-
- // Pass ±Infinity to Math.pow if exponent is out of range.
- if ( !isValidInt( n, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 23, 'exponent' ) &&
- ( !isFinite(n) || i > MAX_SAFE_INTEGER && ( n /= 0 ) ||
- parseFloat(n) != n && !( n = NaN ) ) || n == 0 ) {
- k = Math.pow( +x, n );
- return new BigNumber( m ? k % m : k );
- }
-
- if (m) {
- if ( n > 1 && x.gt(ONE) && x.isInt() && m.gt(ONE) && m.isInt() ) {
- x = x.mod(m);
- } else {
- z = m;
-
- // Nullify m so only a single mod operation is performed at the end.
- m = null;
- }
- } else if (POW_PRECISION) {
-
- // Truncating each coefficient array to a length of k after each multiplication
- // equates to truncating significant digits to POW_PRECISION + [28, 41],
- // i.e. there will be a minimum of 28 guard digits retained.
- // (Using + 1.5 would give [9, 21] guard digits.)
- k = mathceil( POW_PRECISION / LOG_BASE + 2 );
- }
-
- y = new BigNumber(ONE);
-
- for ( ; ; ) {
- if ( i % 2 ) {
- y = y.times(x);
- if ( !y.c ) break;
- if (k) {
- if ( y.c.length > k ) y.c.length = k;
- } else if (m) {
- y = y.mod(m);
- }
- }
-
- i = mathfloor( i / 2 );
- if ( !i ) break;
- x = x.times(x);
- if (k) {
- if ( x.c && x.c.length > k ) x.c.length = k;
- } else if (m) {
- x = x.mod(m);
- }
- }
-
- if (m) return y;
- if ( n < 0 ) y = ONE.div(y);
-
- return z ? y.mod(z) : k ? round( y, POW_PRECISION, ROUNDING_MODE ) : y;
- };
-
-
- /*
- * Return a string representing the value of this BigNumber rounded to sd significant digits
- * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits
- * necessary to represent the integer part of the value in fixed-point notation, then use
- * exponential notation.
- *
- * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.
- * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
- *
- * 'toPrecision() precision not an integer: {sd}'
- * 'toPrecision() precision out of range: {sd}'
- * 'toPrecision() rounding mode not an integer: {rm}'
- * 'toPrecision() rounding mode out of range: {rm}'
- */
- P.toPrecision = function ( sd, rm ) {
- return format( this, sd != null && isValidInt( sd, 1, MAX, 24, 'precision' )
- ? sd | 0 : null, rm, 24 );
- };
-
-
- /*
- * Return a string representing the value of this BigNumber in base b, or base 10 if b is
- * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and
- * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent
- * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than
- * TO_EXP_NEG, return exponential notation.
- *
- * [b] {number} Integer, 2 to 64 inclusive.
- *
- * 'toString() base not an integer: {b}'
- * 'toString() base out of range: {b}'
- */
- P.toString = function (b) {
- var str,
- n = this,
- s = n.s,
- e = n.e;
-
- // Infinity or NaN?
- if ( e === null ) {
-
- if (s) {
- str = 'Infinity';
- if ( s < 0 ) str = '-' + str;
- } else {
- str = 'NaN';
- }
- } else {
- str = coeffToString( n.c );
-
- if ( b == null || !isValidInt( b, 2, 64, 25, 'base' ) ) {
- str = e <= TO_EXP_NEG || e >= TO_EXP_POS
- ? toExponential( str, e )
- : toFixedPoint( str, e );
- } else {
- str = convertBase( toFixedPoint( str, e ), b | 0, 10, s );
- }
-
- if ( s < 0 && n.c[0] ) str = '-' + str;
- }
-
- return str;
- };
-
-
- /*
- * Return a new BigNumber whose value is the value of this BigNumber truncated to a whole
- * number.
- */
- P.truncated = P.trunc = function () {
- return round( new BigNumber(this), this.e + 1, 1 );
- };
-
-
-
- /*
- * Return as toString, but do not accept a base argument, and include the minus sign for
- * negative zero.
- */
- P.valueOf = P.toJSON = function () {
- var str,
- n = this,
- e = n.e;
-
- if ( e === null ) return n.toString();
-
- str = coeffToString( n.c );
-
- str = e <= TO_EXP_NEG || e >= TO_EXP_POS
- ? toExponential( str, e )
- : toFixedPoint( str, e );
-
- return n.s < 0 ? '-' + str : str;
- };
-
-
- // Aliases for BigDecimal methods.
- //P.add = P.plus; // P.add included above
- //P.subtract = P.minus; // P.sub included above
- //P.multiply = P.times; // P.mul included above
- //P.divide = P.div;
- //P.remainder = P.mod;
- //P.compareTo = P.cmp;
- //P.negate = P.neg;
-
-
- if ( configObj != null ) BigNumber.config(configObj);
-
- return BigNumber;
- }
-
-
- // PRIVATE HELPER FUNCTIONS
-
-
- function bitFloor(n) {
- var i = n | 0;
- return n > 0 || n === i ? i : i - 1;
- }
-
-
- // Return a coefficient array as a string of base 10 digits.
- function coeffToString(a) {
- var s, z,
- i = 1,
- j = a.length,
- r = a[0] + '';
-
- for ( ; i < j; ) {
- s = a[i++] + '';
- z = LOG_BASE - s.length;
- for ( ; z--; s = '0' + s );
- r += s;
- }
-
- // Determine trailing zeros.
- for ( j = r.length; r.charCodeAt(--j) === 48; );
- return r.slice( 0, j + 1 || 1 );
- }
-
-
- // Compare the value of BigNumbers x and y.
- function compare( x, y ) {
- var a, b,
- xc = x.c,
- yc = y.c,
- i = x.s,
- j = y.s,
- k = x.e,
- l = y.e;
-
- // Either NaN?
- if ( !i || !j ) return null;
-
- a = xc && !xc[0];
- b = yc && !yc[0];
-
- // Either zero?
- if ( a || b ) return a ? b ? 0 : -j : i;
-
- // Signs differ?
- if ( i != j ) return i;
-
- a = i < 0;
- b = k == l;
-
- // Either Infinity?
- if ( !xc || !yc ) return b ? 0 : !xc ^ a ? 1 : -1;
-
- // Compare exponents.
- if ( !b ) return k > l ^ a ? 1 : -1;
-
- j = ( k = xc.length ) < ( l = yc.length ) ? k : l;
-
- // Compare digit by digit.
- for ( i = 0; i < j; i++ ) if ( xc[i] != yc[i] ) return xc[i] > yc[i] ^ a ? 1 : -1;
-
- // Compare lengths.
- return k == l ? 0 : k > l ^ a ? 1 : -1;
- }
-
-
- /*
- * Return true if n is a valid number in range, otherwise false.
- * Use for argument validation when ERRORS is false.
- * Note: parseInt('1e+1') == 1 but parseFloat('1e+1') == 10.
- */
- function intValidatorNoErrors( n, min, max ) {
- return ( n = truncate(n) ) >= min && n <= max;
- }
-
-
- function isArray(obj) {
- return Object.prototype.toString.call(obj) == '[object Array]';
- }
-
-
- /*
- * Convert string of baseIn to an array of numbers of baseOut.
- * Eg. convertBase('255', 10, 16) returns [15, 15].
- * Eg. convertBase('ff', 16, 10) returns [2, 5, 5].
- */
- function toBaseOut( str, baseIn, baseOut ) {
- var j,
- arr = [0],
- arrL,
- i = 0,
- len = str.length;
-
- for ( ; i < len; ) {
- for ( arrL = arr.length; arrL--; arr[arrL] *= baseIn );
- arr[ j = 0 ] += ALPHABET.indexOf( str.charAt( i++ ) );
-
- for ( ; j < arr.length; j++ ) {
-
- if ( arr[j] > baseOut - 1 ) {
- if ( arr[j + 1] == null ) arr[j + 1] = 0;
- arr[j + 1] += arr[j] / baseOut | 0;
- arr[j] %= baseOut;
- }
- }
- }
-
- return arr.reverse();
- }
-
-
- function toExponential( str, e ) {
- return ( str.length > 1 ? str.charAt(0) + '.' + str.slice(1) : str ) +
- ( e < 0 ? 'e' : 'e+' ) + e;
- }
-
-
- function toFixedPoint( str, e ) {
- var len, z;
-
- // Negative exponent?
- if ( e < 0 ) {
-
- // Prepend zeros.
- for ( z = '0.'; ++e; z += '0' );
- str = z + str;
-
- // Positive exponent
- } else {
- len = str.length;
-
- // Append zeros.
- if ( ++e > len ) {
- for ( z = '0', e -= len; --e; z += '0' );
- str += z;
- } else if ( e < len ) {
- str = str.slice( 0, e ) + '.' + str.slice(e);
- }
- }
-
- return str;
- }
-
-
- function truncate(n) {
- n = parseFloat(n);
- return n < 0 ? mathceil(n) : mathfloor(n);
- }
-
-
- // EXPORT
-
-
- BigNumber = constructorFactory();
- BigNumber.default = BigNumber.BigNumber = BigNumber;
-
-
- // AMD.
- if ( typeof define == 'function' && define.amd ) {
- define( function () { return BigNumber; } );
-
- // Node.js and other environments that support module.exports.
- } else if ( typeof module != 'undefined' && module.exports ) {
- module.exports = BigNumber;
-
- // Split string stops browserify adding crypto shim.
- if ( !cryptoObj ) try { cryptoObj = require('cry' + 'pto'); } catch (e) {}
-
- // Browser.
- } else {
- if ( !globalObj ) globalObj = typeof self != 'undefined' ? self : Function('return this')();
- globalObj.BigNumber = BigNumber;
- }
-})(this);
diff --git a/app/node_modules/bignumber.js/bignumber.js.map b/app/node_modules/bignumber.js/bignumber.js.map
deleted file mode 100644
index 0a45181a..00000000
--- a/app/node_modules/bignumber.js/bignumber.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"bignumber.min.js","sources":["bignumber.js"],"names":["globalObj","constructorFactory","configObj","BigNumber","n","b","c","e","i","num","len","str","x","this","ERRORS","raise","isValidInt","id","round","DECIMAL_PLACES","ROUNDING_MODE","RegExp","ALPHABET","slice","test","parseNumeric","s","replace","length","tooManyDigits","charCodeAt","convertBase","isNumeric","indexOf","search","substring","MAX_SAFE_INTEGER","mathfloor","MAX_EXP","MIN_EXP","LOG_BASE","push","baseOut","baseIn","sign","d","k","r","xc","y","dp","rm","toLowerCase","POW_PRECISION","pow","toBaseOut","toFixedPoint","coeffToString","pop","div","unshift","charAt","format","caller","c0","ne","roundingMode","toString","TO_EXP_NEG","toExponential","maxOrMin","args","method","m","isArray","call","intValidatorWithErrors","min","max","name","truncate","normalise","j","msg","val","error","Error","sd","ni","rd","pows10","POWS_TEN","out","mathceil","BASE","P","prototype","ONE","TO_EXP_POS","CRYPTO","MODULO_MODE","FORMAT","decimalSeparator","groupSeparator","groupSize","secondaryGroupSize","fractionGroupSeparator","fractionGroupSize","another","ROUND_UP","ROUND_DOWN","ROUND_CEIL","ROUND_FLOOR","ROUND_HALF_UP","ROUND_HALF_DOWN","ROUND_HALF_EVEN","ROUND_HALF_CEIL","ROUND_HALF_FLOOR","EUCLID","config","v","p","a","arguments","o","has","hasOwnProperty","MAX","intValidatorNoErrors","notBool","cryptoObj","lt","gt","random","pow2_53","random53bitInt","Math","rand","getRandomValues","Uint32Array","randomBytes","copy","shift","multiply","base","temp","xlo","xhi","carry","klo","SQRT_BASE","khi","compare","aL","bL","cmp","subtract","more","prod","prodL","q","qc","rem","remL","rem0","xi","xL","yc0","yL","yz","yc","NaN","bitFloor","basePrefix","dotAfter","dotBefore","isInfinityOrNaN","whitespaceOrPlus","isNaN","p1","p2","absoluteValue","abs","ceil","comparedTo","decimalPlaces","dividedBy","dividedToIntegerBy","divToInt","equals","eq","floor","greaterThan","greaterThanOrEqualTo","gte","isFinite","isInteger","isInt","isNegative","isNeg","isZero","lessThan","lessThanOrEqualTo","lte","minus","sub","t","xLTy","plus","xe","ye","reverse","modulo","mod","times","negated","neg","add","precision","z","squareRoot","sqrt","rep","half","mul","xcL","ycL","ylo","yhi","zc","sqrtBase","toDigits","toFixed","toFormat","arr","split","g1","g2","intPart","fractionPart","intDigits","substr","toFraction","md","d0","d2","exp","n0","n1","d1","toNumber","toPower","parseFloat","toPrecision","truncated","trunc","valueOf","toJSON","l","obj","Object","arrL","crypto","define","amd","module","exports","require","self","Function"],"mappings":";CAEC,SAAWA,GACR,YAuCA,SAASC,GAAmBC,GAiHxB,QAASC,GAAWC,EAAGC,GACnB,GAAIC,GAAGC,EAAGC,EAAGC,EAAKC,EAAKC,EACnBC,EAAIC,IAGR,MAAQD,YAAaT,IAIjB,MADIW,IAAQC,EAAO,GAAI,+BAAgCX,GAChD,GAAID,GAAWC,EAAGC,EAK7B,IAAU,MAALA,GAAcW,EAAYX,EAAG,EAAG,GAAIY,EAAI,QA4BtC,CAMH,GALAZ,EAAQ,EAAJA,EACJM,EAAMP,EAAI,GAIA,IAALC,EAED,MADAO,GAAI,GAAIT,GAAWC,YAAaD,GAAYC,EAAIO,GACzCO,EAAON,EAAGO,EAAiBP,EAAEL,EAAI,EAAGa,EAK/C,KAAOX,EAAkB,gBAALL,KAAuB,EAAJA,GAAS,IAC7C,GAAMiB,QAAQ,OAAUf,EAAI,IAAMgB,EAASC,MAAO,E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node_modules/bignumber.js/bignumber.min.js b/app/node_modules/bignumber.js/bignumber.min.js
deleted file mode 100644
index a0ef22c6..00000000
--- a/app/node_modules/bignumber.js/bignumber.min.js
+++ /dev/null
@@ -1,3 +0,0 @@
-/* bignumber.js v2.4.0 https://github.com/MikeMcl/bignumber.js/LICENCE */
-!function(e){"use strict";function n(e){function a(e,n){var t,r,i,o,u,s,f=this;if(!(f instanceof a))return j&&L(26,"constructor call without new",e),new a(e,n);if(null!=n&&H(n,2,64,M,"base")){if(n=0|n,s=e+"",10==n)return f=new a(e instanceof a?e:s),U(f,P+f.e+1,B);if((o="number"==typeof e)&&0*e!=0||!new RegExp("^-?"+(t="["+b.slice(0,n)+"]+")+"(?:\\."+t+")?$",37>n?"i":"").test(s))return g(f,s,o,n);o?(f.s=0>1/e?(s=s.slice(1),-1):1,j&&s.replace(/^0\.0*|\./,"").length>15&&L(M,N,e),o=!1):f.s=45===s.charCodeAt(0)?(s=s.slice(1),-1):1,s=D(s,10,n,f.s)}else{if(e instanceof a)return f.s=e.s,f.e=e.e,f.c=(e=e.c)?e.slice():e,void(M=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(M=0)}s=e+""}else{if(!p.test(s=e+""))return g(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&&j&&u>15&&(e>S||e!==m(e))&&L(M,N,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];M=0}function D(e,n,t,i){var o,u,f,c,h,g,p,d=e.indexOf("."),m=P,w=B;for(37>t&&(e=e.toLowerCase()),d>=0&&(f=J,J=0,e=e.replace(".",""),p=new a(t),h=p.pow(e.length-d),J=f,p.c=s(l(r(h.c),h.e),10,n),p.e=p.c.length),g=s(e,t,n),u=f=g.length;0==g[--f];g.pop());if(!g[0])return"0";if(0>d?--u:(h.c=g,h.e=u,h.s=i,h=C(h,p,m,w,n),g=h.c,c=h.r,u=h.e),o=u+m+1,d=g[o],f=n/2,c=c||0>o||null!=g[o+1],c=4>w?(null!=d||c)&&(0==w||w==(h.s<0?3:2)):d>f||d==f&&(4==w||c||6==w&&1&g[o-1]||w==(h.s<0?8:7)),1>o||!g[0])e=c?l("1",-m):"0";else{if(g.length=o,c)for(--n;++g[--o]>n;)g[o]=0,o||(++u,g.unshift(1));for(f=g.length;!g[--f];);for(d=0,e="";f>=d;e+=b.charAt(g[d++]));e=l(e,u)}return e}function F(e,n,t,i){var o,u,s,c,h;if(t=null!=t&&H(t,0,8,i,v)?0|t:B,!e.c)return e.toString();if(o=e.c[0],s=e.e,null==n)h=r(e.c),h=19==i||24==i&&k>=s?f(h,s):l(h,s);else if(e=U(new a(e),n,t),u=e.e,h=r(e.c),c=h.length,19==i||24==i&&(u>=n||k>=u)){for(;n>c;h+="0",c++);h=f(h,u)}else if(n-=s,h=l(h,u),u+1>c){if(--n>0)for(h+=".";n--;h+="0");}else if(n+=u-c,n>0)for(u+1==c&&(h+=".");n--;h+="0");return e.s<0&&o?"-"+h:h}function _(e,n){var t,r,i=0;for(u(e[0])&&(e=e[0]),t=new a(e[0]);++ie||e>t||e!=c(e))&&L(r,(i||"decimal places")+(n>e||e>t?" out of range":" not an integer"),e),!0}function I(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 L(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",M=0,r}function U(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=d((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?m(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]==O&&(a[0]=1));break}if(a[l]+=s,a[l]!=O)break;a[l--]=0,s=1}for(o=a.length;0===a[--o];a.pop());}e.e>z?e.c=e.e=null:e.et?null!=(e=i[t++]):void 0};return f(n="DECIMAL_PLACES")&&H(e,0,E,2,n)&&(P=0|e),r[n]=P,f(n="ROUNDING_MODE")&&H(e,0,8,2,n)&&(B=0|e),r[n]=B,f(n="EXPONENTIAL_AT")&&(u(e)?H(e[0],-E,0,2,n)&&H(e[1],0,E,2,n)&&(k=0|e[0],$=0|e[1]):H(e,-E,E,2,n)&&(k=-($=0|(0>e?-e:e)))),r[n]=[k,$],f(n="RANGE")&&(u(e)?H(e[0],-E,-1,2,n)&&H(e[1],1,E,2,n)&&(G=0|e[0],z=0|e[1]):H(e,-E,E,2,n)&&(0|e?G=-(z=0|(0>e?-e:e)):j&&L(2,n+" cannot be zero",e))),r[n]=[G,z],f(n="ERRORS")&&(e===!!e||1===e||0===e?(M=0,H=(j=!!e)?x:o):j&&L(2,n+w,e)),r[n]=j,f(n="CRYPTO")&&(e===!!e||1===e||0===e?(V=!(!e||!h),e&&!V&&j&&L(2,"crypto unavailable",h)):j&&L(2,n+w,e)),r[n]=V,f(n="MODULO_MODE")&&H(e,0,9,2,n)&&(W=0|e),r[n]=W,f(n="POW_PRECISION")&&H(e,0,E,2,n)&&(J=0|e),r[n]=J,f(n="FORMAT")&&("object"==typeof e?X=e:j&&L(2,n+" not an object",e)),r[n]=X,r},a.max=function(){return _(arguments,T.lt)},a.min=function(){return _(arguments,T.gt)},a.random=function(){var e=9007199254740992,n=Math.random()*e&2097151?function(){return m(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 a(q);if(e=null!=e&&H(e,0,E,14)?0|e:P,o=d(e/y),V)if(h&&h.getRandomValues){for(t=h.getRandomValues(new Uint32Array(o*=2));o>s;)u=131072*t[s]+(t[s+1]>>>11),u>=9e15?(r=h.getRandomValues(new Uint32Array(2)),t[s]=r[0],t[s+1]=r[1]):(f.push(u%1e14),s+=2);s=o/2}else if(h&&h.randomBytes){for(t=h.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?h.randomBytes(7).copy(t,s):(f.push(u%1e14),s+=7);s=o/7}else j&&L(14,"crypto unavailable",h);if(!s)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]=m(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}}(),C=function(){function e(e,n,t){var r,i,o,u,s=0,f=e.length,l=n%A,c=n/A|0;for(e=e.slice();f--;)o=e[f]%A,u=e[f]/A|0,r=c*o+u*l,i=l*o+r%A*A+s,s=(i/t|0)+(r/A|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]1;e.shift());}return function(i,o,u,s,f){var l,c,h,g,p,d,w,v,N,b,S,R,A,E,D,F,_,x=i.s==o.s?1:-1,I=i.c,L=o.c;if(!(I&&I[0]&&L&&L[0]))return new a(i.s&&o.s&&(I?!L||I[0]!=L[0]:L)?I&&0==I[0]||!L?0*x:x/0:NaN);for(v=new a(x),N=v.c=[],c=i.e-o.e,x=u+c+1,f||(f=O,c=t(i.e/y)-t(o.e/y),x=x/y|0),h=0;L[h]==(I[h]||0);h++);if(L[h]>(I[h]||0)&&c--,0>x)N.push(1),g=!0;else{for(E=I.length,F=L.length,h=0,x+=2,p=m(f/(L[0]+1)),p>1&&(L=e(L,p,f),I=e(I,p,f),F=L.length,E=I.length),A=F,b=I.slice(0,F),S=b.length;F>S;b[S++]=0);_=L.slice(),_.unshift(0),D=L[0],L[1]>=f/2&&D++;do{if(p=0,l=n(L,b,F,S),0>l){if(R=b[0],F!=S&&(R=R*f+(b[1]||0)),p=m(R/D),p>1)for(p>=f&&(p=f-1),d=e(L,p,f),w=d.length,S=b.length;1==n(d,b,w,S);)p--,r(d,w>F?_:L,w,f),w=d.length,l=1;else 0==p&&(l=p=1),d=L.slice(),w=d.length;if(S>w&&d.unshift(0),r(b,d,S,f),S=b.length,-1==l)for(;n(L,b,F,S)<1;)p++,r(b,S>F?_:L,S,f),S=b.length}else 0===l&&(p++,b=[0]);N[h++]=p,b[0]?b[S++]=I[A]||0:(b=[I[A]],S=1)}while((A++=10;x/=10,h++);U(v,u+(v.e=h+c*y-1)+1,s,g)}else v.e=c,v.r=+g;return v}}(),g=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 a(c,l);j&&L(M,"not a"+(f?" base "+f:"")+" number",u),o.s=null}o.c=o.e=null,M=0}}(),T.absoluteValue=T.abs=function(){var e=new a(this);return e.s<0&&(e.s=1),e},T.ceil=function(){return U(new a(this),this.e+1,2)},T.comparedTo=T.cmp=function(e,n){return M=1,i(this,new a(e,n))},T.decimalPlaces=T.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},T.dividedBy=T.div=function(e,n){return M=3,C(this,new a(e,n),P,B)},T.dividedToIntegerBy=T.divToInt=function(e,n){return M=4,C(this,new a(e,n),0,1)},T.equals=T.eq=function(e,n){return M=5,0===i(this,new a(e,n))},T.floor=function(){return U(new a(this),this.e+1,3)},T.greaterThan=T.gt=function(e,n){return M=6,i(this,new a(e,n))>0},T.greaterThanOrEqualTo=T.gte=function(e,n){return M=7,1===(n=i(this,new a(e,n)))||0===n},T.isFinite=function(){return!!this.c},T.isInteger=T.isInt=function(){return!!this.c&&t(this.e/y)>this.c.length-2},T.isNaN=function(){return!this.s},T.isNegative=T.isNeg=function(){return this.s<0},T.isZero=function(){return!!this.c&&0==this.c[0]},T.lessThan=T.lt=function(e,n){return M=8,i(this,new a(e,n))<0},T.lessThanOrEqualTo=T.lte=function(e,n){return M=9,-1===(n=i(this,new a(e,n)))||0===n},T.minus=T.sub=function(e,n){var r,i,o,u,s=this,f=s.s;if(M=10,e=new a(e,n),n=e.s,!f||!n)return new a(NaN);if(f!=n)return e.s=-n,s.plus(e);var l=s.e/y,c=e.e/y,h=s.c,g=e.c;if(!l||!c){if(!h||!g)return h?(e.s=-n,e):new a(g?s:NaN);if(!h[0]||!g[0])return g[0]?(e.s=-n,e):new a(h[0]?s:3==B?-0:0)}if(l=t(l),c=t(c),h=h.slice(),f=l-c){for((u=0>f)?(f=-f,o=h):(c=l,o=g),o.reverse(),n=f;n--;o.push(0));o.reverse()}else for(i=(u=(f=h.length)<(n=g.length))?f:n,f=n=0;i>n;n++)if(h[n]!=g[n]){u=h[n]0)for(;n--;h[r++]=0);for(n=O-1;i>f;){if(h[--i]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)/O|0,f[n]%=O;return o&&(f.unshift(o),++s),I(e,f,s)},T.precision=T.sd=function(e){var n,t,r=this,i=r.c;if(null!=e&&e!==!!e&&1!==e&&0!==e&&(j&&L(13,"argument"+w,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},T.round=function(e,n){var t=new a(this);return(null==e||H(e,0,E,15))&&U(t,~~e+this.e+1,null!=n&&H(n,0,8,15,v)?0|n:B),t},T.shift=function(e){var n=this;return H(e,-S,S,16,"argument")?n.times("1e"+c(e)):new a(n.c&&n.c[0]&&(-S>e||e>S)?n.s*(0>e?0:1/0):n)},T.squareRoot=T.sqrt=function(){var e,n,i,o,u,s=this,f=s.c,l=s.s,c=s.e,h=P+4,g=new a("0.5");if(1!==l||!f||!f[0])return new a(!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 a(n)):i=new a(l+""),i.c[0])for(c=i.e,l=c+h,3>l&&(l=0);;)if(u=i,i=g.times(u.plus(C(s,u,h,1))),r(u.c).slice(0,l)===(n=r(i.c)).slice(0,l)){if(i.el&&(m=b,b=S,S=m,o=l,l=g,g=o),o=l+g,m=[];o--;m.push(0));for(w=O,v=A,o=g;--o>=0;){for(r=0,p=S[o]%v,d=S[o]/v|0,s=l,u=o+s;u>o;)c=b[--s]%v,h=b[s]/v|0,f=d*c+h*p,c=p*c+f%v*v+m[u]+r,r=(c/w|0)+(f/v|0)+d*h,m[u--]=c%w;m[u]=r}return r?++i:m.shift(),I(e,m,i)},T.toDigits=function(e,n){var t=new a(this);return e=null!=e&&H(e,1,E,18,"precision")?0|e:null,n=null!=n&&H(n,0,8,18,v)?0|n:B,e?U(t,e,n):t},T.toExponential=function(e,n){return F(this,null!=e&&H(e,0,E,19)?~~e+1:null,n,19)},T.toFixed=function(e,n){return F(this,null!=e&&H(e,0,E,20)?~~e+this.e+1:null,n,20)},T.toFormat=function(e,n){var t=F(this,null!=e&&H(e,0,E,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},T.toFraction=function(e){var n,t,i,o,u,s,f,l,c,h=j,g=this,p=g.c,d=new a(q),m=t=new a(q),w=f=new a(q);if(null!=e&&(j=!1,s=new a(e),j=h,(!(h=s.isInt())||s.lt(q))&&(j&&L(22,"max denominator "+(h?"out of range":"not an integer"),e),e=!h&&s.c&&U(s,s.e+1,1).gte(q)?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 a(c),f.c[0]=0;l=C(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=C(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=C(m,w,o,B).minus(g).abs().cmp(C(f,t,o,B).minus(g).abs())<1?[m.toString(),w.toString()]:[f.toString(),t.toString()],z=u,n},T.toNumber=function(){return+this},T.toPower=T.pow=function(e,n){var t,r,i,o=m(0>e?-e:+e),u=this;if(null!=n&&(M=23,n=new a(n)),!H(e,-S,S,23,"exponent")&&(!isFinite(e)||o>S&&(e/=0)||parseFloat(e)!=e&&!(e=NaN))||0==e)return t=Math.pow(+u,e),new a(n?t%n:t);for(n?e>1&&u.gt(q)&&u.isInt()&&n.gt(q)&&n.isInt()?u=u.mod(n):(i=n,n=null):J&&(t=d(J/y+2)),r=new a(q);;){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=m(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=q.div(r)),i?r.mod(i):t?U(r,J,B):r)},T.toPrecision=function(e,n){return F(this,null!=e&&H(e,1,E,24,"precision")?0|e:null,n,24)},T.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&&H(e,2,64,25,"base")?D(l(n,o),0|e,10,i):k>=o||o>=$?f(n,o):l(n,o),0>i&&t.c[0]&&(n="-"+n)),n},T.truncated=T.trunc=function(){return U(new a(this),this.e+1,1)},T.valueOf=T.toJSON=function(){var e,n=this,t=n.e;return null===t?n.toString():(e=r(n.c),e=k>=t||t>=$?f(e,t):l(e,t),n.s<0?"-"+e:e)},null!=e&&a.config(e),a}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=c(e))>=n&&t>=e}function u(e){return"[object Array]"==Object.prototype.toString.call(e)}function s(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]+=b.indexOf(e.charAt(u++));rt-1&&(null==o[r+1]&&(o[r+1]=0),o[r+1]+=o[r]/t|0,o[r]%=t)}return o.reverse()}function f(e,n){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(0>n?"e":"e+")+n}function l(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 c(e){return e=parseFloat(e),0>e?d(e):m(e)}var a,h,g,p=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,d=Math.ceil,m=Math.floor,w=" not a boolean or binary digit",v="rounding mode",N="number type has more than 15 significant digits",b="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_",O=1e14,y=14,S=9007199254740991,R=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],A=1e7,E=1e9;if("undefined"!=typeof crypto&&(h=crypto),a=n(),a["default"]=a.BigNumber=a,"function"==typeof define&&define.amd)define(function(){return a});else if("undefined"!=typeof module&&module.exports){if(module.exports=a,!h)try{h=require("crypto")}catch(D){}}else e||(e="undefined"!=typeof self?self:Function("return this")()),e.BigNumber=a}(this);
-//# sourceMappingURL=bignumber.js.map
\ No newline at end of file
diff --git a/app/node_modules/bignumber.js/bower.json b/app/node_modules/bignumber.js/bower.json
deleted file mode 100644
index e2418f0b..00000000
--- a/app/node_modules/bignumber.js/bower.json
+++ /dev/null
@@ -1,36 +0,0 @@
-{
- "name": "bignumber.js",
- "main": "bignumber.js",
- "version": "2.4.0",
- "homepage": "https://github.com/MikeMcl/bignumber.js",
- "authors": [
- "Michael Mclaughlin "
- ],
- "description": "A library for arbitrary-precision decimal and non-decimal arithmetic",
- "moduleType": [
- "amd",
- "globals",
- "node"
- ],
- "keywords": [
- "arbitrary",
- "precision",
- "arithmetic",
- "big",
- "number",
- "decimal",
- "float",
- "biginteger",
- "bigdecimal",
- "bignumber",
- "bigint",
- "bignum"
- ],
- "license": "MIT",
- "ignore": [
- ".*",
- "*.json",
- "test"
- ]
-}
-
diff --git a/app/node_modules/bignumber.js/doc/API.html b/app/node_modules/bignumber.js/doc/API.html
deleted file mode 100644
index ffdaea6e..00000000
--- a/app/node_modules/bignumber.js/doc/API.html
+++ /dev/null
@@ -1,2175 +0,0 @@
-
-
-
-
-
-
-bignumber.js API
-
-
-
-
-
-
-
API
-
-
CONSTRUCTOR
-