@skip-go/widget-web-component 3.12.10 → 3.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +0,0 @@
1
- /*! For license information please see 2098.index.js.LICENSE.txt */
2
- export const __webpack_id__=2098;export const __webpack_ids__=[2098];export const __webpack_modules__={799:(t,e,r)=>{var i=r(79188),n=r(84742),s=r(49899),o=r(70392),a=r(47048),c=s.assert,h=r(23e3),u=r(75625);function f(t){if(!(this instanceof f))return new f(t);"string"==typeof t&&(c(Object.prototype.hasOwnProperty.call(o,t),"Unknown curve "+t),t=o[t]),t instanceof o.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}t.exports=f,f.prototype.keyPair=function(t){return new h(this,t)},f.prototype.keyFromPrivate=function(t,e){return h.fromPrivate(this,t,e)},f.prototype.keyFromPublic=function(t,e){return h.fromPublic(this,t,e)},f.prototype.genKeyPair=function(t){t||(t={});for(var e=new n({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||a(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),s=this.n.sub(new i(2));;){var o=new i(e.generate(r));if(!(o.cmp(s)>0))return o.iaddn(1),this.keyFromPrivate(o)}},f.prototype._truncateToN=function(t,e,r){var n;if(i.isBN(t)||"number"==typeof t)n=(t=new i(t,16)).byteLength();else if("object"==typeof t)n=t.length,t=new i(t,16);else{var s=t.toString();n=s.length+1>>>1,t=new i(s,16)}"number"!=typeof r&&(r=8*n);var o=r-this.n.bitLength();return o>0&&(t=t.ushrn(o)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},f.prototype.sign=function(t,e,r,s){if("object"==typeof r&&(s=r,r=null),s||(s={}),"string"!=typeof t&&"number"!=typeof t&&!i.isBN(t)){c("object"==typeof t&&t&&"number"==typeof t.length,"Expected message to be an array-like, a hex string, or a BN instance"),c(t.length>>>0===t.length);for(var o=0;o<t.length;o++)c((255&t[o])===t[o])}e=this.keyFromPrivate(e,r),t=this._truncateToN(t,!1,s.msgBitLength),c(!t.isNeg(),"Can not sign a negative message");var a=this.n.byteLength(),h=e.getPrivate().toArray("be",a),f=t.toArray("be",a);c(new i(f).eq(t),"Can not sign message");for(var d=new n({hash:this.hash,entropy:h,nonce:f,pers:s.pers,persEnc:s.persEnc||"utf8"}),l=this.n.sub(new i(1)),p=0;;p++){var g=s.k?s.k(p):new i(d.generate(this.n.byteLength()));if(!((g=this._truncateToN(g,!0)).cmpn(1)<=0||g.cmp(l)>=0)){var m=this.g.mul(g);if(!m.isInfinity()){var b=m.getX(),v=b.umod(this.n);if(0!==v.cmpn(0)){var y=g.invm(this.n).mul(v.mul(e.getPrivate()).iadd(t));if(0!==(y=y.umod(this.n)).cmpn(0)){var w=(m.getY().isOdd()?1:0)|(0!==b.cmp(v)?2:0);return s.canonical&&y.cmp(this.nh)>0&&(y=this.n.sub(y),w^=1),new u({r:v,s:y,recoveryParam:w})}}}}}},f.prototype.verify=function(t,e,r,i,n){n||(n={}),t=this._truncateToN(t,!1,n.msgBitLength),r=this.keyFromPublic(r,i);var s=(e=new u(e,"hex")).r,o=e.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a,c=o.invm(this.n),h=c.mul(t).umod(this.n),f=c.mul(s).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(h,r.getPublic(),f)).isInfinity()&&a.eqXToP(s):!(a=this.g.mulAdd(h,r.getPublic(),f)).isInfinity()&&0===a.getX().umod(this.n).cmp(s)},f.prototype.recoverPubKey=function(t,e,r,n){c((3&r)===r,"The recovery param is more than two bits"),e=new u(e,n);var s=this.n,o=new i(t),a=e.r,h=e.s,f=1&r,d=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&d)throw new Error("Unable to find sencond key candinate");a=d?this.curve.pointFromX(a.add(this.curve.n),f):this.curve.pointFromX(a,f);var l=e.r.invm(s),p=s.sub(o).mul(l).umod(s),g=h.mul(l).umod(s);return this.g.mulAdd(p,a,g)},f.prototype.getKeyRecoveryParam=function(t,e,r,i){if(null!==(e=new u(e,i)).recoveryParam)return e.recoveryParam;for(var n=0;n<4;n++){var s;try{s=this.recoverPubKey(t,e,n)}catch(t){continue}if(s.eq(r))return n}throw new Error("Unable to find valid recovery factor")}},858:(t,e,r)=>{var i=r(49899),n=r(79188),s=r(35615),o=r(74893),a=i.assert;function c(t){this.twisted=1!=(0|t.a),this.mOneA=this.twisted&&-1==(0|t.a),this.extended=this.mOneA,o.call(this,"edwards",t),this.a=new n(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new n(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new n(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),a(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|t.c)}function h(t,e,r,i,s){o.BasePoint.call(this,t,"projective"),null===e&&null===r&&null===i?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new n(e,16),this.y=new n(r,16),this.z=i?new n(i,16):this.curve.one,this.t=s&&new n(s,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}s(c,o),t.exports=c,c.prototype._mulA=function(t){return this.mOneA?t.redNeg():this.a.redMul(t)},c.prototype._mulC=function(t){return this.oneC?t:this.c.redMul(t)},c.prototype.jpoint=function(t,e,r,i){return this.point(t,e,r,i)},c.prototype.pointFromX=function(t,e){(t=new n(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr(),i=this.c2.redSub(this.a.redMul(r)),s=this.one.redSub(this.c2.redMul(this.d).redMul(r)),o=i.redMul(s.redInvm()),a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");var c=a.fromRed().isOdd();return(e&&!c||!e&&c)&&(a=a.redNeg()),this.point(t,a)},c.prototype.pointFromY=function(t,e){(t=new n(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr(),i=r.redSub(this.c2),s=r.redMul(this.d).redMul(this.c2).redSub(this.a),o=i.redMul(s.redInvm());if(0===o.cmp(this.zero)){if(e)throw new Error("invalid point");return this.point(this.zero,t)}var a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");return a.fromRed().isOdd()!==e&&(a=a.redNeg()),this.point(a,t)},c.prototype.validate=function(t){if(t.isInfinity())return!0;t.normalize();var e=t.x.redSqr(),r=t.y.redSqr(),i=e.redMul(this.a).redAdd(r),n=this.c2.redMul(this.one.redAdd(this.d.redMul(e).redMul(r)));return 0===i.cmp(n)},s(h,o.BasePoint),c.prototype.pointFromJSON=function(t){return h.fromJSON(this,t)},c.prototype.point=function(t,e,r,i){return new h(this,t,e,r,i)},h.fromJSON=function(t,e){return new h(t,e[0],e[1],e[2])},h.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},h.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},h.prototype._extDbl=function(){var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var i=this.curve._mulA(t),n=this.x.redAdd(this.y).redSqr().redISub(t).redISub(e),s=i.redAdd(e),o=s.redSub(r),a=i.redSub(e),c=n.redMul(o),h=s.redMul(a),u=n.redMul(a),f=o.redMul(s);return this.curve.point(c,h,f,u)},h.prototype._projDbl=function(){var t,e,r,i,n,s,o=this.x.redAdd(this.y).redSqr(),a=this.x.redSqr(),c=this.y.redSqr();if(this.curve.twisted){var h=(i=this.curve._mulA(a)).redAdd(c);this.zOne?(t=o.redSub(a).redSub(c).redMul(h.redSub(this.curve.two)),e=h.redMul(i.redSub(c)),r=h.redSqr().redSub(h).redSub(h)):(n=this.z.redSqr(),s=h.redSub(n).redISub(n),t=o.redSub(a).redISub(c).redMul(s),e=h.redMul(i.redSub(c)),r=h.redMul(s))}else i=a.redAdd(c),n=this.curve._mulC(this.z).redSqr(),s=i.redSub(n).redSub(n),t=this.curve._mulC(o.redISub(i)).redMul(s),e=this.curve._mulC(i).redMul(a.redISub(c)),r=i.redMul(s);return this.curve.point(t,e,r)},h.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},h.prototype._extAdd=function(t){var e=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),r=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),i=this.t.redMul(this.curve.dd).redMul(t.t),n=this.z.redMul(t.z.redAdd(t.z)),s=r.redSub(e),o=n.redSub(i),a=n.redAdd(i),c=r.redAdd(e),h=s.redMul(o),u=a.redMul(c),f=s.redMul(c),d=o.redMul(a);return this.curve.point(h,u,d,f)},h.prototype._projAdd=function(t){var e,r,i=this.z.redMul(t.z),n=i.redSqr(),s=this.x.redMul(t.x),o=this.y.redMul(t.y),a=this.curve.d.redMul(s).redMul(o),c=n.redSub(a),h=n.redAdd(a),u=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(s).redISub(o),f=i.redMul(c).redMul(u);return this.curve.twisted?(e=i.redMul(h).redMul(o.redSub(this.curve._mulA(s))),r=c.redMul(h)):(e=i.redMul(h).redMul(o.redSub(s)),r=this.curve._mulC(c).redMul(h)),this.curve.point(f,e,r)},h.prototype.add=function(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},h.prototype.mul=function(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},h.prototype.mulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!1)},h.prototype.jmulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!0)},h.prototype.normalize=function(){if(this.zOne)return this;var t=this.z.redInvm();return this.x=this.x.redMul(t),this.y=this.y.redMul(t),this.t&&(this.t=this.t.redMul(t)),this.z=this.curve.one,this.zOne=!0,this},h.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},h.prototype.getX=function(){return this.normalize(),this.x.fromRed()},h.prototype.getY=function(){return this.normalize(),this.y.fromRed()},h.prototype.eq=function(t){return this===t||0===this.getX().cmp(t.getX())&&0===this.getY().cmp(t.getY())},h.prototype.eqXToP=function(t){var e=t.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(e))return!0;for(var r=t.clone(),i=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(e.redIAdd(i),0===this.x.cmp(e))return!0}},h.prototype.toP=h.prototype.normalize,h.prototype.mixedAdd=h.prototype.add},1427:(t,e,r)=>{var i=r(55663),n=r(38767),s=function(){function t(t,e,r,n){void 0===r&&(r=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=t,this._info=n;var s=i.hmac(this._hash,r,e);this._hmac=new i.HMAC(t,s),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return t.prototype._fillBuffer=function(){this._counter[0]++;var t=this._counter[0];if(0===t)throw new Error("hkdf: cannot expand more");this._hmac.reset(),t>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},t.prototype.expand=function(t){for(var e=new Uint8Array(t),r=0;r<e.length;r++)this._bufpos===this._buffer.length&&this._fillBuffer(),e[r]=this._buffer[this._bufpos++];return e},t.prototype.clean=function(){this._hmac.clean(),n.wipe(this._buffer),n.wipe(this._counter),this._bufpos=0},t}();e.i=s},2591:(t,e)=>{function r(t,e){if(t.length!==e.length)return 0;for(var r=0,i=0;i<t.length;i++)r|=t[i]^e[i];return 1&r-1>>>8}Object.defineProperty(e,"__esModule",{value:!0}),e.select=function(t,e,r){return~(t-1)&e|t-1&r},e.lessOrEqual=function(t,e){return(0|t)-(0|e)-1>>>31&1},e.compare=r,e.equal=function(t,e){return 0!==t.length&&0!==e.length&&0!==r(t,e)}},7269:t=>{t.exports=t=>encodeURIComponent(t).replace(/[!'()*]/g,(t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`))},7841:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SystemRandomSource=void 0;const i=r(14262),n=r(61052);e.SystemRandomSource=class{constructor(){return this.isAvailable=!1,this.name="",this._source=new i.BrowserRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Browser")):(this._source=new n.NodeRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Node")):void 0)}randomBytes(t){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(t)}}},14262:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.BrowserRandomSource=void 0,e.BrowserRandomSource=class{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const t="undefined"!=typeof self?self.crypto||self.msCrypto:null;t&&void 0!==t.getRandomValues&&(this._crypto=t,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(t){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const e=new Uint8Array(t);for(let t=0;t<e.length;t+=65536)this._crypto.getRandomValues(e.subarray(t,t+Math.min(e.length-t,65536)));return e}}},17379:(t,e,r)=>{e._S=e.K=e.TP=e.wE=e.Ee=void 0;r(27687);const i=r(75121);r(38767);function n(t){const e=new Float64Array(16);if(t)for(let r=0;r<t.length;r++)e[r]=t[r];return e}e.Ee=64,e.wE=64,e.TP=32,new Uint8Array(32)[0]=9;const s=n(),o=n([1]),a=(n([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),n([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222])),c=n([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),h=n([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]);n([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function u(t,e){for(let r=0;r<16;r++)t[r]=0|e[r]}function f(t){let e=1;for(let r=0;r<16;r++){let i=t[r]+e+65535;e=Math.floor(i/65536),t[r]=i-65536*e}t[0]+=e-1+37*(e-1)}function d(t,e,r){const i=~(r-1);for(let r=0;r<16;r++){const n=i&(t[r]^e[r]);t[r]^=n,e[r]^=n}}function l(t,e){const r=n(),i=n();for(let t=0;t<16;t++)i[t]=e[t];f(i),f(i),f(i);for(let t=0;t<2;t++){r[0]=i[0]-65517;for(let t=1;t<15;t++)r[t]=i[t]-65535-(r[t-1]>>16&1),r[t-1]&=65535;r[15]=i[15]-32767-(r[14]>>16&1);const t=r[15]>>16&1;r[14]&=65535,d(i,r,1-t)}for(let e=0;e<16;e++)t[2*e]=255&i[e],t[2*e+1]=i[e]>>8}function p(t){const e=new Uint8Array(32);return l(e,t),1&e[0]}function g(t,e,r){for(let i=0;i<16;i++)t[i]=e[i]+r[i]}function m(t,e,r){for(let i=0;i<16;i++)t[i]=e[i]-r[i]}function b(t,e,r){let i,n,s=0,o=0,a=0,c=0,h=0,u=0,f=0,d=0,l=0,p=0,g=0,m=0,b=0,v=0,y=0,w=0,_=0,A=0,M=0,E=0,I=0,S=0,P=0,x=0,R=0,N=0,O=0,C=0,T=0,q=0,k=0,D=r[0],U=r[1],B=r[2],L=r[3],z=r[4],j=r[5],F=r[6],H=r[7],K=r[8],$=r[9],V=r[10],J=r[11],G=r[12],Q=r[13],W=r[14],Y=r[15];i=e[0],s+=i*D,o+=i*U,a+=i*B,c+=i*L,h+=i*z,u+=i*j,f+=i*F,d+=i*H,l+=i*K,p+=i*$,g+=i*V,m+=i*J,b+=i*G,v+=i*Q,y+=i*W,w+=i*Y,i=e[1],o+=i*D,a+=i*U,c+=i*B,h+=i*L,u+=i*z,f+=i*j,d+=i*F,l+=i*H,p+=i*K,g+=i*$,m+=i*V,b+=i*J,v+=i*G,y+=i*Q,w+=i*W,_+=i*Y,i=e[2],a+=i*D,c+=i*U,h+=i*B,u+=i*L,f+=i*z,d+=i*j,l+=i*F,p+=i*H,g+=i*K,m+=i*$,b+=i*V,v+=i*J,y+=i*G,w+=i*Q,_+=i*W,A+=i*Y,i=e[3],c+=i*D,h+=i*U,u+=i*B,f+=i*L,d+=i*z,l+=i*j,p+=i*F,g+=i*H,m+=i*K,b+=i*$,v+=i*V,y+=i*J,w+=i*G,_+=i*Q,A+=i*W,M+=i*Y,i=e[4],h+=i*D,u+=i*U,f+=i*B,d+=i*L,l+=i*z,p+=i*j,g+=i*F,m+=i*H,b+=i*K,v+=i*$,y+=i*V,w+=i*J,_+=i*G,A+=i*Q,M+=i*W,E+=i*Y,i=e[5],u+=i*D,f+=i*U,d+=i*B,l+=i*L,p+=i*z,g+=i*j,m+=i*F,b+=i*H,v+=i*K,y+=i*$,w+=i*V,_+=i*J,A+=i*G,M+=i*Q,E+=i*W,I+=i*Y,i=e[6],f+=i*D,d+=i*U,l+=i*B,p+=i*L,g+=i*z,m+=i*j,b+=i*F,v+=i*H,y+=i*K,w+=i*$,_+=i*V,A+=i*J,M+=i*G,E+=i*Q,I+=i*W,S+=i*Y,i=e[7],d+=i*D,l+=i*U,p+=i*B,g+=i*L,m+=i*z,b+=i*j,v+=i*F,y+=i*H,w+=i*K,_+=i*$,A+=i*V,M+=i*J,E+=i*G,I+=i*Q,S+=i*W,P+=i*Y,i=e[8],l+=i*D,p+=i*U,g+=i*B,m+=i*L,b+=i*z,v+=i*j,y+=i*F,w+=i*H,_+=i*K,A+=i*$,M+=i*V,E+=i*J,I+=i*G,S+=i*Q,P+=i*W,x+=i*Y,i=e[9],p+=i*D,g+=i*U,m+=i*B,b+=i*L,v+=i*z,y+=i*j,w+=i*F,_+=i*H,A+=i*K,M+=i*$,E+=i*V,I+=i*J,S+=i*G,P+=i*Q,x+=i*W,R+=i*Y,i=e[10],g+=i*D,m+=i*U,b+=i*B,v+=i*L,y+=i*z,w+=i*j,_+=i*F,A+=i*H,M+=i*K,E+=i*$,I+=i*V,S+=i*J,P+=i*G,x+=i*Q,R+=i*W,N+=i*Y,i=e[11],m+=i*D,b+=i*U,v+=i*B,y+=i*L,w+=i*z,_+=i*j,A+=i*F,M+=i*H,E+=i*K,I+=i*$,S+=i*V,P+=i*J,x+=i*G,R+=i*Q,N+=i*W,O+=i*Y,i=e[12],b+=i*D,v+=i*U,y+=i*B,w+=i*L,_+=i*z,A+=i*j,M+=i*F,E+=i*H,I+=i*K,S+=i*$,P+=i*V,x+=i*J,R+=i*G,N+=i*Q,O+=i*W,C+=i*Y,i=e[13],v+=i*D,y+=i*U,w+=i*B,_+=i*L,A+=i*z,M+=i*j,E+=i*F,I+=i*H,S+=i*K,P+=i*$,x+=i*V,R+=i*J,N+=i*G,O+=i*Q,C+=i*W,T+=i*Y,i=e[14],y+=i*D,w+=i*U,_+=i*B,A+=i*L,M+=i*z,E+=i*j,I+=i*F,S+=i*H,P+=i*K,x+=i*$,R+=i*V,N+=i*J,O+=i*G,C+=i*Q,T+=i*W,q+=i*Y,i=e[15],w+=i*D,_+=i*U,A+=i*B,M+=i*L,E+=i*z,I+=i*j,S+=i*F,P+=i*H,x+=i*K,R+=i*$,N+=i*V,O+=i*J,C+=i*G,T+=i*Q,q+=i*W,k+=i*Y,s+=38*_,o+=38*A,a+=38*M,c+=38*E,h+=38*I,u+=38*S,f+=38*P,d+=38*x,l+=38*R,p+=38*N,g+=38*O,m+=38*C,b+=38*T,v+=38*q,y+=38*k,n=1,i=s+n+65535,n=Math.floor(i/65536),s=i-65536*n,i=o+n+65535,n=Math.floor(i/65536),o=i-65536*n,i=a+n+65535,n=Math.floor(i/65536),a=i-65536*n,i=c+n+65535,n=Math.floor(i/65536),c=i-65536*n,i=h+n+65535,n=Math.floor(i/65536),h=i-65536*n,i=u+n+65535,n=Math.floor(i/65536),u=i-65536*n,i=f+n+65535,n=Math.floor(i/65536),f=i-65536*n,i=d+n+65535,n=Math.floor(i/65536),d=i-65536*n,i=l+n+65535,n=Math.floor(i/65536),l=i-65536*n,i=p+n+65535,n=Math.floor(i/65536),p=i-65536*n,i=g+n+65535,n=Math.floor(i/65536),g=i-65536*n,i=m+n+65535,n=Math.floor(i/65536),m=i-65536*n,i=b+n+65535,n=Math.floor(i/65536),b=i-65536*n,i=v+n+65535,n=Math.floor(i/65536),v=i-65536*n,i=y+n+65535,n=Math.floor(i/65536),y=i-65536*n,i=w+n+65535,n=Math.floor(i/65536),w=i-65536*n,s+=n-1+37*(n-1),n=1,i=s+n+65535,n=Math.floor(i/65536),s=i-65536*n,i=o+n+65535,n=Math.floor(i/65536),o=i-65536*n,i=a+n+65535,n=Math.floor(i/65536),a=i-65536*n,i=c+n+65535,n=Math.floor(i/65536),c=i-65536*n,i=h+n+65535,n=Math.floor(i/65536),h=i-65536*n,i=u+n+65535,n=Math.floor(i/65536),u=i-65536*n,i=f+n+65535,n=Math.floor(i/65536),f=i-65536*n,i=d+n+65535,n=Math.floor(i/65536),d=i-65536*n,i=l+n+65535,n=Math.floor(i/65536),l=i-65536*n,i=p+n+65535,n=Math.floor(i/65536),p=i-65536*n,i=g+n+65535,n=Math.floor(i/65536),g=i-65536*n,i=m+n+65535,n=Math.floor(i/65536),m=i-65536*n,i=b+n+65535,n=Math.floor(i/65536),b=i-65536*n,i=v+n+65535,n=Math.floor(i/65536),v=i-65536*n,i=y+n+65535,n=Math.floor(i/65536),y=i-65536*n,i=w+n+65535,n=Math.floor(i/65536),w=i-65536*n,s+=n-1+37*(n-1),t[0]=s,t[1]=o,t[2]=a,t[3]=c,t[4]=h,t[5]=u,t[6]=f,t[7]=d,t[8]=l,t[9]=p,t[10]=g,t[11]=m,t[12]=b,t[13]=v,t[14]=y,t[15]=w}function v(t,e){b(t,e,e)}function y(t,e){const r=n(),i=n(),s=n(),o=n(),c=n(),h=n(),u=n(),f=n(),d=n();m(r,t[1],t[0]),m(d,e[1],e[0]),b(r,r,d),g(i,t[0],t[1]),g(d,e[0],e[1]),b(i,i,d),b(s,t[3],e[3]),b(s,s,a),b(o,t[2],e[2]),g(o,o,o),m(c,i,r),m(h,o,s),g(u,o,s),g(f,i,r),b(t[0],c,h),b(t[1],f,u),b(t[2],u,h),b(t[3],c,f)}function w(t,e,r){for(let i=0;i<4;i++)d(t[i],e[i],r)}function _(t,e){const r=n(),i=n(),s=n();(function(t,e){const r=n();let i;for(i=0;i<16;i++)r[i]=e[i];for(i=253;i>=0;i--)v(r,r),2!==i&&4!==i&&b(r,r,e);for(i=0;i<16;i++)t[i]=r[i]})(s,e[2]),b(r,e[0],s),b(i,e[1],s),l(t,i),t[31]^=p(r)<<7}function A(t,e){const r=[n(),n(),n(),n()];u(r[0],c),u(r[1],h),u(r[2],o),b(r[3],c,h),function(t,e,r){u(t[0],s),u(t[1],o),u(t[2],o),u(t[3],s);for(let i=255;i>=0;--i){const n=r[i/8|0]>>(7&i)&1;w(t,e,n),y(e,t),y(t,t),w(t,e,n)}}(t,r,e)}e.K=function(t){if(t.length!==e.TP)throw new Error(`ed25519: seed must be ${e.TP} bytes`);const r=(0,i.hash)(t);r[0]&=248,r[31]&=127,r[31]|=64;const s=new Uint8Array(32),o=[n(),n(),n(),n()];A(o,r),_(s,o);const a=new Uint8Array(64);return a.set(t),a.set(s,32),{publicKey:s,secretKey:a}};const M=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function E(t,e){let r,i,n,s;for(i=63;i>=32;--i){for(r=0,n=i-32,s=i-12;n<s;++n)e[n]+=r-16*e[i]*M[n-(i-32)],r=Math.floor((e[n]+128)/256),e[n]-=256*r;e[n]+=r,e[i]=0}for(r=0,n=0;n<32;n++)e[n]+=r-(e[31]>>4)*M[n],r=e[n]>>8,e[n]&=255;for(n=0;n<32;n++)e[n]-=r*M[n];for(i=0;i<32;i++)e[i+1]+=e[i]>>8,t[i]=255&e[i]}function I(t){const e=new Float64Array(64);for(let r=0;r<64;r++)e[r]=t[r];for(let e=0;e<64;e++)t[e]=0;E(t,e)}e._S=function(t,e){const r=new Float64Array(64),s=[n(),n(),n(),n()],o=(0,i.hash)(t.subarray(0,32));o[0]&=248,o[31]&=127,o[31]|=64;const a=new Uint8Array(64);a.set(o.subarray(32),32);const c=new i.SHA512;c.update(a.subarray(32)),c.update(e);const h=c.digest();c.clean(),I(h),A(s,h),_(a,s),c.reset(),c.update(a.subarray(0,32)),c.update(t.subarray(32)),c.update(e);const u=c.digest();I(u);for(let t=0;t<32;t++)r[t]=h[t];for(let t=0;t<32;t++)for(let e=0;e<32;e++)r[t+e]+=u[t]*o[e];return E(a.subarray(32),r),a}},18837:()=>{},21663:(t,e,r)=>{var i=r(47209),n=r(47591),s=r(38767),o=r(63447),a=r(2591);e.J4=32,e.PX=12,e.iW=16;var c=new Uint8Array(16),h=function(){function t(t){if(this.nonceLength=e.PX,this.tagLength=e.iW,t.length!==e.J4)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(t)}return t.prototype.seal=function(t,e,r,n){if(t.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var o=new Uint8Array(16);o.set(t,o.length-t.length);var a=new Uint8Array(32);i.stream(this._key,o,a,4);var c,h=e.length+this.tagLength;if(n){if(n.length!==h)throw new Error("ChaCha20Poly1305: incorrect destination length");c=n}else c=new Uint8Array(h);return i.streamXOR(this._key,o,e,c,4),this._authenticate(c.subarray(c.length-this.tagLength,c.length),a,c.subarray(0,c.length-this.tagLength),r),s.wipe(o),c},t.prototype.open=function(t,e,r,n){if(t.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(e.length<this.tagLength)return null;var o=new Uint8Array(16);o.set(t,o.length-t.length);var c=new Uint8Array(32);i.stream(this._key,o,c,4);var h=new Uint8Array(this.tagLength);if(this._authenticate(h,c,e.subarray(0,e.length-this.tagLength),r),!a.equal(h,e.subarray(e.length-this.tagLength,e.length)))return null;var u,f=e.length-this.tagLength;if(n){if(n.length!==f)throw new Error("ChaCha20Poly1305: incorrect destination length");u=n}else u=new Uint8Array(f);return i.streamXOR(this._key,o,e.subarray(0,e.length-this.tagLength),u,4),s.wipe(o),u},t.prototype.clean=function(){return s.wipe(this._key),this},t.prototype._authenticate=function(t,e,r,i){var a=new n.Poly1305(e);i&&(a.update(i),i.length%16>0&&a.update(c.subarray(i.length%16))),a.update(r),r.length%16>0&&a.update(c.subarray(r.length%16));var h=new Uint8Array(8);i&&o.writeUint64LE(i.length,h),a.update(h),o.writeUint64LE(r.length,h),a.update(h);for(var u=a.digest(),f=0;f<u.length;f++)t[f]=u[f];a.clean(),s.wipe(u),s.wipe(h)},t}();e.g6=h},23e3:(t,e,r)=>{var i=r(79188),n=r(49899).assert;function s(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}t.exports=s,s.fromPublic=function(t,e,r){return e instanceof s?e:new s(t,{pub:e,pubEnc:r})},s.fromPrivate=function(t,e,r){return e instanceof s?e:new s(t,{priv:e,privEnc:r})},s.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},s.prototype.getPublic=function(t,e){return"string"==typeof t&&(e=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},s.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16,2):this.priv},s.prototype._importPrivate=function(t,e){this.priv=new i(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},s.prototype._importPublic=function(t,e){if(t.x||t.y)return"mont"===this.ec.curve.type?n(t.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||n(t.x&&t.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(t.x,t.y));this.pub=this.ec.curve.decodePoint(t,e)},s.prototype.derive=function(t){return t.validate()||n(t.validate(),"public point not validated"),t.mul(this.priv).getX()},s.prototype.sign=function(t,e,r){return this.ec.sign(t,this,e,r)},s.prototype.verify=function(t,e,r){return this.ec.verify(t,e,this,void 0,r)},s.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"}},25882:(t,e,r)=>{var i=r(79188),n=r(35615),s=r(74893),o=r(49899);function a(t){s.call(this,"mont",t),this.a=new i(t.a,16).toRed(this.red),this.b=new i(t.b,16).toRed(this.red),this.i4=new i(4).toRed(this.red).redInvm(),this.two=new i(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function c(t,e,r){s.BasePoint.call(this,t,"projective"),null===e&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new i(e,16),this.z=new i(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}n(a,s),t.exports=a,a.prototype.validate=function(t){var e=t.normalize().x,r=e.redSqr(),i=r.redMul(e).redAdd(r.redMul(this.a)).redAdd(e);return 0===i.redSqrt().redSqr().cmp(i)},n(c,s.BasePoint),a.prototype.decodePoint=function(t,e){return this.point(o.toArray(t,e),1)},a.prototype.point=function(t,e){return new c(this,t,e)},a.prototype.pointFromJSON=function(t){return c.fromJSON(this,t)},c.prototype.precompute=function(){},c.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},c.fromJSON=function(t,e){return new c(t,e[0],e[1]||t.one)},c.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},c.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},c.prototype.dbl=function(){var t=this.x.redAdd(this.z).redSqr(),e=this.x.redSub(this.z).redSqr(),r=t.redSub(e),i=t.redMul(e),n=r.redMul(e.redAdd(this.curve.a24.redMul(r)));return this.curve.point(i,n)},c.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.diffAdd=function(t,e){var r=this.x.redAdd(this.z),i=this.x.redSub(this.z),n=t.x.redAdd(t.z),s=t.x.redSub(t.z).redMul(r),o=n.redMul(i),a=e.z.redMul(s.redAdd(o).redSqr()),c=e.x.redMul(s.redISub(o).redSqr());return this.curve.point(a,c)},c.prototype.mul=function(t){for(var e=t.clone(),r=this,i=this.curve.point(null,null),n=[];0!==e.cmpn(0);e.iushrn(1))n.push(e.andln(1));for(var s=n.length-1;s>=0;s--)0===n[s]?(r=r.diffAdd(i,this),i=i.dbl()):(i=r.diffAdd(i,this),r=r.dbl());return i},c.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.eq=function(t){return 0===this.getX().cmp(t.getX())},c.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},c.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},27687:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.randomStringForEntropy=e.randomString=e.randomUint32=e.randomBytes=e.defaultRandomSource=void 0;const i=r(7841),n=r(63447),s=r(38767);function o(t,r=e.defaultRandomSource){return r.randomBytes(t)}e.defaultRandomSource=new i.SystemRandomSource,e.randomBytes=o,e.randomUint32=function(t=e.defaultRandomSource){const r=o(4,t),i=(0,n.readUint32LE)(r);return(0,s.wipe)(r),i};const a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function c(t,r=a,i=e.defaultRandomSource){if(r.length<2)throw new Error("randomString charset is too short");if(r.length>256)throw new Error("randomString charset is too long");let n="";const c=r.length,h=256-256%c;for(;t>0;){const e=o(Math.ceil(256*t/h),i);for(let i=0;i<e.length&&t>0;i++){const s=e[i];s<h&&(n+=r.charAt(s%c),t--)}(0,s.wipe)(e)}return n}e.randomString=c,e.randomStringForEntropy=function(t,r=a,i=e.defaultRandomSource){return c(Math.ceil(t/(Math.log(r.length)/Math.LN2)),r,i)}},28605:t=>{var e="%[a-f0-9]{2}",r=new RegExp("("+e+")|([^%]+?)","gi"),i=new RegExp("("+e+")+","gi");function n(t,e){try{return[decodeURIComponent(t.join(""))]}catch(t){}if(1===t.length)return t;e=e||1;var r=t.slice(0,e),i=t.slice(e);return Array.prototype.concat.call([],n(r),n(i))}function s(t){try{return decodeURIComponent(t)}catch(s){for(var e=t.match(r)||[],i=1;i<e.length;i++)e=(t=n(e,i).join("")).match(r)||[];return t}}t.exports=function(t){if("string"!=typeof t)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof t+"`");try{return t=t.replace(/\+/g," "),decodeURIComponent(t)}catch(e){return function(t){for(var e={"%FE%FF":"��","%FF%FE":"��"},r=i.exec(t);r;){try{e[r[0]]=decodeURIComponent(r[0])}catch(t){var n=s(r[0]);n!==r[0]&&(e[r[0]]=n)}r=i.exec(t)}e["%C2"]="�";for(var o=Object.keys(e),a=0;a<o.length;a++){var c=o[a];t=t.replace(new RegExp(c,"g"),e[c])}return t}(t)}}},38767:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.wipe=function(t){for(var e=0;e<t.length;e++)t[e]=0;return t}},38877:(t,e,r)=>{e.Tc=e.TZ=e.wE=e.Xx=void 0;const i=r(27687),n=r(38767);function s(t){const e=new Float64Array(16);if(t)for(let r=0;r<t.length;r++)e[r]=t[r];return e}e.Xx=32,e.wE=32;const o=new Uint8Array(32);o[0]=9;const a=s([56129,1]);function c(t){let e=1;for(let r=0;r<16;r++){let i=t[r]+e+65535;e=Math.floor(i/65536),t[r]=i-65536*e}t[0]+=e-1+37*(e-1)}function h(t,e,r){const i=~(r-1);for(let r=0;r<16;r++){const n=i&(t[r]^e[r]);t[r]^=n,e[r]^=n}}function u(t,e,r){for(let i=0;i<16;i++)t[i]=e[i]+r[i]}function f(t,e,r){for(let i=0;i<16;i++)t[i]=e[i]-r[i]}function d(t,e,r){let i,n,s=0,o=0,a=0,c=0,h=0,u=0,f=0,d=0,l=0,p=0,g=0,m=0,b=0,v=0,y=0,w=0,_=0,A=0,M=0,E=0,I=0,S=0,P=0,x=0,R=0,N=0,O=0,C=0,T=0,q=0,k=0,D=r[0],U=r[1],B=r[2],L=r[3],z=r[4],j=r[5],F=r[6],H=r[7],K=r[8],$=r[9],V=r[10],J=r[11],G=r[12],Q=r[13],W=r[14],Y=r[15];i=e[0],s+=i*D,o+=i*U,a+=i*B,c+=i*L,h+=i*z,u+=i*j,f+=i*F,d+=i*H,l+=i*K,p+=i*$,g+=i*V,m+=i*J,b+=i*G,v+=i*Q,y+=i*W,w+=i*Y,i=e[1],o+=i*D,a+=i*U,c+=i*B,h+=i*L,u+=i*z,f+=i*j,d+=i*F,l+=i*H,p+=i*K,g+=i*$,m+=i*V,b+=i*J,v+=i*G,y+=i*Q,w+=i*W,_+=i*Y,i=e[2],a+=i*D,c+=i*U,h+=i*B,u+=i*L,f+=i*z,d+=i*j,l+=i*F,p+=i*H,g+=i*K,m+=i*$,b+=i*V,v+=i*J,y+=i*G,w+=i*Q,_+=i*W,A+=i*Y,i=e[3],c+=i*D,h+=i*U,u+=i*B,f+=i*L,d+=i*z,l+=i*j,p+=i*F,g+=i*H,m+=i*K,b+=i*$,v+=i*V,y+=i*J,w+=i*G,_+=i*Q,A+=i*W,M+=i*Y,i=e[4],h+=i*D,u+=i*U,f+=i*B,d+=i*L,l+=i*z,p+=i*j,g+=i*F,m+=i*H,b+=i*K,v+=i*$,y+=i*V,w+=i*J,_+=i*G,A+=i*Q,M+=i*W,E+=i*Y,i=e[5],u+=i*D,f+=i*U,d+=i*B,l+=i*L,p+=i*z,g+=i*j,m+=i*F,b+=i*H,v+=i*K,y+=i*$,w+=i*V,_+=i*J,A+=i*G,M+=i*Q,E+=i*W,I+=i*Y,i=e[6],f+=i*D,d+=i*U,l+=i*B,p+=i*L,g+=i*z,m+=i*j,b+=i*F,v+=i*H,y+=i*K,w+=i*$,_+=i*V,A+=i*J,M+=i*G,E+=i*Q,I+=i*W,S+=i*Y,i=e[7],d+=i*D,l+=i*U,p+=i*B,g+=i*L,m+=i*z,b+=i*j,v+=i*F,y+=i*H,w+=i*K,_+=i*$,A+=i*V,M+=i*J,E+=i*G,I+=i*Q,S+=i*W,P+=i*Y,i=e[8],l+=i*D,p+=i*U,g+=i*B,m+=i*L,b+=i*z,v+=i*j,y+=i*F,w+=i*H,_+=i*K,A+=i*$,M+=i*V,E+=i*J,I+=i*G,S+=i*Q,P+=i*W,x+=i*Y,i=e[9],p+=i*D,g+=i*U,m+=i*B,b+=i*L,v+=i*z,y+=i*j,w+=i*F,_+=i*H,A+=i*K,M+=i*$,E+=i*V,I+=i*J,S+=i*G,P+=i*Q,x+=i*W,R+=i*Y,i=e[10],g+=i*D,m+=i*U,b+=i*B,v+=i*L,y+=i*z,w+=i*j,_+=i*F,A+=i*H,M+=i*K,E+=i*$,I+=i*V,S+=i*J,P+=i*G,x+=i*Q,R+=i*W,N+=i*Y,i=e[11],m+=i*D,b+=i*U,v+=i*B,y+=i*L,w+=i*z,_+=i*j,A+=i*F,M+=i*H,E+=i*K,I+=i*$,S+=i*V,P+=i*J,x+=i*G,R+=i*Q,N+=i*W,O+=i*Y,i=e[12],b+=i*D,v+=i*U,y+=i*B,w+=i*L,_+=i*z,A+=i*j,M+=i*F,E+=i*H,I+=i*K,S+=i*$,P+=i*V,x+=i*J,R+=i*G,N+=i*Q,O+=i*W,C+=i*Y,i=e[13],v+=i*D,y+=i*U,w+=i*B,_+=i*L,A+=i*z,M+=i*j,E+=i*F,I+=i*H,S+=i*K,P+=i*$,x+=i*V,R+=i*J,N+=i*G,O+=i*Q,C+=i*W,T+=i*Y,i=e[14],y+=i*D,w+=i*U,_+=i*B,A+=i*L,M+=i*z,E+=i*j,I+=i*F,S+=i*H,P+=i*K,x+=i*$,R+=i*V,N+=i*J,O+=i*G,C+=i*Q,T+=i*W,q+=i*Y,i=e[15],w+=i*D,_+=i*U,A+=i*B,M+=i*L,E+=i*z,I+=i*j,S+=i*F,P+=i*H,x+=i*K,R+=i*$,N+=i*V,O+=i*J,C+=i*G,T+=i*Q,q+=i*W,k+=i*Y,s+=38*_,o+=38*A,a+=38*M,c+=38*E,h+=38*I,u+=38*S,f+=38*P,d+=38*x,l+=38*R,p+=38*N,g+=38*O,m+=38*C,b+=38*T,v+=38*q,y+=38*k,n=1,i=s+n+65535,n=Math.floor(i/65536),s=i-65536*n,i=o+n+65535,n=Math.floor(i/65536),o=i-65536*n,i=a+n+65535,n=Math.floor(i/65536),a=i-65536*n,i=c+n+65535,n=Math.floor(i/65536),c=i-65536*n,i=h+n+65535,n=Math.floor(i/65536),h=i-65536*n,i=u+n+65535,n=Math.floor(i/65536),u=i-65536*n,i=f+n+65535,n=Math.floor(i/65536),f=i-65536*n,i=d+n+65535,n=Math.floor(i/65536),d=i-65536*n,i=l+n+65535,n=Math.floor(i/65536),l=i-65536*n,i=p+n+65535,n=Math.floor(i/65536),p=i-65536*n,i=g+n+65535,n=Math.floor(i/65536),g=i-65536*n,i=m+n+65535,n=Math.floor(i/65536),m=i-65536*n,i=b+n+65535,n=Math.floor(i/65536),b=i-65536*n,i=v+n+65535,n=Math.floor(i/65536),v=i-65536*n,i=y+n+65535,n=Math.floor(i/65536),y=i-65536*n,i=w+n+65535,n=Math.floor(i/65536),w=i-65536*n,s+=n-1+37*(n-1),n=1,i=s+n+65535,n=Math.floor(i/65536),s=i-65536*n,i=o+n+65535,n=Math.floor(i/65536),o=i-65536*n,i=a+n+65535,n=Math.floor(i/65536),a=i-65536*n,i=c+n+65535,n=Math.floor(i/65536),c=i-65536*n,i=h+n+65535,n=Math.floor(i/65536),h=i-65536*n,i=u+n+65535,n=Math.floor(i/65536),u=i-65536*n,i=f+n+65535,n=Math.floor(i/65536),f=i-65536*n,i=d+n+65535,n=Math.floor(i/65536),d=i-65536*n,i=l+n+65535,n=Math.floor(i/65536),l=i-65536*n,i=p+n+65535,n=Math.floor(i/65536),p=i-65536*n,i=g+n+65535,n=Math.floor(i/65536),g=i-65536*n,i=m+n+65535,n=Math.floor(i/65536),m=i-65536*n,i=b+n+65535,n=Math.floor(i/65536),b=i-65536*n,i=v+n+65535,n=Math.floor(i/65536),v=i-65536*n,i=y+n+65535,n=Math.floor(i/65536),y=i-65536*n,i=w+n+65535,n=Math.floor(i/65536),w=i-65536*n,s+=n-1+37*(n-1),t[0]=s,t[1]=o,t[2]=a,t[3]=c,t[4]=h,t[5]=u,t[6]=f,t[7]=d,t[8]=l,t[9]=p,t[10]=g,t[11]=m,t[12]=b,t[13]=v,t[14]=y,t[15]=w}function l(t,e){d(t,e,e)}function p(t,e){const r=new Uint8Array(32),i=new Float64Array(80),n=s(),o=s(),p=s(),g=s(),m=s(),b=s();for(let e=0;e<31;e++)r[e]=t[e];r[31]=127&t[31]|64,r[0]&=248,function(t,e){for(let r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}(i,e);for(let t=0;t<16;t++)o[t]=i[t];n[0]=g[0]=1;for(let t=254;t>=0;--t){const e=r[t>>>3]>>>(7&t)&1;h(n,o,e),h(p,g,e),u(m,n,p),f(n,n,p),u(p,o,g),f(o,o,g),l(g,m),l(b,n),d(n,p,n),d(p,o,m),u(m,n,p),f(n,n,p),l(o,n),f(p,g,b),d(n,p,a),u(n,n,g),d(p,p,n),d(n,g,b),d(g,o,i),l(o,m),h(n,o,e),h(p,g,e)}for(let t=0;t<16;t++)i[t+16]=n[t],i[t+32]=p[t],i[t+48]=o[t],i[t+64]=g[t];const v=i.subarray(32),y=i.subarray(16);!function(t,e){const r=s();for(let t=0;t<16;t++)r[t]=e[t];for(let t=253;t>=0;t--)l(r,r),2!==t&&4!==t&&d(r,r,e);for(let e=0;e<16;e++)t[e]=r[e]}(v,v),d(y,y,v);const w=new Uint8Array(32);return function(t,e){const r=s(),i=s();for(let t=0;t<16;t++)i[t]=e[t];c(i),c(i),c(i);for(let t=0;t<2;t++){r[0]=i[0]-65517;for(let t=1;t<15;t++)r[t]=i[t]-65535-(r[t-1]>>16&1),r[t-1]&=65535;r[15]=i[15]-32767-(r[14]>>16&1);const t=r[15]>>16&1;r[14]&=65535,h(i,r,1-t)}for(let e=0;e<16;e++)t[2*e]=255&i[e],t[2*e+1]=i[e]>>8}(w,y),w}e.TZ=function(t){const r=(0,i.randomBytes)(32,t),s=function(t){if(t.length!==e.wE)throw new Error(`x25519: seed must be ${e.wE} bytes`);const r=new Uint8Array(t);return{publicKey:(i=r,p(i,o)),secretKey:r};var i}(r);return(0,n.wipe)(r),s},e.Tc=function(t,r,i=!1){if(t.length!==e.Xx)throw new Error("X25519: incorrect secret key length");if(r.length!==e.Xx)throw new Error("X25519: incorrect public key length");const n=p(t,r);if(i){let t=0;for(let e=0;e<n.length;e++)t|=n[e];if(0===t)throw new Error("X25519: invalid shared key")}return n}},43730:(t,e,r)=>{var i=r(99499),n=r(70392),s=r(49899),o=s.assert,a=s.parseBytes,c=r(54077),h=r(53604);function u(t){if(o("ed25519"===t,"only tested with ed25519 so far"),!(this instanceof u))return new u(t);t=n[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=i.sha512}t.exports=u,u.prototype.sign=function(t,e){t=a(t);var r=this.keyFromSecret(e),i=this.hashInt(r.messagePrefix(),t),n=this.g.mul(i),s=this.encodePoint(n),o=this.hashInt(s,r.pubBytes(),t).mul(r.priv()),c=i.add(o).umod(this.curve.n);return this.makeSignature({R:n,S:c,Rencoded:s})},u.prototype.verify=function(t,e,r){if(t=a(t),(e=this.makeSignature(e)).S().gte(e.eddsa.curve.n)||e.S().isNeg())return!1;var i=this.keyFromPublic(r),n=this.hashInt(e.Rencoded(),i.pubBytes(),t),s=this.g.mul(e.S());return e.R().add(i.pub().mul(n)).eq(s)},u.prototype.hashInt=function(){for(var t=this.hash(),e=0;e<arguments.length;e++)t.update(arguments[e]);return s.intFromLE(t.digest()).umod(this.curve.n)},u.prototype.keyFromPublic=function(t){return c.fromPublic(this,t)},u.prototype.keyFromSecret=function(t){return c.fromSecret(this,t)},u.prototype.makeSignature=function(t){return t instanceof h?t:new h(this,t)},u.prototype.encodePoint=function(t){var e=t.getY().toArray("le",this.encodingLength);return e[this.encodingLength-1]|=t.getX().isOdd()?128:0,e},u.prototype.decodePoint=function(t){var e=(t=s.parseBytes(t)).length-1,r=t.slice(0,e).concat(-129&t[e]),i=!!(128&t[e]),n=s.intFromLE(r);return this.curve.pointFromY(n,i)},u.prototype.encodeInt=function(t){return t.toArray("le",this.encodingLength)},u.prototype.decodeInt=function(t){return s.intFromLE(t)},u.prototype.isPoint=function(t){return t instanceof this.pointClass}},47209:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0});var i=r(63447),n=r(38767);function s(t,e,r){for(var n=1634760805,s=857760878,o=2036477234,a=1797285236,c=r[3]<<24|r[2]<<16|r[1]<<8|r[0],h=r[7]<<24|r[6]<<16|r[5]<<8|r[4],u=r[11]<<24|r[10]<<16|r[9]<<8|r[8],f=r[15]<<24|r[14]<<16|r[13]<<8|r[12],d=r[19]<<24|r[18]<<16|r[17]<<8|r[16],l=r[23]<<24|r[22]<<16|r[21]<<8|r[20],p=r[27]<<24|r[26]<<16|r[25]<<8|r[24],g=r[31]<<24|r[30]<<16|r[29]<<8|r[28],m=e[3]<<24|e[2]<<16|e[1]<<8|e[0],b=e[7]<<24|e[6]<<16|e[5]<<8|e[4],v=e[11]<<24|e[10]<<16|e[9]<<8|e[8],y=e[15]<<24|e[14]<<16|e[13]<<8|e[12],w=n,_=s,A=o,M=a,E=c,I=h,S=u,P=f,x=d,R=l,N=p,O=g,C=m,T=b,q=v,k=y,D=0;D<20;D+=2)E=(E^=x=x+(C=(C^=w=w+E|0)>>>16|C<<16)|0)>>>20|E<<12,I=(I^=R=R+(T=(T^=_=_+I|0)>>>16|T<<16)|0)>>>20|I<<12,S=(S^=N=N+(q=(q^=A=A+S|0)>>>16|q<<16)|0)>>>20|S<<12,P=(P^=O=O+(k=(k^=M=M+P|0)>>>16|k<<16)|0)>>>20|P<<12,S=(S^=N=N+(q=(q^=A=A+S|0)>>>24|q<<8)|0)>>>25|S<<7,P=(P^=O=O+(k=(k^=M=M+P|0)>>>24|k<<8)|0)>>>25|P<<7,I=(I^=R=R+(T=(T^=_=_+I|0)>>>24|T<<8)|0)>>>25|I<<7,E=(E^=x=x+(C=(C^=w=w+E|0)>>>24|C<<8)|0)>>>25|E<<7,I=(I^=N=N+(k=(k^=w=w+I|0)>>>16|k<<16)|0)>>>20|I<<12,S=(S^=O=O+(C=(C^=_=_+S|0)>>>16|C<<16)|0)>>>20|S<<12,P=(P^=x=x+(T=(T^=A=A+P|0)>>>16|T<<16)|0)>>>20|P<<12,E=(E^=R=R+(q=(q^=M=M+E|0)>>>16|q<<16)|0)>>>20|E<<12,P=(P^=x=x+(T=(T^=A=A+P|0)>>>24|T<<8)|0)>>>25|P<<7,E=(E^=R=R+(q=(q^=M=M+E|0)>>>24|q<<8)|0)>>>25|E<<7,S=(S^=O=O+(C=(C^=_=_+S|0)>>>24|C<<8)|0)>>>25|S<<7,I=(I^=N=N+(k=(k^=w=w+I|0)>>>24|k<<8)|0)>>>25|I<<7;i.writeUint32LE(w+n|0,t,0),i.writeUint32LE(_+s|0,t,4),i.writeUint32LE(A+o|0,t,8),i.writeUint32LE(M+a|0,t,12),i.writeUint32LE(E+c|0,t,16),i.writeUint32LE(I+h|0,t,20),i.writeUint32LE(S+u|0,t,24),i.writeUint32LE(P+f|0,t,28),i.writeUint32LE(x+d|0,t,32),i.writeUint32LE(R+l|0,t,36),i.writeUint32LE(N+p|0,t,40),i.writeUint32LE(O+g|0,t,44),i.writeUint32LE(C+m|0,t,48),i.writeUint32LE(T+b|0,t,52),i.writeUint32LE(q+v|0,t,56),i.writeUint32LE(k+y|0,t,60)}function o(t,e,r,i,o){if(void 0===o&&(o=0),32!==t.length)throw new Error("ChaCha: key size must be 32 bytes");if(i.length<r.length)throw new Error("ChaCha: destination is shorter than source");var c,h;if(0===o){if(8!==e.length&&12!==e.length)throw new Error("ChaCha nonce must be 8 or 12 bytes");h=(c=new Uint8Array(16)).length-e.length,c.set(e,h)}else{if(16!==e.length)throw new Error("ChaCha nonce with counter must be 16 bytes");c=e,h=o}for(var u=new Uint8Array(64),f=0;f<r.length;f+=64){s(u,c,t);for(var d=f;d<f+64&&d<r.length;d++)i[d]=r[d]^u[d-f];a(c,0,h)}return n.wipe(u),0===o&&n.wipe(c),i}function a(t,e,r){for(var i=1;r--;)i=i+(255&t[e])|0,t[e]=255&i,i>>>=8,e++;if(i>0)throw new Error("ChaCha: counter overflow")}e.streamXOR=o,e.stream=function(t,e,r,i){return void 0===i&&(i=0),n.wipe(r),o(t,e,r,r,i)}},47591:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0});var i=r(2591),n=r(38767);e.DIGEST_LENGTH=16;var s=function(){function t(t){this.digestLength=e.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var r=t[0]|t[1]<<8;this._r[0]=8191&r;var i=t[2]|t[3]<<8;this._r[1]=8191&(r>>>13|i<<3);var n=t[4]|t[5]<<8;this._r[2]=7939&(i>>>10|n<<6);var s=t[6]|t[7]<<8;this._r[3]=8191&(n>>>7|s<<9);var o=t[8]|t[9]<<8;this._r[4]=255&(s>>>4|o<<12),this._r[5]=o>>>1&8190;var a=t[10]|t[11]<<8;this._r[6]=8191&(o>>>14|a<<2);var c=t[12]|t[13]<<8;this._r[7]=8065&(a>>>11|c<<5);var h=t[14]|t[15]<<8;this._r[8]=8191&(c>>>8|h<<8),this._r[9]=h>>>5&127,this._pad[0]=t[16]|t[17]<<8,this._pad[1]=t[18]|t[19]<<8,this._pad[2]=t[20]|t[21]<<8,this._pad[3]=t[22]|t[23]<<8,this._pad[4]=t[24]|t[25]<<8,this._pad[5]=t[26]|t[27]<<8,this._pad[6]=t[28]|t[29]<<8,this._pad[7]=t[30]|t[31]<<8}return t.prototype._blocks=function(t,e,r){for(var i=this._fin?0:2048,n=this._h[0],s=this._h[1],o=this._h[2],a=this._h[3],c=this._h[4],h=this._h[5],u=this._h[6],f=this._h[7],d=this._h[8],l=this._h[9],p=this._r[0],g=this._r[1],m=this._r[2],b=this._r[3],v=this._r[4],y=this._r[5],w=this._r[6],_=this._r[7],A=this._r[8],M=this._r[9];r>=16;){var E=t[e+0]|t[e+1]<<8;n+=8191&E;var I=t[e+2]|t[e+3]<<8;s+=8191&(E>>>13|I<<3);var S=t[e+4]|t[e+5]<<8;o+=8191&(I>>>10|S<<6);var P=t[e+6]|t[e+7]<<8;a+=8191&(S>>>7|P<<9);var x=t[e+8]|t[e+9]<<8;c+=8191&(P>>>4|x<<12),h+=x>>>1&8191;var R=t[e+10]|t[e+11]<<8;u+=8191&(x>>>14|R<<2);var N=t[e+12]|t[e+13]<<8;f+=8191&(R>>>11|N<<5);var O=t[e+14]|t[e+15]<<8,C=0,T=C;T+=n*p,T+=s*(5*M),T+=o*(5*A),T+=a*(5*_),C=(T+=c*(5*w))>>>13,T&=8191,T+=h*(5*y),T+=u*(5*v),T+=f*(5*b),T+=(d+=8191&(N>>>8|O<<8))*(5*m);var q=C+=(T+=(l+=O>>>5|i)*(5*g))>>>13;q+=n*g,q+=s*p,q+=o*(5*M),q+=a*(5*A),C=(q+=c*(5*_))>>>13,q&=8191,q+=h*(5*w),q+=u*(5*y),q+=f*(5*v),q+=d*(5*b),C+=(q+=l*(5*m))>>>13,q&=8191;var k=C;k+=n*m,k+=s*g,k+=o*p,k+=a*(5*M),C=(k+=c*(5*A))>>>13,k&=8191,k+=h*(5*_),k+=u*(5*w),k+=f*(5*y),k+=d*(5*v);var D=C+=(k+=l*(5*b))>>>13;D+=n*b,D+=s*m,D+=o*g,D+=a*p,C=(D+=c*(5*M))>>>13,D&=8191,D+=h*(5*A),D+=u*(5*_),D+=f*(5*w),D+=d*(5*y);var U=C+=(D+=l*(5*v))>>>13;U+=n*v,U+=s*b,U+=o*m,U+=a*g,C=(U+=c*p)>>>13,U&=8191,U+=h*(5*M),U+=u*(5*A),U+=f*(5*_),U+=d*(5*w);var B=C+=(U+=l*(5*y))>>>13;B+=n*y,B+=s*v,B+=o*b,B+=a*m,C=(B+=c*g)>>>13,B&=8191,B+=h*p,B+=u*(5*M),B+=f*(5*A),B+=d*(5*_);var L=C+=(B+=l*(5*w))>>>13;L+=n*w,L+=s*y,L+=o*v,L+=a*b,C=(L+=c*m)>>>13,L&=8191,L+=h*g,L+=u*p,L+=f*(5*M),L+=d*(5*A);var z=C+=(L+=l*(5*_))>>>13;z+=n*_,z+=s*w,z+=o*y,z+=a*v,C=(z+=c*b)>>>13,z&=8191,z+=h*m,z+=u*g,z+=f*p,z+=d*(5*M);var j=C+=(z+=l*(5*A))>>>13;j+=n*A,j+=s*_,j+=o*w,j+=a*y,C=(j+=c*v)>>>13,j&=8191,j+=h*b,j+=u*m,j+=f*g,j+=d*p;var F=C+=(j+=l*(5*M))>>>13;F+=n*M,F+=s*A,F+=o*_,F+=a*w,C=(F+=c*y)>>>13,F&=8191,F+=h*v,F+=u*b,F+=f*m,F+=d*g,n=T=8191&(C=(C=((C+=(F+=l*p)>>>13)<<2)+C|0)+(T&=8191)|0),s=q+=C>>>=13,o=k&=8191,a=D&=8191,c=U&=8191,h=B&=8191,u=L&=8191,f=z&=8191,d=j&=8191,l=F&=8191,e+=16,r-=16}this._h[0]=n,this._h[1]=s,this._h[2]=o,this._h[3]=a,this._h[4]=c,this._h[5]=h,this._h[6]=u,this._h[7]=f,this._h[8]=d,this._h[9]=l},t.prototype.finish=function(t,e){void 0===e&&(e=0);var r,i,n,s,o=new Uint16Array(10);if(this._leftover){for(s=this._leftover,this._buffer[s++]=1;s<16;s++)this._buffer[s]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(r=this._h[1]>>>13,this._h[1]&=8191,s=2;s<10;s++)this._h[s]+=r,r=this._h[s]>>>13,this._h[s]&=8191;for(this._h[0]+=5*r,r=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=r,r=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=r,o[0]=this._h[0]+5,r=o[0]>>>13,o[0]&=8191,s=1;s<10;s++)o[s]=this._h[s]+r,r=o[s]>>>13,o[s]&=8191;for(o[9]-=8192,i=(1^r)-1,s=0;s<10;s++)o[s]&=i;for(i=~i,s=0;s<10;s++)this._h[s]=this._h[s]&i|o[s];for(this._h[0]=65535&(this._h[0]|this._h[1]<<13),this._h[1]=65535&(this._h[1]>>>3|this._h[2]<<10),this._h[2]=65535&(this._h[2]>>>6|this._h[3]<<7),this._h[3]=65535&(this._h[3]>>>9|this._h[4]<<4),this._h[4]=65535&(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14),this._h[5]=65535&(this._h[6]>>>2|this._h[7]<<11),this._h[6]=65535&(this._h[7]>>>5|this._h[8]<<8),this._h[7]=65535&(this._h[8]>>>8|this._h[9]<<5),n=this._h[0]+this._pad[0],this._h[0]=65535&n,s=1;s<8;s++)n=(this._h[s]+this._pad[s]|0)+(n>>>16)|0,this._h[s]=65535&n;return t[e+0]=this._h[0]>>>0,t[e+1]=this._h[0]>>>8,t[e+2]=this._h[1]>>>0,t[e+3]=this._h[1]>>>8,t[e+4]=this._h[2]>>>0,t[e+5]=this._h[2]>>>8,t[e+6]=this._h[3]>>>0,t[e+7]=this._h[3]>>>8,t[e+8]=this._h[4]>>>0,t[e+9]=this._h[4]>>>8,t[e+10]=this._h[5]>>>0,t[e+11]=this._h[5]>>>8,t[e+12]=this._h[6]>>>0,t[e+13]=this._h[6]>>>8,t[e+14]=this._h[7]>>>0,t[e+15]=this._h[7]>>>8,this._finished=!0,this},t.prototype.update=function(t){var e,r=0,i=t.length;if(this._leftover){(e=16-this._leftover)>i&&(e=i);for(var n=0;n<e;n++)this._buffer[this._leftover+n]=t[r+n];if(i-=e,r+=e,this._leftover+=e,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(i>=16&&(e=i-i%16,this._blocks(t,r,e),r+=e,i-=e),i){for(n=0;n<i;n++)this._buffer[this._leftover+n]=t[r+n];this._leftover+=i}return this},t.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var t=new Uint8Array(16);return this.finish(t),t},t.prototype.clean=function(){return n.wipe(this._buffer),n.wipe(this._r),n.wipe(this._h),n.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},t}();e.Poly1305=s,e.oneTimeAuth=function(t,e){var r=new s(t);r.update(e);var i=r.digest();return r.clean(),i},e.equal=function(t,r){return t.length===e.DIGEST_LENGTH&&r.length===e.DIGEST_LENGTH&&i.equal(t,r)}},49899:(t,e,r)=>{var i=e,n=r(79188),s=r(7784),o=r(89042);i.assert=s,i.toArray=o.toArray,i.zero2=o.zero2,i.toHex=o.toHex,i.encode=o.encode,i.getNAF=function(t,e,r){var i,n=new Array(Math.max(t.bitLength(),r)+1);for(i=0;i<n.length;i+=1)n[i]=0;var s=1<<e+1,o=t.clone();for(i=0;i<n.length;i++){var a,c=o.andln(s-1);o.isOdd()?(a=c>(s>>1)-1?(s>>1)-c:c,o.isubn(a)):a=0,n[i]=a,o.iushrn(1)}return n},i.getJSF=function(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var i,n=0,s=0;t.cmpn(-n)>0||e.cmpn(-s)>0;){var o,a,c=t.andln(3)+n&3,h=e.andln(3)+s&3;3===c&&(c=-1),3===h&&(h=-1),o=1&c?3!=(i=t.andln(7)+n&7)&&5!==i||2!==h?c:-c:0,r[0].push(o),a=1&h?3!=(i=e.andln(7)+s&7)&&5!==i||2!==c?h:-h:0,r[1].push(a),2*n===o+1&&(n=1-n),2*s===a+1&&(s=1-s),t.iushrn(1),e.iushrn(1)}return r},i.cachedProperty=function(t,e,r){var i="_"+e;t.prototype[e]=function(){return void 0!==this[i]?this[i]:this[i]=r.call(this)}},i.parseBytes=function(t){return"string"==typeof t?i.toArray(t,"hex"):t},i.intFromLE=function(t){return new n(t,"hex","le")}},53604:(t,e,r)=>{var i=r(79188),n=r(49899),s=n.assert,o=n.cachedProperty,a=n.parseBytes;function c(t,e){this.eddsa=t,"object"!=typeof e&&(e=a(e)),Array.isArray(e)&&(s(e.length===2*t.encodingLength,"Signature has invalid size"),e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),s(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof i&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}o(c,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),o(c,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),o(c,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),o(c,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),c.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},c.prototype.toHex=function(){return n.encode(this.toBytes(),"hex").toUpperCase()},t.exports=c},54077:(t,e,r)=>{var i=r(49899),n=i.assert,s=i.parseBytes,o=i.cachedProperty;function a(t,e){this.eddsa=t,this._secret=s(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=s(e.pub)}a.fromPublic=function(t,e){return e instanceof a?e:new a(t,{pub:e})},a.fromSecret=function(t,e){return e instanceof a?e:new a(t,{secret:e})},a.prototype.secret=function(){return this._secret},o(a,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),o(a,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),o(a,"privBytes",(function(){var t=this.eddsa,e=this.hash(),r=t.encodingLength-1,i=e.slice(0,t.encodingLength);return i[0]&=248,i[r]&=127,i[r]|=64,i})),o(a,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),o(a,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),o(a,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),a.prototype.sign=function(t){return n(this._secret,"KeyPair can only verify"),this.eddsa.sign(t,this)},a.prototype.verify=function(t,e){return this.eddsa.verify(t,e,this)},a.prototype.getSecret=function(t){return n(this._secret,"KeyPair is public only"),i.encode(this.secret(),t)},a.prototype.getPublic=function(t){return i.encode(this.pubBytes(),t)},t.exports=a},55663:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0});var i=r(88605),n=r(2591),s=r(38767),o=function(){function t(t,e){this._finished=!1,this._inner=new t,this._outer=new t,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var r=new Uint8Array(this.blockSize);e.length>this.blockSize?this._inner.update(e).finish(r).clean():r.set(e);for(var n=0;n<r.length;n++)r[n]^=54;for(this._inner.update(r),n=0;n<r.length;n++)r[n]^=106;this._outer.update(r),i.isSerializableHash(this._inner)&&i.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),s.wipe(r)}return t.prototype.reset=function(){if(!i.isSerializableHash(this._inner)||!i.isSerializableHash(this._outer))throw new Error("hmac: can't reset() because hash doesn't implement restoreState()");return this._inner.restoreState(this._innerKeyedState),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},t.prototype.clean=function(){i.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),i.isSerializableHash(this._outer)&&this._outer.cleanSavedState(this._outerKeyedState),this._inner.clean(),this._outer.clean()},t.prototype.update=function(t){return this._inner.update(t),this},t.prototype.finish=function(t){return this._finished?(this._outer.finish(t),this):(this._inner.finish(t),this._outer.update(t.subarray(0,this.digestLength)).finish(t),this._finished=!0,this)},t.prototype.digest=function(){var t=new Uint8Array(this.digestLength);return this.finish(t),t},t.prototype.saveState=function(){if(!i.isSerializableHash(this._inner))throw new Error("hmac: can't saveState() because hash doesn't implement it");return this._inner.saveState()},t.prototype.restoreState=function(t){if(!i.isSerializableHash(this._inner)||!i.isSerializableHash(this._outer))throw new Error("hmac: can't restoreState() because hash doesn't implement it");return this._inner.restoreState(t),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},t.prototype.cleanSavedState=function(t){if(!i.isSerializableHash(this._inner))throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(t)},t}();e.HMAC=o,e.hmac=function(t,e,r){var i=new o(t,e);i.update(r);var n=i.digest();return i.clean(),n},e.equal=n.equal},57729:(t,e,r)=>{var i=e;i.version=r(72716).rE,i.utils=r(49899),i.rand=r(47048),i.curve=r(67942),i.curves=r(70392),i.ec=r(799),i.eddsa=r(43730)},59717:(t,e,r)=>{r.d(e,{EthereumProvider:()=>Ff});var i=r(50046),n=r.n(i),s=r(24661),o=r(91315),a=r(20635),c=r(67822),h=r(68032),u=r(21663),f=r(1427),d=r(27687),l=r(91311),p=r(38877),g=r(76282),m=r(57729),b=r(17379),v=r(84979);function y(t){return null!=globalThis.Buffer?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function w(t,e,r,i){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:i}}}const _=w("utf8","u",(t=>"u"+new TextDecoder("utf8").decode(t)),(t=>(new TextEncoder).encode(t.substring(1)))),A=w("ascii","a",(t=>{let e="a";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e}),(t=>{const e=function(t=0){return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?y(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}((t=t.substring(1)).length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e})),M={utf8:_,"utf-8":_,hex:v.Fo.base16,latin1:A,ascii:A,binary:A,...v.Fo};function E(t,e="utf8"){const r=M[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return"utf8"!==e&&"utf-8"!==e||null==globalThis.Buffer||null==globalThis.Buffer.from?r.decoder.decode(`${r.prefix}${t}`):y(globalThis.Buffer.from(t,"utf-8"))}var I=r(25607);const S="base64url";function P(t){return(0,I.j)(function(t,e="utf8"){const r=M[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return"utf8"!==e&&"utf-8"!==e||null==globalThis.Buffer||null==globalThis.Buffer.from?r.encoder.encode(t).substring(1):globalThis.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("utf8")}(E(t,S),"utf8"))}r(67385);var x=r(17367),R=r(39907),N=r(33486).hp;function O(t){const[e,r]=t.split(":");return{namespace:e,reference:r}}function C(t,e=[]){const r=[];return Object.keys(t).forEach((i=>{if(e.length&&!e.includes(i))return;const n=t[i];r.push(...n.accounts)})),r}function T(t,e){return t.includes(":")?[t]:e.chains||[]}var q=Object.defineProperty,k=Object.getOwnPropertySymbols,D=Object.prototype.hasOwnProperty,U=Object.prototype.propertyIsEnumerable,B=(t,e,r)=>e in t?q(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,L=(t,e)=>{for(var r in e||(e={}))D.call(e,r)&&B(t,r,e[r]);if(k)for(var r of k(e))U.call(e,r)&&B(t,r,e[r]);return t};const z="react-native",j="browser",F="js";function H(){return typeof R<"u"&&typeof R.versions<"u"&&typeof R.versions.node<"u"}function K(){return!(0,a.getDocument)()&&!!(0,a.getNavigator)()&&"ReactNative"===navigator.product}function $(){return!H()&&!!(0,a.getNavigator)()&&!!(0,a.getDocument)()}function V(){return K()?z:H()?"node":$()?j:"unknown"}function J(){return(0,c.g)()||{name:"",description:"",url:"",icons:[""]}}function G(t,e,i){const n=function(){if(V()===z&&typeof r.g<"u"&&typeof(null==r.g?void 0:r.g.Platform)<"u"){const{OS:t,Version:e}=r.g.Platform;return[t,e].join("-")}const t=(0,s.o0)();if(null===t)return"unknown";const e=t.os?t.os.replace(" ","").toLowerCase():"unknown";return"browser"===t.type?[e,t.name,t.version].join("-"):[e,t.version].join("-")}(),o=function(){var t;const e=V();return e===j?[e,(null==(t=(0,a.getLocation)())?void 0:t.host)||"unknown"].join(":"):e}();return[[t,e].join("-"),[F,i].join("-"),n,o].join("/")}function Q(t,e){return t.filter((t=>e.includes(t))).length===t.length}function W(t){return Object.fromEntries(t.entries())}function Y(t){return new Map(Object.entries(t))}function X(t=o.FIVE_MINUTES,e){const r=(0,o.toMiliseconds)(t||o.FIVE_MINUTES);let i,n,s;return{resolve:t=>{s&&i&&(clearTimeout(s),i(t))},reject:t=>{s&&n&&(clearTimeout(s),n(t))},done:()=>new Promise(((t,o)=>{s=setTimeout((()=>{o(new Error(e))}),r),i=t,n=o}))}}function Z(t,e,r){return new Promise((async(i,n)=>{const s=setTimeout((()=>n(new Error(r))),e);try{i(await t)}catch(t){n(t)}clearTimeout(s)}))}function tt(t,e){if("string"==typeof e&&e.startsWith(`${t}:`))return e;if("topic"===t.toLowerCase()){if("string"!=typeof e)throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}if("id"===t.toLowerCase()){if("number"!=typeof e)throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${t}`)}function et(t){const[e,r]=t.split(":"),i={id:void 0,topic:void 0};if("topic"===e&&"string"==typeof r)i.topic=r;else{if("id"!==e||!Number.isInteger(Number(r)))throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${r}`);i.id=Number(r)}return i}function rt(t,e){return(0,o.fromMiliseconds)((e||Date.now())+(0,o.toMiliseconds)(t))}function it(t){return Date.now()>=(0,o.toMiliseconds)(t)}function nt(t,e){return`${t}${e?`:${e}`:""}`}function st(t=[],e=[]){return[...new Set([...t,...e])]}function ot(t,e){if(!t.includes(e))return null;const r=t.split(/([&,?,=])/),i=r.indexOf(e);return r[i+2]}function at(){return typeof crypto<"u"&&null!=crypto&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,(t=>{const e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)}))}function ct(){return typeof R<"u"&&"true"===R.env.IS_VITEST}function ht(t){return N.from(t,"base64").toString("utf-8")}var ut,ft=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof r.g<"u"?r.g:typeof self<"u"?self:{},dt={exports:{}};ut=dt,function(){var t="input is invalid type",e="object"==typeof window,r=e?window:{};r.JS_SHA3_NO_WINDOW&&(e=!1);var i=!e&&"object"==typeof self;!r.JS_SHA3_NO_NODE_JS&&"object"==typeof R&&R.versions&&R.versions.node?r=ft:i&&(r=self);var n=!r.JS_SHA3_NO_COMMON_JS&&ut.exports,s=!r.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",o="0123456789abcdef".split(""),a=[4,1024,262144,67108864],c=[0,8,16,24],h=[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],u=[224,256,384,512],f=[128,256],d=["hex","buffer","arrayBuffer","array","digest"],l={128:168,256:136};(r.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),s&&(r.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});for(var p=function(t,e,r){return function(i){return new N(t,e,t).update(i)[r]()}},g=function(t,e,r){return function(i,n){return new N(t,e,n).update(i)[r]()}},m=function(t,e,r){return function(e,i,n,s){return _["cshake"+t].update(e,i,n,s)[r]()}},b=function(t,e,r){return function(e,i,n,s){return _["kmac"+t].update(e,i,n,s)[r]()}},v=function(t,e,r,i){for(var n=0;n<d.length;++n){var s=d[n];t[s]=e(r,i,s)}return t},y=function(t,e){var r=p(t,e,"hex");return r.create=function(){return new N(t,e,t)},r.update=function(t){return r.create().update(t)},v(r,p,t,e)},w=[{name:"keccak",padding:[1,256,65536,16777216],bits:u,createMethod:y},{name:"sha3",padding:[6,1536,393216,100663296],bits:u,createMethod:y},{name:"shake",padding:[31,7936,2031616,520093696],bits:f,createMethod:function(t,e){var r=g(t,e,"hex");return r.create=function(r){return new N(t,e,r)},r.update=function(t,e){return r.create(e).update(t)},v(r,g,t,e)}},{name:"cshake",padding:a,bits:f,createMethod:function(t,e){var r=l[t],i=m(t,0,"hex");return i.create=function(i,n,s){return n||s?new N(t,e,i).bytepad([n,s],r):_["shake"+t].create(i)},i.update=function(t,e,r,n){return i.create(e,r,n).update(t)},v(i,m,t,e)}},{name:"kmac",padding:a,bits:f,createMethod:function(t,e){var r=l[t],i=b(t,0,"hex");return i.create=function(i,n,s){return new O(t,e,n).bytepad(["KMAC",s],r).bytepad([i],r)},i.update=function(t,e,r,n){return i.create(t,r,n).update(e)},v(i,b,t,e)}}],_={},A=[],M=0;M<w.length;++M)for(var E=w[M],I=E.bits,S=0;S<I.length;++S){var P=E.name+"_"+I[S];if(A.push(P),_[P]=E.createMethod(I[S],E.padding),"sha3"!==E.name){var x=E.name+I[S];A.push(x),_[x]=_[P]}}function N(t,e,r){this.blocks=[],this.s=[],this.padding=e,this.outputBits=r,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(t<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var i=0;i<50;++i)this.s[i]=0}function O(t,e,r){N.call(this,t,e,r)}N.prototype.update=function(e){if(this.finalized)throw new Error("finalize already called");var r,i=typeof e;if("string"!==i){if("object"!==i)throw new Error(t);if(null===e)throw new Error(t);if(s&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||s&&ArrayBuffer.isView(e)))throw new Error(t);r=!0}for(var n,o,a=this.blocks,h=this.byteCount,u=e.length,f=this.blockCount,d=0,l=this.s;d<u;){if(this.reset)for(this.reset=!1,a[0]=this.block,n=1;n<f+1;++n)a[n]=0;if(r)for(n=this.start;d<u&&n<h;++d)a[n>>2]|=e[d]<<c[3&n++];else for(n=this.start;d<u&&n<h;++d)(o=e.charCodeAt(d))<128?a[n>>2]|=o<<c[3&n++]:o<2048?(a[n>>2]|=(192|o>>6)<<c[3&n++],a[n>>2]|=(128|63&o)<<c[3&n++]):o<55296||o>=57344?(a[n>>2]|=(224|o>>12)<<c[3&n++],a[n>>2]|=(128|o>>6&63)<<c[3&n++],a[n>>2]|=(128|63&o)<<c[3&n++]):(o=65536+((1023&o)<<10|1023&e.charCodeAt(++d)),a[n>>2]|=(240|o>>18)<<c[3&n++],a[n>>2]|=(128|o>>12&63)<<c[3&n++],a[n>>2]|=(128|o>>6&63)<<c[3&n++],a[n>>2]|=(128|63&o)<<c[3&n++]);if(this.lastByteIndex=n,n>=h){for(this.start=n-h,this.block=a[f],n=0;n<f;++n)l[n]^=a[n];C(l),this.reset=!0}else this.start=n}return this},N.prototype.encode=function(t,e){var r=255&t,i=1,n=[r];for(r=255&(t>>=8);r>0;)n.unshift(r),r=255&(t>>=8),++i;return e?n.push(i):n.unshift(i),this.update(n),n.length},N.prototype.encodeString=function(e){var r,i=typeof e;if("string"!==i){if("object"!==i)throw new Error(t);if(null===e)throw new Error(t);if(s&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||s&&ArrayBuffer.isView(e)))throw new Error(t);r=!0}var n=0,o=e.length;if(r)n=o;else for(var a=0;a<e.length;++a){var c=e.charCodeAt(a);c<128?n+=1:c<2048?n+=2:c<55296||c>=57344?n+=3:(c=65536+((1023&c)<<10|1023&e.charCodeAt(++a)),n+=4)}return n+=this.encode(8*n),this.update(e),n},N.prototype.bytepad=function(t,e){for(var r=this.encode(e),i=0;i<t.length;++i)r+=this.encodeString(t[i]);var n=e-r%e,s=[];return s.length=n,this.update(s),this},N.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex,r=this.blockCount,i=this.s;if(t[e>>2]|=this.padding[3&e],this.lastByteIndex===this.byteCount)for(t[0]=t[r],e=1;e<r+1;++e)t[e]=0;for(t[r-1]|=2147483648,e=0;e<r;++e)i[e]^=t[e];C(i)}},N.prototype.toString=N.prototype.hex=function(){this.finalize();for(var t,e=this.blockCount,r=this.s,i=this.outputBlocks,n=this.extraBytes,s=0,a=0,c="";a<i;){for(s=0;s<e&&a<i;++s,++a)t=r[s],c+=o[t>>4&15]+o[15&t]+o[t>>12&15]+o[t>>8&15]+o[t>>20&15]+o[t>>16&15]+o[t>>28&15]+o[t>>24&15];a%e===0&&(C(r),s=0)}return n&&(t=r[s],c+=o[t>>4&15]+o[15&t],n>1&&(c+=o[t>>12&15]+o[t>>8&15]),n>2&&(c+=o[t>>20&15]+o[t>>16&15])),c},N.prototype.arrayBuffer=function(){this.finalize();var t,e=this.blockCount,r=this.s,i=this.outputBlocks,n=this.extraBytes,s=0,o=0,a=this.outputBits>>3;t=n?new ArrayBuffer(i+1<<2):new ArrayBuffer(a);for(var c=new Uint32Array(t);o<i;){for(s=0;s<e&&o<i;++s,++o)c[o]=r[s];o%e===0&&C(r)}return n&&(c[s]=r[s],t=t.slice(0,a)),t},N.prototype.buffer=N.prototype.arrayBuffer,N.prototype.digest=N.prototype.array=function(){this.finalize();for(var t,e,r=this.blockCount,i=this.s,n=this.outputBlocks,s=this.extraBytes,o=0,a=0,c=[];a<n;){for(o=0;o<r&&a<n;++o,++a)t=a<<2,e=i[o],c[t]=255&e,c[t+1]=e>>8&255,c[t+2]=e>>16&255,c[t+3]=e>>24&255;a%r===0&&C(i)}return s&&(t=a<<2,e=i[o],c[t]=255&e,s>1&&(c[t+1]=e>>8&255),s>2&&(c[t+2]=e>>16&255)),c},O.prototype=new N,O.prototype.finalize=function(){return this.encode(this.outputBits,!0),N.prototype.finalize.call(this)};var C=function(t){var e,r,i,n,s,o,a,c,u,f,d,l,p,g,m,b,v,y,w,_,A,M,E,I,S,P,x,R,N,O,C,T,q,k,D,U,B,L,z,j,F,H,K,$,V,J,G,Q,W,Y,X,Z,tt,et,rt,it,nt,st,ot,at,ct,ht,ut;for(i=0;i<48;i+=2)n=t[0]^t[10]^t[20]^t[30]^t[40],s=t[1]^t[11]^t[21]^t[31]^t[41],o=t[2]^t[12]^t[22]^t[32]^t[42],a=t[3]^t[13]^t[23]^t[33]^t[43],c=t[4]^t[14]^t[24]^t[34]^t[44],u=t[5]^t[15]^t[25]^t[35]^t[45],f=t[6]^t[16]^t[26]^t[36]^t[46],d=t[7]^t[17]^t[27]^t[37]^t[47],e=(l=t[8]^t[18]^t[28]^t[38]^t[48])^(o<<1|a>>>31),r=(p=t[9]^t[19]^t[29]^t[39]^t[49])^(a<<1|o>>>31),t[0]^=e,t[1]^=r,t[10]^=e,t[11]^=r,t[20]^=e,t[21]^=r,t[30]^=e,t[31]^=r,t[40]^=e,t[41]^=r,e=n^(c<<1|u>>>31),r=s^(u<<1|c>>>31),t[2]^=e,t[3]^=r,t[12]^=e,t[13]^=r,t[22]^=e,t[23]^=r,t[32]^=e,t[33]^=r,t[42]^=e,t[43]^=r,e=o^(f<<1|d>>>31),r=a^(d<<1|f>>>31),t[4]^=e,t[5]^=r,t[14]^=e,t[15]^=r,t[24]^=e,t[25]^=r,t[34]^=e,t[35]^=r,t[44]^=e,t[45]^=r,e=c^(l<<1|p>>>31),r=u^(p<<1|l>>>31),t[6]^=e,t[7]^=r,t[16]^=e,t[17]^=r,t[26]^=e,t[27]^=r,t[36]^=e,t[37]^=r,t[46]^=e,t[47]^=r,e=f^(n<<1|s>>>31),r=d^(s<<1|n>>>31),t[8]^=e,t[9]^=r,t[18]^=e,t[19]^=r,t[28]^=e,t[29]^=r,t[38]^=e,t[39]^=r,t[48]^=e,t[49]^=r,g=t[0],m=t[1],J=t[11]<<4|t[10]>>>28,G=t[10]<<4|t[11]>>>28,R=t[20]<<3|t[21]>>>29,N=t[21]<<3|t[20]>>>29,at=t[31]<<9|t[30]>>>23,ct=t[30]<<9|t[31]>>>23,H=t[40]<<18|t[41]>>>14,K=t[41]<<18|t[40]>>>14,k=t[2]<<1|t[3]>>>31,D=t[3]<<1|t[2]>>>31,b=t[13]<<12|t[12]>>>20,v=t[12]<<12|t[13]>>>20,Q=t[22]<<10|t[23]>>>22,W=t[23]<<10|t[22]>>>22,O=t[33]<<13|t[32]>>>19,C=t[32]<<13|t[33]>>>19,ht=t[42]<<2|t[43]>>>30,ut=t[43]<<2|t[42]>>>30,et=t[5]<<30|t[4]>>>2,rt=t[4]<<30|t[5]>>>2,U=t[14]<<6|t[15]>>>26,B=t[15]<<6|t[14]>>>26,y=t[25]<<11|t[24]>>>21,w=t[24]<<11|t[25]>>>21,Y=t[34]<<15|t[35]>>>17,X=t[35]<<15|t[34]>>>17,T=t[45]<<29|t[44]>>>3,q=t[44]<<29|t[45]>>>3,I=t[6]<<28|t[7]>>>4,S=t[7]<<28|t[6]>>>4,it=t[17]<<23|t[16]>>>9,nt=t[16]<<23|t[17]>>>9,L=t[26]<<25|t[27]>>>7,z=t[27]<<25|t[26]>>>7,_=t[36]<<21|t[37]>>>11,A=t[37]<<21|t[36]>>>11,Z=t[47]<<24|t[46]>>>8,tt=t[46]<<24|t[47]>>>8,$=t[8]<<27|t[9]>>>5,V=t[9]<<27|t[8]>>>5,P=t[18]<<20|t[19]>>>12,x=t[19]<<20|t[18]>>>12,st=t[29]<<7|t[28]>>>25,ot=t[28]<<7|t[29]>>>25,j=t[38]<<8|t[39]>>>24,F=t[39]<<8|t[38]>>>24,M=t[48]<<14|t[49]>>>18,E=t[49]<<14|t[48]>>>18,t[0]=g^~b&y,t[1]=m^~v&w,t[10]=I^~P&R,t[11]=S^~x&N,t[20]=k^~U&L,t[21]=D^~B&z,t[30]=$^~J&Q,t[31]=V^~G&W,t[40]=et^~it&st,t[41]=rt^~nt&ot,t[2]=b^~y&_,t[3]=v^~w&A,t[12]=P^~R&O,t[13]=x^~N&C,t[22]=U^~L&j,t[23]=B^~z&F,t[32]=J^~Q&Y,t[33]=G^~W&X,t[42]=it^~st&at,t[43]=nt^~ot&ct,t[4]=y^~_&M,t[5]=w^~A&E,t[14]=R^~O&T,t[15]=N^~C&q,t[24]=L^~j&H,t[25]=z^~F&K,t[34]=Q^~Y&Z,t[35]=W^~X&tt,t[44]=st^~at&ht,t[45]=ot^~ct&ut,t[6]=_^~M&g,t[7]=A^~E&m,t[16]=O^~T&I,t[17]=C^~q&S,t[26]=j^~H&k,t[27]=F^~K&D,t[36]=Y^~Z&$,t[37]=X^~tt&V,t[46]=at^~ht&et,t[47]=ct^~ut&rt,t[8]=M^~g&b,t[9]=E^~m&v,t[18]=T^~I&P,t[19]=q^~S&x,t[28]=H^~k&U,t[29]=K^~D&B,t[38]=Z^~$&J,t[39]=tt^~V&G,t[48]=ht^~et&it,t[49]=ut^~rt&nt,t[0]^=h[i],t[1]^=h[i+1]};if(n)ut.exports=_;else for(M=0;M<A.length;++M)r[A[M]]=_[A[M]]}();var lt=dt.exports;let pt=!1,gt=!1;const mt={debug:1,default:2,info:2,warning:3,error:4,off:5};let bt=mt.default,vt=null;const yt=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch{t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var wt,_t;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(wt||(wt={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(_t||(_t={}));const At="0123456789abcdef";class Mt{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==mt[r]&&this.throwArgumentError("invalid log level name","logLevel",t),!(bt>mt[r])&&console.log.apply(console,e)}debug(...t){this._log(Mt.levels.DEBUG,t)}info(...t){this._log(Mt.levels.INFO,t)}warn(...t){this._log(Mt.levels.WARNING,t)}makeError(t,e,r){if(gt)return this.makeError("censored error",e,{});e||(e=Mt.errors.UNKNOWN_ERROR),r||(r={});const i=[];Object.keys(r).forEach((t=>{const e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t<e.length;t++)r+=At[e[t]>>4],r+=At[15&e[t]];i.push(t+"=Uint8Array(0x"+r+")")}else i.push(t+"="+JSON.stringify(e))}catch{i.push(t+"="+JSON.stringify(r[t].toString()))}})),i.push(`code=${e}`),i.push(`version=${this.version}`);const n=t;let s="";switch(e){case _t.NUMERIC_FAULT:{s="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":s+="-"+e;break;case"negative-power":case"negative-width":s+="-unsupported";break;case"unbound-bitwise-result":s+="-unbound-result"}break}case _t.CALL_EXCEPTION:case _t.INSUFFICIENT_FUNDS:case _t.MISSING_NEW:case _t.NONCE_EXPIRED:case _t.REPLACEMENT_UNDERPRICED:case _t.TRANSACTION_REPLACED:case _t.UNPREDICTABLE_GAS_LIMIT:s=e}s&&(t+=" [ See: https://links.ethers.org/v5-errors-"+s+" ]"),i.length&&(t+=" ("+i.join(", ")+")");const o=new Error(t);return o.reason=n,o.code=e,Object.keys(r).forEach((function(t){o[t]=r[t]})),o}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,Mt.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,i){t||this.throwError(e,r,i)}assertArgument(t,e,r,i){t||this.throwArgumentError(e,r,i)}checkNormalize(t){yt&&this.throwError("platform missing String.prototype.normalize",Mt.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:yt})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,Mt.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,Mt.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",t<e&&this.throwError("missing argument"+r,Mt.errors.MISSING_ARGUMENT,{count:t,expectedCount:e}),t>e&&this.throwError("too many arguments"+r,Mt.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){(t===Object||null==t)&&this.throwError("missing new",Mt.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",Mt.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):(t===Object||null==t)&&this.throwError("missing new",Mt.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return vt||(vt=new Mt("logger/5.7.0")),vt}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",Mt.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),pt){if(!t)return;this.globalLogger().throwError("error censorship permanent",Mt.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}gt=!!t,pt=!!e}static setLogLevel(t){const e=mt[t.toLowerCase()];null!=e?bt=e:Mt.globalLogger().warn("invalid log level - "+t)}static from(t){return new Mt(t)}}Mt.errors=_t,Mt.levels=wt;const Et=new Mt("bytes/5.7.0");function It(t){return!!t.toHexString}function St(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return St(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function Pt(t){return"number"==typeof t&&t==t&&t%1==0}function xt(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t||!Pt(t.length)||t.length<0)return!1;for(let e=0;e<t.length;e++){const r=t[e];if(!Pt(r)||r<0||r>=256)return!1}return!0}function Rt(t,e){if(e||(e={}),"number"==typeof t){Et.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),St(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),It(t)&&(t=t.toHexString()),Nt(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":Et.throwArgumentError("hex data is odd-length","value",t));const i=[];for(let t=0;t<r.length;t+=2)i.push(parseInt(r.substring(t,t+2),16));return St(new Uint8Array(i))}return xt(t)?St(new Uint8Array(t)):Et.throwArgumentError("invalid arrayify value","value",t)}function Nt(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const Ot="0123456789abcdef";function Ct(t,e){if(e||(e={}),"number"==typeof t){Et.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e=Ot[15&t]+e,t=Math.floor(t/16);return e.length?(e.length%2&&(e="0"+e),"0x"+e):"0x00"}if("bigint"==typeof t)return(t=t.toString(16)).length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),It(t))return t.toHexString();if(Nt(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":Et.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(xt(t)){let e="0x";for(let r=0;r<t.length;r++){let i=t[r];e+=Ot[(240&i)>>4]+Ot[15&i]}return e}return Et.throwArgumentError("invalid hexlify value","value",t)}function Tt(t,e,r){return"string"!=typeof t?t=Ct(t):(!Nt(t)||t.length%2)&&Et.throwArgumentError("invalid hexData","value",t),e=2+2*e,null!=r?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function qt(t,e){for("string"!=typeof t?t=Ct(t):Nt(t)||Et.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&Et.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function kt(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(function(t){return Nt(t)&&!(t.length%2)||xt(t)}(t)){let r=Rt(t);64===r.length?(e.v=27+(r[32]>>7),r[32]&=127,e.r=Ct(r.slice(0,32)),e.s=Ct(r.slice(32,64))):65===r.length?(e.r=Ct(r.slice(0,32)),e.s=Ct(r.slice(32,64)),e.v=r[64]):Et.throwArgumentError("invalid signature string","signature",t),e.v<27&&(0===e.v||1===e.v?e.v+=27:Et.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=Ct(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,null!=e._vs){const r=function(t,e){(t=Rt(t)).length>e&&Et.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),St(r)}(Rt(e._vs),32);e._vs=Ct(r);const i=r[0]>=128?1:0;null==e.recoveryParam?e.recoveryParam=i:e.recoveryParam!==i&&Et.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),r[0]&=127;const n=Ct(r);null==e.s?e.s=n:e.s!==n&&Et.throwArgumentError("signature v mismatch _vs","signature",t)}if(null==e.recoveryParam)null==e.v?Et.throwArgumentError("signature missing v and recoveryParam","signature",t):0===e.v||1===e.v?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(null==e.v)e.v=27+e.recoveryParam;else{const r=0===e.v||1===e.v?e.v:1-e.v%2;e.recoveryParam!==r&&Et.throwArgumentError("signature recoveryParam mismatch v","signature",t)}null!=e.r&&Nt(e.r)?e.r=qt(e.r,32):Et.throwArgumentError("signature missing or invalid r","signature",t),null!=e.s&&Nt(e.s)?e.s=qt(e.s,32):Et.throwArgumentError("signature missing or invalid s","signature",t);const r=Rt(e.s);r[0]>=128&&Et.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const i=Ct(r);e._vs&&(Nt(e._vs)||Et.throwArgumentError("signature invalid _vs","signature",t),e._vs=qt(e._vs,32)),null==e._vs?e._vs=i:e._vs!==i&&Et.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function Dt(t){return"0x"+lt.keccak_256(Rt(t))}var Ut={exports:{}},Bt=function(t){var e=t.default;if("function"==typeof e){var r=function(){return e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var i=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(r,e,i.get?i:{enumerable:!0,get:function(){return t[e]}})})),r}(Object.freeze({__proto__:null,default:{}}));!function(t){!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,e,r){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&(("le"===e||"be"===e)&&(r=e,e=10),this._init(t||0,e||10,r||"be"))}var s;"object"==typeof t?t.exports=n:e.BN=n,n.BN=n,n.wordSize=26;try{s=typeof window<"u"&&typeof window.Buffer<"u"?window.Buffer:Bt.Buffer}catch{}function o(t,e){var i=t.charCodeAt(e);return i>=48&&i<=57?i-48:i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:void r(!1,"Invalid character in "+t)}function a(t,e,r){var i=o(t,r);return r-1>=e&&(i|=o(t,r-1)<<4),i}function c(t,e,i,n){for(var s=0,o=0,a=Math.min(t.length,i),c=e;c<a;c++){var h=t.charCodeAt(c)-48;s*=n,o=h>=49?h-49+10:h>=17?h-17+10:h,r(h>=0&&o<n,"Invalid character"),s+=o}return s}function h(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.prototype._init=function(t,e,i){if("number"==typeof t)return this._initNumber(t,e,i);if("object"==typeof t)return this._initArray(t,e,i);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<t.length&&(16===e?this._parseHex(t,n,i):(this._parseBase(t,e,n),"le"===i&&this._initArray(this.toArray(),e,i)))},n.prototype._initNumber=function(t,e,i){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),e,i)},n.prototype._initArray=function(t,e,i){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var s,o,a=0;if("be"===i)for(n=t.length-1,s=0;n>=0;n-=3)o=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[s]|=o<<a&67108863,this.words[s+1]=o>>>26-a&67108863,(a+=24)>=26&&(a-=26,s++);else if("le"===i)for(n=0,s=0;n<t.length;n+=3)o=t[n]|t[n+1]<<8|t[n+2]<<16,this.words[s]|=o<<a&67108863,this.words[s+1]=o>>>26-a&67108863,(a+=24)>=26&&(a-=26,s++);return this._strip()},n.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var n,s=0,o=0;if("be"===r)for(i=t.length-1;i>=e;i-=2)n=a(t,e,i)<<s,this.words[o]|=67108863&n,s>=18?(s-=18,o+=1,this.words[o]|=n>>>26):s+=8;else for(i=(t.length-e)%2==0?e+1:e;i<t.length;i+=2)n=a(t,e,i)<<s,this.words[o]|=67108863&n,s>=18?(s-=18,o+=1,this.words[o]|=n>>>26):s+=8;this._strip()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var s=t.length-r,o=s%i,a=Math.min(s,s-o)+r,h=0,u=r;u<a;u+=i)h=c(t,u,u+i,e),this.imuln(n),this.words[0]+h<67108864?this.words[0]+=h:this._iaddn(h);if(0!==o){var f=1;for(h=c(t,u,t.length,e),u=0;u<o;u++)f*=e;this.imuln(f),this.words[0]+h<67108864?this.words[0]+=h:this._iaddn(h)}this._strip()},n.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},n.prototype._move=function(t){h(t,this)},n.prototype.clone=function(){var t=new n(null);return this.copy(t),t},n.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},n.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},typeof Symbol<"u"&&"function"==typeof Symbol.for)try{n.prototype[Symbol.for("nodejs.util.inspect.custom")]=u}catch{n.prototype.inspect=u}else n.prototype.inspect=u;function u(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var f=["","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"],d=[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],l=[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];function p(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],s=0|e.words[0],o=n*s,a=67108863&o,c=o/67108864|0;r.words[0]=a;for(var h=1;h<i;h++){for(var u=c>>>26,f=67108863&c,d=Math.min(h,e.length-1),l=Math.max(0,h-t.length+1);l<=d;l++){var p=h-l|0;u+=(o=(n=0|t.words[p])*(s=0|e.words[l])+f)/67108864|0,f=67108863&o}r.words[h]=0|f,c=0|u}return 0!==c?r.words[h]=0|c:r.length--,r._strip()}n.prototype.toString=function(t,e){var i;if(e=0|e||1,16===(t=t||10)||"hex"===t){i="";for(var n=0,s=0,o=0;o<this.length;o++){var a=this.words[o],c=(16777215&(a<<n|s)).toString(16);s=a>>>24-n&16777215,(n+=2)>=26&&(n-=26,o--),i=0!==s||o!==this.length-1?f[6-c.length]+c+i:c+i}for(0!==s&&(i=s.toString(16)+i);i.length%e!==0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var h=d[t],u=l[t];i="";var p=this.clone();for(p.negative=0;!p.isZero();){var g=p.modrn(u).toString(t);i=(p=p.idivn(u)).isZero()?g+i:f[h-g.length]+g+i}for(this.isZero()&&(i="0"+i);i.length%e!==0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16,2)},s&&(n.prototype.toBuffer=function(t,e){return this.toArrayLike(s,t,e)}),n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},n.prototype.toArrayLike=function(t,e,i){this._strip();var n=this.byteLength(),s=i||Math.max(1,n);r(n<=s,"byte array longer than desired length"),r(s>0,"Requested array length <= 0");var o=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,s);return this["_toArrayLike"+("le"===e?"LE":"BE")](o,n),o},n.prototype._toArrayLikeLE=function(t,e){for(var r=0,i=0,n=0,s=0;n<this.length;n++){var o=this.words[n]<<s|i;t[r++]=255&o,r<t.length&&(t[r++]=o>>8&255),r<t.length&&(t[r++]=o>>16&255),6===s?(r<t.length&&(t[r++]=o>>24&255),i=0,s=0):(i=o>>>24,s+=2)}if(r<t.length)for(t[r++]=i;r<t.length;)t[r++]=0},n.prototype._toArrayLikeBE=function(t,e){for(var r=t.length-1,i=0,n=0,s=0;n<this.length;n++){var o=this.words[n]<<s|i;t[r--]=255&o,r>=0&&(t[r--]=o>>8&255),r>=0&&(t[r--]=o>>16&255),6===s?(r>=0&&(t[r--]=o>>24&255),i=0,s=0):(i=o>>>24,s+=2)}if(r>=0)for(t[r--]=i;r>=0;)t[r--]=0},Math.clz32?n.prototype._countBits=function(t){return 32-Math.clz32(t)}:n.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},n.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 8191&e||(r+=13,e>>>=13),127&e||(r+=7,e>>>=7),15&e||(r+=4,e>>>=4),3&e||(r+=2,e>>>=2),1&e||r++,r},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},n.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this._strip()},n.prototype.ior=function(t){return r(0===(this.negative|t.negative)),this.iuor(t)},n.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},n.prototype.iand=function(t){return r(0===(this.negative|t.negative)),this.iuand(t)},n.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;i<r.length;i++)this.words[i]=e.words[i]^r.words[i];if(this!==e)for(;i<e.length;i++)this.words[i]=e.words[i];return this.length=e.length,this._strip()},n.prototype.ixor=function(t){return r(0===(this.negative|t.negative)),this.iuxor(t)},n.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),i=t%26;this._expand(e),i>0&&e--;for(var n=0;n<e;n++)this.words[n]=67108863&~this.words[n];return i>0&&(this.words[n]=~this.words[n]&67108863>>26-i),this._strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var i=t/26|0,n=t%26;return this._expand(i+1),this.words[i]=e?this.words[i]|1<<n:this.words[i]&~(1<<n),this._strip()},n.prototype.iadd=function(t){var e,r,i;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,i=t):(r=t,i=this);for(var n=0,s=0;s<i.length;s++)e=(0|r.words[s])+(0|i.words[s])+n,this.words[s]=67108863&e,n=e>>>26;for(;0!==n&&s<r.length;s++)e=(0|r.words[s])+n,this.words[s]=67108863&e,n=e>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this},n.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var s=0,o=0;o<i.length;o++)s=(e=(0|r.words[o])-(0|i.words[o])+s)>>26,this.words[o]=67108863&e;for(;0!==s&&o<r.length;o++)s=(e=(0|r.words[o])+s)>>26,this.words[o]=67108863&e;if(0===s&&o<r.length&&r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this.length=Math.max(this.length,o),r!==this&&(this.negative=1),this._strip()},n.prototype.sub=function(t){return this.clone().isub(t)};var g=function(t,e,r){var i,n,s,o=t.words,a=e.words,c=r.words,h=0,u=0|o[0],f=8191&u,d=u>>>13,l=0|o[1],p=8191&l,g=l>>>13,m=0|o[2],b=8191&m,v=m>>>13,y=0|o[3],w=8191&y,_=y>>>13,A=0|o[4],M=8191&A,E=A>>>13,I=0|o[5],S=8191&I,P=I>>>13,x=0|o[6],R=8191&x,N=x>>>13,O=0|o[7],C=8191&O,T=O>>>13,q=0|o[8],k=8191&q,D=q>>>13,U=0|o[9],B=8191&U,L=U>>>13,z=0|a[0],j=8191&z,F=z>>>13,H=0|a[1],K=8191&H,$=H>>>13,V=0|a[2],J=8191&V,G=V>>>13,Q=0|a[3],W=8191&Q,Y=Q>>>13,X=0|a[4],Z=8191&X,tt=X>>>13,et=0|a[5],rt=8191&et,it=et>>>13,nt=0|a[6],st=8191&nt,ot=nt>>>13,at=0|a[7],ct=8191&at,ht=at>>>13,ut=0|a[8],ft=8191&ut,dt=ut>>>13,lt=0|a[9],pt=8191&lt,gt=lt>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(h+(i=Math.imul(f,j))|0)+((8191&(n=(n=Math.imul(f,F))+Math.imul(d,j)|0))<<13)|0;h=((s=Math.imul(d,F))+(n>>>13)|0)+(mt>>>26)|0,mt&=67108863,i=Math.imul(p,j),n=(n=Math.imul(p,F))+Math.imul(g,j)|0,s=Math.imul(g,F);var bt=(h+(i=i+Math.imul(f,K)|0)|0)+((8191&(n=(n=n+Math.imul(f,$)|0)+Math.imul(d,K)|0))<<13)|0;h=((s=s+Math.imul(d,$)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(b,j),n=(n=Math.imul(b,F))+Math.imul(v,j)|0,s=Math.imul(v,F),i=i+Math.imul(p,K)|0,n=(n=n+Math.imul(p,$)|0)+Math.imul(g,K)|0,s=s+Math.imul(g,$)|0;var vt=(h+(i=i+Math.imul(f,J)|0)|0)+((8191&(n=(n=n+Math.imul(f,G)|0)+Math.imul(d,J)|0))<<13)|0;h=((s=s+Math.imul(d,G)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(w,j),n=(n=Math.imul(w,F))+Math.imul(_,j)|0,s=Math.imul(_,F),i=i+Math.imul(b,K)|0,n=(n=n+Math.imul(b,$)|0)+Math.imul(v,K)|0,s=s+Math.imul(v,$)|0,i=i+Math.imul(p,J)|0,n=(n=n+Math.imul(p,G)|0)+Math.imul(g,J)|0,s=s+Math.imul(g,G)|0;var yt=(h+(i=i+Math.imul(f,W)|0)|0)+((8191&(n=(n=n+Math.imul(f,Y)|0)+Math.imul(d,W)|0))<<13)|0;h=((s=s+Math.imul(d,Y)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(M,j),n=(n=Math.imul(M,F))+Math.imul(E,j)|0,s=Math.imul(E,F),i=i+Math.imul(w,K)|0,n=(n=n+Math.imul(w,$)|0)+Math.imul(_,K)|0,s=s+Math.imul(_,$)|0,i=i+Math.imul(b,J)|0,n=(n=n+Math.imul(b,G)|0)+Math.imul(v,J)|0,s=s+Math.imul(v,G)|0,i=i+Math.imul(p,W)|0,n=(n=n+Math.imul(p,Y)|0)+Math.imul(g,W)|0,s=s+Math.imul(g,Y)|0;var wt=(h+(i=i+Math.imul(f,Z)|0)|0)+((8191&(n=(n=n+Math.imul(f,tt)|0)+Math.imul(d,Z)|0))<<13)|0;h=((s=s+Math.imul(d,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(S,j),n=(n=Math.imul(S,F))+Math.imul(P,j)|0,s=Math.imul(P,F),i=i+Math.imul(M,K)|0,n=(n=n+Math.imul(M,$)|0)+Math.imul(E,K)|0,s=s+Math.imul(E,$)|0,i=i+Math.imul(w,J)|0,n=(n=n+Math.imul(w,G)|0)+Math.imul(_,J)|0,s=s+Math.imul(_,G)|0,i=i+Math.imul(b,W)|0,n=(n=n+Math.imul(b,Y)|0)+Math.imul(v,W)|0,s=s+Math.imul(v,Y)|0,i=i+Math.imul(p,Z)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(g,Z)|0,s=s+Math.imul(g,tt)|0;var _t=(h+(i=i+Math.imul(f,rt)|0)|0)+((8191&(n=(n=n+Math.imul(f,it)|0)+Math.imul(d,rt)|0))<<13)|0;h=((s=s+Math.imul(d,it)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(R,j),n=(n=Math.imul(R,F))+Math.imul(N,j)|0,s=Math.imul(N,F),i=i+Math.imul(S,K)|0,n=(n=n+Math.imul(S,$)|0)+Math.imul(P,K)|0,s=s+Math.imul(P,$)|0,i=i+Math.imul(M,J)|0,n=(n=n+Math.imul(M,G)|0)+Math.imul(E,J)|0,s=s+Math.imul(E,G)|0,i=i+Math.imul(w,W)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul(_,W)|0,s=s+Math.imul(_,Y)|0,i=i+Math.imul(b,Z)|0,n=(n=n+Math.imul(b,tt)|0)+Math.imul(v,Z)|0,s=s+Math.imul(v,tt)|0,i=i+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(g,rt)|0,s=s+Math.imul(g,it)|0;var At=(h+(i=i+Math.imul(f,st)|0)|0)+((8191&(n=(n=n+Math.imul(f,ot)|0)+Math.imul(d,st)|0))<<13)|0;h=((s=s+Math.imul(d,ot)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(C,j),n=(n=Math.imul(C,F))+Math.imul(T,j)|0,s=Math.imul(T,F),i=i+Math.imul(R,K)|0,n=(n=n+Math.imul(R,$)|0)+Math.imul(N,K)|0,s=s+Math.imul(N,$)|0,i=i+Math.imul(S,J)|0,n=(n=n+Math.imul(S,G)|0)+Math.imul(P,J)|0,s=s+Math.imul(P,G)|0,i=i+Math.imul(M,W)|0,n=(n=n+Math.imul(M,Y)|0)+Math.imul(E,W)|0,s=s+Math.imul(E,Y)|0,i=i+Math.imul(w,Z)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,Z)|0,s=s+Math.imul(_,tt)|0,i=i+Math.imul(b,rt)|0,n=(n=n+Math.imul(b,it)|0)+Math.imul(v,rt)|0,s=s+Math.imul(v,it)|0,i=i+Math.imul(p,st)|0,n=(n=n+Math.imul(p,ot)|0)+Math.imul(g,st)|0,s=s+Math.imul(g,ot)|0;var Mt=(h+(i=i+Math.imul(f,ct)|0)|0)+((8191&(n=(n=n+Math.imul(f,ht)|0)+Math.imul(d,ct)|0))<<13)|0;h=((s=s+Math.imul(d,ht)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(k,j),n=(n=Math.imul(k,F))+Math.imul(D,j)|0,s=Math.imul(D,F),i=i+Math.imul(C,K)|0,n=(n=n+Math.imul(C,$)|0)+Math.imul(T,K)|0,s=s+Math.imul(T,$)|0,i=i+Math.imul(R,J)|0,n=(n=n+Math.imul(R,G)|0)+Math.imul(N,J)|0,s=s+Math.imul(N,G)|0,i=i+Math.imul(S,W)|0,n=(n=n+Math.imul(S,Y)|0)+Math.imul(P,W)|0,s=s+Math.imul(P,Y)|0,i=i+Math.imul(M,Z)|0,n=(n=n+Math.imul(M,tt)|0)+Math.imul(E,Z)|0,s=s+Math.imul(E,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,rt)|0,s=s+Math.imul(_,it)|0,i=i+Math.imul(b,st)|0,n=(n=n+Math.imul(b,ot)|0)+Math.imul(v,st)|0,s=s+Math.imul(v,ot)|0,i=i+Math.imul(p,ct)|0,n=(n=n+Math.imul(p,ht)|0)+Math.imul(g,ct)|0,s=s+Math.imul(g,ht)|0;var Et=(h+(i=i+Math.imul(f,ft)|0)|0)+((8191&(n=(n=n+Math.imul(f,dt)|0)+Math.imul(d,ft)|0))<<13)|0;h=((s=s+Math.imul(d,dt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(B,j),n=(n=Math.imul(B,F))+Math.imul(L,j)|0,s=Math.imul(L,F),i=i+Math.imul(k,K)|0,n=(n=n+Math.imul(k,$)|0)+Math.imul(D,K)|0,s=s+Math.imul(D,$)|0,i=i+Math.imul(C,J)|0,n=(n=n+Math.imul(C,G)|0)+Math.imul(T,J)|0,s=s+Math.imul(T,G)|0,i=i+Math.imul(R,W)|0,n=(n=n+Math.imul(R,Y)|0)+Math.imul(N,W)|0,s=s+Math.imul(N,Y)|0,i=i+Math.imul(S,Z)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(P,Z)|0,s=s+Math.imul(P,tt)|0,i=i+Math.imul(M,rt)|0,n=(n=n+Math.imul(M,it)|0)+Math.imul(E,rt)|0,s=s+Math.imul(E,it)|0,i=i+Math.imul(w,st)|0,n=(n=n+Math.imul(w,ot)|0)+Math.imul(_,st)|0,s=s+Math.imul(_,ot)|0,i=i+Math.imul(b,ct)|0,n=(n=n+Math.imul(b,ht)|0)+Math.imul(v,ct)|0,s=s+Math.imul(v,ht)|0,i=i+Math.imul(p,ft)|0,n=(n=n+Math.imul(p,dt)|0)+Math.imul(g,ft)|0,s=s+Math.imul(g,dt)|0;var It=(h+(i=i+Math.imul(f,pt)|0)|0)+((8191&(n=(n=n+Math.imul(f,gt)|0)+Math.imul(d,pt)|0))<<13)|0;h=((s=s+Math.imul(d,gt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(B,K),n=(n=Math.imul(B,$))+Math.imul(L,K)|0,s=Math.imul(L,$),i=i+Math.imul(k,J)|0,n=(n=n+Math.imul(k,G)|0)+Math.imul(D,J)|0,s=s+Math.imul(D,G)|0,i=i+Math.imul(C,W)|0,n=(n=n+Math.imul(C,Y)|0)+Math.imul(T,W)|0,s=s+Math.imul(T,Y)|0,i=i+Math.imul(R,Z)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(N,Z)|0,s=s+Math.imul(N,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul(P,rt)|0,s=s+Math.imul(P,it)|0,i=i+Math.imul(M,st)|0,n=(n=n+Math.imul(M,ot)|0)+Math.imul(E,st)|0,s=s+Math.imul(E,ot)|0,i=i+Math.imul(w,ct)|0,n=(n=n+Math.imul(w,ht)|0)+Math.imul(_,ct)|0,s=s+Math.imul(_,ht)|0,i=i+Math.imul(b,ft)|0,n=(n=n+Math.imul(b,dt)|0)+Math.imul(v,ft)|0,s=s+Math.imul(v,dt)|0;var St=(h+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,gt)|0)+Math.imul(g,pt)|0))<<13)|0;h=((s=s+Math.imul(g,gt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(B,J),n=(n=Math.imul(B,G))+Math.imul(L,J)|0,s=Math.imul(L,G),i=i+Math.imul(k,W)|0,n=(n=n+Math.imul(k,Y)|0)+Math.imul(D,W)|0,s=s+Math.imul(D,Y)|0,i=i+Math.imul(C,Z)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(T,Z)|0,s=s+Math.imul(T,tt)|0,i=i+Math.imul(R,rt)|0,n=(n=n+Math.imul(R,it)|0)+Math.imul(N,rt)|0,s=s+Math.imul(N,it)|0,i=i+Math.imul(S,st)|0,n=(n=n+Math.imul(S,ot)|0)+Math.imul(P,st)|0,s=s+Math.imul(P,ot)|0,i=i+Math.imul(M,ct)|0,n=(n=n+Math.imul(M,ht)|0)+Math.imul(E,ct)|0,s=s+Math.imul(E,ht)|0,i=i+Math.imul(w,ft)|0,n=(n=n+Math.imul(w,dt)|0)+Math.imul(_,ft)|0,s=s+Math.imul(_,dt)|0;var Pt=(h+(i=i+Math.imul(b,pt)|0)|0)+((8191&(n=(n=n+Math.imul(b,gt)|0)+Math.imul(v,pt)|0))<<13)|0;h=((s=s+Math.imul(v,gt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(B,W),n=(n=Math.imul(B,Y))+Math.imul(L,W)|0,s=Math.imul(L,Y),i=i+Math.imul(k,Z)|0,n=(n=n+Math.imul(k,tt)|0)+Math.imul(D,Z)|0,s=s+Math.imul(D,tt)|0,i=i+Math.imul(C,rt)|0,n=(n=n+Math.imul(C,it)|0)+Math.imul(T,rt)|0,s=s+Math.imul(T,it)|0,i=i+Math.imul(R,st)|0,n=(n=n+Math.imul(R,ot)|0)+Math.imul(N,st)|0,s=s+Math.imul(N,ot)|0,i=i+Math.imul(S,ct)|0,n=(n=n+Math.imul(S,ht)|0)+Math.imul(P,ct)|0,s=s+Math.imul(P,ht)|0,i=i+Math.imul(M,ft)|0,n=(n=n+Math.imul(M,dt)|0)+Math.imul(E,ft)|0,s=s+Math.imul(E,dt)|0;var xt=(h+(i=i+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,gt)|0)+Math.imul(_,pt)|0))<<13)|0;h=((s=s+Math.imul(_,gt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(B,Z),n=(n=Math.imul(B,tt))+Math.imul(L,Z)|0,s=Math.imul(L,tt),i=i+Math.imul(k,rt)|0,n=(n=n+Math.imul(k,it)|0)+Math.imul(D,rt)|0,s=s+Math.imul(D,it)|0,i=i+Math.imul(C,st)|0,n=(n=n+Math.imul(C,ot)|0)+Math.imul(T,st)|0,s=s+Math.imul(T,ot)|0,i=i+Math.imul(R,ct)|0,n=(n=n+Math.imul(R,ht)|0)+Math.imul(N,ct)|0,s=s+Math.imul(N,ht)|0,i=i+Math.imul(S,ft)|0,n=(n=n+Math.imul(S,dt)|0)+Math.imul(P,ft)|0,s=s+Math.imul(P,dt)|0;var Rt=(h+(i=i+Math.imul(M,pt)|0)|0)+((8191&(n=(n=n+Math.imul(M,gt)|0)+Math.imul(E,pt)|0))<<13)|0;h=((s=s+Math.imul(E,gt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(B,rt),n=(n=Math.imul(B,it))+Math.imul(L,rt)|0,s=Math.imul(L,it),i=i+Math.imul(k,st)|0,n=(n=n+Math.imul(k,ot)|0)+Math.imul(D,st)|0,s=s+Math.imul(D,ot)|0,i=i+Math.imul(C,ct)|0,n=(n=n+Math.imul(C,ht)|0)+Math.imul(T,ct)|0,s=s+Math.imul(T,ht)|0,i=i+Math.imul(R,ft)|0,n=(n=n+Math.imul(R,dt)|0)+Math.imul(N,ft)|0,s=s+Math.imul(N,dt)|0;var Nt=(h+(i=i+Math.imul(S,pt)|0)|0)+((8191&(n=(n=n+Math.imul(S,gt)|0)+Math.imul(P,pt)|0))<<13)|0;h=((s=s+Math.imul(P,gt)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,i=Math.imul(B,st),n=(n=Math.imul(B,ot))+Math.imul(L,st)|0,s=Math.imul(L,ot),i=i+Math.imul(k,ct)|0,n=(n=n+Math.imul(k,ht)|0)+Math.imul(D,ct)|0,s=s+Math.imul(D,ht)|0,i=i+Math.imul(C,ft)|0,n=(n=n+Math.imul(C,dt)|0)+Math.imul(T,ft)|0,s=s+Math.imul(T,dt)|0;var Ot=(h+(i=i+Math.imul(R,pt)|0)|0)+((8191&(n=(n=n+Math.imul(R,gt)|0)+Math.imul(N,pt)|0))<<13)|0;h=((s=s+Math.imul(N,gt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,i=Math.imul(B,ct),n=(n=Math.imul(B,ht))+Math.imul(L,ct)|0,s=Math.imul(L,ht),i=i+Math.imul(k,ft)|0,n=(n=n+Math.imul(k,dt)|0)+Math.imul(D,ft)|0,s=s+Math.imul(D,dt)|0;var Ct=(h+(i=i+Math.imul(C,pt)|0)|0)+((8191&(n=(n=n+Math.imul(C,gt)|0)+Math.imul(T,pt)|0))<<13)|0;h=((s=s+Math.imul(T,gt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(B,ft),n=(n=Math.imul(B,dt))+Math.imul(L,ft)|0,s=Math.imul(L,dt);var Tt=(h+(i=i+Math.imul(k,pt)|0)|0)+((8191&(n=(n=n+Math.imul(k,gt)|0)+Math.imul(D,pt)|0))<<13)|0;h=((s=s+Math.imul(D,gt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863;var qt=(h+(i=Math.imul(B,pt))|0)+((8191&(n=(n=Math.imul(B,gt))+Math.imul(L,pt)|0))<<13)|0;return h=((s=Math.imul(L,gt))+(n>>>13)|0)+(qt>>>26)|0,qt&=67108863,c[0]=mt,c[1]=bt,c[2]=vt,c[3]=yt,c[4]=wt,c[5]=_t,c[6]=At,c[7]=Mt,c[8]=Et,c[9]=It,c[10]=St,c[11]=Pt,c[12]=xt,c[13]=Rt,c[14]=Nt,c[15]=Ot,c[16]=Ct,c[17]=Tt,c[18]=qt,0!==h&&(c[19]=h,r.length++),r};function m(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,s=0;s<r.length-1;s++){var o=n;n=0;for(var a=67108863&i,c=Math.min(s,e.length-1),h=Math.max(0,s-t.length+1);h<=c;h++){var u=s-h,f=(0|t.words[u])*(0|e.words[h]),d=67108863&f;a=67108863&(d=d+a|0),n+=(o=(o=o+(f/67108864|0)|0)+(d>>>26)|0)>>>26,o&=67108863}r.words[s]=a,i=o,o=n}return 0!==i?r.words[s]=i:r.length--,r._strip()}function b(t,e,r){return m(t,e,r)}Math.imul||(g=p),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?g(this,t,e):r<63?p(this,t,e):r<1024?m(this,t,e):b(this,t,e)},n.prototype.mul=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},n.prototype.mulf=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),b(this,t,e)},n.prototype.imul=function(t){return this.clone().mulTo(t,this)},n.prototype.imuln=function(t){var e=t<0;e&&(t=-t),r("number"==typeof t),r(t<67108864);for(var i=0,n=0;n<this.length;n++){var s=(0|this.words[n])*t,o=(67108863&s)+(67108863&i);i>>=26,i+=s/67108864|0,i+=o>>>26,this.words[n]=67108863&o}return 0!==i&&(this.words[n]=i,this.length++),e?this.ineg():this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var i=r/26|0,n=r%26;e[r]=t.words[i]>>>n&1}return e}(t);if(0===e.length)return new n(1);for(var r=this,i=0;i<e.length&&0===e[i];i++,r=r.sqr());if(++i<e.length)for(var s=r.sqr();i<e.length;i++,s=s.sqr())0!==e[i]&&(r=r.mul(s));return r},n.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,i=t%26,n=(t-i)/26,s=67108863>>>26-i<<26-i;if(0!==i){var o=0;for(e=0;e<this.length;e++){var a=this.words[e]&s,c=(0|this.words[e])-a<<i;this.words[e]=c|o,o=a>>>26-i}o&&(this.words[e]=o,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e<n;e++)this.words[e]=0;this.length+=n}return this._strip()},n.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},n.prototype.iushrn=function(t,e,i){var n;r("number"==typeof t&&t>=0),n=e?(e-e%26)/26:0;var s=t%26,o=Math.min((t-s)/26,this.length),a=67108863^67108863>>>s<<s,c=i;if(n-=o,n=Math.max(0,n),c){for(var h=0;h<o;h++)c.words[h]=this.words[h];c.length=o}if(0!==o)if(this.length>o)for(this.length-=o,h=0;h<this.length;h++)this.words[h]=this.words[h+o];else this.words[0]=0,this.length=1;var u=0;for(h=this.length-1;h>=0&&(0!==u||h>=n);h--){var f=0|this.words[h];this.words[h]=u<<26-s|f>>>s,u=f&a}return c&&0!==u&&(c.words[c.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},n.prototype.ishrn=function(t,e,i){return r(0===this.negative),this.iushrn(t,e,i)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26,n=1<<e;return!(this.length<=i||!(this.words[i]&n))},n.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==e&&i++,this.length=Math.min(i,this.length),0!==e){var n=67108863^67108863>>>e<<e;this.words[this.length-1]&=n}return this._strip()},n.prototype.maskn=function(t){return this.clone().imaskn(t)},n.prototype.iaddn=function(t){return r("number"==typeof t),r(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<=t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},n.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},n.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this._strip()},n.prototype.addn=function(t){return this.clone().iaddn(t)},n.prototype.subn=function(t){return this.clone().isubn(t)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(t,e,i){var n,s=t.length+i;this._expand(s);var o,a=0;for(n=0;n<t.length;n++){o=(0|this.words[n+i])+a;var c=(0|t.words[n])*e;a=((o-=67108863&c)>>26)-(c/67108864|0),this.words[n+i]=67108863&o}for(;n<this.length-i;n++)a=(o=(0|this.words[n+i])+a)>>26,this.words[n+i]=67108863&o;if(0===a)return this._strip();for(r(-1===a),a=0,n=0;n<this.length;n++)a=(o=-(0|this.words[n])+a)>>26,this.words[n]=67108863&o;return this.negative=1,this._strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),s=t,o=0|s.words[s.length-1];0!=(r=26-this._countBits(o))&&(s=s.ushln(r),i.iushln(r),o=0|s.words[s.length-1]);var a,c=i.length-s.length;if("mod"!==e){(a=new n(null)).length=c+1,a.words=new Array(a.length);for(var h=0;h<a.length;h++)a.words[h]=0}var u=i.clone()._ishlnsubmul(s,1,c);0===u.negative&&(i=u,a&&(a.words[c]=1));for(var f=c-1;f>=0;f--){var d=67108864*(0|i.words[s.length+f])+(0|i.words[s.length+f-1]);for(d=Math.min(d/o|0,67108863),i._ishlnsubmul(s,d,f);0!==i.negative;)d--,i.negative=0,i._ishlnsubmul(s,1,f),i.isZero()||(i.negative^=1);a&&(a.words[f]=d)}return a&&a._strip(),i._strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},n.prototype.divmod=function(t,e,i){return r(!t.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(s=a.div.neg()),"div"!==e&&(o=a.mod.neg(),i&&0!==o.negative&&o.iadd(t)),{div:s,mod:o}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(s=a.div.neg()),{div:s,mod:a.mod}):this.negative&t.negative?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(o=a.mod.neg(),i&&0!==o.negative&&o.isub(t)),{div:a.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modrn(t.words[0]))}:this._wordDiv(t,e);var s,o,a},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),s=r.cmp(i);return s<0||1===n&&0===s?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modrn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=(1<<26)%t,n=0,s=this.length-1;s>=0;s--)n=(i*n+(0|this.words[s]))%t;return e?-n:n},n.prototype.modn=function(t){return this.modrn(t)},n.prototype.idivn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=0,n=this.length-1;n>=0;n--){var s=(0|this.words[n])+67108864*i;this.words[n]=s/t|0,i=s%t}return this._strip(),e?this.ineg():this},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var s=new n(1),o=new n(0),a=new n(0),c=new n(1),h=0;e.isEven()&&i.isEven();)e.iushrn(1),i.iushrn(1),++h;for(var u=i.clone(),f=e.clone();!e.isZero();){for(var d=0,l=1;!(e.words[0]&l)&&d<26;++d,l<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(s.isOdd()||o.isOdd())&&(s.iadd(u),o.isub(f)),s.iushrn(1),o.iushrn(1);for(var p=0,g=1;!(i.words[0]&g)&&p<26;++p,g<<=1);if(p>0)for(i.iushrn(p);p-- >0;)(a.isOdd()||c.isOdd())&&(a.iadd(u),c.isub(f)),a.iushrn(1),c.iushrn(1);e.cmp(i)>=0?(e.isub(i),s.isub(a),o.isub(c)):(i.isub(e),a.isub(s),c.isub(o))}return{a,b:c,gcd:i.iushln(h)}},n.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e,i=this,s=t.clone();i=0!==i.negative?i.umod(t):i.clone();for(var o=new n(1),a=new n(0),c=s.clone();i.cmpn(1)>0&&s.cmpn(1)>0;){for(var h=0,u=1;!(i.words[0]&u)&&h<26;++h,u<<=1);if(h>0)for(i.iushrn(h);h-- >0;)o.isOdd()&&o.iadd(c),o.iushrn(1);for(var f=0,d=1;!(s.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(s.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);i.cmp(s)>=0?(i.isub(s),o.isub(a)):(s.isub(i),a.isub(o))}return(e=0===i.cmpn(1)?o:a).cmpn(0)<0&&e.iadd(t),e},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var s=e;e=r,r=s}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return!(1&this.words[0])},n.prototype.isOdd=function(){return!(1&~this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,i=(t-e)/26,n=1<<e;if(this.length<=i)return this._expand(i+1),this.words[i]|=n,this;for(var s=n,o=i;0!==s&&o<this.length;o++){var a=0|this.words[o];s=(a+=s)>>>26,a&=67108863,this.words[o]=a}return 0!==s&&(this.words[o]=s,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var e,i=t<0;if(0!==this.negative&&!i)return-1;if(0===this.negative&&i)return 1;if(this._strip(),this.length>1)e=1;else{i&&(t=-t),r(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:n<t?-1:1}return 0!==this.negative?0|-e:e},n.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},n.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){i<n?e=-1:i>n&&(e=1);break}}return e},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new E(t)},n.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},n.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},n.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},n.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},n.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},n.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},n.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function y(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function A(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function M(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function I(t){E.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(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)}y.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},y.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},y.prototype.split=function(t,e){t.iushrn(this.n,0,e)},y.prototype.imulK=function(t){return t.imul(this.k)},i(w,y),w.prototype.split=function(t,e){for(var r=4194303,i=Math.min(t.length,9),n=0;n<i;n++)e.words[n]=t.words[n];if(e.length=i,t.length<=9)return t.words[0]=0,void(t.length=1);var s=t.words[9];for(e.words[e.length++]=s&r,n=10;n<t.length;n++){var o=0|t.words[n];t.words[n-10]=(o&r)<<4|s>>>22,s=o}s>>>=22,t.words[n-10]=s,0===s&&t.length>10?t.length-=10:t.length-=9},w.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var i=0|t.words[r];e+=977*i,t.words[r]=67108863&e,e=64*i+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(_,y),i(A,y),i(M,y),M.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var i=19*(0|t.words[r])+e,n=67108863&i;i>>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},n._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new w;else if("p224"===t)e=new _;else if("p192"===t)e=new A;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new M}return v[t]=e,e},E.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},E.prototype._verify2=function(t,e){r(0===(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},E.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(h(t,t.umod(this.m)._forceRed(this)),t)},E.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},E.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},E.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},E.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},E.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},E.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},E.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},E.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},E.prototype.isqr=function(t){return this.imul(t,t.clone())},E.prototype.sqr=function(t){return this.mul(t,t)},E.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var i=this.m.add(new n(1)).iushrn(2);return this.pow(t,i)}for(var s=this.m.subn(1),o=0;!s.isZero()&&0===s.andln(1);)o++,s.iushrn(1);r(!s.isZero());var a=new n(1).toRed(this),c=a.redNeg(),h=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new n(2*u*u).toRed(this);0!==this.pow(u,h).cmp(c);)u.redIAdd(c);for(var f=this.pow(u,s),d=this.pow(t,s.addn(1).iushrn(1)),l=this.pow(t,s),p=o;0!==l.cmp(a);){for(var g=l,m=0;0!==g.cmp(a);m++)g=g.redSqr();r(m<p);var b=this.pow(f,new n(1).iushln(p-m-1));d=d.redMul(b),f=b.redSqr(),l=l.redMul(f),p=m}return d},E.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},E.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],t);var s=r[0],o=0,a=0,c=e.bitLength()%26;for(0===c&&(c=26),i=e.length-1;i>=0;i--){for(var h=e.words[i],u=c-1;u>=0;u--){var f=h>>u&1;s!==r[0]&&(s=this.sqr(s)),0!==f||0!==o?(o<<=1,o|=f,(4===++a||0===i&&0===u)&&(s=this.mul(s,r[o]),a=0,o=0)):a=0}c=26}return s},E.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},E.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new I(t)},i(I,E),I.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},I.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},I.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),s=n;return n.cmp(this.m)>=0?s=n.isub(this.m):n.cmpn(0)<0&&(s=n.iadd(this.m)),s._forceRed(this)},I.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),s=r.isub(i).iushrn(this.shift),o=s;return s.cmp(this.m)>=0?o=s.isub(this.m):s.cmpn(0)<0&&(o=s.iadd(this.m)),o._forceRed(this)},I.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,ft)}(Ut);var Lt=Ut.exports;const zt="bignumber/5.7.0";var jt=Lt.BN;const Ft=new Mt(zt),Ht={},Kt=9007199254740991;let $t=!1;class Vt{constructor(t,e){t!==Ht&&Ft.throwError("cannot call constructor directly; use BigNumber.from",Mt.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return Gt(Qt(this).fromTwos(t))}toTwos(t){return Gt(Qt(this).toTwos(t))}abs(){return"-"===this._hex[0]?Vt.from(this._hex.substring(1)):this}add(t){return Gt(Qt(this).add(Qt(t)))}sub(t){return Gt(Qt(this).sub(Qt(t)))}div(t){return Vt.from(t).isZero()&&Wt("division-by-zero","div"),Gt(Qt(this).div(Qt(t)))}mul(t){return Gt(Qt(this).mul(Qt(t)))}mod(t){const e=Qt(t);return e.isNeg()&&Wt("division-by-zero","mod"),Gt(Qt(this).umod(e))}pow(t){const e=Qt(t);return e.isNeg()&&Wt("negative-power","pow"),Gt(Qt(this).pow(e))}and(t){const e=Qt(t);return(this.isNegative()||e.isNeg())&&Wt("unbound-bitwise-result","and"),Gt(Qt(this).and(e))}or(t){const e=Qt(t);return(this.isNegative()||e.isNeg())&&Wt("unbound-bitwise-result","or"),Gt(Qt(this).or(e))}xor(t){const e=Qt(t);return(this.isNegative()||e.isNeg())&&Wt("unbound-bitwise-result","xor"),Gt(Qt(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&Wt("negative-width","mask"),Gt(Qt(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&Wt("negative-width","shl"),Gt(Qt(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&Wt("negative-width","shr"),Gt(Qt(this).shrn(t))}eq(t){return Qt(this).eq(Qt(t))}lt(t){return Qt(this).lt(Qt(t))}lte(t){return Qt(this).lte(Qt(t))}gt(t){return Qt(this).gt(Qt(t))}gte(t){return Qt(this).gte(Qt(t))}isNegative(){return"-"===this._hex[0]}isZero(){return Qt(this).isZero()}toNumber(){try{return Qt(this).toNumber()}catch{Wt("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return Ft.throwError("this platform does not support BigInt",Mt.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?$t||($t=!0,Ft.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?Ft.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",Mt.errors.UNEXPECTED_ARGUMENT,{}):Ft.throwError("BigNumber.toString does not accept parameters",Mt.errors.UNEXPECTED_ARGUMENT,{})),Qt(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof Vt)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new Vt(Ht,Jt(t)):t.match(/^-?[0-9]+$/)?new Vt(Ht,Jt(new jt(t))):Ft.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&Wt("underflow","BigNumber.from",t),(t>=Kt||t<=-Kt)&&Wt("overflow","BigNumber.from",t),Vt.from(String(t));const e=t;if("bigint"==typeof e)return Vt.from(e.toString());if(xt(e))return Vt.from(Ct(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return Vt.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(Nt(t)||"-"===t[0]&&Nt(t.substring(1))))return Vt.from(t)}return Ft.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function Jt(t){if("string"!=typeof t)return Jt(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&Ft.throwArgumentError("invalid hex","value",t),"0x00"===(t=Jt(t))?t:"-"+t;if("0x"!==t.substring(0,2)&&(t="0x"+t),"0x"===t)return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&"0x00"===t.substring(0,4);)t="0x"+t.substring(4);return t}function Gt(t){return Vt.from(Jt(t))}function Qt(t){const e=Vt.from(t).toHexString();return"-"===e[0]?new jt("-"+e.substring(3),16):new jt(e.substring(2),16)}function Wt(t,e,r){const i={fault:t,operation:e};return null!=r&&(i.value=r),Ft.throwError(t,Mt.errors.NUMERIC_FAULT,i)}const Yt=new Mt(zt),Xt={},Zt=Vt.from(0),te=Vt.from(-1);function ee(t,e,r,i){const n={fault:e,operation:r};return void 0!==i&&(n.value=i),Yt.throwError(t,Mt.errors.NUMERIC_FAULT,n)}let re="0";for(;re.length<256;)re+=re;function ie(t){if("number"!=typeof t)try{t=Vt.from(t).toNumber()}catch{}return"number"==typeof t&&t>=0&&t<=256&&!(t%1)?"1"+re.substring(0,t):Yt.throwArgumentError("invalid decimal size","decimals",t)}function ne(t,e){null==e&&(e=0);const r=ie(e),i=(t=Vt.from(t)).lt(Zt);i&&(t=t.mul(te));let n=t.mod(r).toString();for(;n.length<r.length-1;)n="0"+n;n=n.match(/^([0-9]*[1-9]|0)(0*)/)[1];const s=t.div(r).toString();return t=1===r.length?s:s+"."+n,i&&(t="-"+t),t}function se(t,e){null==e&&(e=0);const r=ie(e);("string"!=typeof t||!t.match(/^-?[0-9.]+$/))&&Yt.throwArgumentError("invalid decimal value","value",t);const i="-"===t.substring(0,1);i&&(t=t.substring(1)),"."===t&&Yt.throwArgumentError("missing value","value",t);const n=t.split(".");n.length>2&&Yt.throwArgumentError("too many decimal points","value",t);let s=n[0],o=n[1];for(s||(s="0"),o||(o="0");"0"===o[o.length-1];)o=o.substring(0,o.length-1);for(o.length>r.length-1&&ee("fractional component exceeds decimals","underflow","parseFixed"),""===o&&(o="0");o.length<r.length-1;)o+="0";const a=Vt.from(s),c=Vt.from(o);let h=a.mul(r).add(c);return i&&(h=h.mul(te)),h}class oe{constructor(t,e,r,i){t!==Xt&&Yt.throwError("cannot use FixedFormat constructor; use FixedFormat.from",Mt.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=e,this.width=r,this.decimals=i,this.name=(e?"":"u")+"fixed"+String(r)+"x"+String(i),this._multiplier=ie(i),Object.freeze(this)}static from(t){if(t instanceof oe)return t;"number"==typeof t&&(t=`fixed128x${t}`);let e=!0,r=128,i=18;if("string"==typeof t){if("fixed"!==t)if("ufixed"===t)e=!1;else{const n=t.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);n||Yt.throwArgumentError("invalid fixed format","format",t),e="u"!==n[1],r=parseInt(n[2]),i=parseInt(n[3])}}else if(t){const n=(e,r,i)=>null==t[e]?i:(typeof t[e]!==r&&Yt.throwArgumentError("invalid fixed format ("+e+" not "+r+")","format."+e,t[e]),t[e]);e=n("signed","boolean",e),r=n("width","number",r),i=n("decimals","number",i)}return r%8&&Yt.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",r),i>80&&Yt.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",i),new oe(Xt,e,r,i)}}class ae{constructor(t,e,r,i){t!==Xt&&Yt.throwError("cannot use FixedNumber constructor; use FixedNumber.from",Mt.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=i,this._hex=e,this._value=r,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(t){this.format.name!==t.format.name&&Yt.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",t)}addUnsafe(t){this._checkFormat(t);const e=se(this._value,this.format.decimals),r=se(t._value,t.format.decimals);return ae.fromValue(e.add(r),this.format.decimals,this.format)}subUnsafe(t){this._checkFormat(t);const e=se(this._value,this.format.decimals),r=se(t._value,t.format.decimals);return ae.fromValue(e.sub(r),this.format.decimals,this.format)}mulUnsafe(t){this._checkFormat(t);const e=se(this._value,this.format.decimals),r=se(t._value,t.format.decimals);return ae.fromValue(e.mul(r).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(t){this._checkFormat(t);const e=se(this._value,this.format.decimals),r=se(t._value,t.format.decimals);return ae.fromValue(e.mul(this.format._multiplier).div(r),this.format.decimals,this.format)}floor(){const t=this.toString().split(".");1===t.length&&t.push("0");let e=ae.from(t[0],this.format);const r=!t[1].match(/^(0*)$/);return this.isNegative()&&r&&(e=e.subUnsafe(ce.toFormat(e.format))),e}ceiling(){const t=this.toString().split(".");1===t.length&&t.push("0");let e=ae.from(t[0],this.format);const r=!t[1].match(/^(0*)$/);return!this.isNegative()&&r&&(e=e.addUnsafe(ce.toFormat(e.format))),e}round(t){null==t&&(t=0);const e=this.toString().split(".");if(1===e.length&&e.push("0"),(t<0||t>80||t%1)&&Yt.throwArgumentError("invalid decimal count","decimals",t),e[1].length<=t)return this;const r=ae.from("1"+re.substring(0,t),this.format),i=he.toFormat(this.format);return this.mulUnsafe(r).addUnsafe(i).floor().divUnsafe(r)}isZero(){return"0.0"===this._value||"0"===this._value}isNegative(){return"-"===this._value[0]}toString(){return this._value}toHexString(t){return null==t?this._hex:(t%8&&Yt.throwArgumentError("invalid byte width","width",t),qt(Vt.from(this._hex).fromTwos(this.format.width).toTwos(t).toHexString(),t/8))}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(t){return ae.fromString(this._value,t)}static fromValue(t,e,r){return null==r&&null!=e&&!function(t){return null!=t&&(Vt.isBigNumber(t)||"number"==typeof t&&t%1==0||"string"==typeof t&&!!t.match(/^-?[0-9]+$/)||Nt(t)||"bigint"==typeof t||xt(t))}(e)&&(r=e,e=null),null==e&&(e=0),null==r&&(r="fixed"),ae.fromString(ne(t,e),oe.from(r))}static fromString(t,e){null==e&&(e="fixed");const r=oe.from(e),i=se(t,r.decimals);!r.signed&&i.lt(Zt)&&ee("unsigned value cannot be negative","overflow","value",t);let n=null;r.signed?n=i.toTwos(r.width).toHexString():(n=i.toHexString(),n=qt(n,r.width/8));const s=ne(i,r.decimals);return new ae(Xt,n,s,r)}static fromBytes(t,e){null==e&&(e="fixed");const r=oe.from(e);if(Rt(t).length>r.width/8)throw new Error("overflow");let i=Vt.from(t);r.signed&&(i=i.fromTwos(r.width));const n=i.toTwos((r.signed?0:1)+r.width).toHexString(),s=ne(i,r.decimals);return new ae(Xt,n,s,r)}static from(t,e){if("string"==typeof t)return ae.fromString(t,e);if(xt(t))return ae.fromBytes(t,e);try{return ae.fromValue(t,0,e)}catch(t){if(t.code!==Mt.errors.INVALID_ARGUMENT)throw t}return Yt.throwArgumentError("invalid FixedNumber value","value",t)}static isFixedNumber(t){return!(!t||!t._isFixedNumber)}}const ce=ae.from(1),he=ae.from("0.5"),ue=new Mt("strings/5.7.0");var fe,de;function le(t,e,r,i,n){if(t===de.BAD_PREFIX||t===de.UNEXPECTED_CONTINUE){let t=0;for(let i=e+1;i<r.length&&r[i]>>6==2;i++)t++;return t}return t===de.OVERRUN?r.length-e-1:0}function pe(t,e=fe.current){e!=fe.current&&(ue.checkNormalize(),t=t.normalize(e));let r=[];for(let e=0;e<t.length;e++){const i=t.charCodeAt(e);if(i<128)r.push(i);else if(i<2048)r.push(i>>6|192),r.push(63&i|128);else if(55296==(64512&i)){e++;const n=t.charCodeAt(e);if(e>=t.length||56320!=(64512&n))throw new Error("invalid utf-8 string");const s=65536+((1023&i)<<10)+(1023&n);r.push(s>>18|240),r.push(s>>12&63|128),r.push(s>>6&63|128),r.push(63&s|128)}else r.push(i>>12|224),r.push(i>>6&63|128),r.push(63&i|128)}return Rt(r)}function ge(t,e){e||(e=function(t){return[parseInt(t,16)]});let r=0,i={};return t.split(",").forEach((t=>{let n=t.split(":");r+=parseInt(n[0],16),i[r]=e(n[1])})),i}function me(t){let e=0;return t.split(",").map((t=>{let r=t.split("-");1===r.length?r[1]="0":""===r[1]&&(r[1]="1");let i=e+parseInt(r[0],16);return e=parseInt(r[1],16),{l:i,h:e}}))}!function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"}(fe||(fe={})),function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"}(de||(de={})),Object.freeze({error:function(t,e,r,i,n){return ue.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",r)},ignore:le,replace:function(t,e,r,i,n){return t===de.OVERLONG?(i.push(n),0):(i.push(65533),le(t,e,r))}}),me("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"),"ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map((t=>parseInt(t,16))),ge("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"),ge("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"),ge("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",(function(t){if(t.length%4!=0)throw new Error("bad data");let e=[];for(let r=0;r<t.length;r+=4)e.push(parseInt(t.substring(r,r+4),16));return e})),me("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");const be="hash/5.7.0";function ve(t,e){null==e&&(e=1);const r=[],i=r.forEach,n=function(t,e){i.call(t,(function(t){e>0&&Array.isArray(t)?n(t,e-1):r.push(t)}))};return n(t,e),r}function ye(t){return 1&t?~t>>1:t>>1}function we(t,e){let r=Array(t);for(let i=0,n=-1;i<t;i++)r[i]=n+=1+e();return r}function _e(t,e){let r=Array(t);for(let i=0,n=0;i<t;i++)r[i]=n+=ye(e());return r}function Ae(t,e){let r=we(t(),t),i=t(),n=we(i,t),s=function(t,e){let r=Array(t);for(let i=0;i<t;i++)r[i]=1+e();return r}(i,t);for(let t=0;t<i;t++)for(let e=0;e<s[t];e++)r.push(n[t]+e);return e?r.map((t=>e[t])):r}function Me(t,e,r){let i=Array(t).fill(void 0).map((()=>[]));for(let n=0;n<e;n++)_e(t,r).forEach(((t,e)=>i[e].push(t)));return i}function Ee(t,e){let r=1+e(),i=e(),n=function(t){let e=[];for(;;){let r=t();if(0==r)break;e.push(r)}return e}(e);return ve(Me(n.length,1+t,e).map(((t,e)=>{const s=t[0],o=t.slice(1);return Array(n[e]).fill(void 0).map(((t,e)=>{let n=e*i;return[s+e*r,o.map((t=>t+n))]}))})))}function Ie(t,e){return Me(1+e(),1+t,e).map((t=>[t[0],t.slice(1)]))}const Se=function(t){return function(t){let e=0;return()=>t[e++]}(function(t){let e=0;function r(){return t[e++]<<8|t[e++]}let i=r(),n=1,s=[0,1];for(let t=1;t<i;t++)s.push(n+=r());let o=r(),a=e;e+=o;let c=0,h=0;function u(){return 0==c&&(h=h<<8|t[e++],c=8),h>>--c&1}const f=Math.pow(2,31),d=f>>>1,l=d>>1,p=f-1;let g=0;for(let t=0;t<31;t++)g=g<<1|u();let m=[],b=0,v=f;for(;;){let t=Math.floor(((g-b+1)*n-1)/v),e=0,r=i;for(;r-e>1;){let i=e+r>>>1;t<s[i]?r=i:e=i}if(0==e)break;m.push(e);let o=b+Math.floor(v*s[e]/n),a=b+Math.floor(v*s[e+1]/n)-1;for(;!((o^a)&d);)g=g<<1&p|u(),o=o<<1&p,a=a<<1&p|1;for(;o&~a&l;)g=g&d|g<<1&p>>>1|u(),o=o<<1^d,a=(a^d)<<1|d|1;b=o,v=1+a-o}let y=i-4;return m.map((e=>{switch(e-y){case 3:return y+65792+(t[a++]<<16|t[a++]<<8|t[a++]);case 2:return y+256+(t[a++]<<8|t[a++]);case 1:return y+t[a++];default:return e-1}}))}(t))}(function(t){t=atob(t);const e=[];for(let r=0;r<t.length;r++)e.push(t.charCodeAt(r));return Rt(e)}("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA=="));function Pe(t){return"string"==typeof t&&(t=pe(t)),Dt(function(t){const e=t.map((t=>Rt(t))),r=e.reduce(((t,e)=>t+e.length),0),i=new Uint8Array(r);return e.reduce(((t,e)=>(i.set(e,t),t+e.length)),0),St(i)}([pe("Ethereum Signed Message:\n"),pe(String(t.length)),t]))}new Set(Ae(Se)),new Set(Ae(Se)),function(t){let e=[];for(;;){let r=t();if(0==r)break;e.push(Ee(r,t))}for(;;){let r=t()-1;if(r<0)break;e.push(Ie(r,t))}!function(t){const e={};for(let r=0;r<t.length;r++){const i=t[r];e[i[0]]=i[1]}}(ve(e))}(Se),function(t){let e=Ae(t).sort(((t,e)=>t-e));!function r(){let i=[];for(;;){let n=Ae(t,e);if(0==n.length)break;i.push({set:new Set(n),node:r()})}i.sort(((t,e)=>e.set.size-t.set.size));let n=t(),s=n%3;n=n/3|0;let o=!!(1&n);return n>>=1,{branches:i,valid:s,fe0f:o,save:1==n,check:2==n}}()}(Se),new Mt(be),new Uint8Array(32).fill(0),new Mt("rlp/5.7.0");const xe=new Mt("address/5.7.0");function Re(t){Nt(t,20)||xe.throwArgumentError("invalid address","address",t);const e=(t=t.toLowerCase()).substring(2).split(""),r=new Uint8Array(40);for(let t=0;t<40;t++)r[t]=e[t].charCodeAt(0);const i=Rt(Dt(r));for(let t=0;t<40;t+=2)i[t>>1]>>4>=8&&(e[t]=e[t].toUpperCase()),(15&i[t>>1])>=8&&(e[t+1]=e[t+1].toUpperCase());return"0x"+e.join("")}const Ne={};for(let t=0;t<10;t++)Ne[String(t)]=String(t);for(let t=0;t<26;t++)Ne[String.fromCharCode(65+t)]=String(10+t);const Oe=Math.floor(function(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}(9007199254740991));function Ce(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}new Mt("properties/5.7.0"),new Mt(be),new Uint8Array(32).fill(0),Vt.from(-1);const Te=Vt.from(0),qe=Vt.from(1);Vt.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),qt(qe.toHexString(),32),qt(Te.toHexString(),32);var ke={},De={},Ue=Be;function Be(t,e){if(!t)throw new Error(e||"Assertion failed")}Be.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)};var Le={exports:{}};"function"==typeof Object.create?Le.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:Le.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}};var ze=Ue,je=Le.exports;function Fe(t,e){return!(55296!=(64512&t.charCodeAt(e))||e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1))}function He(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function Ke(t){return 1===t.length?"0"+t:t}function $e(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}De.inherits=je,De.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),n=0;n<t.length;n+=2)r.push(parseInt(t[n]+t[n+1],16))}else for(var i=0,n=0;n<t.length;n++){var s=t.charCodeAt(n);s<128?r[i++]=s:s<2048?(r[i++]=s>>6|192,r[i++]=63&s|128):Fe(t,n)?(s=65536+((1023&s)<<10)+(1023&t.charCodeAt(++n)),r[i++]=s>>18|240,r[i++]=s>>12&63|128,r[i++]=s>>6&63|128,r[i++]=63&s|128):(r[i++]=s>>12|224,r[i++]=s>>6&63|128,r[i++]=63&s|128)}else for(n=0;n<t.length;n++)r[n]=0|t[n];return r},De.toHex=function(t){for(var e="",r=0;r<t.length;r++)e+=Ke(t[r].toString(16));return e},De.htonl=He,De.toHex32=function(t,e){for(var r="",i=0;i<t.length;i++){var n=t[i];"little"===e&&(n=He(n)),r+=$e(n.toString(16))}return r},De.zero2=Ke,De.zero8=$e,De.join32=function(t,e,r,i){var n=r-e;ze(n%4==0);for(var s=new Array(n/4),o=0,a=e;o<s.length;o++,a+=4){var c;c="big"===i?t[a]<<24|t[a+1]<<16|t[a+2]<<8|t[a+3]:t[a+3]<<24|t[a+2]<<16|t[a+1]<<8|t[a],s[o]=c>>>0}return s},De.split32=function(t,e){for(var r=new Array(4*t.length),i=0,n=0;i<t.length;i++,n+=4){var s=t[i];"big"===e?(r[n]=s>>>24,r[n+1]=s>>>16&255,r[n+2]=s>>>8&255,r[n+3]=255&s):(r[n+3]=s>>>24,r[n+2]=s>>>16&255,r[n+1]=s>>>8&255,r[n]=255&s)}return r},De.rotr32=function(t,e){return t>>>e|t<<32-e},De.rotl32=function(t,e){return t<<e|t>>>32-e},De.sum32=function(t,e){return t+e>>>0},De.sum32_3=function(t,e,r){return t+e+r>>>0},De.sum32_4=function(t,e,r,i){return t+e+r+i>>>0},De.sum32_5=function(t,e,r,i,n){return t+e+r+i+n>>>0},De.sum64=function(t,e,r,i){var n=t[e],s=i+t[e+1]>>>0,o=(s<i?1:0)+r+n;t[e]=o>>>0,t[e+1]=s},De.sum64_hi=function(t,e,r,i){return(e+i>>>0<e?1:0)+t+r>>>0},De.sum64_lo=function(t,e,r,i){return e+i>>>0},De.sum64_4_hi=function(t,e,r,i,n,s,o,a){var c=0,h=e;return c+=(h=h+i>>>0)<e?1:0,c+=(h=h+s>>>0)<s?1:0,t+r+n+o+(c+=(h=h+a>>>0)<a?1:0)>>>0},De.sum64_4_lo=function(t,e,r,i,n,s,o,a){return e+i+s+a>>>0},De.sum64_5_hi=function(t,e,r,i,n,s,o,a,c,h){var u=0,f=e;return u+=(f=f+i>>>0)<e?1:0,u+=(f=f+s>>>0)<s?1:0,u+=(f=f+a>>>0)<a?1:0,t+r+n+o+c+(u+=(f=f+h>>>0)<h?1:0)>>>0},De.sum64_5_lo=function(t,e,r,i,n,s,o,a,c,h){return e+i+s+a+h>>>0},De.rotr64_hi=function(t,e,r){return(e<<32-r|t>>>r)>>>0},De.rotr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0},De.shr64_hi=function(t,e,r){return t>>>r},De.shr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0};var Ve={},Je=De,Ge=Ue;function Qe(){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}Ve.BlockHash=Qe,Qe.prototype.update=function(t,e){if(t=Je.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){var r=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-r,t.length),0===this.pending.length&&(this.pending=null),t=Je.join32(t,0,t.length-r,this.endian);for(var i=0;i<t.length;i+=this._delta32)this._update(t,i,i+this._delta32)}return this},Qe.prototype.digest=function(t){return this.update(this._pad()),Ge(null===this.pending),this._digest(t)},Qe.prototype._pad=function(){var t=this.pendingTotal,e=this._delta8,r=e-(t+this.padLength)%e,i=new Array(r+this.padLength);i[0]=128;for(var n=1;n<r;n++)i[n]=0;if(t<<=3,"big"===this.endian){for(var s=8;s<this.padLength;s++)i[n++]=0;i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=t>>>24&255,i[n++]=t>>>16&255,i[n++]=t>>>8&255,i[n++]=255&t}else for(i[n++]=255&t,i[n++]=t>>>8&255,i[n++]=t>>>16&255,i[n++]=t>>>24&255,i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=0,s=8;s<this.padLength;s++)i[n++]=0;return i};var We={},Ye={},Xe=De.rotr32;function Ze(t,e,r){return t&e^~t&r}function tr(t,e,r){return t&e^t&r^e&r}function er(t,e,r){return t^e^r}Ye.ft_1=function(t,e,r,i){return 0===t?Ze(e,r,i):1===t||3===t?er(e,r,i):2===t?tr(e,r,i):void 0},Ye.ch32=Ze,Ye.maj32=tr,Ye.p32=er,Ye.s0_256=function(t){return Xe(t,2)^Xe(t,13)^Xe(t,22)},Ye.s1_256=function(t){return Xe(t,6)^Xe(t,11)^Xe(t,25)},Ye.g0_256=function(t){return Xe(t,7)^Xe(t,18)^t>>>3},Ye.g1_256=function(t){return Xe(t,17)^Xe(t,19)^t>>>10};var rr=De,ir=Ve,nr=Ye,sr=rr.rotl32,or=rr.sum32,ar=rr.sum32_5,cr=nr.ft_1,hr=ir.BlockHash,ur=[1518500249,1859775393,2400959708,3395469782];function fr(){if(!(this instanceof fr))return new fr;hr.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}rr.inherits(fr,hr);var dr=fr;fr.blockSize=512,fr.outSize=160,fr.hmacStrength=80,fr.padLength=64,fr.prototype._update=function(t,e){for(var r=this.W,i=0;i<16;i++)r[i]=t[e+i];for(;i<r.length;i++)r[i]=sr(r[i-3]^r[i-8]^r[i-14]^r[i-16],1);var n=this.h[0],s=this.h[1],o=this.h[2],a=this.h[3],c=this.h[4];for(i=0;i<r.length;i++){var h=~~(i/20),u=ar(sr(n,5),cr(h,s,o,a),c,r[i],ur[h]);c=a,a=o,o=sr(s,30),s=n,n=u}this.h[0]=or(this.h[0],n),this.h[1]=or(this.h[1],s),this.h[2]=or(this.h[2],o),this.h[3]=or(this.h[3],a),this.h[4]=or(this.h[4],c)},fr.prototype._digest=function(t){return"hex"===t?rr.toHex32(this.h,"big"):rr.split32(this.h,"big")};var lr=De,pr=Ve,gr=Ye,mr=Ue,br=lr.sum32,vr=lr.sum32_4,yr=lr.sum32_5,wr=gr.ch32,_r=gr.maj32,Ar=gr.s0_256,Mr=gr.s1_256,Er=gr.g0_256,Ir=gr.g1_256,Sr=pr.BlockHash,Pr=[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 xr(){if(!(this instanceof xr))return new xr;Sr.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=Pr,this.W=new Array(64)}lr.inherits(xr,Sr);var Rr=xr;xr.blockSize=512,xr.outSize=256,xr.hmacStrength=192,xr.padLength=64,xr.prototype._update=function(t,e){for(var r=this.W,i=0;i<16;i++)r[i]=t[e+i];for(;i<r.length;i++)r[i]=vr(Ir(r[i-2]),r[i-7],Er(r[i-15]),r[i-16]);var n=this.h[0],s=this.h[1],o=this.h[2],a=this.h[3],c=this.h[4],h=this.h[5],u=this.h[6],f=this.h[7];for(mr(this.k.length===r.length),i=0;i<r.length;i++){var d=yr(f,Mr(c),wr(c,h,u),this.k[i],r[i]),l=br(Ar(n),_r(n,s,o));f=u,u=h,h=c,c=br(a,d),a=o,o=s,s=n,n=br(d,l)}this.h[0]=br(this.h[0],n),this.h[1]=br(this.h[1],s),this.h[2]=br(this.h[2],o),this.h[3]=br(this.h[3],a),this.h[4]=br(this.h[4],c),this.h[5]=br(this.h[5],h),this.h[6]=br(this.h[6],u),this.h[7]=br(this.h[7],f)},xr.prototype._digest=function(t){return"hex"===t?lr.toHex32(this.h,"big"):lr.split32(this.h,"big")};var Nr=De,Or=Rr;function Cr(){if(!(this instanceof Cr))return new Cr;Or.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}Nr.inherits(Cr,Or);var Tr=Cr;Cr.blockSize=512,Cr.outSize=224,Cr.hmacStrength=192,Cr.padLength=64,Cr.prototype._digest=function(t){return"hex"===t?Nr.toHex32(this.h.slice(0,7),"big"):Nr.split32(this.h.slice(0,7),"big")};var qr=De,kr=Ve,Dr=Ue,Ur=qr.rotr64_hi,Br=qr.rotr64_lo,Lr=qr.shr64_hi,zr=qr.shr64_lo,jr=qr.sum64,Fr=qr.sum64_hi,Hr=qr.sum64_lo,Kr=qr.sum64_4_hi,$r=qr.sum64_4_lo,Vr=qr.sum64_5_hi,Jr=qr.sum64_5_lo,Gr=kr.BlockHash,Qr=[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 Wr(){if(!(this instanceof Wr))return new Wr;Gr.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=Qr,this.W=new Array(160)}qr.inherits(Wr,Gr);var Yr=Wr;function Xr(t,e,r,i,n){var s=t&r^~t&n;return s<0&&(s+=4294967296),s}function Zr(t,e,r,i,n,s){var o=e&i^~e&s;return o<0&&(o+=4294967296),o}function ti(t,e,r,i,n){var s=t&r^t&n^r&n;return s<0&&(s+=4294967296),s}function ei(t,e,r,i,n,s){var o=e&i^e&s^i&s;return o<0&&(o+=4294967296),o}function ri(t,e){var r=Ur(t,e,28)^Ur(e,t,2)^Ur(e,t,7);return r<0&&(r+=4294967296),r}function ii(t,e){var r=Br(t,e,28)^Br(e,t,2)^Br(e,t,7);return r<0&&(r+=4294967296),r}function ni(t,e){var r=Ur(t,e,14)^Ur(t,e,18)^Ur(e,t,9);return r<0&&(r+=4294967296),r}function si(t,e){var r=Br(t,e,14)^Br(t,e,18)^Br(e,t,9);return r<0&&(r+=4294967296),r}function oi(t,e){var r=Ur(t,e,1)^Ur(t,e,8)^Lr(t,e,7);return r<0&&(r+=4294967296),r}function ai(t,e){var r=Br(t,e,1)^Br(t,e,8)^zr(t,e,7);return r<0&&(r+=4294967296),r}function ci(t,e){var r=Ur(t,e,19)^Ur(e,t,29)^Lr(t,e,6);return r<0&&(r+=4294967296),r}function hi(t,e){var r=Br(t,e,19)^Br(e,t,29)^zr(t,e,6);return r<0&&(r+=4294967296),r}Wr.blockSize=1024,Wr.outSize=512,Wr.hmacStrength=192,Wr.padLength=128,Wr.prototype._prepareBlock=function(t,e){for(var r=this.W,i=0;i<32;i++)r[i]=t[e+i];for(;i<r.length;i+=2){var n=ci(r[i-4],r[i-3]),s=hi(r[i-4],r[i-3]),o=r[i-14],a=r[i-13],c=oi(r[i-30],r[i-29]),h=ai(r[i-30],r[i-29]),u=r[i-32],f=r[i-31];r[i]=Kr(n,s,o,a,c,h,u,f),r[i+1]=$r(n,s,o,a,c,h,u,f)}},Wr.prototype._update=function(t,e){this._prepareBlock(t,e);var r=this.W,i=this.h[0],n=this.h[1],s=this.h[2],o=this.h[3],a=this.h[4],c=this.h[5],h=this.h[6],u=this.h[7],f=this.h[8],d=this.h[9],l=this.h[10],p=this.h[11],g=this.h[12],m=this.h[13],b=this.h[14],v=this.h[15];Dr(this.k.length===r.length);for(var y=0;y<r.length;y+=2){var w=b,_=v,A=ni(f,d),M=si(f,d),E=Xr(f,0,l,0,g),I=Zr(0,d,0,p,0,m),S=this.k[y],P=this.k[y+1],x=r[y],R=r[y+1],N=Vr(w,_,A,M,E,I,S,P,x,R),O=Jr(w,_,A,M,E,I,S,P,x,R);w=ri(i,n),_=ii(i,n),A=ti(i,0,s,0,a),M=ei(0,n,0,o,0,c);var C=Fr(w,_,A,M),T=Hr(w,_,A,M);b=g,v=m,g=l,m=p,l=f,p=d,f=Fr(h,u,N,O),d=Hr(u,u,N,O),h=a,u=c,a=s,c=o,s=i,o=n,i=Fr(N,O,C,T),n=Hr(N,O,C,T)}jr(this.h,0,i,n),jr(this.h,2,s,o),jr(this.h,4,a,c),jr(this.h,6,h,u),jr(this.h,8,f,d),jr(this.h,10,l,p),jr(this.h,12,g,m),jr(this.h,14,b,v)},Wr.prototype._digest=function(t){return"hex"===t?qr.toHex32(this.h,"big"):qr.split32(this.h,"big")};var ui=De,fi=Yr;function di(){if(!(this instanceof di))return new di;fi.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}ui.inherits(di,fi);var li=di;di.blockSize=1024,di.outSize=384,di.hmacStrength=192,di.padLength=128,di.prototype._digest=function(t){return"hex"===t?ui.toHex32(this.h.slice(0,12),"big"):ui.split32(this.h.slice(0,12),"big")},We.sha1=dr,We.sha224=Tr,We.sha256=Rr,We.sha384=li,We.sha512=Yr;var pi={},gi=De,mi=Ve,bi=gi.rotl32,vi=gi.sum32,yi=gi.sum32_3,wi=gi.sum32_4,_i=mi.BlockHash;function Ai(){if(!(this instanceof Ai))return new Ai;_i.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function Mi(t,e,r,i){return t<=15?e^r^i:t<=31?e&r|~e&i:t<=47?(e|~r)^i:t<=63?e&i|r&~i:e^(r|~i)}function Ei(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function Ii(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}gi.inherits(Ai,_i),pi.ripemd160=Ai,Ai.blockSize=512,Ai.outSize=160,Ai.hmacStrength=192,Ai.padLength=64,Ai.prototype._update=function(t,e){for(var r=this.h[0],i=this.h[1],n=this.h[2],s=this.h[3],o=this.h[4],a=r,c=i,h=n,u=s,f=o,d=0;d<80;d++){var l=vi(bi(wi(r,Mi(d,i,n,s),t[Si[d]+e],Ei(d)),xi[d]),o);r=o,o=s,s=bi(n,10),n=i,i=l,l=vi(bi(wi(a,Mi(79-d,c,h,u),t[Pi[d]+e],Ii(d)),Ri[d]),f),a=f,f=u,u=bi(h,10),h=c,c=l}l=yi(this.h[1],n,u),this.h[1]=yi(this.h[2],s,f),this.h[2]=yi(this.h[3],o,a),this.h[3]=yi(this.h[4],r,c),this.h[4]=yi(this.h[0],i,h),this.h[0]=l},Ai.prototype._digest=function(t){return"hex"===t?gi.toHex32(this.h,"little"):gi.split32(this.h,"little")};var Si=[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],Pi=[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],xi=[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],Ri=[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],Ni=De,Oi=Ue;function Ci(t,e,r){if(!(this instanceof Ci))return new Ci(t,e,r);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(Ni.toArray(e,r))}var Ti=Ci;function qi(t,e,r){return r={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(e??r.path)}},t(r,r.exports),r.exports}Ci.prototype._init=function(t){t.length>this.blockSize&&(t=(new this.Hash).update(t).digest()),Oi(t.length<=this.blockSize);for(var e=t.length;e<this.blockSize;e++)t.push(0);for(e=0;e<t.length;e++)t[e]^=54;for(this.inner=(new this.Hash).update(t),e=0;e<t.length;e++)t[e]^=106;this.outer=(new this.Hash).update(t)},Ci.prototype.update=function(t,e){return this.inner.update(t,e),this},Ci.prototype.digest=function(t){return this.outer.update(this.inner.digest()),this.outer.digest(t)},function(t){var e=t;e.utils=De,e.common=Ve,e.sha=We,e.ripemd=pi,e.hmac=Ti,e.sha1=e.sha.sha1,e.sha256=e.sha.sha256,e.sha224=e.sha.sha224,e.sha384=e.sha.sha384,e.sha512=e.sha.sha512,e.ripemd160=e.ripemd.ripemd160}(ke);var ki=Di;function Di(t,e){if(!t)throw new Error(e||"Assertion failed")}Di.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)};var Ui=qi((function(t,e){var r=e;function i(t){return 1===t.length?"0"+t:t}function n(t){for(var e="",r=0;r<t.length;r++)e+=i(t[r].toString(16));return e}r.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"!=typeof t){for(var i=0;i<t.length;i++)r[i]=0|t[i];return r}if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),i=0;i<t.length;i+=2)r.push(parseInt(t[i]+t[i+1],16));else for(i=0;i<t.length;i++){var n=t.charCodeAt(i),s=n>>8,o=255&n;s?r.push(s,o):r.push(o)}return r},r.zero2=i,r.toHex=n,r.encode=function(t,e){return"hex"===e?n(t):t}})),Bi=qi((function(t,e){var r=e;r.assert=ki,r.toArray=Ui.toArray,r.zero2=Ui.zero2,r.toHex=Ui.toHex,r.encode=Ui.encode,r.getNAF=function(t,e,r){var i=new Array(Math.max(t.bitLength(),r)+1);i.fill(0);for(var n=1<<e+1,s=t.clone(),o=0;o<i.length;o++){var a,c=s.andln(n-1);s.isOdd()?(a=c>(n>>1)-1?(n>>1)-c:c,s.isubn(a)):a=0,i[o]=a,s.iushrn(1)}return i},r.getJSF=function(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var i,n=0,s=0;t.cmpn(-n)>0||e.cmpn(-s)>0;){var o,a,c=t.andln(3)+n&3,h=e.andln(3)+s&3;3===c&&(c=-1),3===h&&(h=-1),o=1&c?3!=(i=t.andln(7)+n&7)&&5!==i||2!==h?c:-c:0,r[0].push(o),a=1&h?3!=(i=e.andln(7)+s&7)&&5!==i||2!==c?h:-h:0,r[1].push(a),2*n===o+1&&(n=1-n),2*s===a+1&&(s=1-s),t.iushrn(1),e.iushrn(1)}return r},r.cachedProperty=function(t,e,r){var i="_"+e;t.prototype[e]=function(){return void 0!==this[i]?this[i]:this[i]=r.call(this)}},r.parseBytes=function(t){return"string"==typeof t?r.toArray(t,"hex"):t},r.intFromLE=function(t){return new Lt(t,"hex","le")}})),Li=Bi.getNAF,zi=Bi.getJSF,ji=Bi.assert;function Fi(t,e){this.type=t,this.p=new Lt(e.p,16),this.red=e.prime?Lt.red(e.prime):Lt.mont(this.p),this.zero=new Lt(0).toRed(this.red),this.one=new Lt(1).toRed(this.red),this.two=new Lt(2).toRed(this.red),this.n=e.n&&new Lt(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.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 r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Hi=Fi;function Ki(t,e){this.curve=t,this.type=e,this.precomputed=null}Fi.prototype.point=function(){throw new Error("Not implemented")},Fi.prototype.validate=function(){throw new Error("Not implemented")},Fi.prototype._fixedNafMul=function(t,e){ji(t.precomputed);var r=t._getDoubles(),i=Li(e,1,this._bitLength),n=(1<<r.step+1)-(r.step%2==0?2:1);n/=3;var s,o,a=[];for(s=0;s<i.length;s+=r.step){o=0;for(var c=s+r.step-1;c>=s;c--)o=(o<<1)+i[c];a.push(o)}for(var h=this.jpoint(null,null,null),u=this.jpoint(null,null,null),f=n;f>0;f--){for(s=0;s<a.length;s++)(o=a[s])===f?u=u.mixedAdd(r.points[s]):o===-f&&(u=u.mixedAdd(r.points[s].neg()));h=h.add(u)}return h.toP()},Fi.prototype._wnafMul=function(t,e){var r=4,i=t._getNAFPoints(r);r=i.wnd;for(var n=i.points,s=Li(e,r,this._bitLength),o=this.jpoint(null,null,null),a=s.length-1;a>=0;a--){for(var c=0;a>=0&&0===s[a];a--)c++;if(a>=0&&c++,o=o.dblp(c),a<0)break;var h=s[a];ji(0!==h),o="affine"===t.type?h>0?o.mixedAdd(n[h-1>>1]):o.mixedAdd(n[-h-1>>1].neg()):h>0?o.add(n[h-1>>1]):o.add(n[-h-1>>1].neg())}return"affine"===t.type?o.toP():o},Fi.prototype._wnafMulAdd=function(t,e,r,i,n){var s,o,a,c=this._wnafT1,h=this._wnafT2,u=this._wnafT3,f=0;for(s=0;s<i;s++){var d=(a=e[s])._getNAFPoints(t);c[s]=d.wnd,h[s]=d.points}for(s=i-1;s>=1;s-=2){var l=s-1,p=s;if(1===c[l]&&1===c[p]){var g=[e[l],null,null,e[p]];0===e[l].y.cmp(e[p].y)?(g[1]=e[l].add(e[p]),g[2]=e[l].toJ().mixedAdd(e[p].neg())):0===e[l].y.cmp(e[p].y.redNeg())?(g[1]=e[l].toJ().mixedAdd(e[p]),g[2]=e[l].add(e[p].neg())):(g[1]=e[l].toJ().mixedAdd(e[p]),g[2]=e[l].toJ().mixedAdd(e[p].neg()));var m=[-3,-1,-5,-7,0,7,5,1,3],b=zi(r[l],r[p]);for(f=Math.max(b[0].length,f),u[l]=new Array(f),u[p]=new Array(f),o=0;o<f;o++){var v=0|b[0][o],y=0|b[1][o];u[l][o]=m[3*(v+1)+(y+1)],u[p][o]=0,h[l]=g}}else u[l]=Li(r[l],c[l],this._bitLength),u[p]=Li(r[p],c[p],this._bitLength),f=Math.max(u[l].length,f),f=Math.max(u[p].length,f)}var w=this.jpoint(null,null,null),_=this._wnafT4;for(s=f;s>=0;s--){for(var A=0;s>=0;){var M=!0;for(o=0;o<i;o++)_[o]=0|u[o][s],0!==_[o]&&(M=!1);if(!M)break;A++,s--}if(s>=0&&A++,w=w.dblp(A),s<0)break;for(o=0;o<i;o++){var E=_[o];0!==E&&(E>0?a=h[o][E-1>>1]:E<0&&(a=h[o][-E-1>>1].neg()),w="affine"===a.type?w.mixedAdd(a):w.add(a))}}for(s=0;s<i;s++)h[s]=null;return n?w:w.toP()},Fi.BasePoint=Ki,Ki.prototype.eq=function(){throw new Error("Not implemented")},Ki.prototype.validate=function(){return this.curve.validate(this)},Fi.prototype.decodePoint=function(t,e){t=Bi.toArray(t,e);var r=this.p.byteLength();if((4===t[0]||6===t[0]||7===t[0])&&t.length-1==2*r)return 6===t[0]?ji(t[t.length-1]%2==0):7===t[0]&&ji(t[t.length-1]%2==1),this.point(t.slice(1,1+r),t.slice(1+r,1+2*r));if((2===t[0]||3===t[0])&&t.length-1===r)return this.pointFromX(t.slice(1,1+r),3===t[0]);throw new Error("Unknown point format")},Ki.prototype.encodeCompressed=function(t){return this.encode(t,!0)},Ki.prototype._encode=function(t){var e=this.curve.p.byteLength(),r=this.getX().toArray("be",e);return t?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",e))},Ki.prototype.encode=function(t,e){return Bi.encode(this._encode(e),t)},Ki.prototype.precompute=function(t){if(this.precomputed)return this;var e={doubles:null,naf:null,beta:null};return e.naf=this._getNAFPoints(8),e.doubles=this._getDoubles(4,t),e.beta=this._getBeta(),this.precomputed=e,this},Ki.prototype._hasDoubles=function(t){if(!this.precomputed)return!1;var e=this.precomputed.doubles;return!!e&&e.points.length>=Math.ceil((t.bitLength()+1)/e.step)},Ki.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],i=this,n=0;n<e;n+=t){for(var s=0;s<t;s++)i=i.dbl();r.push(i)}return{step:t,points:r}},Ki.prototype._getNAFPoints=function(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var e=[this],r=(1<<t)-1,i=1===r?null:this.dbl(),n=1;n<r;n++)e[n]=e[n-1].add(i);return{wnd:t,points:e}},Ki.prototype._getBeta=function(){return null},Ki.prototype.dblp=function(t){for(var e=this,r=0;r<t;r++)e=e.dbl();return e};var $i=qi((function(t){"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}})),Vi=Bi.assert;function Ji(t){Hi.call(this,"short",t),this.a=new Lt(t.a,16).toRed(this.red),this.b=new Lt(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}$i(Ji,Hi);var Gi=Ji;function Qi(t,e,r,i){Hi.BasePoint.call(this,t,"affine"),null===e&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new Lt(e,16),this.y=new Lt(r,16),i&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function Wi(t,e,r,i){Hi.BasePoint.call(this,t,"jacobian"),null===e&&null===r&&null===i?(this.x=this.curve.one,this.y=this.curve.one,this.z=new Lt(0)):(this.x=new Lt(e,16),this.y=new Lt(r,16),this.z=new Lt(i,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Ji.prototype._getEndomorphism=function(t){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var e,r,i;if(t.beta)e=new Lt(t.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);e=(e=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(t.lambda)r=new Lt(t.lambda,16);else{var s=this._getEndoRoots(this.n);0===this.g.mul(s[0]).x.cmp(this.g.x.redMul(e))?r=s[0]:(r=s[1],Vi(0===this.g.mul(r).x.cmp(this.g.x.redMul(e))))}return i=t.basis?t.basis.map((function(t){return{a:new Lt(t.a,16),b:new Lt(t.b,16)}})):this._getEndoBasis(r),{beta:e,lambda:r,basis:i}}},Ji.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:Lt.mont(t),r=new Lt(2).toRed(e).redInvm(),i=r.redNeg(),n=new Lt(3).toRed(e).redNeg().redSqrt().redMul(r);return[i.redAdd(n).fromRed(),i.redSub(n).fromRed()]},Ji.prototype._getEndoBasis=function(t){for(var e,r,i,n,s,o,a,c,h,u=this.n.ushrn(Math.floor(this.n.bitLength()/2)),f=t,d=this.n.clone(),l=new Lt(1),p=new Lt(0),g=new Lt(0),m=new Lt(1),b=0;0!==f.cmpn(0);){var v=d.div(f);c=d.sub(v.mul(f)),h=g.sub(v.mul(l));var y=m.sub(v.mul(p));if(!i&&c.cmp(u)<0)e=a.neg(),r=l,i=c.neg(),n=h;else if(i&&2===++b)break;a=c,d=f,f=c,g=l,l=h,m=p,p=y}s=c.neg(),o=h;var w=i.sqr().add(n.sqr());return s.sqr().add(o.sqr()).cmp(w)>=0&&(s=e,o=r),i.negative&&(i=i.neg(),n=n.neg()),s.negative&&(s=s.neg(),o=o.neg()),[{a:i,b:n},{a:s,b:o}]},Ji.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],i=e[1],n=i.b.mul(t).divRound(this.n),s=r.b.neg().mul(t).divRound(this.n),o=n.mul(r.a),a=s.mul(i.a),c=n.mul(r.b),h=s.mul(i.b);return{k1:t.sub(o).sub(a),k2:c.add(h).neg()}},Ji.prototype.pointFromX=function(t,e){(t=new Lt(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),i=r.redSqrt();if(0!==i.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var n=i.fromRed().isOdd();return(e&&!n||!e&&n)&&(i=i.redNeg()),this.point(t,i)},Ji.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,i=this.a.redMul(e),n=e.redSqr().redMul(e).redIAdd(i).redIAdd(this.b);return 0===r.redSqr().redISub(n).cmpn(0)},Ji.prototype._endoWnafMulAdd=function(t,e,r){for(var i=this._endoWnafT1,n=this._endoWnafT2,s=0;s<t.length;s++){var o=this._endoSplit(e[s]),a=t[s],c=a._getBeta();o.k1.negative&&(o.k1.ineg(),a=a.neg(!0)),o.k2.negative&&(o.k2.ineg(),c=c.neg(!0)),i[2*s]=a,i[2*s+1]=c,n[2*s]=o.k1,n[2*s+1]=o.k2}for(var h=this._wnafMulAdd(1,i,n,2*s,r),u=0;u<2*s;u++)i[u]=null,n[u]=null;return h},$i(Qi,Hi.BasePoint),Ji.prototype.point=function(t,e,r){return new Qi(this,t,e,r)},Ji.prototype.pointFromJSON=function(t,e){return Qi.fromJSON(this,t,e)},Qi.prototype._getBeta=function(){if(this.curve.endo){var t=this.precomputed;if(t&&t.beta)return t.beta;var e=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(t){var r=this.curve,i=function(t){return r.point(t.x.redMul(r.endo.beta),t.y)};t.beta=e,e.precomputed={beta:null,naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(i)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(i)}}}return e}},Qi.prototype.toJSON=function(){return this.precomputed?[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)}}]:[this.x,this.y]},Qi.fromJSON=function(t,e,r){"string"==typeof e&&(e=JSON.parse(e));var i=t.point(e[0],e[1],r);if(!e[2])return i;function n(e){return t.point(e[0],e[1],r)}var s=e[2];return i.precomputed={beta:null,doubles:s.doubles&&{step:s.doubles.step,points:[i].concat(s.doubles.points.map(n))},naf:s.naf&&{wnd:s.naf.wnd,points:[i].concat(s.naf.points.map(n))}},i},Qi.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},Qi.prototype.isInfinity=function(){return this.inf},Qi.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),i=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,i)},Qi.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),i=t.redInvm(),n=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(i),s=n.redSqr().redISub(this.x.redAdd(this.x)),o=n.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,o)},Qi.prototype.getX=function(){return this.x.fromRed()},Qi.prototype.getY=function(){return this.y.fromRed()},Qi.prototype.mul=function(t){return t=new Lt(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},Qi.prototype.mulAdd=function(t,e,r){var i=[this,e],n=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n):this.curve._wnafMulAdd(1,i,n,2)},Qi.prototype.jmulAdd=function(t,e,r){var i=[this,e],n=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n,!0):this.curve._wnafMulAdd(1,i,n,2,!0)},Qi.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},Qi.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,i=function(t){return t.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(i)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(i)}}}return e},Qi.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},$i(Wi,Hi.BasePoint),Ji.prototype.jpoint=function(t,e,r){return new Wi(this,t,e,r)},Wi.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),i=this.y.redMul(e).redMul(t);return this.curve.point(r,i)},Wi.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Wi.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),i=this.x.redMul(e),n=t.x.redMul(r),s=this.y.redMul(e.redMul(t.z)),o=t.y.redMul(r.redMul(this.z)),a=i.redSub(n),c=s.redSub(o);if(0===a.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var h=a.redSqr(),u=h.redMul(a),f=i.redMul(h),d=c.redSqr().redIAdd(u).redISub(f).redISub(f),l=c.redMul(f.redISub(d)).redISub(s.redMul(u)),p=this.z.redMul(t.z).redMul(a);return this.curve.jpoint(d,l,p)},Wi.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,i=t.x.redMul(e),n=this.y,s=t.y.redMul(e).redMul(this.z),o=r.redSub(i),a=n.redSub(s);if(0===o.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=o.redSqr(),h=c.redMul(o),u=r.redMul(c),f=a.redSqr().redIAdd(h).redISub(u).redISub(u),d=a.redMul(u.redISub(f)).redISub(n.redMul(h)),l=this.z.redMul(o);return this.curve.jpoint(f,d,l)},Wi.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var r=this;for(e=0;e<t;e++)r=r.dbl();return r}var i=this.curve.a,n=this.curve.tinv,s=this.x,o=this.y,a=this.z,c=a.redSqr().redSqr(),h=o.redAdd(o);for(e=0;e<t;e++){var u=s.redSqr(),f=h.redSqr(),d=f.redSqr(),l=u.redAdd(u).redIAdd(u).redIAdd(i.redMul(c)),p=s.redMul(f),g=l.redSqr().redISub(p.redAdd(p)),m=p.redISub(g),b=l.redMul(m);b=b.redIAdd(b).redISub(d);var v=h.redMul(a);e+1<t&&(c=c.redMul(d)),s=g,a=v,h=b}return this.curve.jpoint(s,h.redMul(n),a)},Wi.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},Wi.prototype._zeroDbl=function(){var t,e,r;if(this.zOne){var i=this.x.redSqr(),n=this.y.redSqr(),s=n.redSqr(),o=this.x.redAdd(n).redSqr().redISub(i).redISub(s);o=o.redIAdd(o);var a=i.redAdd(i).redIAdd(i),c=a.redSqr().redISub(o).redISub(o),h=s.redIAdd(s);h=(h=h.redIAdd(h)).redIAdd(h),t=c,e=a.redMul(o.redISub(c)).redISub(h),r=this.y.redAdd(this.y)}else{var u=this.x.redSqr(),f=this.y.redSqr(),d=f.redSqr(),l=this.x.redAdd(f).redSqr().redISub(u).redISub(d);l=l.redIAdd(l);var p=u.redAdd(u).redIAdd(u),g=p.redSqr(),m=d.redIAdd(d);m=(m=m.redIAdd(m)).redIAdd(m),t=g.redISub(l).redISub(l),e=p.redMul(l.redISub(t)).redISub(m),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(t,e,r)},Wi.prototype._threeDbl=function(){var t,e,r;if(this.zOne){var i=this.x.redSqr(),n=this.y.redSqr(),s=n.redSqr(),o=this.x.redAdd(n).redSqr().redISub(i).redISub(s);o=o.redIAdd(o);var a=i.redAdd(i).redIAdd(i).redIAdd(this.curve.a),c=a.redSqr().redISub(o).redISub(o);t=c;var h=s.redIAdd(s);h=(h=h.redIAdd(h)).redIAdd(h),e=a.redMul(o.redISub(c)).redISub(h),r=this.y.redAdd(this.y)}else{var u=this.z.redSqr(),f=this.y.redSqr(),d=this.x.redMul(f),l=this.x.redSub(u).redMul(this.x.redAdd(u));l=l.redAdd(l).redIAdd(l);var p=d.redIAdd(d),g=(p=p.redIAdd(p)).redAdd(p);t=l.redSqr().redISub(g),r=this.y.redAdd(this.z).redSqr().redISub(f).redISub(u);var m=f.redSqr();m=(m=(m=m.redIAdd(m)).redIAdd(m)).redIAdd(m),e=l.redMul(p.redISub(t)).redISub(m)}return this.curve.jpoint(t,e,r)},Wi.prototype._dbl=function(){var t=this.curve.a,e=this.x,r=this.y,i=this.z,n=i.redSqr().redSqr(),s=e.redSqr(),o=r.redSqr(),a=s.redAdd(s).redIAdd(s).redIAdd(t.redMul(n)),c=e.redAdd(e),h=(c=c.redIAdd(c)).redMul(o),u=a.redSqr().redISub(h.redAdd(h)),f=h.redISub(u),d=o.redSqr();d=(d=(d=d.redIAdd(d)).redIAdd(d)).redIAdd(d);var l=a.redMul(f).redISub(d),p=r.redAdd(r).redMul(i);return this.curve.jpoint(u,l,p)},Wi.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr(),i=e.redSqr(),n=t.redAdd(t).redIAdd(t),s=n.redSqr(),o=this.x.redAdd(e).redSqr().redISub(t).redISub(i),a=(o=(o=(o=o.redIAdd(o)).redAdd(o).redIAdd(o)).redISub(s)).redSqr(),c=i.redIAdd(i);c=(c=(c=c.redIAdd(c)).redIAdd(c)).redIAdd(c);var h=n.redIAdd(o).redSqr().redISub(s).redISub(a).redISub(c),u=e.redMul(h);u=(u=u.redIAdd(u)).redIAdd(u);var f=this.x.redMul(a).redISub(u);f=(f=f.redIAdd(f)).redIAdd(f);var d=this.y.redMul(h.redMul(c.redISub(h)).redISub(o.redMul(a)));d=(d=(d=d.redIAdd(d)).redIAdd(d)).redIAdd(d);var l=this.z.redAdd(o).redSqr().redISub(r).redISub(a);return this.curve.jpoint(f,d,l)},Wi.prototype.mul=function(t,e){return t=new Lt(t,e),this.curve._wnafMul(this,t)},Wi.prototype.eq=function(t){if("affine"===t.type)return this.eq(t.toJ());if(this===t)return!0;var e=this.z.redSqr(),r=t.z.redSqr();if(0!==this.x.redMul(r).redISub(t.x.redMul(e)).cmpn(0))return!1;var i=e.redMul(this.z),n=r.redMul(t.z);return 0===this.y.redMul(n).redISub(t.y.redMul(i)).cmpn(0)},Wi.prototype.eqXToP=function(t){var e=this.z.redSqr(),r=t.toRed(this.curve.red).redMul(e);if(0===this.x.cmp(r))return!0;for(var i=t.clone(),n=this.curve.redN.redMul(e);;){if(i.iadd(this.curve.n),i.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(n),0===this.x.cmp(r))return!0}},Wi.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},Wi.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var Yi=qi((function(t,e){var r=e;r.base=Hi,r.short=Gi,r.mont=null,r.edwards=null})),Xi=qi((function(t,e){var r,i=e,n=Bi.assert;function s(t){"short"===t.type?this.curve=new Yi.short(t):"edwards"===t.type?this.curve=new Yi.edwards(t):this.curve=new Yi.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function o(t,e){Object.defineProperty(i,t,{configurable:!0,enumerable:!0,get:function(){var r=new s(e);return Object.defineProperty(i,t,{configurable:!0,enumerable:!0,value:r}),r}})}i.PresetCurve=s,o("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:ke.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),o("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:ke.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),o("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:ke.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),o("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:ke.sha384,gRed:!1,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"]}),o("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:ke.sha512,gRed:!1,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"]}),o("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:ke.sha256,gRed:!1,g:["9"]}),o("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:ke.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{r=null.crash()}catch{r=void 0}o("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:ke.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",r]})}));function Zi(t){if(!(this instanceof Zi))return new Zi(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Ui.toArray(t.entropy,t.entropyEnc||"hex"),r=Ui.toArray(t.nonce,t.nonceEnc||"hex"),i=Ui.toArray(t.pers,t.persEnc||"hex");ki(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,i)}var tn=Zi;Zi.prototype._init=function(t,e,r){var i=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var n=0;n<this.V.length;n++)this.K[n]=0,this.V[n]=1;this._update(i),this._reseed=1,this.reseedInterval=281474976710656},Zi.prototype._hmac=function(){return new ke.hmac(this.hash,this.K)},Zi.prototype._update=function(t){var e=this._hmac().update(this.V).update([0]);t&&(e=e.update(t)),this.K=e.digest(),this.V=this._hmac().update(this.V).digest(),t&&(this.K=this._hmac().update(this.V).update([1]).update(t).digest(),this.V=this._hmac().update(this.V).digest())},Zi.prototype.reseed=function(t,e,r,i){"string"!=typeof e&&(i=r,r=e,e=null),t=Ui.toArray(t,e),r=Ui.toArray(r,i),ki(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},Zi.prototype.generate=function(t,e,r,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(i=r,r=e,e=null),r&&(r=Ui.toArray(r,i||"hex"),this._update(r));for(var n=[];n.length<t;)this.V=this._hmac().update(this.V).digest(),n=n.concat(this.V);var s=n.slice(0,t);return this._update(r),this._reseed++,Ui.encode(s,e)};var en=Bi.assert;function rn(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}var nn=rn;rn.fromPublic=function(t,e,r){return e instanceof rn?e:new rn(t,{pub:e,pubEnc:r})},rn.fromPrivate=function(t,e,r){return e instanceof rn?e:new rn(t,{priv:e,privEnc:r})},rn.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},rn.prototype.getPublic=function(t,e){return"string"==typeof t&&(e=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},rn.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16,2):this.priv},rn.prototype._importPrivate=function(t,e){this.priv=new Lt(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},rn.prototype._importPublic=function(t,e){if(t.x||t.y)return"mont"===this.ec.curve.type?en(t.x,"Need x coordinate"):("short"===this.ec.curve.type||"edwards"===this.ec.curve.type)&&en(t.x&&t.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(t.x,t.y));this.pub=this.ec.curve.decodePoint(t,e)},rn.prototype.derive=function(t){return t.validate()||en(t.validate(),"public point not validated"),t.mul(this.priv).getX()},rn.prototype.sign=function(t,e,r){return this.ec.sign(t,this,e,r)},rn.prototype.verify=function(t,e){return this.ec.verify(t,e,this)},rn.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var sn=Bi.assert;function on(t,e){if(t instanceof on)return t;this._importDER(t,e)||(sn(t.r&&t.s,"Signature without r or s"),this.r=new Lt(t.r,16),this.s=new Lt(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var an=on;function cn(){this.place=0}function hn(t,e){var r=t[e.place++];if(!(128&r))return r;var i=15&r;if(0===i||i>4)return!1;for(var n=0,s=0,o=e.place;s<i;s++,o++)n<<=8,n|=t[o],n>>>=0;return!(n<=127)&&(e.place=o,n)}function un(t){for(var e=0,r=t.length-1;!t[e]&&!(128&t[e+1])&&e<r;)e++;return 0===e?t:t.slice(e)}function fn(t,e){if(e<128)t.push(e);else{var r=1+(Math.log(e)/Math.LN2>>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}}on.prototype._importDER=function(t,e){t=Bi.toArray(t,e);var r=new cn;if(48!==t[r.place++])return!1;var i=hn(t,r);if(!1===i||i+r.place!==t.length||2!==t[r.place++])return!1;var n=hn(t,r);if(!1===n)return!1;var s=t.slice(r.place,n+r.place);if(r.place+=n,2!==t[r.place++])return!1;var o=hn(t,r);if(!1===o||t.length!==o+r.place)return!1;var a=t.slice(r.place,o+r.place);if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}if(0===a[0]){if(!(128&a[1]))return!1;a=a.slice(1)}return this.r=new Lt(s),this.s=new Lt(a),this.recoveryParam=null,!0},on.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&r[0]&&(r=[0].concat(r)),e=un(e),r=un(r);!(r[0]||128&r[1]);)r=r.slice(1);var i=[2];fn(i,e.length),(i=i.concat(e)).push(2),fn(i,r.length);var n=i.concat(r),s=[48];return fn(s,n.length),s=s.concat(n),Bi.encode(s,t)};var dn=function(){throw new Error("unsupported")},ln=Bi.assert;function pn(t){if(!(this instanceof pn))return new pn(t);"string"==typeof t&&(ln(Object.prototype.hasOwnProperty.call(Xi,t),"Unknown curve "+t),t=Xi[t]),t instanceof Xi.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var gn=pn;pn.prototype.keyPair=function(t){return new nn(this,t)},pn.prototype.keyFromPrivate=function(t,e){return nn.fromPrivate(this,t,e)},pn.prototype.keyFromPublic=function(t,e){return nn.fromPublic(this,t,e)},pn.prototype.genKeyPair=function(t){t||(t={});for(var e=new tn({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||dn(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),i=this.n.sub(new Lt(2));;){var n=new Lt(e.generate(r));if(!(n.cmp(i)>0))return n.iaddn(1),this.keyFromPrivate(n)}},pn.prototype._truncateToN=function(t,e){var r=8*t.byteLength()-this.n.bitLength();return r>0&&(t=t.ushrn(r)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},pn.prototype.sign=function(t,e,r,i){"object"==typeof r&&(i=r,r=null),i||(i={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new Lt(t,16));for(var n=this.n.byteLength(),s=e.getPrivate().toArray("be",n),o=t.toArray("be",n),a=new tn({hash:this.hash,entropy:s,nonce:o,pers:i.pers,persEnc:i.persEnc||"utf8"}),c=this.n.sub(new Lt(1)),h=0;;h++){var u=i.k?i.k(h):new Lt(a.generate(this.n.byteLength()));if(!((u=this._truncateToN(u,!0)).cmpn(1)<=0||u.cmp(c)>=0)){var f=this.g.mul(u);if(!f.isInfinity()){var d=f.getX(),l=d.umod(this.n);if(0!==l.cmpn(0)){var p=u.invm(this.n).mul(l.mul(e.getPrivate()).iadd(t));if(0!==(p=p.umod(this.n)).cmpn(0)){var g=(f.getY().isOdd()?1:0)|(0!==d.cmp(l)?2:0);return i.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),g^=1),new an({r:l,s:p,recoveryParam:g})}}}}}},pn.prototype.verify=function(t,e,r,i){t=this._truncateToN(new Lt(t,16)),r=this.keyFromPublic(r,i);var n=(e=new an(e,"hex")).r,s=e.s;if(n.cmpn(1)<0||n.cmp(this.n)>=0||s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var o,a=s.invm(this.n),c=a.mul(t).umod(this.n),h=a.mul(n).umod(this.n);return this.curve._maxwellTrick?!(o=this.g.jmulAdd(c,r.getPublic(),h)).isInfinity()&&o.eqXToP(n):!(o=this.g.mulAdd(c,r.getPublic(),h)).isInfinity()&&0===o.getX().umod(this.n).cmp(n)},pn.prototype.recoverPubKey=function(t,e,r,i){ln((3&r)===r,"The recovery param is more than two bits"),e=new an(e,i);var n=this.n,s=new Lt(t),o=e.r,a=e.s,c=1&r,h=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&h)throw new Error("Unable to find sencond key candinate");o=h?this.curve.pointFromX(o.add(this.curve.n),c):this.curve.pointFromX(o,c);var u=e.r.invm(n),f=n.sub(s).mul(u).umod(n),d=a.mul(u).umod(n);return this.g.mulAdd(f,o,d)},pn.prototype.getKeyRecoveryParam=function(t,e,r,i){if(null!==(e=new an(e,i)).recoveryParam)return e.recoveryParam;for(var n=0;n<4;n++){var s;try{s=this.recoverPubKey(t,e,n)}catch{continue}if(s.eq(r))return n}throw new Error("Unable to find valid recovery factor")};var mn=qi((function(t,e){var r=e;r.version="6.5.4",r.utils=Bi,r.rand=function(){throw new Error("unsupported")},r.curve=Yi,r.curves=Xi,r.ec=gn,r.eddsa=null})).ec;const bn=new Mt("signing-key/5.7.0");let vn=null;function yn(){return vn||(vn=new mn("secp256k1")),vn}class wn{constructor(t){Ce(this,"curve","secp256k1"),Ce(this,"privateKey",Ct(t)),32!==function(t){if("string"!=typeof t)t=Ct(t);else if(!Nt(t)||t.length%2)return null;return(t.length-2)/2}(this.privateKey)&&bn.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const e=yn().keyFromPrivate(Rt(this.privateKey));Ce(this,"publicKey","0x"+e.getPublic(!1,"hex")),Ce(this,"compressedPublicKey","0x"+e.getPublic(!0,"hex")),Ce(this,"_isSigningKey",!0)}_addPoint(t){const e=yn().keyFromPublic(Rt(this.publicKey)),r=yn().keyFromPublic(Rt(t));return"0x"+e.pub.add(r.pub).encodeCompressed("hex")}signDigest(t){const e=yn().keyFromPrivate(Rt(this.privateKey)),r=Rt(t);32!==r.length&&bn.throwArgumentError("bad digest length","digest",t);const i=e.sign(r,{canonical:!0});return kt({recoveryParam:i.recoveryParam,r:qt("0x"+i.r.toString(16),32),s:qt("0x"+i.s.toString(16),32)})}computeSharedSecret(t){const e=yn().keyFromPrivate(Rt(this.privateKey)),r=yn().keyFromPublic(Rt(_n(t)));return qt("0x"+e.derive(r.getPublic()).toString(16),32)}static isSigningKey(t){return!(!t||!t._isSigningKey)}}function _n(t,e){const r=Rt(t);if(32===r.length){const t=new wn(r);return e?"0x"+yn().keyFromPrivate(r).getPublic(!0,"hex"):t.publicKey}return 33===r.length?e?Ct(r):"0x"+yn().keyFromPublic(r).getPublic(!1,"hex"):65===r.length?e?"0x"+yn().keyFromPublic(r).getPublic(!0,"hex"):Ct(r):bn.throwArgumentError("invalid public or private key","key","[REDACTED]")}var An;function Mn(t,e){return function(t){return function(t){let e=null;if("string"!=typeof t&&xe.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==t.substring(0,2)&&(t="0x"+t),e=Re(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&xe.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==function(t){let e=(t=(t=t.toUpperCase()).substring(4)+t.substring(0,2)+"00").split("").map((t=>Ne[t])).join("");for(;e.length>=Oe;){let t=e.substring(0,Oe);e=parseInt(t,10)%97+e.substring(t.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}(t)&&xe.throwArgumentError("bad icap checksum","address",t),e=function(t){return new jt(t,36).toString(16)}(t.substring(4));e.length<40;)e="0"+e;e=Re("0x"+e)}else xe.throwArgumentError("invalid address","address",t);return e}(Tt(Dt(Tt(_n(t),1)),12))}(function(t,e){const r=kt(e),i={r:Rt(r.r),s:Rt(r.s)};return"0x"+yn().recoverPubKey(Rt(t),i,r.recoveryParam).encode("hex",!1)}(Rt(t),e))}new Mt("transactions/5.7.0"),function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"}(An||(An={}));var En=Object.defineProperty,In=Object.defineProperties,Sn=Object.getOwnPropertyDescriptors,Pn=Object.getOwnPropertySymbols,xn=Object.prototype.hasOwnProperty,Rn=Object.prototype.propertyIsEnumerable,Nn=(t,e,r)=>e in t?En(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;const On=t=>t?.split(":"),Cn=t=>{const e=t&&On(t);if(e)return t.includes("did:pkh:")?e[3]:e[1]},Tn=t=>{const e=t&&On(t);if(e)return e[2]+":"+e[3]},qn=t=>{const e=t&&On(t);if(e)return e.pop()};async function kn(t){const{cacao:e,projectId:r}=t,{s:i,p:n}=e,s=Dn(n,n.iss),o=qn(n.iss);return await async function(t,e,r,i,n,s){switch(r.t){case"eip191":return function(t,e,r){return Mn(Pe(e),r).toLowerCase()===t.toLowerCase()}(t,e,r.s);case"eip1271":return await async function(t,e,r,i,n,s){try{const o="0x1626ba7e",a="0000000000000000000000000000000000000000000000000000000000000040",c="0000000000000000000000000000000000000000000000000000000000000041",h=r.substring(2),u=o+Pe(e).substring(2)+a+c+h,f=await fetch(`${s||"https://rpc.walletconnect.org/v1"}/?chainId=${i}&projectId=${n}`,{method:"POST",body:JSON.stringify({id:Date.now()+Math.floor(1e3*Math.random()),jsonrpc:"2.0",method:"eth_call",params:[{to:t,data:u},"latest"]})}),{result:d}=await f.json();return!!d&&d.slice(0,o.length).toLowerCase()===o.toLowerCase()}catch(t){return console.error("isValidEip1271Signature: ",t),!1}}(t,e,r.s,i,n,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`)}}(o,s,i,Cn(n.iss),r)}const Dn=(t,e)=>{const r=`${t.domain} wants you to sign in with your Ethereum account:`,i=qn(e);if(!t.aud&&!t.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let n=t.statement||void 0;const s=`URI: ${t.aud||t.uri}`,o=`Version: ${t.version}`,a=`Chain ID: ${Cn(e)}`,c=`Nonce: ${t.nonce}`,h=`Issued At: ${t.iat}`,u=t.exp?`Expiration Time: ${t.exp}`:void 0,f=t.nbf?`Not Before: ${t.nbf}`:void 0,d=t.requestId?`Request ID: ${t.requestId}`:void 0,l=t.resources?`Resources:${t.resources.map((t=>`\n- ${t}`)).join("")}`:void 0,p=Kn(t.resources);return p&&(n=function(t="",e){Un(e);const r="I further authorize the stated URI to perform the following actions on my behalf: ";if(t.includes(r))return t;const i=[];let n=0;return Object.keys(e.att).forEach((t=>{const r=Object.keys(e.att[t]).map((t=>({ability:t.split("/")[0],action:t.split("/")[1]})));r.sort(((t,e)=>t.action.localeCompare(e.action)));const s={};r.forEach((t=>{s[t.ability]||(s[t.ability]=[]),s[t.ability].push(t.action)}));const o=Object.keys(s).map((e=>(n++,`(${n}) '${e}': '${s[e].join("', '")}' for '${t}'.`)));i.push(o.join(", ").replace(".,","."))})),`${t?t+" ":""}${r}${i.join(" ")}`}(n,zn(p))),[r,i,"",n,"",s,o,a,c,h,u,f,d,l].filter((t=>null!=t)).join("\n")};function Un(t){if(!t)throw new Error("No recap provided, value is undefined");if(!t.att)throw new Error("No `att` property found");const e=Object.keys(t.att);if(null==e||!e.length)throw new Error("No resources found in `att` property");e.forEach((e=>{const r=t.att[e];if(Array.isArray(r))throw new Error(`Resource must be an object: ${e}`);if("object"!=typeof r)throw new Error(`Resource must be an object: ${e}`);if(!Object.keys(r).length)throw new Error(`Resource object is empty: ${e}`);Object.keys(r).forEach((t=>{const e=r[t];if(!Array.isArray(e))throw new Error(`Ability limits ${t} must be an array of objects, found: ${e}`);if(!e.length)throw new Error(`Value of ${t} is empty array, must be an array with objects`);e.forEach((e=>{if("object"!=typeof e)throw new Error(`Ability limits (${t}) must be an array of objects, found: ${e}`)}))}))}))}function Bn(t,e,r={}){e=e?.sort(((t,e)=>t.localeCompare(e)));const i=e.map((e=>({[`${t}/${e}`]:[r]})));return Object.assign({},...i)}function Ln(t){return Un(t),`urn:recap:${function(t){return N.from(JSON.stringify(t)).toString("base64")}(t).replace(/=/g,"")}`}function zn(t){const e=function(t){return JSON.parse(N.from(t,"base64").toString("utf-8"))}(t.replace("urn:recap:",""));return Un(e),e}function jn(t,e){const r=function(t,e){Un(t),Un(e);const r=Object.keys(t.att).concat(Object.keys(e.att)).sort(((t,e)=>t.localeCompare(e))),i={att:{}};return r.forEach((r=>{var n,s;Object.keys((null==(n=t.att)?void 0:n[r])||{}).concat(Object.keys((null==(s=e.att)?void 0:s[r])||{})).sort(((t,e)=>t.localeCompare(e))).forEach((n=>{var s,o;i.att[r]=((t,e)=>In(t,Sn(e)))(((t,e)=>{for(var r in e||(e={}))xn.call(e,r)&&Nn(t,r,e[r]);if(Pn)for(var r of Pn(e))Rn.call(e,r)&&Nn(t,r,e[r]);return t})({},i.att[r]),{[n]:(null==(s=t.att[r])?void 0:s[n])||(null==(o=e.att[r])?void 0:o[n])})}))})),i}(zn(t),zn(e));return Ln(r)}function Fn(t){var e;const r=zn(t);Un(r);const i=null==(e=r.att)?void 0:e.eip155;return i?Object.keys(i).map((t=>t.split("/")[1])):[]}function Hn(t){const e=zn(t);Un(e);const r=[];return Object.values(e.att).forEach((t=>{Object.values(t).forEach((t=>{var e;null!=(e=t?.[0])&&e.chains&&r.push(t[0].chains)}))})),[...new Set(r.flat())]}function Kn(t){if(!t)return;const e=t?.[t.length-1];return function(t){return t&&t.includes("urn:recap:")}(e)?e:void 0}const $n="base10",Vn="base16",Jn="base64pad",Gn="base64url",Qn="utf8";function Wn(){const t=(0,d.randomBytes)(32);return(0,g.dI)(t,Vn)}function Yn(t){const e=(0,l.tW)((0,g.sH)(t,Vn));return(0,g.dI)(e,Vn)}function Xn(t){const e=(0,l.tW)((0,g.sH)(t,Qn));return(0,g.dI)(e,Vn)}function Zn(t){return(0,g.sH)(`${t}`,$n)}function ts(t){return Number((0,g.dI)(t,$n))}function es(t){const{encoding:e=Jn}=t;if(2===ts(t.type))return(0,g.dI)((0,g.xW)([t.type,t.sealed]),e);if(1===ts(t.type)){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return(0,g.dI)((0,g.xW)([t.type,t.senderPublicKey,t.iv,t.sealed]),e)}return(0,g.dI)((0,g.xW)([t.type,t.iv,t.sealed]),e)}function rs(t){const{encoded:e,encoding:r=Jn}=t,i=(0,g.sH)(e,r),n=i.slice(0,1);if(1===ts(n)){const t=33,e=t+12,r=i.slice(1,t),s=i.slice(t,e);return{type:n,sealed:i.slice(e),iv:s,senderPublicKey:r}}if(2===ts(n))return{type:n,sealed:i.slice(1),iv:(0,d.randomBytes)(12)};const s=i.slice(1,13);return{type:n,sealed:i.slice(13),iv:s}}function is(t){const e=t?.type||0;if(1===e){if(typeof t?.senderPublicKey>"u")throw new Error("missing sender public key");if(typeof t?.receiverPublicKey>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:t?.senderPublicKey,receiverPublicKey:t?.receiverPublicKey}}function ns(t){return 1===t.type&&"string"==typeof t.senderPublicKey&&"string"==typeof t.receiverPublicKey}function ss(t){return 2===t.type}function os(t,e){const[r,i,n]=t.split("."),s=function(t){return N.from(function(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");const r=e.length%4;return r>0&&(e+="=".repeat(4-r)),e}(t),"base64")}(n);if(64!==s.length)throw new Error("Invalid signature length");const o=s.slice(0,32).toString("hex"),a=s.slice(32,64).toString("hex"),c=`${r}.${i}`,h=(new l.aD).update(N.from(c)).digest(),u=function(t){return new m.ec("p256").keyFromPublic({x:N.from(t.x,"base64").toString("hex"),y:N.from(t.y,"base64").toString("hex")},"hex")}(e),f=N.from(h).toString("hex");if(!u.verify(f,{r:o,s:a}))throw new Error("Invalid signature");return function(t){const e=t.split(".");return{header:P(e[0]),payload:P(e[1]),signature:E(e[2],S),data:E(e.slice(0,2).join("."),"utf8")}}(t).payload}function as(t){return t?.relay||{protocol:"irn"}}function cs(t){const e=x.CG[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var hs=Object.defineProperty,us=Object.defineProperties,fs=Object.getOwnPropertyDescriptors,ds=Object.getOwnPropertySymbols,ls=Object.prototype.hasOwnProperty,ps=Object.prototype.propertyIsEnumerable,gs=(t,e,r)=>e in t?hs(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ms=(t,e)=>{for(var r in e||(e={}))ls.call(e,r)&&gs(t,r,e[r]);if(ds)for(var r of ds(e))ps.call(e,r)&&gs(t,r,e[r]);return t};function bs(t,e="-"){const r={},i="relay"+e;return Object.keys(t).forEach((e=>{if(e.startsWith(i)){const n=e.replace(i,""),s=t[e];r[n]=s}})),r}function vs(t){if(!t.includes("wc:")){const e=ht(t);null!=e&&e.includes("wc:")&&(t=e)}const e=(t=(t=t.includes("wc://")?t.replace("wc://",""):t).includes("wc:")?t.replace("wc:",""):t).indexOf(":"),r=-1!==t.indexOf("?")?t.indexOf("?"):void 0,i=t.substring(0,e),n=t.substring(e+1,r).split("@"),s=typeof r<"u"?t.substring(r):"",o=h.parse(s),a="string"==typeof o.methods?o.methods.split(","):void 0;return{protocol:i,topic:ys(n[0]),version:parseInt(n[1],10),symKey:o.symKey,relay:bs(o),methods:a,expiryTimestamp:o.expiryTimestamp?parseInt(o.expiryTimestamp,10):void 0}}function ys(t){return t.startsWith("//")?t.substring(2):t}function ws(t){return`${t.protocol}:${t.topic}@${t.version}?`+h.stringify(ms(((t,e)=>us(t,fs(e)))(ms({symKey:t.symKey},function(t,e="-"){const r={};return Object.keys(t).forEach((i=>{const n="relay"+e+i;t[i]&&(r[n]=t[i])})),r}(t.relay)),{expiryTimestamp:t.expiryTimestamp}),t.methods?{methods:t.methods.join(",")}:{}))}function _s(t,e,r){return`${t}?wc_ev=${r}&topic=${e}`}function As(t){const e=[];return t.forEach((t=>{const[r,i]=t.split(":");e.push(`${r}:${i}`)})),e}function Ms(t){return t.includes(":")}function Es(t){return Ms(t)?t.split(":")[0]:t}function Is(t,e){const r=function(t){const e={};return t?.forEach((t=>{const[r,i]=t.split(":");e[r]||(e[r]={accounts:[],chains:[],events:[]}),e[r].accounts.push(t),e[r].chains.push(`${r}:${i}`)})),e}(e=e.map((t=>t.replace("did:pkh:",""))));for(const[e,i]of Object.entries(r))i.methods?i.methods=st(i.methods,t):i.methods=t,i.events=["chainChanged","accountsChanged"];return r}Object.defineProperty,Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;const Ss={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},Ps={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function xs(t,e){const{message:r,code:i}=Ps[t];return{message:e?`${r} ${e}`:r,code:i}}function Rs(t,e){const{message:r,code:i}=Ss[t];return{message:e?`${r} ${e}`:r,code:i}}function Ns(t,e){return!!Array.isArray(t)&&(!(typeof e<"u"&&t.length)||t.every(e))}function Os(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function Cs(t){return typeof t>"u"}function Ts(t,e){return!(!e||!Cs(t))||"string"==typeof t&&!!t.trim().length}function qs(t,e){return!(!e||!Cs(t))||"number"==typeof t&&!isNaN(t)}function ks(t){return!(!Ts(t,!1)||!t.includes(":"))&&2===t.split(":").length}function Ds(t){let e=!0;return Ns(t)?t.length&&(e=t.every((t=>Ts(t,!1)))):e=!1,e}function Us(t,e){let r=null;return Object.values(t).forEach((t=>{if(r)return;const i=function(t,e){let r=null;return Ds(t?.methods)?Ds(t?.events)||(r=Rs("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=Rs("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}(t,`${e}, namespace`);i&&(r=i)})),r}function Bs(t,e){let r=null;if(t&&Os(t)){const i=Us(t,e);i&&(r=i);const n=function(t,e){let r=null;return Object.values(t).forEach((t=>{if(r)return;const i=function(t,e){let r=null;return Ns(t)?t.forEach((t=>{r||function(t){if(Ts(t,!1)&&t.includes(":")){const e=t.split(":");if(3===e.length){const t=e[0]+":"+e[1];return!!e[2]&&ks(t)}}return!1}(t)||(r=Rs("UNSUPPORTED_ACCOUNTS",`${e}, account ${t} should be a string and conform to "namespace:chainId:address" format`))})):r=Rs("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}(t?.accounts,`${e} namespace`);i&&(r=i)})),r}(t,e);n&&(r=n)}else r=xs("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function Ls(t){return Ts(t.protocol,!0)}function zs(t){return typeof t<"u"&&null!==typeof t}function js(t,e){return!(!ks(e)||!function(t){const e=[];return Object.values(t).forEach((t=>{e.push(...As(t.accounts))})),e}(t).includes(e))}function Fs(t,e,r){let i=null;const n=function(t){const e={};return Object.keys(t).forEach((r=>{var i;r.includes(":")?e[r]=t[r]:null==(i=t[r].chains)||i.forEach((i=>{e[i]={methods:t[r].methods,events:t[r].events}}))})),e}(t),s=function(t){const e={};return Object.keys(t).forEach((r=>{if(r.includes(":"))e[r]=t[r];else{const i=As(t[r].accounts);i?.forEach((i=>{e[i]={accounts:t[r].accounts.filter((t=>t.includes(`${i}:`))),methods:t[r].methods,events:t[r].events}}))}})),e}(e),o=Object.keys(n),a=Object.keys(s),c=Hs(Object.keys(t)),h=Hs(Object.keys(e)),u=c.filter((t=>!h.includes(t)));return u.length&&(i=xs("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces.\n Required: ${u.toString()}\n Received: ${Object.keys(e).toString()}`)),Q(o,a)||(i=xs("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces.\n Required: ${o.toString()}\n Approved: ${a.toString()}`)),Object.keys(e).forEach((t=>{if(!t.includes(":")||i)return;const n=As(e[t].accounts);n.includes(t)||(i=xs("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${t}\n Required: ${t}\n Approved: ${n.toString()}`))})),o.forEach((t=>{i||(Q(n[t].methods,s[t].methods)?Q(n[t].events,s[t].events)||(i=xs("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${t}`)):i=xs("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${t}`))})),i}function Hs(t){return[...new Set(t.map((t=>t.includes(":")?t.split(":")[0]:t)))]}function Ks(){const t=V();return new Promise((e=>{switch(t){case j:e($()&&navigator?.onLine);break;case z:e(async function(){if(K()&&typeof r.g<"u"&&null!=r.g&&r.g.NetInfo){const t=await(null==r.g?void 0:r.g.NetInfo.fetch());return t?.isConnected}return!0}());break;default:e(!0)}}))}const $s={};class Vs{static get(t){return $s[t]}static set(t,e){$s[t]=e}static delete(t){delete $s[t]}}var Js=r(37147),Gs=r(13338),Qs=r(70255),Ws=r(94549);class Ys extends Ws.H{constructor(t){super(),this.opts=t,this.protocol="wc",this.version=2}}class Xs extends Ws.H{constructor(t,e){super(),this.core=t,this.logger=e,this.records=new Map}}class Zs{constructor(t,e){this.logger=t,this.core=e}}class to extends Ws.H{constructor(t,e){super(),this.relayer=t,this.logger=e}}class eo extends Ws.H{constructor(t){super()}}class ro{constructor(t,e,r,i){this.core=t,this.logger=e,this.name=r}}class io extends Ws.H{constructor(t,e){super(),this.relayer=t,this.logger=e}}class no extends Ws.H{constructor(t,e){super(),this.core=t,this.logger=e}}class so{constructor(t,e,r){this.core=t,this.logger=e,this.store=r}}class oo{constructor(t,e){this.projectId=t,this.logger=e}}class ao{constructor(t,e,r){this.core=t,this.logger=e,this.telemetryEnabled=r}}n();class co{constructor(t){this.opts=t,this.protocol="wc",this.version=2}}i.EventEmitter;class ho{constructor(t){this.client=t}}const uo=".",fo="base64url",lo="utf8",po="utf8",go="did",mo="key",bo="base58btc";function vo(t){return null!=globalThis.Buffer?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function yo(t=0){return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?vo(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function wo(t,e,r,i){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:i}}}const _o=wo("utf8","u",(t=>"u"+new TextDecoder("utf8").decode(t)),(t=>(new TextEncoder).encode(t.substring(1)))),Ao=wo("ascii","a",(t=>{let e="a";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e}),(t=>{const e=yo((t=t.substring(1)).length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e})),Mo={utf8:_o,"utf-8":_o,hex:v.Fo.base16,latin1:Ao,ascii:Ao,binary:Ao,...v.Fo};function Eo(t,e="utf8"){const r=Mo[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return"utf8"!==e&&"utf-8"!==e||null==globalThis.Buffer||null==globalThis.Buffer.from?r.encoder.encode(t).substring(1):globalThis.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("utf8")}function Io(t,e="utf8"){const r=Mo[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return"utf8"!==e&&"utf-8"!==e||null==globalThis.Buffer||null==globalThis.Buffer.from?r.decoder.decode(`${r.prefix}${t}`):vo(globalThis.Buffer.from(t,"utf-8"))}function So(t){return(0,I.j)(Eo(Io(t,fo),lo))}function Po(t){return Eo(Io((0,I.h)(t),lo),fo)}function xo(t){const e="z"+Eo(function(t,e){e||(e=t.reduce(((t,e)=>t+e.length),0));const r=yo(e);let i=0;for(const e of t)r.set(e,i),i+=e.length;return vo(r)}([Io("K36",bo),t]),bo);return[go,mo,e].join(":")}function Ro(t){const e=t.split(uo);return{header:So(e[0]),payload:So(e[1]),signature:Io(e[2],fo),data:Io(e.slice(0,2).join(uo),po)}}function No(t=(0,d.randomBytes)(32)){return b.K(t)}r(18837);var Oo=r(93786),Co=r(14350);const To=t=>t.split("?")[0],qo=typeof WebSocket<"u"?WebSocket:typeof r.g<"u"&&typeof r.g.WebSocket<"u"?r.g.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:r(38236);class ko{constructor(t){if(this.url=t,this.events=new i.EventEmitter,this.registering=!1,!(0,Co.isWsUrl)(t))throw new Error(`Provided URL is not compatible with WebSocket connection: ${t}`);this.url=t}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(t,e){this.events.on(t,e)}once(t,e){this.events.once(t,e)}off(t,e){this.events.off(t,e)}removeListener(t,e){this.events.removeListener(t,e)}async open(t=this.url){await this.register(t)}async close(){return new Promise(((t,e)=>{typeof this.socket>"u"?e(new Error("Connection already closed")):(this.socket.onclose=e=>{this.onClose(e),t()},this.socket.close())}))}async send(t){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send((0,I.h)(t))}catch(e){this.onError(t.id,e)}}register(t=this.url){if(!(0,Co.isWsUrl)(t))throw new Error(`Provided URL is not compatible with WebSocket connection: ${t}`);if(this.registering){const t=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=t||this.events.listenerCount("open")>=t)&&this.events.setMaxListeners(t+1),new Promise(((t,e)=>{this.events.once("register_error",(t=>{this.resetMaxListeners(),e(t)})),this.events.once("open",(()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return e(new Error("WebSocket connection is missing or invalid"));t(this.socket)}))}))}return this.url=t,this.registering=!0,new Promise(((e,i)=>{const n=new URLSearchParams(t).get("origin"),s=(0,Co.isReactNative)()?{headers:{origin:n}}:{rejectUnauthorized:!(0,Co.isLocalhostUrl)(t)},o=new qo(t,[],s);typeof WebSocket<"u"||typeof r.g<"u"&&typeof r.g.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u"?o.onerror=t=>{const e=t;i(this.emitError(e.error))}:o.on("error",(t=>{i(this.emitError(t))})),o.onopen=()=>{this.onOpen(o),e(o)}}))}onOpen(t){t.onmessage=t=>this.onPayload(t),t.onclose=t=>this.onClose(t),this.socket=t,this.registering=!1,this.events.emit("open")}onClose(t){this.socket=void 0,this.registering=!1,this.events.emit("close",t)}onPayload(t){if(typeof t.data>"u")return;const e="string"==typeof t.data?(0,I.j)(t.data):t.data;this.events.emit("payload",e)}onError(t,e){const r=this.parseError(e),i=r.message||r.toString(),n=(0,Co.formatJsonRpcError)(t,i);this.events.emit("payload",n)}parseError(t,e=this.url){return(0,Co.parseConnectionError)(t,To(e),"WS")}resetMaxListeners(){this.events.getMaxListeners()>10&&this.events.setMaxListeners(10)}emitError(t){const e=this.parseError(new Error(t?.message||`WebSocket connection failed for host: ${To(this.url)}`));return this.events.emit("register_error",e),e}}var Do=r(18677),Uo=r.n(Do);const Bo="core",Lo=`wc@2:${Bo}:`,zo={database:":memory:"},jo="client_ed25519_seed",Fo=o.ONE_DAY,Ho=o.SIX_HOURS,Ko="wss://relay.walletconnect.org",$o="relayer_message",Vo="relayer_message_ack",Jo="relayer_connection_stalled",Go="relayer_publish",Qo="payload",Wo="connect",Yo="disconnect",Xo="error",Zo="2.17.0",ta={link_mode:"link_mode",relay:"relay"},ea="WALLETCONNECT_LINK_MODE_APPS",ra="subscription_created",ia="subscription_deleted",na=1e3*o.FIVE_SECONDS,sa={wc_pairingDelete:{req:{ttl:o.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:o.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:o.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:o.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:o.ONE_DAY,prompt:!1,tag:0},res:{ttl:o.ONE_DAY,prompt:!1,tag:0}}},oa="pairing_create",aa="pairing_delete",ca="history_created",ha="history_updated",ua="history_deleted",fa="expirer_created",da="expirer_deleted",la="expirer_expired",pa="https://verify.walletconnect.org",ga=pa,ma=`${ga}/v3`,ba=["https://verify.walletconnect.com",pa],va="malformed_pairing_uri",ya="session_approve_started";var wa=function(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),i=0;i<r.length;i++)r[i]=255;for(var n=0;n<t.length;n++){var s=t.charAt(n),o=s.charCodeAt(0);if(255!==r[o])throw new TypeError(s+" is ambiguous");r[o]=n}var a=t.length,c=t.charAt(0),h=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function f(t){if("string"!=typeof t)throw new TypeError("Expected String");if(0===t.length)return new Uint8Array;var e=0;if(" "!==t[e]){for(var i=0,n=0;t[e]===c;)i++,e++;for(var s=(t.length-e)*h+1>>>0,o=new Uint8Array(s);t[e];){var u=r[t.charCodeAt(e)];if(255===u)return;for(var f=0,d=s-1;(0!==u||f<n)&&-1!==d;d--,f++)u+=a*o[d]>>>0,o[d]=u%256>>>0,u=u/256>>>0;if(0!==u)throw new Error("Non-zero carry");n=f,e++}if(" "!==t[e]){for(var l=s-n;l!==s&&0===o[l];)l++;for(var p=new Uint8Array(i+(s-l)),g=i;l!==s;)p[g++]=o[l++];return p}}}return{encode:function(e){if(e instanceof Uint8Array||(ArrayBuffer.isView(e)?e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength):Array.isArray(e)&&(e=Uint8Array.from(e))),!(e instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===e.length)return"";for(var r=0,i=0,n=0,s=e.length;n!==s&&0===e[n];)n++,r++;for(var o=(s-n)*u+1>>>0,h=new Uint8Array(o);n!==s;){for(var f=e[n],d=0,l=o-1;(0!==f||d<i)&&-1!==l;l--,d++)f+=256*h[l]>>>0,h[l]=f%a>>>0,f=f/a>>>0;if(0!==f)throw new Error("Non-zero carry");i=d,n++}for(var p=o-i;p!==o&&0===h[p];)p++;for(var g=c.repeat(r);p<o;++p)g+=t.charAt(h[p]);return g},decodeUnsafe:f,decode:function(t){var r=f(t);if(r)return r;throw new Error(`Non-${e} character`)}}};const _a=t=>{if(t instanceof Uint8Array&&"Uint8Array"===t.constructor.name)return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")};class Aa{constructor(t,e,r){this.name=t,this.prefix=e,this.baseEncode=r}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}}class Ma{constructor(t,e,r){if(this.name=t,this.prefix=e,void 0===e.codePointAt(0))throw new Error("Invalid prefix character");this.prefixCodePoint=e.codePointAt(0),this.baseDecode=r}decode(t){if("string"==typeof t){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(t){return Ia(this,t)}}class Ea{constructor(t){this.decoders=t}or(t){return Ia(this,t)}decode(t){const e=t[0],r=this.decoders[e];if(r)return r.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const Ia=(t,e)=>new Ea({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class Sa{constructor(t,e,r,i){this.name=t,this.prefix=e,this.baseEncode=r,this.baseDecode=i,this.encoder=new Aa(t,e,r),this.decoder=new Ma(t,e,i)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}}const Pa=({name:t,prefix:e,encode:r,decode:i})=>new Sa(t,e,r,i),xa=({prefix:t,name:e,alphabet:r})=>{const{encode:i,decode:n}=wa(r,e);return Pa({prefix:t,name:e,encode:i,decode:t=>_a(n(t))})},Ra=({name:t,prefix:e,bitsPerChar:r,alphabet:i})=>Pa({prefix:e,name:t,encode:t=>((t,e,r)=>{const i="="===e[e.length-1],n=(1<<r)-1;let s="",o=0,a=0;for(let i=0;i<t.length;++i)for(a=a<<8|t[i],o+=8;o>r;)o-=r,s+=e[n&a>>o];if(o&&(s+=e[n&a<<r-o]),i)for(;s.length*r&7;)s+="=";return s})(t,i,r),decode:e=>((t,e,r,i)=>{const n={};for(let t=0;t<e.length;++t)n[e[t]]=t;let s=t.length;for(;"="===t[s-1];)--s;const o=new Uint8Array(s*r/8|0);let a=0,c=0,h=0;for(let e=0;e<s;++e){const s=n[t[e]];if(void 0===s)throw new SyntaxError(`Non-${i} character`);c=c<<r|s,a+=r,a>=8&&(a-=8,o[h++]=255&c>>a)}if(a>=r||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return o})(e,i,r,t)}),Na=Pa({prefix:"\0",name:"identity",encode:t=>(t=>(new TextDecoder).decode(t))(t),decode:t=>(t=>(new TextEncoder).encode(t))(t)});var Oa=Object.freeze({__proto__:null,identity:Na});const Ca=Ra({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Ta=Object.freeze({__proto__:null,base2:Ca});const qa=Ra({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var ka=Object.freeze({__proto__:null,base8:qa});const Da=xa({prefix:"9",name:"base10",alphabet:"0123456789"});var Ua=Object.freeze({__proto__:null,base10:Da});const Ba=Ra({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),La=Ra({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var za=Object.freeze({__proto__:null,base16:Ba,base16upper:La});const ja=Ra({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Fa=Ra({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Ha=Ra({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Ka=Ra({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),$a=Ra({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Va=Ra({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Ja=Ra({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Ga=Ra({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Qa=Ra({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Wa=Object.freeze({__proto__:null,base32:ja,base32upper:Fa,base32pad:Ha,base32padupper:Ka,base32hex:$a,base32hexupper:Va,base32hexpad:Ja,base32hexpadupper:Ga,base32z:Qa});const Ya=xa({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Xa=xa({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Za=Object.freeze({__proto__:null,base36:Ya,base36upper:Xa});const tc=xa({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),ec=xa({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var rc=Object.freeze({__proto__:null,base58btc:tc,base58flickr:ec});const ic=Ra({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),nc=Ra({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),sc=Ra({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),oc=Ra({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var ac=Object.freeze({__proto__:null,base64:ic,base64pad:nc,base64url:sc,base64urlpad:oc});const cc=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),hc=cc.reduce(((t,e,r)=>(t[r]=e,t)),[]),uc=cc.reduce(((t,e,r)=>(t[e.codePointAt(0)]=r,t)),[]),fc=Pa({prefix:"🚀",name:"base256emoji",encode:function(t){return t.reduce(((t,e)=>t+hc[e]),"")},decode:function(t){const e=[];for(const r of t){const t=uc[r.codePointAt(0)];if(void 0===t)throw new Error(`Non-base256emoji character: ${r}`);e.push(t)}return new Uint8Array(e)}});var dc=Object.freeze({__proto__:null,base256emoji:fc}),lc=128,pc=-128,gc=Math.pow(2,31),mc=Math.pow(2,7),bc=Math.pow(2,14),vc=Math.pow(2,21),yc=Math.pow(2,28),wc=Math.pow(2,35),_c=Math.pow(2,42),Ac=Math.pow(2,49),Mc=Math.pow(2,56),Ec=Math.pow(2,63),Ic=function t(e,r,i){r=r||[];for(var n=i=i||0;e>=gc;)r[i++]=255&e|lc,e/=128;for(;e&pc;)r[i++]=255&e|lc,e>>>=7;return r[i]=0|e,t.bytes=i-n+1,r},Sc=function(t){return t<mc?1:t<bc?2:t<vc?3:t<yc?4:t<wc?5:t<_c?6:t<Ac?7:t<Mc?8:t<Ec?9:10};const Pc=(t,e,r=0)=>(Ic(t,e,r),e),xc=t=>Sc(t),Rc=(t,e)=>{const r=e.byteLength,i=xc(t),n=i+xc(r),s=new Uint8Array(n+r);return Pc(t,s,0),Pc(r,s,i),s.set(e,n),new Nc(t,r,e,s)};class Nc{constructor(t,e,r,i){this.code=t,this.size=e,this.digest=r,this.bytes=i}}const Oc=({name:t,code:e,encode:r})=>new Cc(t,e,r);class Cc{constructor(t,e,r){this.name=t,this.code=e,this.encode=r}digest(t){if(t instanceof Uint8Array){const e=this.encode(t);return e instanceof Uint8Array?Rc(this.code,e):e.then((t=>Rc(this.code,t)))}throw Error("Unknown type, must be binary type")}}const Tc=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),qc=Oc({name:"sha2-256",code:18,encode:Tc("SHA-256")}),kc=Oc({name:"sha2-512",code:19,encode:Tc("SHA-512")});Object.freeze({__proto__:null,sha256:qc,sha512:kc});const Dc=_a,Uc={code:0,name:"identity",encode:Dc,digest:t=>Rc(0,Dc(t))};Object.freeze({__proto__:null,identity:Uc}),new TextEncoder,new TextDecoder;const Bc={...Oa,...Ta,...ka,...Ua,...za,...Wa,...Za,...rc,...ac,...dc};function Lc(t,e,r,i){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:i}}}const zc=Lc("utf8","u",(t=>"u"+new TextDecoder("utf8").decode(t)),(t=>(new TextEncoder).encode(t.substring(1)))),jc=Lc("ascii","a",(t=>{let e="a";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e}),(t=>{const e=function(t=0){return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}((t=t.substring(1)).length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e})),Fc={utf8:zc,"utf-8":zc,hex:Bc.base16,latin1:jc,ascii:jc,binary:jc,...Bc};class Hc{constructor(t,e){this.core=t,this.logger=e,this.keychain=new Map,this.name="keychain",this.version="0.3",this.initialized=!1,this.storagePrefix=Lo,this.init=async()=>{if(!this.initialized){const t=await this.getKeyChain();typeof t<"u"&&(this.keychain=t),this.initialized=!0}},this.has=t=>(this.isInitialized(),this.keychain.has(t)),this.set=async(t,e)=>{this.isInitialized(),this.keychain.set(t,e),await this.persist()},this.get=t=>{this.isInitialized();const e=this.keychain.get(t);if(typeof e>"u"){const{message:e}=xs("NO_MATCHING_KEY",`${this.name}: ${t}`);throw new Error(e)}return e},this.del=async t=>{this.isInitialized(),this.keychain.delete(t),await this.persist()},this.core=t,this.logger=(0,Qs.U5)(e,this.name)}get context(){return(0,Qs.oI)(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(t){await this.core.storage.setItem(this.storageKey,W(t))}async getKeyChain(){const t=await this.core.storage.getItem(this.storageKey);return typeof t<"u"?Y(t):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:t}=xs("NOT_INITIALIZED",this.name);throw new Error(t)}}}class Kc{constructor(t,e,r){this.core=t,this.logger=e,this.name="crypto",this.randomSessionIdentifier=Wn(),this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=t=>(this.isInitialized(),this.keychain.has(t)),this.getClientId=async()=>(this.isInitialized(),xo(No(await this.getClientSeed()).publicKey)),this.generateKeyPair=()=>{this.isInitialized();const t=function(){const t=p.TZ();return{privateKey:(0,g.dI)(t.secretKey,Vn),publicKey:(0,g.dI)(t.publicKey,Vn)}}();return this.setPrivateKey(t.publicKey,t.privateKey)},this.signJWT=async t=>{this.isInitialized();const e=No(await this.getClientSeed()),r=this.randomSessionIdentifier,i=Fo;return await async function(t,e,r,i,n=(0,o.fromMiliseconds)(Date.now())){const s={alg:"EdDSA",typ:"JWT"},a={iss:xo(i.publicKey),sub:t,aud:e,iat:n,exp:n+r},c=Io([Po((h={header:s,payload:a}).header),Po(h.payload)].join(uo),po);var h;return function(t){return[Po(t.header),Po(t.payload),(e=t.signature,Eo(e,fo))].join(uo);var e}({header:s,payload:a,signature:b._S(i.secretKey,c)})}(r,t,i,e)},this.generateSharedKey=(t,e,r)=>{this.isInitialized();const i=function(t,e){const r=p.Tc((0,g.sH)(t,Vn),(0,g.sH)(e,Vn),!0),i=new f.i(l.aD,r).expand(32);return(0,g.dI)(i,Vn)}(this.getPrivateKey(t),e);return this.setSymKey(i,r)},this.setSymKey=async(t,e)=>{this.isInitialized();const r=e||Yn(t);return await this.keychain.set(r,t),r},this.deleteKeyPair=async t=>{this.isInitialized(),await this.keychain.del(t)},this.deleteSymKey=async t=>{this.isInitialized(),await this.keychain.del(t)},this.encode=async(t,e,r)=>{this.isInitialized();const i=is(r),n=(0,I.h)(e);if(ss(i))return function(t,e){const r=Zn(2),i=(0,d.randomBytes)(12);return es({type:r,sealed:(0,g.sH)(t,Qn),iv:i,encoding:e})}(n,r?.encoding);if(ns(i)){const e=i.senderPublicKey,r=i.receiverPublicKey;t=await this.generateSharedKey(e,r)}const s=this.getSymKey(t),{type:o,senderPublicKey:a}=i;return function(t){const e=Zn(typeof t.type<"u"?t.type:0);if(1===ts(e)&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const r=typeof t.senderPublicKey<"u"?(0,g.sH)(t.senderPublicKey,Vn):void 0,i=typeof t.iv<"u"?(0,g.sH)(t.iv,Vn):(0,d.randomBytes)(12);return es({type:e,sealed:new u.g6((0,g.sH)(t.symKey,Vn)).seal(i,(0,g.sH)(t.message,Qn)),iv:i,senderPublicKey:r,encoding:t.encoding})}({type:o,symKey:s,message:n,senderPublicKey:a,encoding:r?.encoding})},this.decode=async(t,e,r)=>{this.isInitialized();const i=function(t,e){const r=rs({encoded:t,encoding:e?.encoding});return is({type:ts(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?(0,g.dI)(r.senderPublicKey,Vn):void 0,receiverPublicKey:e?.receiverPublicKey})}(e,r);if(ss(i)){const t=function(t,e){const{sealed:r}=rs({encoded:t,encoding:e});return(0,g.dI)(r,Qn)}(e,r?.encoding);return(0,I.j)(t)}if(ns(i)){const e=i.receiverPublicKey,r=i.senderPublicKey;t=await this.generateSharedKey(e,r)}try{const i=function(t){const e=new u.g6((0,g.sH)(t.symKey,Vn)),{sealed:r,iv:i}=rs({encoded:t.encoded,encoding:t?.encoding}),n=e.open(i,r);if(null===n)throw new Error("Failed to decrypt");return(0,g.dI)(n,Qn)}({symKey:this.getSymKey(t),encoded:e,encoding:r?.encoding});return(0,I.j)(i)}catch(e){this.logger.error(`Failed to decode message from topic: '${t}', clientId: '${await this.getClientId()}'`),this.logger.error(e)}},this.getPayloadType=(t,e=Jn)=>ts(rs({encoded:t,encoding:e}).type),this.getPayloadSenderPublicKey=(t,e=Jn)=>{const r=rs({encoded:t,encoding:e});return r.senderPublicKey?(0,g.dI)(r.senderPublicKey,Vn):void 0},this.core=t,this.logger=(0,Qs.U5)(e,this.name),this.keychain=r||new Hc(this.core,this.logger)}get context(){return(0,Qs.oI)(this.logger)}async setPrivateKey(t,e){return await this.keychain.set(t,e),t}getPrivateKey(t){return this.keychain.get(t)}async getClientSeed(){let t="";try{t=this.keychain.get(jo)}catch{t=Wn(),await this.keychain.set(jo,t)}return function(t,e="utf8"){const r=Fc[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return"utf8"!==e&&"utf-8"!==e||null==globalThis.Buffer||null==globalThis.Buffer.from?r.decoder.decode(`${r.prefix}${t}`):globalThis.Buffer.from(t,"utf8")}(t,"base16")}getSymKey(t){return this.keychain.get(t)}isInitialized(){if(!this.initialized){const{message:t}=xs("NOT_INITIALIZED",this.name);throw new Error(t)}}}class $c extends Zs{constructor(t,e){super(t,e),this.logger=t,this.core=e,this.messages=new Map,this.name="messages",this.version="0.3",this.initialized=!1,this.storagePrefix=Lo,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const t=await this.getRelayerMessages();typeof t<"u"&&(this.messages=t),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(t){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(t)}finally{this.initialized=!0}}},this.set=async(t,e)=>{this.isInitialized();const r=Xn(e);let i=this.messages.get(t);return typeof i>"u"&&(i={}),typeof i[r]<"u"||(i[r]=e,this.messages.set(t,i),await this.persist()),r},this.get=t=>{this.isInitialized();let e=this.messages.get(t);return typeof e>"u"&&(e={}),e},this.has=(t,e)=>(this.isInitialized(),typeof this.get(t)[Xn(e)]<"u"),this.del=async t=>{this.isInitialized(),this.messages.delete(t),await this.persist()},this.logger=(0,Qs.U5)(t,this.name),this.core=e}get context(){return(0,Qs.oI)(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(t){await this.core.storage.setItem(this.storageKey,W(t))}async getRelayerMessages(){const t=await this.core.storage.getItem(this.storageKey);return typeof t<"u"?Y(t):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:t}=xs("NOT_INITIALIZED",this.name);throw new Error(t)}}}class Vc extends to{constructor(t,e){super(t,e),this.relayer=t,this.logger=e,this.events=new i.EventEmitter,this.name="publisher",this.queue=new Map,this.publishTimeout=(0,o.toMiliseconds)(o.ONE_MINUTE),this.failedPublishTimeout=(0,o.toMiliseconds)(o.ONE_SECOND),this.needsTransportRestart=!1,this.publish=async(t,e,r)=>{var i;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:t,message:e,opts:r}});const n=r?.ttl||Ho,s=as(r),o=r?.prompt||!1,a=r?.tag||0,c=r?.id||(0,Co.getBigIntRpcId)().toString(),h={topic:t,message:e,opts:{ttl:n,relay:s,prompt:o,tag:a,id:c,attestation:r?.attestation}},u=`Failed to publish payload, please try again. id:${c} tag:${a}`,f=Date.now();let d,l=1;try{for(;void 0===d;){if(Date.now()-f>this.publishTimeout)throw new Error(u);this.logger.trace({id:c,attempts:l},`publisher.publish - attempt ${l}`),d=await await Z(this.rpcPublish(t,e,n,s,o,a,c,r?.attestation).catch((t=>this.logger.warn(t))),this.publishTimeout,u),l++,d||await new Promise((t=>setTimeout(t,this.failedPublishTimeout)))}this.relayer.events.emit(Go,h),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:c,topic:t,message:e,opts:r}})}catch(t){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(t),null!=(i=r?.internal)&&i.throwOnFailedPublish)throw t;this.queue.set(c,h)}},this.on=(t,e)=>{this.events.on(t,e)},this.once=(t,e)=>{this.events.once(t,e)},this.off=(t,e)=>{this.events.off(t,e)},this.removeListener=(t,e)=>{this.events.removeListener(t,e)},this.relayer=t,this.logger=(0,Qs.U5)(e,this.name),this.registerEventListeners()}get context(){return(0,Qs.oI)(this.logger)}rpcPublish(t,e,r,i,n,s,o,a){var c,h,u,f;const d={method:cs(i.protocol).publish,params:{topic:t,message:e,ttl:r,prompt:n,tag:s,attestation:a},id:o};return Cs(null==(c=d.params)?void 0:c.prompt)&&(null==(h=d.params)||delete h.prompt),Cs(null==(u=d.params)?void 0:u.tag)&&(null==(f=d.params)||delete f.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:d}),this.relayer.request(d)}removeRequestFromQueue(t){this.queue.delete(t)}checkQueue(){this.queue.forEach((async t=>{const{topic:e,message:r,opts:i}=t;await this.publish(e,r,i)}))}registerEventListeners(){this.relayer.core.heartbeat.on(Js.li.pulse,(()=>{if(this.needsTransportRestart)return this.needsTransportRestart=!1,void this.relayer.events.emit(Jo);this.checkQueue()})),this.relayer.on(Vo,(t=>{this.removeRequestFromQueue(t.id.toString())}))}}class Jc{constructor(){this.map=new Map,this.set=(t,e)=>{const r=this.get(t);this.exists(t,e)||this.map.set(t,[...r,e])},this.get=t=>this.map.get(t)||[],this.exists=(t,e)=>this.get(t).includes(e),this.delete=(t,e)=>{if(typeof e>"u")return void this.map.delete(t);if(!this.map.has(t))return;const r=this.get(t);if(!this.exists(t,e))return;const i=r.filter((t=>t!==e));i.length?this.map.set(t,i):this.map.delete(t)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var Gc=Object.defineProperty,Qc=Object.defineProperties,Wc=Object.getOwnPropertyDescriptors,Yc=Object.getOwnPropertySymbols,Xc=Object.prototype.hasOwnProperty,Zc=Object.prototype.propertyIsEnumerable,th=(t,e,r)=>e in t?Gc(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,eh=(t,e)=>{for(var r in e||(e={}))Xc.call(e,r)&&th(t,r,e[r]);if(Yc)for(var r of Yc(e))Zc.call(e,r)&&th(t,r,e[r]);return t},rh=(t,e)=>Qc(t,Wc(e));class ih extends io{constructor(t,e){super(t,e),this.relayer=t,this.logger=e,this.subscriptions=new Map,this.topicMap=new Jc,this.events=new i.EventEmitter,this.name="subscription",this.version="0.3",this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=Lo,this.subscribeTimeout=(0,o.toMiliseconds)(o.ONE_MINUTE),this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.pendingBatchMessages=[],this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId(),await this.restore()),this.initialized=!0},this.subscribe=async(t,e)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:t,opts:e}});try{const r=as(e),i={topic:t,relay:r,transportType:e?.transportType};this.pending.set(t,i);const n=await this.rpcSubscribe(t,r,e?.transportType);return"string"==typeof n&&(this.onSubscribe(n,i),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:t,opts:e}})),n}catch(t){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(t),t}},this.unsubscribe=async(t,e)=>{await this.restartToComplete(),this.isInitialized(),typeof e?.id<"u"?await this.unsubscribeById(t,e.id,e):await this.unsubscribeByTopic(t,e)},this.isSubscribed=async t=>{if(this.topics.includes(t))return!0;const e=`${this.pendingSubscriptionWatchLabel}_${t}`;return await new Promise(((r,i)=>{const n=new o.Watch;n.start(e);const s=setInterval((()=>{!this.pending.has(t)&&this.topics.includes(t)&&(clearInterval(s),n.stop(e),r(!0)),n.elapsed(e)>=na&&(clearInterval(s),n.stop(e),i(new Error("Subscription resolution timeout")))}),this.pollingInterval)})).catch((()=>!1))},this.on=(t,e)=>{this.events.on(t,e)},this.once=(t,e)=>{this.events.once(t,e)},this.off=(t,e)=>{this.events.off(t,e)},this.removeListener=(t,e)=>{this.events.removeListener(t,e)},this.start=async()=>{await this.onConnect()},this.stop=async()=>{await this.onDisconnect()},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=t,this.logger=(0,Qs.U5)(e,this.name),this.clientId=""}get context(){return(0,Qs.oI)(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(t,e){let r=!1;try{r=this.getSubscription(t).topic===e}catch{}return r}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(t,e){const r=this.topicMap.get(t);await Promise.all(r.map((async r=>await this.unsubscribeById(t,r,e))))}async unsubscribeById(t,e,r){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:t,id:e,opts:r}});try{const i=as(r);await this.rpcUnsubscribe(t,e,i);const n=Rs("USER_DISCONNECTED",`${this.name}, ${t}`);await this.onUnsubscribe(t,e,n),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:t,id:e,opts:r}})}catch(t){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(t),t}}async rpcSubscribe(t,e,r=ta.relay){r===ta.relay&&await this.restartToComplete();const i={method:cs(e.protocol).subscribe,params:{topic:t}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i});try{const e=Xn(t+this.clientId);return r===ta.link_mode?(setTimeout((()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(i).catch((t=>this.logger.warn(t)))}),(0,o.toMiliseconds)(o.ONE_SECOND)),e):await await Z(this.relayer.request(i).catch((t=>this.logger.warn(t))),this.subscribeTimeout)?e:null}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(Jo)}return null}async rpcBatchSubscribe(t){if(!t.length)return;const e={method:cs(t[0].relay.protocol).batchSubscribe,params:{topics:t.map((t=>t.topic))}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:e});try{return await await Z(this.relayer.request(e).catch((t=>this.logger.warn(t))),this.subscribeTimeout)}catch{this.relayer.events.emit(Jo)}}async rpcBatchFetchMessages(t){if(!t.length)return;const e={method:cs(t[0].relay.protocol).batchFetchMessages,params:{topics:t.map((t=>t.topic))}};let r;this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:e});try{r=await await Z(this.relayer.request(e).catch((t=>this.logger.warn(t))),this.subscribeTimeout)}catch{this.relayer.events.emit(Jo)}return r}rpcUnsubscribe(t,e,r){const i={method:cs(r.protocol).unsubscribe,params:{topic:t,id:e}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(t,e){this.setSubscription(t,rh(eh({},e),{id:t})),this.pending.delete(e.topic)}onBatchSubscribe(t){t.length&&t.forEach((t=>{this.setSubscription(t.id,eh({},t)),this.pending.delete(t.topic)}))}async onUnsubscribe(t,e,r){this.events.removeAllListeners(e),this.hasSubscription(e,t)&&this.deleteSubscription(e,r),await this.relayer.messages.del(t)}async setRelayerSubscriptions(t){await this.relayer.core.storage.setItem(this.storageKey,t)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(t,e){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:t,subscription:e}),this.addSubscription(t,e)}addSubscription(t,e){this.subscriptions.set(t,eh({},e)),this.topicMap.set(e.topic,t),this.events.emit(ra,e)}getSubscription(t){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:t});const e=this.subscriptions.get(t);if(!e){const{message:e}=xs("NO_MATCHING_KEY",`${this.name}: ${t}`);throw new Error(e)}return e}deleteSubscription(t,e){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:t,reason:e});const r=this.getSubscription(t);this.subscriptions.delete(t),this.topicMap.delete(r.topic,t),this.events.emit(ia,rh(eh({},r),{reason:e}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit("subscription_sync")}async reset(){if(this.cached.length){const t=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let e=0;e<t;e++){const t=this.cached.splice(0,this.batchSubscribeTopicsLimit);await this.batchFetchMessages(t),await this.batchSubscribe(t)}}this.events.emit("subscription_resubscribed")}async restore(){try{const t=await this.getRelayerSubscriptions();if(typeof t>"u"||!t.length)return;if(this.subscriptions.size){const{message:t}=xs("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(t)}this.cached=t,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(t){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(t)}}async batchSubscribe(t){if(!t.length)return;const e=await this.rpcBatchSubscribe(t);Ns(e)&&this.onBatchSubscribe(e.map(((e,r)=>rh(eh({},t[r]),{id:e}))))}async batchFetchMessages(t){if(!t.length)return;this.logger.trace(`Fetching batch messages for ${t.length} subscriptions`);const e=await this.rpcBatchFetchMessages(t);e&&e.messages&&(this.pendingBatchMessages=this.pendingBatchMessages.concat(e.messages))}async onConnect(){await this.restart(),this.onEnable()}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||!this.relayer.connected)return;const t=[];this.pending.forEach((e=>{t.push(e)})),await this.batchSubscribe(t),this.pendingBatchMessages.length&&(await this.relayer.handleBatchMessageEvents(this.pendingBatchMessages),this.pendingBatchMessages=[])}registerEventListeners(){this.relayer.core.heartbeat.on(Js.li.pulse,(async()=>{await this.checkPending()})),this.events.on(ra,(async t=>{const e=ra;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,data:t}),await this.persist()})),this.events.on(ia,(async t=>{const e=ia;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,data:t}),await this.persist()}))}isInitialized(){if(!this.initialized){const{message:t}=xs("NOT_INITIALIZED",this.name);throw new Error(t)}}async restartToComplete(){!this.relayer.connected&&!this.relayer.connecting&&await this.relayer.transportOpen(),this.restartInProgress&&await new Promise((t=>{const e=setInterval((()=>{this.restartInProgress||(clearInterval(e),t())}),this.pollingInterval)}))}}var nh=Object.defineProperty,sh=Object.getOwnPropertySymbols,oh=Object.prototype.hasOwnProperty,ah=Object.prototype.propertyIsEnumerable,ch=(t,e,r)=>e in t?nh(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;class hh extends eo{constructor(t){super(t),this.protocol="wc",this.version=2,this.events=new i.EventEmitter,this.name="relayer",this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","stalled","interrupted"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.heartBeatTimeout=(0,o.toMiliseconds)(o.THIRTY_SECONDS+o.ONE_SECOND),this.request=async t=>{var e,r;this.logger.debug("Publishing Request Payload");const i=t.id||(0,Co.getBigIntRpcId)().toString();await this.toEstablishConnection();try{const n=this.provider.request(t);this.requestsInFlight.set(i,{promise:n,request:t}),this.logger.trace({id:i,method:t.method,topic:null==(e=t.params)?void 0:e.topic},"relayer.request - attempt to publish...");const s=await new Promise((async(t,e)=>{const r=()=>{e(new Error(`relayer.request - publish interrupted, id: ${i}`))};this.provider.on(Yo,r);const s=await n;this.provider.off(Yo,r),t(s)}));return this.logger.trace({id:i,method:t.method,topic:null==(r=t.params)?void 0:r.topic},"relayer.request - published"),s}catch(t){throw this.logger.debug(`Failed to Publish Request: ${i}`),t}finally{this.requestsInFlight.delete(i)}},this.resetPingTimeout=()=>{if(H())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout((()=>{var t,e,r;null==(r=null==(e=null==(t=this.provider)?void 0:t.connection)?void 0:e.socket)||r.terminate()}),this.heartBeatTimeout)}catch(t){this.logger.warn(t)}},this.onPayloadHandler=t=>{this.onProviderPayload(t),this.resetPingTimeout()},this.onConnectHandler=()=>{this.logger.trace("relayer connected"),this.startPingTimeout(),this.events.emit("relayer_connect")},this.onDisconnectHandler=()=>{this.logger.trace("relayer disconnected"),this.onProviderDisconnect()},this.onProviderErrorHandler=t=>{this.logger.error(t),this.events.emit("relayer_error",t),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(Qo,this.onPayloadHandler),this.provider.on(Wo,this.onConnectHandler),this.provider.on(Yo,this.onDisconnectHandler),this.provider.on(Xo,this.onProviderErrorHandler)},this.core=t.core,this.logger=typeof t.logger<"u"&&"string"!=typeof t.logger?(0,Qs.U5)(t.logger,this.name):(0,Qs.h6)((0,Qs.iP)({level:t.logger||"error"})),this.messages=new $c(this.logger,t.core),this.subscriber=new ih(this,this.logger),this.publisher=new Vc(this,this.logger),this.relayUrl=t?.relayUrl||Ko,this.projectId=t.projectId,this.bundleId=function(){var t;try{return K()&&typeof r.g<"u"&&typeof(null==r.g?void 0:r.g.Application)<"u"?null==(t=r.g.Application)?void 0:t.applicationId:void 0}catch{return}}(),this.provider={}}async init(){if(this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.subscriber.cached.length>0)try{await this.transportOpen()}catch(t){this.logger.warn(t)}}get context(){return(0,Qs.oI)(this.logger)}get connected(){var t,e,r;return 1===(null==(r=null==(e=null==(t=this.provider)?void 0:t.connection)?void 0:e.socket)?void 0:r.readyState)}get connecting(){var t,e,r;return 0===(null==(r=null==(e=null==(t=this.provider)?void 0:t.connection)?void 0:e.socket)?void 0:r.readyState)}async publish(t,e,r){this.isInitialized(),await this.publisher.publish(t,e,r),await this.recordMessageEvent({topic:t,message:e,publishedAt:Date.now(),transportType:ta.relay})}async subscribe(t,e){var r;this.isInitialized(),"relay"===e?.transportType&&await this.toEstablishConnection();let i,n=(null==(r=this.subscriber.topicMap.get(t))?void 0:r[0])||"";const s=e=>{e.topic===t&&(this.subscriber.off(ra,s),i())};return await Promise.all([new Promise((t=>{i=t,this.subscriber.on(ra,s)})),new Promise((async r=>{n=await this.subscriber.subscribe(t,e)||n,r()}))]),n}async unsubscribe(t,e){this.isInitialized(),await this.subscriber.unsubscribe(t,e)}on(t,e){this.events.on(t,e)}once(t,e){this.events.once(t,e)}off(t,e){this.events.off(t,e)}removeListener(t,e){this.events.removeListener(t,e)}async transportDisconnect(){if(!this.hasExperiencedNetworkDisruption&&this.connected&&this.requestsInFlight.size>0)try{await Promise.all(Array.from(this.requestsInFlight.values()).map((t=>t.promise)))}catch(t){this.logger.warn(t)}this.hasExperiencedNetworkDisruption||this.connected?await Z(this.provider.disconnect(),2e3,"provider.disconnect()").catch((()=>this.onProviderDisconnect())):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(t){await this.confirmOnlineStateOrThrow(),t&&t!==this.relayUrl&&(this.relayUrl=t,await this.transportDisconnect()),await this.createProvider(),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;try{await new Promise((async(t,e)=>{const r=()=>{this.provider.off(Yo,r),e(new Error("Connection interrupted while trying to subscribe"))};this.provider.on(Yo,r),await Z(this.provider.connect(),(0,o.toMiliseconds)(o.ONE_MINUTE),`Socket stalled when trying to connect to ${this.relayUrl}`).catch((t=>{e(t)})).finally((()=>{clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0})),this.subscriber.start().catch((t=>{this.logger.error(t),this.onDisconnectHandler()})),this.hasExperiencedNetworkDisruption=!1,t()}))}catch(t){this.logger.error(t);const e=t;if(this.hasExperiencedNetworkDisruption=!0,!this.isConnectionStalled(e.message))throw t}finally{this.connectionAttemptInProgress=!1}}async restartTransport(t){this.connectionAttemptInProgress||(this.relayUrl=t||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await Ks())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(t){if(0===t?.length)return void this.logger.trace("Batch message events is empty. Ignoring...");const e=t.sort(((t,e)=>t.publishedAt-e.publishedAt));this.logger.trace(`Batch of ${e.length} message events sorted`);for(const t of e)try{await this.onMessageEvent(t)}catch(t){this.logger.warn(t)}this.logger.trace(`Batch of ${e.length} message events processed`)}async onLinkMessageEvent(t,e){const{topic:r}=t;if(!e.sessionExists){const t={topic:r,expiry:rt(o.FIVE_MINUTES),relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(r,t)}this.events.emit($o,t),await this.recordMessageEvent(t)}startPingTimeout(){var t,e,r,i,n;if(H())try{null!=(e=null==(t=this.provider)?void 0:t.connection)&&e.socket&&(null==(n=null==(i=null==(r=this.provider)?void 0:r.connection)?void 0:i.socket)||n.once("ping",(()=>{this.resetPingTimeout()}))),this.resetPingTimeout()}catch(t){this.logger.warn(t)}}isConnectionStalled(t){return this.staleConnectionErrors.some((e=>t.includes(e)))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const t=await this.core.crypto.signJWT(this.relayUrl);this.provider=new Oo.F(new ko(function({protocol:t,version:e,relayUrl:r,sdkVersion:i,auth:n,projectId:s,useOnCloseEvent:o,bundleId:a}){const c=r.split("?"),u={auth:n,ua:G(t,e,i),projectId:s,useOnCloseEvent:o||void 0,origin:a||void 0},f=function(t,e){let r=h.parse(t);return r=L(L({},r),e),h.stringify(r)}(c[1]||"",u);return c[0]+"?"+f}({sdkVersion:Zo,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:t,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(t){const{topic:e,message:r}=t;await this.messages.set(e,r)}async shouldIgnoreMessageEvent(t){const{topic:e,message:r}=t;if(!r||0===r.length)return this.logger.debug(`Ignoring invalid/empty message: ${r}`),!0;if(!await this.subscriber.isSubscribed(e))return this.logger.debug(`Ignoring message for non-subscribed topic ${e}`),!0;const i=this.messages.has(e,r);return i&&this.logger.debug(`Ignoring duplicate message: ${r}`),i}async onProviderPayload(t){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:t}),(0,Co.isJsonRpcRequest)(t)){if(!t.method.endsWith("_subscription"))return;const e=t.params,{topic:r,message:i,publishedAt:n,attestation:s}=e.data,o={topic:r,message:i,publishedAt:n,transportType:ta.relay,attestation:s};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(((t,e)=>{for(var r in e||(e={}))oh.call(e,r)&&ch(t,r,e[r]);if(sh)for(var r of sh(e))ah.call(e,r)&&ch(t,r,e[r]);return t})({type:"event",event:e.id},o)),this.events.emit(e.id,o),await this.acknowledgePayload(t),await this.onMessageEvent(o)}else(0,Co.isJsonRpcResponse)(t)&&this.events.emit(Vo,t)}async onMessageEvent(t){await this.shouldIgnoreMessageEvent(t)||(this.events.emit($o,t),await this.recordMessageEvent(t))}async acknowledgePayload(t){const e=(0,Co.formatJsonRpcResult)(t.id,!0);await this.provider.connection.send(e)}unregisterProviderListeners(){this.provider.off(Qo,this.onPayloadHandler),this.provider.off(Wo,this.onConnectHandler),this.provider.off(Yo,this.onDisconnectHandler),this.provider.off(Xo,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let t=await Ks();!function(t){switch(V()){case j:!function(t){!K()&&$()&&(window.addEventListener("online",(()=>t(!0))),window.addEventListener("offline",(()=>t(!1))))}(t);break;case z:!function(t){K()&&typeof r.g<"u"&&null!=r.g&&r.g.NetInfo&&r.g?.NetInfo.addEventListener((e=>t(e?.isConnected)))}(t)}}((async e=>{t!==e&&(t=e,e?await this.restartTransport().catch((t=>this.logger.error(t))):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))}))}async onProviderDisconnect(){await this.subscriber.stop(),this.requestsInFlight.clear(),clearTimeout(this.pingTimeout),this.events.emit("relayer_disconnect"),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&(this.reconnectTimeout||(this.reconnectTimeout=setTimeout((async()=>{await this.transportOpen().catch((t=>this.logger.error(t)))}),(0,o.toMiliseconds)(.1))))}isInitialized(){if(!this.initialized){const{message:t}=xs("NOT_INITIALIZED",this.name);throw new Error(t)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&(this.connectionAttemptInProgress&&await new Promise((t=>{const e=setInterval((()=>{this.connected&&(clearInterval(e),t())}),this.connectionStatusPollingInterval)})),await this.transportOpen())}}var uh=Object.defineProperty,fh=Object.getOwnPropertySymbols,dh=Object.prototype.hasOwnProperty,lh=Object.prototype.propertyIsEnumerable,ph=(t,e,r)=>e in t?uh(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,gh=(t,e)=>{for(var r in e||(e={}))dh.call(e,r)&&ph(t,r,e[r]);if(fh)for(var r of fh(e))lh.call(e,r)&&ph(t,r,e[r]);return t};class mh extends ro{constructor(t,e,r,i=Lo,n=void 0){super(t,e,r,i),this.core=t,this.logger=e,this.name=r,this.map=new Map,this.version="0.3",this.cached=[],this.initialized=!1,this.storagePrefix=Lo,this.recentlyDeleted=[],this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach((t=>{this.getKey&&null!==t&&!Cs(t)?this.map.set(this.getKey(t),t):function(t){var e;return null==(e=t?.proposer)?void 0:e.publicKey}(t)?this.map.set(t.id,t):function(t){return t?.topic}(t)&&this.map.set(t.topic,t)})),this.cached=[],this.initialized=!0)},this.set=async(t,e)=>{this.isInitialized(),this.map.has(t)?await this.update(t,e):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:t,value:e}),this.map.set(t,e),await this.persist())},this.get=t=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:t}),this.getData(t)),this.getAll=t=>(this.isInitialized(),t?this.values.filter((e=>Object.keys(t).every((r=>Uo()(e[r],t[r]))))):this.values),this.update=async(t,e)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:t,update:e});const r=gh(gh({},this.getData(t)),e);this.map.set(t,r),await this.persist()},this.delete=async(t,e)=>{this.isInitialized(),this.map.has(t)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:t,reason:e}),this.map.delete(t),this.addToRecentlyDeleted(t),await this.persist())},this.logger=(0,Qs.U5)(e,this.name),this.storagePrefix=i,this.getKey=n}get context(){return(0,Qs.oI)(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(t){this.recentlyDeleted.push(t),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(t){await this.core.storage.setItem(this.storageKey,t)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(t){const e=this.map.get(t);if(!e){if(this.recentlyDeleted.includes(t)){const{message:e}=xs("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${t}`);throw this.logger.error(e),new Error(e)}const{message:e}=xs("NO_MATCHING_KEY",`${this.name}: ${t}`);throw this.logger.error(e),new Error(e)}return e}async persist(){await this.setDataStore(this.values)}async restore(){try{const t=await this.getDataStore();if(typeof t>"u"||!t.length)return;if(this.map.size){const{message:t}=xs("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}this.cached=t,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(t){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(t)}}isInitialized(){if(!this.initialized){const{message:t}=xs("NOT_INITIALIZED",this.name);throw new Error(t)}}}class bh{constructor(t,e){this.core=t,this.logger=e,this.name="pairing",this.version="0.3",this.events=new(n()),this.initialized=!1,this.storagePrefix=Lo,this.ignoredPayloadTypes=[1],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:t})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...t])]},this.create=async t=>{this.isInitialized();const e=Wn(),r=await this.core.crypto.setSymKey(e),i=rt(o.FIVE_MINUTES),n={protocol:"irn"},s={topic:r,expiry:i,relay:n,active:!1,methods:t?.methods},a=ws({protocol:this.core.protocol,version:this.core.version,topic:r,symKey:e,relay:n,expiryTimestamp:i,methods:t?.methods});return this.events.emit(oa,s),this.core.expirer.set(r,i),await this.pairings.set(r,s),await this.core.relayer.subscribe(r,{transportType:t?.transportType}),{topic:r,uri:a}},this.pair=async t=>{this.isInitialized();const e=this.core.eventClient.createEvent({properties:{topic:t?.uri,trace:["pairing_started"]}});this.isValidPair(t,e);const{topic:r,symKey:i,relay:n,expiryTimestamp:s,methods:a}=vs(t.uri);let c;if(e.props.properties.topic=r,e.addTrace("pairing_uri_validation_success"),e.addTrace("pairing_uri_not_expired"),this.pairings.keys.includes(r)){if(c=this.pairings.get(r),e.addTrace("existing_pairing"),c.active)throw e.setError("active_pairing_already_exists"),new Error(`Pairing already exists: ${r}. Please try again with a new connection URI.`);e.addTrace("pairing_not_expired")}const h=s||rt(o.FIVE_MINUTES),u={topic:r,relay:n,expiry:h,active:!1,methods:a};this.core.expirer.set(r,h),await this.pairings.set(r,u),e.addTrace("store_new_pairing"),t.activatePairing&&await this.activate({topic:r}),this.events.emit(oa,u),e.addTrace("emit_inactive_pairing"),this.core.crypto.keychain.has(r)||await this.core.crypto.setSymKey(i,r),e.addTrace("subscribing_pairing_topic");try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{e.setError("no_internet_connection")}try{await this.core.relayer.subscribe(r,{relay:n})}catch(t){throw e.setError("subscribe_pairing_topic_failure"),t}return e.addTrace("subscribe_pairing_topic_success"),u},this.activate=async({topic:t})=>{this.isInitialized();const e=rt(o.THIRTY_DAYS);this.core.expirer.set(t,e),await this.pairings.update(t,{active:!0,expiry:e})},this.ping=async t=>{this.isInitialized(),await this.isValidPing(t);const{topic:e}=t;if(this.pairings.keys.includes(e)){const t=await this.sendRequest(e,"wc_pairingPing",{}),{done:r,resolve:i,reject:n}=X();this.events.once(nt("pairing_ping",t),(({error:t})=>{t?n(t):i()})),await r()}},this.updateExpiry=async({topic:t,expiry:e})=>{this.isInitialized(),await this.pairings.update(t,{expiry:e})},this.updateMetadata=async({topic:t,metadata:e})=>{this.isInitialized(),await this.pairings.update(t,{peerMetadata:e})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async t=>{this.isInitialized(),await this.isValidDisconnect(t);const{topic:e}=t;this.pairings.keys.includes(e)&&(await this.sendRequest(e,"wc_pairingDelete",Rs("USER_DISCONNECTED")),await this.deletePairing(e))},this.formatUriFromPairing=t=>{this.isInitialized();const{topic:e,relay:r,expiry:i,methods:n}=t,s=this.core.crypto.keychain.get(e);return ws({protocol:this.core.protocol,version:this.core.version,topic:e,symKey:s,relay:r,expiryTimestamp:i,methods:n})},this.sendRequest=async(t,e,r)=>{const i=(0,Co.formatJsonRpcRequest)(e,r),n=await this.core.crypto.encode(t,i),s=sa[e].req;return this.core.history.set(t,i),this.core.relayer.publish(t,n,s),i.id},this.sendResult=async(t,e,r)=>{const i=(0,Co.formatJsonRpcResult)(t,r),n=await this.core.crypto.encode(e,i),s=await this.core.history.get(e,t),o=sa[s.request.method].res;await this.core.relayer.publish(e,n,o),await this.core.history.resolve(i)},this.sendError=async(t,e,r)=>{const i=(0,Co.formatJsonRpcError)(t,r),n=await this.core.crypto.encode(e,i),s=await this.core.history.get(e,t),o=sa[s.request.method]?sa[s.request.method].res:sa.unregistered_method.res;await this.core.relayer.publish(e,n,o),await this.core.history.resolve(i)},this.deletePairing=async(t,e)=>{await this.core.relayer.unsubscribe(t),await Promise.all([this.pairings.delete(t,Rs("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(t),e?Promise.resolve():this.core.expirer.del(t)])},this.cleanup=async()=>{const t=this.pairings.getAll().filter((t=>it(t.expiry)));await Promise.all(t.map((t=>this.deletePairing(t.topic))))},this.onRelayEventRequest=t=>{const{topic:e,payload:r}=t;switch(r.method){case"wc_pairingPing":return this.onPairingPingRequest(e,r);case"wc_pairingDelete":return this.onPairingDeleteRequest(e,r);default:return this.onUnknownRpcMethodRequest(e,r)}},this.onRelayEventResponse=async t=>{const{topic:e,payload:r}=t,i=(await this.core.history.get(e,r.id)).request.method;return"wc_pairingPing"===i?this.onPairingPingResponse(e,r):this.onUnknownRpcMethodResponse(i)},this.onPairingPingRequest=async(t,e)=>{const{id:r}=e;try{this.isValidPing({topic:t}),await this.sendResult(r,t,!0),this.events.emit("pairing_ping",{id:r,topic:t})}catch(e){await this.sendError(r,t,e),this.logger.error(e)}},this.onPairingPingResponse=(t,e)=>{const{id:r}=e;setTimeout((()=>{(0,Co.isJsonRpcResult)(e)?this.events.emit(nt("pairing_ping",r),{}):(0,Co.isJsonRpcError)(e)&&this.events.emit(nt("pairing_ping",r),{error:e.error})}),500)},this.onPairingDeleteRequest=async(t,e)=>{const{id:r}=e;try{this.isValidDisconnect({topic:t}),await this.deletePairing(t),this.events.emit(aa,{id:r,topic:t})}catch(e){await this.sendError(r,t,e),this.logger.error(e)}},this.onUnknownRpcMethodRequest=async(t,e)=>{const{id:r,method:i}=e;try{if(this.registeredMethods.includes(i))return;const e=Rs("WC_METHOD_UNSUPPORTED",i);await this.sendError(r,t,e),this.logger.error(e)}catch(e){await this.sendError(r,t,e),this.logger.error(e)}},this.onUnknownRpcMethodResponse=t=>{this.registeredMethods.includes(t)||this.logger.error(Rs("WC_METHOD_UNSUPPORTED",t))},this.isValidPair=(t,e)=>{var r;if(!zs(t)){const{message:r}=xs("MISSING_OR_INVALID",`pair() params: ${t}`);throw e.setError(va),new Error(r)}if(!function(t){function e(t){try{return typeof new URL(t)<"u"}catch{return!1}}try{if(Ts(t,!1))return!!e(t)||e(ht(t))}catch{}return!1}(t.uri)){const{message:r}=xs("MISSING_OR_INVALID",`pair() uri: ${t.uri}`);throw e.setError(va),new Error(r)}const i=vs(t?.uri);if(null==(r=i?.relay)||!r.protocol){const{message:t}=xs("MISSING_OR_INVALID","pair() uri#relay-protocol");throw e.setError(va),new Error(t)}if(null==i||!i.symKey){const{message:t}=xs("MISSING_OR_INVALID","pair() uri#symKey");throw e.setError(va),new Error(t)}if(null!=i&&i.expiryTimestamp&&(0,o.toMiliseconds)(i?.expiryTimestamp)<Date.now()){e.setError("pairing_expired");const{message:t}=xs("EXPIRED","pair() URI has expired. Please try again with a new connection URI.");throw new Error(t)}},this.isValidPing=async t=>{if(!zs(t)){const{message:e}=xs("MISSING_OR_INVALID",`ping() params: ${t}`);throw new Error(e)}const{topic:e}=t;await this.isValidPairingTopic(e)},this.isValidDisconnect=async t=>{if(!zs(t)){const{message:e}=xs("MISSING_OR_INVALID",`disconnect() params: ${t}`);throw new Error(e)}const{topic:e}=t;await this.isValidPairingTopic(e)},this.isValidPairingTopic=async t=>{if(!Ts(t,!1)){const{message:e}=xs("MISSING_OR_INVALID",`pairing topic should be a string: ${t}`);throw new Error(e)}if(!this.pairings.keys.includes(t)){const{message:e}=xs("NO_MATCHING_KEY",`pairing topic doesn't exist: ${t}`);throw new Error(e)}if(it(this.pairings.get(t).expiry)){await this.deletePairing(t);const{message:e}=xs("EXPIRED",`pairing topic: ${t}`);throw new Error(e)}},this.core=t,this.logger=(0,Qs.U5)(e,this.name),this.pairings=new mh(this.core,this.logger,this.name,this.storagePrefix)}get context(){return(0,Qs.oI)(this.logger)}isInitialized(){if(!this.initialized){const{message:t}=xs("NOT_INITIALIZED",this.name);throw new Error(t)}}registerRelayerEvents(){this.core.relayer.on($o,(async t=>{const{topic:e,message:r,transportType:i}=t;if(!this.pairings.keys.includes(e)||i===ta.link_mode||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(r)))return;const n=await this.core.crypto.decode(e,r);try{(0,Co.isJsonRpcRequest)(n)?(this.core.history.set(e,n),this.onRelayEventRequest({topic:e,payload:n})):(0,Co.isJsonRpcResponse)(n)&&(await this.core.history.resolve(n),await this.onRelayEventResponse({topic:e,payload:n}),this.core.history.delete(e,n.id))}catch(t){this.logger.error(t)}}))}registerExpirerEvents(){this.core.expirer.on(la,(async t=>{const{topic:e}=et(t.target);e&&this.pairings.keys.includes(e)&&(await this.deletePairing(e,!0),this.events.emit("pairing_expire",{topic:e}))}))}}class vh extends Xs{constructor(t,e){super(t,e),this.core=t,this.logger=e,this.records=new Map,this.events=new i.EventEmitter,this.name="history",this.version="0.3",this.cached=[],this.initialized=!1,this.storagePrefix=Lo,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach((t=>this.records.set(t.id,t))),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(t,e,r)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:t,request:e,chainId:r}),this.records.has(e.id))return;const i={id:e.id,topic:t,request:{method:e.method,params:e.params||null},chainId:r,expiry:rt(o.THIRTY_DAYS)};this.records.set(i.id,i),this.persist(),this.events.emit(ca,i)},this.resolve=async t=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:t}),!this.records.has(t.id))return;const e=await this.getRecord(t.id);typeof e.response>"u"&&(e.response=(0,Co.isJsonRpcError)(t)?{error:t.error}:{result:t.result},this.records.set(e.id,e),this.persist(),this.events.emit(ha,e))},this.get=async(t,e)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:t,id:e}),await this.getRecord(e)),this.delete=(t,e)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:e}),this.values.forEach((r=>{if(r.topic===t){if(typeof e<"u"&&r.id!==e)return;this.records.delete(r.id),this.events.emit(ua,r)}})),this.persist()},this.exists=async(t,e)=>(this.isInitialized(),!!this.records.has(e)&&(await this.getRecord(e)).topic===t),this.on=(t,e)=>{this.events.on(t,e)},this.once=(t,e)=>{this.events.once(t,e)},this.off=(t,e)=>{this.events.off(t,e)},this.removeListener=(t,e)=>{this.events.removeListener(t,e)},this.logger=(0,Qs.U5)(e,this.name)}get context(){return(0,Qs.oI)(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const t=[];return this.values.forEach((e=>{if(typeof e.response<"u")return;const r={topic:e.topic,request:(0,Co.formatJsonRpcRequest)(e.request.method,e.request.params,e.id),chainId:e.chainId};return t.push(r)})),t}async setJsonRpcRecords(t){await this.core.storage.setItem(this.storageKey,t)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(t){this.isInitialized();const e=this.records.get(t);if(!e){const{message:e}=xs("NO_MATCHING_KEY",`${this.name}: ${t}`);throw new Error(e)}return e}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit("history_sync")}async restore(){try{const t=await this.getJsonRpcRecords();if(typeof t>"u"||!t.length)return;if(this.records.size){const{message:t}=xs("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}this.cached=t,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(t){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(t)}}registerEventListeners(){this.events.on(ca,(t=>{const e=ca;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,record:t})})),this.events.on(ha,(t=>{const e=ha;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,record:t})})),this.events.on(ua,(t=>{const e=ua;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,record:t})})),this.core.heartbeat.on(Js.li.pulse,(()=>{this.cleanup()}))}cleanup(){try{this.isInitialized();let t=!1;this.records.forEach((e=>{(0,o.toMiliseconds)(e.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${e.id}`),this.records.delete(e.id),this.events.emit(ua,e,!1),t=!0)})),t&&this.persist()}catch(t){this.logger.warn(t)}}isInitialized(){if(!this.initialized){const{message:t}=xs("NOT_INITIALIZED",this.name);throw new Error(t)}}}class yh extends no{constructor(t,e){super(t,e),this.core=t,this.logger=e,this.expirations=new Map,this.events=new i.EventEmitter,this.name="expirer",this.version="0.3",this.cached=[],this.initialized=!1,this.storagePrefix=Lo,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach((t=>this.expirations.set(t.target,t))),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=t=>{try{const e=this.formatTarget(t);return typeof this.getExpiration(e)<"u"}catch{return!1}},this.set=(t,e)=>{this.isInitialized();const r=this.formatTarget(t),i={target:r,expiry:e};this.expirations.set(r,i),this.checkExpiry(r,i),this.events.emit(fa,{target:r,expiration:i})},this.get=t=>{this.isInitialized();const e=this.formatTarget(t);return this.getExpiration(e)},this.del=t=>{if(this.isInitialized(),this.has(t)){const e=this.formatTarget(t),r=this.getExpiration(e);this.expirations.delete(e),this.events.emit(da,{target:e,expiration:r})}},this.on=(t,e)=>{this.events.on(t,e)},this.once=(t,e)=>{this.events.once(t,e)},this.off=(t,e)=>{this.events.off(t,e)},this.removeListener=(t,e)=>{this.events.removeListener(t,e)},this.logger=(0,Qs.U5)(e,this.name)}get context(){return(0,Qs.oI)(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(t){if("string"==typeof t)return function(t){return tt("topic",t)}(t);if("number"==typeof t)return function(t){return tt("id",t)}(t);const{message:e}=xs("UNKNOWN_TYPE","Target type: "+typeof t);throw new Error(e)}async setExpirations(t){await this.core.storage.setItem(this.storageKey,t)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit("expirer_sync")}async restore(){try{const t=await this.getExpirations();if(typeof t>"u"||!t.length)return;if(this.expirations.size){const{message:t}=xs("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}this.cached=t,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(t){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(t)}}getExpiration(t){const e=this.expirations.get(t);if(!e){const{message:e}=xs("NO_MATCHING_KEY",`${this.name}: ${t}`);throw this.logger.warn(e),new Error(e)}return e}checkExpiry(t,e){const{expiry:r}=e;(0,o.toMiliseconds)(r)-Date.now()<=0&&this.expire(t,e)}expire(t,e){this.expirations.delete(t),this.events.emit(la,{target:t,expiration:e})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach(((t,e)=>this.checkExpiry(e,t)))}registerEventListeners(){this.core.heartbeat.on(Js.li.pulse,(()=>this.checkExpirations())),this.events.on(fa,(t=>{const e=fa;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,data:t}),this.persist()})),this.events.on(la,(t=>{const e=la;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,data:t}),this.persist()})),this.events.on(da,(t=>{const e=da;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,data:t}),this.persist()}))}isInitialized(){if(!this.initialized){const{message:t}=xs("NOT_INITIALIZED",this.name);throw new Error(t)}}}var wh={};function _h(t){let e;return typeof window<"u"&&typeof window[t]<"u"&&(e=window[t]),e}function Ah(t){const e=_h(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}Object.defineProperty(wh,"__esModule",{value:!0}),wh.getLocalStorage=wh.getLocalStorageOrThrow=wh.getCrypto=wh.getCryptoOrThrow=wh.getLocation=wh.getLocationOrThrow=wh.getNavigator=wh.getNavigatorOrThrow=Mh=wh.getDocument=wh.getDocumentOrThrow=wh.getFromWindowOrThrow=wh.getFromWindow=void 0,wh.getFromWindow=_h,wh.getFromWindowOrThrow=Ah,wh.getDocumentOrThrow=function(){return Ah("document")};var Mh=wh.getDocument=function(){return _h("document")};wh.getNavigatorOrThrow=function(){return Ah("navigator")},wh.getNavigator=function(){return _h("navigator")},wh.getLocationOrThrow=function(){return Ah("location")},wh.getLocation=function(){return _h("location")},wh.getCryptoOrThrow=function(){return Ah("crypto")},wh.getCrypto=function(){return _h("crypto")},wh.getLocalStorageOrThrow=function(){return Ah("localStorage")},wh.getLocalStorage=function(){return _h("localStorage")};class Eh extends so{constructor(t,e,r){super(t,e,r),this.core=t,this.logger=e,this.store=r,this.name="verify-api",this.verifyUrlV3=ma,this.storagePrefix=Lo,this.version=2,this.init=async()=>{var t;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&(0,o.toMiliseconds)(null==(t=this.publicKey)?void 0:t.expiresAt)<Date.now()&&(this.logger.debug("verify v2 public key expired"),await this.removePublicKey()))},this.register=async t=>{if(!$()||this.isDevEnv)return;const e=window.location.origin,{id:r,decryptedId:i}=t,n=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${e}&id=${r}&decryptedId=${i}`;try{const t=Mh(),e=this.startAbortTimer(5*o.ONE_SECOND),i=await new Promise(((i,s)=>{const o=()=>{window.removeEventListener("message",c),t.body.removeChild(a),s("attestation aborted")};this.abortController.signal.addEventListener("abort",o);const a=t.createElement("iframe");a.src=n,a.style.display="none",a.addEventListener("error",o,{signal:this.abortController.signal});const c=n=>{if(n.data&&"string"==typeof n.data)try{const s=JSON.parse(n.data);if("verify_attestation"===s.type){if(Ro(s.attestation).payload.id!==r)return;clearInterval(e),t.body.removeChild(a),this.abortController.signal.removeEventListener("abort",o),window.removeEventListener("message",c),i(null===s.attestation?"":s.attestation)}}catch(t){this.logger.warn(t)}};t.body.appendChild(a),window.addEventListener("message",c,{signal:this.abortController.signal})}));return this.logger.debug("jwt attestation",i),i}catch(t){this.logger.warn(t)}return""},this.resolve=async t=>{if(this.isDevEnv)return"";const{attestationId:e,hash:r,encryptedId:i}=t;if(""===e)return void this.logger.debug("resolve: attestationId is empty, skipping");if(e){if(Ro(e).payload.id!==i)return;const t=await this.isValidJwtAttestation(e);if(t)return t.isVerified?t:void this.logger.warn("resolve: jwt attestation: origin url not verified")}if(!r)return;const n=this.getVerifyUrl(t?.verifyUrl);return this.fetchAttestation(r,n)},this.fetchAttestation=async(t,e)=>{this.logger.debug(`resolving attestation: ${t} from url: ${e}`);const r=this.startAbortTimer(5*o.ONE_SECOND),i=await fetch(`${e}/attestation/${t}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(r),200===i.status?await i.json():void 0},this.getVerifyUrl=t=>{let e=t||ga;return ba.includes(e)||(this.logger.info(`verify url: ${e}, not included in trusted list, assigning default: ${ga}`),e=ga),e},this.fetchPublicKey=async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const t=this.startAbortTimer(o.FIVE_SECONDS),e=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(t),await e.json()}catch(t){this.logger.warn(t)}},this.persistPublicKey=async t=>{this.logger.debug("persisting public key to local storage",t),await this.store.setItem(this.storeKey,t),this.publicKey=t},this.removePublicKey=async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0},this.isValidJwtAttestation=async t=>{const e=await this.getPublicKey();try{if(e)return this.validateAttestation(t,e)}catch(t){this.logger.error(t),this.logger.warn("error validating attestation")}const r=await this.fetchAndPersistPublicKey();try{if(r)return this.validateAttestation(t,r)}catch(t){this.logger.error(t),this.logger.warn("error validating attestation")}},this.getPublicKey=async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey(),this.fetchAndPersistPublicKey=async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise((async t=>{const e=await this.fetchPublicKey();e&&(await this.persistPublicKey(e),t(e))}));const t=await this.fetchPromise;return this.fetchPromise=void 0,t},this.validateAttestation=(t,e)=>{const r=os(t,e.publicKey),i={hasExpired:(0,o.toMiliseconds)(r.exp)<Date.now(),payload:r};if(i.hasExpired)throw this.logger.warn("resolve: jwt attestation expired"),new Error("JWT attestation expired");return{origin:i.payload.origin,isScam:i.payload.isScam,isVerified:i.payload.isVerified}},this.logger=(0,Qs.U5)(e,this.name),this.abortController=new AbortController,this.isDevEnv=ct(),this.init()}get storeKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//verify:public:key"}get context(){return(0,Qs.oI)(this.logger)}startAbortTimer(t){return this.abortController=new AbortController,setTimeout((()=>this.abortController.abort()),(0,o.toMiliseconds)(t))}}class Ih extends oo{constructor(t,e){super(t,e),this.projectId=t,this.logger=e,this.context="echo",this.registerDeviceToken=async t=>{const{clientId:e,token:r,notificationType:i,enableEncrypted:n=!1}=t,s=`https://echo.walletconnect.com/${this.projectId}/clients`;await fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:e,type:i,token:r,always_raw:n})})},this.logger=(0,Qs.U5)(e,this.context)}}var Sh=Object.defineProperty,Ph=Object.getOwnPropertySymbols,xh=Object.prototype.hasOwnProperty,Rh=Object.prototype.propertyIsEnumerable,Nh=(t,e,r)=>e in t?Sh(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Oh=(t,e)=>{for(var r in e||(e={}))xh.call(e,r)&&Nh(t,r,e[r]);if(Ph)for(var r of Ph(e))Rh.call(e,r)&&Nh(t,r,e[r]);return t};class Ch extends ao{constructor(t,e,r=!0){super(t,e,r),this.core=t,this.logger=e,this.context="event-client",this.storagePrefix=Lo,this.storageVersion=.1,this.events=new Map,this.shouldPersist=!1,this.init=async()=>{if(!ct())try{const t={eventId:at(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:G(this.core.relayer.protocol,this.core.relayer.version,Zo)}}};await this.sendEvent([t])}catch(t){this.logger.warn(t)}},this.createEvent=t=>{const{event:e="ERROR",type:r="",properties:{topic:i,trace:n}}=t,s=at(),o=this.core.projectId||"",a=Date.now(),c=Oh({eventId:s,timestamp:a,props:{event:e,type:r,properties:{topic:i,trace:n}},bundleId:o,domain:this.getAppDomain()},this.setMethods(s));return this.telemetryEnabled&&(this.events.set(s,c),this.shouldPersist=!0),c},this.getEvent=t=>{const{eventId:e,topic:r}=t;if(e)return this.events.get(e);const i=Array.from(this.events.values()).find((t=>t.props.properties.topic===r));return i?Oh(Oh({},i),this.setMethods(i.eventId)):void 0},this.deleteEvent=t=>{const{eventId:e}=t;this.events.delete(e),this.shouldPersist=!0},this.setEventListeners=()=>{this.core.heartbeat.on(Js.li.pulse,(async()=>{this.shouldPersist&&await this.persist(),this.events.forEach((t=>{(0,o.fromMiliseconds)(Date.now())-(0,o.fromMiliseconds)(t.timestamp)>86400&&(this.events.delete(t.eventId),this.shouldPersist=!0)}))}))},this.setMethods=t=>({addTrace:e=>this.addTrace(t,e),setError:e=>this.setError(t,e)}),this.addTrace=(t,e)=>{const r=this.events.get(t);r&&(r.props.properties.trace.push(e),this.events.set(t,r),this.shouldPersist=!0)},this.setError=(t,e)=>{const r=this.events.get(t);r&&(r.props.type=e,r.timestamp=Date.now(),this.events.set(t,r),this.shouldPersist=!0)},this.persist=async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1},this.restore=async()=>{try{const t=await this.core.storage.getItem(this.storageKey)||[];if(!t.length)return;t.forEach((t=>{this.events.set(t.eventId,Oh(Oh({},t),this.setMethods(t.eventId)))}))}catch(t){this.logger.warn(t)}},this.submit=async()=>{if(!this.telemetryEnabled||0===this.events.size)return;const t=[];for(const[e,r]of this.events)r.props.type&&t.push(r);if(0!==t.length)try{if((await this.sendEvent(t)).ok)for(const e of t)this.events.delete(e.eventId),this.shouldPersist=!0}catch(t){this.logger.warn(t)}},this.sendEvent=async t=>{const e=this.getAppDomain()?"":"&sp=desktop";return await fetch(`https://pulse.walletconnect.org/batch?projectId=${this.core.projectId}&st=events_sdk&sv=js-${Zo}${e}`,{method:"POST",body:JSON.stringify(t)})},this.getAppDomain=()=>J().url,this.logger=(0,Qs.U5)(e,this.context),this.telemetryEnabled=r,r?this.restore().then((async()=>{await this.submit(),this.setEventListeners()})):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var Th=Object.defineProperty,qh=Object.getOwnPropertySymbols,kh=Object.prototype.hasOwnProperty,Dh=Object.prototype.propertyIsEnumerable,Uh=(t,e,r)=>e in t?Th(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Bh=(t,e)=>{for(var r in e||(e={}))kh.call(e,r)&&Uh(t,r,e[r]);if(qh)for(var r of qh(e))Dh.call(e,r)&&Uh(t,r,e[r]);return t};class Lh extends Ys{constructor(t){var e;super(t),this.protocol="wc",this.version=2,this.name=Bo,this.events=new i.EventEmitter,this.initialized=!1,this.on=(t,e)=>this.events.on(t,e),this.once=(t,e)=>this.events.once(t,e),this.off=(t,e)=>this.events.off(t,e),this.removeListener=(t,e)=>this.events.removeListener(t,e),this.dispatchEnvelope=({topic:t,message:e,sessionExists:r})=>{if(!t||!e)return;const i={topic:t,message:e,publishedAt:Date.now(),transportType:ta.link_mode};this.relayer.onLinkMessageEvent(i,{sessionExists:r})},this.projectId=t?.projectId,this.relayUrl=t?.relayUrl||Ko,this.customStoragePrefix=null!=t&&t.customStoragePrefix?`:${t.customStoragePrefix}`:"";const r=(0,Qs.iP)({level:"string"==typeof t?.logger&&t.logger?t.logger:"error"}),{logger:n,chunkLoggerController:s}=(0,Qs.D5)({opts:r,maxSizeInBytes:t?.maxLogBlobSizeInBytes,loggerOverride:t?.logger});this.logChunkController=s,null!=(e=this.logChunkController)&&e.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var t,e;null!=(t=this.logChunkController)&&t.downloadLogsBlobInBrowser&&(null==(e=this.logChunkController)||e.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=(0,Qs.U5)(n,this.name),this.heartbeat=new Js.VH,this.crypto=new Kc(this,this.logger,t?.keychain),this.history=new vh(this,this.logger),this.expirer=new yh(this,this.logger),this.storage=null!=t&&t.storage?t.storage:new Gs.A(Bh(Bh({},zo),t?.storageOptions)),this.relayer=new hh({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new bh(this,this.logger),this.verify=new Eh(this,this.logger,this.storage),this.echoClient=new Ih(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new Ch(this,this.logger,t?.telemetryEnabled)}static async init(t){const e=new Lh(t);await e.initialize();const r=await e.crypto.getClientId();return await e.storage.setItem("WALLETCONNECT_CLIENT_ID",r),e}get context(){return(0,Qs.oI)(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var t;return null==(t=this.logChunkController)?void 0:t.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(t){this.linkModeSupportedApps.includes(t)||(this.linkModeSupportedApps.push(t),await this.storage.setItem(ea,this.linkModeSupportedApps))}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.eventClient.init(),this.linkModeSupportedApps=await this.storage.getItem(ea)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(t){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,t),this.logger.error(t.message),t}}}const zh=Lh,jh="client",Fh=`wc@2:${jh}:`,Hh=jh,Kh="WALLETCONNECT_DEEPLINK_CHOICE",$h="Proposal expired",Vh=o.SEVEN_DAYS,Jh={wc_sessionPropose:{req:{ttl:o.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:o.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:o.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:o.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:o.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:o.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:o.ONE_DAY,prompt:!1,tag:1104},res:{ttl:o.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:o.ONE_DAY,prompt:!1,tag:1106},res:{ttl:o.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:o.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:o.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:o.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:o.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:o.ONE_DAY,prompt:!1,tag:1112},res:{ttl:o.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:o.ONE_DAY,prompt:!1,tag:1114},res:{ttl:o.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:o.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:o.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:o.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:o.FIVE_MINUTES,prompt:!1,tag:1119}}},Gh={min:o.FIVE_MINUTES,max:o.SEVEN_DAYS},Qh="IDLE",Wh="ACTIVE",Yh=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],Xh="wc@1.5:auth:",Zh=`${Xh}:PUB_KEY`;var tu=Object.defineProperty,eu=Object.defineProperties,ru=Object.getOwnPropertyDescriptors,iu=Object.getOwnPropertySymbols,nu=Object.prototype.hasOwnProperty,su=Object.prototype.propertyIsEnumerable,ou=(t,e,r)=>e in t?tu(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,au=(t,e)=>{for(var r in e||(e={}))nu.call(e,r)&&ou(t,r,e[r]);if(iu)for(var r of iu(e))su.call(e,r)&&ou(t,r,e[r]);return t},cu=(t,e)=>eu(t,ru(e));class hu extends ho{constructor(t){super(t),this.name="engine",this.events=new(n()),this.initialized=!1,this.requestQueue={state:Qh,queue:[]},this.sessionRequestQueue={state:Qh,queue:[]},this.requestQueueDelay=o.ONE_SECOND,this.expectedPairingMethodMap=new Map,this.recentlyDeletedMap=new Map,this.recentlyDeletedLimit=200,this.relayMessageCache=[],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(Jh)}),this.initialized=!0,setTimeout((()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()}),(0,o.toMiliseconds)(this.requestQueueDelay)))},this.connect=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const e=cu(au({},t),{requiredNamespaces:t.requiredNamespaces||{},optionalNamespaces:t.optionalNamespaces||{}});await this.isValidConnect(e);const{pairingTopic:r,requiredNamespaces:i,optionalNamespaces:n,sessionProperties:s,relays:a}=e;let c,h=r,u=!1;try{h&&(u=this.client.core.pairing.pairings.get(h).active)}catch(t){throw this.client.logger.error(`connect() -> pairing.get(${h}) failed`),t}if(!h||!u){const{topic:t,uri:e}=await this.client.core.pairing.create();h=t,c=e}if(!h){const{message:t}=xs("NO_MATCHING_KEY",`connect() pairing topic: ${h}`);throw new Error(t)}const f=await this.client.core.crypto.generateKeyPair(),d=Jh.wc_sessionPropose.req.ttl||o.FIVE_MINUTES,l=rt(d),p=au({requiredNamespaces:i,optionalNamespaces:n,relays:a??[{protocol:"irn"}],proposer:{publicKey:f,metadata:this.client.metadata},expiryTimestamp:l,pairingTopic:h},s&&{sessionProperties:s}),{reject:g,resolve:m,done:b}=X(d,$h);this.events.once(nt("session_connect"),(async({error:t,session:e})=>{if(t)g(t);else if(e){e.self.publicKey=f;const t=cu(au({},e),{pairingTopic:p.pairingTopic,requiredNamespaces:p.requiredNamespaces,optionalNamespaces:p.optionalNamespaces,transportType:ta.relay});await this.client.session.set(e.topic,t),await this.setExpiry(e.topic,e.expiry),h&&await this.client.core.pairing.updateMetadata({topic:h,metadata:e.peer.metadata}),this.cleanupDuplicatePairings(t),m(t)}}));const v=await this.sendRequest({topic:h,method:"wc_sessionPropose",params:p,throwOnFailedPublish:!0});return await this.setProposal(v,au({id:v},p)),{uri:c,approval:b}},this.pair=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(t)}catch(t){throw this.client.logger.error("pair() failed"),t}},this.approve=async t=>{var e,r,i;const n=this.client.core.eventClient.createEvent({properties:{topic:null==(e=t?.id)?void 0:e.toString(),trace:[ya]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(t){throw n.setError("no_internet_connection"),t}try{await this.isValidProposalId(t?.id)}catch(e){throw this.client.logger.error(`approve() -> proposal.get(${t?.id}) failed`),n.setError("proposal_not_found"),e}try{await this.isValidApprove(t)}catch(t){throw this.client.logger.error("approve() -> isValidApprove() failed"),n.setError("session_approve_namespace_validation_failure"),t}const{id:s,relayProtocol:o,namespaces:a,sessionProperties:c,sessionConfig:h}=t,u=this.client.proposal.get(s);this.client.core.eventClient.deleteEvent({eventId:n.eventId});const{pairingTopic:f,proposer:d,requiredNamespaces:l,optionalNamespaces:p}=u;let g=null==(r=this.client.core.eventClient)?void 0:r.getEvent({topic:f});g||(g=null==(i=this.client.core.eventClient)?void 0:i.createEvent({type:ya,properties:{topic:f,trace:[ya,"session_namespaces_validation_success"]}}));const m=await this.client.core.crypto.generateKeyPair(),b=d.publicKey,v=await this.client.core.crypto.generateSharedKey(m,b),y=au(au({relay:{protocol:o??"irn"},namespaces:a,controller:{publicKey:m,metadata:this.client.metadata},expiry:rt(Vh)},c&&{sessionProperties:c}),h&&{sessionConfig:h}),w=ta.relay;g.addTrace("subscribing_session_topic");try{await this.client.core.relayer.subscribe(v,{transportType:w})}catch(t){throw g.setError("subscribe_session_topic_failure"),t}g.addTrace("subscribe_session_topic_success");const _=cu(au({},y),{topic:v,requiredNamespaces:l,optionalNamespaces:p,pairingTopic:f,acknowledged:!1,self:y.controller,peer:{publicKey:d.publicKey,metadata:d.metadata},controller:m,transportType:ta.relay});await this.client.session.set(v,_),g.addTrace("store_session");try{g.addTrace("publishing_session_settle"),await this.sendRequest({topic:v,method:"wc_sessionSettle",params:y,throwOnFailedPublish:!0}).catch((t=>{throw g?.setError("session_settle_publish_failure"),t})),g.addTrace("session_settle_publish_success"),g.addTrace("publishing_session_approve"),await this.sendResult({id:s,topic:f,result:{relay:{protocol:o??"irn"},responderPublicKey:m},throwOnFailedPublish:!0}).catch((t=>{throw g?.setError("session_approve_publish_failure"),t})),g.addTrace("session_approve_publish_success")}catch(t){throw this.client.logger.error(t),this.client.session.delete(v,Rs("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(v),t}return this.client.core.eventClient.deleteEvent({eventId:g.eventId}),await this.client.core.pairing.updateMetadata({topic:f,metadata:d.metadata}),await this.client.proposal.delete(s,Rs("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:f}),await this.setExpiry(v,rt(Vh)),{topic:v,acknowledged:()=>Promise.resolve(this.client.session.get(v))}},this.reject=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(t)}catch(t){throw this.client.logger.error("reject() -> isValidReject() failed"),t}const{id:e,reason:r}=t;let i;try{i=this.client.proposal.get(e).pairingTopic}catch(t){throw this.client.logger.error(`reject() -> proposal.get(${e}) failed`),t}i&&(await this.sendError({id:e,topic:i,error:r,rpcOpts:Jh.wc_sessionPropose.reject}),await this.client.proposal.delete(e,Rs("USER_DISCONNECTED")))},this.update=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(t)}catch(t){throw this.client.logger.error("update() -> isValidUpdate() failed"),t}const{topic:e,namespaces:r}=t,{done:i,resolve:n,reject:s}=X(),o=(0,Co.payloadId)(),a=(0,Co.getBigIntRpcId)().toString(),c=this.client.session.get(e).namespaces;return this.events.once(nt("session_update",o),(({error:t})=>{t?s(t):n()})),await this.client.session.update(e,{namespaces:r}),await this.sendRequest({topic:e,method:"wc_sessionUpdate",params:{namespaces:r},throwOnFailedPublish:!0,clientRpcId:o,relayRpcId:a}).catch((t=>{this.client.logger.error(t),this.client.session.update(e,{namespaces:c}),s(t)})),{acknowledged:i}},this.extend=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(t)}catch(t){throw this.client.logger.error("extend() -> isValidExtend() failed"),t}const{topic:e}=t,r=(0,Co.payloadId)(),{done:i,resolve:n,reject:s}=X();return this.events.once(nt("session_extend",r),(({error:t})=>{t?s(t):n()})),await this.setExpiry(e,rt(Vh)),this.sendRequest({topic:e,method:"wc_sessionExtend",params:{},clientRpcId:r,throwOnFailedPublish:!0}).catch((t=>{s(t)})),{acknowledged:i}},this.request=async t=>{this.isInitialized();try{await this.isValidRequest(t)}catch(t){throw this.client.logger.error("request() -> isValidRequest() failed"),t}const{chainId:e,request:i,topic:n,expiry:s=Jh.wc_sessionRequest.req.ttl}=t,o=this.client.session.get(n);o?.transportType===ta.relay&&await this.confirmOnlineStateOrThrow();const c=(0,Co.payloadId)(),h=(0,Co.getBigIntRpcId)().toString(),{done:u,resolve:f,reject:d}=X(s,"Request expired. Please try again.");this.events.once(nt("session_request",c),(({error:t,result:e})=>{t?d(t):f(e)}));const l=this.getAppLinkIfEnabled(o.peer.metadata,o.transportType);return l?(await this.sendRequest({clientRpcId:c,relayRpcId:h,topic:n,method:"wc_sessionRequest",params:{request:cu(au({},i),{expiryTimestamp:rt(s)}),chainId:e},expiry:s,throwOnFailedPublish:!0,appLink:l}).catch((t=>d(t))),this.client.events.emit("session_request_sent",{topic:n,request:i,chainId:e,id:c}),await u()):await Promise.all([new Promise((async t=>{await this.sendRequest({clientRpcId:c,relayRpcId:h,topic:n,method:"wc_sessionRequest",params:{request:cu(au({},i),{expiryTimestamp:rt(s)}),chainId:e},expiry:s,throwOnFailedPublish:!0}).catch((t=>d(t))),this.client.events.emit("session_request_sent",{topic:n,request:i,chainId:e,id:c}),t()})),new Promise((async t=>{var e;if(null==(e=o.sessionConfig)||!e.disableDeepLink){const t=await async function(t,e){let r="";try{if($()&&(r=localStorage.getItem(e),r))return r;r=await t.getItem(e)}catch(t){console.error(t)}return r}(this.client.core.storage,Kh);await async function({id:t,topic:e,wcDeepLink:i}){var n;try{if(!i)return;const s="string"==typeof i?JSON.parse(i):i,o=s?.href;if("string"!=typeof o)return;const c=function(t,e,r){const i=`requestId=${e}&sessionTopic=${r}`;t.endsWith("/")&&(t=t.slice(0,-1));let n=`${t}`;return n=t.startsWith("https://t.me")?`${n}${t.includes("?")?"&startapp=":"?startapp="}${function(t,e=!1){const r=N.from(t).toString("base64");return e?r.replace(/[=]/g,""):r}(i,!0)}`:`${n}/wc?${i}`,n}(o,t,e),h=V();if(h===j){if(null==(n=(0,a.getDocument)())||!n.hasFocus())return void console.warn("Document does not have focus, skipping deeplink.");c.startsWith("https://")||c.startsWith("http://")?window.open(c,"_blank","noreferrer noopener"):window.open(c,typeof window<"u"&&(window.TelegramWebviewProxy||window.Telegram||window.TelegramWebviewProxyProto)?"_blank":"_self","noreferrer noopener")}else h===z&&typeof(null==r.g?void 0:r.g.Linking)<"u"&&await r.g.Linking.openURL(c)}catch(t){console.error(t)}}({id:c,topic:n,wcDeepLink:t})}t()})),u()]).then((t=>t[2]))},this.respond=async t=>{this.isInitialized(),await this.isValidRespond(t);const{topic:e,response:r}=t,{id:i}=r,n=this.client.session.get(e);n.transportType===ta.relay&&await this.confirmOnlineStateOrThrow();const s=this.getAppLinkIfEnabled(n.peer.metadata,n.transportType);(0,Co.isJsonRpcResult)(r)?await this.sendResult({id:i,topic:e,result:r.result,throwOnFailedPublish:!0,appLink:s}):(0,Co.isJsonRpcError)(r)&&await this.sendError({id:i,topic:e,error:r.error,appLink:s}),this.cleanupAfterResponse(t)},this.ping=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(t)}catch(t){throw this.client.logger.error("ping() -> isValidPing() failed"),t}const{topic:e}=t;if(this.client.session.keys.includes(e)){const t=(0,Co.payloadId)(),r=(0,Co.getBigIntRpcId)().toString(),{done:i,resolve:n,reject:s}=X();this.events.once(nt("session_ping",t),(({error:t})=>{t?s(t):n()})),await Promise.all([this.sendRequest({topic:e,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:t,relayRpcId:r}),i()])}else this.client.core.pairing.pairings.keys.includes(e)&&await this.client.core.pairing.ping({topic:e})},this.emit=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(t);const{topic:e,event:r,chainId:i}=t,n=(0,Co.getBigIntRpcId)().toString();await this.sendRequest({topic:e,method:"wc_sessionEvent",params:{event:r,chainId:i},throwOnFailedPublish:!0,relayRpcId:n})},this.disconnect=async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(t);const{topic:e}=t;if(this.client.session.keys.includes(e))await this.sendRequest({topic:e,method:"wc_sessionDelete",params:Rs("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:e,emitEvent:!1});else{if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:t}=xs("MISMATCHED_TOPIC",`Session or pairing topic not found: ${e}`);throw new Error(t)}await this.client.core.pairing.disconnect({topic:e})}},this.find=t=>(this.isInitialized(),this.client.session.getAll().filter((e=>function(t,e){const{requiredNamespaces:r}=e,i=Object.keys(t.namespaces),n=Object.keys(r);let s=!0;return!!Q(n,i)&&(i.forEach((e=>{const{accounts:i,methods:n,events:o}=t.namespaces[e],a=As(i),c=r[e];Q(T(e,c),a)&&Q(c.methods,n)&&Q(c.events,o)||(s=!1)})),s)}(e,t)))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.authenticate=async(t,e)=>{var r;this.isInitialized(),this.isValidAuthenticate(t);const i=e&&this.client.core.linkModeSupportedApps.includes(e)&&(null==(r=this.client.metadata.redirect)?void 0:r.linkMode),n=i?ta.link_mode:ta.relay;n===ta.relay&&await this.confirmOnlineStateOrThrow();const{chains:s,statement:o="",uri:a,domain:c,nonce:h,type:u,exp:f,nbf:d,methods:l=[],expiry:p}=t,g=[...t.resources||[]],{topic:m,uri:b}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:n});this.client.logger.info({message:"Generated new pairing",pairing:{topic:m,uri:b}});const v=await this.client.core.crypto.generateKeyPair(),y=Yn(v);if(await Promise.all([this.client.auth.authKeys.set(Zh,{responseTopic:y,publicKey:v}),this.client.auth.pairingTopics.set(y,{topic:y,pairingTopic:m})]),await this.client.core.relayer.subscribe(y,{transportType:n}),this.client.logger.info(`sending request to new pairing topic: ${m}`),l.length>0){const{namespace:t}=O(s[0]);let e=function(t,e,r){const i=function(t,e,r,i={}){return r?.sort(((t,e)=>t.localeCompare(e))),{att:{[t]:Bn(e,r,i)}}}(t,e,r);return Ln(i)}(t,"request",l);Kn(g)&&(e=jn(e,g.pop())),g.push(e)}const w=p&&p>Jh.wc_sessionAuthenticate.req.ttl?p:Jh.wc_sessionAuthenticate.req.ttl,_={authPayload:{type:u??"caip122",chains:s,statement:o,aud:a,domain:c,version:"1",nonce:h,iat:(new Date).toISOString(),exp:f,nbf:d,resources:g},requester:{publicKey:v,metadata:this.client.metadata},expiryTimestamp:rt(w)},A={requiredNamespaces:{},optionalNamespaces:{eip155:{chains:s,methods:[...new Set(["personal_sign",...l])],events:["chainChanged","accountsChanged"]}},relays:[{protocol:"irn"}],pairingTopic:m,proposer:{publicKey:v,metadata:this.client.metadata},expiryTimestamp:rt(Jh.wc_sessionPropose.req.ttl)},{done:M,resolve:E,reject:I}=X(w,"Request expired"),S=async({error:t,session:e})=>{if(this.events.off(nt("session_request",x),P),t)I(t);else if(e){e.self.publicKey=v,await this.client.session.set(e.topic,e),await this.setExpiry(e.topic,e.expiry),m&&await this.client.core.pairing.updateMetadata({topic:m,metadata:e.peer.metadata});const t=this.client.session.get(e.topic);await this.deleteProposal(R),E({session:t})}},P=async t=>{var r,i,s;if(await this.deletePendingAuthRequest(x,{message:"fulfilled",code:0}),t.error){const e=Rs("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return t.error.code===e.code?void 0:(this.events.off(nt("session_connect"),S),I(t.error.message))}await this.deleteProposal(R),this.events.off(nt("session_connect"),S);const{cacaos:o,responder:a}=t.result,c=[],h=[];for(const t of o){await kn({cacao:t,projectId:this.client.core.projectId})||(this.client.logger.error(t,"Signature verification failed"),I(Rs("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:e}=t,r=Kn(e.resources),i=[Tn(e.iss)],n=qn(e.iss);if(r){const t=Fn(r),e=Hn(r);c.push(...t),i.push(...e)}for(const t of i)h.push(`${t}:${n}`)}const u=await this.client.core.crypto.generateSharedKey(v,a.publicKey);let f;c.length>0&&(f={topic:u,acknowledged:!0,self:{publicKey:v,metadata:this.client.metadata},peer:a,controller:a.publicKey,expiry:rt(Vh),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:m,namespaces:Is([...new Set(c)],[...new Set(h)]),transportType:n},await this.client.core.relayer.subscribe(u,{transportType:n}),await this.client.session.set(u,f),m&&await this.client.core.pairing.updateMetadata({topic:m,metadata:a.metadata}),f=this.client.session.get(u)),null!=(r=this.client.metadata.redirect)&&r.linkMode&&null!=(i=a.metadata.redirect)&&i.linkMode&&null!=(s=a.metadata.redirect)&&s.universal&&e&&(this.client.core.addLinkModeSupportedApp(a.metadata.redirect.universal),this.client.session.update(u,{transportType:ta.link_mode})),E({auths:o,session:f})},x=(0,Co.payloadId)(),R=(0,Co.payloadId)();let N;this.events.once(nt("session_connect"),S),this.events.once(nt("session_request",x),P);try{if(i){const t=(0,Co.formatJsonRpcRequest)("wc_sessionAuthenticate",_,x);this.client.core.history.set(m,t);const r=await this.client.core.crypto.encode("",t,{type:2,encoding:Gn});N=_s(e,m,r)}else await Promise.all([this.sendRequest({topic:m,method:"wc_sessionAuthenticate",params:_,expiry:t.expiry,throwOnFailedPublish:!0,clientRpcId:x}),this.sendRequest({topic:m,method:"wc_sessionPropose",params:A,expiry:Jh.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:R})])}catch(t){throw this.events.off(nt("session_connect"),S),this.events.off(nt("session_request",x),P),t}return await this.setProposal(R,au({id:R},A)),await this.setAuthRequest(x,{request:cu(au({},_),{verifyContext:{}}),pairingTopic:m,transportType:n}),{uri:N??b,response:M}},this.approveSessionAuthenticate=async t=>{const{id:e,auths:r}=t,i=this.client.core.eventClient.createEvent({properties:{topic:e.toString(),trace:["authenticated_session_approve_started"]}});try{this.isInitialized()}catch(t){throw i.setError("no_internet_connection"),t}const n=this.getPendingAuthRequest(e);if(!n)throw i.setError("authenticated_session_pending_request_not_found"),new Error(`Could not find pending auth request with id ${e}`);const s=n.transportType||ta.relay;s===ta.relay&&await this.confirmOnlineStateOrThrow();const o=n.requester.publicKey,a=await this.client.core.crypto.generateKeyPair(),c=Yn(o),h={type:1,receiverPublicKey:o,senderPublicKey:a},u=[],f=[];for(const t of r){if(!await kn({cacao:t,projectId:this.client.core.projectId})){i.setError("invalid_cacao");const t=Rs("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:e,topic:c,error:t,encodeOpts:h}),new Error(t.message)}i.addTrace("cacaos_verified");const{p:r}=t,n=Kn(r.resources),s=[Tn(r.iss)],o=qn(r.iss);if(n){const t=Fn(n),e=Hn(n);u.push(...t),s.push(...e)}for(const t of s)f.push(`${t}:${o}`)}const d=await this.client.core.crypto.generateSharedKey(a,o);let l;if(i.addTrace("create_authenticated_session_topic"),u?.length>0){l={topic:d,acknowledged:!0,self:{publicKey:a,metadata:this.client.metadata},peer:{publicKey:o,metadata:n.requester.metadata},controller:o,expiry:rt(Vh),authentication:r,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:n.pairingTopic,namespaces:Is([...new Set(u)],[...new Set(f)]),transportType:s},i.addTrace("subscribing_authenticated_session_topic");try{await this.client.core.relayer.subscribe(d,{transportType:s})}catch(t){throw i.setError("subscribe_authenticated_session_topic_failure"),t}i.addTrace("subscribe_authenticated_session_topic_success"),await this.client.session.set(d,l),i.addTrace("store_authenticated_session"),await this.client.core.pairing.updateMetadata({topic:n.pairingTopic,metadata:n.requester.metadata})}i.addTrace("publishing_authenticated_session_approve");try{await this.sendResult({topic:c,id:e,result:{cacaos:r,responder:{publicKey:a,metadata:this.client.metadata}},encodeOpts:h,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(n.requester.metadata,s)})}catch(t){throw i.setError("authenticated_session_approve_publish_failure"),t}return await this.client.auth.requests.delete(e,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:n.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:i.eventId}),{session:l}},this.rejectSessionAuthenticate=async t=>{this.isInitialized();const{id:e,reason:r}=t,i=this.getPendingAuthRequest(e);if(!i)throw new Error(`Could not find pending auth request with id ${e}`);i.transportType===ta.relay&&await this.confirmOnlineStateOrThrow();const n=i.requester.publicKey,s=await this.client.core.crypto.generateKeyPair(),o=Yn(n),a={type:1,receiverPublicKey:n,senderPublicKey:s};await this.sendError({id:e,topic:o,error:r,encodeOpts:a,rpcOpts:Jh.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(i.requester.metadata,i.transportType)}),await this.client.auth.requests.delete(e,{message:"rejected",code:0}),await this.client.proposal.delete(e,Rs("USER_DISCONNECTED"))},this.formatAuthMessage=t=>{this.isInitialized();const{request:e,iss:r}=t;return Dn(e,r)},this.processRelayMessageCache=()=>{setTimeout((async()=>{if(0!==this.relayMessageCache.length)for(;this.relayMessageCache.length>0;)try{const t=this.relayMessageCache.shift();t&&await this.onRelayMessage(t)}catch(t){this.client.logger.error(t)}}),50)},this.cleanupDuplicatePairings=async t=>{if(t.pairingTopic)try{const e=this.client.core.pairing.pairings.get(t.pairingTopic),r=this.client.core.pairing.pairings.getAll().filter((r=>{var i,n;return(null==(i=r.peerMetadata)?void 0:i.url)&&(null==(n=r.peerMetadata)?void 0:n.url)===t.peer.metadata.url&&r.topic&&r.topic!==e.topic}));if(0===r.length)return;this.client.logger.info(`Cleaning up ${r.length} duplicate pairing(s)`),await Promise.all(r.map((t=>this.client.core.pairing.disconnect({topic:t.topic})))),this.client.logger.info("Duplicate pairings clean up finished")}catch(t){this.client.logger.error(t)}},this.deleteSession=async t=>{var e;const{topic:r,expirerHasDeleted:i=!1,emitEvent:n=!0,id:s=0}=t,{self:o}=this.client.session.get(r);await this.client.core.relayer.unsubscribe(r),await this.client.session.delete(r,Rs("USER_DISCONNECTED")),this.addToRecentlyDeleted(r,"session"),this.client.core.crypto.keychain.has(o.publicKey)&&await this.client.core.crypto.deleteKeyPair(o.publicKey),this.client.core.crypto.keychain.has(r)&&await this.client.core.crypto.deleteSymKey(r),i||this.client.core.expirer.del(r),this.client.core.storage.removeItem(Kh).catch((t=>this.client.logger.warn(t))),this.getPendingSessionRequests().forEach((t=>{t.topic===r&&this.deletePendingSessionRequest(t.id,Rs("USER_DISCONNECTED"))})),r===(null==(e=this.sessionRequestQueue.queue[0])?void 0:e.topic)&&(this.sessionRequestQueue.state=Qh),n&&this.client.events.emit("session_delete",{id:s,topic:r})},this.deleteProposal=async(t,e)=>{if(e)try{const e=this.client.proposal.get(t),r=this.client.core.eventClient.getEvent({topic:e.pairingTopic});r?.setError("proposal_expired")}catch{}await Promise.all([this.client.proposal.delete(t,Rs("USER_DISCONNECTED")),e?Promise.resolve():this.client.core.expirer.del(t)]),this.addToRecentlyDeleted(t,"proposal")},this.deletePendingSessionRequest=async(t,e,r=!1)=>{await Promise.all([this.client.pendingRequest.delete(t,e),r?Promise.resolve():this.client.core.expirer.del(t)]),this.addToRecentlyDeleted(t,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter((e=>e.id!==t)),r&&(this.sessionRequestQueue.state=Qh,this.client.events.emit("session_request_expire",{id:t}))},this.deletePendingAuthRequest=async(t,e,r=!1)=>{await Promise.all([this.client.auth.requests.delete(t,e),r?Promise.resolve():this.client.core.expirer.del(t)])},this.setExpiry=async(t,e)=>{this.client.session.keys.includes(t)&&(this.client.core.expirer.set(t,e),await this.client.session.update(t,{expiry:e}))},this.setProposal=async(t,e)=>{this.client.core.expirer.set(t,rt(Jh.wc_sessionPropose.req.ttl)),await this.client.proposal.set(t,e)},this.setAuthRequest=async(t,e)=>{const{request:r,pairingTopic:i,transportType:n=ta.relay}=e;this.client.core.expirer.set(t,r.expiryTimestamp),await this.client.auth.requests.set(t,{authPayload:r.authPayload,requester:r.requester,expiryTimestamp:r.expiryTimestamp,id:t,pairingTopic:i,verifyContext:r.verifyContext,transportType:n})},this.setPendingSessionRequest=async t=>{const{id:e,topic:r,params:i,verifyContext:n}=t,s=i.request.expiryTimestamp||rt(Jh.wc_sessionRequest.req.ttl);this.client.core.expirer.set(e,s),await this.client.pendingRequest.set(e,{id:e,topic:r,params:i,verifyContext:n})},this.sendRequest=async t=>{const{topic:e,method:i,params:n,expiry:s,relayRpcId:o,clientRpcId:a,throwOnFailedPublish:c,appLink:h}=t,u=(0,Co.formatJsonRpcRequest)(i,n,a);let f;const d=!!h;try{const t=d?Gn:Jn;f=await this.client.core.crypto.encode(e,u,{encoding:t})}catch(t){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${e} failed`),t}let l;if(Yh.includes(i)){const t=Xn(JSON.stringify(u)),e=Xn(f);l=await this.client.core.verify.register({id:e,decryptedId:t})}const p=Jh[i].req;if(p.attestation=l,s&&(p.ttl=s),o&&(p.id=o),this.client.core.history.set(e,u),d){const t=_s(h,e,f);await r.g.Linking.openURL(t,this.client.name)}else{const t=Jh[i].req;s&&(t.ttl=s),o&&(t.id=o),c?(t.internal=cu(au({},t.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(e,f,t)):this.client.core.relayer.publish(e,f,t).catch((t=>this.client.logger.error(t)))}return u.id},this.sendResult=async t=>{const{id:e,topic:i,result:n,throwOnFailedPublish:s,encodeOpts:o,appLink:a}=t,c=(0,Co.formatJsonRpcResult)(e,n);let h;const u=a&&typeof(null==r.g?void 0:r.g.Linking)<"u";try{const t=u?Gn:Jn;h=await this.client.core.crypto.encode(i,c,cu(au({},o||{}),{encoding:t}))}catch(t){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${i} failed`),t}let f;try{f=await this.client.core.history.get(i,e)}catch(t){throw this.client.logger.error(`sendResult() -> history.get(${i}, ${e}) failed`),t}if(u){const t=_s(a,i,h);await r.g.Linking.openURL(t,this.client.name)}else{const t=Jh[f.request.method].res;s?(t.internal=cu(au({},t.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,h,t)):this.client.core.relayer.publish(i,h,t).catch((t=>this.client.logger.error(t)))}await this.client.core.history.resolve(c)},this.sendError=async t=>{const{id:e,topic:i,error:n,encodeOpts:s,rpcOpts:o,appLink:a}=t,c=(0,Co.formatJsonRpcError)(e,n);let h;const u=a&&typeof(null==r.g?void 0:r.g.Linking)<"u";try{const t=u?Gn:Jn;h=await this.client.core.crypto.encode(i,c,cu(au({},s||{}),{encoding:t}))}catch(t){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${i} failed`),t}let f;try{f=await this.client.core.history.get(i,e)}catch(t){throw this.client.logger.error(`sendError() -> history.get(${i}, ${e}) failed`),t}if(u){const t=_s(a,i,h);await r.g.Linking.openURL(t,this.client.name)}else{const t=o||Jh[f.request.method].res;this.client.core.relayer.publish(i,h,t)}await this.client.core.history.resolve(c)},this.cleanup=async()=>{const t=[],e=[];this.client.session.getAll().forEach((e=>{let r=!1;it(e.expiry)&&(r=!0),this.client.core.crypto.keychain.has(e.topic)||(r=!0),r&&t.push(e.topic)})),this.client.proposal.getAll().forEach((t=>{it(t.expiryTimestamp)&&e.push(t.id)})),await Promise.all([...t.map((t=>this.deleteSession({topic:t}))),...e.map((t=>this.deleteProposal(t)))])},this.onRelayEventRequest=async t=>{this.requestQueue.queue.push(t),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state!==Wh){for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=Wh;const t=this.requestQueue.queue.shift();if(t)try{await this.processRequest(t)}catch(t){this.client.logger.warn(t)}}this.requestQueue.state=Qh}else this.client.logger.info("Request queue already active, skipping...")},this.processRequest=async t=>{const{topic:e,payload:r,attestation:i,transportType:n,encryptedId:s}=t,o=r.method;if(!this.shouldIgnorePairingRequest({topic:e,requestMethod:o}))switch(o){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:e,payload:r,attestation:i,encryptedId:s});case"wc_sessionSettle":return await this.onSessionSettleRequest(e,r);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(e,r);case"wc_sessionExtend":return await this.onSessionExtendRequest(e,r);case"wc_sessionPing":return await this.onSessionPingRequest(e,r);case"wc_sessionDelete":return await this.onSessionDeleteRequest(e,r);case"wc_sessionRequest":return await this.onSessionRequest({topic:e,payload:r,attestation:i,encryptedId:s,transportType:n});case"wc_sessionEvent":return await this.onSessionEventRequest(e,r);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:e,payload:r,attestation:i,encryptedId:s,transportType:n});default:return this.client.logger.info(`Unsupported request method ${o}`)}},this.onRelayEventResponse=async t=>{const{topic:e,payload:r,transportType:i}=t,n=(await this.client.core.history.get(e,r.id)).request.method;switch(n){case"wc_sessionPropose":return this.onSessionProposeResponse(e,r,i);case"wc_sessionSettle":return this.onSessionSettleResponse(e,r);case"wc_sessionUpdate":return this.onSessionUpdateResponse(e,r);case"wc_sessionExtend":return this.onSessionExtendResponse(e,r);case"wc_sessionPing":return this.onSessionPingResponse(e,r);case"wc_sessionRequest":return this.onSessionRequestResponse(e,r);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(e,r);default:return this.client.logger.info(`Unsupported response method ${n}`)}},this.onRelayEventUnknownPayload=t=>{const{topic:e}=t,{message:r}=xs("MISSING_OR_INVALID",`Decoded payload on topic ${e} is not identifiable as a JSON-RPC request or a response.`);throw new Error(r)},this.shouldIgnorePairingRequest=t=>{const{topic:e,requestMethod:r}=t,i=this.expectedPairingMethodMap.get(e);return!(!i||i.includes(r)||!(i.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0))},this.onSessionProposeRequest=async t=>{const{topic:e,payload:r,attestation:i,encryptedId:n}=t,{params:s,id:o}=r;try{const t=this.client.core.eventClient.getEvent({topic:e});this.isValidConnect(au({},r.params));const a=s.expiryTimestamp||rt(Jh.wc_sessionPropose.req.ttl),c=au({id:o,pairingTopic:e,expiryTimestamp:a},s);await this.setProposal(o,c);const h=await this.getVerifyContext({attestationId:i,hash:Xn(JSON.stringify(r)),encryptedId:n,metadata:c.proposer.metadata});0===this.client.events.listenerCount("session_proposal")&&(console.warn("No listener for session_proposal event"),t?.setError("proposal_listener_not_found")),t?.addTrace("emit_session_proposal"),this.client.events.emit("session_proposal",{id:o,params:c,verifyContext:h})}catch(t){await this.sendError({id:o,topic:e,error:t,rpcOpts:Jh.wc_sessionPropose.autoReject}),this.client.logger.error(t)}},this.onSessionProposeResponse=async(t,e,r)=>{const{id:i}=e;if((0,Co.isJsonRpcResult)(e)){const{result:n}=e;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:n});const s=this.client.proposal.get(i);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:s});const o=s.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:o});const a=n.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:a});const c=await this.client.core.crypto.generateSharedKey(o,a);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:c});const h=await this.client.core.relayer.subscribe(c,{transportType:r});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:h}),await this.client.core.pairing.activate({topic:t})}else if((0,Co.isJsonRpcError)(e)){await this.client.proposal.delete(i,Rs("USER_DISCONNECTED"));const t=nt("session_connect");if(0===this.events.listenerCount(t))throw new Error(`emitting ${t} without any listeners, 954`);this.events.emit(nt("session_connect"),{error:e.error})}},this.onSessionSettleRequest=async(t,e)=>{const{id:r,params:i}=e;try{this.isValidSessionSettleRequest(i);const{relay:r,controller:n,expiry:s,namespaces:o,sessionProperties:a,sessionConfig:c}=e.params,h=cu(au(au({topic:t,relay:r,expiry:s,namespaces:o,acknowledged:!0,pairingTopic:"",requiredNamespaces:{},optionalNamespaces:{},controller:n.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:n.publicKey,metadata:n.metadata}},a&&{sessionProperties:a}),c&&{sessionConfig:c}),{transportType:ta.relay}),u=nt("session_connect");if(0===this.events.listenerCount(u))throw new Error(`emitting ${u} without any listeners 997`);this.events.emit(nt("session_connect"),{session:h}),await this.sendResult({id:e.id,topic:t,result:!0,throwOnFailedPublish:!0})}catch(e){await this.sendError({id:r,topic:t,error:e}),this.client.logger.error(e)}},this.onSessionSettleResponse=async(t,e)=>{const{id:r}=e;(0,Co.isJsonRpcResult)(e)?(await this.client.session.update(t,{acknowledged:!0}),this.events.emit(nt("session_approve",r),{})):(0,Co.isJsonRpcError)(e)&&(await this.client.session.delete(t,Rs("USER_DISCONNECTED")),this.events.emit(nt("session_approve",r),{error:e.error}))},this.onSessionUpdateRequest=async(t,e)=>{const{params:r,id:i}=e;try{const e=`${t}_session_update`,n=Vs.get(e);if(n&&this.isRequestOutOfSync(n,i))return this.client.logger.info(`Discarding out of sync request - ${i}`),void this.sendError({id:i,topic:t,error:Rs("INVALID_UPDATE_REQUEST")});this.isValidUpdate(au({topic:t},r));try{Vs.set(e,i),await this.client.session.update(t,{namespaces:r.namespaces}),await this.sendResult({id:i,topic:t,result:!0,throwOnFailedPublish:!0})}catch(t){throw Vs.delete(e),t}this.client.events.emit("session_update",{id:i,topic:t,params:r})}catch(e){await this.sendError({id:i,topic:t,error:e}),this.client.logger.error(e)}},this.isRequestOutOfSync=(t,e)=>parseInt(e.toString().slice(0,-3))<=parseInt(t.toString().slice(0,-3)),this.onSessionUpdateResponse=(t,e)=>{const{id:r}=e,i=nt("session_update",r);if(0===this.events.listenerCount(i))throw new Error(`emitting ${i} without any listeners`);(0,Co.isJsonRpcResult)(e)?this.events.emit(nt("session_update",r),{}):(0,Co.isJsonRpcError)(e)&&this.events.emit(nt("session_update",r),{error:e.error})},this.onSessionExtendRequest=async(t,e)=>{const{id:r}=e;try{this.isValidExtend({topic:t}),await this.setExpiry(t,rt(Vh)),await this.sendResult({id:r,topic:t,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:r,topic:t})}catch(e){await this.sendError({id:r,topic:t,error:e}),this.client.logger.error(e)}},this.onSessionExtendResponse=(t,e)=>{const{id:r}=e,i=nt("session_extend",r);if(0===this.events.listenerCount(i))throw new Error(`emitting ${i} without any listeners`);(0,Co.isJsonRpcResult)(e)?this.events.emit(nt("session_extend",r),{}):(0,Co.isJsonRpcError)(e)&&this.events.emit(nt("session_extend",r),{error:e.error})},this.onSessionPingRequest=async(t,e)=>{const{id:r}=e;try{this.isValidPing({topic:t}),await this.sendResult({id:r,topic:t,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:r,topic:t})}catch(e){await this.sendError({id:r,topic:t,error:e}),this.client.logger.error(e)}},this.onSessionPingResponse=(t,e)=>{const{id:r}=e,i=nt("session_ping",r);if(0===this.events.listenerCount(i))throw new Error(`emitting ${i} without any listeners`);setTimeout((()=>{(0,Co.isJsonRpcResult)(e)?this.events.emit(nt("session_ping",r),{}):(0,Co.isJsonRpcError)(e)&&this.events.emit(nt("session_ping",r),{error:e.error})}),500)},this.onSessionDeleteRequest=async(t,e)=>{const{id:r}=e;try{this.isValidDisconnect({topic:t,reason:e.params}),Promise.all([new Promise((e=>{this.client.core.relayer.once(Go,(async()=>{e(await this.deleteSession({topic:t,id:r}))}))})),this.sendResult({id:r,topic:t,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:t,error:Rs("USER_DISCONNECTED")})]).catch((t=>this.client.logger.error(t)))}catch(t){this.client.logger.error(t)}},this.onSessionRequest=async t=>{var e,r,i;const{topic:n,payload:s,attestation:o,encryptedId:a,transportType:c}=t,{id:h,params:u}=s;try{await this.isValidRequest(au({topic:n},u));const t=this.client.session.get(n),s={id:h,topic:n,params:u,verifyContext:await this.getVerifyContext({attestationId:o,hash:Xn(JSON.stringify((0,Co.formatJsonRpcRequest)("wc_sessionRequest",u,h))),encryptedId:a,metadata:t.peer.metadata,transportType:c})};await this.setPendingSessionRequest(s),c===ta.link_mode&&null!=(e=t.peer.metadata.redirect)&&e.universal&&this.client.core.addLinkModeSupportedApp(null==(r=t.peer.metadata.redirect)?void 0:r.universal),null!=(i=this.client.signConfig)&&i.disableRequestQueue?this.emitSessionRequest(s):(this.addSessionRequestToSessionRequestQueue(s),this.processSessionRequestQueue())}catch(t){await this.sendError({id:h,topic:n,error:t}),this.client.logger.error(t)}},this.onSessionRequestResponse=(t,e)=>{const{id:r}=e,i=nt("session_request",r);if(0===this.events.listenerCount(i))throw new Error(`emitting ${i} without any listeners`);(0,Co.isJsonRpcResult)(e)?this.events.emit(nt("session_request",r),{result:e.result}):(0,Co.isJsonRpcError)(e)&&this.events.emit(nt("session_request",r),{error:e.error})},this.onSessionEventRequest=async(t,e)=>{const{id:r,params:i}=e;try{const e=`${t}_session_event_${i.event.name}`,n=Vs.get(e);if(n&&this.isRequestOutOfSync(n,r))return void this.client.logger.info(`Discarding out of sync request - ${r}`);this.isValidEmit(au({topic:t},i)),this.client.events.emit("session_event",{id:r,topic:t,params:i}),Vs.set(e,r)}catch(e){await this.sendError({id:r,topic:t,error:e}),this.client.logger.error(e)}},this.onSessionAuthenticateResponse=(t,e)=>{const{id:r}=e;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:t,payload:e}),(0,Co.isJsonRpcResult)(e)?this.events.emit(nt("session_request",r),{result:e.result}):(0,Co.isJsonRpcError)(e)&&this.events.emit(nt("session_request",r),{error:e.error})},this.onSessionAuthenticateRequest=async t=>{var e;const{topic:r,payload:i,attestation:n,encryptedId:s,transportType:o}=t;try{const{requester:t,authPayload:a,expiryTimestamp:c}=i.params,h=await this.getVerifyContext({attestationId:n,hash:Xn(JSON.stringify(i)),encryptedId:s,metadata:t.metadata,transportType:o}),u={requester:t,pairingTopic:r,id:i.id,authPayload:a,verifyContext:h,expiryTimestamp:c};await this.setAuthRequest(i.id,{request:u,pairingTopic:r,transportType:o}),o===ta.link_mode&&null!=(e=t.metadata.redirect)&&e.universal&&this.client.core.addLinkModeSupportedApp(t.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:r,params:i.params,id:i.id,verifyContext:h})}catch(t){this.client.logger.error(t);const e=i.params.requester.publicKey,n=await this.client.core.crypto.generateKeyPair(),s=this.getAppLinkIfEnabled(i.params.requester.metadata,o),a={type:1,receiverPublicKey:e,senderPublicKey:n};await this.sendError({id:i.id,topic:r,error:t,encodeOpts:a,rpcOpts:Jh.wc_sessionAuthenticate.autoReject,appLink:s})}},this.addSessionRequestToSessionRequestQueue=t=>{this.sessionRequestQueue.queue.push(t)},this.cleanupAfterResponse=t=>{this.deletePendingSessionRequest(t.response.id,{message:"fulfilled",code:0}),setTimeout((()=>{this.sessionRequestQueue.state=Qh,this.processSessionRequestQueue()}),(0,o.toMiliseconds)(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:t,error:e})=>{const r=this.client.core.history.pending;r.length>0&&r.filter((e=>e.topic===t&&"wc_sessionRequest"===e.request.method)).forEach((t=>{const r=nt("session_request",t.request.id);if(0===this.events.listenerCount(r))throw new Error(`emitting ${r} without any listeners`);this.events.emit(nt("session_request",t.request.id),{error:e})}))},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===Wh)return void this.client.logger.info("session request queue is already active.");const t=this.sessionRequestQueue.queue[0];if(t)try{this.sessionRequestQueue.state=Wh,this.emitSessionRequest(t)}catch(t){this.client.logger.error(t)}else this.client.logger.info("session request queue is empty.")},this.emitSessionRequest=t=>{this.client.events.emit("session_request",t)},this.onPairingCreated=t=>{if(t.methods&&this.expectedPairingMethodMap.set(t.topic,t.methods),t.active)return;const e=this.client.proposal.getAll().find((e=>e.pairingTopic===t.topic));e&&this.onSessionProposeRequest({topic:t.topic,payload:(0,Co.formatJsonRpcRequest)("wc_sessionPropose",{requiredNamespaces:e.requiredNamespaces,optionalNamespaces:e.optionalNamespaces,relays:e.relays,proposer:e.proposer,sessionProperties:e.sessionProperties},e.id)})},this.isValidConnect=async t=>{if(!zs(t)){const{message:e}=xs("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(t)}`);throw new Error(e)}const{pairingTopic:e,requiredNamespaces:r,optionalNamespaces:i,sessionProperties:n,relays:s}=t;if(Cs(e)||await this.isValidPairingTopic(e),!function(t){let e=!1;return t?t&&Ns(t)&&t.length&&t.forEach((t=>{e=Ls(t)})):e=!0,e}(s)){const{message:t}=xs("MISSING_OR_INVALID",`connect() relays: ${s}`);throw new Error(t)}!Cs(r)&&0!==Os(r)&&this.validateNamespaces(r,"requiredNamespaces"),!Cs(i)&&0!==Os(i)&&this.validateNamespaces(i,"optionalNamespaces"),Cs(n)||this.validateSessionProps(n,"sessionProperties")},this.validateNamespaces=(t,e)=>{const r=function(t,e,r){let i=null;if(t&&Os(t)){const n=Us(t,e);n&&(i=n);const s=function(t,e,r){let i=null;return Object.entries(t).forEach((([t,n])=>{if(i)return;const s=function(t,e,r){let i=null;return Ns(e)&&e.length?e.forEach((t=>{i||ks(t)||(i=Rs("UNSUPPORTED_CHAINS",`${r}, chain ${t} should be a string and conform to "namespace:chainId" format`))})):ks(t)||(i=Rs("UNSUPPORTED_CHAINS",`${r}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),i}(t,T(t,n),`${e} ${r}`);s&&(i=s)})),i}(t,e,r);s&&(i=s)}else i=xs("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return i}(t,"connect()",e);if(r)throw new Error(r.message)},this.isValidApprove=async t=>{if(!zs(t))throw new Error(xs("MISSING_OR_INVALID",`approve() params: ${t}`).message);const{id:e,namespaces:r,relayProtocol:i,sessionProperties:n}=t;this.checkRecentlyDeleted(e),await this.isValidProposalId(e);const s=this.client.proposal.get(e),o=Bs(r,"approve()");if(o)throw new Error(o.message);const a=Fs(s.requiredNamespaces,r,"approve()");if(a)throw new Error(a.message);if(!Ts(i,!0)){const{message:t}=xs("MISSING_OR_INVALID",`approve() relayProtocol: ${i}`);throw new Error(t)}Cs(n)||this.validateSessionProps(n,"sessionProperties")},this.isValidReject=async t=>{if(!zs(t)){const{message:e}=xs("MISSING_OR_INVALID",`reject() params: ${t}`);throw new Error(e)}const{id:e,reason:r}=t;if(this.checkRecentlyDeleted(e),await this.isValidProposalId(e),!function(t){return!!(t&&"object"==typeof t&&t.code&&qs(t.code,!1)&&t.message&&Ts(t.message,!1))}(r)){const{message:t}=xs("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(r)}`);throw new Error(t)}},this.isValidSessionSettleRequest=t=>{if(!zs(t)){const{message:e}=xs("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${t}`);throw new Error(e)}const{relay:e,controller:r,namespaces:i,expiry:n}=t;if(!Ls(e)){const{message:t}=xs("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(t)}const s=function(t){let e=null;return Ts(t?.publicKey,!1)||(e=xs("MISSING_OR_INVALID","onSessionSettleRequest() controller public key should be a string")),e}(r);if(s)throw new Error(s.message);const o=Bs(i,"onSessionSettleRequest()");if(o)throw new Error(o.message);if(it(n)){const{message:t}=xs("EXPIRED","onSessionSettleRequest()");throw new Error(t)}},this.isValidUpdate=async t=>{if(!zs(t)){const{message:e}=xs("MISSING_OR_INVALID",`update() params: ${t}`);throw new Error(e)}const{topic:e,namespaces:r}=t;this.checkRecentlyDeleted(e),await this.isValidSessionTopic(e);const i=this.client.session.get(e),n=Bs(r,"update()");if(n)throw new Error(n.message);const s=Fs(i.requiredNamespaces,r,"update()");if(s)throw new Error(s.message)},this.isValidExtend=async t=>{if(!zs(t)){const{message:e}=xs("MISSING_OR_INVALID",`extend() params: ${t}`);throw new Error(e)}const{topic:e}=t;this.checkRecentlyDeleted(e),await this.isValidSessionTopic(e)},this.isValidRequest=async t=>{if(!zs(t)){const{message:e}=xs("MISSING_OR_INVALID",`request() params: ${t}`);throw new Error(e)}const{topic:e,request:r,chainId:i,expiry:n}=t;this.checkRecentlyDeleted(e),await this.isValidSessionTopic(e);const{namespaces:s}=this.client.session.get(e);if(!js(s,i)){const{message:t}=xs("MISSING_OR_INVALID",`request() chainId: ${i}`);throw new Error(t)}if(!function(t){return!(Cs(t)||!Ts(t.method,!1))}(r)){const{message:t}=xs("MISSING_OR_INVALID",`request() ${JSON.stringify(r)}`);throw new Error(t)}if(!function(t,e,r){return!!Ts(r,!1)&&function(t,e){const r=[];return Object.values(t).forEach((t=>{As(t.accounts).includes(e)&&r.push(...t.methods)})),r}(t,e).includes(r)}(s,i,r.method)){const{message:t}=xs("MISSING_OR_INVALID",`request() method: ${r.method}`);throw new Error(t)}if(n&&!function(t,e){return qs(t,!1)&&t<=e.max&&t>=e.min}(n,Gh)){const{message:t}=xs("MISSING_OR_INVALID",`request() expiry: ${n}. Expiry must be a number (in seconds) between ${Gh.min} and ${Gh.max}`);throw new Error(t)}},this.isValidRespond=async t=>{var e;if(!zs(t)){const{message:e}=xs("MISSING_OR_INVALID",`respond() params: ${t}`);throw new Error(e)}const{topic:r,response:i}=t;try{await this.isValidSessionTopic(r)}catch(r){throw null!=(e=t?.response)&&e.id&&this.cleanupAfterResponse(t),r}if(!function(t){return!(Cs(t)||Cs(t.result)&&Cs(t.error)||!qs(t.id,!1)||!Ts(t.jsonrpc,!1))}(i)){const{message:t}=xs("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(i)}`);throw new Error(t)}},this.isValidPing=async t=>{if(!zs(t)){const{message:e}=xs("MISSING_OR_INVALID",`ping() params: ${t}`);throw new Error(e)}const{topic:e}=t;await this.isValidSessionOrPairingTopic(e)},this.isValidEmit=async t=>{if(!zs(t)){const{message:e}=xs("MISSING_OR_INVALID",`emit() params: ${t}`);throw new Error(e)}const{topic:e,event:r,chainId:i}=t;await this.isValidSessionTopic(e);const{namespaces:n}=this.client.session.get(e);if(!js(n,i)){const{message:t}=xs("MISSING_OR_INVALID",`emit() chainId: ${i}`);throw new Error(t)}if(!function(t){return!(Cs(t)||!Ts(t.name,!1))}(r)){const{message:t}=xs("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(r)}`);throw new Error(t)}if(!function(t,e,r){return!!Ts(r,!1)&&function(t,e){const r=[];return Object.values(t).forEach((t=>{As(t.accounts).includes(e)&&r.push(...t.events)})),r}(t,e).includes(r)}(n,i,r.name)){const{message:t}=xs("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(r)}`);throw new Error(t)}},this.isValidDisconnect=async t=>{if(!zs(t)){const{message:e}=xs("MISSING_OR_INVALID",`disconnect() params: ${t}`);throw new Error(e)}const{topic:e}=t;await this.isValidSessionOrPairingTopic(e)},this.isValidAuthenticate=t=>{const{chains:e,uri:r,domain:i,nonce:n}=t;if(!Array.isArray(e)||0===e.length)throw new Error("chains is required and must be a non-empty array");if(!Ts(r,!1))throw new Error("uri is required parameter");if(!Ts(i,!1))throw new Error("domain is required parameter");if(!Ts(n,!1))throw new Error("nonce is required parameter");if([...new Set(e.map((t=>O(t).namespace)))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:s}=O(e[0]);if("eip155"!==s)throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")},this.getVerifyContext=async t=>{const{attestationId:e,hash:r,encryptedId:i,metadata:n,transportType:s}=t,o={verified:{verifyUrl:n.verifyUrl||ga,validation:"UNKNOWN",origin:n.url||""}};try{if(s===ta.link_mode){const t=this.getAppLinkIfEnabled(n,s);return o.verified.validation=t&&new URL(t).origin===new URL(n.url).origin?"VALID":"INVALID",o}const t=await this.client.core.verify.resolve({attestationId:e,hash:r,encryptedId:i,verifyUrl:n.verifyUrl});t&&(o.verified.origin=t.origin,o.verified.isScam=t.isScam,o.verified.validation=t.origin===new URL(n.url).origin?"VALID":"INVALID")}catch(t){this.client.logger.warn(t)}return this.client.logger.debug(`Verify context: ${JSON.stringify(o)}`),o},this.validateSessionProps=(t,e)=>{Object.values(t).forEach((t=>{if(!Ts(t,!1)){const{message:r}=xs("MISSING_OR_INVALID",`${e} must be in Record<string, string> format. Received: ${JSON.stringify(t)}`);throw new Error(r)}}))},this.getPendingAuthRequest=t=>{const e=this.client.auth.requests.get(t);return"object"==typeof e?e:void 0},this.addToRecentlyDeleted=(t,e)=>{if(this.recentlyDeletedMap.set(t,e),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let t=0;const e=this.recentlyDeletedLimit/2;for(const r of this.recentlyDeletedMap.keys()){if(t++>=e)break;this.recentlyDeletedMap.delete(r)}}},this.checkRecentlyDeleted=t=>{const e=this.recentlyDeletedMap.get(t);if(e){const{message:r}=xs("MISSING_OR_INVALID",`Record was recently deleted - ${e}: ${t}`);throw new Error(r)}},this.isLinkModeEnabled=(t,e)=>{var i,n,s,o,a,c,h,u,f;return!(!t||e!==ta.link_mode)&&!0===(null==(n=null==(i=this.client.metadata)?void 0:i.redirect)?void 0:n.linkMode)&&void 0!==(null==(o=null==(s=this.client.metadata)?void 0:s.redirect)?void 0:o.universal)&&""!==(null==(c=null==(a=this.client.metadata)?void 0:a.redirect)?void 0:c.universal)&&void 0!==(null==(h=t?.redirect)?void 0:h.universal)&&""!==(null==(u=t?.redirect)?void 0:u.universal)&&!0===(null==(f=t?.redirect)?void 0:f.linkMode)&&this.client.core.linkModeSupportedApps.includes(t.redirect.universal)&&typeof(null==r.g?void 0:r.g.Linking)<"u"},this.getAppLinkIfEnabled=(t,e)=>{var r;return this.isLinkModeEnabled(t,e)?null==(r=t?.redirect)?void 0:r.universal:void 0},this.handleLinkModeMessage=({url:t})=>{if(!t||!t.includes("wc_ev")||!t.includes("topic"))return;const e=ot(t,"topic")||"",r=decodeURIComponent(ot(t,"wc_ev")||""),i=this.client.session.keys.includes(e);i&&this.client.session.update(e,{transportType:ta.link_mode}),this.client.core.dispatchEnvelope({topic:e,message:r,sessionExists:i})},this.registerLinkModeListeners=async()=>{var t;if(ct()||K()&&null!=(t=this.client.metadata.redirect)&&t.linkMode){const t=null==r.g?void 0:r.g.Linking;if(typeof t<"u"){t.addEventListener("url",this.handleLinkModeMessage,this.client.name);const e=await t.getInitialURL();e&&setTimeout((()=>{this.handleLinkModeMessage({url:e})}),50)}}}}isInitialized(){if(!this.initialized){const{message:t}=xs("NOT_INITIALIZED",this.name);throw new Error(t)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on($o,(t=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(t):this.onRelayMessage(t)}))}async onRelayMessage(t){const{topic:e,message:r,attestation:i,transportType:n}=t,{publicKey:s}=this.client.auth.authKeys.keys.includes(Zh)?this.client.auth.authKeys.get(Zh):{responseTopic:void 0,publicKey:void 0},o=await this.client.core.crypto.decode(e,r,{receiverPublicKey:s,encoding:n===ta.link_mode?Gn:Jn});try{(0,Co.isJsonRpcRequest)(o)?(this.client.core.history.set(e,o),this.onRelayEventRequest({topic:e,payload:o,attestation:i,transportType:n,encryptedId:Xn(r)})):(0,Co.isJsonRpcResponse)(o)?(await this.client.core.history.resolve(o),await this.onRelayEventResponse({topic:e,payload:o,transportType:n}),this.client.core.history.delete(e,o.id)):this.onRelayEventUnknownPayload({topic:e,payload:o,transportType:n})}catch(t){this.client.logger.error(t)}}registerExpirerEvents(){this.client.core.expirer.on(la,(async t=>{const{topic:e,id:r}=et(t.target);return r&&this.client.pendingRequest.keys.includes(r)?await this.deletePendingSessionRequest(r,xs("EXPIRED"),!0):r&&this.client.auth.requests.keys.includes(r)?await this.deletePendingAuthRequest(r,xs("EXPIRED"),!0):void(e?this.client.session.keys.includes(e)&&(await this.deleteSession({topic:e,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:e})):r&&(await this.deleteProposal(r,!0),this.client.events.emit("proposal_expire",{id:r})))}))}registerPairingEvents(){this.client.core.pairing.events.on(oa,(t=>this.onPairingCreated(t))),this.client.core.pairing.events.on(aa,(t=>{this.addToRecentlyDeleted(t.topic,"pairing")}))}isValidPairingTopic(t){if(!Ts(t,!1)){const{message:e}=xs("MISSING_OR_INVALID",`pairing topic should be a string: ${t}`);throw new Error(e)}if(!this.client.core.pairing.pairings.keys.includes(t)){const{message:e}=xs("NO_MATCHING_KEY",`pairing topic doesn't exist: ${t}`);throw new Error(e)}if(it(this.client.core.pairing.pairings.get(t).expiry)){const{message:e}=xs("EXPIRED",`pairing topic: ${t}`);throw new Error(e)}}async isValidSessionTopic(t){if(!Ts(t,!1)){const{message:e}=xs("MISSING_OR_INVALID",`session topic should be a string: ${t}`);throw new Error(e)}if(this.checkRecentlyDeleted(t),!this.client.session.keys.includes(t)){const{message:e}=xs("NO_MATCHING_KEY",`session topic doesn't exist: ${t}`);throw new Error(e)}if(it(this.client.session.get(t).expiry)){await this.deleteSession({topic:t});const{message:e}=xs("EXPIRED",`session topic: ${t}`);throw new Error(e)}if(!this.client.core.crypto.keychain.has(t)){const{message:e}=xs("MISSING_OR_INVALID",`session topic does not exist in keychain: ${t}`);throw await this.deleteSession({topic:t}),new Error(e)}}async isValidSessionOrPairingTopic(t){if(this.checkRecentlyDeleted(t),this.client.session.keys.includes(t))await this.isValidSessionTopic(t);else{if(!this.client.core.pairing.pairings.keys.includes(t)){if(Ts(t,!1)){const{message:e}=xs("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${t}`);throw new Error(e)}{const{message:e}=xs("MISSING_OR_INVALID",`session or pairing topic should be a string: ${t}`);throw new Error(e)}}this.isValidPairingTopic(t)}}async isValidProposalId(t){if(!function(t){return"number"==typeof t}(t)){const{message:e}=xs("MISSING_OR_INVALID",`proposal id should be a number: ${t}`);throw new Error(e)}if(!this.client.proposal.keys.includes(t)){const{message:e}=xs("NO_MATCHING_KEY",`proposal id doesn't exist: ${t}`);throw new Error(e)}if(it(this.client.proposal.get(t).expiryTimestamp)){await this.deleteProposal(t);const{message:e}=xs("EXPIRED",`proposal id: ${t}`);throw new Error(e)}}}class uu extends mh{constructor(t,e){super(t,e,"proposal",Fh),this.core=t,this.logger=e}}class fu extends mh{constructor(t,e){super(t,e,"session",Fh),this.core=t,this.logger=e}}class du extends mh{constructor(t,e){super(t,e,"request",Fh,(t=>t.id)),this.core=t,this.logger=e}}class lu extends mh{constructor(t,e){super(t,e,"authKeys",Xh,(()=>Zh)),this.core=t,this.logger=e}}class pu extends mh{constructor(t,e){super(t,e,"pairingTopics",Xh),this.core=t,this.logger=e}}class gu extends mh{constructor(t,e){super(t,e,"requests",Xh,(t=>t.id)),this.core=t,this.logger=e}}class mu{constructor(t,e){this.core=t,this.logger=e,this.authKeys=new lu(this.core,this.logger),this.pairingTopics=new pu(this.core,this.logger),this.requests=new gu(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}class bu extends co{constructor(t){super(t),this.protocol="wc",this.version=2,this.name=Hh,this.events=new i.EventEmitter,this.on=(t,e)=>this.events.on(t,e),this.once=(t,e)=>this.events.once(t,e),this.off=(t,e)=>this.events.off(t,e),this.removeListener=(t,e)=>this.events.removeListener(t,e),this.removeAllListeners=t=>this.events.removeAllListeners(t),this.connect=async t=>{try{return await this.engine.connect(t)}catch(t){throw this.logger.error(t.message),t}},this.pair=async t=>{try{return await this.engine.pair(t)}catch(t){throw this.logger.error(t.message),t}},this.approve=async t=>{try{return await this.engine.approve(t)}catch(t){throw this.logger.error(t.message),t}},this.reject=async t=>{try{return await this.engine.reject(t)}catch(t){throw this.logger.error(t.message),t}},this.update=async t=>{try{return await this.engine.update(t)}catch(t){throw this.logger.error(t.message),t}},this.extend=async t=>{try{return await this.engine.extend(t)}catch(t){throw this.logger.error(t.message),t}},this.request=async t=>{try{return await this.engine.request(t)}catch(t){throw this.logger.error(t.message),t}},this.respond=async t=>{try{return await this.engine.respond(t)}catch(t){throw this.logger.error(t.message),t}},this.ping=async t=>{try{return await this.engine.ping(t)}catch(t){throw this.logger.error(t.message),t}},this.emit=async t=>{try{return await this.engine.emit(t)}catch(t){throw this.logger.error(t.message),t}},this.disconnect=async t=>{try{return await this.engine.disconnect(t)}catch(t){throw this.logger.error(t.message),t}},this.find=t=>{try{return this.engine.find(t)}catch(t){throw this.logger.error(t.message),t}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(t){throw this.logger.error(t.message),t}},this.authenticate=async(t,e)=>{try{return await this.engine.authenticate(t,e)}catch(t){throw this.logger.error(t.message),t}},this.formatAuthMessage=t=>{try{return this.engine.formatAuthMessage(t)}catch(t){throw this.logger.error(t.message),t}},this.approveSessionAuthenticate=async t=>{try{return await this.engine.approveSessionAuthenticate(t)}catch(t){throw this.logger.error(t.message),t}},this.rejectSessionAuthenticate=async t=>{try{return await this.engine.rejectSessionAuthenticate(t)}catch(t){throw this.logger.error(t.message),t}},this.name=t?.name||Hh,this.metadata=t?.metadata||J(),this.signConfig=t?.signConfig;const e=typeof t?.logger<"u"&&"string"!=typeof t?.logger?t.logger:(0,Qs.h6)((0,Qs.iP)({level:t?.logger||"error"}));this.core=t?.core||new zh(t),this.logger=(0,Qs.U5)(e,this.name),this.session=new fu(this.core,this.logger),this.proposal=new uu(this.core,this.logger),this.pendingRequest=new du(this.core,this.logger),this.engine=new hu(this),this.auth=new mu(this.core,this.logger)}static async init(t){const e=new bu(t);return await e.initialize(),e}get context(){return(0,Qs.oI)(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success"),this.engine.processRelayMessageCache()}catch(t){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(t.message),t}}}var vu=r(64264);const yu="error",wu="wc@2:universal_provider:",_u="https://rpc.walletconnect.org/v1/",Au="generic",Mu=`${_u}bundler`,Eu="default_chain_changed";var Iu,Su,Pu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof r.g<"u"?r.g:typeof self<"u"?self:{},xu={exports:{}};Iu=xu,Su=xu.exports,function(){var t,e="Expected a function",r="__lodash_hash_undefined__",i="__lodash_placeholder__",n=32,s=128,o=1/0,a=9007199254740991,c=NaN,h=4294967295,u=h-1,f=h>>>1,d=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",n],["partialRight",64],["rearg",256]],l="[object Arguments]",p="[object Array]",g="[object Boolean]",m="[object Date]",b="[object Error]",v="[object Function]",y="[object GeneratorFunction]",w="[object Map]",_="[object Number]",A="[object Object]",M="[object Promise]",E="[object RegExp]",I="[object Set]",S="[object String]",P="[object Symbol]",x="[object WeakMap]",R="[object ArrayBuffer]",N="[object DataView]",O="[object Float32Array]",C="[object Float64Array]",T="[object Int8Array]",q="[object Int16Array]",k="[object Int32Array]",D="[object Uint8Array]",U="[object Uint8ClampedArray]",B="[object Uint16Array]",L="[object Uint32Array]",z=/\b__p \+= '';/g,j=/\b(__p \+=) '' \+/g,F=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,K=/[&<>"']/g,$=RegExp(H.source),V=RegExp(K.source),J=/<%-([\s\S]+?)%>/g,G=/<%([\s\S]+?)%>/g,Q=/<%=([\s\S]+?)%>/g,W=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Y=/^\w*$/,X=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Z=/[\\^$.*+?()[\]{}|]/g,tt=RegExp(Z.source),et=/^\s+/,rt=/\s/,it=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,nt=/\{\n\/\* \[wrapped with (.+)\] \*/,st=/,? & /,ot=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,at=/[()=,{}\[\]\/\s]/,ct=/\\(\\)?/g,ht=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ut=/\w*$/,ft=/^[-+]0x[0-9a-f]+$/i,dt=/^0b[01]+$/i,lt=/^\[object .+?Constructor\]$/,pt=/^0o[0-7]+$/i,gt=/^(?:0|[1-9]\d*)$/,mt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,bt=/($^)/,vt=/['\n\r\u2028\u2029\\]/g,yt="\\ud800-\\udfff",wt="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",_t="\\u2700-\\u27bf",At="a-z\\xdf-\\xf6\\xf8-\\xff",Mt="A-Z\\xc0-\\xd6\\xd8-\\xde",Et="\\ufe0e\\ufe0f",It="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",St="["+yt+"]",Pt="["+It+"]",xt="["+wt+"]",Rt="\\d+",Nt="["+_t+"]",Ot="["+At+"]",Ct="[^"+yt+It+Rt+_t+At+Mt+"]",Tt="\\ud83c[\\udffb-\\udfff]",qt="[^"+yt+"]",kt="(?:\\ud83c[\\udde6-\\uddff]){2}",Dt="[\\ud800-\\udbff][\\udc00-\\udfff]",Ut="["+Mt+"]",Bt="\\u200d",Lt="(?:"+Ot+"|"+Ct+")",zt="(?:"+Ut+"|"+Ct+")",jt="(?:['’](?:d|ll|m|re|s|t|ve))?",Ft="(?:['’](?:D|LL|M|RE|S|T|VE))?",Ht="(?:"+xt+"|"+Tt+")?",Kt="["+Et+"]?",$t=Kt+Ht+"(?:"+Bt+"(?:"+[qt,kt,Dt].join("|")+")"+Kt+Ht+")*",Vt="(?:"+[Nt,kt,Dt].join("|")+")"+$t,Jt="(?:"+[qt+xt+"?",xt,kt,Dt,St].join("|")+")",Gt=RegExp("['’]","g"),Qt=RegExp(xt,"g"),Wt=RegExp(Tt+"(?="+Tt+")|"+Jt+$t,"g"),Yt=RegExp([Ut+"?"+Ot+"+"+jt+"(?="+[Pt,Ut,"$"].join("|")+")",zt+"+"+Ft+"(?="+[Pt,Ut+Lt,"$"].join("|")+")",Ut+"?"+Lt+"+"+jt,Ut+"+"+Ft,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Rt,Vt].join("|"),"g"),Xt=RegExp("["+Bt+yt+wt+Et+"]"),Zt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,te=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],ee=-1,re={};re[O]=re[C]=re[T]=re[q]=re[k]=re[D]=re[U]=re[B]=re[L]=!0,re[l]=re[p]=re[R]=re[g]=re[N]=re[m]=re[b]=re[v]=re[w]=re[_]=re[A]=re[E]=re[I]=re[S]=re[x]=!1;var ie={};ie[l]=ie[p]=ie[R]=ie[N]=ie[g]=ie[m]=ie[O]=ie[C]=ie[T]=ie[q]=ie[k]=ie[w]=ie[_]=ie[A]=ie[E]=ie[I]=ie[S]=ie[P]=ie[D]=ie[U]=ie[B]=ie[L]=!0,ie[b]=ie[v]=ie[x]=!1;var ne={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},se=parseFloat,oe=parseInt,ae="object"==typeof Pu&&Pu&&Pu.Object===Object&&Pu,ce="object"==typeof self&&self&&self.Object===Object&&self,he=ae||ce||Function("return this")(),ue=Su&&!Su.nodeType&&Su,fe=ue&&Iu&&!Iu.nodeType&&Iu,de=fe&&fe.exports===ue,le=de&&ae.process,pe=function(){try{return fe&&fe.require&&fe.require("util").types||le&&le.binding&&le.binding("util")}catch{}}(),ge=pe&&pe.isArrayBuffer,me=pe&&pe.isDate,be=pe&&pe.isMap,ve=pe&&pe.isRegExp,ye=pe&&pe.isSet,we=pe&&pe.isTypedArray;function _e(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}function Ae(t,e,r,i){for(var n=-1,s=null==t?0:t.length;++n<s;){var o=t[n];e(i,o,r(o),t)}return i}function Me(t,e){for(var r=-1,i=null==t?0:t.length;++r<i&&!1!==e(t[r],r,t););return t}function Ee(t,e){for(var r=null==t?0:t.length;r--&&!1!==e(t[r],r,t););return t}function Ie(t,e){for(var r=-1,i=null==t?0:t.length;++r<i;)if(!e(t[r],r,t))return!1;return!0}function Se(t,e){for(var r=-1,i=null==t?0:t.length,n=0,s=[];++r<i;){var o=t[r];e(o,r,t)&&(s[n++]=o)}return s}function Pe(t,e){return!(null==t||!t.length)&&Ue(t,e,0)>-1}function xe(t,e,r){for(var i=-1,n=null==t?0:t.length;++i<n;)if(r(e,t[i]))return!0;return!1}function Re(t,e){for(var r=-1,i=null==t?0:t.length,n=Array(i);++r<i;)n[r]=e(t[r],r,t);return n}function Ne(t,e){for(var r=-1,i=e.length,n=t.length;++r<i;)t[n+r]=e[r];return t}function Oe(t,e,r,i){var n=-1,s=null==t?0:t.length;for(i&&s&&(r=t[++n]);++n<s;)r=e(r,t[n],n,t);return r}function Ce(t,e,r,i){var n=null==t?0:t.length;for(i&&n&&(r=t[--n]);n--;)r=e(r,t[n],n,t);return r}function Te(t,e){for(var r=-1,i=null==t?0:t.length;++r<i;)if(e(t[r],r,t))return!0;return!1}var qe=je("length");function ke(t,e,r){var i;return r(t,(function(t,r,n){if(e(t,r,n))return i=r,!1})),i}function De(t,e,r,i){for(var n=t.length,s=r+(i?1:-1);i?s--:++s<n;)if(e(t[s],s,t))return s;return-1}function Ue(t,e,r){return e==e?function(t,e,r){for(var i=r-1,n=t.length;++i<n;)if(t[i]===e)return i;return-1}(t,e,r):De(t,Le,r)}function Be(t,e,r,i){for(var n=r-1,s=t.length;++n<s;)if(i(t[n],e))return n;return-1}function Le(t){return t!=t}function ze(t,e){var r=null==t?0:t.length;return r?Ke(t,e)/r:c}function je(e){return function(r){return null==r?t:r[e]}}function Fe(e){return function(r){return null==e?t:e[r]}}function He(t,e,r,i,n){return n(t,(function(t,n,s){r=i?(i=!1,t):e(r,t,n,s)})),r}function Ke(e,r){for(var i,n=-1,s=e.length;++n<s;){var o=r(e[n]);o!==t&&(i=i===t?o:i+o)}return i}function $e(t,e){for(var r=-1,i=Array(t);++r<t;)i[r]=e(r);return i}function Ve(t){return t&&t.slice(0,cr(t)+1).replace(et,"")}function Je(t){return function(e){return t(e)}}function Ge(t,e){return Re(e,(function(e){return t[e]}))}function Qe(t,e){return t.has(e)}function We(t,e){for(var r=-1,i=t.length;++r<i&&Ue(e,t[r],0)>-1;);return r}function Ye(t,e){for(var r=t.length;r--&&Ue(e,t[r],0)>-1;);return r}var Xe=Fe({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),Ze=Fe({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function tr(t){return"\\"+ne[t]}function er(t){return Xt.test(t)}function rr(t){var e=-1,r=Array(t.size);return t.forEach((function(t,i){r[++e]=[i,t]})),r}function ir(t,e){return function(r){return t(e(r))}}function nr(t,e){for(var r=-1,n=t.length,s=0,o=[];++r<n;){var a=t[r];(a===e||a===i)&&(t[r]=i,o[s++]=r)}return o}function sr(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r}function or(t){return er(t)?function(t){for(var e=Wt.lastIndex=0;Wt.test(t);)++e;return e}(t):qe(t)}function ar(t){return er(t)?function(t){return t.match(Wt)||[]}(t):function(t){return t.split("")}(t)}function cr(t){for(var e=t.length;e--&&rt.test(t.charAt(e)););return e}var hr=Fe({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),ur=function rt(yt){var wt,_t=(yt=null==yt?he:ur.defaults(he.Object(),yt,ur.pick(he,te))).Array,At=yt.Date,Mt=yt.Error,Et=yt.Function,It=yt.Math,St=yt.Object,Pt=yt.RegExp,xt=yt.String,Rt=yt.TypeError,Nt=_t.prototype,Ot=Et.prototype,Ct=St.prototype,Tt=yt["__core-js_shared__"],qt=Ot.toString,kt=Ct.hasOwnProperty,Dt=0,Ut=(wt=/[^.]+$/.exec(Tt&&Tt.keys&&Tt.keys.IE_PROTO||""))?"Symbol(src)_1."+wt:"",Bt=Ct.toString,Lt=qt.call(St),zt=he._,jt=Pt("^"+qt.call(kt).replace(Z,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ft=de?yt.Buffer:t,Ht=yt.Symbol,Kt=yt.Uint8Array,$t=Ft?Ft.allocUnsafe:t,Vt=ir(St.getPrototypeOf,St),Jt=St.create,Wt=Ct.propertyIsEnumerable,Xt=Nt.splice,ne=Ht?Ht.isConcatSpreadable:t,ae=Ht?Ht.iterator:t,ce=Ht?Ht.toStringTag:t,ue=function(){try{var t=hs(St,"defineProperty");return t({},"",{}),t}catch{}}(),fe=yt.clearTimeout!==he.clearTimeout&&yt.clearTimeout,le=At&&At.now!==he.Date.now&&At.now,pe=yt.setTimeout!==he.setTimeout&&yt.setTimeout,qe=It.ceil,Fe=It.floor,fr=St.getOwnPropertySymbols,dr=Ft?Ft.isBuffer:t,lr=yt.isFinite,pr=Nt.join,gr=ir(St.keys,St),mr=It.max,br=It.min,vr=At.now,yr=yt.parseInt,wr=It.random,_r=Nt.reverse,Ar=hs(yt,"DataView"),Mr=hs(yt,"Map"),Er=hs(yt,"Promise"),Ir=hs(yt,"Set"),Sr=hs(yt,"WeakMap"),Pr=hs(St,"create"),xr=Sr&&new Sr,Rr={},Nr=ks(Ar),Or=ks(Mr),Cr=ks(Er),Tr=ks(Ir),qr=ks(Sr),kr=Ht?Ht.prototype:t,Dr=kr?kr.valueOf:t,Ur=kr?kr.toString:t;function Br(t){if(Zo(t)&&!Fo(t)&&!(t instanceof Fr)){if(t instanceof jr)return t;if(kt.call(t,"__wrapped__"))return Ds(t)}return new jr(t)}var Lr=function(){function e(){}return function(r){if(!Xo(r))return{};if(Jt)return Jt(r);e.prototype=r;var i=new e;return e.prototype=t,i}}();function zr(){}function jr(e,r){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!r,this.__index__=0,this.__values__=t}function Fr(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Hr(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}function Kr(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}function $r(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}function Vr(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new $r;++e<r;)this.add(t[e])}function Jr(t){var e=this.__data__=new Kr(t);this.size=e.size}function Gr(t,e){var r=Fo(t),i=!r&&jo(t),n=!r&&!i&&Vo(t),s=!r&&!i&&!n&&aa(t),o=r||i||n||s,a=o?$e(t.length,xt):[],c=a.length;for(var h in t)(e||kt.call(t,h))&&(!o||!("length"==h||n&&("offset"==h||"parent"==h)||s&&("buffer"==h||"byteLength"==h||"byteOffset"==h)||ms(h,c)))&&a.push(h);return a}function Qr(e){var r=e.length;return r?e[$i(0,r-1)]:t}function Wr(t,e){return Cs(Pn(t),si(e,0,t.length))}function Yr(t){return Cs(Pn(t))}function Xr(e,r,i){(i!==t&&!Bo(e[r],i)||i===t&&!(r in e))&&ii(e,r,i)}function Zr(e,r,i){var n=e[r];(!kt.call(e,r)||!Bo(n,i)||i===t&&!(r in e))&&ii(e,r,i)}function ti(t,e){for(var r=t.length;r--;)if(Bo(t[r][0],e))return r;return-1}function ei(t,e,r,i){return ui(t,(function(t,n,s){e(i,t,r(t),s)})),i}function ri(t,e){return t&&xn(e,Ra(e),t)}function ii(t,e,r){"__proto__"==e&&ue?ue(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}function ni(e,r){for(var i=-1,n=r.length,s=_t(n),o=null==e;++i<n;)s[i]=o?t:Ea(e,r[i]);return s}function si(e,r,i){return e==e&&(i!==t&&(e=e<=i?e:i),r!==t&&(e=e>=r?e:r)),e}function oi(e,r,i,n,s,o){var a,c=1&r,h=2&r,u=4&r;if(i&&(a=s?i(e,n,s,o):i(e)),a!==t)return a;if(!Xo(e))return e;var f=Fo(e);if(f){if(a=function(t){var e=t.length,r=new t.constructor(e);return e&&"string"==typeof t[0]&&kt.call(t,"index")&&(r.index=t.index,r.input=t.input),r}(e),!c)return Pn(e,a)}else{var d=ds(e),p=d==v||d==y;if(Vo(e))return _n(e,c);if(d==A||d==l||p&&!s){if(a=h||p?{}:ps(e),!c)return h?function(t,e){return xn(t,fs(t),e)}(e,function(t,e){return t&&xn(e,Na(e),t)}(a,e)):function(t,e){return xn(t,us(t),e)}(e,ri(a,e))}else{if(!ie[d])return s?e:{};a=function(t,e,r){var i=t.constructor;switch(e){case R:return An(t);case g:case m:return new i(+t);case N:return function(t,e){var r=e?An(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}(t,r);case O:case C:case T:case q:case k:case D:case U:case B:case L:return Mn(t,r);case w:return new i;case _:case S:return new i(t);case E:return function(t){var e=new t.constructor(t.source,ut.exec(t));return e.lastIndex=t.lastIndex,e}(t);case I:return new i;case P:return function(t){return Dr?St(Dr.call(t)):{}}(t)}}(e,d,c)}}o||(o=new Jr);var b=o.get(e);if(b)return b;o.set(e,a),na(e)?e.forEach((function(t){a.add(oi(t,r,i,t,e,o))})):ta(e)&&e.forEach((function(t,n){a.set(n,oi(t,r,i,n,e,o))}));var M=f?t:(u?h?rs:es:h?Na:Ra)(e);return Me(M||e,(function(t,n){M&&(t=e[n=t]),Zr(a,n,oi(t,r,i,n,e,o))})),a}function ai(e,r,i){var n=i.length;if(null==e)return!n;for(e=St(e);n--;){var s=i[n],o=r[s],a=e[s];if(a===t&&!(s in e)||!o(a))return!1}return!0}function ci(r,i,n){if("function"!=typeof r)throw new Rt(e);return xs((function(){r.apply(t,n)}),i)}function hi(t,e,r,i){var n=-1,s=Pe,o=!0,a=t.length,c=[],h=e.length;if(!a)return c;r&&(e=Re(e,Je(r))),i?(s=xe,o=!1):e.length>=200&&(s=Qe,o=!1,e=new Vr(e));t:for(;++n<a;){var u=t[n],f=null==r?u:r(u);if(u=i||0!==u?u:0,o&&f==f){for(var d=h;d--;)if(e[d]===f)continue t;c.push(u)}else s(e,f,i)||c.push(u)}return c}Br.templateSettings={escape:J,evaluate:G,interpolate:Q,variable:"",imports:{_:Br}},Br.prototype=zr.prototype,Br.prototype.constructor=Br,jr.prototype=Lr(zr.prototype),jr.prototype.constructor=jr,Fr.prototype=Lr(zr.prototype),Fr.prototype.constructor=Fr,Hr.prototype.clear=function(){this.__data__=Pr?Pr(null):{},this.size=0},Hr.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},Hr.prototype.get=function(e){var i=this.__data__;if(Pr){var n=i[e];return n===r?t:n}return kt.call(i,e)?i[e]:t},Hr.prototype.has=function(e){var r=this.__data__;return Pr?r[e]!==t:kt.call(r,e)},Hr.prototype.set=function(e,i){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Pr&&i===t?r:i,this},Kr.prototype.clear=function(){this.__data__=[],this.size=0},Kr.prototype.delete=function(t){var e=this.__data__,r=ti(e,t);return!(r<0||(r==e.length-1?e.pop():Xt.call(e,r,1),--this.size,0))},Kr.prototype.get=function(e){var r=this.__data__,i=ti(r,e);return i<0?t:r[i][1]},Kr.prototype.has=function(t){return ti(this.__data__,t)>-1},Kr.prototype.set=function(t,e){var r=this.__data__,i=ti(r,t);return i<0?(++this.size,r.push([t,e])):r[i][1]=e,this},$r.prototype.clear=function(){this.size=0,this.__data__={hash:new Hr,map:new(Mr||Kr),string:new Hr}},$r.prototype.delete=function(t){var e=as(this,t).delete(t);return this.size-=e?1:0,e},$r.prototype.get=function(t){return as(this,t).get(t)},$r.prototype.has=function(t){return as(this,t).has(t)},$r.prototype.set=function(t,e){var r=as(this,t),i=r.size;return r.set(t,e),this.size+=r.size==i?0:1,this},Vr.prototype.add=Vr.prototype.push=function(t){return this.__data__.set(t,r),this},Vr.prototype.has=function(t){return this.__data__.has(t)},Jr.prototype.clear=function(){this.__data__=new Kr,this.size=0},Jr.prototype.delete=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r},Jr.prototype.get=function(t){return this.__data__.get(t)},Jr.prototype.has=function(t){return this.__data__.has(t)},Jr.prototype.set=function(t,e){var r=this.__data__;if(r instanceof Kr){var i=r.__data__;if(!Mr||i.length<199)return i.push([t,e]),this.size=++r.size,this;r=this.__data__=new $r(i)}return r.set(t,e),this.size=r.size,this};var ui=On(vi),fi=On(yi,!0);function di(t,e){var r=!0;return ui(t,(function(t,i,n){return r=!!e(t,i,n)})),r}function li(e,r,i){for(var n=-1,s=e.length;++n<s;){var o=e[n],a=r(o);if(null!=a&&(c===t?a==a&&!oa(a):i(a,c)))var c=a,h=o}return h}function pi(t,e){var r=[];return ui(t,(function(t,i,n){e(t,i,n)&&r.push(t)})),r}function gi(t,e,r,i,n){var s=-1,o=t.length;for(r||(r=gs),n||(n=[]);++s<o;){var a=t[s];e>0&&r(a)?e>1?gi(a,e-1,r,i,n):Ne(n,a):i||(n[n.length]=a)}return n}var mi=Cn(),bi=Cn(!0);function vi(t,e){return t&&mi(t,e,Ra)}function yi(t,e){return t&&bi(t,e,Ra)}function wi(t,e){return Se(e,(function(e){return Qo(t[e])}))}function _i(e,r){for(var i=0,n=(r=bn(r,e)).length;null!=e&&i<n;)e=e[qs(r[i++])];return i&&i==n?e:t}function Ai(t,e,r){var i=e(t);return Fo(t)?i:Ne(i,r(t))}function Mi(e){return null==e?e===t?"[object Undefined]":"[object Null]":ce&&ce in St(e)?function(e){var r=kt.call(e,ce),i=e[ce];try{e[ce]=t;var n=!0}catch{}var s=Bt.call(e);return n&&(r?e[ce]=i:delete e[ce]),s}(e):function(t){return Bt.call(t)}(e)}function Ei(t,e){return t>e}function Ii(t,e){return null!=t&&kt.call(t,e)}function Si(t,e){return null!=t&&e in St(t)}function Pi(e,r,i){for(var n=i?xe:Pe,s=e[0].length,o=e.length,a=o,c=_t(o),h=1/0,u=[];a--;){var f=e[a];a&&r&&(f=Re(f,Je(r))),h=br(f.length,h),c[a]=!i&&(r||s>=120&&f.length>=120)?new Vr(a&&f):t}f=e[0];var d=-1,l=c[0];t:for(;++d<s&&u.length<h;){var p=f[d],g=r?r(p):p;if(p=i||0!==p?p:0,!(l?Qe(l,g):n(u,g,i))){for(a=o;--a;){var m=c[a];if(!(m?Qe(m,g):n(e[a],g,i)))continue t}l&&l.push(g),u.push(p)}}return u}function xi(e,r,i){var n=null==(e=Is(e,r=bn(r,e)))?e:e[qs(Js(r))];return null==n?t:_e(n,e,i)}function Ri(t){return Zo(t)&&Mi(t)==l}function Ni(e,r,i,n,s){return e===r||(null==e||null==r||!Zo(e)&&!Zo(r)?e!=e&&r!=r:function(e,r,i,n,s,o){var a=Fo(e),c=Fo(r),h=a?p:ds(e),u=c?p:ds(r),f=(h=h==l?A:h)==A,d=(u=u==l?A:u)==A,v=h==u;if(v&&Vo(e)){if(!Vo(r))return!1;a=!0,f=!1}if(v&&!f)return o||(o=new Jr),a||aa(e)?Zn(e,r,i,n,s,o):function(t,e,r,i,n,s,o){switch(r){case N:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case R:return!(t.byteLength!=e.byteLength||!s(new Kt(t),new Kt(e)));case g:case m:case _:return Bo(+t,+e);case b:return t.name==e.name&&t.message==e.message;case E:case S:return t==e+"";case w:var a=rr;case I:var c=1&i;if(a||(a=sr),t.size!=e.size&&!c)return!1;var h=o.get(t);if(h)return h==e;i|=2,o.set(t,e);var u=Zn(a(t),a(e),i,n,s,o);return o.delete(t),u;case P:if(Dr)return Dr.call(t)==Dr.call(e)}return!1}(e,r,h,i,n,s,o);if(!(1&i)){var y=f&&kt.call(e,"__wrapped__"),M=d&&kt.call(r,"__wrapped__");if(y||M){var x=y?e.value():e,O=M?r.value():r;return o||(o=new Jr),s(x,O,i,n,o)}}return!!v&&(o||(o=new Jr),function(e,r,i,n,s,o){var a=1&i,c=es(e),h=c.length;if(h!=es(r).length&&!a)return!1;for(var u=h;u--;){var f=c[u];if(!(a?f in r:kt.call(r,f)))return!1}var d=o.get(e),l=o.get(r);if(d&&l)return d==r&&l==e;var p=!0;o.set(e,r),o.set(r,e);for(var g=a;++u<h;){var m=e[f=c[u]],b=r[f];if(n)var v=a?n(b,m,f,r,e,o):n(m,b,f,e,r,o);if(!(v===t?m===b||s(m,b,i,n,o):v)){p=!1;break}g||(g="constructor"==f)}if(p&&!g){var y=e.constructor,w=r.constructor;y!=w&&"constructor"in e&&"constructor"in r&&!("function"==typeof y&&y instanceof y&&"function"==typeof w&&w instanceof w)&&(p=!1)}return o.delete(e),o.delete(r),p}(e,r,i,n,s,o))}(e,r,i,n,Ni,s))}function Oi(e,r,i,n){var s=i.length,o=s,a=!n;if(null==e)return!o;for(e=St(e);s--;){var c=i[s];if(a&&c[2]?c[1]!==e[c[0]]:!(c[0]in e))return!1}for(;++s<o;){var h=(c=i[s])[0],u=e[h],f=c[1];if(a&&c[2]){if(u===t&&!(h in e))return!1}else{var d=new Jr;if(n)var l=n(u,f,h,e,r,d);if(!(l===t?Ni(f,u,3,n,d):l))return!1}}return!0}function Ci(t){return!(!Xo(t)||function(t){return!!Ut&&Ut in t}(t))&&(Qo(t)?jt:lt).test(ks(t))}function Ti(t){return"function"==typeof t?t:null==t?ec:"object"==typeof t?Fo(t)?Bi(t[0],t[1]):Ui(t):uc(t)}function qi(t){if(!_s(t))return gr(t);var e=[];for(var r in St(t))kt.call(t,r)&&"constructor"!=r&&e.push(r);return e}function ki(t,e){return t<e}function Di(t,e){var r=-1,i=Ko(t)?_t(t.length):[];return ui(t,(function(t,n,s){i[++r]=e(t,n,s)})),i}function Ui(t){var e=cs(t);return 1==e.length&&e[0][2]?Ms(e[0][0],e[0][1]):function(r){return r===t||Oi(r,t,e)}}function Bi(e,r){return vs(e)&&As(r)?Ms(qs(e),r):function(i){var n=Ea(i,e);return n===t&&n===r?Ia(i,e):Ni(r,n,3)}}function Li(e,r,i,n,s){e!==r&&mi(r,(function(o,a){if(s||(s=new Jr),Xo(o))!function(e,r,i,n,s,o,a){var c=Ss(e,i),h=Ss(r,i),u=a.get(h);if(u)Xr(e,i,u);else{var f=o?o(c,h,i+"",e,r,a):t,d=f===t;if(d){var l=Fo(h),p=!l&&Vo(h),g=!l&&!p&&aa(h);f=h,l||p||g?Fo(c)?f=c:$o(c)?f=Pn(c):p?(d=!1,f=_n(h,!0)):g?(d=!1,f=Mn(h,!0)):f=[]:ra(h)||jo(h)?(f=c,jo(c)?f=ga(c):(!Xo(c)||Qo(c))&&(f=ps(h))):d=!1}d&&(a.set(h,f),s(f,h,n,o,a),a.delete(h)),Xr(e,i,f)}}(e,r,a,i,Li,n,s);else{var c=n?n(Ss(e,a),o,a+"",e,r,s):t;c===t&&(c=o),Xr(e,a,c)}}),Na)}function zi(e,r){var i=e.length;if(i)return ms(r+=r<0?i:0,i)?e[r]:t}function ji(t,e,r){e=e.length?Re(e,(function(t){return Fo(t)?function(e){return _i(e,1===t.length?t[0]:t)}:t})):[ec];var i=-1;e=Re(e,Je(os()));var n=Di(t,(function(t,r,n){var s=Re(e,(function(e){return e(t)}));return{criteria:s,index:++i,value:t}}));return function(t){var e=t.length;for(t.sort((function(t,e){return function(t,e,r){for(var i=-1,n=t.criteria,s=e.criteria,o=n.length,a=r.length;++i<o;){var c=En(n[i],s[i]);if(c)return i>=a?c:c*("desc"==r[i]?-1:1)}return t.index-e.index}(t,e,r)}));e--;)t[e]=t[e].value;return t}(n)}function Fi(t,e,r){for(var i=-1,n=e.length,s={};++i<n;){var o=e[i],a=_i(t,o);r(a,o)&&Wi(s,bn(o,t),a)}return s}function Hi(t,e,r,i){var n=i?Be:Ue,s=-1,o=e.length,a=t;for(t===e&&(e=Pn(e)),r&&(a=Re(t,Je(r)));++s<o;)for(var c=0,h=e[s],u=r?r(h):h;(c=n(a,u,c,i))>-1;)a!==t&&Xt.call(a,c,1),Xt.call(t,c,1);return t}function Ki(t,e){for(var r=t?e.length:0,i=r-1;r--;){var n=e[r];if(r==i||n!==s){var s=n;ms(n)?Xt.call(t,n,1):hn(t,n)}}return t}function $i(t,e){return t+Fe(wr()*(e-t+1))}function Vi(t,e){var r="";if(!t||e<1||e>a)return r;do{e%2&&(r+=t),(e=Fe(e/2))&&(t+=t)}while(e);return r}function Ji(t,e){return Rs(Es(t,e,ec),t+"")}function Gi(t){return Qr(Ba(t))}function Qi(t,e){var r=Ba(t);return Cs(r,si(e,0,r.length))}function Wi(e,r,i,n){if(!Xo(e))return e;for(var s=-1,o=(r=bn(r,e)).length,a=o-1,c=e;null!=c&&++s<o;){var h=qs(r[s]),u=i;if("__proto__"===h||"constructor"===h||"prototype"===h)return e;if(s!=a){var f=c[h];(u=n?n(f,h,c):t)===t&&(u=Xo(f)?f:ms(r[s+1])?[]:{})}Zr(c,h,u),c=c[h]}return e}var Yi=xr?function(t,e){return xr.set(t,e),t}:ec,Xi=ue?function(t,e){return ue(t,"toString",{configurable:!0,enumerable:!1,value:Xa(e),writable:!0})}:ec;function Zi(t){return Cs(Ba(t))}function tn(t,e,r){var i=-1,n=t.length;e<0&&(e=-e>n?0:n+e),(r=r>n?n:r)<0&&(r+=n),n=e>r?0:r-e>>>0,e>>>=0;for(var s=_t(n);++i<n;)s[i]=t[i+e];return s}function en(t,e){var r;return ui(t,(function(t,i,n){return!(r=e(t,i,n))})),!!r}function rn(t,e,r){var i=0,n=null==t?i:t.length;if("number"==typeof e&&e==e&&n<=f){for(;i<n;){var s=i+n>>>1,o=t[s];null!==o&&!oa(o)&&(r?o<=e:o<e)?i=s+1:n=s}return n}return nn(t,e,ec,r)}function nn(e,r,i,n){var s=0,o=null==e?0:e.length;if(0===o)return 0;for(var a=(r=i(r))!=r,c=null===r,h=oa(r),f=r===t;s<o;){var d=Fe((s+o)/2),l=i(e[d]),p=l!==t,g=null===l,m=l==l,b=oa(l);if(a)var v=n||m;else v=f?m&&(n||p):c?m&&p&&(n||!g):h?m&&p&&!g&&(n||!b):!g&&!b&&(n?l<=r:l<r);v?s=d+1:o=d}return br(o,u)}function sn(t,e){for(var r=-1,i=t.length,n=0,s=[];++r<i;){var o=t[r],a=e?e(o):o;if(!r||!Bo(a,c)){var c=a;s[n++]=0===o?0:o}}return s}function on(t){return"number"==typeof t?t:oa(t)?c:+t}function an(t){if("string"==typeof t)return t;if(Fo(t))return Re(t,an)+"";if(oa(t))return Ur?Ur.call(t):"";var e=t+"";return"0"==e&&1/t==-o?"-0":e}function cn(t,e,r){var i=-1,n=Pe,s=t.length,o=!0,a=[],c=a;if(r)o=!1,n=xe;else if(s>=200){var h=e?null:Jn(t);if(h)return sr(h);o=!1,n=Qe,c=new Vr}else c=e?[]:a;t:for(;++i<s;){var u=t[i],f=e?e(u):u;if(u=r||0!==u?u:0,o&&f==f){for(var d=c.length;d--;)if(c[d]===f)continue t;e&&c.push(f),a.push(u)}else n(c,f,r)||(c!==a&&c.push(f),a.push(u))}return a}function hn(t,e){return null==(t=Is(t,e=bn(e,t)))||delete t[qs(Js(e))]}function un(t,e,r,i){return Wi(t,e,r(_i(t,e)),i)}function fn(t,e,r,i){for(var n=t.length,s=i?n:-1;(i?s--:++s<n)&&e(t[s],s,t););return r?tn(t,i?0:s,i?s+1:n):tn(t,i?s+1:0,i?n:s)}function dn(t,e){var r=t;return r instanceof Fr&&(r=r.value()),Oe(e,(function(t,e){return e.func.apply(e.thisArg,Ne([t],e.args))}),r)}function ln(t,e,r){var i=t.length;if(i<2)return i?cn(t[0]):[];for(var n=-1,s=_t(i);++n<i;)for(var o=t[n],a=-1;++a<i;)a!=n&&(s[n]=hi(s[n]||o,t[a],e,r));return cn(gi(s,1),e,r)}function pn(e,r,i){for(var n=-1,s=e.length,o=r.length,a={};++n<s;){var c=n<o?r[n]:t;i(a,e[n],c)}return a}function gn(t){return $o(t)?t:[]}function mn(t){return"function"==typeof t?t:ec}function bn(t,e){return Fo(t)?t:vs(t,e)?[t]:Ts(ma(t))}var vn=Ji;function yn(e,r,i){var n=e.length;return i=i===t?n:i,!r&&i>=n?e:tn(e,r,i)}var wn=fe||function(t){return he.clearTimeout(t)};function _n(t,e){if(e)return t.slice();var r=t.length,i=$t?$t(r):new t.constructor(r);return t.copy(i),i}function An(t){var e=new t.constructor(t.byteLength);return new Kt(e).set(new Kt(t)),e}function Mn(t,e){var r=e?An(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}function En(e,r){if(e!==r){var i=e!==t,n=null===e,s=e==e,o=oa(e),a=r!==t,c=null===r,h=r==r,u=oa(r);if(!c&&!u&&!o&&e>r||o&&a&&h&&!c&&!u||n&&a&&h||!i&&h||!s)return 1;if(!n&&!o&&!u&&e<r||u&&i&&s&&!n&&!o||c&&i&&s||!a&&s||!h)return-1}return 0}function In(t,e,r,i){for(var n=-1,s=t.length,o=r.length,a=-1,c=e.length,h=mr(s-o,0),u=_t(c+h),f=!i;++a<c;)u[a]=e[a];for(;++n<o;)(f||n<s)&&(u[r[n]]=t[n]);for(;h--;)u[a++]=t[n++];return u}function Sn(t,e,r,i){for(var n=-1,s=t.length,o=-1,a=r.length,c=-1,h=e.length,u=mr(s-a,0),f=_t(u+h),d=!i;++n<u;)f[n]=t[n];for(var l=n;++c<h;)f[l+c]=e[c];for(;++o<a;)(d||n<s)&&(f[l+r[o]]=t[n++]);return f}function Pn(t,e){var r=-1,i=t.length;for(e||(e=_t(i));++r<i;)e[r]=t[r];return e}function xn(e,r,i,n){var s=!i;i||(i={});for(var o=-1,a=r.length;++o<a;){var c=r[o],h=n?n(i[c],e[c],c,i,e):t;h===t&&(h=e[c]),s?ii(i,c,h):Zr(i,c,h)}return i}function Rn(t,e){return function(r,i){var n=Fo(r)?Ae:ei,s=e?e():{};return n(r,t,os(i,2),s)}}function Nn(e){return Ji((function(r,i){var n=-1,s=i.length,o=s>1?i[s-1]:t,a=s>2?i[2]:t;for(o=e.length>3&&"function"==typeof o?(s--,o):t,a&&bs(i[0],i[1],a)&&(o=s<3?t:o,s=1),r=St(r);++n<s;){var c=i[n];c&&e(r,c,n,o)}return r}))}function On(t,e){return function(r,i){if(null==r)return r;if(!Ko(r))return t(r,i);for(var n=r.length,s=e?n:-1,o=St(r);(e?s--:++s<n)&&!1!==i(o[s],s,o););return r}}function Cn(t){return function(e,r,i){for(var n=-1,s=St(e),o=i(e),a=o.length;a--;){var c=o[t?a:++n];if(!1===r(s[c],c,s))break}return e}}function Tn(e){return function(r){var i=er(r=ma(r))?ar(r):t,n=i?i[0]:r.charAt(0),s=i?yn(i,1).join(""):r.slice(1);return n[e]()+s}}function qn(t){return function(e){return Oe(Qa(ja(e).replace(Gt,"")),t,"")}}function kn(t){return function(){var e=arguments;switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3]);case 5:return new t(e[0],e[1],e[2],e[3],e[4]);case 6:return new t(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var r=Lr(t.prototype),i=t.apply(r,e);return Xo(i)?i:r}}function Dn(e){return function(r,i,n){var s=St(r);if(!Ko(r)){var o=os(i,3);r=Ra(r),i=function(t){return o(s[t],t,s)}}var a=e(r,i,n);return a>-1?s[o?r[a]:a]:t}}function Un(r){return ts((function(i){var n=i.length,s=n,o=jr.prototype.thru;for(r&&i.reverse();s--;){var a=i[s];if("function"!=typeof a)throw new Rt(e);if(o&&!c&&"wrapper"==ns(a))var c=new jr([],!0)}for(s=c?s:n;++s<n;){var h=ns(a=i[s]),u="wrapper"==h?is(a):t;c=u&&ys(u[0])&&424==u[1]&&!u[4].length&&1==u[9]?c[ns(u[0])].apply(c,u[3]):1==a.length&&ys(a)?c[h]():c.thru(a)}return function(){var t=arguments,e=t[0];if(c&&1==t.length&&Fo(e))return c.plant(e).value();for(var r=0,s=n?i[r].apply(this,t):e;++r<n;)s=i[r].call(this,s);return s}}))}function Bn(e,r,i,n,o,a,c,h,u,f){var d=r&s,l=1&r,p=2&r,g=24&r,m=512&r,b=p?t:kn(e);return function s(){for(var v=arguments.length,y=_t(v),w=v;w--;)y[w]=arguments[w];if(g)var _=ss(s),A=function(t,e){for(var r=t.length,i=0;r--;)t[r]===e&&++i;return i}(y,_);if(n&&(y=In(y,n,o,g)),a&&(y=Sn(y,a,c,g)),v-=A,g&&v<f){var M=nr(y,_);return $n(e,r,Bn,s.placeholder,i,y,M,h,u,f-v)}var E=l?i:this,I=p?E[e]:e;return v=y.length,h?y=function(e,r){for(var i=e.length,n=br(r.length,i),s=Pn(e);n--;){var o=r[n];e[n]=ms(o,i)?s[o]:t}return e}(y,h):m&&v>1&&y.reverse(),d&&u<v&&(y.length=u),this&&this!==he&&this instanceof s&&(I=b||kn(I)),I.apply(E,y)}}function Ln(t,e){return function(r,i){return function(t,e,r,i){return vi(t,(function(t,n,s){e(i,r(t),n,s)})),i}(r,t,e(i),{})}}function zn(e,r){return function(i,n){var s;if(i===t&&n===t)return r;if(i!==t&&(s=i),n!==t){if(s===t)return n;"string"==typeof i||"string"==typeof n?(i=an(i),n=an(n)):(i=on(i),n=on(n)),s=e(i,n)}return s}}function jn(t){return ts((function(e){return e=Re(e,Je(os())),Ji((function(r){var i=this;return t(e,(function(t){return _e(t,i,r)}))}))}))}function Fn(e,r){var i=(r=r===t?" ":an(r)).length;if(i<2)return i?Vi(r,e):r;var n=Vi(r,qe(e/or(r)));return er(r)?yn(ar(n),0,e).join(""):n.slice(0,e)}function Hn(e){return function(r,i,n){return n&&"number"!=typeof n&&bs(r,i,n)&&(i=n=t),r=fa(r),i===t?(i=r,r=0):i=fa(i),function(t,e,r,i){for(var n=-1,s=mr(qe((e-t)/(r||1)),0),o=_t(s);s--;)o[i?s:++n]=t,t+=r;return o}(r,i,n=n===t?r<i?1:-1:fa(n),e)}}function Kn(t){return function(e,r){return"string"==typeof e&&"string"==typeof r||(e=pa(e),r=pa(r)),t(e,r)}}function $n(e,r,i,s,o,a,c,h,u,f){var d=8&r;r|=d?n:64,4&(r&=~(d?64:n))||(r&=-4);var l=[e,r,o,d?a:t,d?c:t,d?t:a,d?t:c,h,u,f],p=i.apply(t,l);return ys(e)&&Ps(p,l),p.placeholder=s,Ns(p,e,r)}function Vn(t){var e=It[t];return function(t,r){if(t=pa(t),(r=null==r?0:br(da(r),292))&&lr(t)){var i=(ma(t)+"e").split("e");return+((i=(ma(e(i[0]+"e"+(+i[1]+r)))+"e").split("e"))[0]+"e"+(+i[1]-r))}return e(t)}}var Jn=Ir&&1/sr(new Ir([,-0]))[1]==o?function(t){return new Ir(t)}:oc;function Gn(t){return function(e){var r=ds(e);return r==w?rr(e):r==I?function(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=[t,t]})),r}(e):function(t,e){return Re(e,(function(e){return[e,t[e]]}))}(e,t(e))}}function Qn(r,o,a,c,h,u,f,d){var l=2&o;if(!l&&"function"!=typeof r)throw new Rt(e);var p=c?c.length:0;if(p||(o&=-97,c=h=t),f=f===t?f:mr(da(f),0),d=d===t?d:da(d),p-=h?h.length:0,64&o){var g=c,m=h;c=h=t}var b=l?t:is(r),v=[r,o,a,c,h,g,m,u,f,d];if(b&&function(t,e){var r=t[1],n=e[1],o=r|n,a=o<131,c=n==s&&8==r||n==s&&256==r&&t[7].length<=e[8]||384==n&&e[7].length<=e[8]&&8==r;if(!a&&!c)return t;1&n&&(t[2]=e[2],o|=1&r?0:4);var h=e[3];if(h){var u=t[3];t[3]=u?In(u,h,e[4]):h,t[4]=u?nr(t[3],i):e[4]}(h=e[5])&&(u=t[5],t[5]=u?Sn(u,h,e[6]):h,t[6]=u?nr(t[5],i):e[6]),(h=e[7])&&(t[7]=h),n&s&&(t[8]=null==t[8]?e[8]:br(t[8],e[8])),null==t[9]&&(t[9]=e[9]),t[0]=e[0],t[1]=o}(v,b),r=v[0],o=v[1],a=v[2],c=v[3],h=v[4],!(d=v[9]=v[9]===t?l?0:r.length:mr(v[9]-p,0))&&24&o&&(o&=-25),o&&1!=o)y=8==o||16==o?function(e,r,i){var n=kn(e);return function s(){for(var o=arguments.length,a=_t(o),c=o,h=ss(s);c--;)a[c]=arguments[c];var u=o<3&&a[0]!==h&&a[o-1]!==h?[]:nr(a,h);return(o-=u.length)<i?$n(e,r,Bn,s.placeholder,t,a,u,t,t,i-o):_e(this&&this!==he&&this instanceof s?n:e,this,a)}}(r,o,d):o!=n&&33!=o||h.length?Bn.apply(t,v):function(t,e,r,i){var n=1&e,s=kn(t);return function e(){for(var o=-1,a=arguments.length,c=-1,h=i.length,u=_t(h+a),f=this&&this!==he&&this instanceof e?s:t;++c<h;)u[c]=i[c];for(;a--;)u[c++]=arguments[++o];return _e(f,n?r:this,u)}}(r,o,a,c);else var y=function(t,e,r){var i=1&e,n=kn(t);return function e(){return(this&&this!==he&&this instanceof e?n:t).apply(i?r:this,arguments)}}(r,o,a);return Ns((b?Yi:Ps)(y,v),r,o)}function Wn(e,r,i,n){return e===t||Bo(e,Ct[i])&&!kt.call(n,i)?r:e}function Yn(e,r,i,n,s,o){return Xo(e)&&Xo(r)&&(o.set(r,e),Li(e,r,t,Yn,o),o.delete(r)),e}function Xn(e){return ra(e)?t:e}function Zn(e,r,i,n,s,o){var a=1&i,c=e.length,h=r.length;if(c!=h&&!(a&&h>c))return!1;var u=o.get(e),f=o.get(r);if(u&&f)return u==r&&f==e;var d=-1,l=!0,p=2&i?new Vr:t;for(o.set(e,r),o.set(r,e);++d<c;){var g=e[d],m=r[d];if(n)var b=a?n(m,g,d,r,e,o):n(g,m,d,e,r,o);if(b!==t){if(b)continue;l=!1;break}if(p){if(!Te(r,(function(t,e){if(!Qe(p,e)&&(g===t||s(g,t,i,n,o)))return p.push(e)}))){l=!1;break}}else if(g!==m&&!s(g,m,i,n,o)){l=!1;break}}return o.delete(e),o.delete(r),l}function ts(e){return Rs(Es(e,t,Fs),e+"")}function es(t){return Ai(t,Ra,us)}function rs(t){return Ai(t,Na,fs)}var is=xr?function(t){return xr.get(t)}:oc;function ns(t){for(var e=t.name+"",r=Rr[e],i=kt.call(Rr,e)?r.length:0;i--;){var n=r[i],s=n.func;if(null==s||s==t)return n.name}return e}function ss(t){return(kt.call(Br,"placeholder")?Br:t).placeholder}function os(){var t=Br.iteratee||rc;return t=t===rc?Ti:t,arguments.length?t(arguments[0],arguments[1]):t}function as(t,e){var r=t.__data__;return function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}(e)?r["string"==typeof e?"string":"hash"]:r.map}function cs(t){for(var e=Ra(t),r=e.length;r--;){var i=e[r],n=t[i];e[r]=[i,n,As(n)]}return e}function hs(e,r){var i=function(e,r){return null==e?t:e[r]}(e,r);return Ci(i)?i:t}var us=fr?function(t){return null==t?[]:(t=St(t),Se(fr(t),(function(e){return Wt.call(t,e)})))}:lc,fs=fr?function(t){for(var e=[];t;)Ne(e,us(t)),t=Vt(t);return e}:lc,ds=Mi;function ls(t,e,r){for(var i=-1,n=(e=bn(e,t)).length,s=!1;++i<n;){var o=qs(e[i]);if(!(s=null!=t&&r(t,o)))break;t=t[o]}return s||++i!=n?s:!!(n=null==t?0:t.length)&&Yo(n)&&ms(o,n)&&(Fo(t)||jo(t))}function ps(t){return"function"!=typeof t.constructor||_s(t)?{}:Lr(Vt(t))}function gs(t){return Fo(t)||jo(t)||!!(ne&&t&&t[ne])}function ms(t,e){var r=typeof t;return!!(e=e??a)&&("number"==r||"symbol"!=r&&gt.test(t))&&t>-1&&t%1==0&&t<e}function bs(t,e,r){if(!Xo(r))return!1;var i=typeof e;return!!("number"==i?Ko(r)&&ms(e,r.length):"string"==i&&e in r)&&Bo(r[e],t)}function vs(t,e){if(Fo(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!oa(t))||Y.test(t)||!W.test(t)||null!=e&&t in St(e)}function ys(t){var e=ns(t),r=Br[e];if("function"!=typeof r||!(e in Fr.prototype))return!1;if(t===r)return!0;var i=is(r);return!!i&&t===i[0]}(Ar&&ds(new Ar(new ArrayBuffer(1)))!=N||Mr&&ds(new Mr)!=w||Er&&ds(Er.resolve())!=M||Ir&&ds(new Ir)!=I||Sr&&ds(new Sr)!=x)&&(ds=function(e){var r=Mi(e),i=r==A?e.constructor:t,n=i?ks(i):"";if(n)switch(n){case Nr:return N;case Or:return w;case Cr:return M;case Tr:return I;case qr:return x}return r});var ws=Tt?Qo:pc;function _s(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Ct)}function As(t){return t==t&&!Xo(t)}function Ms(e,r){return function(i){return null!=i&&i[e]===r&&(r!==t||e in St(i))}}function Es(e,r,i){return r=mr(r===t?e.length-1:r,0),function(){for(var t=arguments,n=-1,s=mr(t.length-r,0),o=_t(s);++n<s;)o[n]=t[r+n];n=-1;for(var a=_t(r+1);++n<r;)a[n]=t[n];return a[r]=i(o),_e(e,this,a)}}function Is(t,e){return e.length<2?t:_i(t,tn(e,0,-1))}function Ss(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}var Ps=Os(Yi),xs=pe||function(t,e){return he.setTimeout(t,e)},Rs=Os(Xi);function Ns(t,e,r){var i=e+"";return Rs(t,function(t,e){var r=e.length;if(!r)return t;var i=r-1;return e[i]=(r>1?"& ":"")+e[i],e=e.join(r>2?", ":" "),t.replace(it,"{\n/* [wrapped with "+e+"] */\n")}(i,function(t,e){return Me(d,(function(r){var i="_."+r[0];e&r[1]&&!Pe(t,i)&&t.push(i)})),t.sort()}(function(t){var e=t.match(nt);return e?e[1].split(st):[]}(i),r)))}function Os(e){var r=0,i=0;return function(){var n=vr(),s=16-(n-i);if(i=n,s>0){if(++r>=800)return arguments[0]}else r=0;return e.apply(t,arguments)}}function Cs(e,r){var i=-1,n=e.length,s=n-1;for(r=r===t?n:r;++i<r;){var o=$i(i,s),a=e[o];e[o]=e[i],e[i]=a}return e.length=r,e}var Ts=function(){var t=Co((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(X,(function(t,r,i,n){e.push(i?n.replace(ct,"$1"):r||t)})),e}),(function(t){return 500===e.size&&e.clear(),t})),e=t.cache;return t}();function qs(t){if("string"==typeof t||oa(t))return t;var e=t+"";return"0"==e&&1/t==-o?"-0":e}function ks(t){if(null!=t){try{return qt.call(t)}catch{}try{return t+""}catch{}}return""}function Ds(t){if(t instanceof Fr)return t.clone();var e=new jr(t.__wrapped__,t.__chain__);return e.__actions__=Pn(t.__actions__),e.__index__=t.__index__,e.__values__=t.__values__,e}var Us=Ji((function(t,e){return $o(t)?hi(t,gi(e,1,$o,!0)):[]})),Bs=Ji((function(e,r){var i=Js(r);return $o(i)&&(i=t),$o(e)?hi(e,gi(r,1,$o,!0),os(i,2)):[]})),Ls=Ji((function(e,r){var i=Js(r);return $o(i)&&(i=t),$o(e)?hi(e,gi(r,1,$o,!0),t,i):[]}));function zs(t,e,r){var i=null==t?0:t.length;if(!i)return-1;var n=null==r?0:da(r);return n<0&&(n=mr(i+n,0)),De(t,os(e,3),n)}function js(e,r,i){var n=null==e?0:e.length;if(!n)return-1;var s=n-1;return i!==t&&(s=da(i),s=i<0?mr(n+s,0):br(s,n-1)),De(e,os(r,3),s,!0)}function Fs(t){return null!=t&&t.length?gi(t,1):[]}function Hs(e){return e&&e.length?e[0]:t}var Ks=Ji((function(t){var e=Re(t,gn);return e.length&&e[0]===t[0]?Pi(e):[]})),$s=Ji((function(e){var r=Js(e),i=Re(e,gn);return r===Js(i)?r=t:i.pop(),i.length&&i[0]===e[0]?Pi(i,os(r,2)):[]})),Vs=Ji((function(e){var r=Js(e),i=Re(e,gn);return(r="function"==typeof r?r:t)&&i.pop(),i.length&&i[0]===e[0]?Pi(i,t,r):[]}));function Js(e){var r=null==e?0:e.length;return r?e[r-1]:t}var Gs=Ji(Qs);function Qs(t,e){return t&&t.length&&e&&e.length?Hi(t,e):t}var Ws=ts((function(t,e){var r=null==t?0:t.length,i=ni(t,e);return Ki(t,Re(e,(function(t){return ms(t,r)?+t:t})).sort(En)),i}));function Ys(t){return null==t?t:_r.call(t)}var Xs=Ji((function(t){return cn(gi(t,1,$o,!0))})),Zs=Ji((function(e){var r=Js(e);return $o(r)&&(r=t),cn(gi(e,1,$o,!0),os(r,2))})),to=Ji((function(e){var r=Js(e);return r="function"==typeof r?r:t,cn(gi(e,1,$o,!0),t,r)}));function eo(t){if(!t||!t.length)return[];var e=0;return t=Se(t,(function(t){if($o(t))return e=mr(t.length,e),!0})),$e(e,(function(e){return Re(t,je(e))}))}function ro(e,r){if(!e||!e.length)return[];var i=eo(e);return null==r?i:Re(i,(function(e){return _e(r,t,e)}))}var io=Ji((function(t,e){return $o(t)?hi(t,e):[]})),no=Ji((function(t){return ln(Se(t,$o))})),so=Ji((function(e){var r=Js(e);return $o(r)&&(r=t),ln(Se(e,$o),os(r,2))})),oo=Ji((function(e){var r=Js(e);return r="function"==typeof r?r:t,ln(Se(e,$o),t,r)})),ao=Ji(eo),co=Ji((function(e){var r=e.length,i=r>1?e[r-1]:t;return i="function"==typeof i?(e.pop(),i):t,ro(e,i)}));function ho(t){var e=Br(t);return e.__chain__=!0,e}function uo(t,e){return e(t)}var fo=ts((function(e){var r=e.length,i=r?e[0]:0,n=this.__wrapped__,s=function(t){return ni(t,e)};return!(r>1||this.__actions__.length)&&n instanceof Fr&&ms(i)?((n=n.slice(i,+i+(r?1:0))).__actions__.push({func:uo,args:[s],thisArg:t}),new jr(n,this.__chain__).thru((function(e){return r&&!e.length&&e.push(t),e}))):this.thru(s)})),lo=Rn((function(t,e,r){kt.call(t,r)?++t[r]:ii(t,r,1)})),po=Dn(zs),go=Dn(js);function mo(t,e){return(Fo(t)?Me:ui)(t,os(e,3))}function bo(t,e){return(Fo(t)?Ee:fi)(t,os(e,3))}var vo=Rn((function(t,e,r){kt.call(t,r)?t[r].push(e):ii(t,r,[e])})),yo=Ji((function(t,e,r){var i=-1,n="function"==typeof e,s=Ko(t)?_t(t.length):[];return ui(t,(function(t){s[++i]=n?_e(e,t,r):xi(t,e,r)})),s})),wo=Rn((function(t,e,r){ii(t,r,e)}));function _o(t,e){return(Fo(t)?Re:Di)(t,os(e,3))}var Ao=Rn((function(t,e,r){t[r?0:1].push(e)}),(function(){return[[],[]]})),Mo=Ji((function(t,e){if(null==t)return[];var r=e.length;return r>1&&bs(t,e[0],e[1])?e=[]:r>2&&bs(e[0],e[1],e[2])&&(e=[e[0]]),ji(t,gi(e,1),[])})),Eo=le||function(){return he.Date.now()};function Io(e,r,i){return r=i?t:r,r=e&&null==r?e.length:r,Qn(e,s,t,t,t,t,r)}function So(r,i){var n;if("function"!=typeof i)throw new Rt(e);return r=da(r),function(){return--r>0&&(n=i.apply(this,arguments)),r<=1&&(i=t),n}}var Po=Ji((function(t,e,r){var i=1;if(r.length){var s=nr(r,ss(Po));i|=n}return Qn(t,i,e,r,s)})),xo=Ji((function(t,e,r){var i=3;if(r.length){var s=nr(r,ss(xo));i|=n}return Qn(e,i,t,r,s)}));function Ro(r,i,n){var s,o,a,c,h,u,f=0,d=!1,l=!1,p=!0;if("function"!=typeof r)throw new Rt(e);function g(e){var i=s,n=o;return s=o=t,f=e,c=r.apply(n,i)}function m(e){var r=e-u;return u===t||r>=i||r<0||l&&e-f>=a}function b(){var t=Eo();if(m(t))return v(t);h=xs(b,function(t){var e=i-(t-u);return l?br(e,a-(t-f)):e}(t))}function v(e){return h=t,p&&s?g(e):(s=o=t,c)}function y(){var e=Eo(),r=m(e);if(s=arguments,o=this,u=e,r){if(h===t)return function(t){return f=t,h=xs(b,i),d?g(t):c}(u);if(l)return wn(h),h=xs(b,i),g(u)}return h===t&&(h=xs(b,i)),c}return i=pa(i)||0,Xo(n)&&(d=!!n.leading,a=(l="maxWait"in n)?mr(pa(n.maxWait)||0,i):a,p="trailing"in n?!!n.trailing:p),y.cancel=function(){h!==t&&wn(h),f=0,s=u=o=h=t},y.flush=function(){return h===t?c:v(Eo())},y}var No=Ji((function(t,e){return ci(t,1,e)})),Oo=Ji((function(t,e,r){return ci(t,pa(e)||0,r)}));function Co(t,r){if("function"!=typeof t||null!=r&&"function"!=typeof r)throw new Rt(e);var i=function(){var e=arguments,n=r?r.apply(this,e):e[0],s=i.cache;if(s.has(n))return s.get(n);var o=t.apply(this,e);return i.cache=s.set(n,o)||s,o};return i.cache=new(Co.Cache||$r),i}function To(t){if("function"!=typeof t)throw new Rt(e);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}Co.Cache=$r;var qo=vn((function(t,e){var r=(e=1==e.length&&Fo(e[0])?Re(e[0],Je(os())):Re(gi(e,1),Je(os()))).length;return Ji((function(i){for(var n=-1,s=br(i.length,r);++n<s;)i[n]=e[n].call(this,i[n]);return _e(t,this,i)}))})),ko=Ji((function(e,r){var i=nr(r,ss(ko));return Qn(e,n,t,r,i)})),Do=Ji((function(e,r){var i=nr(r,ss(Do));return Qn(e,64,t,r,i)})),Uo=ts((function(e,r){return Qn(e,256,t,t,t,r)}));function Bo(t,e){return t===e||t!=t&&e!=e}var Lo=Kn(Ei),zo=Kn((function(t,e){return t>=e})),jo=Ri(function(){return arguments}())?Ri:function(t){return Zo(t)&&kt.call(t,"callee")&&!Wt.call(t,"callee")},Fo=_t.isArray,Ho=ge?Je(ge):function(t){return Zo(t)&&Mi(t)==R};function Ko(t){return null!=t&&Yo(t.length)&&!Qo(t)}function $o(t){return Zo(t)&&Ko(t)}var Vo=dr||pc,Jo=me?Je(me):function(t){return Zo(t)&&Mi(t)==m};function Go(t){if(!Zo(t))return!1;var e=Mi(t);return e==b||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!ra(t)}function Qo(t){if(!Xo(t))return!1;var e=Mi(t);return e==v||e==y||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Wo(t){return"number"==typeof t&&t==da(t)}function Yo(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=a}function Xo(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function Zo(t){return null!=t&&"object"==typeof t}var ta=be?Je(be):function(t){return Zo(t)&&ds(t)==w};function ea(t){return"number"==typeof t||Zo(t)&&Mi(t)==_}function ra(t){if(!Zo(t)||Mi(t)!=A)return!1;var e=Vt(t);if(null===e)return!0;var r=kt.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&qt.call(r)==Lt}var ia=ve?Je(ve):function(t){return Zo(t)&&Mi(t)==E},na=ye?Je(ye):function(t){return Zo(t)&&ds(t)==I};function sa(t){return"string"==typeof t||!Fo(t)&&Zo(t)&&Mi(t)==S}function oa(t){return"symbol"==typeof t||Zo(t)&&Mi(t)==P}var aa=we?Je(we):function(t){return Zo(t)&&Yo(t.length)&&!!re[Mi(t)]},ca=Kn(ki),ha=Kn((function(t,e){return t<=e}));function ua(t){if(!t)return[];if(Ko(t))return sa(t)?ar(t):Pn(t);if(ae&&t[ae])return function(t){for(var e,r=[];!(e=t.next()).done;)r.push(e.value);return r}(t[ae]());var e=ds(t);return(e==w?rr:e==I?sr:Ba)(t)}function fa(t){return t?(t=pa(t))===o||t===-o?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function da(t){var e=fa(t),r=e%1;return e==e?r?e-r:e:0}function la(t){return t?si(da(t),0,h):0}function pa(t){if("number"==typeof t)return t;if(oa(t))return c;if(Xo(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=Xo(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=Ve(t);var r=dt.test(t);return r||pt.test(t)?oe(t.slice(2),r?2:8):ft.test(t)?c:+t}function ga(t){return xn(t,Na(t))}function ma(t){return null==t?"":an(t)}var ba=Nn((function(t,e){if(_s(e)||Ko(e))xn(e,Ra(e),t);else for(var r in e)kt.call(e,r)&&Zr(t,r,e[r])})),va=Nn((function(t,e){xn(e,Na(e),t)})),ya=Nn((function(t,e,r,i){xn(e,Na(e),t,i)})),wa=Nn((function(t,e,r,i){xn(e,Ra(e),t,i)})),_a=ts(ni),Aa=Ji((function(e,r){e=St(e);var i=-1,n=r.length,s=n>2?r[2]:t;for(s&&bs(r[0],r[1],s)&&(n=1);++i<n;)for(var o=r[i],a=Na(o),c=-1,h=a.length;++c<h;){var u=a[c],f=e[u];(f===t||Bo(f,Ct[u])&&!kt.call(e,u))&&(e[u]=o[u])}return e})),Ma=Ji((function(e){return e.push(t,Yn),_e(Ca,t,e)}));function Ea(e,r,i){var n=null==e?t:_i(e,r);return n===t?i:n}function Ia(t,e){return null!=t&&ls(t,e,Si)}var Sa=Ln((function(t,e,r){null!=e&&"function"!=typeof e.toString&&(e=Bt.call(e)),t[e]=r}),Xa(ec)),Pa=Ln((function(t,e,r){null!=e&&"function"!=typeof e.toString&&(e=Bt.call(e)),kt.call(t,e)?t[e].push(r):t[e]=[r]}),os),xa=Ji(xi);function Ra(t){return Ko(t)?Gr(t):qi(t)}function Na(t){return Ko(t)?Gr(t,!0):function(t){if(!Xo(t))return function(t){var e=[];if(null!=t)for(var r in St(t))e.push(r);return e}(t);var e=_s(t),r=[];for(var i in t)"constructor"==i&&(e||!kt.call(t,i))||r.push(i);return r}(t)}var Oa=Nn((function(t,e,r){Li(t,e,r)})),Ca=Nn((function(t,e,r,i){Li(t,e,r,i)})),Ta=ts((function(t,e){var r={};if(null==t)return r;var i=!1;e=Re(e,(function(e){return e=bn(e,t),i||(i=e.length>1),e})),xn(t,rs(t),r),i&&(r=oi(r,7,Xn));for(var n=e.length;n--;)hn(r,e[n]);return r})),qa=ts((function(t,e){return null==t?{}:function(t,e){return Fi(t,e,(function(e,r){return Ia(t,r)}))}(t,e)}));function ka(t,e){if(null==t)return{};var r=Re(rs(t),(function(t){return[t]}));return e=os(e),Fi(t,r,(function(t,r){return e(t,r[0])}))}var Da=Gn(Ra),Ua=Gn(Na);function Ba(t){return null==t?[]:Ge(t,Ra(t))}var La=qn((function(t,e,r){return e=e.toLowerCase(),t+(r?za(e):e)}));function za(t){return Ga(ma(t).toLowerCase())}function ja(t){return(t=ma(t))&&t.replace(mt,Xe).replace(Qt,"")}var Fa=qn((function(t,e,r){return t+(r?"-":"")+e.toLowerCase()})),Ha=qn((function(t,e,r){return t+(r?" ":"")+e.toLowerCase()})),Ka=Tn("toLowerCase"),$a=qn((function(t,e,r){return t+(r?"_":"")+e.toLowerCase()})),Va=qn((function(t,e,r){return t+(r?" ":"")+Ga(e)})),Ja=qn((function(t,e,r){return t+(r?" ":"")+e.toUpperCase()})),Ga=Tn("toUpperCase");function Qa(e,r,i){return e=ma(e),(r=i?t:r)===t?function(t){return Zt.test(t)}(e)?function(t){return t.match(Yt)||[]}(e):function(t){return t.match(ot)||[]}(e):e.match(r)||[]}var Wa=Ji((function(e,r){try{return _e(e,t,r)}catch(t){return Go(t)?t:new Mt(t)}})),Ya=ts((function(t,e){return Me(e,(function(e){e=qs(e),ii(t,e,Po(t[e],t))})),t}));function Xa(t){return function(){return t}}var Za=Un(),tc=Un(!0);function ec(t){return t}function rc(t){return Ti("function"==typeof t?t:oi(t,1))}var ic=Ji((function(t,e){return function(r){return xi(r,t,e)}})),nc=Ji((function(t,e){return function(r){return xi(t,r,e)}}));function sc(t,e,r){var i=Ra(e),n=wi(e,i);null==r&&(!Xo(e)||!n.length&&i.length)&&(r=e,e=t,t=this,n=wi(e,Ra(e)));var s=!(Xo(r)&&"chain"in r&&!r.chain),o=Qo(t);return Me(n,(function(r){var i=e[r];t[r]=i,o&&(t.prototype[r]=function(){var e=this.__chain__;if(s||e){var r=t(this.__wrapped__);return(r.__actions__=Pn(this.__actions__)).push({func:i,args:arguments,thisArg:t}),r.__chain__=e,r}return i.apply(t,Ne([this.value()],arguments))})})),t}function oc(){}var ac=jn(Re),cc=jn(Ie),hc=jn(Te);function uc(t){return vs(t)?je(qs(t)):function(t){return function(e){return _i(e,t)}}(t)}var fc=Hn(),dc=Hn(!0);function lc(){return[]}function pc(){return!1}var gc=zn((function(t,e){return t+e}),0),mc=Vn("ceil"),bc=zn((function(t,e){return t/e}),1),vc=Vn("floor"),yc=zn((function(t,e){return t*e}),1),wc=Vn("round"),_c=zn((function(t,e){return t-e}),0);return Br.after=function(t,r){if("function"!=typeof r)throw new Rt(e);return t=da(t),function(){if(--t<1)return r.apply(this,arguments)}},Br.ary=Io,Br.assign=ba,Br.assignIn=va,Br.assignInWith=ya,Br.assignWith=wa,Br.at=_a,Br.before=So,Br.bind=Po,Br.bindAll=Ya,Br.bindKey=xo,Br.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return Fo(t)?t:[t]},Br.chain=ho,Br.chunk=function(e,r,i){r=(i?bs(e,r,i):r===t)?1:mr(da(r),0);var n=null==e?0:e.length;if(!n||r<1)return[];for(var s=0,o=0,a=_t(qe(n/r));s<n;)a[o++]=tn(e,s,s+=r);return a},Br.compact=function(t){for(var e=-1,r=null==t?0:t.length,i=0,n=[];++e<r;){var s=t[e];s&&(n[i++]=s)}return n},Br.concat=function(){var t=arguments.length;if(!t)return[];for(var e=_t(t-1),r=arguments[0],i=t;i--;)e[i-1]=arguments[i];return Ne(Fo(r)?Pn(r):[r],gi(e,1))},Br.cond=function(t){var r=null==t?0:t.length,i=os();return t=r?Re(t,(function(t){if("function"!=typeof t[1])throw new Rt(e);return[i(t[0]),t[1]]})):[],Ji((function(e){for(var i=-1;++i<r;){var n=t[i];if(_e(n[0],this,e))return _e(n[1],this,e)}}))},Br.conforms=function(t){return function(t){var e=Ra(t);return function(r){return ai(r,t,e)}}(oi(t,1))},Br.constant=Xa,Br.countBy=lo,Br.create=function(t,e){var r=Lr(t);return null==e?r:ri(r,e)},Br.curry=function e(r,i,n){var s=Qn(r,8,t,t,t,t,t,i=n?t:i);return s.placeholder=e.placeholder,s},Br.curryRight=function e(r,i,n){var s=Qn(r,16,t,t,t,t,t,i=n?t:i);return s.placeholder=e.placeholder,s},Br.debounce=Ro,Br.defaults=Aa,Br.defaultsDeep=Ma,Br.defer=No,Br.delay=Oo,Br.difference=Us,Br.differenceBy=Bs,Br.differenceWith=Ls,Br.drop=function(e,r,i){var n=null==e?0:e.length;return n?tn(e,(r=i||r===t?1:da(r))<0?0:r,n):[]},Br.dropRight=function(e,r,i){var n=null==e?0:e.length;return n?tn(e,0,(r=n-(r=i||r===t?1:da(r)))<0?0:r):[]},Br.dropRightWhile=function(t,e){return t&&t.length?fn(t,os(e,3),!0,!0):[]},Br.dropWhile=function(t,e){return t&&t.length?fn(t,os(e,3),!0):[]},Br.fill=function(e,r,i,n){var s=null==e?0:e.length;return s?(i&&"number"!=typeof i&&bs(e,r,i)&&(i=0,n=s),function(e,r,i,n){var s=e.length;for((i=da(i))<0&&(i=-i>s?0:s+i),(n=n===t||n>s?s:da(n))<0&&(n+=s),n=i>n?0:la(n);i<n;)e[i++]=r;return e}(e,r,i,n)):[]},Br.filter=function(t,e){return(Fo(t)?Se:pi)(t,os(e,3))},Br.flatMap=function(t,e){return gi(_o(t,e),1)},Br.flatMapDeep=function(t,e){return gi(_o(t,e),o)},Br.flatMapDepth=function(e,r,i){return i=i===t?1:da(i),gi(_o(e,r),i)},Br.flatten=Fs,Br.flattenDeep=function(t){return null!=t&&t.length?gi(t,o):[]},Br.flattenDepth=function(e,r){return null!=e&&e.length?gi(e,r=r===t?1:da(r)):[]},Br.flip=function(t){return Qn(t,512)},Br.flow=Za,Br.flowRight=tc,Br.fromPairs=function(t){for(var e=-1,r=null==t?0:t.length,i={};++e<r;){var n=t[e];i[n[0]]=n[1]}return i},Br.functions=function(t){return null==t?[]:wi(t,Ra(t))},Br.functionsIn=function(t){return null==t?[]:wi(t,Na(t))},Br.groupBy=vo,Br.initial=function(t){return null!=t&&t.length?tn(t,0,-1):[]},Br.intersection=Ks,Br.intersectionBy=$s,Br.intersectionWith=Vs,Br.invert=Sa,Br.invertBy=Pa,Br.invokeMap=yo,Br.iteratee=rc,Br.keyBy=wo,Br.keys=Ra,Br.keysIn=Na,Br.map=_o,Br.mapKeys=function(t,e){var r={};return e=os(e,3),vi(t,(function(t,i,n){ii(r,e(t,i,n),t)})),r},Br.mapValues=function(t,e){var r={};return e=os(e,3),vi(t,(function(t,i,n){ii(r,i,e(t,i,n))})),r},Br.matches=function(t){return Ui(oi(t,1))},Br.matchesProperty=function(t,e){return Bi(t,oi(e,1))},Br.memoize=Co,Br.merge=Oa,Br.mergeWith=Ca,Br.method=ic,Br.methodOf=nc,Br.mixin=sc,Br.negate=To,Br.nthArg=function(t){return t=da(t),Ji((function(e){return zi(e,t)}))},Br.omit=Ta,Br.omitBy=function(t,e){return ka(t,To(os(e)))},Br.once=function(t){return So(2,t)},Br.orderBy=function(e,r,i,n){return null==e?[]:(Fo(r)||(r=null==r?[]:[r]),Fo(i=n?t:i)||(i=null==i?[]:[i]),ji(e,r,i))},Br.over=ac,Br.overArgs=qo,Br.overEvery=cc,Br.overSome=hc,Br.partial=ko,Br.partialRight=Do,Br.partition=Ao,Br.pick=qa,Br.pickBy=ka,Br.property=uc,Br.propertyOf=function(e){return function(r){return null==e?t:_i(e,r)}},Br.pull=Gs,Br.pullAll=Qs,Br.pullAllBy=function(t,e,r){return t&&t.length&&e&&e.length?Hi(t,e,os(r,2)):t},Br.pullAllWith=function(e,r,i){return e&&e.length&&r&&r.length?Hi(e,r,t,i):e},Br.pullAt=Ws,Br.range=fc,Br.rangeRight=dc,Br.rearg=Uo,Br.reject=function(t,e){return(Fo(t)?Se:pi)(t,To(os(e,3)))},Br.remove=function(t,e){var r=[];if(!t||!t.length)return r;var i=-1,n=[],s=t.length;for(e=os(e,3);++i<s;){var o=t[i];e(o,i,t)&&(r.push(o),n.push(i))}return Ki(t,n),r},Br.rest=function(r,i){if("function"!=typeof r)throw new Rt(e);return Ji(r,i=i===t?i:da(i))},Br.reverse=Ys,Br.sampleSize=function(e,r,i){return r=(i?bs(e,r,i):r===t)?1:da(r),(Fo(e)?Wr:Qi)(e,r)},Br.set=function(t,e,r){return null==t?t:Wi(t,e,r)},Br.setWith=function(e,r,i,n){return n="function"==typeof n?n:t,null==e?e:Wi(e,r,i,n)},Br.shuffle=function(t){return(Fo(t)?Yr:Zi)(t)},Br.slice=function(e,r,i){var n=null==e?0:e.length;return n?(i&&"number"!=typeof i&&bs(e,r,i)?(r=0,i=n):(r=null==r?0:da(r),i=i===t?n:da(i)),tn(e,r,i)):[]},Br.sortBy=Mo,Br.sortedUniq=function(t){return t&&t.length?sn(t):[]},Br.sortedUniqBy=function(t,e){return t&&t.length?sn(t,os(e,2)):[]},Br.split=function(e,r,i){return i&&"number"!=typeof i&&bs(e,r,i)&&(r=i=t),(i=i===t?h:i>>>0)?(e=ma(e))&&("string"==typeof r||null!=r&&!ia(r))&&!(r=an(r))&&er(e)?yn(ar(e),0,i):e.split(r,i):[]},Br.spread=function(t,r){if("function"!=typeof t)throw new Rt(e);return r=null==r?0:mr(da(r),0),Ji((function(e){var i=e[r],n=yn(e,0,r);return i&&Ne(n,i),_e(t,this,n)}))},Br.tail=function(t){var e=null==t?0:t.length;return e?tn(t,1,e):[]},Br.take=function(e,r,i){return e&&e.length?tn(e,0,(r=i||r===t?1:da(r))<0?0:r):[]},Br.takeRight=function(e,r,i){var n=null==e?0:e.length;return n?tn(e,(r=n-(r=i||r===t?1:da(r)))<0?0:r,n):[]},Br.takeRightWhile=function(t,e){return t&&t.length?fn(t,os(e,3),!1,!0):[]},Br.takeWhile=function(t,e){return t&&t.length?fn(t,os(e,3)):[]},Br.tap=function(t,e){return e(t),t},Br.throttle=function(t,r,i){var n=!0,s=!0;if("function"!=typeof t)throw new Rt(e);return Xo(i)&&(n="leading"in i?!!i.leading:n,s="trailing"in i?!!i.trailing:s),Ro(t,r,{leading:n,maxWait:r,trailing:s})},Br.thru=uo,Br.toArray=ua,Br.toPairs=Da,Br.toPairsIn=Ua,Br.toPath=function(t){return Fo(t)?Re(t,qs):oa(t)?[t]:Pn(Ts(ma(t)))},Br.toPlainObject=ga,Br.transform=function(t,e,r){var i=Fo(t),n=i||Vo(t)||aa(t);if(e=os(e,4),null==r){var s=t&&t.constructor;r=n?i?new s:[]:Xo(t)&&Qo(s)?Lr(Vt(t)):{}}return(n?Me:vi)(t,(function(t,i,n){return e(r,t,i,n)})),r},Br.unary=function(t){return Io(t,1)},Br.union=Xs,Br.unionBy=Zs,Br.unionWith=to,Br.uniq=function(t){return t&&t.length?cn(t):[]},Br.uniqBy=function(t,e){return t&&t.length?cn(t,os(e,2)):[]},Br.uniqWith=function(e,r){return r="function"==typeof r?r:t,e&&e.length?cn(e,t,r):[]},Br.unset=function(t,e){return null==t||hn(t,e)},Br.unzip=eo,Br.unzipWith=ro,Br.update=function(t,e,r){return null==t?t:un(t,e,mn(r))},Br.updateWith=function(e,r,i,n){return n="function"==typeof n?n:t,null==e?e:un(e,r,mn(i),n)},Br.values=Ba,Br.valuesIn=function(t){return null==t?[]:Ge(t,Na(t))},Br.without=io,Br.words=Qa,Br.wrap=function(t,e){return ko(mn(e),t)},Br.xor=no,Br.xorBy=so,Br.xorWith=oo,Br.zip=ao,Br.zipObject=function(t,e){return pn(t||[],e||[],Zr)},Br.zipObjectDeep=function(t,e){return pn(t||[],e||[],Wi)},Br.zipWith=co,Br.entries=Da,Br.entriesIn=Ua,Br.extend=va,Br.extendWith=ya,sc(Br,Br),Br.add=gc,Br.attempt=Wa,Br.camelCase=La,Br.capitalize=za,Br.ceil=mc,Br.clamp=function(e,r,i){return i===t&&(i=r,r=t),i!==t&&(i=(i=pa(i))==i?i:0),r!==t&&(r=(r=pa(r))==r?r:0),si(pa(e),r,i)},Br.clone=function(t){return oi(t,4)},Br.cloneDeep=function(t){return oi(t,5)},Br.cloneDeepWith=function(e,r){return oi(e,5,r="function"==typeof r?r:t)},Br.cloneWith=function(e,r){return oi(e,4,r="function"==typeof r?r:t)},Br.conformsTo=function(t,e){return null==e||ai(t,e,Ra(e))},Br.deburr=ja,Br.defaultTo=function(t,e){return null==t||t!=t?e:t},Br.divide=bc,Br.endsWith=function(e,r,i){e=ma(e),r=an(r);var n=e.length,s=i=i===t?n:si(da(i),0,n);return(i-=r.length)>=0&&e.slice(i,s)==r},Br.eq=Bo,Br.escape=function(t){return(t=ma(t))&&V.test(t)?t.replace(K,Ze):t},Br.escapeRegExp=function(t){return(t=ma(t))&&tt.test(t)?t.replace(Z,"\\$&"):t},Br.every=function(e,r,i){var n=Fo(e)?Ie:di;return i&&bs(e,r,i)&&(r=t),n(e,os(r,3))},Br.find=po,Br.findIndex=zs,Br.findKey=function(t,e){return ke(t,os(e,3),vi)},Br.findLast=go,Br.findLastIndex=js,Br.findLastKey=function(t,e){return ke(t,os(e,3),yi)},Br.floor=vc,Br.forEach=mo,Br.forEachRight=bo,Br.forIn=function(t,e){return null==t?t:mi(t,os(e,3),Na)},Br.forInRight=function(t,e){return null==t?t:bi(t,os(e,3),Na)},Br.forOwn=function(t,e){return t&&vi(t,os(e,3))},Br.forOwnRight=function(t,e){return t&&yi(t,os(e,3))},Br.get=Ea,Br.gt=Lo,Br.gte=zo,Br.has=function(t,e){return null!=t&&ls(t,e,Ii)},Br.hasIn=Ia,Br.head=Hs,Br.identity=ec,Br.includes=function(t,e,r,i){t=Ko(t)?t:Ba(t),r=r&&!i?da(r):0;var n=t.length;return r<0&&(r=mr(n+r,0)),sa(t)?r<=n&&t.indexOf(e,r)>-1:!!n&&Ue(t,e,r)>-1},Br.indexOf=function(t,e,r){var i=null==t?0:t.length;if(!i)return-1;var n=null==r?0:da(r);return n<0&&(n=mr(i+n,0)),Ue(t,e,n)},Br.inRange=function(e,r,i){return r=fa(r),i===t?(i=r,r=0):i=fa(i),function(t,e,r){return t>=br(e,r)&&t<mr(e,r)}(e=pa(e),r,i)},Br.invoke=xa,Br.isArguments=jo,Br.isArray=Fo,Br.isArrayBuffer=Ho,Br.isArrayLike=Ko,Br.isArrayLikeObject=$o,Br.isBoolean=function(t){return!0===t||!1===t||Zo(t)&&Mi(t)==g},Br.isBuffer=Vo,Br.isDate=Jo,Br.isElement=function(t){return Zo(t)&&1===t.nodeType&&!ra(t)},Br.isEmpty=function(t){if(null==t)return!0;if(Ko(t)&&(Fo(t)||"string"==typeof t||"function"==typeof t.splice||Vo(t)||aa(t)||jo(t)))return!t.length;var e=ds(t);if(e==w||e==I)return!t.size;if(_s(t))return!qi(t).length;for(var r in t)if(kt.call(t,r))return!1;return!0},Br.isEqual=function(t,e){return Ni(t,e)},Br.isEqualWith=function(e,r,i){var n=(i="function"==typeof i?i:t)?i(e,r):t;return n===t?Ni(e,r,t,i):!!n},Br.isError=Go,Br.isFinite=function(t){return"number"==typeof t&&lr(t)},Br.isFunction=Qo,Br.isInteger=Wo,Br.isLength=Yo,Br.isMap=ta,Br.isMatch=function(t,e){return t===e||Oi(t,e,cs(e))},Br.isMatchWith=function(e,r,i){return i="function"==typeof i?i:t,Oi(e,r,cs(r),i)},Br.isNaN=function(t){return ea(t)&&t!=+t},Br.isNative=function(t){if(ws(t))throw new Mt("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Ci(t)},Br.isNil=function(t){return null==t},Br.isNull=function(t){return null===t},Br.isNumber=ea,Br.isObject=Xo,Br.isObjectLike=Zo,Br.isPlainObject=ra,Br.isRegExp=ia,Br.isSafeInteger=function(t){return Wo(t)&&t>=-a&&t<=a},Br.isSet=na,Br.isString=sa,Br.isSymbol=oa,Br.isTypedArray=aa,Br.isUndefined=function(e){return e===t},Br.isWeakMap=function(t){return Zo(t)&&ds(t)==x},Br.isWeakSet=function(t){return Zo(t)&&"[object WeakSet]"==Mi(t)},Br.join=function(t,e){return null==t?"":pr.call(t,e)},Br.kebabCase=Fa,Br.last=Js,Br.lastIndexOf=function(e,r,i){var n=null==e?0:e.length;if(!n)return-1;var s=n;return i!==t&&(s=(s=da(i))<0?mr(n+s,0):br(s,n-1)),r==r?function(t,e,r){for(var i=r+1;i--;)if(t[i]===e)return i;return i}(e,r,s):De(e,Le,s,!0)},Br.lowerCase=Ha,Br.lowerFirst=Ka,Br.lt=ca,Br.lte=ha,Br.max=function(e){return e&&e.length?li(e,ec,Ei):t},Br.maxBy=function(e,r){return e&&e.length?li(e,os(r,2),Ei):t},Br.mean=function(t){return ze(t,ec)},Br.meanBy=function(t,e){return ze(t,os(e,2))},Br.min=function(e){return e&&e.length?li(e,ec,ki):t},Br.minBy=function(e,r){return e&&e.length?li(e,os(r,2),ki):t},Br.stubArray=lc,Br.stubFalse=pc,Br.stubObject=function(){return{}},Br.stubString=function(){return""},Br.stubTrue=function(){return!0},Br.multiply=yc,Br.nth=function(e,r){return e&&e.length?zi(e,da(r)):t},Br.noConflict=function(){return he._===this&&(he._=zt),this},Br.noop=oc,Br.now=Eo,Br.pad=function(t,e,r){t=ma(t);var i=(e=da(e))?or(t):0;if(!e||i>=e)return t;var n=(e-i)/2;return Fn(Fe(n),r)+t+Fn(qe(n),r)},Br.padEnd=function(t,e,r){t=ma(t);var i=(e=da(e))?or(t):0;return e&&i<e?t+Fn(e-i,r):t},Br.padStart=function(t,e,r){t=ma(t);var i=(e=da(e))?or(t):0;return e&&i<e?Fn(e-i,r)+t:t},Br.parseInt=function(t,e,r){return r||null==e?e=0:e&&(e=+e),yr(ma(t).replace(et,""),e||0)},Br.random=function(e,r,i){if(i&&"boolean"!=typeof i&&bs(e,r,i)&&(r=i=t),i===t&&("boolean"==typeof r?(i=r,r=t):"boolean"==typeof e&&(i=e,e=t)),e===t&&r===t?(e=0,r=1):(e=fa(e),r===t?(r=e,e=0):r=fa(r)),e>r){var n=e;e=r,r=n}if(i||e%1||r%1){var s=wr();return br(e+s*(r-e+se("1e-"+((s+"").length-1))),r)}return $i(e,r)},Br.reduce=function(t,e,r){var i=Fo(t)?Oe:He,n=arguments.length<3;return i(t,os(e,4),r,n,ui)},Br.reduceRight=function(t,e,r){var i=Fo(t)?Ce:He,n=arguments.length<3;return i(t,os(e,4),r,n,fi)},Br.repeat=function(e,r,i){return r=(i?bs(e,r,i):r===t)?1:da(r),Vi(ma(e),r)},Br.replace=function(){var t=arguments,e=ma(t[0]);return t.length<3?e:e.replace(t[1],t[2])},Br.result=function(e,r,i){var n=-1,s=(r=bn(r,e)).length;for(s||(s=1,e=t);++n<s;){var o=null==e?t:e[qs(r[n])];o===t&&(n=s,o=i),e=Qo(o)?o.call(e):o}return e},Br.round=wc,Br.runInContext=rt,Br.sample=function(t){return(Fo(t)?Qr:Gi)(t)},Br.size=function(t){if(null==t)return 0;if(Ko(t))return sa(t)?or(t):t.length;var e=ds(t);return e==w||e==I?t.size:qi(t).length},Br.snakeCase=$a,Br.some=function(e,r,i){var n=Fo(e)?Te:en;return i&&bs(e,r,i)&&(r=t),n(e,os(r,3))},Br.sortedIndex=function(t,e){return rn(t,e)},Br.sortedIndexBy=function(t,e,r){return nn(t,e,os(r,2))},Br.sortedIndexOf=function(t,e){var r=null==t?0:t.length;if(r){var i=rn(t,e);if(i<r&&Bo(t[i],e))return i}return-1},Br.sortedLastIndex=function(t,e){return rn(t,e,!0)},Br.sortedLastIndexBy=function(t,e,r){return nn(t,e,os(r,2),!0)},Br.sortedLastIndexOf=function(t,e){if(null!=t&&t.length){var r=rn(t,e,!0)-1;if(Bo(t[r],e))return r}return-1},Br.startCase=Va,Br.startsWith=function(t,e,r){return t=ma(t),r=null==r?0:si(da(r),0,t.length),e=an(e),t.slice(r,r+e.length)==e},Br.subtract=_c,Br.sum=function(t){return t&&t.length?Ke(t,ec):0},Br.sumBy=function(t,e){return t&&t.length?Ke(t,os(e,2)):0},Br.template=function(e,r,i){var n=Br.templateSettings;i&&bs(e,r,i)&&(r=t),e=ma(e),r=ya({},r,n,Wn);var s,o,a=ya({},r.imports,n.imports,Wn),c=Ra(a),h=Ge(a,c),u=0,f=r.interpolate||bt,d="__p += '",l=Pt((r.escape||bt).source+"|"+f.source+"|"+(f===Q?ht:bt).source+"|"+(r.evaluate||bt).source+"|$","g"),p="//# sourceURL="+(kt.call(r,"sourceURL")?(r.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++ee+"]")+"\n";e.replace(l,(function(t,r,i,n,a,c){return i||(i=n),d+=e.slice(u,c).replace(vt,tr),r&&(s=!0,d+="' +\n__e("+r+") +\n'"),a&&(o=!0,d+="';\n"+a+";\n__p += '"),i&&(d+="' +\n((__t = ("+i+")) == null ? '' : __t) +\n'"),u=c+t.length,t})),d+="';\n";var g=kt.call(r,"variable")&&r.variable;if(g){if(at.test(g))throw new Mt("Invalid `variable` option passed into `_.template`")}else d="with (obj) {\n"+d+"\n}\n";d=(o?d.replace(z,""):d).replace(j,"$1").replace(F,"$1;"),d="function("+(g||"obj")+") {\n"+(g?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(s?", __e = _.escape":"")+(o?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+d+"return __p\n}";var m=Wa((function(){return Et(c,p+"return "+d).apply(t,h)}));if(m.source=d,Go(m))throw m;return m},Br.times=function(t,e){if((t=da(t))<1||t>a)return[];var r=h,i=br(t,h);e=os(e),t-=h;for(var n=$e(i,e);++r<t;)e(r);return n},Br.toFinite=fa,Br.toInteger=da,Br.toLength=la,Br.toLower=function(t){return ma(t).toLowerCase()},Br.toNumber=pa,Br.toSafeInteger=function(t){return t?si(da(t),-a,a):0===t?t:0},Br.toString=ma,Br.toUpper=function(t){return ma(t).toUpperCase()},Br.trim=function(e,r,i){if((e=ma(e))&&(i||r===t))return Ve(e);if(!e||!(r=an(r)))return e;var n=ar(e),s=ar(r);return yn(n,We(n,s),Ye(n,s)+1).join("")},Br.trimEnd=function(e,r,i){if((e=ma(e))&&(i||r===t))return e.slice(0,cr(e)+1);if(!e||!(r=an(r)))return e;var n=ar(e);return yn(n,0,Ye(n,ar(r))+1).join("")},Br.trimStart=function(e,r,i){if((e=ma(e))&&(i||r===t))return e.replace(et,"");if(!e||!(r=an(r)))return e;var n=ar(e);return yn(n,We(n,ar(r))).join("")},Br.truncate=function(e,r){var i=30,n="...";if(Xo(r)){var s="separator"in r?r.separator:s;i="length"in r?da(r.length):i,n="omission"in r?an(r.omission):n}var o=(e=ma(e)).length;if(er(e)){var a=ar(e);o=a.length}if(i>=o)return e;var c=i-or(n);if(c<1)return n;var h=a?yn(a,0,c).join(""):e.slice(0,c);if(s===t)return h+n;if(a&&(c+=h.length-c),ia(s)){if(e.slice(c).search(s)){var u,f=h;for(s.global||(s=Pt(s.source,ma(ut.exec(s))+"g")),s.lastIndex=0;u=s.exec(f);)var d=u.index;h=h.slice(0,d===t?c:d)}}else if(e.indexOf(an(s),c)!=c){var l=h.lastIndexOf(s);l>-1&&(h=h.slice(0,l))}return h+n},Br.unescape=function(t){return(t=ma(t))&&$.test(t)?t.replace(H,hr):t},Br.uniqueId=function(t){var e=++Dt;return ma(t)+e},Br.upperCase=Ja,Br.upperFirst=Ga,Br.each=mo,Br.eachRight=bo,Br.first=Hs,sc(Br,function(){var t={};return vi(Br,(function(e,r){kt.call(Br.prototype,r)||(t[r]=e)})),t}(),{chain:!1}),Br.VERSION="4.17.21",Me(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(t){Br[t].placeholder=Br})),Me(["drop","take"],(function(e,r){Fr.prototype[e]=function(i){i=i===t?1:mr(da(i),0);var n=this.__filtered__&&!r?new Fr(this):this.clone();return n.__filtered__?n.__takeCount__=br(i,n.__takeCount__):n.__views__.push({size:br(i,h),type:e+(n.__dir__<0?"Right":"")}),n},Fr.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),Me(["filter","map","takeWhile"],(function(t,e){var r=e+1,i=1==r||3==r;Fr.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:os(t,3),type:r}),e.__filtered__=e.__filtered__||i,e}})),Me(["head","last"],(function(t,e){var r="take"+(e?"Right":"");Fr.prototype[t]=function(){return this[r](1).value()[0]}})),Me(["initial","tail"],(function(t,e){var r="drop"+(e?"":"Right");Fr.prototype[t]=function(){return this.__filtered__?new Fr(this):this[r](1)}})),Fr.prototype.compact=function(){return this.filter(ec)},Fr.prototype.find=function(t){return this.filter(t).head()},Fr.prototype.findLast=function(t){return this.reverse().find(t)},Fr.prototype.invokeMap=Ji((function(t,e){return"function"==typeof t?new Fr(this):this.map((function(r){return xi(r,t,e)}))})),Fr.prototype.reject=function(t){return this.filter(To(os(t)))},Fr.prototype.slice=function(e,r){e=da(e);var i=this;return i.__filtered__&&(e>0||r<0)?new Fr(i):(e<0?i=i.takeRight(-e):e&&(i=i.drop(e)),r!==t&&(i=(r=da(r))<0?i.dropRight(-r):i.take(r-e)),i)},Fr.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},Fr.prototype.toArray=function(){return this.take(h)},vi(Fr.prototype,(function(e,r){var i=/^(?:filter|find|map|reject)|While$/.test(r),n=/^(?:head|last)$/.test(r),s=Br[n?"take"+("last"==r?"Right":""):r],o=n||/^find/.test(r);s&&(Br.prototype[r]=function(){var r=this.__wrapped__,a=n?[1]:arguments,c=r instanceof Fr,h=a[0],u=c||Fo(r),f=function(t){var e=s.apply(Br,Ne([t],a));return n&&d?e[0]:e};u&&i&&"function"==typeof h&&1!=h.length&&(c=u=!1);var d=this.__chain__,l=!!this.__actions__.length,p=o&&!d,g=c&&!l;if(!o&&u){r=g?r:new Fr(this);var m=e.apply(r,a);return m.__actions__.push({func:uo,args:[f],thisArg:t}),new jr(m,d)}return p&&g?e.apply(this,a):(m=this.thru(f),p?n?m.value()[0]:m.value():m)})})),Me(["pop","push","shift","sort","splice","unshift"],(function(t){var e=Nt[t],r=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",i=/^(?:pop|shift)$/.test(t);Br.prototype[t]=function(){var t=arguments;if(i&&!this.__chain__){var n=this.value();return e.apply(Fo(n)?n:[],t)}return this[r]((function(r){return e.apply(Fo(r)?r:[],t)}))}})),vi(Fr.prototype,(function(t,e){var r=Br[e];if(r){var i=r.name+"";kt.call(Rr,i)||(Rr[i]=[]),Rr[i].push({name:e,func:r})}})),Rr[Bn(t,2).name]=[{name:"wrapper",func:t}],Fr.prototype.clone=function(){var t=new Fr(this.__wrapped__);return t.__actions__=Pn(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=Pn(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=Pn(this.__views__),t},Fr.prototype.reverse=function(){if(this.__filtered__){var t=new Fr(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},Fr.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,r=Fo(t),i=e<0,n=r?t.length:0,s=function(t,e,r){for(var i=-1,n=r.length;++i<n;){var s=r[i],o=s.size;switch(s.type){case"drop":t+=o;break;case"dropRight":e-=o;break;case"take":e=br(e,t+o);break;case"takeRight":t=mr(t,e-o)}}return{start:t,end:e}}(0,n,this.__views__),o=s.start,a=s.end,c=a-o,h=i?a:o-1,u=this.__iteratees__,f=u.length,d=0,l=br(c,this.__takeCount__);if(!r||!i&&n==c&&l==c)return dn(t,this.__actions__);var p=[];t:for(;c--&&d<l;){for(var g=-1,m=t[h+=e];++g<f;){var b=u[g],v=b.iteratee,y=b.type,w=v(m);if(2==y)m=w;else if(!w){if(1==y)continue t;break t}}p[d++]=m}return p},Br.prototype.at=fo,Br.prototype.chain=function(){return ho(this)},Br.prototype.commit=function(){return new jr(this.value(),this.__chain__)},Br.prototype.next=function(){this.__values__===t&&(this.__values__=ua(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?t:this.__values__[this.__index__++]}},Br.prototype.plant=function(e){for(var r,i=this;i instanceof zr;){var n=Ds(i);n.__index__=0,n.__values__=t,r?s.__wrapped__=n:r=n;var s=n;i=i.__wrapped__}return s.__wrapped__=e,r},Br.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Fr){var r=e;return this.__actions__.length&&(r=new Fr(this)),(r=r.reverse()).__actions__.push({func:uo,args:[Ys],thisArg:t}),new jr(r,this.__chain__)}return this.thru(Ys)},Br.prototype.toJSON=Br.prototype.valueOf=Br.prototype.value=function(){return dn(this.__wrapped__,this.__actions__)},Br.prototype.first=Br.prototype.head,ae&&(Br.prototype[ae]=function(){return this}),Br}();fe?((fe.exports=ur)._=ur,ue._=ur):he._=ur}.call(Pu);var Ru=Object.defineProperty,Nu=Object.defineProperties,Ou=Object.getOwnPropertyDescriptors,Cu=Object.getOwnPropertySymbols,Tu=Object.prototype.hasOwnProperty,qu=Object.prototype.propertyIsEnumerable,ku=(t,e,r)=>e in t?Ru(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Du=(t,e)=>{for(var r in e||(e={}))Tu.call(e,r)&&ku(t,r,e[r]);if(Cu)for(var r of Cu(e))qu.call(e,r)&&ku(t,r,e[r]);return t},Uu=(t,e)=>Nu(t,Ou(e));function Bu(t,e,r){var i;const n=O(t);return(null==(i=e.rpcMap)?void 0:i[n.reference])||`${_u}?chainId=${n.namespace}:${n.reference}&projectId=${r}`}function Lu(t){return t.includes(":")?t.split(":")[1]:t}function zu(t){return t.map((t=>`${t.split(":")[0]}:${t.split(":")[1]}`))}function ju(t={},e={}){const r=Fu(t),i=Fu(e);return xu.exports.merge(r,i)}function Fu(t){var e,r,i,n;const s={};if(!Os(t))return s;for(const[o,a]of Object.entries(t)){const t=Ms(o)?[o]:a.chains,c=a.methods||[],h=a.events||[],u=a.rpcMap||{},f=Es(o);s[f]=Uu(Du(Du({},s[f]),a),{chains:st(t,null==(e=s[f])?void 0:e.chains),methods:st(c,null==(r=s[f])?void 0:r.methods),events:st(h,null==(i=s[f])?void 0:i.events),rpcMap:Du(Du({},u),null==(n=s[f])?void 0:n.rpcMap)})}return s}function Hu(t){return t.includes(":")?t.split(":")[2]:t}function Ku(t){const e={};for(const[r,i]of Object.entries(t)){const t=i.methods||[],n=i.events||[],s=i.accounts||[],o=Ms(r)?[r]:i.chains?i.chains:zu(i.accounts);e[r]={chains:o,methods:t,events:n,accounts:s}}return e}function $u(t){return"number"==typeof t?t:t.includes("0x")?parseInt(t,16):(t=t.includes(":")?t.split(":")[1]:t,isNaN(Number(t))?t:Number(t))}const Vu={},Ju=t=>Vu[t],Gu=(t,e)=>{Vu[t]=e};class Qu{constructor(t){this.name="polkadot",this.namespace=t.namespace,this.events=Ju("events"),this.client=Ju("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(Eu,`${this.name}:${t}`)}getAccounts(){const t=this.namespace.accounts;return t&&t.filter((t=>t.split(":")[1]===this.chainId.toString())).map((t=>t.split(":")[2]))||[]}createHttpProviders(){const t={};return this.namespace.chains.forEach((e=>{var r;const i=Lu(e);t[i]=this.createHttpProvider(i,null==(r=this.namespace.rpcMap)?void 0:r[e])})),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const r=this.createHttpProvider(t,e);r&&(this.httpProviders[t]=r)}createHttpProvider(t,e){const r=e||Bu(t,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${t}`);return new Oo.F(new vu.A(r,Ju("disableProviderPing")))}}var Wu=Object.defineProperty,Yu=Object.defineProperties,Xu=Object.getOwnPropertyDescriptors,Zu=Object.getOwnPropertySymbols,tf=Object.prototype.hasOwnProperty,ef=Object.prototype.propertyIsEnumerable,rf=(t,e,r)=>e in t?Wu(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,nf=(t,e)=>{for(var r in e||(e={}))tf.call(e,r)&&rf(t,r,e[r]);if(Zu)for(var r of Zu(e))ef.call(e,r)&&rf(t,r,e[r]);return t},sf=(t,e)=>Yu(t,Xu(e));class of{constructor(t){this.name="eip155",this.namespace=t.namespace,this.events=Ju("events"),this.client=Ju("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(t){switch(t.request.method){case"eth_requestAccounts":case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(t);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(t);case"wallet_getCallsStatus":return await this.getCallStatus(t)}return this.namespace.methods.includes(t.request.method)?await this.client.request(t):this.getHttpProvider().request(t.request)}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(parseInt(t),e),this.chainId=parseInt(t),this.events.emit(Eu,`${this.name}:${t}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}createHttpProvider(t,e){const r=e||Bu(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${t}`);return new Oo.F(new vu.V(r,Ju("disableProviderPing")))}setHttpProvider(t,e){const r=this.createHttpProvider(t,e);r&&(this.httpProviders[t]=r)}createHttpProviders(){const t={};return this.namespace.chains.forEach((e=>{var r;const i=parseInt(Lu(e));t[i]=this.createHttpProvider(i,null==(r=this.namespace.rpcMap)?void 0:r[e])})),t}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter((t=>t.split(":")[1]===this.chainId.toString())).map((t=>t.split(":")[2])))]:[]}getHttpProvider(){const t=this.chainId,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}async handleSwitchChain(t){var e,r;let i=t.request.params?null==(e=t.request.params[0])?void 0:e.chainId:"0x0";i=i.startsWith("0x")?i:`0x${i}`;const n=parseInt(i,16);if(this.isChainApproved(n))this.setDefaultChain(`${n}`);else{if(!this.namespace.methods.includes("wallet_switchEthereumChain"))throw new Error(`Failed to switch to chain 'eip155:${n}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);await this.client.request({topic:t.topic,request:{method:t.request.method,params:[{chainId:i}]},chainId:null==(r=this.namespace.chains)?void 0:r[0]}),this.setDefaultChain(`${n}`)}return null}isChainApproved(t){return this.namespace.chains.includes(`${this.name}:${t}`)}async getCapabilities(t){var e,r,i;const n=null==(r=null==(e=t.request)?void 0:e.params)?void 0:r[0];if(!n)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const s=this.client.session.get(t.topic),o=(null==(i=s?.sessionProperties)?void 0:i.capabilities)||{};if(null!=o&&o[n])return o?.[n];const a=await this.client.request(t);try{await this.client.session.update(t.topic,{sessionProperties:sf(nf({},s.sessionProperties||{}),{capabilities:sf(nf({},o||{}),{[n]:a})})})}catch(t){console.warn("Failed to update session with capabilities",t)}return a}async getCallStatus(t){var e,r;const i=this.client.session.get(t.topic),n=null==(e=i.sessionProperties)?void 0:e.bundler_name;if(n){const e=this.getBundlerUrl(t.chainId,n);try{return await this.getUserOperationReceipt(e,t)}catch(t){console.warn("Failed to fetch call status from bundler",t,e)}}const s=null==(r=i.sessionProperties)?void 0:r.bundler_url;if(s)try{return await this.getUserOperationReceipt(s,t)}catch(t){console.warn("Failed to fetch call status from custom bundler",t,s)}if(this.namespace.methods.includes(t.request.method))return await this.client.request(t);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(t,e){var r;const i=new URL(t),n=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify((0,Co.formatJsonRpcRequest)("eth_getUserOperationReceipt",[null==(r=e.request.params)?void 0:r[0]]))});if(!n.ok)throw new Error(`Failed to fetch user operation receipt - ${n.status}`);return await n.json()}getBundlerUrl(t,e){return`${Mu}?projectId=${this.client.core.projectId}&chainId=${t}&bundler=${e}`}}class af{constructor(t){this.name="solana",this.namespace=t.namespace,this.events=Ju("events"),this.client=Ju("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(Eu,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter((t=>t.split(":")[1]===this.chainId.toString())).map((t=>t.split(":")[2])))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach((e=>{var r;const i=Lu(e);t[i]=this.createHttpProvider(i,null==(r=this.namespace.rpcMap)?void 0:r[e])})),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const r=this.createHttpProvider(t,e);r&&(this.httpProviders[t]=r)}createHttpProvider(t,e){const r=e||Bu(t,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${t}`);return new Oo.F(new vu.A(r,Ju("disableProviderPing")))}}class cf{constructor(t){this.name="cosmos",this.namespace=t.namespace,this.events=Ju("events"),this.client=Ju("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(Eu,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter((t=>t.split(":")[1]===this.chainId.toString())).map((t=>t.split(":")[2])))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach((e=>{var r;const i=Lu(e);t[i]=this.createHttpProvider(i,null==(r=this.namespace.rpcMap)?void 0:r[e])})),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const r=this.createHttpProvider(t,e);r&&(this.httpProviders[t]=r)}createHttpProvider(t,e){const r=e||Bu(t,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${t}`);return new Oo.F(new vu.A(r,Ju("disableProviderPing")))}}class hf{constructor(t){this.name="algorand",this.namespace=t.namespace,this.events=Ju("events"),this.client=Ju("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){if(!this.httpProviders[t]){const r=e||Bu(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,r)}this.chainId=t,this.events.emit(Eu,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter((t=>t.split(":")[1]===this.chainId.toString())).map((t=>t.split(":")[2])))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach((e=>{var r;t[e]=this.createHttpProvider(e,null==(r=this.namespace.rpcMap)?void 0:r[e])})),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const r=this.createHttpProvider(t,e);r&&(this.httpProviders[t]=r)}createHttpProvider(t,e){const r=e||Bu(t,this.namespace,this.client.core.projectId);return typeof r>"u"?void 0:new Oo.F(new vu.A(r,Ju("disableProviderPing")))}}class uf{constructor(t){this.name="cip34",this.namespace=t.namespace,this.events=Ju("events"),this.client=Ju("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(Eu,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter((t=>t.split(":")[1]===this.chainId.toString())).map((t=>t.split(":")[2])))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach((e=>{const r=this.getCardanoRPCUrl(e),i=Lu(e);t[i]=this.createHttpProvider(i,r)})),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}getCardanoRPCUrl(t){const e=this.namespace.rpcMap;if(e)return e[t]}setHttpProvider(t,e){const r=this.createHttpProvider(t,e);r&&(this.httpProviders[t]=r)}createHttpProvider(t,e){const r=e||this.getCardanoRPCUrl(t);if(!r)throw new Error(`No RPC url provided for chainId: ${t}`);return new Oo.F(new vu.A(r,Ju("disableProviderPing")))}}class ff{constructor(t){this.name="elrond",this.namespace=t.namespace,this.events=Ju("events"),this.client=Ju("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(Eu,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter((t=>t.split(":")[1]===this.chainId.toString())).map((t=>t.split(":")[2])))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach((e=>{var r;const i=Lu(e);t[i]=this.createHttpProvider(i,null==(r=this.namespace.rpcMap)?void 0:r[e])})),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const r=this.createHttpProvider(t,e);r&&(this.httpProviders[t]=r)}createHttpProvider(t,e){const r=e||Bu(t,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${t}`);return new Oo.F(new vu.A(r,Ju("disableProviderPing")))}}class df{constructor(t){this.name="multiversx",this.namespace=t.namespace,this.events=Ju("events"),this.client=Ju("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(Eu,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter((t=>t.split(":")[1]===this.chainId.toString())).map((t=>t.split(":")[2])))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach((e=>{var r;const i=Lu(e);t[i]=this.createHttpProvider(i,null==(r=this.namespace.rpcMap)?void 0:r[e])})),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const r=this.createHttpProvider(t,e);r&&(this.httpProviders[t]=r)}createHttpProvider(t,e){const r=e||Bu(t,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${t}`);return new Oo.F(new vu.A(r,Ju("disableProviderPing")))}}class lf{constructor(t){this.name="near",this.namespace=t.namespace,this.events=Ju("events"),this.client=Ju("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){if(this.chainId=t,!this.httpProviders[t]){const r=e||Bu(`${this.name}:${t}`,this.namespace);if(!r)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,r)}this.events.emit(Eu,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t&&t.filter((t=>t.split(":")[1]===this.chainId.toString())).map((t=>t.split(":")[2]))||[]}createHttpProviders(){const t={};return this.namespace.chains.forEach((e=>{var r;t[e]=this.createHttpProvider(e,null==(r=this.namespace.rpcMap)?void 0:r[e])})),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const r=this.createHttpProvider(t,e);r&&(this.httpProviders[t]=r)}createHttpProvider(t,e){const r=e||Bu(t,this.namespace);return typeof r>"u"?void 0:new Oo.F(new vu.A(r,Ju("disableProviderPing")))}}class pf{constructor(t){this.name=Au,this.namespace=t.namespace,this.events=Ju("events"),this.client=Ju("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(t.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(t.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(t.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(t.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider(t.chainId).request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(Eu,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter((t=>t.split(":")[1]===this.chainId.toString())).map((t=>t.split(":")[2])))]:[]}createHttpProviders(){var t,e;const r={};return null==(e=null==(t=this.namespace)?void 0:t.accounts)||e.forEach((t=>{const e=O(t);r[`${e.namespace}:${e.reference}`]=this.createHttpProvider(t)})),r}getHttpProvider(t){const e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const r=this.createHttpProvider(t,e);r&&(this.httpProviders[t]=r)}createHttpProvider(t,e){const r=e||Bu(t,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${t}`);return new Oo.F(new vu.A(r,Ju("disableProviderPing")))}}var gf=Object.defineProperty,mf=Object.defineProperties,bf=Object.getOwnPropertyDescriptors,vf=Object.getOwnPropertySymbols,yf=Object.prototype.hasOwnProperty,wf=Object.prototype.propertyIsEnumerable,_f=(t,e,r)=>e in t?gf(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Af=(t,e)=>{for(var r in e||(e={}))yf.call(e,r)&&_f(t,r,e[r]);if(vf)for(var r of vf(e))wf.call(e,r)&&_f(t,r,e[r]);return t},Mf=(t,e)=>mf(t,bf(e));class Ef{constructor(t){this.events=new(n()),this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=t,this.logger=typeof t?.logger<"u"&&"string"!=typeof t?.logger?t.logger:(0,Qs.h6)((0,Qs.iP)({level:t?.logger||yu})),this.disableProviderPing=t?.disableProviderPing||!1}static async init(t){const e=new Ef(t);return await e.initialize(),e}async request(t,e,r){const[i,n]=this.validateChain(e);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(i).request({request:Af({},t),chainId:`${i}:${n}`,topic:this.session.topic,expiry:r})}sendAsync(t,e,r,i){const n=(new Date).getTime();this.request(t,r,i).then((t=>e(null,(0,Co.formatJsonRpcResult)(n,t)))).catch((t=>e(t,void 0)))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var t;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:null==(t=this.session)?void 0:t.topic,reason:Rs("USER_DISCONNECTED")}),await this.cleanup()}async connect(t){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(t),await this.cleanupPendingPairings(),!t.skipPairing)return await this.pair(t.pairingTopic)}async authenticate(t,e){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(t),await this.cleanupPendingPairings();const{uri:r,response:i}=await this.client.authenticate(t,e);r&&(this.uri=r,this.events.emit("display_uri",r));const n=await i();if(this.session=n.session,this.session){const t=Ku(this.session.namespaces);this.namespaces=ju(this.namespaces,t),this.persist("namespaces",this.namespaces),this.onConnect()}return n}on(t,e){this.events.on(t,e)}once(t,e){this.events.once(t,e)}removeListener(t,e){this.events.removeListener(t,e)}off(t,e){this.events.off(t,e)}get isWalletConnect(){return!0}async pair(t){this.shouldAbortPairingAttempt=!1;let e=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(e>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:r,approval:i}=await this.client.connect({pairingTopic:t,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});r&&(this.uri=r,this.events.emit("display_uri",r)),await i().then((t=>{this.session=t;const e=Ku(t.namespaces);this.namespaces=ju(this.namespaces,e),this.persist("namespaces",this.namespaces)})).catch((t=>{if(t.message!==$h)throw t;e++}))}while(!this.session);return this.onConnect(),this.session}setDefaultChain(t,e){try{if(!this.session)return;const[r,i]=this.validateChain(t),n=this.getProvider(r);n.name===Au?n.setDefaultChain(`${r}:${i}`,e):n.setDefaultChain(i,e)}catch(t){if(!/Please call connect/.test(t.message))throw t}}async cleanupPendingPairings(t={}){this.logger.info("Cleaning up inactive pairings...");const e=this.client.pairing.getAll();if(Ns(e)){for(const r of e)t.deletePairings?this.client.core.expirer.set(r.topic,0):await this.client.core.relayer.subscriber.unsubscribe(r.topic);this.logger.info(`Inactive pairings cleared: ${e.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const t=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[t]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await bu.init({core:this.providerOpts.core,logger:this.providerOpts.logger||yu,relayUrl:this.providerOpts.relayUrl||"wss://relay.walletconnect.org",projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const t=[...new Set(Object.keys(this.session.namespaces).map((t=>Es(t))))];Gu("client",this.client),Gu("events",this.events),Gu("disableProviderPing",this.disableProviderPing),t.forEach((t=>{if(!this.session)return;const e=function(t,e){const r=Object.keys(e.namespaces).filter((e=>e.includes(t)));if(!r.length)return[];const i=[];return r.forEach((t=>{const r=e.namespaces[t].accounts;i.push(...r)})),i}(t,this.session),r=zu(e),i=ju(this.namespaces,this.optionalNamespaces),n=Mf(Af({},i[t]),{accounts:e,chains:r});switch(t){case"eip155":this.rpcProviders[t]=new of({namespace:n});break;case"algorand":this.rpcProviders[t]=new hf({namespace:n});break;case"solana":this.rpcProviders[t]=new af({namespace:n});break;case"cosmos":this.rpcProviders[t]=new cf({namespace:n});break;case"polkadot":this.rpcProviders[t]=new Qu({namespace:n});break;case"cip34":this.rpcProviders[t]=new uf({namespace:n});break;case"elrond":this.rpcProviders[t]=new ff({namespace:n});break;case"multiversx":this.rpcProviders[t]=new df({namespace:n});break;case"near":this.rpcProviders[t]=new lf({namespace:n});break;default:this.rpcProviders[Au]?this.rpcProviders[Au].updateNamespace(n):this.rpcProviders[Au]=new pf({namespace:n})}}))}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",(t=>{this.events.emit("session_ping",t)})),this.client.on("session_event",(t=>{const{params:e}=t,{event:r}=e;if("accountsChanged"===r.name){const t=r.data;t&&Ns(t)&&this.events.emit("accountsChanged",t.map(Hu))}else if("chainChanged"===r.name){const t=e.chainId,r=e.event.data,i=Es(t),n=$u(t)!==$u(r)?`${i}:${$u(r)}`:t;this.onChainChanged(n)}else this.events.emit(r.name,r.data);this.events.emit("session_event",t)})),this.client.on("session_update",(({topic:t,params:e})=>{var r;const{namespaces:i}=e,n=null==(r=this.client)?void 0:r.session.get(t);this.session=Mf(Af({},n),{namespaces:i}),this.onSessionUpdate(),this.events.emit("session_update",{topic:t,params:e})})),this.client.on("session_delete",(async t=>{await this.cleanup(),this.events.emit("session_delete",t),this.events.emit("disconnect",Mf(Af({},Rs("USER_DISCONNECTED")),{data:t.topic}))})),this.on(Eu,(t=>{this.onChainChanged(t,!0)}))}getProvider(t){return this.rpcProviders[t]||this.rpcProviders[Au]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach((t=>{var e;this.getProvider(t).updateNamespace(null==(e=this.session)?void 0:e.namespaces[t])}))}setNamespaces(t){const{namespaces:e,optionalNamespaces:r,sessionProperties:i}=t;e&&Object.keys(e).length&&(this.namespaces=e),r&&Object.keys(r).length&&(this.optionalNamespaces=r),this.sessionProperties=i,this.persist("namespaces",e),this.persist("optionalNamespaces",r)}validateChain(t){const[e,r]=t?.split(":")||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[e,r];if(e&&!Object.keys(this.namespaces||{}).map((t=>Es(t))).includes(e))throw new Error(`Namespace '${e}' is not configured. Please call connect() first with namespace config.`);if(e&&r)return[e,r];const i=Es(Object.keys(this.namespaces)[0]);return[i,this.rpcProviders[i].getDefaultChain()]}async requestAccounts(){const[t]=this.validateChain();return await this.getProvider(t).requestAccounts()}onChainChanged(t,e=!1){if(!this.namespaces)return;const[r,i]=this.validateChain(t);i&&(e||this.getProvider(r).setDefaultChain(i),this.namespaces[r]?this.namespaces[r].defaultChain=i:this.namespaces[`${r}:${i}`]?this.namespaces[`${r}:${i}`].defaultChain=i:this.namespaces[`${r}:${i}`]={defaultChain:i},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",i))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(t,e){this.client.core.storage.setItem(`${wu}/${t}`,e)}async getFromStore(t){return await this.client.core.storage.getItem(`${wu}/${t}`)}}const If=Ef,Sf=["eth_sendTransaction","personal_sign"],Pf=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode","wallet_sendCalls","wallet_getCapabilities","wallet_getCallsStatus","wallet_showCallsStatus"],xf=["chainChanged","accountsChanged"],Rf=["chainChanged","accountsChanged","message","disconnect","connect"];var Nf=Object.defineProperty,Of=Object.defineProperties,Cf=Object.getOwnPropertyDescriptors,Tf=Object.getOwnPropertySymbols,qf=Object.prototype.hasOwnProperty,kf=Object.prototype.propertyIsEnumerable,Df=(t,e,r)=>e in t?Nf(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Uf=(t,e)=>{for(var r in e||(e={}))qf.call(e,r)&&Df(t,r,e[r]);if(Tf)for(var r of Tf(e))kf.call(e,r)&&Df(t,r,e[r]);return t},Bf=(t,e)=>Of(t,Cf(e));function Lf(t){return Number(t[0].split(":")[1])}function zf(t){return`0x${t.toString(16)}`}class jf{constructor(){this.events=new i.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY="wc@2:ethereum_provider:",this.on=(t,e)=>(this.events.on(t,e),this),this.once=(t,e)=>(this.events.once(t,e),this),this.removeListener=(t,e)=>(this.events.removeListener(t,e),this),this.off=(t,e)=>(this.events.off(t,e),this),this.parseAccount=t=>this.isCompatibleChainId(t)?this.parseAccountId(t).address:t,this.signer={},this.rpc={}}static async init(t){const e=new jf;return await e.initialize(t),e}async request(t,e){return await this.signer.request(t,this.formatChainId(this.chainId),e)}sendAsync(t,e,r){this.signer.sendAsync(t,e,this.formatChainId(this.chainId),r)}get connected(){return!!this.signer.client&&this.signer.client.core.relayer.connected}get connecting(){return!!this.signer.client&&this.signer.client.core.relayer.connecting}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(t){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(t);const{required:e,optional:r}=function(t){const{chains:e,optionalChains:r,methods:i,optionalMethods:n,events:s,optionalEvents:o,rpcMap:a}=t;if(!Ns(e))throw new Error("Invalid chains");const c={chains:e,methods:i||Sf,events:s||xf,rpcMap:Uf({},e.length?{[Lf(e)]:a[Lf(e)]}:{})},h=s?.filter((t=>!xf.includes(t))),u=i?.filter((t=>!Sf.includes(t)));if(!(r||o||n||null!=h&&h.length||null!=u&&u.length))return{required:e.length?c:void 0};const f={chains:[...new Set(h?.length&&u?.length||!r?c.chains.concat(r||[]):r)],methods:[...new Set(c.methods.concat(null!=n&&n.length?n:Pf))],events:[...new Set(c.events.concat(null!=o&&o.length?o:Rf))],rpcMap:a};return{required:e.length?c:void 0,optional:r.length?f:void 0}}(this.rpc);try{const i=await new Promise((async(i,n)=>{var s;this.rpc.showQrModal&&(null==(s=this.modal)||s.subscribeModal((t=>{!t.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),n(new Error("Connection request reset. Please try again.")))}))),await this.signer.connect(Bf(Uf({namespaces:Uf({},e&&{[this.namespace]:e})},r&&{optionalNamespaces:{[this.namespace]:r}}),{pairingTopic:t?.pairingTopic})).then((t=>{i(t)})).catch((t=>{n(new Error(t.message))}))}));if(!i)return;const n=C(i.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:n),this.setAccounts(n),this.events.emit("connect",{chainId:zf(this.chainId)})}catch(t){throw this.signer.logger.error(t),t}finally{this.modal&&this.modal.closeModal()}}async authenticate(t,e){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts({chains:t?.chains});try{const r=await new Promise((async(r,i)=>{var n;this.rpc.showQrModal&&(null==(n=this.modal)||n.subscribeModal((t=>{!t.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),i(new Error("Connection request reset. Please try again.")))}))),await this.signer.authenticate(Bf(Uf({},t),{chains:this.rpc.chains}),e).then((t=>{r(t)})).catch((t=>{i(new Error(t.message))}))})),i=r.session;if(i){const t=C(i.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:t),this.setAccounts(t),this.events.emit("connect",{chainId:zf(this.chainId)})}return r}catch(t){throw this.signer.logger.error(t),t}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",(t=>{const{params:e}=t,{event:r}=e;"accountsChanged"===r.name?(this.accounts=this.parseAccounts(r.data),this.events.emit("accountsChanged",this.accounts)):"chainChanged"===r.name?this.setChainId(this.formatChainId(r.data)):this.events.emit(r.name,r.data),this.events.emit("session_event",t)})),this.signer.on("chainChanged",(t=>{const e=parseInt(t);this.chainId=e,this.events.emit("chainChanged",zf(this.chainId)),this.persist()})),this.signer.on("session_update",(t=>{this.events.emit("session_update",t)})),this.signer.on("session_delete",(t=>{this.reset(),this.events.emit("session_delete",t),this.events.emit("disconnect",Bf(Uf({},Rs("USER_DISCONNECTED")),{data:t.topic,name:"USER_DISCONNECTED"}))})),this.signer.on("display_uri",(t=>{var e,r;this.rpc.showQrModal&&(null==(e=this.modal)||e.closeModal(),null==(r=this.modal)||r.openModal({uri:t})),this.events.emit("display_uri",t)}))}switchEthereumChain(t){this.request({method:"wallet_switchEthereumChain",params:[{chainId:t.toString(16)}]})}isCompatibleChainId(t){return"string"==typeof t&&t.startsWith(`${this.namespace}:`)}formatChainId(t){return`${this.namespace}:${t}`}parseChainId(t){return Number(t.split(":")[1])}setChainIds(t){const e=t.filter((t=>this.isCompatibleChainId(t))).map((t=>this.parseChainId(t)));e.length&&(this.chainId=e[0],this.events.emit("chainChanged",zf(this.chainId)),this.persist())}setChainId(t){if(this.isCompatibleChainId(t)){const e=this.parseChainId(t);this.chainId=e,this.switchEthereumChain(e)}}parseAccountId(t){const[e,r,i]=t.split(":");return{chainId:`${e}:${r}`,address:i}}setAccounts(t){this.accounts=t.filter((t=>this.parseChainId(this.parseAccountId(t).chainId)===this.chainId)).map((t=>this.parseAccountId(t).address)),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(t){var e,r;const i=null!=(e=t?.chains)?e:[],n=null!=(r=t?.optionalChains)?r:[],s=i.concat(n);if(!s.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const o=i.length?t?.methods||Sf:[],a=i.length?t?.events||xf:[],c=t?.optionalMethods||[],h=t?.optionalEvents||[],u=t?.rpcMap||this.buildRpcMap(s,t.projectId),f=t?.qrModalOptions||void 0;return{chains:i?.map((t=>this.formatChainId(t))),optionalChains:n.map((t=>this.formatChainId(t))),methods:o,events:a,optionalMethods:c,optionalEvents:h,rpcMap:u,showQrModal:!(null==t||!t.showQrModal),qrModalOptions:f,projectId:t.projectId,metadata:t.metadata}}buildRpcMap(t,e){const r={};return t.forEach((t=>{r[t]=this.getRpcUrl(t,e)})),r}async initialize(t){if(this.rpc=this.getRpcConfig(t),this.chainId=this.rpc.chains.length?Lf(this.rpc.chains):Lf(this.rpc.optionalChains),this.signer=await If.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:t.disableProviderPing,relayUrl:t.relayUrl,storageOptions:t.storageOptions,customStoragePrefix:t.customStoragePrefix,telemetryEnabled:t.telemetryEnabled}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let t;try{const{WalletConnectModal:e}=await Promise.resolve().then(r.bind(r,85577));t=e}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(t)try{this.modal=new t(Uf({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(t){throw this.signer.logger.error(t),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(t){if(!t)return;const{chains:e,optionalChains:r,rpcMap:i}=t;e&&Ns(e)&&(this.rpc.chains=e.map((t=>this.formatChainId(t))),e.forEach((t=>{this.rpc.rpcMap[t]=i?.[t]||this.getRpcUrl(t)}))),r&&Ns(r)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=r?.map((t=>this.formatChainId(t))),r.forEach((t=>{this.rpc.rpcMap[t]=i?.[t]||this.getRpcUrl(t)})))}getRpcUrl(t,e){var r;return(null==(r=this.rpc.rpcMap)?void 0:r[t])||`https://rpc.walletconnect.org/v1/?chainId=eip155:${t}&projectId=${e||this.rpc.projectId}`}async loadPersistedSession(){if(this.session)try{const t=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),e=this.session.namespaces[`${this.namespace}:${t}`]?this.session.namespaces[`${this.namespace}:${t}`]:this.session.namespaces[this.namespace];this.setChainIds(t?[this.formatChainId(t)]:e?.accounts),this.setAccounts(e?.accounts)}catch(t){this.signer.logger.error("Failed to load persisted session, clearing state..."),this.signer.logger.error(t),await this.disconnect().catch((t=>this.signer.logger.warn(t)))}}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(t){return"string"==typeof t||t instanceof String?[this.parseAccount(t)]:t.map((t=>this.parseAccount(t)))}}const Ff=jf},61052:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.NodeRandomSource=void 0;const i=r(38767);e.NodeRandomSource=class{constructor(){this.isAvailable=!1,this.isInstantiated=!1;{const t=r(45423);t&&t.randomBytes&&(this._crypto=t,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(t){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let e=this._crypto.randomBytes(t);if(e.length!==t)throw new Error("NodeRandomSource: got fewer bytes than requested");const r=new Uint8Array(t);for(let t=0;t<r.length;t++)r[t]=e[t];return(0,i.wipe)(e),r}}},63447:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0});var i=r(96411);function n(t,e,r){return void 0===e&&(e=new Uint8Array(2)),void 0===r&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}function s(t,e,r){return void 0===e&&(e=new Uint8Array(2)),void 0===r&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}function o(t,e){return void 0===e&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}function a(t,e){return void 0===e&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}function c(t,e){return void 0===e&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}function h(t,e){return void 0===e&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}function u(t,e,r){return void 0===e&&(e=new Uint8Array(4)),void 0===r&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}function f(t,e,r){return void 0===e&&(e=new Uint8Array(4)),void 0===r&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}function d(t,e,r){return void 0===e&&(e=new Uint8Array(8)),void 0===r&&(r=0),u(t/4294967296>>>0,e,r),u(t>>>0,e,r+4),e}function l(t,e,r){return void 0===e&&(e=new Uint8Array(8)),void 0===r&&(r=0),f(t>>>0,e,r),f(t/4294967296>>>0,e,r+4),e}e.readInt16BE=function(t,e){return void 0===e&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16},e.readUint16BE=function(t,e){return void 0===e&&(e=0),(t[e+0]<<8|t[e+1])>>>0},e.readInt16LE=function(t,e){return void 0===e&&(e=0),(t[e+1]<<8|t[e])<<16>>16},e.readUint16LE=function(t,e){return void 0===e&&(e=0),(t[e+1]<<8|t[e])>>>0},e.writeUint16BE=n,e.writeInt16BE=n,e.writeUint16LE=s,e.writeInt16LE=s,e.readInt32BE=o,e.readUint32BE=a,e.readInt32LE=c,e.readUint32LE=h,e.writeUint32BE=u,e.writeInt32BE=u,e.writeUint32LE=f,e.writeInt32LE=f,e.readInt64BE=function(t,e){void 0===e&&(e=0);var r=o(t,e),i=o(t,e+4);return 4294967296*r+i-4294967296*(i>>31)},e.readUint64BE=function(t,e){return void 0===e&&(e=0),4294967296*a(t,e)+a(t,e+4)},e.readInt64LE=function(t,e){void 0===e&&(e=0);var r=c(t,e);return 4294967296*c(t,e+4)+r-4294967296*(r>>31)},e.readUint64LE=function(t,e){void 0===e&&(e=0);var r=h(t,e);return 4294967296*h(t,e+4)+r},e.writeUint64BE=d,e.writeInt64BE=d,e.writeUint64LE=l,e.writeInt64LE=l,e.readUintBE=function(t,e,r){if(void 0===r&&(r=0),t%8!=0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var i=0,n=1,s=t/8+r-1;s>=r;s--)i+=e[s]*n,n*=256;return i},e.readUintLE=function(t,e,r){if(void 0===r&&(r=0),t%8!=0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var i=0,n=1,s=r;s<r+t/8;s++)i+=e[s]*n,n*=256;return i},e.writeUintBE=function(t,e,r,n){if(void 0===r&&(r=new Uint8Array(t/8)),void 0===n&&(n=0),t%8!=0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!i.isSafeInteger(e))throw new Error("writeUintBE value must be an integer");for(var s=1,o=t/8+n-1;o>=n;o--)r[o]=e/s&255,s*=256;return r},e.writeUintLE=function(t,e,r,n){if(void 0===r&&(r=new Uint8Array(t/8)),void 0===n&&(n=0),t%8!=0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!i.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var s=1,o=n;o<n+t/8;o++)r[o]=e/s&255,s*=256;return r},e.readFloat32BE=function(t,e){return void 0===e&&(e=0),new DataView(t.buffer,t.byteOffset,t.byteLength).getFloat32(e)},e.readFloat32LE=function(t,e){return void 0===e&&(e=0),new DataView(t.buffer,t.byteOffset,t.byteLength).getFloat32(e,!0)},e.readFloat64BE=function(t,e){return void 0===e&&(e=0),new DataView(t.buffer,t.byteOffset,t.byteLength).getFloat64(e)},e.readFloat64LE=function(t,e){return void 0===e&&(e=0),new DataView(t.buffer,t.byteOffset,t.byteLength).getFloat64(e,!0)},e.writeFloat32BE=function(t,e,r){return void 0===e&&(e=new Uint8Array(4)),void 0===r&&(r=0),new DataView(e.buffer,e.byteOffset,e.byteLength).setFloat32(r,t),e},e.writeFloat32LE=function(t,e,r){return void 0===e&&(e=new Uint8Array(4)),void 0===r&&(r=0),new DataView(e.buffer,e.byteOffset,e.byteLength).setFloat32(r,t,!0),e},e.writeFloat64BE=function(t,e,r){return void 0===e&&(e=new Uint8Array(8)),void 0===r&&(r=0),new DataView(e.buffer,e.byteOffset,e.byteLength).setFloat64(r,t),e},e.writeFloat64LE=function(t,e,r){return void 0===e&&(e=new Uint8Array(8)),void 0===r&&(r=0),new DataView(e.buffer,e.byteOffset,e.byteLength).setFloat64(r,t,!0),e}},67385:()=>{},67942:(t,e,r)=>{var i=e;i.base=r(74893),i.short=r(85580),i.mont=r(25882),i.edwards=r(858)},68032:(t,e,r)=>{const i=r(7269),n=r(28605),s=r(72851),o=r(90028),a=Symbol("encodeFragmentIdentifier");function c(t){if("string"!=typeof t||1!==t.length)throw new TypeError("arrayFormatSeparator must be single character string")}function h(t,e){return e.encode?e.strict?i(t):encodeURIComponent(t):t}function u(t,e){return e.decode?n(t):t}function f(t){return Array.isArray(t)?t.sort():"object"==typeof t?f(Object.keys(t)).sort(((t,e)=>Number(t)-Number(e))).map((e=>t[e])):t}function d(t){const e=t.indexOf("#");return-1!==e&&(t=t.slice(0,e)),t}function l(t){const e=(t=d(t)).indexOf("?");return-1===e?"":t.slice(e+1)}function p(t,e){return e.parseNumbers&&!Number.isNaN(Number(t))&&"string"==typeof t&&""!==t.trim()?t=Number(t):!e.parseBooleans||null===t||"true"!==t.toLowerCase()&&"false"!==t.toLowerCase()||(t="true"===t.toLowerCase()),t}function g(t,e){c((e=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},e)).arrayFormatSeparator);const r=function(t){let e;switch(t.arrayFormat){case"index":return(t,r,i)=>{e=/\[(\d*)\]$/.exec(t),t=t.replace(/\[\d*\]$/,""),e?(void 0===i[t]&&(i[t]={}),i[t][e[1]]=r):i[t]=r};case"bracket":return(t,r,i)=>{e=/(\[\])$/.exec(t),t=t.replace(/\[\]$/,""),e?void 0!==i[t]?i[t]=[].concat(i[t],r):i[t]=[r]:i[t]=r};case"colon-list-separator":return(t,r,i)=>{e=/(:list)$/.exec(t),t=t.replace(/:list$/,""),e?void 0!==i[t]?i[t]=[].concat(i[t],r):i[t]=[r]:i[t]=r};case"comma":case"separator":return(e,r,i)=>{const n="string"==typeof r&&r.includes(t.arrayFormatSeparator),s="string"==typeof r&&!n&&u(r,t).includes(t.arrayFormatSeparator);r=s?u(r,t):r;const o=n||s?r.split(t.arrayFormatSeparator).map((e=>u(e,t))):null===r?r:u(r,t);i[e]=o};case"bracket-separator":return(e,r,i)=>{const n=/(\[\])$/.test(e);if(e=e.replace(/\[\]$/,""),!n)return void(i[e]=r?u(r,t):r);const s=null===r?[]:r.split(t.arrayFormatSeparator).map((e=>u(e,t)));void 0!==i[e]?i[e]=[].concat(i[e],s):i[e]=s};default:return(t,e,r)=>{void 0!==r[t]?r[t]=[].concat(r[t],e):r[t]=e}}}(e),i=Object.create(null);if("string"!=typeof t)return i;if(!(t=t.trim().replace(/^[?#&]/,"")))return i;for(const n of t.split("&")){if(""===n)continue;let[t,o]=s(e.decode?n.replace(/\+/g," "):n,"=");o=void 0===o?null:["comma","separator","bracket-separator"].includes(e.arrayFormat)?o:u(o,e),r(u(t,e),o,i)}for(const t of Object.keys(i)){const r=i[t];if("object"==typeof r&&null!==r)for(const t of Object.keys(r))r[t]=p(r[t],e);else i[t]=p(r,e)}return!1===e.sort?i:(!0===e.sort?Object.keys(i).sort():Object.keys(i).sort(e.sort)).reduce(((t,e)=>{const r=i[e];return Boolean(r)&&"object"==typeof r&&!Array.isArray(r)?t[e]=f(r):t[e]=r,t}),Object.create(null))}e.extract=l,e.parse=g,e.stringify=(t,e)=>{if(!t)return"";c((e=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},e)).arrayFormatSeparator);const r=r=>e.skipNull&&null==t[r]||e.skipEmptyString&&""===t[r],i=function(t){switch(t.arrayFormat){case"index":return e=>(r,i)=>{const n=r.length;return void 0===i||t.skipNull&&null===i||t.skipEmptyString&&""===i?r:null===i?[...r,[h(e,t),"[",n,"]"].join("")]:[...r,[h(e,t),"[",h(n,t),"]=",h(i,t)].join("")]};case"bracket":return e=>(r,i)=>void 0===i||t.skipNull&&null===i||t.skipEmptyString&&""===i?r:null===i?[...r,[h(e,t),"[]"].join("")]:[...r,[h(e,t),"[]=",h(i,t)].join("")];case"colon-list-separator":return e=>(r,i)=>void 0===i||t.skipNull&&null===i||t.skipEmptyString&&""===i?r:null===i?[...r,[h(e,t),":list="].join("")]:[...r,[h(e,t),":list=",h(i,t)].join("")];case"comma":case"separator":case"bracket-separator":{const e="bracket-separator"===t.arrayFormat?"[]=":"=";return r=>(i,n)=>void 0===n||t.skipNull&&null===n||t.skipEmptyString&&""===n?i:(n=null===n?"":n,0===i.length?[[h(r,t),e,h(n,t)].join("")]:[[i,h(n,t)].join(t.arrayFormatSeparator)])}default:return e=>(r,i)=>void 0===i||t.skipNull&&null===i||t.skipEmptyString&&""===i?r:null===i?[...r,h(e,t)]:[...r,[h(e,t),"=",h(i,t)].join("")]}}(e),n={};for(const e of Object.keys(t))r(e)||(n[e]=t[e]);const s=Object.keys(n);return!1!==e.sort&&s.sort(e.sort),s.map((r=>{const n=t[r];return void 0===n?"":null===n?h(r,e):Array.isArray(n)?0===n.length&&"bracket-separator"===e.arrayFormat?h(r,e)+"[]":n.reduce(i(r),[]).join("&"):h(r,e)+"="+h(n,e)})).filter((t=>t.length>0)).join("&")},e.parseUrl=(t,e)=>{e=Object.assign({decode:!0},e);const[r,i]=s(t,"#");return Object.assign({url:r.split("?")[0]||"",query:g(l(t),e)},e&&e.parseFragmentIdentifier&&i?{fragmentIdentifier:u(i,e)}:{})},e.stringifyUrl=(t,r)=>{r=Object.assign({encode:!0,strict:!0,[a]:!0},r);const i=d(t.url).split("?")[0]||"",n=e.extract(t.url),s=e.parse(n,{sort:!1}),o=Object.assign(s,t.query);let c=e.stringify(o,r);c&&(c=`?${c}`);let u=function(t){let e="";const r=t.indexOf("#");return-1!==r&&(e=t.slice(r)),e}(t.url);return t.fragmentIdentifier&&(u=`#${r[a]?h(t.fragmentIdentifier,r):t.fragmentIdentifier}`),`${i}${c}${u}`},e.pick=(t,r,i)=>{i=Object.assign({parseFragmentIdentifier:!0,[a]:!1},i);const{url:n,query:s,fragmentIdentifier:c}=e.parseUrl(t,i);return e.stringifyUrl({url:n,query:o(s,r),fragmentIdentifier:c},i)},e.exclude=(t,r,i)=>{const n=Array.isArray(r)?t=>!r.includes(t):(t,e)=>!r(t,e);return e.pick(t,n,i)}},70392:(t,e,r)=>{var i,n=e,s=r(99499),o=r(67942),a=r(49899).assert;function c(t){"short"===t.type?this.curve=new o.short(t):"edwards"===t.type?this.curve=new o.edwards(t):this.curve=new o.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,a(this.g.validate(),"Invalid curve"),a(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function h(t,e){Object.defineProperty(n,t,{configurable:!0,enumerable:!0,get:function(){var r=new c(e);return Object.defineProperty(n,t,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=c,h("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:s.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),h("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:s.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),h("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:s.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),h("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:s.sha384,gRed:!1,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"]}),h("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:s.sha512,gRed:!1,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"]}),h("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:s.sha256,gRed:!1,g:["9"]}),h("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:s.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{i=r(88483)}catch(t){i=void 0}h("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:s.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",i]})},72716:t=>{t.exports={rE:"6.6.1"}},72851:t=>{t.exports=(t,e)=>{if("string"!=typeof t||"string"!=typeof e)throw new TypeError("Expected the arguments to be of type `string`");if(""===e)return[t];const r=t.indexOf(e);return-1===r?[t]:[t.slice(0,r),t.slice(r+e.length)]}},74893:(t,e,r)=>{var i=r(79188),n=r(49899),s=n.getNAF,o=n.getJSF,a=n.assert;function c(t,e){this.type=t,this.p=new i(e.p,16),this.red=e.prime?i.red(e.prime):i.mont(this.p),this.zero=new i(0).toRed(this.red),this.one=new i(1).toRed(this.red),this.two=new i(2).toRed(this.red),this.n=e.n&&new i(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.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 r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function h(t,e){this.curve=t,this.type=e,this.precomputed=null}t.exports=c,c.prototype.point=function(){throw new Error("Not implemented")},c.prototype.validate=function(){throw new Error("Not implemented")},c.prototype._fixedNafMul=function(t,e){a(t.precomputed);var r=t._getDoubles(),i=s(e,1,this._bitLength),n=(1<<r.step+1)-(r.step%2==0?2:1);n/=3;var o,c,h=[];for(o=0;o<i.length;o+=r.step){c=0;for(var u=o+r.step-1;u>=o;u--)c=(c<<1)+i[u];h.push(c)}for(var f=this.jpoint(null,null,null),d=this.jpoint(null,null,null),l=n;l>0;l--){for(o=0;o<h.length;o++)(c=h[o])===l?d=d.mixedAdd(r.points[o]):c===-l&&(d=d.mixedAdd(r.points[o].neg()));f=f.add(d)}return f.toP()},c.prototype._wnafMul=function(t,e){var r=4,i=t._getNAFPoints(r);r=i.wnd;for(var n=i.points,o=s(e,r,this._bitLength),c=this.jpoint(null,null,null),h=o.length-1;h>=0;h--){for(var u=0;h>=0&&0===o[h];h--)u++;if(h>=0&&u++,c=c.dblp(u),h<0)break;var f=o[h];a(0!==f),c="affine"===t.type?f>0?c.mixedAdd(n[f-1>>1]):c.mixedAdd(n[-f-1>>1].neg()):f>0?c.add(n[f-1>>1]):c.add(n[-f-1>>1].neg())}return"affine"===t.type?c.toP():c},c.prototype._wnafMulAdd=function(t,e,r,i,n){var a,c,h,u=this._wnafT1,f=this._wnafT2,d=this._wnafT3,l=0;for(a=0;a<i;a++){var p=(h=e[a])._getNAFPoints(t);u[a]=p.wnd,f[a]=p.points}for(a=i-1;a>=1;a-=2){var g=a-1,m=a;if(1===u[g]&&1===u[m]){var b=[e[g],null,null,e[m]];0===e[g].y.cmp(e[m].y)?(b[1]=e[g].add(e[m]),b[2]=e[g].toJ().mixedAdd(e[m].neg())):0===e[g].y.cmp(e[m].y.redNeg())?(b[1]=e[g].toJ().mixedAdd(e[m]),b[2]=e[g].add(e[m].neg())):(b[1]=e[g].toJ().mixedAdd(e[m]),b[2]=e[g].toJ().mixedAdd(e[m].neg()));var v=[-3,-1,-5,-7,0,7,5,1,3],y=o(r[g],r[m]);for(l=Math.max(y[0].length,l),d[g]=new Array(l),d[m]=new Array(l),c=0;c<l;c++){var w=0|y[0][c],_=0|y[1][c];d[g][c]=v[3*(w+1)+(_+1)],d[m][c]=0,f[g]=b}}else d[g]=s(r[g],u[g],this._bitLength),d[m]=s(r[m],u[m],this._bitLength),l=Math.max(d[g].length,l),l=Math.max(d[m].length,l)}var A=this.jpoint(null,null,null),M=this._wnafT4;for(a=l;a>=0;a--){for(var E=0;a>=0;){var I=!0;for(c=0;c<i;c++)M[c]=0|d[c][a],0!==M[c]&&(I=!1);if(!I)break;E++,a--}if(a>=0&&E++,A=A.dblp(E),a<0)break;for(c=0;c<i;c++){var S=M[c];0!==S&&(S>0?h=f[c][S-1>>1]:S<0&&(h=f[c][-S-1>>1].neg()),A="affine"===h.type?A.mixedAdd(h):A.add(h))}}for(a=0;a<i;a++)f[a]=null;return n?A:A.toP()},c.BasePoint=h,h.prototype.eq=function(){throw new Error("Not implemented")},h.prototype.validate=function(){return this.curve.validate(this)},c.prototype.decodePoint=function(t,e){t=n.toArray(t,e);var r=this.p.byteLength();if((4===t[0]||6===t[0]||7===t[0])&&t.length-1==2*r)return 6===t[0]?a(t[t.length-1]%2==0):7===t[0]&&a(t[t.length-1]%2==1),this.point(t.slice(1,1+r),t.slice(1+r,1+2*r));if((2===t[0]||3===t[0])&&t.length-1===r)return this.pointFromX(t.slice(1,1+r),3===t[0]);throw new Error("Unknown point format")},h.prototype.encodeCompressed=function(t){return this.encode(t,!0)},h.prototype._encode=function(t){var e=this.curve.p.byteLength(),r=this.getX().toArray("be",e);return t?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",e))},h.prototype.encode=function(t,e){return n.encode(this._encode(e),t)},h.prototype.precompute=function(t){if(this.precomputed)return this;var e={doubles:null,naf:null,beta:null};return e.naf=this._getNAFPoints(8),e.doubles=this._getDoubles(4,t),e.beta=this._getBeta(),this.precomputed=e,this},h.prototype._hasDoubles=function(t){if(!this.precomputed)return!1;var e=this.precomputed.doubles;return!!e&&e.points.length>=Math.ceil((t.bitLength()+1)/e.step)},h.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],i=this,n=0;n<e;n+=t){for(var s=0;s<t;s++)i=i.dbl();r.push(i)}return{step:t,points:r}},h.prototype._getNAFPoints=function(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var e=[this],r=(1<<t)-1,i=1===r?null:this.dbl(),n=1;n<r;n++)e[n]=e[n-1].add(i);return{wnd:t,points:e}},h.prototype._getBeta=function(){return null},h.prototype.dblp=function(t){for(var e=this,r=0;r<t;r++)e=e.dbl();return e}},75121:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0});var i=r(63447),n=r(38767);e.DIGEST_LENGTH=64,e.BLOCK_SIZE=128;var s=function(){function t(){this.digestLength=e.DIGEST_LENGTH,this.blockSize=e.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return t.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},t.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},t.prototype.clean=function(){n.wipe(this._buffer),n.wipe(this._tempHi),n.wipe(this._tempLo),this.reset()},t.prototype.update=function(t,r){if(void 0===r&&(r=t.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var i=0;if(this._bytesHashed+=r,this._bufferLength>0){for(;this._bufferLength<e.BLOCK_SIZE&&r>0;)this._buffer[this._bufferLength++]=t[i++],r--;this._bufferLength===this.blockSize&&(a(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(i=a(this._tempHi,this._tempLo,this._stateHi,this._stateLo,t,i,r),r%=this.blockSize);r>0;)this._buffer[this._bufferLength++]=t[i++],r--;return this},t.prototype.finish=function(t){if(!this._finished){var e=this._bytesHashed,r=this._bufferLength,n=e/536870912|0,s=e<<3,o=e%128<112?128:256;this._buffer[r]=128;for(var c=r+1;c<o-8;c++)this._buffer[c]=0;i.writeUint32BE(n,this._buffer,o-8),i.writeUint32BE(s,this._buffer,o-4),a(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,o),this._finished=!0}for(c=0;c<this.digestLength/8;c++)i.writeUint32BE(this._stateHi[c],t,8*c),i.writeUint32BE(this._stateLo[c],t,8*c+4);return this},t.prototype.digest=function(){var t=new Uint8Array(this.digestLength);return this.finish(t),t},t.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{stateHi:new Int32Array(this._stateHi),stateLo:new Int32Array(this._stateLo),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},t.prototype.restoreState=function(t){return this._stateHi.set(t.stateHi),this._stateLo.set(t.stateLo),this._bufferLength=t.bufferLength,t.buffer&&this._buffer.set(t.buffer),this._bytesHashed=t.bytesHashed,this._finished=!1,this},t.prototype.cleanSavedState=function(t){n.wipe(t.stateHi),n.wipe(t.stateLo),t.buffer&&n.wipe(t.buffer),t.bufferLength=0,t.bytesHashed=0},t}();e.SHA512=s;var o=new Int32Array([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 a(t,e,r,n,s,a,c){for(var h,u,f,d,l,p,g,m,b=r[0],v=r[1],y=r[2],w=r[3],_=r[4],A=r[5],M=r[6],E=r[7],I=n[0],S=n[1],P=n[2],x=n[3],R=n[4],N=n[5],O=n[6],C=n[7];c>=128;){for(var T=0;T<16;T++){var q=8*T+a;t[T]=i.readUint32BE(s,q),e[T]=i.readUint32BE(s,q+4)}for(T=0;T<80;T++){var k,D,U=b,B=v,L=y,z=w,j=_,F=A,H=M,K=I,$=S,V=P,J=x,G=R,Q=N,W=O;if(l=65535&(u=C),p=u>>>16,g=65535&(h=E),m=h>>>16,l+=65535&(u=(R>>>14|_<<18)^(R>>>18|_<<14)^(_>>>9|R<<23)),p+=u>>>16,g+=65535&(h=(_>>>14|R<<18)^(_>>>18|R<<14)^(R>>>9|_<<23)),m+=h>>>16,l+=65535&(u=R&N^~R&O),p+=u>>>16,g+=65535&(h=_&A^~_&M),m+=h>>>16,h=o[2*T],l+=65535&(u=o[2*T+1]),p+=u>>>16,g+=65535&h,m+=h>>>16,h=t[T%16],p+=(u=e[T%16])>>>16,g+=65535&h,m+=h>>>16,g+=(p+=(l+=65535&u)>>>16)>>>16,l=65535&(u=d=65535&l|p<<16),p=u>>>16,g=65535&(h=f=65535&g|(m+=g>>>16)<<16),m=h>>>16,l+=65535&(u=(I>>>28|b<<4)^(b>>>2|I<<30)^(b>>>7|I<<25)),p+=u>>>16,g+=65535&(h=(b>>>28|I<<4)^(I>>>2|b<<30)^(I>>>7|b<<25)),m+=h>>>16,p+=(u=I&S^I&P^S&P)>>>16,g+=65535&(h=b&v^b&y^v&y),m+=h>>>16,k=65535&(g+=(p+=(l+=65535&u)>>>16)>>>16)|(m+=g>>>16)<<16,D=65535&l|p<<16,l=65535&(u=J),p=u>>>16,g=65535&(h=z),m=h>>>16,p+=(u=d)>>>16,g+=65535&(h=f),m+=h>>>16,v=U,y=B,w=L,_=z=65535&(g+=(p+=(l+=65535&u)>>>16)>>>16)|(m+=g>>>16)<<16,A=j,M=F,E=H,b=k,S=K,P=$,x=V,R=J=65535&l|p<<16,N=G,O=Q,C=W,I=D,T%16==15)for(q=0;q<16;q++)h=t[q],l=65535&(u=e[q]),p=u>>>16,g=65535&h,m=h>>>16,h=t[(q+9)%16],l+=65535&(u=e[(q+9)%16]),p+=u>>>16,g+=65535&h,m+=h>>>16,f=t[(q+1)%16],l+=65535&(u=((d=e[(q+1)%16])>>>1|f<<31)^(d>>>8|f<<24)^(d>>>7|f<<25)),p+=u>>>16,g+=65535&(h=(f>>>1|d<<31)^(f>>>8|d<<24)^f>>>7),m+=h>>>16,f=t[(q+14)%16],p+=(u=((d=e[(q+14)%16])>>>19|f<<13)^(f>>>29|d<<3)^(d>>>6|f<<26))>>>16,g+=65535&(h=(f>>>19|d<<13)^(d>>>29|f<<3)^f>>>6),m+=h>>>16,m+=(g+=(p+=(l+=65535&u)>>>16)>>>16)>>>16,t[q]=65535&g|m<<16,e[q]=65535&l|p<<16}l=65535&(u=I),p=u>>>16,g=65535&(h=b),m=h>>>16,h=r[0],p+=(u=n[0])>>>16,g+=65535&h,m+=h>>>16,m+=(g+=(p+=(l+=65535&u)>>>16)>>>16)>>>16,r[0]=b=65535&g|m<<16,n[0]=I=65535&l|p<<16,l=65535&(u=S),p=u>>>16,g=65535&(h=v),m=h>>>16,h=r[1],p+=(u=n[1])>>>16,g+=65535&h,m+=h>>>16,m+=(g+=(p+=(l+=65535&u)>>>16)>>>16)>>>16,r[1]=v=65535&g|m<<16,n[1]=S=65535&l|p<<16,l=65535&(u=P),p=u>>>16,g=65535&(h=y),m=h>>>16,h=r[2],p+=(u=n[2])>>>16,g+=65535&h,m+=h>>>16,m+=(g+=(p+=(l+=65535&u)>>>16)>>>16)>>>16,r[2]=y=65535&g|m<<16,n[2]=P=65535&l|p<<16,l=65535&(u=x),p=u>>>16,g=65535&(h=w),m=h>>>16,h=r[3],p+=(u=n[3])>>>16,g+=65535&h,m+=h>>>16,m+=(g+=(p+=(l+=65535&u)>>>16)>>>16)>>>16,r[3]=w=65535&g|m<<16,n[3]=x=65535&l|p<<16,l=65535&(u=R),p=u>>>16,g=65535&(h=_),m=h>>>16,h=r[4],p+=(u=n[4])>>>16,g+=65535&h,m+=h>>>16,m+=(g+=(p+=(l+=65535&u)>>>16)>>>16)>>>16,r[4]=_=65535&g|m<<16,n[4]=R=65535&l|p<<16,l=65535&(u=N),p=u>>>16,g=65535&(h=A),m=h>>>16,h=r[5],p+=(u=n[5])>>>16,g+=65535&h,m+=h>>>16,m+=(g+=(p+=(l+=65535&u)>>>16)>>>16)>>>16,r[5]=A=65535&g|m<<16,n[5]=N=65535&l|p<<16,l=65535&(u=O),p=u>>>16,g=65535&(h=M),m=h>>>16,h=r[6],p+=(u=n[6])>>>16,g+=65535&h,m+=h>>>16,m+=(g+=(p+=(l+=65535&u)>>>16)>>>16)>>>16,r[6]=M=65535&g|m<<16,n[6]=O=65535&l|p<<16,l=65535&(u=C),p=u>>>16,g=65535&(h=E),m=h>>>16,h=r[7],p+=(u=n[7])>>>16,g+=65535&h,m+=h>>>16,m+=(g+=(p+=(l+=65535&u)>>>16)>>>16)>>>16,r[7]=E=65535&g|m<<16,n[7]=C=65535&l|p<<16,a+=128,c-=128}return a}e.hash=function(t){var e=new s;e.update(t);var r=e.digest();return e.clean(),r}},75625:(t,e,r)=>{var i=r(79188),n=r(49899),s=n.assert;function o(t,e){if(t instanceof o)return t;this._importDER(t,e)||(s(t.r&&t.s,"Signature without r or s"),this.r=new i(t.r,16),this.s=new i(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}function a(){this.place=0}function c(t,e){var r=t[e.place++];if(!(128&r))return r;var i=15&r;if(0===i||i>4)return!1;if(0===t[e.place])return!1;for(var n=0,s=0,o=e.place;s<i;s++,o++)n<<=8,n|=t[o],n>>>=0;return!(n<=127)&&(e.place=o,n)}function h(t){for(var e=0,r=t.length-1;!t[e]&&!(128&t[e+1])&&e<r;)e++;return 0===e?t:t.slice(e)}function u(t,e){if(e<128)t.push(e);else{var r=1+(Math.log(e)/Math.LN2>>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}}t.exports=o,o.prototype._importDER=function(t,e){t=n.toArray(t,e);var r=new a;if(48!==t[r.place++])return!1;var s=c(t,r);if(!1===s)return!1;if(s+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var o=c(t,r);if(!1===o)return!1;if(128&t[r.place])return!1;var h=t.slice(r.place,o+r.place);if(r.place+=o,2!==t[r.place++])return!1;var u=c(t,r);if(!1===u)return!1;if(t.length!==u+r.place)return!1;if(128&t[r.place])return!1;var f=t.slice(r.place,u+r.place);if(0===h[0]){if(!(128&h[1]))return!1;h=h.slice(1)}if(0===f[0]){if(!(128&f[1]))return!1;f=f.slice(1)}return this.r=new i(h),this.s=new i(f),this.recoveryParam=null,!0},o.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&r[0]&&(r=[0].concat(r)),e=h(e),r=h(r);!(r[0]||128&r[1]);)r=r.slice(1);var i=[2];u(i,e.length),(i=i.concat(e)).push(2),u(i,r.length);var s=i.concat(r),o=[48];return u(o,s.length),o=o.concat(s),n.encode(o,t)}},79188:function(t,e,r){!function(t,e){function i(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function s(t,e,r){if(s.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=s:e.BN=s,s.BN=s,s.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(3205).Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function c(t,e,r){var i=a(t,r);return r-1>=e&&(i|=a(t,r-1)<<4),i}function h(t,e,r,i){for(var n=0,s=Math.min(t.length,r),o=e;o<s;o++){var a=t.charCodeAt(o)-48;n*=i,n+=a>=49?a-49+10:a>=17?a-17+10:a}return n}s.isBN=function(t){return t instanceof s||null!==t&&"object"==typeof t&&t.constructor.wordSize===s.wordSize&&Array.isArray(t.words)},s.max=function(t,e){return t.cmp(e)>0?t:e},s.min=function(t,e){return t.cmp(e)<0?t:e},s.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<t.length&&(16===e?this._parseHex(t,n,r):(this._parseBase(t,e,n),"le"===r&&this._initArray(this.toArray(),e,r)))},s.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(i(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},s.prototype._initArray=function(t,e,r){if(i("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var s,o,a=0;if("be"===r)for(n=t.length-1,s=0;n>=0;n-=3)o=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[s]|=o<<a&67108863,this.words[s+1]=o>>>26-a&67108863,(a+=24)>=26&&(a-=26,s++);else if("le"===r)for(n=0,s=0;n<t.length;n+=3)o=t[n]|t[n+1]<<8|t[n+2]<<16,this.words[s]|=o<<a&67108863,this.words[s+1]=o>>>26-a&67108863,(a+=24)>=26&&(a-=26,s++);return this.strip()},s.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var n,s=0,o=0;if("be"===r)for(i=t.length-1;i>=e;i-=2)n=c(t,e,i)<<s,this.words[o]|=67108863&n,s>=18?(s-=18,o+=1,this.words[o]|=n>>>26):s+=8;else for(i=(t.length-e)%2==0?e+1:e;i<t.length;i+=2)n=c(t,e,i)<<s,this.words[o]|=67108863&n,s>=18?(s-=18,o+=1,this.words[o]|=n>>>26):s+=8;this.strip()},s.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var s=t.length-r,o=s%i,a=Math.min(s,s-o)+r,c=0,u=r;u<a;u+=i)c=h(t,u,u+i,e),this.imuln(n),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==o){var f=1;for(c=h(t,u,t.length,e),u=0;u<o;u++)f*=e;this.imuln(f),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}this.strip()},s.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},s.prototype.clone=function(){var t=new s(null);return this.copy(t),t},s.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},s.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},s.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},s.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var u=["","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"],f=[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],d=[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];function l(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],s=0|e.words[0],o=n*s,a=67108863&o,c=o/67108864|0;r.words[0]=a;for(var h=1;h<i;h++){for(var u=c>>>26,f=67108863&c,d=Math.min(h,e.length-1),l=Math.max(0,h-t.length+1);l<=d;l++){var p=h-l|0;u+=(o=(n=0|t.words[p])*(s=0|e.words[l])+f)/67108864|0,f=67108863&o}r.words[h]=0|f,c=0|u}return 0!==c?r.words[h]=0|c:r.length--,r.strip()}s.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,s=0,o=0;o<this.length;o++){var a=this.words[o],c=(16777215&(a<<n|s)).toString(16);r=0!=(s=a>>>24-n&16777215)||o!==this.length-1?u[6-c.length]+c+r:c+r,(n+=2)>=26&&(n-=26,o--)}for(0!==s&&(r=s.toString(16)+r);r.length%e!==0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var h=f[t],l=d[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var g=p.modn(l).toString(t);r=(p=p.idivn(l)).isZero()?g+r:u[h-g.length]+g+r}for(this.isZero()&&(r="0"+r);r.length%e!==0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(t,e){return i(void 0!==o),this.toArrayLike(o,t,e)},s.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},s.prototype.toArrayLike=function(t,e,r){var n=this.byteLength(),s=r||Math.max(1,n);i(n<=s,"byte array longer than desired length"),i(s>0,"Requested array length <= 0"),this.strip();var o,a,c="le"===e,h=new t(s),u=this.clone();if(c){for(a=0;!u.isZero();a++)o=u.andln(255),u.iushrn(8),h[a]=o;for(;a<s;a++)h[a]=0}else{for(a=0;a<s-n;a++)h[a]=0;for(a=0;!u.isZero();a++)o=u.andln(255),u.iushrn(8),h[s-a-1]=o}return h},Math.clz32?s.prototype._countBits=function(t){return 32-Math.clz32(t)}:s.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},s.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 8191&e||(r+=13,e>>>=13),127&e||(r+=7,e>>>=7),15&e||(r+=4,e>>>=4),3&e||(r+=2,e>>>=2),1&e||r++,r},s.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},s.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},s.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},s.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},s.prototype.isNeg=function(){return 0!==this.negative},s.prototype.neg=function(){return this.clone().ineg()},s.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},s.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},s.prototype.ior=function(t){return i(0===(this.negative|t.negative)),this.iuor(t)},s.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},s.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},s.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this.strip()},s.prototype.iand=function(t){return i(0===(this.negative|t.negative)),this.iuand(t)},s.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},s.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},s.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;i<r.length;i++)this.words[i]=e.words[i]^r.words[i];if(this!==e)for(;i<e.length;i++)this.words[i]=e.words[i];return this.length=e.length,this.strip()},s.prototype.ixor=function(t){return i(0===(this.negative|t.negative)),this.iuxor(t)},s.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},s.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},s.prototype.inotn=function(t){i("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n<e;n++)this.words[n]=67108863&~this.words[n];return r>0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},s.prototype.notn=function(t){return this.clone().inotn(t)},s.prototype.setn=function(t,e){i("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<<n:this.words[r]&~(1<<n),this.strip()},s.prototype.iadd=function(t){var e,r,i;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,i=t):(r=t,i=this);for(var n=0,s=0;s<i.length;s++)e=(0|r.words[s])+(0|i.words[s])+n,this.words[s]=67108863&e,n=e>>>26;for(;0!==n&&s<r.length;s++)e=(0|r.words[s])+n,this.words[s]=67108863&e,n=e>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this},s.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},s.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var s=0,o=0;o<i.length;o++)s=(e=(0|r.words[o])-(0|i.words[o])+s)>>26,this.words[o]=67108863&e;for(;0!==s&&o<r.length;o++)s=(e=(0|r.words[o])+s)>>26,this.words[o]=67108863&e;if(0===s&&o<r.length&&r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this.length=Math.max(this.length,o),r!==this&&(this.negative=1),this.strip()},s.prototype.sub=function(t){return this.clone().isub(t)};var p=function(t,e,r){var i,n,s,o=t.words,a=e.words,c=r.words,h=0,u=0|o[0],f=8191&u,d=u>>>13,l=0|o[1],p=8191&l,g=l>>>13,m=0|o[2],b=8191&m,v=m>>>13,y=0|o[3],w=8191&y,_=y>>>13,A=0|o[4],M=8191&A,E=A>>>13,I=0|o[5],S=8191&I,P=I>>>13,x=0|o[6],R=8191&x,N=x>>>13,O=0|o[7],C=8191&O,T=O>>>13,q=0|o[8],k=8191&q,D=q>>>13,U=0|o[9],B=8191&U,L=U>>>13,z=0|a[0],j=8191&z,F=z>>>13,H=0|a[1],K=8191&H,$=H>>>13,V=0|a[2],J=8191&V,G=V>>>13,Q=0|a[3],W=8191&Q,Y=Q>>>13,X=0|a[4],Z=8191&X,tt=X>>>13,et=0|a[5],rt=8191&et,it=et>>>13,nt=0|a[6],st=8191&nt,ot=nt>>>13,at=0|a[7],ct=8191&at,ht=at>>>13,ut=0|a[8],ft=8191&ut,dt=ut>>>13,lt=0|a[9],pt=8191&lt,gt=lt>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(h+(i=Math.imul(f,j))|0)+((8191&(n=(n=Math.imul(f,F))+Math.imul(d,j)|0))<<13)|0;h=((s=Math.imul(d,F))+(n>>>13)|0)+(mt>>>26)|0,mt&=67108863,i=Math.imul(p,j),n=(n=Math.imul(p,F))+Math.imul(g,j)|0,s=Math.imul(g,F);var bt=(h+(i=i+Math.imul(f,K)|0)|0)+((8191&(n=(n=n+Math.imul(f,$)|0)+Math.imul(d,K)|0))<<13)|0;h=((s=s+Math.imul(d,$)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(b,j),n=(n=Math.imul(b,F))+Math.imul(v,j)|0,s=Math.imul(v,F),i=i+Math.imul(p,K)|0,n=(n=n+Math.imul(p,$)|0)+Math.imul(g,K)|0,s=s+Math.imul(g,$)|0;var vt=(h+(i=i+Math.imul(f,J)|0)|0)+((8191&(n=(n=n+Math.imul(f,G)|0)+Math.imul(d,J)|0))<<13)|0;h=((s=s+Math.imul(d,G)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(w,j),n=(n=Math.imul(w,F))+Math.imul(_,j)|0,s=Math.imul(_,F),i=i+Math.imul(b,K)|0,n=(n=n+Math.imul(b,$)|0)+Math.imul(v,K)|0,s=s+Math.imul(v,$)|0,i=i+Math.imul(p,J)|0,n=(n=n+Math.imul(p,G)|0)+Math.imul(g,J)|0,s=s+Math.imul(g,G)|0;var yt=(h+(i=i+Math.imul(f,W)|0)|0)+((8191&(n=(n=n+Math.imul(f,Y)|0)+Math.imul(d,W)|0))<<13)|0;h=((s=s+Math.imul(d,Y)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(M,j),n=(n=Math.imul(M,F))+Math.imul(E,j)|0,s=Math.imul(E,F),i=i+Math.imul(w,K)|0,n=(n=n+Math.imul(w,$)|0)+Math.imul(_,K)|0,s=s+Math.imul(_,$)|0,i=i+Math.imul(b,J)|0,n=(n=n+Math.imul(b,G)|0)+Math.imul(v,J)|0,s=s+Math.imul(v,G)|0,i=i+Math.imul(p,W)|0,n=(n=n+Math.imul(p,Y)|0)+Math.imul(g,W)|0,s=s+Math.imul(g,Y)|0;var wt=(h+(i=i+Math.imul(f,Z)|0)|0)+((8191&(n=(n=n+Math.imul(f,tt)|0)+Math.imul(d,Z)|0))<<13)|0;h=((s=s+Math.imul(d,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(S,j),n=(n=Math.imul(S,F))+Math.imul(P,j)|0,s=Math.imul(P,F),i=i+Math.imul(M,K)|0,n=(n=n+Math.imul(M,$)|0)+Math.imul(E,K)|0,s=s+Math.imul(E,$)|0,i=i+Math.imul(w,J)|0,n=(n=n+Math.imul(w,G)|0)+Math.imul(_,J)|0,s=s+Math.imul(_,G)|0,i=i+Math.imul(b,W)|0,n=(n=n+Math.imul(b,Y)|0)+Math.imul(v,W)|0,s=s+Math.imul(v,Y)|0,i=i+Math.imul(p,Z)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(g,Z)|0,s=s+Math.imul(g,tt)|0;var _t=(h+(i=i+Math.imul(f,rt)|0)|0)+((8191&(n=(n=n+Math.imul(f,it)|0)+Math.imul(d,rt)|0))<<13)|0;h=((s=s+Math.imul(d,it)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(R,j),n=(n=Math.imul(R,F))+Math.imul(N,j)|0,s=Math.imul(N,F),i=i+Math.imul(S,K)|0,n=(n=n+Math.imul(S,$)|0)+Math.imul(P,K)|0,s=s+Math.imul(P,$)|0,i=i+Math.imul(M,J)|0,n=(n=n+Math.imul(M,G)|0)+Math.imul(E,J)|0,s=s+Math.imul(E,G)|0,i=i+Math.imul(w,W)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul(_,W)|0,s=s+Math.imul(_,Y)|0,i=i+Math.imul(b,Z)|0,n=(n=n+Math.imul(b,tt)|0)+Math.imul(v,Z)|0,s=s+Math.imul(v,tt)|0,i=i+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(g,rt)|0,s=s+Math.imul(g,it)|0;var At=(h+(i=i+Math.imul(f,st)|0)|0)+((8191&(n=(n=n+Math.imul(f,ot)|0)+Math.imul(d,st)|0))<<13)|0;h=((s=s+Math.imul(d,ot)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(C,j),n=(n=Math.imul(C,F))+Math.imul(T,j)|0,s=Math.imul(T,F),i=i+Math.imul(R,K)|0,n=(n=n+Math.imul(R,$)|0)+Math.imul(N,K)|0,s=s+Math.imul(N,$)|0,i=i+Math.imul(S,J)|0,n=(n=n+Math.imul(S,G)|0)+Math.imul(P,J)|0,s=s+Math.imul(P,G)|0,i=i+Math.imul(M,W)|0,n=(n=n+Math.imul(M,Y)|0)+Math.imul(E,W)|0,s=s+Math.imul(E,Y)|0,i=i+Math.imul(w,Z)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(_,Z)|0,s=s+Math.imul(_,tt)|0,i=i+Math.imul(b,rt)|0,n=(n=n+Math.imul(b,it)|0)+Math.imul(v,rt)|0,s=s+Math.imul(v,it)|0,i=i+Math.imul(p,st)|0,n=(n=n+Math.imul(p,ot)|0)+Math.imul(g,st)|0,s=s+Math.imul(g,ot)|0;var Mt=(h+(i=i+Math.imul(f,ct)|0)|0)+((8191&(n=(n=n+Math.imul(f,ht)|0)+Math.imul(d,ct)|0))<<13)|0;h=((s=s+Math.imul(d,ht)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(k,j),n=(n=Math.imul(k,F))+Math.imul(D,j)|0,s=Math.imul(D,F),i=i+Math.imul(C,K)|0,n=(n=n+Math.imul(C,$)|0)+Math.imul(T,K)|0,s=s+Math.imul(T,$)|0,i=i+Math.imul(R,J)|0,n=(n=n+Math.imul(R,G)|0)+Math.imul(N,J)|0,s=s+Math.imul(N,G)|0,i=i+Math.imul(S,W)|0,n=(n=n+Math.imul(S,Y)|0)+Math.imul(P,W)|0,s=s+Math.imul(P,Y)|0,i=i+Math.imul(M,Z)|0,n=(n=n+Math.imul(M,tt)|0)+Math.imul(E,Z)|0,s=s+Math.imul(E,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(_,rt)|0,s=s+Math.imul(_,it)|0,i=i+Math.imul(b,st)|0,n=(n=n+Math.imul(b,ot)|0)+Math.imul(v,st)|0,s=s+Math.imul(v,ot)|0,i=i+Math.imul(p,ct)|0,n=(n=n+Math.imul(p,ht)|0)+Math.imul(g,ct)|0,s=s+Math.imul(g,ht)|0;var Et=(h+(i=i+Math.imul(f,ft)|0)|0)+((8191&(n=(n=n+Math.imul(f,dt)|0)+Math.imul(d,ft)|0))<<13)|0;h=((s=s+Math.imul(d,dt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(B,j),n=(n=Math.imul(B,F))+Math.imul(L,j)|0,s=Math.imul(L,F),i=i+Math.imul(k,K)|0,n=(n=n+Math.imul(k,$)|0)+Math.imul(D,K)|0,s=s+Math.imul(D,$)|0,i=i+Math.imul(C,J)|0,n=(n=n+Math.imul(C,G)|0)+Math.imul(T,J)|0,s=s+Math.imul(T,G)|0,i=i+Math.imul(R,W)|0,n=(n=n+Math.imul(R,Y)|0)+Math.imul(N,W)|0,s=s+Math.imul(N,Y)|0,i=i+Math.imul(S,Z)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(P,Z)|0,s=s+Math.imul(P,tt)|0,i=i+Math.imul(M,rt)|0,n=(n=n+Math.imul(M,it)|0)+Math.imul(E,rt)|0,s=s+Math.imul(E,it)|0,i=i+Math.imul(w,st)|0,n=(n=n+Math.imul(w,ot)|0)+Math.imul(_,st)|0,s=s+Math.imul(_,ot)|0,i=i+Math.imul(b,ct)|0,n=(n=n+Math.imul(b,ht)|0)+Math.imul(v,ct)|0,s=s+Math.imul(v,ht)|0,i=i+Math.imul(p,ft)|0,n=(n=n+Math.imul(p,dt)|0)+Math.imul(g,ft)|0,s=s+Math.imul(g,dt)|0;var It=(h+(i=i+Math.imul(f,pt)|0)|0)+((8191&(n=(n=n+Math.imul(f,gt)|0)+Math.imul(d,pt)|0))<<13)|0;h=((s=s+Math.imul(d,gt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(B,K),n=(n=Math.imul(B,$))+Math.imul(L,K)|0,s=Math.imul(L,$),i=i+Math.imul(k,J)|0,n=(n=n+Math.imul(k,G)|0)+Math.imul(D,J)|0,s=s+Math.imul(D,G)|0,i=i+Math.imul(C,W)|0,n=(n=n+Math.imul(C,Y)|0)+Math.imul(T,W)|0,s=s+Math.imul(T,Y)|0,i=i+Math.imul(R,Z)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(N,Z)|0,s=s+Math.imul(N,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul(P,rt)|0,s=s+Math.imul(P,it)|0,i=i+Math.imul(M,st)|0,n=(n=n+Math.imul(M,ot)|0)+Math.imul(E,st)|0,s=s+Math.imul(E,ot)|0,i=i+Math.imul(w,ct)|0,n=(n=n+Math.imul(w,ht)|0)+Math.imul(_,ct)|0,s=s+Math.imul(_,ht)|0,i=i+Math.imul(b,ft)|0,n=(n=n+Math.imul(b,dt)|0)+Math.imul(v,ft)|0,s=s+Math.imul(v,dt)|0;var St=(h+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,gt)|0)+Math.imul(g,pt)|0))<<13)|0;h=((s=s+Math.imul(g,gt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(B,J),n=(n=Math.imul(B,G))+Math.imul(L,J)|0,s=Math.imul(L,G),i=i+Math.imul(k,W)|0,n=(n=n+Math.imul(k,Y)|0)+Math.imul(D,W)|0,s=s+Math.imul(D,Y)|0,i=i+Math.imul(C,Z)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(T,Z)|0,s=s+Math.imul(T,tt)|0,i=i+Math.imul(R,rt)|0,n=(n=n+Math.imul(R,it)|0)+Math.imul(N,rt)|0,s=s+Math.imul(N,it)|0,i=i+Math.imul(S,st)|0,n=(n=n+Math.imul(S,ot)|0)+Math.imul(P,st)|0,s=s+Math.imul(P,ot)|0,i=i+Math.imul(M,ct)|0,n=(n=n+Math.imul(M,ht)|0)+Math.imul(E,ct)|0,s=s+Math.imul(E,ht)|0,i=i+Math.imul(w,ft)|0,n=(n=n+Math.imul(w,dt)|0)+Math.imul(_,ft)|0,s=s+Math.imul(_,dt)|0;var Pt=(h+(i=i+Math.imul(b,pt)|0)|0)+((8191&(n=(n=n+Math.imul(b,gt)|0)+Math.imul(v,pt)|0))<<13)|0;h=((s=s+Math.imul(v,gt)|0)+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,i=Math.imul(B,W),n=(n=Math.imul(B,Y))+Math.imul(L,W)|0,s=Math.imul(L,Y),i=i+Math.imul(k,Z)|0,n=(n=n+Math.imul(k,tt)|0)+Math.imul(D,Z)|0,s=s+Math.imul(D,tt)|0,i=i+Math.imul(C,rt)|0,n=(n=n+Math.imul(C,it)|0)+Math.imul(T,rt)|0,s=s+Math.imul(T,it)|0,i=i+Math.imul(R,st)|0,n=(n=n+Math.imul(R,ot)|0)+Math.imul(N,st)|0,s=s+Math.imul(N,ot)|0,i=i+Math.imul(S,ct)|0,n=(n=n+Math.imul(S,ht)|0)+Math.imul(P,ct)|0,s=s+Math.imul(P,ht)|0,i=i+Math.imul(M,ft)|0,n=(n=n+Math.imul(M,dt)|0)+Math.imul(E,ft)|0,s=s+Math.imul(E,dt)|0;var xt=(h+(i=i+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,gt)|0)+Math.imul(_,pt)|0))<<13)|0;h=((s=s+Math.imul(_,gt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(B,Z),n=(n=Math.imul(B,tt))+Math.imul(L,Z)|0,s=Math.imul(L,tt),i=i+Math.imul(k,rt)|0,n=(n=n+Math.imul(k,it)|0)+Math.imul(D,rt)|0,s=s+Math.imul(D,it)|0,i=i+Math.imul(C,st)|0,n=(n=n+Math.imul(C,ot)|0)+Math.imul(T,st)|0,s=s+Math.imul(T,ot)|0,i=i+Math.imul(R,ct)|0,n=(n=n+Math.imul(R,ht)|0)+Math.imul(N,ct)|0,s=s+Math.imul(N,ht)|0,i=i+Math.imul(S,ft)|0,n=(n=n+Math.imul(S,dt)|0)+Math.imul(P,ft)|0,s=s+Math.imul(P,dt)|0;var Rt=(h+(i=i+Math.imul(M,pt)|0)|0)+((8191&(n=(n=n+Math.imul(M,gt)|0)+Math.imul(E,pt)|0))<<13)|0;h=((s=s+Math.imul(E,gt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,i=Math.imul(B,rt),n=(n=Math.imul(B,it))+Math.imul(L,rt)|0,s=Math.imul(L,it),i=i+Math.imul(k,st)|0,n=(n=n+Math.imul(k,ot)|0)+Math.imul(D,st)|0,s=s+Math.imul(D,ot)|0,i=i+Math.imul(C,ct)|0,n=(n=n+Math.imul(C,ht)|0)+Math.imul(T,ct)|0,s=s+Math.imul(T,ht)|0,i=i+Math.imul(R,ft)|0,n=(n=n+Math.imul(R,dt)|0)+Math.imul(N,ft)|0,s=s+Math.imul(N,dt)|0;var Nt=(h+(i=i+Math.imul(S,pt)|0)|0)+((8191&(n=(n=n+Math.imul(S,gt)|0)+Math.imul(P,pt)|0))<<13)|0;h=((s=s+Math.imul(P,gt)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,i=Math.imul(B,st),n=(n=Math.imul(B,ot))+Math.imul(L,st)|0,s=Math.imul(L,ot),i=i+Math.imul(k,ct)|0,n=(n=n+Math.imul(k,ht)|0)+Math.imul(D,ct)|0,s=s+Math.imul(D,ht)|0,i=i+Math.imul(C,ft)|0,n=(n=n+Math.imul(C,dt)|0)+Math.imul(T,ft)|0,s=s+Math.imul(T,dt)|0;var Ot=(h+(i=i+Math.imul(R,pt)|0)|0)+((8191&(n=(n=n+Math.imul(R,gt)|0)+Math.imul(N,pt)|0))<<13)|0;h=((s=s+Math.imul(N,gt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,i=Math.imul(B,ct),n=(n=Math.imul(B,ht))+Math.imul(L,ct)|0,s=Math.imul(L,ht),i=i+Math.imul(k,ft)|0,n=(n=n+Math.imul(k,dt)|0)+Math.imul(D,ft)|0,s=s+Math.imul(D,dt)|0;var Ct=(h+(i=i+Math.imul(C,pt)|0)|0)+((8191&(n=(n=n+Math.imul(C,gt)|0)+Math.imul(T,pt)|0))<<13)|0;h=((s=s+Math.imul(T,gt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(B,ft),n=(n=Math.imul(B,dt))+Math.imul(L,ft)|0,s=Math.imul(L,dt);var Tt=(h+(i=i+Math.imul(k,pt)|0)|0)+((8191&(n=(n=n+Math.imul(k,gt)|0)+Math.imul(D,pt)|0))<<13)|0;h=((s=s+Math.imul(D,gt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863;var qt=(h+(i=Math.imul(B,pt))|0)+((8191&(n=(n=Math.imul(B,gt))+Math.imul(L,pt)|0))<<13)|0;return h=((s=Math.imul(L,gt))+(n>>>13)|0)+(qt>>>26)|0,qt&=67108863,c[0]=mt,c[1]=bt,c[2]=vt,c[3]=yt,c[4]=wt,c[5]=_t,c[6]=At,c[7]=Mt,c[8]=Et,c[9]=It,c[10]=St,c[11]=Pt,c[12]=xt,c[13]=Rt,c[14]=Nt,c[15]=Ot,c[16]=Ct,c[17]=Tt,c[18]=qt,0!==h&&(c[19]=h,r.length++),r};function g(t,e,r){return(new m).mulp(t,e,r)}function m(t,e){this.x=t,this.y=e}Math.imul||(p=l),s.prototype.mulTo=function(t,e){var r,i=this.length+t.length;return r=10===this.length&&10===t.length?p(this,t,e):i<63?l(this,t,e):i<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,s=0;s<r.length-1;s++){var o=n;n=0;for(var a=67108863&i,c=Math.min(s,e.length-1),h=Math.max(0,s-t.length+1);h<=c;h++){var u=s-h,f=(0|t.words[u])*(0|e.words[h]),d=67108863&f;a=67108863&(d=d+a|0),n+=(o=(o=o+(f/67108864|0)|0)+(d>>>26)|0)>>>26,o&=67108863}r.words[s]=a,i=o,o=n}return 0!==i?r.words[s]=i:r.length--,r.strip()}(this,t,e):g(this,t,e),r},m.prototype.makeRBT=function(t){for(var e=new Array(t),r=s.prototype._countBits(t)-1,i=0;i<t;i++)e[i]=this.revBin(i,r,t);return e},m.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var i=0,n=0;n<e;n++)i|=(1&t)<<e-n-1,t>>=1;return i},m.prototype.permute=function(t,e,r,i,n,s){for(var o=0;o<s;o++)i[o]=e[t[o]],n[o]=r[t[o]]},m.prototype.transform=function(t,e,r,i,n,s){this.permute(s,t,e,r,i,n);for(var o=1;o<n;o<<=1)for(var a=o<<1,c=Math.cos(2*Math.PI/a),h=Math.sin(2*Math.PI/a),u=0;u<n;u+=a)for(var f=c,d=h,l=0;l<o;l++){var p=r[u+l],g=i[u+l],m=r[u+l+o],b=i[u+l+o],v=f*m-d*b;b=f*b+d*m,m=v,r[u+l]=p+m,i[u+l]=g+b,r[u+l+o]=p-m,i[u+l+o]=g-b,l!==a&&(v=c*f-h*d,d=c*d+h*f,f=v)}},m.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),i=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+i},m.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var i=0;i<r/2;i++){var n=t[i];t[i]=t[r-i-1],t[r-i-1]=n,n=e[i],e[i]=-e[r-i-1],e[r-i-1]=-n}},m.prototype.normalize13b=function(t,e){for(var r=0,i=0;i<e/2;i++){var n=8192*Math.round(t[2*i+1]/e)+Math.round(t[2*i]/e)+r;t[i]=67108863&n,r=n<67108864?0:n/67108864|0}return t},m.prototype.convert13b=function(t,e,r,n){for(var s=0,o=0;o<e;o++)s+=0|t[o],r[2*o]=8191&s,s>>>=13,r[2*o+1]=8191&s,s>>>=13;for(o=2*e;o<n;++o)r[o]=0;i(0===s),i(!(-8192&s))},m.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},m.prototype.mulp=function(t,e,r){var i=2*this.guessLen13b(t.length,e.length),n=this.makeRBT(i),s=this.stub(i),o=new Array(i),a=new Array(i),c=new Array(i),h=new Array(i),u=new Array(i),f=new Array(i),d=r.words;d.length=i,this.convert13b(t.words,t.length,o,i),this.convert13b(e.words,e.length,h,i),this.transform(o,s,a,c,i,n),this.transform(h,s,u,f,i,n);for(var l=0;l<i;l++){var p=a[l]*u[l]-c[l]*f[l];c[l]=a[l]*f[l]+c[l]*u[l],a[l]=p}return this.conjugate(a,c,i),this.transform(a,c,d,s,i,n),this.conjugate(d,s,i),this.normalize13b(d,i),r.negative=t.negative^e.negative,r.length=t.length+e.length,r.strip()},s.prototype.mul=function(t){var e=new s(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},s.prototype.mulf=function(t){var e=new s(null);return e.words=new Array(this.length+t.length),g(this,t,e)},s.prototype.imul=function(t){return this.clone().mulTo(t,this)},s.prototype.imuln=function(t){i("number"==typeof t),i(t<67108864);for(var e=0,r=0;r<this.length;r++){var n=(0|this.words[r])*t,s=(67108863&n)+(67108863&e);e>>=26,e+=n/67108864|0,e+=s>>>26,this.words[r]=67108863&s}return 0!==e&&(this.words[r]=e,this.length++),this},s.prototype.muln=function(t){return this.clone().imuln(t)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var i=r/26|0,n=r%26;e[r]=(t.words[i]&1<<n)>>>n}return e}(t);if(0===e.length)return new s(1);for(var r=this,i=0;i<e.length&&0===e[i];i++,r=r.sqr());if(++i<e.length)for(var n=r.sqr();i<e.length;i++,n=n.sqr())0!==e[i]&&(r=r.mul(n));return r},s.prototype.iushln=function(t){i("number"==typeof t&&t>=0);var e,r=t%26,n=(t-r)/26,s=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e<this.length;e++){var a=this.words[e]&s,c=(0|this.words[e])-a<<r;this.words[e]=c|o,o=a>>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e<n;e++)this.words[e]=0;this.length+=n}return this.strip()},s.prototype.ishln=function(t){return i(0===this.negative),this.iushln(t)},s.prototype.iushrn=function(t,e,r){var n;i("number"==typeof t&&t>=0),n=e?(e-e%26)/26:0;var s=t%26,o=Math.min((t-s)/26,this.length),a=67108863^67108863>>>s<<s,c=r;if(n-=o,n=Math.max(0,n),c){for(var h=0;h<o;h++)c.words[h]=this.words[h];c.length=o}if(0===o);else if(this.length>o)for(this.length-=o,h=0;h<this.length;h++)this.words[h]=this.words[h+o];else this.words[0]=0,this.length=1;var u=0;for(h=this.length-1;h>=0&&(0!==u||h>=n);h--){var f=0|this.words[h];this.words[h]=u<<26-s|f>>>s,u=f&a}return c&&0!==u&&(c.words[c.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},s.prototype.shln=function(t){return this.clone().ishln(t)},s.prototype.ushln=function(t){return this.clone().iushln(t)},s.prototype.shrn=function(t){return this.clone().ishrn(t)},s.prototype.ushrn=function(t){return this.clone().iushrn(t)},s.prototype.testn=function(t){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,n=1<<e;return!(this.length<=r||!(this.words[r]&n))},s.prototype.imaskn=function(t){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var n=67108863^67108863>>>e<<e;this.words[this.length-1]&=n}return this.strip()},s.prototype.maskn=function(t){return this.clone().imaskn(t)},s.prototype.iaddn=function(t){return i("number"==typeof t),i(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},s.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},s.prototype.isubn=function(t){if(i("number"==typeof t),i(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},s.prototype.addn=function(t){return this.clone().iaddn(t)},s.prototype.subn=function(t){return this.clone().isubn(t)},s.prototype.iabs=function(){return this.negative=0,this},s.prototype.abs=function(){return this.clone().iabs()},s.prototype._ishlnsubmul=function(t,e,r){var n,s,o=t.length+r;this._expand(o);var a=0;for(n=0;n<t.length;n++){s=(0|this.words[n+r])+a;var c=(0|t.words[n])*e;a=((s-=67108863&c)>>26)-(c/67108864|0),this.words[n+r]=67108863&s}for(;n<this.length-r;n++)a=(s=(0|this.words[n+r])+a)>>26,this.words[n+r]=67108863&s;if(0===a)return this.strip();for(i(-1===a),a=0,n=0;n<this.length;n++)a=(s=-(0|this.words[n])+a)>>26,this.words[n]=67108863&s;return this.negative=1,this.strip()},s.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),n=t,o=0|n.words[n.length-1];0!=(r=26-this._countBits(o))&&(n=n.ushln(r),i.iushln(r),o=0|n.words[n.length-1]);var a,c=i.length-n.length;if("mod"!==e){(a=new s(null)).length=c+1,a.words=new Array(a.length);for(var h=0;h<a.length;h++)a.words[h]=0}var u=i.clone()._ishlnsubmul(n,1,c);0===u.negative&&(i=u,a&&(a.words[c]=1));for(var f=c-1;f>=0;f--){var d=67108864*(0|i.words[n.length+f])+(0|i.words[n.length+f-1]);for(d=Math.min(d/o|0,67108863),i._ishlnsubmul(n,d,f);0!==i.negative;)d--,i.negative=0,i._ishlnsubmul(n,1,f),i.isZero()||(i.negative^=1);a&&(a.words[f]=d)}return a&&a.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:a||null,mod:i}},s.prototype.divmod=function(t,e,r){return i(!t.isZero()),this.isZero()?{div:new s(0),mod:new s(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(n=a.div.neg()),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:n,mod:o}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(n=a.div.neg()),{div:n,mod:a.mod}):0!==(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:a.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new s(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new s(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new s(this.modn(t.words[0]))}:this._wordDiv(t,e);var n,o,a},s.prototype.div=function(t){return this.divmod(t,"div",!1).div},s.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},s.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},s.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),s=r.cmp(i);return s<0||1===n&&0===s?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},s.prototype.modn=function(t){i(t<=67108863);for(var e=(1<<26)%t,r=0,n=this.length-1;n>=0;n--)r=(e*r+(0|this.words[n]))%t;return r},s.prototype.idivn=function(t){i(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*e;this.words[r]=n/t|0,e=n%t}return this.strip()},s.prototype.divn=function(t){return this.clone().idivn(t)},s.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new s(1),o=new s(0),a=new s(0),c=new s(1),h=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++h;for(var u=r.clone(),f=e.clone();!e.isZero();){for(var d=0,l=1;0===(e.words[0]&l)&&d<26;++d,l<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(u),o.isub(f)),n.iushrn(1),o.iushrn(1);for(var p=0,g=1;0===(r.words[0]&g)&&p<26;++p,g<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||c.isOdd())&&(a.iadd(u),c.isub(f)),a.iushrn(1),c.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(a),o.isub(c)):(r.isub(e),a.isub(n),c.isub(o))}return{a,b:c,gcd:r.iushln(h)}},s.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,o=new s(1),a=new s(0),c=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var h=0,u=1;0===(e.words[0]&u)&&h<26;++h,u<<=1);if(h>0)for(e.iushrn(h);h-- >0;)o.isOdd()&&o.iadd(c),o.iushrn(1);for(var f=0,d=1;0===(r.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(r.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(a)):(r.isub(e),a.isub(o))}return(n=0===e.cmpn(1)?o:a).cmpn(0)<0&&n.iadd(t),n},s.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var s=e;e=r,r=s}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},s.prototype.invm=function(t){return this.egcd(t).a.umod(t)},s.prototype.isEven=function(){return!(1&this.words[0])},s.prototype.isOdd=function(){return!(1&~this.words[0])},s.prototype.andln=function(t){return this.words[0]&t},s.prototype.bincn=function(t){i("number"==typeof t);var e=t%26,r=(t-e)/26,n=1<<e;if(this.length<=r)return this._expand(r+1),this.words[r]|=n,this;for(var s=n,o=r;0!==s&&o<this.length;o++){var a=0|this.words[o];s=(a+=s)>>>26,a&=67108863,this.words[o]=a}return 0!==s&&(this.words[o]=s,this.length++),this},s.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},s.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:n<t?-1:1}return 0!==this.negative?0|-e:e},s.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},s.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){i<n?e=-1:i>n&&(e=1);break}}return e},s.prototype.gtn=function(t){return 1===this.cmpn(t)},s.prototype.gt=function(t){return 1===this.cmp(t)},s.prototype.gten=function(t){return this.cmpn(t)>=0},s.prototype.gte=function(t){return this.cmp(t)>=0},s.prototype.ltn=function(t){return-1===this.cmpn(t)},s.prototype.lt=function(t){return-1===this.cmp(t)},s.prototype.lten=function(t){return this.cmpn(t)<=0},s.prototype.lte=function(t){return this.cmp(t)<=0},s.prototype.eqn=function(t){return 0===this.cmpn(t)},s.prototype.eq=function(t){return 0===this.cmp(t)},s.red=function(t){return new M(t)},s.prototype.toRed=function(t){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},s.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(t){return this.red=t,this},s.prototype.forceRed=function(t){return i(!this.red,"Already a number in reduction context"),this._forceRed(t)},s.prototype.redAdd=function(t){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},s.prototype.redIAdd=function(t){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},s.prototype.redSub=function(t){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},s.prototype.redISub=function(t){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},s.prototype.redShl=function(t){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},s.prototype.redMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},s.prototype.redIMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},s.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(t){return i(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var b={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new s(e,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function A(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(t){if("string"==typeof t){var e=s._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function E(t){M.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new s(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)}v.prototype._tmp=function(){var t=new s(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},n(y,v),y.prototype.split=function(t,e){for(var r=4194303,i=Math.min(t.length,9),n=0;n<i;n++)e.words[n]=t.words[n];if(e.length=i,t.length<=9)return t.words[0]=0,void(t.length=1);var s=t.words[9];for(e.words[e.length++]=s&r,n=10;n<t.length;n++){var o=0|t.words[n];t.words[n-10]=(o&r)<<4|s>>>22,s=o}s>>>=22,t.words[n-10]=s,0===s&&t.length>10?t.length-=10:t.length-=9},y.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var i=0|t.words[r];e+=977*i,t.words[r]=67108863&e,e=64*i+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},n(w,v),n(_,v),n(A,v),A.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var i=19*(0|t.words[r])+e,n=67108863&i;i>>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},s._prime=function(t){if(b[t])return b[t];var e;if("k256"===t)e=new y;else if("p224"===t)e=new w;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new A}return b[t]=e,e},M.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},M.prototype._verify2=function(t,e){i(0===(t.negative|e.negative),"red works only with positives"),i(t.red&&t.red===e.red,"red works only with red numbers")},M.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},M.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},M.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},M.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},M.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},M.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},M.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},M.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},M.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},M.prototype.isqr=function(t){return this.imul(t,t.clone())},M.prototype.sqr=function(t){return this.mul(t,t)},M.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new s(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);i(!n.isZero());var a=new s(1).toRed(this),c=a.redNeg(),h=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new s(2*u*u).toRed(this);0!==this.pow(u,h).cmp(c);)u.redIAdd(c);for(var f=this.pow(u,n),d=this.pow(t,n.addn(1).iushrn(1)),l=this.pow(t,n),p=o;0!==l.cmp(a);){for(var g=l,m=0;0!==g.cmp(a);m++)g=g.redSqr();i(m<p);var b=this.pow(f,new s(1).iushln(p-m-1));d=d.redMul(b),f=b.redSqr(),l=l.redMul(f),p=m}return d},M.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},M.prototype.pow=function(t,e){if(e.isZero())return new s(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new s(1).toRed(this),r[1]=t;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],t);var n=r[0],o=0,a=0,c=e.bitLength()%26;for(0===c&&(c=26),i=e.length-1;i>=0;i--){for(var h=e.words[i],u=c-1;u>=0;u--){var f=h>>u&1;n!==r[0]&&(n=this.sqr(n)),0!==f||0!==o?(o<<=1,o|=f,(4===++a||0===i&&0===u)&&(n=this.mul(n,r[o]),a=0,o=0)):a=0}c=26}return n},M.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},M.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},s.mont=function(t){return new E(t)},n(E,M),E.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},E.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},E.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),s=n;return n.cmp(this.m)>=0?s=n.isub(this.m):n.cmpn(0)<0&&(s=n.iadd(this.m)),s._forceRed(this)},E.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new s(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},E.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},85580:(t,e,r)=>{var i=r(49899),n=r(79188),s=r(35615),o=r(74893),a=i.assert;function c(t){o.call(this,"short",t),this.a=new n(t.a,16).toRed(this.red),this.b=new n(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function h(t,e,r,i){o.BasePoint.call(this,t,"affine"),null===e&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new n(e,16),this.y=new n(r,16),i&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function u(t,e,r,i){o.BasePoint.call(this,t,"jacobian"),null===e&&null===r&&null===i?(this.x=this.curve.one,this.y=this.curve.one,this.z=new n(0)):(this.x=new n(e,16),this.y=new n(r,16),this.z=new n(i,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}s(c,o),t.exports=c,c.prototype._getEndomorphism=function(t){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var e,r;if(t.beta)e=new n(t.beta,16).toRed(this.red);else{var i=this._getEndoRoots(this.p);e=(e=i[0].cmp(i[1])<0?i[0]:i[1]).toRed(this.red)}if(t.lambda)r=new n(t.lambda,16);else{var s=this._getEndoRoots(this.n);0===this.g.mul(s[0]).x.cmp(this.g.x.redMul(e))?r=s[0]:(r=s[1],a(0===this.g.mul(r).x.cmp(this.g.x.redMul(e))))}return{beta:e,lambda:r,basis:t.basis?t.basis.map((function(t){return{a:new n(t.a,16),b:new n(t.b,16)}})):this._getEndoBasis(r)}}},c.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:n.mont(t),r=new n(2).toRed(e).redInvm(),i=r.redNeg(),s=new n(3).toRed(e).redNeg().redSqrt().redMul(r);return[i.redAdd(s).fromRed(),i.redSub(s).fromRed()]},c.prototype._getEndoBasis=function(t){for(var e,r,i,s,o,a,c,h,u,f=this.n.ushrn(Math.floor(this.n.bitLength()/2)),d=t,l=this.n.clone(),p=new n(1),g=new n(0),m=new n(0),b=new n(1),v=0;0!==d.cmpn(0);){var y=l.div(d);h=l.sub(y.mul(d)),u=m.sub(y.mul(p));var w=b.sub(y.mul(g));if(!i&&h.cmp(f)<0)e=c.neg(),r=p,i=h.neg(),s=u;else if(i&&2===++v)break;c=h,l=d,d=h,m=p,p=u,b=g,g=w}o=h.neg(),a=u;var _=i.sqr().add(s.sqr());return o.sqr().add(a.sqr()).cmp(_)>=0&&(o=e,a=r),i.negative&&(i=i.neg(),s=s.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:i,b:s},{a:o,b:a}]},c.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],i=e[1],n=i.b.mul(t).divRound(this.n),s=r.b.neg().mul(t).divRound(this.n),o=n.mul(r.a),a=s.mul(i.a),c=n.mul(r.b),h=s.mul(i.b);return{k1:t.sub(o).sub(a),k2:c.add(h).neg()}},c.prototype.pointFromX=function(t,e){(t=new n(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),i=r.redSqrt();if(0!==i.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var s=i.fromRed().isOdd();return(e&&!s||!e&&s)&&(i=i.redNeg()),this.point(t,i)},c.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,i=this.a.redMul(e),n=e.redSqr().redMul(e).redIAdd(i).redIAdd(this.b);return 0===r.redSqr().redISub(n).cmpn(0)},c.prototype._endoWnafMulAdd=function(t,e,r){for(var i=this._endoWnafT1,n=this._endoWnafT2,s=0;s<t.length;s++){var o=this._endoSplit(e[s]),a=t[s],c=a._getBeta();o.k1.negative&&(o.k1.ineg(),a=a.neg(!0)),o.k2.negative&&(o.k2.ineg(),c=c.neg(!0)),i[2*s]=a,i[2*s+1]=c,n[2*s]=o.k1,n[2*s+1]=o.k2}for(var h=this._wnafMulAdd(1,i,n,2*s,r),u=0;u<2*s;u++)i[u]=null,n[u]=null;return h},s(h,o.BasePoint),c.prototype.point=function(t,e,r){return new h(this,t,e,r)},c.prototype.pointFromJSON=function(t,e){return h.fromJSON(this,t,e)},h.prototype._getBeta=function(){if(this.curve.endo){var t=this.precomputed;if(t&&t.beta)return t.beta;var e=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(t){var r=this.curve,i=function(t){return r.point(t.x.redMul(r.endo.beta),t.y)};t.beta=e,e.precomputed={beta:null,naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(i)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(i)}}}return e}},h.prototype.toJSON=function(){return this.precomputed?[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)}}]:[this.x,this.y]},h.fromJSON=function(t,e,r){"string"==typeof e&&(e=JSON.parse(e));var i=t.point(e[0],e[1],r);if(!e[2])return i;function n(e){return t.point(e[0],e[1],r)}var s=e[2];return i.precomputed={beta:null,doubles:s.doubles&&{step:s.doubles.step,points:[i].concat(s.doubles.points.map(n))},naf:s.naf&&{wnd:s.naf.wnd,points:[i].concat(s.naf.points.map(n))}},i},h.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},h.prototype.isInfinity=function(){return this.inf},h.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),i=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,i)},h.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),i=t.redInvm(),n=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(i),s=n.redSqr().redISub(this.x.redAdd(this.x)),o=n.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,o)},h.prototype.getX=function(){return this.x.fromRed()},h.prototype.getY=function(){return this.y.fromRed()},h.prototype.mul=function(t){return t=new n(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},h.prototype.mulAdd=function(t,e,r){var i=[this,e],n=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n):this.curve._wnafMulAdd(1,i,n,2)},h.prototype.jmulAdd=function(t,e,r){var i=[this,e],n=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n,!0):this.curve._wnafMulAdd(1,i,n,2,!0)},h.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},h.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,i=function(t){return t.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(i)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(i)}}}return e},h.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},s(u,o.BasePoint),c.prototype.jpoint=function(t,e,r){return new u(this,t,e,r)},u.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),i=this.y.redMul(e).redMul(t);return this.curve.point(r,i)},u.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},u.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),i=this.x.redMul(e),n=t.x.redMul(r),s=this.y.redMul(e.redMul(t.z)),o=t.y.redMul(r.redMul(this.z)),a=i.redSub(n),c=s.redSub(o);if(0===a.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var h=a.redSqr(),u=h.redMul(a),f=i.redMul(h),d=c.redSqr().redIAdd(u).redISub(f).redISub(f),l=c.redMul(f.redISub(d)).redISub(s.redMul(u)),p=this.z.redMul(t.z).redMul(a);return this.curve.jpoint(d,l,p)},u.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,i=t.x.redMul(e),n=this.y,s=t.y.redMul(e).redMul(this.z),o=r.redSub(i),a=n.redSub(s);if(0===o.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=o.redSqr(),h=c.redMul(o),u=r.redMul(c),f=a.redSqr().redIAdd(h).redISub(u).redISub(u),d=a.redMul(u.redISub(f)).redISub(n.redMul(h)),l=this.z.redMul(o);return this.curve.jpoint(f,d,l)},u.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var r=this;for(e=0;e<t;e++)r=r.dbl();return r}var i=this.curve.a,n=this.curve.tinv,s=this.x,o=this.y,a=this.z,c=a.redSqr().redSqr(),h=o.redAdd(o);for(e=0;e<t;e++){var u=s.redSqr(),f=h.redSqr(),d=f.redSqr(),l=u.redAdd(u).redIAdd(u).redIAdd(i.redMul(c)),p=s.redMul(f),g=l.redSqr().redISub(p.redAdd(p)),m=p.redISub(g),b=l.redMul(m);b=b.redIAdd(b).redISub(d);var v=h.redMul(a);e+1<t&&(c=c.redMul(d)),s=g,a=v,h=b}return this.curve.jpoint(s,h.redMul(n),a)},u.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},u.prototype._zeroDbl=function(){var t,e,r;if(this.zOne){var i=this.x.redSqr(),n=this.y.redSqr(),s=n.redSqr(),o=this.x.redAdd(n).redSqr().redISub(i).redISub(s);o=o.redIAdd(o);var a=i.redAdd(i).redIAdd(i),c=a.redSqr().redISub(o).redISub(o),h=s.redIAdd(s);h=(h=h.redIAdd(h)).redIAdd(h),t=c,e=a.redMul(o.redISub(c)).redISub(h),r=this.y.redAdd(this.y)}else{var u=this.x.redSqr(),f=this.y.redSqr(),d=f.redSqr(),l=this.x.redAdd(f).redSqr().redISub(u).redISub(d);l=l.redIAdd(l);var p=u.redAdd(u).redIAdd(u),g=p.redSqr(),m=d.redIAdd(d);m=(m=m.redIAdd(m)).redIAdd(m),t=g.redISub(l).redISub(l),e=p.redMul(l.redISub(t)).redISub(m),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(t,e,r)},u.prototype._threeDbl=function(){var t,e,r;if(this.zOne){var i=this.x.redSqr(),n=this.y.redSqr(),s=n.redSqr(),o=this.x.redAdd(n).redSqr().redISub(i).redISub(s);o=o.redIAdd(o);var a=i.redAdd(i).redIAdd(i).redIAdd(this.curve.a),c=a.redSqr().redISub(o).redISub(o);t=c;var h=s.redIAdd(s);h=(h=h.redIAdd(h)).redIAdd(h),e=a.redMul(o.redISub(c)).redISub(h),r=this.y.redAdd(this.y)}else{var u=this.z.redSqr(),f=this.y.redSqr(),d=this.x.redMul(f),l=this.x.redSub(u).redMul(this.x.redAdd(u));l=l.redAdd(l).redIAdd(l);var p=d.redIAdd(d),g=(p=p.redIAdd(p)).redAdd(p);t=l.redSqr().redISub(g),r=this.y.redAdd(this.z).redSqr().redISub(f).redISub(u);var m=f.redSqr();m=(m=(m=m.redIAdd(m)).redIAdd(m)).redIAdd(m),e=l.redMul(p.redISub(t)).redISub(m)}return this.curve.jpoint(t,e,r)},u.prototype._dbl=function(){var t=this.curve.a,e=this.x,r=this.y,i=this.z,n=i.redSqr().redSqr(),s=e.redSqr(),o=r.redSqr(),a=s.redAdd(s).redIAdd(s).redIAdd(t.redMul(n)),c=e.redAdd(e),h=(c=c.redIAdd(c)).redMul(o),u=a.redSqr().redISub(h.redAdd(h)),f=h.redISub(u),d=o.redSqr();d=(d=(d=d.redIAdd(d)).redIAdd(d)).redIAdd(d);var l=a.redMul(f).redISub(d),p=r.redAdd(r).redMul(i);return this.curve.jpoint(u,l,p)},u.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr(),i=e.redSqr(),n=t.redAdd(t).redIAdd(t),s=n.redSqr(),o=this.x.redAdd(e).redSqr().redISub(t).redISub(i),a=(o=(o=(o=o.redIAdd(o)).redAdd(o).redIAdd(o)).redISub(s)).redSqr(),c=i.redIAdd(i);c=(c=(c=c.redIAdd(c)).redIAdd(c)).redIAdd(c);var h=n.redIAdd(o).redSqr().redISub(s).redISub(a).redISub(c),u=e.redMul(h);u=(u=u.redIAdd(u)).redIAdd(u);var f=this.x.redMul(a).redISub(u);f=(f=f.redIAdd(f)).redIAdd(f);var d=this.y.redMul(h.redMul(c.redISub(h)).redISub(o.redMul(a)));d=(d=(d=d.redIAdd(d)).redIAdd(d)).redIAdd(d);var l=this.z.redAdd(o).redSqr().redISub(r).redISub(a);return this.curve.jpoint(f,d,l)},u.prototype.mul=function(t,e){return t=new n(t,e),this.curve._wnafMul(this,t)},u.prototype.eq=function(t){if("affine"===t.type)return this.eq(t.toJ());if(this===t)return!0;var e=this.z.redSqr(),r=t.z.redSqr();if(0!==this.x.redMul(r).redISub(t.x.redMul(e)).cmpn(0))return!1;var i=e.redMul(this.z),n=r.redMul(t.z);return 0===this.y.redMul(n).redISub(t.y.redMul(i)).cmpn(0)},u.prototype.eqXToP=function(t){var e=this.z.redSqr(),r=t.toRed(this.curve.red).redMul(e);if(0===this.x.cmp(r))return!0;for(var i=t.clone(),n=this.curve.redN.redMul(e);;){if(i.iadd(this.curve.n),i.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(n),0===this.x.cmp(r))return!0}},u.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},u.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},88483:t=>{t.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"]]}}},88605:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isSerializableHash=function(t){return void 0!==t.saveState&&void 0!==t.restoreState&&void 0!==t.cleanSavedState}},90028:t=>{t.exports=function(t,e){for(var r={},i=Object.keys(t),n=Array.isArray(e),s=0;s<i.length;s++){var o=i[s],a=t[o];(n?-1!==e.indexOf(o):e(o,a,t))&&(r[o]=a)}return r}},91311:(t,e,r)=>{var i=r(63447),n=r(38767);e.On=32,e.cS=64;var s=function(){function t(){this.digestLength=e.On,this.blockSize=e.cS,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return t.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},t.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},t.prototype.clean=function(){n.wipe(this._buffer),n.wipe(this._temp),this.reset()},t.prototype.update=function(t,e){if(void 0===e&&(e=t.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var r=0;if(this._bytesHashed+=e,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&e>0;)this._buffer[this._bufferLength++]=t[r++],e--;this._bufferLength===this.blockSize&&(a(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(e>=this.blockSize&&(r=a(this._temp,this._state,t,r,e),e%=this.blockSize);e>0;)this._buffer[this._bufferLength++]=t[r++],e--;return this},t.prototype.finish=function(t){if(!this._finished){var e=this._bytesHashed,r=this._bufferLength,n=e/536870912|0,s=e<<3,o=e%64<56?64:128;this._buffer[r]=128;for(var c=r+1;c<o-8;c++)this._buffer[c]=0;i.writeUint32BE(n,this._buffer,o-8),i.writeUint32BE(s,this._buffer,o-4),a(this._temp,this._state,this._buffer,0,o),this._finished=!0}for(c=0;c<this.digestLength/4;c++)i.writeUint32BE(this._state[c],t,4*c);return this},t.prototype.digest=function(){var t=new Uint8Array(this.digestLength);return this.finish(t),t},t.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{state:new Int32Array(this._state),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},t.prototype.restoreState=function(t){return this._state.set(t.state),this._bufferLength=t.bufferLength,t.buffer&&this._buffer.set(t.buffer),this._bytesHashed=t.bytesHashed,this._finished=!1,this},t.prototype.cleanSavedState=function(t){n.wipe(t.state),t.buffer&&n.wipe(t.buffer),t.bufferLength=0,t.bytesHashed=0},t}();e.aD=s;var o=new Int32Array([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 a(t,e,r,n,s){for(;s>=64;){for(var a=e[0],c=e[1],h=e[2],u=e[3],f=e[4],d=e[5],l=e[6],p=e[7],g=0;g<16;g++){var m=n+4*g;t[g]=i.readUint32BE(r,m)}for(g=16;g<64;g++){var b=t[g-2],v=(b>>>17|b<<15)^(b>>>19|b<<13)^b>>>10,y=((b=t[g-15])>>>7|b<<25)^(b>>>18|b<<14)^b>>>3;t[g]=(v+t[g-7]|0)+(y+t[g-16]|0)}for(g=0;g<64;g++)v=(((f>>>6|f<<26)^(f>>>11|f<<21)^(f>>>25|f<<7))+(f&d^~f&l)|0)+(p+(o[g]+t[g]|0)|0)|0,y=((a>>>2|a<<30)^(a>>>13|a<<19)^(a>>>22|a<<10))+(a&c^a&h^c&h)|0,p=l,l=d,d=f,f=u+v|0,u=h,h=c,c=a,a=v+y|0;e[0]+=a,e[1]+=c,e[2]+=h,e[3]+=u,e[4]+=f,e[5]+=d,e[6]+=l,e[7]+=p,n+=64,s-=64}return n}e.tW=function(t){var e=new s;e.update(t);var r=e.digest();return e.clean(),r}},96411:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.mul=Math.imul||function(t,e){var r=65535&t,i=65535&e;return r*i+((t>>>16&65535)*i+r*(e>>>16&65535)<<16>>>0)|0},e.add=function(t,e){return t+e|0},e.sub=function(t,e){return t-e|0},e.rotl=function(t,e){return t<<e|t>>>32-e},e.rotr=function(t,e){return t<<32-e|t>>>e},e.isInteger=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t},e.MAX_SAFE_INTEGER=9007199254740991,e.isSafeInteger=function(t){return e.isInteger(t)&&t>=-e.MAX_SAFE_INTEGER&&t<=e.MAX_SAFE_INTEGER}}};