Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jsbi

Package Overview
Dependencies
Maintainers
2
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsbi - npm Package Compare versions

Comparing version 2.0.5 to 3.0.0

2

dist/jsbi-cjs.js

@@ -1,1 +0,1 @@

"use strict";class JSBI extends Array{constructor(a,b){if(a>JSBI.__kMaxLength)throw new RangeError("Maximum BigInt size exceeded");super(a),this.sign=b}static BigInt(a){var b=Math.floor,c=Number.isFinite;if("number"==typeof a){if(0===a)return JSBI.__zero();if((0|a)===a)return 0>a?JSBI.__oneDigit(-a,!0):JSBI.__oneDigit(a,!1);if(!c(a)||b(a)!==a)throw new RangeError("The number "+a+" cannot be converted to BigInt because it is not an integer");return JSBI.__fromDouble(a)}if("string"==typeof a){const b=JSBI.__fromString(a);if(null===b)throw new SyntaxError("Cannot convert "+a+" to a BigInt");return b}if("boolean"==typeof a)return!0===a?JSBI.__oneDigit(1,!1):JSBI.__zero();if("object"==typeof a){if(a.constructor===JSBI)return a;const b=JSBI.__toPrimitive(a);return JSBI.BigInt(b)}throw new TypeError("Cannot convert "+a+" to a BigInt")}toDebugString(){const a=["BigInt["];for(const b of this)a.push((b?(b>>>0).toString(16):b)+", ");return a.push("]"),a.join("")}toString(a=10){if(2>a||36<a)throw new RangeError("toString() radix argument must be between 2 and 36");return 0===this.length?"0":0==(a&a-1)?JSBI.__toStringBasePowerOfTwo(this,a):JSBI.__toStringGeneric(this,a,!1)}static toNumber(a){var b=Math.clz32;const c=a.length;if(0===c)return 0;if(1===c){const b=a.__unsignedDigit(0);return a.sign?-b:b}const d=a.__digit(c-1),e=b(d),f=32*c-e;if(1024<f)return a.sign?-Infinity:1/0;let g=f-1,h=d,i=c-1;const j=e+1;let k=32===j?0:h<<j;k>>>=12;const l=j-12;let m=12<=j?0:h<<20+j,n=20+j;0<l&&0<i&&(i--,h=a.__digit(i),k|=h>>>32-l,m=h<<l,n=l),0<n&&0<i&&(i--,h=a.__digit(i),m|=h>>>32-n,n-=32);const o=JSBI.__decideRounding(a,n,i,h);if((1===o||0===o&&1==(1&m))&&(m=m+1>>>0,0==m&&(k++,0!=k>>>20&&(k=0,g++,1023<g))))return a.sign?-Infinity:1/0;const p=a.sign?-2147483648:0;return g=g+1023<<20,JSBI.__kBitConversionInts[1]=p|g|k,JSBI.__kBitConversionInts[0]=m,JSBI.__kBitConversionDouble[0]}static unaryMinus(a){if(0===a.length)return a;const b=a.__copy();return b.sign=!a.sign,b}static bitwiseNot(a){return a.sign?JSBI.__absoluteSubOne(a).__trim():JSBI.__absoluteAddOne(a,!0)}static exponentiate(a,b){if(b.sign)throw new RangeError("Exponent must be positive");if(0===b.length)return JSBI.__oneDigit(1,!1);if(0===a.length)return a;if(1===a.length&&1===a.__digit(0))return a.sign&&0==(1&b.__digit(0))?JSBI.unaryMinus(a):a;if(1<b.length)throw new RangeError("BigInt too big");let c=b.__unsignedDigit(0);if(1===c)return a;if(c>=JSBI.__kMaxLengthBits)throw new RangeError("BigInt too big");if(1===a.length&&2===a.__digit(0)){const b=1+(c>>>5),d=a.sign&&0!=(1&c),e=new JSBI(b,d);e.__initializeDigits();const f=1<<(31&c);return e.__setDigit(b-1,f),e}let d=null,e=a;for(0!=(1&c)&&(d=a),c>>=1;0!==c;c>>=1)e=JSBI.multiply(e,e),0!=(1&c)&&(null===d?d=e:d=JSBI.multiply(d,e));return d}static multiply(a,b){if(0===a.length)return a;if(0===b.length)return b;let c=a.length+b.length;32<=a.__clzmsd()+b.__clzmsd()&&c--;const d=new JSBI(c,a.sign!==b.sign);d.__initializeDigits();for(let c=0;c<a.length;c++)JSBI.__multiplyAccumulate(b,a.__digit(c),d,c);return d.__trim()}static divide(a,b){if(0===b.length)throw new RangeError("Division by zero");if(0>JSBI.__absoluteCompare(a,b))return JSBI.__zero();const c=a.sign!==b.sign,d=b.__unsignedDigit(0);let e;if(1===b.length&&65535>=d){if(1===d)return c===a.sign?a:JSBI.unaryMinus(a);e=JSBI.__absoluteDivSmall(a,d,null)}else e=JSBI.__absoluteDivLarge(a,b,!0,!1);return e.sign=c,e.__trim()}static remainder(a,b){if(0===b.length)throw new RangeError("Division by zero");if(0>JSBI.__absoluteCompare(a,b))return a;const c=b.__unsignedDigit(0);if(1===b.length&&65535>=c){if(1===c)return JSBI.__zero();const b=JSBI.__absoluteModSmall(a,c);return 0===b?JSBI.__zero():JSBI.__oneDigit(b,a.sign)}const d=JSBI.__absoluteDivLarge(a,b,!1,!0);return d.sign=a.sign,d.__trim()}static add(a,b){const c=a.sign;return c===b.sign?JSBI.__absoluteAdd(a,b,c):0<=JSBI.__absoluteCompare(a,b)?JSBI.__absoluteSub(a,b,c):JSBI.__absoluteSub(b,a,!c)}static subtract(a,b){const c=a.sign;return c===b.sign?0<=JSBI.__absoluteCompare(a,b)?JSBI.__absoluteSub(a,b,c):JSBI.__absoluteSub(b,a,!c):JSBI.__absoluteAdd(a,b,c)}static leftShift(a,b){return 0===b.length||0===a.length?a:b.sign?JSBI.__rightShiftByAbsolute(a,b):JSBI.__leftShiftByAbsolute(a,b)}static signedRightShift(a,b){return 0===b.length||0===a.length?a:b.sign?JSBI.__leftShiftByAbsolute(a,b):JSBI.__rightShiftByAbsolute(a,b)}static unsignedRightShift(){throw new TypeError("BigInts have no unsigned right shift; use >> instead")}static lessThan(a,b){return 0>JSBI.__compareToBigInt(a,b)}static lessThanOrEqual(a,b){return 0>=JSBI.__compareToBigInt(a,b)}static greaterThan(a,b){return 0<JSBI.__compareToBigInt(a,b)}static greaterThanOrEqual(a,b){return 0<=JSBI.__compareToBigInt(a,b)}static equal(a,b){if(a.sign!==b.sign)return!1;if(a.length!==b.length)return!1;for(let c=0;c<a.length;c++)if(a.__digit(c)!==b.__digit(c))return!1;return!0}static bitwiseAnd(a,b){var c=Math.max;if(!a.sign&&!b.sign)return JSBI.__absoluteAnd(a,b).__trim();if(a.sign&&b.sign){const d=c(a.length,b.length)+1;let e=JSBI.__absoluteSubOne(a,d);const f=JSBI.__absoluteSubOne(b);return e=JSBI.__absoluteOr(e,f,e),JSBI.__absoluteAddOne(e,!0,e).__trim()}return a.sign&&([a,b]=[b,a]),JSBI.__absoluteAndNot(a,JSBI.__absoluteSubOne(b)).__trim()}static bitwiseXor(a,b){var c=Math.max;if(!a.sign&&!b.sign)return JSBI.__absoluteXor(a,b).__trim();if(a.sign&&b.sign){const d=c(a.length,b.length),e=JSBI.__absoluteSubOne(a,d),f=JSBI.__absoluteSubOne(b);return JSBI.__absoluteXor(e,f,e).__trim()}const d=c(a.length,b.length)+1;a.sign&&([a,b]=[b,a]);let e=JSBI.__absoluteSubOne(b,d);return e=JSBI.__absoluteXor(e,a,e),JSBI.__absoluteAddOne(e,!0,e).__trim()}static bitwiseOr(a,b){var c=Math.max;const d=c(a.length,b.length);if(!a.sign&&!b.sign)return JSBI.__absoluteOr(a,b).__trim();if(a.sign&&b.sign){let c=JSBI.__absoluteSubOne(a,d);const e=JSBI.__absoluteSubOne(b);return c=JSBI.__absoluteAnd(c,e,c),JSBI.__absoluteAddOne(c,!0,c).__trim()}a.sign&&([a,b]=[b,a]);let e=JSBI.__absoluteSubOne(b,d);return e=JSBI.__absoluteAndNot(e,a,e),JSBI.__absoluteAddOne(e,!0,e).__trim()}static ADD(a,b){if(a=JSBI.__toPrimitive(a),b=JSBI.__toPrimitive(b),"string"==typeof a)return"string"!=typeof b&&(b=b.toString()),a+b;if("string"==typeof b)return a.toString()+b;if(a=JSBI.__toNumeric(a),b=JSBI.__toNumeric(b),JSBI.__isBigInt(a)&&JSBI.__isBigInt(b))return JSBI.add(a,b);if("number"==typeof a&&"number"==typeof b)return a+b;throw new TypeError("Cannot mix BigInt and other types, use explicit conversions")}static LT(a,b){return JSBI.__compare(a,b,0)}static LE(a,b){return JSBI.__compare(a,b,1)}static GT(a,b){return JSBI.__compare(a,b,2)}static GE(a,b){return JSBI.__compare(a,b,3)}static EQ(a,b){for(;;){if(JSBI.__isBigInt(a))return JSBI.__isBigInt(b)?JSBI.equal(a,b):JSBI.EQ(b,a);if("number"==typeof a){if(JSBI.__isBigInt(b))return JSBI.__equalToNumber(b,a);if("object"!=typeof b)return a==b;b=JSBI.__toPrimitive(b)}else if("string"==typeof a){if(JSBI.__isBigInt(b))return a=JSBI.__fromString(a),null!==a&&JSBI.equal(a,b);if("object"!=typeof b)return a==b;b=JSBI.__toPrimitive(b)}else if("boolean"==typeof a){if(JSBI.__isBigInt(b))return JSBI.__equalToNumber(b,+a);if("object"!=typeof b)return a==b;b=JSBI.__toPrimitive(b)}else if("symbol"==typeof a){if(JSBI.__isBigInt(b))return!1;if("object"!=typeof b)return a==b;b=JSBI.__toPrimitive(b)}else if("object"==typeof a){if("object"==typeof b&&b.constructor!==JSBI)return a==b;a=JSBI.__toPrimitive(a)}else return a==b}}static __zero(){return new JSBI(0,!1)}static __oneDigit(a,b){const c=new JSBI(1,b);return c.__setDigit(0,a),c}__copy(){const a=new JSBI(this.length,this.sign);for(let b=0;b<this.length;b++)a[b]=this[b];return a}__trim(){let a=this.length,b=this[a-1];for(;0===b;)a--,b=this[a-1],this.pop();return 0===a&&(this.sign=!1),this}__initializeDigits(){for(let a=0;a<this.length;a++)this[a]=0}static __decideRounding(a,b,c,d){if(0<b)return-1;let e;if(0>b)e=-b-1;else{if(0===c)return-1;c--,d=a.__digit(c),e=31}let f=1<<e;if(0==(d&f))return-1;if(f-=1,0!=(d&f))return 1;for(;0<c;)if(c--,0!==a.__digit(c))return 1;return 0}static __fromDouble(a){JSBI.__kBitConversionDouble[0]=a;const b=2047&JSBI.__kBitConversionInts[1]>>>20,c=b-1023,d=(c>>>5)+1,e=new JSBI(d,0>a);let f=1048575&JSBI.__kBitConversionInts[1]|1048576,g=JSBI.__kBitConversionInts[0];const h=20,i=31&c;let j,k=0;if(i<20){const a=h-i;k=a+32,j=f>>>a,f=f<<32-a|g>>>a,g<<=32-a}else if(i===20)k=32,j=f,f=g;else{const a=i-h;k=32-a,j=f<<a|g>>>32-a,f=g<<a}e.__setDigit(d-1,j);for(let b=d-2;0<=b;b--)0<k?(k-=32,j=f,f=g):j=0,e.__setDigit(b,j);return e.__trim()}static __isWhitespace(a){return!!(13>=a&&9<=a)||(159>=a?32==a:131071>=a?160==a||5760==a:196607>=a?(a&=131071,10>=a||40==a||41==a||47==a||95==a||4096==a):65279==a)}static __fromString(a,b=0){let c=0;const e=a.length;let f=0;if(f===e)return JSBI.__zero();let g=a.charCodeAt(f);for(;JSBI.__isWhitespace(g);){if(++f===e)return JSBI.__zero();g=a.charCodeAt(f)}if(43===g){if(++f===e)return null;g=a.charCodeAt(f),c=1}else if(45===g){if(++f===e)return null;g=a.charCodeAt(f),c=-1}if(0===b){if(b=10,48===g){if(++f===e)return JSBI.__zero();if(g=a.charCodeAt(f),88===g||120===g){if(b=16,++f===e)return null;g=a.charCodeAt(f)}else if(79===g||111===g){if(b=8,++f===e)return null;g=a.charCodeAt(f)}else if(66===g||98===g){if(b=2,++f===e)return null;g=a.charCodeAt(f)}}}else if(16===b&&48===g){if(++f===e)return JSBI.__zero();if(g=a.charCodeAt(f),88===g||120===g){if(++f===e)return null;g=a.charCodeAt(f)}}for(;48===g;){if(++f===e)return JSBI.__zero();g=a.charCodeAt(f)}const h=e-f;let i=JSBI.__kMaxBitsPerChar[b],j=JSBI.__kBitsPerCharTableMultiplier-1;if(h>1073741824/i)return null;const k=i*h+j>>>JSBI.__kBitsPerCharTableShift,l=new JSBI(k+31>>>5,!1),n=10>b?b:10,o=10<b?b-10:0;if(0==(b&b-1)){i>>=JSBI.__kBitsPerCharTableShift;const b=[],c=[];let d=!1;do{let h=0,j=0;for(;;){let b;if(g-48>>>0<n)b=g-48;else if((32|g)-97>>>0<o)b=(32|g)-87;else{d=!0;break}if(j+=i,h=h<<i|b,++f===e){d=!0;break}if(g=a.charCodeAt(f),32<j+i)break}b.push(h),c.push(j)}while(!d);JSBI.__fillFromParts(l,b,c)}else{l.__initializeDigits();let c=!1,h=0;do{let k=0,p=1;for(;;){let i;if(g-48>>>0<n)i=g-48;else if((32|g)-97>>>0<o)i=(32|g)-87;else{c=!0;break}const d=p*b;if(4294967295<d)break;if(p=d,k=k*b+i,h++,++f===e){c=!0;break}g=a.charCodeAt(f)}j=32*JSBI.__kBitsPerCharTableMultiplier-1;const q=i*h+j>>>JSBI.__kBitsPerCharTableShift+5;l.__inplaceMultiplyAdd(p,k,q)}while(!c)}for(;f!==e;){if(!JSBI.__isWhitespace(g))return null;g=a.charCodeAt(f++)}return 0!=c&&10!==b?null:(l.sign=-1==c,l.__trim())}static __fillFromParts(a,b,c){let d=0,e=0,f=0;for(let g=b.length-1;0<=g;g--){const h=b[g],i=c[g];e|=h<<f,f+=i,32===f?(a.__setDigit(d++,e),f=0,e=0):32<f&&(a.__setDigit(d++,e),f-=32,e=h>>>i-f)}if(0!==e){if(d>=a.length)throw new Error("implementation bug");a.__setDigit(d++,e)}for(;d<a.length;d++)a.__setDigit(d,0)}static __toStringBasePowerOfTwo(a,b){var c=Math.clz32;const d=a.length;let e=b-1;e=(85&e>>>1)+(85&e),e=(51&e>>>2)+(51&e),e=(15&e>>>4)+(15&e);const f=e,g=b-1,h=a.__digit(d-1),i=c(h);let j=0|(32*d-i+f-1)/f;if(a.sign&&j++,268435456<j)throw new Error("string too long");const k=Array(j);let l=j-1,m=0,n=0;for(let c=0;c<d-1;c++){const b=a.__digit(c),d=(m|b<<n)&g;k[l--]=JSBI.__kConversionChars[d];const e=f-n;for(m=b>>>e,n=32-e;n>=f;)k[l--]=JSBI.__kConversionChars[m&g],m>>>=f,n-=f}const o=(m|h<<n)&g;for(k[l--]=JSBI.__kConversionChars[o],m=h>>>f-n;0!==m;)k[l--]=JSBI.__kConversionChars[m&g],m>>>=f;if(a.sign&&(k[l--]="-"),-1!=l)throw new Error("implementation bug");return k.join("")}static __toStringGeneric(a,b,c){var d=Math.clz32;const e=a.length;if(0===e)return"";if(1===e){let d=a.__unsignedDigit(0).toString(b);return!1===c&&a.sign&&(d="-"+d),d}const f=32*e-d(a.__digit(e-1)),g=JSBI.__kMaxBitsPerChar[b],h=g-1;let i=f*JSBI.__kBitsPerCharTableMultiplier;i+=h-1,i=0|i/h;const j=i+1>>1,k=JSBI.exponentiate(JSBI.__oneDigit(b,!1),JSBI.__oneDigit(j,!1));let l,m;const n=k.__unsignedDigit(0);if(1===k.length&&65535>=n){l=new JSBI(a.length,!1),l.__initializeDigits();let c=0;for(let b=2*a.length-1;0<=b;b--){const d=c<<16|a.__halfDigit(b);l.__setHalfDigit(b,0|d/n),c=0|d%n}m=c.toString(b)}else{const c=JSBI.__absoluteDivLarge(a,k,!0,!0);l=c.quotient;const d=c.remainder.__trim();m=JSBI.__toStringGeneric(d,b,!0)}l.__trim();let o=JSBI.__toStringGeneric(l,b,!0);for(;m.length<j;)m="0"+m;return!1===c&&a.sign&&(o="-"+o),o+m}static __unequalSign(a){return a?-1:1}static __absoluteGreater(a){return a?-1:1}static __absoluteLess(a){return a?1:-1}static __compareToBigInt(a,b){const c=a.sign;if(c!==b.sign)return JSBI.__unequalSign(c);const d=JSBI.__absoluteCompare(a,b);return 0<d?JSBI.__absoluteGreater(c):0>d?JSBI.__absoluteLess(c):0}static __compareToNumber(a,b){if(b|!0){const c=a.sign,d=0>b;if(c!==d)return JSBI.__unequalSign(c);if(0===a.length){if(d)throw new Error("implementation bug");return 0===b?0:-1}if(1<a.length)return JSBI.__absoluteGreater(c);const e=Math.abs(b),f=a.__unsignedDigit(0);return f>e?JSBI.__absoluteGreater(c):f<e?JSBI.__absoluteLess(c):0}return JSBI.__compareToDouble(a,b)}static __compareToDouble(a,b){var c=Math.clz32;if(b!==b)return b;if(b===1/0)return-1;if(b===-Infinity)return 1;const d=a.sign;if(d!==0>b)return JSBI.__unequalSign(d);if(0===b)throw new Error("implementation bug: should be handled elsewhere");if(0===a.length)return-1;JSBI.__kBitConversionDouble[0]=b;const e=2047&JSBI.__kBitConversionInts[1]>>>20;if(2047==e)throw new Error("implementation bug: handled elsewhere");const f=e-1023;if(0>f)return JSBI.__absoluteGreater(d);const g=a.length;let h=a.__digit(g-1);const i=c(h),j=32*g-i,k=f+1;if(j<k)return JSBI.__absoluteLess(d);if(j>k)return JSBI.__absoluteGreater(d);let l=1048576|1048575&JSBI.__kBitConversionInts[1],m=JSBI.__kBitConversionInts[0];const n=20,o=31-i;if(o!==(j-1)%31)throw new Error("implementation bug");let p,q=0;if(20>o){const a=n-o;q=a+32,p=l>>>a,l=l<<32-a|m>>>a,m<<=32-a}else if(20===o)q=32,p=l,l=m;else{const a=o-n;q=32-a,p=l<<a|m>>>32-a,l=m<<a}if(h>>>=0,p>>>=0,h>p)return JSBI.__absoluteGreater(d);if(h<p)return JSBI.__absoluteLess(d);for(let c=g-2;0<=c;c--){0<q?(q-=32,p=l>>>0,l=m,m=0):p=0;const b=a.__unsignedDigit(c);if(b>p)return JSBI.__absoluteGreater(d);if(b<p)return JSBI.__absoluteLess(d)}if(0!==l||0!==m){if(0===q)throw new Error("implementation bug");return JSBI.__absoluteLess(d)}return 0}static __equalToNumber(a,b){var c=Math.abs;return b|0===b?0===b?0===a.length:1===a.length&&a.sign===0>b&&a.__unsignedDigit(0)===c(b):0===JSBI.__compareToDouble(a,b)}static __comparisonResultToBool(a,b){switch(b){case 0:return 0>a;case 1:return 0>=a;case 2:return 0<a;case 3:return 0<=a;}throw new Error("unreachable")}static __compare(a,b,c){if(a=JSBI.__toPrimitive(a),b=JSBI.__toPrimitive(b),"string"==typeof a&&"string"==typeof b)switch(c){case 0:return a<b;case 1:return a<=b;case 2:return a>b;case 3:return a>=b;}if(JSBI.__isBigInt(a)&&"string"==typeof b)return b=JSBI.__fromString(b),null!==b&&JSBI.__comparisonResultToBool(JSBI.__compareToBigInt(a,b),c);if("string"==typeof a&&JSBI.__isBigInt(b))return a=JSBI.__fromString(a),null!==a&&JSBI.__comparisonResultToBool(JSBI.__compareToBigInt(a,b),c);if(a=JSBI.__toNumeric(a),b=JSBI.__toNumeric(b),JSBI.__isBigInt(a)){if(JSBI.__isBigInt(b))return JSBI.__comparisonResultToBool(JSBI.__compareToBigInt(a,b),c);if("number"!=typeof b)throw new Error("implementation bug");return JSBI.__comparisonResultToBool(JSBI.__compareToNumber(a,b),c)}if("number"!=typeof a)throw new Error("implementation bug");if(JSBI.__isBigInt(b))return JSBI.__comparisonResultToBool(JSBI.__compareToNumber(b,a),2^c);if("number"!=typeof b)throw new Error("implementation bug");return 0===c?a<b:1===c?a<=b:2===c?a>b:3===c?a>=b:void 0}__clzmsd(){return Math.clz32(this[this.length-1])}static __absoluteAdd(a,b,c){if(a.length<b.length)return JSBI.__absoluteAdd(b,a,c);if(0===a.length)return a;if(0===b.length)return a.sign===c?a:JSBI.unaryMinus(a);let d=a.length;(0===a.__clzmsd()||b.length===a.length&&0===b.__clzmsd())&&d++;const e=new JSBI(d,c);let f=0,g=0;for(;g<b.length;g++){const c=b.__digit(g),d=a.__digit(g),h=(65535&d)+(65535&c)+f,i=(d>>>16)+(c>>>16)+(h>>>16);f=i>>>16,e.__setDigit(g,65535&h|i<<16)}for(;g<a.length;g++){const b=a.__digit(g),c=(65535&b)+f,d=(b>>>16)+(c>>>16);f=d>>>16,e.__setDigit(g,65535&c|d<<16)}return g<e.length&&e.__setDigit(g,f),e.__trim()}static __absoluteSub(a,b,c){if(0===a.length)return a;if(0===b.length)return a.sign===c?a:JSBI.unaryMinus(a);const d=new JSBI(a.length,c);let e=0,f=0;for(;f<b.length;f++){const c=a.__digit(f),g=b.__digit(f),h=(65535&c)-(65535&g)-e;e=1&h>>>16;const i=(c>>>16)-(g>>>16)-e;e=1&i>>>16,d.__setDigit(f,65535&h|i<<16)}for(;f<a.length;f++){const b=a.__digit(f),c=(65535&b)-e;e=1&c>>>16;const g=(b>>>16)-e;e=1&g>>>16,d.__setDigit(f,65535&c|g<<16)}return d.__trim()}static __absoluteAddOne(a,b,c=null){const d=a.length;null===c?c=new JSBI(d,b):c.sign=b;let e=!0;for(let f,g=0;g<d;g++){f=a.__digit(g);const b=-1===f;e&&(f=0|f+1),e=b,c.__setDigit(g,f)}return e&&c.__setDigitGrow(d,1),c}static __absoluteSubOne(a,b){const c=a.length;b=b||c;const d=new JSBI(b,!1);let e=!0;for(let f,g=0;g<c;g++){f=a.__digit(g);const b=0===f;e&&(f=0|f-1),e=b,d.__setDigit(g,f)}for(let e=c;e<b;e++)d.__setDigit(e,0);return d}static __absoluteAnd(a,b,c=null){let d=a.length,e=b.length,f=e;if(d<e){f=d;const c=a,g=d;a=b,d=e,b=c,e=g}let g=f;null===c?c=new JSBI(g,!1):g=c.length;let h=0;for(;h<f;h++)c.__setDigit(h,a.__digit(h)&b.__digit(h));for(;h<g;h++)c.__setDigit(h,0);return c}static __absoluteAndNot(a,b,c=null){const d=a.length,e=b.length;let f=e;d<e&&(f=d);let g=d;null===c?c=new JSBI(g,!1):g=c.length;let h=0;for(;h<f;h++)c.__setDigit(h,a.__digit(h)&~b.__digit(h));for(;h<d;h++)c.__setDigit(h,a.__digit(h));for(;h<g;h++)c.__setDigit(h,0);return c}static __absoluteOr(a,b,c=null){let d=a.length,e=b.length,f=e;if(d<e){f=d;const c=a,g=d;a=b,d=e,b=c,e=g}let g=d;null===c?c=new JSBI(g,!1):g=c.length;let h=0;for(;h<f;h++)c.__setDigit(h,a.__digit(h)|b.__digit(h));for(;h<d;h++)c.__setDigit(h,a.__digit(h));for(;h<g;h++)c.__setDigit(h,0);return c}static __absoluteXor(a,b,c=null){let d=a.length,e=b.length,f=e;if(d<e){f=d;const c=a,g=d;a=b,d=e,b=c,e=g}let g=d;null===c?c=new JSBI(g,!1):g=c.length;let h=0;for(;h<f;h++)c.__setDigit(h,a.__digit(h)^b.__digit(h));for(;h<d;h++)c.__setDigit(h,a.__digit(h));for(;h<g;h++)c.__setDigit(h,0);return c}static __absoluteCompare(a,b){const c=a.length-b.length;if(0!=c)return c;let d=a.length-1;for(;0<=d&&a.__digit(d)===b.__digit(d);)d--;return 0>d?0:a.__unsignedDigit(d)>b.__unsignedDigit(d)?1:-1}static __multiplyAccumulate(a,b,c,d){var e=Math.imul;if(0===b)return;const f=65535&b,g=b>>>16;let h=0,j=0,k=0;for(let l=0;l<a.length;l++,d++){let b=c.__digit(d),i=65535&b,m=b>>>16;const n=a.__digit(l),o=65535&n,p=n>>>16,q=e(o,f),r=e(o,g),s=e(p,f),t=e(p,g);i+=j+(65535&q),m+=k+h+(i>>>16)+(q>>>16)+(65535&r)+(65535&s),h=m>>>16,j=(r>>>16)+(s>>>16)+(65535&t)+h,h=j>>>16,j&=65535,k=t>>>16,b=65535&i|m<<16,c.__setDigit(d,b)}for(;0!=h||0!==j||0!==k;d++){let a=c.__digit(d);const b=(65535&a)+j,e=(a>>>16)+(b>>>16)+k+h;j=0,k=0,h=e>>>16,a=65535&b|e<<16,c.__setDigit(d,a)}}static __internalMultiplyAdd(a,b,c,d,e){var f=Math.imul;let g=c,h=0;for(let j=0;j<d;j++){const c=a.__digit(j),d=f(65535&c,b),i=(65535&d)+h+g;g=i>>>16;const k=f(c>>>16,b),l=(65535&k)+(d>>>16)+g;g=l>>>16,h=k>>>16,e.__setDigit(j,l<<16|65535&i)}if(e.length>d)for(e.__setDigit(d++,g+h);d<e.length;)e.__setDigit(d++,0);else if(0!==g+h)throw new Error("implementation bug")}__inplaceMultiplyAdd(a,b,c){var e=Math.imul;c>this.length&&(c=this.length);const f=65535&a,g=a>>>16;let h=0,j=65535&b,k=b>>>16;for(let l=0;l<c;l++){const a=this.__digit(l),b=65535&a,c=a>>>16,d=e(b,f),i=e(b,g),m=e(c,f),n=e(c,g),o=j+(65535&d),p=k+h+(o>>>16)+(d>>>16)+(65535&i)+(65535&m);j=(i>>>16)+(m>>>16)+(65535&n)+(p>>>16),h=j>>>16,j&=65535,k=n>>>16;this.__setDigit(l,65535&o|p<<16)}if(0!=h||0!==j||0!==k)throw new Error("implementation bug")}static __absoluteDivSmall(a,b,c){null===c&&(c=new JSBI(a.length,!1));let d=0;for(let e,f=2*a.length-1;0<=f;f-=2){e=(d<<16|a.__halfDigit(f))>>>0;const g=0|e/b;d=0|e%b,e=(d<<16|a.__halfDigit(f-1))>>>0;const h=0|e/b;d=0|e%b,c.__setDigit(f>>>1,g<<16|h)}return c}static __absoluteModSmall(a,b){let c=0;for(let d=2*a.length-1;0<=d;d--){const e=(c<<16|a.__halfDigit(d))>>>0;c=0|e%b}return c}static __absoluteDivLarge(a,b,d,e){var f=Math.imul;const g=b.__halfDigitLength(),h=b.length,c=a.__halfDigitLength()-g;let i=null;d&&(i=new JSBI(c+2>>>1,!1),i.__initializeDigits());const k=new JSBI(g+2>>>1,!1);k.__initializeDigits();const l=JSBI.__clz16(b.__halfDigit(g-1));0<l&&(b=JSBI.__specialLeftShift(b,l,0));const m=JSBI.__specialLeftShift(a,l,1),n=b.__halfDigit(g-1);let o=0;for(let l,p=c;0<=p;p--){l=65535;const a=m.__halfDigit(p+g);if(a!==n){const c=(a<<16|m.__halfDigit(p+g-1))>>>0;l=0|c/n;let d=0|c%n;const e=b.__halfDigit(g-2),h=m.__halfDigit(p+g-2);for(;f(l,e)>>>0>(d<<16|h)>>>0&&(l--,d+=n,!(65535<d)););}JSBI.__internalMultiplyAdd(b,l,0,h,k);let e=m.__inplaceSub(k,p,g+1);0!==e&&(e=m.__inplaceAdd(b,p,g),m.__setHalfDigit(p+g,m.__halfDigit(p+g)+e),l--),d&&(1&p?o=l<<16:i.__setDigit(p>>>1,o|l))}return e?(m.__inplaceRightShift(l),d?{quotient:i,remainder:m}:m):d?i:void 0}static __clz16(a){return Math.clz32(a)-16}__inplaceAdd(a,b,c){let d=0;for(let e=0;e<c;e++){const c=this.__halfDigit(b+e)+a.__halfDigit(e)+d;d=c>>>16,this.__setHalfDigit(b+e,c)}return d}__inplaceSub(a,b,c){let d=0;if(1&b){b>>=1;let e=this.__digit(b),f=65535&e,g=0;for(;g<c-1>>>1;g++){const c=a.__digit(g),h=(e>>>16)-(65535&c)-d;d=1&h>>>16,this.__setDigit(b+g,h<<16|65535&f),e=this.__digit(b+g+1),f=(65535&e)-(c>>>16)-d,d=1&f>>>16}const h=a.__digit(g),i=(e>>>16)-(65535&h)-d;d=1&i>>>16,this.__setDigit(b+g,i<<16|65535&f);if(b+g+1>=this.length)throw new RangeError("out of bounds");0==(1&c)&&(e=this.__digit(b+g+1),f=(65535&e)-(h>>>16)-d,d=1&f>>>16,this.__setDigit(b+a.length,4294901760&e|65535&f))}else{b>>=1;let e=0;for(;e<a.length-1;e++){const c=this.__digit(b+e),f=a.__digit(e),g=(65535&c)-(65535&f)-d;d=1&g>>>16;const h=(c>>>16)-(f>>>16)-d;d=1&h>>>16,this.__setDigit(b+e,h<<16|65535&g)}const f=this.__digit(b+e),g=a.__digit(e),h=(65535&f)-(65535&g)-d;d=1&h>>>16;let i=0;0==(1&c)&&(i=(f>>>16)-(g>>>16)-d,d=1&i>>>16),this.__setDigit(b+e,i<<16|65535&h)}return d}__inplaceRightShift(a){if(0===a)return;let b=this.__digit(0)>>>a;const c=this.length-1;for(let e=0;e<c;e++){const c=this.__digit(e+1);this.__setDigit(e,c<<32-a|b),b=c>>>a}this.__setDigit(c,b)}static __specialLeftShift(a,b,c){const d=a.length,e=new JSBI(d+c,!1);if(0===b){for(let b=0;b<d;b++)e.__setDigit(b,a.__digit(b));return 0<c&&e.__setDigit(d,0),e}let f=0;for(let g=0;g<d;g++){const c=a.__digit(g);e.__setDigit(g,c<<b|f),f=c>>>32-b}return 0<c&&e.__setDigit(d,f),e}static __leftShiftByAbsolute(a,b){const c=JSBI.__toShiftAmount(b);if(0>c)throw new RangeError("BigInt too big");const e=c>>>5,f=31&c,g=a.length,h=0!==f&&0!=a.__digit(g-1)>>>32-f,j=g+e+(h?1:0),k=new JSBI(j,a.sign);if(0===f){let b=0;for(;b<e;b++)k.__setDigit(b,0);for(;b<j;b++)k.__setDigit(b,a.__digit(b-e))}else{let b=0;for(let a=0;a<e;a++)k.__setDigit(a,0);for(let c=0;c<g;c++){const g=a.__digit(c);k.__setDigit(c+e,g<<f|b),b=g>>>32-f}if(h)k.__setDigit(g+e,b);else if(0!=b)throw new Error("implementation bug")}return k.__trim()}static __rightShiftByAbsolute(a,b){const c=a.length,d=a.sign,e=JSBI.__toShiftAmount(b);if(0>e)return JSBI.__rightShiftByMaximum(d);const f=e>>>5,g=31&e;let h=c-f;if(0>=h)return JSBI.__rightShiftByMaximum(d);let i=!1;if(d){if(0!=(a.__digit(f)&(1<<g)-1))i=!0;else for(let b=0;b<f;b++)if(0!==a.__digit(b)){i=!0;break}}if(i&&0===g){const b=a.__digit(c-1);0==~b&&h++}let j=new JSBI(h,d);if(0===g)for(let b=f;b<c;b++)j.__setDigit(b-f,a.__digit(b));else{let b=a.__digit(f)>>>g;const d=c-f-1;for(let c=0;c<d;c++){const e=a.__digit(c+f+1);j.__setDigit(c,e<<32-g|b),b=e>>>g}j.__setDigit(d,b)}return i&&(j=JSBI.__absoluteAddOne(j,!0,j)),j.__trim()}static __rightShiftByMaximum(a){return a?JSBI.__oneDigit(1,!0):JSBI.__zero()}static __toShiftAmount(a){if(1<a.length)return-1;const b=a.__unsignedDigit(0);return b>JSBI.__kMaxLengthBits?-1:b}static __toPrimitive(a,b="default"){if("object"!=typeof a)return a;if(a.constructor===JSBI)return a;const c=a[Symbol.toPrimitive];if(c){const a=c(b);if("object"!=typeof a)return a;throw new TypeError("Cannot convert object to primitive value")}const d=a.valueOf;if(d){const b=d.call(a);if("object"!=typeof b)return b}const e=a.toString;if(e){const b=e.call(a);if("object"!=typeof b)return b}throw new TypeError("Cannot convert object to primitive value")}static __toNumeric(a){return JSBI.__isBigInt(a)?a:+a}static __isBigInt(a){return"object"==typeof a&&a.constructor===JSBI}__digit(a){return this[a]}__unsignedDigit(a){return this[a]>>>0}__setDigit(a,b){this[a]=0|b}__setDigitGrow(a,b){this[a]=0|b}__halfDigitLength(){const a=this.length;return 65535>=this.__unsignedDigit(a-1)?2*a-1:2*a}__halfDigit(a){return 65535&this[a>>>1]>>>((1&a)<<4)}__setHalfDigit(a,b){const c=a>>>1,d=this.__digit(c),e=1&a?65535&d|b<<16:4294901760&d|65535&b;this.__setDigit(c,e)}static __digitPow(a,b){let c=1;for(;0<b;)1&b&&(c*=a),b>>>=1,a*=a;return c}}JSBI.__kMaxLength=33554432,JSBI.__kMaxLengthBits=JSBI.__kMaxLength<<5,JSBI.__kMaxBitsPerChar=[0,0,32,51,64,75,83,90,96,102,107,111,115,119,122,126,128,131,134,136,139,141,143,145,147,149,151,153,154,156,158,159,160,162,163,165,166],JSBI.__kBitsPerCharTableShift=5,JSBI.__kBitsPerCharTableMultiplier=1<<JSBI.__kBitsPerCharTableShift,JSBI.__kConversionChars=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],JSBI.__kBitConversionBuffer=new ArrayBuffer(8),JSBI.__kBitConversionDouble=new Float64Array(JSBI.__kBitConversionBuffer),JSBI.__kBitConversionInts=new Int32Array(JSBI.__kBitConversionBuffer),module.exports=JSBI;
'use strict';class JSBI extends Array{constructor(a,b){if(a>JSBI.__kMaxLength)throw new RangeError("Maximum BigInt size exceeded");super(a),this.sign=b}static BigInt(a){var b=Math.floor,c=Number.isFinite;if("number"==typeof a){if(0===a)return JSBI.__zero();if((0|a)===a)return 0>a?JSBI.__oneDigit(-a,!0):JSBI.__oneDigit(a,!1);if(!c(a)||b(a)!==a)throw new RangeError("The number "+a+" cannot be converted to BigInt because it is not an integer");return JSBI.__fromDouble(a)}if("string"==typeof a){const b=JSBI.__fromString(a);if(null===b)throw new SyntaxError("Cannot convert "+a+" to a BigInt");return b}if("boolean"==typeof a)return!0===a?JSBI.__oneDigit(1,!1):JSBI.__zero();if("object"==typeof a){if(a.constructor===JSBI)return a;const b=JSBI.__toPrimitive(a);return JSBI.BigInt(b)}throw new TypeError("Cannot convert "+a+" to a BigInt")}toDebugString(){const a=["BigInt["];for(const b of this)a.push((b?(b>>>0).toString(16):b)+", ");return a.push("]"),a.join("")}toString(a=10){if(2>a||36<a)throw new RangeError("toString() radix argument must be between 2 and 36");return 0===this.length?"0":0==(a&a-1)?JSBI.__toStringBasePowerOfTwo(this,a):JSBI.__toStringGeneric(this,a,!1)}static toNumber(a){var b=Math.clz32;const c=a.length;if(0===c)return 0;if(1===c){const b=a.__unsignedDigit(0);return a.sign?-b:b}const d=a.__digit(c-1),e=b(d),f=32*c-e;if(1024<f)return a.sign?-Infinity:1/0;let g=f-1,h=d,i=c-1;const j=e+1;let k=32===j?0:h<<j;k>>>=12;const l=j-12;let m=12<=j?0:h<<20+j,n=20+j;0<l&&0<i&&(i--,h=a.__digit(i),k|=h>>>32-l,m=h<<l,n=l),0<n&&0<i&&(i--,h=a.__digit(i),m|=h>>>32-n,n-=32);const o=JSBI.__decideRounding(a,n,i,h);if((1===o||0===o&&1==(1&m))&&(m=m+1>>>0,0==m&&(k++,0!=k>>>20&&(k=0,g++,1023<g))))return a.sign?-Infinity:1/0;const p=a.sign?-2147483648:0;return g=g+1023<<20,JSBI.__kBitConversionInts[1]=p|g|k,JSBI.__kBitConversionInts[0]=m,JSBI.__kBitConversionDouble[0]}static unaryMinus(a){if(0===a.length)return a;const b=a.__copy();return b.sign=!a.sign,b}static bitwiseNot(a){return a.sign?JSBI.__absoluteSubOne(a).__trim():JSBI.__absoluteAddOne(a,!0)}static exponentiate(a,b){if(b.sign)throw new RangeError("Exponent must be positive");if(0===b.length)return JSBI.__oneDigit(1,!1);if(0===a.length)return a;if(1===a.length&&1===a.__digit(0))return a.sign&&0==(1&b.__digit(0))?JSBI.unaryMinus(a):a;if(1<b.length)throw new RangeError("BigInt too big");let c=b.__unsignedDigit(0);if(1===c)return a;if(c>=JSBI.__kMaxLengthBits)throw new RangeError("BigInt too big");if(1===a.length&&2===a.__digit(0)){const b=1+(c>>>5),d=a.sign&&0!=(1&c),e=new JSBI(b,d);e.__initializeDigits();const f=1<<(31&c);return e.__setDigit(b-1,f),e}let d=null,e=a;for(0!=(1&c)&&(d=a),c>>=1;0!==c;c>>=1)e=JSBI.multiply(e,e),0!=(1&c)&&(null===d?d=e:d=JSBI.multiply(d,e));return d}static multiply(a,b){if(0===a.length)return a;if(0===b.length)return b;let c=a.length+b.length;32<=a.__clzmsd()+b.__clzmsd()&&c--;const d=new JSBI(c,a.sign!==b.sign);d.__initializeDigits();for(let c=0;c<a.length;c++)JSBI.__multiplyAccumulate(b,a.__digit(c),d,c);return d.__trim()}static divide(a,b){if(0===b.length)throw new RangeError("Division by zero");if(0>JSBI.__absoluteCompare(a,b))return JSBI.__zero();const c=a.sign!==b.sign,d=b.__unsignedDigit(0);let e;if(1===b.length&&65535>=d){if(1===d)return c===a.sign?a:JSBI.unaryMinus(a);e=JSBI.__absoluteDivSmall(a,d,null)}else e=JSBI.__absoluteDivLarge(a,b,!0,!1);return e.sign=c,e.__trim()}static remainder(a,b){if(0===b.length)throw new RangeError("Division by zero");if(0>JSBI.__absoluteCompare(a,b))return a;const c=b.__unsignedDigit(0);if(1===b.length&&65535>=c){if(1===c)return JSBI.__zero();const b=JSBI.__absoluteModSmall(a,c);return 0===b?JSBI.__zero():JSBI.__oneDigit(b,a.sign)}const d=JSBI.__absoluteDivLarge(a,b,!1,!0);return d.sign=a.sign,d.__trim()}static add(a,b){const c=a.sign;return c===b.sign?JSBI.__absoluteAdd(a,b,c):0<=JSBI.__absoluteCompare(a,b)?JSBI.__absoluteSub(a,b,c):JSBI.__absoluteSub(b,a,!c)}static subtract(a,b){const c=a.sign;return c===b.sign?0<=JSBI.__absoluteCompare(a,b)?JSBI.__absoluteSub(a,b,c):JSBI.__absoluteSub(b,a,!c):JSBI.__absoluteAdd(a,b,c)}static leftShift(a,b){return 0===b.length||0===a.length?a:b.sign?JSBI.__rightShiftByAbsolute(a,b):JSBI.__leftShiftByAbsolute(a,b)}static signedRightShift(a,b){return 0===b.length||0===a.length?a:b.sign?JSBI.__leftShiftByAbsolute(a,b):JSBI.__rightShiftByAbsolute(a,b)}static unsignedRightShift(){throw new TypeError("BigInts have no unsigned right shift; use >> instead")}static lessThan(a,b){return 0>JSBI.__compareToBigInt(a,b)}static lessThanOrEqual(a,b){return 0>=JSBI.__compareToBigInt(a,b)}static greaterThan(a,b){return 0<JSBI.__compareToBigInt(a,b)}static greaterThanOrEqual(a,b){return 0<=JSBI.__compareToBigInt(a,b)}static equal(a,b){if(a.sign!==b.sign)return!1;if(a.length!==b.length)return!1;for(let c=0;c<a.length;c++)if(a.__digit(c)!==b.__digit(c))return!1;return!0}static bitwiseAnd(a,b){var c=Math.max;if(!a.sign&&!b.sign)return JSBI.__absoluteAnd(a,b).__trim();if(a.sign&&b.sign){const d=c(a.length,b.length)+1;let e=JSBI.__absoluteSubOne(a,d);const f=JSBI.__absoluteSubOne(b);return e=JSBI.__absoluteOr(e,f,e),JSBI.__absoluteAddOne(e,!0,e).__trim()}return a.sign&&([a,b]=[b,a]),JSBI.__absoluteAndNot(a,JSBI.__absoluteSubOne(b)).__trim()}static bitwiseXor(a,b){var c=Math.max;if(!a.sign&&!b.sign)return JSBI.__absoluteXor(a,b).__trim();if(a.sign&&b.sign){const d=c(a.length,b.length),e=JSBI.__absoluteSubOne(a,d),f=JSBI.__absoluteSubOne(b);return JSBI.__absoluteXor(e,f,e).__trim()}const d=c(a.length,b.length)+1;a.sign&&([a,b]=[b,a]);let e=JSBI.__absoluteSubOne(b,d);return e=JSBI.__absoluteXor(e,a,e),JSBI.__absoluteAddOne(e,!0,e).__trim()}static bitwiseOr(a,b){var c=Math.max;const d=c(a.length,b.length);if(!a.sign&&!b.sign)return JSBI.__absoluteOr(a,b).__trim();if(a.sign&&b.sign){let c=JSBI.__absoluteSubOne(a,d);const e=JSBI.__absoluteSubOne(b);return c=JSBI.__absoluteAnd(c,e,c),JSBI.__absoluteAddOne(c,!0,c).__trim()}a.sign&&([a,b]=[b,a]);let e=JSBI.__absoluteSubOne(b,d);return e=JSBI.__absoluteAndNot(e,a,e),JSBI.__absoluteAddOne(e,!0,e).__trim()}static ADD(a,b){if(a=JSBI.__toPrimitive(a),b=JSBI.__toPrimitive(b),"string"==typeof a)return"string"!=typeof b&&(b=b.toString()),a+b;if("string"==typeof b)return a.toString()+b;if(a=JSBI.__toNumeric(a),b=JSBI.__toNumeric(b),JSBI.__isBigInt(a)&&JSBI.__isBigInt(b))return JSBI.add(a,b);if("number"==typeof a&&"number"==typeof b)return a+b;throw new TypeError("Cannot mix BigInt and other types, use explicit conversions")}static LT(a,b){return JSBI.__compare(a,b,0)}static LE(a,b){return JSBI.__compare(a,b,1)}static GT(a,b){return JSBI.__compare(a,b,2)}static GE(a,b){return JSBI.__compare(a,b,3)}static EQ(a,b){for(;;){if(JSBI.__isBigInt(a))return JSBI.__isBigInt(b)?JSBI.equal(a,b):JSBI.EQ(b,a);if("number"==typeof a){if(JSBI.__isBigInt(b))return JSBI.__equalToNumber(b,a);if("object"!=typeof b)return a==b;b=JSBI.__toPrimitive(b)}else if("string"==typeof a){if(JSBI.__isBigInt(b))return a=JSBI.__fromString(a),null!==a&&JSBI.equal(a,b);if("object"!=typeof b)return a==b;b=JSBI.__toPrimitive(b)}else if("boolean"==typeof a){if(JSBI.__isBigInt(b))return JSBI.__equalToNumber(b,+a);if("object"!=typeof b)return a==b;b=JSBI.__toPrimitive(b)}else if("symbol"==typeof a){if(JSBI.__isBigInt(b))return!1;if("object"!=typeof b)return a==b;b=JSBI.__toPrimitive(b)}else if("object"==typeof a){if("object"==typeof b&&b.constructor!==JSBI)return a==b;a=JSBI.__toPrimitive(a)}else return a==b}}static __zero(){return new JSBI(0,!1)}static __oneDigit(a,b){const c=new JSBI(1,b);return c.__setDigit(0,a),c}__copy(){const a=new JSBI(this.length,this.sign);for(let b=0;b<this.length;b++)a[b]=this[b];return a}__trim(){let a=this.length,b=this[a-1];for(;0===b;)a--,b=this[a-1],this.pop();return 0===a&&(this.sign=!1),this}__initializeDigits(){for(let a=0;a<this.length;a++)this[a]=0}static __decideRounding(a,b,c,d){if(0<b)return-1;let e;if(0>b)e=-b-1;else{if(0===c)return-1;c--,d=a.__digit(c),e=31}let f=1<<e;if(0==(d&f))return-1;if(f-=1,0!=(d&f))return 1;for(;0<c;)if(c--,0!==a.__digit(c))return 1;return 0}static __fromDouble(a){JSBI.__kBitConversionDouble[0]=a;const b=2047&JSBI.__kBitConversionInts[1]>>>20,c=b-1023,d=(c>>>5)+1,e=new JSBI(d,0>a);let f=1048575&JSBI.__kBitConversionInts[1]|1048576,g=JSBI.__kBitConversionInts[0];const h=20,i=31&c;let j,k=0;if(i<20){const a=h-i;k=a+32,j=f>>>a,f=f<<32-a|g>>>a,g<<=32-a}else if(i===20)k=32,j=f,f=g;else{const a=i-h;k=32-a,j=f<<a|g>>>32-a,f=g<<a}e.__setDigit(d-1,j);for(let b=d-2;0<=b;b--)0<k?(k-=32,j=f,f=g):j=0,e.__setDigit(b,j);return e.__trim()}static __isWhitespace(a){return!!(13>=a&&9<=a)||(159>=a?32==a:131071>=a?160==a||5760==a:196607>=a?(a&=131071,10>=a||40==a||41==a||47==a||95==a||4096==a):65279==a)}static __fromString(a,b=0){let c=0;const e=a.length;let f=0;if(f===e)return JSBI.__zero();let g=a.charCodeAt(f);for(;JSBI.__isWhitespace(g);){if(++f===e)return JSBI.__zero();g=a.charCodeAt(f)}if(43===g){if(++f===e)return null;g=a.charCodeAt(f),c=1}else if(45===g){if(++f===e)return null;g=a.charCodeAt(f),c=-1}if(0===b){if(b=10,48===g){if(++f===e)return JSBI.__zero();if(g=a.charCodeAt(f),88===g||120===g){if(b=16,++f===e)return null;g=a.charCodeAt(f)}else if(79===g||111===g){if(b=8,++f===e)return null;g=a.charCodeAt(f)}else if(66===g||98===g){if(b=2,++f===e)return null;g=a.charCodeAt(f)}}}else if(16===b&&48===g){if(++f===e)return JSBI.__zero();if(g=a.charCodeAt(f),88===g||120===g){if(++f===e)return null;g=a.charCodeAt(f)}}for(;48===g;){if(++f===e)return JSBI.__zero();g=a.charCodeAt(f)}const h=e-f;let i=JSBI.__kMaxBitsPerChar[b],j=JSBI.__kBitsPerCharTableMultiplier-1;if(h>1073741824/i)return null;const k=i*h+j>>>JSBI.__kBitsPerCharTableShift,l=new JSBI(k+31>>>5,!1),n=10>b?b:10,o=10<b?b-10:0;if(0==(b&b-1)){i>>=JSBI.__kBitsPerCharTableShift;const b=[],c=[];let d=!1;do{let h=0,j=0;for(;;){let b;if(g-48>>>0<n)b=g-48;else if((32|g)-97>>>0<o)b=(32|g)-87;else{d=!0;break}if(j+=i,h=h<<i|b,++f===e){d=!0;break}if(g=a.charCodeAt(f),32<j+i)break}b.push(h),c.push(j)}while(!d);JSBI.__fillFromParts(l,b,c)}else{l.__initializeDigits();let c=!1,h=0;do{let k=0,p=1;for(;;){let i;if(g-48>>>0<n)i=g-48;else if((32|g)-97>>>0<o)i=(32|g)-87;else{c=!0;break}const d=p*b;if(4294967295<d)break;if(p=d,k=k*b+i,h++,++f===e){c=!0;break}g=a.charCodeAt(f)}j=32*JSBI.__kBitsPerCharTableMultiplier-1;const q=i*h+j>>>JSBI.__kBitsPerCharTableShift+5;l.__inplaceMultiplyAdd(p,k,q)}while(!c)}for(;f!==e;){if(!JSBI.__isWhitespace(g))return null;g=a.charCodeAt(f++)}return 0!=c&&10!==b?null:(l.sign=-1==c,l.__trim())}static __fillFromParts(a,b,c){let d=0,e=0,f=0;for(let g=b.length-1;0<=g;g--){const h=b[g],i=c[g];e|=h<<f,f+=i,32===f?(a.__setDigit(d++,e),f=0,e=0):32<f&&(a.__setDigit(d++,e),f-=32,e=h>>>i-f)}if(0!==e){if(d>=a.length)throw new Error("implementation bug");a.__setDigit(d++,e)}for(;d<a.length;d++)a.__setDigit(d,0)}static __toStringBasePowerOfTwo(a,b){var c=Math.clz32;const d=a.length;let e=b-1;e=(85&e>>>1)+(85&e),e=(51&e>>>2)+(51&e),e=(15&e>>>4)+(15&e);const f=e,g=b-1,h=a.__digit(d-1),i=c(h);let j=0|(32*d-i+f-1)/f;if(a.sign&&j++,268435456<j)throw new Error("string too long");const k=Array(j);let l=j-1,m=0,n=0;for(let c=0;c<d-1;c++){const b=a.__digit(c),d=(m|b<<n)&g;k[l--]=JSBI.__kConversionChars[d];const e=f-n;for(m=b>>>e,n=32-e;n>=f;)k[l--]=JSBI.__kConversionChars[m&g],m>>>=f,n-=f}const o=(m|h<<n)&g;for(k[l--]=JSBI.__kConversionChars[o],m=h>>>f-n;0!==m;)k[l--]=JSBI.__kConversionChars[m&g],m>>>=f;if(a.sign&&(k[l--]="-"),-1!=l)throw new Error("implementation bug");return k.join("")}static __toStringGeneric(a,b,c){var d=Math.clz32;const e=a.length;if(0===e)return"";if(1===e){let d=a.__unsignedDigit(0).toString(b);return!1===c&&a.sign&&(d="-"+d),d}const f=32*e-d(a.__digit(e-1)),g=JSBI.__kMaxBitsPerChar[b],h=g-1;let i=f*JSBI.__kBitsPerCharTableMultiplier;i+=h-1,i=0|i/h;const j=i+1>>1,k=JSBI.exponentiate(JSBI.__oneDigit(b,!1),JSBI.__oneDigit(j,!1));let l,m;const n=k.__unsignedDigit(0);if(1===k.length&&65535>=n){l=new JSBI(a.length,!1),l.__initializeDigits();let c=0;for(let b=2*a.length-1;0<=b;b--){const d=c<<16|a.__halfDigit(b);l.__setHalfDigit(b,0|d/n),c=0|d%n}m=c.toString(b)}else{const c=JSBI.__absoluteDivLarge(a,k,!0,!0);l=c.quotient;const d=c.remainder.__trim();m=JSBI.__toStringGeneric(d,b,!0)}l.__trim();let o=JSBI.__toStringGeneric(l,b,!0);for(;m.length<j;)m="0"+m;return!1===c&&a.sign&&(o="-"+o),o+m}static __unequalSign(a){return a?-1:1}static __absoluteGreater(a){return a?-1:1}static __absoluteLess(a){return a?1:-1}static __compareToBigInt(a,b){const c=a.sign;if(c!==b.sign)return JSBI.__unequalSign(c);const d=JSBI.__absoluteCompare(a,b);return 0<d?JSBI.__absoluteGreater(c):0>d?JSBI.__absoluteLess(c):0}static __compareToNumber(a,b){if(b|!0){const c=a.sign,d=0>b;if(c!==d)return JSBI.__unequalSign(c);if(0===a.length){if(d)throw new Error("implementation bug");return 0===b?0:-1}if(1<a.length)return JSBI.__absoluteGreater(c);const e=Math.abs(b),f=a.__unsignedDigit(0);return f>e?JSBI.__absoluteGreater(c):f<e?JSBI.__absoluteLess(c):0}return JSBI.__compareToDouble(a,b)}static __compareToDouble(a,b){var c=Math.clz32;if(b!==b)return b;if(b===1/0)return-1;if(b===-Infinity)return 1;const d=a.sign;if(d!==0>b)return JSBI.__unequalSign(d);if(0===b)throw new Error("implementation bug: should be handled elsewhere");if(0===a.length)return-1;JSBI.__kBitConversionDouble[0]=b;const e=2047&JSBI.__kBitConversionInts[1]>>>20;if(2047==e)throw new Error("implementation bug: handled elsewhere");const f=e-1023;if(0>f)return JSBI.__absoluteGreater(d);const g=a.length;let h=a.__digit(g-1);const i=c(h),j=32*g-i,k=f+1;if(j<k)return JSBI.__absoluteLess(d);if(j>k)return JSBI.__absoluteGreater(d);let l=1048576|1048575&JSBI.__kBitConversionInts[1],m=JSBI.__kBitConversionInts[0];const n=20,o=31-i;if(o!==(j-1)%31)throw new Error("implementation bug");let p,q=0;if(20>o){const a=n-o;q=a+32,p=l>>>a,l=l<<32-a|m>>>a,m<<=32-a}else if(20===o)q=32,p=l,l=m;else{const a=o-n;q=32-a,p=l<<a|m>>>32-a,l=m<<a}if(h>>>=0,p>>>=0,h>p)return JSBI.__absoluteGreater(d);if(h<p)return JSBI.__absoluteLess(d);for(let c=g-2;0<=c;c--){0<q?(q-=32,p=l>>>0,l=m,m=0):p=0;const b=a.__unsignedDigit(c);if(b>p)return JSBI.__absoluteGreater(d);if(b<p)return JSBI.__absoluteLess(d)}if(0!==l||0!==m){if(0===q)throw new Error("implementation bug");return JSBI.__absoluteLess(d)}return 0}static __equalToNumber(a,b){var c=Math.abs;return b|0===b?0===b?0===a.length:1===a.length&&a.sign===0>b&&a.__unsignedDigit(0)===c(b):0===JSBI.__compareToDouble(a,b)}static __comparisonResultToBool(a,b){switch(b){case 0:return 0>a;case 1:return 0>=a;case 2:return 0<a;case 3:return 0<=a;}throw new Error("unreachable")}static __compare(a,b,c){if(a=JSBI.__toPrimitive(a),b=JSBI.__toPrimitive(b),"string"==typeof a&&"string"==typeof b)switch(c){case 0:return a<b;case 1:return a<=b;case 2:return a>b;case 3:return a>=b;}if(JSBI.__isBigInt(a)&&"string"==typeof b)return b=JSBI.__fromString(b),null!==b&&JSBI.__comparisonResultToBool(JSBI.__compareToBigInt(a,b),c);if("string"==typeof a&&JSBI.__isBigInt(b))return a=JSBI.__fromString(a),null!==a&&JSBI.__comparisonResultToBool(JSBI.__compareToBigInt(a,b),c);if(a=JSBI.__toNumeric(a),b=JSBI.__toNumeric(b),JSBI.__isBigInt(a)){if(JSBI.__isBigInt(b))return JSBI.__comparisonResultToBool(JSBI.__compareToBigInt(a,b),c);if("number"!=typeof b)throw new Error("implementation bug");return JSBI.__comparisonResultToBool(JSBI.__compareToNumber(a,b),c)}if("number"!=typeof a)throw new Error("implementation bug");if(JSBI.__isBigInt(b))return JSBI.__comparisonResultToBool(JSBI.__compareToNumber(b,a),2^c);if("number"!=typeof b)throw new Error("implementation bug");return 0===c?a<b:1===c?a<=b:2===c?a>b:3===c?a>=b:void 0}__clzmsd(){return Math.clz32(this[this.length-1])}static __absoluteAdd(a,b,c){if(a.length<b.length)return JSBI.__absoluteAdd(b,a,c);if(0===a.length)return a;if(0===b.length)return a.sign===c?a:JSBI.unaryMinus(a);let d=a.length;(0===a.__clzmsd()||b.length===a.length&&0===b.__clzmsd())&&d++;const e=new JSBI(d,c);let f=0,g=0;for(;g<b.length;g++){const c=b.__digit(g),d=a.__digit(g),h=(65535&d)+(65535&c)+f,i=(d>>>16)+(c>>>16)+(h>>>16);f=i>>>16,e.__setDigit(g,65535&h|i<<16)}for(;g<a.length;g++){const b=a.__digit(g),c=(65535&b)+f,d=(b>>>16)+(c>>>16);f=d>>>16,e.__setDigit(g,65535&c|d<<16)}return g<e.length&&e.__setDigit(g,f),e.__trim()}static __absoluteSub(a,b,c){if(0===a.length)return a;if(0===b.length)return a.sign===c?a:JSBI.unaryMinus(a);const d=new JSBI(a.length,c);let e=0,f=0;for(;f<b.length;f++){const c=a.__digit(f),g=b.__digit(f),h=(65535&c)-(65535&g)-e;e=1&h>>>16;const i=(c>>>16)-(g>>>16)-e;e=1&i>>>16,d.__setDigit(f,65535&h|i<<16)}for(;f<a.length;f++){const b=a.__digit(f),c=(65535&b)-e;e=1&c>>>16;const g=(b>>>16)-e;e=1&g>>>16,d.__setDigit(f,65535&c|g<<16)}return d.__trim()}static __absoluteAddOne(a,b,c=null){const d=a.length;null===c?c=new JSBI(d,b):c.sign=b;let e=!0;for(let f,g=0;g<d;g++){f=a.__digit(g);const b=-1===f;e&&(f=0|f+1),e=b,c.__setDigit(g,f)}return e&&c.__setDigitGrow(d,1),c}static __absoluteSubOne(a,b){const c=a.length;b=b||c;const d=new JSBI(b,!1);let e=!0;for(let f,g=0;g<c;g++){f=a.__digit(g);const b=0===f;e&&(f=0|f-1),e=b,d.__setDigit(g,f)}for(let e=c;e<b;e++)d.__setDigit(e,0);return d}static __absoluteAnd(a,b,c=null){let d=a.length,e=b.length,f=e;if(d<e){f=d;const c=a,g=d;a=b,d=e,b=c,e=g}let g=f;null===c?c=new JSBI(g,!1):g=c.length;let h=0;for(;h<f;h++)c.__setDigit(h,a.__digit(h)&b.__digit(h));for(;h<g;h++)c.__setDigit(h,0);return c}static __absoluteAndNot(a,b,c=null){const d=a.length,e=b.length;let f=e;d<e&&(f=d);let g=d;null===c?c=new JSBI(g,!1):g=c.length;let h=0;for(;h<f;h++)c.__setDigit(h,a.__digit(h)&~b.__digit(h));for(;h<d;h++)c.__setDigit(h,a.__digit(h));for(;h<g;h++)c.__setDigit(h,0);return c}static __absoluteOr(a,b,c=null){let d=a.length,e=b.length,f=e;if(d<e){f=d;const c=a,g=d;a=b,d=e,b=c,e=g}let g=d;null===c?c=new JSBI(g,!1):g=c.length;let h=0;for(;h<f;h++)c.__setDigit(h,a.__digit(h)|b.__digit(h));for(;h<d;h++)c.__setDigit(h,a.__digit(h));for(;h<g;h++)c.__setDigit(h,0);return c}static __absoluteXor(a,b,c=null){let d=a.length,e=b.length,f=e;if(d<e){f=d;const c=a,g=d;a=b,d=e,b=c,e=g}let g=d;null===c?c=new JSBI(g,!1):g=c.length;let h=0;for(;h<f;h++)c.__setDigit(h,a.__digit(h)^b.__digit(h));for(;h<d;h++)c.__setDigit(h,a.__digit(h));for(;h<g;h++)c.__setDigit(h,0);return c}static __absoluteCompare(a,b){const c=a.length-b.length;if(0!=c)return c;let d=a.length-1;for(;0<=d&&a.__digit(d)===b.__digit(d);)d--;return 0>d?0:a.__unsignedDigit(d)>b.__unsignedDigit(d)?1:-1}static __multiplyAccumulate(a,b,c,d){var e=Math.imul;if(0===b)return;const f=65535&b,g=b>>>16;let h=0,j=0,k=0;for(let l=0;l<a.length;l++,d++){let b=c.__digit(d),i=65535&b,m=b>>>16;const n=a.__digit(l),o=65535&n,p=n>>>16,q=e(o,f),r=e(o,g),s=e(p,f),t=e(p,g);i+=j+(65535&q),m+=k+h+(i>>>16)+(q>>>16)+(65535&r)+(65535&s),h=m>>>16,j=(r>>>16)+(s>>>16)+(65535&t)+h,h=j>>>16,j&=65535,k=t>>>16,b=65535&i|m<<16,c.__setDigit(d,b)}for(;0!=h||0!==j||0!==k;d++){let a=c.__digit(d);const b=(65535&a)+j,e=(a>>>16)+(b>>>16)+k+h;j=0,k=0,h=e>>>16,a=65535&b|e<<16,c.__setDigit(d,a)}}static __internalMultiplyAdd(a,b,c,d,e){var f=Math.imul;let g=c,h=0;for(let j=0;j<d;j++){const c=a.__digit(j),d=f(65535&c,b),i=(65535&d)+h+g;g=i>>>16;const k=f(c>>>16,b),l=(65535&k)+(d>>>16)+g;g=l>>>16,h=k>>>16,e.__setDigit(j,l<<16|65535&i)}if(e.length>d)for(e.__setDigit(d++,g+h);d<e.length;)e.__setDigit(d++,0);else if(0!==g+h)throw new Error("implementation bug")}__inplaceMultiplyAdd(a,b,c){var e=Math.imul;c>this.length&&(c=this.length);const f=65535&a,g=a>>>16;let h=0,j=65535&b,k=b>>>16;for(let l=0;l<c;l++){const a=this.__digit(l),b=65535&a,c=a>>>16,d=e(b,f),i=e(b,g),m=e(c,f),n=e(c,g),o=j+(65535&d),p=k+h+(o>>>16)+(d>>>16)+(65535&i)+(65535&m);j=(i>>>16)+(m>>>16)+(65535&n)+(p>>>16),h=j>>>16,j&=65535,k=n>>>16;this.__setDigit(l,65535&o|p<<16)}if(0!=h||0!==j||0!==k)throw new Error("implementation bug")}static __absoluteDivSmall(a,b,c){null===c&&(c=new JSBI(a.length,!1));let d=0;for(let e,f=2*a.length-1;0<=f;f-=2){e=(d<<16|a.__halfDigit(f))>>>0;const g=0|e/b;d=0|e%b,e=(d<<16|a.__halfDigit(f-1))>>>0;const h=0|e/b;d=0|e%b,c.__setDigit(f>>>1,g<<16|h)}return c}static __absoluteModSmall(a,b){let c=0;for(let d=2*a.length-1;0<=d;d--){const e=(c<<16|a.__halfDigit(d))>>>0;c=0|e%b}return c}static __absoluteDivLarge(a,b,d,e){var f=Math.imul;const g=b.__halfDigitLength(),h=b.length,c=a.__halfDigitLength()-g;let i=null;d&&(i=new JSBI(c+2>>>1,!1),i.__initializeDigits());const k=new JSBI(g+2>>>1,!1);k.__initializeDigits();const l=JSBI.__clz16(b.__halfDigit(g-1));0<l&&(b=JSBI.__specialLeftShift(b,l,0));const m=JSBI.__specialLeftShift(a,l,1),n=b.__halfDigit(g-1);let o=0;for(let l,p=c;0<=p;p--){l=65535;const a=m.__halfDigit(p+g);if(a!==n){const c=(a<<16|m.__halfDigit(p+g-1))>>>0;l=0|c/n;let d=0|c%n;const e=b.__halfDigit(g-2),h=m.__halfDigit(p+g-2);for(;f(l,e)>>>0>(d<<16|h)>>>0&&(l--,d+=n,!(65535<d)););}JSBI.__internalMultiplyAdd(b,l,0,h,k);let e=m.__inplaceSub(k,p,g+1);0!==e&&(e=m.__inplaceAdd(b,p,g),m.__setHalfDigit(p+g,m.__halfDigit(p+g)+e),l--),d&&(1&p?o=l<<16:i.__setDigit(p>>>1,o|l))}return e?(m.__inplaceRightShift(l),d?{quotient:i,remainder:m}:m):d?i:void 0}static __clz16(a){return Math.clz32(a)-16}__inplaceAdd(a,b,c){let d=0;for(let e=0;e<c;e++){const c=this.__halfDigit(b+e)+a.__halfDigit(e)+d;d=c>>>16,this.__setHalfDigit(b+e,c)}return d}__inplaceSub(a,b,c){let d=0;if(1&b){b>>=1;let e=this.__digit(b),f=65535&e,g=0;for(;g<c-1>>>1;g++){const c=a.__digit(g),h=(e>>>16)-(65535&c)-d;d=1&h>>>16,this.__setDigit(b+g,h<<16|65535&f),e=this.__digit(b+g+1),f=(65535&e)-(c>>>16)-d,d=1&f>>>16}const h=a.__digit(g),i=(e>>>16)-(65535&h)-d;d=1&i>>>16,this.__setDigit(b+g,i<<16|65535&f);if(b+g+1>=this.length)throw new RangeError("out of bounds");0==(1&c)&&(e=this.__digit(b+g+1),f=(65535&e)-(h>>>16)-d,d=1&f>>>16,this.__setDigit(b+a.length,4294901760&e|65535&f))}else{b>>=1;let e=0;for(;e<a.length-1;e++){const c=this.__digit(b+e),f=a.__digit(e),g=(65535&c)-(65535&f)-d;d=1&g>>>16;const h=(c>>>16)-(f>>>16)-d;d=1&h>>>16,this.__setDigit(b+e,h<<16|65535&g)}const f=this.__digit(b+e),g=a.__digit(e),h=(65535&f)-(65535&g)-d;d=1&h>>>16;let i=0;0==(1&c)&&(i=(f>>>16)-(g>>>16)-d,d=1&i>>>16),this.__setDigit(b+e,i<<16|65535&h)}return d}__inplaceRightShift(a){if(0===a)return;let b=this.__digit(0)>>>a;const c=this.length-1;for(let e=0;e<c;e++){const c=this.__digit(e+1);this.__setDigit(e,c<<32-a|b),b=c>>>a}this.__setDigit(c,b)}static __specialLeftShift(a,b,c){const d=a.length,e=new JSBI(d+c,!1);if(0===b){for(let b=0;b<d;b++)e.__setDigit(b,a.__digit(b));return 0<c&&e.__setDigit(d,0),e}let f=0;for(let g=0;g<d;g++){const c=a.__digit(g);e.__setDigit(g,c<<b|f),f=c>>>32-b}return 0<c&&e.__setDigit(d,f),e}static __leftShiftByAbsolute(a,b){const c=JSBI.__toShiftAmount(b);if(0>c)throw new RangeError("BigInt too big");const e=c>>>5,f=31&c,g=a.length,h=0!==f&&0!=a.__digit(g-1)>>>32-f,j=g+e+(h?1:0),k=new JSBI(j,a.sign);if(0===f){let b=0;for(;b<e;b++)k.__setDigit(b,0);for(;b<j;b++)k.__setDigit(b,a.__digit(b-e))}else{let b=0;for(let a=0;a<e;a++)k.__setDigit(a,0);for(let c=0;c<g;c++){const g=a.__digit(c);k.__setDigit(c+e,g<<f|b),b=g>>>32-f}if(h)k.__setDigit(g+e,b);else if(0!=b)throw new Error("implementation bug")}return k.__trim()}static __rightShiftByAbsolute(a,b){const c=a.length,d=a.sign,e=JSBI.__toShiftAmount(b);if(0>e)return JSBI.__rightShiftByMaximum(d);const f=e>>>5,g=31&e;let h=c-f;if(0>=h)return JSBI.__rightShiftByMaximum(d);let i=!1;if(d){if(0!=(a.__digit(f)&(1<<g)-1))i=!0;else for(let b=0;b<f;b++)if(0!==a.__digit(b)){i=!0;break}}if(i&&0===g){const b=a.__digit(c-1);0==~b&&h++}let j=new JSBI(h,d);if(0===g)for(let b=f;b<c;b++)j.__setDigit(b-f,a.__digit(b));else{let b=a.__digit(f)>>>g;const d=c-f-1;for(let c=0;c<d;c++){const e=a.__digit(c+f+1);j.__setDigit(c,e<<32-g|b),b=e>>>g}j.__setDigit(d,b)}return i&&(j=JSBI.__absoluteAddOne(j,!0,j)),j.__trim()}static __rightShiftByMaximum(a){return a?JSBI.__oneDigit(1,!0):JSBI.__zero()}static __toShiftAmount(a){if(1<a.length)return-1;const b=a.__unsignedDigit(0);return b>JSBI.__kMaxLengthBits?-1:b}static __toPrimitive(a,b="default"){if("object"!=typeof a)return a;if(a.constructor===JSBI)return a;const c=a[Symbol.toPrimitive];if(c){const a=c(b);if("object"!=typeof a)return a;throw new TypeError("Cannot convert object to primitive value")}const d=a.valueOf;if(d){const b=d.call(a);if("object"!=typeof b)return b}const e=a.toString;if(e){const b=e.call(a);if("object"!=typeof b)return b}throw new TypeError("Cannot convert object to primitive value")}static __toNumeric(a){return JSBI.__isBigInt(a)?a:+a}static __isBigInt(a){return"object"==typeof a&&a.constructor===JSBI}__digit(a){return this[a]}__unsignedDigit(a){return this[a]>>>0}__setDigit(a,b){this[a]=0|b}__setDigitGrow(a,b){this[a]=0|b}__halfDigitLength(){const a=this.length;return 65535>=this.__unsignedDigit(a-1)?2*a-1:2*a}__halfDigit(a){return 65535&this[a>>>1]>>>((1&a)<<4)}__setHalfDigit(a,b){const c=a>>>1,d=this.__digit(c),e=1&a?65535&d|b<<16:4294901760&d|65535&b;this.__setDigit(c,e)}static __digitPow(a,b){let c=1;for(;0<b;)1&b&&(c*=a),b>>>=1,a*=a;return c}}JSBI.__kMaxLength=33554432,JSBI.__kMaxLengthBits=JSBI.__kMaxLength<<5,JSBI.__kMaxBitsPerChar=[0,0,32,51,64,75,83,90,96,102,107,111,115,119,122,126,128,131,134,136,139,141,143,145,147,149,151,153,154,156,158,159,160,162,163,165,166],JSBI.__kBitsPerCharTableShift=5,JSBI.__kBitsPerCharTableMultiplier=1<<JSBI.__kBitsPerCharTableShift,JSBI.__kConversionChars=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],JSBI.__kBitConversionBuffer=new ArrayBuffer(8),JSBI.__kBitConversionDouble=new Float64Array(JSBI.__kBitConversionBuffer),JSBI.__kBitConversionInts=new Int32Array(JSBI.__kBitConversionBuffer),module.exports=JSBI;

@@ -1,1 +0,1 @@

(function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):a.JSBI=b()})(this,function(){"use strict";var a=Math.imul,b=Math.abs,c=Math.max,d=Math.clz32;class e extends Array{constructor(a,b){if(a>e.__kMaxLength)throw new RangeError("Maximum BigInt size exceeded");super(a),this.sign=b}static BigInt(a){var b=Math.floor,c=Number.isFinite;if("number"==typeof a){if(0===a)return e.__zero();if((0|a)===a)return 0>a?e.__oneDigit(-a,!0):e.__oneDigit(a,!1);if(!c(a)||b(a)!==a)throw new RangeError("The number "+a+" cannot be converted to BigInt because it is not an integer");return e.__fromDouble(a)}if("string"==typeof a){const b=e.__fromString(a);if(null===b)throw new SyntaxError("Cannot convert "+a+" to a BigInt");return b}if("boolean"==typeof a)return!0===a?e.__oneDigit(1,!1):e.__zero();if("object"==typeof a){if(a.constructor===e)return a;const b=e.__toPrimitive(a);return e.BigInt(b)}throw new TypeError("Cannot convert "+a+" to a BigInt")}toDebugString(){const a=["BigInt["];for(const b of this)a.push((b?(b>>>0).toString(16):b)+", ");return a.push("]"),a.join("")}toString(a=10){if(2>a||36<a)throw new RangeError("toString() radix argument must be between 2 and 36");return 0===this.length?"0":0==(a&a-1)?e.__toStringBasePowerOfTwo(this,a):e.__toStringGeneric(this,a,!1)}static toNumber(a){const b=a.length;if(0===b)return 0;if(1===b){const b=a.__unsignedDigit(0);return a.sign?-b:b}const c=a.__digit(b-1),f=d(c),g=32*b-f;if(1024<g)return a.sign?-Infinity:1/0;let h=g-1,i=c,j=b-1;const k=f+1;let l=32===k?0:i<<k;l>>>=12;const m=k-12;let n=12<=k?0:i<<20+k,o=20+k;0<m&&0<j&&(j--,i=a.__digit(j),l|=i>>>32-m,n=i<<m,o=m),0<o&&0<j&&(j--,i=a.__digit(j),n|=i>>>32-o,o-=32);const p=e.__decideRounding(a,o,j,i);if((1===p||0===p&&1==(1&n))&&(n=n+1>>>0,0==n&&(l++,0!=l>>>20&&(l=0,h++,1023<h))))return a.sign?-Infinity:1/0;const q=a.sign?-2147483648:0;return h=h+1023<<20,e.__kBitConversionInts[1]=q|h|l,e.__kBitConversionInts[0]=n,e.__kBitConversionDouble[0]}static unaryMinus(a){if(0===a.length)return a;const b=a.__copy();return b.sign=!a.sign,b}static bitwiseNot(a){return a.sign?e.__absoluteSubOne(a).__trim():e.__absoluteAddOne(a,!0)}static exponentiate(a,b){if(b.sign)throw new RangeError("Exponent must be positive");if(0===b.length)return e.__oneDigit(1,!1);if(0===a.length)return a;if(1===a.length&&1===a.__digit(0))return a.sign&&0==(1&b.__digit(0))?e.unaryMinus(a):a;if(1<b.length)throw new RangeError("BigInt too big");let c=b.__unsignedDigit(0);if(1===c)return a;if(c>=e.__kMaxLengthBits)throw new RangeError("BigInt too big");if(1===a.length&&2===a.__digit(0)){const b=1+(c>>>5),d=a.sign&&0!=(1&c),f=new e(b,d);f.__initializeDigits();const g=1<<(31&c);return f.__setDigit(b-1,g),f}let d=null,f=a;for(0!=(1&c)&&(d=a),c>>=1;0!==c;c>>=1)f=e.multiply(f,f),0!=(1&c)&&(null===d?d=f:d=e.multiply(d,f));return d}static multiply(a,b){if(0===a.length)return a;if(0===b.length)return b;let c=a.length+b.length;32<=a.__clzmsd()+b.__clzmsd()&&c--;const d=new e(c,a.sign!==b.sign);d.__initializeDigits();for(let c=0;c<a.length;c++)e.__multiplyAccumulate(b,a.__digit(c),d,c);return d.__trim()}static divide(a,b){if(0===b.length)throw new RangeError("Division by zero");if(0>e.__absoluteCompare(a,b))return e.__zero();const c=a.sign!==b.sign,d=b.__unsignedDigit(0);let f;if(1===b.length&&65535>=d){if(1===d)return c===a.sign?a:e.unaryMinus(a);f=e.__absoluteDivSmall(a,d,null)}else f=e.__absoluteDivLarge(a,b,!0,!1);return f.sign=c,f.__trim()}static remainder(a,b){if(0===b.length)throw new RangeError("Division by zero");if(0>e.__absoluteCompare(a,b))return a;const c=b.__unsignedDigit(0);if(1===b.length&&65535>=c){if(1===c)return e.__zero();const b=e.__absoluteModSmall(a,c);return 0===b?e.__zero():e.__oneDigit(b,a.sign)}const d=e.__absoluteDivLarge(a,b,!1,!0);return d.sign=a.sign,d.__trim()}static add(a,b){const c=a.sign;return c===b.sign?e.__absoluteAdd(a,b,c):0<=e.__absoluteCompare(a,b)?e.__absoluteSub(a,b,c):e.__absoluteSub(b,a,!c)}static subtract(a,b){const c=a.sign;return c===b.sign?0<=e.__absoluteCompare(a,b)?e.__absoluteSub(a,b,c):e.__absoluteSub(b,a,!c):e.__absoluteAdd(a,b,c)}static leftShift(a,b){return 0===b.length||0===a.length?a:b.sign?e.__rightShiftByAbsolute(a,b):e.__leftShiftByAbsolute(a,b)}static signedRightShift(a,b){return 0===b.length||0===a.length?a:b.sign?e.__leftShiftByAbsolute(a,b):e.__rightShiftByAbsolute(a,b)}static unsignedRightShift(){throw new TypeError("BigInts have no unsigned right shift; use >> instead")}static lessThan(a,b){return 0>e.__compareToBigInt(a,b)}static lessThanOrEqual(a,b){return 0>=e.__compareToBigInt(a,b)}static greaterThan(a,b){return 0<e.__compareToBigInt(a,b)}static greaterThanOrEqual(a,b){return 0<=e.__compareToBigInt(a,b)}static equal(a,b){if(a.sign!==b.sign)return!1;if(a.length!==b.length)return!1;for(let c=0;c<a.length;c++)if(a.__digit(c)!==b.__digit(c))return!1;return!0}static bitwiseAnd(a,b){if(!a.sign&&!b.sign)return e.__absoluteAnd(a,b).__trim();if(a.sign&&b.sign){const d=c(a.length,b.length)+1;let f=e.__absoluteSubOne(a,d);const g=e.__absoluteSubOne(b);return f=e.__absoluteOr(f,g,f),e.__absoluteAddOne(f,!0,f).__trim()}return a.sign&&([a,b]=[b,a]),e.__absoluteAndNot(a,e.__absoluteSubOne(b)).__trim()}static bitwiseXor(a,b){if(!a.sign&&!b.sign)return e.__absoluteXor(a,b).__trim();if(a.sign&&b.sign){const d=c(a.length,b.length),f=e.__absoluteSubOne(a,d),g=e.__absoluteSubOne(b);return e.__absoluteXor(f,g,f).__trim()}const d=c(a.length,b.length)+1;a.sign&&([a,b]=[b,a]);let f=e.__absoluteSubOne(b,d);return f=e.__absoluteXor(f,a,f),e.__absoluteAddOne(f,!0,f).__trim()}static bitwiseOr(a,b){const d=c(a.length,b.length);if(!a.sign&&!b.sign)return e.__absoluteOr(a,b).__trim();if(a.sign&&b.sign){let c=e.__absoluteSubOne(a,d);const f=e.__absoluteSubOne(b);return c=e.__absoluteAnd(c,f,c),e.__absoluteAddOne(c,!0,c).__trim()}a.sign&&([a,b]=[b,a]);let f=e.__absoluteSubOne(b,d);return f=e.__absoluteAndNot(f,a,f),e.__absoluteAddOne(f,!0,f).__trim()}static ADD(a,b){if(a=e.__toPrimitive(a),b=e.__toPrimitive(b),"string"==typeof a)return"string"!=typeof b&&(b=b.toString()),a+b;if("string"==typeof b)return a.toString()+b;if(a=e.__toNumeric(a),b=e.__toNumeric(b),e.__isBigInt(a)&&e.__isBigInt(b))return e.add(a,b);if("number"==typeof a&&"number"==typeof b)return a+b;throw new TypeError("Cannot mix BigInt and other types, use explicit conversions")}static LT(a,b){return e.__compare(a,b,0)}static LE(a,b){return e.__compare(a,b,1)}static GT(a,b){return e.__compare(a,b,2)}static GE(a,b){return e.__compare(a,b,3)}static EQ(a,b){for(;;){if(e.__isBigInt(a))return e.__isBigInt(b)?e.equal(a,b):e.EQ(b,a);if("number"==typeof a){if(e.__isBigInt(b))return e.__equalToNumber(b,a);if("object"!=typeof b)return a==b;b=e.__toPrimitive(b)}else if("string"==typeof a){if(e.__isBigInt(b))return a=e.__fromString(a),null!==a&&e.equal(a,b);if("object"!=typeof b)return a==b;b=e.__toPrimitive(b)}else if("boolean"==typeof a){if(e.__isBigInt(b))return e.__equalToNumber(b,+a);if("object"!=typeof b)return a==b;b=e.__toPrimitive(b)}else if("symbol"==typeof a){if(e.__isBigInt(b))return!1;if("object"!=typeof b)return a==b;b=e.__toPrimitive(b)}else if("object"==typeof a){if("object"==typeof b&&b.constructor!==e)return a==b;a=e.__toPrimitive(a)}else return a==b}}static __zero(){return new e(0,!1)}static __oneDigit(a,b){const c=new e(1,b);return c.__setDigit(0,a),c}__copy(){const a=new e(this.length,this.sign);for(let b=0;b<this.length;b++)a[b]=this[b];return a}__trim(){let a=this.length,b=this[a-1];for(;0===b;)a--,b=this[a-1],this.pop();return 0===a&&(this.sign=!1),this}__initializeDigits(){for(let a=0;a<this.length;a++)this[a]=0}static __decideRounding(a,b,c,d){if(0<b)return-1;let e;if(0>b)e=-b-1;else{if(0===c)return-1;c--,d=a.__digit(c),e=31}let f=1<<e;if(0==(d&f))return-1;if(f-=1,0!=(d&f))return 1;for(;0<c;)if(c--,0!==a.__digit(c))return 1;return 0}static __fromDouble(a){e.__kBitConversionDouble[0]=a;const b=2047&e.__kBitConversionInts[1]>>>20,c=b-1023,d=(c>>>5)+1,f=new e(d,0>a);let g=1048575&e.__kBitConversionInts[1]|1048576,h=e.__kBitConversionInts[0];const i=20,j=31&c;let k,l=0;if(20>j){const a=i-j;l=a+32,k=g>>>a,g=g<<32-a|h>>>a,h<<=32-a}else if(20===j)l=32,k=g,g=h;else{const a=j-i;l=32-a,k=g<<a|h>>>32-a,g=h<<a}f.__setDigit(d-1,k);for(let b=d-2;0<=b;b--)0<l?(l-=32,k=g,g=h):k=0,f.__setDigit(b,k);return f.__trim()}static __isWhitespace(a){return!!(13>=a&&9<=a)||(159>=a?32==a:131071>=a?160==a||5760==a:196607>=a?(a&=131071,10>=a||40==a||41==a||47==a||95==a||4096==a):65279==a)}static __fromString(a,b=0){let c=0;const f=a.length;let g=0;if(g===f)return e.__zero();let h=a.charCodeAt(g);for(;e.__isWhitespace(h);){if(++g===f)return e.__zero();h=a.charCodeAt(g)}if(43===h){if(++g===f)return null;h=a.charCodeAt(g),c=1}else if(45===h){if(++g===f)return null;h=a.charCodeAt(g),c=-1}if(0===b){if(b=10,48===h){if(++g===f)return e.__zero();if(h=a.charCodeAt(g),88===h||120===h){if(b=16,++g===f)return null;h=a.charCodeAt(g)}else if(79===h||111===h){if(b=8,++g===f)return null;h=a.charCodeAt(g)}else if(66===h||98===h){if(b=2,++g===f)return null;h=a.charCodeAt(g)}}}else if(16===b&&48===h){if(++g===f)return e.__zero();if(h=a.charCodeAt(g),88===h||120===h){if(++g===f)return null;h=a.charCodeAt(g)}}for(;48===h;){if(++g===f)return e.__zero();h=a.charCodeAt(g)}const i=f-g;let j=e.__kMaxBitsPerChar[b],k=e.__kBitsPerCharTableMultiplier-1;if(i>1073741824/j)return null;const l=j*i+k>>>e.__kBitsPerCharTableShift,m=new e(l+31>>>5,!1),n=10>b?b:10,o=10<b?b-10:0;if(0==(b&b-1)){j>>=e.__kBitsPerCharTableShift;const b=[],c=[];let d=!1;do{let e=0,i=0;for(;;){let b;if(h-48>>>0<n)b=h-48;else if((32|h)-97>>>0<o)b=(32|h)-87;else{d=!0;break}if(i+=j,e=e<<j|b,++g===f){d=!0;break}if(h=a.charCodeAt(g),32<i+j)break}b.push(e),c.push(i)}while(!d);e.__fillFromParts(m,b,c)}else{m.__initializeDigits();let c=!1,i=0;do{let l=0,p=1;for(;;){let e;if(h-48>>>0<n)e=h-48;else if((32|h)-97>>>0<o)e=(32|h)-87;else{c=!0;break}const d=p*b;if(4294967295<d)break;if(p=d,l=l*b+e,i++,++g===f){c=!0;break}h=a.charCodeAt(g)}k=32*e.__kBitsPerCharTableMultiplier-1;const q=j*i+k>>>e.__kBitsPerCharTableShift+5;m.__inplaceMultiplyAdd(p,l,q)}while(!c)}for(;g!==f;){if(!e.__isWhitespace(h))return null;h=a.charCodeAt(g++)}return 0!=c&&10!==b?null:(m.sign=-1==c,m.__trim())}static __fillFromParts(a,b,c){let d=0,e=0,f=0;for(let g=b.length-1;0<=g;g--){const h=b[g],i=c[g];e|=h<<f,f+=i,32===f?(a.__setDigit(d++,e),f=0,e=0):32<f&&(a.__setDigit(d++,e),f-=32,e=h>>>i-f)}if(0!==e){if(d>=a.length)throw new Error("implementation bug");a.__setDigit(d++,e)}for(;d<a.length;d++)a.__setDigit(d,0)}static __toStringBasePowerOfTwo(a,b){const c=a.length;let f=b-1;f=(85&f>>>1)+(85&f),f=(51&f>>>2)+(51&f),f=(15&f>>>4)+(15&f);const g=f,h=b-1,i=a.__digit(c-1),j=d(i);let k=0|(32*c-j+g-1)/g;if(a.sign&&k++,268435456<k)throw new Error("string too long");const l=Array(k);let m=k-1,n=0,o=0;for(let d=0;d<c-1;d++){const b=a.__digit(d),c=(n|b<<o)&h;l[m--]=e.__kConversionChars[c];const f=g-o;for(n=b>>>f,o=32-f;o>=g;)l[m--]=e.__kConversionChars[n&h],n>>>=g,o-=g}const p=(n|i<<o)&h;for(l[m--]=e.__kConversionChars[p],n=i>>>g-o;0!==n;)l[m--]=e.__kConversionChars[n&h],n>>>=g;if(a.sign&&(l[m--]="-"),-1!=m)throw new Error("implementation bug");return l.join("")}static __toStringGeneric(a,b,c){const f=a.length;if(0===f)return"";if(1===f){let d=a.__unsignedDigit(0).toString(b);return!1===c&&a.sign&&(d="-"+d),d}const g=32*f-d(a.__digit(f-1)),h=e.__kMaxBitsPerChar[b],i=h-1;let j=g*e.__kBitsPerCharTableMultiplier;j+=i-1,j=0|j/i;const k=j+1>>1,l=e.exponentiate(e.__oneDigit(b,!1),e.__oneDigit(k,!1));let m,n;const o=l.__unsignedDigit(0);if(1===l.length&&65535>=o){m=new e(a.length,!1),m.__initializeDigits();let c=0;for(let b=2*a.length-1;0<=b;b--){const d=c<<16|a.__halfDigit(b);m.__setHalfDigit(b,0|d/o),c=0|d%o}n=c.toString(b)}else{const c=e.__absoluteDivLarge(a,l,!0,!0);m=c.quotient;const d=c.remainder.__trim();n=e.__toStringGeneric(d,b,!0)}m.__trim();let p=e.__toStringGeneric(m,b,!0);for(;n.length<k;)n="0"+n;return!1===c&&a.sign&&(p="-"+p),p+n}static __unequalSign(a){return a?-1:1}static __absoluteGreater(a){return a?-1:1}static __absoluteLess(a){return a?1:-1}static __compareToBigInt(a,b){const c=a.sign;if(c!==b.sign)return e.__unequalSign(c);const d=e.__absoluteCompare(a,b);return 0<d?e.__absoluteGreater(c):0>d?e.__absoluteLess(c):0}static __compareToNumber(a,c){if(!0|c){const d=a.sign,f=0>c;if(d!==f)return e.__unequalSign(d);if(0===a.length){if(f)throw new Error("implementation bug");return 0===c?0:-1}if(1<a.length)return e.__absoluteGreater(d);const g=b(c),h=a.__unsignedDigit(0);return h>g?e.__absoluteGreater(d):h<g?e.__absoluteLess(d):0}return e.__compareToDouble(a,c)}static __compareToDouble(a,b){if(b!==b)return b;if(b===1/0)return-1;if(b===-Infinity)return 1;const c=a.sign;if(c!==0>b)return e.__unequalSign(c);if(0===b)throw new Error("implementation bug: should be handled elsewhere");if(0===a.length)return-1;e.__kBitConversionDouble[0]=b;const f=2047&e.__kBitConversionInts[1]>>>20;if(2047==f)throw new Error("implementation bug: handled elsewhere");const g=f-1023;if(0>g)return e.__absoluteGreater(c);const h=a.length;let i=a.__digit(h-1);const j=d(i),k=32*h-j,l=g+1;if(k<l)return e.__absoluteLess(c);if(k>l)return e.__absoluteGreater(c);let m=1048576|1048575&e.__kBitConversionInts[1],n=e.__kBitConversionInts[0];const o=20,p=31-j;if(p!==(k-1)%31)throw new Error("implementation bug");let q,r=0;if(20>p){const a=o-p;r=a+32,q=m>>>a,m=m<<32-a|n>>>a,n<<=32-a}else if(20===p)r=32,q=m,m=n;else{const a=p-o;r=32-a,q=m<<a|n>>>32-a,m=n<<a}if(i>>>=0,q>>>=0,i>q)return e.__absoluteGreater(c);if(i<q)return e.__absoluteLess(c);for(let d=h-2;0<=d;d--){0<r?(r-=32,q=m>>>0,m=n,n=0):q=0;const b=a.__unsignedDigit(d);if(b>q)return e.__absoluteGreater(c);if(b<q)return e.__absoluteLess(c)}if(0!==m||0!==n){if(0===r)throw new Error("implementation bug");return e.__absoluteLess(c)}return 0}static __equalToNumber(a,c){return c|0===c?0===c?0===a.length:1===a.length&&a.sign===0>c&&a.__unsignedDigit(0)===b(c):0===e.__compareToDouble(a,c)}static __comparisonResultToBool(a,b){switch(b){case 0:return 0>a;case 1:return 0>=a;case 2:return 0<a;case 3:return 0<=a;}throw new Error("unreachable")}static __compare(a,b,c){if(a=e.__toPrimitive(a),b=e.__toPrimitive(b),"string"==typeof a&&"string"==typeof b)switch(c){case 0:return a<b;case 1:return a<=b;case 2:return a>b;case 3:return a>=b;}if(e.__isBigInt(a)&&"string"==typeof b)return b=e.__fromString(b),null!==b&&e.__comparisonResultToBool(e.__compareToBigInt(a,b),c);if("string"==typeof a&&e.__isBigInt(b))return a=e.__fromString(a),null!==a&&e.__comparisonResultToBool(e.__compareToBigInt(a,b),c);if(a=e.__toNumeric(a),b=e.__toNumeric(b),e.__isBigInt(a)){if(e.__isBigInt(b))return e.__comparisonResultToBool(e.__compareToBigInt(a,b),c);if("number"!=typeof b)throw new Error("implementation bug");return e.__comparisonResultToBool(e.__compareToNumber(a,b),c)}if("number"!=typeof a)throw new Error("implementation bug");if(e.__isBigInt(b))return e.__comparisonResultToBool(e.__compareToNumber(b,a),2^c);if("number"!=typeof b)throw new Error("implementation bug");return 0===c?a<b:1===c?a<=b:2===c?a>b:3===c?a>=b:void 0}__clzmsd(){return d(this[this.length-1])}static __absoluteAdd(a,b,c){if(a.length<b.length)return e.__absoluteAdd(b,a,c);if(0===a.length)return a;if(0===b.length)return a.sign===c?a:e.unaryMinus(a);let d=a.length;(0===a.__clzmsd()||b.length===a.length&&0===b.__clzmsd())&&d++;const f=new e(d,c);let g=0,h=0;for(;h<b.length;h++){const c=b.__digit(h),d=a.__digit(h),e=(65535&d)+(65535&c)+g,i=(d>>>16)+(c>>>16)+(e>>>16);g=i>>>16,f.__setDigit(h,65535&e|i<<16)}for(;h<a.length;h++){const b=a.__digit(h),c=(65535&b)+g,d=(b>>>16)+(c>>>16);g=d>>>16,f.__setDigit(h,65535&c|d<<16)}return h<f.length&&f.__setDigit(h,g),f.__trim()}static __absoluteSub(a,b,c){if(0===a.length)return a;if(0===b.length)return a.sign===c?a:e.unaryMinus(a);const d=new e(a.length,c);let f=0,g=0;for(;g<b.length;g++){const c=a.__digit(g),e=b.__digit(g),h=(65535&c)-(65535&e)-f;f=1&h>>>16;const i=(c>>>16)-(e>>>16)-f;f=1&i>>>16,d.__setDigit(g,65535&h|i<<16)}for(;g<a.length;g++){const b=a.__digit(g),c=(65535&b)-f;f=1&c>>>16;const e=(b>>>16)-f;f=1&e>>>16,d.__setDigit(g,65535&c|e<<16)}return d.__trim()}static __absoluteAddOne(a,b,c=null){const d=a.length;null===c?c=new e(d,b):c.sign=b;let f=!0;for(let e,g=0;g<d;g++){e=a.__digit(g);const b=-1===e;f&&(e=0|e+1),f=b,c.__setDigit(g,e)}return f&&c.__setDigitGrow(d,1),c}static __absoluteSubOne(a,b){const c=a.length;b=b||c;const d=new e(b,!1);let f=!0;for(let e,g=0;g<c;g++){e=a.__digit(g);const b=0===e;f&&(e=0|e-1),f=b,d.__setDigit(g,e)}for(let e=c;e<b;e++)d.__setDigit(e,0);return d}static __absoluteAnd(a,b,c=null){let d=a.length,f=b.length,g=f;if(d<f){g=d;const c=a,e=d;a=b,d=f,b=c,f=e}let h=g;null===c?c=new e(h,!1):h=c.length;let j=0;for(;j<g;j++)c.__setDigit(j,a.__digit(j)&b.__digit(j));for(;j<h;j++)c.__setDigit(j,0);return c}static __absoluteAndNot(a,b,c=null){const d=a.length,f=b.length;let g=f;d<f&&(g=d);let h=d;null===c?c=new e(h,!1):h=c.length;let j=0;for(;j<g;j++)c.__setDigit(j,a.__digit(j)&~b.__digit(j));for(;j<d;j++)c.__setDigit(j,a.__digit(j));for(;j<h;j++)c.__setDigit(j,0);return c}static __absoluteOr(a,b,c=null){let d=a.length,f=b.length,g=f;if(d<f){g=d;const c=a,e=d;a=b,d=f,b=c,f=e}let h=d;null===c?c=new e(h,!1):h=c.length;let j=0;for(;j<g;j++)c.__setDigit(j,a.__digit(j)|b.__digit(j));for(;j<d;j++)c.__setDigit(j,a.__digit(j));for(;j<h;j++)c.__setDigit(j,0);return c}static __absoluteXor(a,b,c=null){let d=a.length,f=b.length,g=f;if(d<f){g=d;const c=a,e=d;a=b,d=f,b=c,f=e}let h=d;null===c?c=new e(h,!1):h=c.length;let j=0;for(;j<g;j++)c.__setDigit(j,a.__digit(j)^b.__digit(j));for(;j<d;j++)c.__setDigit(j,a.__digit(j));for(;j<h;j++)c.__setDigit(j,0);return c}static __absoluteCompare(a,b){const c=a.length-b.length;if(0!=c)return c;let d=a.length-1;for(;0<=d&&a.__digit(d)===b.__digit(d);)d--;return 0>d?0:a.__unsignedDigit(d)>b.__unsignedDigit(d)?1:-1}static __multiplyAccumulate(b,c,d,e){if(0===c)return;const f=65535&c,g=c>>>16;let h=0,j=0,k=0;for(let l=0;l<b.length;l++,e++){let c=d.__digit(e),i=65535&c,m=c>>>16;const n=b.__digit(l),o=65535&n,p=n>>>16,q=a(o,f),r=a(o,g),s=a(p,f),t=a(p,g);i+=j+(65535&q),m+=k+h+(i>>>16)+(q>>>16)+(65535&r)+(65535&s),h=m>>>16,j=(r>>>16)+(s>>>16)+(65535&t)+h,h=j>>>16,j&=65535,k=t>>>16,c=65535&i|m<<16,d.__setDigit(e,c)}for(;0!=h||0!==j||0!==k;e++){let a=d.__digit(e);const b=(65535&a)+j,c=(a>>>16)+(b>>>16)+k+h;j=0,k=0,h=c>>>16,a=65535&b|c<<16,d.__setDigit(e,a)}}static __internalMultiplyAdd(b,c,d,e,f){let g=d,h=0;for(let j=0;j<e;j++){const d=b.__digit(j),e=a(65535&d,c),i=(65535&e)+h+g;g=i>>>16;const k=a(d>>>16,c),l=(65535&k)+(e>>>16)+g;g=l>>>16,h=k>>>16,f.__setDigit(j,l<<16|65535&i)}if(f.length>e)for(f.__setDigit(e++,g+h);e<f.length;)f.__setDigit(e++,0);else if(0!==g+h)throw new Error("implementation bug")}__inplaceMultiplyAdd(b,c,d){d>this.length&&(d=this.length);const e=65535&b,f=b>>>16;let g=0,h=65535&c,j=c>>>16;for(let k=0;k<d;k++){const b=this.__digit(k),c=65535&b,d=b>>>16,i=a(c,e),l=a(c,f),m=a(d,e),n=a(d,f),o=h+(65535&i),p=j+g+(o>>>16)+(i>>>16)+(65535&l)+(65535&m);h=(l>>>16)+(m>>>16)+(65535&n)+(p>>>16),g=h>>>16,h&=65535,j=n>>>16;this.__setDigit(k,65535&o|p<<16)}if(0!=g||0!==h||0!==j)throw new Error("implementation bug")}static __absoluteDivSmall(a,b,c){null===c&&(c=new e(a.length,!1));let d=0;for(let e,f=2*a.length-1;0<=f;f-=2){e=(d<<16|a.__halfDigit(f))>>>0;const g=0|e/b;d=0|e%b,e=(d<<16|a.__halfDigit(f-1))>>>0;const h=0|e/b;d=0|e%b,c.__setDigit(f>>>1,g<<16|h)}return c}static __absoluteModSmall(a,b){let c=0;for(let d=2*a.length-1;0<=d;d--){const e=(c<<16|a.__halfDigit(d))>>>0;c=0|e%b}return c}static __absoluteDivLarge(b,d,f,g){const h=d.__halfDigitLength(),i=d.length,c=b.__halfDigitLength()-h;let k=null;f&&(k=new e(c+2>>>1,!1),k.__initializeDigits());const l=new e(h+2>>>1,!1);l.__initializeDigits();const m=e.__clz16(d.__halfDigit(h-1));0<m&&(d=e.__specialLeftShift(d,m,0));const n=e.__specialLeftShift(b,m,1),o=d.__halfDigit(h-1);let p=0;for(let m,q=c;0<=q;q--){m=65535;const b=n.__halfDigit(q+h);if(b!==o){const c=(b<<16|n.__halfDigit(q+h-1))>>>0;m=0|c/o;let e=0|c%o;const f=d.__halfDigit(h-2),g=n.__halfDigit(q+h-2);for(;a(m,f)>>>0>(e<<16|g)>>>0&&(m--,e+=o,!(65535<e)););}e.__internalMultiplyAdd(d,m,0,i,l);let g=n.__inplaceSub(l,q,h+1);0!==g&&(g=n.__inplaceAdd(d,q,h),n.__setHalfDigit(q+h,n.__halfDigit(q+h)+g),m--),f&&(1&q?p=m<<16:k.__setDigit(q>>>1,p|m))}return g?(n.__inplaceRightShift(m),f?{quotient:k,remainder:n}:n):f?k:void 0}static __clz16(a){return d(a)-16}__inplaceAdd(a,b,c){let d=0;for(let e=0;e<c;e++){const c=this.__halfDigit(b+e)+a.__halfDigit(e)+d;d=c>>>16,this.__setHalfDigit(b+e,c)}return d}__inplaceSub(a,b,c){let d=0;if(1&b){b>>=1;let e=this.__digit(b),f=65535&e,g=0;for(;g<c-1>>>1;g++){const c=a.__digit(g),h=(e>>>16)-(65535&c)-d;d=1&h>>>16,this.__setDigit(b+g,h<<16|65535&f),e=this.__digit(b+g+1),f=(65535&e)-(c>>>16)-d,d=1&f>>>16}const h=a.__digit(g),i=(e>>>16)-(65535&h)-d;d=1&i>>>16,this.__setDigit(b+g,i<<16|65535&f);if(b+g+1>=this.length)throw new RangeError("out of bounds");0==(1&c)&&(e=this.__digit(b+g+1),f=(65535&e)-(h>>>16)-d,d=1&f>>>16,this.__setDigit(b+a.length,4294901760&e|65535&f))}else{b>>=1;let e=0;for(;e<a.length-1;e++){const c=this.__digit(b+e),f=a.__digit(e),g=(65535&c)-(65535&f)-d;d=1&g>>>16;const h=(c>>>16)-(f>>>16)-d;d=1&h>>>16,this.__setDigit(b+e,h<<16|65535&g)}const f=this.__digit(b+e),g=a.__digit(e),h=(65535&f)-(65535&g)-d;d=1&h>>>16;let i=0;0==(1&c)&&(i=(f>>>16)-(g>>>16)-d,d=1&i>>>16),this.__setDigit(b+e,i<<16|65535&h)}return d}__inplaceRightShift(a){if(0===a)return;let b=this.__digit(0)>>>a;const c=this.length-1;for(let e=0;e<c;e++){const c=this.__digit(e+1);this.__setDigit(e,c<<32-a|b),b=c>>>a}this.__setDigit(c,b)}static __specialLeftShift(a,b,c){const d=a.length,f=new e(d+c,!1);if(0===b){for(let b=0;b<d;b++)f.__setDigit(b,a.__digit(b));return 0<c&&f.__setDigit(d,0),f}let g=0;for(let e=0;e<d;e++){const c=a.__digit(e);f.__setDigit(e,c<<b|g),g=c>>>32-b}return 0<c&&f.__setDigit(d,g),f}static __leftShiftByAbsolute(a,b){const c=e.__toShiftAmount(b);if(0>c)throw new RangeError("BigInt too big");const f=c>>>5,g=31&c,h=a.length,i=0!==g&&0!=a.__digit(h-1)>>>32-g,j=h+f+(i?1:0),k=new e(j,a.sign);if(0===g){let b=0;for(;b<f;b++)k.__setDigit(b,0);for(;b<j;b++)k.__setDigit(b,a.__digit(b-f))}else{let b=0;for(let a=0;a<f;a++)k.__setDigit(a,0);for(let c=0;c<h;c++){const e=a.__digit(c);k.__setDigit(c+f,e<<g|b),b=e>>>32-g}if(i)k.__setDigit(h+f,b);else if(0!=b)throw new Error("implementation bug")}return k.__trim()}static __rightShiftByAbsolute(a,b){const c=a.length,d=a.sign,f=e.__toShiftAmount(b);if(0>f)return e.__rightShiftByMaximum(d);const g=f>>>5,h=31&f;let i=c-g;if(0>=i)return e.__rightShiftByMaximum(d);let j=!1;if(d){if(0!=(a.__digit(g)&(1<<h)-1))j=!0;else for(let b=0;b<g;b++)if(0!==a.__digit(b)){j=!0;break}}if(j&&0===h){const b=a.__digit(c-1);0==~b&&i++}let k=new e(i,d);if(0===h)for(let b=g;b<c;b++)k.__setDigit(b-g,a.__digit(b));else{let b=a.__digit(g)>>>h;const d=c-g-1;for(let c=0;c<d;c++){const e=a.__digit(c+g+1);k.__setDigit(c,e<<32-h|b),b=e>>>h}k.__setDigit(d,b)}return j&&(k=e.__absoluteAddOne(k,!0,k)),k.__trim()}static __rightShiftByMaximum(a){return a?e.__oneDigit(1,!0):e.__zero()}static __toShiftAmount(a){if(1<a.length)return-1;const b=a.__unsignedDigit(0);return b>e.__kMaxLengthBits?-1:b}static __toPrimitive(a,b="default"){if("object"!=typeof a)return a;if(a.constructor===e)return a;const c=a[Symbol.toPrimitive];if(c){const a=c(b);if("object"!=typeof a)return a;throw new TypeError("Cannot convert object to primitive value")}const d=a.valueOf;if(d){const b=d.call(a);if("object"!=typeof b)return b}const f=a.toString;if(f){const b=f.call(a);if("object"!=typeof b)return b}throw new TypeError("Cannot convert object to primitive value")}static __toNumeric(a){return e.__isBigInt(a)?a:+a}static __isBigInt(a){return"object"==typeof a&&a.constructor===e}__digit(a){return this[a]}__unsignedDigit(a){return this[a]>>>0}__setDigit(a,b){this[a]=0|b}__setDigitGrow(a,b){this[a]=0|b}__halfDigitLength(){const a=this.length;return 65535>=this.__unsignedDigit(a-1)?2*a-1:2*a}__halfDigit(a){return 65535&this[a>>>1]>>>((1&a)<<4)}__setHalfDigit(a,b){const c=a>>>1,d=this.__digit(c),e=1&a?65535&d|b<<16:4294901760&d|65535&b;this.__setDigit(c,e)}static __digitPow(a,b){let c=1;for(;0<b;)1&b&&(c*=a),b>>>=1,a*=a;return c}}return e.__kMaxLength=33554432,e.__kMaxLengthBits=e.__kMaxLength<<5,e.__kMaxBitsPerChar=[0,0,32,51,64,75,83,90,96,102,107,111,115,119,122,126,128,131,134,136,139,141,143,145,147,149,151,153,154,156,158,159,160,162,163,165,166],e.__kBitsPerCharTableShift=5,e.__kBitsPerCharTableMultiplier=1<<e.__kBitsPerCharTableShift,e.__kConversionChars=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],e.__kBitConversionBuffer=new ArrayBuffer(8),e.__kBitConversionDouble=new Float64Array(e.__kBitConversionBuffer),e.__kBitConversionInts=new Int32Array(e.__kBitConversionBuffer),e});
(function(e,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):e.JSBI=i()})(this,function(){'use strict';function e(i){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(i)}function i(e,i){if(!(e instanceof i))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var _,n=0;n<t.length;n++)_=t[n],_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(e,_.key,_)}function _(e,i,_){return i&&t(e.prototype,i),_&&t(e,_),e}function n(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(i&&i.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),i&&l(e,i)}function g(e){return g=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},g(e)}function l(e,i){return l=Object.setPrototypeOf||function(e,i){return e.__proto__=i,e},l(e,i)}function o(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(i){return!1}}function a(){return a=o()?Reflect.construct:function(e,i,t){var _=[null];_.push.apply(_,i);var n=Function.bind.apply(e,_),g=new n;return t&&l(g,t.prototype),g},a.apply(null,arguments)}function s(e){return-1!==Function.toString.call(e).indexOf("[native code]")}function u(e){var i="function"==typeof Map?new Map:void 0;return u=function(e){function t(){return a(e,arguments,g(this).constructor)}if(null===e||!s(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if("undefined"!=typeof i){if(i.has(e))return i.get(e);i.set(e,t)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),l(t,e)},u(e)}function r(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function d(e,i){return i&&("object"==typeof i||"function"==typeof i)?i:r(e)}var h=function(t){var o=Math.abs,a=Math.max,s=Math.imul,u=Math.clz32;function l(e,t){var _;if(i(this,l),e>l.__kMaxLength)throw new RangeError("Maximum BigInt size exceeded");return _=d(this,g(l).call(this,e)),_.sign=t,_}return n(l,t),_(l,[{key:"toDebugString",value:function(){var e=["BigInt["],i=!0,t=!1,_=void 0;try{for(var n,g,l=this[Symbol.iterator]();!(i=(n=l.next()).done);i=!0)g=n.value,e.push((g?(g>>>0).toString(16):g)+", ")}catch(e){t=!0,_=e}finally{try{i||null==l.return||l.return()}finally{if(t)throw _}}return e.push("]"),e.join("")}},{key:"toString",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:10;if(2>e||36<e)throw new RangeError("toString() radix argument must be between 2 and 36");return 0===this.length?"0":0==(e&e-1)?l.__toStringBasePowerOfTwo(this,e):l.__toStringGeneric(this,e,!1)}},{key:"__copy",value:function(){for(var e=new l(this.length,this.sign),t=0;t<this.length;t++)e[t]=this[t];return e}},{key:"__trim",value:function(){for(var e=this.length,i=this[e-1];0===i;)e--,i=this[e-1],this.pop();return 0===e&&(this.sign=!1),this}},{key:"__initializeDigits",value:function(){for(var e=0;e<this.length;e++)this[e]=0}},{key:"__clzmsd",value:function(){return u(this[this.length-1])}},{key:"__inplaceMultiplyAdd",value:function(e,t,_){_>this.length&&(_=this.length);for(var n=65535&e,g=e>>>16,l=0,o=65535&t,a=t>>>16,u=0;u<_;u++){var r=this.__digit(u),d=65535&r,h=r>>>16,b=s(d,n),m=s(d,g),c=s(h,n),v=s(h,g),y=o+(65535&b),f=a+l+(y>>>16)+(b>>>16)+(65535&m)+(65535&c);o=(m>>>16)+(c>>>16)+(65535&v)+(f>>>16),l=o>>>16,o&=65535,a=v>>>16;this.__setDigit(u,65535&y|f<<16)}if(0!==l||0!==o||0!==a)throw new Error("implementation bug")}},{key:"__inplaceAdd",value:function(e,t,_){for(var n,g=0,l=0;l<_;l++)n=this.__halfDigit(t+l)+e.__halfDigit(l)+g,g=n>>>16,this.__setHalfDigit(t+l,n);return g}},{key:"__inplaceSub",value:function(e,t,_){var n=0;if(1&t){t>>=1;for(var g=this.__digit(t),l=65535&g,o=0;o<_-1>>>1;o++){var a=e.__digit(o),s=(g>>>16)-(65535&a)-n;n=1&s>>>16,this.__setDigit(t+o,s<<16|65535&l),g=this.__digit(t+o+1),l=(65535&g)-(a>>>16)-n,n=1&l>>>16}var u=e.__digit(o),r=(g>>>16)-(65535&u)-n;n=1&r>>>16,this.__setDigit(t+o,r<<16|65535&l);if(t+o+1>=this.length)throw new RangeError("out of bounds");0==(1&_)&&(g=this.__digit(t+o+1),l=(65535&g)-(u>>>16)-n,n=1&l>>>16,this.__setDigit(t+e.length,4294901760&g|65535&l))}else{t>>=1;for(var d=0;d<e.length-1;d++){var h=this.__digit(t+d),b=e.__digit(d),m=(65535&h)-(65535&b)-n;n=1&m>>>16;var c=(h>>>16)-(b>>>16)-n;n=1&c>>>16,this.__setDigit(t+d,c<<16|65535&m)}var v=this.__digit(t+d),y=e.__digit(d),f=(65535&v)-(65535&y)-n;n=1&f>>>16;var D=0;0==(1&_)&&(D=(v>>>16)-(y>>>16)-n,n=1&D>>>16),this.__setDigit(t+d,D<<16|65535&f)}return n}},{key:"__inplaceRightShift",value:function(e){if(0!==e){for(var t,_=this.__digit(0)>>>e,n=this.length-1,g=0;g<n;g++)t=this.__digit(g+1),this.__setDigit(g,t<<32-e|_),_=t>>>e;this.__setDigit(n,_)}}},{key:"__digit",value:function(e){return this[e]}},{key:"__unsignedDigit",value:function(e){return this[e]>>>0}},{key:"__setDigit",value:function(e,i){this[e]=0|i}},{key:"__setDigitGrow",value:function(e,i){this[e]=0|i}},{key:"__halfDigitLength",value:function(){var e=this.length;return 65535>=this.__unsignedDigit(e-1)?2*e-1:2*e}},{key:"__halfDigit",value:function(e){return 65535&this[e>>>1]>>>((1&e)<<4)}},{key:"__setHalfDigit",value:function(e,i){var t=e>>>1,_=this.__digit(t),n=1&e?65535&_|i<<16:4294901760&_|65535&i;this.__setDigit(t,n)}}],[{key:"BigInt",value:function(i){var t=Math.floor,_=Number.isFinite;if("number"==typeof i){if(0===i)return l.__zero();if((0|i)===i)return 0>i?l.__oneDigit(-i,!0):l.__oneDigit(i,!1);if(!_(i)||t(i)!==i)throw new RangeError("The number "+i+" cannot be converted to BigInt because it is not an integer");return l.__fromDouble(i)}if("string"==typeof i){var n=l.__fromString(i);if(null===n)throw new SyntaxError("Cannot convert "+i+" to a BigInt");return n}if("boolean"==typeof i)return!0===i?l.__oneDigit(1,!1):l.__zero();if("object"===e(i)){if(i.constructor===l)return i;var g=l.__toPrimitive(i);return l.BigInt(g)}throw new TypeError("Cannot convert "+i+" to a BigInt")}},{key:"toNumber",value:function(e){var i=e.length;if(0===i)return 0;if(1===i){var t=e.__unsignedDigit(0);return e.sign?-t:t}var _=e.__digit(i-1),n=u(_),g=32*i-n;if(1024<g)return e.sign?-Infinity:1/0;var o=g-1,a=_,s=i-1,r=n+1,d=32===r?0:a<<r;d>>>=12;var h=r-12,b=12<=r?0:a<<20+r,m=20+r;0<h&&0<s&&(s--,a=e.__digit(s),d|=a>>>32-h,b=a<<h,m=h),0<m&&0<s&&(s--,a=e.__digit(s),b|=a>>>32-m,m-=32);var c=l.__decideRounding(e,m,s,a);if((1===c||0===c&&1==(1&b))&&(b=b+1>>>0,0===b&&(d++,0!=d>>>20&&(d=0,o++,1023<o))))return e.sign?-Infinity:1/0;var v=e.sign?-2147483648:0;return o=o+1023<<20,l.__kBitConversionInts[1]=v|o|d,l.__kBitConversionInts[0]=b,l.__kBitConversionDouble[0]}},{key:"unaryMinus",value:function(e){if(0===e.length)return e;var i=e.__copy();return i.sign=!e.sign,i}},{key:"bitwiseNot",value:function(e){return e.sign?l.__absoluteSubOne(e).__trim():l.__absoluteAddOne(e,!0)}},{key:"exponentiate",value:function(e,i){if(i.sign)throw new RangeError("Exponent must be positive");if(0===i.length)return l.__oneDigit(1,!1);if(0===e.length)return e;if(1===e.length&&1===e.__digit(0))return e.sign&&0==(1&i.__digit(0))?l.unaryMinus(e):e;if(1<i.length)throw new RangeError("BigInt too big");var t=i.__unsignedDigit(0);if(1===t)return e;if(t>=l.__kMaxLengthBits)throw new RangeError("BigInt too big");if(1===e.length&&2===e.__digit(0)){var _=1+(t>>>5),n=e.sign&&0!=(1&t),g=new l(_,n);g.__initializeDigits();var o=1<<(31&t);return g.__setDigit(_-1,o),g}var a=null,s=e;for(0!=(1&t)&&(a=e),t>>=1;0!==t;t>>=1)s=l.multiply(s,s),0!=(1&t)&&(null===a?a=s:a=l.multiply(a,s));return a}},{key:"multiply",value:function(e,t){if(0===e.length)return e;if(0===t.length)return t;var _=e.length+t.length;32<=e.__clzmsd()+t.__clzmsd()&&_--;var n=new l(_,e.sign!==t.sign);n.__initializeDigits();for(var g=0;g<e.length;g++)l.__multiplyAccumulate(t,e.__digit(g),n,g);return n.__trim()}},{key:"divide",value:function(e,i){if(0===i.length)throw new RangeError("Division by zero");if(0>l.__absoluteCompare(e,i))return l.__zero();var t,_=e.sign!==i.sign,n=i.__unsignedDigit(0);if(1===i.length&&65535>=n){if(1===n)return _===e.sign?e:l.unaryMinus(e);t=l.__absoluteDivSmall(e,n,null)}else t=l.__absoluteDivLarge(e,i,!0,!1);return t.sign=_,t.__trim()}},{key:"remainder",value:function e(i,t){if(0===t.length)throw new RangeError("Division by zero");if(0>l.__absoluteCompare(i,t))return i;var _=t.__unsignedDigit(0);if(1===t.length&&65535>=_){if(1===_)return l.__zero();var n=l.__absoluteModSmall(i,_);return 0===n?l.__zero():l.__oneDigit(n,i.sign)}var e=l.__absoluteDivLarge(i,t,!1,!0);return e.sign=i.sign,e.__trim()}},{key:"add",value:function(e,i){var t=e.sign;return t===i.sign?l.__absoluteAdd(e,i,t):0<=l.__absoluteCompare(e,i)?l.__absoluteSub(e,i,t):l.__absoluteSub(i,e,!t)}},{key:"subtract",value:function(e,i){var t=e.sign;return t===i.sign?0<=l.__absoluteCompare(e,i)?l.__absoluteSub(e,i,t):l.__absoluteSub(i,e,!t):l.__absoluteAdd(e,i,t)}},{key:"leftShift",value:function(e,i){return 0===i.length||0===e.length?e:i.sign?l.__rightShiftByAbsolute(e,i):l.__leftShiftByAbsolute(e,i)}},{key:"signedRightShift",value:function(e,i){return 0===i.length||0===e.length?e:i.sign?l.__leftShiftByAbsolute(e,i):l.__rightShiftByAbsolute(e,i)}},{key:"unsignedRightShift",value:function(){throw new TypeError("BigInts have no unsigned right shift; use >> instead")}},{key:"lessThan",value:function(e,i){return 0>l.__compareToBigInt(e,i)}},{key:"lessThanOrEqual",value:function(e,i){return 0>=l.__compareToBigInt(e,i)}},{key:"greaterThan",value:function(e,i){return 0<l.__compareToBigInt(e,i)}},{key:"greaterThanOrEqual",value:function(e,i){return 0<=l.__compareToBigInt(e,i)}},{key:"equal",value:function(e,t){if(e.sign!==t.sign)return!1;if(e.length!==t.length)return!1;for(var _=0;_<e.length;_++)if(e.__digit(_)!==t.__digit(_))return!1;return!0}},{key:"bitwiseAnd",value:function(e,i){if(!e.sign&&!i.sign)return l.__absoluteAnd(e,i).__trim();if(e.sign&&i.sign){var t=a(e.length,i.length)+1,_=l.__absoluteSubOne(e,t),n=l.__absoluteSubOne(i);return _=l.__absoluteOr(_,n,_),l.__absoluteAddOne(_,!0,_).__trim()}if(e.sign){var g=[i,e];e=g[0],i=g[1]}return l.__absoluteAndNot(e,l.__absoluteSubOne(i)).__trim()}},{key:"bitwiseXor",value:function(e,i){if(!e.sign&&!i.sign)return l.__absoluteXor(e,i).__trim();if(e.sign&&i.sign){var t=a(e.length,i.length),_=l.__absoluteSubOne(e,t),n=l.__absoluteSubOne(i);return l.__absoluteXor(_,n,_).__trim()}var g=a(e.length,i.length)+1;if(e.sign){var o=[i,e];e=o[0],i=o[1]}var s=l.__absoluteSubOne(i,g);return s=l.__absoluteXor(s,e,s),l.__absoluteAddOne(s,!0,s).__trim()}},{key:"bitwiseOr",value:function(e,i){var t=a(e.length,i.length);if(!e.sign&&!i.sign)return l.__absoluteOr(e,i).__trim();if(e.sign&&i.sign){var _=l.__absoluteSubOne(e,t),n=l.__absoluteSubOne(i);return _=l.__absoluteAnd(_,n,_),l.__absoluteAddOne(_,!0,_).__trim()}if(e.sign){var g=[i,e];e=g[0],i=g[1]}var o=l.__absoluteSubOne(i,t);return o=l.__absoluteAndNot(o,e,o),l.__absoluteAddOne(o,!0,o).__trim()}},{key:"ADD",value:function(e,i){if(e=l.__toPrimitive(e),i=l.__toPrimitive(i),"string"==typeof e)return"string"!=typeof i&&(i=i.toString()),e+i;if("string"==typeof i)return e.toString()+i;if(e=l.__toNumeric(e),i=l.__toNumeric(i),l.__isBigInt(e)&&l.__isBigInt(i))return l.add(e,i);if("number"==typeof e&&"number"==typeof i)return e+i;throw new TypeError("Cannot mix BigInt and other types, use explicit conversions")}},{key:"LT",value:function(e,i){return l.__compare(e,i,0)}},{key:"LE",value:function(e,i){return l.__compare(e,i,1)}},{key:"GT",value:function(e,i){return l.__compare(e,i,2)}},{key:"GE",value:function(e,i){return l.__compare(e,i,3)}},{key:"EQ",value:function(i,t){for(;;){if(l.__isBigInt(i))return l.__isBigInt(t)?l.equal(i,t):l.EQ(t,i);if("number"==typeof i){if(l.__isBigInt(t))return l.__equalToNumber(t,i);if("object"!==e(t))return i==t;t=l.__toPrimitive(t)}else if("string"==typeof i){if(l.__isBigInt(t))return i=l.__fromString(i),null!==i&&l.equal(i,t);if("object"!==e(t))return i==t;t=l.__toPrimitive(t)}else if("boolean"==typeof i){if(l.__isBigInt(t))return l.__equalToNumber(t,+i);if("object"!==e(t))return i==t;t=l.__toPrimitive(t)}else if("symbol"===e(i)){if(l.__isBigInt(t))return!1;if("object"!==e(t))return i==t;t=l.__toPrimitive(t)}else if("object"===e(i)){if("object"===e(t)&&t.constructor!==l)return i==t;i=l.__toPrimitive(i)}else return i==t}}},{key:"__zero",value:function(){return new l(0,!1)}},{key:"__oneDigit",value:function(e,i){var t=new l(1,i);return t.__setDigit(0,e),t}},{key:"__decideRounding",value:function(e,i,t,_){if(0<i)return-1;var n;if(0>i)n=-i-1;else{if(0===t)return-1;t--,_=e.__digit(t),n=31}var g=1<<n;if(0==(_&g))return-1;if(g-=1,0!=(_&g))return 1;for(;0<t;)if(t--,0!==e.__digit(t))return 1;return 0}},{key:"__fromDouble",value:function(e){l.__kBitConversionDouble[0]=e;var i,t=2047&l.__kBitConversionInts[1]>>>20,_=t-1023,n=(_>>>5)+1,g=new l(n,0>e),o=1048575&l.__kBitConversionInts[1]|1048576,a=l.__kBitConversionInts[0],s=20,u=31&_,r=0;if(u<s){var d=s-u;r=d+32,i=o>>>d,o=o<<32-d|a>>>d,a<<=32-d}else if(u===s)r=32,i=o,o=a;else{var h=u-s;r=32-h,i=o<<h|a>>>32-h,o=a<<h}g.__setDigit(n-1,i);for(var b=n-2;0<=b;b--)0<r?(r-=32,i=o,o=a):i=0,g.__setDigit(b,i);return g.__trim()}},{key:"__isWhitespace",value:function(e){return!!(13>=e&&9<=e)||(159>=e?32==e:131071>=e?160==e||5760==e:196607>=e?(e&=131071,10>=e||40==e||41==e||47==e||95==e||4096==e):65279==e)}},{key:"__fromString",value:function(e){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,t=0,_=e.length,n=0;if(n===_)return l.__zero();for(var g=e.charCodeAt(n);l.__isWhitespace(g);){if(++n===_)return l.__zero();g=e.charCodeAt(n)}if(43===g){if(++n===_)return null;g=e.charCodeAt(n),t=1}else if(45===g){if(++n===_)return null;g=e.charCodeAt(n),t=-1}if(0===i){if(i=10,48===g){if(++n===_)return l.__zero();if(g=e.charCodeAt(n),88===g||120===g){if(i=16,++n===_)return null;g=e.charCodeAt(n)}else if(79===g||111===g){if(i=8,++n===_)return null;g=e.charCodeAt(n)}else if(66===g||98===g){if(i=2,++n===_)return null;g=e.charCodeAt(n)}}}else if(16===i&&48===g){if(++n===_)return l.__zero();if(g=e.charCodeAt(n),88===g||120===g){if(++n===_)return null;g=e.charCodeAt(n)}}for(;48===g;){if(++n===_)return l.__zero();g=e.charCodeAt(n)}var o=_-n,a=l.__kMaxBitsPerChar[i],s=l.__kBitsPerCharTableMultiplier-1;if(o>1073741824/a)return null;var u=a*o+s>>>l.__kBitsPerCharTableShift,r=new l(u+31>>>5,!1),h=10>i?i:10,b=10<i?i-10:0;if(0==(i&i-1)){a>>=l.__kBitsPerCharTableShift;var c=[],v=[],y=!1;do{for(var f,D=0,k=0;;){if(f=void 0,g-48>>>0<h)f=g-48;else if((32|g)-97>>>0<b)f=(32|g)-87;else{y=!0;break}if(k+=a,D=D<<a|f,++n===_){y=!0;break}if(g=e.charCodeAt(n),32<k+a)break}c.push(D),v.push(k)}while(!y);l.__fillFromParts(r,c,v)}else{r.__initializeDigits();var p=!1,B=0;do{for(var S,C=0,A=1;;){if(S=void 0,g-48>>>0<h)S=g-48;else if((32|g)-97>>>0<b)S=(32|g)-87;else{p=!0;break}var I=A*i;if(4294967295<I)break;if(A=I,C=C*i+S,B++,++n===_){p=!0;break}g=e.charCodeAt(n)}s=32*l.__kBitsPerCharTableMultiplier-1;var m=a*B+s>>>l.__kBitsPerCharTableShift+5;r.__inplaceMultiplyAdd(A,C,m)}while(!p)}for(;n!==_;){if(!l.__isWhitespace(g))return null;g=e.charCodeAt(n++)}return 0!==t&&10!==i?null:(r.sign=-1===t,r.__trim())}},{key:"__fillFromParts",value:function(e,t,_){for(var n=0,g=0,l=0,o=t.length-1;0<=o;o--){var a=t[o],s=_[o];g|=a<<l,l+=s,32===l?(e.__setDigit(n++,g),l=0,g=0):32<l&&(e.__setDigit(n++,g),l-=32,g=a>>>s-l)}if(0!==g){if(n>=e.length)throw new Error("implementation bug");e.__setDigit(n++,g)}for(;n<e.length;n++)e.__setDigit(n,0)}},{key:"__toStringBasePowerOfTwo",value:function(e,t){var _=e.length,n=t-1;n=(85&n>>>1)+(85&n),n=(51&n>>>2)+(51&n),n=(15&n>>>4)+(15&n);var g=n,o=t-1,a=e.__digit(_-1),s=u(a),r=0|(32*_-s+g-1)/g;if(e.sign&&r++,268435456<r)throw new Error("string too long");for(var d=Array(r),h=r-1,b=0,m=0,c=0;c<_-1;c++){var v=e.__digit(c),y=(b|v<<m)&o;d[h--]=l.__kConversionChars[y];var f=g-m;for(b=v>>>f,m=32-f;m>=g;)d[h--]=l.__kConversionChars[b&o],b>>>=g,m-=g}var D=(b|a<<m)&o;for(d[h--]=l.__kConversionChars[D],b=a>>>g-m;0!==b;)d[h--]=l.__kConversionChars[b&o],b>>>=g;if(e.sign&&(d[h--]="-"),-1!==h)throw new Error("implementation bug");return d.join("")}},{key:"__toStringGeneric",value:function(e,t,_){var n=e.length;if(0===n)return"";if(1===n){var g=e.__unsignedDigit(0).toString(t);return!1===_&&e.sign&&(g="-"+g),g}var o=32*n-u(e.__digit(n-1)),a=l.__kMaxBitsPerChar[t],s=a-1,r=o*l.__kBitsPerCharTableMultiplier;r+=s-1,r=0|r/s;var d,h,b=r+1>>1,m=l.exponentiate(l.__oneDigit(t,!1),l.__oneDigit(b,!1)),c=m.__unsignedDigit(0);if(1===m.length&&65535>=c){d=new l(e.length,!1),d.__initializeDigits();for(var v,y=0,f=2*e.length-1;0<=f;f--)v=y<<16|e.__halfDigit(f),d.__setHalfDigit(f,0|v/c),y=0|v%c;h=y.toString(t)}else{var D=l.__absoluteDivLarge(e,m,!0,!0);d=D.quotient;var k=D.remainder.__trim();h=l.__toStringGeneric(k,t,!0)}d.__trim();for(var p=l.__toStringGeneric(d,t,!0);h.length<b;)h="0"+h;return!1===_&&e.sign&&(p="-"+p),p+h}},{key:"__unequalSign",value:function(e){return e?-1:1}},{key:"__absoluteGreater",value:function(e){return e?-1:1}},{key:"__absoluteLess",value:function(e){return e?1:-1}},{key:"__compareToBigInt",value:function(e,i){var t=e.sign;if(t!==i.sign)return l.__unequalSign(t);var _=l.__absoluteCompare(e,i);return 0<_?l.__absoluteGreater(t):0>_?l.__absoluteLess(t):0}},{key:"__compareToNumber",value:function(e,i){if(!0|i){var t=e.sign,_=0>i;if(t!==_)return l.__unequalSign(t);if(0===e.length){if(_)throw new Error("implementation bug");return 0===i?0:-1}if(1<e.length)return l.__absoluteGreater(t);var n=o(i),g=e.__unsignedDigit(0);return g>n?l.__absoluteGreater(t):g<n?l.__absoluteLess(t):0}return l.__compareToDouble(e,i)}},{key:"__compareToDouble",value:function(e,i){if(i!==i)return i;if(i===1/0)return-1;if(i===-Infinity)return 1;var t=e.sign;if(t!==0>i)return l.__unequalSign(t);if(0===i)throw new Error("implementation bug: should be handled elsewhere");if(0===e.length)return-1;l.__kBitConversionDouble[0]=i;var _=2047&l.__kBitConversionInts[1]>>>20;if(2047==_)throw new Error("implementation bug: handled elsewhere");var n=_-1023;if(0>n)return l.__absoluteGreater(t);var g=e.length,o=e.__digit(g-1),a=u(o),s=32*g-a,r=n+1;if(s<r)return l.__absoluteLess(t);if(s>r)return l.__absoluteGreater(t);var d=1048576|1048575&l.__kBitConversionInts[1],h=l.__kBitConversionInts[0],b=20,m=31-a;if(m!==(s-1)%31)throw new Error("implementation bug");var c,v=0;if(m<b){var y=b-m;v=y+32,c=d>>>y,d=d<<32-y|h>>>y,h<<=32-y}else if(m===b)v=32,c=d,d=h;else{var f=m-b;v=32-f,c=d<<f|h>>>32-f,d=h<<f}if(o>>>=0,c>>>=0,o>c)return l.__absoluteGreater(t);if(o<c)return l.__absoluteLess(t);for(var D=g-2;0<=D;D--){0<v?(v-=32,c=d>>>0,d=h,h=0):c=0;var k=e.__unsignedDigit(D);if(k>c)return l.__absoluteGreater(t);if(k<c)return l.__absoluteLess(t)}if(0!==d||0!==h){if(0===v)throw new Error("implementation bug");return l.__absoluteLess(t)}return 0}},{key:"__equalToNumber",value:function(e,i){return i|0===i?0===i?0===e.length:1===e.length&&e.sign===0>i&&e.__unsignedDigit(0)===o(i):0===l.__compareToDouble(e,i)}},{key:"__comparisonResultToBool",value:function(e,i){switch(i){case 0:return 0>e;case 1:return 0>=e;case 2:return 0<e;case 3:return 0<=e;}throw new Error("unreachable")}},{key:"__compare",value:function(e,i,t){if(e=l.__toPrimitive(e),i=l.__toPrimitive(i),"string"==typeof e&&"string"==typeof i)switch(t){case 0:return e<i;case 1:return e<=i;case 2:return e>i;case 3:return e>=i;}if(l.__isBigInt(e)&&"string"==typeof i)return i=l.__fromString(i),null!==i&&l.__comparisonResultToBool(l.__compareToBigInt(e,i),t);if("string"==typeof e&&l.__isBigInt(i))return e=l.__fromString(e),null!==e&&l.__comparisonResultToBool(l.__compareToBigInt(e,i),t);if(e=l.__toNumeric(e),i=l.__toNumeric(i),l.__isBigInt(e)){if(l.__isBigInt(i))return l.__comparisonResultToBool(l.__compareToBigInt(e,i),t);if("number"!=typeof i)throw new Error("implementation bug");return l.__comparisonResultToBool(l.__compareToNumber(e,i),t)}if("number"!=typeof e)throw new Error("implementation bug");if(l.__isBigInt(i))return l.__comparisonResultToBool(l.__compareToNumber(i,e),2^t);if("number"!=typeof i)throw new Error("implementation bug");return 0===t?e<i:1===t?e<=i:2===t?e>i:3===t?e>=i:void 0}},{key:"__absoluteAdd",value:function(e,t,_){if(e.length<t.length)return l.__absoluteAdd(t,e,_);if(0===e.length)return e;if(0===t.length)return e.sign===_?e:l.unaryMinus(e);var n=e.length;(0===e.__clzmsd()||t.length===e.length&&0===t.__clzmsd())&&n++;for(var g=new l(n,_),o=0,a=0;a<t.length;a++){var s=t.__digit(a),u=e.__digit(a),r=(65535&u)+(65535&s)+o,d=(u>>>16)+(s>>>16)+(r>>>16);o=d>>>16,g.__setDigit(a,65535&r|d<<16)}for(;a<e.length;a++){var h=e.__digit(a),b=(65535&h)+o,m=(h>>>16)+(b>>>16);o=m>>>16,g.__setDigit(a,65535&b|m<<16)}return a<g.length&&g.__setDigit(a,o),g.__trim()}},{key:"__absoluteSub",value:function(e,t,_){if(0===e.length)return e;if(0===t.length)return e.sign===_?e:l.unaryMinus(e);for(var n=new l(e.length,_),g=0,o=0;o<t.length;o++){var a=e.__digit(o),s=t.__digit(o),u=(65535&a)-(65535&s)-g;g=1&u>>>16;var r=(a>>>16)-(s>>>16)-g;g=1&r>>>16,n.__setDigit(o,65535&u|r<<16)}for(;o<e.length;o++){var d=e.__digit(o),h=(65535&d)-g;g=1&h>>>16;var b=(d>>>16)-g;g=1&b>>>16,n.__setDigit(o,65535&h|b<<16)}return n.__trim()}},{key:"__absoluteAddOne",value:function(e,t){var _=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,n=e.length;null===_?_=new l(n,t):_.sign=t;for(var g=!0,o=0;o<n;o++){var a=e.__digit(o),s=-1===a;g&&(a=0|a+1),g=s,_.__setDigit(o,a)}return g&&_.__setDigitGrow(n,1),_}},{key:"__absoluteSubOne",value:function(e,t){var _=e.length;t=t||_;for(var n=new l(t,!1),g=!0,o=0;o<_;o++){var a=e.__digit(o),s=0===a;g&&(a=0|a-1),g=s,n.__setDigit(o,a)}for(var u=_;u<t;u++)n.__setDigit(u,0);return n}},{key:"__absoluteAnd",value:function(e,t){var _=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,n=e.length,g=t.length,o=g;if(n<g){o=n;var a=e,s=n;e=t,n=g,t=a,g=s}var u=o;null===_?_=new l(u,!1):u=_.length;for(var r=0;r<o;r++)_.__setDigit(r,e.__digit(r)&t.__digit(r));for(;r<u;r++)_.__setDigit(r,0);return _}},{key:"__absoluteAndNot",value:function(e,t){var _=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,n=e.length,g=t.length,o=g;n<g&&(o=n);var a=n;null===_?_=new l(a,!1):a=_.length;for(var s=0;s<o;s++)_.__setDigit(s,e.__digit(s)&~t.__digit(s));for(;s<n;s++)_.__setDigit(s,e.__digit(s));for(;s<a;s++)_.__setDigit(s,0);return _}},{key:"__absoluteOr",value:function(e,t){var _=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,n=e.length,g=t.length,o=g;if(n<g){o=n;var a=e,s=n;e=t,n=g,t=a,g=s}var u=n;null===_?_=new l(u,!1):u=_.length;for(var r=0;r<o;r++)_.__setDigit(r,e.__digit(r)|t.__digit(r));for(;r<n;r++)_.__setDigit(r,e.__digit(r));for(;r<u;r++)_.__setDigit(r,0);return _}},{key:"__absoluteXor",value:function(e,t){var _=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,n=e.length,g=t.length,o=g;if(n<g){o=n;var a=e,s=n;e=t,n=g,t=a,g=s}var u=n;null===_?_=new l(u,!1):u=_.length;for(var r=0;r<o;r++)_.__setDigit(r,e.__digit(r)^t.__digit(r));for(;r<n;r++)_.__setDigit(r,e.__digit(r));for(;r<u;r++)_.__setDigit(r,0);return _}},{key:"__absoluteCompare",value:function(e,t){var _=e.length-t.length;if(0!=_)return _;for(var n=e.length-1;0<=n&&e.__digit(n)===t.__digit(n);)n--;return 0>n?0:e.__unsignedDigit(n)>t.__unsignedDigit(n)?1:-1}},{key:"__multiplyAccumulate",value:function(e,t,_,n){if(0!==t){for(var g=65535&t,l=t>>>16,o=0,a=0,u=0,r=0;r<e.length;r++,n++){var d=_.__digit(n),h=65535&d,b=d>>>16,m=e.__digit(r),c=65535&m,v=m>>>16,y=s(c,g),f=s(c,l),D=s(v,g),k=s(v,l);h+=a+(65535&y),b+=u+o+(h>>>16)+(y>>>16)+(65535&f)+(65535&D),o=b>>>16,a=(f>>>16)+(D>>>16)+(65535&k)+o,o=a>>>16,a&=65535,u=k>>>16,d=65535&h|b<<16,_.__setDigit(n,d)}for(;0!==o||0!==a||0!==u;n++){var p=_.__digit(n),B=(65535&p)+a,S=(p>>>16)+(B>>>16)+u+o;a=0,u=0,o=S>>>16,p=65535&B|S<<16,_.__setDigit(n,p)}}}},{key:"__internalMultiplyAdd",value:function(e,t,_,g,l){for(var o=_,a=0,u=0;u<g;u++){var r=e.__digit(u),d=s(65535&r,t),h=(65535&d)+a+o;o=h>>>16;var b=s(r>>>16,t),m=(65535&b)+(d>>>16)+o;o=m>>>16,a=b>>>16,l.__setDigit(u,m<<16|65535&h)}if(l.length>g)for(l.__setDigit(g++,o+a);g<l.length;)l.__setDigit(g++,0);else if(0!==o+a)throw new Error("implementation bug")}},{key:"__absoluteDivSmall",value:function(e,t,_){null===_&&(_=new l(e.length,!1));for(var n=0,g=2*e.length-1;0<=g;g-=2){var o=(n<<16|e.__halfDigit(g))>>>0,a=0|o/t;n=0|o%t,o=(n<<16|e.__halfDigit(g-1))>>>0;var s=0|o/t;n=0|o%t,_.__setDigit(g>>>1,a<<16|s)}return _}},{key:"__absoluteModSmall",value:function(e,t){for(var _,n=0,g=2*e.length-1;0<=g;g--)_=(n<<16|e.__halfDigit(g))>>>0,n=0|_%t;return n}},{key:"__absoluteDivLarge",value:function(e,i,t,_){var g=i.__halfDigitLength(),n=i.length,o=e.__halfDigitLength()-g,a=null;t&&(a=new l(o+2>>>1,!1),a.__initializeDigits());var r=new l(g+2>>>1,!1);r.__initializeDigits();var d=l.__clz16(i.__halfDigit(g-1));0<d&&(i=l.__specialLeftShift(i,d,0));for(var h=l.__specialLeftShift(e,d,1),u=i.__halfDigit(g-1),b=0,m=o;0<=m;m--){var v=65535,y=h.__halfDigit(m+g);if(y!==u){var f=(y<<16|h.__halfDigit(m+g-1))>>>0;v=0|f/u;for(var D=0|f%u,k=i.__halfDigit(g-2),p=h.__halfDigit(m+g-2);s(v,k)>>>0>(D<<16|p)>>>0&&(v--,D+=u,!(65535<D)););}l.__internalMultiplyAdd(i,v,0,n,r);var B=h.__inplaceSub(r,m,g+1);0!==B&&(B=h.__inplaceAdd(i,m,g),h.__setHalfDigit(m+g,h.__halfDigit(m+g)+B),v--),t&&(1&m?b=v<<16:a.__setDigit(m>>>1,b|v))}return _?(h.__inplaceRightShift(d),t?{quotient:a,remainder:h}:h):t?a:void 0}},{key:"__clz16",value:function(e){return u(e)-16}},{key:"__specialLeftShift",value:function(e,t,_){var g=e.length,n=new l(g+_,!1);if(0===t){for(var o=0;o<g;o++)n.__setDigit(o,e.__digit(o));return 0<_&&n.__setDigit(g,0),n}for(var a,s=0,u=0;u<g;u++)a=e.__digit(u),n.__setDigit(u,a<<t|s),s=a>>>32-t;return 0<_&&n.__setDigit(g,s),n}},{key:"__leftShiftByAbsolute",value:function(e,t){var _=l.__toShiftAmount(t);if(0>_)throw new RangeError("BigInt too big");var n=_>>>5,g=31&_,o=e.length,a=0!==g&&0!=e.__digit(o-1)>>>32-g,s=o+n+(a?1:0),u=new l(s,e.sign);if(0===g){for(var r=0;r<n;r++)u.__setDigit(r,0);for(;r<s;r++)u.__setDigit(r,e.__digit(r-n))}else{for(var h=0,b=0;b<n;b++)u.__setDigit(b,0);for(var m,c=0;c<o;c++)m=e.__digit(c),u.__setDigit(c+n,m<<g|h),h=m>>>32-g;if(a)u.__setDigit(o+n,h);else if(0!==h)throw new Error("implementation bug")}return u.__trim()}},{key:"__rightShiftByAbsolute",value:function(e,t){var _=e.length,n=e.sign,g=l.__toShiftAmount(t);if(0>g)return l.__rightShiftByMaximum(n);var o=g>>>5,a=31&g,s=_-o;if(0>=s)return l.__rightShiftByMaximum(n);var u=!1;if(n){if(0!=(e.__digit(o)&(1<<a)-1))u=!0;else for(var r=0;r<o;r++)if(0!==e.__digit(r)){u=!0;break}}if(u&&0===a){var h=e.__digit(_-1);0==~h&&s++}var b=new l(s,n);if(0===a)for(var m=o;m<_;m++)b.__setDigit(m-o,e.__digit(m));else{for(var c,v=e.__digit(o)>>>a,y=_-o-1,f=0;f<y;f++)c=e.__digit(f+o+1),b.__setDigit(f,c<<32-a|v),v=c>>>a;b.__setDigit(y,v)}return u&&(b=l.__absoluteAddOne(b,!0,b)),b.__trim()}},{key:"__rightShiftByMaximum",value:function(e){return e?l.__oneDigit(1,!0):l.__zero()}},{key:"__toShiftAmount",value:function(e){if(1<e.length)return-1;var i=e.__unsignedDigit(0);return i>l.__kMaxLengthBits?-1:i}},{key:"__toPrimitive",value:function(i){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"default";if("object"!==e(i))return i;if(i.constructor===l)return i;var _=i[Symbol.toPrimitive];if(_){var n=_(t);if("object"!==e(n))return n;throw new TypeError("Cannot convert object to primitive value")}var g=i.valueOf;if(g){var o=g.call(i);if("object"!==e(o))return o}var a=i.toString;if(a){var s=a.call(i);if("object"!==e(s))return s}throw new TypeError("Cannot convert object to primitive value")}},{key:"__toNumeric",value:function(e){return l.__isBigInt(e)?e:+e}},{key:"__isBigInt",value:function(i){return"object"===e(i)&&i.constructor===l}},{key:"__digitPow",value:function(e,i){for(var t=1;0<i;)1&i&&(t*=e),i>>>=1,e*=e;return t}}]),l}(u(Array));return h.__kMaxLength=33554432,h.__kMaxLengthBits=h.__kMaxLength<<5,h.__kMaxBitsPerChar=[0,0,32,51,64,75,83,90,96,102,107,111,115,119,122,126,128,131,134,136,139,141,143,145,147,149,151,153,154,156,158,159,160,162,163,165,166],h.__kBitsPerCharTableShift=5,h.__kBitsPerCharTableMultiplier=1<<h.__kBitsPerCharTableShift,h.__kConversionChars=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],h.__kBitConversionBuffer=new ArrayBuffer(8),h.__kBitConversionDouble=new Float64Array(h.__kBitConversionBuffer),h.__kBitConversionInts=new Int32Array(h.__kBitConversionBuffer),h});
{
"name": "jsbi",
"version": "2.0.5",
"version": "3.0.0",
"repository": "GoogleChromeLabs/jsbi",
"devDependencies": {
"@babel/preset-env": "^7.5.2",
"eslint": "^5.4.0",
"eslint-config-google": "^0.9.1",
"rollup": "^0.65.0",
"rollup-plugin-babel": "^4.3.3",
"rollup-plugin-babel-minify": "^6.0.0"

@@ -9,0 +12,0 @@ },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc