if(!(thisinstanceofD))throwError("AES must be instanitated with `new`");Object.defineProperty(this,"key",{value:f(a,!0)}),this._prepare()};D.prototype._prepare=function(){vara=n[this.key.length];if(null==a)thrownewError("invalid key size (must be 16, 24 or 32 bytes)");this._Ke=[],this._Kd=[];for(varb=0;b<=a;b++)this._Ke.push([0,0,0,0]),this._Kd.push([0,0,0,0]);for(varc,d=4*(a+1),e=this.key.length/4,f=i(this.key),b=0;b<e;b++)c=b>>2,this._Ke[c][b%4]=f[b],this._Kd[a-c][b%4]=f[b];for(varg,h=0,j=e;j<d;){if(g=f[e-1],f[0]^=p[g>>16&255]<<24^p[g>>8&255]<<16^p[255&g]<<8^p[g>>24&255]^o[h]<<24,h+=1,8!=e)for(varb=1;b<e;b++)f[b]^=f[b-1];else{for(varb=1;b<e/2;b++)f[b]^=f[b-1];g=f[e/2-1],f[e/2]^=p[255&g]^p[g>>8&255]<<8^p[g>>16&255]<<16^p[g>>24&255]<<24;for(varb=e/2+1;b<e;b++)f[b]^=f[b-1]}for(vark,l,b=0;b<e&&j<d;)k=j>>2,l=j%4,this._Ke[k][l]=f[b],this._Kd[a-k][l]=f[b++],j++}for(vark=1;k<a;k++)for(varl=0;l<4;l++)g=this._Kd[k][l],this._Kd[k][l]=z[g>>24&255]^A[g>>16&255]^B[g>>8&255]^C[255&g]},D.prototype.encrypt=function(a){if(16!=a.length)thrownewError("invalid plaintext size (must be 16 bytes)");for(varb=this._Ke.length-1,c=[0,0,0,0],d=i(a),e=0;e<4;e++)d[e]^=this._Ke[0][e];for(varf=1;f<b;f++){for(vare=0;e<4;e++)c[e]=r[d[e]>>24&255]^s[d[(e+1)%4]>>16&255]^t[d[(e+2)%4]>>8&255]^u[255&d[(e+3)%4]]^this._Ke[f][e];d=c.slice()}for(varh,j=g(16),e=0;e<4;e++)h=this._Ke[b][e],j[4*e]=255&(p[d[e]>>24&255]^h>>24),j[4*e+1]=255&(p[d[(e+1)%4]>>16&255]^h>>16),j[4*e+2]=255&(p[d[(e+2)%4]>>8&255]^h>>8),j[4*e+3]=255&(p[255&d[(e+3)%4]]^h);returnj},D.prototype.decrypt=function(a){if(16!=a.length)thrownewError("invalid ciphertext size (must be 16 bytes)");for(varb=this._Kd.length-1,c=[0,0,0,0],d=i(a),e=0;e<4;e++)d[e]^=this._Kd[0][e];for(varf=1;f<b;f++){for(vare=0;e<4;e++)c[e]=v[d[e]>>24&255]^w[d[(e+3)%4]>>16&255]^x[d[(e+2)%4]>>8&255]^y[255&d[(e+1)%4]]^this._Kd[f][e];d=c.slice()}for(varh,j=g(16),e=0;e<4;e++)h=this._Kd[b][e],j[4*e]=255&(q[d[e]>>24&255]^h>>24),j[4*e+1]=255&(q[d[(e+3)%4]>>16&255]^h>>16),j[4*e+2]=255&(q[d[(e+2)%4]>>8&255]^h>>8),j[4*e+3]=255&(q[255&d[(e+1)%4]]^h);returnj};varE=function(a){if(!(thisinstanceofE))throwError("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=newD(a)};E.prototype.encrypt=function(a){if(a=f(a),a.length%16!==0)thrownewError("invalid plaintext size (must be multiple of 16 bytes)");for(varb=g(a.length),c=g(16),d=0;d<a.length;d+=16)h(a,c,0,d,d+16),c=this._aes.encrypt(c),h(c,b,d);returnb},E.prototype.decrypt=function(a){if(a=f(a),a.length%16!==0)thrownewError("invalid ciphertext size (must be multiple of 16 bytes)");for(varb=g(a.length),c=g(16),d=0;d<a.length;d+=16)h(a,c,0,d,d+16),c=this._aes.decrypt(c),h(c,b,d);returnb};varF=function(a,b){if(!(thisinstanceofF))throwError("AES must be instanitated with `new`");if(this.description="Cipher Block Chaining",this.name="cbc",b){if(16!=b.length)thrownewError("invalid initialation vector size (must be 16 bytes)")}elseb=g(16);this._lastCipherblock=f(b,!0),this._aes=newD(a)};F.prototype.encrypt=function(a){if(a=f(a),a.length%16!==0)thrownewError("invalid plaintext size (must be multiple of 16 bytes)");for(varb=g(a.length),c=g(16),d=0;d<a.length;d+=16){h(a,c,0,d,d+16);for(vare=0;e<16;e++)c[e]^=this._lastCipherblock[e];this._lastCipherblock=this._aes.encrypt(c),h(this._lastCipherblock,b,d)}returnb},F.prototype.decrypt=function(a){if(a=f(a),a.length%16!==0)thrownewError("invalid ciphertext size (must be multiple of 16 bytes)");for(varb=g(a.length),c=g(16),d=0;d<a.length;d+=16){h(a,c,0,d,d+16),c=this._aes.decrypt(c);for(vare=0;e<16;e++)b[d+e]=c[e]^this._lastCipherblock[e];h(a,this._lastCipherblock,0,d,d+16)}returnb};varG=function(a,b,c){if(!(thisinstanceofG))throwError("AES must be instanitated with `new`");if(this.description="Cipher Feedback",this.name="cfb",b){if(16!=b.length)thrownewError("invalid initialation vector size (must be 16 size)")}elseb=g(16);c||(c=1),this.segmentSize=c,this._shiftRegister=f(b,!0),this._aes=newD(a)};G.prototype.encrypt=function(a){if(a.length%
c[2*g]=8191&f,f>>>=13,c[2*g+1]=8191&f,f>>>=13;for(g=2*b;g<e;++g)c[g]=0;d(0===f),d(0===(f&-8192))},m.prototype.stub=function(a){for(varb=newArray(a),c=0;c<a;c++)b[c]=0;returnb},m.prototype.mulp=function(a,b,c){vard=2*this.guessLen13b(a.length,b.length),e=this.makeRBT(d),f=this.stub(d),g=newArray(d),h=newArray(d),i=newArray(d),j=newArray(d),k=newArray(d),l=newArray(d),m=c.words;m.length=d,this.convert13b(a.words,a.length,g,d),this.convert13b(b.words,b.length,j,d),this.transform(g,f,h,i,d,e),this.transform(j,f,k,l,d,e);for(varn=0;n<d;n++){varo=h[n]*k[n]-i[n]*l[n];i[n]=h[n]*l[n]+i[n]*k[n],h[n]=o}returnthis.conjugate(h,i,d),this.transform(h,i,m,f,d,e),this.conjugate(m,f,d),this.normalize13b(m,d),c.negative=a.negative^b.negative,c.length=a.length+b.length,c.strip()},f.prototype.mul=function(a){varb=newf(null);returnb.words=newArray(this.length+a.length),this.mulTo(a,b)},f.prototype.mulf=function(a){varb=newf(null);returnb.words=newArray(this.length+a.length),l(this,a,b)},f.prototype.imul=function(a){returnthis.clone().mulTo(a,this)},f.prototype.imuln=function(a){d("number"==typeofa),d(a<67108864);for(varb=0,c=0;c<this.length;c++){vare=(0|this.words[c])*a,f=(67108863&e)+(67108863&b);b>>=26,b+=e/67108864|0,b+=f>>>26,this.words[c]=67108863&f}return0!==b&&(this.words[c]=b,this.length++),this},f.prototype.muln=function(a){returnthis.clone().imuln(a)},f.prototype.sqr=function(){returnthis.mul(this)},f.prototype.isqr=function(){returnthis.imul(this.clone())},f.prototype.pow=function(a){varb=i(a);if(0===b.length)returnnewf(1);for(varc=this,d=0;d<b.length&&0===b[d];d++,c=c.sqr());if(++d<b.length)for(vare=c.sqr();d<b.length;d++,e=e.sqr())0!==b[d]&&(c=c.mul(e));returnc},f.prototype.iushln=function(a){d("number"==typeofa&&a>=0);varb,c=a%26,e=(a-c)/26,f=67108863>>>26-c<<26-c;if(0!==c){varg=0;for(b=0;b<this.length;b++){varh=this.words[b]&f,i=(0|this.words[b])-h<<c;this.words[b]=i|g,g=h>>>26-c}g&&(this.words[b]=g,this.length++)}if(0!==e){for(b=this.length-1;b>=0;b--)this.words[b+e]=this.words[b];for(b=0;b<e;b++)this.words[b]=0;this.length+=e}returnthis.strip()},f.prototype.ishln=function(a){returnd(0===this.negative),this.iushln(a)},f.prototype.iushrn=function(a,b,c){d("number"==typeofa&&a>=0);vare;e=b?(b-b%26)/26:0;varf=a%26,g=Math.min((a-f)/26,this.length),h=67108863^67108863>>>f<<f,i=c;if(e-=g,e=Math.max(0,e),i){for(varj=0;j<g;j++)i.words[j]=this.words[j];i.length=g}if(0===g);elseif(this.length>g)for(this.length-=g,j=0;j<this.length;j++)this.words[j]=this.words[j+g];elsethis.words[0]=0,this.length=1;vark=0;for(j=this.length-1;j>=0&&(0!==k||j>=e);j--){varl=0|this.words[j];this.words[j]=k<<26-f|l>>>f,k=l&h}returni&&0!==k&&(i.words[i.length++]=k),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},f.prototype.ishrn=function(a,b,c){returnd(0===this.negative),this.iushrn(a,b,c)},f.prototype.shln=function(a){returnthis.clone().ishln(a)},f.prototype.ushln=function(a){returnthis.clone().iushln(a)},f.prototype.shrn=function(a){returnthis.clone().ishrn(a)},f.prototype.ushrn=function(a){returnthis.clone().iushrn(a)},f.prototype.testn=function(a){d("number"==typeofa&&a>=0);varb=a%26,c=(a-b)/26,e=1<<b;if(this.length<=c)return!1;varf=this.words[c];return!!(f&e)},f.prototype.imaskn=function(a){d("number"==typeofa&&a>=0);varb=a%26,c=(a-b)/26;if(d(0===this.negative,"imaskn works only with positive numbers"),this.length<=c)returnthis;if(0!==b&&c++,this.length=Math.min(c,this.length),0!==b){vare=67108863^67108863>>>b<<b;this.words[this.length-1]&=e}returnthis.strip()},f.prototype.maskn=function(a){returnthis.clone().imaskn(a)},f.prototype.iaddn=function(a){returnd("number"==typeofa),d(a<67108864),a<0?this.isubn(-a):0!==this.negative?1===this.length&&(0|this.words[0])<a?(this.words[0]=a-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(a),this.negative=1,this):this._iaddn(a)},f.prototype._iaddn=function(a){this.words[0]+=a;for(varb=0;b<this.length&&this.words[b]>=67108864;b++)this.words[b]-=67108864,b===this.length-1?this.words[b+1]=1:this.words[b+1]++;returnthi
c&&(b=b.substring(1)),"."===b&&g("invalid value",{input:a});vard=b.split(".");d.length>2&&g("too many decimal points",{input:a});vare=d[0],h=d[1];for(e||(e="0"),h||(h="0"),h.length>18&&g("too many decimal places",{input:a,decimals:h.length});h.length<18;)h+="0";e=f(e),h=f(h);vark=e.mul(j).add(h);returnc&&(k=k.mul(i)),k}varf=a("./bignumber.js").bigNumberify,g=a("./throw-error"),h=newf(0),i=newf((-1)),j=newf("1000000000000000000");b.exports={formatEther:d,parseEther:e}},{"./bignumber.js":21,"./throw-error":35}],37:[function(a,b,c){functiond(a){for(varb=[],c=0,d=0;d<a.length;d++){vare=a.charCodeAt(d);e<128?b[c++]=e:e<2048?(b[c++]=e>>6|192,b[c++]=63&e|128):55296==(64512&e)&&d+1<a.length&&56320==(64512&a.charCodeAt(d+1))?(e=65536+((1023&e)<<10)+(1023&a.charCodeAt(++d)),b[c++]=e>>18|240,b[c++]=e>>12&63|128,b[c++]=e>>6&63|128,b[c++]=63&e|128):(b[c++]=e>>12|224,b[c++]=e>>6&63|128,b[c++]=63&e|128)}returnf.arrayify(b)}functione(a){a=f.arrayify(a);for(varb="",c=0;c<a.length;){vard=a[c++];if(d>>7!=0){if(d>>6!=2){vare=null;if(d>>5==6)e=1;elseif(d>>4==14)e=2;elseif(d>>3==30)e=3;elseif(d>>2==62)e=4;else{if(d>>1!=126)continue;e=5}if(c+e>a.length){for(;c<a.length&&a[c]>>6==2;c++);if(c!=a.length)continue;returnb}varg,h=d&(1<<8-e-1)-1;for(g=0;g<e;g++){vari=a[c++];if(i>>6!=2)break;h=h<<6|63&i}g==e?h<=65535?b+=String.fromCharCode(h):(h-=65536,b+=String.fromCharCode((h>>10&1023)+55296,(1023&h)+56320)):c--}}elseb+=String.fromCharCode(d)}returnb}varf=a("./convert.js");b.exports={toUtf8Bytes:d,toUtf8String:e}},{"./convert.js":24}],38:[function(a,b,c){vard=c;d.utils=a("./hash/utils"),d.common=a("./hash/common"),d.sha=a("./hash/sha"),d.ripemd=a("./hash/ripemd"),d.hmac=a("./hash/hmac"),d.sha1=d.sha.sha1,d.sha256=d.sha.sha256,d.sha224=d.sha.sha224,d.sha384=d.sha.sha384,d.sha512=d.sha.sha512,d.ripemd160=d.ripemd.ripemd160},{"./hash/common":39,"./hash/hmac":40,"./hash/ripemd":41,"./hash/sha":42,"./hash/utils":49}],39:[function(a,b,c){"use strict";functiond(){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}vare=a("./utils"),f=a("minimalistic-assert");c.BlockHash=d,d.prototype.update=function(a,b){if(a=e.toArray(a,b),this.pending?this.pending=this.pending.concat(a):this.pending=a,this.pendingTotal+=a.length,this.pending.length>=this._delta8){a=this.pending;varc=a.length%this._delta8;this.pending=a.slice(a.length-c,a.length),0===this.pending.length&&(this.pending=null),a=e.join32(a,0,a.length-c,this.endian);for(vard=0;d<a.length;d+=this._delta32)this._update(a,d,d+this._delta32)}returnthis},d.prototype.digest=function(a){returnthis.update(this._pad()),f(null===this.pending),this._digest(a)},d.prototype._pad=function(){vara=this.pendingTotal,b=this._delta8,c=b-(a+this.padLength)%b,d=newArray(c+this.padLength);d[0]=128;for(vare=1;e<c;e++)d[e]=0;if(a<<=3,"big"===this.endian){for(varf=8;f<this.padLength;f++)d[e++]=0;d[e++]=0,d[e++]=0,d[e++]=0,d[e++]=0,d[e++]=a>>>24&255,d[e++]=a>>>16&255,d[e++]=a>>>8&255,d[e++]=255&a}elsefor(d[e++]=255&a,d[e++]=a>>>8&255,d[e++]=a>>>16&255,d[e++]=a>>>24&255,d[e++]=0,d[e++]=0,d[e++]=0,d[e++]=0,f=8;f<this.padLength;f++)d[e++]=0;returnd}},{"./utils":49,"minimalistic-assert":52}],40:[function(a,b,c){"use strict";functiond(a,b,c){returnthisinstanceofd?(this.Hash=a,this.blockSize=a.blockSize/8,this.outSize=a.outSize/8,this.inner=null,this.outer=null,voidthis._init(e.toArray(b,c))):newd(a,b,c)}vare=a("./utils"),f=a("minimalistic-assert");b.exports=d,d.prototype._init=function(a){a.length>this.blockSize&&(a=(newthis.Hash).update(a).digest()),f(a.length<=this.blockSize);for(varb=a.length;b<this.blockSize;b++)a.push(0);for(b=0;b<a.length;b++)a[b]^=54;for(this.inner=(newthis.Hash).update(a),b=0;b<a.length;b++)a[b]^=106;this.outer=(newthis.Hash).update(a)},d.prototype.update=function(a,b){returnthis.inner.update(a,b),this},d.prototype.digest=function(
},{}],57:[function(a,b,c){functiond(a,b,c){vard=b&&c||0,e=0;for(b=b||[],a.toLowerCase().replace(/[0-9a-f]{2}/g,function(a){e<16&&(b[d+e++]=j[a])});e<16;)b[d+e++]=0;returnb}functione(a,b){varc=b||0,d=i;returnd[a[c++]]+d[a[c++]]+d[a[c++]]+d[a[c++]]+"-"+d[a[c++]]+d[a[c++]]+"-"+d[a[c++]]+d[a[c++]]+"-"+d[a[c++]]+d[a[c++]]+"-"+d[a[c++]]+d[a[c++]]+d[a[c++]]+d[a[c++]]+d[a[c++]]+d[a[c++]]}functionf(a,b,c){vard=b&&c||0,f=b||[];a=a||{};varg=void0!==a.clockseq?a.clockseq:n,h=void0!==a.msecs?a.msecs:(newDate).getTime(),i=void0!==a.nsecs?a.nsecs:p+1,j=h-o+(i-p)/1e4;if(j<0&&void0===a.clockseq&&(g=g+1&16383),(j<0||h>o)&&void0===a.nsecs&&(i=0),i>=1e4)thrownewError("uuid.v1(): Can't create more than 10M uuids/sec");o=h,p=i,n=g,h+=122192928e5;vark=(1e4*(268435455&h)+i)%4294967296;f[d++]=k>>>24&255,f[d++]=k>>>16&255,f[d++]=k>>>8&255,f[d++]=255&k;varl=h/4294967296*1e4&268435455;f[d++]=l>>>8&255,f[d++]=255&l,f[d++]=l>>>24&15|16,f[d++]=l>>>16&255,f[d++]=g>>>8|128,f[d++]=255&g;for(varq=a.node||m,r=0;r<6;r++)f[d+r]=q[r];returnb?b:e(f)}functiong(a,b,c){vard=b&&c||0;"string"==typeofa&&(b="binary"==a?newArray(16):null,a=null),a=a||{};varf=a.random||(a.rng||h)();if(f[6]=15&f[6]|64,f[8]=63&f[8]|128,b)for(varg=0;g<16;g++)b[d+g]=f[g];returnb||e(f)}for(varh=a("./rng"),i=[],j={},k=0;k<256;k++)i[k]=(k+256).toString(16).substr(1),j[i[k]]=k;varl=h(),m=[1|l[0],l[1],l[2],l[3],l[4],l[5]],n=16383&(l[6]<<8|l[7]),o=0,p=0,q=g;q.v1=f,q.v4=g,q.parse=d,q.unparse=e,b.exports=q},{"./rng":56}],58:[function(a,b,c){functiond(a){return(1<<a)-1<<8-a}functione(a){return(1<<a)-1}functionf(a,b,c,d){if(!(thisinstanceoff))thrownewError("missing new");m.defineProperty(this,"_keyPair",a),m.defineProperty(this,"privateKey",m.hexlify(a.priv.toArray("be",32))),m.defineProperty(this,"publicKey","0x"+a.getPublic(!0,"hex")),m.defineProperty(this,"chainCode",m.hexlify(b)),m.defineProperty(this,"index",c),m.defineProperty(this,"depth",d)}functiong(a,b){if(b)if(b.normalize)b=b.normalize("NFKD");elsefor(varc=0;c<b.length;c++){vard=b.charCodeAt(c);if(d<32||d>127)thrownewError("passwords with non-ASCII characters not supported in this environment")}elseb="";a=m.toUtf8Bytes(a,"NFKD");vare=m.toUtf8Bytes("mnemonic"+b,"NFKD");returnm.hexlify(m.pbkdf2(a,e,2048,64,m.createSha512Hmac))}functionh(a){varb=a.toLowerCase().split(" ");if(b.length%3!==0)thrownewError("invalid mnemonic");for(varc=m.arrayify(newUint8Array(Math.ceil(11*b.length/8))),e=0,f=0;f<b.length;f++){varg=l.indexOf(b[f]);if(g===-1)thrownewError("invalid mnemonic");for(varh=0;h<11;h++)g&1<<10-h&&(c[e>>3]|=1<<7-e%8),e++}vari=32*b.length/3,j=b.length/3,k=d(j),n=m.arrayify(m.sha256(c.slice(0,i/8)))[0];if(n&=k,n!==(c[c.length-1]&k))thrownewError("invalid checksum");returnm.hexlify(c.slice(0,i/8))}functioni(a){if(a=m.arrayify(a),a.length%4!==0||a.length<16||a.length>32)thrownewError("invalid entropy");for(varb=[0],c=11,f=0;f<a.length;f++)c>8?(b[b.length-1]<<=8,b[b.length-1]|=a[f],c-=8):(b[b.length-1]<<=c,b[b.length-1]|=a[f]>>8-c,b.push(a[f]&e(8-c)),c+=3);varg=m.arrayify(m.sha256(a))[0],h=a.length/4;g&=d(h),b[b.length-1]<<=h,b[b.length-1]|=g>>8-h;for(varf=0;f<b.length;f++)b[f]=l[b[f]];returnb.join(" ")}functionj(a){try{returnh(a),!0}catch(b){}return!1}vark=new(a("elliptic").ec)("secp256k1"),l=function(){varb=a("./words.json");returnb.replace(/([A-Z])/g," $1").toLowerCase().substring(1).split(" ")}(),m=function(){varb=a("ethers-utils/convert.js"),c=a("ethers-utils/sha2"),d=a("ethers-utils/hmac");return{defineProperty:a("ethers-utils/properties.js").defineProperty,arrayify:b.arrayify,bigNumberify:a("ethers-utils/bignumber.js").bigNumberify,hexlify:b.hexlify,toUtf8Bytes:a("ethers-utils/utf8.js").toUtf8Bytes,sha256:c.sha256,createSha512Hmac:d.createSha512Hmac,pbkdf2:a("ethers-utils/pbkdf2.js")}}(),n=m.toUtf8Bytes("Bitcoin seed"),o=2147483648;m.defineProperty(f.prototype,"_derive",function(a){if(!this.privateKey){if(a>=o)thrownewError("cannot derive child of neutered node");thrownewError("not implemented")}varb=newUint8Array(37);a&o?b.set(m.arrayify(this.privateKey),1)