UNPKG

n8n-nodes-wax

Version:

n8n Community Node Package for the WAX Blockchain

1 lines 230 kB
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).eosjs_ecc=t()}}(function(){return function(){return function t(e,r,i){function n(s,f){if(!r[s]){if(!e[s]){var a="function"==typeof require&&require;if(!f&&a)return a(s,!0);if(o)return o(s,!0);var h=new Error("Cannot find module '"+s+"'");throw h.code="MODULE_NOT_FOUND",h}var u=r[s]={exports:{}};e[s][0].call(u.exports,function(t){return n(e[s][1][t]||t)},u,u.exports,t,e,r,i)}return r[s].exports}for(var o="function"==typeof require&&require,s=0;s<i.length;s++)n(i[s]);return n}}()({1:[function(t,e,r){(function(r){"use strict";var i=t("randombytes"),n=t("bytebuffer"),o=t("browserify-aes"),s=t("assert"),f=t("./key_public"),a=t("./key_private"),h=t("./hash"),u=n.Long;function l(t,e,i,u,l){if(!(t=a(t)))throw new TypeError("private_key is required");if(!(e=f(e)))throw new TypeError("public_key is required");if(!(i=p(i)))throw new TypeError("nonce is required");if(!r.isBuffer(u)){if("string"!=typeof u)throw new TypeError("message should be buffer or string");u=new r(u,"binary")}if(l&&"number"!=typeof l)throw new TypeError("checksum should be a number");var c=t.getSharedSecret(e),g=new n(n.DEFAULT_CAPACITY,n.LITTLE_ENDIAN);g.writeUint64(i),g.append(c.toString("binary"),"binary"),g=new r(g.copy(0,g.offset).toBinary(),"binary");var y=h.sha512(g),b=y.slice(32,48),v=y.slice(0,32),m=h.sha256(y);m=m.slice(0,4);var w=n.fromBinary(m.toString("binary"),n.DEFAULT_CAPACITY,n.LITTLE_ENDIAN);if(m=w.readUint32(),l){if(m!==l)throw new Error("Invalid key");u=function(t,e,i){s(t,"Missing cipher text"),t=d(t);var n=o.createDecipheriv("aes-256-cbc",e,i);return t=r.concat([n.update(t),n.final()])}(u,v,b)}else u=function(t,e,i){s(t,"Missing plain text"),t=d(t);var n=o.createCipheriv("aes-256-cbc",e,i);return t=r.concat([n.update(t),n.final()])}(u,v,b);return{nonce:i,message:u,checksum:m}}e.exports={encrypt:function(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(){if(null===c){var t=new Uint8Array(i(2));c=parseInt(t[0]<<8|t[1],10)}var e=u.fromNumber(Date.now()),r=++c%65535;return(e=e.shiftLeft(16).or(u.fromNumber(r))).toString()}();return l(t,e,n,r)},decrypt:function(t,e,r,i,n){return l(t,e,r,i,n).message}};var c=null,p=function(t){return t?u.isLong(t)?t:u.fromString(t):t},d=function(t){return t?r.isBuffer(t)?t:new r(t,"binary"):t}}).call(this,t("buffer").Buffer)},{"./hash":7,"./key_private":9,"./key_public":10,assert:24,"browserify-aes":37,buffer:52,bytebuffer:53,randombytes:79}],2:[function(t,e,r){"use strict";t("./aes");var i=t("./key_private"),n=t("./key_public"),o=t("./signature"),s=(t("./key_utils"),t("./hash")),f={initialize:i.initialize,unsafeRandomKey:function(){return i.unsafeRandomKey().then(function(t){return t.toString()})},randomKey:function(t){return i.randomKey(t).then(function(t){return t.toString()})},seedPrivate:function(t){return i.fromSeed(t).toString()},privateToPublic:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"EOS";return i(t).toPublic().toString(e)},isValidPublic:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"EOS";return n.isValid(t,e)},isValidPrivate:function(t){return i.isValid(t)},sign:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"utf8";if(!0===r)throw new TypeError("API changed, use signHash(..) instead");return!1===r&&console.log("Warning: ecc.sign hashData parameter was removed"),o.sign(t,e,r).toString()},signHash:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"hex";return o.signHash(t,e,r).toString()},verify:function(t,e,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"utf8";if(!0===i)throw new TypeError("API changed, use verifyHash(..) instead");return!1===i&&console.log("Warning: ecc.verify hashData parameter was removed"),(t=o.from(t)).verify(e,r,i)},verifyHash:function(t,e,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"hex";return(t=o.from(t)).verifyHash(e,r,i)},recover:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"utf8";if(!0===r)throw new TypeError("API changed, use recoverHash(signature, data) instead");return!1===r&&console.log("Warning: ecc.recover hashData parameter was removed"),(t=o.from(t)).recover(e,r).toString()},recoverHash:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"hex";return(t=o.from(t)).recoverHash(e,r).toString()},sha256:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"hex";return s.sha256(t,e)}};e.exports=f},{"./aes":1,"./hash":7,"./key_private":9,"./key_public":10,"./key_utils":11,"./signature":13}],3:[function(t,e,r){"use strict";var i=t("./aes"),n=t("./key_private"),o=t("./key_public"),s=t("./signature"),f=t("./key_utils");e.exports={Aes:i,PrivateKey:n,PublicKey:o,Signature:s,key_utils:f}},{"./aes":1,"./key_private":9,"./key_public":10,"./key_utils":11,"./signature":13}],4:[function(t,e,r){(function(r){"use strict";var i=t("assert"),n=t("./hash"),o=t("./enforce_types"),s=t("bigi"),f=t("./ecsignature");function a(t,e,f,a,h){o("Buffer",e),o(s,f),h&&(e=n.sha256(r.concat([e,new r(h)]))),i.equal(e.length,32,"Hash must be 256 bit");var u=f.toBuffer(32),l=new r(32),c=new r(32);c.fill(1),l.fill(0),l=n.HmacSHA256(r.concat([c,new r([0]),u,e]),l),c=n.HmacSHA256(c,l),l=n.HmacSHA256(r.concat([c,new r([1]),u,e]),l),c=n.HmacSHA256(c,l),c=n.HmacSHA256(c,l);for(var p=s.fromBuffer(c);p.signum()<=0||p.compareTo(t.n)>=0||!a(p);)l=n.HmacSHA256(r.concat([c,new r([0])]),l),c=n.HmacSHA256(c,l),c=n.HmacSHA256(c,l),p=s.fromBuffer(c);return p}function h(t,e,r,i){var n=t.n,o=t.G,s=r.r,f=r.s;if(s.signum()<=0||s.compareTo(n)>=0)return!1;if(f.signum()<=0||f.compareTo(n)>=0)return!1;var a=f.modInverse(n),h=e.multiply(a).mod(n),u=s.multiply(a).mod(n),l=o.multiplyTwo(h,i,u);return!t.isInfinity(l)&&l.affineX.mod(n).equals(s)}function u(t,e,r,n){i.strictEqual(3&n,n,"Recovery param is more than two bits");var o=t.n,s=t.G,f=r.r,a=r.s;i(f.signum()>0&&f.compareTo(o)<0,"Invalid r value"),i(a.signum()>0&&a.compareTo(o)<0,"Invalid s value");var h=1&n,u=n>>1?f.add(o):f,l=t.pointFromX(h,u),c=l.multiply(o);i(t.isInfinity(c),"nR is not a valid curve point");var p=e.negate().mod(o),d=f.modInverse(o),g=l.multiplyTwo(a,s,p).multiply(d);return t.validate(g),g}e.exports={calcPubKeyRecoveryParam:function(t,e,r,i){for(var n=0;n<4;n++)if(u(t,e,r,n).equals(i))return n;throw new Error("Unable to find valid recovery factor")},deterministicGenerateK:a,recoverPubKey:u,sign:function(t,e,r,i){var n,o,h=s.fromBuffer(e),u=t.n,l=t.G,c=(a(t,e,r,function(e){var i=l.multiply(e);return!t.isInfinity(i)&&0!==(n=i.affineX.mod(u)).signum()&&0!==(o=e.modInverse(u).multiply(h.add(r.multiply(n))).mod(u)).signum()},i),u.shiftRight(1));return o.compareTo(c)>0&&(o=u.subtract(o)),f(n,o)},verify:function(t,e,r,i){return h(t,s.fromBuffer(e),r,i)},verifyRaw:h}}).call(this,t("buffer").Buffer)},{"./ecsignature":5,"./enforce_types":6,"./hash":7,assert:24,bigi:32,buffer:52}],5:[function(t,e,r){(function(r){"use strict";var i=t("assert"),n=t("./enforce_types"),o=t("bigi");function s(t,e){function i(){var i=t.toDERInteger(),n=e.toDERInteger(),o=[];return o.push(2,i.length),(o=o.concat(i)).push(2,n.length),(o=o.concat(n)).unshift(48,o.length),new r(o)}return n(o,t),n(o,e),{r:t,s:e,toCompact:function(i,n){n&&(i+=4),i+=27;var o=new r(65);return o.writeUInt8(i,0),t.toBuffer(32).copy(o,1),e.toBuffer(32).copy(o,33),o},toDER:i,toScriptSignature:function(t){var e=new r(1);return e.writeUInt8(t,0),r.concat([i(),e])}}}s.parseCompact=function(t){i.equal(t.length,65,"Invalid signature length");var e=t.readUInt8(0)-27;return i.equal(e,7&e,"Invalid signature parameter"),{compressed:!!(4&e),i:e&=3,signature:s(o.fromBuffer(t.slice(1,33)),o.fromBuffer(t.slice(33)))}},s.fromDER=function(t){i.equal(t.readUInt8(0),48,"Not a DER sequence"),i.equal(t.readUInt8(1),t.length-2,"Invalid sequence length"),i.equal(t.readUInt8(2),2,"Expected a DER integer");var e=t.readUInt8(3);i(e>0,"R length is zero");var r=4+e;i.equal(t.readUInt8(r),2,"Expected a DER integer (2)");var n=t.readUInt8(r+1);i(n>0,"S length is zero");var f=t.slice(4,r),a=t.slice(r+2);r+=2+n,e>1&&0===f.readUInt8(0)&&i(128&f.readUInt8(1),"R value excessively padded"),n>1&&0===a.readUInt8(0)&&i(128&a.readUInt8(1),"S value excessively padded"),i.equal(r,t.length,"Invalid DER encoding");var h=o.fromDERInteger(f),u=o.fromDERInteger(a);return i(h.signum()>=0,"R value is negative"),i(u.signum()>=0,"S value is negative"),s(h,u)},s.parseScriptSignature=function(t){var e=t.readUInt8(t.length-1),r=-129&e;return i(r>0&&r<4,"Invalid hashType"),{signature:s.fromDER(t.slice(0,-1)),hashType:e}},e.exports=s}).call(this,t("buffer").Buffer)},{"./enforce_types":6,assert:24,bigi:32,buffer:52}],6:[function(t,e,r){(function(t){"use strict";function r(t){var e=t.toString().match(/function (.*?)\(/);return e?e[1]:null}e.exports=function(e,i){switch(e){case"Array":if(Array.isArray(i))return;break;case"Boolean":if("boolean"==typeof i)return;break;case"Buffer":if(t.isBuffer(i))return;break;case"Number":if("number"==typeof i)return;break;case"String":if("string"==typeof i)return;break;default:if(r(i.constructor)===r(e))return}throw new TypeError("Expected "+(r(e)||e)+", got "+i)}}).call(this,{isBuffer:t("../node_modules/is-buffer/index.js")})},{"../node_modules/is-buffer/index.js":72}],7:[function(t,e,r){"use strict";var i=t("create-hash"),n=t("create-hmac");e.exports={sha1:function(t,e){return i("sha1").update(t).digest(e)},sha256:function(t,e){return i("sha256").update(t).digest(e)},sha512:function(t,e){return i("sha512").update(t).digest(e)},HmacSHA256:function(t,e){return n("sha256",e).update(t).digest()},ripemd160:function(t){try{return i("rmd160").update(t).digest()}catch(e){return i("ripemd160").update(t).digest()}}}},{"create-hash":56,"create-hmac":59}],8:[function(t,e,r){"use strict";var i=t("./api_common"),n=t("./api_object"),o=Object.assign({},i,n);e.exports=o},{"./api_common":2,"./api_object":3}],9:[function(t,e,r){(function(r){"use strict";var i=t("@babel/runtime/helpers/interopRequireDefault"),n=i(t("@babel/runtime/helpers/toConsumableArray")),o=i(t("@babel/runtime/helpers/slicedToArray")),s=i(t("@babel/runtime/helpers/typeof")),f=t("ecurve"),a=f.Point,h=f.getCurveByName("secp256k1"),u=t("bigi"),l=t("assert"),c=t("./hash"),p=t("./key_public"),d=t("./key_utils"),g=t("create-hash"),y=t("./promise-async");h.G,h.n;function b(t){if("string"==typeof t)return b.fromString(t);if(r.isBuffer(t))return b.fromBuffer(t);if("object"===(0,s.default)(t)&&u.isBigInteger(t.d))return b(t.d);if(!u.isBigInteger(t))throw new TypeError("Invalid private key");function e(){var t=n();return t=r.concat([new r([128]),t]),d.checkEncode(t,"sha256x2")}var i;function n(){return t.toBuffer(32)}return{d:t,toWif:e,toString:function(){return e()},toPublic:function(){if(i)return i;var e=h.G.multiply(t);return i=p.fromPoint(e)},toBuffer:n,getSharedSecret:function(t){var e=(t=p(t)).toUncompressed().toBuffer(),r=a.fromAffine(h,u.fromBuffer(e.slice(1,33)),u.fromBuffer(e.slice(33,65))),i=n(),o=r.multiply(u.fromBuffer(i)).affineX.toBuffer({size:32});return c.sha512(o)},getChildKey:function(t){return b(g("sha256").update(n()).update(t).digest())}}}function v(t){l.equal((0,s.default)(t),"string","privateStr");var e=t.match(/^PVT_([A-Za-z0-9]+)_([A-Za-z0-9]+)$/);if(null===e){var r=d.checkDecode(t,"sha256x2"),i=r.readUInt8(0);l.equal(128,i,"Expected version ".concat(128,", instead got ",i));return{privateKey:b.fromBuffer(r.slice(1)),format:"WIF",keyType:"K1"}}l(3===e.length,"Expecting private key like: PVT_K1_base58privateKey..");var n=(0,o.default)(e,3),f=n[1],a=n[2];return l.equal(f,"K1","K1 private key expected"),{privateKey:b.fromBuffer(d.checkDecode(a,f)),format:"PVT",keyType:f}}e.exports=b,b.fromHex=function(t){return b.fromBuffer(new r(t,"hex"))},b.fromBuffer=function(t){if(!r.isBuffer(t))throw new Error("Expecting parameter to be a Buffer type");if(33===t.length&&1===t[32]&&(t=t.slice(0,-1)),32!==t.length)throw new Error("Expecting 32 bytes, instead got ".concat(t.length));return b(u.fromBuffer(t))},b.fromSeed=function(t){if("string"!=typeof t)throw new Error("seed must be of type string");return b.fromBuffer(c.sha256(t))},b.isWif=function(t){try{return l("WIF"===v(t).format),!0}catch(t){return!1}},b.isValid=function(t){try{return b(t),!0}catch(t){return!1}},b.fromWif=function(t){return console.log("PrivateKey.fromWif is deprecated, please use PrivateKey.fromString"),b.fromString(t)},b.fromString=function(t){return v(t).privateKey},b.randomKey=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return b.initialize().then(function(){return b.fromBuffer(d.random32ByteBuffer({cpuEntropyBits:t}))})},b.unsafeRandomKey=function(){return Promise.resolve(b.fromBuffer(d.random32ByteBuffer({safe:!1})))};var m=!1;b.initialize=y(function(){m||(function(){var t=b(c.sha256("")),e="key comparison test failed on a known private key";l.equal(t.toWif(),"5KYZdUEo39z3FPrtuX2QbbwGnNP5zTd7yyr2SC1j299sBCnWjss",e),l.equal(t.toString(),"5KYZdUEo39z3FPrtuX2QbbwGnNP5zTd7yyr2SC1j299sBCnWjss",e);var r=t.toPublic();l.equal(r.toString(),"EOS859gxfnXyUriMgUeThh1fWv3oqcpLFyHa3TfFYC4PK2HqhToVM","pubkey string comparison test failed on a known public key"),w(function(){return b.fromString(t.toWif())},"converting known wif from string"),w(function(){return b.fromString(t.toString())},"converting known pvt from string"),w(function(){return p.fromString(r.toString())},"converting known public key from string"),!0}(),d.addEntropy.apply(d,(0,n.default)(d.cpuEntropy())),l(d.entropyCount()>=128,"insufficient entropy"),m=!0)});var w=function(t,e){try{t()}catch(t){throw t.message="".concat(e," ==> ").concat(t.message),t}}}).call(this,t("buffer").Buffer)},{"./hash":7,"./key_public":10,"./key_utils":11,"./promise-async":12,"@babel/runtime/helpers/interopRequireDefault":16,"@babel/runtime/helpers/slicedToArray":21,"@babel/runtime/helpers/toConsumableArray":22,"@babel/runtime/helpers/typeof":23,assert:24,bigi:32,buffer:52,"create-hash":56,ecurve:64}],10:[function(t,e,r){(function(r){"use strict";var i=t("@babel/runtime/helpers/interopRequireDefault"),n=i(t("@babel/runtime/helpers/slicedToArray")),o=i(t("@babel/runtime/helpers/typeof")),s=t("assert"),f=t("ecurve"),a=t("bigi"),h=f.getCurveByName("secp256k1"),u=t("./hash"),l=t("./key_utils"),c=h.G,p=h.n;function d(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"EOS";if("string"==typeof t){var i=d.fromString(t,e);return s(null!=i,"Invalid public key"),i}if(r.isBuffer(t))return d.fromBuffer(t);if("object"===(0,o.default)(t)&&t.Q)return d(t.Q);function n(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.compressed;return t.getEncoded(e)}return s.equal((0,o.default)(t),"object","Invalid public key"),s.equal((0,o.default)(t.compressed),"boolean","Invalid public key"),{Q:t,toString:function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"EOS")+l.checkEncode(n())},toUncompressed:function(){var e=t.getEncoded(!1),r=f.Point.decodeFrom(h,e);return d.fromPoint(r)},toBuffer:n,child:function(e){console.error("Deprecated warning: PublicKey.child"),s(r.isBuffer(e),"Buffer required: offset"),s.equal(e.length,32,"offset length"),e=r.concat([n(),e]),e=u.sha256(e);var i=a.fromBuffer(e);if(i.compareTo(p)>=0)throw new Error("Child offset went out of bounds, try again");var o=c.multiply(i),f=t.add(o);if(h.isInfinity(f))throw new Error("Child offset derived to an invalid key, try again");return d.fromPoint(f)},toHex:function(){return n().toString("hex")}}}e.exports=d,d.isValid=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"EOS";try{return d(t,e),!0}catch(t){return!1}},d.fromBinary=function(t){return d.fromBuffer(new r(t,"binary"))},d.fromBuffer=function(t){return d(f.Point.decodeFrom(h,t))},d.fromPoint=function(t){return d(t)},d.fromString=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"EOS";try{return d.fromStringOrThrow(t,e)}catch(t){return null}},d.fromStringOrThrow=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"EOS";s.equal((0,o.default)(t),"string","public_key");var r=t.match(/^PUB_([A-Za-z0-9]+)_([A-Za-z0-9]+)$/);if(null===r)return new RegExp("^"+e).test(t)&&(t=t.substring(e.length)),d.fromBuffer(l.checkDecode(t));s(3===r.length,"Expecting public key like: PUB_K1_base58pubkey..");var i=(0,n.default)(r,3),f=i[1],a=i[2];return s.equal(f,"K1","K1 private key expected"),d.fromBuffer(l.checkDecode(a,f))},d.fromHex=function(t){return d.fromBuffer(new r(t,"hex"))},d.fromStringHex=function(t){return d.fromString(new r(t,"hex"))}}).call(this,t("buffer").Buffer)},{"./hash":7,"./key_utils":11,"@babel/runtime/helpers/interopRequireDefault":16,"@babel/runtime/helpers/slicedToArray":21,"@babel/runtime/helpers/typeof":23,assert:24,bigi:32,buffer:52,ecurve:64}],11:[function(t,e,r){(function(r){"use strict";var i=t("@babel/runtime/helpers/interopRequireDefault")(t("@babel/runtime/helpers/typeof")),n=t("bs58"),o=t("assert"),s=t("randombytes"),f=t("./hash");e.exports={random32ByteBuffer:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.cpuEntropyBits,n=void 0===e?0:e,a=t.safe,c=void 0===a||a;o.equal((0,i.default)(n),"number","cpuEntropyBits"),o.equal((0,i.default)(c),"boolean","boolean"),c&&o(h>=128,"Call initialize() to add entropy");var p=[];return p.push(s(32)),p.push(r.from(l(n))),p.push(u),p.push(function(){var t=Array(s(101)).join();try{t+=(new Date).toString()+" "+window.screen.height+" "+window.screen.width+" "+window.screen.colorDepth+" "+window.screen.availHeight+" "+window.screen.availWidth+" "+window.screen.pixelDepth+navigator.language+" "+window.location+" "+window.history.length;for(var e,i=0;i<navigator.mimeTypes.length;i++)e=navigator.mimeTypes[i],t+=e.description+" "+e.type+" "+e.suffixes+" "}catch(e){t+=f.sha256((new Date).toString())}var n=new r(t),o=t+=n.toString("binary")+" "+(new Date).toString(),a=Date.now();for(;Date.now()-a<25;)o=f.sha256(o);return o}()),f.sha256(r.concat(p))},addEntropy:function(){o.equal(u.length,101,"externalEntropyArray");for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];h+=e.length;for(var i=0,n=e;i<n.length;i++){var s=n[i],f=a++%101,l=u[f]+=s;l>9007199254740991&&(u[f]=0)}},cpuEntropy:l,entropyCount:function(){return h},checkDecode:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;o(null!=t,"private key expected");var i,s=new r(n.decode(t)),a=s.slice(-4),h=s.slice(0,-4);if("sha256x2"===e)i=f.sha256(f.sha256(h)).slice(0,4);else{var u=[h];e&&u.push(r.from(e)),i=f.ripemd160(r.concat(u)).slice(0,4)}if(a.toString("hex")!==i.toString("hex"))throw new Error("Invalid checksum, "+"".concat(a.toString("hex")," != ").concat(i.toString("hex")));return h},checkEncode:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(o(r.isBuffer(t),"expecting keyBuffer<Buffer>"),"sha256x2"===e){var i=f.sha256(f.sha256(t)).slice(0,4);return n.encode(r.concat([t,i]))}var s=[t];e&&s.push(r.from(e));var a=f.ripemd160(r.concat(s)).slice(0,4);return n.encode(r.concat([t,a]))}};var a=0,h=0,u=s(101);function l(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:128,e=[],r=null,i=0;e.length<t;){var n=c();if(null!=r){var o=n-r;if(Math.abs(o)<1){i++;continue}var s=Math.floor(p(Math.abs(o))+1);if(s<4){s<2&&i++;continue}e.push(o)}r=n}if(i>10){var f=Number(i/t*100).toFixed(2);console.warn("WARN: ".concat(f,"% low CPU entropy re-sampled"))}return e}function c(){for(var t=Date.now(),e=0,r=0;Date.now()<t+7+1;)r=Math.sin(Math.sqrt(Math.log(++e+r)));return e}var p=function(t){return Math.log(t)/Math.LN2}}).call(this,t("buffer").Buffer)},{"./hash":7,"@babel/runtime/helpers/interopRequireDefault":16,"@babel/runtime/helpers/typeof":23,assert:24,bs58:50,buffer:52,randombytes:79}],12:[function(t,e,r){"use strict";e.exports=function(t){return function(){for(var e=arguments.length,r=new Array(e),i=0;i<e;i++)r[i]=arguments[i];return new Promise(function(e,i){setTimeout(function(){try{e(t.apply(void 0,r))}catch(t){i(t)}})})}}},{}],13:[function(t,e,r){(function(r){"use strict";var i=t("@babel/runtime/helpers/interopRequireDefault"),n=i(t("@babel/runtime/helpers/slicedToArray")),o=i(t("@babel/runtime/helpers/typeof")),s=t("./ecdsa"),f=t("./hash"),a=t("ecurve").getCurveByName("secp256k1"),h=t("assert"),u=t("bigi"),l=t("./key_utils"),c=t("./key_public"),p=t("./key_private");function d(t,e,i){function n(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"utf8";return"string"==typeof t&&(t=r.from(t,i)),h(r.isBuffer(t),"data is a required String or Buffer"),o(t=f.sha256(t),e)}function o(i,n){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"hex";if("string"==typeof i&&(i=r.from(i,o)),32!==i.length||!r.isBuffer(i))throw new Error("dataSha256: 32 bytes required");var f=c(n);return h(f,"pubkey required"),s.verify(a,i,{r:t,s:e},f.Q)}function p(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"utf8";return"string"==typeof t&&(t=r.from(t,e)),h(r.isBuffer(t),"data is a required String or Buffer"),d(t=f.sha256(t))}function d(n){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"hex";if("string"==typeof n&&(n=r.from(n,o)),32!==n.length||!r.isBuffer(n))throw new Error("dataSha256: 32 byte String or buffer requred");var f=u.fromBuffer(n),h=i;h-=27,h&=3;var l=s.recoverPubKey(a,f,{r:t,s:e,i:i},h);return c.fromPoint(l)}function g(){var n;return(n=new r(65)).writeUInt8(i,0),t.toBuffer(32).copy(n,1),e.toBuffer(32).copy(n,33),n}var y;return h.equal(null!=t,!0,"Missing parameter"),h.equal(null!=e,!0,"Missing parameter"),h.equal(null!=i,!0,"Missing parameter"),{r:t,s:e,i:i,toBuffer:g,verify:n,verifyHash:o,verifyHex:function(t,e){return console.log('Deprecated: use verify(data, pubkey, "hex")'),n(r.from(t,"hex"),e)},recover:p,recoverHash:d,toHex:function(){return g().toString("hex")},toString:function(){return y||(y="SIG_K1_"+l.checkEncode(g(),"K1"))},verifyBuffer:function(){return console.log("Deprecated: use signature.verify instead (same arguments)"),n.apply(void 0,arguments)},recoverPublicKey:function(){return console.log("Deprecated: use signature.recover instead (same arguments)"),p.apply(void 0,arguments)},recoverPublicKeyFromBuffer:function(){return console.log("Deprecated: use signature.recoverHash instead (same arguments)"),d.apply(void 0,arguments)}}}e.exports=d,d.sign=function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"utf8";return"string"==typeof t&&(t=r.from(t,i)),h(r.isBuffer(t),"data is a required String or Buffer"),t=f.sha256(t),d.signHash(t,e)},d.signHash=function(t,e){var i,n,o,f,l,c,g,y=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"hex";if("string"==typeof t&&(t=r.from(t,y)),32!==t.length||!r.isBuffer(t))throw new Error("dataSha256: 32 byte buffer requred");for(e=p(e),h(e,"privateKey required"),f=null,g=0,n=u.fromBuffer(t);;){if(c=(i=(o=s.sign(a,t,e.d,g++)).toDER())[5+(l=i[3])],32===l&&32===c){f=s.calcPubKeyRecoveryParam(a,n,o,e.toPublic().Q),f+=4,f+=27;break}g%10==0&&console.log("WARN: "+g+" attempts to find canonical signature")}return d(o.r,o.s,f)},d.fromBuffer=function(t){var e;return h(r.isBuffer(t),"Buffer is required"),h.equal(t.length,65,"Invalid signature length"),e=t.readUInt8(0),h.equal(e-27,e-27&7,"Invalid signature parameter"),d(u.fromBuffer(t.slice(1,33)),u.fromBuffer(t.slice(33)),e)},d.fromHex=function(t){return d.fromBuffer(r.from(t,"hex"))},d.fromString=function(t){try{return d.fromStringOrThrow(t)}catch(t){return null}},d.fromStringOrThrow=function(t){h.equal((0,o.default)(t),"string","signature");var e=t.match(/^SIG_([A-Za-z0-9]+)_([A-Za-z0-9]+)$/);h(null!=e&&3===e.length,"Expecting signature like: SIG_K1_base58signature..");var r=(0,n.default)(e,3),i=r[1],s=r[2];return h.equal(i,"K1","K1 signature expected"),d.fromBuffer(l.checkDecode(s,i))},d.from=function(t){var e=t?t.r&&t.s&&t.i?t:"string"==typeof t&&130===t.length?d.fromHex(t):"string"==typeof t&&130!==t.length?d.fromStringOrThrow(t):r.isBuffer(t)?d.fromBuffer(t):null:t;if(!e)throw new TypeError("signature should be a hex string or buffer");return e}}).call(this,t("buffer").Buffer)},{"./ecdsa":4,"./hash":7,"./key_private":9,"./key_public":10,"./key_utils":11,"@babel/runtime/helpers/interopRequireDefault":16,"@babel/runtime/helpers/slicedToArray":21,"@babel/runtime/helpers/typeof":23,assert:24,bigi:32,buffer:52,ecurve:64}],14:[function(t,e,r){e.exports=function(t){if(Array.isArray(t))return t}},{}],15:[function(t,e,r){e.exports=function(t){if(Array.isArray(t)){for(var e=0,r=new Array(t.length);e<t.length;e++)r[e]=t[e];return r}}},{}],16:[function(t,e,r){e.exports=function(t){return t&&t.__esModule?t:{default:t}}},{}],17:[function(t,e,r){e.exports=function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}},{}],18:[function(t,e,r){e.exports=function(t,e){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t)){var r=[],i=!0,n=!1,o=void 0;try{for(var s,f=t[Symbol.iterator]();!(i=(s=f.next()).done)&&(r.push(s.value),!e||r.length!==e);i=!0);}catch(t){n=!0,o=t}finally{try{i||null==f.return||f.return()}finally{if(n)throw o}}return r}}},{}],19:[function(t,e,r){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}},{}],20:[function(t,e,r){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}},{}],21:[function(t,e,r){var i=t("./arrayWithHoles"),n=t("./iterableToArrayLimit"),o=t("./nonIterableRest");e.exports=function(t,e){return i(t)||n(t,e)||o()}},{"./arrayWithHoles":14,"./iterableToArrayLimit":18,"./nonIterableRest":19}],22:[function(t,e,r){var i=t("./arrayWithoutHoles"),n=t("./iterableToArray"),o=t("./nonIterableSpread");e.exports=function(t){return i(t)||n(t)||o()}},{"./arrayWithoutHoles":15,"./iterableToArray":17,"./nonIterableSpread":20}],23:[function(t,e,r){function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function n(t){return"function"==typeof Symbol&&"symbol"===i(Symbol.iterator)?e.exports=n=function(t){return i(t)}:e.exports=n=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":i(t)},n(t)}e.exports=n},{}],24:[function(t,e,r){(function(r){"use strict";var i=t("object-assign");function n(t,e){if(t===e)return 0;for(var r=t.length,i=e.length,n=0,o=Math.min(r,i);n<o;++n)if(t[n]!==e[n]){r=t[n],i=e[n];break}return r<i?-1:i<r?1:0}function o(t){return r.Buffer&&"function"==typeof r.Buffer.isBuffer?r.Buffer.isBuffer(t):!(null==t||!t._isBuffer)}var s=t("util/"),f=Object.prototype.hasOwnProperty,a=Array.prototype.slice,h="foo"===function(){}.name;function u(t){return Object.prototype.toString.call(t)}function l(t){return!o(t)&&("function"==typeof r.ArrayBuffer&&("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):!!t&&(t instanceof DataView||!!(t.buffer&&t.buffer instanceof ArrayBuffer))))}var c=e.exports=v,p=/\s*function\s+([^\(\s]*)\s*/;function d(t){if(s.isFunction(t)){if(h)return t.name;var e=t.toString().match(p);return e&&e[1]}}function g(t,e){return"string"==typeof t?t.length<e?t:t.slice(0,e):t}function y(t){if(h||!s.isFunction(t))return s.inspect(t);var e=d(t);return"[Function"+(e?": "+e:"")+"]"}function b(t,e,r,i,n){throw new c.AssertionError({message:r,actual:t,expected:e,operator:i,stackStartFunction:n})}function v(t,e){t||b(t,!0,e,"==",c.ok)}function m(t,e,r,i){if(t===e)return!0;if(o(t)&&o(e))return 0===n(t,e);if(s.isDate(t)&&s.isDate(e))return t.getTime()===e.getTime();if(s.isRegExp(t)&&s.isRegExp(e))return t.source===e.source&&t.global===e.global&&t.multiline===e.multiline&&t.lastIndex===e.lastIndex&&t.ignoreCase===e.ignoreCase;if(null!==t&&"object"==typeof t||null!==e&&"object"==typeof e){if(l(t)&&l(e)&&u(t)===u(e)&&!(t instanceof Float32Array||t instanceof Float64Array))return 0===n(new Uint8Array(t.buffer),new Uint8Array(e.buffer));if(o(t)!==o(e))return!1;var f=(i=i||{actual:[],expected:[]}).actual.indexOf(t);return-1!==f&&f===i.expected.indexOf(e)||(i.actual.push(t),i.expected.push(e),function(t,e,r,i){if(null==t||null==e)return!1;if(s.isPrimitive(t)||s.isPrimitive(e))return t===e;if(r&&Object.getPrototypeOf(t)!==Object.getPrototypeOf(e))return!1;var n=w(t),o=w(e);if(n&&!o||!n&&o)return!1;if(n)return t=a.call(t),e=a.call(e),m(t,e,r);var f,h,u=T(t),l=T(e);if(u.length!==l.length)return!1;for(u.sort(),l.sort(),h=u.length-1;h>=0;h--)if(u[h]!==l[h])return!1;for(h=u.length-1;h>=0;h--)if(f=u[h],!m(t[f],e[f],r,i))return!1;return!0}(t,e,r,i))}return r?t===e:t==e}function w(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function _(t,e){if(!t||!e)return!1;if("[object RegExp]"==Object.prototype.toString.call(e))return e.test(t);try{if(t instanceof e)return!0}catch(t){}return!Error.isPrototypeOf(e)&&!0===e.call({},t)}function E(t,e,r,i){var n;if("function"!=typeof e)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(i=r,r=null),n=function(t){var e;try{t()}catch(t){e=t}return e}(e),i=(r&&r.name?" ("+r.name+").":".")+(i?" "+i:"."),t&&!n&&b(n,r,"Missing expected exception"+i);var o="string"==typeof i,f=!t&&n&&!r;if((!t&&s.isError(n)&&o&&_(n,r)||f)&&b(n,r,"Got unwanted exception"+i),t&&n&&r&&!_(n,r)||!t&&n)throw n}c.AssertionError=function(t){var e;this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=g(y((e=this).actual),128)+" "+e.operator+" "+g(y(e.expected),128),this.generatedMessage=!0);var r=t.stackStartFunction||b;if(Error.captureStackTrace)Error.captureStackTrace(this,r);else{var i=new Error;if(i.stack){var n=i.stack,o=d(r),s=n.indexOf("\n"+o);if(s>=0){var f=n.indexOf("\n",s+1);n=n.substring(f+1)}this.stack=n}}},s.inherits(c.AssertionError,Error),c.fail=b,c.ok=v,c.equal=function(t,e,r){t!=e&&b(t,e,r,"==",c.equal)},c.notEqual=function(t,e,r){t==e&&b(t,e,r,"!=",c.notEqual)},c.deepEqual=function(t,e,r){m(t,e,!1)||b(t,e,r,"deepEqual",c.deepEqual)},c.deepStrictEqual=function(t,e,r){m(t,e,!0)||b(t,e,r,"deepStrictEqual",c.deepStrictEqual)},c.notDeepEqual=function(t,e,r){m(t,e,!1)&&b(t,e,r,"notDeepEqual",c.notDeepEqual)},c.notDeepStrictEqual=function t(e,r,i){m(e,r,!0)&&b(e,r,i,"notDeepStrictEqual",t)},c.strictEqual=function(t,e,r){t!==e&&b(t,e,r,"===",c.strictEqual)},c.notStrictEqual=function(t,e,r){t===e&&b(t,e,r,"!==",c.notStrictEqual)},c.throws=function(t,e,r){E(!0,t,e,r)},c.doesNotThrow=function(t,e,r){E(!1,t,e,r)},c.ifError=function(t){if(t)throw t},c.strict=i(function t(e,r){e||b(e,!0,r,"==",t)},c,{equal:c.strictEqual,deepEqual:c.deepStrictEqual,notEqual:c.notStrictEqual,notDeepEqual:c.notDeepStrictEqual}),c.strict.strict=c.strict;var T=Object.keys||function(t){var e=[];for(var r in t)f.call(t,r)&&e.push(r);return e}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"object-assign":76,"util/":27}],25:[function(t,e,r){"function"==typeof Object.create?e.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}},{}],26:[function(t,e,r){e.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},{}],27:[function(t,e,r){(function(e,i){var n=/%[sdj%]/g;r.format=function(t){if(!b(t)){for(var e=[],r=0;r<arguments.length;r++)e.push(f(arguments[r]));return e.join(" ")}r=1;for(var i=arguments,o=i.length,s=String(t).replace(n,function(t){if("%%"===t)return"%";if(r>=o)return t;switch(t){case"%s":return String(i[r++]);case"%d":return Number(i[r++]);case"%j":try{return JSON.stringify(i[r++])}catch(t){return"[Circular]"}default:return t}}),a=i[r];r<o;a=i[++r])g(a)||!w(a)?s+=" "+a:s+=" "+f(a);return s},r.deprecate=function(t,n){if(v(i.process))return function(){return r.deprecate(t,n).apply(this,arguments)};if(!0===e.noDeprecation)return t;var o=!1;return function(){if(!o){if(e.throwDeprecation)throw new Error(n);e.traceDeprecation?console.trace(n):console.error(n),o=!0}return t.apply(this,arguments)}};var o,s={};function f(t,e){var i={seen:[],stylize:h};return arguments.length>=3&&(i.depth=arguments[2]),arguments.length>=4&&(i.colors=arguments[3]),d(e)?i.showHidden=e:e&&r._extend(i,e),v(i.showHidden)&&(i.showHidden=!1),v(i.depth)&&(i.depth=2),v(i.colors)&&(i.colors=!1),v(i.customInspect)&&(i.customInspect=!0),i.colors&&(i.stylize=a),u(i,t,i.depth)}function a(t,e){var r=f.styles[e];return r?"["+f.colors[r][0]+"m"+t+"["+f.colors[r][1]+"m":t}function h(t,e){return t}function u(t,e,i){if(t.customInspect&&e&&T(e.inspect)&&e.inspect!==r.inspect&&(!e.constructor||e.constructor.prototype!==e)){var n=e.inspect(i,t);return b(n)||(n=u(t,n,i)),n}var o=function(t,e){if(v(e))return t.stylize("undefined","undefined");if(b(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}if(y(e))return t.stylize(""+e,"number");if(d(e))return t.stylize(""+e,"boolean");if(g(e))return t.stylize("null","null")}(t,e);if(o)return o;var s=Object.keys(e),f=function(t){var e={};return t.forEach(function(t,r){e[t]=!0}),e}(s);if(t.showHidden&&(s=Object.getOwnPropertyNames(e)),E(e)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return l(e);if(0===s.length){if(T(e)){var a=e.name?": "+e.name:"";return t.stylize("[Function"+a+"]","special")}if(m(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(_(e))return t.stylize(Date.prototype.toString.call(e),"date");if(E(e))return l(e)}var h,w="",B=!1,S=["{","}"];(p(e)&&(B=!0,S=["[","]"]),T(e))&&(w=" [Function"+(e.name?": "+e.name:"")+"]");return m(e)&&(w=" "+RegExp.prototype.toString.call(e)),_(e)&&(w=" "+Date.prototype.toUTCString.call(e)),E(e)&&(w=" "+l(e)),0!==s.length||B&&0!=e.length?i<0?m(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special"):(t.seen.push(e),h=B?function(t,e,r,i,n){for(var o=[],s=0,f=e.length;s<f;++s)k(e,String(s))?o.push(c(t,e,r,i,String(s),!0)):o.push("");return n.forEach(function(n){n.match(/^\d+$/)||o.push(c(t,e,r,i,n,!0))}),o}(t,e,i,f,s):s.map(function(r){return c(t,e,i,f,r,B)}),t.seen.pop(),function(t,e,r){if(t.reduce(function(t,e){return 0,e.indexOf("\n")>=0&&0,t+e.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60)return r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1];return r[0]+e+" "+t.join(", ")+" "+r[1]}(h,w,S)):S[0]+w+S[1]}function l(t){return"["+Error.prototype.toString.call(t)+"]"}function c(t,e,r,i,n,o){var s,f,a;if((a=Object.getOwnPropertyDescriptor(e,n)||{value:e[n]}).get?f=a.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):a.set&&(f=t.stylize("[Setter]","special")),k(i,n)||(s="["+n+"]"),f||(t.seen.indexOf(a.value)<0?(f=g(r)?u(t,a.value,null):u(t,a.value,r-1)).indexOf("\n")>-1&&(f=o?f.split("\n").map(function(t){return" "+t}).join("\n").substr(2):"\n"+f.split("\n").map(function(t){return" "+t}).join("\n")):f=t.stylize("[Circular]","special")),v(s)){if(o&&n.match(/^\d+$/))return f;(s=JSON.stringify(""+n)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=t.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=t.stylize(s,"string"))}return s+": "+f}function p(t){return Array.isArray(t)}function d(t){return"boolean"==typeof t}function g(t){return null===t}function y(t){return"number"==typeof t}function b(t){return"string"==typeof t}function v(t){return void 0===t}function m(t){return w(t)&&"[object RegExp]"===B(t)}function w(t){return"object"==typeof t&&null!==t}function _(t){return w(t)&&"[object Date]"===B(t)}function E(t){return w(t)&&("[object Error]"===B(t)||t instanceof Error)}function T(t){return"function"==typeof t}function B(t){return Object.prototype.toString.call(t)}function S(t){return t<10?"0"+t.toString(10):t.toString(10)}r.debuglog=function(t){if(v(o)&&(o=e.env.NODE_DEBUG||""),t=t.toUpperCase(),!s[t])if(new RegExp("\\b"+t+"\\b","i").test(o)){var i=e.pid;s[t]=function(){var e=r.format.apply(r,arguments);console.error("%s %d: %s",t,i,e)}}else s[t]=function(){};return s[t]},r.inspect=f,f.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},f.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},r.isArray=p,r.isBoolean=d,r.isNull=g,r.isNullOrUndefined=function(t){return null==t},r.isNumber=y,r.isString=b,r.isSymbol=function(t){return"symbol"==typeof t},r.isUndefined=v,r.isRegExp=m,r.isObject=w,r.isDate=_,r.isError=E,r.isFunction=T,r.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},r.isBuffer=t("./support/isBuffer");var I=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function k(t,e){return Object.prototype.hasOwnProperty.call(t,e)}r.log=function(){var t,e;console.log("%s - %s",(t=new Date,e=[S(t.getHours()),S(t.getMinutes()),S(t.getSeconds())].join(":"),[t.getDate(),I[t.getMonth()],e].join(" ")),r.format.apply(r,arguments))},r.inherits=t("inherits"),r._extend=function(t,e){if(!e||!w(e))return t;for(var r=Object.keys(e),i=r.length;i--;)t[r[i]]=e[r[i]];return t}}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":26,_process:78,inherits:25}],28:[function(t,e,r){"use strict";var i=t("safe-buffer").Buffer;e.exports=function(t){if(t.length>=255)throw new TypeError("Alphabet too long");var e=new Uint8Array(256);e.fill(255);for(var r=0;r<t.length;r++){var n=t.charAt(r),o=n.charCodeAt(0);if(255!==e[o])throw new TypeError(n+" is ambiguous");e[o]=r}var s=t.length,f=t.charAt(0),a=Math.log(s)/Math.log(256),h=Math.log(256)/Math.log(s);function u(t){if("string"!=typeof t)throw new TypeError("Expected String");if(0===t.length)return i.alloc(0);var r=0;if(" "!==t[r]){for(var n=0,o=0;t[r]===f;)n++,r++;for(var h=(t.length-r)*a+1>>>0,u=new Uint8Array(h);t[r];){var l=e[t.charCodeAt(r)];if(255===l)return;for(var c=0,p=h-1;(0!==l||c<o)&&-1!==p;p--,c++)l+=s*u[p]>>>0,u[p]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");o=c,r++}if(" "!==t[r]){for(var d=h-o;d!==h&&0===u[d];)d++;var g=i.allocUnsafe(n+(h-d));g.fill(0,0,n);for(var y=n;d!==h;)g[y++]=u[d++];return g}}}return{encode:function(e){if(!i.isBuffer(e))throw new TypeError("Expected Buffer");if(0===e.length)return"";for(var r=0,n=0,o=0,a=e.length;o!==a&&0===e[o];)o++,r++;for(var u=(a-o)*h+1>>>0,l=new Uint8Array(u);o!==a;){for(var c=e[o],p=0,d=u-1;(0!==c||p<n)&&-1!==d;d--,p++)c+=256*l[d]>>>0,l[d]=c%s>>>0,c=c/s>>>0;if(0!==c)throw new Error("Non-zero carry");n=p,o++}for(var g=u-n;g!==u&&0===l[g];)g++;for(var y=f.repeat(r);g<u;++g)y+=t.charAt(l[g]);return y},decodeUnsafe:u,decode:function(t){var e=u(t);if(e)return e;throw new Error("Non-base"+s+" character")}}}},{"safe-buffer":95}],29:[function(t,e,r){"use strict";r.byteLength=function(t){var e=h(t),r=e[0],i=e[1];return 3*(r+i)/4-i},r.toByteArray=function(t){var e,r,i=h(t),s=i[0],f=i[1],a=new o(function(t,e,r){return 3*(e+r)/4-r}(0,s,f)),u=0,l=f>0?s-4:s;for(r=0;r<l;r+=4)e=n[t.charCodeAt(r)]<<18|n[t.charCodeAt(r+1)]<<12|n[t.charCodeAt(r+2)]<<6|n[t.charCodeAt(r+3)],a[u++]=e>>16&255,a[u++]=e>>8&255,a[u++]=255&e;2===f&&(e=n[t.charCodeAt(r)]<<2|n[t.charCodeAt(r+1)]>>4,a[u++]=255&e);1===f&&(e=n[t.charCodeAt(r)]<<10|n[t.charCodeAt(r+1)]<<4|n[t.charCodeAt(r+2)]>>2,a[u++]=e>>8&255,a[u++]=255&e);return a},r.fromByteArray=function(t){for(var e,r=t.length,n=r%3,o=[],s=0,f=r-n;s<f;s+=16383)o.push(u(t,s,s+16383>f?f:s+16383));1===n?(e=t[r-1],o.push(i[e>>2]+i[e<<4&63]+"==")):2===n&&(e=(t[r-2]<<8)+t[r-1],o.push(i[e>>10]+i[e>>4&63]+i[e<<2&63]+"="));return o.join("")};for(var i=[],n=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",f=0,a=s.length;f<a;++f)i[f]=s[f],n[s.charCodeAt(f)]=f;function h(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function u(t,e,r){for(var n,o,s=[],f=e;f<r;f+=3)n=(t[f]<<16&16711680)+(t[f+1]<<8&65280)+(255&t[f+2]),s.push(i[(o=n)>>18&63]+i[o>>12&63]+i[o>>6&63]+i[63&o]);return s.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},{}],30:[function(t,e,r){function i(t,e,r){if(!(this instanceof i))return new i(t,e,r);null!=t&&("number"==typeof t?this.fromNumber(t,e,r):null==e&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,e))}var n=i.prototype;n.__bigi=t("../package.json").version,i.isBigInteger=function(t,e){return t&&t.__bigi&&(!e||t.__bigi===n.__bigi)},i.prototype.am=function(t,e,r,i,n,o){for(;--o>=0;){var s=e*this[t++]+r[i]+n;n=Math.floor(s/67108864),r[i++]=67108863&s}return n},i.prototype.DB=26,i.prototype.DM=67108863;var o=i.prototype.DV=1<<26;i.prototype.FV=Math.pow(2,52),i.prototype.F1=26,i.prototype.F2=0;var s,f,a="0123456789abcdefghijklmnopqrstuvwxyz",h=new Array;for(s="0".charCodeAt(0),f=0;f<=9;++f)h[s++]=f;for(s="a".charCodeAt(0),f=10;f<36;++f)h[s++]=f;for(s="A".charCodeAt(0),f=10;f<36;++f)h[s++]=f;function u(t){return a.charAt(t)}function l(t,e){var r=h[t.charCodeAt(e)];return null==r?-1:r}function c(t){var e=new i;return e.fromInt(t),e}function p(t){var e,r=1;return 0!=(e=t>>>16)&&(t=e,r+=16),0!=(e=t>>8)&&(t=e,r+=8),0!=(e=t>>4)&&(t=e,r+=4),0!=(e=t>>2)&&(t=e,r+=2),0!=(e=t>>1)&&(t=e,r+=1),r}function d(t){this.m=t}function g(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}function y(t,e){return t&e}function b(t,e){return t|e}function v(t,e){return t^e}function m(t,e){return t&~e}function w(t){if(0==t)return-1;var e=0;return 0==(65535&t)&&(t>>=16,e+=16),0==(255&t)&&(t>>=8,e+=8),0==(15&t)&&(t>>=4,e+=4),0==(3&t)&&(t>>=2,e+=2),0==(1&t)&&++e,e}function _(t){for(var e=0;0!=t;)t&=t-1,++e;return e}function E(){}function T(t){return t}function B(t){this.r2=new i,this.q3=new i,i.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}d.prototype.convert=function(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},d.prototype.revert=function(t){return t},d.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},d.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},d.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},g.prototype.convert=function(t){var e=new i;return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo(i.ZERO)>0&&this.m.subTo(e,e),e},g.prototype.revert=function(t){var e=new i;return t.copyTo(e),this.reduce(e),e},g.prototype.reduce=function(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e<this.m.t;++e){var r=32767&t[e],i=r*this.mpl+((r*this.mph+(t[e]>>15)*this.mpl&this.um)<<15)&t.DM;for(t[r=e+this.m.t]+=this.m.am(0,i,t,e,0,this.m.t);t[r]>=t.DV;)t[r]-=t.DV,t[++r]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)},g.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},g.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},n.copyTo=function(t){for(var e=this.t-1;e>=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s},n.fromInt=function(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+o:this.t=0},n.fromString=function(t,e){var r;if(16==e)r=4;else if(8==e)r=3;else if(256==e)r=8;else if(2==e)r=1;else if(32==e)r=5;else{if(4!=e)return void this.fromRadix(t,e);r=2}this.t=0,this.s=0;for(var n=t.length,o=!1,s=0;--n>=0;){var f=8==r?255&t[n]:l(t,n);f<0?"-"==t.charAt(n)&&(o=!0):(o=!1,0==s?this[this.t++]=f:s+r>this.DB?(this[this.t-1]|=(f&(1<<this.DB-s)-1)<<s,this[this.t++]=f>>this.DB-s):this[this.t-1]|=f<<s,(s+=r)>=this.DB&&(s-=this.DB))}8==r&&0!=(128&t[0])&&(this.s=-1,s>0&&(this[this.t-1]|=(1<<this.DB-s)-1<<s)),this.clamp(),o&&i.ZERO.subTo(this,this)},n.clamp=function(){for(var t=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t},n.dlShiftTo=function(t,e){var r;for(r=this.t-1;r>=0;--r)e[r+t]=this[r];for(r=t-1;r>=0;--r)e[r]=0;e.t=this.t+t,e.s=this.s},n.drShiftTo=function(t,e){for(var r=t;r<this.t;++r)e[r-t]=this[r];e.t=Math.max(this.t-t,0),e.s=this.s},n.lShiftTo=function(t,e){var r,i=t%this.DB,n=this.DB-i,o=(1<<n)-1,s=Math.floor(t/this.DB),f=this.s<<i&this.DM;for(r=this.t-1;r>=0;--r)e[r+s+1]=this[r]>>n|f,f=(this[r]&o)<<i;for(r=s-1;r>=0;--r)e[r]=0;e[s]=f,e.t=this.t+s+1,e.s=this.s,e.clamp()},n.rShiftTo=function(t,e){e.s=this.s;var r=Math.floor(t/this.DB);if(r>=this.t)e.t=0;else{var i=t%this.DB,n=this.DB-i,o=(1<<i)-1;e[0]=this[r]>>i;for(var s=r+1;s<this.t;++s)e[s-r-1]|=(this[s]&o)<<n,e[s-r]=this[s]>>i;i>0&&(e[this.t-r-1]|=(this.s&o)<<n),e.t=this.t-r,e.clamp()}},n.subTo=function(t,e){for(var r=0,i=0,n=Math.min(t.t,this.t);r<n;)i+=this[r]-t[r],e[r++]=i&this.DM,i>>=this.DB;if(t.t<this.t){for(i-=t.s;r<this.t;)i+=this[r],e[r++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;r<t.t;)i-=t[r],e[r++]=i&this.DM,i>>=this.DB;i-=t.s}e.s=i<0?-1:0,i<-1?e[r++]=this.DV+i:i>0&&(e[r++]=i),e.t=r,e.clamp()},n.multiplyTo=function(t,e){var r=this.abs(),n=t.abs(),o=r.t;for(e.t=o+n.t;--o>=0;)e[o]=0;for(o=0;o<n.t;++o)e[o+r.t]=r.am(0,n[o],e,o,0,r.t);e.s=0,e.clamp(),this.s!=t.s&&i.ZERO.subTo(e,e)},n.squareTo=function(t){for(var e=this.abs(),r=t.t=2*e.t;--r>=0;)t[r]=0;for(r=0;r<e.t-1;++r){var i=e.am(r,e[r],t,2*r,0,1);(t[r+e.t]+=e.am(r+1,2*e[r],t,2*r+1,i,e.t-r-1))>=e.DV&&(t[r+e.t]-=e.DV,t[r+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(r,e[r],t,2*r,0,1)),t.s=0,t.clamp()},n.divRemTo=function(t,e,r){var n=t.abs();if(!(n.t<=0)){var o=this.abs();if(o.t<n.t)return null!=e&&e.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=new i);var s=new i,f=this.s,a=t.s,h=this.DB-p(n[n.t-1]);h>0?(n.lShiftTo(h,s),o.lShiftTo(h,r)):(n.copyTo(s),o.copyTo(r));var u=s.t,l=s[u-1];if(0!=l){var c=l*(1<<this.F1)+(u>1?s[u-2]>>this.F2:0),d=this.FV/c,g=(1<<this.F1)/c,y=1<<this.F2,b=r.t,v=b-u,m=null==e?new i:e;for(s.dlShiftTo(v,m),r.compareTo(m)>=0&&(r[r.t++]=1,r.subTo(m,r)),i.ONE.dlShiftTo(u,m),m.subTo(s,s);s.t<u;)s[s.t++]=0;for(;--v>=0;){var w=r[--b]==l?this.DM:Math.floor(r[b]*d+(r[b-1]+y)*g);if((r[b]+=s.am(0,w,r,v,0,u))<w)for(s.dlShiftTo(v,m),r.subTo(m,r);r[b]<--w;)r.subTo(m,r)}null!=e&&(r.drShiftTo(u,e),f!=a&&i.ZERO.subTo(e,e)),r.t=u,r.clamp(),h>0&&r.rShiftTo(h,r),f<0&&i.ZERO.subTo(r,r)}}},n.invDigit=function(){if(this.t<1)return 0;var t=this[0];if(0==(1&t))return 0;var e=3&t;return(e=(e=(e=(e=e*(2-(15&t)*e)&15)*(2-(255&t)*e)&255)*(2-((65535&t)*e&65535))&65535)*(2-t*e%this.DV)%this.DV)>0?this.DV-e:-e},n.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},n.exp=function(t,e){if(t>4294967295||t<1)return i.ONE;var r=new i,n=new i,o=e.convert(this),s=p(t)-1;for(o.copyTo(r);--s>=0;)if(e.sqrTo(r,n),(t&1<<s)>0)e.mulTo(n,o,r);else{var f=r;r=n,n=f}return e.revert(r)},n.toString=function(t){var e;if(this.s<0)return"-"+this.negate().toString(t);if(16==t)e=4;else if(8==t)e=3;else if(2==t)e=1;else if(32==t)e=5;else{if(4!=t)return this.toRadix(t);e=2}var r,i=(1<<e)-1,n=!1,o="",s=this.t,f=this.DB-s*this.DB%e;if(s-- >0)for(f<this.DB&&(r=this[s]>>f)>0&&(n=!0,o=u(r));s>=0;)f<e?(r=(this[s]&(1<<f)-1)<<e-f,r|=this[--s]>>(f+=this.DB-e)):(r=this[s]>>(f-=e)&i,f<=0&&(f+=this.DB,--s)),r>0&&(n=!0),n&&(o+=u(r));return n?o:"0"},n.negate=function(){var t=new i;return i.ZERO.subTo(this,t),t},n.abs=function(){return this.s<0?this.negate():this},n.compareTo=function(t){var e=this.s-t.s;if(0!=e)return e;var r=this.t;if(0!=(e=r-t.t))return this.s<0?-e:e;for(;--r>=0;)if(0!=(e=this[r]-t[r]))return e;return 0},n.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+p(this[this.t-1]^this.s&this.DM)},n.byteLength=function(){return this.bitLength()>>3},n.mod=function(t){var e=new i;return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(i.ZERO)>0&&t.subTo(e,e),e},n.modPowInt=function(t,e){var r;return r=t<256||e.isEven()?new d(e):new g(e),this.exp(t,r)},E.prototype.convert=T,E.prototype.revert=T,E.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r)},E.prototype.sqrTo=function(t,e){t.squareTo(e)},B.prototype.convert=function(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=new i;return t.copyTo(e),this.reduce(e),e},B.prototype.revert=function(t){return t},B.prototype.reduce=function(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)},B.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},B.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)};var S=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],I=(1<<26)/S[S.length-1];n.chunkSize=function(t){return Math.floor(Math.LN2*this.DB/Math.log(t))},n.toRadi