text: (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){(function(global){global.UniswapFraction=require("@uniswap/sdk").Fraction}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"@uniswap/sdk":91}],2:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.version="abi/5.0.1"},{}],3:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var bytes_1=require("@ethersproject/bytes");var properties_1=require("@ethersproject/properties");var logger_1=require("@ethersproject/logger");var _version_1=require("./_version");var logger=new logger_1.Logger(_version_1.version);var abstract_coder_1=require("./coders/abstract-coder");var address_1=require("./coders/address");var array_1=require("./coders/array");var boolean_1=require("./coders/boolean");var bytes_2=require("./coders/bytes");var fixed_bytes_1=require("./coders/fixed-bytes");var null_1=require("./coders/null");var number_1=require("./coders/number");var string_1=require("./coders/string");var tuple_1=require("./coders/tuple");var fragments_1=require("./fragments");var paramTypeBytes=new RegExp(/^bytes([0-9]*)$/);var paramTypeNumber=new RegExp(/^(u?int)([0-9]*)$/);var AbiCoder=function(){function AbiCoder(coerceFunc){var _newTarget=this.constructor;logger.checkNew(_newTarget,AbiCoder);properties_1.defineReadOnly(this,"coerceFunc",coerceFunc||null)}AbiCoder.prototype._getCoder=function(param){var _this=this;switch(param.baseType){case"address":return new address_1.AddressCoder(param.name);case"bool":return new boolean_1.BooleanCoder(param.name);case"string":return new string_1.StringCoder(param.name);case"bytes":return new bytes_2.BytesCoder(param.name);case"array":return new array_1.ArrayCoder(this._getCoder(param.arrayChildren),param.arrayLength,param.name);case"tuple":return new tuple_1.TupleCoder((param.components||[]).map(function(component){return _this._getCoder(component)}),param.name);case"":return new null_1.NullCoder(param.name)}var match=param.type.match(paramTypeNumber);if(match){var size=parseInt(match[2]||"256");if(size===0||size>256||size%8!==0){logger.throwArgumentError("invalid "+match[1]+" bit length","param",param)}return new number_1.NumberCoder(size/8,match[1]==="int",param.name)}match=param.type.match(paramTypeBytes);if(match){var size=parseInt(match[1]);if(size===0||size>32){logger.throwArgumentError("invalid bytes length","param",param)}return new fixed_bytes_1.FixedBytesCoder(size,param.name)}return logger.throwArgumentError("invalid type","type",param.type)};AbiCoder.prototype._getWordSize=function(){return 32};AbiCoder.prototype._getReader=function(data){return new abstract_coder_1.Reader(data,this._getWordSize(),this.coerceFunc)};AbiCoder.prototype._getWriter=function(){return new abstract_coder_1.Writer(this._getWordSize())};AbiCoder.prototype.encode=function(types,values){var _this=this;if(types.length!==values.length){logger.throwError("types/values length mismatch",logger_1.Logger.errors.INVALID_ARGUMENT,{count:{types:types.length,values:values.length},value:{types:types,values:values}})}var coders=types.map(function(type){return _this._getCoder(fragments_1.ParamType.from(type))});var coder=new tuple_1.TupleCoder(coders,"_");var writer=this._getWriter();coder.encode(writer,values);return writer.data};AbiCoder.prototype.decode=function(types,data){var _this=this;var coders=types.map(function(type){return _this._getCoder(fragments_1.ParamType.from(type))});var coder=new tuple_1.TupleCoder(coders,"_");return coder.decode(this._getReader(bytes_1.arrayify(data)))};return AbiCoder}();exports.AbiCoder=AbiCoder;exports.defaultAbiCoder=new AbiCoder},{"./_version":2,"./coders/abstract-coder":4,"./coders/address":5,"./coders/array":7,"./coders/boolean":8,"./coders/bytes":9,"./coders/fixed-bytes":10,"./coders/null":11,"./coders/number":12,"./coders/string":13,"./coders/tuple":14,"./fragments":15,"@ethersproject/bytes":30,"@ethersproject/logger":38,"@ethersproject/properties":42}],4:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var bytes_1=require("@ethersproject/bytes");var bignumber_1=require("@ethersproject/bignumber");var properties_1=require("@ethersproject/properties");var logger_1=require("@ethersproject/logger");var _version_1=require("../_version");var logger=new logger_1.Logger(_version_1.version);function checkResultErrors(result){var errors=[];var checkErrors=function(path,object){if(!Array.isArray(object)){return}for(var key in object){var childPath=path.slice();childPath.push(key);try{checkErrors(childPath,object[key])}catch(error){errors.push({path:childPath,error:error})}}};checkErrors([],result);return errors}exports.checkResultErrors=checkResultErrors;var Coder=function(){function Coder(name,type,localName,dynamic){this.name=name;this.type=type;this.localName=localName;this.dynamic=dynamic}Coder.prototype._throwError=function(message,value){logger.throwArgumentError(message,this.localName,value)};return Coder}();exports.Coder=Coder;var Writer=function(){function Writer(wordSize){properties_1.defineReadOnly(this,"wordSize",wordSize||32);this._data=bytes_1.arrayify([]);this._padding=new Uint8Array(wordSize)}Object.defineProperty(Writer.prototype,"data",{get:function(){return bytes_1.hexlify(this._data)},enumerable:true,configurable:true});Object.defineProperty(Writer.prototype,"length",{get:function(){return this._data.length},enumerable:true,configurable:true});Writer.prototype._writeData=function(data){this._data=bytes_1.concat([this._data,data]);return data.length};Writer.prototype.writeBytes=function(value){var bytes=bytes_1.arrayify(value);if(bytes.length%this.wordSize){bytes=bytes_1.concat([bytes,this._padding.slice(bytes.length%this.wordSize)])}return this._writeData(bytes)};Writer.prototype._getValue=function(value){var bytes=bytes_1.arrayify(bignumber_1.BigNumber.from(value));if(bytes.length>this.wordSize){logger.throwError("value out-of-bounds",logger_1.Logger.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:bytes.length})}if(bytes.length%this.wordSize){bytes=bytes_1.concat([this._padding.slice(bytes.length%this.wordSize),bytes])}return bytes};Writer.prototype.writeValue=function(value){return this._writeData(this._getValue(value))};Writer.prototype.writeUpdatableValue=function(){var _this=this;var offset=this.length;this.writeValue(0);return function(value){_this._data.set(_this._getValue(value),offset)}};return Writer}();exports.Writer=Writer;var Reader=function(){function Reader(data,wordSize,coerceFunc){properties_1.defineReadOnly(this,"_data",bytes_1.arrayify(data));properties_1.defineReadOnly(this,"wordSize",wordSize||32);properties_1.defineReadOnly(this,"_coerceFunc",coerceFunc);this._offset=0}Object.defineProperty(Reader.prototype,"data",{get:function(){return bytes_1.hexlify(this._data)},enumerable:true,configurable:true});Object.defineProperty(Reader.prototype,"consumed",{get:function(){return this._offset},enumerable:true,configurable:true});Reader.coerce=function(name,value){var match=name.match("^u?int([0-9]+)$");if(match&&parseInt(match[1])<=48){value=value.toNumber()}return value};Reader.prototype.coerce=function(name,value){if(this._coerceFunc){return this._coerceFunc(name,value)}return Reader.coerce(name,value)};Reader.prototype._peekBytes=function(offset,length){var alignedLength=Math.ceil(length/this.wordSize)*this.wordSize;if(this._offset+alignedLength>this._data.length){logger.throwError("data out-of-bounds",logger_1.Logger.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+alignedLength})}return this._data.slice(this._offset,this._offset+alignedLength)};Reader.prototype.subReader=function(offset){return new Reader(this._data.slice(this._offset+offset),this.wordSize,this._coerceFunc)};Reader.prototype.readBytes=function(length){var bytes=this._peekBytes(0,length);this._offset+=bytes.length;return bytes.slice(0,length)};Reader.prototype.readValue=function(){return bignumber_1.BigNumber.from(this.readBytes(this.wordSize))};return Reader}();exports.Reader=Reader},{"../_version":2,"@ethersproject/bignumber":28,"@ethersproject/bytes":30,"@ethersproject/logger":38,"@ethersproject/properties":42}],5:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p]};return extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();Object.defineProperty(exports,"__esModule",{value:true});var address_1=require("@ethersproject/address");var bytes_1=require("@ethersproject/bytes");var abstract_coder_1=require("./abstract-coder");var AddressCoder=function(_super){__extends(AddressCoder,_super);function AddressCoder(localName){return _super.call(this,"address","address",localName,false)||this}AddressCoder.prototype.encode=function(writer,value){try{address_1.getAddress(value)}catch(error){this._throwError(error.message,value)}return writer.writeValue(value)};AddressCoder.prototype.decode=function(reader){return address_1.getAddress(bytes_1.hexZeroPad(reader.readValue().toHexString(),20))};return AddressCoder}(abstract_coder_1.Coder);exports.AddressCoder=AddressCoder},{"./abstract-coder":4,"@ethersproject/address":23,"@ethersproject/bytes":30}],6:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p]};return extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();Object.defineProperty(exports,"__esModule",{value:true});var abstract_coder_1=require("./abstract-coder");var AnonymousCoder=function(_super){__extends(AnonymousCoder,_super);function AnonymousCoder(coder){var _this=_super.call(this,coder.name,coder.type,undefined,coder.dynamic)||this;_this.coder=coder;return _this}AnonymousCoder.prototype.encode=function(writer,value){return this.coder.encode(writer,value)};AnonymousCoder.prototype.decode=function(reader){return this.coder.decode(reader)};return AnonymousCoder}(abstract_coder_1.Coder);exports.AnonymousCoder=AnonymousCoder},{"./abstract-coder":4}],7:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p]};return extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();Object.defineProperty(exports,"__esModule",{value:true});var logger_1=require("@ethersproject/logger");var _version_1=require("../_version");var logger=new logger_1.Logger(_version_1.version);var abstract_coder_1=require("./abstract-coder");var anonymous_1=require("./anonymous");function pack(writer,coders,values){var arrayValues=null;if(Array.isArray(values)){arrayValues=values}else if(values&&typeof values==="object"){var unique_1={};arrayValues=coders.map(function(coder){var name=coder.localName;if(!name){logger.throwError("cannot encode object for signature with missing names",logger_1.Logger.errors.INVALID_ARGUMENT,{argument:"values",coder:coder,value:values})}if(unique_1[name]){logger.throwError("cannot encode object for signature with duplicate names",logger_1.Logger.errors.INVALID_ARGUMENT,{argument:"values",coder:coder,value:values})}unique_1[name]=true;return values[name]})}else{logger.throwArgumentError("invalid tuple value","tuple",values)}if(coders.length!==arrayValues.length){logger.throwArgumentError("types/value length mismatch","tuple",values)}var staticWriter=new abstract_coder_1.Writer(writer.wordSize);var dynamicWriter=new abstract_coder_1.Writer(writer.wordSize);var updateFuncs=[];coders.forEach(function(coder,index){var value=arrayValues[index];if(coder.dynamic){var dynamicOffset_1=dynamicWriter.length;coder.encode(dynamicWriter,value);var updateFunc_1=staticWriter.writeUpdatableValue();updateFuncs.push(function(baseOffset){updateFunc_1(baseOffset+dynamicOffset_1)})}else{coder.encode(staticWriter,value)}});updateFuncs.forEach(function(func){func(staticWriter.length)});var length=writer.writeBytes(staticWriter.data);length+=writer.writeBytes(dynamicWriter.data);return length}exports.pack=pack;function unpack(reader,coders){var values=[];var baseReader=reader.subReader(0);var dynamicLength=0;coders.forEach(function(coder){var value=null;if(coder.dynamic){var offset=reader.readValue();var offsetReader=baseReader.subReader(offset.toNumber());try{value=coder.decode(offsetReader)}catch(error){if(error.code===logger_1.Logger.errors.BUFFER_OVERRUN){throw error}value=error;value.baseType=coder.name;value.name=coder.localName;value.type=coder.type}dynamicLength+=offsetReader.consumed}else{try{value=coder.decode(reader)}catch(error){if(error.code===logger_1.Logger.errors.BUFFER_OVERRUN){throw error}value=error;value.baseType=coder.name;value.name=coder.localName;value.type=coder.type}}if(value!=undefined){values.push(value)}});reader.readBytes(dynamicLength);var uniqueNames=coders.reduce(function(accum,coder){var name=coder.localName;if(name){if(!accum[name]){accum[name]=0}accum[name]++}return accum},{});coders.forEach(function(coder,index){var name=coder.localName;if(!name||uniqueNames[name]!==1){return}if(name==="length"){name="_length"}if(values[name]!=null){return}var value=values[index];if(value instanceof Error){Object.defineProperty(values,name,{get:function(){throw value}})}else{values[name]=value}});var _loop_1=function(i){var value=values[i];if(value instanceof Error){Object.defineProperty(values,i,{get:function(){throw value}})}};for(var i=0;i<values.length;i++){_loop_1(i)}return Object.freeze(values)}exports.unpack=unpack;var ArrayCoder=function(_super){__extends(ArrayCoder,_super);function ArrayCoder(coder,length,localName){var _this=this;var type=coder.type+"["+(length>=0?length:"")+"]";var dynamic=length===-1||coder.dynamic;_this=_super.call(this,"array",type,localName,dynamic)||this;_this.coder=coder;_this.length=length;return _this}ArrayCoder.prototype.encode=function(writer,value){if(!Array.isArray(value)){this._throwError("expected array value",value)}var count=this.length;if(count===-1){count=value.length;writer.writeValue(value.length)}logger.checkArgumentCount(count,value.length,"coder array"+(this.localName?" "+this.localName:""));var coders=[];for(var i=0;i<value.length;i++){coders.push(this.coder)}return pack(writer,coders,value)};ArrayCoder.prototype.decode=function(reader){var count=this.length;if(count===-1){count=reader.readValue().toNumber()}var coders=[];for(var i=0;i<count;i++){coders.push(new anonymous_1.AnonymousCoder(this.coder))}return reader.coerce(this.name,unpack(reader,coders))};return ArrayCoder}(abstract_coder_1.Coder);exports.ArrayCoder=ArrayCoder},{"../_version":2,"./abstract-coder":4,"./anonymous":6,"@ethersproject/logger":38}],8:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p]};return extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();Object.defineProperty(exports,"__esModule",{value:true});var abstract_coder_1=require("./abstract-coder");var BooleanCoder=function(_super){__extends(BooleanCoder,_super);function BooleanCoder(localName){return _super.call(this,"bool","bool",localName,false)||this}BooleanCoder.prototype.encode=function(writer,value){return writer.writeValue(value?1:0)};BooleanCoder.prototype.decode=function(reader){return reader.coerce(this.type,!reader.readValue().isZero())};return BooleanCoder}(abstract_coder_1.Coder);exports.BooleanCoder=BooleanCoder},{"./abstract-coder":4}],9:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p]};return extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();Object.defineProperty(exports,"__esModule",{value:true});var bytes_1=require("@ethersproject/bytes");var abstract_coder_1=require("./abstract-coder");var DynamicBytesCoder=function(_super){__extends(DynamicBytesCoder,_super);function DynamicBytesCoder(type,localName){return _super.call(this,type,type,localName,true)||this}DynamicBytesCoder.prototype.encode=function(writer,value){value=bytes_1.arrayify(value);var length=writer.writeValue(value.length);length+=writer.writeBytes(value);return length};DynamicBytesCoder.prototype.decode=function(reader){return reader.readBytes(reader.readValue().toNumber())};return DynamicBytesCoder}(abstract_coder_1.Coder);exports.DynamicBytesCoder=DynamicBytesCoder;var BytesCoder=function(_super){__extends(BytesCoder,_super);function BytesCoder(localName){return _super.call(this,"bytes",localName)||this}BytesCoder.prototype.decode=function(reader){return reader.coerce(this.name,bytes_1.hexlify(_super.prototype.decode.call(this,reader)))};return BytesCoder}(DynamicBytesCoder);exports.BytesCoder=BytesCoder},{"./abstract-coder":4,"@ethersproject/bytes":30}],10:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p]};return extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();Object.defineProperty(exports,"__esModule",{value:true});var bytes_1=require("@ethersproject/bytes");var abstract_coder_1=require("./abstract-coder");var FixedBytesCoder=function(_super){__extends(FixedBytesCoder,_super);function FixedBytesCoder(size,localName){var _this=this;var name="bytes"+String(size);_this=_super.call(this,name,name,localName,false)||this;_this.size=size;return _this}FixedBytesCoder.prototype.encode=function(writer,value){var data=bytes_1.arrayify(value);if(data.length!==this.size){this._throwError("incorrect data length",value)}return writer.writeBytes(data)};FixedBytesCoder.prototype.decode=function(reader){return reader.coerce(this.name,bytes_1.hexlify(reader.readBytes(this.size)))};return FixedBytesCoder}(abstract_coder_1.Coder);exports.FixedBytesCoder=FixedBytesCoder},{"./abstract-coder":4,"@ethersproject/bytes":30}],11:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p]};return extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();Object.defineProperty(exports,"__esModule",{value:true});var abstract_coder_1=require("./abstract-coder");var NullCoder=function(_super){__extends(NullCoder,_super);function NullCoder(localName){return _super.call(this,"null","",localName,false)||this}NullCoder.prototype.encode=function(writer,value){if(value!=null){this._throwError("not null",value)}return writer.writeBytes([])};NullCoder.prototype.decode=function(reader){reader.readBytes(0);return reader.coerce(this.name,null)};return NullCoder}(abstract_coder_1.Coder);exports.NullCoder=NullCoder},{"./abstract-coder":4}],12:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p]};return extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();Object.defineProperty(exports,"__esModule",{value:true});var bignumber_1=require("@ethersproject/bignumber");var constants_1=require("@ethersproject/constants");var abstract_coder_1=require("./abstract-coder");var NumberCoder=function(_super){__extends(NumberCoder,_super);function NumberCoder(size,signed,localName){var _this=this;var name=(signed?"int":"uint")+size*8;_this=_super.call(this,name,name,localName,false)||this;_this.size=size;_this.signed=signed;return _this}NumberCoder.prototype.encode=function(writer,value){var v=bignumber_1.BigNumber.from(value);var maxUintValue=constants_1.MaxUint256.mask(writer.wordSize*8);if(this.signed){var bounds=maxUintValue.mask(this.size*8-1);if(v.gt(bounds)||v.lt(bounds.add(constants_1.One).mul(constants_1.NegativeOne))){this._throwError("value out-of-bounds",value)}}else if(v.lt(constants_1.Zero)||v.gt(maxUintValue.mask(this.size*8))){this._throwError("value out-of-bounds",value)}v=v.toTwos(this.size*8).mask(this.size*8);if(this.signed){v=v.fromTwos(this.size*8).toTwos(8*writer.wordSize)}return writer.writeValue(v)};NumberCoder.prototype.decode=function(reader){var value=reader.readValue().mask(this.size*8);if(this.signed){value=value.fromTwos(this.size*8)}return reader.coerce(this.name,value)};return NumberCoder}(abstract_coder_1.Coder);exports.NumberCoder=NumberCoder},{"./abstract-coder":4,"@ethersproject/bignumber":28,"@ethersproject/constants":31}],13:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p]};return extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();Object.defineProperty(exports,"__esModule",{value:true});var strings_1=require("@ethersproject/strings");var bytes_1=require("./bytes");var StringCoder=function(_super){__extends(StringCoder,_super);function StringCoder(localName){return _super.call(this,"string",localName)||this}StringCoder.prototype.encode=function(writer,value){return _super.prototype.encode.call(this,writer,strings_1.toUtf8Bytes(value))};StringCoder.prototype.decode=function(reader){return strings_1.toUtf8String(_super.prototype.decode.call(this,reader))};return StringCoder}(bytes_1.DynamicBytesCoder);exports.StringCoder=StringCoder},{"./bytes":9,"@ethersproject/strings":84}],14:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p]};return extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();Object.defineProperty(exports,"__esModule",{value:true});var abstract_coder_1=require("./abstract-coder");var array_1=require("./array");var TupleCoder=function(_super){__extends(TupleCoder,_super);function TupleCoder(coders,localName){var _this=this;var dynamic=false;var types=[];coders.forEach(function(coder){if(coder.dynamic){dynamic=true}types.push(coder.type)});var type="tuple("+types.join(",")+")";_this=_super.call(this,"tuple",type,localName,dynamic)||this;_this.coders=coders;return _this}TupleCoder.prototype.encode=function(writer,value){return array_1.pack(writer,this.coders,value)};TupleCoder.prototype.decode=function(reader){return reader.coerce(this.name,array_1.unpack(reader,this.coders))};return TupleCoder}(abstract_coder_1.Coder);exports.TupleCoder=TupleCoder},{"./abstract-coder":4,"./array":7}],15:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p]};return extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();Object.defineProperty(exports,"__esModule",{value:true});var bignumber_1=require("@ethersproject/bignumber");var properties_1=require("@ethersproject/properties");var logger_1=require("@ethersproject/logger");var _version_1=require("./_version");var logger=new logger_1.Logger(_version_1.version);var _constructorGuard={};var ModifiersBytes={calldata:true,memory:true,storage:true};var ModifiersNest={calldata:true,memory:true};function checkModifier(type,name){if(type==="bytes"||type==="string"){if(ModifiersBytes[name]){return true}}else if(type==="address"){if(name==="payable"){return true}}else if(type.indexOf("[")>=0||type==="tuple"){if(ModifiersNest[name]){return true}}if(ModifiersBytes[name]||name==="payable"){logger.throwArgumentError("invalid modifier","name",name)}return false}function parseParamType(param,allowIndexed){var originalParam=param;function throwError(i){logger.throwArgumentError("unexpected character at position "+i,"param",param)}param=param.replace(/\s/g," ");function newNode(parent){var node={type:"",name:"",parent:parent,state:{allowType:true}};if(allowIndexed){node.indexed=false}return node}var parent={type:"",name:"",state:{allowType:true}};var node=parent;for(var i=0;i<param.length;i++){var c=param[i];switch(c){case"(":if(node.state.allowType&&node.type===""){node.type="tuple"}else if(!node.state.allowParams){throwError(i)}node.state.allowType=false;node.type=verifyType(node.type);node.components=[newNode(node)];node=node.components[0];break;case")":delete node.state;if(node.name==="indexed"){if(!allowIndexed){throwError(i)}node.indexed=true;node.name=""}if(checkModifier(node.type,node.name)){node.name=""}node.type=verifyType(node.type);var child=node;node=node.parent;if(!node){throwError(i)}delete child.parent;node.state.allowParams=false;node.state.allowName=true;node.state.allowArray=true;break;case",":delete node.state;if(node.name==="indexed"){if(!allowIndexed){throwError(i)}node.indexed=true;node.name=""}if(checkModifier(node.type,node.name)){node.name=""}node.type=verifyType(node.type);var sibling=newNode(node.parent);node.parent.components.push(sibling);delete node.parent;node=sibling;break;case" ":if(node.state.allowType){if(node.type!==""){node.type=verifyType(node.type);delete node.state.allowType;node.state.allowName=true;node.state.allowParams=true}}if(node.state.allowName){if(node.name!==""){if(node.name==="indexed"){if(!allowIndexed){throwError(i)}if(node.indexed){throwError(i)}node.indexed=true;node.name=""}else if(checkModifier(node.type,node.name)){node.name=""}else{node.state.allowName=false}}}break;case"[":if(!node.state.allowArray){throwError(i)}node.type+=c;node.state.allowArray=false;node.state.allowName=false;node.state.readArray=true;break;case"]":if(!node.state.readArray){throwError(i)}node.type+=c;node.state.readArray=false;node.state.allowArray=true;node.state.allowName=true;break;default:if(node.state.allowType){node.type+=c;node.state.allowParams=true;node.state.allowArray=true}else if(node.state.allowName){node.name+=c;delete node.state.allowArray}else if(node.state.readArray){node.type+=c}else{throwError(i)}}}if(node.parent){logger.throwArgumentError("unexpected eof","param",param)}delete parent.state;if(node.name==="indexed"){if(!allowIndexed){throwError(originalParam.length-7)}if(node.indexed){throwError(originalParam.length-7)}node.indexed=true;node.name=""}else if(checkModifier(node.type,node.name)){node.name=""}parent.type=verifyType(parent.type);return parent}function populate(object,params){for(var key in params){properties_1.defineReadOnly(object,key,params[key])}}exports.FormatTypes=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"});var paramTypeArray=new RegExp(/^(.*)\[([0-9]*)\]$/);var ParamType=function(){function ParamType(constructorGuard,params){if(constructorGuard!==_constructorGuard){logger.throwError("use fromString",logger_1.Logger.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"})}populate(this,params);var match=this.type.match(paramTypeArray);if(match){populate(this,{arrayLength:parseInt(match[2]||"-1"),arrayChildren:ParamType.fromObject({type:match[1],components:this.components}),baseType:"array"})}else{populate(this,{arrayLength:null,arrayChildren:null,baseType:this.components!=null?"tuple":this.type})}this._isParamType=true;Object.freeze(this)}ParamType.prototype.format=function(format){if(!format){format=exports.FormatTypes.sighash}if(!exports.FormatTypes[format]){logger.throwArgumentError("invalid format type","format",format)}if(format===exports.FormatTypes.json){var result_1={type:this.baseType==="tuple"?"tuple":this.type,name:this.name||undefined};if(typeof this.indexed==="boolean"){result_1.indexed=this.indexed}if(this.components){result_1.components=this.components.map(function(comp){return JSON.parse(comp.format(format))})}return JSON.stringify(result_1)}var result="";if(this.baseType==="array"){result+=this.arrayChildren.format(format);result+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"}else{if(this.baseType==="tuple"){if(format!==exports.FormatTypes.sighash){result+=this.type}result+="("+this.components.map(function(comp){return comp.format(format)}).join(format===exports.FormatTypes.full?", ":",")+")"}else{result+=this.type}}if(format!==exports.FormatTypes.sighash){if(this.indexed===true){result+=" indexed"}if(format===exports.FormatTypes.full&&this.name){result+=" "+this.name}}return result};ParamType.from=function(value,allowIndexed){if(typeof value==="string"){return ParamType.fromString(value,allowIndexed)}return ParamType.fromObject(value)};ParamType.fromObject=function(value){if(ParamType.isParamType(value)){return value}return new ParamType(_constructorGuard,{name:value.name||null,type:verifyType(value.type),indexed:value.indexed==null?null:!!value.indexed,components:value.components?value.components.map(ParamType.fromObject):null})};ParamType.fromString=function(value,allowIndexed){function ParamTypify(node){return ParamType.fromObject({name:node.name,type:node.type,indexed:node.indexed,components:node.components})}return ParamTypify(parseParamType(value,!!allowIndexed))};ParamType.isParamType=function(value){return!!(value!=null&&value._isParamType)};return ParamType}();exports.ParamType=ParamType;function parseParams(value,allowIndex){return splitNesting(value).map(function(param){return ParamType.fromString(param,allowIndex)})}var Fragment=function(){function Fragment(constructorGuard,params){if(constructorGuard!==_constructorGuard){logger.throwError("use a static from method",logger_1.Logger.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"})}populate(this,params);this._isFragment=true;Object.freeze(this)}Fragment.from=function(value){if(Fragment.isFragment(value)){return value}if(typeof value==="string"){return Fragment.fromString(value)}return Fragment.fromObject(value)};Fragment.fromObject=function(value){if(Fragment.isFragment(value)){return value}switch(value.type){case"function":return FunctionFragment.fromObject(value);case"event":return EventFragment.fromObject(value);case"constructor":return ConstructorFragment.fromObject(value);case"fallback":case"receive":return null}return logger.throwArgumentError("invalid fragment object","value",value)};Fragment.fromString=function(value){value=value.replace(/\s/g," ");value=value.replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," ");value=value.trim();if(value.split(" ")[0]==="event"){return EventFragment.fromString(value.substring(5).trim())}else if(value.split(" ")[0]==="function"){return FunctionFragment.fromString(value.substring(8).trim())}else if(value.split("(")[0].trim()==="constructor"){return ConstructorFragment.fromString(value.trim())}return logger.throwArgumentError("unsupported fragment","value",value)};Fragment.isFragment=function(value){return!!(value&&value._isFragment)};return Fragment}();exports.Fragment=Fragment;var EventFragment=function(_super){__extends(EventFragment,_super);function EventFragment(){return _super!==null&&_super.apply(this,arguments)||this}EventFragment.prototype.format=function(format){if(!format){format=exports.FormatTypes.sighash}if(!exports.FormatTypes[format]){logger.throwArgumentError("invalid format type","format",format)}if(format===exports.FormatTypes.json){return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(function(input){return JSON.parse(input.format(format))})})}var result="";if(format!==exports.FormatTypes.sighash){result+="event "}result+=this.name+"("+this.inputs.map(function(input){return input.format(format)}).join(format===exports.FormatTypes.full?", ":",")+") ";if(format!==exports.FormatTypes.sighash){if(this.anonymous){result+="anonymous "}}return result.trim()};EventFragment.from=function(value){if(typeof value==="string"){return EventFragment.fromString(value)}return EventFragment.fromObject(value)};EventFragment.fromObject=function(value){if(EventFragment.isEventFragment(value)){return value}if(value.type!=="event"){logger.throwArgumentError("invalid event object","value",value)}var params={name:verifyIdentifier(value.name),anonymous:value.anonymous,inputs:value.inputs?value.inputs.map(ParamType.fromObject):[],type:"event"};return new EventFragment(_constructorGuard,params)};EventFragment.fromString=function(value){var match=value.match(regexParen);if(!match){logger.throwArgumentError("invalid event string","value",value)}var anonymous=false;match[3].split(" ").forEach(function(modifier){switch(modifier.trim()){case"anonymous":anonymous=true;break;case"":break;default:logger.warn("unknown modifier: "+modifier)}});return EventFragment.fromObject({name:match[1].trim(),anonymous:anonymous,inputs:parseParams(match[2],true),type:"event"})};EventFragment.isEventFragment=function(value){return value&&value._isFragment&&value.type==="event"};return EventFragment}(Fragment);exports.EventFragment=EventFragment;function parseGas(value,params){params.gas=null;var comps=value.split("@");if(comps.length!==1){if(comps.length>2){logger.throwArgumentError("invalid human-readable ABI signature","value",value)}if(!comps[1].match(/^[0-9]+$/)){logger.throwArgumentError("invalid human-readable ABI signature gas","value",value)}params.gas=bignumber_1.BigNumber.from(comps[1]);return comps[0]}return value}function parseModifiers(value,params){params.constant=false;params.payable=false;params.stateMutability="nonpayable";value.split(" ").forEach(function(modifier){switch(modifier.trim()){case"constant":params.constant=true;break;case"payable":params.payable=true;params.stateMutability="payable";break;case"nonpayable":params.payable=false;params.stateMutability="nonpayable";break;case"pure":params.constant=true;params.stateMutability="pure";break;case"view":params.constant=true;params.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+modifier)}})}function verifyState(value){var result={constant:false,payable:true,stateMutability:"payable"};if(value.stateMutability!=null){result.stateMutability=value.stateMutability;result.constant=result.stateMutability==="view"||result.stateMutability==="pure";if(value.constant!=null){if(!!value.constant!==result.constant){logger.throwArgumentError("cannot have constant function with mutability "+result.stateMutability,"value",value)}}result.payable=result.stateMutability==="payable";if(value.payable!=null){if(!!value.payable!==result.payable){logger.throwArgumentError("cannot have payable function with mutability "+result.stateMutability,"value",value)}}}else if(value.payable!=null){result.payable=!!value.payable;if(value.constant==null&&!result.payable&&value.type!=="constructor"){logger.throwArgumentError("unable to determine stateMutability","value",value)}result.constant=!!value.constant;if(result.constant){result.stateMutability="view"}else{result.stateMutability=result.payable?"payable":"nonpayable"}if(result.payable&&result.constant){logger.throwArgumentError("cannot have constant payable function","value",value)}}else if(value.constant!=null){result.constant=!!value.constant;result.payable=!result.constant;result.stateMutability=result.constant?"view":"payable"}else if(value.type!=="constructor"){logger.throwArgumentError("unable to determine stateMutability","value",value)}return result}var ConstructorFragment=function(_super){__extends(ConstructorFragment,_super);function ConstructorFragment(){return _super!==null&&_super.apply(this,arguments)||this}ConstructorFragment.prototype.format=function(format){if(!format){format=exports.FormatTypes.sighash}if(!exports.FormatTypes[format]){logger.throwArgumentError("invalid format type","format",format)}if(format===exports.FormatTypes.json){return JSON.stringify({type:"constructor",stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:undefined,payble:this.payable,gas:this.gas?this.gas.toNumber():undefined,inputs:this.inputs.map(function(input){return JSON.parse(input.format(format))})})}if(format===exports.FormatTypes.sighash){logger.throwError("cannot format a constructor for sighash",logger_1.Logger.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"})}var result="constructor("+this.inputs.map(function(input){return input.format(format)}).join(format===exports.FormatTypes.full?", ":",")+") ";if(this.stateMutability&&this.stateMutability!=="nonpayable"){result+=this.stateMutability+" "}return result.trim()};ConstructorFragment.from=function(value){if(typeof value==="string"){return ConstructorFragment.fromString(value)}return ConstructorFragment.fromObject(value)};ConstructorFragment.fromObject=function(value){if(ConstructorFragment.isConstructorFragment(value)){return value}if(value.type!=="constructor"){logger.throwArgumentError("invalid constructor object","value",value)}var state=verifyState(value);if(state.constant){logger.throwArgumentError("constructor cannot be constant","value",value)}var params={name:null,type:value.type,inputs:value.inputs?value.inputs.map(ParamType.fromObject):[],payable:state.payable,stateMutability:state.stateMutability,gas:value.gas?bignumber_1.BigNumber.from(value.gas):null};return new ConstructorFragment(_constructorGuard,params)};ConstructorFragment.fromString=function(value){var params={type:"constructor"};value=parseGas(value,params);var parens=value.match(regexParen);if(!parens||parens[1].trim()!=="constructor"){logger.throwArgumentError("invalid constructor string","value",value)}params.inputs=parseParams(parens[2].trim(),false);parseModifiers(parens[3].trim(),params);return ConstructorFragment.fromObject(params)};ConstructorFragment.isConstructorFragment=function(value){return value&&value._isFragment&&value.type==="constructor"};return ConstructorFragment}(Fragment);exports.ConstructorFragment=ConstructorFragment;var FunctionFragment=function(_super){__extends(FunctionFragment,_super);function FunctionFragment(){return _super!==null&&_super.apply(this,arguments)||this}FunctionFragment.prototype.format=function(format){if(!format){format=exports.FormatTypes.sighash}if(!exports.FormatTypes[format]){logger.throwArgumentError("invalid format type","format",format)}if(format===exports.FormatTypes.json){return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:undefined,payble:this.payable,gas:this.gas?this.gas.toNumber():undefined,inputs:this.inputs.map(function(input){return JSON.parse(input.format(format))}),ouputs:this.outputs.map(function(output){return JSON.parse(output.format(format))})})}var result="";if(format!==exports.FormatTypes.sighash){result+="function "}result+=this.name+"("+this.inputs.map(function(input){return input.format(format)}).join(format===exports.FormatTypes.full?", ":",")+") ";if(format!==exports.FormatTypes.sighash){if(this.stateMutability){if(this.stateMutability!=="nonpayable"){result+=this.stateMutability+" "}}else if(this.constant){result+="view "}if(this.outputs&&this.outputs.length){result+="returns ("+this.outputs.map(function(output){return output.format(format)}).join(", ")+") "}if(this.gas!=null){result+="@"+this.gas.toString()+" "}}return result.trim()};FunctionFragment.from=function(value){if(typeof value==="string"){return FunctionFragment.fromString(value)}return FunctionFragment.fromObject(value)};FunctionFragment.fromObject=function(value){if(FunctionFragment.isFunctionFragment(value)){return value}if(value.type!=="function"){logger.throwArgumentError("invalid function object","value",value)}var state=verifyState(value);var params={type:value.type,name:verifyIdentifier(value.name),constant:state.constant,inputs:value.inputs?value.inputs.map(ParamType.fromObject):[],outputs:value.outputs?value.outputs.map(ParamType.fromObject):[],payable:state.payable,stateMutability:state.stateMutability,gas:value.gas?bignumber_1.BigNumber.from(value.gas):null};return new FunctionFragment(_constructorGuard,params)};FunctionFragment.fromString=function(value){var params={type:"function"};value=parseGas(value,params);var comps=value.split(" returns ");if(comps.length>2){logger.throwArgumentError("invalid function string","value",value)}var parens=comps[0].match(regexParen);if(!parens){logger.throwArgumentError("invalid function signature","value",value)}params.name=parens[1].trim();if(params.name){verifyIdentifier(params.name)}params.inputs=parseParams(parens[2],false);parseModifiers(parens[3].trim(),params);if(comps.length>1){var returns=comps[1].match(regexParen);if(returns[1].trim()!=""||returns[3].trim()!=""){logger.throwArgumentError("unexpected tokens","value",value)}params.outputs=parseParams(returns[2],false)}else{params.outputs=[]}return FunctionFragment.fromObject(params)};FunctionFragment.isFunctionFragment=function(value){return value&&value._isFragment&&value.type==="function"};return FunctionFragment}(ConstructorFragment);exports.FunctionFragment=FunctionFragment;function verifyType(type){if(type.match(/^uint($|[^1-9])/)){type="uint256"+type.substring(4)}else if(type.match(/^int($|[^1-9])/)){type="int256"+type.substring(3)}return type}var regexIdentifier=new RegExp("^[A-Za-z_][A-Za-z0-9_]*$");function verifyIdentifier(value){if(!value||!value.match(regexIdentifier)){logger.throwArgumentError('invalid identifier "'+value+'"',"value",value)}return value}var regexParen=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");function splitNesting(value){value=value.trim();var result=[];var accum="";var depth=0;for(var offset=0;offset<value.length;offset++){var c=value[offset];if(c===","&&depth===0){result.push(accum);accum=""}else{accum+=c;if(c==="("){depth++}else if(c===")"){depth--;if(depth===-1){logger.throwArgumentError("unbalanced parenthesis","value",value)}}}}if(accum){result.push(accum)}return result}},{"./_version":2,"@ethersproject/bignumber":28,"@ethersproject/logger":38,"@ethersproject/properties":42}],16:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var fragments_1=require("./fragments");exports.ConstructorFragment=fragments_1.ConstructorFragment;exports.EventFragment=fragments_1.EventFragment;exports.FormatTypes=fragments_1.FormatTypes;exports.Fragment=fragments_1.Fragment;exports.FunctionFragment=fragments_1.FunctionFragment;exports.ParamType=fragments_1.ParamType;var abi_coder_1=require("./abi-coder");exports.AbiCoder=abi_coder_1.AbiCoder;exports.defaultAbiCoder=abi_coder_1.defaultAbiCoder;var interface_1=require("./interface");exports.checkResultErrors=interface_1.checkResultErrors;exports.Indexed=interface_1.Indexed;exports.Interface=interface_1.Interface;exports.LogDescription=interface_1.LogDescription;exports.TransactionDescription=interface_1.TransactionDescription},{"./abi-coder":3,"./fragments":15,"./interface":17}],17:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p]};return extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();Object.defineProperty(exports,"__esModule",{value:true});var address_1=require("@ethersproject/address");var bignumber_1=require("@ethersproject/bignumber");var bytes_1=require("@ethersproject/bytes");var hash_1=require("@ethersproject/hash");var keccak256_1=require("@ethersproject/keccak256");var properties_1=require("@ethersproject/properties");var abi_coder_1=require("./abi-coder");var abstract_coder_1=require("./coders/abstract-coder");exports.checkResultErrors=abstract_coder_1.checkResultErrors;var fragments_1=require("./fragments");var logger_1=require("@ethersproject/logger");var _version_1=require("./_version");var logger=new logger_1.Logger(_version_1.version);var LogDescription=function(_super){__extends(LogDescription,_super);function LogDescription(){return _super!==null&&_super.apply(this,arguments)||this}return LogDescription}(properties_1.Description);exports.LogDescription=LogDescription;var TransactionDescription=function(_super){__extends(TransactionDescription,_super);function TransactionDescription(){return _super!==null&&_super.apply(this,arguments)||this}return TransactionDescription}(properties_1.Description);exports.TransactionDescription=TransactionDescription;var Indexed=function(_super){__extends(Indexed,_super);function Indexed(){return _super!==null&&_super.apply(this,arguments)||this}Indexed.isIndexed=function(value){return!!(value&&value._isIndexed)};return Indexed}(properties_1.Description);exports.Indexed=Indexed;function wrapAccessError(property,error){var wrap=new Error("deferred error during ABI decoding triggered accessing "+property);wrap.error=error;return wrap}var Interface=function(){function Interface(fragments){var _newTarget=this.constructor;var _this=this;logger.checkNew(_newTarget,Interface);var abi=[];if(typeof fragments==="string"){abi=JSON.parse(fragments)}else{abi=fragments}properties_1.defineReadOnly(this,"fragments",abi.map(function(fragment){return fragments_1.Fragment.from(fragment)}).filter(function(fragment){return fragment!=null}));properties_1.defineReadOnly(this,"_abiCoder",properties_1.getStatic(_newTarget,"getAbiCoder")());properties_1.defineReadOnly(this,"functions",{});properties_1.defineReadOnly(this,"errors",{});properties_1.defineReadOnly(this,"events",{});properties_1.defineReadOnly(this,"structs",{});this.fragments.forEach(function(fragment){var bucket=null;switch(fragment.type){case"constructor":if(_this.deploy){logger.warn("duplicate definition - constructor");return}properties_1.defineReadOnly(_this,"deploy",fragment);return;case"function":bucket=_this.functions;break;case"event":bucket=_this.events;break;default:return}var signature=fragment.format();if(bucket[signature]){logger.warn("duplicate definition - "+signature);return}bucket[signature]=fragment});if(!this.deploy){properties_1.defineReadOnly(this,"deploy",fragments_1.ConstructorFragment.from({payable:false,type:"constructor"}))}properties_1.defineReadOnly(this,"_isInterface",true)}Interface.prototype.format=function(format){if(!format){format=fragments_1.FormatTypes.full}if(format===fragments_1.FormatTypes.sighash){logger.throwArgumentError("interface does not support formatting sighash","format",format)}var abi=this.fragments.map(function(fragment){return fragment.format(format)});if(format===fragments_1.FormatTypes.json){return JSON.stringify(abi.map(function(j){return JSON.parse(j)}))}return abi};Interface.getAbiCoder=function(){return abi_coder_1.defaultAbiCoder};Interface.getAddress=function(address){return address_1.getAddress(address)};Interface.getSighash=function(functionFragment){return bytes_1.hexDataSlice(hash_1.id(functionFragment.format()),0,4)};Interface.getEventTopic=function(eventFragment){return hash_1.id(eventFragment.format())};Interface.prototype.getFunction=function(nameOrSignatureOrSighash){if(bytes_1.isHexString(nameOrSignatureOrSighash)){for(var name_1 in this.functions){if(nameOrSignatureOrSighash===this.getSighash(name_1)){return this.functions[name_1]}}logger.throwArgumentError("no matching function","sighash",nameOrSignatureOrSighash)}if(nameOrSignatureOrSighash.indexOf("(")===-1){var name_2=nameOrSignatureOrSighash.trim();var matching=Object.keys(this.functions).filter(function(f){return f.split("(")[0]===name_2});if(matching.length===0){logger.throwArgumentError("no matching function","name",name_2)}else if(matching.length>1){logger.throwArgumentError("multiple matching functions","name",name_2)}return this.functions[matching[0]]}var result=this.functions[fragments_1.FunctionFragment.fromString(nameOrSignatureOrSighash).format()];if(!result){logger.throwArgumentError("no matching function","signature",nameOrSignatureOrSighash)}return result};Interface.prototype.getEvent=function(nameOrSignatureOrTopic){if(bytes_1.isHexString(nameOrSignatureOrTopic)){var topichash=nameOrSignatureOrTopic.toLowerCase();for(var name_3 in this.events){if(topichash===this.getEventTopic(name_3)){return this.events[name_3]}}logger.throwArgumentError("no matching event","topichash",topichash)}if(nameOrSignatureOrTopic.indexOf("(")===-1){var name_4=nameOrSignatureOrTopic.trim();var matching=Object.keys(this.events).filter(function(f){return f.split("(")[0]===name_4});if(matching.length===0){logger.throwArgumentError("no matching event","name",name_4)}else if(matching.length>1){logger.throwArgumentError("multiple matching events","name",name_4)}return this.events[matching[0]]}var result=this.events[fragments_1.EventFragment.fromString(nameOrSignatureOrTopic).format()];if(!result){logger.throwArgumentError("no matching event","signature",nameOrSignatureOrTopic)}return result};Interface.prototype.getSighash=function(functionFragment){if(typeof functionFragment==="string"){functionFragment=this.getFunction(functionFragment)}return properties_1.getStatic(this.constructor,"getSighash")(functionFragment)};Interface.prototype.getEventTopic=function(eventFragment){if(typeof eventFragment==="string"){eventFragment=this.getEvent(eventFragment)}return properties_1.getStatic(this.constructor,"getEventTopic")(eventFragment)};Interface.prototype._decodeParams=function(params,data){return this._abiCoder.decode(params,data)};Interface.prototype._encodeParams=function(params,values){return this._abiCoder.encode(params,values)};Interface.prototype.encodeDeploy=function(values){return this._encodeParams(this.deploy.inputs,values||[])};Interface.prototype.decodeFunctionData=function(functionFragment,data){if(typeof functionFragment==="string"){functionFragment=this.getFunction(functionFragment)}var bytes=bytes_1.arrayify(data);if(bytes_1.hexlify(bytes.slice(0,4))!==this.getSighash(functionFragment)){logger.throwArgumentError("data signature does not match function "+functionFragment.name+".","data",bytes_1.hexlify(bytes))}return this._decodeParams(functionFragment.inputs,bytes.slice(4))};Interface.prototype.encodeFunctionData=function(functionFragment,values){if(typeof functionFragment==="string"){functionFragment=this.getFunction(functionFragment)}return bytes_1.hexlify(bytes_1.concat([this.getSighash(functionFragment),this._encodeParams(functionFragment.inputs,values||[])]))};Interface.prototype.decodeFunctionResult=function(functionFragment,data){if(typeof functionFragment==="string"){functionFragment=this.getFunction(functionFragment)}var bytes=bytes_1.arrayify(data);var reason=null;var errorSignature=null;switch(bytes.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(functionFragment.outputs,bytes)}catch(error){}break;case 4:if(bytes_1.hexlify(bytes.slice(0,4))==="0x08c379a0"){errorSignature="Error(string)";reason=this._abiCoder.decode(["string"],bytes.slice(4))[0]}break}return logger.throwError("call revert exception",logger_1.Logger.errors.CALL_EXCEPTION,{method:functionFragment.format(),errorSignature:errorSignature,errorArgs:[reason],reason:reason})};Interface.prototype.encodeFunctionResult=function(functionFragment,values){if(typeof functionFragment==="string"){functionFragment=this.getFunction(functionFragment)}return bytes_1.hexlify(this._abiCoder.encode(functionFragment.outputs,values||[]))};Interface.prototype.encodeFilterTopics=function(eventFragment,values){var _this=this;if(typeof eventFragment==="string"){eventFragment=this.getEvent(eventFragment)}if(values.length>eventFragment.inputs.length){logger.throwError("too many arguments for "+eventFragment.format(),logger_1.Logger.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:values})}var topics=[];if(!eventFragment.anonymous){topics.push(this.getEventTopic(eventFragment))}var encodeTopic=function(param,value){if(param.type==="string"){return hash_1.id(value)}else if(param.type==="bytes"){return keccak256_1.keccak256(bytes_1.hexlify(value))}if(param.type==="address"){_this._abiCoder.encode(["address"],[value])}return bytes_1.hexZeroPad(bytes_1.hexlify(value),32)};values.forEach(function(value,index){var param=eventFragment.inputs[index];if(!param.indexed){if(value!=null){logger.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+param.name,value)}return}if(value==null){topics.push(null)}else if(param.baseType==="array"||param.baseType==="tuple"){logger.throwArgumentError("filtering with tuples or arrays not supported","contract."+param.name,value)}else if(Array.isArray(value)){topics.push(value.map(function(value){return encodeTopic(param,value)}))}else{topics.push(encodeTopic(param,value))}});while(topics.length&&topics[topics.length-1]===null){topics.pop()}return topics};Interface.prototype.encodeEventLog=function(eventFragment,values){var _this=this;if(typeof eventFragment==="string"){eventFragment=this.getEvent(eventFragment)}var topics=[];var dataTypes=[];var dataValues=[];if(!eventFragment.anonymous){topics.push(this.getEventTopic(eventFragment))}if(values.length!==eventFragment.inputs.length){logger.throwArgumentError("event arguments/values mismatch","values",values)}eventFragment.inputs.forEach(function(param,index){var value=values[index];if(param.indexed){if(param.type==="string"){topics.push(hash_1.id(value))}else if(param.type==="bytes"){topics.push(keccak256_1.keccak256(value))}else if(param.baseType==="tuple"||param.baseType==="array"){throw new Error("not implemented")}else{topics.push(_this._abiCoder.encode([param.type],[value]))}}else{dataTypes.push(param);dataValues.push(value)}});return{data:this._abiCoder.encode(dataTypes,dataValues),topics:topics}};Interface.prototype.decodeEventLog=function(eventFragment,data,topics){if(typeof eventFragment==="string"){eventFragment=this.getEvent(eventFragment)}if(topics!=null&&!eventFragment.anonymous){var topicHash=this.getEventTopic(eventFragment);if(!bytes_1.isHexString(topics[0],32)||topics[0].toLowerCase()!==topicHash){logger.throwError("fragment/topic mismatch",logger_1.Logger.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:topicHash,value:topics[0]})}topics=topics.slice(1)}var indexed=[];var nonIndexed=[];var dynamic=[];eventFragment.inputs.forEach(function(param,index){if(param.indexed){if(param.type==="string"||param.type==="bytes"||param.baseType==="tuple"||param.baseType==="array"){indexed.push(fragments_1.ParamType.fromObject({type:"bytes32",name:param.name}));dynamic.push(true)}else{indexed.push(param);dynamic.push(false)}}else{nonIndexed.push(param);dynamic.push(false)}});var resultIndexed=topics!=null?this._abiCoder.decode(indexed,bytes_1.concat(topics)):null;var resultNonIndexed=this._abiCoder.decode(nonIndexed,data);var result=[];var nonIndexedIndex=0,indexedIndex=0;eventFragment.inputs.forEach(function(param,index){if(param.indexed){if(resultIndexed==null){result[index]=new Indexed({_isIndexed:true,hash:null})}else if(dynamic[index]){result[index]=new Indexed({_isIndexed:true,hash:resultIndexed[indexedIndex++]})}else{try{result[index]=resultIndexed[indexedIndex++]}catch(error){result[index]=error}}}else{try{result[index]=resultNonIndexed[nonIndexedIndex++]}catch(error){result[index]=error}}if(param.name&&result[param.name]==null){var value_1=result[index];if(value_1 instanceof Error){Object.defineProperty(result,param.name,{get:function(){throw wrapAccessError("property "+JSON.stringify(param.name),value_1)}})}else{result[param.name]=value_1}}});var _loop_1=function(i){var value=result[i];if(value instanceof Error){Object.defineProperty(result,i,{get:function(){throw wrapAccessError("index "+i,value)}})}};for(var i=0;i<result.length;i++){_loop_1(i)}return Object.freeze(result)};Interface.prototype.parseTransaction=function(tx){var fragment=this.getFunction(tx.data.substring(0,10).toLowerCase());if(!fragment){return null}return new TransactionDescription({args:this._abiCoder.decode(fragment.inputs,"0x"+tx.data.substring(10)),functionFragment:fragment,name:fragment.name,signature:fragment.format(),sighash:this.getSighash(fragment),value:bignumber_1.BigNumber.from(tx.value||"0")})};Interface.prototype.parseLog=function(log){var fragment=this.getEvent(log.topics[0]);if(!fragment||fragment.anonymous){return null}return new LogDescription({eventFragment:fragment,name:fragment.name,signature:fragment.format(),topic:this.getEventTopic(fragment),args:this.decodeEventLog(fragment,log.data,log.topics)})};Interface.isInterface=function(value){return!!(value&&value._isInterface)};return Interface}();exports.Interface=Interface},{"./_version":2,"./abi-coder":3,"./coders/abstract-coder":4,"./fragments":15,"@ethersproject/address":23,"@ethersproject/bignumber":28,"@ethersproject/bytes":30,"@ethersproject/hash":35,"@ethersproject/keccak256":36,"@ethersproject/logger":38,"@ethersproject/properties":42}],18:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.version="abstract-provider/5.0.1"},{}],19:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p]};return extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();Object.defineProperty(exports,"__esModule",{value:true});var bytes_1=require("@ethersproject/bytes");var properties_1=require("@ethersproject/properties");var logger_1=require("@ethersproject/logger");var _version_1=require("./_version");var logger=new logger_1.Logger(_version_1.version);var ForkEvent=function(_super){__extends(ForkEvent,_super);function ForkEvent(){return _super!==null&&_super.apply(this,arguments)||this}ForkEvent.isForkEvent=function(value){return!!(value&&value._isForkEvent)};return ForkEvent}(properties_1.Description);exports.ForkEvent=ForkEvent;var BlockForkEvent=function(_super){__extends(BlockForkEvent,_super);function BlockForkEvent(blockHash,expiry){var _this=this;if(!bytes_1.isHexString(blockHash,32)){logger.throwArgumentError("invalid blockHash","blockHash",blockHash)}_this=_super.call(this,{_isForkEvent:true,_isBlockForkEvent:true,expiry:expiry||0,blockHash:blockHash})||this;return _this}return BlockForkEvent}(ForkEvent);exports.BlockForkEvent=BlockForkEvent;var TransactionForkEvent=function(_super){__extends(TransactionForkEvent,_super);function TransactionForkEvent(hash,expiry){var _this=this;if(!bytes_1.isHexString(hash,32)){logger.throwArgumentError("invalid transaction hash","hash",hash)}_this=_super.call(this,{_isForkEvent:true,_isTransactionForkEvent:true,expiry:expiry||0,hash:hash})||this;return _this}return TransactionForkEvent}(ForkEvent);exports.TransactionForkEvent=TransactionForkEvent;var TransactionOrderForkEvent=function(_super){__extends(TransactionOrderForkEvent,_super);function TransactionOrderForkEvent(beforeHash,afterHash,expiry){var _this=this;if(!bytes_1.isHexString(beforeHash,32)){logger.throwArgumentError("invalid transaction hash","beforeHash",beforeHash)}if(!bytes_1.isHexString(afterHash,32)){logger.throwArgumentError("invalid transaction hash","afterHash",afterHash)}_this=_super.call(this,{_isForkEvent:true,_isTransactionOrderForkEvent:true,expiry:expiry||0,beforeHash:beforeHash,afterHash:afterHash})||this;return _this}return TransactionOrderForkEvent}(ForkEvent);exports.TransactionOrderForkEvent=TransactionOrderForkEvent;var Provider=function(){function Provider(){var _newTarget=this.constructor;logger.checkAbstract(_newTarget,Provider);properties_1.defineReadOnly(this,"_isProvider",true)}Provider.prototype.addListener=function(eventName,listener){return this.on(eventName,listener)};Provider.prototype.removeListener=function(eventName,listener){return this.off(eventName,listener)};Provider.isProvider=function(value){return!!(value&&value._isProvider)};return Provider}();exports.Provider=Provider},{"./_version":18,"@ethersproject/bytes":30,"@ethersproject/logger":38,"@ethersproject/properties":42}],20:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.version="abstract-signer/5.0.1"},{}],21:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p]};return extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){function adopt(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator["throw"](value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})};var __generator=this&&this.__generator||function(thisArg,body){var _={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},f,y,t,g;return g={next:verb(0),throw:verb(1),return:verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(_)try{if(f=1,y&&(t=op[0]&2?y["return"]:op[0]?y["throw"]||((t=y["return"])&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[op[0]&2,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return{value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break}if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break}if(t[2])_.ops.pop();_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e];y=0}finally{f=t=0}if(op[0]&5)throw op[1];return{value:op[0]?op[1]:void 0,done:true}}};Object.defineProperty(exports,"__esModule",{value:true});var properties_1=require("@ethersproject/properties");var logger_1=require("@ethersproject/logger");var _version_1=require("./_version");var logger=new logger_1.Logger(_version_1.version);var allowedTransactionKeys=["chainId","data","from","gasLimit","gasPrice","nonce","to","value"];var Signer=function(){function Signer(){var _newTarget=this.constructor;logger.checkAbstract(_newTarget,Signer);properties_1.defineReadOnly(this,"_isSigner",true)}Signer.prototype.getBalance=function(blockTag){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:this._checkProvider("getBalance");return[4,this.provider.getBalance(this.getAddress(),blockTag)];case 1:return[2,_a.sent()]}})})};Signer.prototype.getTransactionCount=function(blockTag){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:this._checkProvider("getTransactionCount");return[4,this.provider.getTransactionCount(this.getAddress(),blockTag)];case 1:return[2,_a.sent()]}})})};Signer.prototype.estimateGas=function(transaction){return __awaiter(this,void 0,void 0,function(){var tx;return __generator(this,function(_a){switch(_a.label){case 0:this._checkProvider("estimateGas");return[4,properties_1.resolveProperties(this.checkTransaction(transaction))];case 1:tx=_a.sent();return[4,this.provider.estimateGas(tx)];case 2:return[2,_a.sent()]}})})};Signer.prototype.call=function(transaction,blockTag){return __awaiter(this,void 0,void 0,function(){var tx;return __generator(this,function(_a){switch(_a.label){case 0:this._checkProvider("call");return[4,properties_1.resolveProperties(this.checkTransaction(transaction))];case 1:tx=_a.sent();return[4,this.provider.call(tx,blockTag)];case 2:return[2,_a.sent()]}})})};Signer.prototype.sendTransaction=function(transaction){var _this=this;this._checkProvider("sendTransaction");return this.populateTransaction(transaction).then(function(tx){return _this.signTransaction(tx).then(function(signedTx){return _this.provider.sendTransaction(signedTx)})})};Signer.prototype.getChainId=function(){return __awaiter(this,void 0,void 0,function(){var network;return __generator(this,function(_a){switch(_a.label){case 0:this._checkProvider("getChainId");return[4,this.provider.getNetwork()];case 1:network=_a.sent();return[2,network.chainId]}})})};Signer.prototype.getGasPrice=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:this._checkProvider("getGasPrice");return[4,this.provider.getGasPrice()];case 1:return[2,_a.sent()]}})})};Signer.prototype.resolveName=function(name){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:this._checkProvider("resolveName");return[4,this.provider.resolveName(name)];case 1:return[2,_a.sent()]}})})};Signer.prototype.checkTransaction=function(transaction){for(var key in transaction){if(allowedTransactionKeys.indexOf(key)===-1){logger.throwArgumentError("invalid transaction key: "+key,"transaction",transaction)}}var tx=properties_1.shallowCopy(transaction);if(tx.from==null){tx.from=this.getAddress()}else{tx.from=Promise.all([Promise.resolve(tx.from),this.getAddress()]).then(function(result){if(result[0]!==result[1]){logger.throwArgumentError("from address mismatch","transaction",transaction)}return result[0]})}return tx};Signer.prototype.populateTransaction=function(transaction){return __awaiter(this,void 0,void 0,function(){var tx;var _this=this;return __generator(this,function(_a){switch(_a.label){case 0:return[4,properties_1.resolveProperties(this.checkTransaction(transaction))];case 1:tx=_a.sent();if(tx.to!=null){tx.to=Promise.resolve(tx.to).then(function(to){return _this.resolveName(to)})}if(tx.gasPrice==null){tx.gasPrice=this.getGasPrice()}if(tx.nonce==null){tx.nonce=this.getTransactionCount("pending")}if(tx.gasLimit==null){tx.gasLimit=this.estimateGas(tx).catch(function(error){return logger.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",logger_1.Logger.errors.UNPREDICTABLE_GAS_LIMIT,{error:error,tx:tx})})}if(tx.chainId==null){tx.chainId=this.getChainId()}else{tx.chainId=Promise.all([Promise.resolve(tx.chainId),this.getChainId()]).then(function(results){if(results[1]!==0&&results[0]!==results[1]){logger.throwArgumentError("chainId address mismatch","transaction",transaction)}return results[0]})}return[4,properties_1.resolveProperties(tx)];case 2:return[2,_a.sent()]}})})};Signer.prototype._checkProvider=function(operation){if(!this.provider){logger.throwError("missing provider",logger_1.Logger.errors.UNSUPPORTED_OPERATION,{operation:operation||"_checkProvider"})}};Signer.isSigner=function(value){return!!(value&&value._isSigner)};return Signer}();exports.Signer=Signer;var VoidSigner=function(_super){__extends(VoidSigner,_super);function VoidSigner(address,provider){var _newTarget=this.constructor;var _this=this;logger.checkNew(_newTarget,VoidSigner);_this=_super.call(this)||this;properties_1.defineReadOnly(_this,"address",address);properties_1.defineReadOnly(_this,"provider",provider||null);return _this}VoidSigner.prototype.getAddress=function(){return Promise.resolve(this.address)};VoidSigner.prototype._fail=function(message,operation){return Promise.resolve().then(function(){logger.throwError(message,logger_1.Logger.errors.UNSUPPORTED_OPERATION,{operation:operation})})};VoidSigner.prototype.signMessage=function(message){return this._fail("VoidSigner cannot sign messages","signMessage")};VoidSigner.prototype.signTransaction=function(transaction){return this._fail("VoidSigner cannot sign transactions","signTransaction")};VoidSigner.prototype.connect=function(provider){return new VoidSigner(this.address,provider)};return VoidSigner}(Signer);exports.VoidSigner=VoidSigner},{"./_version":20,"@ethersproject/logger":38,"@ethersproject/properties":42}],22:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.version="address/5.0.1"},{}],23:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var bn_js_1=require("bn.js");var bytes_1=require("@ethersproject/bytes");var bignumber_1=require("@ethersproject/bignumber");var keccak256_1=require("@ethersproject/keccak256");var rlp_1=require("@ethersproject/rlp");var logger_1=require("@ethersproject/logger");var _version_1=require("./_version");var logger=new logger_1.Logger(_version_1.version);function getChecksumAddress(address){if(!bytes_1.isHexString(address,20)){logger.throwArgumentError("invalid address","address",address)}address=address.toLowerCase();var chars=address.substring(2).split("");var expanded=new Uint8Array(40);for(var i=0;i<40;i++){expanded[i]=chars[i].charCodeAt(0)}var hashed=bytes_1.arrayify(keccak256_1.keccak256(expanded));for(var i=0;i<40;i+=2){if(hashed[i>>1]>>4>=8){chars[i]=chars[i].toUpperCase()}if((hashed[i>>1]&15)>=8){chars[i+1]=chars[i+1].toUpperCase()}}return"0x"+chars.join("")}var MAX_SAFE_INTEGER=9007199254740991;function log10(x){if(Math.log10){return Math.log10(x)}return Math.log(x)/Math.LN10}var ibanLookup={};for(var i=0;i<10;i++){ibanLookup[String(i)]=String(i)}for(var i=0;i<26;i++){ibanLookup[String.fromCharCode(65+i)]=String(10+i)}var safeDigits=Math.floor(log10(MAX_SAFE_INTEGER));function ibanChecksum(address){address=address.toUpperCase();address=address.substring(4)+address.substring(0,2)+"00";var expanded=address.split("").map(function(c){return ibanLookup[c]}).join("");while(expanded.length>=safeDigits){var block=expanded.substring(0,safeDigits);expanded=parseInt(block,10)%97+expanded.substring(block.length)}var checksum=String(98-parseInt(expanded,10)%97);while(checksum.length<2){checksum="0"+checksum}return checksum}function getAddress(address){var result=null;if(typeof address!=="string"){logger.throwArgumentError("invalid address","address",address)}if(address.match(/^(0x)?[0-9a-fA-F]{40}$/)){if(address.substring(0,2)!=="0x"){address="0x"+address}result=getChecksumAddress(address);if(address.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&result!==address){logger.throwArgumentError("bad address checksum","address",address)}}else if(address.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){if(address.substring(2,4)!==ibanChecksum(address)){logger.throwArgumentError("bad icap checksum","address",address)}result=new bn_js_1.BN(address.substring(4),36).toString(16);while(result.length<40){result="0"+result}result=getChecksumAddress("0x"+result)}else{logger.throwArgumentError("invalid address","address",address)}return result}exports.getAddress=getAddress;function isAddress(address){try{getAddress(address);return true}catch(error){}return false}exports.isAddress=isAddress;function getIcapAddress(address){var base36=new bn_js_1.BN(getAddress(address).substring(2),16).toString(36).toUpperCase();while(base36.length<30){base36="0"+base36}return"XE"+ibanChecksum("XE00"+base36)+base36}exports.getIcapAddress=getIcapAddress;function getContractAddress(transaction){var from=null;try{from=getAddress(transaction.from)}catch(error){logger.throwArgumentError("missing from address","transaction",transaction)}var nonce=bytes_1.stripZeros(bytes_1.arrayify(bignumber_1.BigNumber.from(transaction.nonce).toHexString()));return getAddress(bytes_1.hexDataSlice(keccak256_1.keccak256(rlp_1.encode([from,nonce])),12))}exports.getContractAddress=getContractAddress;function getCreate2Address(from,salt,initCodeHash){if(bytes_1.hexDataLength(salt)!==32){logger.throwArgumentError("salt must be 32 bytes","salt",salt)}if(bytes_1.hexDataLength(initCodeHash)!==32){logger.throwArgumentError("initCodeHash must be 32 bytes","initCodeHash",initCodeHash)}return getAddress(bytes_1.hexDataSlice(keccak256_1.keccak256(bytes_1.concat(["0xff",getAddress(from),salt,initCodeHash])),12))}exports.getCreate2Address=getCreate2Address},{"./_version":22,"@ethersproject/bignumber":28,"@ethersproject/bytes":30,"@ethersproject/keccak256":36,"@ethersproject/logger":38,"@ethersproject/rlp":63,"bn.js":96}],24:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var bytes_1=require("@ethersproject/bytes");function decode(textData){textData=atob(textData);var data=[];for(var i=0;i<textData.length;i++){data.push(textData.charCodeAt(i))}return bytes_1.arrayify(data)}exports.decode=decode;function encode(data){data=bytes_1.arrayify(data);var textData="";for(var i=0;i<data.length;i++){textData+=String.fromCharCode(data[i])}return btoa(textData)}exports.encode=encode},{"@ethersproject/bytes":30}],25:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.version="bignumber/5.0.4"},{}],26:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var bn_js_1=require("bn.js");var bytes_1=require("@ethersproject/bytes");var logger_1=require("@ethersproject/logger");var _version_1=require("./_version");var logger=new logger_1.Logger(_version_1.version);var _constructorGuard={};var MAX_SAFE=9007199254740991;function isBigNumberish(value){return value!=null&&(BigNumber.isBigNumber(value)||typeof value==="number"&&value%1===0||typeof value==="string"&&!!value.match(/^-?[0-9]+$/)||bytes_1.isHexString(value)||typeof value==="bigint"||bytes_1.isBytes(value))}exports.isBigNumberish=isBigNumberish;var BigNumber=function(){function BigNumber(constructorGuard,hex){var _newTarget=this.constructor;logger.checkNew(_newTarget,BigNumber);if(constructorGuard!==_constructorGuard){logger.throwError("cannot call constructor directly; use BigNumber.from",logger_1.Logger.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"})}this._hex=hex;this._isBigNumber=true;Object.freeze(this)}BigNumber.prototype.fromTwos=function(value){return toBigNumber(toBN(this).fromTwos(value))};BigNumber.prototype.toTwos=function(value){return toBigNumber(toBN(this).toTwos(value))};BigNumber.prototype.abs=function(){if(this._hex[0]==="-"){return BigNumber.from(this._hex.substring(1))}return this};BigNumber.prototype.add=function(other){return toBigNumber(toBN(this).add(toBN(other)))};BigNumber.prototype.sub=function(other){return toBigNumber(toBN(this).sub(toBN(other)))};BigNumber.prototype.div=function(other){var o=BigNumber.from(other);if(o.isZero()){throwFault("division by zero","div")}return toBigNumber(toBN(this).div(toBN(other)))};BigNumber.prototype.mul=function(other){return toBigNumber(toBN(this).mul(toBN(other)))};BigNumber.prototype.mod=function(other){var value=toBN(other);if(value.isNeg()){throwFault("cannot modulo negative values","mod")}return toBigNumber(toBN(this).umod(value))};BigNumber.prototype.pow=function(other){var value=toBN(other);if(value.isNeg()){throwFault("cannot raise to negative values","pow")}return toBigNumber(toBN(this).pow(value))};BigNumber.prototype.and=function(other){var value=toBN(other);if(this.isNegative()||value.isNeg()){throwFault("cannot 'and' negative values","and")}return toBigNumber(toBN(this).and(value))};BigNumber.prototype.or=function(other){var value=toBN(other);if(this.isNegative()||value.isNeg()){throwFault("cannot 'or' negative values","or")}return toBigNumber(toBN(this).or(value))};BigNumber.prototype.xor=function(other){var value=toBN(other);if(this.isNegative()||value.isNeg()){throwFault("cannot 'xor' negative values","xor")}return toBigNumber(toBN(this).xor(value))};BigNumber.prototype.mask=function(value){if(this.isNegative()||value<0){throwFault("cannot mask negative values","mask")}return toBigNumber(toBN(this).maskn(value))};BigNumber.prototype.shl=function(value){if(this.isNegative()||value<0){throwFault("cannot shift negative values","shl")}return toBigNumber(toBN(this).shln(value))};BigNumber.prototype.shr=function(value){if(this.isNegative()||value<0){throwFault("cannot shift negative values","shr")}return toBigNumber(toBN(this).shrn(value))};BigNumber.prototype.eq=function(other){return toBN(this).eq(toBN(other))};BigNumber.prototype.lt=function(other){return toBN(this).lt(toBN(other))};BigNumber.prototype.lte=function(other){return toBN(this).lte(toBN(other))};BigNumber.prototype.gt=function(other){return toBN(this).gt(toBN(other))};BigNumber.prototype.gte=function(other){return toBN(this).gte(toBN(other))};BigNumber.prototype.isNegative=function(){return this._hex[0]==="-"};BigNumber.prototype.isZero=function(){return toBN(this).isZero()};BigNumber.prototype.toNumber=function(){try{return toBN(this).toNumber()}catch(error){throwFault("overflow","toNumber",this.toString())}return null};BigNumber.prototype.toString=function(){if(arguments.length!==0){logger.throwError("bigNumber.toString does not accept parameters",logger_1.Logger.errors.UNEXPECTED_ARGUMENT,{})}return toBN(this).toString(10)};BigNumber.prototype.toHexString=function(){return this._hex};BigNumber.from=function(value){if(value instanceof BigNumber){return value}if(typeof value==="string"){if(value.match(/^-?0x[0-9a-f]+$/i)){return new BigNumber(_constructorGuard,toHex(value))}if(value.match(/^-?[0-9]+$/)){return new BigNumber(_constructorGuard,toHex(new bn_js_1.BN(value)))}return logger.throwArgumentError("invalid BigNumber string","value",value)}if(typeof value==="number"){if(value%1){throwFault("underflow","BigNumber.from",value)}if(value>=MAX_SAFE||value<=-MAX_SAFE){throwFault("overflow","BigNumber.from",value)}return BigNumber.from(String(value))}if(typeof value==="bigint"){return BigNumber.from(value.toString())}if(bytes_1.isBytes(value)){return BigNumber.from(bytes_1.hexlify(value))}if(value._hex&&bytes_1.isHexString(value._hex)){return BigNumber.from(value._hex)}if(value.toHexString){value=value.toHexString();if(typeof value==="string"){return BigNumber.from(value)}}return logger.throwArgumentError("invalid BigNumber value","value",value)};BigNumber.isBigNumber=function(value){return!!(value&&value._isBigNumber)};return BigNumber}();exports.BigNumber=BigNumber;function toHex(value){if(typeof value!=="string"){return toHex(value.toString(16))}if(value[0]==="-"){value=value.substring(1);if(value[0]==="-"){logger.throwArgumentError("invalid hex","value",value)}value=toHex(value);if(value==="0x00"){return value}return"-"+value}if(value.substring(0,2)!=="0x"){value="0x"+value}if(value==="0x"){return"0x00"}if(value.length%2){value="0x0"+value.substring(2)}while(value.length>4&&value.substring(0,4)==="0x00"){value="0x"+value.substring(4)}return value}function toBigNumber(value){return BigNumber.from(toHex(value))}function toBN(value){var hex=BigNumber.from(value).toHexString();if(hex[0]==="-"){return new bn_js_1.BN("-"+hex.substring(3),16)}return new bn_js_1.BN(hex.substring(2),16)}function throwFault(fault,operation,value){var params={fault:fault,operation:operation};if(value!=null){params.value=value}return logger.throwError(fault,logger_1.Logger.errors.NUMERIC_FAULT,params)}},{"./_version":25,"@ethersproject/bytes":30,"@ethersproject/logger":38,"bn.js":96}],27:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var bytes_1=require("@ethersproject/bytes");var logger_1=require("@ethersproject/logger");var _version_1=require("./_version");var logger=new logger_1.Logger(_version_1.version);var bignumber_1=require("./bignumber");var _constructorGuard={};var Zero=bignumber_1.BigNumber.from(0);var NegativeOne=bignumber_1.BigNumber.from(-1);function throwFault(message,fault,operation,value){var params={fault:fault,operation:operation};if(value!==undefined){params.value=value}return logger.throwError(message,logger_1.Logger.errors.NUMERIC_FAULT,params)}var zeros="0";while(zeros.length<256){zeros+=zeros}function getMultiplier(decimals){if(typeof decimals!=="number"){try{decimals=bignumber_1.BigNumber.from(decimals).toNumber()}catch(e){}}if(typeof decimals==="number"&&decimals>=0&&decimals<=256&&!(decimals%1)){return"1"+zeros.substring(0,decimals)}return logger.throwArgumentError("invalid decimal size","decimals",decimals)}function formatFixed(value,decimals){if(decimals==null){decimals=0}var multiplier=getMultiplier(decimals);value=bignumber_1.BigNumber.from(value);var negative=value.lt(Zero);if(negative){value=value.mul(NegativeOne)}var fraction=value.mod(multiplier).toString();while(fraction.length<multiplier.length-1){fraction="0"+fraction}fraction=fraction.match(/^([0-9]*[1-9]|0)(0*)/)[1];var whole=value.div(multiplier).toString();value=whole+"."+fraction;if(negative){value="-"+value}return value}exports.formatFixed=formatFixed;function parseFixed(value,decimals){if(decimals==null){decimals=0}var multiplier=getMultiplier(decimals);if(typeof value!=="string"||!value.match(/^-?[0-9.,]+$/)){logger.throwArgumentError("invalid decimal value","value",value)}if(multiplier.length-1===0){return bignumber_1.BigNumber.from(value)}var negative=value.substring(0,1)==="-";if(negative){value=value.substring(1)}if(value==="."){logger.throwArgumentError("missing value","value",value)}var comps=value.split(".");if(comps.length>2){logger.throwArgumentError("too many decimal points","value",value)}var whole=comps[0],fraction=comps[1];if(!whole){whole="0"}if(!fraction){fraction="0"}if(fraction.length>multiplier.length-1){throwFault("fractional component exceeds decimals","underflow","parseFixed")}while(fraction.length<multiplier.length-1){fraction+="0"}var wholeValue=bignumber_1.BigNumber.from(whole);var fractionValue=bignumber_1.BigNumber.from(fraction);var wei=wholeValue.mul(multiplier).add(fractionValue);if(negative){wei=wei.mul(NegativeOne)}return wei}exports.parseFixed=parseFixed;var FixedFormat=function(){function FixedFormat(constructorGuard,signed,width,decimals){if(constructorGuard!==_constructorGuard){logger.throwError("cannot use FixedFormat constructor; use FixedFormat.from",logger_1.Logger.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"})}this.signed=signed;this.width=width;this.decimals=decimals;this.name=(signed?"":"u")+"fixed"+String(width)+"x"+String(decimals);this._multiplier=getMultiplier(decimals);Object.freeze(this)}FixedFormat.from=function(value){if(value instanceof FixedFormat){return value}var signed=true;var width=128;var decimals=18;if(typeof value==="string"){if(value==="fixed"){}else if(value==="ufixed"){signed=false}else if(value!=null){var match=value.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);if(!match){logger.throwArgumentError("invalid fixed format","format",value)}signed=match[1]!=="u";width=parseInt(match[2]);decimals=parseInt(match[3])}}else if(value){var check=function(key,type,defaultValue){if(value[key]==null){return defaultValue}if(typeof value[key]!==type){logger.throwArgumentError("invalid fixed format ("+key+" not "+type+")","format."+key,value[key])}return value[key]};signed=check("signed","boolean",signed);width=check("width","number",width);decimals=check("decimals","number",decimals)}if(width%8){logger.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",width)}if(decimals>80){logger.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",decimals)}return new FixedFormat(_constructorGuard,signed,width,decimals)};return FixedFormat}();exports.FixedFormat=FixedFormat;var FixedNumber=function(){function FixedNumber(constructorGuard,hex,value,format){var _newTarget=this.constructor;logger.checkNew(_newTarget,FixedNumber);if(constructorGuard!==_constructorGuard){logger.throwError("cannot use FixedNumber constructor; use FixedNumber.from",logger_1.Logger.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"})}this.format=format;this._hex=hex;this._value=value;this._isFixedNumber=true;Object.freeze(this)}FixedNumber.prototype._checkFormat=function(other){if(this.format.name!==other.format.name){logger.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",other)}};FixedNumber.prototype.addUnsafe=function(other){this._checkFormat(other);var a=parseFixed(this._value,this.format.decimals);var b=parseFixed(other._value,other.format.decimals);return FixedNumber.fromValue(a.add(b),this.format.decimals,this.format)};FixedNumber.prototype.subUnsafe=function(other){this._checkFormat(other);var a=parseFixed(this._value,this.format.decimals);var b=parseFixed(other._value,other.format.decimals);return FixedNumber.fromValue(a.sub(b),this.format.decimals,this.format)};FixedNumber.prototype.mulUnsafe=function(other){this._checkFormat(other);var a=parseFixed(this._value,this.format.decimals);var b=parseFixed(other._value,other.format.decimals);return FixedNumber.fromValue(a.mul(b).div(this.format._multiplier),this.format.decimals,this.format)};FixedNumber.prototype.divUnsafe=function(other){this._checkFormat(other);var a=parseFixed(this._value,this.format.decimals);var b=parseFixed(other._value,other.format.decimals);return FixedNumber.fromValue(a.mul(this.format._multiplier).div(b),this.format.decimals,this.format)};FixedNumber.prototype.round=function(decimals){if(decimals==null){decimals=0}if(decimals<0||decimals>80||decimals%1){logger.throwArgumentError("invalid decimal count","decimals",decimals)}var comps=this.toString().split(".");if(comps[1].length<=decimals){return this}var bump="0."+zeros.substring(0,decimals)+"5";comps=this.addUnsafe(FixedNumber.fromString(bump,this.format))._value.split(".");return FixedNumber.fromString(comps[0]+"."+comps[1].substring(0,decimals))};FixedNumber.prototype.isZero=function(){return this._value==="0.0"};FixedNumber.prototype.toString=function(){return this._value};FixedNumber.prototype.toHexString=function(width){if(width==null){return this._hex}if(width%8){logger.throwArgumentError("invalid byte width","width",width)}var hex=bignumber_1.BigNumber.from(this._hex).fromTwos(this.format.width).toTwos(width).toHexString();return bytes_1.hexZeroPad(hex,width/8)};FixedNumber.prototype.toUnsafeFloat=function(){return parseFloat(this.toString())};FixedNumber.prototype.toFormat=function(format){return FixedNumber.fromString(this._value,format)};FixedNumber.fromValue=function(value,decimals,format){if(format==null&&decimals!=null&&!bignumber_1.isBigNumberish(decimals)){format=decimals;decimals=null}if(decimals==null){decimals=0}if(format==null){format="fixed"}return FixedNumber.fromString(formatFixed(value,decimals),FixedFormat.from(format))};FixedNumber.fromString=function(value,format){if(format==null){format="fixed"}var fixedFormat=FixedFormat.from(format);var numeric=parseFixed(value,fixedFormat.decimals);if(!fixedFormat.signed&&numeric.lt(Zero)){throwFault("unsigned value cannot be negative","overflow","value",value)}var hex=null;if(fixedFormat.signed){hex=numeric.toTwos(fixedFormat.width).toHexString()}else{hex=numeric.toHexString();hex=bytes_1.hexZeroPad(hex,fixedFormat.width/8)}var decimal=formatFixed(numeric,fixedFormat.decimals);return new FixedNumber(_constructorGuard,hex,decimal,fixedFormat)};FixedNumber.fromBytes=function(value,format){if(format==null){format="fixed"}var fixedFormat=FixedFormat.from(format);if(bytes_1.arrayify(value).length>fixedFormat.width/8){throw new Error("overflow")}var numeric=bignumber_1.BigNumber.from(value);if(fixedFormat.signed){numeric=numeric.fromTwos(fixedFormat.width)}var hex=numeric.toTwos((fixedFormat.signed?0:1)+fixedFormat.width).toHexString();var decimal=formatFixed(numeric,fixedFormat.decimals);return new FixedNumber(_constructorGuard,hex,decimal,fixedFormat)};FixedNumber.from=function(value,format){if(typeof value==="string"){return FixedNumber.fromString(value,format)}if(bytes_1.isBytes(value)){return FixedNumber.fromBytes(value,format)}try{return FixedNumber.fromValue(value,0,format)}catch(error){if(error.code!==logger_1.Logger.errors.INVALID_ARGUMENT){throw error}}return logger.throwArgumentError("invalid FixedNumber value","value",value)};FixedNumber.isFixedNumber=function(value){return!!(value&&value._isFixedNumber)};return FixedNumber}();exports.FixedNumber=FixedNumber},{"./_version":25,"./bignumber":26,"@ethersproject/bytes":30,"@ethersproject/logger":38}],28:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var bignumber_1=require("./bignumber");exports.BigNumber=bignumber_1.BigNumber;var fixednumber_1=require("./fixednumber");exports.formatFixed=fixednumber_1.formatFixed;exports.FixedFormat=fixednumber_1.FixedFormat;exports.FixedNumber=fixednumber_1.FixedNumber;exports.parseFixed=fixednumber_1.parseFixed},{"./bignumber":26,"./fixednumber":27}],29:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.version="bytes/5.0.2"},{}],30:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var logger_1=require("@ethersproject/logger");var _version_1=require("./_version");var logger=new logger_1.Logger(_version_1.version);function isHexable(value){return!!value.toHexString}function addSlice(array){if(array.slice){return array}array.slice=function(){var args=Array.prototype.slice.call(arguments);return addSlice(new Uint8Array(Array.prototype.slice.apply(array,args)))};return array}function isBytesLike(value){return isHexString(value)&&!(value.length%2)||isBytes(value)}exports.isBytesLike=isBytesLike;function isBytes(value){if(value==null){return false}if(value.constructor===Uint8Array){return true}if(typeof value==="string"){return false}if(value.length==null){return false}for(var i=0;i<value.length;i++){var v=value[i];if(v<0||v>=256||v%1){return false}}return true}exports.isBytes=isBytes;function arrayify(value,options){if(!options){options={}}if(typeof value==="number"){logger.checkSafeUint53(value,"invalid arrayify value");var result=[];while(value){result.unshift(value&255);value=parseInt(String(value/256))}if(result.length===0){result.push(0)}return addSlice(new Uint8Array(result))}if(options.allowMissingPrefix&&typeof value==="string"&&value.substring(0,2)!=="0x"){value="0x"+value}if(isHexable(value)){value=value.toHexString()}if(isHexString(value)){var hex=value.substring(2);if(hex.length%2){if(options.hexPad==="left"){hex="0x0"+hex.substring(2)}else if(options.hexPad==="right"){hex+="0"}else{logger.throwArgumentError("hex data is odd-length","value",value)}}var result=[];for(var i=0;i<hex.length;i+=2){result.push(parseInt(hex.substring(i,i+2),16))}return addSlice(new Uint8Array(result))}if(isBytes(value)){return addSlice(new Uint8Array(value))}return logger.throwArgumentError("invalid arrayify value","value",value)}exports.arrayify=arrayify;function concat(items){var objects=items.map(function(item){return arrayify(item)});var length=objects.reduce(function(accum,item){return accum+item.length},0);var result=new Uint8Array(length);objects.reduce(function(offset,object){result.set(object,offset);return offset+object.length},0);return addSlice(result)}exports.concat=concat;function stripZeros(value){var result=arrayify(value);if(result.length===0){return result}var start=0;while(start<result.length&&result[start]===0){start++}if(start){result=result.slice(start)}return result}exports.stripZeros=stripZeros;function zeroPad(value,length){value=arrayify(value);if(value.length>length){logger.throwArgumentError("value out of range","value",arguments[0])}var result=new Uint8Array(length);result.set(value,length-value.length);return addSlice(result)}exports.zeroPad=zeroPad;function isHexString(value,length){if(typeof value!=="string"||!value.match(/^0x[0-9A-Fa-f]*$/)){return false}if(length&&value.length!==2+2*length){return false}return true}exports.isHexString=isHexString;var HexCharacters="0123456789abcdef";function hexlify(value,options){if(!options){options={}}if(typeof value==="number"){logger.checkSafeUint53(value,"invalid hexlify value");var hex="";while(value){hex=HexCharacters[value&15]+hex;value=Math.floor(value/16)}if(hex.length){if(hex.length%2){hex="0"+hex}return"0x"+hex}return"0x00"}if(options.allowMissingPrefix&&typeof value==="string"&&value.substring(0,2)!=="0x"){value="0x"+value}if(isHexable(value)){return value.toHexString()}if(isHexString(value)){if(value.length%2){if(options.hexPad==="left"){value="0x0"+value.substring(2)}else if(options.hexPad==="right"){value+="0"}else{logger.throwArgumentError("hex data is odd-length","value",value)}}return value.toLowerCase()}if(isBytes(value)){var result="0x";for(var i=0;i<value.length;i++){var v=value[i];result+=HexCharacters[(v&240)>>4]+HexCharacters[v&15]}return result}return logger.throwArgumentError("invalid hexlify value","value",value)}exports.hexlify=hexlify;function hexDataLength(data){if(typeof data!=="string"){data=hexlify(data)}else if(!isHexString(data)||data.length%2){return null}return(data.length-2)/2}exports.hexDataLength=hexDataLength;function hexDataSlice(data,offset,endOffset){if(typeof data!=="string"){data=hexlify(data)}else if(!isHexString(data)||data.length%2){logger.throwArgumentError("invalid hexData","value",data)}offset=2+2*offset;if(endOffset!=null){return"0x"+data.substring(offset,2+2*endOffset)}return"0x"+data.substring(offset)}exports.hexDataSlice=hexDataSlice;function hexConcat(items){var result="0x";items.forEach(function(item){result+=hexlify(item).substring(2)});return result}exports.hexConcat=hexConcat;function hexValue(value){var trimmed=hexStripZeros(hexlify(value,{hexPad:"left"}));if(trimmed==="0x"){return"0x0"}return trimmed}exports.hexValue=hexValue;function hexStripZeros(value){if(typeof value!=="string"){value=hexlify(value)}if(!isHexString(value)){logger.throwArgumentError("invalid hex string","value",value)}value=value.substring(2);var offset=0;while(offset<value.length&&value[offset]==="0"){offset++}return"0x"+value.substring(offset)}exports.hexStripZeros=hexStripZeros;function hexZeroPad(value,length){if(typeof value!=="string"){value=hexlify(value)}else if(!isHexString(value)){logger.throwArgumentError("invalid hex string","value",value)}if(value.length>2*length+2){logger.throwArgumentError("value out of range","value",arguments[1])}while(value.length<2*length+2){value="0x0"+value.substring(2)}return value}exports.hexZeroPad=hexZeroPad;function splitSignature(signature){var result={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0};if(isBytesLike(signature)){var bytes=arrayify(signature);if(bytes.length!==65){logger.throwArgumentError("invalid signature string; must be 65 bytes","signature",signature)}result.r=hexlify(bytes.slice(0,32));result.s=hexlify(bytes.slice(32,64));result.v=bytes[64];if(result.v<27){if(result.v===0||result.v===1){result.v+=27}else{logger.throwArgumentError("signature invalid v byte","signature",signature)}}result.recoveryParam=1-result.v%2;if(result.recoveryParam){bytes[32]|=128}result._vs=hexlify(bytes.slice(32,64))}else{result.r=signature.r;result.s=signature.s;result.v=signature.v;result.recoveryParam=signature.recoveryParam;result._vs=signature._vs;if(result._vs!=null){var vs_1=zeroPad(arrayify(result._vs),32);result._vs=hexlify(vs_1);var recoveryParam=vs_1[0]>=128?1:0;if(result.recoveryParam==null){result.recoveryParam=recoveryParam}else if(result.recoveryParam!==recoveryParam){logger.throwArgumentError("signature recoveryParam mismatch _vs","signature",signature)}vs_1[0]&=127;var s=hexlify(vs_1);if(result.s==null){result.s=s}else if(result.s!==s){logger.throwArgumentError("signature v mismatch _vs","signature",signature)}}if(result.recoveryParam==null){if(result.v==null){logger.throwArgumentError("signature missing v and recoveryParam","signature",signature)}else{result.recoveryParam=1-result.v%2}}else{if(result.v==null){result.v=27+result.recoveryParam}else if(result.recoveryParam!==1-result.v%2){logger.throwArgumentError("signature recoveryParam mismatch v","signature",signature)}}if(result.r==null||!isHexString(result.r)){logger.throwArgumentError("signature missing or invalid r","signature",signature)}else{result.r=hexZeroPad(result.r,32)}if(result.s==null||!isHexString(result.s)){logger.throwArgumentError("signature missing or invalid s","signature",signature)}else{result.s=hexZeroPad(result.s,32)}var vs=arrayify(result.s);if(vs[0]>=128){logger.throwArgumentError("signature s out of range","signature",signature)}if(result.recoveryParam){vs[0]|=128}var _vs=hexlify(vs);if(result._vs){if(!isHexString(result._vs)){logger.throwArgumentError("signature invalid _vs","signature",signature)}result._vs=hexZeroPad(result._vs,32)}if(result._vs==null){result._vs=_vs}else if(result._vs!==_vs){logger.throwArgumentError("signature _vs mismatch v and s","signature",signature)}}return result}exports.splitSignature=splitSignature;function joinSignature(signature){signature=splitSignature(signature);return hexlify(concat([signature.r,signature.s,signature.recoveryParam?"0x1c":"0x1b"]))}exports.joinSignature=joinSignature},{"./_version":29,"@ethersproject/logger":38}],31:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var bignumber_1=require("@ethersproject/bignumber");var AddressZero="0x0000000000000000000000000000000000000000";exports.AddressZero=AddressZero;var HashZero="0x0000000000000000000000000000000000000000000000000000000000000000";exports.HashZero=HashZero;var EtherSymbol="Ξ";exports.EtherSymbol=EtherSymbol;var NegativeOne=bignumber_1.BigNumber.from(-1);exports.NegativeOne=NegativeOne;var Zero=bignumber_1.BigNumber.from(0);exports.Zero=Zero;var One=bignumber_1.BigNumber.from(1);exports.One=One;var Two=bignumber_1.BigNumber.from(2);exports.Two=Two;var WeiPerEther=bignumber_1.BigNumber.from("1000000000000000000");exports.WeiPerEther=WeiPerEther;var MaxUint256=bignumber_1.BigNumber.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");exports.MaxUint256=MaxUint256},{"@ethersproject/bignumber":28}],32:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.version="contracts/5.0.1"},{}],33:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p]};return extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){function adopt(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator["throw"](value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})};var __generator=this&&this.__generator||function(thisArg,body){var _={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},f,y,t,g;return g={next:verb(0),throw:verb(1),return:verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(_)try{if(f=1,y&&(t=op[0]&2?y["return"]:op[0]?y["throw"]||((t=y["return"])&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[op[0]&2,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return{value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break}if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break}if(t[2])_.ops.pop();_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e];y=0}finally{f=t=0}if(op[0]&5)throw op[1];return{value:op[0]?op[1]:void 0,done:true}}};var __spreadArrays=this&&this.__spreadArrays||function(){for(var s=0,i=0,il=arguments.length;i<il;i++)s+=arguments[i].length;for(var r=Array(s),k=0,i=0;i<il;i++)for(var a=arguments[i],j=0,jl=a.length;j<jl;j++,k++)r[k]=a[j];return r};Object.defineProperty(exports,"__esModule",{value:true});var abi_1=require("@ethersproject/abi");var abstract_provider_1=require("@ethersproject/abstract-provider");var abstract_signer_1=require("@ethersproject/abstract-signer");var address_1=require("@ethersproject/address");var bignumber_1=require("@ethersproject/bignumber");var bytes_1=require("@ethersproject/bytes");var properties_1=require("@ethersproject/properties");var logger_1=require("@ethersproject/logger");var _version_1=require("./_version");var logger=new logger_1.Logger(_version_1.version);var allowedTransactionKeys={chainId:true,data:true,from:true,gasLimit:true,gasPrice:true,nonce:true,to:true,value:true};function resolveName(resolver,nameOrPromise){return __awaiter(this,void 0,void 0,function(){var name;return __generator(this,function(_a){switch(_a.label){case 0:return[4,nameOrPromise];case 1:name=_a.sent();try{return[2,address_1.getAddress(name)]}catch(error){}if(!resolver){logger.throwError("a provider or signer is needed to resolve ENS names",logger_1.Logger.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"})}return[4,resolver.resolveName(name)];case 2:return[2,_a.sent()]}})})}function resolveAddresses(resolver,value,paramType){if(Array.isArray(paramType)){return Promise.all(paramType.map(function(paramType,index){return resolveAddresses(resolver,Array.isArray(value)?value[index]:value[paramType.name],paramType)}))}if(paramType.type==="address"){return resolveName(resolver,value)}if(paramType.type==="tuple"){return resolveAddresses(resolver,value,paramType.components)}if(paramType.baseType==="array"){if(!Array.isArray(value)){throw new Error("invalid value for array")}return Promise.all(value.map(function(v){return resolveAddresses(resolver,v,paramType.arrayChildren)}))}return Promise.resolve(value)}function populateTransaction(contract,fragment,args){return __awaiter(this,void 0,void 0,function(){var overrides,resolved,tx,ro,roValue,leftovers;var _this=this;return __generator(this,function(_a){switch(_a.label){case 0:overrides={};if(args.length===fragment.inputs.length+1&&typeof args[args.length-1]==="object"){overrides=properties_1.shallowCopy(args.pop())}logger.checkArgumentCount(args.length,fragment.inputs.length,"passed to contract");if(contract.signer){if(overrides.from){overrides.from=properties_1.resolveProperties({override:resolveName(contract.signer,overrides.from),signer:contract.signer.getAddress()}).then(function(check){return __awaiter(_this,void 0,void 0,function(){return __generator(this,function(_a){if(address_1.getAddress(check.signer)!==check.override){logger.throwError("Contract with a Signer cannot override from",logger_1.Logger.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"})}return[2,check.override]})})})}else{overrides.from=contract.signer.getAddress()}}else if(overrides.from){overrides.from=resolveName(contract.provider,overrides.from)}return[4,properties_1.resolveProperties({args:resolveAddresses(contract.signer||contract.provider,args,fragment.inputs),address:contract.resolvedAddress,overrides:properties_1.resolveProperties(overrides)||{}})];case 1:resolved=_a.sent();tx={data:contract.interface.encodeFunctionData(fragment,resolved.args),to:resolved.address};ro=resolved.overrides;if(ro.nonce!=null){tx.nonce=bignumber_1.BigNumber.from(ro.nonce).toNumber()}if(ro.gasLimit!=null){tx.gasLimit=bignumber_1.BigNumber.from(ro.gasLimit)}if(ro.gasPrice!=null){tx.gasPrice=bignumber_1.BigNumber.from(ro.gasPrice)}if(ro.from!=null){tx.from=ro.from}if(tx.gasLimit==null&&fragment.gas!=null){tx.gasLimit=bignumber_1.BigNumber.from(fragment.gas).add(21e3)}if(ro.value){roValue=bignumber_1.BigNumber.from(ro.value);if(!roValue.isZero()&&!fragment.payable){logger.throwError("non-payable method cannot override value",logger_1.Logger.errors.UNSUPPORTED_OPERATION,{operation:"overrides.value",value:overrides.value})}tx.value=roValue}delete overrides.nonce;delete overrides.gasLimit;delete overrides.gasPrice;delete overrides.from;delete overrides.value;leftovers=Object.keys(overrides).filter(function(key){return overrides[key]!=null});if(leftovers.length){logger.throwError("cannot override "+leftovers.map(function(l){return JSON.stringify(l)}).join(","),logger_1.Logger.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:leftovers})}return[2,tx]}})})}function buildPopulate(contract,fragment){return function(){var args=[];for(var _i=0;_i<arguments.length;_i++){args[_i]=arguments[_i]}return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){return[2,populateTransaction(contract,fragment,args)]})})}}function buildEstimate(contract,fragment){var signerOrProvider=contract.signer||contract.provider;return function(){var args=[];for(var _i=0;_i<arguments.length;_i++){args[_i]=arguments[_i]}return __awaiter(this,void 0,void 0,function(){var tx;return __generator(this,function(_a){switch(_a.label){case 0:if(!signerOrProvider){logger.throwError("estimate require a provider or signer",logger_1.Logger.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"})}return[4,populateTransaction(contract,fragment,args)];case 1:tx=_a.sent();return[4,signerOrProvider.estimateGas(tx)];case 2:return[2,_a.sent()]}})})}}function buildCall(contract,fragment,collapseSimple){var signerOrProvider=contract.signer||contract.provider;return function(){var args=[];for(var _i=0;_i<arguments.length;_i++){args[_i]=arguments[_i]}return __awaiter(this,void 0,void 0,function(){var blockTag,overrides,tx,result,value;return __generator(this,function(_a){switch(_a.label){case 0:blockTag=undefined;if(!(args.length===fragment.inputs.length+1&&typeof args[args.length-1]==="object"))return[3,3];overrides=properties_1.shallowCopy(args.pop());if(!(overrides.blockTag!=null))return[3,2];return[4,overrides.blockTag];case 1:blockTag=_a.sent();_a.label=2;case 2:delete overrides.blockTag;args.push(overrides);_a.label=3;case 3:if(!(contract.deployTransaction!=null))return[3,5];return[4,contract._deployed(blockTag)];case 4:_a.sent();_a.label=5;case 5:return[4,populateTransaction(contract,fragment,args)];case 6:tx=_a.sent();return[4,signerOrProvider.call(tx,blockTag)];case 7:result=_a.sent();try{value=contract.interface.decodeFunctionResult(fragment,result);if(collapseSimple&&fragment.outputs.length===1){value=value[0]}return[2,value]}catch(error){if(error.code===logger_1.Logger.errors.CALL_EXCEPTION){error.address=contract.address;error.args=args;error.transaction=tx}throw error}return[2]}})})}}function buildSend(contract,fragment){return function(){var args=[];for(var _i=0;_i<arguments.length;_i++){args[_i]=arguments[_i]}return __awaiter(this,void 0,void 0,function(){var txRequest,tx,wait;return __generator(this,function(_a){switch(_a.label){case 0:if(!contract.signer){logger.throwError("sending a transaction requires a signer",logger_1.Logger.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"})}if(!(contract.deployTransaction!=null))return[3,2];return[4,contract._deployed()];case 1:_a.sent();_a.label=2;case 2:return[4,populateTransaction(contract,fragment,args)];case 3:txRequest=_a.sent();return[4,contract.signer.sendTransaction(txRequest)];case 4:tx=_a.sent();wait=tx.wait.bind(tx);tx.wait=function(confirmations){return wait(confirmations).then(function(receipt){receipt.events=receipt.logs.map(function(log){var event=properties_1.deepCopy(log);var parsed=null;try{parsed=contract.interface.parseLog(log)}catch(e){}if(parsed){event.args=parsed.args;event.decode=function(data,topics){return contract.interface.decodeEventLog(parsed.eventFragment,data,topics)};event.event=parsed.name;event.eventSignature=parsed.signature}event.removeListener=function(){return contract.provider};event.getBlock=function(){return contract.provider.getBlock(receipt.blockHash)};event.getTransaction=function(){return contract.provider.getTransaction(receipt.transactionHash)};event.getTransactionReceipt=function(){return Promise.resolve(receipt)};return event});return receipt})};return[2,tx]}})})}}function buildDefault(contract,fragment,collapseSimple){if(fragment.constant){return buildCall(contract,fragment,collapseSimple)}return buildSend(contract,fragment)}function getEventTag(filter){if(filter.address&&(filter.topics==null||filter.topics.length===0)){return"*"}return(filter.address||"*")+"@"+(filter.topics?filter.topics.map(function(topic){if(Array.isArray(topic)){return topic.join("|")}return topic}).join(":"):"")}var RunningEvent=function(){function RunningEvent(tag,filter){properties_1.defineReadOnly(this,"tag",tag);properties_1.defineReadOnly(this,"filter",filter);this._listeners=[]}RunningEvent.prototype.addListener=function(listener,once){this._listeners.push({listener:listener,once:once})};RunningEvent.prototype.removeListener=function(listener){var done=false;this._listeners=this._listeners.filter(function(item){if(done||item.listener!==listener){return true}done=true;return false})};RunningEvent.prototype.removeAllListeners=function(){this._listeners=[]};RunningEvent.prototype.listeners=function(){return this._listeners.map(function(i){return i.listener})};RunningEvent.prototype.listenerCount=function(){return this._listeners.length};RunningEvent.prototype.run=function(args){var _this=this;var listenerCount=this.listenerCount();this._listeners=this._listeners.filter(function(item){var argsCopy=args.slice();setTimeout(function(){item.listener.apply(_this,argsCopy)},0);return!item.once});return listenerCount};RunningEvent.prototype.prepareEvent=function(event){};RunningEvent.prototype.getEmit=function(event){return[event]};return RunningEvent}();var ErrorRunningEvent=function(_super){__extends(ErrorRunningEvent,_super);function ErrorRunningEvent(){return _super.call(this,"error",null)||this}return ErrorRunningEvent}(RunningEvent);var FragmentRunningEvent=function(_super){__extends(FragmentRunningEvent,_super);function FragmentRunningEvent(address,contractInterface,fragment,topics){var _this=this;var filter={address:address};var topic=contractInterface.getEventTopic(fragment);if(topics){if(topic!==topics[0]){logger.throwArgumentError("topic mismatch","topics",topics)}filter.topics=topics.slice()}else{filter.topics=[topic]}_this=_super.call(this,getEventTag(filter),filter)||this;properties_1.defineReadOnly(_this,"address",address);properties_1.defineReadOnly(_this,"interface",contractInterface);properties_1.defineReadOnly(_this,"fragment",fragment);return _this}FragmentRunningEvent.prototype.prepareEvent=function(event){var _this=this;_super.prototype.prepareEvent.call(this,event);event.event=this.fragment.name;event.eventSignature=this.fragment.format();event.decode=function(data,topics){return _this.interface.decodeEventLog(_this.fragment,data,topics)};try{event.args=this.interface.decodeEventLog(this.fragment,event.data,event.topics)}catch(error){event.args=null;event.decodeError=error}};FragmentRunningEvent.prototype.getEmit=function(event){var errors=abi_1.checkResultErrors(event.args);if(errors.length){throw errors[0].error}var args=(event.args||[]).slice();args.push(event);return args};return FragmentRunningEvent}(RunningEvent);var WildcardRunningEvent=function(_super){__extends(WildcardRunningEvent,_super);function WildcardRunningEvent(address,contractInterface){var _this=_super.call(this,"*",{address:address})||this;properties_1.defineReadOnly(_this,"address",address);properties_1.defineReadOnly(_this,"interface",contractInterface);return _this}WildcardRunningEvent.prototype.prepareEvent=function(event){var _this=this;_super.prototype.prepareEvent.call(this,event);try{var parsed_1=this.interface.parseLog(event);event.event=parsed_1.name;event.eventSignature=parsed_1.signature;event.decode=function(data,topics){return _this.interface.decodeEventLog(parsed_1.eventFragment,data,topics)};event.args=parsed_1.args}catch(error){}};return WildcardRunningEvent}(RunningEvent);var Contract=function(){function Contract(addressOrName,contractInterface,signerOrProvider){var _newTarget=this.constructor;var _this=this;logger.checkNew(_newTarget,Contract);properties_1.defineReadOnly(this,"interface",properties_1.getStatic(_newTarget,"getInterface")(contractInterface));if(signerOrProvider==null){properties_1.defineReadOnly(this,"provider",null);properties_1.defineReadOnly(this,"signer",null)}else if(abstract_signer_1.Signer.isSigner(signerOrProvider)){properties_1.defineReadOnly(this,"provider",signerOrProvider.provider||null);properties_1.defineReadOnly(this,"signer",signerOrProvider)}else if(abstract_provider_1.Provider.isProvider(signerOrProvider)){properties_1.defineReadOnly(this,"provider",signerOrProvider);properties_1.defineReadOnly(this,"signer",null)}else{logger.throwArgumentError("invalid signer or provider","signerOrProvider",signerOrProvider)}properties_1.defineReadOnly(this,"callStatic",{});properties_1.defineReadOnly(this,"estimateGas",{});properties_1.defineReadOnly(this,"functions",{});properties_1.defineReadOnly(this,"populateTransaction",{});properties_1.defineReadOnly(this,"filters",{});{var uniqueFilters_1={};Object.keys(this.interface.events).forEach(function(eventSignature){var event=_this.interface.events[eventSignature];properties_1.defineReadOnly(_this.filters,eventSignature,function(){var args=[];for(var _i=0;_i<arguments.length;_i++){args[_i]=arguments[_i]}return{address:_this.address,topics:_this.interface.encodeFilterTopics(event,args)}});if(!uniqueFilters_1[event.name]){uniqueFilters_1[event.name]=[]}uniqueFilters_1[event.name].push(eventSignature)});Object.keys(uniqueFilters_1).forEach(function(name){var filters=uniqueFilters_1[name];if(filters.length===1){properties_1.defineReadOnly(_this.filters,name,_this.filters[filters[0]])}else{logger.warn("Duplicate definition of "+name+" ("+filters.join(", ")+")")}})}properties_1.defineReadOnly(this,"_runningEvents",{});properties_1.defineReadOnly(this,"_wrappedEmits",{});properties_1.defineReadOnly(this,"address",addressOrName);if(this.provider){properties_1.defineReadOnly(this,"resolvedAddress",this.provider.resolveName(addressOrName).then(function(address){if(address==null){throw new Error("name not found")}return address}).catch(function(error){console.log("ERROR: Cannot find Contract - "+addressOrName);throw error}))}else{try{properties_1.defineReadOnly(this,"resolvedAddress",Promise.resolve(address_1.getAddress(addressOrName)))}catch(error){logger.throwError("provider is required to use ENS name as contract address",logger_1.Logger.errors.UNSUPPORTED_OPERATION,{operation:"new Contract"})}}var uniqueNames={};var uniqueSignatures={};Object.keys(this.interface.functions).forEach(function(signature){var fragment=_this.interface.functions[signature];if(uniqueSignatures[signature]){logger.warn("Duplicate ABI entry for "+JSON.stringify(name));return}uniqueSignatures[signature]=true;{var name_1=fragment.name;if(!uniqueNames[name_1]){uniqueNames[name_1]=[]}uniqueNames[name_1].push(signature)}if(_this[signature]==null){properties_1.defineReadOnly(_this,signature,buildDefault(_this,fragment,true))}if(_this.functions[signature]==null){properties_1.defineReadOnly(_this.functions,signature,buildDefault(_this,fragment,false))}if(_this.callStatic[signature]==null){properties_1.defineReadOnly(_this.callStatic,signature,buildCall(_this,fragment,true))}if(_this.populateTransaction[signature]==null){properties_1.defineReadOnly(_this.populateTransaction,signature,buildPopulate(_this,fragment))}if(_this.estimateGas[signature]==null){properties_1.defineReadOnly(_this.estimateGas,signature,buildEstimate(_this,fragment))}});Object.keys(uniqueNames).forEach(function(name){var signatures=uniqueNames[name];if(signatures.length>1){return}var signature=signatures[0];if(_this[name]==null){properties_1.defineReadOnly(_this,name,_this[signature])}if(_this.functions[name]==null){properties_1.defineReadOnly(_this.functions,name,_this.functions[signature])}if(_this.callStatic[name]==null){properties_1.defineReadOnly(_this.callStatic,name,_this.callStatic[signature])}if(_this.populateTransaction[name]==null){properties_1.defineReadOnly(_this.populateTransaction,name,_this.populateTransaction[signature])}if(_this.estimateGas[name]==null){properties_1.defineReadOnly(_this.estimateGas,name,_this.estimateGas[signature])}})}Contract.getContractAddress=function(transaction){return address_1.getContractAddress(transaction)};Contract.getInterface=function(contractInterface){if(abi_1.Interface.isInterface(contractInterface)){return contractInterface}return new abi_1.Interface(contractInterface)};Contract.prototype.deployed=function(){return this._deployed()};Contract.prototype._deployed=function(blockTag){var _this=this;if(!this._deployedPromise){if(this.deployTransaction){this._deployedPromise=this.deployTransaction.wait().then(function(){return _this})}else{this._deployedPromise=this.provider.getCode(this.address,blockTag).then(function(code){if(code==="0x"){logger.throwError("contract not deployed",logger_1.Logger.errors.UNSUPPORTED_OPERATION,{contractAddress:_this.address,operation:"getDeployed"})}return _this})}}return this._deployedPromise};Contract.prototype.fallback=function(overrides){var _this=this;if(!this.signer){logger.throwError("sending a transactions require a signer",logger_1.Logger.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"})}var tx=properties_1.shallowCopy(overrides||{});["from","to"].forEach(function(key){if(tx[key]==null){return}logger.throwError("cannot override "+key,logger_1.Logger.errors.UNSUPPORTED_OPERATION,{operation:key})});tx.to=this.resolvedAddress;return this.deployed().then(function(){return _this.signer.sendTransaction(tx)})};Contract.prototype.connect=function(signerOrProvider){if(typeof signerOrProvider==="string"){signerOrProvider=new abstract_signer_1.VoidSigner(signerOrProvider,this.provider)}var contract=new this.constructor(this.address,this.interface,signerOrProvider);if(this.deployTransaction){properties_1.defineReadOnly(contract,"deployTransaction",this.deployTransaction)}return contract};Contract.prototype.attach=function(addressOrName){return new this.constructor(addressOrName,this.interface,this.signer||this.provider)};Contract.isIndexed=function(value){return abi_1.Indexed.isIndexed(value)};Contract.prototype._normalizeRunningEvent=function(runningEvent){if(this._runningEvents[runningEvent.tag]){return this._runningEvents[runningEvent.tag]}return runningEvent};Contract.prototype._getRunningEvent=function(eventName){if(typeof eventName==="string"){if(eventName==="error"){return this._normalizeRunningEvent(new ErrorRunningEvent)}if(eventName==="event"){return this._normalizeRunningEvent(new RunningEvent("event",null))}if(eventName==="*"){return this._normalizeRunningEvent(new WildcardRunningEvent(this.address,this.interface))}var fragment=this.interface.getEvent(eventName);return this._normalizeRunningEvent(new FragmentRunningEvent(this.address,this.interface,fragment))}if(eventName.topics&&eventName.topics.length>0){try{var topic=eventName.topics[0];if(typeof topic!=="string"){throw new Error("invalid topic")}var fragment=this.interface.getEvent(topic);return this._normalizeRunningEvent(new FragmentRunningEvent(this.address,this.interface,fragment,eventName.topics))}catch(error){}var filter={address:this.address,topics:eventName.topics};return this._normalizeRunningEvent(new RunningEvent(getEventTag(filter),filter))}return this._normalizeRunningEvent(new WildcardRunningEvent(this.address,this.interface))};Contract.prototype._checkRunningEvents=function(runningEvent){if(runningEvent.listenerCount()===0){delete this._runningEvents[runningEvent.tag];var emit=this._wrappedEmits[runningEvent.tag];if(emit){this.provider.off(runningEvent.filter,emit);delete this._wrappedEmits[runningEvent.tag]}}};Contract.prototype._wrapEvent=function(runningEvent,log,listener){var _this=this;var event=properties_1.deepCopy(log);event.removeListener=function(){if(!listener){return}runningEvent.removeListener(listener);_this._checkRunningEvents(runningEvent)};event.getBlock=function(){return _this.provider.getBlock(log.blockHash)};event.getTransaction=function(){return _this.provider.getTransaction(log.transactionHash)};event.getTransactionReceipt=function(){return _this.provider.getTransactionReceipt(log.transactionHash)};runningEvent.prepareEvent(event);return event};Contract.prototype._addEventListener=function(runningEvent,listener,once){var _this=this;if(!this.provider){logger.throwError("events require a provider or a signer with a provider",logger_1.Logger.errors.UNSUPPORTED_OPERATION,{operation:"once"})}runningEvent.addListener(listener,once);this._runningEvents[runningEvent.tag]=runningEvent;if(!this._wrappedEmits[runningEvent.tag]){var wrappedEmit=function(log){var event=_this._wrapEvent(runningEvent,log,listener);if(event.decodeError==null){try{var args=runningEvent.getEmit(event);_this.emit.apply(_this,__spreadArrays([runningEvent.filter],args))}catch(error){event.decodeError=error.error}}if(runningEvent.filter!=null){_this.emit("event",event)}if(event.decodeError!=null){_this.emit("error",event.decodeError,event)}};this._wrappedEmits[runningEvent.tag]=wrappedEmit;if(runningEvent.filter!=null){this.provider.on(runningEvent.filter,wrappedEmit)}}};Contract.prototype.queryFilter=function(event,fromBlockOrBlockhash,toBlock){var _this=this;var runningEvent=this._getRunningEvent(event);var filter=properties_1.shallowCopy(runningEvent.filter);if(typeof fromBlockOrBlockhash==="string"&&bytes_1.isHexString(fromBlockOrBlockhash,32)){if(toBlock!=null){logger.throwArgumentError("cannot specify toBlock with blockhash","toBlock",toBlock)}filter.blockHash=fromBlockOrBlockhash}else{filter.fromBlock=fromBlockOrBlockhash!=null?fromBlockOrBlockhash:0;filter.toBlock=toBlock!=null?toBlock:"latest"}return this.provider.getLogs(filter).then(function(logs){return logs.map(function(log){return _this._wrapEvent(runningEvent,log,null)})})};Contract.prototype.on=function(event,listener){this._addEventListener(this._getRunningEvent(event),listener,false);return this};Contract.prototype.once=function(event,listener){this._addEventListener(this._getRunningEvent(event),listener,true);return this};Contract.prototype.emit=function(eventName){var args=[];for(var _i=1;_i<arguments.length;_i++){args[_i-1]=arguments[_i]}if(!this.provider){return false}var runningEvent=this._getRunningEvent(eventName);var result=runningEvent.run(args)>0;this._checkRunningEvents(runningEvent);return result};Contract.prototype.listenerCount=function(eventName){if(!this.provider){return 0}return this._getRunningEvent(eventName).listenerCount()};Contract.prototype.listeners=function(eventName){if(!this.provider){return[]}if(eventName==null){var result_1=[];for(var tag in this._runningEvents){this._runningEvents[tag].listeners().forEach(function(listener){result_1.push(listener)})}return result_1}return this._getRunningEvent(eventName).listeners()};Contract.prototype.removeAllListeners=function(eventName){if(!this.provider){return this}if(eventName==null){for(var tag in this._runningEvents){var runningEvent_1=this._runningEvents[tag];runningEvent_1.removeAllListeners();this._checkRunningEvents(runningEvent_1)}return this}var runningEvent=this._getRunningEvent(eventName);runningEvent.removeAllListeners();this._checkRunningEvents(runningEvent);return this};Contract.prototype.off=function(eventName,listener){if(!this.provider){return this}var runningEvent=this._getRunningEvent(eventName);runningEvent.removeListener(listener);this._checkRunningEvents(runningEvent);return this};Contract.prototype.removeListener=function(eventName,listener){return this.off(eventName,listener)};return Contract}();exports.Contract=Contract;var ContractFactory=function(){function ContractFactory(contractInterface,bytecode,signer){var _newTarget=this.constructor;var bytecodeHex=null;if(typeof bytecode==="string"){bytecodeHex=bytecode}else if(bytes_1.isBytes(bytecode)){bytecodeHex=bytes_1.hexlify(bytecode)}else if(bytecode&&typeof bytecode.object==="string"){bytecodeHex=bytecode.object}else{bytecodeHex="!"}if(bytecodeHex.substring(0,2)!=="0x"){bytecodeHex="0x"+bytecodeHex}if(!bytes_1.isHexString(bytecodeHex)||bytecodeHex.length%2){logger.throwArgumentError("invalid bytecode","bytecode",bytecode)}if(signer&&!abstract_signer_1.Signer.isSigner(signer)){logger.throwArgumentError("invalid signer","signer",signer)}properties_1.defineReadOnly(this,"bytecode",bytecodeHex);properties_1.defineReadOnly(this,"interface",properties_1.getStatic(_newTarget,"getInterface")(contractInterface));properties_1.defineReadOnly(this,"signer",signer||null)}ContractFactory.prototype.getDeployTransaction=function(){var args=[];for(var _i=0;_i<arguments.length;_i++){args[_i]=arguments[_i]}var tx={};if(args.length===this.interface.deploy.inputs.length+1&&typeof args[args.length-1]==="object"){tx=properties_1.shallowCopy(args.pop());for(var key in tx){if(!allowedTransactionKeys[key]){throw new Error("unknown transaction override "+key)}}}["data","from","to"].forEach(function(key){if(tx[key]==null){return}logger.throwError("cannot override "+key,logger_1.Logger.errors.UNSUPPORTED_OPERATION,{operation:key})});logger.checkArgumentCount(args.length,this.interface.deploy.inputs.length," in Contract constructor");tx.data=bytes_1.hexlify(bytes_1.concat([this.bytecode,this.interface.encodeDeploy(args)]));return tx};ContractFactory.prototype.deploy=function(){var args=[];for(var _i=0;_i<arguments.length;_i++){args[_i]=arguments[_i]}return __awaiter(this,void 0,void 0,function(){var overrides,params,unsignedTx,tx,address,contract;return __generator(this,function(_a){switch(_a.label){case 0:overrides={};if(args.length===this.interface.deploy.inputs.length+1){overrides=args.pop()}logger.checkArgumentCount(args.length,this.interface.deploy.inputs.length," in Contract constructor");return[4,resolveAddresses(this.signer,args,this.interface.deploy.inputs)];case 1:params=_a.sent();params.push(overrides);unsignedTx=this.getDeployTransaction.apply(this,params);return[4,this.signer.sendTransaction(unsignedTx)];case 2:tx=_a.sent();address=properties_1.getStatic(this.constructor,"getContractAddress")(tx);contract=properties_1.getStatic(this.constructor,"getContract")(address,this.interface,this.signer);properties_1.defineReadOnly(contract,"deployTransaction",tx);return[2,contract]}})})};ContractFactory.prototype.attach=function(address){return this.constructor.getContract(address,this.interface,this.signer)};ContractFactory.prototype.connect=function(signer){return new this.constructor(this.interface,this.bytecode,signer)};ContractFactory.fromSolidity=function(compilerOutput,signer){if(compilerOutput==null){logger.throwError("missing compiler output",logger_1.Logger.errors.MISSING_ARGUMENT,{argument:"compilerOutput"})}if(typeof compilerOutput==="string"){compilerOutput=JSON.parse(compilerOutput)}var abi=compilerOutput.abi;var bytecode=null;if(compilerOutput.bytecode){bytecode=compilerOutput.bytecode}else if(compilerOutput.evm&&compilerOutput.evm.bytecode){bytecode=compilerOutput.evm.bytecode}return new this(abi,bytecode,signer)};ContractFactory.getInterface=function(contractInterface){return Contract.getInterface(contractInterface)};ContractFactory.getContractAddress=function(tx){return address_1.getContractAddress(tx)};ContractFactory.getContract=function(address,contractInterface,signer){return new Contract(address,contractInterface,signer)};return ContractFactory}();exports.ContractFactory=ContractFactory},{"./_version":32,"@ethersproject/abi":16,"@ethersproject/abstract-provider":19,"@ethersproject/abstract-signer":21,"@ethersproject/address":23,"@ethersproject/bignumber":28,"@ethersproject/bytes":30,"@ethersproject/logger":38,"@ethersproject/properties":42}],34:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.version="hash/5.0.1"},{}],35:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var bytes_1=require("@ethersproject/bytes");var strings_1=require("@ethersproject/strings");var keccak256_1=require("@ethersproject/keccak256");var logger_1=require("@ethersproject/logger");var _version_1=require("./_version");var logger=new logger_1.Logger(_version_1.version);var Zeros=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);var Partition=new RegExp("^((.*)\\.)?([^.]+)$");function isValidName(name){try{var comps=name.split(".");for(var i=0;i<comps.length;i++){if(strings_1.nameprep(comps[i]).length===0){throw new Error("empty")}}return true}catch(error){}return false}exports.isValidName=isValidName;function namehash(name){if(typeof name!=="string"){logger.throwArgumentError("invalid address - "+String(name),"name",name)}var result=Zeros;while(name.length){var partition=name.match(Partition);var label=strings_1.toUtf8Bytes(strings_1.nameprep(partition[3]));result=keccak256_1.keccak256(bytes_1.concat([result,keccak256_1.keccak256(label)]));name=partition[2]||""}return bytes_1.hexlify(result)}exports.namehash=namehash;function id(text){return keccak256_1.keccak256(strings_1.toUtf8Bytes(text))}exports.id=id;exports.messagePrefix="Ethereum Signed Message:\n";function hashMessage(message){if(typeof message==="string"){message=strings_1.toUtf8Bytes(message)}return keccak256_1.keccak256(bytes_1.concat([strings_1.toUtf8Bytes(exports.messagePrefix),strings_1.toUtf8Bytes(String(message.length)),message]))}exports.hashMessage=hashMessage},{"./_version":34,"@ethersproject/bytes":30,"@ethersproject/keccak256":36,"@ethersproject/logger":38,"@ethersproject/strings":84}],36:[function(require,module,exports){"use strict";var __importDefault=this&&this.__importDefault||function(mod){return mod&&mod.__esModule?mod:{default:mod}};Object.defineProperty(exports,"__esModule",{value:true});var js_sha3_1=__importDefault(require("js-sha3"));var bytes_1=require("@ethersproject/bytes");function keccak256(data){return"0x"+js_sha3_1.default.keccak_256(bytes_1.arrayify(data))}exports.keccak256=keccak256},{"@ethersproject/bytes":30,"js-sha3":130}],37:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.version="logger/5.0.2"},{}],38:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var _permanentCensorErrors=false;var _censorErrors=false;var LogLevels={debug:1,default:2,info:2,warning:3,error:4,off:5};var _logLevel=LogLevels["default"];var _version_1=require("./_version");var _globalLogger=null;function _checkNormalize(){try{var missing_1=[];["NFD","NFC","NFKD","NFKC"].forEach(function(form){try{if("test".normalize(form)!=="test"){throw new Error("bad normalize")}}catch(error){missing_1.push(form)}});if(missing_1.length){throw new Error("missing "+missing_1.join(", "))}if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769)){throw new Error("broken implementation")}}catch(error){return error.message}return null}var _normalizeError=_checkNormalize();var LogLevel;(function(LogLevel){LogLevel["DEBUG"]="DEBUG";LogLevel["INFO"]="INFO";LogLevel["WARNING"]="WARNING";LogLevel["ERROR"]="ERROR";LogLevel["OFF"]="OFF"})(LogLevel=exports.LogLevel||(exports.LogLevel={}));var ErrorCode;(function(ErrorCode){ErrorCode["UNKNOWN_ERROR"]="UNKNOWN_ERROR";ErrorCode["NOT_IMPLEMENTED"]="NOT_IMPLEMENTED";ErrorCode["UNSUPPORTED_OPERATION"]="UNSUPPORTED_OPERATION";ErrorCode["NETWORK_ERROR"]="NETWORK_ERROR";ErrorCode["SERVER_ERROR"]="SERVER_ERROR";ErrorCode["TIMEOUT"]="TIMEOUT";ErrorCode["BUFFER_OVERRUN"]="BUFFER_OVERRUN";ErrorCode["NUMERIC_FAULT"]="NUMERIC_FAULT";ErrorCode["MISSING_NEW"]="MISSING_NEW";ErrorCode["INVALID_ARGUMENT"]="INVALID_ARGUMENT";ErrorCode["MISSING_ARGUMENT"]="MISSING_ARGUMENT";ErrorCode["UNEXPECTED_ARGUMENT"]="UNEXPECTED_ARGUMENT";ErrorCode["CALL_EXCEPTION"]="CALL_EXCEPTION";ErrorCode["INSUFFICIENT_FUNDS"]="INSUFFICIENT_FUNDS";ErrorCode["NONCE_EXPIRED"]="NONCE_EXPIRED";ErrorCode["REPLACEMENT_UNDERPRICED"]="REPLACEMENT_UNDERPRICED";ErrorCode["UNPREDICTABLE_GAS_LIMIT"]="UNPREDICTABLE_GAS_LIMIT"})(ErrorCode=exports.ErrorCode||(exports.ErrorCode={}));var Logger=function(){function Logger(version){Object.defineProperty(this,"version",{enumerable:true,value:version,writable:false})}Logger.prototype._log=function(logLevel,args){var level=logLevel.toLowerCase();if(LogLevels[level]==null){this.throwArgumentError("invalid log level name","logLevel",logLevel)}if(_logLevel>LogLevels[level]){return}console.log.apply(console,args)};Logger.prototype.debug=function(){var args=[];for(var _i=0;_i<arguments.length;_i++){args[_i]=arguments[_i]}this._log(Logger.levels.DEBUG,args)};Logger.prototype.info=function(){var args=[];for(var _i=0;_i<arguments.length;_i++){args[_i]=arguments[_i]}this._log(Logger.levels.INFO,args)};Logger.prototype.warn=function(){var args=[];for(var _i=0;_i<arguments.length;_i++){args[_i]=arguments[_i]}this._log(Logger.levels.WARNING,args)};Logger.prototype.makeError=function(message,code,params){if(_censorErrors){return this.makeError("censored error",code,{})}if(!code){code=Logger.errors.UNKNOWN_ERROR}if(!params){params={}}var messageDetails=[];Object.keys(params).forEach(function(key){try{messageDetails.push(key+"="+JSON.stringify(params[key]))}catch(error){messageDetails.push(key+"="+JSON.stringify(params[key].toString()))}});messageDetails.push("code="+code);messageDetails.push("version="+this.version);var reason=message;if(messageDetails.length){message+=" ("+messageDetails.join(", ")+")"}var error=new Error(message);error.reason=reason;error.code=code;Object.keys(params).forEach(function(key){error[key]=params[key]});return error};Logger.prototype.throwError=function(message,code,params){throw this.makeError(message,code,params)};Logger.prototype.throwArgumentError=function(message,name,value){return this.throwError(message,Logger.errors.INVALID_ARGUMENT,{argument:name,value:value})};Logger.prototype.checkNormalize=function(message){if(message==null){message="platform missing String.prototype.normalize"}if(_normalizeError){this.throwError("platform missing String.prototype.normalize",Logger.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:_normalizeError})}};Logger.prototype.checkSafeUint53=function(value,message){if(typeof value!=="number"){return}if(message==null){message="value not safe"}if(value<0||value>=9007199254740991){this.throwError(message,Logger.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:value})}if(value%1){this.throwError(message,Logger.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:value})}};Logger.prototype.checkArgumentCount=function(count,expectedCount,message){if(message){message=": "+message}else{message=""}if(count<expectedCount){this.throwError("missing argument"+message,Logger.errors.MISSING_ARGUMENT,{count:count,expectedCount:expectedCount})}if(count>expectedCount){this.throwError("too many arguments"+message,Logger.errors.UNEXPECTED_ARGUMENT,{count:count,expectedCount:expectedCount})}};Logger.prototype.checkNew=function(target,kind){if(target===Object||target==null){this.throwError("missing new",Logger.errors.MISSING_NEW,{name:kind.name})}};Logger.prototype.checkAbstract=function(target,kind){if(target===kind){this.throwError("cannot instantiate abstract class "+JSON.stringify(kind.name)+" directly; use a sub-class",Logger.errors.UNSUPPORTED_OPERATION,{name:target.name,operation:"new"})}else if(target===Object||target==null){this.throwError("missing new",Logger.errors.MISSING_NEW,{name:kind.name})}};Logger.globalLogger=function(){if(!_globalLogger){_globalLogger=new Logger(_version_1.version)}return _globalLogger};Logger.setCensorship=function(censorship,permanent){if(!censorship&&permanent){this.globalLogger().throwError("cannot permanently disable censorship",Logger.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}if(_permanentCensorErrors){if(!censorship){return}this.globalLogger().throwError("error censorship permanent",Logger.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}_censorErrors=!!censorship;_permanentCensorErrors=!!permanent};Logger.setLogLevel=function(logLevel){var level=LogLevels[logLevel];if(level==null){Logger.globalLogger().warn("invalid log level - "+logLevel);return}_logLevel=level};Logger.errors=ErrorCode;Logger.levels=LogLevel;return Logger}();exports.Logger=Logger},{"./_version":37}],39:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.version="networks/5.0.1"},{}],40:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var logger_1=require("@ethersproject/logger");var _version_1=require("./_version");var logger=new logger_1.Logger(_version_1.version);function ethDefaultProvider(network){return function(providers,options){if(options==null){options={}}var providerList=[];if(providers.InfuraProvider){try{providerList.push(new providers.InfuraProvider(network,options.infura))}catch(error){}}if(providers.EtherscanProvider){try{providerList.push(new providers.EtherscanProvider(network,options.etherscan))}catch(error){}}if(providers.AlchemyProvider){try{providerList.push(new providers.AlchemyProvider(network,options.alchemy))}catch(error){}}if(providers.CloudflareProvider){try{providerList.push(new providers.CloudflareProvider(network))}catch(error){}}if(providerList.length===0){return null}if(providers.FallbackProvider){var quorum=1;if(options.quorum!=null){quorum=options.quorum}else if(network==="homestead"){quorum=2}return new providers.FallbackProvider(providerList,quorum)}return providerList[0]}}function etcDefaultProvider(url,network){return function(providers,options){if(providers.JsonRpcProvider){return new providers.JsonRpcProvider(url,network)}return null}}var homestead={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:ethDefaultProvider("homestead")};var ropsten={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:ethDefaultProvider("ropsten")};var classicMordor={chainId:63,name:"classicMordor",_defaultProvider:etcDefaultProvider("https://www.ethercluster.com/mordor","classicMordor")};var networks={unspecified:{chainId:0,name:"unspecified"},homestead:homestead,mainnet:homestead,morden:{chainId:2,name:"morden"},ropsten:ropsten,testnet:ropsten,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:ethDefaultProvider("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:ethDefaultProvider("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:ethDefaultProvider("goerli")},classic:{chainId:61,name:"classic",_defaultProvider:etcDefaultProvider("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:classicMordor,classicTestnet:classicMordor,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:etcDefaultProvider("https://www.ethercluster.com/kotti","classicKotti")}};function getNetwork(network){if(network==null){return null}if(typeof network==="number"){for(var name_1 in networks){var standard_1=networks[name_1];if(standard_1.chainId===network){return{name:standard_1.name,chainId:standard_1.chainId,ensAddress:standard_1.ensAddress||null,_defaultProvider:standard_1._defaultProvider||null}}}return{chainId:network,name:"unknown"}}if(typeof network==="string"){var standard_2=networks[network];if(standard_2==null){return null}return{name:standard_2.name,chainId:standard_2.chainId,ensAddress:standard_2.ensAddress,_defaultProvider:standard_2._defaultProvider||null}}var standard=networks[network.name];if(!standard){if(typeof network.chainId!=="number"){logger.throwArgumentError("invalid network chainId","network",network)}return network}if(network.chainId!==0&&network.chainId!==standard.chainId){logger.throwArgumentError("network chainId mismatch","network",network)}return{name:network.name,chainId:standard.chainId,ensAddress:network.ensAddress||standard.ensAddress||null,_defaultProvider:network._defaultProvider||standard._defaultProvider||null}}exports.getNetwork=getNetwork},{"./_version":39,"@ethersproject/logger":38}],41:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.version="properties/5.0.1"},{}],42:[function(require,module,exports){"use strict";var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){function adopt(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator["throw"](value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})};var __generator=this&&this.__generator||function(thisArg,body){var _={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},f,y,t,g;return g={next:verb(0),throw:verb(1),return:verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(_)try{if(f=1,y&&(t=op[0]&2?y["return"]:op[0]?y["throw"]||((t=y["return"])&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[op[0]&2,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return{value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break}if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break}if(t[2])_.ops.pop();_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e];y=0}finally{f=t=0}if(op[0]&5)throw op[1];return{value:op[0]?op[1]:void 0,done:true}}};Object.defineProperty(exports,"__esModule",{value:true});var logger_1=require("@ethersproject/logger");var _version_1=require("./_version");var logger=new logger_1.Logger(_version_1.version);function defineReadOnly(object,name,value){Object.defineProperty(object,name,{enumerable:true,value:value,writable:false})}exports.defineReadOnly=defineReadOnly;function getStatic(ctor,key){for(var i=0;i<32;i++){if(ctor[key]){return ctor[key]}if(!ctor.prototype||typeof ctor.prototype!=="object"){break}ctor=Object.getPrototypeOf(ctor.prototype).constructor}return null}exports.getStatic=getStatic;function resolveProperties(object){return __awaiter(this,void 0,void 0,function(){var promises,results;return __generator(this,function(_a){switch(_a.label){case 0:promises=Object.keys(object).map(function(key){var value=object[key];return Promise.resolve(value).then(function(v){return{key:key,value:v}})});return[4,Promise.all(promises)];case 1:results=_a.sent();return[2,results.reduce(function(accum,result){accum[result.key]=result.value;return accum},{})]}})})}exports.resolveProperties=resolveProperties;function checkProperties(object,properties){if(!object||typeof object!=="object"){logger.throwArgumentError("invalid object","object",object)}Object.keys(object).forEach(function(key){if(!properties[key]){logger.throwArgumentError("invalid object key - "+key,"transaction:"+key,object)}})}exports.checkProperties=checkProperties;function shallowCopy(object){var result={};for(var key in object){result[key]=object[key]}return result}exports.shallowCopy=shallowCopy;var opaque={bigint:true,boolean:true,function:true,number:true,string:true};function _isFrozen(object){if(object===undefined||object===null||opaque[typeof object]){return true}if(Array.isArray(object)||typeof object==="object"){if(!Object.isFrozen(object)){return false}var keys=Object.keys(object);for(var i=0;i<keys.length;i++){if(!_isFrozen(object[keys[i]])){return false}}return true}return logger.throwArgumentError("Cannot deepCopy "+typeof object,"object",object)}function _deepCopy(object){if(_isFrozen(object)){return object}if(Array.isArray(object)){return Object.freeze(object.map(function(item){return deepCopy(item)}))}if(typeof object==="object"){var result={};for(var key in object){var value=object[key];if(value===undefined){continue}defineReadOnly(result,key,deepCopy(value))}return result}return logger.throwArgumentError("Cannot deepCopy "+typeof object,"object",object)}function deepCopy(object){return _deepCopy(object)}exports.deepCopy=deepCopy;var Description=function(){function Description(info){for(var key in info){this[key]=deepCopy(info[key])}}return Description}();exports.Description=Description},{"./_version":41,"@ethersproject/logger":38}],43:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.version="providers/5.0.4"},{}],44:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p]};return extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();Object.defineProperty(exports,"__esModule",{value:true});var websocket_provider_1=require("./websocket-provider");var logger_1=require("@ethersproject/logger");var _version_1=require("./_version");var logger=new logger_1.Logger(_version_1.version);var url_json_rpc_provider_1=require("./url-json-rpc-provider");var defaultApiKey="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";var AlchemyProvider=function(_super){__extends(AlchemyProvider,_super);function AlchemyProvider(){return _super!==null&&_super.apply(this,arguments)||this}AlchemyProvider.getWebSocketProvider=function(network,apiKey){var provider=new AlchemyProvider(network,apiKey);var url=provider.connection.url.replace(/^http/i,"ws").replace(".alchemyapi.",".ws.alchemyapi.");return new websocket_provider_1.WebSocketProvider(url,provider.network)};AlchemyProvider.getApiKey=function(apiKey){if(apiKey==null){return defaultApiKey}if(apiKey&&typeof apiKey!=="string"){logger.throwArgumentError("invalid apiKey","apiKey",apiKey)}return apiKey};AlchemyProvider.getUrl=function(network,apiKey){var host=null;switch(network.name){case"homestead":host="eth-mainnet.alchemyapi.io/v2/";break;case"ropsten":host="eth-ropsten.alchemyapi.io/v2/";break;case"rinkeby":host="eth-rinkeby.alchemyapi.io/v2/";break;case"goerli":host="eth-goerli.alchemyapi.io/v2/";break;case"kovan":host="eth-kovan.alchemyapi.io/v2/";break;default:logger.throwArgumentError("unsupported network","network",arguments[0])}return"https:/"+"/"+host+apiKey};return AlchemyProvider}(url_json_rpc_provider_1.UrlJsonRpcProvider);exports.AlchemyProvider=AlchemyProvider},{"./_version":43,"./url-json-rpc-provider":56,"./websocket-provider":58,"@ethersproject/logger":38}],45:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p]};return extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){function adopt(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator["throw"](value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})};var __generator=this&&this.__generator||function(thisArg,body){var _={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},f,y,t,g;return g={next:verb(0),throw:verb(1),return:verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(_)try{if(f=1,y&&(t=op[0]&2?y["return"]:op[0]?y["throw"]||((t=y["return"])&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[op[0]&2,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return{value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break}if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break}if(t[2])_.ops.pop();_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e];y=0}finally{f=t=0}if(op[0]&5)throw op[1];return{value:op[0]?op[1]:void 0,done:true}}};Object.defineProperty(exports,"__esModule",{value:true});var abstract_provider_1=require("@ethersproject/abstract-provider");var bignumber_1=require("@ethersproject/bignumber");var bytes_1=require("@ethersproject/bytes");var hash_1=require("@ethersproject/hash");var networks_1=require("@ethersproject/networks");var properties_1=require("@ethersproject/properties");var strings_1=require("@ethersproject/strings");var web_1=require("@ethersproject/web");var logger_1=require("@ethersproject/logger");var _version_1=require("./_version");var logger=new logger_1.Logger(_version_1.version);var formatter_1=require("./formatter");function checkTopic(topic){if(topic==null){return"null"}if(bytes_1.hexDataLength(topic)!==32){logger.throwArgumentError("invalid topic","topic",topic)}return topic.toLowerCase()}function serializeTopics(topics){topics=topics.slice();while(topics.length>0&&topics[topics.length-1]==null){topics.pop()}return topics.map(function(topic){if(Array.isArray(topic)){var unique_1={};topic.forEach(function(topic){unique_1[checkTopic(topic)]=true});var sorted=Object.keys(unique_1);sorted.sort();return sorted.join("|")}else{return checkTopic(topic)}}).join("&")}function deserializeTopics(data){if(data===""){return[]}return data.split(/&/g).map(function(topic){if(topic===""){return[]}var comps=topic.split("|").map(function(topic){return topic==="null"?null:topic});return comps.length===1?comps[0]:comps})}function getEventTag(eventName){if(typeof eventName==="string"){eventName=eventName.toLowerCase();if(bytes_1.hexDataLength(eventName)===32){return"tx:"+eventName}if(eventName.indexOf(":")===-1){return eventName}}else if(Array.isArray(eventName)){return"filter:*:"+serializeTopics(eventName)}else if(abstract_provider_1.ForkEvent.isForkEvent(eventName)){logger.warn("not implemented");throw new Error("not implemented")}else if(eventName&&typeof eventName==="object"){return"filter:"+(eventName.address||"*")+":"+serializeTopics(eventName.topics||[])}throw new Error("invalid event - "+eventName)}function getTime(){return(new Date).getTime()}function stall(duration){return new Promise(function(resolve){setTimeout(resolve,duration)})}var PollableEvents=["block","network","pending","poll"];var Event=function(){function Event(tag,listener,once){properties_1.defineReadOnly(this,"tag",tag);properties_1.defineReadOnly(this,"listener",listener);properties_1.defineReadOnly(this,"once",once)}Object.defineProperty(Event.prototype,"event",{get:function(){switch(this.type){case"tx":return this.hash;case"filter":return this.filter}return this.tag},enumerable:true,configurable:true});Object.defineProperty(Event.prototype,"type",{get:function(){return this.tag.split(":")[0]},enumerable:true,configurable:true});Object.defineProperty(Event.prototype,"hash",{get:function(){var comps=this.tag.split(":");if(comps[0]!=="tx"){return null}return comps[1]},enumerable:true,configurable:true});Object.defineProperty(Event.prototype,"filter",{get:function(){var comps=this.tag.split(":");if(comps[0]!=="filter"){return null}var address=comps[1];var topics=deserializeTopics(comps[2]);var filter={};if(topics.length>0){filter.topics=topics}if(address&&address!=="*"){filter.address=address}return filter},enumerable:true,configurable:true});Event.prototype.pollable=function(){return this.tag.indexOf(":")>=0||PollableEvents.indexOf(this.tag)>=0};return Event}();exports.Event=Event;var defaultFormatter=null;var nextPollId=1;var BaseProvider=function(_super){__extends(BaseProvider,_super);function BaseProvider(network){var _newTarget=this.constructor;var _this=this;logger.checkNew(_newTarget,abstract_provider_1.Provider);_this=_super.call(this)||this;_this._events=[];_this._emitted={block:-2};_this.formatter=_newTarget.getFormatter();properties_1.defineReadOnly(_this,"anyNetwork",network==="any");if(_this.anyNetwork){network=_this.detectNetwork()}if(network instanceof Promise){_this._networkPromise=network;network.catch(function(error){});_this._ready().catch(function(error){})}else{var knownNetwork=properties_1.getStatic(_newTarget,"getNetwork")(network);if(knownNetwork){properties_1.defineReadOnly(_this,"_network",knownNetwork);_this.emit("network",knownNetwork,null)}else{logger.throwArgumentError("invalid network","network",network)}}_this._maxInternalBlockNumber=-1024;_this._lastBlockNumber=-2;_this._pollingInterval=4e3;_this._fastQueryDate=0;return _this}BaseProvider.prototype._ready=function(){return __awaiter(this,void 0,void 0,function(){var network,error_1;return __generator(this,function(_a){switch(_a.label){case 0:if(!(this._network==null))return[3,7];network=null;if(!this._networkPromise)return[3,4];_a.label=1;case 1:_a.trys.push([1,3,,4]);return[4,this._networkPromise];case 2:network=_a.sent();return[3,4];case 3:error_1=_a.sent();return[3,4];case 4:if(!(network==null))return[3,6];return[4,this.detectNetwork()];case 5:network=_a.sent();_a.label=6;case 6:if(!network){logger.throwError("no network detected",logger_1.Logger.errors.UNKNOWN_ERROR,{})}if(this._network==null){if(this.anyNetwork){this._network=network}else{properties_1.defineReadOnly(this,"_network",network)}this.emit("network",network,null)}_a.label=7;case 7:return[2,this._network]}})})};Object.defineProperty(BaseProvider.prototype,"ready",{get:function(){var _this=this;return web_1.poll(function(){return _this._ready().then(function(network){return network},function(error){if(error.code===logger_1.Logger.errors.NETWORK_ERROR&&error.event==="noNetwork"){return undefined}throw error})})},enumerable:true,configurable:true});BaseProvider.getFormatter=function(){if(defaultFormatter==null){defaultFormatter=new formatter_1.Formatter}return defaultFormatter};BaseProvider.getNetwork=function(network){return networks_1.getNetwork(network==null?"homestead":network)};BaseProvider.prototype._getInternalBlockNumber=function(maxAge){return __awaiter(this,void 0,void 0,function(){var internalBlockNumber,result,reqTime,checkInternalBlockNumber;var _this=this;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this._ready()];case 1:_a.sent();internalBlockNumber=this._internalBlockNumber;if(!(maxAge>0&&this._internalBlockNumber))return[3,3];return[4,internalBlockNumber];case 2:result=_a.sent();if(getTime()-result.respTime<=maxAge){return[2,result.blockNumber]}_a.label=3;case 3:reqTime=getTime();checkInternalBlockNumber=properties_1.resolveProperties({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then(function(network){return null},function(error){return error})}).then(function(_a){var blockNumber=_a.blockNumber,networkError=_a.networkError;if(networkError){if(_this._internalBlockNumber===checkInternalBlockNumber){_this._internalBlockNumber=null}throw networkError}var respTime=getTime();blockNumber=bignumber_1.BigNumber.from(blockNumber).toNumber();if(blockNumber<_this._maxInternalBlockNumber){blockNumber=_this._maxInternalBlockNumber}_this._maxInternalBlockNumber=blockNumber;_this._setFastBlockNumber(blockNumber);return{blockNumber:blockNumber,reqTime:reqTime,respTime:respTime}});this._internalBlockNumber=checkInternalBlockNumber;return[4,checkInternalBlockNumber];case 4:return[2,_a.sent().blockNumber]}})})};BaseProvider.prototype.poll=function(){return __awaiter(this,void 0,void 0,function(){var pollId,runners,blockNumber,i;var _this=this;return __generator(this,function(_a){switch(_a.label){case 0:pollId=nextPollId++;runners=[];return[4,this._getInternalBlockNumber(100+this.pollingInterval/2)];case 1:blockNumber=_a.sent();this._setFastBlockNumber(blockNumber);this.emit("poll",pollId,blockNumber);if(blockNumber===this._lastBlockNumber){this.emit("didPoll",pollId);return[2]}if(this._emitted.block===-2){this._emitted.block=blockNumber-1}if(Math.abs(this._emitted.block-blockNumber)>1e3){logger.warn("network block skew detected; skipping block events");this.emit("error",logger.makeError("network block skew detected",logger_1.Logger.errors.NETWORK_ERROR,{blockNumber:blockNumber,event:"blockSkew",previousBlockNumber:this._emitted.block}));this.emit("block",blockNumber)}else{for(i=this._emitted.block+1;i<=blockNumber;i++){this.emit("block",i)}}if(this._emitted.block!==blockNumber){this._emitted.block=blockNumber;Object.keys(this._emitted).forEach(function(key){if(key==="block"){return}var eventBlockNumber=_this._emitted[key];if(eventBlockNumber==="pending"){return}if(blockNumber-eventBlockNumber>12){delete _this._emitted[key]}})}if(this._lastBlockNumber===-2){this._lastBlockNumber=blockNumber-1}this._events.forEach(function(event){switch(event.type){case"tx":{var hash_2=event.hash;var runner=_this.getTransactionReceipt(hash_2).then(function(receipt){if(!receipt||receipt.blockNumber==null){return null}_this._emitted["t:"+hash_2]=receipt.blockNumber;_this.emit(hash_2,receipt);return null}).catch(function(error){_this.emit("error",error)});runners.push(runner);break}case"filter":{var filter_1=event.filter;filter_1.fromBlock=_this._lastBlockNumber+1;filter_1.toBlock=blockNumber;var runner=_this.getLogs(filter_1).then(function(logs){if(logs.length===0){return}logs.forEach(function(log){_this._emitted["b:"+log.blockHash]=log.blockNumber;_this._emitted["t:"+log.transactionHash]=log.blockNumber;_this.emit(filter_1,log)})}).catch(function(error){_this.emit("error",error)});runners.push(runner);break}}});this._lastBlockNumber=blockNumber;Promise.all(runners).then(function(){_this.emit("didPoll",pollId)});return[2,null]}})})};BaseProvider.prototype.resetEventsBlock=function(blockNumber){this._lastBlockNumber=blockNumber-1;if(this.polling){this.poll()}};Object.defineProperty(BaseProvider.prototype,"network",{get:function(){return this._network},enumerable:true,configurable:true});BaseProvider.prototype.detectNetwork=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){return[2,logger.throwError("provider does not support network detection",logger_1.Logger.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})]})})};BaseProvider.prototype.getNetwork=function(){return __awaiter(this,void 0,void 0,function(){var network,currentNetwork,error;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this._ready()];case 1:network=_a.sent();return[4,this.detectNetwork()];case 2:currentNetwork=_a.sent();if(!(network.chainId!==currentNetwork.chainId))return[3,5];if(!this.anyNetwork)return[3,4];this._network=currentNetwork;this._lastBlockNumber=-2;this._fastBlockNumber=null;this._fastBlockNumberPromise=null;this._fastQueryDate=0;this._emitted.block=-2;this._maxInternalBlockNumber=-1024;this._internalBlockNumber=null;this.emit("network",currentNetwork,network);return[4,stall(0)];case 3:_a.sent();return[2,this._network];case 4:error=logger.makeError("underlying network changed",logger_1.Logger.errors.NETWORK_ERROR,{event:"changed",network:network,detectedNetwork:currentNetwork});this.emit("error",error);throw error;case 5:return[2,network]}})})};Object.defineProperty(BaseProvider.prototype,"blockNumber",{get:function(){var _this=this;this._getInternalBlockNumber(100+this.pollingInterval/2).then(function(blockNumber){_this._setFastBlockNumber(blockNumber)});return this._fastBlockNumber!=null?this._fastBlockNumber:-1},enumerable:true,configurable:true});Object.defineProperty(BaseProvider.prototype,"polling",{get:function(){return this._poller!=null},set:function(value){var _this=this;if(value&&!this._poller){this._poller=setInterval(this.poll.bind(this),this.pollingInterval);if(!this._bootstrapPoll){this._bootstrapPoll=setTimeout(function(){_this.poll();_this._bootstrapPoll=setTimeout(function(){if(!_this._poller){_this.poll()}_this._bootstrapPoll=null},_this.pollingInterval)},0)}}else if(!value&&this._poller){clearInterval(this._poller);this._poller=null}},enumerable:true,configurable:true});Object.defineProperty(BaseProvider.prototype,"pollingInterval",{get:function(){return this._pollingInterval},set:function(value){var _this=this;if(typeof value!=="number"||value<=0||parseInt(String(value))!=value){throw new Error("invalid polling interval")}this._pollingInterval=value;if(this._poller){clearInterval(this._poller);this._poller=setInterval(function(){_this.poll()},this._pollingInterval)}},enumerable:true,configurable:true});BaseProvider.prototype._getFastBlockNumber=function(){var _this=this;var now=getTime();if(now-this._fastQueryDate>2*this._pollingInterval){this._fastQueryDate=now;this._fastBlockNumberPromise=this.getBlockNumber().then(function(blockNumber){if(_this._fastBlockNumber==null||blockNumber>_this._fastBlockNumber){_this._fastBlockNumber=blockNumber}return _this._fastBlockNumber})}return this._fastBlockNumberPromise};BaseProvider.prototype._setFastBlockNumber=function(blockNumber){if(this._fastBlockNumber!=null&&blockNumber<this._fastBlockNumber){return}this._fastQueryDate=getTime();if(this._fastBlockNumber==null||blockNumber>this._fastBlockNumber){this._fastBlockNumber=blockNumber;this._fastBlockNumberPromise=Promise.resolve(blockNumber)}};BaseProvider.prototype.waitForTransaction=function(transactionHash,confirmations,timeout){return __awaiter(this,void 0,void 0,function(){var receipt;var _this=this;return __generator(this,function(_a){switch(_a.label){case 0:if(confirmations==null){confirmations=1}return[4,this.getTransactionReceipt(transactionHash)];case 1:receipt=_a.sent();if((receipt?receipt.confirmations:0)>=confirmations){return[2,receipt]}return[2,new Promise(function(resolve,reject){var timer=null;var done=false;var handler=function(receipt){if(receipt.confirmations<confirmations){return}if(timer){clearTimeout(timer)}if(done){return}done=true;_this.removeListener(transactionHash,handler);resolve(receipt)};_this.on(transactionHash,handler);if(typeof timeout==="number"&&timeout>0){timer=setTimeout(function(){if(done){return}timer=null;done=true;_this.removeListener(transactionHash,handler);reject(logger.makeError("timeout exceeded",logger_1.Logger.errors.TIMEOUT,{timeout:timeout}))},timeout);if(timer.unref){timer.unref()}}})]}})})};BaseProvider.prototype.getBlockNumber=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){return[2,this._getInternalBlockNumber(0)]})})};BaseProvider.prototype.getGasPrice=function(){return __awaiter(this,void 0,void 0,function(){var _a,_b;return __generator(this,function(_c){switch(_c.label){case 0:return[4,this.getNetwork()];case 1:_c.sent();_b=(_a=bignumber_1.BigNumber).from;return[4,this.perform("getGasPrice",{})];case 2:return[2,_b.apply(_a,[_c.sent()])]}})})};BaseProvider.prototype.getBalance=function(addressOrName,blockTag){return __awaiter(this,void 0,void 0,function(){var params,_a,_b;return __generator(this,function(_c){switch(_c.label){case 0:return[4,this.getNetwork()];case 1:_c.sent();return[4,properties_1.resolveProperties({address:this._getAddress(addressOrName),blockTag:this._getBlockTag(blockTag)})];case 2:params=_c.sent();_b=(_a=bignumber_1.BigNumber).from;return[4,this.perform("getBalance",params)];case 3:return[2,_b.apply(_a,[_c.sent()])]}})})};BaseProvider.prototype.getTransactionCount=function(addressOrName,blockTag){return __awaiter(this,void 0,void 0,function(){var params,_a,_b;return __generator(this,function(_c){switch(_c.label){case 0:return[4,this.getNetwork()];case 1:_c.sent();return[4,properties_1.resolveProperties({address:this._getAddress(addressOrName),blockTag:this._getBlockTag(blockTag)})];case 2:params=_c.sent();_b=(_a=bignumber_1.BigNumber).from;return[4,this.perform("getTransactionCount",params)];case 3:return[2,_b.apply(_a,[_c.sent()]).toNumber()]}})})};BaseProvider.prototype.getCode=function(addressOrName,blockTag){return __awaiter(this,void 0,void 0,function(){var params,_a;return __generator(this,function(_b){switch(_b.label){case 0:return[4,this.getNetwork()];case 1:_b.sent();return[4,properties_1.resolveProperties({address:this._getAddress(addressOrName),blockTag:this._getBlockTag(blockTag)})];case 2:params=_b.sent();_a=bytes_1.hexlify;return[4,this.perform("getCode",params)];case 3:return[2,_a.apply(void 0,[_b.sent()])]}})})};BaseProvider.prototype.getStorageAt=function(addressOrName,position,blockTag){return __awaiter(this,void 0,void 0,function(){var params,_a;return __generator(this,function(_b){switch(_b.label){case 0:return[4,this.getNetwork()];case 1:_b.sent();return[4,properties_1.resolveProperties({address:this._getAddress(addressOrName),blockTag:this._getBlockTag(blockTag),position:Promise.resolve(position).then(function(p){return bytes_1.hexValue(p)})})];case 2:params=_b.sent();_a=bytes_1.hexlify;return[4,this.perform("getStorageAt",params)];case 3:return[2,_a.apply(void 0,[_b.sent()])]}})})};BaseProvider.prototype._wrapTransaction=function(tx,hash){var _this=this;if(hash!=null&&bytes_1.hexDataLength(hash)!==32){throw new Error("invalid response - sendTransaction")}var result=tx;if(hash!=null&&tx.hash!==hash){logger.throwError("Transaction hash mismatch from Provider.sendTransaction.",logger_1.Logger.errors.UNKNOWN_ERROR,{expectedHash:tx.hash,returnedHash:hash})}result.wait=function(confirmations){return __awaiter(_this,void 0,void 0,function(){var receipt;return __generator(this,function(_a){switch(_a.label){case 0:if(confirmations!==0){this._emitted["t:"+tx.hash]="pending"}return[4,this.waitForTransaction(tx.hash,confirmations)];case 1:receipt=_a.sent();if(receipt==null&&confirmations===0){return[2,null]}this._emitted["t:"+tx.hash]=receipt.blockNumber;if(receipt.status===0){logger.throwError("transaction failed",logger_1.Logger.errors.CALL_EXCEPTION,{transactionHash:tx.hash,transaction:tx,receipt:receipt})}return[2,receipt]}})})};return result};BaseProvider.prototype.sendTransaction=function(signedTransaction){return __awaiter(this,void 0,void 0,function(){var hexTx,tx,hash,error_2;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getNetwork()];case 1:_a.sent();return[4,Promise.resolve(signedTransaction).then(function(t){return bytes_1.hexlify(t)})];case 2:hexTx=_a.sent();tx=this.formatter.transaction(signedTransaction);_a.label=3;case 3:_a.trys.push([3,5,,6]);return[4,this.perform("sendTransaction",{signedTransaction:hexTx})];case 4:hash=_a.sent();return[2,this._wrapTransaction(tx,hash)];case 5:error_2=_a.sent();error_2.transaction=tx;error_2.transactionHash=tx.hash;throw error_2;case 6:return[2]}})})};BaseProvider.prototype._getTransactionRequest=function(transaction){return __awaiter(this,void 0,void 0,function(){var values,tx,_a,_b;var _this=this;return __generator(this,function(_c){switch(_c.label){case 0:return[4,transaction];case 1:values=_c.sent();tx={};["from","to"].forEach(function(key){if(values[key]==null){return}tx[key]=Promise.resolve(values[key]).then(function(v){return v?_this._getAddress(v):null})});["gasLimit","gasPrice","value"].forEach(function(key){if(values[key]==null){return}tx[key]=Promise.resolve(values[key]).then(function(v){return v?bignumber_1.BigNumber.from(v):null})});["data"].forEach(function(key){if(values[key]==null){return}tx[key]=Promise.resolve(values[key]).then(function(v){return v?bytes_1.hexlify(v):null})});_b=(_a=this.formatter).transactionRequest;return[4,properties_1.resolveProperties(tx)];case 2:return[2,_b.apply(_a,[_c.sent()])]}})})};BaseProvider.prototype._getFilter=function(filter){return __awaiter(this,void 0,void 0,function(){var result,_a,_b;var _this=this;return __generator(this,function(_c){switch(_c.label){case 0:return[4,filter];case 1:filter=_c.sent();result={};if(filter.address!=null){result.address=this._getAddress(filter.address)}["blockHash","topics"].forEach(function(key){if(filter[key]==null){return}result[key]=filter[key]});["fromBlock","toBlock"].forEach(function(key){if(filter[key]==null){return}result[key]=_this._getBlockTag(filter[key])});_b=(_a=this.formatter).filter;return[4,properties_1.resolveProperties(result)];case 2:return[2,_b.apply(_a,[_c.sent()])]}})})};BaseProvider.prototype.call=function(transaction,blockTag){return __awaiter(this,void 0,void 0,function(){var params,_a;return __generator(this,function(_b){switch(_b.label){case 0:return[4,this.getNetwork()];case 1:_b.sent();return[4,properties_1.resolveProperties({transaction:this._getTransactionRequest(transaction),blockTag:this._getBlockTag(blockTag)})];case 2:params=_b.sent();_a=bytes_1.hexlify;return[4,this.perform("call",params)];case 3:return[2,_a.apply(void 0,[_b.sent()])]}})})};BaseProvider.prototype.estimateGas=function(transaction){return __awaiter(this,void 0,void 0,function(){var params,_a,_b;return __generator(this,function(_c){switch(_c.label){case 0:return[4,this.getNetwork()];case 1:_c.sent();return[4,properties_1.resolveProperties({transaction:this._getTransactionRequest(transaction)})];case 2:params=_c.sent();_b=(_a=bignumber_1.BigNumber).from;return[4,this.perform("estimateGas",params)];case 3:return[2,_b.apply(_a,[_c.sent()])]}})})};BaseProvider.prototype._getAddress=function(addressOrName){return __awaiter(this,void 0,void 0,function(){var address;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.resolveName(addressOrName)];case 1:address=_a.sent();if(address==null){logger.throwError("ENS name not configured",logger_1.Logger.errors.UNSUPPORTED_OPERATION,{operation:"resolveName("+JSON.stringify(addressOrName)+")"})}return[2,address]}})})};BaseProvider.prototype._getBlock=function(blockHashOrBlockTag,includeTransactions){return __awaiter(this,void 0,void 0,function(){var blockNumber,params,_a,_b,_c,error_3;var _this=this;return __generator(this,function(_d){switch(_d.label){case 0:return[4,this.getNetwork()];case 1:_d.sent();return[4,blockHashOrBlockTag];case 2:blockHashOrBlockTag=_d.sent();blockNumber=-128;params={includeTransactions:!!includeTransactions};if(!bytes_1.isHexString(blockHashOrBlockTag,32))return[3,3];params.blockHash=blockHashOrBlockTag;return[3,6];case 3:_d.trys.push([3,5,,6]);_a=params;_c=(_b=this.formatter).blockTag;return[4,this._getBlockTag(blockHashOrBlockTag)];case 4:_a.blockTag=_c.apply(_b,[_d.sent()]);if(bytes_1.isHexString(params.blockTag)){blockNumber=parseInt(params.blockTag.substring(2),16)}return[3,6];case 5:error_3=_d.sent();logger.throwArgumentError("invalid block hash or block tag","blockHashOrBlockTag",blockHashOrBlockTag);return[3,6];case 6:return[2,web_1.poll(function(){return __awaiter(_this,void 0,void 0,function(){var block,blockNumber_1,i,tx,confirmations;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.perform("getBlock",params)];case 1:block=_a.sent();if(block==null){if(params.blockHash!=null){if(this._emitted["b:"+params.blockHash]==null){return[2,null]}}if(params.blockTag!=null){if(blockNumber>this._emitted.block){return[2,null]}}return[2,undefined]}if(!includeTransactions)return[3,8];blockNumber_1=null;i=0;_a.label=2;case 2:if(!(i<block.transactions.length))return[3,7];tx=block.transactions[i];if(!(tx.blockNumber==null))return[3,3];tx.confirmations=0;return[3,6];case 3:if(!(tx.confirmations==null))return[3,6];if(!(blockNumber_1==null))return[3,5];return[4,this._getInternalBlockNumber(100+2*this.pollingInterval)];case 4:blockNumber_1=_a.sent();_a.label=5;case 5:confirmations=blockNumber_1-tx.blockNumber+1;if(confirmations<=0){confirmations=1}tx.confirmations=confirmations;_a.label=6;case 6:i++;return[3,2];case 7:return[2,this.formatter.blockWithTransactions(block)];case 8:return[2,this.formatter.block(block)]}})})},{oncePoll:this})]}})})};BaseProvider.prototype.getBlock=function(blockHashOrBlockTag){return this._getBlock(blockHashOrBlockTag,false)};BaseProvider.prototype.getBlockWithTransactions=function(blockHashOrBlockTag){return this._getBlock(blockHashOrBlockTag,true)};BaseProvider.prototype.getTransaction=function(transactionHash){return __awaiter(this,void 0,void 0,function(){var params;var _this=this;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getNetwork()];case 1:_a.sent();return[4,transactionHash];case 2:transactionHash=_a.sent();params={transactionHash:this.formatter.hash(transactionHash,true)};return[2,web_1.poll(function(){return __awaiter(_this,void 0,void 0,function(){var result,tx,blockNumber,confirmations;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.perform("getTransaction",params)];case 1:result=_a.sent();if(result==null){if(this._emitted["t:"+transactionHash]==null){return[2,null]}return[2,undefined]}tx=this.formatter.transactionResponse(result);if(!(tx.blockNumber==null))return[3,2];tx.confirmations=0;return[3,4];case 2:if(!(tx.confirmations==null))return[3,4];return[4,this._getInternalBlockNumber(100+2*this.pollingInterval)];case 3:blockNumber=_a.sent();confirmations=blockNumber-tx.blockNumber+1;if(confirmations<=0){confirmations=1}tx.confirmations=confirmations;_a.label=4;case 4:return[2,this._wrapTransaction(tx)]}})})},{oncePoll:this})]}})})};BaseProvider.prototype.getTransactionReceipt=function(transactionHash){return __awaiter(this,void 0,void 0,function(){var params;var _this=this;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getNetwork()];case 1:_a.sent();return[4,transactionHash];case 2:transactionHash=_a.sent();params={transactionHash:this.formatter.hash(transactionHash,true)};return[2,web_1.poll(function(){return __awaiter(_this,void 0,void 0,function(){var result,receipt,blockNumber,confirmations;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.perform("getTransactionReceipt",params)];case 1:result=_a.sent();if(result==null){if(this._emitted["t:"+transactionHash]==null){return[2,null]}return[2,undefined]}if(result.blockHash==null){return[2,undefined]}receipt=this.formatter.receipt(result);if(!(receipt.blockNumber==null))return[3,2];receipt.confirmations=0;return[3,4];case 2:if(!(receipt.confirmations==null))return[3,4];return[4,this._getInternalBlockNumber(100+2*this.pollingInterval)];case 3:blockNumber=_a.sent();confirmations=blockNumber-receipt.blockNumber+1;if(confirmations<=0){confirmations=1}receipt.confirmations=confirmations;_a.label=4;case 4:return[2,receipt]}})})},{oncePoll:this})]}})})};BaseProvider.prototype.getLogs=function(filter){return __awaiter(this,void 0,void 0,function(){var params,logs;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getNetwork()];case 1:_a.sent();return[4,properties_1.resolveProperties({filter:this._getFilter(filter)})];case 2:params=_a.sent();return[4,this.perform("getLogs",params)];case 3:logs=_a.sent();logs.forEach(function(log){if(log.removed==null){log.removed=false}});return[2,formatter_1.Formatter.arrayOf(this.formatter.filterLog.bind(this.formatter))(logs)]}})})};BaseProvider.prototype.getEtherPrice=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getNetwork()];case 1:_a.sent();return[2,this.perform("getEtherPrice",{})]}})})};BaseProvider.prototype._getBlockTag=function(blockTag){return __awaiter(this,void 0,void 0,function(){var blockNumber;return __generator(this,function(_a){switch(_a.label){case 0:return[4,blockTag];case 1:blockTag=_a.sent();if(!(typeof blockTag==="number"&&blockTag<0))return[3,3];if(blockTag%1){logger.throwArgumentError("invalid BlockTag","blockTag",blockTag)}return[4,this._getInternalBlockNumber(100+2*this.pollingInterval)];case 2:blockNumber=_a.sent();blockNumber+=blockTag;if(blockNumber<0){blockNumber=0}return[2,this.formatter.blockTag(blockNumber)];case 3:return[2,this.formatter.blockTag(blockTag)]}})})};BaseProvider.prototype._getResolver=function(name){return __awaiter(this,void 0,void 0,function(){var network,transaction,_a,_b;return __generator(this,function(_c){switch(_c.label){case 0:return[4,this.getNetwork()];case 1:network=_c.sent();if(!network.ensAddress){logger.throwError("network does not support ENS",logger_1.Logger.errors.UNSUPPORTED_OPERATION,{operation:"ENS",network:network.name})}transaction={to:network.ensAddress,data:"0x0178b8bf"+hash_1.namehash(name).substring(2)};_b=(_a=this.formatter).callAddress;return[4,this.call(transaction)];case 2:return[2,_b.apply(_a,[_c.sent()])]}})})};BaseProvider.prototype.resolveName=function(name){return __awaiter(this,void 0,void 0,function(){var resolverAddress,transaction,_a,_b;return __generator(this,function(_c){switch(_c.label){case 0:return[4,name];case 1:name=_c.sent();try{return[2,Promise.resolve(this.formatter.address(name))]}catch(error){if(bytes_1.isHexString(name)){throw error}}if(typeof name!=="string"){logger.throwArgumentError("invalid ENS name","name",name)}return[4,this._getResolver(name)];case 2:resolverAddress=_c.sent();if(!resolverAddress){return[2,null]}transaction={to:resolverAddress,data:"0x3b3b57de"+hash_1.namehash(name).substring(2)};_b=(_a=this.formatter).callAddress;return[4,this.call(transaction)];case 3:return[2,_b.apply(_a,[_c.sent()])]}})})};BaseProvider.prototype.lookupAddress=function(address){return __awaiter(this,void 0,void 0,function(){var reverseName,resolverAddress,bytes,_a,length,name,addr;return __generator(this,function(_b){switch(_b.label){case 0:return[4,address];case 1:address=_b.sent();address=this.formatter.address(address);reverseName=address.substring(2).toLowerCase()+".addr.reverse";return[4,this._getResolver(reverseName)];case 2:resolverAddress=_b.sent();if(!resolverAddress){return[2,null]}_a=bytes_1.arrayify;return[4,this.call({to:resolverAddress,data:"0x691f3431"+hash_1.namehash(reverseName).substring(2)})];case 3:bytes=_a.apply(void 0,[_b.sent()]);if(bytes.length<32||!bignumber_1.BigNumber.from(bytes.slice(0,32)).eq(32)){return[2,null]}bytes=bytes.slice(32);if(bytes.length<32){return[2,null]}length=bignumber_1.BigNumber.from(bytes.slice(0,32)).toNumber();bytes=bytes.slice(32);if(length>bytes.length){return[2,null]}name=strings_1.toUtf8String(bytes.slice(0,length));return[4,this.resolveName(name)];case 4:addr=_b.sent();if(addr!=address){return[2,null]}return[2,name]}})})};BaseProvider.prototype.perform=function(method,params){return logger.throwError(method+" not implemented",logger_1.Logger.errors.NOT_IMPLEMENTED,{operation:method})};BaseProvider.prototype._startEvent=function(event){this.polling=this._events.filter(function(e){return e.pollable()}).length>0};BaseProvider.prototype._stopEvent=function(event){this.polling=this._events.filter(function(e){return e.pollable()}).length>0};BaseProvider.prototype._addEventListener=function(eventName,listener,once){var event=new Event(getEventTag(eventName),listener,once);this._events.push(event);this._startEvent(event);return this};BaseProvider.prototype.on=function(eventName,listener){return this._addEventListener(eventName,listener,false)};BaseProvider.prototype.once=function(eventName,listener){return this._addEventListener(eventName,listener,true)};BaseProvider.prototype.emit=function(eventName){var _this=this;var args=[];for(var _i=1;_i<arguments.length;_i++){args[_i-1]=arguments[_i]}var result=false;var stopped=[];var eventTag=getEventTag(eventName);this._events=this._events.filter(function(event){if(event.tag!==eventTag){return true}setTimeout(function(){event.listener.apply(_this,args)},0);result=true;if(event.once){stopped.push(event);return false}return true});stopped.forEach(function(event){_this._stopEvent(event)});return result};BaseProvider.prototype.listenerCount=function(eventName){if(!eventName){return this._events.length}var eventTag=getEventTag(eventName);return this._events.filter(function(event){return event.tag===eventTag}).length};BaseProvider.prototype.listeners=function(eventName){if(eventName==null){return this._events.map(function(event){return event.listener})}var eventTag=getEventTag(eventName);return this._events.filter(function(event){return event.tag===eventTag}).map(function(event){return event.listener})};BaseProvider.prototype.off=function(eventName,listener){var _this=this;if(listener==null){return this.removeAllListeners(eventName)}var stopped=[];var found=false;var eventTag=getEventTag(eventName);this._events=this._events.filter(function(event){if(event.tag!==eventTag||event.listener!=listener){return true}if(found){return true}found=true;stopped.push(event);return false});stopped.forEach(function(event){_this._stopEvent(event)});return this};BaseProvider.prototype.removeAllListeners=function(eventName){var _this=this;var stopped=[];if(eventName==null){stopped=this._events;this._events=[]}else{var eventTag_1=getEventTag(eventName);this._events=this._events.filter(function(event){if(event.tag!==eventTag_1){return true}stopped.push(event);return false})}stopped.forEach(function(event){_this._stopEvent(event)});return this};return BaseProvider}(abstract_provider_1.Provider);exports.BaseProvider=BaseProvider},{"./_version":43,"./formatter":51,"@ethersproject/abstract-provider":19,"@ethersproject/bignumber":28,"@ethersproject/bytes":30,"@ethersproject/hash":35,"@ethersproject/logger":38,"@ethersproject/networks":40,"@ethersproject/properties":42,"@ethersproject/strings":84,"@ethersproject/web":90}],46:[function(require,module,exports){"use strict";module.exports.IpcProvider=null},{}],47:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var logger_1=require("@ethersproject/logger");var _version_1=require("./_version");var WS=null;try{WS=WebSocket;if(WS==null){throw new Error("inject please")}}catch(error){var logger_2=new logger_1.Logger(_version_1.version);WS=function(){logger_2.throwError("WebSockets not supported in this environment",logger_1.Logger.errors.UNSUPPORTED_OPERATION,{operation:"new WebSocket()"})}}module.exports=WS},{"./_version":43,"@ethersproject/logger":38}],48:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p]};return extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){function adopt(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator["throw"](value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})};var __generator=this&&this.__generator||function(thisArg,body){var _={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},f,y,t,g;return g={next:verb(0),throw:verb(1),return:verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(_)try{if(f=1,y&&(t=op[0]&2?y["return"]:op[0]?y["throw"]||((t=y["return"])&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[op[0]&2,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return{value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break}if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break}if(t[2])_.ops.pop();_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e];y=0}finally{f=t=0}if(op[0]&5)throw op[1];return{value:op[0]?op[1]:void 0,done:true}}};Object.defineProperty(exports,"__esModule",{value:true});var url_json_rpc_provider_1=require("./url-json-rpc-provider");var logger_1=require("@ethersproject/logger");var _version_1=require("./_version");var logger=new logger_1.Logger(_version_1.version);var CloudflareProvider=function(_super){__extends(CloudflareProvider,_super);function CloudflareProvider(){return _super!==null&&_super.apply(this,arguments)||this}CloudflareProvider.getApiKey=function(apiKey){if(apiKey!=null){logger.throwArgumentError("apiKey not supported for cloudflare","apiKey",apiKey)}return null};CloudflareProvider.getUrl=function(network,apiKey){var host=null;switch(network.name){case"homestead":host="https://cloudflare-eth.com/";break;default:logger.throwArgumentError("unsupported network","network",arguments[0])}return host};CloudflareProvider.prototype.perform=function(method,params){return __awaiter(this,void 0,void 0,function(){var block;return __generator(this,function(_a){switch(_a.label){case 0:if(!(method==="getBlockNumber"))return[3,2];return[4,_super.prototype.perform.call(this,"getBlock",{blockTag:"latest"})];case 1:block=_a.sent();return[2,block.number];case 2:return[2,_super.prototype.perform.call(this,method,params)]}})})};return CloudflareProvider}(url_json_rpc_provider_1.UrlJsonRpcProvider);exports.CloudflareProvider=CloudflareProvider},{"./_version":43,"./url-json-rpc-provider":56,"@ethersproject/logger":38}],49:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p]};return extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){function adopt(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator["throw"](value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})};var __generator=this&&this.__generator||function(thisArg,body){var _={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},f,y,t,g;return g={next:verb(0),throw:verb(1),return:verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(_)try{if(f=1,y&&(t=op[0]&2?y["return"]:op[0]?y["throw"]||((t=y["return"])&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[op[0]&2,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return{value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break}if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break}if(t[2])_.ops.pop();_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e];y=0}finally{f=t=0}if(op[0]&5)throw op[1];return{value:op[0]?op[1]:void 0,done:true}}};Object.defineProperty(exports,"__esModule",{value:true});var bytes_1=require("@ethersproject/bytes");var properties_1=require("@ethersproject/properties");var web_1=require("@ethersproject/web");var logger_1=require("@ethersproject/logger");var _version_1=require("./_version");var logger=new logger_1.Logger(_version_1.version);var base_provider_1=require("./base-provider");function getTransactionString(transaction){var result=[];for(var key in transaction){if(transaction[key]==null){continue}var value=bytes_1.hexlify(transaction[key]);if({gasLimit:true,gasPrice:true,nonce:true,value:true}[key]){value=bytes_1.hexValue(value)}result.push(key+"="+value)}return result.join("&")}function getResult(result){if(result.status==0&&(result.message==="No records found"||result.message==="No transactions found")){return result.result}if(result.status!=1||result.message!="OK"){var error=new Error("invalid response");error.result=JSON.stringify(result);throw error}return result.result}function getJsonResult(result){if(result.jsonrpc!="2.0"){var error=new Error("invalid response");error.result=JSON.stringify(result);throw error}if(result.error){var error=new Error(result.error.message||"unknown error");if(result.error.code){error.code=result.error.code}if(result.error.data){error.data=result.error.data}throw error}return result.result}function checkLogTag(blockTag){if(blockTag==="pending"){throw new Error("pending not supported")}if(blockTag==="latest"){return blockTag}return parseInt(blockTag.substring(2),16)}var defaultApiKey="9D13ZE7XSBTJ94N9BNJ2MA33VMAY2YPIRB";var EtherscanProvider=function(_super){__extends(EtherscanProvider,_super);function EtherscanProvider(network,apiKey){var _newTarget=this.constructor;var _this=this;logger.checkNew(_newTarget,EtherscanProvider);_this=_super.call(this,network)||this;var name="invalid";if(_this.network){name=_this.network.name}var baseUrl=null;switch(name){case"homestead":baseUrl="https://api.etherscan.io";break;case"ropsten":baseUrl="https://api-ropsten.etherscan.io";break;case"rinkeby":baseUrl="https://api-rinkeby.etherscan.io";break;case"kovan":baseUrl="https://api-kovan.etherscan.io";break;case"goerli":baseUrl="https://api-goerli.etherscan.io";break;default:throw new Error("unsupported network")}properties_1.defineReadOnly(_this,"baseUrl",baseUrl);properties_1.defineReadOnly(_this,"apiKey",apiKey||defaultApiKey);return _this}EtherscanProvider.prototype.detectNetwork=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){return[2,this.network]})})};EtherscanProvider.prototype.perform=function(method,params){return __awaiter(this,void 0,void 0,function(){var url,apiKey,get,_a,transaction,transaction,topic0,logs,txs,i,log,tx,_b;var _this=this;return __generator(this,function(_c){switch(_c.label){case 0:url=this.baseUrl;apiKey="";if(this.apiKey){apiKey+="&apikey="+this.apiKey}get=function(url,procFunc){return __awaiter(_this,void 0,void 0,function(){var result;return __generator(this,function(_a){switch(_a.label){case 0:this.emit("debug",{action:"request",request:url,provider:this});return[4,web_1.fetchJson(url,null,procFunc||getJsonResult)];case 1:result=_a.sent();this.emit("debug",{action:"response",request:url,response:properties_1.deepCopy(result),provider:this});return[2,result]}})})};_a=method;switch(_a){case"getBlockNumber":return[3,1];case"getGasPrice":return[3,2];case"getBalance":return[3,3];case"getTransactionCount":return[3,4];case"getCode":return[3,5];case"getStorageAt":return[3,6];case"sendTransaction":return[3,7];case"getBlock":return[3,8];case"getTransaction":return[3,9];case"getTransactionReceipt":return[3,10];case"call":return[3,11];case"estimateGas":return[3,12];case"getLogs":return[3,13];case"getEtherPrice":return[3,20]}return[3,22];case 1:url+="/api?module=proxy&action=eth_blockNumber"+apiKey;return[2,get(url)];case 2:url+="/api?module=proxy&action=eth_gasPrice"+apiKey;return[2,get(url)];case 3:url+="/api?module=account&action=balance&address="+params.address;url+="&tag="+params.blockTag+apiKey;return[2,get(url,getResult)];case 4:url+="/api?module=proxy&action=eth_getTransactionCount&address="+params.address;url+="&tag="+params.blockTag+apiKey;return[2,get(url)];case 5:url+="/api?module=proxy&action=eth_getCode&address="+params.address;url+="&tag="+params.blockTag+apiKey;return[2,get(url,getJsonResult)];case 6:url+="/api?module=proxy&action=eth_getStorageAt&address="+params.address;url+="&position="+params.position;url+="&tag="+params.blockTag+apiKey;return[2,get(url,getJsonResult)];case 7:url+="/api?module=proxy&action=eth_sendRawTransaction&hex="+params.signedTransaction;url+=apiKey;return[2,get(url).catch(function(error){if(error.responseText){if(error.responseText.toLowerCase().indexOf("insufficient funds")>=0){logger.throwError("insufficient funds",logger_1.Logger.errors.INSUFFICIENT_FUNDS,{})}if(error.responseText.indexOf("same hash was already imported")>=0){logger.throwError("nonce has already been used",logger_1.Logger.errors.NONCE_EXPIRED,{})}if(error.responseText.indexOf("another transaction with same nonce")>=0){logger.throwError("replacement fee too low",logger_1.Logger.errors.REPLACEMENT_UNDERPRICED,{})}}throw error})];case 8:if(params.blockTag){url+="/api?module=proxy&action=eth_getBlockByNumber&tag="+params.blockTag;if(params.includeTransactions){url+="&boolean=true"}else{url+="&boolean=false"}url+=apiKey;return[2,get(url)]}throw new Error("getBlock by blockHash not implemented");case 9:url+="/api?module=proxy&action=eth_getTransactionByHash&txhash="+params.transactionHash;url+=apiKey;return[2,get(url)];case 10:url+="/api?module=proxy&action=eth_getTransactionReceipt&txhash="+params.transactionHash;url+=apiKey;return[2,get(url)];case 11:{transaction=getTransactionString(params.transaction);if(transaction){transaction="&"+transaction}url+="/api?module=proxy&action=eth_call"+transaction;if(params.blockTag!=="latest"){throw new Error("EtherscanProvider does not support blockTag for call")}url+=apiKey;return[2,get(url)]}_c.label=12;case 12:{transaction=getTransactionString(params.transaction);if(transaction){transaction="&"+transaction}url+="/api?module=proxy&action=eth_estimateGas&"+transaction;url+=apiKey;return[2,get(url)]}_c.label=13;case 13:url+="/api?module=logs&action=getLogs";if(params.filter.fromBlock){url+="&fromBlock="+checkLogTag(params.filter.fromBlock)}if(params.filter.toBlock){url+="&toBlock="+checkLogTag(params.filter.toBlock)}if(params.filter.address){url+="&address="+params.filter.address}if(params.filter.topics&&params.filter.topics.length>0){if(params.filter.topics.length>1){logger.throwError("unsupported topic count",logger_1.Logger.errors.UNSUPPORTED_OPERATION,{topics:params.filter.topics})}if(params.filter.topics.length===1){topic0=params.filter.topics[0];if(typeof topic0!=="string"||topic0.length!==66){logger.throwError("unsupported topic format",logger_1.Logger.errors.UNSUPPORTED_OPERATION,{topic0:topic0})}url+="&topic0="+topic0}}url+=apiKey;return[4,get(url,getResult)];case 14:logs=_c.sent();txs={};i=0;_c.label=15;case 15:if(!(i<logs.length))return[3,19];log=logs[i];if(log.blockHash!=null){return[3,18]}if(!(txs[log.transactionHash]==null))return[3,17];return[4,this.getTransaction(log.transactionHash)];case 16:tx=_c.sent();if(tx){txs[log.transactionHash]=tx.blockHash}_c.label=17;case 17:log.blockHash=txs[log.transactionHash];_c.label=18;case 18:i++;return[3,15];case 19:return[2,logs];case 20:if(this.network.name!=="homestead"){return[2,0]}url+="/api?module=stats&action=ethprice";url+=apiKey;_b=parseFloat;return[4,get(url,getResult)];case 21:return[2,_b.apply(void 0,[_c.sent().ethusd])];case 22:return[3,23];case 23:return[2,_super.prototype.perform.call(this,method,params)]}})})};EtherscanProvider.prototype.getHistory=function(addressOrName,startBlock,endBlock){var _this=this;var url=this.baseUrl;var apiKey="";if(this.apiKey){apiKey+="&apikey="+this.apiKey}if(startBlock==null){startBlock=0}if(endBlock==null){endBlock=99999999}return this.resolveName(addressOrName).then(function(address){url+="/api?module=account&action=txlist&address="+address;url+="&startblock="+startBlock;url+="&endblock="+endBlock;url+="&sort=asc"+apiKey;_this.emit("debug",{action:"request",request:url,provider:_this});return web_1.fetchJson(url,null,getResult).then(function(result){_this.emit("debug",{action:"response",request:url,response:properties_1.deepCopy(result),provider:_this});var output=[];result.forEach(function(tx){["contractAddress","to"].forEach(function(key){if(tx[key]==""){delete tx[key]}});if(tx.creates==null&&tx.contractAddress!=null){tx.creates=tx.contractAddress}var item=_this.formatter.transactionResponse(tx);if(tx.timeStamp){item.timestamp=parseInt(tx.timeStamp)}output.push(item)});return output})})};return EtherscanProvider}(base_provider_1.BaseProvider);exports.EtherscanProvider=EtherscanProvider},{"./_version":43,"./base-provider":45,"@ethersproject/bytes":30,"@ethersproject/logger":38,"@ethersproject/properties":42,"@ethersproject/web":90}],50:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p]};return extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){function adopt(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator["throw"](value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})};var __generator=this&&this.__generator||function(thisArg,body){var _={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},f,y,t,g;return g={next:verb(0),throw:verb(1),return:verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(_)try{if(f=1,y&&(t=op[0]&2?y["return"]:op[0]?y["throw"]||((t=y["return"])&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[op[0]&2,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return{value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break}if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break}if(t[2])_.ops.pop();_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e];y=0}finally{f=t=0}if(op[0]&5)throw op[1];return{value:op[0]?op[1]:void 0,done:true}}};Object.defineProperty(exports,"__esModule",{value:true});var abstract_provider_1=require("@ethersproject/abstract-provider");var bignumber_1=require("@ethersproject/bignumber");var bytes_1=require("@ethersproject/bytes");var properties_1=require("@ethersproject/properties");var random_1=require("@ethersproject/random");var web_1=require("@ethersproject/web");var base_provider_1=require("./base-provider");var logger_1=require("@ethersproject/logger");var _version_1=require("./_version");var logger=new logger_1.Logger(_version_1.version);function now(){return(new Date).getTime()}function checkNetworks(networks){var result=null;for(var i=0;i<networks.length;i++){var network=networks[i];if(network==null){return null}if(result){if(!(result.name===network.name&&result.chainId===network.chainId&&(result.ensAddress===network.ensAddress||result.ensAddress==null&&network.ensAddress==null))){logger.throwArgumentError("provider mismatch","networks",networks)}}else{result=network}}return result}function median(values,maxDelta){values=values.slice().sort();var middle=Math.floor(values.length/2);if(values.length%2){return values[middle]}var a=values[middle-1],b=values[middle];if(maxDelta!=null&&Math.abs(a-b)>maxDelta){return null}return(a+b)/2}function serialize(value){if(value===null){return"null"}else if(typeof value==="number"||typeof value==="boolean"){return JSON.stringify(value)}else if(typeof value==="string"){return value}else if(bignumber_1.BigNumber.isBigNumber(value)){return value.toString()}else if(Array.isArray(value)){return JSON.stringify(value.map(function(i){return serialize(i)}))}else if(typeof value==="object"){var keys=Object.keys(value);keys.sort();return"{"+keys.map(function(key){var v=value[key];if(typeof v==="function"){v="[function]"}else{v=serialize(v)}return JSON.stringify(key)+":"+v}).join(",")+"}"}throw new Error("unknown value type: "+typeof value)}var nextRid=1;function stall(duration){var cancel=null;var timer=null;var promise=new Promise(function(resolve){cancel=function(){if(timer){clearTimeout(timer);timer=null}resolve()};timer=setTimeout(cancel,duration)});var wait=function(func){promise=promise.then(func);return promise};function getPromise(){return promise}return{cancel:cancel,getPromise:getPromise,wait:wait}}function exposeDebugConfig(config,now){var result={provider:config.provider,weight:config.weight};if(config.start){result.start=config.start}if(now){result.duration=now-config.start}if(config.done){if(config.error){result.error=config.error}else{result.result=config.result||null}}return result}function normalizedTally(normalize,quorum){return function(configs){var tally={};configs.forEach(function(c){var value=normalize(c.result);if(!tally[value]){tally[value]={count:0,result:c.result}}tally[value].count++});var keys=Object.keys(tally);for(var i=0;i<keys.length;i++){var check=tally[keys[i]];if(check.count>=quorum){return check.result}}return undefined}}function getProcessFunc(provider,method,params){var normalize=serialize;switch(method){case"getBlockNumber":return function(configs){var values=configs.map(function(c){return c.result});var blockNumber=median(configs.map(function(c){return c.result}),2);if(blockNumber==null){return undefined}blockNumber=Math.ceil(blockNumber);if(values.indexOf(blockNumber+1)>=0){blockNumber++}if(blockNumber>=provider._highestBlockNumber){provider._highestBlockNumber=blockNumber}return provider._highestBlockNumber};case"getGasPrice":return function(configs){var values=configs.map(function(c){return c.result});values.sort();return values[Math.floor(values.length/2)]};case"getEtherPrice":return function(configs){return median(configs.map(function(c){return c.result}))};case"getBalance":case"getTransactionCount":case"getCode":case"getStorageAt":case"call":case"estimateGas":case"getLogs":break;case"getTransaction":case"getTransactionReceipt":normalize=function(tx){if(tx==null){return null}tx=properties_1.shallowCopy(tx);tx.confirmations=-1;return serialize(tx)};break;case"getBlock":if(params.includeTransactions){normalize=function(block){if(block==null){return null}block=properties_1.shallowCopy(block);block.transactions=block.transactions.map(function(tx){tx=properties_1.shallowCopy(tx);tx.confirmations=-1;return tx});return serialize(block)}}else{normalize=function(block){if(block==null){return null}return serialize(block)}}break;default:throw new Error("unknown method: "+method)}return normalizedTally(normalize,provider.quorum)}function waitForSync(config,blockNumber){return __awaiter(this,void 0,void 0,function(){var provider;return __generator(this,function(_a){provider=config.provider;if(provider.blockNumber!=null&&provider.blockNumber>=blockNumber||blockNumber===-1){return[2,provider]}return[2,web_1.poll(function(){return new Promise(function(resolve,reject){setTimeout(function(){if(provider.blockNumber>=blockNumber){return resolve(provider)}if(config.cancelled){return resolve(null)}return resolve(undefined)},0)})},{oncePoll:provider})]})})}function getRunner(config,currentBlockNumber,method,params){return __awaiter(this,void 0,void 0,function(){var provider,_a,filter;return __generator(this,function(_b){switch(_b.label){case 0:provider=config.provider;_a=method;switch(_a){case"getBlockNumber":return[3,1];case"getGasPrice":return[3,1];case"getEtherPrice":return[3,2];case"getBalance":return[3,3];case"getTransactionCount":return[3,3];case"getCode":return[3,3];case"getStorageAt":return[3,6];case"getBlock":return[3,9];case"call":return[3,12];case"estimateGas":return[3,12];case"getTransaction":return[3,15];case"getTransactionReceipt":return[3,15];case"getLogs":return[3,16]}return[3,19];case 1:return[2,provider[method]()];case 2:if(provider.getEtherPrice){return[2,provider.getEtherPrice()]}return[3,19];case 3:if(!(params.blockTag&&bytes_1.isHexString(params.blockTag)))return[3,5];return[4,waitForSync(config,currentBlockNumber)];case 4:provider=_b.sent();_b.label=5;case 5:return[2,provider[method](params.address,params.blockTag||"latest")];case 6:if(!(params.blockTag&&bytes_1.isHexString(params.blockTag)))return[3,8];return[4,waitForSync(config,currentBlockNumber)];case 7:provider=_b.sent();_b.label=8;case 8:return[2,provider.getStorageAt(params.address,params.position,params.blockTag||"latest")];case 9:if(!(params.blockTag&&bytes_1.isHexString(params.blockTag)))return[3,11];return[4,waitForSync(config,currentBlockNumber)];case 10:provider=_b.sent();_b.label=11;case 11:return[2,provider[params.includeTransactions?"getBlockWithTransactions":"getBlock"](params.blockTag||params.blockHash)];case 12:if(!(params.blockTag&&bytes_1.isHexString(params.blockTag)))return[3,14];return[4,waitForSync(config,currentBlockNumber)];case 13:provider=_b.sent();_b.label=14;case 14:return[2,provider[method](params.transaction)];case 15:return[2,provider[method](params.transactionHash)];case 16:filter=params.filter;if(!(filter.fromBlock&&bytes_1.isHexString(filter.fromBlock)||filter.toBlock&&bytes_1.isHexString(filter.toBlock)))return[3,18];return[4,waitForSync(config,currentBlockNumber)];case 17:provider=_b.sent();_b.label=18;case 18:return[2,provider.getLogs(filter)];case 19:return[2,logger.throwError("unknown method error",logger_1.Logger.errors.UNKNOWN_ERROR,{method:method,params:params})]}})})}var FallbackProvider=function(_super){__extends(FallbackProvider,_super);function FallbackProvider(providers,quorum){var _newTarget=this.constructor;var _this=this;logger.checkNew(_newTarget,FallbackProvider);if(providers.length===0){logger.throwArgumentError("missing providers","providers",providers)}var providerConfigs=providers.map(function(configOrProvider,index){if(abstract_provider_1.Provider.isProvider(configOrProvider)){return Object.freeze({provider:configOrProvider,weight:1,stallTimeout:750,priority:1})}var config=properties_1.shallowCopy(configOrProvider);if(config.priority==null){config.priority=1}if(config.stallTimeout==null){config.stallTimeout=750}if(config.weight==null){config.weight=1}var weight=config.weight;if(weight%1||weight>512||weight<1){logger.throwArgumentError("invalid weight; must be integer in [1, 512]","providers["+index+"].weight",weight)}return Object.freeze(config)});var total=providerConfigs.reduce(function(accum,c){return accum+c.weight},0);if(quorum==null){quorum=total/2}else if(quorum>total){logger.throwArgumentError("quorum will always fail; larger than total weight","quorum",quorum)}var networkOrReady=checkNetworks(providerConfigs.map(function(c){return c.provider.network}));if(networkOrReady==null){networkOrReady=new Promise(function(resolve,reject){setTimeout(function(){_this.detectNetwork().then(resolve,reject)},0)})}_this=_super.call(this,networkOrReady)||this;properties_1.defineReadOnly(_this,"providerConfigs",Object.freeze(providerConfigs));properties_1.defineReadOnly(_this,"quorum",quorum);_this._highestBlockNumber=-1;return _this}FallbackProvider.prototype.detectNetwork=function(){return __awaiter(this,void 0,void 0,function(){var networks;return __generator(this,function(_a){switch(_a.label){case 0:return[4,Promise.all(this.providerConfigs.map(function(c){return c.provider.getNetwork()}))];case 1:networks=_a.sent();return[2,checkNetworks(networks)]}})})};FallbackProvider.prototype.perform=function(method,params){return __awaiter(this,void 0,void 0,function(){var results,i_1,result,processFunc,configs,currentBlockNumber,i,first,_loop_1,this_1,state_1;var _this=this;return __generator(this,function(_a){switch(_a.label){case 0:if(!(method==="sendTransaction"))return[3,2];return[4,Promise.all(this.providerConfigs.map(function(c){return c.provider.sendTransaction(params.signedTransaction).then(function(result){return result.hash},function(error){return error})}))];case 1:results=_a.sent();for(i_1=0;i_1<results.length;i_1++){result=results[i_1];if(typeof result==="string"){return[2,result]}}throw results[0];case 2:if(!(this._highestBlockNumber===-1&&method!=="getBlockNumber"))return[3,4];return[4,this.getBlockNumber()];case 3:_a.sent();_a.label=4;case 4:processFunc=getProcessFunc(this,method,params);configs=random_1.shuffled(this.providerConfigs.map(properties_1.shallowCopy));configs.sort(function(a,b){return a.priority-b.priority});currentBlockNumber=this._highestBlockNumber;i=0;first=true;_loop_1=function(){var t0,inflightWeight,_loop_2,waiting,results,result;return __generator(this,function(_a){switch(_a.label){case 0:t0=now();inflightWeight=configs.filter(function(c){return c.runner&&t0-c.start<c.stallTimeout}).reduce(function(accum,c){return accum+c.weight},0);_loop_2=function(){var config=configs[i++];var rid=nextRid++;config.start=now();config.staller=stall(config.stallTimeout);config.staller.wait(function(){config.staller=null});config.runner=getRunner(config,currentBlockNumber,method,params).then(function(result){config.done=true;config.result=result;if(_this.listenerCount("debug")){_this.emit("debug",{action:"request",rid:rid,backend:exposeDebugConfig(config,now()),request:{method:method,params:properties_1.deepCopy(params)},provider:_this})}},function(error){config.done=true;config.error=error;if(_this.listenerCount("debug")){_this.emit("debug",{action:"request",rid:rid,backend:exposeDebugConfig(config,now()),request:{method:method,params:properties_1.deepCopy(params)},provider:_this})}});if(this_1.listenerCount("debug")){this_1.emit("debug",{action:"request",rid:rid,backend:exposeDebugConfig(config,null),request:{method:method,params:properties_1.deepCopy(params)},provider:this_1})}inflightWeight+=config.weight};while(inflightWeight<this_1.quorum&&i<configs.length){_loop_2()}waiting=[];configs.forEach(function(c){if(c.done||!c.runner){return}waiting.push(c.runner);if(c.staller){waiting.push(c.staller.getPromise())}});if(!waiting.length)return[3,2];return[4,Promise.race(waiting)];case 1:_a.sent();_a.label=2;case 2:results=configs.filter(function(c){return c.done&&c.error==null});if(!(results.length>=this_1.quorum))return[3,5];result=processFunc(results);if(result!==undefined){configs.forEach(function(c){if(c.staller){c.staller.cancel()}c.cancelled=true});return[2,{value:result}]}if(!!first)return[3,4];return[4,stall(100).getPromise()];case 3:_a.sent();_a.label=4;case 4:first=false;_a.label=5;case 5:if(configs.filter(function(c){return!c.done}).length===0){return[2,"break"]}return[2]}})};this_1=this;_a.label=5;case 5:if(!true)return[3,7];return[5,_loop_1()];case 6:state_1=_a.sent();if(typeof state_1==="object")return[2,state_1.value];if(state_1==="break")return[3,7];return[3,5];case 7:configs.forEach(function(c){if(c.staller){c.staller.cancel()}c.cancelled=true});return[2,logger.throwError("failed to meet quorum",logger_1.Logger.errors.SERVER_ERROR,{method:method,params:params,results:configs.map(function(c){return exposeDebugConfig(c)}),provider:this})]}})})};return FallbackProvider}(base_provider_1.BaseProvider);exports.FallbackProvider=FallbackProvider},{"./_version":43,"./base-provider":45,"@ethersproject/abstract-provider":19,"@ethersproject/bignumber":28,"@ethersproject/bytes":30,"@ethersproject/logger":38,"@ethersproject/properties":42,"@ethersproject/random":60,"@ethersproject/web":90}],51:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var address_1=require("@ethersproject/address");var bignumber_1=require("@ethersproject/bignumber");var bytes_1=require("@ethersproject/bytes");var constants_1=require("@ethersproject/constants");var properties_1=require("@ethersproject/properties");var transactions_1=require("@ethersproject/transactions");var logger_1=require("@ethersproject/logger");var _version_1=require("./_version");var logger=new logger_1.Logger(_version_1.version);var Formatter=function(){function Formatter(){var _newTarget=this.constructor;logger.checkNew(_newTarget,Formatter);this.formats=this.getDefaultFormats()}Formatter.prototype.getDefaultFormats=function(){var _this=this;var formats={};var address=this.address.bind(this);var bigNumber=this.bigNumber.bind(this);var blockTag=this.blockTag.bind(this);var data=this.data.bind(this);var hash=this.hash.bind(this);var hex=this.hex.bind(this);var number=this.number.bind(this);var strictData=function(v){return _this.data(v,true)};formats.transaction={hash:hash,blockHash:Formatter.allowNull(hash,null),blockNumber:Formatter.allowNull(number,null),transactionIndex:Formatter.allowNull(number,null),confirmations:Formatter.allowNull(number,null),from:address,gasPrice:bigNumber,gasLimit:bigNumber,to:Formatter.allowNull(address,null),value:bigNumber,nonce:number,data:data,r:Formatter.allowNull(this.uint256),s:Formatter.allowNull(this.uint256),v:Formatter.allowNull(number),creates:Formatter.allowNull(address,null),raw:Formatter.allowNull(data)};formats.transactionRequest={from:Formatter.allowNull(address),nonce:Formatter.allowNull(number),gasLimit:Formatter.allowNull(bigNumber),gasPrice:Formatter.allowNull(bigNumber),to:Formatter.allowNull(address),value:Formatter.allowNull(bigNumber),data:Formatter.allowNull(strictData)};formats.receiptLog={transactionIndex:number,blockNumber:number,transactionHash:hash,address:address,topics:Formatter.arrayOf(hash),data:data,logIndex:number,blockHash:hash};formats.receipt={to:Formatter.allowNull(this.address,null),from:Formatter.allowNull(this.address,null),contractAddress:Formatter.allowNull(address,null),transactionIndex:number,root:Formatter.allowNull(hash),gasUsed:bigNumber,logsBloom:Formatter.allowNull(data),blockHash:hash,transactionHash:hash,logs:Formatter.arrayOf(this.receiptLog.bind(this)),blockNumber:number,confirmations:Formatter.allowNull(number,null),cumulativeGasUsed:bigNumber,status:Formatter.allowNull(number)};formats.block={hash:hash,parentHash:hash,number:number,timestamp:number,nonce:Formatter.allowNull(hex),difficulty:this.difficulty.bind(this),gasLimit:bigNumber,gasUsed:bigNumber,miner:address,extraData:data,transactions:Formatter.allowNull(Formatter.arrayOf(hash))};formats.blockWithTransactions=properties_1.shallowCopy(formats.block);formats.blockWithTransactions.transactions=Formatter.allowNull(Formatter.arrayOf(this.transactionResponse.bind(this)));formats.filter={fromBlock:Formatter.allowNull(blockTag,undefined),toBlock:Formatter.allowNull(blockTag,undefined),blockHash:Formatter.allowNull(hash,undefined),address:Formatter.allowNull(address,undefined),topics:Formatter.allowNull(this.topics.bind(this),undefined)};formats.filterLog={blockNumber:Formatter.allowNull(number),blockHash:Formatter.allowNull(hash),transactionIndex:number,removed:Formatter.allowNull(this.boolean.bind(this)),address:address,data:Formatter.allowFalsish(data,"0x"),topics:Formatter.arrayOf(hash),transactionHash:hash,logIndex:number};return formats};Formatter.prototype.number=function(number){return bignumber_1.BigNumber.from(number).toNumber()};Formatter.prototype.bigNumber=function(value){return bignumber_1.BigNumber.from(value)};Formatter.prototype.boolean=function(value){if(typeof value==="boolean"){return value}if(typeof value==="string"){value=value.toLowerCase();if(value==="true"){return true}if(value==="false"){return false}}throw new Error("invalid boolean - "+value)};Formatter.prototype.hex=function(value,strict){if(typeof value==="string"){if(!strict&&value.substring(0,2)!=="0x"){value="0x"+value}if(bytes_1.isHexString(value)){return value.toLowerCase()}}return logger.throwArgumentError("invalid hash","value",value)};Formatter.prototype.data=function(value,strict){var result=this.hex(value,strict);if(result.length%2!==0){throw new Error("invalid data; odd-length - "+value)}return result};Formatter.prototype.address=function(value){return address_1.getAddress(value)};Formatter.prototype.callAddress=function(value){if(!bytes_1.isHexString(value,32)){return null}var address=address_1.getAddress(bytes_1.hexDataSlice(value,12));return address===constants_1.AddressZero?null:address};Formatter.prototype.contractAddress=function(value){return address_1.getContractAddress(value)};Formatter.prototype.blockTag=function(blockTag){if(blockTag==null){return"latest"}if(blockTag==="earliest"){return"0x0"}if(blockTag==="latest"||blockTag==="pending"){return blockTag}if(typeof blockTag==="number"||bytes_1.isHexString(blockTag)){return bytes_1.hexValue(blockTag)}throw new Error("invalid blockTag")};Formatter.prototype.hash=function(value,strict){var result=this.hex(value,strict);if(bytes_1.hexDataLength(result)!==32){return logger.throwArgumentError("invalid hash","value",value)}return result};Formatter.prototype.difficulty=function(value){if(value==null){return null}var v=bignumber_1.BigNumber.from(value);try{return v.toNumber()}catch(error){}return null};Formatter.prototype.uint256=function(value){if(!bytes_1.isHexString(value)){throw new Error("invalid uint256")}return bytes_1.hexZeroPad(value,32)};Formatter.prototype._block=function(value,format){if(value.author!=null&&value.miner==null){value.miner=value.author}return Formatter.check(format,value)};Formatter.prototype.block=function(value){return this._block(value,this.formats.block)};Formatter.prototype.blockWithTransactions=function(value){return this._block(value,this.formats.blockWithTransactions)};Formatter.prototype.transactionRequest=function(value){return Formatter.check(this.formats.transactionRequest,value)};Formatter.prototype.transactionResponse=function(transaction){if(transaction.gas!=null&&transaction.gasLimit==null){transaction.gasLimit=transaction.gas}if(transaction.to&&bignumber_1.BigNumber.from(transaction.to).isZero()){transaction.to="0x0000000000000000000000000000000000000000"}if(transaction.input!=null&&transaction.data==null){transaction.data=transaction.input}if(transaction.to==null&&transaction.creates==null){transaction.creates=this.contractAddress(transaction)}var result=Formatter.check(this.formats.transaction,transaction);if(transaction.chainId!=null){var chainId=transaction.chainId;if(bytes_1.isHexString(chainId)){chainId=bignumber_1.BigNumber.from(chainId).toNumber()}result.chainId=chainId}else{var chainId=transaction.networkId;if(chainId==null&&result.v==null){chainId=transaction.chainId}if(bytes_1.isHexString(chainId)){chainId=bignumber_1.BigNumber.from(chainId).toNumber()}if(typeof chainId!=="number"&&result.v!=null){chainId=(result.v-35)/2;if(chainId<0){chainId=0}chainId=parseInt(chainId)}if(typeof chainId!=="number"){chainId=0}result.chainId=chainId}if(result.blockHash&&result.blockHash.replace(/0/g,"")==="x"){result.blockHash=null}return result};Formatter.prototype.transaction=function(value){return transactions_1.parse(value)};Formatter.prototype.receiptLog=function(value){return Formatter.check(this.formats.receiptLog,value)};Formatter.prototype.receipt=function(value){var result=Formatter.check(this.formats.receipt,value);if(value.status!=null){result.byzantium=true}return result};Formatter.prototype.topics=function(value){var _this=this;if(Array.isArray(value)){return value.map(function(v){return _this.topics(v)})}else if(value!=null){return this.hash(value,true)}return null};Formatter.prototype.filter=function(value){return Formatter.check(this.formats.filter,value)};Formatter.prototype.filterLog=function(value){return Formatter.check(this.formats.filterLog,value)};Formatter.check=function(format,object){var result={};for(var key in format){try{var value=format[key](object[key]);if(value!==undefined){result[key]=value}}catch(error){error.checkKey=key;error.checkValue=object[key];throw error}}return result};Formatter.allowNull=function(format,nullValue){return function(value){if(value==null){return nullValue}return format(value)}};Formatter.allowFalsish=function(format,replaceValue){return function(value){if(!value){return replaceValue}return format(value)}};Formatter.arrayOf=function(format){return function(array){if(!Array.isArray(array)){throw new Error("not an array")}var result=[];array.forEach(function(value){result.push(format(value))});return result}};return Formatter}();exports.Formatter=Formatter},{"./_version":43,"@ethersproject/address":23,"@ethersproject/bignumber":28,"@ethersproject/bytes":30,"@ethersproject/constants":31,"@ethersproject/logger":38,"@ethersproject/properties":42,"@ethersproject/transactions":87}],52:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var abstract_provider_1=require("@ethersproject/abstract-provider");exports.Provider=abstract_provider_1.Provider;var networks_1=require("@ethersproject/networks");exports.getNetwork=networks_1.getNetwork;var base_provider_1=require("./base-provider");exports.BaseProvider=base_provider_1.BaseProvider;var alchemy_provider_1=require("./alchemy-provider");exports.AlchemyProvider=alchemy_provider_1.AlchemyProvider;var cloudflare_provider_1=require("./cloudflare-provider");exports.CloudflareProvider=cloudflare_provider_1.CloudflareProvider;var etherscan_provider_1=require("./etherscan-provider");exports.EtherscanProvider=etherscan_provider_1.EtherscanProvider;var fallback_provider_1=require("./fallback-provider");exports.FallbackProvider=fallback_provider_1.FallbackProvider;var ipc_provider_1=require("./ipc-provider");exports.IpcProvider=ipc_provider_1.IpcProvider;var infura_provider_1=require("./infura-provider");exports.InfuraProvider=infura_provider_1.InfuraProvider;var json_rpc_provider_1=require("./json-rpc-provider");exports.JsonRpcProvider=json_rpc_provider_1.JsonRpcProvider;exports.JsonRpcSigner=json_rpc_provider_1.JsonRpcSigner;var nodesmith_provider_1=require("./nodesmith-provider");exports.NodesmithProvider=nodesmith_provider_1.NodesmithProvider;var url_json_rpc_provider_1=require("./url-json-rpc-provider");exports.StaticJsonRpcProvider=url_json_rpc_provider_1.StaticJsonRpcProvider;exports.UrlJsonRpcProvider=url_json_rpc_provider_1.UrlJsonRpcProvider;var web3_provider_1=require("./web3-provider");exports.Web3Provider=web3_provider_1.Web3Provider;var websocket_provider_1=require("./websocket-provider");exports.WebSocketProvider=websocket_provider_1.WebSocketProvider;var formatter_1=require("./formatter");exports.Formatter=formatter_1.Formatter;var logger_1=require("@ethersproject/logger");var _version_1=require("./_version");var logger=new logger_1.Logger(_version_1.version);function getDefaultProvider(network,options){if(network==null){network="homestead"}if(typeof network==="string"){var match=network.match(/^(ws|http)s?:/i);if(match){switch(match[1]){case"http":return new json_rpc_provider_1.JsonRpcProvider(network);case"ws":return new websocket_provider_1.WebSocketProvider(network);default:logger.throwArgumentError("unsupported URL scheme","network",network)}}}var n=networks_1.getNetwork(network);if(!n||!n._defaultProvider){logger.throwError("unsupported getDefaultProvider network",logger_1.Logger.errors.NETWORK_ERROR,{operation:"getDefaultProvider",network:network})}return n._defaultProvider({FallbackProvider:fallback_provider_1.FallbackProvider,AlchemyProvider:alchemy_provider_1.AlchemyProvider,CloudflareProvider:cloudflare_provider_1.CloudflareProvider,EtherscanProvider:etherscan_provider_1.EtherscanProvider,InfuraProvider:infura_provider_1.InfuraProvider,JsonRpcProvider:json_rpc_provider_1.JsonRpcProvider,NodesmithProvider:nodesmith_provider_1.NodesmithProvider,Web3Provider:web3_provider_1.Web3Provider,IpcProvider:ipc_provider_1.IpcProvider},options)}exports.getDefaultProvider=getDefaultProvider},{"./_version":43,"./alchemy-provider":44,"./base-provider":45,"./cloudflare-provider":48,"./etherscan-provider":49,"./fallback-provider":50,"./formatter":51,"./infura-provider":53,"./ipc-provider":46,"./json-rpc-provider":54,"./nodesmith-provider":55,"./url-json-rpc-provider":56,"./web3-provider":57,"./websocket-provider":58,"@ethersproject/abstract-provider":19,"@ethersproject/logger":38,"@ethersproject/networks":40}],53:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p]};return extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();Object.defineProperty(exports,"__esModule",{value:true});var websocket_provider_1=require("./websocket-provider");var logger_1=require("@ethersproject/logger");var _version_1=require("./_version");var logger=new logger_1.Logger(_version_1.version);var url_json_rpc_provider_1=require("./url-json-rpc-provider");var defaultProjectId="84842078b09946638c03157f83405213";var InfuraProvider=function(_super){__extends(InfuraProvider,_super);function InfuraProvider(){return _super!==null&&_super.apply(this,arguments)||this}InfuraProvider.getWebSocketProvider=function(network,apiKey){var provider=new InfuraProvider(network,apiKey);var connection=provider.connection;if(connection.password){logger.throwError("INFURA WebSocket project secrets unsupported",logger_1.Logger.errors.UNSUPPORTED_OPERATION,{operation:"InfuraProvider.getWebSocketProvider()"})}var url=connection.url.replace(/^http/i,"ws").replace("/v3/","/ws/v3/");return new websocket_provider_1.WebSocketProvider(url,network)};InfuraProvider.getApiKey=function(apiKey){var apiKeyObj={apiKey:defaultProjectId,projectId:defaultProjectId,projectSecret:null};if(apiKey==null){return apiKeyObj}if(typeof apiKey==="string"){apiKeyObj.projectId=apiKey}else if(apiKey.projectSecret!=null){if(typeof apiKey.projectId!=="string"){logger.throwArgumentError("projectSecret requires a projectId","projectId",apiKey.projectId)}if(typeof apiKey.projectSecret!=="string"){logger.throwArgumentError("invalid projectSecret","projectSecret","[REDACTED]")}apiKeyObj.projectId=apiKey.projectId;apiKeyObj.projectSecret=apiKey.projectSecret}else if(apiKey.projectId){apiKeyObj.projectId=apiKey.projectId}apiKeyObj.apiKey=apiKeyObj.projectId;return apiKeyObj};InfuraProvider.getUrl=function(network,apiKey){var host=null;switch(network.name){case"homestead":host="mainnet.infura.io";break;case"ropsten":host="ropsten.infura.io";break;case"rinkeby":host="rinkeby.infura.io";break;case"kovan":host="kovan.infura.io";break;case"goerli":host="goerli.infura.io";break;default:logger.throwError("unsupported network",logger_1.Logger.errors.INVALID_ARGUMENT,{argument:"network",value:network})}var connection={url:"https:/"+"/"+host+"/v3/"+apiKey.projectId};if(apiKey.projectSecret!=null){connection.user="";connection.password=apiKey.projectSecret}return connection};return InfuraProvider}(url_json_rpc_provider_1.UrlJsonRpcProvider);exports.InfuraProvider=InfuraProvider},{"./_version":43,"./url-json-rpc-provider":56,"./websocket-provider":58,"@ethersproject/logger":38}],54:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p]};return extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){function adopt(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator["throw"](value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})};var __generator=this&&this.__generator||function(thisArg,body){var _={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},f,y,t,g;return g={next:verb(0),throw:verb(1),return:verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(_)try{if(f=1,y&&(t=op[0]&2?y["return"]:op[0]?y["throw"]||((t=y["return"])&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[op[0]&2,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return{value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break}if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break}if(t[2])_.ops.pop();_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e];y=0}finally{f=t=0}if(op[0]&5)throw op[1];return{value:op[0]?op[1]:void 0,done:true}}};Object.defineProperty(exports,"__esModule",{value:true});var abstract_signer_1=require("@ethersproject/abstract-signer");var bignumber_1=require("@ethersproject/bignumber");var bytes_1=require("@ethersproject/bytes");var properties_1=require("@ethersproject/properties");var strings_1=require("@ethersproject/strings");var web_1=require("@ethersproject/web");var logger_1=require("@ethersproject/logger");var _version_1=require("./_version");var logger=new logger_1.Logger(_version_1.version);var base_provider_1=require("./base-provider");function timer(timeout){return new Promise(function(resolve){setTimeout(resolve,timeout)})}function getResult(payload){if(payload.error){var error=new Error(payload.error.message);error.code=payload.error.code;error.data=payload.error.data;throw error}return payload.result}function getLowerCase(value){if(value){return value.toLowerCase()}return value}var _constructorGuard={};var JsonRpcSigner=function(_super){__extends(JsonRpcSigner,_super);function JsonRpcSigner(constructorGuard,provider,addressOrIndex){var _newTarget=this.constructor;var _this=this;logger.checkNew(_newTarget,JsonRpcSigner);_this=_super.call(this)||this;if(constructorGuard!==_constructorGuard){throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner")}properties_1.defineReadOnly(_this,"provider",provider);if(addressOrIndex==null){addressOrIndex=0}if(typeof addressOrIndex==="string"){properties_1.defineReadOnly(_this,"_address",_this.provider.formatter.address(addressOrIndex));properties_1.defineReadOnly(_this,"_index",null)}else if(typeof addressOrIndex==="number"){properties_1.defineReadOnly(_this,"_index",addressOrIndex);properties_1.defineReadOnly(_this,"_address",null)}else{logger.throwArgumentError("invalid address or index","addressOrIndex",addressOrIndex)}return _this}JsonRpcSigner.prototype.connect=function(provider){return logger.throwError("cannot alter JSON-RPC Signer connection",logger_1.Logger.errors.UNSUPPORTED_OPERATION,{operation:"connect"})};JsonRpcSigner.prototype.connectUnchecked=function(){return new UncheckedJsonRpcSigner(_constructorGuard,this.provider,this._address||this._index)};JsonRpcSigner.prototype.getAddress=function(){var _this=this;if(this._address){return Promise.resolve(this._address)}return this.provider.send("eth_accounts",[]).then(function(accounts){if(accounts.length<=_this._index){logger.throwError("unknown account #"+_this._index,logger_1.Logger.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"})}return _this.provider.formatter.address(accounts[_this._index])})};JsonRpcSigner.prototype.sendUncheckedTransaction=function(transaction){var _this=this;transaction=properties_1.shallowCopy(transaction);var fromAddress=this.getAddress().then(function(address){if(address){address=address.toLowerCase()}return address});if(transaction.gasLimit==null){var estimate=properties_1.shallowCopy(transaction);estimate.from=fromAddress;transaction.gasLimit=this.provider.estimateGas(estimate)}return properties_1.resolveProperties({tx:properties_1.resolveProperties(transaction),sender:fromAddress}).then(function(_a){var tx=_a.tx,sender=_a.sender;if(tx.from!=null){if(tx.from.toLowerCase()!==sender){logger.throwArgumentError("from address mismatch","transaction",transaction)}}else{tx.from=sender}var hexTx=_this.provider.constructor.hexlifyTransaction(tx,{from:true});return _this.provider.send("eth_sendTransaction",[hexTx]).then(function(hash){return hash},function(error){if(error.responseText){if(error.responseText.indexOf("insufficient funds")>=0){logger.throwError("insufficient funds",logger_1.Logger.errors.INSUFFICIENT_FUNDS,{transaction:tx})}if(error.responseText.indexOf("nonce too low")>=0){logger.throwError("nonce has already been used",logger_1.Logger.errors.NONCE_EXPIRED,{transaction:tx})}if(error.responseText.indexOf("replacement transaction underpriced")>=0){logger.throwError("replacement fee too low",logger_1.Logger.errors.REPLACEMENT_UNDERPRICED,{transaction:tx})}}throw error})})};JsonRpcSigner.prototype.signTransaction=function(transaction){return logger.throwError("signing transactions is unsupported",logger_1.Logger.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})};JsonRpcSigner.prototype.sendTransaction=function(transaction){var _this=this;return this.sendUncheckedTransaction(transaction).then(function(hash){return web_1.poll(function(){return _this.provider.getTransaction(hash).then(function(tx){if(tx===null){return undefined}return _this.provider._wrapTransaction(tx,hash)})},{onceBlock:_this.provider}).catch(function(error){error.transactionHash=hash;throw error})})};JsonRpcSigner.prototype.signMessage=function(message){var _this=this;var data=typeof message==="string"?strings_1.toUtf8Bytes(message):message;return this.getAddress().then(function(address){return _this.provider.send("eth_sign",[address.toLowerCase(),bytes_1.hexlify(data)])})};JsonRpcSigner.prototype.unlock=function(password){var provider=this.provider;return this.getAddress().then(function(address){return provider.send("personal_unlockAccount",[address.toLowerCase(),password,null])})};return JsonRpcSigner}(abstract_signer_1.Signer);exports.JsonRpcSigner=JsonRpcSigner;var UncheckedJsonRpcSigner=function(_super){__extends(UncheckedJsonRpcSigner,_super);function UncheckedJsonRpcSigner(){return _super!==null&&_super.apply(this,arguments)||this}UncheckedJsonRpcSigner.prototype.sendTransaction=function(transaction){var _this=this;return this.sendUncheckedTransaction(transaction).then(function(hash){return{hash:hash,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:function(confirmations){return _this.provider.waitForTransaction(hash,confirmations)}}})};return UncheckedJsonRpcSigner}(JsonRpcSigner);var allowedTransactionKeys={chainId:true,data:true,gasLimit:true,gasPrice:true,nonce:true,to:true,value:true};var JsonRpcProvider=function(_super){__extends(JsonRpcProvider,_super);function JsonRpcProvider(url,network){var _newTarget=this.constructor;var _this=this;logger.checkNew(_newTarget,JsonRpcProvider);var networkOrReady=network;if(networkOrReady==null){networkOrReady=new Promise(function(resolve,reject){setTimeout(function(){_this.detectNetwork().then(function(network){resolve(network)},function(error){reject(error)})},0)})}_this=_super.call(this,networkOrReady)||this;if(!url){url=properties_1.getStatic(_this.constructor,"defaultUrl")()}if(typeof url==="string"){properties_1.defineReadOnly(_this,"connection",Object.freeze({url:url}))}else{properties_1.defineReadOnly(_this,"connection",Object.freeze(properties_1.shallowCopy(url)))}_this._nextId=42;return _this}JsonRpcProvider.defaultUrl=function(){return"http://localhost:8545"};JsonRpcProvider.prototype.detectNetwork=function(){return __awaiter(this,void 0,void 0,function(){var chainId,error_1,error_2,getNetwork;return __generator(this,function(_a){switch(_a.label){case 0:return[4,timer(0)];case 1:_a.sent();chainId=null;_a.label=2;case 2:_a.trys.push([2,4,,9]);return[4,this.send("eth_chainId",[])];case 3:chainId=_a.sent();return[3,9];case 4:error_1=_a.sent();_a.label=5;case 5:_a.trys.push([5,7,,8]);return[4,this.send("net_version",[])];case 6:chainId=_a.sent();return[3,8];case 7:error_2=_a.sent();return[3,8];case 8:return[3,9];case 9:if(chainId!=null){getNetwork=properties_1.getStatic(this.constructor,"getNetwork");try{return[2,getNetwork(bignumber_1.BigNumber.from(chainId).toNumber())]}catch(error){return[2,logger.throwError("could not detect network",logger_1.Logger.errors.NETWORK_ERROR,{chainId:chainId,event:"invalidNetwork",serverError:error})]}}return[2,logger.throwError("could not detect network",logger_1.Logger.errors.NETWORK_ERROR,{event:"noNetwork"})]}})})};JsonRpcProvider.prototype.getSigner=function(addressOrIndex){return new JsonRpcSigner(_constructorGuard,this,addressOrIndex)};JsonRpcProvider.prototype.getUncheckedSigner=function(addressOrIndex){return this.getSigner(addressOrIndex).connectUnchecked()};JsonRpcProvider.prototype.listAccounts=function(){var _this=this;return this.send("eth_accounts",[]).then(function(accounts){return accounts.map(function(a){return _this.formatter.address(a)})})};JsonRpcProvider.prototype.send=function(method,params){var _this=this;var request={method:method,params:params,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:properties_1.deepCopy(request),provider:this});return web_1.fetchJson(this.connection,JSON.stringify(request),getResult).then(function(result){_this.emit("debug",{action:"response",request:request,response:result,provider:_this});return result},function(error){_this.emit("debug",{action:"response",error:error,request:request,provider:_this});throw error})};JsonRpcProvider.prototype.prepareRequest=function(method,params){switch(method){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[getLowerCase(params.address),params.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[getLowerCase(params.address),params.blockTag]];case"getCode":return["eth_getCode",[getLowerCase(params.address),params.blockTag]];case"getStorageAt":return["eth_getStorageAt",[getLowerCase(params.address),params.position,params.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[params.signedTransaction]];case"getBlock":if(params.blockTag){return["eth_getBlockByNumber",[params.blockTag,!!params.includeTransactions]]}else if(params.blockHash){return["eth_getBlockByHash",[params.blockHash,!!params.includeTransactions]]}return null;case"getTransaction":return["eth_getTransactionByHash",[params.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[params.transactionHash]];case"call":{var hexlifyTransaction=properties_1.getStatic(this.constructor,"hexlifyTransaction");return["eth_call",[hexlifyTransaction(params.transaction,{from:true}),params.blockTag]]}case"estimateGas":{var hexlifyTransaction=properties_1.getStatic(this.constructor,"hexlifyTransaction");return["eth_estimateGas",[hexlifyTransaction(params.transaction,{from:true})]]}case"getLogs":if(params.filter&&params.filter.address!=null){params.filter.address=getLowerCase(params.filter.address)}return["eth_getLogs",[params.filter]];default:break}return null};JsonRpcProvider.prototype.perform=function(method,params){var args=this.prepareRequest(method,params);if(args==null){logger.throwError(method+" not implemented",logger_1.Logger.errors.NOT_IMPLEMENTED,{operation:method})}if(method==="sendTransaction"){return this.send(args[0],args[1]).catch(function(error){if(error.responseText){if(error.responseText.indexOf("insufficient funds")>0){logger.throwError("insufficient funds",logger_1.Logger.errors.INSUFFICIENT_FUNDS,{})}if(error.responseText.indexOf("nonce too low")>0){logger.throwError("nonce has already been used",logger_1.Logger.errors.NONCE_EXPIRED,{})}if(error.responseText.indexOf("replacement transaction underpriced")>0){logger.throwError("replacement fee too low",logger_1.Logger.errors.REPLACEMENT_UNDERPRICED,{})}}throw error})}return this.send(args[0],args[1])};JsonRpcProvider.prototype._startEvent=function(event){if(event.tag==="pending"){this._startPending()}_super.prototype._startEvent.call(this,event)};JsonRpcProvider.prototype._startPending=function(){if(this._pendingFilter!=null){return}var self=this;var pendingFilter=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=pendingFilter;pendingFilter.then(function(filterId){function poll(){self.send("eth_getFilterChanges",[filterId]).then(function(hashes){if(self._pendingFilter!=pendingFilter){return null}var seq=Promise.resolve();hashes.forEach(function(hash){self._emitted["t:"+hash.toLowerCase()]="pending";seq=seq.then(function(){return self.getTransaction(hash).then(function(tx){self.emit("pending",tx);return null})})});return seq.then(function(){return timer(1e3)})}).then(function(){if(self._pendingFilter!=pendingFilter){self.send("eth_uninstallFilter",[filterId]);return}setTimeout(function(){poll()},0);return null}).catch(function(error){})}poll();return filterId}).catch(function(error){})};JsonRpcProvider.prototype._stopEvent=function(event){if(event.tag==="pending"&&this.listenerCount("pending")===0){this._pendingFilter=null}_super.prototype._stopEvent.call(this,event)};JsonRpcProvider.hexlifyTransaction=function(transaction,allowExtra){var allowed=properties_1.shallowCopy(allowedTransactionKeys);if(allowExtra){for(var key in allowExtra){if(allowExtra[key]){allowed[key]=true}}}properties_1.checkProperties(transaction,allowed);var result={};["gasLimit","gasPrice","nonce","value"].forEach(function(key){if(transaction[key]==null){return}var value=bytes_1.hexValue(transaction[key]);if(key==="gasLimit"){key="gas"}result[key]=value});["from","to","data"].forEach(function(key){if(transaction[key]==null){return}result[key]=bytes_1.hexlify(transaction[key])});return result};return JsonRpcProvider}(base_provider_1.BaseProvider);exports.JsonRpcProvider=JsonRpcProvider},{"./_version":43,"./base-provider":45,"@ethersproject/abstract-signer":21,"@ethersproject/bignumber":28,"@ethersproject/bytes":30,"@ethersproject/logger":38,"@ethersproject/properties":42,"@ethersproject/strings":84,"@ethersproject/web":90}],55:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p]};return extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();Object.defineProperty(exports,"__esModule",{value:true});var url_json_rpc_provider_1=require("./url-json-rpc-provider");var logger_1=require("@ethersproject/logger");var _version_1=require("./_version");var logger=new logger_1.Logger(_version_1.version);var defaultApiKey="ETHERS_JS_SHARED";var NodesmithProvider=function(_super){__extends(NodesmithProvider,_super);function NodesmithProvider(){return _super!==null&&_super.apply(this,arguments)||this}NodesmithProvider.getApiKey=function(apiKey){if(apiKey&&typeof apiKey!=="string"){logger.throwArgumentError("invalid apiKey","apiKey",apiKey)}return apiKey||defaultApiKey};NodesmithProvider.getUrl=function(network,apiKey){logger.warn("NodeSmith will be discontinued on 2019-12-20; please migrate to another platform.");var host=null;switch(network.name){case"homestead":host="https://ethereum.api.nodesmith.io/v1/mainnet/jsonrpc";break;case"ropsten":host="https://ethereum.api.nodesmith.io/v1/ropsten/jsonrpc";break;case"rinkeby":host="https://ethereum.api.nodesmith.io/v1/rinkeby/jsonrpc";break;case"goerli":host="https://ethereum.api.nodesmith.io/v1/goerli/jsonrpc";break;case"kovan":host="https://ethereum.api.nodesmith.io/v1/kovan/jsonrpc";break;default:logger.throwArgumentError("unsupported network","network",arguments[0])}return host+"?apiKey="+apiKey};return NodesmithProvider}(url_json_rpc_provider_1.UrlJsonRpcProvider);exports.NodesmithProvider=NodesmithProvider},{"./_version":43,"./url-json-rpc-provider":56,"@ethersproject/logger":38}],56:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p]};return extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){function adopt(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator["throw"](value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})};var __generator=this&&this.__generator||function(thisArg,body){var _={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},f,y,t,g;return g={next:verb(0),throw:verb(1),return:verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(_)try{if(f=1,y&&(t=op[0]&2?y["return"]:op[0]?y["throw"]||((t=y["return"])&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[op[0]&2,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return{value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break}if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break}if(t[2])_.ops.pop();_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e];y=0}finally{f=t=0}if(op[0]&5)throw op[1];return{value:op[0]?op[1]:void 0,done:true}}};Object.defineProperty(exports,"__esModule",{value:true});var properties_1=require("@ethersproject/properties");var logger_1=require("@ethersproject/logger");var _version_1=require("./_version");var logger=new logger_1.Logger(_version_1.version);var json_rpc_provider_1=require("./json-rpc-provider");var StaticJsonRpcProvider=function(_super){__extends(StaticJsonRpcProvider,_super);function StaticJsonRpcProvider(){return _super!==null&&_super.apply(this,arguments)||this}StaticJsonRpcProvider.prototype.detectNetwork=function(){return __awaiter(this,void 0,void 0,function(){var network;return __generator(this,function(_a){switch(_a.label){case 0:network=this.network;if(!(network==null))return[3,2];return[4,_super.prototype.detectNetwork.call(this)];case 1:network=_a.sent();if(!network){logger.throwError("no network detected",logger_1.Logger.errors.UNKNOWN_ERROR,{})}if(this._network==null){properties_1.defineReadOnly(this,"_network",network);this.emit("network",network,null)}_a.label=2;case 2:return[2,network]}})})};return StaticJsonRpcProvider}(json_rpc_provider_1.JsonRpcProvider);exports.StaticJsonRpcProvider=StaticJsonRpcProvider;var UrlJsonRpcProvider=function(_super){__extends(UrlJsonRpcProvider,_super);function UrlJsonRpcProvider(network,apiKey){var _newTarget=this.constructor;var _this=this;logger.checkAbstract(_newTarget,UrlJsonRpcProvider);network=properties_1.getStatic(_newTarget,"getNetwork")(network);apiKey=properties_1.getStatic(_newTarget,"getApiKey")(apiKey);var connection=properties_1.getStatic(_newTarget,"getUrl")(network,apiKey);_this=_super.call(this,connection,network)||this;if(typeof apiKey==="string"){properties_1.defineReadOnly(_this,"apiKey",apiKey)}else if(apiKey!=null){Object.keys(apiKey).forEach(function(key){properties_1.defineReadOnly(_this,key,apiKey[key])})}return _this}UrlJsonRpcProvider.prototype._startPending=function(){logger.warn("WARNING: API provider does not support pending filters")};UrlJsonRpcProvider.prototype.getSigner=function(address){return logger.throwError("API provider does not support signing",logger_1.Logger.errors.UNSUPPORTED_OPERATION,{operation:"getSigner"})};UrlJsonRpcProvider.prototype.listAccounts=function(){return Promise.resolve([])};UrlJsonRpcProvider.getApiKey=function(apiKey){return apiKey};UrlJsonRpcProvider.getUrl=function(network,apiKey){return logger.throwError("not implemented; sub-classes must override getUrl",logger_1.Logger.errors.NOT_IMPLEMENTED,{operation:"getUrl"})};return UrlJsonRpcProvider}(StaticJsonRpcProvider);exports.UrlJsonRpcProvider=UrlJsonRpcProvider},{"./_version":43,"./json-rpc-provider":54,"@ethersproject/logger":38,"@ethersproject/properties":42}],57:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p]};return extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();Object.defineProperty(exports,"__esModule",{value:true});var properties_1=require("@ethersproject/properties");var logger_1=require("@ethersproject/logger");var _version_1=require("./_version");var logger=new logger_1.Logger(_version_1.version);var json_rpc_provider_1=require("./json-rpc-provider");var _nextId=1;function buildWeb3LegacyFetcher(provider,sendFunc){return function(method,params){if(method=="eth_sign"&&provider.isMetaMask){method="personal_sign";params=[params[1],params[0]]}var request={method:method,params:params,id:_nextId++,jsonrpc:"2.0"};return new Promise(function(resolve,reject){sendFunc(request,function(error,result){if(error){return reject(error)}if(result.error){var error_1=new Error(result.error.message);error_1.code=result.error.code;error_1.data=result.error.data;return reject(error_1)}resolve(result.result)})})}}function buildEip1193Fetcher(provider){return function(method,params){if(params==null){params=[]}if(method=="eth_sign"&&provider.isMetaMask){method="personal_sign";params=[params[1],params[0]]}return provider.request({method:method,params:params})}}var Web3Provider=function(_super){__extends(Web3Provider,_super);function Web3Provider(provider,network){var _newTarget=this.constructor;var _this=this;logger.checkNew(_newTarget,Web3Provider);if(provider==null){logger.throwArgumentError("missing provider","provider",provider)}var path=null;var jsonRpcFetchFunc=null;var subprovider=null;if(typeof provider==="function"){path="unknown:";jsonRpcFetchFunc=provider}else{path=provider.host||provider.path||"";if(!path&&provider.isMetaMask){path="metamask"}subprovider=provider;if(provider.request){if(path===""){path="eip-1193:"}jsonRpcFetchFunc=buildEip1193Fetcher(provider)}else if(provider.sendAsync){jsonRpcFetchFunc=buildWeb3LegacyFetcher(provider,provider.sendAsync.bind(provider))}else if(provider.send){jsonRpcFetchFunc=buildWeb3LegacyFetcher(provider,provider.send.bind(provider))}else{logger.throwArgumentError("unsupported provider","provider",provider)}if(!path){path="unknown:"}}_this=_super.call(this,path,network)||this;properties_1.defineReadOnly(_this,"jsonRpcFetchFunc",jsonRpcFetchFunc);properties_1.defineReadOnly(_this,"provider",subprovider);return _this}Web3Provider.prototype.send=function(method,params){return this.jsonRpcFetchFunc(method,params)};return Web3Provider}(json_rpc_provider_1.JsonRpcProvider);exports.Web3Provider=Web3Provider},{"./_version":43,"./json-rpc-provider":54,"@ethersproject/logger":38,"@ethersproject/properties":42}],58:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p]};return extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){function adopt(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator["throw"](value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})};var __generator=this&&this.__generator||function(thisArg,body){var _={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},f,y,t,g;return g={next:verb(0),throw:verb(1),return:verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(_)try{if(f=1,y&&(t=op[0]&2?y["return"]:op[0]?y["throw"]||((t=y["return"])&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[op[0]&2,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return{value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break}if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break}if(t[2])_.ops.pop();_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e];y=0}finally{f=t=0}if(op[0]&5)throw op[1];return{value:op[0]?op[1]:void 0,done:true}}};var __importDefault=this&&this.__importDefault||function(mod){return mod&&mod.__esModule?mod:{default:mod}};Object.defineProperty(exports,"__esModule",{value:true});var ws_1=__importDefault(require("ws"));var bignumber_1=require("@ethersproject/bignumber");var properties_1=require("@ethersproject/properties");var json_rpc_provider_1=require("./json-rpc-provider");var logger_1=require("@ethersproject/logger");var _version_1=require("./_version");var logger=new logger_1.Logger(_version_1.version);var NextId=1;var WebSocketProvider=function(_super){__extends(WebSocketProvider,_super);function WebSocketProvider(url,network){var _this=this;if(network==="any"){logger.throwError("WebSocketProvider does not support 'any' network yet",logger_1.Logger.errors.UNSUPPORTED_OPERATION,{operation:"network:any"})}_this=_super.call(this,url,network)||this;_this._pollingInterval=-1;properties_1.defineReadOnly(_this,"_websocket",new ws_1.default(_this.connection.url));properties_1.defineReadOnly(_this,"_requests",{});properties_1.defineReadOnly(_this,"_subs",{});properties_1.defineReadOnly(_this,"_subIds",{});_this._wsReady=false;_this._websocket.onopen=function(){_this._wsReady=true;Object.keys(_this._requests).forEach(function(id){_this._websocket.send(_this._requests[id].payload)})};_this._websocket.onmessage=function(messageEvent){var data=messageEvent.data;var result=JSON.parse(data);if(result.id!=null){var id=String(result.id);var request=_this._requests[id];delete _this._requests[id];if(result.result!==undefined){request.callback(null,result.result)}else{if(result.error){var error=new Error(result.error.message||"unknown error");properties_1.defineReadOnly(error,"code",result.error.code||null);properties_1.defineReadOnly(error,"response",data);request.callback(error,undefined)}else{request.callback(new Error("unknown error"),undefined)}}}else if(result.method==="eth_subscription"){var sub=_this._subs[result.params.subscription];if(sub){sub.processFunc(result.params.result)}}else{console.warn("this should not happen")}};var fauxPoll=setInterval(function(){_this.emit("poll")},1e3);if(fauxPoll.unref){fauxPoll.unref()}return _this}Object.defineProperty(WebSocketProvider.prototype,"pollingInterval",{get:function(){return 0},set:function(value){logger.throwError("cannot set polling interval on WebSocketProvider",logger_1.Logger.errors.UNSUPPORTED_OPERATION,{operation:"setPollingInterval"})},enumerable:true,configurable:true});WebSocketProvider.prototype.resetEventsBlock=function(blockNumber){logger.throwError("cannot reset events block on WebSocketProvider",logger_1.Logger.errors.UNSUPPORTED_OPERATION,{operation:"resetEventBlock"})};WebSocketProvider.prototype.poll=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){return[2,null]})})};Object.defineProperty(WebSocketProvider.prototype,"polling",{set:function(value){if(!value){return}logger.throwError("cannot set polling on WebSocketProvider",logger_1.Logger.errors.UNSUPPORTED_OPERATION,{operation:"setPolling"})},enumerable:true,configurable:true});WebSocketProvider.prototype.send=function(method,params){var _this=this;var rid=NextId++;return new Promise(function(resolve,reject){function callback(error,result){if(error){return reject(error)}return resolve(result)}var payload=JSON.stringify({method:method,params:params,id:rid,jsonrpc:"2.0"});_this._requests[String(rid)]={callback:callback,payload:payload};if(_this._wsReady){_this._websocket.send(payload)}})};WebSocketProvider.defaultUrl=function(){return"ws://localhost:8546"};WebSocketProvider.prototype._subscribe=function(tag,param,processFunc){return __awaiter(this,void 0,void 0,function(){var subIdPromise,subId;var _this=this;return __generator(this,function(_a){switch(_a.label){case 0:subIdPromise=this._subIds[tag];if(subIdPromise==null){subIdPromise=Promise.all(param).then(function(param){return _this.send("eth_subscribe",param)});this._subIds[tag]=subIdPromise}return[4,subIdPromise];case 1:subId=_a.sent();this._subs[subId]={tag:tag,processFunc:processFunc};return[2]}})})};WebSocketProvider.prototype._startEvent=function(event){var _this=this;switch(event.type){case"block":this._subscribe("block",["newHeads"],function(result){var blockNumber=bignumber_1.BigNumber.from(result.number).toNumber();_this._emitted.block=blockNumber;_this.emit("block",blockNumber)});break;case"pending":this._subscribe("pending",["newPendingTransactions"],function(result){_this.emit("pending",result)});break;case"filter":this._subscribe(event.tag,["logs",this._getFilter(event.filter)],function(result){if(result.removed==null){result.removed=false}_this.emit(event.filter,_this.formatter.filterLog(result))});break;case"tx":{var emitReceipt_1=function(event){var hash=event.hash;_this.getTransactionReceipt(hash).then(function(receipt){if(!receipt){return}_this.emit(hash,receipt)})};emitReceipt_1(event);this._subscribe("tx",["newHeads"],function(result){_this._events.filter(function(e){return e.type==="tx"}).forEach(emitReceipt_1)});break}case"debug":case"poll":case"willPoll":case"didPoll":case"error":break;default:console.log("unhandled:",event);break}};WebSocketProvider.prototype._stopEvent=function(event){var _this=this;var tag=event.tag;if(event.type==="tx"){if(this._events.filter(function(e){return e.type==="tx"}).length){return}tag="tx"}else if(this.listenerCount(event.event)){return}var subId=this._subIds[tag];if(!subId){return}delete this._subIds[tag];subId.then(function(subId){if(!_this._subs[subId]){return}delete _this._subs[subId];_this.send("eth_unsubscribe",[subId])})};return WebSocketProvider}(json_rpc_provider_1.JsonRpcProvider);exports.WebSocketProvider=WebSocketProvider},{"./_version":43,"./json-rpc-provider":54,"@ethersproject/bignumber":28,"@ethersproject/logger":38,"@ethersproject/properties":42,ws:47}],59:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.version="random/5.0.1"},{}],60:[function(require,module,exports){(function(global){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var bytes_1=require("@ethersproject/bytes");var logger_1=require("@ethersproject/logger");var _version_1=require("./_version");var logger=new logger_1.Logger(_version_1.version);var shuffle_1=require("./shuffle");exports.shuffled=shuffle_1.shuffled;var anyGlobal=null;try{anyGlobal=window;if(anyGlobal==null){throw new Error("try next")}}catch(error){try{anyGlobal=global;if(anyGlobal==null){throw new Error("try next")}}catch(error){anyGlobal={}}}var crypto=anyGlobal.crypto||anyGlobal.msCrypto;if(!crypto||!crypto.getRandomValues){logger.warn("WARNING: Missing strong random number source");crypto={getRandomValues:function(buffer){return logger.throwError("no secure random source avaialble",logger_1.Logger.errors.UNSUPPORTED_OPERATION,{operation:"crypto.getRandomValues"})}}}function randomBytes(length){if(length<=0||length>1024||length%1){logger.throwArgumentError("invalid length","length",length)}var result=new Uint8Array(length);crypto.getRandomValues(result);return bytes_1.arrayify(result)}exports.randomBytes=randomBytes}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./_version":59,"./shuffle":61,"@ethersproject/bytes":30,"@ethersproject/logger":38}],61:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});function shuffled(array){array=array.slice();for(var i=array.length-1;i>0;i--){var j=Math.floor(Math.random()*(i+1));var tmp=array[i];array[i]=array[j];array[j]=tmp}return array}exports.shuffled=shuffled},{}],62:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.version="rlp/5.0.1"},{}],63:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var bytes_1=require("@ethersproject/bytes");var logger_1=require("@ethersproject/logger");var _version_1=require("./_version");var logger=new logger_1.Logger(_version_1.version);function arrayifyInteger(value){var result=[];while(value){result.unshift(value&255);value>>=8}return result}function unarrayifyInteger(data,offset,length){var result=0;for(var i=0;i<length;i++){result=result*256+data[offset+i]}return result}function _encode(object){if(Array.isArray(object)){var payload_1=[];object.forEach(function(child){payload_1=payload_1.concat(_encode(child))});if(payload_1.length<=55){payload_1.unshift(192+payload_1.length);return payload_1}var length_1=arrayifyInteger(payload_1.length);length_1.unshift(247+length_1.length);return length_1.concat(payload_1)}if(!bytes_1.isBytesLike(object)){logger.throwArgumentError("RLP object must be BytesLike","object",object)}var data=Array.prototype.slice.call(bytes_1.arrayify(object));if(data.length===1&&data[0]<=127){return data}else if(data.length<=55){data.unshift(128+data.length);return data}var length=arrayifyInteger(data.length);length.unshift(183+length.length);return length.concat(data)}function encode(object){return bytes_1.hexlify(_encode(object))}exports.encode=encode;function _decodeChildren(data,offset,childOffset,length){var result=[];while(childOffset<offset+1+length){var decoded=_decode(data,childOffset);result.push(decoded.result);childOffset+=decoded.consumed;if(childOffset>offset+1+length){logger.throwError("child data too short",logger_1.Logger.errors.BUFFER_OVERRUN,{})}}return{consumed:1+length,result:result}}function _decode(data,offset){if(data.length===0){logger.throwError("data too short",logger_1.Logger.errors.BUFFER_OVERRUN,{})}if(data[offset]>=248){var lengthLength=data[offset]-247;if(offset+1+lengthLength>data.length){logger.throwError("data short segment too short",logger_1.Logger.errors.BUFFER_OVERRUN,{})}var length_2=unarrayifyInteger(data,offset+1,lengthLength);if(offset+1+lengthLength+length_2>data.length){logger.throwError("data long segment too short",logger_1.Logger.errors.BUFFER_OVERRUN,{})}return _decodeChildren(data,offset,offset+1+lengthLength,lengthLength+length_2)}else if(data[offset]>=192){var length_3=data[offset]-192;if(offset+1+length_3>data.length){logger.throwError("data array too short",logger_1.Logger.errors.BUFFER_OVERRUN,{})}return _decodeChildren(data,offset,offset+1,length_3)}else if(data[offset]>=184){var lengthLength=data[offset]-183;if(offset+1+lengthLength>data.length){logger.throwError("data array too short",logger_1.Logger.errors.BUFFER_OVERRUN,{})}var length_4=unarrayifyInteger(data,offset+1,lengthLength);if(offset+1+lengthLength+length_4>data.length){logger.throwError("data array too short",logger_1.Logger.errors.BUFFER_OVERRUN,{})}var result=bytes_1.hexlify(data.slice(offset+1+lengthLength,offset+1+lengthLength+length_4));return{consumed:1+lengthLength+length_4,result:result}}else if(data[offset]>=128){var length_5=data[offset]-128;if(offset+1+length_5>data.length){logger.throwError("data too short",logger_1.Logger.errors.BUFFER_OVERRUN,{})}var result=bytes_1.hexlify(data.slice(offset+1,offset+1+length_5));return{consumed:1+length_5,result:result}}return{consumed:1,result:bytes_1.hexlify(data[offset])}}function decode(data){var bytes=bytes_1.arrayify(data);var decoded=_decode(bytes,0);if(decoded.consumed!==bytes.length){logger.throwArgumentError("invalid rlp data","data",data)}return decoded.result}exports.decode=decode},{"./_version":62,"@ethersproject/bytes":30,"@ethersproject/logger":38}],64:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.version="sha2/5.0.1"},{}],65:[function(require,module,exports){"use strict";var __importStar=this&&this.__importStar||function(mod){if(mod&&mod.__esModule)return mod;var result={};if(mod!=null)for(var k in mod)if(Object.hasOwnProperty.call(mod,k))result[k]=mod[k];result["default"]=mod;return result};Object.defineProperty(exports,"__esModule",{value:true});var hash=__importStar(require("hash.js"));var bytes_1=require("@ethersproject/bytes");var logger_1=require("@ethersproject/logger");var _version_1=require("./_version");var logger=new logger_1.Logger(_version_1.version);var SupportedAlgorithm;(function(SupportedAlgorithm){SupportedAlgorithm["sha256"]="sha256";SupportedAlgorithm["sha512"]="sha512"})(SupportedAlgorithm=exports.SupportedAlgorithm||(exports.SupportedAlgorithm={}));function ripemd160(data){return"0x"+hash.ripemd160().update(bytes_1.arrayify(data)).digest("hex")}exports.ripemd160=ripemd160;function sha256(data){return"0x"+hash.sha256().update(bytes_1.arrayify(data)).digest("hex")}exports.sha256=sha256;function sha512(data){return"0x"+hash.sha512().update(bytes_1.arrayify(data)).digest("hex")}exports.sha512=sha512;function computeHmac(algorithm,key,data){if(!SupportedAlgorithm[algorithm]){logger.throwError("unsupported algorithm "+algorithm,logger_1.Logger.errors.UNSUPPORTED_OPERATION,{operation:"hmac",algorithm:algorithm})}return"0x"+hash.hmac(hash[algorithm],bytes_1.arrayify(key)).update(bytes_1.arrayify(data)).digest("hex")}exports.computeHmac=computeHmac},{"./_version":64,"@ethersproject/bytes":30,"@ethersproject/logger":38,"hash.js":66}],66:[function(require,module,exports){var hash=exports;hash.utils=require("./hash/utils");hash.common=require("./hash/common");hash.sha=require("./hash/sha");hash.ripemd=require("./hash/ripemd");hash.hmac=require("./hash/hmac");hash.sha1=hash.sha.sha1;hash.sha256=hash.sha.sha256;hash.sha224=hash.sha.sha224;hash.sha384=hash.sha.sha384;hash.sha512=hash.sha.sha512;hash.ripemd160=hash.ripemd.ripemd160},{"./hash/common":67,"./hash/hmac":68,"./hash/ripemd":69,"./hash/sha":70,"./hash/utils":77}],67:[function(require,module,exports){"use strict";var utils=require("./utils");var assert=require("minimalistic-assert");function BlockHash(){this.pending=null;this.pendingTotal=0;this.blockSize=this.constructor.blockSize;this.outSize=this.constructor.outSize;this.hmacStrength=this.constructor.hmacStrength;this.padLength=this.constructor.padLength/8;this.endian="big";this._delta8=this.blockSize/8;this._delta32=this.blockSize/32}exports.BlockHash=BlockHash;BlockHash.prototype.update=function update(msg,enc){msg=utils.toArray(msg,enc);if(!this.pending)this.pending=msg;else this.pending=this.pending.concat(msg);this.pendingTotal+=msg.length;if(this.pending.length>=this._delta8){msg=this.pending;var r=msg.length%this._delta8;this.pending=msg.slice(msg.length-r,msg.length);if(this.pending.length===0)this.pending=null;msg=utils.join32(msg,0,msg.length-r,this.endian);for(var i=0;i<msg.length;i+=this._delta32)this._update(msg,i,i+this._delta32)}return this};BlockHash.prototype.digest=function digest(enc){this.update(this._pad());assert(this.pending===null);return this._digest(enc)};BlockHash.prototype._pad=function pad(){var len=this.pendingTotal;var bytes=this._delta8;var k=bytes-(len+this.padLength)%bytes;var res=new Array(k+this.padLength);res[0]=128;for(var i=1;i<k;i++)res[i]=0;len<<=3;if(this.endian==="big"){for(var t=8;t<this.padLength;t++)res[i++]=0;res[i++]=0;res[i++]=0;res[i++]=0;res[i++]=0;res[i++]=len>>>24&255;res[i++]=len>>>16&255;res[i++]=len>>>8&255;res[i++]=len&255}else{res[i++]=len&255;res[i++]=len>>>8&255;res[i++]=len>>>16&255;res[i++]=len>>>24&255;res[i++]=0;res[i++]=0;res[i++]=0;res[i++]=0;for(t=8;t<this.padLength;t++)res[i++]=0}return res}},{"./utils":77,"minimalistic-assert":132}],68:[function(require,module,exports){"use strict";var utils=require("./utils");var assert=require("minimalistic-assert");function Hmac(hash,key,enc){if(!(this instanceof Hmac))return new Hmac(hash,key,enc);this.Hash=hash;this.blockSize=hash.blockSize/8;this.outSize=hash.outSize/8;this.inner=null;this.outer=null;this._init(utils.toArray(key,enc))}module.exports=Hmac;Hmac.prototype._init=function init(key){if(key.length>this.blockSize)key=(new this.Hash).update(key).digest();assert(key.length<=this.blockSize);for(var i=key.length;i<this.blockSize;i++)key.push(0);for(i=0;i<key.length;i++)key[i]^=54;this.inner=(new this.Hash).update(key);for(i=0;i<key.length;i++)key[i]^=106;this.outer=(new this.Hash).update(key)};Hmac.prototype.update=function update(msg,enc){this.inner.update(msg,enc);return this};Hmac.prototype.digest=function digest(enc){this.outer.update(this.inner.digest());return this.outer.digest(enc)}},{"./utils":77,"minimalistic-assert":132}],69:[function(require,module,exports){"use strict";var utils=require("./utils");var common=require("./common");var rotl32=utils.rotl32;var sum32=utils.sum32;var sum32_3=utils.sum32_3;var sum32_4=utils.sum32_4;var BlockHash=common.BlockHash;function RIPEMD160(){if(!(this instanceof RIPEMD160))return new RIPEMD160;BlockHash.call(this);this.h=[1732584193,4023233417,2562383102,271733878,3285377520];this.endian="little"}utils.inherits(RIPEMD160,BlockHash);exports.ripemd160=RIPEMD160;RIPEMD160.blockSize=512;RIPEMD160.outSize=160;RIPEMD160.hmacStrength=192;RIPEMD160.padLength=64;RIPEMD160.prototype._update=function update(msg,start){var A=this.h[0];var B=this.h[1];var C=this.h[2];var D=this.h[3];var E=this.h[4];var Ah=A;var Bh=B;var Ch=C;var Dh=D;var Eh=E;for(var j=0;j<80;j++){var T=sum32(rotl32(sum32_4(A,f(j,B,C,D),msg[r[j]+start],K(j)),s[j]),E);A=E;E=D;D=rotl32(C,10);C=B;B=T;T=sum32(rotl32(sum32_4(Ah,f(79-j,Bh,Ch,Dh),msg[rh[j]+start],Kh(j)),sh[j]),Eh);Ah=Eh;Eh=Dh;Dh=rotl32(Ch,10);Ch=Bh;Bh=T}T=sum32_3(this.h[1],C,Dh);this.h[1]=sum32_3(this.h[2],D,Eh);this.h[2]=sum32_3(this.h[3],E,Ah);this.h[3]=sum32_3(this.h[4],A,Bh);this.h[4]=sum32_3(this.h[0],B,Ch);this.h[0]=T};RIPEMD160.prototype._digest=function digest(enc){if(enc==="hex")return utils.toHex32(this.h,"little");else return utils.split32(this.h,"little")};function f(j,x,y,z){if(j<=15)return x^y^z;else if(j<=31)return x&y|~x&z;else if(j<=47)return(x|~y)^z;else if(j<=63)return x&z|y&~z;else return x^(y|~z)}function K(j){if(j<=15)return 0;else if(j<=31)return 1518500249;else if(j<=47)return 1859775393;else if(j<=63)return 2400959708;else return 2840853838}function Kh(j){if(j<=15)return 1352829926;else if(j<=31)return 1548603684;else if(j<=47)return 1836072691;else if(j<=63)return 2053994217;else return 0}var r=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13];var rh=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11];var s=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6];var sh=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]},{"./common":67,"./utils":77}],70:[function(require,module,exports){"use strict";exports.sha1=require("./sha/1");exports.sha224=require("./sha/224");exports.sha256=require("./sha/256");exports.sha384=require("./sha/384");exports.sha512=require("./sha/512")},{"./sha/1":71,"./sha/224":72,"./sha/256":73,"./sha/384":74,"./sha/512":75}],71:[function(require,module,exports){"use strict";var utils=require("../utils");var common=require("../common");var shaCommon=require("./common");var rotl32=utils.rotl32;var sum32=utils.sum32;var sum32_5=utils.sum32_5;var ft_1=shaCommon.ft_1;var BlockHash=common.BlockHash;var sha1_K=[1518500249,1859775393,2400959708,3395469782];function SHA1(){if(!(this instanceof SHA1))return new SHA1;BlockHash.call(this);this.h=[1732584193,4023233417,2562383102,271733878,3285377520];this.W=new Array(80)}utils.inherits(SHA1,BlockHash);module.exports=SHA1;SHA1.blockSize=512;SHA1.outSize=160;SHA1.hmacStrength=80;SHA1.padLength=64;SHA1.prototype._update=function _update(msg,start){var W=this.W;for(var i=0;i<16;i++)W[i]=msg[start+i];for(;i<W.length;i++)W[i]=rotl32(W[i-3]^W[i-8]^W[i-14]^W[i-16],1);var a=this.h[0];var b=this.h[1];var c=this.h[2];var d=this.h[3];var e=this.h[4];for(i=0;i<W.length;i++){var s=~~(i/20);var t=sum32_5(rotl32(a,5),ft_1(s,b,c,d),e,W[i],sha1_K[s]);e=d;d=c;c=rotl32(b,30);b=a;a=t}this.h[0]=sum32(this.h[0],a);this.h[1]=sum32(this.h[1],b);this.h[2]=sum32(this.h[2],c);this.h[3]=sum32(this.h[3],d);this.h[4]=sum32(this.h[4],e)};SHA1.prototype._digest=function digest(enc){if(enc==="hex")return utils.toHex32(this.h,"big");else return utils.split32(this.h,"big")}},{"../common":67,"../utils":77,"./common":76}],72:[function(require,module,exports){"use strict";var utils=require("../utils");var SHA256=require("./256");function SHA224(){if(!(this instanceof SHA224))return new SHA224;SHA256.call(this);this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}utils.inherits(SHA224,SHA256);module.exports=SHA224;SHA224.blockSize=512;SHA224.outSize=224;SHA224.hmacStrength=192;SHA224.padLength=64;SHA224.prototype._digest=function digest(enc){if(enc==="hex")return utils.toHex32(this.h.slice(0,7),"big");else return utils.split32(this.h.slice(0,7),"big")}},{"../utils":77,"./256":73}],73:[function(require,module,exports){"use strict";var utils=require("../utils");var common=require("../common");var shaCommon=require("./common");var assert=require("minimalistic-assert");var sum32=utils.sum32;var sum32_4=utils.sum32_4;var sum32_5=utils.sum32_5;var ch32=shaCommon.ch32;var maj32=shaCommon.maj32;var s0_256=shaCommon.s0_256;var s1_256=shaCommon.s1_256;var g0_256=shaCommon.g0_256;var g1_256=shaCommon.g1_256;var BlockHash=common.BlockHash;var sha256_K=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function SHA256(){if(!(this instanceof SHA256))return new SHA256;BlockHash.call(this);this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];this.k=sha256_K;this.W=new Array(64)}utils.inherits(SHA256,BlockHash);module.exports=SHA256;SHA256.blockSize=512;SHA256.outSize=256;SHA256.hmacStrength=192;SHA256.padLength=64;SHA256.prototype._update=function _update(msg,start){var W=this.W;for(var i=0;i<16;i++)W[i]=msg[start+i];for(;i<W.length;i++)W[i]=sum32_4(g1_256(W[i-2]),W[i-7],g0_256(W[i-15]),W[i-16]);var a=this.h[0];var b=this.h[1];var c=this.h[2];var d=this.h[3];var e=this.h[4];var f=this.h[5];var g=this.h[6];var h=this.h[7];assert(this.k.length===W.length);for(i=0;i<W.length;i++){var T1=sum32_5(h,s1_256(e),ch32(e,f,g),this.k[i],W[i]);var T2=sum32(s0_256(a),maj32(a,b,c));h=g;g=f;f=e;e=sum32(d,T1);d=c;c=b;b=a;a=sum32(T1,T2)}this.h[0]=sum32(this.h[0],a);this.h[1]=sum32(this.h[1],b);this.h[2]=sum32(this.h[2],c);this.h[3]=sum32(this.h[3],d);this.h[4]=sum32(this.h[4],e);this.h[5]=sum32(this.h[5],f);this.h[6]=sum32(this.h[6],g);this.h[7]=sum32(this.h[7],h)};SHA256.prototype._digest=function digest(enc){if(enc==="hex")return utils.toHex32(this.h,"big");else return utils.split32(this.h,"big")}},{"../common":67,"../utils":77,"./common":76,"minimalistic-assert":132}],74:[function(require,module,exports){"use strict";var utils=require("../utils");var SHA512=require("./512");function SHA384(){if(!(this instanceof SHA384))return new SHA384;SHA512.call(this);this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}utils.inherits(SHA384,SHA512);module.exports=SHA384;SHA384.blockSize=1024;SHA384.outSize=384;SHA384.hmacStrength=192;SHA384.padLength=128;SHA384.prototype._digest=function digest(enc){if(enc==="hex")return utils.toHex32(this.h.slice(0,12),"big");else return utils.split32(this.h.slice(0,12),"big")}},{"../utils":77,"./512":75}],75:[function(require,module,exports){"use strict";var utils=require("../utils");var common=require("../common");var assert=require("minimalistic-assert");var rotr64_hi=utils.rotr64_hi;var rotr64_lo=utils.rotr64_lo;var shr64_hi=utils.shr64_hi;var shr64_lo=utils.shr64_lo;var sum64=utils.sum64;var sum64_hi=utils.sum64_hi;var sum64_lo=utils.sum64_lo;var sum64_4_hi=utils.sum64_4_hi;var sum64_4_lo=utils.sum64_4_lo;var sum64_5_hi=utils.sum64_5_hi;var sum64_5_lo=utils.sum64_5_lo;var BlockHash=common.BlockHash;var sha512_K=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function SHA512(){if(!(this instanceof SHA512))return new SHA512;BlockHash.call(this);this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209];this.k=sha512_K;this.W=new Array(160)}utils.inherits(SHA512,BlockHash);module.exports=SHA512;SHA512.blockSize=1024;SHA512.outSize=512;SHA512.hmacStrength=192;SHA512.padLength=128;SHA512.prototype._prepareBlock=function _prepareBlock(msg,start){var W=this.W;for(var i=0;i<32;i++)W[i]=msg[start+i];for(;i<W.length;i+=2){var c0_hi=g1_512_hi(W[i-4],W[i-3]);var c0_lo=g1_512_lo(W[i-4],W[i-3]);var c1_hi=W[i-14];var c1_lo=W[i-13];var c2_hi=g0_512_hi(W[i-30],W[i-29]);var c2_lo=g0_512_lo(W[i-30],W[i-29]);var c3_hi=W[i-32];var c3_lo=W[i-31];W[i]=sum64_4_hi(c0_hi,c0_lo,c1_hi,c1_lo,c2_hi,c2_lo,c3_hi,c3_lo);W[i+1]=sum64_4_lo(c0_hi,c0_lo,c1_hi,c1_lo,c2_hi,c2_lo,c3_hi,c3_lo)}};SHA512.prototype._update=function _update(msg,start){this._prepareBlock(msg,start);var W=this.W;var ah=this.h[0];var al=this.h[1];var bh=this.h[2];var bl=this.h[3];var ch=this.h[4];var cl=this.h[5];var dh=this.h[6];var dl=this.h[7];var eh=this.h[8];var el=this.h[9];var fh=this.h[10];var fl=this.h[11];var gh=this.h[12];var gl=this.h[13];var hh=this.h[14];var hl=this.h[15];assert(this.k.length===W.length);for(var i=0;i<W.length;i+=2){var c0_hi=hh;var c0_lo=hl;var c1_hi=s1_512_hi(eh,el);var c1_lo=s1_512_lo(eh,el);var c2_hi=ch64_hi(eh,el,fh,fl,gh,gl);var c2_lo=ch64_lo(eh,el,fh,fl,gh,gl);var c3_hi=this.k[i];var c3_lo=this.k[i+1];var c4_hi=W[i];var c4_lo=W[i+1];var T1_hi=sum64_5_hi(c0_hi,c0_lo,c1_hi,c1_lo,c2_hi,c2_lo,c3_hi,c3_lo,c4_hi,c4_lo);var T1_lo=sum64_5_lo(c0_hi,c0_lo,c1_hi,c1_lo,c2_hi,c2_lo,c3_hi,c3_lo,c4_hi,c4_lo);c0_hi=s0_512_hi(ah,al);c0_lo=s0_512_lo(ah,al);c1_hi=maj64_hi(ah,al,bh,bl,ch,cl);c1_lo=maj64_lo(ah,al,bh,bl,ch,cl);var T2_hi=sum64_hi(c0_hi,c0_lo,c1_hi,c1_lo);var T2_lo=sum64_lo(c0_hi,c0_lo,c1_hi,c1_lo);hh=gh;hl=gl;gh=fh;gl=fl;fh=eh;fl=el;eh=sum64_hi(dh,dl,T1_hi,T1_lo);el=sum64_lo(dl,dl,T1_hi,T1_lo);dh=ch;dl=cl;ch=bh;cl=bl;bh=ah;bl=al;ah=sum64_hi(T1_hi,T1_lo,T2_hi,T2_lo);al=sum64_lo(T1_hi,T1_lo,T2_hi,T2_lo)}sum64(this.h,0,ah,al);sum64(this.h,2,bh,bl);sum64(this.h,4,ch,cl);sum64(this.h,6,dh,dl);sum64(this.h,8,eh,el);sum64(this.h,10,fh,fl);sum64(this.h,12,gh,gl);sum64(this.h,14,hh,hl)};SHA512.prototype._digest=function digest(enc){if(enc==="hex")return utils.toHex32(this.h,"big");else return utils.split32(this.h,"big")};function ch64_hi(xh,xl,yh,yl,zh){var r=xh&yh^~xh&zh;if(r<0)r+=4294967296;return r}function ch64_lo(xh,xl,yh,yl,zh,zl){var r=xl&yl^~xl&zl;if(r<0)r+=4294967296;return r}function maj64_hi(xh,xl,yh,yl,zh){var r=xh&yh^xh&zh^yh&zh;if(r<0)r+=4294967296;return r}function maj64_lo(xh,xl,yh,yl,zh,zl){var r=xl&yl^xl&zl^yl&zl;if(r<0)r+=4294967296;return r}function s0_512_hi(xh,xl){var c0_hi=rotr64_hi(xh,xl,28);var c1_hi=rotr64_hi(xl,xh,2);var c2_hi=rotr64_hi(xl,xh,7);var r=c0_hi^c1_hi^c2_hi;if(r<0)r+=4294967296;return r}function s0_512_lo(xh,xl){var c0_lo=rotr64_lo(xh,xl,28);var c1_lo=rotr64_lo(xl,xh,2);var c2_lo=rotr64_lo(xl,xh,7);var r=c0_lo^c1_lo^c2_lo;if(r<0)r+=4294967296;return r}function s1_512_hi(xh,xl){var c0_hi=rotr64_hi(xh,xl,14);var c1_hi=rotr64_hi(xh,xl,18);var c2_hi=rotr64_hi(xl,xh,9);var r=c0_hi^c1_hi^c2_hi;if(r<0)r+=4294967296;return r}function s1_512_lo(xh,xl){var c0_lo=rotr64_lo(xh,xl,14);var c1_lo=rotr64_lo(xh,xl,18);var c2_lo=rotr64_lo(xl,xh,9);var r=c0_lo^c1_lo^c2_lo;if(r<0)r+=4294967296;return r}function g0_512_hi(xh,xl){var c0_hi=rotr64_hi(xh,xl,1);var c1_hi=rotr64_hi(xh,xl,8);var c2_hi=shr64_hi(xh,xl,7);var r=c0_hi^c1_hi^c2_hi;if(r<0)r+=4294967296;return r}function g0_512_lo(xh,xl){var c0_lo=rotr64_lo(xh,xl,1);var c1_lo=rotr64_lo(xh,xl,8);var c2_lo=shr64_lo(xh,xl,7);var r=c0_lo^c1_lo^c2_lo;if(r<0)r+=4294967296;return r}function g1_512_hi(xh,xl){var c0_hi=rotr64_hi(xh,xl,19);var c1_hi=rotr64_hi(xl,xh,29);var c2_hi=shr64_hi(xh,xl,6);var r=c0_hi^c1_hi^c2_hi;if(r<0)r+=4294967296;return r}function g1_512_lo(xh,xl){var c0_lo=rotr64_lo(xh,xl,19);var c1_lo=rotr64_lo(xl,xh,29);var c2_lo=shr64_lo(xh,xl,6);var r=c0_lo^c1_lo^c2_lo;if(r<0)r+=4294967296;return r}},{"../common":67,"../utils":77,"minimalistic-assert":132}],76:[function(require,module,exports){"use strict";var utils=require("../utils");var rotr32=utils.rotr32;function ft_1(s,x,y,z){if(s===0)return ch32(x,y,z);if(s===1||s===3)return p32(x,y,z);if(s===2)return maj32(x,y,z)}exports.ft_1=ft_1;function ch32(x,y,z){return x&y^~x&z}exports.ch32=ch32;function maj32(x,y,z){return x&y^x&z^y&z}exports.maj32=maj32;function p32(x,y,z){return x^y^z}exports.p32=p32;function s0_256(x){return rotr32(x,2)^rotr32(x,13)^rotr32(x,22)}exports.s0_256=s0_256;function s1_256(x){return rotr32(x,6)^rotr32(x,11)^rotr32(x,25)}exports.s1_256=s1_256;function g0_256(x){return rotr32(x,7)^rotr32(x,18)^x>>>3}exports.g0_256=g0_256;function g1_256(x){return rotr32(x,17)^rotr32(x,19)^x>>>10}exports.g1_256=g1_256},{"../utils":77}],77:[function(require,module,exports){"use strict";var assert=require("minimalistic-assert");var inherits=require("inherits");exports.inherits=inherits;function toArray(msg,enc){if(Array.isArray(msg))return msg.slice();if(!msg)return[];var res=[];if(typeof msg==="string"){if(!enc){for(var i=0;i<msg.length;i++){var c=msg.charCodeAt(i);var hi=c>>8;var lo=c&255;if(hi)res.push(hi,lo);else res.push(lo)}}else if(enc==="hex"){msg=msg.replace(/[^a-z0-9]+/gi,"");if(msg.length%2!==0)msg="0"+msg;for(i=0;i<msg.length;i+=2)res.push(parseInt(msg[i]+msg[i+1],16))}}else{for(i=0;i<msg.length;i++)res[i]=msg[i]|0}return res}exports.toArray=toArray;function toHex(msg){var res="";for(var i=0;i<msg.length;i++)res+=zero2(msg[i].toString(16));return res}exports.toHex=toHex;function htonl(w){var res=w>>>24|w>>>8&65280|w<<8&16711680|(w&255)<<24;return res>>>0}exports.htonl=htonl;function toHex32(msg,endian){var res="";for(var i=0;i<msg.length;i++){var w=msg[i];if(endian==="little")w=htonl(w);res+=zero8(w.toString(16))}return res}exports.toHex32=toHex32;function zero2(word){if(word.length===1)return"0"+word;else return word}exports.zero2=zero2;function zero8(word){if(word.length===7)return"0"+word;else if(word.length===6)return"00"+word;else if(word.length===5)return"000"+word;else if(word.length===4)return"0000"+word;else if(word.length===3)return"00000"+word;else if(word.length===2)return"000000"+word;else if(word.length===1)return"0000000"+word;else return word}exports.zero8=zero8;function join32(msg,start,end,endian){var len=end-start;assert(len%4===0);var res=new Array(len/4);for(var i=0,k=start;i<res.length;i++,k+=4){var w;if(endian==="big")w=msg[k]<<24|msg[k+1]<<16|msg[k+2]<<8|msg[k+3];else w=msg[k+3]<<24|msg[k+2]<<16|msg[k+1]<<8|msg[k];res[i]=w>>>0}return res}exports.join32=join32;function split32(msg,endian){var res=new Array(msg.length*4);for(var i=0,k=0;i<msg.length;i++,k+=4){var m=msg[i];if(endian==="big"){res[k]=m>>>24;res[k+1]=m>>>16&255;res[k+2]=m>>>8&255;res[k+3]=m&255}else{res[k+3]=m>>>24;res[k+2]=m>>>16&255;res[k+1]=m>>>8&255;res[k]=m&255}}return res}exports.split32=split32;function rotr32(w,b){return w>>>b|w<<32-b}exports.rotr32=rotr32;function rotl32(w,b){return w<<b|w>>>32-b}exports.rotl32=rotl32;function sum32(a,b){return a+b>>>0}exports.sum32=sum32;function sum32_3(a,b,c){return a+b+c>>>0}exports.sum32_3=sum32_3;function sum32_4(a,b,c,d){return a+b+c+d>>>0}exports.sum32_4=sum32_4;function sum32_5(a,b,c,d,e){return a+b+c+d+e>>>0}exports.sum32_5=sum32_5;function sum64(buf,pos,ah,al){var bh=buf[pos];var bl=buf[pos+1];var lo=al+bl>>>0;var hi=(lo<al?1:0)+ah+bh;buf[pos]=hi>>>0;buf[pos+1]=lo}exports.sum64=sum64;function sum64_hi(ah,al,bh,bl){var lo=al+bl>>>0;var hi=(lo<al?1:0)+ah+bh;return hi>>>0}exports.sum64_hi=sum64_hi;function sum64_lo(ah,al,bh,bl){var lo=al+bl;return lo>>>0}exports.sum64_lo=sum64_lo;function sum64_4_hi(ah,al,bh,bl,ch,cl,dh,dl){var carry=0;var lo=al;lo=lo+bl>>>0;carry+=lo<al?1:0;lo=lo+cl>>>0;carry+=lo<cl?1:0;lo=lo+dl>>>0;carry+=lo<dl?1:0;var hi=ah+bh+ch+dh+carry;return hi>>>0}exports.sum64_4_hi=sum64_4_hi;function sum64_4_lo(ah,al,bh,bl,ch,cl,dh,dl){var lo=al+bl+cl+dl;return lo>>>0}exports.sum64_4_lo=sum64_4_lo;function sum64_5_hi(ah,al,bh,bl,ch,cl,dh,dl,eh,el){var carry=0;var lo=al;lo=lo+bl>>>0;carry+=lo<al?1:0;lo=lo+cl>>>0;carry+=lo<cl?1:0;lo=lo+dl>>>0;carry+=lo<dl?1:0;lo=lo+el>>>0;carry+=lo<el?1:0;var hi=ah+bh+ch+dh+eh+carry;return hi>>>0}exports.sum64_5_hi=sum64_5_hi;function sum64_5_lo(ah,al,bh,bl,ch,cl,dh,dl,eh,el){var lo=al+bl+cl+dl+el;return lo>>>0}exports.sum64_5_lo=sum64_5_lo;function rotr64_hi(ah,al,num){var r=al<<32-num|ah>>>num;return r>>>0}exports.rotr64_hi=rotr64_hi;function rotr64_lo(ah,al,num){var r=ah<<32-num|al>>>num;return r>>>0}exports.rotr64_lo=rotr64_lo;function shr64_hi(ah,al,num){return ah>>>num}exports.shr64_hi=shr64_hi;function shr64_lo(ah,al,num){var r=ah<<32-num|al>>>num;return r>>>0}exports.shr64_lo=shr64_lo},{inherits:129,"minimalistic-assert":132}],78:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.version="signing-key/5.0.2"},{}],79:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var elliptic_1=require("elliptic");var bytes_1=require("@ethersproject/bytes");var properties_1=require("@ethersproject/properties");var logger_1=require("@ethersproject/logger");var _version_1=require("./_version");var logger=new logger_1.Logger(_version_1.version);var _curve=null;function getCurve(){if(!_curve){_curve=new elliptic_1.ec("secp256k1")}return _curve}var SigningKey=function(){function SigningKey(privateKey){properties_1.defineReadOnly(this,"curve","secp256k1");properties_1.defineReadOnly(this,"privateKey",bytes_1.hexlify(privateKey));var keyPair=getCurve().keyFromPrivate(bytes_1.arrayify(this.privateKey));properties_1.defineReadOnly(this,"publicKey","0x"+keyPair.getPublic(false,"hex"));properties_1.defineReadOnly(this,"compressedPublicKey","0x"+keyPair.getPublic(true,"hex"));properties_1.defineReadOnly(this,"_isSigningKey",true)}SigningKey.prototype._addPoint=function(other){var p0=getCurve().keyFromPublic(bytes_1.arrayify(this.publicKey));var p1=getCurve().keyFromPublic(bytes_1.arrayify(other));return"0x"+p0.pub.add(p1.pub).encodeCompressed("hex")};SigningKey.prototype.signDigest=function(digest){var keyPair=getCurve().keyFromPrivate(bytes_1.arrayify(this.privateKey));var signature=keyPair.sign(bytes_1.arrayify(digest),{canonical:true});return bytes_1.splitSignature({recoveryParam:signature.recoveryParam,r:bytes_1.hexZeroPad("0x"+signature.r.toString(16),32),s:bytes_1.hexZeroPad("0x"+signature.s.toString(16),32)})};SigningKey.prototype.computeSharedSecret=function(otherKey){var keyPair=getCurve().keyFromPrivate(bytes_1.arrayify(this.privateKey));var otherKeyPair=getCurve().keyFromPublic(bytes_1.arrayify(computePublicKey(otherKey)));return bytes_1.hexZeroPad("0x"+keyPair.derive(otherKeyPair.getPublic()).toString(16),32)};SigningKey.isSigningKey=function(value){return!!(value&&value._isSigningKey)};return SigningKey}();exports.SigningKey=SigningKey;function recoverPublicKey(digest,signature){var sig=bytes_1.splitSignature(signature);var rs={r:bytes_1.arrayify(sig.r),s:bytes_1.arrayify(sig.s)};return"0x"+getCurve().recoverPubKey(bytes_1.arrayify(digest),rs,sig.recoveryParam).encode("hex",false)}exports.recoverPublicKey=recoverPublicKey;function computePublicKey(key,compressed){var bytes=bytes_1.arrayify(key);if(bytes.length===32){var signingKey=new SigningKey(bytes);if(compressed){return"0x"+getCurve().keyFromPrivate(bytes).getPublic(true,"hex")}return signingKey.publicKey}else if(bytes.length===33){if(compressed){return bytes_1.hexlify(bytes)}return"0x"+getCurve().keyFromPublic(bytes).getPublic(false,"hex")}else if(bytes.length===65){if(!compressed){return bytes_1.hexlify(bytes)}return"0x"+getCurve().keyFromPublic(bytes).getPublic(true,"hex")}return logger.throwArgumentError("invalid public or private key","key","[REDACTED]")}exports.computePublicKey=computePublicKey},{"./_version":78,"@ethersproject/bytes":30,"@ethersproject/logger":38,"@ethersproject/properties":42,elliptic:100}],80:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var bignumber_1=require("@ethersproject/bignumber");var bytes_1=require("@ethersproject/bytes");var keccak256_1=require("@ethersproject/keccak256");var sha2_1=require("@ethersproject/sha2");var strings_1=require("@ethersproject/strings");var regexBytes=new RegExp("^bytes([0-9]+)$");var regexNumber=new RegExp("^(u?int)([0-9]*)$");var regexArray=new RegExp("^(.*)\\[([0-9]*)\\]$");var Zeros="0000000000000000000000000000000000000000000000000000000000000000";function _pack(type,value,isArray){switch(type){case"address":if(isArray){return bytes_1.zeroPad(value,32)}return bytes_1.arrayify(value);case"string":return strings_1.toUtf8Bytes(value);case"bytes":return bytes_1.arrayify(value);case"bool":value=value?"0x01":"0x00";if(isArray){return bytes_1.zeroPad(value,32)}return bytes_1.arrayify(value)}var match=type.match(regexNumber);if(match){var size=parseInt(match[2]||"256");if(size%8!=0||size===0||size>256){throw new Error("invalid number type - "+type)}if(isArray){size=256}value=bignumber_1.BigNumber.from(value).toTwos(size);return bytes_1.zeroPad(value,size/8)}match=type.match(regexBytes);if(match){var size=parseInt(match[1]);if(String(size)!=match[1]||size===0||size>32){throw new Error("invalid number type - "+type)}if(bytes_1.arrayify(value).byteLength!==size){throw new Error("invalid value for "+type)}if(isArray){return bytes_1.arrayify((value+Zeros).substring(0,66))}return value}match=type.match(regexArray);if(match&&Array.isArray(value)){var baseType_1=match[1];var count=parseInt(match[2]||String(value.length));if(count!=value.length){throw new Error("invalid value for "+type)}var result_1=[];value.forEach(function(value){result_1.push(_pack(baseType_1,value,true))});return bytes_1.concat(result_1)}throw new Error("unknown type - "+type)}function pack(types,values){if(types.length!=values.length){throw new Error("type/value count mismatch")}var tight=[];types.forEach(function(type,index){tight.push(_pack(type,values[index]))});return bytes_1.hexlify(bytes_1.concat(tight))}exports.pack=pack;function keccak256(types,values){return keccak256_1.keccak256(pack(types,values))}exports.keccak256=keccak256;function sha256(types,values){return sha2_1.sha256(pack(types,values))}exports.sha256=sha256},{"@ethersproject/bignumber":28,"@ethersproject/bytes":30,"@ethersproject/keccak256":36,"@ethersproject/sha2":65,"@ethersproject/strings":84}],81:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.version="strings/5.0.1"},{}],82:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var constants_1=require("@ethersproject/constants");var bytes_1=require("@ethersproject/bytes");var utf8_1=require("./utf8");function formatBytes32String(text){var bytes=utf8_1.toUtf8Bytes(text);if(bytes.length>31){throw new Error("bytes32 string must be less than 32 bytes")}return bytes_1.hexlify(bytes_1.concat([bytes,constants_1.HashZero]).slice(0,32))}exports.formatBytes32String=formatBytes32String;function parseBytes32String(bytes){var data=bytes_1.arrayify(bytes);if(data.length!==32){throw new Error("invalid bytes32 - not 32 bytes long")}if(data[31]!==0){throw new Error("invalid bytes32 string - no null terminator")}var length=31;while(data[length-1]===0){length--}return utf8_1.toUtf8String(data.slice(0,length))}exports.parseBytes32String=parseBytes32String},{"./utf8":85,"@ethersproject/bytes":30,"@ethersproject/constants":31}],83:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var utf8_1=require("./utf8");function bytes2(data){if(data.length%4!==0){throw new Error("bad data")}var result=[];for(var i=0;i<data.length;i+=4){result.push(parseInt(data.substring(i,i+4),16))}return result}function createTable(data,func){if(!func){func=function(value){return[parseInt(value,16)]}}var lo=0;var result={};data.split(",").forEach(function(pair){var comps=pair.split(":");lo+=parseInt(comps[0],16);result[lo]=func(comps[1])});return result}function createRangeTable(data){var hi=0;return data.split(",").map(function(v){var comps=v.split("-");if(comps.length===1){comps[1]="0"}else if(comps[1]===""){comps[1]="1"}var lo=hi+parseInt(comps[0],16);hi=parseInt(comps[1],16);return{l:lo,h:hi}})}function matchMap(value,ranges){var lo=0;for(var i=0;i<ranges.length;i++){var range=ranges[i];lo+=range.l;if(value>=lo&&value<=lo+range.h&&(value-lo)%(range.d||1)===0){if(range.e&&range.e.indexOf(value-lo)!==-1){continue}return range}}return null}var Table_A_1_ranges=createRangeTable("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d");var Table_B_1_flags="ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map(function(v){return parseInt(v,16)});var Table_B_2_ranges=[{h:25,s:32,l:65},{h:30,s:32,e:[23],l:127},{h:54,s:1,e:[48],l:64,d:2},{h:14,s:1,l:57,d:2},{h:44,s:1,l:17,d:2},{h:10,s:1,e:[2,6,8],l:61,d:2},{h:16,s:1,l:68,d:2},{h:84,s:1,e:[18,24,66],l:19,d:2},{h:26,s:32,e:[17],l:435},{h:22,s:1,l:71,d:2},{h:15,s:80,l:40},{h:31,s:32,l:16},{h:32,s:1,l:80,d:2},{h:52,s:1,l:42,d:2},{h:12,s:1,l:55,d:2},{h:40,s:1,e:[38],l:15,d:2},{h:14,s:1,l:48,d:2},{h:37,s:48,l:49},{h:148,s:1,l:6351,d:2},{h:88,s:1,l:160,d:2},{h:15,s:16,l:704},{h:25,s:26,l:854},{h:25,s:32,l:55915},{h:37,s:40,l:1247},{h:25,s:-119711,l:53248},{h:25,s:-119763,l:52},{h:25,s:-119815,l:52},{h:25,s:-119867,e:[1,4,5,7,8,11,12,17],l:52},{h:25,s:-119919,l:52},{h:24,s:-119971,e:[2,7,8,17],l:52},{h:24,s:-120023,e:[2,7,13,15,16,17],l:52},{h:25,s:-120075,l:52},{h:25,s:-120127,l:52},{h:25,s:-120179,l:52},{h:25,s:-120231,l:52},{h:25,s:-120283,l:52},{h:25,s:-120335,l:52},{h:24,s:-119543,e:[17],l:56},{h:24,s:-119601,e:[17],l:58},{h:24,s:-119659,e:[17],l:58},{h:24,s:-119717,e:[17],l:58},{h:24,s:-119775,e:[17],l:58}];var Table_B_2_lut_abs=createTable("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3");var Table_B_2_lut_rel=createTable("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7");var Table_B_2_complex=createTable("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",bytes2);var Table_C_ranges=createRangeTable("80-20,2a0-,39c,32,f71,18e,7f2-f,19-7,30-4,7-5,f81-b,5,a800-20ff,4d1-1f,110,fa-6,d174-7,2e84-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,2,1f-5f,ff7f-20001");function flatten(values){return values.reduce(function(accum,value){value.forEach(function(value){accum.push(value)});return accum},[])}function _nameprepTableA1(codepoint){return!!matchMap(codepoint,Table_A_1_ranges)}exports._nameprepTableA1=_nameprepTableA1;function _nameprepTableB2(codepoint){var range=matchMap(codepoint,Table_B_2_ranges);if(range){return[codepoint+range.s]}var codes=Table_B_2_lut_abs[codepoint];if(codes){return codes}var shift=Table_B_2_lut_rel[codepoint];if(shift){return[codepoint+shift[0]]}var complex=Table_B_2_complex[codepoint];if(complex){return complex}return null}exports._nameprepTableB2=_nameprepTableB2;function _nameprepTableC(codepoint){return!!matchMap(codepoint,Table_C_ranges)}exports._nameprepTableC=_nameprepTableC;function nameprep(value){if(value.match(/^[a-z0-9-]*$/i)&&value.length<=59){return value.toLowerCase()}var codes=utf8_1.toUtf8CodePoints(value);codes=flatten(codes.map(function(code){if(Table_B_1_flags.indexOf(code)>=0){return[]}if(code>=65024&&code<=65039){return[]}var codesTableB2=_nameprepTableB2(code);if(codesTableB2){return codesTableB2}return[code]}));codes=utf8_1.toUtf8CodePoints(utf8_1._toUtf8String(codes),utf8_1.UnicodeNormalizationForm.NFKC);codes.forEach(function(code){if(_nameprepTableC(code)){throw new Error("STRINGPREP_CONTAINS_PROHIBITED")}});codes.forEach(function(code){if(_nameprepTableA1(code)){throw new Error("STRINGPREP_CONTAINS_UNASSIGNED")}});var name=utf8_1._toUtf8String(codes);if(name.substring(0,1)==="-"||name.substring(2,4)==="--"||name.substring(name.length-1)==="-"){throw new Error("invalid hyphen")}if(name.length>63){throw new Error("too long")}return name}exports.nameprep=nameprep},{"./utf8":85}],84:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var bytes32_1=require("./bytes32");exports.formatBytes32String=bytes32_1.formatBytes32String;exports.parseBytes32String=bytes32_1.parseBytes32String;var idna_1=require("./idna");exports.nameprep=idna_1.nameprep;var utf8_1=require("./utf8");exports._toEscapedUtf8String=utf8_1._toEscapedUtf8String;exports.toUtf8Bytes=utf8_1.toUtf8Bytes;exports.toUtf8CodePoints=utf8_1.toUtf8CodePoints;exports.toUtf8String=utf8_1.toUtf8String;exports.UnicodeNormalizationForm=utf8_1.UnicodeNormalizationForm;exports.Utf8ErrorFuncs=utf8_1.Utf8ErrorFuncs;exports.Utf8ErrorReason=utf8_1.Utf8ErrorReason},{"./bytes32":82,"./idna":83,"./utf8":85}],85:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var bytes_1=require("@ethersproject/bytes");var logger_1=require("@ethersproject/logger");var _version_1=require("./_version");var logger=new logger_1.Logger(_version_1.version);var UnicodeNormalizationForm;(function(UnicodeNormalizationForm){UnicodeNormalizationForm["current"]="";UnicodeNormalizationForm["NFC"]="NFC";UnicodeNormalizationForm["NFD"]="NFD";UnicodeNormalizationForm["NFKC"]="NFKC";UnicodeNormalizationForm["NFKD"]="NFKD"})(UnicodeNormalizationForm=exports.UnicodeNormalizationForm||(exports.UnicodeNormalizationForm={}));var Utf8ErrorReason;(function(Utf8ErrorReason){Utf8ErrorReason["UNEXPECTED_CONTINUE"]="unexpected continuation byte";Utf8ErrorReason["BAD_PREFIX"]="bad codepoint prefix";Utf8ErrorReason["OVERRUN"]="string overrun";Utf8ErrorReason["MISSING_CONTINUE"]="missing continuation byte";Utf8ErrorReason["OUT_OF_RANGE"]="out of UTF-8 range";Utf8ErrorReason["UTF16_SURROGATE"]="UTF-16 surrogate";Utf8ErrorReason["OVERLONG"]="overlong representation"})(Utf8ErrorReason=exports.Utf8ErrorReason||(exports.Utf8ErrorReason={}));function errorFunc(reason,offset,bytes,output,badCodepoint){return logger.throwArgumentError("invalid codepoint at offset "+offset+"; "+reason,"bytes",bytes)}function ignoreFunc(reason,offset,bytes,output,badCodepoint){if(reason===Utf8ErrorReason.BAD_PREFIX||reason===Utf8ErrorReason.UNEXPECTED_CONTINUE){var i=0;for(var o=offset+1;o<bytes.length;o++){if(bytes[o]>>6!==2){break}i++}return i}if(reason===Utf8ErrorReason.OVERRUN){return bytes.length-offset-1}return 0}function replaceFunc(reason,offset,bytes,output,badCodepoint){if(reason===Utf8ErrorReason.OVERLONG){output.push(badCodepoint);return 0}output.push(65533);return ignoreFunc(reason,offset,bytes,output,badCodepoint)}exports.Utf8ErrorFuncs=Object.freeze({error:errorFunc,ignore:ignoreFunc,replace:replaceFunc});function getUtf8CodePoints(bytes,onError){if(onError==null){onError=exports.Utf8ErrorFuncs.error}bytes=bytes_1.arrayify(bytes);var result=[];var i=0;while(i<bytes.length){var c=bytes[i++];if(c>>7===0){result.push(c);continue}var extraLength=null;var overlongMask=null;if((c&224)===192){extraLength=1;overlongMask=127}else if((c&240)===224){extraLength=2;overlongMask=2047}else if((c&248)===240){extraLength=3;overlongMask=65535}else{if((c&192)===128){i+=onError(Utf8ErrorReason.UNEXPECTED_CONTINUE,i-1,bytes,result)}else{i+=onError(Utf8ErrorReason.BAD_PREFIX,i-1,bytes,result)}continue}if(i-1+extraLength>=bytes.length){i+=onError(Utf8ErrorReason.OVERRUN,i-1,bytes,result);continue}var res=c&(1<<8-extraLength-1)-1;for(var j=0;j<extraLength;j++){var nextChar=bytes[i];if((nextChar&192)!=128){i+=onError(Utf8ErrorReason.MISSING_CONTINUE,i,bytes,result);res=null;break}res=res<<6|nextChar&63;i++}if(res===null){continue}if(res>1114111){i+=onError(Utf8ErrorReason.OUT_OF_RANGE,i-1-extraLength,bytes,result,res);continue}if(res>=55296&&res<=57343){i+=onError(Utf8ErrorReason.UTF16_SURROGATE,i-1-extraLength,bytes,result,res);continue}if(res<=overlongMask){i+=onError(Utf8ErrorReason.OVERLONG,i-1-extraLength,bytes,result,res);continue}result.push(res)}return result}function toUtf8Bytes(str,form){if(form===void 0){form=UnicodeNormalizationForm.current}if(form!=UnicodeNormalizationForm.current){logger.checkNormalize();str=str.normalize(form)}var result=[];for(var i=0;i<str.length;i++){var c=str.charCodeAt(i);if(c<128){result.push(c)}else if(c<2048){result.push(c>>6|192);result.push(c&63|128)}else if((c&64512)==55296){i++;var c2=str.charCodeAt(i);if(i>=str.length||(c2&64512)!==56320){throw new Error("invalid utf-8 string")}var pair=65536+((c&1023)<<10)+(c2&1023);result.push(pair>>18|240);result.push(pair>>12&63|128);result.push(pair>>6&63|128);result.push(pair&63|128)}else{result.push(c>>12|224);result.push(c>>6&63|128);result.push(c&63|128)}}return bytes_1.arrayify(result)}exports.toUtf8Bytes=toUtf8Bytes;function escapeChar(value){var hex="0000"+value.toString(16);return"\\u"+hex.substring(hex.length-4)}function _toEscapedUtf8String(bytes,onError){return'"'+getUtf8CodePoints(bytes,onError).map(function(codePoint){if(codePoint<256){switch(codePoint){case 8:return"\\b";case 9:return"\\t";case 10:return"\\n";case 13:return"\\r";case 34:return'\\"';case 92:return"\\\\"}if(codePoint>=32&&codePoint<127){return String.fromCharCode(codePoint)}}if(codePoint<=65535){return escapeChar(codePoint)}codePoint-=65536;return escapeChar((codePoint>>10&1023)+55296)+escapeChar((codePoint&1023)+56320)}).join("")+'"'}exports._toEscapedUtf8String=_toEscapedUtf8String;function _toUtf8String(codePoints){return codePoints.map(function(codePoint){if(codePoint<=65535){return String.fromCharCode(codePoint)}codePoint-=65536;return String.fromCharCode((codePoint>>10&1023)+55296,(codePoint&1023)+56320)}).join("")}exports._toUtf8String=_toUtf8String;function toUtf8String(bytes,onError){return _toUtf8String(getUtf8CodePoints(bytes,onError))}exports.toUtf8String=toUtf8String;function toUtf8CodePoints(str,form){if(form===void 0){form=UnicodeNormalizationForm.current}return getUtf8CodePoints(toUtf8Bytes(str,form))}exports.toUtf8CodePoints=toUtf8CodePoints},{"./_version":81,"@ethersproject/bytes":30,"@ethersproject/logger":38}],86:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.version="transactions/5.0.1"},{}],87:[function(require,module,exports){"use strict";var __importStar=this&&this.__importStar||function(mod){if(mod&&mod.__esModule)return mod;var result={};if(mod!=null)for(var k in mod)if(Object.hasOwnProperty.call(mod,k))result[k]=mod[k];result["default"]=mod;return result};Object.defineProperty(exports,"__esModule",{value:true});var address_1=require("@ethersproject/address");var bignumber_1=require("@ethersproject/bignumber");var bytes_1=require("@ethersproject/bytes");var constants_1=require("@ethersproject/constants");var keccak256_1=require("@ethersproject/keccak256");var properties_1=require("@ethersproject/properties");var RLP=__importStar(require("@ethersproject/rlp"));var signing_key_1=require("@ethersproject/signing-key");var logger_1=require("@ethersproject/logger");var _version_1=require("./_version");var logger=new logger_1.Logger(_version_1.version);function handleAddress(value){if(value==="0x"){return null}return address_1.getAddress(value)}function handleNumber(value){if(value==="0x"){return constants_1.Zero}return bignumber_1.BigNumber.from(value)}var transactionFields=[{name:"nonce",maxLength:32,numeric:true},{name:"gasPrice",maxLength:32,numeric:true},{name:"gasLimit",maxLength:32,numeric:true},{name:"to",length:20},{name:"value",maxLength:32,numeric:true},{name:"data"}];var allowedTransactionKeys={chainId:true,data:true,gasLimit:true,gasPrice:true,nonce:true,to:true,value:true};function computeAddress(key){var publicKey=signing_key_1.computePublicKey(key);return address_1.getAddress(bytes_1.hexDataSlice(keccak256_1.keccak256(bytes_1.hexDataSlice(publicKey,1)),12))}exports.computeAddress=computeAddress;function recoverAddress(digest,signature){return computeAddress(signing_key_1.recoverPublicKey(bytes_1.arrayify(digest),signature))}exports.recoverAddress=recoverAddress;function serialize(transaction,signature){properties_1.checkProperties(transaction,allowedTransactionKeys);var raw=[];transactionFields.forEach(function(fieldInfo){var value=transaction[fieldInfo.name]||[];var options={};if(fieldInfo.numeric){options.hexPad="left"}value=bytes_1.arrayify(bytes_1.hexlify(value,options));if(fieldInfo.length&&value.length!==fieldInfo.length&&value.length>0){logger.throwArgumentError("invalid length for "+fieldInfo.name,"transaction:"+fieldInfo.name,value)}if(fieldInfo.maxLength){value=bytes_1.stripZeros(value);if(value.length>fieldInfo.maxLength){logger.throwArgumentError("invalid length for "+fieldInfo.name,"transaction:"+fieldInfo.name,value)}}raw.push(bytes_1.hexlify(value))});var chainId=0;if(transaction.chainId!=null){chainId=transaction.chainId;if(typeof chainId!=="number"){logger.throwArgumentError("invalid transaction.chainId","transaction",transaction)}}else if(signature&&!bytes_1.isBytesLike(signature)&&signature.v>28){chainId=Math.floor((signature.v-35)/2)}if(chainId!==0){raw.push(bytes_1.hexlify(chainId));raw.push("0x");raw.push("0x")}if(!signature){return RLP.encode(raw)}var sig=bytes_1.splitSignature(signature);var v=27+sig.recoveryParam;if(chainId!==0){raw.pop();raw.pop();raw.pop();v+=chainId*2+8;if(sig.v>28&&sig.v!==v){logger.throwArgumentError("transaction.chainId/signature.v mismatch","signature",signature)}}else if(sig.v!==v){logger.throwArgumentError("transaction.chainId/signature.v mismatch","signature",signature)}raw.push(bytes_1.hexlify(v));raw.push(bytes_1.stripZeros(bytes_1.arrayify(sig.r)));raw.push(bytes_1.stripZeros(bytes_1.arrayify(sig.s)));return RLP.encode(raw)}exports.serialize=serialize;function parse(rawTransaction){var transaction=RLP.decode(rawTransaction);if(transaction.length!==9&&transaction.length!==6){logger.throwArgumentError("invalid raw transaction","rawTransaction",rawTransaction)}var tx={nonce:handleNumber(transaction[0]).toNumber(),gasPrice:handleNumber(transaction[1]),gasLimit:handleNumber(transaction[2]),to:handleAddress(transaction[3]),value:handleNumber(transaction[4]),data:transaction[5],chainId:0};if(transaction.length===6){return tx}try{tx.v=bignumber_1.BigNumber.from(transaction[6]).toNumber()}catch(error){console.log(error);return tx}tx.r=bytes_1.hexZeroPad(transaction[7],32);tx.s=bytes_1.hexZeroPad(transaction[8],32);if(bignumber_1.BigNumber.from(tx.r).isZero()&&bignumber_1.BigNumber.from(tx.s).isZero()){tx.chainId=tx.v;tx.v=0}else{tx.chainId=Math.floor((tx.v-35)/2);if(tx.chainId<0){tx.chainId=0}var recoveryParam=tx.v-27;var raw=transaction.slice(0,6);if(tx.chainId!==0){raw.push(bytes_1.hexlify(tx.chainId));raw.push("0x");raw.push("0x");recoveryParam-=tx.chainId*2+8}var digest=keccak256_1.keccak256(RLP.encode(raw));try{tx.from=recoverAddress(digest,{r:bytes_1.hexlify(tx.r),s:bytes_1.hexlify(tx.s),recoveryParam:recoveryParam})}catch(error){console.log(error)}tx.hash=keccak256_1.keccak256(rawTransaction)}return tx}exports.parse=parse},{"./_version":86,"@ethersproject/address":23,"@ethersproject/bignumber":28,"@ethersproject/bytes":30,"@ethersproject/constants":31,"@ethersproject/keccak256":36,"@ethersproject/logger":38,"@ethersproject/properties":42,"@ethersproject/rlp":63,"@ethersproject/signing-key":79}],88:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.version="web/5.0.1"},{}],89:[function(require,module,exports){"use strict";var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){function adopt(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator["throw"](value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})};var __generator=this&&this.__generator||function(thisArg,body){var _={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},f,y,t,g;return g={next:verb(0),throw:verb(1),return:verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(_)try{if(f=1,y&&(t=op[0]&2?y["return"]:op[0]?y["throw"]||((t=y["return"])&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[op[0]&2,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return{value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break}if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break}if(t[2])_.ops.pop();_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e];y=0}finally{f=t=0}if(op[0]&5)throw op[1];return{value:op[0]?op[1]:void 0,done:true}}};Object.defineProperty(exports,"__esModule",{value:true});function getUrl(href,options){return __awaiter(this,void 0,void 0,function(){var request,response,body,headers;return __generator(this,function(_a){switch(_a.label){case 0:if(options==null){options={}}request={method:options.method||"GET",headers:options.headers||{},body:options.body||undefined,mode:"cors",cache:"no-cache",credentials:"same-origin",redirect:"follow",referrer:"client"};return[4,fetch(href,request)];case 1:response=_a.sent();return[4,response.text()];case 2:body=_a.sent();headers={};if(response.headers.forEach){response.headers.forEach(function(value,key){headers[key.toLowerCase()]=value})}else{response.headers.keys().forEach(function(key){headers[key.toLowerCase()]=response.headers.get(key)})}return[2,{headers:headers,statusCode:response.status,statusMessage:response.statusText,body:body}]}})})}exports.getUrl=getUrl},{}],90:[function(require,module,exports){"use strict";var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){function adopt(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator["throw"](value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})};var __generator=this&&this.__generator||function(thisArg,body){var _={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},f,y,t,g;return g={next:verb(0),throw:verb(1),return:verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(_)try{if(f=1,y&&(t=op[0]&2?y["return"]:op[0]?y["throw"]||((t=y["return"])&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[op[0]&2,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return{value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break}if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break}if(t[2])_.ops.pop();_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e];y=0}finally{f=t=0}if(op[0]&5)throw op[1];return{value:op[0]?op[1]:void 0,done:true}}};Object.defineProperty(exports,"__esModule",{value:true});var base64_1=require("@ethersproject/base64");var properties_1=require("@ethersproject/properties");var strings_1=require("@ethersproject/strings");var logger_1=require("@ethersproject/logger");var _version_1=require("./_version");var logger=new logger_1.Logger(_version_1.version);var geturl_1=require("./geturl");function fetchJson(connection,json,processFunc){var headers={};var url=null;var options={method:"GET"};var allow304=false;var timeout=2*60*1e3;if(typeof connection==="string"){url=connection}else if(typeof connection==="object"){if(connection==null||connection.url==null){logger.throwArgumentError("missing URL","connection.url",connection)}url=connection.url;if(typeof connection.timeout==="number"&&connection.timeout>0){timeout=connection.timeout}if(connection.headers){for(var key in connection.headers){headers[key.toLowerCase()]={key:key,value:String(connection.headers[key])};if(["if-none-match","if-modified-since"].indexOf(key.toLowerCase())>=0){allow304=true}}}if(connection.user!=null&&connection.password!=null){if(url.substring(0,6)!=="https:"&&connection.allowInsecureAuthentication!==true){logger.throwError("basic authentication requires a secure https url",logger_1.Logger.errors.INVALID_ARGUMENT,{argument:"url",url:url,user:connection.user,password:"[REDACTED]"})}var authorization=connection.user+":"+connection.password;headers["authorization"]={key:"Authorization",value:"Basic "+base64_1.encode(strings_1.toUtf8Bytes(authorization))}}}if(json){options.method="POST";options.body=json;headers["content-type"]={key:"Content-Type",value:"application/json"}}var flatHeaders={};Object.keys(headers).forEach(function(key){var header=headers[key];flatHeaders[header.key]=header.value});options.headers=flatHeaders;var runningTimeout=function(){var timer=null;var promise=new Promise(function(resolve,reject){if(timeout){timer=setTimeout(function(){if(timer==null){return}timer=null;reject(logger.makeError("timeout",logger_1.Logger.errors.TIMEOUT,{requestBody:options.body||null,requestMethod:options.method,timeout:timeout,url:url}))},timeout)}});var cancel=function(){if(timer==null){return}clearTimeout(timer);timer=null};return{promise:promise,cancel:cancel}}();var runningFetch=function(){return __awaiter(this,void 0,void 0,function(){var response,error_1,body,json,error_2;return __generator(this,function(_a){switch(_a.label){case 0:response=null;_a.label=1;case 1:_a.trys.push([1,3,,4]);return[4,geturl_1.getUrl(url,options)];case 2:response=_a.sent();return[3,4];case 3:error_1=_a.sent();response=error_1.response;if(response==null){runningTimeout.cancel();logger.throwError("missing response",logger_1.Logger.errors.SERVER_ERROR,{requestBody:options.body||null,requestMethod:options.method,serverError:error_1,url:url})}return[3,4];case 4:body=response.body;if(allow304&&response.statusCode===304){body=null}else if(response.statusCode<200||response.statusCode>=300){runningTimeout.cancel();logger.throwError("bad response",logger_1.Logger.errors.SERVER_ERROR,{status:response.statusCode,headers:response.headers,body:body,requestBody:options.body||null,requestMethod:options.method,url:url})}runningTimeout.cancel();json=null;if(body!=null){try{json=JSON.parse(body)}catch(error){logger.throwError("invalid JSON",logger_1.Logger.errors.SERVER_ERROR,{body:body,error:error,requestBody:options.body||null,requestMethod:options.method,url:url})}}if(!processFunc)return[3,8];_a.label=5;case 5:_a.trys.push([5,7,,8]);return[4,processFunc(json,response)];case 6:json=_a.sent();return[3,8];case 7:error_2=_a.sent();logger.throwError("processing response error",logger_1.Logger.errors.SERVER_ERROR,{body:json,error:error_2,requestBody:options.body||null,requestMethod:options.method,url:url});return[3,8];case 8:return[2,json]}})})}();return Promise.race([runningTimeout.promise,runningFetch])}exports.fetchJson=fetchJson;function poll(func,options){if(!options){options={}}options=properties_1.shallowCopy(options);if(options.floor==null){options.floor=0}if(options.ceiling==null){options.ceiling=1e4}if(options.interval==null){options.interval=250}return new Promise(function(resolve,reject){var timer=null;var done=false;var cancel=function(){if(done){return false}done=true;if(timer){clearTimeout(timer)}return true};if(options.timeout){timer=setTimeout(function(){if(cancel()){reject(new Error("timeout"))}},options.timeout)}var retryLimit=options.retryLimit;var attempt=0;function check(){return func().then(function(result){if(result!==undefined){if(cancel()){resolve(result)}}else if(options.oncePoll){options.oncePoll.once("poll",check)}else if(options.onceBlock){options.onceBlock.once("block",check)}else if(!done){attempt++;if(attempt>retryLimit){if(cancel()){reject(new Error("retry limit reached"))}return}var timeout=options.interval*parseInt(String(Math.random()*Math.pow(2,attempt)));if(timeout<options.floor){timeout=options.floor}if(timeout>options.ceiling){timeout=options.ceiling}setTimeout(check,timeout)}return null},function(error){if(cancel()){reject(error)}})}check()})}exports.poll=poll},{"./_version":88,"./geturl":89,"@ethersproject/base64":24,"@ethersproject/logger":38,"@ethersproject/properties":42,"@ethersproject/strings":84}],91:[function(require,module,exports){(function(process){"use strict";if(process.env.NODE_ENV==="production"){module.exports=require("./sdk.cjs.production.min.js")}else{module.exports=require("./sdk.cjs.development.js")}}).call(this,require("_process"))},{"./sdk.cjs.development.js":92,"./sdk.cjs.production.min.js":93,_process:134}],92:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});function _interopDefault(ex){return ex&&typeof ex==="object"&&"default"in ex?ex["default"]:ex}var JSBI=_interopDefault(require("jsbi"));var invariant=_interopDefault(require("tiny-invariant"));var warning=_interopDefault(require("tiny-warning"));var address=require("@ethersproject/address");var _Big=_interopDefault(require("big.js"));var toFormat=_interopDefault(require("toformat"));var _Decimal=_interopDefault(require("decimal.js-light"));var solidity=require("@ethersproject/solidity");var contracts=require("@ethersproject/contracts");var networks=require("@ethersproject/networks");var providers=require("@ethersproject/providers");var IUniswapV2Pair=_interopDefault(require("@uniswap/v2-core/build/IUniswapV2Pair.json"));var _SOLIDITY_TYPE_MAXIMA;(function(ChainId){ChainId[ChainId["MAINNET"]=1]="MAINNET";ChainId[ChainId["ROPSTEN"]=3]="ROPSTEN";ChainId[ChainId["RINKEBY"]=4]="RINKEBY";ChainId[ChainId["GÖRLI"]=5]="GÖRLI";ChainId[ChainId["KOVAN"]=42]="KOVAN"})(exports.ChainId||(exports.ChainId={}));(function(TradeType){TradeType[TradeType["EXACT_INPUT"]=0]="EXACT_INPUT";TradeType[TradeType["EXACT_OUTPUT"]=1]="EXACT_OUTPUT"})(exports.TradeType||(exports.TradeType={}));(function(Rounding){Rounding[Rounding["ROUND_DOWN"]=0]="ROUND_DOWN";Rounding[Rounding["ROUND_HALF_UP"]=1]="ROUND_HALF_UP";Rounding[Rounding["ROUND_UP"]=2]="ROUND_UP"})(exports.Rounding||(exports.Rounding={}));var FACTORY_ADDRESS="0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f";var INIT_CODE_HASH="0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f";var MINIMUM_LIQUIDITY=JSBI.BigInt(1e3);var ZERO=JSBI.BigInt(0);var ONE=JSBI.BigInt(1);var TWO=JSBI.BigInt(2);var THREE=JSBI.BigInt(3);var FIVE=JSBI.BigInt(5);var TEN=JSBI.BigInt(10);var _100=JSBI.BigInt(100);var _997=JSBI.BigInt(997);var _1000=JSBI.BigInt(1e3);var SolidityType;(function(SolidityType){SolidityType["uint8"]="uint8";SolidityType["uint256"]="uint256"})(SolidityType||(SolidityType={}));var SOLIDITY_TYPE_MAXIMA=(_SOLIDITY_TYPE_MAXIMA={},_SOLIDITY_TYPE_MAXIMA[SolidityType.uint8]=JSBI.BigInt("0xff"),_SOLIDITY_TYPE_MAXIMA[SolidityType.uint256]=JSBI.BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),_SOLIDITY_TYPE_MAXIMA);function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor}function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key]}}}return target};return _extends.apply(this,arguments)}function _inheritsLoose(subClass,superClass){subClass.prototype=Object.create(superClass.prototype);subClass.prototype.constructor=subClass;subClass.__proto__=superClass}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o)};return _getPrototypeOf(o)}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o};return _setPrototypeOf(o,p)}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Date.prototype.toString.call(Reflect.construct(Date,[],function(){}));return true}catch(e){return false}}function _construct(Parent,args,Class){if(_isNativeReflectConstruct()){_construct=Reflect.construct}else{_construct=function _construct(Parent,args,Class){var a=[null];a.push.apply(a,args);var Constructor=Function.bind.apply(Parent,a);var instance=new Constructor;if(Class)_setPrototypeOf(instance,Class.prototype);return instance}}return _construct.apply(null,arguments)}function _isNativeFunction(fn){return Function.toString.call(fn).indexOf("[native code]")!==-1}function _wrapNativeSuper(Class){var _cache=typeof Map==="function"?new Map:undefined;_wrapNativeSuper=function _wrapNativeSuper(Class){if(Class===null||!_isNativeFunction(Class))return Class;if(typeof Class!=="function"){throw new TypeError("Super expression must either be null or a function")}if(typeof _cache!=="undefined"){if(_cache.has(Class))return _cache.get(Class);_cache.set(Class,Wrapper)}function Wrapper(){return _construct(Class,arguments,_getPrototypeOf(this).constructor)}Wrapper.prototype=Object.create(Class.prototype,{constructor:{value:Wrapper,enumerable:false,writable:true,configurable:true}});return _setPrototypeOf(Wrapper,Class)};return _wrapNativeSuper(Class)}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return self}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _createForOfIteratorHelperLoose(o){var i=0;if(typeof Symbol==="undefined"||o[Symbol.iterator]==null){if(Array.isArray(o)||(o=_unsupportedIterableToArray(o)))return function(){if(i>=o.length)return{done:true};return{done:false,value:o[i++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}i=o[Symbol.iterator]();return i.next.bind(i)}var CAN_SET_PROTOTYPE="setPrototypeOf"in Object;var InsufficientReservesError=function(_Error){_inheritsLoose(InsufficientReservesError,_Error);function InsufficientReservesError(){var _this;_this=_Error.call(this)||this;_this.isInsufficientReservesError=true;_this.name=_this.constructor.name;if(CAN_SET_PROTOTYPE)Object.setPrototypeOf(_assertThisInitialized(_this),(this instanceof InsufficientReservesError?this.constructor:void 0).prototype);return _this}return InsufficientReservesError}(_wrapNativeSuper(Error));var InsufficientInputAmountError=function(_Error2){_inheritsLoose(InsufficientInputAmountError,_Error2);function InsufficientInputAmountError(){var _this2;_this2=_Error2.call(this)||this;_this2.isInsufficientInputAmountError=true;_this2.name=_this2.constructor.name;if(CAN_SET_PROTOTYPE)Object.setPrototypeOf(_assertThisInitialized(_this2),(this instanceof InsufficientInputAmountError?this.constructor:void 0).prototype);return _this2}return InsufficientInputAmountError}(_wrapNativeSuper(Error));function validateSolidityTypeInstance(value,solidityType){!JSBI.greaterThanOrEqual(value,ZERO)?invariant(false,value+" is not a "+solidityType+"."):void 0;!JSBI.lessThanOrEqual(value,SOLIDITY_TYPE_MAXIMA[solidityType])?invariant(false,value+" is not a "+solidityType+"."):void 0}function validateAndParseAddress(address$1){try{var checksummedAddress=address.getAddress(address$1);"development"!=="production"?warning(address$1===checksummedAddress,address$1+" is not checksummed."):void 0;return checksummedAddress}catch(error){invariant(false,address$1+" is not a valid address.")}}function parseBigintIsh(bigintIsh){return bigintIsh instanceof JSBI?bigintIsh:typeof bigintIsh==="bigint"?JSBI.BigInt(bigintIsh.toString()):JSBI.BigInt(bigintIsh)}function sqrt(y){validateSolidityTypeInstance(y,SolidityType.uint256);var z=ZERO;var x;if(JSBI.greaterThan(y,THREE)){z=y;x=JSBI.add(JSBI.divide(y,TWO),ONE);while(JSBI.lessThan(x,z)){z=x;x=JSBI.divide(JSBI.add(JSBI.divide(y,x),x),TWO)}}else if(JSBI.notEqual(y,ZERO)){z=ONE}return z}function sortedInsert(items,add,maxSize,comparator){!(maxSize>0)?invariant(false,"MAX_SIZE_ZERO"):void 0;!(items.length<=maxSize)?invariant(false,"ITEMS_SIZE"):void 0;if(items.length===0){items.push(add);return null}else{var isFull=items.length===maxSize;if(isFull&&comparator(items[items.length-1],add)<=0){return add}var lo=0,hi=items.length;while(lo<hi){var mid=lo+hi>>>1;if(comparator(items[mid],add)<=0){lo=mid+1}else{hi=mid}}items.splice(lo,0,add);return isFull?items.pop():null}}var Currency=function Currency(decimals,symbol,name){validateSolidityTypeInstance(JSBI.BigInt(decimals),SolidityType.uint8);this.decimals=decimals;this.symbol=symbol;this.name=name};Currency.ETHER=new Currency(18,"ETH","Ether");var ETHER=Currency.ETHER;var _WETH;var Token=function(_Currency){_inheritsLoose(Token,_Currency);function Token(chainId,address,decimals,symbol,name){var _this;_this=_Currency.call(this,decimals,symbol,name)||this;_this.chainId=chainId;_this.address=validateAndParseAddress(address);return _this}var _proto=Token.prototype;_proto.equals=function equals(other){if(this===other){return true}var equivalent=this.chainId===other.chainId&&this.address===other.address;if(equivalent){!(this.decimals===other.decimals)?invariant(false,"DECIMALS"):void 0;if(this.symbol&&other.symbol)!(this.symbol===other.symbol)?invariant(false,"SYMBOL"):void 0;if(this.name&&other.name)!(this.name===other.name)?invariant(false,"NAME"):void 0}return equivalent};_proto.sortsBefore=function sortsBefore(other){!(this.chainId===other.chainId)?invariant(false,"CHAIN_IDS"):void 0;!(this.address!==other.address)?invariant(false,"ADDRESSES"):void 0;return this.address.toLowerCase()<other.address.toLowerCase()};return Token}(Currency);function currencyEquals(currencyA,currencyB){if(currencyA instanceof Token&&currencyB instanceof Token){return currencyA.equals(currencyB)}else if(currencyA instanceof Token){return false}else if(currencyB instanceof Token){return false}else{return currencyA===currencyB}}var WETH=(_WETH={},_WETH[exports.ChainId.MAINNET]=new Token(exports.ChainId.MAINNET,"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",18,"WETH","Wrapped Ether"),_WETH[exports.ChainId.ROPSTEN]=new Token(exports.ChainId.ROPSTEN,"0xc778417E063141139Fce010982780140Aa0cD5Ab",18,"WETH","Wrapped Ether"),_WETH[exports.ChainId.RINKEBY]=new Token(exports.ChainId.RINKEBY,"0xc778417E063141139Fce010982780140Aa0cD5Ab",18,"WETH","Wrapped Ether"),_WETH[exports.ChainId.GÖRLI]=new Token(exports.ChainId.GÖRLI,"0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6",18,"WETH","Wrapped Ether"),_WETH[exports.ChainId.KOVAN]=new Token(exports.ChainId.KOVAN,"0xd0A1E359811322d97991E03f863a0C30C2cF029C",18,"WETH","Wrapped Ether"),_WETH);var _toSignificantRoundin,_toFixedRounding;var Decimal=toFormat(_Decimal);var Big=toFormat(_Big);var toSignificantRounding=(_toSignificantRoundin={},_toSignificantRoundin[exports.Rounding.ROUND_DOWN]=Decimal.ROUND_DOWN,_toSignificantRoundin[exports.Rounding.ROUND_HALF_UP]=Decimal.ROUND_HALF_UP,_toSignificantRoundin[exports.Rounding.ROUND_UP]=Decimal.ROUND_UP,_toSignificantRoundin);var toFixedRounding=(_toFixedRounding={},_toFixedRounding[exports.Rounding.ROUND_DOWN]=0,_toFixedRounding[exports.Rounding.ROUND_HALF_UP]=1,_toFixedRounding[exports.Rounding.ROUND_UP]=3,_toFixedRounding);var Fraction=function(){function Fraction(numerator,denominator){if(denominator===void 0){denominator=ONE}this.numerator=parseBigintIsh(numerator);this.denominator=parseBigintIsh(denominator)}var _proto=Fraction.prototype;_proto.invert=function invert(){return new Fraction(this.denominator,this.numerator)};_proto.add=function add(other){var otherParsed=other instanceof Fraction?other:new Fraction(parseBigintIsh(other));if(JSBI.equal(this.denominator,otherParsed.denominator)){return new Fraction(JSBI.add(this.numerator,otherParsed.numerator),this.denominator)}return new Fraction(JSBI.add(JSBI.multiply(this.numerator,otherParsed.denominator),JSBI.multiply(otherParsed.numerator,this.denominator)),JSBI.multiply(this.denominator,otherParsed.denominator))};_proto.subtract=function subtract(other){var otherParsed=other instanceof Fraction?other:new Fraction(parseBigintIsh(other));if(JSBI.equal(this.denominator,otherParsed.denominator)){return new Fraction(JSBI.subtract(this.numerator,otherParsed.numerator),this.denominator)}return new Fraction(JSBI.subtract(JSBI.multiply(this.numerator,otherParsed.denominator),JSBI.multiply(otherParsed.numerator,this.denominator)),JSBI.multiply(this.denominator,otherParsed.denominator))};_proto.lessThan=function lessThan(other){var otherParsed=other instanceof Fraction?other:new Fraction(parseBigintIsh(other));return JSBI.lessThan(JSBI.multiply(this.numerator,otherParsed.denominator),JSBI.multiply(otherParsed.numerator,this.denominator))};_proto.equalTo=function equalTo(other){var otherParsed=other instanceof Fraction?other:new Fraction(parseBigintIsh(other));return JSBI.equal(JSBI.multiply(this.numerator,otherParsed.denominator),JSBI.multiply(otherParsed.numerator,this.denominator))};_proto.greaterThan=function greaterThan(other){var otherParsed=other instanceof Fraction?other:new Fraction(parseBigintIsh(other));return JSBI.greaterThan(JSBI.multiply(this.numerator,otherParsed.denominator),JSBI.multiply(otherParsed.numerator,this.denominator))};_proto.multiply=function multiply(other){var otherParsed=other instanceof Fraction?other:new Fraction(parseBigintIsh(other));return new Fraction(JSBI.multiply(this.numerator,otherParsed.numerator),JSBI.multiply(this.denominator,otherParsed.denominator))};_proto.divide=function divide(other){var otherParsed=other instanceof Fraction?other:new Fraction(parseBigintIsh(other));return new Fraction(JSBI.multiply(this.numerator,otherParsed.denominator),JSBI.multiply(this.denominator,otherParsed.numerator))};_proto.toSignificant=function toSignificant(significantDigits,format,rounding){if(format===void 0){format={groupSeparator:""}}if(rounding===void 0){rounding=exports.Rounding.ROUND_HALF_UP}!Number.isInteger(significantDigits)?invariant(false,significantDigits+" is not an integer."):void 0;!(significantDigits>0)?invariant(false,significantDigits+" is not positive."):void 0;Decimal.set({precision:significantDigits+1,rounding:toSignificantRounding[rounding]});var quotient=new Decimal(this.numerator.toString()).div(this.denominator.toString()).toSignificantDigits(significantDigits);return quotient.toFormat(quotient.decimalPlaces(),format)};_proto.toFixed=function toFixed(decimalPlaces,format,rounding){if(format===void 0){format={groupSeparator:""}}if(rounding===void 0){rounding=exports.Rounding.ROUND_HALF_UP}!Number.isInteger(decimalPlaces)?invariant(false,decimalPlaces+" is not an integer."):void 0;!(decimalPlaces>=0)?invariant(false,decimalPlaces+" is negative."):void 0;Big.DP=decimalPlaces;Big.RM=toFixedRounding[rounding];return new Big(this.numerator.toString()).div(this.denominator.toString()).toFormat(decimalPlaces,format)};_createClass(Fraction,[{key:"quotient",get:function get(){return JSBI.divide(this.numerator,this.denominator)}},{key:"remainder",get:function get(){return new Fraction(JSBI.remainder(this.numerator,this.denominator),this.denominator)}}]);return Fraction}();var Big$1=toFormat(_Big);var CurrencyAmount=function(_Fraction){_inheritsLoose(CurrencyAmount,_Fraction);function CurrencyAmount(currency,amount){var _this;var parsedAmount=parseBigintIsh(amount);validateSolidityTypeInstance(parsedAmount,SolidityType.uint256);_this=_Fraction.call(this,parsedAmount,JSBI.exponentiate(TEN,JSBI.BigInt(currency.decimals)))||this;_this.currency=currency;return _this}CurrencyAmount.ether=function ether(amount){return new CurrencyAmount(ETHER,amount)};var _proto=CurrencyAmount.prototype;_proto.add=function add(other){!currencyEquals(this.currency,other.currency)?invariant(false,"TOKEN"):void 0;return new CurrencyAmount(this.currency,JSBI.add(this.raw,other.raw))};_proto.subtract=function subtract(other){!currencyEquals(this.currency,other.currency)?invariant(false,"TOKEN"):void 0;return new CurrencyAmount(this.currency,JSBI.subtract(this.raw,other.raw))};_proto.toSignificant=function toSignificant(significantDigits,format,rounding){if(significantDigits===void 0){significantDigits=6}if(rounding===void 0){rounding=exports.Rounding.ROUND_DOWN}return _Fraction.prototype.toSignificant.call(this,significantDigits,format,rounding)};_proto.toFixed=function toFixed(decimalPlaces,format,rounding){if(decimalPlaces===void 0){decimalPlaces=this.currency.decimals}if(rounding===void 0){rounding=exports.Rounding.ROUND_DOWN}!(decimalPlaces<=this.currency.decimals)?invariant(false,"DECIMALS"):void 0;return _Fraction.prototype.toFixed.call(this,decimalPlaces,format,rounding)};_proto.toExact=function toExact(format){if(format===void 0){format={groupSeparator:""}}Big$1.DP=this.currency.decimals;return new Big$1(this.numerator.toString()).div(this.denominator.toString()).toFormat(format)};_createClass(CurrencyAmount,[{key:"raw",get:function get(){return this.numerator}}]);return CurrencyAmount}(Fraction);var TokenAmount=function(_CurrencyAmount){_inheritsLoose(TokenAmount,_CurrencyAmount);function TokenAmount(token,amount){var _this;_this=_CurrencyAmount.call(this,token,amount)||this;_this.token=token;return _this}var _proto=TokenAmount.prototype;_proto.add=function add(other){!this.token.equals(other.token)?invariant(false,"TOKEN"):void 0;return new TokenAmount(this.token,JSBI.add(this.raw,other.raw))};_proto.subtract=function subtract(other){!this.token.equals(other.token)?invariant(false,"TOKEN"):void 0;return new TokenAmount(this.token,JSBI.subtract(this.raw,other.raw))};return TokenAmount}(CurrencyAmount);var Price=function(_Fraction){_inheritsLoose(Price,_Fraction);function Price(baseCurrency,quoteCurrency,denominator,numerator){var _this;_this=_Fraction.call(this,numerator,denominator)||this;_this.baseCurrency=baseCurrency;_this.quoteCurrency=quoteCurrency;_this.scalar=new Fraction(JSBI.exponentiate(TEN,JSBI.BigInt(baseCurrency.decimals)),JSBI.exponentiate(TEN,JSBI.BigInt(quoteCurrency.decimals)));return _this}Price.fromRoute=function fromRoute(route){var prices=[];for(var _iterator=_createForOfIteratorHelperLoose(route.pairs.entries()),_step;!(_step=_iterator()).done;){var _step$value=_step.value,i=_step$value[0],pair=_step$value[1];prices.push(route.path[i].equals(pair.token0)?new Price(pair.reserve0.currency,pair.reserve1.currency,pair.reserve0.raw,pair.reserve1.raw):new Price(pair.reserve1.currency,pair.reserve0.currency,pair.reserve1.raw,pair.reserve0.raw))}return prices.slice(1).reduce(function(accumulator,currentValue){return accumulator.multiply(currentValue)},prices[0])};var _proto=Price.prototype;_proto.invert=function invert(){return new Price(this.quoteCurrency,this.baseCurrency,this.numerator,this.denominator)};_proto.multiply=function multiply(other){!currencyEquals(this.quoteCurrency,other.baseCurrency)?invariant(false,"TOKEN"):void 0;var fraction=_Fraction.prototype.multiply.call(this,other);return new Price(this.baseCurrency,other.quoteCurrency,fraction.denominator,fraction.numerator)};_proto.quote=function quote(currencyAmount){!currencyEquals(currencyAmount.currency,this.baseCurrency)?invariant(false,"TOKEN"):void 0;if(this.quoteCurrency instanceof Token){return new TokenAmount(this.quoteCurrency,_Fraction.prototype.multiply.call(this,currencyAmount.raw).quotient)}return CurrencyAmount.ether(_Fraction.prototype.multiply.call(this,currencyAmount.raw).quotient)};_proto.toSignificant=function toSignificant(significantDigits,format,rounding){if(significantDigits===void 0){significantDigits=6}return this.adjusted.toSignificant(significantDigits,format,rounding)};_proto.toFixed=function toFixed(decimalPlaces,format,rounding){if(decimalPlaces===void 0){decimalPlaces=4}return this.adjusted.toFixed(decimalPlaces,format,rounding)};_createClass(Price,[{key:"raw",get:function get(){return new Fraction(this.numerator,this.denominator)}},{key:"adjusted",get:function get(){return _Fraction.prototype.multiply.call(this,this.scalar)}}]);return Price}(Fraction);var PAIR_ADDRESS_CACHE={};var Pair=function(){function Pair(tokenAmountA,tokenAmountB){var tokenAmounts=tokenAmountA.token.sortsBefore(tokenAmountB.token)?[tokenAmountA,tokenAmountB]:[tokenAmountB,tokenAmountA];this.liquidityToken=new Token(tokenAmounts[0].token.chainId,Pair.getAddress(tokenAmounts[0].token,tokenAmounts[1].token),18,"UNI-V2","Uniswap V2");this.tokenAmounts=tokenAmounts}Pair.getAddress=function getAddress(tokenA,tokenB){var _PAIR_ADDRESS_CACHE,_PAIR_ADDRESS_CACHE$t;var tokens=tokenA.sortsBefore(tokenB)?[tokenA,tokenB]:[tokenB,tokenA];if(((_PAIR_ADDRESS_CACHE=PAIR_ADDRESS_CACHE)===null||_PAIR_ADDRESS_CACHE===void 0?void 0:(_PAIR_ADDRESS_CACHE$t=_PAIR_ADDRESS_CACHE[tokens[0].address])===null||_PAIR_ADDRESS_CACHE$t===void 0?void 0:_PAIR_ADDRESS_CACHE$t[tokens[1].address])===undefined){var _PAIR_ADDRESS_CACHE2,_extends2,_extends3;PAIR_ADDRESS_CACHE=_extends(_extends({},PAIR_ADDRESS_CACHE),{},(_extends3={},_extends3[tokens[0].address]=_extends(_extends({},(_PAIR_ADDRESS_CACHE2=PAIR_ADDRESS_CACHE)===null||_PAIR_ADDRESS_CACHE2===void 0?void 0:_PAIR_ADDRESS_CACHE2[tokens[0].address]),{},(_extends2={},_extends2[tokens[1].address]=address.getCreate2Address(FACTORY_ADDRESS,solidity.keccak256(["bytes"],[solidity.pack(["address","address"],[tokens[0].address,tokens[1].address])]),INIT_CODE_HASH),_extends2)),_extends3))}return PAIR_ADDRESS_CACHE[tokens[0].address][tokens[1].address]};var _proto=Pair.prototype;_proto.involvesToken=function involvesToken(token){return token.equals(this.token0)||token.equals(this.token1)};_proto.priceOf=function priceOf(token){!this.involvesToken(token)?invariant(false,"TOKEN"):void 0;return token.equals(this.token0)?this.token0Price:this.token1Price};_proto.reserveOf=function reserveOf(token){!this.involvesToken(token)?invariant(false,"TOKEN"):void 0;return token.equals(this.token0)?this.reserve0:this.reserve1};_proto.getOutputAmount=function getOutputAmount(inputAmount){!this.involvesToken(inputAmount.token)?invariant(false,"TOKEN"):void 0;if(JSBI.equal(this.reserve0.raw,ZERO)||JSBI.equal(this.reserve1.raw,ZERO)){throw new InsufficientReservesError}var inputReserve=this.reserveOf(inputAmount.token);var outputReserve=this.reserveOf(inputAmount.token.equals(this.token0)?this.token1:this.token0);var inputAmountWithFee=JSBI.multiply(inputAmount.raw,_997);var numerator=JSBI.multiply(inputAmountWithFee,outputReserve.raw);var denominator=JSBI.add(JSBI.multiply(inputReserve.raw,_1000),inputAmountWithFee);var outputAmount=new TokenAmount(inputAmount.token.equals(this.token0)?this.token1:this.token0,JSBI.divide(numerator,denominator));if(JSBI.equal(outputAmount.raw,ZERO)){throw new InsufficientInputAmountError}return[outputAmount,new Pair(inputReserve.add(inputAmount),outputReserve.subtract(outputAmount))]};_proto.getInputAmount=function getInputAmount(outputAmount){!this.involvesToken(outputAmount.token)?invariant(false,"TOKEN"):void 0;if(JSBI.equal(this.reserve0.raw,ZERO)||JSBI.equal(this.reserve1.raw,ZERO)||JSBI.greaterThanOrEqual(outputAmount.raw,this.reserveOf(outputAmount.token).raw)){throw new InsufficientReservesError}var outputReserve=this.reserveOf(outputAmount.token);var inputReserve=this.reserveOf(outputAmount.token.equals(this.token0)?this.token1:this.token0);var numerator=JSBI.multiply(JSBI.multiply(inputReserve.raw,outputAmount.raw),_1000);var denominator=JSBI.multiply(JSBI.subtract(outputReserve.raw,outputAmount.raw),_997);var inputAmount=new TokenAmount(outputAmount.token.equals(this.token0)?this.token1:this.token0,JSBI.add(JSBI.divide(numerator,denominator),ONE));return[inputAmount,new Pair(inputReserve.add(inputAmount),outputReserve.subtract(outputAmount))]};_proto.getLiquidityMinted=function getLiquidityMinted(totalSupply,tokenAmountA,tokenAmountB){!totalSupply.token.equals(this.liquidityToken)?invariant(false,"LIQUIDITY"):void 0;var tokenAmounts=tokenAmountA.token.sortsBefore(tokenAmountB.token)?[tokenAmountA,tokenAmountB]:[tokenAmountB,tokenAmountA];!(tokenAmounts[0].token.equals(this.token0)&&tokenAmounts[1].token.equals(this.token1))?invariant(false,"TOKEN"):void 0;var liquidity;if(JSBI.equal(totalSupply.raw,ZERO)){liquidity=JSBI.subtract(sqrt(JSBI.multiply(tokenAmounts[0].raw,tokenAmounts[1].raw)),MINIMUM_LIQUIDITY)}else{var amount0=JSBI.divide(JSBI.multiply(tokenAmounts[0].raw,totalSupply.raw),this.reserve0.raw);var amount1=JSBI.divide(JSBI.multiply(tokenAmounts[1].raw,totalSupply.raw),this.reserve1.raw);liquidity=JSBI.lessThanOrEqual(amount0,amount1)?amount0:amount1}if(!JSBI.greaterThan(liquidity,ZERO)){throw new InsufficientInputAmountError}return new TokenAmount(this.liquidityToken,liquidity)};_proto.getLiquidityValue=function getLiquidityValue(token,totalSupply,liquidity,feeOn,kLast){if(feeOn===void 0){feeOn=false}!this.involvesToken(token)?invariant(false,"TOKEN"):void 0;!totalSupply.token.equals(this.liquidityToken)?invariant(false,"TOTAL_SUPPLY"):void 0;!liquidity.token.equals(this.liquidityToken)?invariant(false,"LIQUIDITY"):void 0;!JSBI.lessThanOrEqual(liquidity.raw,totalSupply.raw)?invariant(false,"LIQUIDITY"):void 0;var totalSupplyAdjusted;if(!feeOn){totalSupplyAdjusted=totalSupply}else{!!!kLast?invariant(false,"K_LAST"):void 0;var kLastParsed=parseBigintIsh(kLast);if(!JSBI.equal(kLastParsed,ZERO)){var rootK=sqrt(JSBI.multiply(this.reserve0.raw,this.reserve1.raw));var rootKLast=sqrt(kLastParsed);if(JSBI.greaterThan(rootK,rootKLast)){var numerator=JSBI.multiply(totalSupply.raw,JSBI.subtract(rootK,rootKLast));var denominator=JSBI.add(JSBI.multiply(rootK,FIVE),rootKLast);var feeLiquidity=JSBI.divide(numerator,denominator);totalSupplyAdjusted=totalSupply.add(new TokenAmount(this.liquidityToken,feeLiquidity))}else{totalSupplyAdjusted=totalSupply}}else{totalSupplyAdjusted=totalSupply}}return new TokenAmount(token,JSBI.divide(JSBI.multiply(liquidity.raw,this.reserveOf(token).raw),totalSupplyAdjusted.raw))};_createClass(Pair,[{key:"token0Price",get:function get(){return new Price(this.token0,this.token1,this.tokenAmounts[0].raw,this.tokenAmounts[1].raw)}},{key:"token1Price",get:function get(){return new Price(this.token1,this.token0,this.tokenAmounts[1].raw,this.tokenAmounts[0].raw)}},{key:"chainId",get:function get(){return this.token0.chainId}},{key:"token0",get:function get(){return this.tokenAmounts[0].token}},{key:"token1",get:function get(){return this.tokenAmounts[1].token}},{key:"reserve0",get:function get(){return this.tokenAmounts[0]}},{key:"reserve1",get:function get(){return this.tokenAmounts[1]}}]);return Pair}();var Route=function(){function Route(pairs,input,output){!(pairs.length>0)?invariant(false,"PAIRS"):void 0;!pairs.every(function(pair){return pair.chainId===pairs[0].chainId})?invariant(false,"CHAIN_IDS"):void 0;!(input instanceof Token&&pairs[0].involvesToken(input)||input===ETHER&&pairs[0].involvesToken(WETH[pairs[0].chainId]))?invariant(false,"INPUT"):void 0;!(typeof output==="undefined"||output instanceof Token&&pairs[pairs.length-1].involvesToken(output)||output===ETHER&&pairs[pairs.length-1].involvesToken(WETH[pairs[0].chainId]))?invariant(false,"OUTPUT"):void 0;var path=[input instanceof Token?input:WETH[pairs[0].chainId]];for(var _iterator=_createForOfIteratorHelperLoose(pairs.entries()),_step;!(_step=_iterator()).done;){var _step$value=_step.value,i=_step$value[0],pair=_step$value[1];var currentInput=path[i];!(currentInput.equals(pair.token0)||currentInput.equals(pair.token1))?invariant(false,"PATH"):void 0;var _output=currentInput.equals(pair.token0)?pair.token1:pair.token0;path.push(_output)}this.pairs=pairs;this.path=path;this.midPrice=Price.fromRoute(this);this.input=input;this.output=output!==null&&output!==void 0?output:path[path.length-1]}_createClass(Route,[{key:"chainId",get:function get(){return this.pairs[0].chainId}}]);return Route}();var _100_PERCENT=new Fraction(_100);var Percent=function(_Fraction){_inheritsLoose(Percent,_Fraction);function Percent(){return _Fraction.apply(this,arguments)||this}var _proto=Percent.prototype;_proto.toSignificant=function toSignificant(significantDigits,format,rounding){if(significantDigits===void 0){significantDigits=5}return this.multiply(_100_PERCENT).toSignificant(significantDigits,format,rounding)};_proto.toFixed=function toFixed(decimalPlaces,format,rounding){if(decimalPlaces===void 0){decimalPlaces=2}return this.multiply(_100_PERCENT).toFixed(decimalPlaces,format,rounding)};return Percent}(Fraction);function computePriceImpact(midPrice,inputAmount,outputAmount){var exactQuote=midPrice.raw.multiply(inputAmount.raw);var slippage=exactQuote.subtract(outputAmount.raw).divide(exactQuote);return new Percent(slippage.numerator,slippage.denominator)}function inputOutputComparator(a,b){!currencyEquals(a.inputAmount.currency,b.inputAmount.currency)?invariant(false,"INPUT_CURRENCY"):void 0;!currencyEquals(a.outputAmount.currency,b.outputAmount.currency)?invariant(false,"OUTPUT_CURRENCY"):void 0;if(a.outputAmount.equalTo(b.outputAmount)){if(a.inputAmount.equalTo(b.inputAmount)){return 0}if(a.inputAmount.lessThan(b.inputAmount)){return-1}else{return 1}}else{if(a.outputAmount.lessThan(b.outputAmount)){return 1}else{return-1}}}function tradeComparator(a,b){var ioComp=inputOutputComparator(a,b);if(ioComp!==0){return ioComp}if(a.priceImpact.lessThan(b.priceImpact)){return-1}else if(a.priceImpact.greaterThan(b.priceImpact)){return 1}return a.route.path.length-b.route.path.length}function wrappedAmount(currencyAmount,chainId){if(currencyAmount instanceof TokenAmount)return currencyAmount;if(currencyAmount.currency===ETHER)return new TokenAmount(WETH[chainId],currencyAmount.raw);invariant(false,"CURRENCY")}function wrappedCurrency(currency,chainId){if(currency instanceof Token)return currency;if(currency===ETHER)return WETH[chainId];invariant(false,"CURRENCY")}var Trade=function(){function Trade(route,amount,tradeType){var amounts=new Array(route.path.length);var nextPairs=new Array(route.pairs.length);if(tradeType===exports.TradeType.EXACT_INPUT){!currencyEquals(amount.currency,route.input)?invariant(false,"INPUT"):void 0;amounts[0]=wrappedAmount(amount,route.chainId);for(var i=0;i<route.path.length-1;i++){var pair=route.pairs[i];var _pair$getOutputAmount=pair.getOutputAmount(amounts[i]),outputAmount=_pair$getOutputAmount[0],nextPair=_pair$getOutputAmount[1];amounts[i+1]=outputAmount;nextPairs[i]=nextPair}}else{!currencyEquals(amount.currency,route.output)?invariant(false,"OUTPUT"):void 0;amounts[amounts.length-1]=wrappedAmount(amount,route.chainId);for(var _i=route.path.length-1;_i>0;_i--){var _pair=route.pairs[_i-1];var _pair$getInputAmount=_pair.getInputAmount(amounts[_i]),inputAmount=_pair$getInputAmount[0],_nextPair=_pair$getInputAmount[1];amounts[_i-1]=inputAmount;nextPairs[_i-1]=_nextPair}}this.route=route;this.tradeType=tradeType;this.inputAmount=tradeType===exports.TradeType.EXACT_INPUT?amount:route.input===ETHER?CurrencyAmount.ether(amounts[0].raw):amounts[0];this.outputAmount=tradeType===exports.TradeType.EXACT_OUTPUT?amount:route.output===ETHER?CurrencyAmount.ether(amounts[amounts.length-1].raw):amounts[amounts.length-1];this.executionPrice=new Price(this.inputAmount.currency,this.outputAmount.currency,this.inputAmount.raw,this.outputAmount.raw);this.nextMidPrice=Price.fromRoute(new Route(nextPairs,route.input));this.priceImpact=computePriceImpact(route.midPrice,this.inputAmount,this.outputAmount)}Trade.exactIn=function exactIn(route,amountIn){return new Trade(route,amountIn,exports.TradeType.EXACT_INPUT)};Trade.exactOut=function exactOut(route,amountOut){return new Trade(route,amountOut,exports.TradeType.EXACT_OUTPUT)};var _proto=Trade.prototype;_proto.minimumAmountOut=function minimumAmountOut(slippageTolerance){!!slippageTolerance.lessThan(ZERO)?invariant(false,"SLIPPAGE_TOLERANCE"):void 0;if(this.tradeType===exports.TradeType.EXACT_OUTPUT){return this.outputAmount}else{var slippageAdjustedAmountOut=new Fraction(ONE).add(slippageTolerance).invert().multiply(this.outputAmount.raw).quotient;return this.outputAmount instanceof TokenAmount?new TokenAmount(this.outputAmount.token,slippageAdjustedAmountOut):CurrencyAmount.ether(slippageAdjustedAmountOut)}};_proto.maximumAmountIn=function maximumAmountIn(slippageTolerance){!!slippageTolerance.lessThan(ZERO)?invariant(false,"SLIPPAGE_TOLERANCE"):void 0;if(this.tradeType===exports.TradeType.EXACT_INPUT){return this.inputAmount}else{var slippageAdjustedAmountIn=new Fraction(ONE).add(slippageTolerance).multiply(this.inputAmount.raw).quotient;return this.inputAmount instanceof TokenAmount?new TokenAmount(this.inputAmount.token,slippageAdjustedAmountIn):CurrencyAmount.ether(slippageAdjustedAmountIn)}};Trade.bestTradeExactIn=function bestTradeExactIn(pairs,currencyAmountIn,currencyOut,_temp,currentPairs,originalAmountIn,bestTrades){var _ref=_temp===void 0?{}:_temp,_ref$maxNumResults=_ref.maxNumResults,maxNumResults=_ref$maxNumResults===void 0?3:_ref$maxNumResults,_ref$maxHops=_ref.maxHops,maxHops=_ref$maxHops===void 0?3:_ref$maxHops;if(currentPairs===void 0){currentPairs=[]}if(originalAmountIn===void 0){originalAmountIn=currencyAmountIn}if(bestTrades===void 0){bestTrades=[]}!(pairs.length>0)?invariant(false,"PAIRS"):void 0;!(maxHops>0)?invariant(false,"MAX_HOPS"):void 0;!(originalAmountIn===currencyAmountIn||currentPairs.length>0)?invariant(false,"INVALID_RECURSION"):void 0;var chainId=currencyAmountIn instanceof TokenAmount?currencyAmountIn.token.chainId:currencyOut instanceof Token?currencyOut.chainId:undefined;!(chainId!==undefined)?invariant(false,"CHAIN_ID"):void 0;var amountIn=wrappedAmount(currencyAmountIn,chainId);var tokenOut=wrappedCurrency(currencyOut,chainId);for(var i=0;i<pairs.length;i++){var pair=pairs[i];if(!pair.token0.equals(amountIn.token)&&!pair.token1.equals(amountIn.token))continue;if(pair.reserve0.equalTo(ZERO)||pair.reserve1.equalTo(ZERO))continue;var amountOut=void 0;try{var _pair$getOutputAmount2=pair.getOutputAmount(amountIn);amountOut=_pair$getOutputAmount2[0]}catch(error){if(error.isInsufficientInputAmountError){continue}throw error}if(amountOut.token.equals(tokenOut)){sortedInsert(bestTrades,new Trade(new Route([].concat(currentPairs,[pair]),originalAmountIn.currency,currencyOut),originalAmountIn,exports.TradeType.EXACT_INPUT),maxNumResults,tradeComparator)}else if(maxHops>1&&pairs.length>1){var pairsExcludingThisPair=pairs.slice(0,i).concat(pairs.slice(i+1,pairs.length));Trade.bestTradeExactIn(pairsExcludingThisPair,amountOut,currencyOut,{maxNumResults:maxNumResults,maxHops:maxHops-1},[].concat(currentPairs,[pair]),originalAmountIn,bestTrades)}}return bestTrades};Trade.bestTradeExactOut=function bestTradeExactOut(pairs,currencyIn,currencyAmountOut,_temp2,currentPairs,originalAmountOut,bestTrades){var _ref2=_temp2===void 0?{}:_temp2,_ref2$maxNumResults=_ref2.maxNumResults,maxNumResults=_ref2$maxNumResults===void 0?3:_ref2$maxNumResults,_ref2$maxHops=_ref2.maxHops,maxHops=_ref2$maxHops===void 0?3:_ref2$maxHops;if(currentPairs===void 0){currentPairs=[]}if(originalAmountOut===void 0){originalAmountOut=currencyAmountOut}if(bestTrades===void 0){bestTrades=[]}!(pairs.length>0)?invariant(false,"PAIRS"):void 0;!(maxHops>0)?invariant(false,"MAX_HOPS"):void 0;!(originalAmountOut===currencyAmountOut||currentPairs.length>0)?invariant(false,"INVALID_RECURSION"):void 0;var chainId=currencyAmountOut instanceof TokenAmount?currencyAmountOut.token.chainId:currencyIn instanceof Token?currencyIn.chainId:undefined;!(chainId!==undefined)?invariant(false,"CHAIN_ID"):void 0;var amountOut=wrappedAmount(currencyAmountOut,chainId);var tokenIn=wrappedCurrency(currencyIn,chainId);for(var i=0;i<pairs.length;i++){var pair=pairs[i];if(!pair.token0.equals(amountOut.token)&&!pair.token1.equals(amountOut.token))continue;if(pair.reserve0.equalTo(ZERO)||pair.reserve1.equalTo(ZERO))continue;var amountIn=void 0;try{var _pair$getInputAmount2=pair.getInputAmount(amountOut);amountIn=_pair$getInputAmount2[0]}catch(error){if(error.isInsufficientReservesError){continue}throw error}if(amountIn.token.equals(tokenIn)){sortedInsert(bestTrades,new Trade(new Route([pair].concat(currentPairs),currencyIn,originalAmountOut.currency),originalAmountOut,exports.TradeType.EXACT_OUTPUT),maxNumResults,tradeComparator)}else if(maxHops>1&&pairs.length>1){var pairsExcludingThisPair=pairs.slice(0,i).concat(pairs.slice(i+1,pairs.length));Trade.bestTradeExactOut(pairsExcludingThisPair,currencyIn,amountIn,{maxNumResults:maxNumResults,maxHops:maxHops-1},[pair].concat(currentPairs),originalAmountOut,bestTrades)}}return bestTrades};return Trade}();function toHex(currencyAmount){return"0x"+currencyAmount.raw.toString(16)}var ZERO_HEX="0x0";var Router=function(){function Router(){}Router.swapCallParameters=function swapCallParameters(trade,options){var etherIn=trade.inputAmount.currency===ETHER;var etherOut=trade.outputAmount.currency===ETHER;!!(etherIn&&etherOut)?invariant(false,"ETHER_IN_OUT"):void 0;!(options.ttl>0)?invariant(false,"TTL"):void 0;var to=validateAndParseAddress(options.recipient);var amountIn=toHex(trade.maximumAmountIn(options.allowedSlippage));var amountOut=toHex(trade.minimumAmountOut(options.allowedSlippage));var path=trade.route.path.map(function(token){return token.address});var deadline="0x"+(Math.floor((new Date).getTime()/1e3)+options.ttl).toString(16);var useFeeOnTransfer=Boolean(options.feeOnTransfer);var methodName;var args;var value;switch(trade.tradeType){case exports.TradeType.EXACT_INPUT:if(etherIn){methodName=useFeeOnTransfer?"swapExactETHForTokensSupportingFeeOnTransferTokens":"swapExactETHForTokens";args=[amountOut,path,to,deadline];value=amountIn}else if(etherOut){methodName=useFeeOnTransfer?"swapExactTokensForETHSupportingFeeOnTransferTokens":"swapExactTokensForETH";args=[amountIn,amountOut,path,to,deadline];value=ZERO_HEX}else{methodName=useFeeOnTransfer?"swapExactTokensForTokensSupportingFeeOnTransferTokens":"swapExactTokensForTokens";args=[amountIn,amountOut,path,to,deadline];value=ZERO_HEX}break;case exports.TradeType.EXACT_OUTPUT:!!useFeeOnTransfer?invariant(false,"EXACT_OUT_FOT"):void 0;if(etherIn){methodName="swapETHForExactTokens";args=[amountOut,path,to,deadline];value=amountIn}else if(etherOut){methodName="swapTokensForExactETH";args=[amountOut,amountIn,path,to,deadline];value=ZERO_HEX}else{methodName="swapTokensForExactTokens";args=[amountOut,amountIn,path,to,deadline];value=ZERO_HEX}break}return{methodName:methodName,args:args,value:value}};return Router}();var ERC20=[{constant:true,inputs:[],name:"decimals",outputs:[{name:"",type:"uint8"}],payable:false,stateMutability:"view",type:"function"},{constant:true,inputs:[{name:"",type:"address"}],name:"balanceOf",outputs:[{name:"",type:"uint256"}],payable:false,stateMutability:"view",type:"function"}];var _TOKEN_DECIMALS_CACHE;var TOKEN_DECIMALS_CACHE=(_TOKEN_DECIMALS_CACHE={},_TOKEN_DECIMALS_CACHE[exports.ChainId.MAINNET]={"0xE0B7927c4aF23765Cb51314A0E0521A9645F0E2A":9},_TOKEN_DECIMALS_CACHE);var Fetcher=function(){function Fetcher(){}Fetcher.fetchTokenData=function fetchTokenData(chainId,address,provider,symbol,name){try{var _TOKEN_DECIMALS_CACHE2,_TOKEN_DECIMALS_CACHE3;var _temp3=function _temp3(parsedDecimals){return new Token(chainId,address,parsedDecimals,symbol,name)};if(provider===undefined)provider=providers.getDefaultProvider(networks.getNetwork(chainId));var _temp4=typeof((_TOKEN_DECIMALS_CACHE2=TOKEN_DECIMALS_CACHE)===null||_TOKEN_DECIMALS_CACHE2===void 0?void 0:(_TOKEN_DECIMALS_CACHE3=_TOKEN_DECIMALS_CACHE2[chainId])===null||_TOKEN_DECIMALS_CACHE3===void 0?void 0:_TOKEN_DECIMALS_CACHE3[address])==="number";return Promise.resolve(_temp4?_temp3(TOKEN_DECIMALS_CACHE[chainId][address]):Promise.resolve(new contracts.Contract(address,ERC20,provider).decimals().then(function(decimals){var _TOKEN_DECIMALS_CACHE4,_extends2,_extends3;TOKEN_DECIMALS_CACHE=_extends(_extends({},TOKEN_DECIMALS_CACHE),{},(_extends3={},_extends3[chainId]=_extends(_extends({},(_TOKEN_DECIMALS_CACHE4=TOKEN_DECIMALS_CACHE)===null||_TOKEN_DECIMALS_CACHE4===void 0?void 0:_TOKEN_DECIMALS_CACHE4[chainId]),{},(_extends2={},_extends2[address]=decimals,_extends2)),_extends3));return decimals})).then(_temp3))}catch(e){return Promise.reject(e)}};Fetcher.fetchPairData=function fetchPairData(tokenA,tokenB,provider){try{if(provider===undefined)provider=providers.getDefaultProvider(networks.getNetwork(tokenA.chainId));!(tokenA.chainId===tokenB.chainId)?"development"!=="production"?invariant(false,"CHAIN_ID"):invariant(false):void 0;var address=Pair.getAddress(tokenA,tokenB);return Promise.resolve(new contracts.Contract(address,IUniswapV2Pair.abi,provider).getReserves()).then(function(_ref){var reserves0=_ref[0],reserves1=_ref[1];var balances=tokenA.sortsBefore(tokenB)?[reserves0,reserves1]:[reserves1,reserves0];return new Pair(new TokenAmount(tokenA,balances[0]),new TokenAmount(tokenB,balances[1]))})}catch(e){return Promise.reject(e)}};return Fetcher}();exports.JSBI=JSBI;exports.Currency=Currency;exports.CurrencyAmount=CurrencyAmount;exports.ETHER=ETHER;exports.FACTORY_ADDRESS=FACTORY_ADDRESS;exports.Fetcher=Fetcher;exports.Fraction=Fraction;exports.INIT_CODE_HASH=INIT_CODE_HASH;exports.InsufficientInputAmountError=InsufficientInputAmountError;exports.InsufficientReservesError=InsufficientReservesError;exports.MINIMUM_LIQUIDITY=MINIMUM_LIQUIDITY;exports.Pair=Pair;exports.Percent=Percent;exports.Price=Price;exports.Route=Route;exports.Router=Router;exports.Token=Token;exports.TokenAmount=TokenAmount;exports.Trade=Trade;exports.WETH=WETH;exports.currencyEquals=currencyEquals;exports.inputOutputComparator=inputOutputComparator;exports.tradeComparator=tradeComparator},{"@ethersproject/address":23,"@ethersproject/contracts":33,"@ethersproject/networks":40,"@ethersproject/providers":52,"@ethersproject/solidity":80,"@uniswap/v2-core/build/IUniswapV2Pair.json":94,"big.js":95,"decimal.js-light":99,jsbi:131,"tiny-invariant":135,"tiny-warning":136,toformat:137}],93:[function(require,module,exports){"use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}Object.defineProperty(exports,"__esModule",{value:!0});var e,n,r,o,i=t(require("jsbi")),u=t(require("tiny-invariant")),a=(t(require("tiny-warning")),require("@ethersproject/address")),s=t(require("big.js")),c=t(require("toformat")),d=t(require("decimal.js-light")),p=require("@ethersproject/solidity"),f=require("@ethersproject/contracts"),l=require("@ethersproject/networks"),h=require("@ethersproject/providers"),m=t(require("@uniswap/v2-core/build/IUniswapV2Pair.json"));(n=exports.ChainId||(exports.ChainId={}))[n.MAINNET=1]="MAINNET",n[n.ROPSTEN=3]="ROPSTEN",n[n.RINKEBY=4]="RINKEBY",n[n["GÖRLI"]=5]="GÖRLI",n[n.KOVAN=42]="KOVAN",(r=exports.TradeType||(exports.TradeType={}))[r.EXACT_INPUT=0]="EXACT_INPUT",r[r.EXACT_OUTPUT=1]="EXACT_OUTPUT",(o=exports.Rounding||(exports.Rounding={}))[o.ROUND_DOWN=0]="ROUND_DOWN",o[o.ROUND_HALF_UP=1]="ROUND_HALF_UP",o[o.ROUND_UP=2]="ROUND_UP";var v,y="0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f",w=i.BigInt(1e3),T=i.BigInt(0),g=i.BigInt(1),k=i.BigInt(2),x=i.BigInt(3),A=i.BigInt(5),I=i.BigInt(10),E=i.BigInt(100),O=i.BigInt(997),b=i.BigInt(1e3);!function(t){t.uint8="uint8",t.uint256="uint256"}(v||(v={}));var q=((e={})[v.uint8]=i.BigInt("0xff"),e[v.uint256]=i.BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),e);function N(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function R(t,e,n){return e&&N(t.prototype,e),n&&N(t,n),t}function P(){return(P=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function C(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}function U(t){return(U=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function _(t,e){return(_=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function D(){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(t){return!1}}function F(t,e,n){return(F=D()?Reflect.construct:function(t,e,n){var r=[null];r.push.apply(r,e);var o=new(Function.bind.apply(t,r));return n&&_(o,n.prototype),o}).apply(null,arguments)}function S(t){var e="function"==typeof Map?new Map:void 0;return(S=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return F(t,arguments,U(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),_(n,t)})(t)}function B(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function j(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function H(t){var e=0;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(t=function(t,e){if(t){if("string"==typeof t)return j(t,void 0);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?j(t,void 0):void 0}}(t)))return function(){return e>=t.length?{done:!0}:{done:!1,value:t[e++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(e=t[Symbol.iterator]()).next.bind(e)}var M="setPrototypeOf"in Object,W=function(t){function e(){var n;return(n=t.call(this)||this).isInsufficientReservesError=!0,n.name=n.constructor.name,M&&Object.setPrototypeOf(B(n),(this instanceof e?this.constructor:void 0).prototype),n}return C(e,t),e}(S(Error)),L=function(t){function e(){var n;return(n=t.call(this)||this).isInsufficientInputAmountError=!0,n.name=n.constructor.name,M&&Object.setPrototypeOf(B(n),(this instanceof e?this.constructor:void 0).prototype),n}return C(e,t),e}(S(Error));function X(t,e){i.greaterThanOrEqual(t,T)||u(!1),i.lessThanOrEqual(t,q[e])||u(!1)}function K(t){try{return a.getAddress(t)}catch(t){u(!1)}}function V(t){return t instanceof i?t:i.BigInt("bigint"==typeof t?t.toString():t)}function Y(t){X(t,v.uint256);var e,n=T;if(i.greaterThan(t,x))for(n=t,e=i.add(i.divide(t,k),g);i.lessThan(e,n);)n=e,e=i.divide(i.add(i.divide(t,e),e),k);else i.notEqual(t,T)&&(n=g);return n}function G(t,e,n,r){if(n>0||u(!1),t.length<=n||u(!1),0===t.length)return t.push(e),null;var o=t.length===n;if(o&&r(t[t.length-1],e)<=0)return e;for(var i=0,a=t.length;i<a;){var s=i+a>>>1;r(t[s],e)<=0?i=s+1:a=s}return t.splice(i,0,e),o?t.pop():null}var J,Q=function(t,e,n){X(i.BigInt(t),v.uint8),this.decimals=t,this.symbol=e,this.name=n},$=Q.ETHER=new Q(18,"ETH","Ether"),z=function(t){function e(e,n,r,o,i){var u;return(u=t.call(this,r,o,i)||this).chainId=e,u.address=K(n),u}C(e,t);var n=e.prototype;return n.equals=function(t){if(this===t)return!0;var e=this.chainId===t.chainId&&this.address===t.address;return e&&(this.decimals!==t.decimals&&u(!1),this.symbol&&t.symbol&&this.symbol!==t.symbol&&u(!1),this.name&&t.name&&this.name!==t.name&&u(!1)),e},n.sortsBefore=function(t){return this.chainId!==t.chainId&&u(!1),this.address===t.address&&u(!1),this.address.toLowerCase()<t.address.toLowerCase()},e}(Q);function Z(t,e){return t instanceof z&&e instanceof z?t.equals(e):!(t instanceof z||e instanceof z||t!==e)}var tt,et,nt=((J={})[exports.ChainId.MAINNET]=new z(exports.ChainId.MAINNET,"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",18,"WETH","Wrapped Ether"),J[exports.ChainId.ROPSTEN]=new z(exports.ChainId.ROPSTEN,"0xc778417E063141139Fce010982780140Aa0cD5Ab",18,"WETH","Wrapped Ether"),J[exports.ChainId.RINKEBY]=new z(exports.ChainId.RINKEBY,"0xc778417E063141139Fce010982780140Aa0cD5Ab",18,"WETH","Wrapped Ether"),J[exports.ChainId.GÖRLI]=new z(exports.ChainId.GÖRLI,"0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6",18,"WETH","Wrapped Ether"),J[exports.ChainId.KOVAN]=new z(exports.ChainId.KOVAN,"0xd0A1E359811322d97991E03f863a0C30C2cF029C",18,"WETH","Wrapped Ether"),J),rt=c(d),ot=c(s),it=((tt={})[exports.Rounding.ROUND_DOWN]=rt.ROUND_DOWN,tt[exports.Rounding.ROUND_HALF_UP]=rt.ROUND_HALF_UP,tt[exports.Rounding.ROUND_UP]=rt.ROUND_UP,tt),ut=((et={})[exports.Rounding.ROUND_DOWN]=0,et[exports.Rounding.ROUND_HALF_UP]=1,et[exports.Rounding.ROUND_UP]=3,et),at=function(){function t(t,e){void 0===e&&(e=g),this.numerator=V(t),this.denominator=V(e)}var e=t.prototype;return e.invert=function(){return new t(this.denominator,this.numerator)},e.add=function(e){var n=e instanceof t?e:new t(V(e));return i.equal(this.denominator,n.denominator)?new t(i.add(this.numerator,n.numerator),this.denominator):new t(i.add(i.multiply(this.numerator,n.denominator),i.multiply(n.numerator,this.denominator)),i.multiply(this.denominator,n.denominator))},e.subtract=function(e){var n=e instanceof t?e:new t(V(e));return i.equal(this.denominator,n.denominator)?new t(i.subtract(this.numerator,n.numerator),this.denominator):new t(i.subtract(i.multiply(this.numerator,n.denominator),i.multiply(n.numerator,this.denominator)),i.multiply(this.denominator,n.denominator))},e.lessThan=function(e){var n=e instanceof t?e:new t(V(e));return i.lessThan(i.multiply(this.numerator,n.denominator),i.multiply(n.numerator,this.denominator))},e.equalTo=function(e){var n=e instanceof t?e:new t(V(e));return i.equal(i.multiply(this.numerator,n.denominator),i.multiply(n.numerator,this.denominator))},e.greaterThan=function(e){var n=e instanceof t?e:new t(V(e));return i.greaterThan(i.multiply(this.numerator,n.denominator),i.multiply(n.numerator,this.denominator))},e.multiply=function(e){var n=e instanceof t?e:new t(V(e));return new t(i.multiply(this.numerator,n.numerator),i.multiply(this.denominator,n.denominator))},e.divide=function(e){var n=e instanceof t?e:new t(V(e));return new t(i.multiply(this.numerator,n.denominator),i.multiply(this.denominator,n.numerator))},e.toSignificant=function(t,e,n){void 0===e&&(e={groupSeparator:""}),void 0===n&&(n=exports.Rounding.ROUND_HALF_UP),Number.isInteger(t)||u(!1),t>0||u(!1),rt.set({precision:t+1,rounding:it[n]});var r=new rt(this.numerator.toString()).div(this.denominator.toString()).toSignificantDigits(t);return r.toFormat(r.decimalPlaces(),e)},e.toFixed=function(t,e,n){return void 0===e&&(e={groupSeparator:""}),void 0===n&&(n=exports.Rounding.ROUND_HALF_UP),Number.isInteger(t)||u(!1),t>=0||u(!1),ot.DP=t,ot.RM=ut[n],new ot(this.numerator.toString()).div(this.denominator.toString()).toFormat(t,e)},R(t,[{key:"quotient",get:function(){return i.divide(this.numerator,this.denominator)}},{key:"remainder",get:function(){return new t(i.remainder(this.numerator,this.denominator),this.denominator)}}]),t}(),st=c(s),ct=function(t){function e(e,n){var r,o=V(n);return X(o,v.uint256),(r=t.call(this,o,i.exponentiate(I,i.BigInt(e.decimals)))||this).currency=e,r}C(e,t),e.ether=function(t){return new e($,t)};var n=e.prototype;return n.add=function(t){return Z(this.currency,t.currency)||u(!1),new e(this.currency,i.add(this.raw,t.raw))},n.subtract=function(t){return Z(this.currency,t.currency)||u(!1),new e(this.currency,i.subtract(this.raw,t.raw))},n.toSignificant=function(e,n,r){return void 0===e&&(e=6),void 0===r&&(r=exports.Rounding.ROUND_DOWN),t.prototype.toSignificant.call(this,e,n,r)},n.toFixed=function(e,n,r){return void 0===e&&(e=this.currency.decimals),void 0===r&&(r=exports.Rounding.ROUND_DOWN),e<=this.currency.decimals||u(!1),t.prototype.toFixed.call(this,e,n,r)},n.toExact=function(t){return void 0===t&&(t={groupSeparator:""}),st.DP=this.currency.decimals,new st(this.numerator.toString()).div(this.denominator.toString()).toFormat(t)},R(e,[{key:"raw",get:function(){return this.numerator}}]),e}(at),dt=function(t){function e(e,n){var r;return(r=t.call(this,e,n)||this).token=e,r}C(e,t);var n=e.prototype;return n.add=function(t){return this.token.equals(t.token)||u(!1),new e(this.token,i.add(this.raw,t.raw))},n.subtract=function(t){return this.token.equals(t.token)||u(!1),new e(this.token,i.subtract(this.raw,t.raw))},e}(ct),pt=function(t){function e(e,n,r,o){var u;return(u=t.call(this,o,r)||this).baseCurrency=e,u.quoteCurrency=n,u.scalar=new at(i.exponentiate(I,i.BigInt(e.decimals)),i.exponentiate(I,i.BigInt(n.decimals))),u}C(e,t),e.fromRoute=function(t){for(var n,r=[],o=H(t.pairs.entries());!(n=o()).done;){var i=n.value,u=i[1];r.push(t.path[i[0]].equals(u.token0)?new e(u.reserve0.currency,u.reserve1.currency,u.reserve0.raw,u.reserve1.raw):new e(u.reserve1.currency,u.reserve0.currency,u.reserve1.raw,u.reserve0.raw))}return r.slice(1).reduce(function(t,e){return t.multiply(e)},r[0])};var n=e.prototype;return n.invert=function(){return new e(this.quoteCurrency,this.baseCurrency,this.numerator,this.denominator)},n.multiply=function(n){Z(this.quoteCurrency,n.baseCurrency)||u(!1);var r=t.prototype.multiply.call(this,n);return new e(this.baseCurrency,n.quoteCurrency,r.denominator,r.numerator)},n.quote=function(e){return Z(e.currency,this.baseCurrency)||u(!1),this.quoteCurrency instanceof z?new dt(this.quoteCurrency,t.prototype.multiply.call(this,e.raw).quotient):ct.ether(t.prototype.multiply.call(this,e.raw).quotient)},n.toSignificant=function(t,e,n){return void 0===t&&(t=6),this.adjusted.toSignificant(t,e,n)},n.toFixed=function(t,e,n){return void 0===t&&(t=4),this.adjusted.toFixed(t,e,n)},R(e,[{key:"raw",get:function(){return new at(this.numerator,this.denominator)}},{key:"adjusted",get:function(){return t.prototype.multiply.call(this,this.scalar)}}]),e}(at),ft={},lt=function(){function t(e,n){var r=e.token.sortsBefore(n.token)?[e,n]:[n,e];this.liquidityToken=new z(r[0].token.chainId,t.getAddress(r[0].token,r[1].token),18,"UNI-V2","Uniswap V2"),this.tokenAmounts=r}t.getAddress=function(t,e){var n,r,o,i,u,s=t.sortsBefore(e)?[t,e]:[e,t];return void 0===(null===(n=ft)||void 0===n||null===(r=n[s[0].address])||void 0===r?void 0:r[s[1].address])&&(ft=P(P({},ft),{},((u={})[s[0].address]=P(P({},null===(o=ft)||void 0===o?void 0:o[s[0].address]),{},((i={})[s[1].address]=a.getCreate2Address("0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f",p.keccak256(["bytes"],[p.pack(["address","address"],[s[0].address,s[1].address])]),y),i)),u))),ft[s[0].address][s[1].address]};var e=t.prototype;return e.involvesToken=function(t){return t.equals(this.token0)||t.equals(this.token1)},e.priceOf=function(t){return this.involvesToken(t)||u(!1),t.equals(this.token0)?this.token0Price:this.token1Price},e.reserveOf=function(t){return this.involvesToken(t)||u(!1),t.equals(this.token0)?this.reserve0:this.reserve1},e.getOutputAmount=function(e){if(this.involvesToken(e.token)||u(!1),i.equal(this.reserve0.raw,T)||i.equal(this.reserve1.raw,T))throw new W;var n=this.reserveOf(e.token),r=this.reserveOf(e.token.equals(this.token0)?this.token1:this.token0),o=i.multiply(e.raw,O),a=i.multiply(o,r.raw),s=i.add(i.multiply(n.raw,b),o),c=new dt(e.token.equals(this.token0)?this.token1:this.token0,i.divide(a,s));if(i.equal(c.raw,T))throw new L;return[c,new t(n.add(e),r.subtract(c))]},e.getInputAmount=function(e){if(this.involvesToken(e.token)||u(!1),i.equal(this.reserve0.raw,T)||i.equal(this.reserve1.raw,T)||i.greaterThanOrEqual(e.raw,this.reserveOf(e.token).raw))throw new W;var n=this.reserveOf(e.token),r=this.reserveOf(e.token.equals(this.token0)?this.token1:this.token0),o=i.multiply(i.multiply(r.raw,e.raw),b),a=i.multiply(i.subtract(n.raw,e.raw),O),s=new dt(e.token.equals(this.token0)?this.token1:this.token0,i.add(i.divide(o,a),g));return[s,new t(r.add(s),n.subtract(e))]},e.getLiquidityMinted=function(t,e,n){t.token.equals(this.liquidityToken)||u(!1);var r,o=e.token.sortsBefore(n.token)?[e,n]:[n,e];if(o[0].token.equals(this.token0)&&o[1].token.equals(this.token1)||u(!1),i.equal(t.raw,T))r=i.subtract(Y(i.multiply(o[0].raw,o[1].raw)),w);else{var a=i.divide(i.multiply(o[0].raw,t.raw),this.reserve0.raw),s=i.divide(i.multiply(o[1].raw,t.raw),this.reserve1.raw);r=i.lessThanOrEqual(a,s)?a:s}if(!i.greaterThan(r,T))throw new L;return new dt(this.liquidityToken,r)},e.getLiquidityValue=function(t,e,n,r,o){var a;if(void 0===r&&(r=!1),this.involvesToken(t)||u(!1),e.token.equals(this.liquidityToken)||u(!1),n.token.equals(this.liquidityToken)||u(!1),i.lessThanOrEqual(n.raw,e.raw)||u(!1),r){o||u(!1);var s=V(o);if(i.equal(s,T))a=e;else{var c=Y(i.multiply(this.reserve0.raw,this.reserve1.raw)),d=Y(s);if(i.greaterThan(c,d)){var p=i.multiply(e.raw,i.subtract(c,d)),f=i.add(i.multiply(c,A),d),l=i.divide(p,f);a=e.add(new dt(this.liquidityToken,l))}else a=e}}else a=e;return new dt(t,i.divide(i.multiply(n.raw,this.reserveOf(t).raw),a.raw))},R(t,[{key:"token0Price",get:function(){return new pt(this.token0,this.token1,this.tokenAmounts[0].raw,this.tokenAmounts[1].raw)}},{key:"token1Price",get:function(){return new pt(this.token1,this.token0,this.tokenAmounts[1].raw,this.tokenAmounts[0].raw)}},{key:"chainId",get:function(){return this.token0.chainId}},{key:"token0",get:function(){return this.tokenAmounts[0].token}},{key:"token1",get:function(){return this.tokenAmounts[1].token}},{key:"reserve0",get:function(){return this.tokenAmounts[0]}},{key:"reserve1",get:function(){return this.tokenAmounts[1]}}]),t}(),ht=function(){function t(t,e,n){t.length>0||u(!1),t.every(function(e){return e.chainId===t[0].chainId})||u(!1),e instanceof z&&t[0].involvesToken(e)||e===$&&t[0].involvesToken(nt[t[0].chainId])||u(!1),void 0===n||n instanceof z&&t[t.length-1].involvesToken(n)||n===$&&t[t.length-1].involvesToken(nt[t[0].chainId])||u(!1);for(var r,o=[e instanceof z?e:nt[t[0].chainId]],i=H(t.entries());!(r=i()).done;){var a=r.value,s=a[1],c=o[a[0]];c.equals(s.token0)||c.equals(s.token1)||u(!1);var d=c.equals(s.token0)?s.token1:s.token0;o.push(d)}this.pairs=t,this.path=o,this.midPrice=pt.fromRoute(this),this.input=e,this.output=null!=n?n:o[o.length-1]}return R(t,[{key:"chainId",get:function(){return this.pairs[0].chainId}}]),t}(),mt=new at(E),vt=function(t){function e(){return t.apply(this,arguments)||this}C(e,t);var n=e.prototype;return n.toSignificant=function(t,e,n){return void 0===t&&(t=5),this.multiply(mt).toSignificant(t,e,n)},n.toFixed=function(t,e,n){return void 0===t&&(t=2),this.multiply(mt).toFixed(t,e,n)},e}(at);function yt(t,e){return Z(t.inputAmount.currency,e.inputAmount.currency)||u(!1),Z(t.outputAmount.currency,e.outputAmount.currency)||u(!1),t.outputAmount.equalTo(e.outputAmount)?t.inputAmount.equalTo(e.inputAmount)?0:t.inputAmount.lessThan(e.inputAmount)?-1:1:t.outputAmount.lessThan(e.outputAmount)?1:-1}function wt(t,e){var n=yt(t,e);return 0!==n?n:t.priceImpact.lessThan(e.priceImpact)?-1:t.priceImpact.greaterThan(e.priceImpact)?1:t.route.path.length-e.route.path.length}function Tt(t,e){return t instanceof dt?t:t.currency===$?new dt(nt[e],t.raw):void u(!1)}function gt(t,e){return t instanceof z?t:t===$?nt[e]:void u(!1)}var kt=function(){function t(t,e,n){var r,o,i,a=new Array(t.path.length),s=new Array(t.pairs.length);if(n===exports.TradeType.EXACT_INPUT){Z(e.currency,t.input)||u(!1),a[0]=Tt(e,t.chainId);for(var c=0;c<t.path.length-1;c++){var d=t.pairs[c].getOutputAmount(a[c]),p=d[1];a[c+1]=d[0],s[c]=p}}else{Z(e.currency,t.output)||u(!1),a[a.length-1]=Tt(e,t.chainId);for(var f=t.path.length-1;f>0;f--){var l=t.pairs[f-1].getInputAmount(a[f]),h=l[1];a[f-1]=l[0],s[f-1]=h}}this.route=t,this.tradeType=n,this.inputAmount=n===exports.TradeType.EXACT_INPUT?e:t.input===$?ct.ether(a[0].raw):a[0],this.outputAmount=n===exports.TradeType.EXACT_OUTPUT?e:t.output===$?ct.ether(a[a.length-1].raw):a[a.length-1],this.executionPrice=new pt(this.inputAmount.currency,this.outputAmount.currency,this.inputAmount.raw,this.outputAmount.raw),this.nextMidPrice=pt.fromRoute(new ht(s,t.input)),this.priceImpact=(r=this.outputAmount,i=(o=t.midPrice.raw.multiply(this.inputAmount.raw)).subtract(r.raw).divide(o),new vt(i.numerator,i.denominator))}t.exactIn=function(e,n){return new t(e,n,exports.TradeType.EXACT_INPUT)},t.exactOut=function(e,n){return new t(e,n,exports.TradeType.EXACT_OUTPUT)};var e=t.prototype;return e.minimumAmountOut=function(t){if(t.lessThan(T)&&u(!1),this.tradeType===exports.TradeType.EXACT_OUTPUT)return this.outputAmount;var e=new at(g).add(t).invert().multiply(this.outputAmount.raw).quotient;return this.outputAmount instanceof dt?new dt(this.outputAmount.token,e):ct.ether(e)},e.maximumAmountIn=function(t){if(t.lessThan(T)&&u(!1),this.tradeType===exports.TradeType.EXACT_INPUT)return this.inputAmount;var e=new at(g).add(t).multiply(this.inputAmount.raw).quotient;return this.inputAmount instanceof dt?new dt(this.inputAmount.token,e):ct.ether(e)},t.bestTradeExactIn=function(e,n,r,o,i,a,s){var c=void 0===o?{}:o,d=c.maxNumResults,p=void 0===d?3:d,f=c.maxHops,l=void 0===f?3:f;void 0===i&&(i=[]),void 0===a&&(a=n),void 0===s&&(s=[]),e.length>0||u(!1),l>0||u(!1),a===n||i.length>0||u(!1);var h=n instanceof dt?n.token.chainId:r instanceof z?r.chainId:void 0;void 0===h&&u(!1);for(var m=Tt(n,h),v=gt(r,h),y=0;y<e.length;y++){var w=e[y];if((w.token0.equals(m.token)||w.token1.equals(m.token))&&!w.reserve0.equalTo(T)&&!w.reserve1.equalTo(T)){var g=void 0;try{g=w.getOutputAmount(m)[0]}catch(t){if(t.isInsufficientInputAmountError)continue;throw t}if(g.token.equals(v))G(s,new t(new ht([].concat(i,[w]),a.currency,r),a,exports.TradeType.EXACT_INPUT),p,wt);else if(l>1&&e.length>1){var k=e.slice(0,y).concat(e.slice(y+1,e.length));t.bestTradeExactIn(k,g,r,{maxNumResults:p,maxHops:l-1},[].concat(i,[w]),a,s)}}}return s},t.bestTradeExactOut=function(e,n,r,o,i,a,s){var c=void 0===o?{}:o,d=c.maxNumResults,p=void 0===d?3:d,f=c.maxHops,l=void 0===f?3:f;void 0===i&&(i=[]),void 0===a&&(a=r),void 0===s&&(s=[]),e.length>0||u(!1),l>0||u(!1),a===r||i.length>0||u(!1);var h=r instanceof dt?r.token.chainId:n instanceof z?n.chainId:void 0;void 0===h&&u(!1);for(var m=Tt(r,h),v=gt(n,h),y=0;y<e.length;y++){var w=e[y];if((w.token0.equals(m.token)||w.token1.equals(m.token))&&!w.reserve0.equalTo(T)&&!w.reserve1.equalTo(T)){var g=void 0;try{g=w.getInputAmount(m)[0]}catch(t){if(t.isInsufficientReservesError)continue;throw t}if(g.token.equals(v))G(s,new t(new ht([w].concat(i),n,a.currency),a,exports.TradeType.EXACT_OUTPUT),p,wt);else if(l>1&&e.length>1){var k=e.slice(0,y).concat(e.slice(y+1,e.length));t.bestTradeExactOut(k,n,g,{maxNumResults:p,maxHops:l-1},[w].concat(i),a,s)}}}return s},t}();function xt(t){return"0x"+t.raw.toString(16)}var At,It=function(){function t(){}return t.swapCallParameters=function(t,e){var n=t.inputAmount.currency===$,r=t.outputAmount.currency===$;n&&r&&u(!1),e.ttl>0||u(!1);var o,i,a,s=K(e.recipient),c=xt(t.maximumAmountIn(e.allowedSlippage)),d=xt(t.minimumAmountOut(e.allowedSlippage)),p=t.route.path.map(function(t){return t.address}),f="0x"+(Math.floor((new Date).getTime()/1e3)+e.ttl).toString(16),l=Boolean(e.feeOnTransfer);switch(t.tradeType){case exports.TradeType.EXACT_INPUT:n?(o=l?"swapExactETHForTokensSupportingFeeOnTransferTokens":"swapExactETHForTokens",i=[d,p,s,f],a=c):r?(o=l?"swapExactTokensForETHSupportingFeeOnTransferTokens":"swapExactTokensForETH",i=[c,d,p,s,f],a="0x0"):(o=l?"swapExactTokensForTokensSupportingFeeOnTransferTokens":"swapExactTokensForTokens",i=[c,d,p,s,f],a="0x0");break;case exports.TradeType.EXACT_OUTPUT:l&&u(!1),n?(o="swapETHForExactTokens",i=[d,p,s,f],a=c):r?(o="swapTokensForExactETH",i=[d,c,p,s,f],a="0x0"):(o="swapTokensForExactTokens",i=[d,c,p,s,f],a="0x0")}return{methodName:o,args:i,value:a}},t}(),Et=[{constant:!0,inputs:[],name:"decimals",outputs:[{name:"",type:"uint8"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{name:"",type:"address"}],name:"balanceOf",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"}],Ot=((At={})[exports.ChainId.MAINNET]={"0xE0B7927c4aF23765Cb51314A0E0521A9645F0E2A":9},At),bt=function(){function t(){}return t.fetchTokenData=function(t,e,n,r,o){try{var i,u,a=function(n){return new z(t,e,n,r,o)};void 0===n&&(n=h.getDefaultProvider(l.getNetwork(t)));var s="number"==typeof(null===(i=Ot)||void 0===i||null===(u=i[t])||void 0===u?void 0:u[e]);return Promise.resolve(s?a(Ot[t][e]):Promise.resolve(new f.Contract(e,Et,n).decimals().then(function(n){var r,o,i;return Ot=P(P({},Ot),{},((i={})[t]=P(P({},null===(r=Ot)||void 0===r?void 0:r[t]),{},((o={})[e]=n,o)),i)),n})).then(a))}catch(t){return Promise.reject(t)}},t.fetchPairData=function(t,e,n){try{void 0===n&&(n=h.getDefaultProvider(l.getNetwork(t.chainId))),t.chainId!==e.chainId&&u(!1);var r=lt.getAddress(t,e);return Promise.resolve(new f.Contract(r,m.abi,n).getReserves()).then(function(n){var r=n[0],o=n[1],i=t.sortsBefore(e)?[r,o]:[o,r];return new lt(new dt(t,i[0]),new dt(e,i[1]))})}catch(t){return Promise.reject(t)}},t}();exports.JSBI=i,exports.Currency=Q,exports.CurrencyAmount=ct,exports.ETHER=$,exports.FACTORY_ADDRESS="0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f",exports.Fetcher=bt,exports.Fraction=at,exports.INIT_CODE_HASH=y,exports.InsufficientInputAmountError=L,exports.InsufficientReservesError=W,exports.MINIMUM_LIQUIDITY=w,exports.Pair=lt,exports.Percent=vt,exports.Price=pt,exports.Route=ht,exports.Router=It,exports.Token=z,exports.TokenAmount=dt,exports.Trade=kt,exports.WETH=nt,exports.currencyEquals=Z,exports.inputOutputComparator=yt,exports.tradeComparator=wt},{"@ethersproject/address":23,"@ethersproject/contracts":33,"@ethersproject/networks":40,"@ethersproject/providers":52,"@ethersproject/solidity":80,"@uniswap/v2-core/build/IUniswapV2Pair.json":94,"big.js":95,"decimal.js-light":99,jsbi:131,"tiny-invariant":135,"tiny-warning":136,toformat:137}],94:[function(require,module,exports){module.exports={abi:[{anonymous:false,inputs:[{indexed:true,internalType:"address",name:"owner",type:"address"},{indexed:true,internalType:"address",name:"spender",type:"address"},{indexed:false,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:false,inputs:[{indexed:true,internalType:"address",name:"sender",type:"address"},{indexed:false,internalType:"uint256",name:"amount0",type:"uint256"},{indexed:false,internalType:"uint256",name:"amount1",type:"uint256"},{indexed:true,internalType:"address",name:"to",type:"address"}],name:"Burn",type:"event"},{anonymous:false,inputs:[{indexed:true,internalType:"address",name:"sender",type:"address"},{indexed:false,internalType:"uint256",name:"amount0",type:"uint256"},{indexed:false,internalType:"uint256",name:"amount1",type:"uint256"}],name:"Mint",type:"event"},{anonymous:false,inputs:[{indexed:true,internalType:"address",name:"sender",type:"address"},{indexed:false,internalType:"uint256",name:"amount0In",type:"uint256"},{indexed:false,internalType:"uint256",name:"amount1In",type:"uint256"},{indexed:false,internalType:"uint256",name:"amount0Out",type:"uint256"},{indexed:false,internalType:"uint256",name:"amount1Out",type:"uint256"},{indexed:true,internalType:"address",name:"to",type:"address"}],name:"Swap",type:"event"},{anonymous:false,inputs:[{indexed:false,internalType:"uint112",name:"reserve0",type:"uint112"},{indexed:false,internalType:"uint112",name:"reserve1",type:"uint112"}],name:"Sync",type:"event"},{anonymous:false,inputs:[{indexed:true,internalType:"address",name:"from",type:"address"},{indexed:true,internalType:"address",name:"to",type:"address"},{indexed:false,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{constant:true,inputs:[],name:"DOMAIN_SEPARATOR",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],payable:false,stateMutability:"view",type:"function"},{constant:true,inputs:[],name:"MINIMUM_LIQUIDITY",outputs:[{internalType:"uint256",name:"",type:"uint256"}],payable:false,stateMutability:"pure",type:"function"},{constant:true,inputs:[],name:"PERMIT_TYPEHASH",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],payable:false,stateMutability:"pure",type:"function"},{constant:true,inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],payable:false,stateMutability:"view",type:"function"},{constant:false,inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],payable:false,stateMutability:"nonpayable",type:"function"},{constant:true,inputs:[{internalType:"address",name:"owner",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],payable:false,stateMutability:"view",type:"function"},{constant:false,inputs:[{internalType:"address",name:"to",type:"address"}],name:"burn",outputs:[{internalType:"uint256",name:"amount0",type:"uint256"},{internalType:"uint256",name:"amount1",type:"uint256"}],payable:false,stateMutability:"nonpayable",type:"function"},{constant:true,inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],payable:false,stateMutability:"pure",type:"function"},{constant:true,inputs:[],name:"factory",outputs:[{internalType:"address",name:"",type:"address"}],payable:false,stateMutability:"view",type:"function"},{constant:true,inputs:[],name:"getReserves",outputs:[{internalType:"uint112",name:"reserve0",type:"uint112"},{internalType:"uint112",name:"reserve1",type:"uint112"},{internalType:"uint32",name:"blockTimestampLast",type:"uint32"}],payable:false,stateMutability:"view",type:"function"},{constant:false,inputs:[{internalType:"address",name:"",type:"address"},{internalType:"address",name:"",type:"address"}],name:"initialize",outputs:[],payable:false,stateMutability:"nonpayable",type:"function"},{constant:true,inputs:[],name:"kLast",outputs:[{internalType:"uint256",name:"",type:"uint256"}],payable:false,stateMutability:"view",type:"function"},{constant:false,inputs:[{internalType:"address",name:"to",type:"address"}],name:"mint",outputs:[{internalType:"uint256",name:"liquidity",type:"uint256"}],payable:false,stateMutability:"nonpayable",type:"function"},{constant:true,inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],payable:false,stateMutability:"pure",type:"function"},{constant:true,inputs:[{internalType:"address",name:"owner",type:"address"}],name:"nonces",outputs:[{internalType:"uint256",name:"",type:"uint256"}],payable:false,stateMutability:"view",type:"function"},{constant:false,inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"value",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"permit",outputs:[],payable:false,stateMutability:"nonpayable",type:"function"},{constant:true,inputs:[],name:"price0CumulativeLast",outputs:[{internalType:"uint256",name:"",type:"uint256"}],payable:false,stateMutability:"view",type:"function"},{constant:true,inputs:[],name:"price1CumulativeLast",outputs:[{internalType:"uint256",name:"",type:"uint256"}],payable:false,stateMutability:"view",type:"function"},{constant:false,inputs:[{internalType:"address",name:"to",type:"address"}],name:"skim",outputs:[],payable:false,stateMutability:"nonpayable",type:"function"},{constant:false,inputs:[{internalType:"uint256",name:"amount0Out",type:"uint256"},{internalType:"uint256",name:"amount1Out",type:"uint256"},{internalType:"address",name:"to",type:"address"},{internalType:"bytes",name:"data",type:"bytes"}],name:"swap",outputs:[],payable:false,stateMutability:"nonpayable",type:"function"},{constant:true,inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],payable:false,stateMutability:"pure",type:"function"},{constant:false,inputs:[],name:"sync",outputs:[],payable:false,stateMutability:"nonpayable",type:"function"},{constant:true,inputs:[],name:"token0",outputs:[{internalType:"address",name:"",type:"address"}],payable:false,stateMutability:"view",type:"function"},{constant:true,inputs:[],name:"token1",outputs:[{internalType:"address",name:"",type:"address"}],payable:false,stateMutability:"view",type:"function"},{constant:true,inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],payable:false,stateMutability:"view",type:"function"},{constant:false,inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],payable:false,stateMutability:"nonpayable",type:"function"},{constant:false,inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],payable:false,stateMutability:"nonpayable",type:"function"}],evm:{bytecode:{linkReferences:{},object:"",opcodes:"",sourceMap:""},deployedBytecode:{linkReferences:{},object:"",opcodes:"",sourceMap:""}},metadata:'{"compiler":{"version":"0.5.16+commit.9c3226ce"},"language":"Solidity","output":{"abi":[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"Burn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount0In","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1In","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount0Out","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1Out","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"Swap","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint112","name":"reserve0","type":"uint112"},{"indexed":false,"internalType":"uint112","name":"reserve1","type":"uint112"}],"name":"Sync","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"constant":true,"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"MINIMUM_LIQUIDITY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"PERMIT_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"burn","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getReserves","outputs":[{"internalType":"uint112","name":"reserve0","type":"uint112"},{"internalType":"uint112","name":"reserve1","type":"uint112"},{"internalType":"uint32","name":"blockTimestampLast","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"initialize","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"kLast","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"mint","outputs":[{"internalType":"uint256","name":"liquidity","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permit","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"price0CumulativeLast","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"price1CumulativeLast","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"skim","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"amount0Out","type":"uint256"},{"internalType":"uint256","name":"amount1Out","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"swap","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":false,"inputs":[],"name":"sync","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"token0","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"token1","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"}],"devdoc":{"methods":{}},"userdoc":{"methods":{}}},"settings":{"compilationTarget":{"contracts/interfaces/IUniswapV2Pair.sol":"IUniswapV2Pair"},"evmVersion":"istanbul","libraries":{},"optimizer":{"enabled":true,"runs":999999},"remappings":[]},"sources":{"contracts/interfaces/IUniswapV2Pair.sol":{"keccak256":"0x7c9bc70e5996c763e02ff38905282bc24fb242b0ef2519a003b36824fc524a4b","urls":["bzz-raw://85d5ad2dd23ee127f40907a12865a1e8cb5828814f6f2480285e1827dd72dedf","dweb:/ipfs/QmayKQWJgWmr46DqWseADyUanmqxh662hPNdAkdHRjiQQH"]}},"version":1}',interface:[{anonymous:false,inputs:[{indexed:true,internalType:"address",name:"owner",type:"address"},{indexed:true,internalType:"address",name:"spender",type:"address"},{indexed:false,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:false,inputs:[{indexed:true,internalType:"address",name:"sender",type:"address"},{indexed:false,internalType:"uint256",name:"amount0",type:"uint256"},{indexed:false,internalType:"uint256",name:"amount1",type:"uint256"},{indexed:true,internalType:"address",name:"to",type:"address"}],name:"Burn",type:"event"},{anonymous:false,inputs:[{indexed:true,internalType:"address",name:"sender",type:"address"},{indexed:false,internalType:"uint256",name:"amount0",type:"uint256"},{indexed:false,internalType:"uint256",name:"amount1",type:"uint256"}],name:"Mint",type:"event"},{anonymous:false,inputs:[{indexed:true,internalType:"address",name:"sender",type:"address"},{indexed:false,internalType:"uint256",name:"amount0In",type:"uint256"},{indexed:false,internalType:"uint256",name:"amount1In",type:"uint256"},{indexed:false,internalType:"uint256",name:"amount0Out",type:"uint256"},{indexed:false,internalType:"uint256",name:"amount1Out",type:"uint256"},{indexed:true,internalType:"address",name:"to",type:"address"}],name:"Swap",type:"event"},{anonymous:false,inputs:[{indexed:false,internalType:"uint112",name:"reserve0",type:"uint112"},{indexed:false,internalType:"uint112",name:"reserve1",type:"uint112"}],name:"Sync",type:"event"},{anonymous:false,inputs:[{indexed:true,internalType:"address",name:"from",type:"address"},{indexed:true,internalType:"address",name:"to",type:"address"},{indexed:false,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{constant:true,inputs:[],name:"DOMAIN_SEPARATOR",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],payable:false,stateMutability:"view",type:"function"},{constant:true,inputs:[],name:"MINIMUM_LIQUIDITY",outputs:[{internalType:"uint256",name:"",type:"uint256"}],payable:false,stateMutability:"pure",type:"function"},{constant:true,inputs:[],name:"PERMIT_TYPEHASH",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],payable:false,stateMutability:"pure",type:"function"},{constant:true,inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],payable:false,stateMutability:"view",type:"function"},{constant:false,inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],payable:false,stateMutability:"nonpayable",type:"function"},{constant:true,inputs:[{internalType:"address",name:"owner",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],payable:false,stateMutability:"view",type:"function"},{constant:false,inputs:[{internalType:"address",name:"to",type:"address"}],name:"burn",outputs:[{internalType:"uint256",name:"amount0",type:"uint256"},{internalType:"uint256",name:"amount1",type:"uint256"}],payable:false,stateMutability:"nonpayable",type:"function"},{constant:true,inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],payable:false,stateMutability:"pure",type:"function"},{constant:true,inputs:[],name:"factory",outputs:[{internalType:"address",name:"",type:"address"}],payable:false,stateMutability:"view",type:"function"},{constant:true,inputs:[],name:"getReserves",outputs:[{internalType:"uint112",name:"reserve0",type:"uint112"},{internalType:"uint112",name:"reserve1",type:"uint112"},{internalType:"uint32",name:"blockTimestampLast",type:"uint32"}],payable:false,stateMutability:"view",type:"function"},{constant:false,inputs:[{internalType:"address",name:"",type:"address"},{internalType:"address",name:"",type:"address"}],name:"initialize",outputs:[],payable:false,stateMutability:"nonpayable",type:"function"},{constant:true,inputs:[],name:"kLast",outputs:[{internalType:"uint256",name:"",type:"uint256"}],payable:false,stateMutability:"view",type:"function"},{constant:false,inputs:[{internalType:"address",name:"to",type:"address"}],name:"mint",outputs:[{internalType:"uint256",name:"liquidity",type:"uint256"}],payable:false,stateMutability:"nonpayable",type:"function"},{constant:true,inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],payable:false,stateMutability:"pure",type:"function"},{constant:true,inputs:[{internalType:"address",name:"owner",type:"address"}],name:"nonces",outputs:[{internalType:"uint256",name:"",type:"uint256"}],payable:false,stateMutability:"view",type:"function"},{constant:false,inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"value",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"permit",outputs:[],payable:false,stateMutability:"nonpayable",type:"function"},{constant:true,inputs:[],name:"price0CumulativeLast",outputs:[{internalType:"uint256",name:"",type:"uint256"}],payable:false,stateMutability:"view",type:"function"},{constant:true,inputs:[],name:"price1CumulativeLast",outputs:[{internalType:"uint256",name:"",type:"uint256"}],payable:false,stateMutability:"view",type:"function"},{constant:false,inputs:[{internalType:"address",name:"to",type:"address"}],name:"skim",outputs:[],payable:false,stateMutability:"nonpayable",type:"function"},{constant:false,inputs:[{internalType:"uint256",name:"amount0Out",type:"uint256"},{internalType:"uint256",name:"amount1Out",type:"uint256"},{internalType:"address",name:"to",type:"address"},{internalType:"bytes",name:"data",type:"bytes"}],name:"swap",outputs:[],payable:false,stateMutability:"nonpayable",type:"function"},{constant:true,inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],payable:false,stateMutability:"pure",type:"function"},{constant:false,inputs:[],name:"sync",outputs:[],payable:false,stateMutability:"nonpayable",type:"function"},{constant:true,inputs:[],name:"token0",outputs:[{internalType:"address",name:"",type:"address"}],payable:false,stateMutability:"view",type:"function"},{constant:true,inputs:[],name:"token1",outputs:[{internalType:"address",name:"",type:"address"}],payable:false,stateMutability:"view",type:"function"},{constant:true,inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],payable:false,stateMutability:"view",type:"function"},{constant:false,inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],payable:false,stateMutability:"nonpayable",type:"function"},{constant:false,inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],payable:false,stateMutability:"nonpayable",type:"function"}],bytecode:""}},{}],95:[function(require,module,exports){(function(GLOBAL){"use strict";var Big,DP=20,RM=1,MAX_DP=1e6,MAX_POWER=1e6,NE=-7,PE=21,NAME="[big.js] ",INVALID=NAME+"Invalid ",INVALID_DP=INVALID+"decimal places",INVALID_RM=INVALID+"rounding mode",DIV_BY_ZERO=NAME+"Division by zero",P={},UNDEFINED=void 0,NUMERIC=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function _Big_(){function Big(n){var x=this;if(!(x instanceof Big))return n===UNDEFINED?_Big_():new Big(n);if(n instanceof Big){x.s=n.s;x.e=n.e;x.c=n.c.slice()}else{parse(x,n)}x.constructor=Big}Big.prototype=P;Big.DP=DP;Big.RM=RM;Big.NE=NE;Big.PE=PE;Big.version="5.2.2";return Big}function parse(x,n){var e,i,nl;if(n===0&&1/n<0)n="-0";else if(!NUMERIC.test(n+=""))throw Error(INVALID+"number");x.s=n.charAt(0)=="-"?(n=n.slice(1),-1):1;if((e=n.indexOf("."))>-1)n=n.replace(".","");if((i=n.search(/e/i))>0){if(e<0)e=i;e+=+n.slice(i+1);n=n.substring(0,i)}else if(e<0){e=n.length}nl=n.length;for(i=0;i<nl&&n.charAt(i)=="0";)++i;if(i==nl){x.c=[x.e=0]}else{for(;nl>0&&n.charAt(--nl)=="0";);x.e=e-i-1;x.c=[];for(e=0;i<=nl;)x.c[e++]=+n.charAt(i++)}return x}function round(x,dp,rm,more){var xc=x.c,i=x.e+dp+1;if(i<xc.length){if(rm===1){more=xc[i]>=5}else if(rm===2){more=xc[i]>5||xc[i]==5&&(more||i<0||xc[i+1]!==UNDEFINED||xc[i-1]&1)}else if(rm===3){more=more||!!xc[0]}else{more=false;if(rm!==0)throw Error(INVALID_RM)}if(i<1){xc.length=1;if(more){x.e=-dp;xc[0]=1}else{xc[0]=x.e=0}}else{xc.length=i--;if(more){for(;++xc[i]>9;){xc[i]=0;if(!i--){++x.e;xc.unshift(1)}}}for(i=xc.length;!xc[--i];)xc.pop()}}else if(rm<0||rm>3||rm!==~~rm){throw Error(INVALID_RM)}return x}function stringify(x,id,n,k){var e,s,Big=x.constructor,z=!x.c[0];if(n!==UNDEFINED){if(n!==~~n||n<(id==3)||n>MAX_DP){throw Error(id==3?INVALID+"precision":INVALID_DP)}x=new Big(x);n=k-x.e;if(x.c.length>++k)round(x,n,Big.RM);if(id==2)k=x.e+n+1;for(;x.c.length<k;)x.c.push(0)}e=x.e;s=x.c.join("");n=s.length;if(id!=2&&(id==1||id==3&&k<=e||e<=Big.NE||e>=Big.PE)){s=s.charAt(0)+(n>1?"."+s.slice(1):"")+(e<0?"e":"e+")+e}else if(e<0){for(;++e;)s="0"+s;s="0."+s}else if(e>0){if(++e>n)for(e-=n;e--;)s+="0";else if(e<n)s=s.slice(0,e)+"."+s.slice(e)}else if(n>1){s=s.charAt(0)+"."+s.slice(1)}return x.s<0&&(!z||id==4)?"-"+s:s}P.abs=function(){var x=new this.constructor(this);x.s=1;return x};P.cmp=function(y){var isneg,x=this,xc=x.c,yc=(y=new x.constructor(y)).c,i=x.s,j=y.s,k=x.e,l=y.e;if(!xc[0]||!yc[0])return!xc[0]?!yc[0]?0:-j:i;if(i!=j)return i;isneg=i<0;if(k!=l)return k>l^isneg?1:-1;j=(k=xc.length)<(l=yc.length)?k:l;for(i=-1;++i<j;){if(xc[i]!=yc[i])return xc[i]>yc[i]^isneg?1:-1}return k==l?0:k>l^isneg?1:-1};P.div=function(y){var x=this,Big=x.constructor,a=x.c,b=(y=new Big(y)).c,k=x.s==y.s?1:-1,dp=Big.DP;if(dp!==~~dp||dp<0||dp>MAX_DP)throw Error(INVALID_DP);if(!b[0])throw Error(DIV_BY_ZERO);if(!a[0])return new Big(k*0);var bl,bt,n,cmp,ri,bz=b.slice(),ai=bl=b.length,al=a.length,r=a.slice(0,bl),rl=r.length,q=y,qc=q.c=[],qi=0,d=dp+(q.e=x.e-y.e)+1;q.s=k;k=d<0?0:d;bz.unshift(0);for(;rl++<bl;)r.push(0);do{for(n=0;n<10;n++){if(bl!=(rl=r.length)){cmp=bl>rl?1:-1}else{for(ri=-1,cmp=0;++ri<bl;){if(b[ri]!=r[ri]){cmp=b[ri]>r[ri]?1:-1;break}}}if(cmp<0){for(bt=rl==bl?b:bz;rl;){if(r[--rl]<bt[rl]){ri=rl;for(;ri&&!r[--ri];)r[ri]=9;--r[ri];r[rl]+=10}r[rl]-=bt[rl]}for(;!r[0];)r.shift()}else{break}}qc[qi++]=cmp?n:++n;if(r[0]&&cmp)r[rl]=a[ai]||0;else r=[a[ai]]}while((ai++<al||r[0]!==UNDEFINED)&&k--);if(!qc[0]&&qi!=1){qc.shift();q.e--}if(qi>d)round(q,dp,Big.RM,r[0]!==UNDEFINED);return q};P.eq=function(y){return!this.cmp(y)};P.gt=function(y){return this.cmp(y)>0};P.gte=function(y){return this.cmp(y)>-1};P.lt=function(y){return this.cmp(y)<0};P.lte=function(y){return this.cmp(y)<1};P.minus=P.sub=function(y){var i,j,t,xlty,x=this,Big=x.constructor,a=x.s,b=(y=new Big(y)).s;if(a!=b){y.s=-b;return x.plus(y)}var xc=x.c.slice(),xe=x.e,yc=y.c,ye=y.e;if(!xc[0]||!yc[0]){return yc[0]?(y.s=-b,y):new Big(xc[0]?x:0)}if(a=xe-ye){if(xlty=a<0){a=-a;t=xc}else{ye=xe;t=yc}t.reverse();for(b=a;b--;)t.push(0);t.reverse()}else{j=((xlty=xc.length<yc.length)?xc:yc).length;for(a=b=0;b<j;b++){if(xc[b]!=yc[b]){xlty=xc[b]<yc[b];break}}}if(xlty){t=xc;xc=yc;yc=t;y.s=-y.s}if((b=(j=yc.length)-(i=xc.length))>0)for(;b--;)xc[i++]=0;for(b=i;j>a;){if(xc[--j]<yc[j]){for(i=j;i&&!xc[--i];)xc[i]=9;--xc[i];xc[j]+=10}xc[j]-=yc[j]}for(;xc[--b]===0;)xc.pop();for(;xc[0]===0;){xc.shift();--ye}if(!xc[0]){y.s=1;xc=[ye=0]}y.c=xc;y.e=ye;return y};P.mod=function(y){var ygtx,x=this,Big=x.constructor,a=x.s,b=(y=new Big(y)).s;if(!y.c[0])throw Error(DIV_BY_ZERO);x.s=y.s=1;ygtx=y.cmp(x)==1;x.s=a;y.s=b;if(ygtx)return new Big(x);a=Big.DP;b=Big.RM;Big.DP=Big.RM=0;x=x.div(y);Big.DP=a;Big.RM=b;return this.minus(x.times(y))};P.plus=P.add=function(y){var t,x=this,Big=x.constructor,a=x.s,b=(y=new Big(y)).s;if(a!=b){y.s=-b;return x.minus(y)}var xe=x.e,xc=x.c,ye=y.e,yc=y.c;if(!xc[0]||!yc[0])return yc[0]?y:new Big(xc[0]?x:a*0);xc=xc.slice();if(a=xe-ye){if(a>0){ye=xe;t=yc}else{a=-a;t=xc}t.reverse();for(;a--;)t.push(0);t.reverse()}if(xc.length-yc.length<0){t=yc;yc=xc;xc=t}a=yc.length;for(b=0;a;xc[a]%=10)b=(xc[--a]=xc[a]+yc[a]+b)/10|0;if(b){xc.unshift(b);++ye}for(a=xc.length;xc[--a]===0;)xc.pop();y.c=xc;y.e=ye;return y};P.pow=function(n){var x=this,one=new x.constructor(1),y=one,isneg=n<0;if(n!==~~n||n<-MAX_POWER||n>MAX_POWER)throw Error(INVALID+"exponent");if(isneg)n=-n;for(;;){if(n&1)y=y.times(x);n>>=1;if(!n)break;x=x.times(x)}return isneg?one.div(y):y};P.round=function(dp,rm){var Big=this.constructor;if(dp===UNDEFINED)dp=0;else if(dp!==~~dp||dp<-MAX_DP||dp>MAX_DP)throw Error(INVALID_DP);return round(new Big(this),dp,rm===UNDEFINED?Big.RM:rm)};P.sqrt=function(){var r,c,t,x=this,Big=x.constructor,s=x.s,e=x.e,half=new Big(.5);if(!x.c[0])return new Big(x);if(s<0)throw Error(NAME+"No square root");s=Math.sqrt(x+"");if(s===0||s===1/0){c=x.c.join("");if(!(c.length+e&1))c+="0";s=Math.sqrt(c);e=((e+1)/2|0)-(e<0||e&1);r=new Big((s==1/0?"1e":(s=s.toExponential()).slice(0,s.indexOf("e")+1))+e)}else{r=new Big(s)}e=r.e+(Big.DP+=4);do{t=r;r=half.times(t.plus(x.div(t)))}while(t.c.slice(0,e).join("")!==r.c.slice(0,e).join(""));return round(r,Big.DP-=4,Big.RM)};P.times=P.mul=function(y){var c,x=this,Big=x.constructor,xc=x.c,yc=(y=new Big(y)).c,a=xc.length,b=yc.length,i=x.e,j=y.e;y.s=x.s==y.s?1:-1;if(!xc[0]||!yc[0])return new Big(y.s*0);y.e=i+j;if(a<b){c=xc;xc=yc;yc=c;j=a;a=b;b=j}for(c=new Array(j=a+b);j--;)c[j]=0;for(i=b;i--;){b=0;for(j=a+i;j>i;){b=c[j]+yc[i]*xc[j-i-1]+b;c[j--]=b%10;b=b/10|0}c[j]=(c[j]+b)%10}if(b)++y.e;else c.shift();for(i=c.length;!c[--i];)c.pop();y.c=c;return y};P.toExponential=function(dp){return stringify(this,1,dp,dp)};P.toFixed=function(dp){return stringify(this,2,dp,this.e+dp)};P.toPrecision=function(sd){return stringify(this,3,sd,sd-1)};P.toString=function(){return stringify(this)};P.valueOf=P.toJSON=function(){return stringify(this,4)};Big=_Big_();Big["default"]=Big.Big=Big;if(typeof define==="function"&&define.amd){define(function(){return Big})}else if(typeof module!=="undefined"&&module.exports){module.exports=Big}else{GLOBAL.Big=Big}})(this)},{}],96:[function(require,module,exports){(function(module,exports){"use strict";function assert(val,msg){if(!val)throw new Error(msg||"Assertion failed")}function inherits(ctor,superCtor){ctor.super_=superCtor;var TempCtor=function(){};TempCtor.prototype=superCtor.prototype;ctor.prototype=new TempCtor;ctor.prototype.constructor=ctor}function BN(number,base,endian){if(BN.isBN(number)){return number}this.negative=0;this.words=null;this.length=0;this.red=null;if(number!==null){if(base==="le"||base==="be"){endian=base;base=10}this._init(number||0,base||10,endian||"be")}}if(typeof module==="object"){module.exports=BN}else{exports.BN=BN}BN.BN=BN;BN.wordSize=26;var Buffer;try{Buffer=require("buffer").Buffer}catch(e){}BN.isBN=function isBN(num){if(num instanceof BN){return true}return num!==null&&typeof num==="object"&&num.constructor.wordSize===BN.wordSize&&Array.isArray(num.words)};BN.max=function max(left,right){if(left.cmp(right)>0)return left;return right};BN.min=function min(left,right){if(left.cmp(right)<0)return left;return right};BN.prototype._init=function init(number,base,endian){if(typeof number==="number"){return this._initNumber(number,base,endian)}if(typeof number==="object"){return this._initArray(number,base,endian)}if(base==="hex"){base=16}assert(base===(base|0)&&base>=2&&base<=36);number=number.toString().replace(/\s+/g,"");var start=0;if(number[0]==="-"){start++}if(base===16){this._parseHex(number,start)}else{this._parseBase(number,base,start)}if(number[0]==="-"){this.negative=1}this.strip();if(endian!=="le")return;this._initArray(this.toArray(),base,endian)};BN.prototype._initNumber=function _initNumber(number,base,endian){if(number<0){this.negative=1;number=-number}if(number<67108864){this.words=[number&67108863];this.length=1}else if(number<4503599627370496){this.words=[number&67108863,number/67108864&67108863];this.length=2}else{assert(number<9007199254740992);this.words=[number&67108863,number/67108864&67108863,1];this.length=3}if(endian!=="le")return;this._initArray(this.toArray(),base,endian)};BN.prototype._initArray=function _initArray(number,base,endian){assert(typeof number.length==="number");if(number.length<=0){this.words=[0];this.length=1;return this}this.length=Math.ceil(number.length/3);this.words=new Array(this.length);for(var i=0;i<this.length;i++){this.words[i]=0}var j,w;var off=0;if(endian==="be"){for(i=number.length-1,j=0;i>=0;i-=3){w=number[i]|number[i-1]<<8|number[i-2]<<16;this.words[j]|=w<<off&67108863;this.words[j+1]=w>>>26-off&67108863;off+=24;if(off>=26){off-=26;j++}}}else if(endian==="le"){for(i=0,j=0;i<number.length;i+=3){w=number[i]|number[i+1]<<8|number[i+2]<<16;this.words[j]|=w<<off&67108863;this.words[j+1]=w>>>26-off&67108863;off+=24;if(off>=26){off-=26;j++}}}return this.strip()};function parseHex(str,start,end){var r=0;var len=Math.min(str.length,end);for(var i=start;i<len;i++){var c=str.charCodeAt(i)-48;r<<=4;if(c>=49&&c<=54){r|=c-49+10}else if(c>=17&&c<=22){r|=c-17+10}else{r|=c&15}}return r}BN.prototype._parseHex=function _parseHex(number,start){this.length=Math.ceil((number.length-start)/6);this.words=new Array(this.length);for(var i=0;i<this.length;i++){this.words[i]=0}var j,w;var off=0;for(i=number.length-6,j=0;i>=start;i-=6){w=parseHex(number,i,i+6);this.words[j]|=w<<off&67108863;this.words[j+1]|=w>>>26-off&4194303;off+=24;if(off>=26){off-=26;j++}}if(i+6!==start){w=parseHex(number,start,i+6);this.words[j]|=w<<off&67108863;this.words[j+1]|=w>>>26-off&4194303}this.strip()};function parseBase(str,start,end,mul){var r=0;var len=Math.min(str.length,end);for(var i=start;i<len;i++){var c=str.charCodeAt(i)-48;r*=mul;if(c>=49){r+=c-49+10}else if(c>=17){r+=c-17+10}else{r+=c}}return r}BN.prototype._parseBase=function _parseBase(number,base,start){this.words=[0];this.length=1;for(var limbLen=0,limbPow=1;limbPow<=67108863;limbPow*=base){limbLen++}limbLen--;limbPow=limbPow/base|0;var total=number.length-start;var mod=total%limbLen;var end=Math.min(total,total-mod)+start;var word=0;for(var i=start;i<end;i+=limbLen){word=parseBase(number,i,i+limbLen,base);this.imuln(limbPow);if(this.words[0]+word<67108864){this.words[0]+=word}else{this._iaddn(word)}}if(mod!==0){var pow=1;word=parseBase(number,i,number.length,base);for(i=0;i<mod;i++){pow*=base}this.imuln(pow);if(this.words[0]+word<67108864){this.words[0]+=word}else{this._iaddn(word)}}};BN.prototype.copy=function copy(dest){dest.words=new Array(this.length);for(var i=0;i<this.length;i++){dest.words[i]=this.words[i]}dest.length=this.length;dest.negative=this.negative;dest.red=this.red};BN.prototype.clone=function clone(){var r=new BN(null);this.copy(r);return r};BN.prototype._expand=function _expand(size){while(this.length<size){this.words[this.length++]=0}return this};BN.prototype.strip=function strip(){while(this.length>1&&this.words[this.length-1]===0){this.length--}return this._normSign()};BN.prototype._normSign=function _normSign(){if(this.length===1&&this.words[0]===0){this.negative=0}return this};BN.prototype.inspect=function inspect(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var zeros=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"];var groupSizes=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5];var groupBases=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];BN.prototype.toString=function toString(base,padding){base=base||10;padding=padding|0||1;var out;if(base===16||base==="hex"){out="";var off=0;var carry=0;for(var i=0;i<this.length;i++){var w=this.words[i];var word=((w<<off|carry)&16777215).toString(16);carry=w>>>24-off&16777215;if(carry!==0||i!==this.length-1){out=zeros[6-word.length]+word+out}else{out=word+out}off+=2;if(off>=26){off-=26;i--}}if(carry!==0){out=carry.toString(16)+out}while(out.length%padding!==0){out="0"+out}if(this.negative!==0){out="-"+out}return out}if(base===(base|0)&&base>=2&&base<=36){var groupSize=groupSizes[base];var groupBase=groupBases[base];out="";var c=this.clone();c.negative=0;while(!c.isZero()){var r=c.modn(groupBase).toString(base);c=c.idivn(groupBase);if(!c.isZero()){out=zeros[groupSize-r.length]+r+out}else{out=r+out}}if(this.isZero()){out="0"+out}while(out.length%padding!==0){out="0"+out}if(this.negative!==0){out="-"+out}return out}assert(false,"Base should be between 2 and 36")};BN.prototype.toNumber=function toNumber(){var ret=this.words[0];if(this.length===2){ret+=this.words[1]*67108864}else if(this.length===3&&this.words[2]===1){ret+=4503599627370496+this.words[1]*67108864}else if(this.length>2){assert(false,"Number can only safely store up to 53 bits")}return this.negative!==0?-ret:ret};BN.prototype.toJSON=function toJSON(){return this.toString(16)};BN.prototype.toBuffer=function toBuffer(endian,length){assert(typeof Buffer!=="undefined");return this.toArrayLike(Buffer,endian,length)};BN.prototype.toArray=function toArray(endian,length){return this.toArrayLike(Array,endian,length)};BN.prototype.toArrayLike=function toArrayLike(ArrayType,endian,length){var byteLength=this.byteLength();var reqLength=length||Math.max(1,byteLength);assert(byteLength<=reqLength,"byte array longer than desired length");assert(reqLength>0,"Requested array length <= 0");this.strip();var littleEndian=endian==="le";var res=new ArrayType(reqLength);var b,i;var q=this.clone();if(!littleEndian){for(i=0;i<reqLength-byteLength;i++){res[i]=0}for(i=0;!q.isZero();i++){b=q.andln(255);q.iushrn(8);res[reqLength-i-1]=b}}else{for(i=0;!q.isZero();i++){b=q.andln(255);q.iushrn(8);res[i]=b}for(;i<reqLength;i++){res[i]=0}}return res};if(Math.clz32){BN.prototype._countBits=function _countBits(w){return 32-Math.clz32(w)}}else{BN.prototype._countBits=function _countBits(w){var t=w;var r=0;if(t>=4096){r+=13;t>>>=13}if(t>=64){r+=7;t>>>=7}if(t>=8){r+=4;t>>>=4}if(t>=2){r+=2;t>>>=2}return r+t}}BN.prototype._zeroBits=function _zeroBits(w){if(w===0)return 26;var t=w;var r=0;if((t&8191)===0){r+=13;t>>>=13}if((t&127)===0){r+=7;t>>>=7}if((t&15)===0){r+=4;t>>>=4}if((t&3)===0){r+=2;t>>>=2}if((t&1)===0){r++}return r};BN.prototype.bitLength=function bitLength(){var w=this.words[this.length-1];var hi=this._countBits(w);return(this.length-1)*26+hi};function toBitArray(num){var w=new Array(num.bitLength());for(var bit=0;bit<w.length;bit++){var off=bit/26|0;var wbit=bit%26;w[bit]=(num.words[off]&1<<wbit)>>>wbit}return w}BN.prototype.zeroBits=function zeroBits(){if(this.isZero())return 0;var r=0;for(var i=0;i<this.length;i++){var b=this._zeroBits(this.words[i]);r+=b;if(b!==26)break}return r};BN.prototype.byteLength=function byteLength(){return Math.ceil(this.bitLength()/8)};BN.prototype.toTwos=function toTwos(width){if(this.negative!==0){return this.abs().inotn(width).iaddn(1)}return this.clone()};BN.prototype.fromTwos=function fromTwos(width){if(this.testn(width-1)){return this.notn(width).iaddn(1).ineg()}return this.clone()};BN.prototype.isNeg=function isNeg(){return this.negative!==0};BN.prototype.neg=function neg(){return this.clone().ineg()};BN.prototype.ineg=function ineg(){if(!this.isZero()){this.negative^=1}return this};BN.prototype.iuor=function iuor(num){while(this.length<num.length){this.words[this.length++]=0}for(var i=0;i<num.length;i++){this.words[i]=this.words[i]|num.words[i]}return this.strip()};BN.prototype.ior=function ior(num){assert((this.negative|num.negative)===0);return this.iuor(num)};BN.prototype.or=function or(num){if(this.length>num.length)return this.clone().ior(num);return num.clone().ior(this)};BN.prototype.uor=function uor(num){if(this.length>num.length)return this.clone().iuor(num);return num.clone().iuor(this)};BN.prototype.iuand=function iuand(num){var b;if(this.length>num.length){b=num}else{b=this}for(var i=0;i<b.length;i++){this.words[i]=this.words[i]&num.words[i]}this.length=b.length;return this.strip()};BN.prototype.iand=function iand(num){assert((this.negative|num.negative)===0);return this.iuand(num)};BN.prototype.and=function and(num){if(this.length>num.length)return this.clone().iand(num);return num.clone().iand(this)};BN.prototype.uand=function uand(num){if(this.length>num.length)return this.clone().iuand(num);return num.clone().iuand(this)};BN.prototype.iuxor=function iuxor(num){var a;var b;if(this.length>num.length){a=this;b=num}else{a=num;b=this}for(var i=0;i<b.length;i++){this.words[i]=a.words[i]^b.words[i]}if(this!==a){for(;i<a.length;i++){this.words[i]=a.words[i]}}this.length=a.length;return this.strip()};BN.prototype.ixor=function ixor(num){assert((this.negative|num.negative)===0);return this.iuxor(num)};BN.prototype.xor=function xor(num){if(this.length>num.length)return this.clone().ixor(num);return num.clone().ixor(this)};BN.prototype.uxor=function uxor(num){if(this.length>num.length)return this.clone().iuxor(num);return num.clone().iuxor(this)};BN.prototype.inotn=function inotn(width){assert(typeof width==="number"&&width>=0);var bytesNeeded=Math.ceil(width/26)|0;var bitsLeft=width%26;this._expand(bytesNeeded);if(bitsLeft>0){bytesNeeded--}for(var i=0;i<bytesNeeded;i++){this.words[i]=~this.words[i]&67108863}if(bitsLeft>0){this.words[i]=~this.words[i]&67108863>>26-bitsLeft}return this.strip()};BN.prototype.notn=function notn(width){return this.clone().inotn(width)};BN.prototype.setn=function setn(bit,val){assert(typeof bit==="number"&&bit>=0);var off=bit/26|0;var wbit=bit%26;this._expand(off+1);if(val){this.words[off]=this.words[off]|1<<wbit}else{this.words[off]=this.words[off]&~(1<<wbit)}return this.strip()};BN.prototype.iadd=function iadd(num){var r;if(this.negative!==0&&num.negative===0){this.negative=0;r=this.isub(num);this.negative^=1;return this._normSign()}else if(this.negative===0&&num.negative!==0){num.negative=0;r=this.isub(num);num.negative=1;return r._normSign()}var a,b;if(this.length>num.length){a=this;b=num}else{a=num;b=this}var carry=0;for(var i=0;i<b.length;i++){r=(a.words[i]|0)+(b.words[i]|0)+carry;this.words[i]=r&67108863;carry=r>>>26}for(;carry!==0&&i<a.length;i++){r=(a.words[i]|0)+carry;this.words[i]=r&67108863;carry=r>>>26}this.length=a.length;if(carry!==0){this.words[this.length]=carry;this.length++}else if(a!==this){for(;i<a.length;i++){this.words[i]=a.words[i]}}return this};BN.prototype.add=function add(num){var res;if(num.negative!==0&&this.negative===0){num.negative=0;res=this.sub(num);num.negative^=1;return res}else if(num.negative===0&&this.negative!==0){this.negative=0;res=num.sub(this);this.negative=1;return res}if(this.length>num.length)return this.clone().iadd(num);return num.clone().iadd(this)};BN.prototype.isub=function isub(num){if(num.negative!==0){num.negative=0;var r=this.iadd(num);num.negative=1;return r._normSign()}else if(this.negative!==0){this.negative=0;this.iadd(num);this.negative=1;return this._normSign()}var cmp=this.cmp(num);if(cmp===0){this.negative=0;this.length=1;this.words[0]=0;return this}var a,b;if(cmp>0){a=this;b=num}else{a=num;b=this}var carry=0;for(var i=0;i<b.length;i++){r=(a.words[i]|0)-(b.words[i]|0)+carry;carry=r>>26;this.words[i]=r&67108863}for(;carry!==0&&i<a.length;i++){r=(a.words[i]|0)+carry;carry=r>>26;this.words[i]=r&67108863}if(carry===0&&i<a.length&&a!==this){for(;i<a.length;i++){this.words[i]=a.words[i]}}this.length=Math.max(this.length,i);if(a!==this){this.negative=1}return this.strip()};BN.prototype.sub=function sub(num){return this.clone().isub(num)};function smallMulTo(self,num,out){out.negative=num.negative^self.negative;var len=self.length+num.length|0;out.length=len;len=len-1|0;var a=self.words[0]|0;var b=num.words[0]|0;var r=a*b;var lo=r&67108863;var carry=r/67108864|0;out.words[0]=lo;for(var k=1;k<len;k++){var ncarry=carry>>>26;var rword=carry&67108863;var maxJ=Math.min(k,num.length-1);for(var j=Math.max(0,k-self.length+1);j<=maxJ;j++){var i=k-j|0;a=self.words[i]|0;b=num.words[j]|0;r=a*b+rword;ncarry+=r/67108864|0;rword=r&67108863}out.words[k]=rword|0;carry=ncarry|0}if(carry!==0){out.words[k]=carry|0}else{out.length--}return out.strip()}var comb10MulTo=function comb10MulTo(self,num,out){var a=self.words;var b=num.words;var o=out.words;var c=0;var lo;var mid;var hi;var a0=a[0]|0;var al0=a0&8191;var ah0=a0>>>13;var a1=a[1]|0;var al1=a1&8191;var ah1=a1>>>13;var a2=a[2]|0;var al2=a2&8191;var ah2=a2>>>13;var a3=a[3]|0;var al3=a3&8191;var ah3=a3>>>13;var a4=a[4]|0;var al4=a4&8191;var ah4=a4>>>13;var a5=a[5]|0;var al5=a5&8191;var ah5=a5>>>13;var a6=a[6]|0;var al6=a6&8191;var ah6=a6>>>13;var a7=a[7]|0;var al7=a7&8191;var ah7=a7>>>13;var a8=a[8]|0;var al8=a8&8191;var ah8=a8>>>13;var a9=a[9]|0;var al9=a9&8191;var ah9=a9>>>13;var b0=b[0]|0;var bl0=b0&8191;var bh0=b0>>>13;var b1=b[1]|0;var bl1=b1&8191;var bh1=b1>>>13;var b2=b[2]|0;var bl2=b2&8191;var bh2=b2>>>13;var b3=b[3]|0;var bl3=b3&8191;var bh3=b3>>>13;var b4=b[4]|0;var bl4=b4&8191;var bh4=b4>>>13;var b5=b[5]|0;var bl5=b5&8191;var bh5=b5>>>13;var b6=b[6]|0;var bl6=b6&8191;var bh6=b6>>>13;var b7=b[7]|0;var bl7=b7&8191;var bh7=b7>>>13;var b8=b[8]|0;var bl8=b8&8191;var bh8=b8>>>13;var b9=b[9]|0;var bl9=b9&8191;var bh9=b9>>>13;out.negative=self.negative^num.negative;out.length=19;lo=Math.imul(al0,bl0);mid=Math.imul(al0,bh0);mid=mid+Math.imul(ah0,bl0)|0;hi=Math.imul(ah0,bh0);var w0=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w0>>>26)|0;w0&=67108863;lo=Math.imul(al1,bl0);mid=Math.imul(al1,bh0);mid=mid+Math.imul(ah1,bl0)|0;hi=Math.imul(ah1,bh0);lo=lo+Math.imul(al0,bl1)|0;mid=mid+Math.imul(al0,bh1)|0;mid=mid+Math.imul(ah0,bl1)|0;hi=hi+Math.imul(ah0,bh1)|0;var w1=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w1>>>26)|0;w1&=67108863;lo=Math.imul(al2,bl0);mid=Math.imul(al2,bh0);mid=mid+Math.imul(ah2,bl0)|0;hi=Math.imul(ah2,bh0);lo=lo+Math.imul(al1,bl1)|0;mid=mid+Math.imul(al1,bh1)|0;mid=mid+Math.imul(ah1,bl1)|0;hi=hi+Math.imul(ah1,bh1)|0;lo=lo+Math.imul(al0,bl2)|0;mid=mid+Math.imul(al0,bh2)|0;mid=mid+Math.imul(ah0,bl2)|0;hi=hi+Math.imul(ah0,bh2)|0;var w2=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w2>>>26)|0;w2&=67108863;lo=Math.imul(al3,bl0);mid=Math.imul(al3,bh0);mid=mid+Math.imul(ah3,bl0)|0;hi=Math.imul(ah3,bh0);lo=lo+Math.imul(al2,bl1)|0;mid=mid+Math.imul(al2,bh1)|0;mid=mid+Math.imul(ah2,bl1)|0;hi=hi+Math.imul(ah2,bh1)|0;lo=lo+Math.imul(al1,bl2)|0;mid=mid+Math.imul(al1,bh2)|0;mid=mid+Math.imul(ah1,bl2)|0;hi=hi+Math.imul(ah1,bh2)|0;lo=lo+Math.imul(al0,bl3)|0;mid=mid+Math.imul(al0,bh3)|0;mid=mid+Math.imul(ah0,bl3)|0;hi=hi+Math.imul(ah0,bh3)|0;var w3=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w3>>>26)|0;w3&=67108863;lo=Math.imul(al4,bl0);mid=Math.imul(al4,bh0);mid=mid+Math.imul(ah4,bl0)|0;hi=Math.imul(ah4,bh0);lo=lo+Math.imul(al3,bl1)|0;mid=mid+Math.imul(al3,bh1)|0;mid=mid+Math.imul(ah3,bl1)|0;hi=hi+Math.imul(ah3,bh1)|0;lo=lo+Math.imul(al2,bl2)|0;mid=mid+Math.imul(al2,bh2)|0;mid=mid+Math.imul(ah2,bl2)|0;hi=hi+Math.imul(ah2,bh2)|0;lo=lo+Math.imul(al1,bl3)|0;mid=mid+Math.imul(al1,bh3)|0;mid=mid+Math.imul(ah1,bl3)|0;hi=hi+Math.imul(ah1,bh3)|0;lo=lo+Math.imul(al0,bl4)|0;mid=mid+Math.imul(al0,bh4)|0;mid=mid+Math.imul(ah0,bl4)|0;hi=hi+Math.imul(ah0,bh4)|0;var w4=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w4>>>26)|0;w4&=67108863;lo=Math.imul(al5,bl0);mid=Math.imul(al5,bh0);mid=mid+Math.imul(ah5,bl0)|0;hi=Math.imul(ah5,bh0);lo=lo+Math.imul(al4,bl1)|0;mid=mid+Math.imul(al4,bh1)|0;mid=mid+Math.imul(ah4,bl1)|0;hi=hi+Math.imul(ah4,bh1)|0;lo=lo+Math.imul(al3,bl2)|0;mid=mid+Math.imul(al3,bh2)|0;mid=mid+Math.imul(ah3,bl2)|0;hi=hi+Math.imul(ah3,bh2)|0;lo=lo+Math.imul(al2,bl3)|0;mid=mid+Math.imul(al2,bh3)|0;mid=mid+Math.imul(ah2,bl3)|0;hi=hi+Math.imul(ah2,bh3)|0;lo=lo+Math.imul(al1,bl4)|0;mid=mid+Math.imul(al1,bh4)|0;mid=mid+Math.imul(ah1,bl4)|0;hi=hi+Math.imul(ah1,bh4)|0;lo=lo+Math.imul(al0,bl5)|0;mid=mid+Math.imul(al0,bh5)|0;mid=mid+Math.imul(ah0,bl5)|0;hi=hi+Math.imul(ah0,bh5)|0;var w5=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w5>>>26)|0;w5&=67108863;lo=Math.imul(al6,bl0);mid=Math.imul(al6,bh0);mid=mid+Math.imul(ah6,bl0)|0;hi=Math.imul(ah6,bh0);lo=lo+Math.imul(al5,bl1)|0;mid=mid+Math.imul(al5,bh1)|0;mid=mid+Math.imul(ah5,bl1)|0;hi=hi+Math.imul(ah5,bh1)|0;lo=lo+Math.imul(al4,bl2)|0;mid=mid+Math.imul(al4,bh2)|0;mid=mid+Math.imul(ah4,bl2)|0;hi=hi+Math.imul(ah4,bh2)|0;lo=lo+Math.imul(al3,bl3)|0;mid=mid+Math.imul(al3,bh3)|0;mid=mid+Math.imul(ah3,bl3)|0;hi=hi+Math.imul(ah3,bh3)|0;lo=lo+Math.imul(al2,bl4)|0;mid=mid+Math.imul(al2,bh4)|0;mid=mid+Math.imul(ah2,bl4)|0;hi=hi+Math.imul(ah2,bh4)|0;lo=lo+Math.imul(al1,bl5)|0;mid=mid+Math.imul(al1,bh5)|0;mid=mid+Math.imul(ah1,bl5)|0;hi=hi+Math.imul(ah1,bh5)|0;lo=lo+Math.imul(al0,bl6)|0;mid=mid+Math.imul(al0,bh6)|0;mid=mid+Math.imul(ah0,bl6)|0;hi=hi+Math.imul(ah0,bh6)|0;var w6=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w6>>>26)|0;w6&=67108863;lo=Math.imul(al7,bl0);mid=Math.imul(al7,bh0);mid=mid+Math.imul(ah7,bl0)|0;hi=Math.imul(ah7,bh0);lo=lo+Math.imul(al6,bl1)|0;mid=mid+Math.imul(al6,bh1)|0;mid=mid+Math.imul(ah6,bl1)|0;hi=hi+Math.imul(ah6,bh1)|0;lo=lo+Math.imul(al5,bl2)|0;mid=mid+Math.imul(al5,bh2)|0;mid=mid+Math.imul(ah5,bl2)|0;hi=hi+Math.imul(ah5,bh2)|0;lo=lo+Math.imul(al4,bl3)|0;mid=mid+Math.imul(al4,bh3)|0;mid=mid+Math.imul(ah4,bl3)|0;hi=hi+Math.imul(ah4,bh3)|0;lo=lo+Math.imul(al3,bl4)|0;mid=mid+Math.imul(al3,bh4)|0;mid=mid+Math.imul(ah3,bl4)|0;hi=hi+Math.imul(ah3,bh4)|0;lo=lo+Math.imul(al2,bl5)|0;mid=mid+Math.imul(al2,bh5)|0;mid=mid+Math.imul(ah2,bl5)|0;hi=hi+Math.imul(ah2,bh5)|0;lo=lo+Math.imul(al1,bl6)|0;mid=mid+Math.imul(al1,bh6)|0;mid=mid+Math.imul(ah1,bl6)|0;hi=hi+Math.imul(ah1,bh6)|0;lo=lo+Math.imul(al0,bl7)|0;mid=mid+Math.imul(al0,bh7)|0;mid=mid+Math.imul(ah0,bl7)|0;hi=hi+Math.imul(ah0,bh7)|0;var w7=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w7>>>26)|0;w7&=67108863;lo=Math.imul(al8,bl0);mid=Math.imul(al8,bh0);mid=mid+Math.imul(ah8,bl0)|0;hi=Math.imul(ah8,bh0);lo=lo+Math.imul(al7,bl1)|0;mid=mid+Math.imul(al7,bh1)|0;mid=mid+Math.imul(ah7,bl1)|0;hi=hi+Math.imul(ah7,bh1)|0;lo=lo+Math.imul(al6,bl2)|0;mid=mid+Math.imul(al6,bh2)|0;mid=mid+Math.imul(ah6,bl2)|0;hi=hi+Math.imul(ah6,bh2)|0;lo=lo+Math.imul(al5,bl3)|0;mid=mid+Math.imul(al5,bh3)|0;mid=mid+Math.imul(ah5,bl3)|0;hi=hi+Math.imul(ah5,bh3)|0;lo=lo+Math.imul(al4,bl4)|0;mid=mid+Math.imul(al4,bh4)|0;mid=mid+Math.imul(ah4,bl4)|0;hi=hi+Math.imul(ah4,bh4)|0;lo=lo+Math.imul(al3,bl5)|0;mid=mid+Math.imul(al3,bh5)|0;mid=mid+Math.imul(ah3,bl5)|0;hi=hi+Math.imul(ah3,bh5)|0;lo=lo+Math.imul(al2,bl6)|0;mid=mid+Math.imul(al2,bh6)|0;mid=mid+Math.imul(ah2,bl6)|0;hi=hi+Math.imul(ah2,bh6)|0;lo=lo+Math.imul(al1,bl7)|0;mid=mid+Math.imul(al1,bh7)|0;mid=mid+Math.imul(ah1,bl7)|0;hi=hi+Math.imul(ah1,bh7)|0;lo=lo+Math.imul(al0,bl8)|0;mid=mid+Math.imul(al0,bh8)|0;mid=mid+Math.imul(ah0,bl8)|0;hi=hi+Math.imul(ah0,bh8)|0;var w8=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w8>>>26)|0;w8&=67108863;lo=Math.imul(al9,bl0);mid=Math.imul(al9,bh0);mid=mid+Math.imul(ah9,bl0)|0;hi=Math.imul(ah9,bh0);lo=lo+Math.imul(al8,bl1)|0;mid=mid+Math.imul(al8,bh1)|0;mid=mid+Math.imul(ah8,bl1)|0;hi=hi+Math.imul(ah8,bh1)|0;lo=lo+Math.imul(al7,bl2)|0;mid=mid+Math.imul(al7,bh2)|0;mid=mid+Math.imul(ah7,bl2)|0;hi=hi+Math.imul(ah7,bh2)|0;lo=lo+Math.imul(al6,bl3)|0;mid=mid+Math.imul(al6,bh3)|0;mid=mid+Math.imul(ah6,bl3)|0;hi=hi+Math.imul(ah6,bh3)|0;lo=lo+Math.imul(al5,bl4)|0;mid=mid+Math.imul(al5,bh4)|0;mid=mid+Math.imul(ah5,bl4)|0;hi=hi+Math.imul(ah5,bh4)|0;lo=lo+Math.imul(al4,bl5)|0;mid=mid+Math.imul(al4,bh5)|0;mid=mid+Math.imul(ah4,bl5)|0;hi=hi+Math.imul(ah4,bh5)|0;lo=lo+Math.imul(al3,bl6)|0;mid=mid+Math.imul(al3,bh6)|0;mid=mid+Math.imul(ah3,bl6)|0;hi=hi+Math.imul(ah3,bh6)|0;lo=lo+Math.imul(al2,bl7)|0;mid=mid+Math.imul(al2,bh7)|0;mid=mid+Math.imul(ah2,bl7)|0;hi=hi+Math.imul(ah2,bh7)|0;lo=lo+Math.imul(al1,bl8)|0;mid=mid+Math.imul(al1,bh8)|0;mid=mid+Math.imul(ah1,bl8)|0;hi=hi+Math.imul(ah1,bh8)|0;lo=lo+Math.imul(al0,bl9)|0;mid=mid+Math.imul(al0,bh9)|0;mid=mid+Math.imul(ah0,bl9)|0;hi=hi+Math.imul(ah0,bh9)|0;var w9=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w9>>>26)|0;w9&=67108863;lo=Math.imul(al9,bl1);mid=Math.imul(al9,bh1);mid=mid+Math.imul(ah9,bl1)|0;hi=Math.imul(ah9,bh1);lo=lo+Math.imul(al8,bl2)|0;mid=mid+Math.imul(al8,bh2)|0;mid=mid+Math.imul(ah8,bl2)|0;hi=hi+Math.imul(ah8,bh2)|0;lo=lo+Math.imul(al7,bl3)|0;mid=mid+Math.imul(al7,bh3)|0;mid=mid+Math.imul(ah7,bl3)|0;hi=hi+Math.imul(ah7,bh3)|0;lo=lo+Math.imul(al6,bl4)|0;mid=mid+Math.imul(al6,bh4)|0;mid=mid+Math.imul(ah6,bl4)|0;hi=hi+Math.imul(ah6,bh4)|0;lo=lo+Math.imul(al5,bl5)|0;mid=mid+Math.imul(al5,bh5)|0;mid=mid+Math.imul(ah5,bl5)|0;hi=hi+Math.imul(ah5,bh5)|0;lo=lo+Math.imul(al4,bl6)|0;mid=mid+Math.imul(al4,bh6)|0;mid=mid+Math.imul(ah4,bl6)|0;hi=hi+Math.imul(ah4,bh6)|0;lo=lo+Math.imul(al3,bl7)|0;mid=mid+Math.imul(al3,bh7)|0;mid=mid+Math.imul(ah3,bl7)|0;hi=hi+Math.imul(ah3,bh7)|0;lo=lo+Math.imul(al2,bl8)|0;mid=mid+Math.imul(al2,bh8)|0;mid=mid+Math.imul(ah2,bl8)|0;hi=hi+Math.imul(ah2,bh8)|0;lo=lo+Math.imul(al1,bl9)|0;mid=mid+Math.imul(al1,bh9)|0;mid=mid+Math.imul(ah1,bl9)|0;hi=hi+Math.imul(ah1,bh9)|0;var w10=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w10>>>26)|0;w10&=67108863;lo=Math.imul(al9,bl2);mid=Math.imul(al9,bh2);mid=mid+Math.imul(ah9,bl2)|0;hi=Math.imul(ah9,bh2);lo=lo+Math.imul(al8,bl3)|0;mid=mid+Math.imul(al8,bh3)|0;mid=mid+Math.imul(ah8,bl3)|0;hi=hi+Math.imul(ah8,bh3)|0;lo=lo+Math.imul(al7,bl4)|0;mid=mid+Math.imul(al7,bh4)|0;mid=mid+Math.imul(ah7,bl4)|0;hi=hi+Math.imul(ah7,bh4)|0;lo=lo+Math.imul(al6,bl5)|0;mid=mid+Math.imul(al6,bh5)|0;mid=mid+Math.imul(ah6,bl5)|0;hi=hi+Math.imul(ah6,bh5)|0;lo=lo+Math.imul(al5,bl6)|0;mid=mid+Math.imul(al5,bh6)|0;mid=mid+Math.imul(ah5,bl6)|0;hi=hi+Math.imul(ah5,bh6)|0;lo=lo+Math.imul(al4,bl7)|0;mid=mid+Math.imul(al4,bh7)|0;mid=mid+Math.imul(ah4,bl7)|0;hi=hi+Math.imul(ah4,bh7)|0;lo=lo+Math.imul(al3,bl8)|0;mid=mid+Math.imul(al3,bh8)|0;mid=mid+Math.imul(ah3,bl8)|0;hi=hi+Math.imul(ah3,bh8)|0;lo=lo+Math.imul(al2,bl9)|0;mid=mid+Math.imul(al2,bh9)|0;mid=mid+Math.imul(ah2,bl9)|0;hi=hi+Math.imul(ah2,bh9)|0;var w11=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w11>>>26)|0;w11&=67108863;lo=Math.imul(al9,bl3);mid=Math.imul(al9,bh3);mid=mid+Math.imul(ah9,bl3)|0;hi=Math.imul(ah9,bh3);lo=lo+Math.imul(al8,bl4)|0;mid=mid+Math.imul(al8,bh4)|0;mid=mid+Math.imul(ah8,bl4)|0;hi=hi+Math.imul(ah8,bh4)|0;lo=lo+Math.imul(al7,bl5)|0;mid=mid+Math.imul(al7,bh5)|0;mid=mid+Math.imul(ah7,bl5)|0;hi=hi+Math.imul(ah7,bh5)|0;lo=lo+Math.imul(al6,bl6)|0;mid=mid+Math.imul(al6,bh6)|0;mid=mid+Math.imul(ah6,bl6)|0;hi=hi+Math.imul(ah6,bh6)|0;lo=lo+Math.imul(al5,bl7)|0;mid=mid+Math.imul(al5,bh7)|0;mid=mid+Math.imul(ah5,bl7)|0;hi=hi+Math.imul(ah5,bh7)|0;lo=lo+Math.imul(al4,bl8)|0;mid=mid+Math.imul(al4,bh8)|0;mid=mid+Math.imul(ah4,bl8)|0;hi=hi+Math.imul(ah4,bh8)|0;lo=lo+Math.imul(al3,bl9)|0;mid=mid+Math.imul(al3,bh9)|0;mid=mid+Math.imul(ah3,bl9)|0;hi=hi+Math.imul(ah3,bh9)|0;var w12=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w12>>>26)|0;w12&=67108863;lo=Math.imul(al9,bl4);mid=Math.imul(al9,bh4);mid=mid+Math.imul(ah9,bl4)|0;hi=Math.imul(ah9,bh4);lo=lo+Math.imul(al8,bl5)|0;mid=mid+Math.imul(al8,bh5)|0;mid=mid+Math.imul(ah8,bl5)|0;hi=hi+Math.imul(ah8,bh5)|0;lo=lo+Math.imul(al7,bl6)|0;mid=mid+Math.imul(al7,bh6)|0;mid=mid+Math.imul(ah7,bl6)|0;hi=hi+Math.imul(ah7,bh6)|0;lo=lo+Math.imul(al6,bl7)|0;mid=mid+Math.imul(al6,bh7)|0;mid=mid+Math.imul(ah6,bl7)|0;hi=hi+Math.imul(ah6,bh7)|0;lo=lo+Math.imul(al5,bl8)|0;mid=mid+Math.imul(al5,bh8)|0;mid=mid+Math.imul(ah5,bl8)|0;hi=hi+Math.imul(ah5,bh8)|0;lo=lo+Math.imul(al4,bl9)|0;mid=mid+Math.imul(al4,bh9)|0;mid=mid+Math.imul(ah4,bl9)|0;hi=hi+Math.imul(ah4,bh9)|0;var w13=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w13>>>26)|0;w13&=67108863;lo=Math.imul(al9,bl5);mid=Math.imul(al9,bh5);mid=mid+Math.imul(ah9,bl5)|0;hi=Math.imul(ah9,bh5);lo=lo+Math.imul(al8,bl6)|0;mid=mid+Math.imul(al8,bh6)|0;mid=mid+Math.imul(ah8,bl6)|0;hi=hi+Math.imul(ah8,bh6)|0;lo=lo+Math.imul(al7,bl7)|0;mid=mid+Math.imul(al7,bh7)|0;mid=mid+Math.imul(ah7,bl7)|0;hi=hi+Math.imul(ah7,bh7)|0;lo=lo+Math.imul(al6,bl8)|0;mid=mid+Math.imul(al6,bh8)|0;mid=mid+Math.imul(ah6,bl8)|0;hi=hi+Math.imul(ah6,bh8)|0;lo=lo+Math.imul(al5,bl9)|0;mid=mid+Math.imul(al5,bh9)|0;mid=mid+Math.imul(ah5,bl9)|0;hi=hi+Math.imul(ah5,bh9)|0;var w14=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w14>>>26)|0;w14&=67108863;lo=Math.imul(al9,bl6);mid=Math.imul(al9,bh6);mid=mid+Math.imul(ah9,bl6)|0;hi=Math.imul(ah9,bh6);lo=lo+Math.imul(al8,bl7)|0;mid=mid+Math.imul(al8,bh7)|0;mid=mid+Math.imul(ah8,bl7)|0;hi=hi+Math.imul(ah8,bh7)|0;lo=lo+Math.imul(al7,bl8)|0;mid=mid+Math.imul(al7,bh8)|0;mid=mid+Math.imul(ah7,bl8)|0;hi=hi+Math.imul(ah7,bh8)|0;lo=lo+Math.imul(al6,bl9)|0;mid=mid+Math.imul(al6,bh9)|0;mid=mid+Math.imul(ah6,bl9)|0;hi=hi+Math.imul(ah6,bh9)|0;var w15=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w15>>>26)|0;w15&=67108863;lo=Math.imul(al9,bl7);mid=Math.imul(al9,bh7);mid=mid+Math.imul(ah9,bl7)|0;hi=Math.imul(ah9,bh7);lo=lo+Math.imul(al8,bl8)|0;mid=mid+Math.imul(al8,bh8)|0;mid=mid+Math.imul(ah8,bl8)|0;hi=hi+Math.imul(ah8,bh8)|0;lo=lo+Math.imul(al7,bl9)|0;mid=mid+Math.imul(al7,bh9)|0;mid=mid+Math.imul(ah7,bl9)|0;hi=hi+Math.imul(ah7,bh9)|0;var w16=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w16>>>26)|0;w16&=67108863;lo=Math.imul(al9,bl8);mid=Math.imul(al9,bh8);mid=mid+Math.imul(ah9,bl8)|0;hi=Math.imul(ah9,bh8);lo=lo+Math.imul(al8,bl9)|0;mid=mid+Math.imul(al8,bh9)|0;mid=mid+Math.imul(ah8,bl9)|0;hi=hi+Math.imul(ah8,bh9)|0;var w17=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w17>>>26)|0;w17&=67108863;lo=Math.imul(al9,bl9);mid=Math.imul(al9,bh9);mid=mid+Math.imul(ah9,bl9)|0;hi=Math.imul(ah9,bh9);var w18=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w18>>>26)|0;w18&=67108863;o[0]=w0;o[1]=w1;o[2]=w2;o[3]=w3;o[4]=w4;o[5]=w5;o[6]=w6;o[7]=w7;o[8]=w8;o[9]=w9;o[10]=w10;o[11]=w11;o[12]=w12;o[13]=w13;o[14]=w14;o[15]=w15;o[16]=w16;o[17]=w17;o[18]=w18;if(c!==0){o[19]=c;out.length++}return out};if(!Math.imul){comb10MulTo=smallMulTo}function bigMulTo(self,num,out){out.negative=num.negative^self.negative;out.length=self.length+num.length;var carry=0;var hncarry=0;for(var k=0;k<out.length-1;k++){var ncarry=hncarry;hncarry=0;var rword=carry&67108863;var maxJ=Math.min(k,num.length-1);for(var j=Math.max(0,k-self.length+1);j<=maxJ;j++){var i=k-j;var a=self.words[i]|0;var b=num.words[j]|0;var r=a*b;var lo=r&67108863;ncarry=ncarry+(r/67108864|0)|0;lo=lo+rword|0;rword=lo&67108863;ncarry=ncarry+(lo>>>26)|0;hncarry+=ncarry>>>26;ncarry&=67108863}out.words[k]=rword;carry=ncarry;ncarry=hncarry}if(carry!==0){out.words[k]=carry}else{out.length--}return out.strip()}function jumboMulTo(self,num,out){var fftm=new FFTM;return fftm.mulp(self,num,out)}BN.prototype.mulTo=function mulTo(num,out){var res;var len=this.length+num.length;if(this.length===10&&num.length===10){res=comb10MulTo(this,num,out)}else if(len<63){res=smallMulTo(this,num,out)}else if(len<1024){res=bigMulTo(this,num,out)}else{res=jumboMulTo(this,num,out)}return res};function FFTM(x,y){this.x=x;this.y=y}FFTM.prototype.makeRBT=function makeRBT(N){var t=new Array(N);var l=BN.prototype._countBits(N)-1;for(var i=0;i<N;i++){t[i]=this.revBin(i,l,N)}return t};FFTM.prototype.revBin=function revBin(x,l,N){if(x===0||x===N-1)return x;var rb=0;for(var i=0;i<l;i++){rb|=(x&1)<<l-i-1;x>>=1}return rb};FFTM.prototype.permute=function permute(rbt,rws,iws,rtws,itws,N){for(var i=0;i<N;i++){rtws[i]=rws[rbt[i]];itws[i]=iws[rbt[i]]}};FFTM.prototype.transform=function transform(rws,iws,rtws,itws,N,rbt){this.permute(rbt,rws,iws,rtws,itws,N);for(var s=1;s<N;s<<=1){var l=s<<1;var rtwdf=Math.cos(2*Math.PI/l);var itwdf=Math.sin(2*Math.PI/l);for(var p=0;p<N;p+=l){var rtwdf_=rtwdf;var itwdf_=itwdf;for(var j=0;j<s;j++){var re=rtws[p+j];var ie=itws[p+j];var ro=rtws[p+j+s];var io=itws[p+j+s];var rx=rtwdf_*ro-itwdf_*io;io=rtwdf_*io+itwdf_*ro;ro=rx;rtws[p+j]=re+ro;itws[p+j]=ie+io;rtws[p+j+s]=re-ro;itws[p+j+s]=ie-io;if(j!==l){rx=rtwdf*rtwdf_-itwdf*itwdf_;itwdf_=rtwdf*itwdf_+itwdf*rtwdf_;rtwdf_=rx}}}}};FFTM.prototype.guessLen13b=function guessLen13b(n,m){var N=Math.max(m,n)|1;var odd=N&1;var i=0;for(N=N/2|0;N;N=N>>>1){i++}return 1<<i+1+odd};FFTM.prototype.conjugate=function conjugate(rws,iws,N){if(N<=1)return;for(var i=0;i<N/2;i++){var t=rws[i];rws[i]=rws[N-i-1];rws[N-i-1]=t;t=iws[i];iws[i]=-iws[N-i-1];iws[N-i-1]=-t}};FFTM.prototype.normalize13b=function normalize13b(ws,N){var carry=0;for(var i=0;i<N/2;i++){var w=Math.round(ws[2*i+1]/N)*8192+Math.round(ws[2*i]/N)+carry;ws[i]=w&67108863;if(w<67108864){carry=0}else{carry=w/67108864|0}}return ws};FFTM.prototype.convert13b=function convert13b(ws,len,rws,N){var carry=0;for(var i=0;i<len;i++){carry=carry+(ws[i]|0);rws[2*i]=carry&8191;carry=carry>>>13;rws[2*i+1]=carry&8191;carry=carry>>>13}for(i=2*len;i<N;++i){rws[i]=0}assert(carry===0);assert((carry&~8191)===0)};FFTM.prototype.stub=function stub(N){var ph=new Array(N);for(var i=0;i<N;i++){ph[i]=0}return ph};FFTM.prototype.mulp=function mulp(x,y,out){var N=2*this.guessLen13b(x.length,y.length);var rbt=this.makeRBT(N);var _=this.stub(N);var rws=new Array(N);var rwst=new Array(N);var iwst=new Array(N);var nrws=new Array(N);var nrwst=new Array(N);var niwst=new Array(N);var rmws=out.words;rmws.length=N;this.convert13b(x.words,x.length,rws,N);this.convert13b(y.words,y.length,nrws,N);this.transform(rws,_,rwst,iwst,N,rbt);this.transform(nrws,_,nrwst,niwst,N,rbt);for(var i=0;i<N;i++){var rx=rwst[i]*nrwst[i]-iwst[i]*niwst[i];iwst[i]=rwst[i]*niwst[i]+iwst[i]*nrwst[i];rwst[i]=rx}this.conjugate(rwst,iwst,N);this.transform(rwst,iwst,rmws,_,N,rbt);this.conjugate(rmws,_,N);this.normalize13b(rmws,N);out.negative=x.negative^y.negative;out.length=x.length+y.length;return out.strip()};BN.prototype.mul=function mul(num){var out=new BN(null);out.words=new Array(this.length+num.length);return this.mulTo(num,out)};BN.prototype.mulf=function mulf(num){var out=new BN(null);out.words=new Array(this.length+num.length);return jumboMulTo(this,num,out)};BN.prototype.imul=function imul(num){return this.clone().mulTo(num,this)};BN.prototype.imuln=function imuln(num){assert(typeof num==="number");assert(num<67108864);var carry=0;for(var i=0;i<this.length;i++){var w=(this.words[i]|0)*num;var lo=(w&67108863)+(carry&67108863);carry>>=26;carry+=w/67108864|0;carry+=lo>>>26;this.words[i]=lo&67108863}if(carry!==0){this.words[i]=carry;this.length++}return this};BN.prototype.muln=function muln(num){return this.clone().imuln(num)};BN.prototype.sqr=function sqr(){return this.mul(this)};BN.prototype.isqr=function isqr(){return this.imul(this.clone())};BN.prototype.pow=function pow(num){var w=toBitArray(num);if(w.length===0)return new BN(1);var res=this;for(var i=0;i<w.length;i++,res=res.sqr()){if(w[i]!==0)break}if(++i<w.length){for(var q=res.sqr();i<w.length;i++,q=q.sqr()){if(w[i]===0)continue;res=res.mul(q)}}return res};BN.prototype.iushln=function iushln(bits){assert(typeof bits==="number"&&bits>=0);var r=bits%26;var s=(bits-r)/26;var carryMask=67108863>>>26-r<<26-r;var i;if(r!==0){var carry=0;for(i=0;i<this.length;i++){var newCarry=this.words[i]&carryMask;var c=(this.words[i]|0)-newCarry<<r;this.words[i]=c|carry;carry=newCarry>>>26-r}if(carry){this.words[i]=carry;this.length++}}if(s!==0){for(i=this.length-1;i>=0;i--){this.words[i+s]=this.words[i]}for(i=0;i<s;i++){this.words[i]=0}this.length+=s}return this.strip()};BN.prototype.ishln=function ishln(bits){assert(this.negative===0);return this.iushln(bits)};BN.prototype.iushrn=function iushrn(bits,hint,extended){assert(typeof bits==="number"&&bits>=0);var h;if(hint){h=(hint-hint%26)/26}else{h=0}var r=bits%26;var s=Math.min((bits-r)/26,this.length);var mask=67108863^67108863>>>r<<r;var maskedWords=extended;h-=s;h=Math.max(0,h);if(maskedWords){for(var i=0;i<s;i++){maskedWords.words[i]=this.words[i]}maskedWords.length=s}if(s===0){}else if(this.length>s){this.length-=s;for(i=0;i<this.length;i++){this.words[i]=this.words[i+s]}}else{this.words[0]=0;this.length=1}var carry=0;for(i=this.length-1;i>=0&&(carry!==0||i>=h);i--){var word=this.words[i]|0;this.words[i]=carry<<26-r|word>>>r;carry=word&mask}if(maskedWords&&carry!==0){maskedWords.words[maskedWords.length++]=carry}if(this.length===0){this.words[0]=0;this.length=1}return this.strip()};BN.prototype.ishrn=function ishrn(bits,hint,extended){assert(this.negative===0);return this.iushrn(bits,hint,extended)};BN.prototype.shln=function shln(bits){return this.clone().ishln(bits)};BN.prototype.ushln=function ushln(bits){return this.clone().iushln(bits)};BN.prototype.shrn=function shrn(bits){return this.clone().ishrn(bits)};BN.prototype.ushrn=function ushrn(bits){return this.clone().iushrn(bits)};BN.prototype.testn=function testn(bit){assert(typeof bit==="number"&&bit>=0);var r=bit%26;var s=(bit-r)/26;var q=1<<r;if(this.length<=s)return false;var w=this.words[s];return!!(w&q)};BN.prototype.imaskn=function imaskn(bits){assert(typeof bits==="number"&&bits>=0);var r=bits%26;var s=(bits-r)/26;assert(this.negative===0,"imaskn works only with positive numbers");if(this.length<=s){return this}if(r!==0){s++}this.length=Math.min(s,this.length);if(r!==0){var mask=67108863^67108863>>>r<<r;this.words[this.length-1]&=mask}return this.strip()};BN.prototype.maskn=function maskn(bits){return this.clone().imaskn(bits)};BN.prototype.iaddn=function iaddn(num){assert(typeof num==="number");assert(num<67108864);if(num<0)return this.isubn(-num);if(this.negative!==0){if(this.length===1&&(this.words[0]|0)<num){this.words[0]=num-(this.words[0]|0);this.negative=0;return this}this.negative=0;this.isubn(num);this.negative=1;return this}return this._iaddn(num)};BN.prototype._iaddn=function _iaddn(num){this.words[0]+=num;for(var i=0;i<this.length&&this.words[i]>=67108864;i++){this.words[i]-=67108864;if(i===this.length-1){this.words[i+1]=1}else{this.words[i+1]++}}this.length=Math.max(this.length,i+1);return this};BN.prototype.isubn=function isubn(num){assert(typeof num==="number");assert(num<67108864);if(num<0)return this.iaddn(-num);if(this.negative!==0){this.negative=0;this.iaddn(num);this.negative=1;return this}this.words[0]-=num;if(this.length===1&&this.words[0]<0){this.words[0]=-this.words[0];this.negative=1}else{for(var i=0;i<this.length&&this.words[i]<0;i++){this.words[i]+=67108864;this.words[i+1]-=1}}return this.strip()};BN.prototype.addn=function addn(num){return this.clone().iaddn(num)};BN.prototype.subn=function subn(num){return this.clone().isubn(num)};BN.prototype.iabs=function iabs(){this.negative=0;return this};BN.prototype.abs=function abs(){return this.clone().iabs()};BN.prototype._ishlnsubmul=function _ishlnsubmul(num,mul,shift){var len=num.length+shift;var i;this._expand(len);var w;var carry=0;for(i=0;i<num.length;i++){w=(this.words[i+shift]|0)+carry;var right=(num.words[i]|0)*mul;w-=right&67108863;carry=(w>>26)-(right/67108864|0);this.words[i+shift]=w&67108863}for(;i<this.length-shift;i++){w=(this.words[i+shift]|0)+carry;carry=w>>26;this.words[i+shift]=w&67108863}if(carry===0)return this.strip();assert(carry===-1);carry=0;for(i=0;i<this.length;i++){w=-(this.words[i]|0)+carry;carry=w>>26;this.words[i]=w&67108863}this.negative=1;return this.strip()};BN.prototype._wordDiv=function _wordDiv(num,mode){var shift=this.length-num.length;var a=this.clone();var b=num;var bhi=b.words[b.length-1]|0;var bhiBits=this._countBits(bhi);shift=26-bhiBits;if(shift!==0){b=b.ushln(shift);a.iushln(shift);bhi=b.words[b.length-1]|0}var m=a.length-b.length;var q;if(mode!=="mod"){q=new BN(null);q.length=m+1;q.words=new Array(q.length);for(var i=0;i<q.length;i++){q.words[i]=0}}var diff=a.clone()._ishlnsubmul(b,1,m);if(diff.negative===0){a=diff;if(q){q.words[m]=1}}for(var j=m-1;j>=0;j--){var qj=(a.words[b.length+j]|0)*67108864+(a.words[b.length+j-1]|0);qj=Math.min(qj/bhi|0,67108863);a._ishlnsubmul(b,qj,j);while(a.negative!==0){qj--;a.negative=0;a._ishlnsubmul(b,1,j);if(!a.isZero()){a.negative^=1}}if(q){q.words[j]=qj}}if(q){q.strip()}a.strip();if(mode!=="div"&&shift!==0){a.iushrn(shift)}return{div:q||null,mod:a}};BN.prototype.divmod=function divmod(num,mode,positive){assert(!num.isZero());if(this.isZero()){return{div:new BN(0),mod:new BN(0)}}var div,mod,res;if(this.negative!==0&&num.negative===0){res=this.neg().divmod(num,mode);if(mode!=="mod"){div=res.div.neg()}if(mode!=="div"){mod=res.mod.neg();if(positive&&mod.negative!==0){mod.iadd(num)}}return{div:div,mod:mod}}if(this.negative===0&&num.negative!==0){res=this.divmod(num.neg(),mode);if(mode!=="mod"){div=res.div.neg()}return{div:div,mod:res.mod}}if((this.negative&num.negative)!==0){res=this.neg().divmod(num.neg(),mode);if(mode!=="div"){mod=res.mod.neg();if(positive&&mod.negative!==0){mod.isub(num)}}return{div:res.div,mod:mod}}if(num.length>this.length||this.cmp(num)<0){return{div:new BN(0),mod:this}}if(num.length===1){if(mode==="div"){return{div:this.divn(num.words[0]),mod:null}}if(mode==="mod"){return{div:null,mod:new BN(this.modn(num.words[0]))}}return{div:this.divn(num.words[0]),mod:new BN(this.modn(num.words[0]))}}return this._wordDiv(num,mode)};BN.prototype.div=function div(num){return this.divmod(num,"div",false).div};BN.prototype.mod=function mod(num){return this.divmod(num,"mod",false).mod};BN.prototype.umod=function umod(num){return this.divmod(num,"mod",true).mod};BN.prototype.divRound=function divRound(num){var dm=this.divmod(num);if(dm.mod.isZero())return dm.div;var mod=dm.div.negative!==0?dm.mod.isub(num):dm.mod;var half=num.ushrn(1);var r2=num.andln(1);var cmp=mod.cmp(half);if(cmp<0||r2===1&&cmp===0)return dm.div;return dm.div.negative!==0?dm.div.isubn(1):dm.div.iaddn(1)};BN.prototype.modn=function modn(num){assert(num<=67108863);var p=(1<<26)%num;var acc=0;for(var i=this.length-1;i>=0;i--){acc=(p*acc+(this.words[i]|0))%num}return acc};BN.prototype.idivn=function idivn(num){assert(num<=67108863);var carry=0;for(var i=this.length-1;i>=0;i--){var w=(this.words[i]|0)+carry*67108864;this.words[i]=w/num|0;carry=w%num}return this.strip()};BN.prototype.divn=function divn(num){return this.clone().idivn(num)};BN.prototype.egcd=function egcd(p){assert(p.negative===0);assert(!p.isZero());var x=this;var y=p.clone();if(x.negative!==0){x=x.umod(p)}else{x=x.clone()}var A=new BN(1);var B=new BN(0);var C=new BN(0);var D=new BN(1);var g=0;while(x.isEven()&&y.isEven()){x.iushrn(1);y.iushrn(1);++g}var yp=y.clone();var xp=x.clone();while(!x.isZero()){for(var i=0,im=1;(x.words[0]&im)===0&&i<26;++i,im<<=1);if(i>0){x.iushrn(i);while(i-- >0){if(A.isOdd()||B.isOdd()){A.iadd(yp);B.isub(xp)}A.iushrn(1);B.iushrn(1)}}for(var j=0,jm=1;(y.words[0]&jm)===0&&j<26;++j,jm<<=1);if(j>0){y.iushrn(j);while(j-- >0){if(C.isOdd()||D.isOdd()){C.iadd(yp);D.isub(xp)}C.iushrn(1);D.iushrn(1)}}if(x.cmp(y)>=0){x.isub(y);A.isub(C);B.isub(D)}else{y.isub(x);C.isub(A);D.isub(B)}}return{a:C,b:D,gcd:y.iushln(g)}};BN.prototype._invmp=function _invmp(p){assert(p.negative===0);assert(!p.isZero());var a=this;var b=p.clone();if(a.negative!==0){a=a.umod(p)}else{a=a.clone()}var x1=new BN(1);var x2=new BN(0);var delta=b.clone();while(a.cmpn(1)>0&&b.cmpn(1)>0){for(var i=0,im=1;(a.words[0]&im)===0&&i<26;++i,im<<=1);if(i>0){a.iushrn(i);while(i-- >0){if(x1.isOdd()){x1.iadd(delta)}x1.iushrn(1)}}for(var j=0,jm=1;(b.words[0]&jm)===0&&j<26;++j,jm<<=1);if(j>0){b.iushrn(j);while(j-- >0){if(x2.isOdd()){x2.iadd(delta)}x2.iushrn(1)}}if(a.cmp(b)>=0){a.isub(b);x1.isub(x2)}else{b.isub(a);x2.isub(x1)}}var res;if(a.cmpn(1)===0){res=x1}else{res=x2}if(res.cmpn(0)<0){res.iadd(p)}return res};BN.prototype.gcd=function gcd(num){if(this.isZero())return num.abs();if(num.isZero())return this.abs();var a=this.clone();var b=num.clone();a.negative=0;b.negative=0;for(var shift=0;a.isEven()&&b.isEven();shift++){a.iushrn(1);b.iushrn(1)}do{while(a.isEven()){a.iushrn(1)}while(b.isEven()){b.iushrn(1)}var r=a.cmp(b);if(r<0){var t=a;a=b;b=t}else if(r===0||b.cmpn(1)===0){break}a.isub(b)}while(true);return b.iushln(shift)};BN.prototype.invm=function invm(num){return this.egcd(num).a.umod(num)};BN.prototype.isEven=function isEven(){return(this.words[0]&1)===0};BN.prototype.isOdd=function isOdd(){return(this.words[0]&1)===1};BN.prototype.andln=function andln(num){return this.words[0]&num};BN.prototype.bincn=function bincn(bit){assert(typeof bit==="number");var r=bit%26;var s=(bit-r)/26;var q=1<<r;if(this.length<=s){this._expand(s+1);this.words[s]|=q;return this}var carry=q;for(var i=s;carry!==0&&i<this.length;i++){var w=this.words[i]|0;w+=carry;carry=w>>>26;w&=67108863;this.words[i]=w}if(carry!==0){this.words[i]=carry;this.length++}return this};BN.prototype.isZero=function isZero(){return this.length===1&&this.words[0]===0};BN.prototype.cmpn=function cmpn(num){var negative=num<0;if(this.negative!==0&&!negative)return-1;if(this.negative===0&&negative)return 1;this.strip();var res;if(this.length>1){res=1}else{if(negative){num=-num}assert(num<=67108863,"Number is too big");var w=this.words[0]|0;res=w===num?0:w<num?-1:1}if(this.negative!==0)return-res|0;return res};BN.prototype.cmp=function cmp(num){if(this.negative!==0&&num.negative===0)return-1;if(this.negative===0&&num.negative!==0)return 1;var res=this.ucmp(num);if(this.negative!==0)return-res|0;return res};BN.prototype.ucmp=function ucmp(num){if(this.length>num.length)return 1;if(this.length<num.length)return-1;var res=0;for(var i=this.length-1;i>=0;i--){var a=this.words[i]|0;var b=num.words[i]|0;if(a===b)continue;if(a<b){res=-1}else if(a>b){res=1}break}return res};BN.prototype.gtn=function gtn(num){return this.cmpn(num)===1};BN.prototype.gt=function gt(num){return this.cmp(num)===1};BN.prototype.gten=function gten(num){return this.cmpn(num)>=0};BN.prototype.gte=function gte(num){return this.cmp(num)>=0};BN.prototype.ltn=function ltn(num){return this.cmpn(num)===-1};BN.prototype.lt=function lt(num){return this.cmp(num)===-1};BN.prototype.lten=function lten(num){return this.cmpn(num)<=0};BN.prototype.lte=function lte(num){return this.cmp(num)<=0};BN.prototype.eqn=function eqn(num){return this.cmpn(num)===0};BN.prototype.eq=function eq(num){return this.cmp(num)===0};BN.red=function red(num){return new Red(num)};BN.prototype.toRed=function toRed(ctx){assert(!this.red,"Already a number in reduction context");assert(this.negative===0,"red works only with positives");return ctx.convertTo(this)._forceRed(ctx)};BN.prototype.fromRed=function fromRed(){assert(this.red,"fromRed works only with numbers in reduction context");return this.red.convertFrom(this)};BN.prototype._forceRed=function _forceRed(ctx){this.red=ctx;return this};BN.prototype.forceRed=function forceRed(ctx){assert(!this.red,"Already a number in reduction context");return this._forceRed(ctx)};BN.prototype.redAdd=function redAdd(num){assert(this.red,"redAdd works only with red numbers");return this.red.add(this,num)};BN.prototype.redIAdd=function redIAdd(num){assert(this.red,"redIAdd works only with red numbers");return this.red.iadd(this,num)};BN.prototype.redSub=function redSub(num){assert(this.red,"redSub works only with red numbers");return this.red.sub(this,num)};BN.prototype.redISub=function redISub(num){assert(this.red,"redISub works only with red numbers");return this.red.isub(this,num)};BN.prototype.redShl=function redShl(num){assert(this.red,"redShl works only with red numbers");return this.red.shl(this,num)};BN.prototype.redMul=function redMul(num){assert(this.red,"redMul works only with red numbers");this.red._verify2(this,num);return this.red.mul(this,num)};BN.prototype.redIMul=function redIMul(num){assert(this.red,"redMul works only with red numbers");this.red._verify2(this,num);return this.red.imul(this,num)};BN.prototype.redSqr=function redSqr(){assert(this.red,"redSqr works only with red numbers");this.red._verify1(this);return this.red.sqr(this)};BN.prototype.redISqr=function redISqr(){assert(this.red,"redISqr works only with red numbers");this.red._verify1(this);return this.red.isqr(this)};BN.prototype.redSqrt=function redSqrt(){assert(this.red,"redSqrt works only with red numbers");this.red._verify1(this);return this.red.sqrt(this)};BN.prototype.redInvm=function redInvm(){assert(this.red,"redInvm works only with red numbers");this.red._verify1(this);return this.red.invm(this)};BN.prototype.redNeg=function redNeg(){assert(this.red,"redNeg works only with red numbers");this.red._verify1(this);return this.red.neg(this)};BN.prototype.redPow=function redPow(num){assert(this.red&&!num.red,"redPow(normalNum)");this.red._verify1(this);return this.red.pow(this,num)};var primes={k256:null,p224:null,p192:null,p25519:null};function MPrime(name,p){this.name=name;this.p=new BN(p,16);this.n=this.p.bitLength();this.k=new BN(1).iushln(this.n).isub(this.p);this.tmp=this._tmp()}MPrime.prototype._tmp=function _tmp(){var tmp=new BN(null);tmp.words=new Array(Math.ceil(this.n/13));return tmp};MPrime.prototype.ireduce=function ireduce(num){var r=num;var rlen;do{this.split(r,this.tmp);r=this.imulK(r);r=r.iadd(this.tmp);rlen=r.bitLength()}while(rlen>this.n);var cmp=rlen<this.n?-1:r.ucmp(this.p);if(cmp===0){r.words[0]=0;r.length=1}else if(cmp>0){r.isub(this.p)}else{if(r.strip!==undefined){r.strip()}else{r._strip()}}return r};MPrime.prototype.split=function split(input,out){input.iushrn(this.n,0,out)};MPrime.prototype.imulK=function imulK(num){return num.imul(this.k)};function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}inherits(K256,MPrime);K256.prototype.split=function split(input,output){var mask=4194303;var outLen=Math.min(input.length,9);for(var i=0;i<outLen;i++){output.words[i]=input.words[i]}output.length=outLen;if(input.length<=9){input.words[0]=0;input.length=1;return}var prev=input.words[9];output.words[output.length++]=prev&mask;for(i=10;i<input.length;i++){var next=input.words[i]|0;input.words[i-10]=(next&mask)<<4|prev>>>22;prev=next}prev>>>=22;input.words[i-10]=prev;if(prev===0&&input.length>10){input.length-=10}else{input.length-=9}};K256.prototype.imulK=function imulK(num){num.words[num.length]=0;num.words[num.length+1]=0;num.length+=2;var lo=0;for(var i=0;i<num.length;i++){var w=num.words[i]|0;lo+=w*977;num.words[i]=lo&67108863;lo=w*64+(lo/67108864|0)}if(num.words[num.length-1]===0){num.length--;if(num.words[num.length-1]===0){num.length--}}return num};function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}inherits(P224,MPrime);function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}inherits(P192,MPrime);function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}inherits(P25519,MPrime);P25519.prototype.imulK=function imulK(num){var carry=0;for(var i=0;i<num.length;i++){var hi=(num.words[i]|0)*19+carry;var lo=hi&67108863;hi>>>=26;num.words[i]=lo;carry=hi}if(carry!==0){num.words[num.length++]=carry}return num};BN._prime=function prime(name){if(primes[name])return primes[name];var prime;if(name==="k256"){prime=new K256}else if(name==="p224"){prime=new P224}else if(name==="p192"){prime=new P192}else if(name==="p25519"){prime=new P25519}else{throw new Error("Unknown prime "+name)}primes[name]=prime;return prime};function Red(m){if(typeof m==="string"){var prime=BN._prime(m);this.m=prime.p;this.prime=prime}else{assert(m.gtn(1),"modulus must be greater than 1");this.m=m;this.prime=null}}Red.prototype._verify1=function _verify1(a){assert(a.negative===0,"red works only with positives");assert(a.red,"red works only with red numbers")};Red.prototype._verify2=function _verify2(a,b){assert((a.negative|b.negative)===0,"red works only with positives");assert(a.red&&a.red===b.red,"red works only with red numbers")};Red.prototype.imod=function imod(a){if(this.prime)return this.prime.ireduce(a)._forceRed(this);return a.umod(this.m)._forceRed(this)};Red.prototype.neg=function neg(a){if(a.isZero()){return a.clone()}return this.m.sub(a)._forceRed(this)};Red.prototype.add=function add(a,b){this._verify2(a,b);var res=a.add(b);if(res.cmp(this.m)>=0){res.isub(this.m)}return res._forceRed(this)};Red.prototype.iadd=function iadd(a,b){this._verify2(a,b);var res=a.iadd(b);if(res.cmp(this.m)>=0){res.isub(this.m)}return res};Red.prototype.sub=function sub(a,b){this._verify2(a,b);var res=a.sub(b);if(res.cmpn(0)<0){res.iadd(this.m)}return res._forceRed(this)};Red.prototype.isub=function isub(a,b){this._verify2(a,b);var res=a.isub(b);if(res.cmpn(0)<0){res.iadd(this.m)}return res};Red.prototype.shl=function shl(a,num){this._verify1(a);return this.imod(a.ushln(num))};Red.prototype.imul=function imul(a,b){this._verify2(a,b);return this.imod(a.imul(b))};Red.prototype.mul=function mul(a,b){this._verify2(a,b);return this.imod(a.mul(b))};Red.prototype.isqr=function isqr(a){return this.imul(a,a.clone())};Red.prototype.sqr=function sqr(a){return this.mul(a,a)};Red.prototype.sqrt=function sqrt(a){if(a.isZero())return a.clone();var mod3=this.m.andln(3);assert(mod3%2===1);if(mod3===3){var pow=this.m.add(new BN(1)).iushrn(2);return this.pow(a,pow)}var q=this.m.subn(1);var s=0;while(!q.isZero()&&q.andln(1)===0){s++;q.iushrn(1)}assert(!q.isZero());var one=new BN(1).toRed(this);var nOne=one.redNeg();var lpow=this.m.subn(1).iushrn(1);var z=this.m.bitLength();z=new BN(2*z*z).toRed(this);while(this.pow(z,lpow).cmp(nOne)!==0){z.redIAdd(nOne)}var c=this.pow(z,q);var r=this.pow(a,q.addn(1).iushrn(1));var t=this.pow(a,q);var m=s;while(t.cmp(one)!==0){var tmp=t;for(var i=0;tmp.cmp(one)!==0;i++){tmp=tmp.redSqr()}assert(i<m);var b=this.pow(c,new BN(1).iushln(m-i-1));r=r.redMul(b);c=b.redSqr();t=t.redMul(c);m=i}return r};Red.prototype.invm=function invm(a){var inv=a._invmp(this.m);if(inv.negative!==0){inv.negative=0;return this.imod(inv).redNeg()}else{return this.imod(inv)}};Red.prototype.pow=function pow(a,num){if(num.isZero())return new BN(1).toRed(this);if(num.cmpn(1)===0)return a.clone();var windowSize=4;var wnd=new Array(1<<windowSize);wnd[0]=new BN(1).toRed(this);wnd[1]=a;for(var i=2;i<wnd.length;i++){wnd[i]=this.mul(wnd[i-1],a)}var res=wnd[0];var current=0;var currentLen=0;var start=num.bitLength()%26;if(start===0){start=26}for(i=num.length-1;i>=0;i--){var word=num.words[i];for(var j=start-1;j>=0;j--){var bit=word>>j&1;if(res!==wnd[0]){res=this.sqr(res)}if(bit===0&&current===0){currentLen=0;continue}current<<=1;current|=bit;currentLen++;if(currentLen!==windowSize&&(i!==0||j!==0))continue;res=this.mul(res,wnd[current]);currentLen=0;current=0}start=26}return res};Red.prototype.convertTo=function convertTo(num){var r=num.umod(this.m);return r===num?r.clone():r};Red.prototype.convertFrom=function convertFrom(num){var res=num.clone();res.red=null;return res};BN.mont=function mont(num){return new Mont(num)};function Mont(m){Red.call(this,m);this.shift=this.m.bitLength();if(this.shift%26!==0){this.shift+=26-this.shift%26}this.r=new BN(1).iushln(this.shift);this.r2=this.imod(this.r.sqr());this.rinv=this.r._invmp(this.m);this.minv=this.rinv.mul(this.r).isubn(1).div(this.m);this.minv=this.minv.umod(this.r);this.minv=this.r.sub(this.minv)}inherits(Mont,Red);Mont.prototype.convertTo=function convertTo(num){return this.imod(num.ushln(this.shift))};Mont.prototype.convertFrom=function convertFrom(num){var r=this.imod(num.mul(this.rinv));r.red=null;return r};Mont.prototype.imul=function imul(a,b){if(a.isZero()||b.isZero()){a.words[0]=0;a.length=1;return a}var t=a.imul(b);var c=t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);var u=t.isub(c).iushrn(this.shift);var res=u;if(u.cmp(this.m)>=0){res=u.isub(this.m)}else if(u.cmpn(0)<0){res=u.iadd(this.m)}return res._forceRed(this)};Mont.prototype.mul=function mul(a,b){if(a.isZero()||b.isZero())return new BN(0)._forceRed(this);var t=a.mul(b);var c=t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);var u=t.isub(c).iushrn(this.shift);var res=u;if(u.cmp(this.m)>=0){res=u.isub(this.m)}else if(u.cmpn(0)<0){res=u.iadd(this.m)}return res._forceRed(this)};Mont.prototype.invm=function invm(a){var res=this.imod(a._invmp(this.m).mul(this.r2));return res._forceRed(this)}})(typeof module==="undefined"||module,this)},{buffer:98}],97:[function(require,module,exports){var r;module.exports=function rand(len){if(!r)r=new Rand(null);return r.generate(len)};function Rand(rand){this.rand=rand}module.exports.Rand=Rand;Rand.prototype.generate=function generate(len){return this._rand(len)};Rand.prototype._rand=function _rand(n){if(this.rand.getBytes)return this.rand.getBytes(n);var res=new Uint8Array(n);for(var i=0;i<res.length;i++)res[i]=this.rand.getByte();return res};if(typeof self==="object"){if(self.crypto&&self.crypto.getRandomValues){Rand.prototype._rand=function _rand(n){var arr=new Uint8Array(n);self.crypto.getRandomValues(arr);return arr}}else if(self.msCrypto&&self.msCrypto.getRandomValues){Rand.prototype._rand=function _rand(n){var arr=new Uint8Array(n);self.msCrypto.getRandomValues(arr);return arr}}else if(typeof window==="object"){Rand.prototype._rand=function(){throw new Error("Not implemented yet")}}}else{try{var crypto=require("crypto");if(typeof crypto.randomBytes!=="function")throw new Error("Not supported");Rand.prototype._rand=function _rand(n){return crypto.randomBytes(n)}}catch(e){}}},{crypto:98}],98:[function(require,module,exports){},{}],99:[function(require,module,exports){(function(globalScope){"use strict";var MAX_DIGITS=1e9,Decimal={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},external=true,decimalError="[DecimalError] ",invalidArgument=decimalError+"Invalid argument: ",exponentOutOfRange=decimalError+"Exponent out of range: ",mathfloor=Math.floor,mathpow=Math.pow,isDecimal=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,ONE,BASE=1e7,LOG_BASE=7,MAX_SAFE_INTEGER=9007199254740991,MAX_E=mathfloor(MAX_SAFE_INTEGER/LOG_BASE),P={};P.absoluteValue=P.abs=function(){var x=new this.constructor(this);if(x.s)x.s=1;return x};P.comparedTo=P.cmp=function(y){var i,j,xdL,ydL,x=this;y=new x.constructor(y);if(x.s!==y.s)return x.s||-y.s;if(x.e!==y.e)return x.e>y.e^x.s<0?1:-1;xdL=x.d.length;ydL=y.d.length;for(i=0,j=xdL<ydL?xdL:ydL;i<j;++i){if(x.d[i]!==y.d[i])return x.d[i]>y.d[i]^x.s<0?1:-1}return xdL===ydL?0:xdL>ydL^x.s<0?1:-1};P.decimalPlaces=P.dp=function(){var x=this,w=x.d.length-1,dp=(w-x.e)*LOG_BASE;w=x.d[w];if(w)for(;w%10==0;w/=10)dp--;return dp<0?0:dp};P.dividedBy=P.div=function(y){return divide(this,new this.constructor(y))};P.dividedToIntegerBy=P.idiv=function(y){var x=this,Ctor=x.constructor;return round(divide(x,new Ctor(y),0,1),Ctor.precision)};P.equals=P.eq=function(y){return!this.cmp(y)};P.exponent=function(){return getBase10Exponent(this)};P.greaterThan=P.gt=function(y){return this.cmp(y)>0};P.greaterThanOrEqualTo=P.gte=function(y){return this.cmp(y)>=0};P.isInteger=P.isint=function(){return this.e>this.d.length-2};P.isNegative=P.isneg=function(){return this.s<0};P.isPositive=P.ispos=function(){return this.s>0};P.isZero=function(){return this.s===0};P.lessThan=P.lt=function(y){return this.cmp(y)<0};P.lessThanOrEqualTo=P.lte=function(y){return this.cmp(y)<1};P.logarithm=P.log=function(base){var r,x=this,Ctor=x.constructor,pr=Ctor.precision,wpr=pr+5;if(base===void 0){base=new Ctor(10)}else{base=new Ctor(base);if(base.s<1||base.eq(ONE))throw Error(decimalError+"NaN")}if(x.s<1)throw Error(decimalError+(x.s?"NaN":"-Infinity"));if(x.eq(ONE))return new Ctor(0);external=false;r=divide(ln(x,wpr),ln(base,wpr),wpr);external=true;return round(r,pr)};P.minus=P.sub=function(y){var x=this;y=new x.constructor(y);return x.s==y.s?subtract(x,y):add(x,(y.s=-y.s,y))};P.modulo=P.mod=function(y){var q,x=this,Ctor=x.constructor,pr=Ctor.precision;y=new Ctor(y);if(!y.s)throw Error(decimalError+"NaN");if(!x.s)return round(new Ctor(x),pr);external=false;q=divide(x,y,0,1).times(y);external=true;return x.minus(q)};P.naturalExponential=P.exp=function(){return exp(this)};P.naturalLogarithm=P.ln=function(){return ln(this)};P.negated=P.neg=function(){var x=new this.constructor(this);x.s=-x.s||0;return x};P.plus=P.add=function(y){var x=this;y=new x.constructor(y);return x.s==y.s?add(x,y):subtract(x,(y.s=-y.s,y))};P.precision=P.sd=function(z){var e,sd,w,x=this;if(z!==void 0&&z!==!!z&&z!==1&&z!==0)throw Error(invalidArgument+z);e=getBase10Exponent(x)+1;w=x.d.length-1;sd=w*LOG_BASE+1;w=x.d[w];if(w){for(;w%10==0;w/=10)sd--;for(w=x.d[0];w>=10;w/=10)sd++}return z&&e>sd?e:sd};P.squareRoot=P.sqrt=function(){var e,n,pr,r,s,t,wpr,x=this,Ctor=x.constructor;if(x.s<1){if(!x.s)return new Ctor(0);throw Error(decimalError+"NaN")}e=getBase10Exponent(x);external=false;s=Math.sqrt(+x);if(s==0||s==1/0){n=digitsToString(x.d);if((n.length+e)%2==0)n+="0";s=Math.sqrt(n);e=mathfloor((e+1)/2)-(e<0||e%2);if(s==1/0){n="1e"+e}else{n=s.toExponential();n=n.slice(0,n.indexOf("e")+1)+e}r=new Ctor(n)}else{r=new Ctor(s.toString())}pr=Ctor.precision;s=wpr=pr+3;for(;;){t=r;r=t.plus(divide(x,t,wpr+2)).times(.5);if(digitsToString(t.d).slice(0,wpr)===(n=digitsToString(r.d)).slice(0,wpr)){n=n.slice(wpr-3,wpr+1);if(s==wpr&&n=="4999"){round(t,pr+1,0);if(t.times(t).eq(x)){r=t;break}}else if(n!="9999"){break}wpr+=4}}external=true;return round(r,pr)};P.times=P.mul=function(y){var carry,e,i,k,r,rL,t,xdL,ydL,x=this,Ctor=x.constructor,xd=x.d,yd=(y=new Ctor(y)).d;if(!x.s||!y.s)return new Ctor(0);y.s*=x.s;e=x.e+y.e;xdL=xd.length;ydL=yd.length;if(xdL<ydL){r=xd;xd=yd;yd=r;rL=xdL;xdL=ydL;ydL=rL}r=[];rL=xdL+ydL;for(i=rL;i--;)r.push(0);for(i=ydL;--i>=0;){carry=0;for(k=xdL+i;k>i;){t=r[k]+yd[i]*xd[k-i-1]+carry;r[k--]=t%BASE|0;carry=t/BASE|0}r[k]=(r[k]+carry)%BASE|0}for(;!r[--rL];)r.pop();if(carry)++e;else r.shift();y.d=r;y.e=e;return external?round(y,Ctor.precision):y};P.toDecimalPlaces=P.todp=function(dp,rm){var x=this,Ctor=x.constructor;x=new Ctor(x);if(dp===void 0)return x;checkInt32(dp,0,MAX_DIGITS);if(rm===void 0)rm=Ctor.rounding;else checkInt32(rm,0,8);return round(x,dp+getBase10Exponent(x)+1,rm)};P.toExponential=function(dp,rm){var str,x=this,Ctor=x.constructor;if(dp===void 0){str=toString(x,true)}else{checkInt32(dp,0,MAX_DIGITS);if(rm===void 0)rm=Ctor.rounding;else checkInt32(rm,0,8);x=round(new Ctor(x),dp+1,rm);str=toString(x,true,dp+1)}return str};P.toFixed=function(dp,rm){var str,y,x=this,Ctor=x.constructor;if(dp===void 0)return toString(x);checkInt32(dp,0,MAX_DIGITS);if(rm===void 0)rm=Ctor.rounding;else checkInt32(rm,0,8);y=round(new Ctor(x),dp+getBase10Exponent(x)+1,rm);str=toString(y.abs(),false,dp+getBase10Exponent(y)+1);return x.isneg()&&!x.isZero()?"-"+str:str};P.toInteger=P.toint=function(){var x=this,Ctor=x.constructor;return round(new Ctor(x),getBase10Exponent(x)+1,Ctor.rounding)};P.toNumber=function(){return+this};P.toPower=P.pow=function(y){var e,k,pr,r,sign,yIsInt,x=this,Ctor=x.constructor,guard=12,yn=+(y=new Ctor(y));if(!y.s)return new Ctor(ONE);x=new Ctor(x);if(!x.s){if(y.s<1)throw Error(decimalError+"Infinity");return x}if(x.eq(ONE))return x;pr=Ctor.precision;if(y.eq(ONE))return round(x,pr);e=y.e;k=y.d.length-1;yIsInt=e>=k;sign=x.s;if(!yIsInt){if(sign<0)throw Error(decimalError+"NaN")}else if((k=yn<0?-yn:yn)<=MAX_SAFE_INTEGER){r=new Ctor(ONE);e=Math.ceil(pr/LOG_BASE+4);external=false;for(;;){if(k%2){r=r.times(x);truncate(r.d,e)}k=mathfloor(k/2);if(k===0)break;x=x.times(x);truncate(x.d,e)}external=true;return y.s<0?new Ctor(ONE).div(r):round(r,pr)}sign=sign<0&&y.d[Math.max(e,k)]&1?-1:1;x.s=1;external=false;r=y.times(ln(x,pr+guard));external=true;r=exp(r);r.s=sign;return r};P.toPrecision=function(sd,rm){var e,str,x=this,Ctor=x.constructor;if(sd===void 0){e=getBase10Exponent(x);str=toString(x,e<=Ctor.toExpNeg||e>=Ctor.toExpPos)}else{checkInt32(sd,1,MAX_DIGITS);if(rm===void 0)rm=Ctor.rounding;else checkInt32(rm,0,8);x=round(new Ctor(x),sd,rm);e=getBase10Exponent(x);str=toString(x,sd<=e||e<=Ctor.toExpNeg,sd)}return str};P.toSignificantDigits=P.tosd=function(sd,rm){var x=this,Ctor=x.constructor;if(sd===void 0){sd=Ctor.precision;rm=Ctor.rounding}else{checkInt32(sd,1,MAX_DIGITS);if(rm===void 0)rm=Ctor.rounding;else checkInt32(rm,0,8)}return round(new Ctor(x),sd,rm)};P.toString=P.valueOf=P.val=P.toJSON=function(){var x=this,e=getBase10Exponent(x),Ctor=x.constructor;return toString(x,e<=Ctor.toExpNeg||e>=Ctor.toExpPos)};function add(x,y){var carry,d,e,i,k,len,xd,yd,Ctor=x.constructor,pr=Ctor.precision;if(!x.s||!y.s){if(!y.s)y=new Ctor(x);return external?round(y,pr):y}xd=x.d;yd=y.d;k=x.e;e=y.e;xd=xd.slice();i=k-e;if(i){if(i<0){d=xd;i=-i;len=yd.length}else{d=yd;e=k;len=xd.length}k=Math.ceil(pr/LOG_BASE);len=k>len?k+1:len+1;if(i>len){i=len;d.length=1}d.reverse();for(;i--;)d.push(0);d.reverse()}len=xd.length;i=yd.length;if(len-i<0){i=len;d=yd;yd=xd;xd=d}for(carry=0;i;){carry=(xd[--i]=xd[i]+yd[i]+carry)/BASE|0;xd[i]%=BASE}if(carry){xd.unshift(carry);++e}for(len=xd.length;xd[--len]==0;)xd.pop();y.d=xd;y.e=e;return external?round(y,pr):y}function checkInt32(i,min,max){if(i!==~~i||i<min||i>max){throw Error(invalidArgument+i)}}function digitsToString(d){var i,k,ws,indexOfLastWord=d.length-1,str="",w=d[0];if(indexOfLastWord>0){str+=w;for(i=1;i<indexOfLastWord;i++){ws=d[i]+"";k=LOG_BASE-ws.length;if(k)str+=getZeroString(k);str+=ws}w=d[i];ws=w+"";k=LOG_BASE-ws.length;if(k)str+=getZeroString(k)}else if(w===0){return"0"}for(;w%10===0;)w/=10;return str+w}var divide=function(){function multiplyInteger(x,k){var temp,carry=0,i=x.length;for(x=x.slice();i--;){temp=x[i]*k+carry;x[i]=temp%BASE|0;carry=temp/BASE|0}if(carry)x.unshift(carry);return x}function compare(a,b,aL,bL){var i,r;if(aL!=bL){r=aL>bL?1:-1}else{for(i=r=0;i<aL;i++){if(a[i]!=b[i]){r=a[i]>b[i]?1:-1;break}}}return r}function subtract(a,b,aL){var i=0;for(;aL--;){a[aL]-=i;i=a[aL]<b[aL]?1:0;a[aL]=i*BASE+a[aL]-b[aL]}for(;!a[0]&&a.length>1;)a.shift()}return function(x,y,pr,dp){var cmp,e,i,k,prod,prodL,q,qd,rem,remL,rem0,sd,t,xi,xL,yd0,yL,yz,Ctor=x.constructor,sign=x.s==y.s?1:-1,xd=x.d,yd=y.d;if(!x.s)return new Ctor(x);if(!y.s)throw Error(decimalError+"Division by zero");e=x.e-y.e;yL=yd.length;xL=xd.length;q=new Ctor(sign);qd=q.d=[];for(i=0;yd[i]==(xd[i]||0);)++i;if(yd[i]>(xd[i]||0))--e;if(pr==null){sd=pr=Ctor.precision}else if(dp){sd=pr+(getBase10Exponent(x)-getBase10Exponent(y))+1}else{sd=pr}if(sd<0)return new Ctor(0);sd=sd/LOG_BASE+2|0;i=0;if(yL==1){k=0;yd=yd[0];sd++;for(;(i<xL||k)&&sd--;i++){t=k*BASE+(xd[i]||0);qd[i]=t/yd|0;k=t%yd|0}}else{k=BASE/(yd[0]+1)|0;if(k>1){yd=multiplyInteger(yd,k);xd=multiplyInteger(xd,k);yL=yd.length;xL=xd.length}xi=yL;rem=xd.slice(0,yL);remL=rem.length;for(;remL<yL;)rem[remL++]=0;yz=yd.slice();yz.unshift(0);yd0=yd[0];if(yd[1]>=BASE/2)++yd0;do{k=0;cmp=compare(yd,rem,yL,remL);if(cmp<0){rem0=rem[0];if(yL!=remL)rem0=rem0*BASE+(rem[1]||0);k=rem0/yd0|0;if(k>1){if(k>=BASE)k=BASE-1;prod=multiplyInteger(yd,k);prodL=prod.length;remL=rem.length;cmp=compare(prod,rem,prodL,remL);if(cmp==1){k--;subtract(prod,yL<prodL?yz:yd,prodL)}}else{if(k==0)cmp=k=1;prod=yd.slice()}prodL=prod.length;if(prodL<remL)prod.unshift(0);subtract(rem,prod,remL);if(cmp==-1){remL=rem.length;cmp=compare(yd,rem,yL,remL);if(cmp<1){k++;subtract(rem,yL<remL?yz:yd,remL)}}remL=rem.length}else if(cmp===0){k++;rem=[0]}qd[i++]=k;if(cmp&&rem[0]){rem[remL++]=xd[xi]||0}else{rem=[xd[xi]];remL=1}}while((xi++<xL||rem[0]!==void 0)&&sd--)}if(!qd[0])qd.shift();q.e=e;return round(q,dp?pr+getBase10Exponent(q)+1:pr)}}();function exp(x,sd){var denominator,guard,pow,sum,t,wpr,i=0,k=0,Ctor=x.constructor,pr=Ctor.precision;if(getBase10Exponent(x)>16)throw Error(exponentOutOfRange+getBase10Exponent(x));if(!x.s)return new Ctor(ONE);if(sd==null){external=false;wpr=pr}else{wpr=sd}t=new Ctor(.03125);while(x.abs().gte(.1)){x=x.times(t);k+=5}guard=Math.log(mathpow(2,k))/Math.LN10*2+5|0;wpr+=guard;denominator=pow=sum=new Ctor(ONE);Ctor.precision=wpr;for(;;){pow=round(pow.times(x),wpr);denominator=denominator.times(++i);t=sum.plus(divide(pow,denominator,wpr));if(digitsToString(t.d).slice(0,wpr)===digitsToString(sum.d).slice(0,wpr)){while(k--)sum=round(sum.times(sum),wpr);Ctor.precision=pr;return sd==null?(external=true,round(sum,pr)):sum}sum=t}}function getBase10Exponent(x){var e=x.e*LOG_BASE,w=x.d[0];for(;w>=10;w/=10)e++;return e}function getLn10(Ctor,sd,pr){if(sd>Ctor.LN10.sd()){external=true;if(pr)Ctor.precision=pr;throw Error(decimalError+"LN10 precision limit exceeded")}return round(new Ctor(Ctor.LN10),sd)}function getZeroString(k){var zs="";for(;k--;)zs+="0";return zs}function ln(y,sd){var c,c0,denominator,e,numerator,sum,t,wpr,x2,n=1,guard=10,x=y,xd=x.d,Ctor=x.constructor,pr=Ctor.precision;if(x.s<1)throw Error(decimalError+(x.s?"NaN":"-Infinity"));if(x.eq(ONE))return new Ctor(0);if(sd==null){external=false;wpr=pr}else{wpr=sd}if(x.eq(10)){if(sd==null)external=true;return getLn10(Ctor,wpr)}wpr+=guard;Ctor.precision=wpr;c=digitsToString(xd);c0=c.charAt(0);e=getBase10Exponent(x);if(Math.abs(e)<15e14){while(c0<7&&c0!=1||c0==1&&c.charAt(1)>3){x=x.times(y);c=digitsToString(x.d);c0=c.charAt(0);n++}e=getBase10Exponent(x);if(c0>1){x=new Ctor("0."+c);e++}else{x=new Ctor(c0+"."+c.slice(1))}}else{t=getLn10(Ctor,wpr+2,pr).times(e+"");x=ln(new Ctor(c0+"."+c.slice(1)),wpr-guard).plus(t);Ctor.precision=pr;return sd==null?(external=true,round(x,pr)):x}sum=numerator=x=divide(x.minus(ONE),x.plus(ONE),wpr);x2=round(x.times(x),wpr);denominator=3;for(;;){numerator=round(numerator.times(x2),wpr);t=sum.plus(divide(numerator,new Ctor(denominator),wpr));if(digitsToString(t.d).slice(0,wpr)===digitsToString(sum.d).slice(0,wpr)){sum=sum.times(2);if(e!==0)sum=sum.plus(getLn10(Ctor,wpr+2,pr).times(e+""));sum=divide(sum,new Ctor(n),wpr);Ctor.precision=pr;return sd==null?(external=true,round(sum,pr)):sum}sum=t;denominator+=2}}function parseDecimal(x,str){var e,i,len;if((e=str.indexOf("."))>-1)str=str.replace(".","");if((i=str.search(/e/i))>0){if(e<0)e=i;e+=+str.slice(i+1);str=str.substring(0,i)}else if(e<0){e=str.length}for(i=0;str.charCodeAt(i)===48;)++i;for(len=str.length;str.charCodeAt(len-1)===48;)--len;str=str.slice(i,len);if(str){len-=i;e=e-i-1;x.e=mathfloor(e/LOG_BASE);x.d=[];i=(e+1)%LOG_BASE;if(e<0)i+=LOG_BASE;if(i<len){if(i)x.d.push(+str.slice(0,i));for(len-=LOG_BASE;i<len;)x.d.push(+str.slice(i,i+=LOG_BASE));str=str.slice(i);i=LOG_BASE-str.length}else{i-=len}for(;i--;)str+="0";x.d.push(+str);if(external&&(x.e>MAX_E||x.e<-MAX_E))throw Error(exponentOutOfRange+e)}else{x.s=0;x.e=0;x.d=[0]}return x}function round(x,sd,rm){var i,j,k,n,rd,doRound,w,xdi,xd=x.d;for(n=1,k=xd[0];k>=10;k/=10)n++;i=sd-n;if(i<0){i+=LOG_BASE;j=sd;w=xd[xdi=0]}else{xdi=Math.ceil((i+1)/LOG_BASE);k=xd.length;if(xdi>=k)return x;w=k=xd[xdi];for(n=1;k>=10;k/=10)n++;i%=LOG_BASE;j=i-LOG_BASE+n}if(rm!==void 0){k=mathpow(10,n-j-1);rd=w/k%10|0;doRound=sd<0||xd[xdi+1]!==void 0||w%k;doRound=rm<4?(rd||doRound)&&(rm==0||rm==(x.s<0?3:2)):rd>5||rd==5&&(rm==4||doRound||rm==6&&(i>0?j>0?w/mathpow(10,n-j):0:xd[xdi-1])%10&1||rm==(x.s<0?8:7))}if(sd<1||!xd[0]){if(doRound){k=getBase10Exponent(x);xd.length=1;sd=sd-k-1;xd[0]=mathpow(10,(LOG_BASE-sd%LOG_BASE)%LOG_BASE);x.e=mathfloor(-sd/LOG_BASE)||0}else{xd.length=1;xd[0]=x.e=x.s=0}return x}if(i==0){xd.length=xdi;k=1;xdi--}else{xd.length=xdi+1;k=mathpow(10,LOG_BASE-i);xd[xdi]=j>0?(w/mathpow(10,n-j)%mathpow(10,j)|0)*k:0}if(doRound){for(;;){if(xdi==0){if((xd[0]+=k)==BASE){xd[0]=1;++x.e}break}else{xd[xdi]+=k;if(xd[xdi]!=BASE)break;xd[xdi--]=0;k=1}}}for(i=xd.length;xd[--i]===0;)xd.pop();if(external&&(x.e>MAX_E||x.e<-MAX_E)){throw Error(exponentOutOfRange+getBase10Exponent(x))}return x}function subtract(x,y){var d,e,i,j,k,len,xd,xe,xLTy,yd,Ctor=x.constructor,pr=Ctor.precision;if(!x.s||!y.s){if(y.s)y.s=-y.s;else y=new Ctor(x);return external?round(y,pr):y}xd=x.d;yd=y.d;e=y.e;xe=x.e;xd=xd.slice();k=xe-e;if(k){xLTy=k<0;if(xLTy){d=xd;k=-k;len=yd.length}else{d=yd;e=xe;len=xd.length}i=Math.max(Math.ceil(pr/LOG_BASE),len)+2;if(k>i){k=i;d.length=1}d.reverse();for(i=k;i--;)d.push(0);d.reverse()}else{i=xd.length;len=yd.length;xLTy=i<len;if(xLTy)len=i;for(i=0;i<len;i++){if(xd[i]!=yd[i]){xLTy=xd[i]<yd[i];break}}k=0}if(xLTy){d=xd;xd=yd;yd=d;y.s=-y.s}len=xd.length;for(i=yd.length-len;i>0;--i)xd[len++]=0;for(i=yd.length;i>k;){if(xd[--i]<yd[i]){for(j=i;j&&xd[--j]===0;)xd[j]=BASE-1;--xd[j];xd[i]+=BASE}xd[i]-=yd[i]}for(;xd[--len]===0;)xd.pop();for(;xd[0]===0;xd.shift())--e;if(!xd[0])return new Ctor(0);y.d=xd;y.e=e;return external?round(y,pr):y}function toString(x,isExp,sd){var k,e=getBase10Exponent(x),str=digitsToString(x.d),len=str.length;if(isExp){if(sd&&(k=sd-len)>0){str=str.charAt(0)+"."+str.slice(1)+getZeroString(k)}else if(len>1){str=str.charAt(0)+"."+str.slice(1)}str=str+(e<0?"e":"e+")+e}else if(e<0){str="0."+getZeroString(-e-1)+str;if(sd&&(k=sd-len)>0)str+=getZeroString(k)}else if(e>=len){str+=getZeroString(e+1-len);if(sd&&(k=sd-e-1)>0)str=str+"."+getZeroString(k)}else{if((k=e+1)<len)str=str.slice(0,k)+"."+str.slice(k);if(sd&&(k=sd-len)>0){if(e+1===len)str+=".";str+=getZeroString(k)}}return x.s<0?"-"+str:str}function truncate(arr,len){if(arr.length>len){arr.length=len;return true}}function clone(obj){var i,p,ps;function Decimal(value){var x=this;if(!(x instanceof Decimal))return new Decimal(value);x.constructor=Decimal;if(value instanceof Decimal){x.s=value.s;x.e=value.e;x.d=(value=value.d)?value.slice():value;return}if(typeof value==="number"){if(value*0!==0){throw Error(invalidArgument+value)}if(value>0){x.s=1}else if(value<0){value=-value;x.s=-1}else{x.s=0;x.e=0;x.d=[0];return}if(value===~~value&&value<1e7){x.e=0;x.d=[value];return}return parseDecimal(x,value.toString())}else if(typeof value!=="string"){throw Error(invalidArgument+value)}if(value.charCodeAt(0)===45){value=value.slice(1);x.s=-1}else{x.s=1}if(isDecimal.test(value))parseDecimal(x,value);else throw Error(invalidArgument+value)}Decimal.prototype=P;Decimal.ROUND_UP=0;Decimal.ROUND_DOWN=1;Decimal.ROUND_CEIL=2;Decimal.ROUND_FLOOR=3;Decimal.ROUND_HALF_UP=4;Decimal.ROUND_HALF_DOWN=5;Decimal.ROUND_HALF_EVEN=6;Decimal.ROUND_HALF_CEIL=7;Decimal.ROUND_HALF_FLOOR=8;Decimal.clone=clone;Decimal.config=Decimal.set=config;if(obj===void 0)obj={};if(obj){ps=["precision","rounding","toExpNeg","toExpPos","LN10"];for(i=0;i<ps.length;)if(!obj.hasOwnProperty(p=ps[i++]))obj[p]=this[p]}Decimal.config(obj);return Decimal}function config(obj){if(!obj||typeof obj!=="object"){throw Error(decimalError+"Object expected")}var i,p,v,ps=["precision",1,MAX_DIGITS,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(i=0;i<ps.length;i+=3){if((v=obj[p=ps[i]])!==void 0){if(mathfloor(v)===v&&v>=ps[i+1]&&v<=ps[i+2])this[p]=v;else throw Error(invalidArgument+p+": "+v)}}if((v=obj[p="LN10"])!==void 0){if(v==Math.LN10)this[p]=new this(v);else throw Error(invalidArgument+p+": "+v)}return this}Decimal=clone(Decimal);Decimal["default"]=Decimal.Decimal=Decimal;ONE=new Decimal(1);if(typeof define=="function"&&define.amd){define(function(){return Decimal})}else if(typeof module!="undefined"&&module.exports){module.exports=Decimal}else{if(!globalScope){globalScope=typeof self!="undefined"&&self&&self.self==self?self:Function("return this")()}globalScope.Decimal=Decimal}})(this)},{}],100:[function(require,module,exports){"use strict";var elliptic=exports;elliptic.version=require("../package.json").version;elliptic.utils=require("./elliptic/utils");elliptic.rand=require("brorand");elliptic.curve=require("./elliptic/curve");elliptic.curves=require("./elliptic/curves");elliptic.ec=require("./elliptic/ec");elliptic.eddsa=require("./elliptic/eddsa")},{"../package.json":115,"./elliptic/curve":103,"./elliptic/curves":106,"./elliptic/ec":107,"./elliptic/eddsa":110,"./elliptic/utils":114,brorand:97}],101:[function(require,module,exports){"use strict";var BN=require("bn.js");var utils=require("../utils");var getNAF=utils.getNAF;var getJSF=utils.getJSF;var assert=utils.assert;function BaseCurve(type,conf){this.type=type;this.p=new BN(conf.p,16);this.red=conf.prime?BN.red(conf.prime):BN.mont(this.p);this.zero=new BN(0).toRed(this.red);this.one=new BN(1).toRed(this.red);this.two=new BN(2).toRed(this.red);this.n=conf.n&&new BN(conf.n,16);this.g=conf.g&&this.pointFromJSON(conf.g,conf.gRed);this._wnafT1=new Array(4);this._wnafT2=new Array(4);this._wnafT3=new Array(4);this._wnafT4=new Array(4);this._bitLength=this.n?this.n.bitLength():0;var adjustCount=this.n&&this.p.div(this.n);if(!adjustCount||adjustCount.cmpn(100)>0){this.redN=null}else{this._maxwellTrick=true;this.redN=this.n.toRed(this.red)}}module.exports=BaseCurve;BaseCurve.prototype.point=function point(){throw new Error("Not implemented")};BaseCurve.prototype.validate=function validate(){throw new Error("Not implemented")};BaseCurve.prototype._fixedNafMul=function _fixedNafMul(p,k){assert(p.precomputed);var doubles=p._getDoubles();var naf=getNAF(k,1,this._bitLength);var I=(1<<doubles.step+1)-(doubles.step%2===0?2:1);I/=3;var repr=[];for(var j=0;j<naf.length;j+=doubles.step){var nafW=0;for(var k=j+doubles.step-1;k>=j;k--)nafW=(nafW<<1)+naf[k];repr.push(nafW)}var a=this.jpoint(null,null,null);var b=this.jpoint(null,null,null);for(var i=I;i>0;i--){for(var j=0;j<repr.length;j++){var nafW=repr[j];if(nafW===i)b=b.mixedAdd(doubles.points[j]);else if(nafW===-i)b=b.mixedAdd(doubles.points[j].neg())}a=a.add(b)}return a.toP()};BaseCurve.prototype._wnafMul=function _wnafMul(p,k){var w=4;var nafPoints=p._getNAFPoints(w);w=nafPoints.wnd;var wnd=nafPoints.points;var naf=getNAF(k,w,this._bitLength);var acc=this.jpoint(null,null,null);for(var i=naf.length-1;i>=0;i--){for(var k=0;i>=0&&naf[i]===0;i--)k++;if(i>=0)k++;acc=acc.dblp(k);if(i<0)break;var z=naf[i];assert(z!==0);if(p.type==="affine"){if(z>0)acc=acc.mixedAdd(wnd[z-1>>1]);else acc=acc.mixedAdd(wnd[-z-1>>1].neg())}else{if(z>0)acc=acc.add(wnd[z-1>>1]);else acc=acc.add(wnd[-z-1>>1].neg())}}return p.type==="affine"?acc.toP():acc};BaseCurve.prototype._wnafMulAdd=function _wnafMulAdd(defW,points,coeffs,len,jacobianResult){var wndWidth=this._wnafT1;var wnd=this._wnafT2;var naf=this._wnafT3;var max=0;for(var i=0;i<len;i++){var p=points[i];var nafPoints=p._getNAFPoints(defW);wndWidth[i]=nafPoints.wnd;wnd[i]=nafPoints.points}for(var i=len-1;i>=1;i-=2){var a=i-1;var b=i;if(wndWidth[a]!==1||wndWidth[b]!==1){naf[a]=getNAF(coeffs[a],wndWidth[a],this._bitLength);naf[b]=getNAF(coeffs[b],wndWidth[b],this._bitLength);max=Math.max(naf[a].length,max);max=Math.max(naf[b].length,max);continue}var comb=[points[a],null,null,points[b]];if(points[a].y.cmp(points[b].y)===0){comb[1]=points[a].add(points[b]);comb[2]=points[a].toJ().mixedAdd(points[b].neg())}else if(points[a].y.cmp(points[b].y.redNeg())===0){comb[1]=points[a].toJ().mixedAdd(points[b]);comb[2]=points[a].add(points[b].neg())}else{comb[1]=points[a].toJ().mixedAdd(points[b]);comb[2]=points[a].toJ().mixedAdd(points[b].neg())}var index=[-3,-1,-5,-7,0,7,5,1,3];var jsf=getJSF(coeffs[a],coeffs[b]);max=Math.max(jsf[0].length,max);naf[a]=new Array(max);naf[b]=new Array(max);for(var j=0;j<max;j++){var ja=jsf[0][j]|0;var jb=jsf[1][j]|0;naf[a][j]=index[(ja+1)*3+(jb+1)];naf[b][j]=0;wnd[a]=comb}}var acc=this.jpoint(null,null,null);var tmp=this._wnafT4;for(var i=max;i>=0;i--){var k=0;while(i>=0){var zero=true;for(var j=0;j<len;j++){tmp[j]=naf[j][i]|0;if(tmp[j]!==0)zero=false}if(!zero)break;k++;i--}if(i>=0)k++;acc=acc.dblp(k);if(i<0)break;for(var j=0;j<len;j++){var z=tmp[j];var p;if(z===0)continue;else if(z>0)p=wnd[j][z-1>>1];else if(z<0)p=wnd[j][-z-1>>1].neg();if(p.type==="affine")acc=acc.mixedAdd(p);else acc=acc.add(p)}}for(var i=0;i<len;i++)wnd[i]=null;if(jacobianResult)return acc;else return acc.toP()};function BasePoint(curve,type){this.curve=curve;this.type=type;this.precomputed=null}BaseCurve.BasePoint=BasePoint;BasePoint.prototype.eq=function eq(){throw new Error("Not implemented")};BasePoint.prototype.validate=function validate(){return this.curve.validate(this)};BaseCurve.prototype.decodePoint=function decodePoint(bytes,enc){bytes=utils.toArray(bytes,enc);var len=this.p.byteLength();if((bytes[0]===4||bytes[0]===6||bytes[0]===7)&&bytes.length-1===2*len){if(bytes[0]===6)assert(bytes[bytes.length-1]%2===0);else if(bytes[0]===7)assert(bytes[bytes.length-1]%2===1);var res=this.point(bytes.slice(1,1+len),bytes.slice(1+len,1+2*len));return res}else if((bytes[0]===2||bytes[0]===3)&&bytes.length-1===len){return this.pointFromX(bytes.slice(1,1+len),bytes[0]===3)}throw new Error("Unknown point format")};BasePoint.prototype.encodeCompressed=function encodeCompressed(enc){return this.encode(enc,true)};BasePoint.prototype._encode=function _encode(compact){var len=this.curve.p.byteLength();var x=this.getX().toArray("be",len);if(compact)return[this.getY().isEven()?2:3].concat(x);return[4].concat(x,this.getY().toArray("be",len))};BasePoint.prototype.encode=function encode(enc,compact){return utils.encode(this._encode(compact),enc)};BasePoint.prototype.precompute=function precompute(power){if(this.precomputed)return this;var precomputed={doubles:null,naf:null,beta:null};precomputed.naf=this._getNAFPoints(8);precomputed.doubles=this._getDoubles(4,power);precomputed.beta=this._getBeta();this.precomputed=precomputed;return this};BasePoint.prototype._hasDoubles=function _hasDoubles(k){if(!this.precomputed)return false;var doubles=this.precomputed.doubles;if(!doubles)return false;return doubles.points.length>=Math.ceil((k.bitLength()+1)/doubles.step)};BasePoint.prototype._getDoubles=function _getDoubles(step,power){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;var doubles=[this];var acc=this;for(var i=0;i<power;i+=step){for(var j=0;j<step;j++)acc=acc.dbl();doubles.push(acc)}return{step:step,points:doubles}};BasePoint.prototype._getNAFPoints=function _getNAFPoints(wnd){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;var res=[this];var max=(1<<wnd)-1;var dbl=max===1?null:this.dbl();for(var i=1;i<max;i++)res[i]=res[i-1].add(dbl);return{wnd:wnd,points:res}};BasePoint.prototype._getBeta=function _getBeta(){return null};BasePoint.prototype.dblp=function dblp(k){var r=this;for(var i=0;i<k;i++)r=r.dbl();return r}},{"../utils":114,"bn.js":96}],102:[function(require,module,exports){"use strict";var utils=require("../utils");var BN=require("bn.js");var inherits=require("inherits");var Base=require("./base");var assert=utils.assert;function EdwardsCurve(conf){this.twisted=(conf.a|0)!==1;this.mOneA=this.twisted&&(conf.a|0)===-1;this.extended=this.mOneA;Base.call(this,"edwards",conf);this.a=new BN(conf.a,16).umod(this.red.m);this.a=this.a.toRed(this.red);this.c=new BN(conf.c,16).toRed(this.red);this.c2=this.c.redSqr();this.d=new BN(conf.d,16).toRed(this.red);this.dd=this.d.redAdd(this.d);assert(!this.twisted||this.c.fromRed().cmpn(1)===0);this.oneC=(conf.c|0)===1}inherits(EdwardsCurve,Base);module.exports=EdwardsCurve;EdwardsCurve.prototype._mulA=function _mulA(num){if(this.mOneA)return num.redNeg();else return this.a.redMul(num)};EdwardsCurve.prototype._mulC=function _mulC(num){if(this.oneC)return num;else return this.c.redMul(num)};EdwardsCurve.prototype.jpoint=function jpoint(x,y,z,t){return this.point(x,y,z,t)};EdwardsCurve.prototype.pointFromX=function pointFromX(x,odd){x=new BN(x,16);if(!x.red)x=x.toRed(this.red);var x2=x.redSqr();var rhs=this.c2.redSub(this.a.redMul(x2));var lhs=this.one.redSub(this.c2.redMul(this.d).redMul(x2));var y2=rhs.redMul(lhs.redInvm());var y=y2.redSqrt();if(y.redSqr().redSub(y2).cmp(this.zero)!==0)throw new Error("invalid point");var isOdd=y.fromRed().isOdd();if(odd&&!isOdd||!odd&&isOdd)y=y.redNeg();return this.point(x,y)};EdwardsCurve.prototype.pointFromY=function pointFromY(y,odd){y=new BN(y,16);if(!y.red)y=y.toRed(this.red);var y2=y.redSqr();var lhs=y2.redSub(this.c2);var rhs=y2.redMul(this.d).redMul(this.c2).redSub(this.a);var x2=lhs.redMul(rhs.redInvm());if(x2.cmp(this.zero)===0){if(odd)throw new Error("invalid point");else return this.point(this.zero,y)}var x=x2.redSqrt();if(x.redSqr().redSub(x2).cmp(this.zero)!==0)throw new Error("invalid point");if(x.fromRed().isOdd()!==odd)x=x.redNeg();return this.point(x,y)};EdwardsCurve.prototype.validate=function validate(point){if(point.isInfinity())return true;point.normalize();var x2=point.x.redSqr();var y2=point.y.redSqr();var lhs=x2.redMul(this.a).redAdd(y2);var rhs=this.c2.redMul(this.one.redAdd(this.d.redMul(x2).redMul(y2)));return lhs.cmp(rhs)===0};function Point(curve,x,y,z,t){Base.BasePoint.call(this,curve,"projective");if(x===null&&y===null&&z===null){this.x=this.curve.zero;this.y=this.curve.one;this.z=this.curve.one;this.t=this.curve.zero;this.zOne=true}else{this.x=new BN(x,16);this.y=new BN(y,16);this.z=z?new BN(z,16):this.curve.one;this.t=t&&new BN(t,16);if(!this.x.red)this.x=this.x.toRed(this.curve.red);if(!this.y.red)this.y=this.y.toRed(this.curve.red);if(!this.z.red)this.z=this.z.toRed(this.curve.red);if(this.t&&!this.t.red)this.t=this.t.toRed(this.curve.red);this.zOne=this.z===this.curve.one;if(this.curve.extended&&!this.t){this.t=this.x.redMul(this.y);if(!this.zOne)this.t=this.t.redMul(this.z.redInvm())}}}inherits(Point,Base.BasePoint);EdwardsCurve.prototype.pointFromJSON=function pointFromJSON(obj){return Point.fromJSON(this,obj)};EdwardsCurve.prototype.point=function point(x,y,z,t){return new Point(this,x,y,z,t)};Point.fromJSON=function fromJSON(curve,obj){return new Point(curve,obj[0],obj[1],obj[2])};Point.prototype.inspect=function inspect(){if(this.isInfinity())return"<EC Point Infinity>";return"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"};Point.prototype.isInfinity=function isInfinity(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)};Point.prototype._extDbl=function _extDbl(){var a=this.x.redSqr();var b=this.y.redSqr();var c=this.z.redSqr();c=c.redIAdd(c);var d=this.curve._mulA(a);var e=this.x.redAdd(this.y).redSqr().redISub(a).redISub(b);var g=d.redAdd(b);var f=g.redSub(c);var h=d.redSub(b);var nx=e.redMul(f);var ny=g.redMul(h);var nt=e.redMul(h);var nz=f.redMul(g);return this.curve.point(nx,ny,nz,nt)};Point.prototype._projDbl=function _projDbl(){var b=this.x.redAdd(this.y).redSqr();var c=this.x.redSqr();var d=this.y.redSqr();var nx;var ny;var nz;if(this.curve.twisted){var e=this.curve._mulA(c);var f=e.redAdd(d);if(this.zOne){nx=b.redSub(c).redSub(d).redMul(f.redSub(this.curve.two));ny=f.redMul(e.redSub(d));nz=f.redSqr().redSub(f).redSub(f)}else{var h=this.z.redSqr();var j=f.redSub(h).redISub(h);nx=b.redSub(c).redISub(d).redMul(j);ny=f.redMul(e.redSub(d));nz=f.redMul(j)}}else{var e=c.redAdd(d);var h=this.curve._mulC(this.z).redSqr();var j=e.redSub(h).redSub(h);nx=this.curve._mulC(b.redISub(e)).redMul(j);ny=this.curve._mulC(e).redMul(c.redISub(d));nz=e.redMul(j)}return this.curve.point(nx,ny,nz)};Point.prototype.dbl=function dbl(){if(this.isInfinity())return this;if(this.curve.extended)return this._extDbl();else return this._projDbl()};Point.prototype._extAdd=function _extAdd(p){var a=this.y.redSub(this.x).redMul(p.y.redSub(p.x));var b=this.y.redAdd(this.x).redMul(p.y.redAdd(p.x));var c=this.t.redMul(this.curve.dd).redMul(p.t);var d=this.z.redMul(p.z.redAdd(p.z));var e=b.redSub(a);var f=d.redSub(c);var g=d.redAdd(c);var h=b.redAdd(a);var nx=e.redMul(f);var ny=g.redMul(h);var nt=e.redMul(h);var nz=f.redMul(g);return this.curve.point(nx,ny,nz,nt)};Point.prototype._projAdd=function _projAdd(p){var a=this.z.redMul(p.z);var b=a.redSqr();var c=this.x.redMul(p.x);var d=this.y.redMul(p.y);var e=this.curve.d.redMul(c).redMul(d);var f=b.redSub(e);var g=b.redAdd(e);var tmp=this.x.redAdd(this.y).redMul(p.x.redAdd(p.y)).redISub(c).redISub(d);var nx=a.redMul(f).redMul(tmp);var ny;var nz;if(this.curve.twisted){ny=a.redMul(g).redMul(d.redSub(this.curve._mulA(c)));nz=f.redMul(g)}else{ny=a.redMul(g).redMul(d.redSub(c));nz=this.curve._mulC(f).redMul(g)}return this.curve.point(nx,ny,nz)};Point.prototype.add=function add(p){if(this.isInfinity())return p;if(p.isInfinity())return this;if(this.curve.extended)return this._extAdd(p);else return this._projAdd(p)};Point.prototype.mul=function mul(k){if(this._hasDoubles(k))return this.curve._fixedNafMul(this,k);else return this.curve._wnafMul(this,k)};Point.prototype.mulAdd=function mulAdd(k1,p,k2){return this.curve._wnafMulAdd(1,[this,p],[k1,k2],2,false)};Point.prototype.jmulAdd=function jmulAdd(k1,p,k2){return this.curve._wnafMulAdd(1,[this,p],[k1,k2],2,true)};Point.prototype.normalize=function normalize(){if(this.zOne)return this;var zi=this.z.redInvm();this.x=this.x.redMul(zi);this.y=this.y.redMul(zi);if(this.t)this.t=this.t.redMul(zi);this.z=this.curve.one;this.zOne=true;return this};Point.prototype.neg=function neg(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())};Point.prototype.getX=function getX(){this.normalize();return this.x.fromRed()};Point.prototype.getY=function getY(){this.normalize();return this.y.fromRed()};Point.prototype.eq=function eq(other){return this===other||this.getX().cmp(other.getX())===0&&this.getY().cmp(other.getY())===0};Point.prototype.eqXToP=function eqXToP(x){var rx=x.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(rx)===0)return true;var xc=x.clone();var t=this.curve.redN.redMul(this.z);for(;;){xc.iadd(this.curve.n);if(xc.cmp(this.curve.p)>=0)return false;rx.redIAdd(t);if(this.x.cmp(rx)===0)return true}};Point.prototype.toP=Point.prototype.normalize;Point.prototype.mixedAdd=Point.prototype.add},{"../utils":114,"./base":101,"bn.js":96,inherits:129}],103:[function(require,module,exports){"use strict";var curve=exports;curve.base=require("./base");curve.short=require("./short");curve.mont=require("./mont");curve.edwards=require("./edwards")},{"./base":101,"./edwards":102,"./mont":104,"./short":105}],104:[function(require,module,exports){"use strict";var BN=require("bn.js");var inherits=require("inherits");var Base=require("./base");var utils=require("../utils");function MontCurve(conf){Base.call(this,"mont",conf);this.a=new BN(conf.a,16).toRed(this.red);this.b=new BN(conf.b,16).toRed(this.red);this.i4=new BN(4).toRed(this.red).redInvm();this.two=new BN(2).toRed(this.red);this.a24=this.i4.redMul(this.a.redAdd(this.two))}inherits(MontCurve,Base);module.exports=MontCurve;MontCurve.prototype.validate=function validate(point){var x=point.normalize().x;var x2=x.redSqr();var rhs=x2.redMul(x).redAdd(x2.redMul(this.a)).redAdd(x);var y=rhs.redSqrt();return y.redSqr().cmp(rhs)===0};function Point(curve,x,z){Base.BasePoint.call(this,curve,"projective");if(x===null&&z===null){this.x=this.curve.one;this.z=this.curve.zero}else{this.x=new BN(x,16);this.z=new BN(z,16);if(!this.x.red)this.x=this.x.toRed(this.curve.red);if(!this.z.red)this.z=this.z.toRed(this.curve.red)}}inherits(Point,Base.BasePoint);MontCurve.prototype.decodePoint=function decodePoint(bytes,enc){return this.point(utils.toArray(bytes,enc),1)};MontCurve.prototype.point=function point(x,z){return new Point(this,x,z)};MontCurve.prototype.pointFromJSON=function pointFromJSON(obj){return Point.fromJSON(this,obj)};Point.prototype.precompute=function precompute(){};Point.prototype._encode=function _encode(){return this.getX().toArray("be",this.curve.p.byteLength())};Point.fromJSON=function fromJSON(curve,obj){return new Point(curve,obj[0],obj[1]||curve.one)};Point.prototype.inspect=function inspect(){if(this.isInfinity())return"<EC Point Infinity>";return"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"};Point.prototype.isInfinity=function isInfinity(){return this.z.cmpn(0)===0};Point.prototype.dbl=function dbl(){var a=this.x.redAdd(this.z);var aa=a.redSqr();var b=this.x.redSub(this.z);var bb=b.redSqr();var c=aa.redSub(bb);var nx=aa.redMul(bb);var nz=c.redMul(bb.redAdd(this.curve.a24.redMul(c)));return this.curve.point(nx,nz)};Point.prototype.add=function add(){throw new Error("Not supported on Montgomery curve")};Point.prototype.diffAdd=function diffAdd(p,diff){var a=this.x.redAdd(this.z);var b=this.x.redSub(this.z);var c=p.x.redAdd(p.z);var d=p.x.redSub(p.z);var da=d.redMul(a);var cb=c.redMul(b);var nx=diff.z.redMul(da.redAdd(cb).redSqr());var nz=diff.x.redMul(da.redISub(cb).redSqr());return this.curve.point(nx,nz)};Point.prototype.mul=function mul(k){var t=k.clone();var a=this;var b=this.curve.point(null,null);var c=this;for(var bits=[];t.cmpn(0)!==0;t.iushrn(1))bits.push(t.andln(1));for(var i=bits.length-1;i>=0;i--){if(bits[i]===0){a=a.diffAdd(b,c);b=b.dbl()}else{b=a.diffAdd(b,c);a=a.dbl()}}return b};Point.prototype.mulAdd=function mulAdd(){throw new Error("Not supported on Montgomery curve")};Point.prototype.jumlAdd=function jumlAdd(){throw new Error("Not supported on Montgomery curve")};Point.prototype.eq=function eq(other){return this.getX().cmp(other.getX())===0};Point.prototype.normalize=function normalize(){this.x=this.x.redMul(this.z.redInvm());this.z=this.curve.one;return this};Point.prototype.getX=function getX(){this.normalize();return this.x.fromRed()}},{"../utils":114,"./base":101,"bn.js":96,inherits:129}],105:[function(require,module,exports){"use strict";var utils=require("../utils");var BN=require("bn.js");var inherits=require("inherits");var Base=require("./base");var assert=utils.assert;function ShortCurve(conf){Base.call(this,"short",conf);this.a=new BN(conf.a,16).toRed(this.red);this.b=new BN(conf.b,16).toRed(this.red);this.tinv=this.two.redInvm();this.zeroA=this.a.fromRed().cmpn(0)===0;this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0;this.endo=this._getEndomorphism(conf);this._endoWnafT1=new Array(4);this._endoWnafT2=new Array(4)}inherits(ShortCurve,Base);module.exports=ShortCurve;ShortCurve.prototype._getEndomorphism=function _getEndomorphism(conf){if(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)return;var beta;var lambda;if(conf.beta){beta=new BN(conf.beta,16).toRed(this.red)}else{var betas=this._getEndoRoots(this.p);beta=betas[0].cmp(betas[1])<0?betas[0]:betas[1];beta=beta.toRed(this.red)}if(conf.lambda){lambda=new BN(conf.lambda,16)}else{var lambdas=this._getEndoRoots(this.n);if(this.g.mul(lambdas[0]).x.cmp(this.g.x.redMul(beta))===0){lambda=lambdas[0]}else{lambda=lambdas[1];assert(this.g.mul(lambda).x.cmp(this.g.x.redMul(beta))===0)}}var basis;if(conf.basis){basis=conf.basis.map(function(vec){return{a:new BN(vec.a,16),b:new BN(vec.b,16)}})}else{basis=this._getEndoBasis(lambda)}return{beta:beta,lambda:lambda,basis:basis}};ShortCurve.prototype._getEndoRoots=function _getEndoRoots(num){var red=num===this.p?this.red:BN.mont(num);var tinv=new BN(2).toRed(red).redInvm();var ntinv=tinv.redNeg();var s=new BN(3).toRed(red).redNeg().redSqrt().redMul(tinv);var l1=ntinv.redAdd(s).fromRed();var l2=ntinv.redSub(s).fromRed();return[l1,l2]};ShortCurve.prototype._getEndoBasis=function _getEndoBasis(lambda){var aprxSqrt=this.n.ushrn(Math.floor(this.n.bitLength()/2));var u=lambda;var v=this.n.clone();var x1=new BN(1);var y1=new BN(0);var x2=new BN(0);var y2=new BN(1);var a0;var b0;var a1;var b1;var a2;var b2;var prevR;var i=0;var r;var x;while(u.cmpn(0)!==0){var q=v.div(u);r=v.sub(q.mul(u));x=x2.sub(q.mul(x1));var y=y2.sub(q.mul(y1));if(!a1&&r.cmp(aprxSqrt)<0){a0=prevR.neg();b0=x1;a1=r.neg();b1=x}else if(a1&&++i===2){break}prevR=r;v=u;u=r;x2=x1;x1=x;y2=y1;y1=y}a2=r.neg();b2=x;var len1=a1.sqr().add(b1.sqr());var len2=a2.sqr().add(b2.sqr());if(len2.cmp(len1)>=0){a2=a0;b2=b0}if(a1.negative){a1=a1.neg();b1=b1.neg()}if(a2.negative){a2=a2.neg();b2=b2.neg()}return[{a:a1,b:b1},{a:a2,b:b2}]};ShortCurve.prototype._endoSplit=function _endoSplit(k){var basis=this.endo.basis;var v1=basis[0];var v2=basis[1];var c1=v2.b.mul(k).divRound(this.n);var c2=v1.b.neg().mul(k).divRound(this.n);var p1=c1.mul(v1.a);var p2=c2.mul(v2.a);var q1=c1.mul(v1.b);var q2=c2.mul(v2.b);var k1=k.sub(p1).sub(p2);var k2=q1.add(q2).neg();return{k1:k1,k2:k2}};ShortCurve.prototype.pointFromX=function pointFromX(x,odd){x=new BN(x,16);if(!x.red)x=x.toRed(this.red);var y2=x.redSqr().redMul(x).redIAdd(x.redMul(this.a)).redIAdd(this.b);var y=y2.redSqrt();if(y.redSqr().redSub(y2).cmp(this.zero)!==0)throw new Error("invalid point");var isOdd=y.fromRed().isOdd();if(odd&&!isOdd||!odd&&isOdd)y=y.redNeg();return this.point(x,y)};ShortCurve.prototype.validate=function validate(point){if(point.inf)return true;var x=point.x;var y=point.y;var ax=this.a.redMul(x);var rhs=x.redSqr().redMul(x).redIAdd(ax).redIAdd(this.b);return y.redSqr().redISub(rhs).cmpn(0)===0};ShortCurve.prototype._endoWnafMulAdd=function _endoWnafMulAdd(points,coeffs,jacobianResult){var npoints=this._endoWnafT1;var ncoeffs=this._endoWnafT2;for(var i=0;i<points.length;i++){var split=this._endoSplit(coeffs[i]);var p=points[i];var beta=p._getBeta();if(split.k1.negative){split.k1.ineg();p=p.neg(true)}if(split.k2.negative){split.k2.ineg();beta=beta.neg(true)}npoints[i*2]=p;npoints[i*2+1]=beta;ncoeffs[i*2]=split.k1;ncoeffs[i*2+1]=split.k2}var res=this._wnafMulAdd(1,npoints,ncoeffs,i*2,jacobianResult);for(var j=0;j<i*2;j++){npoints[j]=null;ncoeffs[j]=null}return res};function Point(curve,x,y,isRed){Base.BasePoint.call(this,curve,"affine");if(x===null&&y===null){this.x=null;this.y=null;this.inf=true}else{this.x=new BN(x,16);this.y=new BN(y,16);if(isRed){this.x.forceRed(this.curve.red);this.y.forceRed(this.curve.red)}if(!this.x.red)this.x=this.x.toRed(this.curve.red);if(!this.y.red)this.y=this.y.toRed(this.curve.red);this.inf=false}}inherits(Point,Base.BasePoint);ShortCurve.prototype.point=function point(x,y,isRed){return new Point(this,x,y,isRed)};ShortCurve.prototype.pointFromJSON=function pointFromJSON(obj,red){return Point.fromJSON(this,obj,red)};Point.prototype._getBeta=function _getBeta(){if(!this.curve.endo)return;var pre=this.precomputed;if(pre&&pre.beta)return pre.beta;var beta=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(pre){var curve=this.curve;var endoMul=function(p){return curve.point(p.x.redMul(curve.endo.beta),p.y)};pre.beta=beta;beta.precomputed={beta:null,naf:pre.naf&&{wnd:pre.naf.wnd,points:pre.naf.points.map(endoMul)},doubles:pre.doubles&&{step:pre.doubles.step,points:pre.doubles.points.map(endoMul)}}}return beta};Point.prototype.toJSON=function toJSON(){if(!this.precomputed)return[this.x,this.y];return[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]};Point.fromJSON=function fromJSON(curve,obj,red){if(typeof obj==="string")obj=JSON.parse(obj);var res=curve.point(obj[0],obj[1],red);if(!obj[2])return res;function obj2point(obj){return curve.point(obj[0],obj[1],red)}var pre=obj[2];res.precomputed={beta:null,doubles:pre.doubles&&{step:pre.doubles.step,points:[res].concat(pre.doubles.points.map(obj2point))},naf:pre.naf&&{wnd:pre.naf.wnd,points:[res].concat(pre.naf.points.map(obj2point))}};return res};Point.prototype.inspect=function inspect(){if(this.isInfinity())return"<EC Point Infinity>";return"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"};Point.prototype.isInfinity=function isInfinity(){return this.inf};Point.prototype.add=function add(p){if(this.inf)return p;if(p.inf)return this;if(this.eq(p))return this.dbl();if(this.neg().eq(p))return this.curve.point(null,null);if(this.x.cmp(p.x)===0)return this.curve.point(null,null);var c=this.y.redSub(p.y);if(c.cmpn(0)!==0)c=c.redMul(this.x.redSub(p.x).redInvm());var nx=c.redSqr().redISub(this.x).redISub(p.x);var ny=c.redMul(this.x.redSub(nx)).redISub(this.y);return this.curve.point(nx,ny)};Point.prototype.dbl=function dbl(){if(this.inf)return this;var ys1=this.y.redAdd(this.y);if(ys1.cmpn(0)===0)return this.curve.point(null,null);var a=this.curve.a;var x2=this.x.redSqr();var dyinv=ys1.redInvm();var c=x2.redAdd(x2).redIAdd(x2).redIAdd(a).redMul(dyinv);var nx=c.redSqr().redISub(this.x.redAdd(this.x));var ny=c.redMul(this.x.redSub(nx)).redISub(this.y);return this.curve.point(nx,ny)};Point.prototype.getX=function getX(){return this.x.fromRed()};Point.prototype.getY=function getY(){return this.y.fromRed()};Point.prototype.mul=function mul(k){k=new BN(k,16);if(this.isInfinity())return this;else if(this._hasDoubles(k))return this.curve._fixedNafMul(this,k);else if(this.curve.endo)return this.curve._endoWnafMulAdd([this],[k]);else return this.curve._wnafMul(this,k)};Point.prototype.mulAdd=function mulAdd(k1,p2,k2){var points=[this,p2];var coeffs=[k1,k2];if(this.curve.endo)return this.curve._endoWnafMulAdd(points,coeffs);else return this.curve._wnafMulAdd(1,points,coeffs,2)};Point.prototype.jmulAdd=function jmulAdd(k1,p2,k2){var points=[this,p2];var coeffs=[k1,k2];if(this.curve.endo)return this.curve._endoWnafMulAdd(points,coeffs,true);else return this.curve._wnafMulAdd(1,points,coeffs,2,true)};Point.prototype.eq=function eq(p){return this===p||this.inf===p.inf&&(this.inf||this.x.cmp(p.x)===0&&this.y.cmp(p.y)===0)};Point.prototype.neg=function neg(_precompute){if(this.inf)return this;var res=this.curve.point(this.x,this.y.redNeg());if(_precompute&&this.precomputed){var pre=this.precomputed;var negate=function(p){return p.neg()};res.precomputed={naf:pre.naf&&{wnd:pre.naf.wnd,points:pre.naf.points.map(negate)},doubles:pre.doubles&&{step:pre.doubles.step,points:pre.doubles.points.map(negate)}}}return res};Point.prototype.toJ=function toJ(){if(this.inf)return this.curve.jpoint(null,null,null);var res=this.curve.jpoint(this.x,this.y,this.curve.one);return res};function JPoint(curve,x,y,z){Base.BasePoint.call(this,curve,"jacobian");if(x===null&&y===null&&z===null){this.x=this.curve.one;this.y=this.curve.one;this.z=new BN(0)}else{this.x=new BN(x,16);this.y=new BN(y,16);this.z=new BN(z,16)}if(!this.x.red)this.x=this.x.toRed(this.curve.red);if(!this.y.red)this.y=this.y.toRed(this.curve.red);if(!this.z.red)this.z=this.z.toRed(this.curve.red);this.zOne=this.z===this.curve.one}inherits(JPoint,Base.BasePoint);ShortCurve.prototype.jpoint=function jpoint(x,y,z){return new JPoint(this,x,y,z)};JPoint.prototype.toP=function toP(){if(this.isInfinity())return this.curve.point(null,null);var zinv=this.z.redInvm();var zinv2=zinv.redSqr();var ax=this.x.redMul(zinv2);var ay=this.y.redMul(zinv2).redMul(zinv);return this.curve.point(ax,ay)};JPoint.prototype.neg=function neg(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};JPoint.prototype.add=function add(p){if(this.isInfinity())return p;if(p.isInfinity())return this;var pz2=p.z.redSqr();var z2=this.z.redSqr();var u1=this.x.redMul(pz2);var u2=p.x.redMul(z2);var s1=this.y.redMul(pz2.redMul(p.z));var s2=p.y.redMul(z2.redMul(this.z));var h=u1.redSub(u2);var r=s1.redSub(s2);if(h.cmpn(0)===0){if(r.cmpn(0)!==0)return this.curve.jpoint(null,null,null);else return this.dbl()}var h2=h.redSqr();var h3=h2.redMul(h);var v=u1.redMul(h2);var nx=r.redSqr().redIAdd(h3).redISub(v).redISub(v);var ny=r.redMul(v.redISub(nx)).redISub(s1.redMul(h3));var nz=this.z.redMul(p.z).redMul(h);return this.curve.jpoint(nx,ny,nz)};JPoint.prototype.mixedAdd=function mixedAdd(p){if(this.isInfinity())return p.toJ();if(p.isInfinity())return this;var z2=this.z.redSqr();var u1=this.x;var u2=p.x.redMul(z2);var s1=this.y;var s2=p.y.redMul(z2).redMul(this.z);var h=u1.redSub(u2);var r=s1.redSub(s2);if(h.cmpn(0)===0){if(r.cmpn(0)!==0)return this.curve.jpoint(null,null,null);else return this.dbl()}var h2=h.redSqr();var h3=h2.redMul(h);var v=u1.redMul(h2);var nx=r.redSqr().redIAdd(h3).redISub(v).redISub(v);var ny=r.redMul(v.redISub(nx)).redISub(s1.redMul(h3));var nz=this.z.redMul(h);return this.curve.jpoint(nx,ny,nz)};JPoint.prototype.dblp=function dblp(pow){if(pow===0)return this;if(this.isInfinity())return this;if(!pow)return this.dbl();if(this.curve.zeroA||this.curve.threeA){var r=this;for(var i=0;i<pow;i++)r=r.dbl();return r}var a=this.curve.a;var tinv=this.curve.tinv;var jx=this.x;var jy=this.y;var jz=this.z;var jz4=jz.redSqr().redSqr();var jyd=jy.redAdd(jy);for(var i=0;i<pow;i++){var jx2=jx.redSqr();var jyd2=jyd.redSqr();var jyd4=jyd2.redSqr();var c=jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4));var t1=jx.redMul(jyd2);var nx=c.redSqr().redISub(t1.redAdd(t1));var t2=t1.redISub(nx);var dny=c.redMul(t2);dny=dny.redIAdd(dny).redISub(jyd4);var nz=jyd.redMul(jz);if(i+1<pow)jz4=jz4.redMul(jyd4);jx=nx;jz=nz;jyd=dny}return this.curve.jpoint(jx,jyd.redMul(tinv),jz)};JPoint.prototype.dbl=function dbl(){if(this.isInfinity())return this;if(this.curve.zeroA)return this._zeroDbl();else if(this.curve.threeA)return this._threeDbl();else return this._dbl()};JPoint.prototype._zeroDbl=function _zeroDbl(){var nx;var ny;var nz;if(this.zOne){var xx=this.x.redSqr();var yy=this.y.redSqr();var yyyy=yy.redSqr();var s=this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);s=s.redIAdd(s);var m=xx.redAdd(xx).redIAdd(xx);var t=m.redSqr().redISub(s).redISub(s);var yyyy8=yyyy.redIAdd(yyyy);yyyy8=yyyy8.redIAdd(yyyy8);yyyy8=yyyy8.redIAdd(yyyy8);nx=t;ny=m.redMul(s.redISub(t)).redISub(yyyy8);nz=this.y.redAdd(this.y)}else{var a=this.x.redSqr();var b=this.y.redSqr();var c=b.redSqr();var d=this.x.redAdd(b).redSqr().redISub(a).redISub(c);d=d.redIAdd(d);var e=a.redAdd(a).redIAdd(a);var f=e.redSqr();var c8=c.redIAdd(c);c8=c8.redIAdd(c8);c8=c8.redIAdd(c8);nx=f.redISub(d).redISub(d);ny=e.redMul(d.redISub(nx)).redISub(c8);nz=this.y.redMul(this.z);nz=nz.redIAdd(nz)}return this.curve.jpoint(nx,ny,nz)};JPoint.prototype._threeDbl=function _threeDbl(){var nx;var ny;var nz;if(this.zOne){var xx=this.x.redSqr();var yy=this.y.redSqr();var yyyy=yy.redSqr();var s=this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);s=s.redIAdd(s);var m=xx.redAdd(xx).redIAdd(xx).redIAdd(this.curve.a);var t=m.redSqr().redISub(s).redISub(s);nx=t;var yyyy8=yyyy.redIAdd(yyyy);yyyy8=yyyy8.redIAdd(yyyy8);yyyy8=yyyy8.redIAdd(yyyy8);ny=m.redMul(s.redISub(t)).redISub(yyyy8);nz=this.y.redAdd(this.y)}else{var delta=this.z.redSqr();var gamma=this.y.redSqr();var beta=this.x.redMul(gamma);var alpha=this.x.redSub(delta).redMul(this.x.redAdd(delta));alpha=alpha.redAdd(alpha).redIAdd(alpha);var beta4=beta.redIAdd(beta);beta4=beta4.redIAdd(beta4);var beta8=beta4.redAdd(beta4);nx=alpha.redSqr().redISub(beta8);nz=this.y.redAdd(this.z).redSqr().redISub(gamma).redISub(delta);var ggamma8=gamma.redSqr();ggamma8=ggamma8.redIAdd(ggamma8);ggamma8=ggamma8.redIAdd(ggamma8);ggamma8=ggamma8.redIAdd(ggamma8);ny=alpha.redMul(beta4.redISub(nx)).redISub(ggamma8)}return this.curve.jpoint(nx,ny,nz)};JPoint.prototype._dbl=function _dbl(){var a=this.curve.a;var jx=this.x;var jy=this.y;var jz=this.z;var jz4=jz.redSqr().redSqr();var jx2=jx.redSqr();var jy2=jy.redSqr();var c=jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4));var jxd4=jx.redAdd(jx);jxd4=jxd4.redIAdd(jxd4);var t1=jxd4.redMul(jy2);var nx=c.redSqr().redISub(t1.redAdd(t1));var t2=t1.redISub(nx);var jyd8=jy2.redSqr();jyd8=jyd8.redIAdd(jyd8);jyd8=jyd8.redIAdd(jyd8);jyd8=jyd8.redIAdd(jyd8);var ny=c.redMul(t2).redISub(jyd8);var nz=jy.redAdd(jy).redMul(jz);return this.curve.jpoint(nx,ny,nz)};JPoint.prototype.trpl=function trpl(){if(!this.curve.zeroA)return this.dbl().add(this);var xx=this.x.redSqr();var yy=this.y.redSqr();var zz=this.z.redSqr();var yyyy=yy.redSqr();var m=xx.redAdd(xx).redIAdd(xx);var mm=m.redSqr();var e=this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);e=e.redIAdd(e);e=e.redAdd(e).redIAdd(e);e=e.redISub(mm);var ee=e.redSqr();var t=yyyy.redIAdd(yyyy);t=t.redIAdd(t);t=t.redIAdd(t);t=t.redIAdd(t);var u=m.redIAdd(e).redSqr().redISub(mm).redISub(ee).redISub(t);var yyu4=yy.redMul(u);yyu4=yyu4.redIAdd(yyu4);yyu4=yyu4.redIAdd(yyu4);var nx=this.x.redMul(ee).redISub(yyu4);nx=nx.redIAdd(nx);nx=nx.redIAdd(nx);var ny=this.y.redMul(u.redMul(t.redISub(u)).redISub(e.redMul(ee)));ny=ny.redIAdd(ny);ny=ny.redIAdd(ny);ny=ny.redIAdd(ny);var nz=this.z.redAdd(e).redSqr().redISub(zz).redISub(ee);return this.curve.jpoint(nx,ny,nz)};JPoint.prototype.mul=function mul(k,kbase){k=new BN(k,kbase);return this.curve._wnafMul(this,k)};JPoint.prototype.eq=function eq(p){if(p.type==="affine")return this.eq(p.toJ());if(this===p)return true;var z2=this.z.redSqr();var pz2=p.z.redSqr();if(this.x.redMul(pz2).redISub(p.x.redMul(z2)).cmpn(0)!==0)return false;var z3=z2.redMul(this.z);var pz3=pz2.redMul(p.z);return this.y.redMul(pz3).redISub(p.y.redMul(z3)).cmpn(0)===0};JPoint.prototype.eqXToP=function eqXToP(x){var zs=this.z.redSqr();var rx=x.toRed(this.curve.red).redMul(zs);if(this.x.cmp(rx)===0)return true;var xc=x.clone();var t=this.curve.redN.redMul(zs);for(;;){xc.iadd(this.curve.n);if(xc.cmp(this.curve.p)>=0)return false;rx.redIAdd(t);if(this.x.cmp(rx)===0)return true}};JPoint.prototype.inspect=function inspect(){if(this.isInfinity())return"<EC JPoint Infinity>";return"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"};JPoint.prototype.isInfinity=function isInfinity(){return this.z.cmpn(0)===0}},{"../utils":114,"./base":101,"bn.js":96,inherits:129}],106:[function(require,module,exports){"use strict";var curves=exports;var hash=require("hash.js");var curve=require("./curve");var utils=require("./utils");var assert=utils.assert;function PresetCurve(options){if(options.type==="short")this.curve=new curve.short(options);else if(options.type==="edwards")this.curve=new curve.edwards(options);else this.curve=new curve.mont(options);this.g=this.curve.g;this.n=this.curve.n;this.hash=options.hash;assert(this.g.validate(),"Invalid curve");assert(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}curves.PresetCurve=PresetCurve;function defineCurve(name,options){Object.defineProperty(curves,name,{configurable:true,enumerable:true,get:function(){var curve=new PresetCurve(options);Object.defineProperty(curves,name,{configurable:true,enumerable:true,value:curve});return curve}})}defineCurve("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:hash.sha256,gRed:false,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]});defineCurve("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:hash.sha256,gRed:false,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]});defineCurve("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:hash.sha256,gRed:false,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]});defineCurve("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff "+"fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff "+"fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f "+"5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 "+"f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:hash.sha384,gRed:false,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 "+"5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 "+"0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]});defineCurve("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff "+"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff "+"ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff "+"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff "+"ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b "+"99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd "+"3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff "+"ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 "+"f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:hash.sha512,gRed:false,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 "+"053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 "+"a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 "+"579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 "+"3fad0761 353c7086 a272c240 88be9476 9fd16650"]});defineCurve("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:hash.sha256,gRed:false,g:["9"]});defineCurve("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:hash.sha256,gRed:false,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var pre;try{pre=require("./precomputed/secp256k1")}catch(e){pre=undefined}defineCurve("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:hash.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:false,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",pre]})},{"./curve":103,"./precomputed/secp256k1":113,"./utils":114,"hash.js":116}],107:[function(require,module,exports){"use strict";var BN=require("bn.js");var HmacDRBG=require("hmac-drbg");var utils=require("../utils");var curves=require("../curves");var rand=require("brorand");var assert=utils.assert;var KeyPair=require("./key");var Signature=require("./signature");function EC(options){if(!(this instanceof EC))return new EC(options);if(typeof options==="string"){assert(curves.hasOwnProperty(options),"Unknown curve "+options);options=curves[options]}if(options instanceof curves.PresetCurve)options={curve:options};this.curve=options.curve.curve;this.n=this.curve.n;this.nh=this.n.ushrn(1);this.g=this.curve.g;this.g=options.curve.g;this.g.precompute(options.curve.n.bitLength()+1);this.hash=options.hash||options.curve.hash}module.exports=EC;EC.prototype.keyPair=function keyPair(options){return new KeyPair(this,options)};EC.prototype.keyFromPrivate=function keyFromPrivate(priv,enc){return KeyPair.fromPrivate(this,priv,enc)};EC.prototype.keyFromPublic=function keyFromPublic(pub,enc){return KeyPair.fromPublic(this,pub,enc)};EC.prototype.genKeyPair=function genKeyPair(options){if(!options)options={};var drbg=new HmacDRBG({hash:this.hash,pers:options.pers,persEnc:options.persEnc||"utf8",entropy:options.entropy||rand(this.hash.hmacStrength),entropyEnc:options.entropy&&options.entropyEnc||"utf8",nonce:this.n.toArray()});var bytes=this.n.byteLength();var ns2=this.n.sub(new BN(2));do{var priv=new BN(drbg.generate(bytes));if(priv.cmp(ns2)>0)continue;priv.iaddn(1);return this.keyFromPrivate(priv)}while(true)};EC.prototype._truncateToN=function truncateToN(msg,truncOnly){var delta=msg.byteLength()*8-this.n.bitLength();if(delta>0)msg=msg.ushrn(delta);if(!truncOnly&&msg.cmp(this.n)>=0)return msg.sub(this.n);else return msg};EC.prototype.sign=function sign(msg,key,enc,options){if(typeof enc==="object"){options=enc;enc=null}if(!options)options={};key=this.keyFromPrivate(key,enc);msg=this._truncateToN(new BN(msg,16));var bytes=this.n.byteLength();var bkey=key.getPrivate().toArray("be",bytes);var nonce=msg.toArray("be",bytes);var drbg=new HmacDRBG({hash:this.hash,entropy:bkey,nonce:nonce,pers:options.pers,persEnc:options.persEnc||"utf8"});var ns1=this.n.sub(new BN(1));for(var iter=0;true;iter++){var k=options.k?options.k(iter):new BN(drbg.generate(this.n.byteLength()));k=this._truncateToN(k,true);if(k.cmpn(1)<=0||k.cmp(ns1)>=0)continue;var kp=this.g.mul(k);if(kp.isInfinity())continue;var kpX=kp.getX();var r=kpX.umod(this.n);if(r.cmpn(0)===0)continue;var s=k.invm(this.n).mul(r.mul(key.getPrivate()).iadd(msg));s=s.umod(this.n);if(s.cmpn(0)===0)continue;var recoveryParam=(kp.getY().isOdd()?1:0)|(kpX.cmp(r)!==0?2:0);if(options.canonical&&s.cmp(this.nh)>0){s=this.n.sub(s);recoveryParam^=1}return new Signature({r:r,s:s,recoveryParam:recoveryParam})}};EC.prototype.verify=function verify(msg,signature,key,enc){msg=this._truncateToN(new BN(msg,16));key=this.keyFromPublic(key,enc);signature=new Signature(signature,"hex");var r=signature.r;var s=signature.s;if(r.cmpn(1)<0||r.cmp(this.n)>=0)return false;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return false;var sinv=s.invm(this.n);var u1=sinv.mul(msg).umod(this.n);var u2=sinv.mul(r).umod(this.n);if(!this.curve._maxwellTrick){var p=this.g.mulAdd(u1,key.getPublic(),u2);if(p.isInfinity())return false;return p.getX().umod(this.n).cmp(r)===0}var p=this.g.jmulAdd(u1,key.getPublic(),u2);if(p.isInfinity())return false;return p.eqXToP(r)};EC.prototype.recoverPubKey=function(msg,signature,j,enc){assert((3&j)===j,"The recovery param is more than two bits");signature=new Signature(signature,enc);var n=this.n;var e=new BN(msg);var r=signature.r;var s=signature.s;var isYOdd=j&1;var isSecondKey=j>>1;if(r.cmp(this.curve.p.umod(this.curve.n))>=0&&isSecondKey)throw new Error("Unable to find sencond key candinate");if(isSecondKey)r=this.curve.pointFromX(r.add(this.curve.n),isYOdd);else r=this.curve.pointFromX(r,isYOdd);var rInv=signature.r.invm(n);var s1=n.sub(e).mul(rInv).umod(n);var s2=s.mul(rInv).umod(n);return this.g.mulAdd(s1,r,s2)};EC.prototype.getKeyRecoveryParam=function(e,signature,Q,enc){signature=new Signature(signature,enc);if(signature.recoveryParam!==null)return signature.recoveryParam;for(var i=0;i<4;i++){var Qprime;try{Qprime=this.recoverPubKey(e,signature,i)}catch(e){continue}if(Qprime.eq(Q))return i}throw new Error("Unable to find valid recovery factor")}},{"../curves":106,"../utils":114,"./key":108,"./signature":109,"bn.js":96,brorand:97,"hmac-drbg":128}],108:[function(require,module,exports){"use strict";var BN=require("bn.js");var utils=require("../utils");var assert=utils.assert;function KeyPair(ec,options){this.ec=ec;this.priv=null;this.pub=null;if(options.priv)this._importPrivate(options.priv,options.privEnc);if(options.pub)this._importPublic(options.pub,options.pubEnc)}module.exports=KeyPair;KeyPair.fromPublic=function fromPublic(ec,pub,enc){if(pub instanceof KeyPair)return pub;return new KeyPair(ec,{pub:pub,pubEnc:enc})};KeyPair.fromPrivate=function fromPrivate(ec,priv,enc){if(priv instanceof KeyPair)return priv;return new KeyPair(ec,{priv:priv,privEnc:enc})};KeyPair.prototype.validate=function validate(){var pub=this.getPublic();if(pub.isInfinity())return{result:false,reason:"Invalid public key"};if(!pub.validate())return{result:false,reason:"Public key is not a point"};if(!pub.mul(this.ec.curve.n).isInfinity())return{result:false,reason:"Public key * N != O"};return{result:true,reason:null}};KeyPair.prototype.getPublic=function getPublic(compact,enc){if(typeof compact==="string"){enc=compact;compact=null}if(!this.pub)this.pub=this.ec.g.mul(this.priv);if(!enc)return this.pub;return this.pub.encode(enc,compact)};KeyPair.prototype.getPrivate=function getPrivate(enc){if(enc==="hex")return this.priv.toString(16,2);else return this.priv};KeyPair.prototype._importPrivate=function _importPrivate(key,enc){this.priv=new BN(key,enc||16);this.priv=this.priv.umod(this.ec.curve.n)};KeyPair.prototype._importPublic=function _importPublic(key,enc){if(key.x||key.y){if(this.ec.curve.type==="mont"){assert(key.x,"Need x coordinate")}else if(this.ec.curve.type==="short"||this.ec.curve.type==="edwards"){assert(key.x&&key.y,"Need both x and y coordinate")}this.pub=this.ec.curve.point(key.x,key.y);return}this.pub=this.ec.curve.decodePoint(key,enc)};KeyPair.prototype.derive=function derive(pub){return pub.mul(this.priv).getX()};KeyPair.prototype.sign=function sign(msg,enc,options){return this.ec.sign(msg,this,enc,options)};KeyPair.prototype.verify=function verify(msg,signature){return this.ec.verify(msg,signature,this)};KeyPair.prototype.inspect=function inspect(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"}},{"../utils":114,"bn.js":96}],109:[function(require,module,exports){"use strict";var BN=require("bn.js");var utils=require("../utils");var assert=utils.assert;function Signature(options,enc){if(options instanceof Signature)return options;if(this._importDER(options,enc))return;assert(options.r&&options.s,"Signature without r or s");this.r=new BN(options.r,16);this.s=new BN(options.s,16);if(options.recoveryParam===undefined)this.recoveryParam=null;else this.recoveryParam=options.recoveryParam}module.exports=Signature;function Position(){this.place=0}function getLength(buf,p){var initial=buf[p.place++];if(!(initial&128)){return initial}var octetLen=initial&15;if(octetLen===0||octetLen>4){return false}var val=0;for(var i=0,off=p.place;i<octetLen;i++,off++){val<<=8;val|=buf[off];val>>>=0}if(val<=127){return false}p.place=off;return val}function rmPadding(buf){var i=0;var len=buf.length-1;while(!buf[i]&&!(buf[i+1]&128)&&i<len){i++}if(i===0){return buf}return buf.slice(i)}Signature.prototype._importDER=function _importDER(data,enc){data=utils.toArray(data,enc);var p=new Position;if(data[p.place++]!==48){return false}var len=getLength(data,p);if(len===false){return false}if(len+p.place!==data.length){return false}if(data[p.place++]!==2){return false}var rlen=getLength(data,p);if(rlen===false){return false}var r=data.slice(p.place,rlen+p.place);p.place+=rlen;if(data[p.place++]!==2){return false}var slen=getLength(data,p);if(slen===false){return false}if(data.length!==slen+p.place){return false}var s=data.slice(p.place,slen+p.place);if(r[0]===0){if(r[1]&128){r=r.slice(1)}else{return false}}if(s[0]===0){if(s[1]&128){s=s.slice(1)}else{return false}}this.r=new BN(r);this.s=new BN(s);this.recoveryParam=null;return true};function constructLength(arr,len){if(len<128){arr.push(len);return}var octets=1+(Math.log(len)/Math.LN2>>>3);arr.push(octets|128);while(--octets){arr.push(len>>>(octets<<3)&255)}arr.push(len)}Signature.prototype.toDER=function toDER(enc){var r=this.r.toArray();var s=this.s.toArray();if(r[0]&128)r=[0].concat(r);if(s[0]&128)s=[0].concat(s);r=rmPadding(r);s=rmPadding(s);while(!s[0]&&!(s[1]&128)){s=s.slice(1)}var arr=[2];constructLength(arr,r.length);arr=arr.concat(r);arr.push(2);constructLength(arr,s.length);var backHalf=arr.concat(s);var res=[48];constructLength(res,backHalf.length);res=res.concat(backHalf);return utils.encode(res,enc)}},{"../utils":114,"bn.js":96}],110:[function(require,module,exports){"use strict";var hash=require("hash.js");var curves=require("../curves");var utils=require("../utils");var assert=utils.assert;var parseBytes=utils.parseBytes;var KeyPair=require("./key");var Signature=require("./signature");function EDDSA(curve){assert(curve==="ed25519","only tested with ed25519 so far");if(!(this instanceof EDDSA))return new EDDSA(curve);var curve=curves[curve].curve;this.curve=curve;this.g=curve.g;this.g.precompute(curve.n.bitLength()+1);this.pointClass=curve.point().constructor;this.encodingLength=Math.ceil(curve.n.bitLength()/8);this.hash=hash.sha512}module.exports=EDDSA;EDDSA.prototype.sign=function sign(message,secret){message=parseBytes(message);var key=this.keyFromSecret(secret);var r=this.hashInt(key.messagePrefix(),message);var R=this.g.mul(r);var Rencoded=this.encodePoint(R);var s_=this.hashInt(Rencoded,key.pubBytes(),message).mul(key.priv());var S=r.add(s_).umod(this.curve.n);return this.makeSignature({R:R,S:S,Rencoded:Rencoded})};EDDSA.prototype.verify=function verify(message,sig,pub){message=parseBytes(message);sig=this.makeSignature(sig);var key=this.keyFromPublic(pub);var h=this.hashInt(sig.Rencoded(),key.pubBytes(),message);var SG=this.g.mul(sig.S());var RplusAh=sig.R().add(key.pub().mul(h));return RplusAh.eq(SG)};EDDSA.prototype.hashInt=function hashInt(){var hash=this.hash();for(var i=0;i<arguments.length;i++)hash.update(arguments[i]);return utils.intFromLE(hash.digest()).umod(this.curve.n)};EDDSA.prototype.keyFromPublic=function keyFromPublic(pub){return KeyPair.fromPublic(this,pub)};EDDSA.prototype.keyFromSecret=function keyFromSecret(secret){return KeyPair.fromSecret(this,secret)};EDDSA.prototype.makeSignature=function makeSignature(sig){if(sig instanceof Signature)return sig;return new Signature(this,sig)};EDDSA.prototype.encodePoint=function encodePoint(point){var enc=point.getY().toArray("le",this.encodingLength);enc[this.encodingLength-1]|=point.getX().isOdd()?128:0;return enc};EDDSA.prototype.decodePoint=function decodePoint(bytes){bytes=utils.parseBytes(bytes);var lastIx=bytes.length-1;var normed=bytes.slice(0,lastIx).concat(bytes[lastIx]&~128);var xIsOdd=(bytes[lastIx]&128)!==0;var y=utils.intFromLE(normed);return this.curve.pointFromY(y,xIsOdd)};EDDSA.prototype.encodeInt=function encodeInt(num){return num.toArray("le",this.encodingLength)};EDDSA.prototype.decodeInt=function decodeInt(bytes){return utils.intFromLE(bytes)};EDDSA.prototype.isPoint=function isPoint(val){return val instanceof this.pointClass}},{"../curves":106,"../utils":114,"./key":111,"./signature":112,"hash.js":116}],111:[function(require,module,exports){"use strict";var utils=require("../utils");var assert=utils.assert;var parseBytes=utils.parseBytes;var cachedProperty=utils.cachedProperty;function KeyPair(eddsa,params){this.eddsa=eddsa;this._secret=parseBytes(params.secret);if(eddsa.isPoint(params.pub))this._pub=params.pub;else this._pubBytes=parseBytes(params.pub)}KeyPair.fromPublic=function fromPublic(eddsa,pub){if(pub instanceof KeyPair)return pub;return new KeyPair(eddsa,{pub:pub})};KeyPair.fromSecret=function fromSecret(eddsa,secret){if(secret instanceof KeyPair)return secret;return new KeyPair(eddsa,{secret:secret})};KeyPair.prototype.secret=function secret(){return this._secret};cachedProperty(KeyPair,"pubBytes",function pubBytes(){return this.eddsa.encodePoint(this.pub())});cachedProperty(KeyPair,"pub",function pub(){if(this._pubBytes)return this.eddsa.decodePoint(this._pubBytes);return this.eddsa.g.mul(this.priv())});cachedProperty(KeyPair,"privBytes",function privBytes(){var eddsa=this.eddsa;var hash=this.hash();var lastIx=eddsa.encodingLength-1;var a=hash.slice(0,eddsa.encodingLength);a[0]&=248;a[lastIx]&=127;a[lastIx]|=64;return a});cachedProperty(KeyPair,"priv",function priv(){return this.eddsa.decodeInt(this.privBytes())});cachedProperty(KeyPair,"hash",function hash(){return this.eddsa.hash().update(this.secret()).digest()});cachedProperty(KeyPair,"messagePrefix",function messagePrefix(){return this.hash().slice(this.eddsa.encodingLength)});KeyPair.prototype.sign=function sign(message){assert(this._secret,"KeyPair can only verify");return this.eddsa.sign(message,this)};KeyPair.prototype.verify=function verify(message,sig){return this.eddsa.verify(message,sig,this)};KeyPair.prototype.getSecret=function getSecret(enc){assert(this._secret,"KeyPair is public only");return utils.encode(this.secret(),enc)};KeyPair.prototype.getPublic=function getPublic(enc){return utils.encode(this.pubBytes(),enc)};module.exports=KeyPair},{"../utils":114}],112:[function(require,module,exports){"use strict";var BN=require("bn.js");var utils=require("../utils");var assert=utils.assert;var cachedProperty=utils.cachedProperty;var parseBytes=utils.parseBytes;function Signature(eddsa,sig){this.eddsa=eddsa;if(typeof sig!=="object")sig=parseBytes(sig);if(Array.isArray(sig)){sig={R:sig.slice(0,eddsa.encodingLength),S:sig.slice(eddsa.encodingLength)}}assert(sig.R&&sig.S,"Signature without R or S");if(eddsa.isPoint(sig.R))this._R=sig.R;if(sig.S instanceof BN)this._S=sig.S;this._Rencoded=Array.isArray(sig.R)?sig.R:sig.Rencoded;this._Sencoded=Array.isArray(sig.S)?sig.S:sig.Sencoded}cachedProperty(Signature,"S",function S(){return this.eddsa.decodeInt(this.Sencoded())});cachedProperty(Signature,"R",function R(){return this.eddsa.decodePoint(this.Rencoded())});cachedProperty(Signature,"Rencoded",function Rencoded(){return this.eddsa.encodePoint(this.R())});cachedProperty(Signature,"Sencoded",function Sencoded(){return this.eddsa.encodeInt(this.S())});Signature.prototype.toBytes=function toBytes(){return this.Rencoded().concat(this.Sencoded())};Signature.prototype.toHex=function toHex(){return utils.encode(this.toBytes(),"hex").toUpperCase()};module.exports=Signature},{"../utils":114,"bn.js":96}],113:[function(require,module,exports){module.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}},{}],114:[function(require,module,exports){"use strict";var utils=exports;var BN=require("bn.js");var minAssert=require("minimalistic-assert");var minUtils=require("minimalistic-crypto-utils");utils.assert=minAssert;utils.toArray=minUtils.toArray;utils.zero2=minUtils.zero2;utils.toHex=minUtils.toHex;utils.encode=minUtils.encode;function getNAF(num,w,bits){var naf=new Array(Math.max(num.bitLength(),bits)+1);naf.fill(0);var ws=1<<w+1;var k=num.clone();for(var i=0;i<naf.length;i++){var z;var mod=k.andln(ws-1);if(k.isOdd()){if(mod>(ws>>1)-1)z=(ws>>1)-mod;else z=mod;k.isubn(z)}else{z=0}naf[i]=z;k.iushrn(1)}return naf}utils.getNAF=getNAF;function getJSF(k1,k2){var jsf=[[],[]];k1=k1.clone();k2=k2.clone();var d1=0;var d2=0;while(k1.cmpn(-d1)>0||k2.cmpn(-d2)>0){var m14=k1.andln(3)+d1&3;var m24=k2.andln(3)+d2&3;if(m14===3)m14=-1;if(m24===3)m24=-1;var u1;if((m14&1)===0){u1=0}else{var m8=k1.andln(7)+d1&7;if((m8===3||m8===5)&&m24===2)u1=-m14;else u1=m14}jsf[0].push(u1);var u2;if((m24&1)===0){u2=0}else{var m8=k2.andln(7)+d2&7;if((m8===3||m8===5)&&m14===2)u2=-m24;else u2=m24}jsf[1].push(u2);if(2*d1===u1+1)d1=1-d1;if(2*d2===u2+1)d2=1-d2;k1.iushrn(1);k2.iushrn(1)}return jsf}utils.getJSF=getJSF;function cachedProperty(obj,name,computer){var key="_"+name;obj.prototype[name]=function cachedProperty(){return this[key]!==undefined?this[key]:this[key]=computer.call(this)}}utils.cachedProperty=cachedProperty;function parseBytes(bytes){return typeof bytes==="string"?utils.toArray(bytes,"hex"):bytes}utils.parseBytes=parseBytes;function intFromLE(bytes){return new BN(bytes,"hex","le")}utils.intFromLE=intFromLE},{"bn.js":96,"minimalistic-assert":132,"minimalistic-crypto-utils":133}],115:[function(require,module,exports){module.exports={_from:"elliptic@6.5.3",_id:"elliptic@6.5.3",_inBundle:false,_integrity:"sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw==",_location:"/elliptic",_phantomChildren:{},_requested:{type:"version",registry:true,raw:"elliptic@6.5.3",name:"elliptic",escapedName:"elliptic",rawSpec:"6.5.3",saveSpec:null,fetchSpec:"6.5.3"},_requiredBy:["/@ethersproject/signing-key"],_resolved:"https://registry.npmjs.org/elliptic/-/elliptic-6.5.3.tgz",_shasum:"cb59eb2efdaf73a0bd78ccd7015a62ad6e0f93d6",_spec:"elliptic@6.5.3",_where:"C:\\Users\\marco\\Desktop\\uniswap-sdk-test\\node_modules\\@ethersproject\\signing-key",author:{name:"Fedor Indutny",email:"fedor@indutny.com"},bugs:{url:"https://github.com/indutny/elliptic/issues"},bundleDependencies:false,dependencies:{"bn.js":"^4.4.0",brorand:"^1.0.1","hash.js":"^1.0.0","hmac-drbg":"^1.0.0",inherits:"^2.0.1","minimalistic-assert":"^1.0.0","minimalistic-crypto-utils":"^1.0.0"},deprecated:false,description:"EC cryptography",devDependencies:{brfs:"^1.4.3",coveralls:"^3.0.8",grunt:"^1.0.4","grunt-browserify":"^5.0.0","grunt-cli":"^1.2.0","grunt-contrib-connect":"^1.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^1.0.1","grunt-mocha-istanbul":"^3.0.1","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.2",jscs:"^3.0.7",jshint:"^2.10.3",mocha:"^6.2.2"},files:["lib"],homepage:"https://github.com/indutny/elliptic",keywords:["EC","Elliptic","curve","Cryptography"],license:"MIT",main:"lib/elliptic.js",name:"elliptic",repository:{type:"git",url:"git+ssh://git@github.com/indutny/elliptic.git"},scripts:{jscs:"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",jshint:"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",lint:"npm run jscs && npm run jshint",test:"npm run lint && npm run unit",unit:"istanbul test _mocha --reporter=spec test/index.js",version:"grunt dist && git add dist/"},version:"6.5.3"}},{}],116:[function(require,module,exports){arguments[4][66][0].apply(exports,arguments)},{"./hash/common":117,"./hash/hmac":118,"./hash/ripemd":119,"./hash/sha":120,"./hash/utils":127,dup:66}],117:[function(require,module,exports){arguments[4][67][0].apply(exports,arguments)},{"./utils":127,dup:67,"minimalistic-assert":132}],118:[function(require,module,exports){arguments[4][68][0].apply(exports,arguments)},{"./utils":127,dup:68,"minimalistic-assert":132}],119:[function(require,module,exports){arguments[4][69][0].apply(exports,arguments)},{"./common":117,"./utils":127,dup:69}],120:[function(require,module,exports){arguments[4][70][0].apply(exports,arguments)},{"./sha/1":121,"./sha/224":122,"./sha/256":123,"./sha/384":124,"./sha/512":125,dup:70}],121:[function(require,module,exports){arguments[4][71][0].apply(exports,arguments)},{"../common":117,"../utils":127,"./common":126,dup:71}],122:[function(require,module,exports){arguments[4][72][0].apply(exports,arguments)},{"../utils":127,"./256":123,dup:72}],123:[function(require,module,exports){arguments[4][73][0].apply(exports,arguments)},{"../common":117,"../utils":127,"./common":126,dup:73,"minimalistic-assert":132}],124:[function(require,module,exports){arguments[4][74][0].apply(exports,arguments)},{"../utils":127,"./512":125,dup:74}],125:[function(require,module,exports){arguments[4][75][0].apply(exports,arguments)},{"../common":117,"../utils":127,dup:75,"minimalistic-assert":132}],126:[function(require,module,exports){arguments[4][76][0].apply(exports,arguments)},{"../utils":127,dup:76}],127:[function(require,module,exports){"use strict";var assert=require("minimalistic-assert");var inherits=require("inherits");exports.inherits=inherits;function isSurrogatePair(msg,i){if((msg.charCodeAt(i)&64512)!==55296){return false}if(i<0||i+1>=msg.length){return false}return(msg.charCodeAt(i+1)&64512)===56320}function toArray(msg,enc){if(Array.isArray(msg))return msg.slice();if(!msg)return[];var res=[];if(typeof msg==="string"){if(!enc){var p=0;for(var i=0;i<msg.length;i++){var c=msg.charCodeAt(i);if(c<128){res[p++]=c}else if(c<2048){res[p++]=c>>6|192;res[p++]=c&63|128}else if(isSurrogatePair(msg,i)){c=65536+((c&1023)<<10)+(msg.charCodeAt(++i)&1023);res[p++]=c>>18|240;res[p++]=c>>12&63|128;res[p++]=c>>6&63|128;res[p++]=c&63|128}else{res[p++]=c>>12|224;res[p++]=c>>6&63|128;res[p++]=c&63|128}}}else if(enc==="hex"){msg=msg.replace(/[^a-z0-9]+/gi,"");if(msg.length%2!==0)msg="0"+msg;for(i=0;i<msg.length;i+=2)res.push(parseInt(msg[i]+msg[i+1],16))}}else{for(i=0;i<msg.length;i++)res[i]=msg[i]|0}return res}exports.toArray=toArray;function toHex(msg){var res="";for(var i=0;i<msg.length;i++)res+=zero2(msg[i].toString(16));return res}exports.toHex=toHex;function htonl(w){var res=w>>>24|w>>>8&65280|w<<8&16711680|(w&255)<<24;return res>>>0}exports.htonl=htonl;function toHex32(msg,endian){var res="";for(var i=0;i<msg.length;i++){var w=msg[i];if(endian==="little")w=htonl(w);res+=zero8(w.toString(16))}return res}exports.toHex32=toHex32;function zero2(word){if(word.length===1)return"0"+word;else return word}exports.zero2=zero2;function zero8(word){if(word.length===7)return"0"+word;else if(word.length===6)return"00"+word;else if(word.length===5)return"000"+word;else if(word.length===4)return"0000"+word;else if(word.length===3)return"00000"+word;else if(word.length===2)return"000000"+word;else if(word.length===1)return"0000000"+word;else return word}exports.zero8=zero8;function join32(msg,start,end,endian){var len=end-start;assert(len%4===0);var res=new Array(len/4);for(var i=0,k=start;i<res.length;i++,k+=4){var w;if(endian==="big")w=msg[k]<<24|msg[k+1]<<16|msg[k+2]<<8|msg[k+3];else w=msg[k+3]<<24|msg[k+2]<<16|msg[k+1]<<8|msg[k];res[i]=w>>>0}return res}exports.join32=join32;function split32(msg,endian){var res=new Array(msg.length*4);for(var i=0,k=0;i<msg.length;i++,k+=4){var m=msg[i];if(endian==="big"){res[k]=m>>>24;res[k+1]=m>>>16&255;res[k+2]=m>>>8&255;res[k+3]=m&255}else{res[k+3]=m>>>24;res[k+2]=m>>>16&255;res[k+1]=m>>>8&255;res[k]=m&255}}return res}exports.split32=split32;function rotr32(w,b){return w>>>b|w<<32-b}exports.rotr32=rotr32;function rotl32(w,b){return w<<b|w>>>32-b}exports.rotl32=rotl32;function sum32(a,b){return a+b>>>0}exports.sum32=sum32;function sum32_3(a,b,c){return a+b+c>>>0}exports.sum32_3=sum32_3;function sum32_4(a,b,c,d){return a+b+c+d>>>0}exports.sum32_4=sum32_4;function sum32_5(a,b,c,d,e){return a+b+c+d+e>>>0}exports.sum32_5=sum32_5;function sum64(buf,pos,ah,al){var bh=buf[pos];var bl=buf[pos+1];var lo=al+bl>>>0;var hi=(lo<al?1:0)+ah+bh;buf[pos]=hi>>>0;buf[pos+1]=lo}exports.sum64=sum64;function sum64_hi(ah,al,bh,bl){var lo=al+bl>>>0;var hi=(lo<al?1:0)+ah+bh;return hi>>>0}exports.sum64_hi=sum64_hi;function sum64_lo(ah,al,bh,bl){var lo=al+bl;return lo>>>0}exports.sum64_lo=sum64_lo;function sum64_4_hi(ah,al,bh,bl,ch,cl,dh,dl){var carry=0;var lo=al;lo=lo+bl>>>0;carry+=lo<al?1:0;lo=lo+cl>>>0;carry+=lo<cl?1:0;lo=lo+dl>>>0;carry+=lo<dl?1:0;var hi=ah+bh+ch+dh+carry;return hi>>>0}exports.sum64_4_hi=sum64_4_hi;function sum64_4_lo(ah,al,bh,bl,ch,cl,dh,dl){var lo=al+bl+cl+dl;return lo>>>0}exports.sum64_4_lo=sum64_4_lo;function sum64_5_hi(ah,al,bh,bl,ch,cl,dh,dl,eh,el){var carry=0;var lo=al;lo=lo+bl>>>0;carry+=lo<al?1:0;lo=lo+cl>>>0;carry+=lo<cl?1:0;lo=lo+dl>>>0;carry+=lo<dl?1:0;lo=lo+el>>>0;carry+=lo<el?1:0;var hi=ah+bh+ch+dh+eh+carry;return hi>>>0}exports.sum64_5_hi=sum64_5_hi;function sum64_5_lo(ah,al,bh,bl,ch,cl,dh,dl,eh,el){var lo=al+bl+cl+dl+el;return lo>>>0}exports.sum64_5_lo=sum64_5_lo;function rotr64_hi(ah,al,num){var r=al<<32-num|ah>>>num;return r>>>0}exports.rotr64_hi=rotr64_hi;function rotr64_lo(ah,al,num){var r=ah<<32-num|al>>>num;return r>>>0}exports.rotr64_lo=rotr64_lo;function shr64_hi(ah,al,num){return ah>>>num}exports.shr64_hi=shr64_hi;function shr64_lo(ah,al,num){var r=ah<<32-num|al>>>num;return r>>>0}exports.shr64_lo=shr64_lo},{inherits:129,"minimalistic-assert":132}],128:[function(require,module,exports){"use strict";var hash=require("hash.js");var utils=require("minimalistic-crypto-utils");var assert=require("minimalistic-assert");function HmacDRBG(options){if(!(this instanceof HmacDRBG))return new HmacDRBG(options);this.hash=options.hash;this.predResist=!!options.predResist;this.outLen=this.hash.outSize;this.minEntropy=options.minEntropy||this.hash.hmacStrength;this._reseed=null;this.reseedInterval=null;this.K=null;this.V=null;var entropy=utils.toArray(options.entropy,options.entropyEnc||"hex");var nonce=utils.toArray(options.nonce,options.nonceEnc||"hex");var pers=utils.toArray(options.pers,options.persEnc||"hex");assert(entropy.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits");this._init(entropy,nonce,pers)}module.exports=HmacDRBG;HmacDRBG.prototype._init=function init(entropy,nonce,pers){var seed=entropy.concat(nonce).concat(pers);this.K=new Array(this.outLen/8);this.V=new Array(this.outLen/8);for(var i=0;i<this.V.length;i++){this.K[i]=0;this.V[i]=1}this._update(seed);this._reseed=1;this.reseedInterval=281474976710656};HmacDRBG.prototype._hmac=function hmac(){return new hash.hmac(this.hash,this.K)};HmacDRBG.prototype._update=function update(seed){var kmac=this._hmac().update(this.V).update([0]);if(seed)kmac=kmac.update(seed);this.K=kmac.digest();this.V=this._hmac().update(this.V).digest();if(!seed)return;this.K=this._hmac().update(this.V).update([1]).update(seed).digest();this.V=this._hmac().update(this.V).digest()};HmacDRBG.prototype.reseed=function reseed(entropy,entropyEnc,add,addEnc){if(typeof entropyEnc!=="string"){addEnc=add;add=entropyEnc;entropyEnc=null}entropy=utils.toArray(entropy,entropyEnc);add=utils.toArray(add,addEnc);assert(entropy.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits");this._update(entropy.concat(add||[]));this._reseed=1};HmacDRBG.prototype.generate=function generate(len,enc,add,addEnc){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");if(typeof enc!=="string"){addEnc=add;add=enc;enc=null}if(add){add=utils.toArray(add,addEnc||"hex");this._update(add)}var temp=[];while(temp.length<len){this.V=this._hmac().update(this.V).digest();temp=temp.concat(this.V)}var res=temp.slice(0,len);this._update(add);this._reseed++;return utils.encode(res,enc)}},{"hash.js":116,"minimalistic-assert":132,"minimalistic-crypto-utils":133}],129:[function(require,module,exports){if(typeof Object.create==="function"){module.exports=function inherits(ctor,superCtor){if(superCtor){ctor.super_=superCtor;ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:false,writable:true,configurable:true}})}}}else{module.exports=function inherits(ctor,superCtor){if(superCtor){ctor.super_=superCtor;var TempCtor=function(){};TempCtor.prototype=superCtor.prototype;ctor.prototype=new TempCtor;ctor.prototype.constructor=ctor}}}},{}],130:[function(require,module,exports){(function(process,global){(function(){"use strict";var root=typeof window==="object"?window:{};var NODE_JS=!root.JS_SHA3_NO_NODE_JS&&typeof process==="object"&&process.versions&&process.versions.node;if(NODE_JS){root=global}var COMMON_JS=!root.JS_SHA3_NO_COMMON_JS&&typeof module==="object"&&module.exports;var HEX_CHARS="0123456789abcdef".split("");var SHAKE_PADDING=[31,7936,2031616,520093696];var KECCAK_PADDING=[1,256,65536,16777216];var PADDING=[6,1536,393216,100663296];var SHIFT=[0,8,16,24];var RC=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648];var BITS=[224,256,384,512];var SHAKE_BITS=[128,256];var OUTPUT_TYPES=["hex","buffer","arrayBuffer","array"];var createOutputMethod=function(bits,padding,outputType){return function(message){return new Keccak(bits,padding,bits).update(message)[outputType]()}};var createShakeOutputMethod=function(bits,padding,outputType){return function(message,outputBits){return new Keccak(bits,padding,outputBits).update(message)[outputType]()}};var createMethod=function(bits,padding){var method=createOutputMethod(bits,padding,"hex");method.create=function(){return new Keccak(bits,padding,bits)};method.update=function(message){return method.create().update(message)};for(var i=0;i<OUTPUT_TYPES.length;++i){var type=OUTPUT_TYPES[i];method[type]=createOutputMethod(bits,padding,type)}return method};var createShakeMethod=function(bits,padding){var method=createShakeOutputMethod(bits,padding,"hex");method.create=function(outputBits){return new Keccak(bits,padding,outputBits)};method.update=function(message,outputBits){return method.create(outputBits).update(message)};for(var i=0;i<OUTPUT_TYPES.length;++i){var type=OUTPUT_TYPES[i];method[type]=createShakeOutputMethod(bits,padding,type)}return method};var algorithms=[{name:"keccak",padding:KECCAK_PADDING,bits:BITS,createMethod:createMethod},{name:"sha3",padding:PADDING,bits:BITS,createMethod:createMethod},{name:"shake",padding:SHAKE_PADDING,bits:SHAKE_BITS,createMethod:createShakeMethod}];var methods={},methodNames=[];for(var i=0;i<algorithms.length;++i){var algorithm=algorithms[i];var bits=algorithm.bits;for(var j=0;j<bits.length;++j){var methodName=algorithm.name+"_"+bits[j];methodNames.push(methodName);methods[methodName]=algorithm.createMethod(bits[j],algorithm.padding)}}function Keccak(bits,padding,outputBits){this.blocks=[];this.s=[];this.padding=padding;this.outputBits=outputBits;this.reset=true;this.block=0;this.start=0;this.blockCount=1600-(bits<<1)>>5;this.byteCount=this.blockCount<<2;this.outputBlocks=outputBits>>5;this.extraBytes=(outputBits&31)>>3;for(var i=0;i<50;++i){this.s[i]=0}}Keccak.prototype.update=function(message){var notString=typeof message!=="string";if(notString&&message.constructor===ArrayBuffer){message=new Uint8Array(message)}var length=message.length,blocks=this.blocks,byteCount=this.byteCount,blockCount=this.blockCount,index=0,s=this.s,i,code;while(index<length){if(this.reset){this.reset=false;blocks[0]=this.block;for(i=1;i<blockCount+1;++i){blocks[i]=0}}if(notString){for(i=this.start;index<length&&i<byteCount;++index){blocks[i>>2]|=message[index]<<SHIFT[i++&3]}}else{for(i=this.start;index<length&&i<byteCount;++index){code=message.charCodeAt(index);if(code<128){blocks[i>>2]|=code<<SHIFT[i++&3]}else if(code<2048){blocks[i>>2]|=(192|code>>6)<<SHIFT[i++&3];blocks[i>>2]|=(128|code&63)<<SHIFT[i++&3]}else if(code<55296||code>=57344){blocks[i>>2]|=(224|code>>12)<<SHIFT[i++&3];blocks[i>>2]|=(128|code>>6&63)<<SHIFT[i++&3];blocks[i>>2]|=(128|code&63)<<SHIFT[i++&3]}else{code=65536+((code&1023)<<10|message.charCodeAt(++index)&1023);blocks[i>>2]|=(240|code>>18)<<SHIFT[i++&3];blocks[i>>2]|=(128|code>>12&63)<<SHIFT[i++&3];blocks[i>>2]|=(128|code>>6&63)<<SHIFT[i++&3];blocks[i>>2]|=(128|code&63)<<SHIFT[i++&3]}}}this.lastByteIndex=i;if(i>=byteCount){this.start=i-byteCount;this.block=blocks[blockCount];for(i=0;i<blockCount;++i){s[i]^=blocks[i]}f(s);this.reset=true}else{this.start=i}}return this};Keccak.prototype.finalize=function(){var blocks=this.blocks,i=this.lastByteIndex,blockCount=this.blockCount,s=this.s;blocks[i>>2]|=this.padding[i&3];if(this.lastByteIndex===this.byteCount){blocks[0]=blocks[blockCount];for(i=1;i<blockCount+1;++i){blocks[i]=0}}blocks[blockCount-1]|=2147483648;for(i=0;i<blockCount;++i){s[i]^=blocks[i]}f(s)};Keccak.prototype.toString=Keccak.prototype.hex=function(){this.finalize();var blockCount=this.blockCount,s=this.s,outputBlocks=this.outputBlocks,extraBytes=this.extraBytes,i=0,j=0;var hex="",block;while(j<outputBlocks){for(i=0;i<blockCount&&j<outputBlocks;++i,++j){block=s[i];hex+=HEX_CHARS[block>>4&15]+HEX_CHARS[block&15]+HEX_CHARS[block>>12&15]+HEX_CHARS[block>>8&15]+HEX_CHARS[block>>20&15]+HEX_CHARS[block>>16&15]+HEX_CHARS[block>>28&15]+HEX_CHARS[block>>24&15]}if(j%blockCount===0){f(s);i=0}}if(extraBytes){block=s[i];if(extraBytes>0){hex+=HEX_CHARS[block>>4&15]+HEX_CHARS[block&15]}if(extraBytes>1){hex+=HEX_CHARS[block>>12&15]+HEX_CHARS[block>>8&15]}if(extraBytes>2){hex+=HEX_CHARS[block>>20&15]+HEX_CHARS[block>>16&15]}}return hex};Keccak.prototype.arrayBuffer=function(){this.finalize();var blockCount=this.blockCount,s=this.s,outputBlocks=this.outputBlocks,extraBytes=this.extraBytes,i=0,j=0;var bytes=this.outputBits>>3;var buffer;if(extraBytes){buffer=new ArrayBuffer(outputBlocks+1<<2)}else{buffer=new ArrayBuffer(bytes)}var array=new Uint32Array(buffer);while(j<outputBlocks){for(i=0;i<blockCount&&j<outputBlocks;++i,++j){array[j]=s[i]}if(j%blockCount===0){f(s)}}if(extraBytes){array[i]=s[i];buffer=buffer.slice(0,bytes)}return buffer};Keccak.prototype.buffer=Keccak.prototype.arrayBuffer;Keccak.prototype.digest=Keccak.prototype.array=function(){this.finalize();var blockCount=this.blockCount,s=this.s,outputBlocks=this.outputBlocks,extraBytes=this.extraBytes,i=0,j=0;var array=[],offset,block;while(j<outputBlocks){for(i=0;i<blockCount&&j<outputBlocks;++i,++j){offset=j<<2;block=s[i];array[offset]=block&255;array[offset+1]=block>>8&255;array[offset+2]=block>>16&255;array[offset+3]=block>>24&255}if(j%blockCount===0){f(s)}}if(extraBytes){offset=j<<2;block=s[i];if(extraBytes>0){array[offset]=block&255}if(extraBytes>1){array[offset+1]=block>>8&255}if(extraBytes>2){array[offset+2]=block>>16&255}}return array};var f=function(s){var h,l,n,c0,c1,c2,c3,c4,c5,c6,c7,c8,c9,b0,b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,b16,b17,b18,b19,b20,b21,b22,b23,b24,b25,b26,b27,b28,b29,b30,b31,b32,b33,b34,b35,b36,b37,b38,b39,b40,b41,b42,b43,b44,b45,b46,b47,b48,b49;for(n=0;n<48;n+=2){c0=s[0]^s[10]^s[20]^s[30]^s[40];c1=s[1]^s[11]^s[21]^s[31]^s[41];c2=s[2]^s[12]^s[22]^s[32]^s[42];c3=s[3]^s[13]^s[23]^s[33]^s[43];c4=s[4]^s[14]^s[24]^s[34]^s[44];c5=s[5]^s[15]^s[25]^s[35]^s[45];c6=s[6]^s[16]^s[26]^s[36]^s[46];c7=s[7]^s[17]^s[27]^s[37]^s[47];c8=s[8]^s[18]^s[28]^s[38]^s[48];c9=s[9]^s[19]^s[29]^s[39]^s[49];h=c8^(c2<<1|c3>>>31);l=c9^(c3<<1|c2>>>31);s[0]^=h;s[1]^=l;s[10]^=h;s[11]^=l;s[20]^=h;s[21]^=l;s[30]^=h;s[31]^=l;s[40]^=h;s[41]^=l;h=c0^(c4<<1|c5>>>31);l=c1^(c5<<1|c4>>>31);s[2]^=h;s[3]^=l;s[12]^=h;s[13]^=l;s[22]^=h;s[23]^=l;s[32]^=h;s[33]^=l;s[42]^=h;s[43]^=l;h=c2^(c6<<1|c7>>>31);l=c3^(c7<<1|c6>>>31);s[4]^=h;s[5]^=l;s[14]^=h;s[15]^=l;s[24]^=h;s[25]^=l;s[34]^=h;s[35]^=l;s[44]^=h;s[45]^=l;h=c4^(c8<<1|c9>>>31);l=c5^(c9<<1|c8>>>31);s[6]^=h;s[7]^=l;s[16]^=h;s[17]^=l;s[26]^=h;s[27]^=l;s[36]^=h;s[37]^=l;s[46]^=h;s[47]^=l;h=c6^(c0<<1|c1>>>31);l=c7^(c1<<1|c0>>>31);s[8]^=h;s[9]^=l;s[18]^=h;s[19]^=l;s[28]^=h;s[29]^=l;s[38]^=h;s[39]^=l;s[48]^=h;s[49]^=l;b0=s[0];b1=s[1];b32=s[11]<<4|s[10]>>>28;b33=s[10]<<4|s[11]>>>28;b14=s[20]<<3|s[21]>>>29;b15=s[21]<<3|s[20]>>>29;b46=s[31]<<9|s[30]>>>23;b47=s[30]<<9|s[31]>>>23;b28=s[40]<<18|s[41]>>>14;b29=s[41]<<18|s[40]>>>14;b20=s[2]<<1|s[3]>>>31;b21=s[3]<<1|s[2]>>>31;b2=s[13]<<12|s[12]>>>20;b3=s[12]<<12|s[13]>>>20;b34=s[22]<<10|s[23]>>>22;b35=s[23]<<10|s[22]>>>22;b16=s[33]<<13|s[32]>>>19;b17=s[32]<<13|s[33]>>>19;b48=s[42]<<2|s[43]>>>30;b49=s[43]<<2|s[42]>>>30;b40=s[5]<<30|s[4]>>>2;b41=s[4]<<30|s[5]>>>2;b22=s[14]<<6|s[15]>>>26;b23=s[15]<<6|s[14]>>>26;b4=s[25]<<11|s[24]>>>21;b5=s[24]<<11|s[25]>>>21;b36=s[34]<<15|s[35]>>>17;b37=s[35]<<15|s[34]>>>17;b18=s[45]<<29|s[44]>>>3;b19=s[44]<<29|s[45]>>>3;b10=s[6]<<28|s[7]>>>4;b11=s[7]<<28|s[6]>>>4;b42=s[17]<<23|s[16]>>>9;b43=s[16]<<23|s[17]>>>9;b24=s[26]<<25|s[27]>>>7;b25=s[27]<<25|s[26]>>>7;b6=s[36]<<21|s[37]>>>11;b7=s[37]<<21|s[36]>>>11;b38=s[47]<<24|s[46]>>>8;b39=s[46]<<24|s[47]>>>8;b30=s[8]<<27|s[9]>>>5;b31=s[9]<<27|s[8]>>>5;b12=s[18]<<20|s[19]>>>12;b13=s[19]<<20|s[18]>>>12;b44=s[29]<<7|s[28]>>>25;b45=s[28]<<7|s[29]>>>25;b26=s[38]<<8|s[39]>>>24;b27=s[39]<<8|s[38]>>>24;b8=s[48]<<14|s[49]>>>18;b9=s[49]<<14|s[48]>>>18;s[0]=b0^~b2&b4;s[1]=b1^~b3&b5;s[10]=b10^~b12&b14;s[11]=b11^~b13&b15;s[20]=b20^~b22&b24;s[21]=b21^~b23&b25;s[30]=b30^~b32&b34;s[31]=b31^~b33&b35;s[40]=b40^~b42&b44;s[41]=b41^~b43&b45;s[2]=b2^~b4&b6;s[3]=b3^~b5&b7;s[12]=b12^~b14&b16;s[13]=b13^~b15&b17;s[22]=b22^~b24&b26;s[23]=b23^~b25&b27;s[32]=b32^~b34&b36;s[33]=b33^~b35&b37;s[42]=b42^~b44&b46;s[43]=b43^~b45&b47;s[4]=b4^~b6&b8;s[5]=b5^~b7&b9;s[14]=b14^~b16&b18;s[15]=b15^~b17&b19;s[24]=b24^~b26&b28;s[25]=b25^~b27&b29;s[34]=b34^~b36&b38;s[35]=b35^~b37&b39;s[44]=b44^~b46&b48;s[45]=b45^~b47&b49;s[6]=b6^~b8&b0;s[7]=b7^~b9&b1;s[16]=b16^~b18&b10;s[17]=b17^~b19&b11;s[26]=b26^~b28&b20;s[27]=b27^~b29&b21;s[36]=b36^~b38&b30;s[37]=b37^~b39&b31;s[46]=b46^~b48&b40;s[47]=b47^~b49&b41;s[8]=b8^~b0&b2;s[9]=b9^~b1&b3;s[18]=b18^~b10&b12;s[19]=b19^~b11&b13;s[28]=b28^~b20&b22;s[29]=b29^~b21&b23;s[38]=b38^~b30&b32;s[39]=b39^~b31&b33;s[48]=b48^~b40&b42;s[49]=b49^~b41&b43;s[0]^=RC[n];s[1]^=RC[n+1]}};if(COMMON_JS){module.exports=methods}else{for(var i=0;i<methodNames.length;++i){root[methodNames[i]]=methods[methodNames[i]]}}})()}).call(this,require("_process"),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{_process:134}],131:[function(require,module,exports){(function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self,e.JSBI=t())})(this,function(){"use strict";function e(t){"@babel/helpers - typeof";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(t)}function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(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,t,_){return t&&i(e.prototype,t),_&&i(e,_),e}function n(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&l(e,t)}function g(e){return g=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},g(e)}function l(e,t){return l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},l(e,t)}function a(){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(t){return!1}}function s(){return s=a()?Reflect.construct:function(e,t,i){var _=[null];_.push.apply(_,t);var n=Function.bind.apply(e,_),g=new n;return i&&l(g,i.prototype),g},s.apply(null,arguments)}function u(e){return-1!==Function.toString.call(e).indexOf("[native code]")}function r(e){var t="function"==typeof Map?new Map:void 0;return r=function(e){function i(){return s(e,arguments,g(this).constructor)}if(null===e||!u(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if("undefined"!=typeof t){if(t.has(e))return t.get(e);t.set(e,i)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),l(i,e)},r(e)}function d(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function h(e,t){return t&&("object"==typeof t||"function"==typeof t)?t:d(e)}function b(e){var t=a();return function(){var i,_=g(e);if(t){var n=g(this).constructor;i=Reflect.construct(_,arguments,n)}else i=_.apply(this,arguments);return h(this,i)}}function m(e,t){if(e){if("string"==typeof e)return c(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var _=0,n=Array(t);_<t;_++)n[_]=e[_];return n}function v(e,t){var _;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(_=m(e))||t&&e&&"number"==typeof e.length){_&&(e=_);var n=0,g=function(){};return{s:g,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(t){throw t},f:g}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,a=!0,s=!1;return{s:function(){_=e[Symbol.iterator]()},n:function(){var e=_.next();return a=e.done,e},e:function(t){s=!0,l=t},f:function(){try{a||null==_.return||_.return()}finally{if(s)throw l}}}}var f=function(i){var o=Math.abs,l=Math.max,a=Math.imul,s=Math.clz32;function g(e,i){var _;if(t(this,g),e>g.__kMaxLength)throw new RangeError("Maximum BigInt size exceeded");return _=u.call(this,e),_.sign=i,_}n(g,i);var u=b(g);return _(g,[{key:"toDebugString",value:function(){var e,t=["BigInt["],i=v(this);try{for(i.s();!(e=i.n()).done;){var _=e.value;t.push((_?(_>>>0).toString(16):_)+", ")}}catch(e){i.e(e)}finally{i.f()}return t.push("]"),t.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)?g.__toStringBasePowerOfTwo(this,e):g.__toStringGeneric(this,e,!1)}},{key:"__copy",value:function(){for(var e=new g(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,t=this[e-1];0===t;)e--,t=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 s(this[this.length-1])}},{key:"__inplaceMultiplyAdd",value:function(e,t,_){_>this.length&&(_=this.length);for(var n=65535&e,g=e>>>16,o=0,l=65535&t,s=t>>>16,u=0;u<_;u++){var r=this.__digit(u),d=65535&r,h=r>>>16,b=a(d,n),m=a(d,g),c=a(h,n),v=a(h,g),f=l+(65535&b),y=s+o+(f>>>16)+(b>>>16)+(65535&m)+(65535&c);l=(m>>>16)+(c>>>16)+(65535&v)+(y>>>16),o=l>>>16,l&=65535,s=v>>>16;this.__setDigit(u,65535&f|y<<16)}if(0!==o||0!==l||0!==s)throw new Error("implementation bug")}},{key:"__inplaceAdd",value:function(e,t,_){for(var n,g=0,o=0;o<_;o++)n=this.__halfDigit(t+o)+e.__halfDigit(o)+g,g=n>>>16,this.__setHalfDigit(t+o,n);return g}},{key:"__inplaceSub",value:function(e,t,_){var n=0;if(1&t){t>>=1;for(var g=this.__digit(t),o=65535&g,l=0;l<_-1>>>1;l++){var a=e.__digit(l),s=(g>>>16)-(65535&a)-n;n=1&s>>>16,this.__setDigit(t+l,s<<16|65535&o),g=this.__digit(t+l+1),o=(65535&g)-(a>>>16)-n,n=1&o>>>16}var u=e.__digit(l),r=(g>>>16)-(65535&u)-n;n=1&r>>>16,this.__setDigit(t+l,r<<16|65535&o);if(t+l+1>=this.length)throw new RangeError("out of bounds");0==(1&_)&&(g=this.__digit(t+l+1),o=(65535&g)-(u>>>16)-n,n=1&o>>>16,this.__setDigit(t+e.length,4294901760&g|65535&o))}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),f=e.__digit(d),y=(65535&v)-(65535&f)-n;n=1&y>>>16;var k=0;0==(1&_)&&(k=(v>>>16)-(f>>>16)-n,n=1&k>>>16),this.__setDigit(t+d,k<<16|65535&y)}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,t){this[e]=0|t}},{key:"__setDigitGrow",value:function(e,t){this[e]=0|t}},{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,t){var i=e>>>1,_=this.__digit(i),n=1&e?65535&_|t<<16:4294901760&_|65535&t;this.__setDigit(i,n)}}],[{key:"BigInt",value:function(t){var i=Math.floor,_=Number.isFinite;if("number"==typeof t){if(0===t)return g.__zero();if((0|t)===t)return 0>t?g.__oneDigit(-t,!0):g.__oneDigit(t,!1);if(!_(t)||i(t)!==t)throw new RangeError("The number "+t+" cannot be converted to BigInt because it is not an integer");return g.__fromDouble(t)}if("string"==typeof t){var n=g.__fromString(t);if(null===n)throw new SyntaxError("Cannot convert "+t+" to a BigInt");return n}if("boolean"==typeof t)return!0===t?g.__oneDigit(1,!1):g.__zero();if("object"===e(t)){if(t.constructor===g)return t;var o=g.__toPrimitive(t);return g.BigInt(o)}throw new TypeError("Cannot convert "+t+" to a BigInt")}},{key:"toNumber",value:function(e){var t=e.length;if(0===t)return 0;if(1===t){var i=e.__unsignedDigit(0);return e.sign?-i:i}var _=e.__digit(t-1),n=s(_),o=32*t-n;if(1024<o)return e.sign?-Infinity:1/0;var l=o-1,a=_,u=t-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<u&&(u--,a=e.__digit(u),d|=a>>>32-h,b=a<<h,m=h),0<m&&0<u&&(u--,a=e.__digit(u),b|=a>>>32-m,m-=32);var c=g.__decideRounding(e,m,u,a);if((1===c||0===c&&1==(1&b))&&(b=b+1>>>0,0===b&&(d++,0!=d>>>20&&(d=0,l++,1023<l))))return e.sign?-Infinity:1/0;var v=e.sign?-2147483648:0;return l=l+1023<<20,g.__kBitConversionInts[1]=v|l|d,g.__kBitConversionInts[0]=b,g.__kBitConversionDouble[0]}},{key:"unaryMinus",value:function(e){if(0===e.length)return e;var t=e.__copy();return t.sign=!e.sign,t}},{key:"bitwiseNot",value:function(e){return e.sign?g.__absoluteSubOne(e).__trim():g.__absoluteAddOne(e,!0)}},{key:"exponentiate",value:function(e,t){if(t.sign)throw new RangeError("Exponent must be positive");if(0===t.length)return g.__oneDigit(1,!1);if(0===e.length)return e;if(1===e.length&&1===e.__digit(0))return e.sign&&0==(1&t.__digit(0))?g.unaryMinus(e):e;if(1<t.length)throw new RangeError("BigInt too big");var i=t.__unsignedDigit(0);if(1===i)return e;if(i>=g.__kMaxLengthBits)throw new RangeError("BigInt too big");if(1===e.length&&2===e.__digit(0)){var _=1+(i>>>5),n=e.sign&&0!=(1&i),o=new g(_,n);o.__initializeDigits();var l=1<<(31&i);return o.__setDigit(_-1,l),o}var a=null,s=e;for(0!=(1&i)&&(a=e),i>>=1;0!==i;i>>=1)s=g.multiply(s,s),0!=(1&i)&&(null===a?a=s:a=g.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 g(_,e.sign!==t.sign);n.__initializeDigits();for(var o=0;o<e.length;o++)g.__multiplyAccumulate(t,e.__digit(o),n,o);return n.__trim()}},{key:"divide",value:function(e,t){if(0===t.length)throw new RangeError("Division by zero");if(0>g.__absoluteCompare(e,t))return g.__zero();var i,_=e.sign!==t.sign,n=t.__unsignedDigit(0);if(1===t.length&&65535>=n){if(1===n)return _===e.sign?e:g.unaryMinus(e);i=g.__absoluteDivSmall(e,n,null)}else i=g.__absoluteDivLarge(e,t,!0,!1);return i.sign=_,i.__trim()}},{key:"remainder",value:function e(t,i){if(0===i.length)throw new RangeError("Division by zero");if(0>g.__absoluteCompare(t,i))return t;var _=i.__unsignedDigit(0);if(1===i.length&&65535>=_){if(1===_)return g.__zero();var n=g.__absoluteModSmall(t,_);return 0===n?g.__zero():g.__oneDigit(n,t.sign)}var e=g.__absoluteDivLarge(t,i,!1,!0);return e.sign=t.sign,e.__trim()}},{key:"add",value:function(e,t){var i=e.sign;return i===t.sign?g.__absoluteAdd(e,t,i):0<=g.__absoluteCompare(e,t)?g.__absoluteSub(e,t,i):g.__absoluteSub(t,e,!i)}},{key:"subtract",value:function(e,t){var i=e.sign;return i===t.sign?0<=g.__absoluteCompare(e,t)?g.__absoluteSub(e,t,i):g.__absoluteSub(t,e,!i):g.__absoluteAdd(e,t,i)}},{key:"leftShift",value:function(e,t){return 0===t.length||0===e.length?e:t.sign?g.__rightShiftByAbsolute(e,t):g.__leftShiftByAbsolute(e,t)}},{key:"signedRightShift",value:function(e,t){return 0===t.length||0===e.length?e:t.sign?g.__leftShiftByAbsolute(e,t):g.__rightShiftByAbsolute(e,t)}},{key:"unsignedRightShift",value:function(){throw new TypeError("BigInts have no unsigned right shift; use >> instead")}},{key:"lessThan",value:function(e,t){return 0>g.__compareToBigInt(e,t)}},{key:"lessThanOrEqual",value:function(e,t){return 0>=g.__compareToBigInt(e,t)}},{key:"greaterThan",value:function(e,t){return 0<g.__compareToBigInt(e,t)}},{key:"greaterThanOrEqual",value:function(e,t){return 0<=g.__compareToBigInt(e,t)}},{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:"notEqual",value:function(e,t){return!g.equal(e,t)}},{key:"bitwiseAnd",value:function(e,t){if(!e.sign&&!t.sign)return g.__absoluteAnd(e,t).__trim();if(e.sign&&t.sign){var i=l(e.length,t.length)+1,_=g.__absoluteSubOne(e,i),n=g.__absoluteSubOne(t);return _=g.__absoluteOr(_,n,_),g.__absoluteAddOne(_,!0,_).__trim()}if(e.sign){var o=[t,e];e=o[0],t=o[1]}return g.__absoluteAndNot(e,g.__absoluteSubOne(t)).__trim()}},{key:"bitwiseXor",value:function(e,t){if(!e.sign&&!t.sign)return g.__absoluteXor(e,t).__trim();if(e.sign&&t.sign){var i=l(e.length,t.length),_=g.__absoluteSubOne(e,i),n=g.__absoluteSubOne(t);return g.__absoluteXor(_,n,_).__trim()}var o=l(e.length,t.length)+1;if(e.sign){var a=[t,e];e=a[0],t=a[1]}var s=g.__absoluteSubOne(t,o);return s=g.__absoluteXor(s,e,s),g.__absoluteAddOne(s,!0,s).__trim()}},{key:"bitwiseOr",value:function(e,t){var i=l(e.length,t.length);if(!e.sign&&!t.sign)return g.__absoluteOr(e,t).__trim();if(e.sign&&t.sign){var _=g.__absoluteSubOne(e,i),n=g.__absoluteSubOne(t);return _=g.__absoluteAnd(_,n,_),g.__absoluteAddOne(_,!0,_).__trim()}if(e.sign){var o=[t,e];e=o[0],t=o[1]}var a=g.__absoluteSubOne(t,i);return a=g.__absoluteAndNot(a,e,a),g.__absoluteAddOne(a,!0,a).__trim()}},{key:"asIntN",value:function(e,t){if(0===t.length)return t;if(0===e)return g.__zero();if(e>=g.__kMaxLengthBits)return t;var _=e+31>>>5;if(t.length<_)return t;var n=t.__unsignedDigit(_-1),o=1<<(31&e-1);if(t.length===_&&n<o)return t;if(!((n&o)===o))return g.__truncateToNBits(e,t);if(!t.sign)return g.__truncateAndSubFromPowerOfTwo(e,t,!0);if(0==(n&o-1)){for(var l=_-2;0<=l;l--)if(0!==t.__digit(l))return g.__truncateAndSubFromPowerOfTwo(e,t,!1);return t.length===_&&n===o?t:g.__truncateToNBits(e,t)}return g.__truncateAndSubFromPowerOfTwo(e,t,!1)}},{key:"asUintN",value:function(e,t){if(0===t.length)return t;if(0===e)return g.__zero();if(t.sign){if(e>g.__kMaxLengthBits)throw new RangeError("BigInt too big");return g.__truncateAndSubFromPowerOfTwo(e,t,!1)}if(e>=g.__kMaxLengthBits)return t;var i=e+31>>>5;if(t.length<i)return t;var _=31&e;if(t.length==i){if(0===_)return t;var n=t.__digit(i-1);if(0==n>>>_)return t}return g.__truncateToNBits(e,t)}},{key:"ADD",value:function(e,t){if(e=g.__toPrimitive(e),t=g.__toPrimitive(t),"string"==typeof e)return"string"!=typeof t&&(t=t.toString()),e+t;if("string"==typeof t)return e.toString()+t;if(e=g.__toNumeric(e),t=g.__toNumeric(t),g.__isBigInt(e)&&g.__isBigInt(t))return g.add(e,t);if("number"==typeof e&&"number"==typeof t)return e+t;throw new TypeError("Cannot mix BigInt and other types, use explicit conversions")}},{key:"LT",value:function(e,t){return g.__compare(e,t,0)}},{key:"LE",value:function(e,t){return g.__compare(e,t,1)}},{key:"GT",value:function(e,t){return g.__compare(e,t,2)}},{key:"GE",value:function(e,t){return g.__compare(e,t,3)}},{key:"EQ",value:function(t,i){for(;;){if(g.__isBigInt(t))return g.__isBigInt(i)?g.equal(t,i):g.EQ(i,t);if("number"==typeof t){if(g.__isBigInt(i))return g.__equalToNumber(i,t);if("object"!==e(i))return t==i;i=g.__toPrimitive(i)}else if("string"==typeof t){if(g.__isBigInt(i))return t=g.__fromString(t),null!==t&&g.equal(t,i);if("object"!==e(i))return t==i;i=g.__toPrimitive(i)}else if("boolean"==typeof t){if(g.__isBigInt(i))return g.__equalToNumber(i,+t);if("object"!==e(i))return t==i;i=g.__toPrimitive(i)}else if("symbol"===e(t)){if(g.__isBigInt(i))return!1;if("object"!==e(i))return t==i;i=g.__toPrimitive(i)}else if("object"===e(t)){if("object"===e(i)&&i.constructor!==g)return t==i;t=g.__toPrimitive(t)}else return t==i}}},{key:"NE",value:function(e,t){return!g.EQ(e,t)}},{key:"__zero",value:function(){return new g(0,!1)}},{key:"__oneDigit",value:function(e,t){var i=new g(1,t);return i.__setDigit(0,e),i}},{key:"__decideRounding",value:function(e,t,i,_){if(0<t)return-1;var n;if(0>t)n=-t-1;else{if(0===i)return-1;i--,_=e.__digit(i),n=31}var g=1<<n;if(0==(_&g))return-1;if(g-=1,0!=(_&g))return 1;for(;0<i;)if(i--,0!==e.__digit(i))return 1;return 0}},{key:"__fromDouble",value:function(e){g.__kBitConversionDouble[0]=e;var t,i=2047&g.__kBitConversionInts[1]>>>20,_=i-1023,n=(_>>>5)+1,o=new g(n,0>e),l=1048575&g.__kBitConversionInts[1]|1048576,a=g.__kBitConversionInts[0],s=20,u=31&_,r=0;if(u<s){var d=s-u;r=d+32,t=l>>>d,l=l<<32-d|a>>>d,a<<=32-d}else if(u===s)r=32,t=l,l=a;else{var h=u-s;r=32-h,t=l<<h|a>>>32-h,l=a<<h}o.__setDigit(n-1,t);for(var b=n-2;0<=b;b--)0<r?(r-=32,t=l,l=a):t=0,o.__setDigit(b,t);return o.__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 t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,i=0,_=e.length,n=0;if(n===_)return g.__zero();for(var o=e.charCodeAt(n);g.__isWhitespace(o);){if(++n===_)return g.__zero();o=e.charCodeAt(n)}if(43===o){if(++n===_)return null;o=e.charCodeAt(n),i=1}else if(45===o){if(++n===_)return null;o=e.charCodeAt(n),i=-1}if(0===t){if(t=10,48===o){if(++n===_)return g.__zero();if(o=e.charCodeAt(n),88===o||120===o){if(t=16,++n===_)return null;o=e.charCodeAt(n)}else if(79===o||111===o){if(t=8,++n===_)return null;o=e.charCodeAt(n)}else if(66===o||98===o){if(t=2,++n===_)return null;o=e.charCodeAt(n)}}}else if(16===t&&48===o){if(++n===_)return g.__zero();if(o=e.charCodeAt(n),88===o||120===o){if(++n===_)return null;o=e.charCodeAt(n)}}for(;48===o;){if(++n===_)return g.__zero();o=e.charCodeAt(n)}var l=_-n,a=g.__kMaxBitsPerChar[t],s=g.__kBitsPerCharTableMultiplier-1;if(l>1073741824/a)return null;var u=a*l+s>>>g.__kBitsPerCharTableShift,r=new g(u+31>>>5,!1),h=10>t?t:10,b=10<t?t-10:0;if(0==(t&t-1)){a>>=g.__kBitsPerCharTableShift;var c=[],v=[],f=!1;do{for(var y,k=0,D=0;;){if(y=void 0,o-48>>>0<h)y=o-48;else if((32|o)-97>>>0<b)y=(32|o)-87;else{f=!0;break}if(D+=a,k=k<<a|y,++n===_){f=!0;break}if(o=e.charCodeAt(n),32<D+a)break}c.push(k),v.push(D)}while(!f);g.__fillFromParts(r,c,v)}else{r.__initializeDigits();var p=!1,B=0;do{for(var S,C=0,A=1;;){if(S=void 0,o-48>>>0<h)S=o-48;else if((32|o)-97>>>0<b)S=(32|o)-87;else{p=!0;break}var T=A*t;if(4294967295<T)break;if(A=T,C=C*t+S,B++,++n===_){p=!0;break}o=e.charCodeAt(n)}s=32*g.__kBitsPerCharTableMultiplier-1;var m=a*B+s>>>g.__kBitsPerCharTableShift+5;r.__inplaceMultiplyAdd(A,C,m)}while(!p)}if(n!==_){if(!g.__isWhitespace(o))return null;for(n++;n<_;n++)if(o=e.charCodeAt(n),!g.__isWhitespace(o))return null}return 0!==i&&10!==t?null:(r.sign=-1===i,r.__trim())}},{key:"__fillFromParts",value:function(e,t,_){for(var n=0,g=0,o=0,l=t.length-1;0<=l;l--){var a=t[l],s=_[l];g|=a<<o,o+=s,32===o?(e.__setDigit(n++,g),o=0,g=0):32<o&&(e.__setDigit(n++,g),o-=32,g=a>>>s-o)}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 o=n,l=t-1,a=e.__digit(_-1),u=s(a),r=0|(32*_-u+o-1)/o;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),f=(b|v<<m)&l;d[h--]=g.__kConversionChars[f];var y=o-m;for(b=v>>>y,m=32-y;m>=o;)d[h--]=g.__kConversionChars[b&l],b>>>=o,m-=o}var k=(b|a<<m)&l;for(d[h--]=g.__kConversionChars[k],b=a>>>o-m;0!==b;)d[h--]=g.__kConversionChars[b&l],b>>>=o;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 o=e.__unsignedDigit(0).toString(t);return!1===_&&e.sign&&(o="-"+o),o}var l=32*n-s(e.__digit(n-1)),a=g.__kMaxBitsPerChar[t],u=a-1,r=l*g.__kBitsPerCharTableMultiplier;r+=u-1,r=0|r/u;var d,h,b=r+1>>1,m=g.exponentiate(g.__oneDigit(t,!1),g.__oneDigit(b,!1)),c=m.__unsignedDigit(0);if(1===m.length&&65535>=c){d=new g(e.length,!1),d.__initializeDigits();for(var v,f=0,y=2*e.length-1;0<=y;y--)v=f<<16|e.__halfDigit(y),d.__setHalfDigit(y,0|v/c),f=0|v%c;h=f.toString(t)}else{var k=g.__absoluteDivLarge(e,m,!0,!0);d=k.quotient;var D=k.remainder.__trim();h=g.__toStringGeneric(D,t,!0)}d.__trim();for(var p=g.__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,t){var i=e.sign;if(i!==t.sign)return g.__unequalSign(i);var _=g.__absoluteCompare(e,t);return 0<_?g.__absoluteGreater(i):0>_?g.__absoluteLess(i):0}},{key:"__compareToNumber",value:function(e,t){if(!0|t){var i=e.sign,_=0>t;if(i!==_)return g.__unequalSign(i);if(0===e.length){if(_)throw new Error("implementation bug");return 0===t?0:-1}if(1<e.length)return g.__absoluteGreater(i);var n=o(t),l=e.__unsignedDigit(0);return l>n?g.__absoluteGreater(i):l<n?g.__absoluteLess(i):0}return g.__compareToDouble(e,t)}},{key:"__compareToDouble",value:function(e,t){if(t!==t)return t;if(t===1/0)return-1;if(t===-Infinity)return 1;var i=e.sign;if(i!==0>t)return g.__unequalSign(i);if(0===t)throw new Error("implementation bug: should be handled elsewhere");if(0===e.length)return-1;g.__kBitConversionDouble[0]=t;var _=2047&g.__kBitConversionInts[1]>>>20;if(2047==_)throw new Error("implementation bug: handled elsewhere");var n=_-1023;if(0>n)return g.__absoluteGreater(i);var o=e.length,l=e.__digit(o-1),a=s(l),u=32*o-a,r=n+1;if(u<r)return g.__absoluteLess(i);if(u>r)return g.__absoluteGreater(i);var d=1048576|1048575&g.__kBitConversionInts[1],h=g.__kBitConversionInts[0],b=20,m=31-a;if(m!==(u-1)%31)throw new Error("implementation bug");var c,v=0;if(m<b){var f=b-m;v=f+32,c=d>>>f,d=d<<32-f|h>>>f,h<<=32-f}else if(m===b)v=32,c=d,d=h;else{var y=m-b;v=32-y,c=d<<y|h>>>32-y,d=h<<y}if(l>>>=0,c>>>=0,l>c)return g.__absoluteGreater(i);if(l<c)return g.__absoluteLess(i);for(var k=o-2;0<=k;k--){0<v?(v-=32,c=d>>>0,d=h,h=0):c=0;var D=e.__unsignedDigit(k);if(D>c)return g.__absoluteGreater(i);if(D<c)return g.__absoluteLess(i)}if(0!==d||0!==h){if(0===v)throw new Error("implementation bug");return g.__absoluteLess(i)}return 0}},{key:"__equalToNumber",value:function(e,t){return t|0===t?0===t?0===e.length:1===e.length&&e.sign===0>t&&e.__unsignedDigit(0)===o(t):0===g.__compareToDouble(e,t)}},{key:"__comparisonResultToBool",value:function(e,t){switch(t){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,t,i){if(e=g.__toPrimitive(e),t=g.__toPrimitive(t),"string"==typeof e&&"string"==typeof t)switch(i){case 0:return e<t;case 1:return e<=t;case 2:return e>t;case 3:return e>=t}if(g.__isBigInt(e)&&"string"==typeof t)return t=g.__fromString(t),null!==t&&g.__comparisonResultToBool(g.__compareToBigInt(e,t),i);if("string"==typeof e&&g.__isBigInt(t))return e=g.__fromString(e),null!==e&&g.__comparisonResultToBool(g.__compareToBigInt(e,t),i);if(e=g.__toNumeric(e),t=g.__toNumeric(t),g.__isBigInt(e)){if(g.__isBigInt(t))return g.__comparisonResultToBool(g.__compareToBigInt(e,t),i);if("number"!=typeof t)throw new Error("implementation bug");return g.__comparisonResultToBool(g.__compareToNumber(e,t),i)}if("number"!=typeof e)throw new Error("implementation bug");if(g.__isBigInt(t))return g.__comparisonResultToBool(g.__compareToNumber(t,e),2^i);if("number"!=typeof t)throw new Error("implementation bug");return 0===i?e<t:1===i?e<=t:2===i?e>t:3===i?e>=t:void 0}},{key:"__absoluteAdd",value:function(e,t,_){if(e.length<t.length)return g.__absoluteAdd(t,e,_);if(0===e.length)return e;if(0===t.length)return e.sign===_?e:g.unaryMinus(e);var n=e.length;(0===e.__clzmsd()||t.length===e.length&&0===t.__clzmsd())&&n++;for(var o=new g(n,_),l=0,a=0;a<t.length;a++){var s=t.__digit(a),u=e.__digit(a),r=(65535&u)+(65535&s)+l,d=(u>>>16)+(s>>>16)+(r>>>16);l=d>>>16,o.__setDigit(a,65535&r|d<<16)}for(;a<e.length;a++){var h=e.__digit(a),b=(65535&h)+l,m=(h>>>16)+(b>>>16);l=m>>>16,o.__setDigit(a,65535&b|m<<16)}return a<o.length&&o.__setDigit(a,l),o.__trim()}},{key:"__absoluteSub",value:function(e,t,_){if(0===e.length)return e;if(0===t.length)return e.sign===_?e:g.unaryMinus(e);for(var n=new g(e.length,_),o=0,l=0;l<t.length;l++){var a=e.__digit(l),s=t.__digit(l),u=(65535&a)-(65535&s)-o;o=1&u>>>16;var r=(a>>>16)-(s>>>16)-o;o=1&r>>>16,n.__setDigit(l,65535&u|r<<16)}for(;l<e.length;l++){var d=e.__digit(l),h=(65535&d)-o;o=1&h>>>16;var b=(d>>>16)-o;o=1&b>>>16,n.__setDigit(l,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 g(n,t):_.sign=t;for(var o,l=!0,a=0;a<n;a++){if(o=e.__digit(a),l){var s=-1===o;o=0|o+1,l=s}_.__setDigit(a,o)}return l&&_.__setDigitGrow(n,1),_}},{key:"__absoluteSubOne",value:function(e,t){var _=e.length;t=t||_;for(var n,o=new g(t,!1),l=!0,a=0;a<_;a++){if(n=e.__digit(a),l){var s=0===n;n=0|n-1,l=s}o.__setDigit(a,n)}if(l)throw new Error("implementation bug");for(var u=_;u<t;u++)o.__setDigit(u,0);return o}},{key:"__absoluteAnd",value:function(e,t){var _=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,n=e.length,o=t.length,l=o;if(n<o){l=n;var a=e,s=n;e=t,n=o,t=a,o=s}var u=l;null===_?_=new g(u,!1):u=_.length;for(var r=0;r<l;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,o=t.length,l=o;n<o&&(l=n);var a=n;null===_?_=new g(a,!1):a=_.length;for(var s=0;s<l;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,o=t.length,l=o;if(n<o){l=n;var a=e,s=n;e=t,n=o,t=a,o=s}var u=n;null===_?_=new g(u,!1):u=_.length;for(var r=0;r<l;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,o=t.length,l=o;if(n<o){l=n;var a=e,s=n;e=t,n=o,t=a,o=s}var u=n;null===_?_=new g(u,!1):u=_.length;for(var r=0;r<l;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,o=t>>>16,l=0,s=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,f=a(c,g),y=a(c,o),k=a(v,g),D=a(v,o);h+=s+(65535&f),b+=u+l+(h>>>16)+(f>>>16)+(65535&y)+(65535&k),l=b>>>16,s=(y>>>16)+(k>>>16)+(65535&D)+l,l=s>>>16,s&=65535,u=D>>>16,d=65535&h|b<<16,_.__setDigit(n,d)}for(;0!==l||0!==s||0!==u;n++){var p=_.__digit(n),B=(65535&p)+s,S=(p>>>16)+(B>>>16)+u+l;s=0,u=0,l=S>>>16,p=65535&B|S<<16,_.__setDigit(n,p)}}}},{key:"__internalMultiplyAdd",value:function(e,t,_,g,o){for(var l=_,s=0,u=0;u<g;u++){var r=e.__digit(u),d=a(65535&r,t),h=(65535&d)+s+l;l=h>>>16;var b=a(r>>>16,t),m=(65535&b)+(d>>>16)+l;l=m>>>16,s=b>>>16,o.__setDigit(u,m<<16|65535&h)}if(o.length>g)for(o.__setDigit(g++,l+s);g<o.length;)o.__setDigit(g++,0);else if(0!==l+s)throw new Error("implementation bug")}},{key:"__absoluteDivSmall",value:function(e,t,_){null===_&&(_=new g(e.length,!1));for(var n=0,o=2*e.length-1;0<=o;o-=2){var l=(n<<16|e.__halfDigit(o))>>>0,a=0|l/t;n=0|l%t,l=(n<<16|e.__halfDigit(o-1))>>>0;var s=0|l/t;n=0|l%t,_.__setDigit(o>>>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,t,i,_){var o=t.__halfDigitLength(),n=t.length,l=e.__halfDigitLength()-o,s=null;i&&(s=new g(l+2>>>1,!1),s.__initializeDigits());var r=new g(o+2>>>1,!1);r.__initializeDigits();var d=g.__clz16(t.__halfDigit(o-1));0<d&&(t=g.__specialLeftShift(t,d,0));for(var h=g.__specialLeftShift(e,d,1),u=t.__halfDigit(o-1),b=0,m=l;0<=m;m--){var v=65535,f=h.__halfDigit(m+o);if(f!==u){var y=(f<<16|h.__halfDigit(m+o-1))>>>0;v=0|y/u;for(var k=0|y%u,D=t.__halfDigit(o-2),p=h.__halfDigit(m+o-2);a(v,D)>>>0>(k<<16|p)>>>0&&(v--,k+=u,!(65535<k)););}g.__internalMultiplyAdd(t,v,0,n,r);var B=h.__inplaceSub(r,m,o+1);0!==B&&(B=h.__inplaceAdd(t,m,o),h.__setHalfDigit(m+o,h.__halfDigit(m+o)+B),v--),i&&(1&m?b=v<<16:s.__setDigit(m>>>1,b|v))}return _?(h.__inplaceRightShift(d),i?{quotient:s,remainder:h}:h):i?s:void 0}},{key:"__clz16",value:function(e){return s(e)-16}},{key:"__specialLeftShift",value:function(e,t,_){var o=e.length,n=new g(o+_,!1);if(0===t){for(var l=0;l<o;l++)n.__setDigit(l,e.__digit(l));return 0<_&&n.__setDigit(o,0),n}for(var a,s=0,u=0;u<o;u++)a=e.__digit(u),n.__setDigit(u,a<<t|s),s=a>>>32-t;return 0<_&&n.__setDigit(o,s),n}},{key:"__leftShiftByAbsolute",value:function(e,t){var _=g.__toShiftAmount(t);if(0>_)throw new RangeError("BigInt too big");var n=_>>>5,o=31&_,l=e.length,a=0!==o&&0!=e.__digit(l-1)>>>32-o,s=l+n+(a?1:0),u=new g(s,e.sign);if(0===o){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<l;c++)m=e.__digit(c),u.__setDigit(c+n,m<<o|h),h=m>>>32-o;if(a)u.__setDigit(l+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,o=g.__toShiftAmount(t);if(0>o)return g.__rightShiftByMaximum(n);var l=o>>>5,a=31&o,s=_-l;if(0>=s)return g.__rightShiftByMaximum(n);var u=!1;if(n){if(0!=(e.__digit(l)&(1<<a)-1))u=!0;else for(var r=0;r<l;r++)if(0!==e.__digit(r)){u=!0;break}}if(u&&0===a){var h=e.__digit(_-1);0==~h&&s++}var b=new g(s,n);if(0===a)for(var m=l;m<_;m++)b.__setDigit(m-l,e.__digit(m));else{for(var c,v=e.__digit(l)>>>a,f=_-l-1,y=0;y<f;y++)c=e.__digit(y+l+1),b.__setDigit(y,c<<32-a|v),v=c>>>a;b.__setDigit(f,v)}return u&&(b=g.__absoluteAddOne(b,!0,b)),b.__trim()}},{key:"__rightShiftByMaximum",value:function(e){return e?g.__oneDigit(1,!0):g.__zero()}},{key:"__toShiftAmount",value:function(e){if(1<e.length)return-1;var t=e.__unsignedDigit(0);return t>g.__kMaxLengthBits?-1:t}},{key:"__toPrimitive",value:function(t){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"default";if("object"!==e(t))return t;if(t.constructor===g)return t;var _=t[Symbol.toPrimitive];if(_){var n=_(i);if("object"!==e(n))return n;throw new TypeError("Cannot convert object to primitive value")}var o=t.valueOf;if(o){var l=o.call(t);if("object"!==e(l))return l}var a=t.toString;if(a){var s=a.call(t);if("object"!==e(s))return s}throw new TypeError("Cannot convert object to primitive value")}},{key:"__toNumeric",value:function(e){return g.__isBigInt(e)?e:+e}},{key:"__isBigInt",value:function(t){return"object"===e(t)&&t.constructor===g}},{key:"__truncateToNBits",value:function(e,t){for(var _=e+31>>>5,n=new g(_,t.sign),o=_-1,l=0;l<o;l++)n.__setDigit(l,t.__digit(l));var a=t.__digit(o);if(0!=(31&e)){var s=32-(31&e);a=a<<s>>>s}return n.__setDigit(o,a),n.__trim()}},{key:"__truncateAndSubFromPowerOfTwo",value:function(e,t,_){for(var n=Math.min,o=e+31>>>5,l=new g(o,_),a=0,s=o-1,u=0,r=n(s,t.length);a<r;a++){var d=t.__digit(a),h=0-(65535&d)-u;u=1&h>>>16;var b=0-(d>>>16)-u;u=1&b>>>16,l.__setDigit(a,65535&h|b<<16)}for(;a<s;a++)l.__setDigit(a,0|-u);var m,c=s<t.length?t.__digit(s):0,v=31&e;if(0===v){var f=0-(65535&c)-u;u=1&f>>>16;var y=0-(c>>>16)-u;m=65535&f|y<<16}else{var k=32-v;c=c<<k>>>k;var D=1<<32-k,p=(65535&D)-(65535&c)-u;u=1&p>>>16;var B=(D>>>16)-(c>>>16)-u;m=65535&p|B<<16,m&=D-1}return l.__setDigit(s,m),l.__trim()}},{key:"__digitPow",value:function(e,t){for(var i=1;0<t;)1&t&&(i*=e),t>>>=1,e*=e;return i}}]),g}(r(Array));return f.__kMaxLength=33554432,f.__kMaxLengthBits=f.__kMaxLength<<5,f.__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],f.__kBitsPerCharTableShift=5,f.__kBitsPerCharTableMultiplier=1<<f.__kBitsPerCharTableShift,f.__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"],f.__kBitConversionBuffer=new ArrayBuffer(8),f.__kBitConversionDouble=new Float64Array(f.__kBitConversionBuffer),f.__kBitConversionInts=new Int32Array(f.__kBitConversionBuffer),f})},{}],132:[function(require,module,exports){module.exports=assert;function assert(val,msg){if(!val)throw new Error(msg||"Assertion failed")}assert.equal=function assertEqual(l,r,msg){if(l!=r)throw new Error(msg||"Assertion failed: "+l+" != "+r)}},{}],133:[function(require,module,exports){"use strict";var utils=exports;function toArray(msg,enc){if(Array.isArray(msg))return msg.slice();if(!msg)return[];var res=[];if(typeof msg!=="string"){for(var i=0;i<msg.length;i++)res[i]=msg[i]|0;return res}if(enc==="hex"){msg=msg.replace(/[^a-z0-9]+/gi,"");if(msg.length%2!==0)msg="0"+msg;for(var i=0;i<msg.length;i+=2)res.push(parseInt(msg[i]+msg[i+1],16))}else{for(var i=0;i<msg.length;i++){var c=msg.charCodeAt(i);var hi=c>>8;var lo=c&255;if(hi)res.push(hi,lo);else res.push(lo)}}return res}utils.toArray=toArray;function zero2(word){if(word.length===1)return"0"+word;else return word}utils.zero2=zero2;function toHex(msg){var res="";for(var i=0;i<msg.length;i++)res+=zero2(msg[i].toString(16));return res}utils.toHex=toHex;utils.encode=function encode(arr,enc){if(enc==="hex")return toHex(arr);else return arr}},{}],134:[function(require,module,exports){var process=module.exports={};var cachedSetTimeout;var cachedClearTimeout;function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}(function(){try{if(typeof setTimeout==="function"){cachedSetTimeout=setTimeout}else{cachedSetTimeout=defaultSetTimout}}catch(e){cachedSetTimeout=defaultSetTimout}try{if(typeof clearTimeout==="function"){cachedClearTimeout=clearTimeout}else{cachedClearTimeout=defaultClearTimeout}}catch(e){cachedClearTimeout=defaultClearTimeout}})();function runTimeout(fun){if(cachedSetTimeout===setTimeout){return setTimeout(fun,0)}if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout){cachedSetTimeout=setTimeout;return setTimeout(fun,0)}try{return cachedSetTimeout(fun,0)}catch(e){try{return cachedSetTimeout.call(null,fun,0)}catch(e){return cachedSetTimeout.call(this,fun,0)}}}function runClearTimeout(marker){if(cachedClearTimeout===clearTimeout){return clearTimeout(marker)}if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout){cachedClearTimeout=clearTimeout;return clearTimeout(marker)}try{return cachedClearTimeout(marker)}catch(e){try{return cachedClearTimeout.call(null,marker)}catch(e){return cachedClearTimeout.call(this,marker)}}}var queue=[];var draining=false;var currentQueue;var queueIndex=-1;function cleanUpNextTick(){if(!draining||!currentQueue){return}draining=false;if(currentQueue.length){queue=currentQueue.concat(queue)}else{queueIndex=-1}if(queue.length){drainQueue()}}function drainQueue(){if(draining){return}var timeout=runTimeout(cleanUpNextTick);draining=true;var len=queue.length;while(len){currentQueue=queue;queue=[];while(++queueIndex<len){if(currentQueue){currentQueue[queueIndex].run()}}queueIndex=-1;len=queue.length}currentQueue=null;draining=false;runClearTimeout(timeout)}process.nextTick=function(fun){var args=new Array(arguments.length-1);if(arguments.length>1){for(var i=1;i<arguments.length;i++){args[i-1]=arguments[i]}}queue.push(new Item(fun,args));if(queue.length===1&&!draining){runTimeout(drainQueue)}};function Item(fun,array){this.fun=fun;this.array=array}Item.prototype.run=function(){this.fun.apply(null,this.array)};process.title="browser";process.browser=true;process.env={};process.argv=[];process.version="";process.versions={};function noop(){}process.on=noop;process.addListener=noop;process.once=noop;process.off=noop;process.removeListener=noop;process.removeAllListeners=noop;process.emit=noop;process.prependListener=noop;process.prependOnceListener=noop;process.listeners=function(name){return[]};process.binding=function(name){throw new Error("process.binding is not supported")};process.cwd=function(){return"/"};process.chdir=function(dir){throw new Error("process.chdir is not supported")};process.umask=function(){return 0}},{}],135:[function(require,module,exports){(function(process){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var isProduction=process.env.NODE_ENV==="production";var prefix="Invariant failed";function invariant(condition,message){if(condition){return}if(isProduction){throw new Error(prefix)}throw new Error(prefix+": "+(message||""))}exports.default=invariant}).call(this,require("_process"))},{_process:134}],136:[function(require,module,exports){(function(process){"use strict";var isProduction=process.env.NODE_ENV==="production";function warning(condition,message){if(!isProduction){if(condition){return}var text="Warning: "+message;if(typeof console!=="undefined"){console.warn(text)}try{throw Error(text)}catch(x){}}}module.exports=warning}).call(this,require("_process"))},{_process:134}],137:[function(require,module,exports){function toFormat(Ctor){"use strict";Ctor.prototype.toFormat=function toFormat(dp,rm,fmt){if(!this.e&&this.e!==0)return this.toString();var arr,g1,g2,i,u,nd,intd,intp,fracp,dsep,gsep,gsize,sgsize,fgsep,fgsize,tfmt=this.format||{},cfmt=this.constructor.format||{};if(dp!=u){if(typeof dp=="object"){fmt=dp;dp=u}else if(rm!=u){if(typeof rm=="object"){fmt=rm;rm=u}else if(typeof fmt!="object"){fmt={}}}else{fmt={}}}else{fmt={}}arr=this.toFixed(dp,rm).split(".");intp=arr[0];fracp=arr[1];intd=this.s<0?intp.slice(1):intp;nd=intd.length;dsep=fmt.decimalSeparator;if(dsep==u){dsep=tfmt.decimalSeparator;if(dsep==u){dsep=cfmt.decimalSeparator;if(dsep==u)dsep="."}}gsep=fmt.groupSeparator;if(gsep==u){gsep=tfmt.groupSeparator;if(gsep==u)gsep=cfmt.groupSeparator}if(gsep){gsize=fmt.groupSize;if(gsize==u){gsize=tfmt.groupSize;if(gsize==u){gsize=cfmt.groupSize;if(gsize==u)gsize=0}}sgsize=fmt.secondaryGroupSize;if(sgsize==u){sgsize=tfmt.secondaryGroupSize;if(sgsize==u){sgsize=cfmt.secondaryGroupSize;if(sgsize==u)sgsize=0}}if(sgsize){g1=+sgsize;g2=+gsize;nd-=g2}else{g1=+gsize;g2=+sgsize}if(g1>0&&nd>0){i=nd%g1||g1;intp=intd.substr(0,i);for(;i<nd;i+=g1)intp+=gsep+intd.substr(i,g1);if(g2>0)intp+=gsep+intd.slice(i);if(this.s<0)intp="-"+intp}}if(fracp){fgsep=fmt.fractionGroupSeparator;if(fgsep==u){fgsep=tfmt.fractionGroupSeparator;if(fgsep==u)fgsep=cfmt.fractionGroupSeparator}if(fgsep){fgsize=fmt.fractionGroupSize;if(fgsize==u){fgsize=tfmt.fractionGroupSize;if(fgsize==u){fgsize=cfmt.fractionGroupSize;if(fgsize==u)fgsize=0}}fgsize=+fgsize;if(fgsize){fracp=fracp.replace(new RegExp("\\d{"+fgsize+"}\\B","g"),"$&"+fgsep)}}return intp+dsep+fracp}else{return intp}};Ctor.format={decimalSeparator:".",groupSeparator:",",groupSize:3,secondaryGroupSize:0,fractionGroupSeparator:"",fractionGroupSize:0};return Ctor}if(typeof module!=="undefined"&&module.exports)module.exports=toFormat},{}]},{},[1]);