/**
 * Minified by jsDelivr using Terser v5.37.0.
 * Original file: /npm/n64@0.2.10/lib/n64.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
/*!
 * int64.js - int64 object for javascript.
 * Copyright (c) 2017, Christopher Jeffrey (MIT License).
 * https://github.com/chjj/n64
 */
"use strict";function N64(t){enforce(this instanceof N64,"this","N64"),enforce(0===t||1===t,"sign","bit"),this.hi=0,this.lo=0,this.sign=t}function U64(t,n){if(!(this instanceof U64))return new U64(t,n);N64.call(this,0),this.from(t,n)}function I64(t,n){if(!(this instanceof I64))return new I64(t,n);N64.call(this,1),this.from(t,n)}function getBase(t){if(null==t)return 10;if("number"==typeof t)return t;switch(t){case"bin":return 2;case"oct":return 8;case"dec":return 10;case"hex":return 16}return 0}function countBits(t){if(Math.clz32)return 32-Math.clz32(t);let n=31;for(;n>=0&&!(t&1<<n);n--);return n+1}function floor(t){return t<0?-Math.floor(-t):Math.floor(t)}function enforce(t,n,r){if(!t){const t=new TypeError(`'${n}' must be a(n) ${r}.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,enforce),t}}function isNumber(t){return"number"==typeof t&&isFinite(t)}function isArray(t){return Array.isArray?Array.isArray(t):"Array"==={}.toString.call(t).slice(8,-1)}function isSafeInteger(t){return Number.isSafeInteger?Number.isSafeInteger(t):isNumber(t)&&Math.floor(t)===t&&t>=-9007199254740991&&t<=9007199254740991}function alloc(t,n){return t.allocUnsafe?t.allocUnsafe(n):new t(n)}function readI32LE(t,n){return t[n]|t[n+1]<<8|t[n+2]<<16|t[n+3]<<24}function readI32BE(t,n){return t[n]<<24|t[n+1]<<16|t[n+2]<<8|t[n+3]}function writeI32LE(t,n,r){t[r]=255&n,t[r+1]=n>>>8&255,t[r+2]=n>>>16&255,t[r+3]=n>>>24&255}function writeI32BE(t,n,r){t[r]=n>>>24&255,t[r+1]=n>>>16&255,t[r+2]=n>>>8&255,t[r+3]=255&n}N64.prototype._add=function(t,n){const r=this.hi,o=this.lo,e=o+n|0,i=o>>31,s=n>>31,u=(r+t|0)+(1&(i&s|~(e>>31)&(i^s)));return this.hi=0|u,this.lo=e,this},N64.prototype.iadd=function(t){return enforce(N64.isN64(t),"operand","int64"),this._add(t.hi,t.lo)},N64.prototype.iaddn=function(t){return enforce(isNumber(t),"operand","number"),this._add(t>>31&-this.sign,0|t)},N64.prototype.add=function(t){return this.clone().iadd(t)},N64.prototype.addn=function(t){return this.clone().iaddn(t)},N64.prototype._sub=function(t,n){return t=~t,-1===(n=~n)?(n=0,t+=1,t|=0):n+=1,this._add(t,n)},N64.prototype.isub=function(t){return enforce(N64.isN64(t),"operand","int64"),this._sub(t.hi,t.lo)},N64.prototype.isubn=function(t){return enforce(isNumber(t),"operand","number"),this._sub(t>>31&-this.sign,0|t)},N64.prototype.sub=function(t){return this.clone().isub(t)},N64.prototype.subn=function(t){return this.clone().isubn(t)},N64.prototype._mul=function(t,n){const r=this.hi,o=this.lo,e=65535&r,i=o>>>16,s=65535&o,u=65535&t,h=n>>>16,f=65535&n;let c=0,p=0,N=0,l=0;l+=s*f,N+=l>>>16,l&=65535,N+=i*f,p+=N>>>16,N&=65535,N+=s*h,p+=N>>>16,N&=65535,p+=e*f,c+=p>>>16,p&=65535,p+=i*h,c+=p>>>16,p&=65535,p+=s*u,c+=p>>>16,p&=65535,c+=(r>>>16)*f+e*h+i*u+s*(t>>>16),c&=65535;const a=c<<16|p,m=N<<16|l;return this.hi=a,this.lo=m,this},N64.prototype.imul=function(t){return enforce(N64.isN64(t),"multiplicand","int64"),this._mul(t.hi,t.lo)},N64.prototype.imuln=function(t){return enforce(isNumber(t),"multiplicand","number"),this._mul(t>>31&-this.sign,0|t)},N64.prototype.mul=function(t){return this.clone().imul(t)},N64.prototype.muln=function(t){return this.clone().imuln(t)},N64.prototype.idiv=function(t){let n=this;if(enforce(N64.isN64(t),"divisor","int64"),t.isZero())throw new Error("Cannot divide by zero.");if(n.isZero())return n;if(n.eq(t))return n.set(1);if(n.isSafe()&&t.isSafe()){const r=floor(n.toDouble()/t.toDouble());return n.set(r)}let r=!1;n.sign&&(n.hi<0?t.hi<0?(n=n.ineg(),t=t.neg()):(n=n.ineg(),r=!0):t.hi<0&&(t=t.neg(),r=!0));const o=n.toU64(),e=t.toU64();if(o.lt(e))return n.set(0);if(o.ushrn(1).lt(e))return n.set(r?-1:1);const i=new U64,s=new U64;let u=o.bitLength();for(;u--;)s.ishln(1),s.lo|=o.testn(u),s.gte(e)&&(s.isub(e),i.setn(u,1));return n.hi=i.hi,n.lo=i.lo,r&&n.ineg(),n},N64.prototype.idivn=function(t){return enforce(isNumber(t),"divisor","number"),this.idiv(this._small(t))},N64.prototype.div=function(t){return this.clone().idiv(t)},N64.prototype.divn=function(t){return this.clone().idivn(t)},N64.prototype.imod=function(t){const n=this;if(enforce(N64.isN64(t),"divisor","int64"),t.isZero())throw new Error("Cannot divide by zero.");if(n.isZero())return n;if(n.eq(t))return n.set(0);if(n.isSafe()&&t.isSafe()){const r=n.toDouble()%t.toDouble();return n.set(r)}return n.isub(n.div(t).imul(t))},N64.prototype.imodn=function(t){return enforce(isNumber(t),"divisor","number"),this.imod(this._small(t))},N64.prototype.mod=function(t){return this.clone().imod(t)},N64.prototype.modn=function(t){return this.clone().imodn(t)},N64.prototype.ipow=function(t){return enforce(N64.isN64(t),"exponent","int64"),this.ipown(t.lo)},N64.prototype.ipown=function(t){if(enforce(isNumber(t),"exponent","number"),this.isZero())return this;const n=this.clone(),r=this;let o=t>>>0;for(r.set(1);o>0;)1&o&&r.imul(n),o>>>=1,n.imul(n);return r},N64.prototype.pow=function(t){return this.clone().ipow(t)},N64.prototype.pown=function(t){return this.clone().ipown(t)},N64.prototype.sqr=function(){return this.mul(this)},N64.prototype.isqr=function(){return this.imul(this)},N64.prototype.iand=function(t){return enforce(N64.isN64(t),"operand","int64"),this.hi&=t.hi,this.lo&=t.lo,this},N64.prototype.iandn=function(t){return enforce(isNumber(t),"operand","number"),this.hi&=t>>31&-this.sign,this.lo&=0|t,this},N64.prototype.and=function(t){return this.clone().iand(t)},N64.prototype.andn=function(t){return this.clone().iandn(t)},N64.prototype.ior=function(t){return enforce(N64.isN64(t),"operand","int64"),this.hi|=t.hi,this.lo|=t.lo,this},N64.prototype.iorn=function(t){return enforce(isNumber(t),"operand","number"),this.hi|=t>>31&-this.sign,this.lo|=0|t,this},N64.prototype.or=function(t){return this.clone().ior(t)},N64.prototype.orn=function(t){return this.clone().iorn(t)},N64.prototype.ixor=function(t){return enforce(N64.isN64(t),"operand","int64"),this.hi^=t.hi,this.lo^=t.lo,this},N64.prototype.ixorn=function(t){return enforce(isNumber(t),"operand","number"),this.hi^=t>>31&-this.sign,this.lo^=0|t,this},N64.prototype.xor=function(t){return this.clone().ixor(t)},N64.prototype.xorn=function(t){return this.clone().ixorn(t)},N64.prototype.inot=function(){return this.hi=~this.hi,this.lo=~this.lo,this},N64.prototype.not=function(){return this.clone().inot()},N64.prototype.ishl=function(t){return enforce(N64.isN64(t),"bits","int64"),this.ishln(t.lo)},N64.prototype.ishln=function(t){if(enforce(isNumber(t),"bits","number"),0===(t&=63))return this;let n=this.hi,r=this.lo;return t<32?(n<<=t,n|=r>>>32-t,r<<=t):(n=r<<t-32,r=0),this.hi=n,this.lo=r,this},N64.prototype.shl=function(t){return this.clone().ishl(t)},N64.prototype.shln=function(t){return this.clone().ishln(t)},N64.prototype.ishr=function(t){return enforce(N64.isN64(t),"bits","int64"),this.ishrn(t.lo)},N64.prototype.ishrn=function(t){if(!this.sign)return this.iushrn(t);if(enforce(isNumber(t),"bits","number"),0===(t&=63))return this;let n=this.hi,r=this.lo;return t<32?(r>>>=t,r|=n<<32-t,n>>=t):(r=n>>t-32,n>>=31),this.hi=n,this.lo=r,this},N64.prototype.shr=function(t){return this.clone().ishr(t)},N64.prototype.shrn=function(t){return this.clone().ishrn(t)},N64.prototype.iushr=function(t){return enforce(N64.isN64(t),"bits","int64"),this.iushrn(t.lo)},N64.prototype.iushrn=function(t){if(enforce(isNumber(t),"bits","number"),0===(t&=63))return this;let n=this.hi,r=this.lo;return t<32?(r>>>=t,r|=n<<32-t,n>>>=t):(r=n>>>t-32,n=0),this.hi=0|n,this.lo=0|r,this},N64.prototype.ushr=function(t){return this.clone().iushr(t)},N64.prototype.ushrn=function(t){return this.clone().iushrn(t)},N64.prototype.setn=function(t,n){return enforce(isNumber(t),"bit","number"),(t&=63)<32?n?this.lo|=1<<t:this.lo&=~(1<<t):n?this.hi|=1<<t-32:this.hi&=~(1<<t-32),this},N64.prototype.testn=function(t){return enforce(isNumber(t),"bit","number"),(t&=63)<32?this.lo>>>t&1:this.hi>>>t-32&1},N64.prototype.setb=function(t,n){return enforce(isNumber(t),"pos","number"),enforce(isNumber(n),"ch","number"),n&=255,(t&=7)<4?(this.lo&=~(255<<8*t),this.lo|=n<<8*t):(this.hi&=~(255<<8*(t-4)),this.hi|=n<<8*(t-4)),this},N64.prototype.orb=function(t,n){return enforce(isNumber(t),"pos","number"),enforce(isNumber(n),"ch","number"),n&=255,(t&=7)<4?this.lo|=n<<8*t:this.hi|=n<<8*(t-4),this},N64.prototype.getb=function(t){return enforce(isNumber(t),"pos","number"),(t&=7)<4?this.lo>>8*t&255:this.hi>>8*(t-4)&255},N64.prototype.imaskn=function(t){return enforce(isNumber(t),"bit","number"),(t&=63)<32?(this.hi=0,this.lo&=(1<<t)-1):(this.hi&=(1<<t-32)-1,this.lo&=4294967295),this},N64.prototype.maskn=function(t){return this.clone().imaskn(t)},N64.prototype.andln=function(t){return enforce(isNumber(t),"operand","number"),this.lo&t},N64.prototype.ineg=function(){let t=~this.hi,n=~this.lo;return-1===n?(n=0,t+=1,t|=0):n+=1,this.hi=t,this.lo=n,this},N64.prototype.neg=function(){return this.clone().ineg()},N64.prototype.iabs=function(){return this.isNeg()&&this.ineg(),this},N64.prototype.abs=function(){return this.clone().iabs()},N64.prototype._cmp=function(t,n){const r=this;let o=r.hi,e=r.lo;if(o===t&&e===n)return 0;let i=!1;if(r.sign){const n=o<0,r=t<0;if(n&&!r)return-1;if(!n&&r)return 1;i=n}return i||(o>>>=0,t>>>=0),o<t?-1:o>t?1:(e>>>=0,e<(n>>>=0)?-1:1)},N64.prototype.cmp=function(t){return enforce(N64.isN64(t),"value","int64"),this._cmp(t.hi,t.lo)},N64.prototype.cmpn=function(t){return enforce(isNumber(t),"value","number"),this._cmp(t>>31&-this.sign,0|t)},N64.prototype.eq=function(t){return enforce(N64.isN64(t),"value","int64"),this.hi===t.hi&&this.lo===t.lo},N64.prototype.eqn=function(t){return enforce(isNumber(t),"value","number"),this.hi===(t>>31&-this.sign)&&this.lo===(0|t)},N64.prototype.gt=function(t){return this.cmp(t)>0},N64.prototype.gtn=function(t){return this.cmpn(t)>0},N64.prototype.gte=function(t){return this.cmp(t)>=0},N64.prototype.gten=function(t){return this.cmpn(t)>=0},N64.prototype.lt=function(t){return this.cmp(t)<0},N64.prototype.ltn=function(t){return this.cmpn(t)<0},N64.prototype.lte=function(t){return this.cmp(t)<=0},N64.prototype.lten=function(t){return this.cmpn(t)<=0},N64.prototype.isZero=function(){return 0===this.hi&&0===this.lo},N64.prototype.isNeg=function(){return 1===this.sign&&this.hi<0},N64.prototype.isOdd=function(){return!(1&~this.lo)},N64.prototype.isEven=function(){return!(1&this.lo)},N64.prototype.clone=function(){const t=new this.constructor;return t.hi=this.hi,t.lo=this.lo,t},N64.prototype.inject=function(t){return enforce(N64.isN64(t),"value","int64"),this.hi=t.hi,this.lo=t.lo,this},N64.prototype.set=function(t){enforce(isSafeInteger(t),"number","integer");let n=!1;return t<0&&(t=-t,n=!0),this.hi=t*(1/4294967296)|0,this.lo=0|t,n&&this.ineg(),this},N64.prototype.join=function(t,n){return enforce(isNumber(t),"hi","number"),enforce(isNumber(n),"lo","number"),this.hi=0|t,this.lo=0|n,this},N64.prototype._small=function(t){const n=new this.constructor;return n.hi=t>>31&-this.sign,n.lo=0|t,n},N64.prototype.bitLength=function(){let t=this;return this.isNeg()&&(t=this.neg()),0===t.hi?countBits(t.lo):countBits(t.hi)+32},N64.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},N64.prototype.isSafe=function(){let t=this.hi;return this.isNeg()&&(t=~t,0===this.lo&&(t+=1)),!(4292870144&t)},N64.prototype.inspect=function(){let t="I64";return this.sign||(t="U64"),`<${t}: ${this.toString(10)}>`},N64.prototype.readLE=function(t,n){return enforce(t&&"number"==typeof t.length,"data","arraylike"),enforce((n|0)===n,"offset","integer"),enforce(n+8<=t.length,"offset","valid offset"),this.lo=readI32LE(t,n),this.hi=readI32LE(t,n+4),n+8},N64.prototype.readBE=function(t,n){return enforce(t&&"number"==typeof t.length,"data","arraylike"),enforce((n|0)===n,"offset","integer"),enforce(n+8<=t.length,"offset","valid offset"),this.hi=readI32BE(t,n),this.lo=readI32BE(t,n+4),n+8},N64.prototype.readRaw=function(t,n){return this.readLE(t,n)},N64.prototype.writeLE=function(t,n){return enforce(t&&"number"==typeof t.length,"data","arraylike"),enforce((n|0)===n,"offset","integer"),enforce(n+8<=t.length,"offset","valid offset"),writeI32LE(t,this.lo,n),writeI32LE(t,this.hi,n+4),n+8},N64.prototype.writeBE=function(t,n){return enforce(t&&"number"==typeof t.length,"data","arraylike"),enforce((n|0)===n,"offset","integer"),enforce(n+8<=t.length,"offset","valid offset"),writeI32BE(t,this.hi,n),writeI32BE(t,this.lo,n+4),n+8},N64.prototype.writeRaw=function(t,n){return this.writeLE(t,n)},N64.prototype.toU64=function(){const t=new U64;return t.hi=this.hi,t.lo=this.lo,t},N64.prototype.toI64=function(){const t=new I64;return t.hi=this.hi,t.lo=this.lo,t},N64.prototype.toNumber=function(){if(!this.isSafe())throw new Error("Number exceeds 53 bits.");return this.toDouble()},N64.prototype.toDouble=function(){let t=this.hi;return this.sign||(t>>>=0),4294967296*t+(this.lo>>>0)},N64.prototype.toInt=function(){return this.sign?this.lo:this.lo>>>0},N64.prototype.toBool=function(){return!this.isZero()},N64.prototype.toBits=function(){return[this.hi,this.lo]},N64.prototype.toObject=function(){return{hi:this.hi,lo:this.lo}},N64.prototype.toString=function(t,n){if(null==n&&(n=0),enforce((t=getBase(t))>>>0===t,"base","integer"),enforce(n>>>0===n,"pad","integer"),t<2||t>16)throw new Error("Base ranges between 2 and 16.");if(n>64)throw new Error("Maximum padding is 64 characters.");let r=this,o=!1;r.isNeg()&&(r=r.neg(),o=!0);let e=r.hi>>>0,i=r.lo>>>0,s="";do{const n=e%t;e-=n,e/=t,i+=4294967296*n;const r=i%t;i-=r,i/=t;let o=r;o+=o<10?48:87,s=String.fromCharCode(o)+s}while(i>0||e>0);for(;s.length<n;)s="0"+s;return o&&(s="-"+s),s},N64.prototype.toJSON=function(){return this.toString(16,16)},N64.prototype.toBN=function(t){const n=this.isNeg();let r=this.hi,o=this.lo;n&&(r=~r,o=~o,-1===o?(o=0,r+=1,r|=0):o+=1),r>>>=0,o>>>=0;const e=new t(r);return e.ishln(32),e.iadd(new t(o)),n&&e.ineg(),e},N64.prototype.toLE=function(t){enforce("function"==typeof t,"ArrayLike","constructor");const n=alloc(t,8);return this.writeLE(n,0),n},N64.prototype.toBE=function(t){enforce("function"==typeof t,"ArrayLike","constructor");const n=alloc(t,8);return this.writeBE(n,0),n},N64.prototype.toRaw=function(t){return this.toLE(t)},N64.prototype.fromNumber=function(t){return this.set(t)},N64.prototype.fromInt=function(t){return enforce(isNumber(t),"integer","number"),this.join(t>>31&-this.sign,t)},N64.prototype.fromBool=function(t){return enforce("boolean"==typeof t,"value","boolean"),this.hi=0,this.lo=t?1:0,this},N64.prototype.fromBits=function(t,n){return this.join(t,n)},N64.prototype.fromObject=function(t){return enforce(t&&"object"==typeof t,"number","object"),this.fromBits(t.hi,t.lo)},N64.prototype.fromString=function(t,n){if(n=getBase(n),enforce("string"==typeof t,"string","string"),enforce(n>>>0===n,"base","integer"),n<2||n>16)throw new Error("Base ranges between 2 and 16.");let r=!1,o=0;if(t.length>0&&"-"===t[0]&&(o+=1,r=!0),t.length===o||t.length>o+64)throw new Error("Invalid string (bad length).");let e=0,i=0;for(;o<t.length;o++){let r=t.charCodeAt(o);if(r>=48&&r<=57?r-=48:r>=65&&r<=90?r-=55:r>=97&&r<=122?r-=87:r=n,r>=n)throw new Error("Invalid string (parse error).");if(i*=n,i+=r,e*=n,i>4294967295&&(r=i%4294967296,e+=(i-r)/4294967296,i=r),e>4294967295)throw new Error("Invalid string (overflow).")}return this.hi=0|e,this.lo=0|i,r&&this.ineg(),this},N64.prototype.fromJSON=function(t){return this.fromString(t,16)},N64.prototype.fromBN=function(t){enforce(t&&isArray(t.words),"number","big number");const n=this,r=t.clone(),o=r.isNeg();if(n.sign&&r.testn(63))throw new Error("Big number overflow.");let e=0;for(;!r.isZero();){if(8===e)throw new Error("Big number overflow.");n.orb(e,r.andln(255)),r.iushrn(8),e++}return o&&n.ineg(),n},N64.prototype.fromLE=function(t){return this.readLE(t,0),this},N64.prototype.fromBE=function(t){return this.readBE(t,0),this},N64.prototype.fromRaw=function(t){return this.fromLE(t)},N64.prototype.from=function(t,n){if(null==t)return this;if("number"==typeof t)return"number"==typeof n?this.fromBits(t,n):this.fromNumber(t);if("string"==typeof t)return this.fromString(t,n);if("object"==typeof t)return isArray(t.words)?this.fromBN(t):"number"==typeof t.length?this.fromRaw(t):this.fromObject(t);if("boolean"==typeof t)return this.fromBool(t);throw new TypeError("Non-numeric object passed to N64.")},N64.min=function(t,n){return t.cmp(n)<0?t:n},N64.max=function(t,n){return t.cmp(n)>0?t:n},N64.random=function(){const t=new this;return t.hi=4294967296*Math.random()|0,t.lo=4294967296*Math.random()|0,t},N64.pow=function(t,n){return(new this).fromInt(t).ipown(n)},N64.shift=function(t,n){return(new this).fromInt(t).ishln(n)},N64.readLE=function(t,n){const r=new this;return r.readLE(t,n),r},N64.readBE=function(t,n){const r=new this;return r.readBE(t,n),r},N64.readRaw=function(t,n){const r=new this;return r.readRaw(t,n),r},N64.fromNumber=function(t){return(new this).fromNumber(t)},N64.fromInt=function(t){return(new this).fromInt(t)},N64.fromBool=function(t){return(new this).fromBool(t)},N64.fromBits=function(t,n){return(new this).fromBits(t,n)},N64.fromObject=function(t){return(new this).fromObject(t)},N64.fromString=function(t,n){return(new this).fromString(t,n)},N64.fromJSON=function(t){return(new this).fromJSON(t)},N64.fromBN=function(t){return(new this).fromBN(t)},N64.fromLE=function(t){return(new this).fromLE(t)},N64.fromBE=function(t){return(new this).fromBE(t)},N64.fromRaw=function(t){return(new this).fromRaw(t)},N64.from=function(t,n){return(new this).from(t,n)},N64.isN64=function(t){return t instanceof N64},N64.isU64=function(t){return t instanceof U64},N64.isI64=function(t){return t instanceof I64},U64.__proto__=N64,U64.prototype.__proto__=N64.prototype,U64.ULONG_MIN=0,U64.ULONG_MAX=4294967295,U64.UINT32_MIN=U64(0,0),U64.UINT32_MAX=U64(0,4294967295),U64.UINT64_MIN=U64(0,0),U64.UINT64_MAX=U64(4294967295,4294967295),I64.__proto__=N64,I64.prototype.__proto__=N64.prototype,I64.LONG_MIN=-2147483648,I64.LONG_MAX=2147483647,I64.INT32_MIN=I64(4294967295,2147483648),I64.INT32_MAX=I64(0,2147483647),I64.INT64_MIN=I64(2147483648,0),I64.INT64_MAX=I64(2147483647,4294967295),exports.N64=N64,exports.U64=U64,exports.I64=I64;
//# sourceMappingURL=/sm/f49169ddf02ca3c8971ee7ca1187a0b06f9feba7b6d72044103fee6e2e6f4da8.map