>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(w[e])return w[e];var t;if("k256"===e)t=new k;else if("p224"===e)t=new E;else if("p192"===e)t=new _;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new A}return w[e]=t,t},S.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},S.prototype._verify2=function(e,t){r(0===(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},S.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(l(e,e.umod(this.m)._forceRed(this)),e)},S.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},S.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},S.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},S.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},S.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},S.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},S.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},S.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},S.prototype.isqr=function(e){return this.imul(e,e.clone())},S.prototype.sqr=function(e){return this.mul(e,e)},S.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2===1),3===t){var n=this.m.add(new o(1)).iushrn(2);return this.pow(e,n)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);r(!i.isZero());var s=new o(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,c).cmp(u);)l.redIAdd(u);for(var f=this.pow(l,i),h=this.pow(e,i.addn(1).iushrn(1)),d=this.pow(e,i),p=a;0!==d.cmp(s);){for(var v=d,m=0;0!==v.cmp(s);m++)v=v.redSqr();r(m=0;r--){for(var c=t.words[r],l=u-1;l>=0;l--){var f=c>>l&1;i!==n[0]&&(i=this.sqr(i)),0!==f||0!==a?(a<<=1,a|=f,(4===++s||0===r&&0===l)&&(i=this.mul(i,n[a]),s=0,a=0)):s=0}u=26}return i},S.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},S.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new O(e)},i(O,S),O.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},O.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},O.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},O.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},O.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=n.nmd(e),this)},49716:function(e,t,n){"use strict";n.r(t),n.d(t,{arrayify:function(){return c},concat:function(){return l},hexConcat:function(){return g},hexDataLength:function(){return m},hexDataSlice:function(){return y},hexStripZeros:function(){return w},hexValue:function(){return b},hexZeroPad:function(){return x},hexlify:function(){return v},isBytes:function(){return u},isBytesLike:function(){return a},isHexString:function(){return d},joinSignature:function(){return E},splitSignature:function(){return k},stripZeros:function(){return f},zeroPad:function(){return h}});var r=new(n(39502).Logger)("bytes/5.7.0");function i(e){return!!e.toHexString}function o(e){return e.slice||(e.slice=function(){var t=Array.prototype.slice.call(arguments);return o(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function a(e){return d(e)&&!(e.length%2)||u(e)}function s(e){return"number"===typeof e&&e==e&&e%1===0}function u(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"===typeof e)return!1;if(!s(e.length)||e.length<0)return!1;for(var t=0;t=256)return!1}return!0}function c(e,t){if(t||(t={}),"number"===typeof e){r.checkSafeUint53(e,"invalid arrayify value");for(var n=[];e;)n.unshift(255&e),e=parseInt(String(e/256));return 0===n.length&&n.push(0),o(new Uint8Array(n))}if(t.allowMissingPrefix&&"string"===typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),i(e)&&(e=e.toHexString()),d(e)){var a=e.substring(2);a.length%2&&("left"===t.hexPad?a="0"+a:"right"===t.hexPad?a+="0":r.throwArgumentError("hex data is odd-length","value",e));for(var s=[],c=0;ct&&r.throwArgumentError("value out of range","value",arguments[0]);var n=new Uint8Array(t);return n.set(e,t-e.length),o(n)}function d(e,t){return!("string"!==typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(!t||e.length===2+2*t)}var p="0123456789abcdef";function v(e,t){if(t||(t={}),"number"===typeof e){r.checkSafeUint53(e,"invalid hexlify value");for(var n="";e;)n=p[15&e]+n,e=Math.floor(e/16);return n.length?(n.length%2&&(n="0"+n),"0x"+n):"0x00"}if("bigint"===typeof e)return(e=e.toString(16)).length%2?"0x0"+e:"0x"+e;if(t.allowMissingPrefix&&"string"===typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),i(e))return e.toHexString();if(d(e))return e.length%2&&("left"===t.hexPad?e="0x0"+e.substring(2):"right"===t.hexPad?e+="0":r.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(u(e)){for(var o="0x",a=0;a>4]+p[15&s]}return o}return r.throwArgumentError("invalid hexlify value","value",e)}function m(e){if("string"!==typeof e)e=v(e);else if(!d(e)||e.length%2)return null;return(e.length-2)/2}function y(e,t,n){return"string"!==typeof e?e=v(e):(!d(e)||e.length%2)&&r.throwArgumentError("invalid hexData","value",e),t=2+2*t,null!=n?"0x"+e.substring(t,2+2*n):"0x"+e.substring(t)}function g(e){var t="0x";return e.forEach((function(e){t+=v(e).substring(2)})),t}function b(e){var t=w(v(e,{hexPad:"left"}));return"0x"===t?"0x0":t}function w(e){"string"!==typeof e&&(e=v(e)),d(e)||r.throwArgumentError("invalid hex string","value",e),e=e.substring(2);for(var t=0;t2*t+2&&r.throwArgumentError("value out of range","value",arguments[1]);e.length<2*t+2;)e="0x0"+e.substring(2);return e}function k(e){var t={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(a(e)){var n=c(e);64===n.length?(t.v=27+(n[32]>>7),n[32]&=127,t.r=v(n.slice(0,32)),t.s=v(n.slice(32,64))):65===n.length?(t.r=v(n.slice(0,32)),t.s=v(n.slice(32,64)),t.v=n[64]):r.throwArgumentError("invalid signature string","signature",e),t.v<27&&(0===t.v||1===t.v?t.v+=27:r.throwArgumentError("signature invalid v byte","signature",e)),t.recoveryParam=1-t.v%2,t.recoveryParam&&(n[32]|=128),t._vs=v(n.slice(32,64))}else{if(t.r=e.r,t.s=e.s,t.v=e.v,t.recoveryParam=e.recoveryParam,t._vs=e._vs,null!=t._vs){var i=h(c(t._vs),32);t._vs=v(i);var o=i[0]>=128?1:0;null==t.recoveryParam?t.recoveryParam=o:t.recoveryParam!==o&&r.throwArgumentError("signature recoveryParam mismatch _vs","signature",e),i[0]&=127;var s=v(i);null==t.s?t.s=s:t.s!==s&&r.throwArgumentError("signature v mismatch _vs","signature",e)}if(null==t.recoveryParam)null==t.v?r.throwArgumentError("signature missing v and recoveryParam","signature",e):0===t.v||1===t.v?t.recoveryParam=t.v:t.recoveryParam=1-t.v%2;else if(null==t.v)t.v=27+t.recoveryParam;else{var u=0===t.v||1===t.v?t.v:1-t.v%2;t.recoveryParam!==u&&r.throwArgumentError("signature recoveryParam mismatch v","signature",e)}null!=t.r&&d(t.r)?t.r=x(t.r,32):r.throwArgumentError("signature missing or invalid r","signature",e),null!=t.s&&d(t.s)?t.s=x(t.s,32):r.throwArgumentError("signature missing or invalid s","signature",e);var l=c(t.s);l[0]>=128&&r.throwArgumentError("signature s out of range","signature",e),t.recoveryParam&&(l[0]|=128);var f=v(l);t._vs&&(d(t._vs)||r.throwArgumentError("signature invalid _vs","signature",e),t._vs=x(t._vs,32)),null==t._vs?t._vs=f:t._vs!==f&&r.throwArgumentError("signature _vs mismatch v and s","signature",e)}return t.yParityAndS=t._vs,t.compact=t.r+t.yParityAndS.substring(2),t}function E(e){return v(l([(e=k(e)).r,e.s,e.recoveryParam?"0x1c":"0x1b"]))}},75422:function(e,t,n){"use strict";n.d(t,{Bz:function(){return s},_Y:function(){return o},fh:function(){return a},tL:function(){return i}});var r=n(2257),i=r.O$.from(-1),o=r.O$.from(0),a=r.O$.from(1),s=r.O$.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")},84867:function(e,t,n){"use strict";n.d(t,{R:function(){return r}});var r="0x0000000000000000000000000000000000000000000000000000000000000000"},49366:function(e,t,n){"use strict";n.d(t,{i:function(){return r}});var r="hash/5.7.0"},51583:function(e,t,n){"use strict";n.d(t,{id:function(){return o}});var r=n(88062),i=n(83374);function o(e){return(0,r.keccak256)((0,i.Y0)(e))}},81049:function(e,t,n){"use strict";n.r(t),n.d(t,{_TypedDataEncoder:function(){return a.E},dnsEncode:function(){return i.Kn},ensNormalize:function(){return i.w3},hashMessage:function(){return o.r},id:function(){return r.id},isValidName:function(){return i.r1},messagePrefix:function(){return o.B},namehash:function(){return i.VM}});var r=n(51583),i=n(95235),o=n(2273),a=n(35992)},2273:function(e,t,n){"use strict";n.d(t,{B:function(){return a},r:function(){return s}});var r=n(49716),i=n(88062),o=n(83374),a="\x19Ethereum Signed Message:\n";function s(e){return"string"===typeof e&&(e=(0,o.Y0)(e)),(0,i.keccak256)((0,r.concat)([(0,o.Y0)(a),(0,o.Y0)(String(e.length)),e]))}},95235:function(e,t,n){"use strict";n.d(t,{Kn:function(){return L},w3:function(){return R},r1:function(){return B},VM:function(){return D}});var r=n(49716),i=n(83374),o=n(88062),a=n(39502),s=n(49366),u=n(93433),c=n(37762);function l(e,t){null==t&&(t=1);var n=[],r=n.forEach;return function e(t,i){r.call(t,(function(t){i>0&&Array.isArray(t)?e(t,i-1):n.push(t)}))}(e,t),n}function f(e){return function(e){var t=0;return function(){return e[t++]}}(function(e){var t=0;function n(){return e[t++]<<8|e[t++]}for(var r=n(),i=1,o=[0,1],a=1;a>--c&1}for(var h=Math.pow(2,31),d=h>>>1,p=d>>1,v=h-1,m=0,y=0;y<31;y++)m=m<<1|f();for(var g=[],b=0,w=h;;){for(var x=Math.floor(((m-b+1)*i-1)/w),k=0,E=r;E-k>1;){var _=k+E>>>1;x>>1|f(),A=A<<1^d,S=(S^d)<<1|d|1;b=A,w=1+S-A}var O=r-4;return g.map((function(t){switch(t-O){case 3:return O+65792+(e[u++]<<16|e[u++]<<8|e[u++]);case 2:return O+256+(e[u++]<<8|e[u++]);case 1:return O+e[u++];default:return t-1}}))}(e))}function h(e){return 1&e?~e>>1:e>>1}function d(e,t){for(var n=Array(e),r=0,i=-1;r>=1),check:2==o}}()}(b),_=45,A=95;function S(e){return(0,i.XL)(e)}function O(e){return e.filter((function(e){return 65039!=e}))}function M(e){var t,n=(0,c.Z)(e.split("."));try{for(n.s();!(t=n.n()).done;){var r=t.value,i=S(r);try{for(var o=i.lastIndexOf(A)-1;o>=0;o--)if(i[o]!==A)throw new Error("underscore only allowed at start");if(i.length>=4&&i.every((function(e){return e<128}))&&i[2]===_&&i[3]===_)throw new Error("invalid label extension")}catch(a){throw new Error('Invalid label "'.concat(r,'": ').concat(a.message))}}}catch(a){n.e(a)}finally{n.f()}return e}function C(e){return M(function(e,t){var n=S(e).reverse(),r=[];for(;n.length;){var i=P(n);if(i)r.push.apply(r,(0,u.Z)(t(i)));else{var o=n.pop();if(w.has(o))r.push(o);else if(!x.has(o)){var a=k[o];if(!a)throw new Error("Disallowed codepoint: 0x".concat(o.toString(16).toUpperCase()));r.push.apply(r,(0,u.Z)(a))}}}return M(function(e){return e.normalize("NFC")}(String.fromCodePoint.apply(String,r)))}(e,O))}function P(e,t){var n,r,i,o=E,a=[],s=e.length;t&&(t.length=0);for(var c=function(){var c=e[--s];if(!(o=null===(n=o.branches.find((function(e){return e.set.has(c)})))||void 0===n?void 0:n.node))return 0;if(o.save)i=c;else if(o.check&&c===i)return 0;a.push(c),o.fe0f&&(a.push(65039),s>0&&65039==e[s-1]&&s--),o.valid&&(r=a.slice(),2==o.valid&&r.splice(1,1),t&&t.push.apply(t,(0,u.Z)(e.slice(s).reverse())),e.length=s)};s&&0!==c(););return r}var T=new a.Logger(s.i),j=new Uint8Array(32);function I(e){if(0===e.length)throw new Error("invalid ENS name; empty component");return e}function N(e){var t=(0,i.Y0)(C(e)),n=[];if(0===e.length)return n;for(var r=0,o=0;o=t.length)throw new Error("invalid ENS name; empty component");return n.push(I(t.slice(r))),n}function R(e){return N(e).map((function(e){return(0,i.ZN)(e)})).join(".")}function B(e){try{return 0!==N(e).length}catch(t){}return!1}function D(e){"string"!==typeof e&&T.throwArgumentError("invalid ENS name; not a string","name",e);for(var t=j,n=N(e);n.length;)t=(0,o.keccak256)((0,r.concat)([t,(0,o.keccak256)(n.pop())]));return(0,r.hexlify)(t)}function L(e){return(0,r.hexlify)((0,r.concat)(N(e).map((function(e){if(e.length>63)throw new Error("invalid DNS encoded entry; length exceeds 63 bytes");var t=new Uint8Array(e.length+1);return t.set(e,1),t[0]=t.length-1,t}))))+"00"}j.fill(0)},35992:function(e,t,n){"use strict";n.d(t,{E:function(){return C}});var r=n(74165),i=n(15671),o=n(43144),a=n(97419),s=n(2257),u=n(49716),c=n(88062),l=n(30520),f=n(39502),h=n(49366),d=n(51583),p=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(t){o(t)}}function s(e){try{u(r.throw(e))}catch(t){o(t)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))},v=new f.Logger(h.i),m=new Uint8Array(32);m.fill(0);var y=s.O$.from(-1),g=s.O$.from(0),b=s.O$.from(1),w=s.O$.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var x=(0,u.hexZeroPad)(b.toHexString(),32),k=(0,u.hexZeroPad)(g.toHexString(),32),E={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},_=["name","version","chainId","verifyingContract","salt"];function A(e){return function(t){return"string"!==typeof t&&v.throwArgumentError("invalid domain value for ".concat(JSON.stringify(e)),"domain.".concat(e),t),t}}var S={name:A("name"),version:A("version"),chainId:function(e){try{return s.O$.from(e).toString()}catch(t){}return v.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",e)},verifyingContract:function(e){try{return(0,a.getAddress)(e).toLowerCase()}catch(t){}return v.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",e)},salt:function(e){try{var t=(0,u.arrayify)(e);if(32!==t.length)throw new Error("bad length");return(0,u.hexlify)(t)}catch(n){}return v.throwArgumentError('invalid domain value "salt"',"domain.salt",e)}};function O(e){var t=e.match(/^(u?)int(\d*)$/);if(t){var n=""===t[1],r=parseInt(t[2]||"256");(r%8!==0||r>256||t[2]&&t[2]!==String(r))&&v.throwArgumentError("invalid numeric width","type",e);var i=w.mask(n?r-1:r),o=n?i.add(b).mul(y):g;return function(t){var n=s.O$.from(t);return(n.lt(o)||n.gt(i))&&v.throwArgumentError("value out-of-bounds for ".concat(e),"value",t),(0,u.hexZeroPad)(n.toTwos(256).toHexString(),32)}}var l=e.match(/^bytes(\d+)$/);if(l){var f=parseInt(l[1]);return(0===f||f>32||l[1]!==String(f))&&v.throwArgumentError("invalid bytes width","type",e),function(t){return(0,u.arrayify)(t).length!==f&&v.throwArgumentError("invalid length for ".concat(e),"value",t),function(e){var t=(0,u.arrayify)(e),n=t.length%32;return n?(0,u.hexConcat)([t,m.slice(n)]):(0,u.hexlify)(t)}(t)}}switch(e){case"address":return function(e){return(0,u.hexZeroPad)((0,a.getAddress)(e),32)};case"bool":return function(e){return e?x:k};case"bytes":return function(e){return(0,c.keccak256)(e)};case"string":return function(e){return(0,d.id)(e)}}return null}function M(e,t){return"".concat(e,"(").concat(t.map((function(e){var t=e.name;return e.type+" "+t})).join(","),")")}var C=function(){function e(t){(0,i.Z)(this,e),(0,l.defineReadOnly)(this,"types",Object.freeze((0,l.deepCopy)(t))),(0,l.defineReadOnly)(this,"_encoderCache",{}),(0,l.defineReadOnly)(this,"_types",{});var n={},r={},o={};Object.keys(t).forEach((function(e){n[e]={},r[e]=[],o[e]={}}));var a=function(e){var i={};t[e].forEach((function(o){i[o.name]&&v.throwArgumentError("duplicate variable name ".concat(JSON.stringify(o.name)," in ").concat(JSON.stringify(e)),"types",t),i[o.name]=!0;var a=o.type.match(/^([^\x5b]*)(\x5b|$)/)[1];a===e&&v.throwArgumentError("circular type reference to ".concat(JSON.stringify(a)),"types",t),O(a)||(r[a]||v.throwArgumentError("unknown type ".concat(JSON.stringify(a)),"types",t),r[a].push(e),n[e][a]=!0)}))};for(var s in t)a(s);var u=Object.keys(r).filter((function(e){return 0===r[e].length}));for(var c in 0===u.length?v.throwArgumentError("missing primary type","types",t):u.length>1&&v.throwArgumentError("ambiguous primary types or unused types: ".concat(u.map((function(e){return JSON.stringify(e)})).join(", ")),"types",t),(0,l.defineReadOnly)(this,"primaryType",u[0]),function e(i,a){a[i]&&v.throwArgumentError("circular type reference to ".concat(JSON.stringify(i)),"types",t),a[i]=!0,Object.keys(n[i]).forEach((function(t){r[t]&&(e(t,a),Object.keys(a).forEach((function(e){o[e][t]=!0})))})),delete a[i]}(this.primaryType,{}),o){var f=Object.keys(o[c]);f.sort(),this._types[c]=M(c,t[c])+f.map((function(e){return M(e,t[e])})).join("")}}return(0,o.Z)(e,[{key:"getEncoder",value:function(e){var t=this._encoderCache[e];return t||(t=this._encoderCache[e]=this._getEncoder(e)),t}},{key:"_getEncoder",value:function(e){var t=this,n=O(e);if(n)return n;var r=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(r){var i=r[1],o=this.getEncoder(i),a=parseInt(r[3]);return function(e){a>=0&&e.length!==a&&v.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e);var n=e.map(o);return t._types[i]&&(n=n.map(c.keccak256)),(0,c.keccak256)((0,u.hexConcat)(n))}}var s=this.types[e];if(s){var l=(0,d.id)(this._types[e]);return function(e){var n=s.map((function(n){var r=n.name,i=n.type,o=t.getEncoder(i)(e[r]);return t._types[i]?(0,c.keccak256)(o):o}));return n.unshift(l),(0,u.hexConcat)(n)}}return v.throwArgumentError("unknown type: ".concat(e),"type",e)}},{key:"encodeType",value:function(e){var t=this._types[e];return t||v.throwArgumentError("unknown type: ".concat(JSON.stringify(e)),"name",e),t}},{key:"encodeData",value:function(e,t){return this.getEncoder(e)(t)}},{key:"hashStruct",value:function(e,t){return(0,c.keccak256)(this.encodeData(e,t))}},{key:"encode",value:function(e){return this.encodeData(this.primaryType,e)}},{key:"hash",value:function(e){return this.hashStruct(this.primaryType,e)}},{key:"_visit",value:function(e,t,n){var r=this;if(O(e))return n(e,t);var i=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(i){var o=i[1],a=parseInt(i[3]);return a>=0&&t.length!==a&&v.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",t),t.map((function(e){return r._visit(o,e,n)}))}var s=this.types[e];return s?s.reduce((function(e,i){var o=i.name,a=i.type;return e[o]=r._visit(a,t[o],n),e}),{}):v.throwArgumentError("unknown type: ".concat(e),"type",e)}},{key:"visit",value:function(e,t){return this._visit(this.primaryType,e,t)}}],[{key:"from",value:function(t){return new e(t)}},{key:"getPrimaryType",value:function(t){return e.from(t).primaryType}},{key:"hashStruct",value:function(t,n,r){return e.from(n).hashStruct(t,r)}},{key:"hashDomain",value:function(t){var n=[];for(var r in t){var i=E[r];i||v.throwArgumentError("invalid typed-data domain key: ".concat(JSON.stringify(r)),"domain",t),n.push({name:r,type:i})}return n.sort((function(e,t){return _.indexOf(e.name)-_.indexOf(t.name)})),e.hashStruct("EIP712Domain",{EIP712Domain:n},t)}},{key:"encode",value:function(t,n,r){return(0,u.hexConcat)(["0x1901",e.hashDomain(t),e.from(n).hash(r)])}},{key:"hash",value:function(t,n,r){return(0,c.keccak256)(e.encode(t,n,r))}},{key:"resolveNames",value:function(t,n,i,o){return p(this,void 0,void 0,(0,r.Z)().mark((function a(){var s,c,f;return(0,r.Z)().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:t=(0,l.shallowCopy)(t),s={},t.verifyingContract&&!(0,u.isHexString)(t.verifyingContract,20)&&(s[t.verifyingContract]="0x"),(c=e.from(n)).visit(i,(function(e,t){return"address"!==e||(0,u.isHexString)(t,20)||(s[t]="0x"),t})),a.t0=(0,r.Z)().keys(s);case 6:if((a.t1=a.t0()).done){a.next=13;break}return f=a.t1.value,a.next=10,o(f);case 10:s[f]=a.sent,a.next=6;break;case 13:return t.verifyingContract&&s[t.verifyingContract]&&(t.verifyingContract=s[t.verifyingContract]),i=c.visit(i,(function(e,t){return"address"===e&&s[t]?s[t]:t})),a.abrupt("return",{domain:t,value:i});case 16:case"end":return a.stop()}}),a)})))}},{key:"getPayload",value:function(t,n,r){e.hashDomain(t);var i={},o=[];_.forEach((function(e){var n=t[e];null!=n&&(i[e]=S[e](n),o.push({name:e,type:E[e]}))}));var a=e.from(n),c=(0,l.shallowCopy)(n);return c.EIP712Domain?v.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",n):c.EIP712Domain=o,a.encode(r),{types:c,domain:i,primaryType:a.primaryType,message:a.visit(r,(function(e,t){if(e.match(/^bytes(\d*)/))return(0,u.hexlify)((0,u.arrayify)(t));if(e.match(/^u?int/))return s.O$.from(t).toString();switch(e){case"address":return t.toLowerCase();case"bool":return!!t;case"string":return"string"!==typeof t&&v.throwArgumentError("invalid string","value",t),t}return v.throwArgumentError("unsupported type","type",e)}))}}}]),e}()},15148:function(e,t,n){"use strict";n.r(t),n.d(t,{HDNode:function(){return R},defaultPath:function(){return N},entropyToMnemonic:function(){return L},getAccountPath:function(){return Z},isValidMnemonic:function(){return F},mnemonicToEntropy:function(){return D},mnemonicToSeed:function(){return B}});var r=n(15671),i=n(43144),o=n(3482),a=n(49716),s=n(2257),u=n(83374),c=n(72522),l=n(30520),f=n(78865),h=n(39598),d=n(24667),p=n(25452),v=n(60136),m=n(29388),y=n(51583),g=n(39502),b=new g.Logger("wordlists/5.7.0"),w=function(){function e(t){(0,r.Z)(this,e),b.checkAbstract(this instanceof e?this.constructor:void 0,e),(0,l.defineReadOnly)(this,"locale",t)}return(0,i.Z)(e,[{key:"split",value:function(e){return e.toLowerCase().split(/ +/g)}},{key:"join",value:function(e){return e.join(" ")}}],[{key:"check",value:function(e){for(var t=[],n=0;n<2048;n++){var r=e.getWord(n);if(n!==e.getWordIndex(r))return"0x";t.push(r)}return(0,y.id)(t.join("\n")+"\n")}},{key:"register",value:function(e,t){t||(t=e.locale)}}]),e}(),x=null;function k(e){if(null==x&&(x="AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo".replace(/([A-Z])/g," $1").toLowerCase().substring(1).split(" "),"0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60"!==w.check(e)))throw x=null,new Error("BIP39 Wordlist for en (English) FAILED")}var E=new(function(e){(0,v.Z)(n,e);var t=(0,m.Z)(n);function n(){return(0,r.Z)(this,n),t.call(this,"en")}return(0,i.Z)(n,[{key:"getWord",value:function(e){return k(this),x[e]}},{key:"getWordIndex",value:function(e){return k(this),x.indexOf(e)}}]),n}(w));w.register(E);var _={en:E},A=new g.Logger("hdnode/5.7.0"),S=s.O$.from("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),O=(0,u.Y0)("Bitcoin seed"),M=2147483648;function C(e){return(1<=256)throw new Error("Depth too large!");return T((0,a.concat)([null!=this.privateKey?"0x0488ADE4":"0x0488B21E",(0,a.hexlify)(this.depth),this.parentFingerprint,(0,a.hexZeroPad)((0,a.hexlify)(this.index),4),this.chainCode,null!=this.privateKey?(0,a.concat)(["0x00",this.privateKey]):this.publicKey]))}},{key:"neuter",value:function(){return new e(I,null,this.publicKey,this.parentFingerprint,this.chainCode,this.index,this.depth,this.path)}},{key:"_derive",value:function(t){if(t>4294967295)throw new Error("invalid index - "+String(t));var n=this.path;n&&(n+="/"+(t&~M));var r=new Uint8Array(37);if(t&M){if(!this.privateKey)throw new Error("cannot derive child of neutered node");r.set((0,a.arrayify)(this.privateKey),1),n&&(n+="'")}else r.set((0,a.arrayify)(this.publicKey));for(var i=24;i>=0;i-=8)r[33+(i>>3)]=t>>24-i&255;var o=(0,a.arrayify)((0,h.Gy)(d.p.sha512,this.chainCode,r)),u=o.slice(0,32),c=o.slice(32),l=null,p=null;this.privateKey?l=P(s.O$.from(u).add(this.privateKey).mod(S)):p=new f.SigningKey((0,a.hexlify)(u))._addPoint(this.publicKey);var v=n,m=this.mnemonic;return m&&(v=Object.freeze({phrase:m.phrase,path:n,locale:m.locale||"en"})),new e(I,l,p,this.fingerprint,P(c),t,this.depth+1,v)}},{key:"derivePath",value:function(e){var t=e.split("/");if(0===t.length||"m"===t[0]&&0!==this.depth)throw new Error("invalid path - "+e);"m"===t[0]&&t.shift();for(var n=this,r=0;r=M)throw new Error("invalid path index - "+i);n=n._derive(M+o)}else{if(!i.match(/^[0-9]+$/))throw new Error("invalid path component - "+i);var a=parseInt(i);if(a>=M)throw new Error("invalid path index - "+i);n=n._derive(a)}}return n}}],[{key:"_fromSeed",value:function(t,n){var r=(0,a.arrayify)(t);if(r.length<16||r.length>64)throw new Error("invalid seed");var i=(0,a.arrayify)((0,h.Gy)(d.p.sha512,O,r));return new e(I,P(i.slice(0,32)),null,"0x00000000",P(i.slice(32)),0,0,n)}},{key:"fromMnemonic",value:function(t,n,r){return t=L(D(t,r=j(r)),r),e._fromSeed(B(t,n),{phrase:t,path:"m",locale:r.locale})}},{key:"fromSeed",value:function(t){return e._fromSeed(t,null)}},{key:"fromExtendedKey",value:function(t){var n=o.Base58.decode(t);82===n.length&&T(n.slice(0,78))===t||A.throwArgumentError("invalid extended key","extendedKey","[REDACTED]");var r=n[4],i=(0,a.hexlify)(n.slice(5,9)),s=parseInt((0,a.hexlify)(n.slice(9,13)).substring(2),16),u=(0,a.hexlify)(n.slice(13,45)),c=n.slice(45,78);switch((0,a.hexlify)(n.slice(0,4))){case"0x0488b21e":case"0x043587cf":return new e(I,null,(0,a.hexlify)(c),i,u,s,r,null);case"0x0488ade4":case"0x04358394 ":if(0!==c[0])break;return new e(I,(0,a.hexlify)(c.slice(1)),null,i,u,s,r,null)}return A.throwArgumentError("invalid extended key","extendedKey","[REDACTED]")}}]),e}();function B(e,t){t||(t="");var n=(0,u.Y0)("mnemonic"+t,u.Uj.NFKD);return(0,c.n)((0,u.Y0)(e,u.Uj.NFKD),n,2048,64,"sha512")}function D(e,t){t=j(t),A.checkNormalize();var n=t.split(e);if(n.length%3!==0)throw new Error("invalid mnemonic");for(var r=(0,a.arrayify)(new Uint8Array(Math.ceil(11*n.length/8))),i=0,o=0;o>3]|=1<<7-i%8),i++}var c=32*n.length/3,l=C(n.length/3);if(((0,a.arrayify)((0,h.JQ)(r.slice(0,c/8)))[0]&l)!==(r[r.length-1]&l))throw new Error("invalid checksum");return(0,a.hexlify)(r.slice(0,c/8))}function L(e,t){if(t=j(t),(e=(0,a.arrayify)(e)).length%4!==0||e.length<16||e.length>32)throw new Error("invalid entropy");for(var n=[0],r=11,i=0;i8?(n[n.length-1]<<=8,n[n.length-1]|=e[i],r-=8):(n[n.length-1]<<=r,n[n.length-1]|=e[i]>>8-r,n.push(e[i]&(1<<8-r)-1),r+=3);var o=e.length/4,s=(0,a.arrayify)((0,h.JQ)(e))[0]&C(o);return n[n.length-1]<<=o,n[n.length-1]|=s>>8-o,t.join(n.map((function(e){return t.getWord(e)})))}function F(e,t){try{return D(e,t),!0}catch(n){}return!1}function Z(e){return("number"!==typeof e||e<0||e>=M||e%1)&&A.throwArgumentError("invalid account index","index",e),"m/44'/60'/".concat(e,"'/0/0")}},95382:function(e,t,n){"use strict";n.d(t,{i:function(){return r}});var r="json-wallets/5.7.0"},31529:function(e,t,n){"use strict";n.r(t),n.d(t,{decryptCrowdsale:function(){return w},decryptJsonWallet:function(){return A},decryptJsonWalletSync:function(){return S},decryptKeystore:function(){return _.pe},decryptKeystoreSync:function(){return _.hb},encryptKeystore:function(){return _.HI},getJsonWalletAddress:function(){return E},isCrowdsaleWallet:function(){return x},isKeystoreWallet:function(){return k}});var r=n(15671),i=n(43144),o=n(60136),a=n(29388),s=n(1830),u=n.n(s),c=n(97419),l=n(49716),f=n(88062),h=n(72522),d=n(83374),p=n(30520),v=n(39502),m=n(95382),y=n(58661),g=new v.Logger(m.i),b=function(e){(0,o.Z)(n,e);var t=(0,a.Z)(n);function n(){return(0,r.Z)(this,n),t.apply(this,arguments)}return(0,i.Z)(n,[{key:"isCrowdsaleAccount",value:function(e){return!(!e||!e._isCrowdsaleAccount)}}]),n}(p.Description);function w(e,t){var n=JSON.parse(e);t=(0,y.Ij)(t);var r=(0,c.getAddress)((0,y.gx)(n,"ethaddr")),i=(0,y.p3)((0,y.gx)(n,"encseed"));i&&i.length%16===0||g.throwArgumentError("invalid encseed","json",e);for(var o=(0,l.arrayify)((0,h.n)(t,t,2e3,32,"sha256")).slice(0,16),a=i.slice(0,16),s=i.slice(16),p=new(u().ModeOfOperation.cbc)(o,a),v=u().padding.pkcs7.strip((0,l.arrayify)(p.decrypt(s))),m="",w=0;w255)return!1;return!0}function i(e,t){if(e.buffer&&ArrayBuffer.isView(e)&&"Uint8Array"===e.name)return t&&(e=e.slice?e.slice():Array.prototype.slice.call(e)),e;if(Array.isArray(e)){if(!r(e))throw new Error("Array contains invalid value: "+e);return new Uint8Array(e)}if(n(e.length)&&r(e))return new Uint8Array(e);throw new Error("unsupported array-like object")}function o(e){return new Uint8Array(e)}function a(e,t,n,r,i){null==r&&null==i||(e=e.slice?e.slice(r,i):Array.prototype.slice.call(e,r,i)),t.set(e,n)}var s={toBytes:function(e){var t=[],n=0;for(e=encodeURI(e);n191&&r<224?(t.push(String.fromCharCode((31&r)<<6|63&e[n+1])),n+=2):(t.push(String.fromCharCode((15&r)<<12|(63&e[n+1])<<6|63&e[n+2])),n+=3)}return t.join("")}},u=function(){var e="0123456789abcdef";return{toBytes:function(e){for(var t=[],n=0;n>4]+e[15&i])}return n.join("")}}}(),c={16:10,24:12,32:14},l=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],f=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],h=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],d=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],p=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],v=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],m=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],y=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],g=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],b=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],w=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],x=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],k=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],E=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],_=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function A(e){for(var t=[],n=0;n>2,this._Ke[n][t%4]=o[t],this._Kd[e-n][t%4]=o[t];for(var a,s=0,u=i;u>16&255]<<24^f[a>>8&255]<<16^f[255&a]<<8^f[a>>24&255]^l[s]<<24,s+=1,8!=i)for(t=1;t>8&255]<<8^f[a>>16&255]<<16^f[a>>24&255]<<24;for(t=i/2+1;t>2,d=u%4,this._Ke[h][d]=o[t],this._Kd[e-h][d]=o[t++],u++}for(var h=1;h>24&255]^k[a>>16&255]^E[a>>8&255]^_[255&a]},S.prototype.encrypt=function(e){if(16!=e.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var t=this._Ke.length-1,n=[0,0,0,0],r=A(e),i=0;i<4;i++)r[i]^=this._Ke[0][i];for(var a=1;a>24&255]^p[r[(i+1)%4]>>16&255]^v[r[(i+2)%4]>>8&255]^m[255&r[(i+3)%4]]^this._Ke[a][i];r=n.slice()}var s,u=o(16);for(i=0;i<4;i++)s=this._Ke[t][i],u[4*i]=255&(f[r[i]>>24&255]^s>>24),u[4*i+1]=255&(f[r[(i+1)%4]>>16&255]^s>>16),u[4*i+2]=255&(f[r[(i+2)%4]>>8&255]^s>>8),u[4*i+3]=255&(f[255&r[(i+3)%4]]^s);return u},S.prototype.decrypt=function(e){if(16!=e.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var t=this._Kd.length-1,n=[0,0,0,0],r=A(e),i=0;i<4;i++)r[i]^=this._Kd[0][i];for(var a=1;a>24&255]^g[r[(i+3)%4]>>16&255]^b[r[(i+2)%4]>>8&255]^w[255&r[(i+1)%4]]^this._Kd[a][i];r=n.slice()}var s,u=o(16);for(i=0;i<4;i++)s=this._Kd[t][i],u[4*i]=255&(h[r[i]>>24&255]^s>>24),u[4*i+1]=255&(h[r[(i+3)%4]>>16&255]^s>>16),u[4*i+2]=255&(h[r[(i+2)%4]>>8&255]^s>>8),u[4*i+3]=255&(h[255&r[(i+1)%4]]^s);return u};var O=function e(t){if(!(this instanceof e))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new S(t)};O.prototype.encrypt=function(e){if((e=i(e)).length%16!==0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=o(e.length),n=o(16),r=0;r=0;--t)this._counter[t]=e%256,e>>=8},T.prototype.setBytes=function(e){if(16!=(e=i(e,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=e},T.prototype.increment=function(){for(var e=15;e>=0;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}};var j=function e(t,n){if(!(this instanceof e))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",n instanceof T||(n=new T(n)),this._counter=n,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new S(t)};j.prototype.encrypt=function(e){for(var t=i(e,!0),n=0;n16)throw new Error("PKCS#7 padding byte out of range");for(var n=e.length-t,r=0;rs[n]||console.log.apply(console,t)}},{key:"debug",value:function(){for(var t=arguments.length,n=new Array(t),r=0;r>4],n+=d[15&t[o]];i.push(e+"=Uint8Array(0x"+n+")")}else i.push(e+"="+JSON.stringify(t))}catch(c){i.push(e+"="+JSON.stringify(r[e].toString()))}})),i.push("code=".concat(n)),i.push("version=".concat(this.version));var o=t,s="";switch(n){case f.NUMERIC_FAULT:s="NUMERIC_FAULT";var u=t;switch(u){case"overflow":case"underflow":case"division-by-zero":s+="-"+u;break;case"negative-power":case"negative-width":s+="-unsupported";break;case"unbound-bitwise-result":s+="-unbound-result"}break;case f.CALL_EXCEPTION:case f.INSUFFICIENT_FUNDS:case f.MISSING_NEW:case f.NONCE_EXPIRED:case f.REPLACEMENT_UNDERPRICED:case f.TRANSACTION_REPLACED:case f.UNPREDICTABLE_GAS_LIMIT:s=n}s&&(t+=" [ See: https://links.ethers.org/v5-errors-"+s+" ]"),i.length&&(t+=" ("+i.join(", ")+")");var c=new Error(t);return c.reason=o,c.code=n,Object.keys(r).forEach((function(e){c[e]=r[e]})),c}},{key:"throwError",value:function(e,t,n){throw this.makeError(e,t,n)}},{key:"throwArgumentError",value:function(t,n,r){return this.throwError(t,e.errors.INVALID_ARGUMENT,{argument:n,value:r})}},{key:"assert",value:function(e,t,n,r){e||this.throwError(t,n,r)}},{key:"assertArgument",value:function(e,t,n,r){e||this.throwArgumentError(t,n,r)}},{key:"checkNormalize",value:function(t){null==t&&(t="platform missing String.prototype.normalize"),h&&this.throwError("platform missing String.prototype.normalize",e.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:h})}},{key:"checkSafeUint53",value:function(t,n){"number"===typeof t&&(null==n&&(n="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(n,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(n,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}},{key:"checkArgumentCount",value:function(t,n,r){r=r?": "+r:"",tn&&this.throwError("too many arguments"+r,e.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:n})}},{key:"checkNew",value:function(t,n){t!==Object&&null!=t||this.throwError("missing new",e.errors.MISSING_NEW,{name:n.name})}},{key:"checkAbstract",value:function(t,n){t===n?this.throwError("cannot instantiate abstract class "+JSON.stringify(n.name)+" directly; use a sub-class",e.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",e.errors.MISSING_NEW,{name:n.name})}}],[{key:"globalLogger",value:function(){return c||(c=new e("logger/5.7.0")),c}},{key:"setCensorship",value:function(t,n){if(!t&&n&&this.globalLogger().throwError("cannot permanently disable censorship",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),o){if(!t)return;this.globalLogger().throwError("error censorship permanent",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}a=!!t,o=!!n}},{key:"setLogLevel",value:function(t){var n=s[t.toLowerCase()];null!=n?u=n:e.globalLogger().warn("invalid log level - "+t)}},{key:"from",value:function(t){return new e(t)}}]),e}();p.errors=f,p.levels=l},72522:function(e,t,n){"use strict";n.d(t,{n:function(){return o}});var r=n(49716),i=n(39598);function o(e,t,n,o,a){var s;e=(0,r.arrayify)(e),t=(0,r.arrayify)(t);var u,c,l=1,f=new Uint8Array(o),h=new Uint8Array(t.length+4);h.set(t);for(var d=1;d<=l;d++){h[t.length]=d>>24&255,h[t.length+1]=d>>16&255,h[t.length+2]=d>>8&255,h[t.length+3]=255&d;var p=(0,r.arrayify)((0,i.Gy)(a,e,h));s||(s=p.length,c=new Uint8Array(s),u=o-((l=Math.ceil(o/s))-1)*s),c.set(p);for(var v=1;v0&&null==e[e.length-1];)e.pop();return e.map((function(e){if(Array.isArray(e)){var t={};e.forEach((function(e){t[z(e)]=!0}));var n=Object.keys(t);return n.sort(),n.join("|")}return z(e)})).join("&")}function q(e){if("string"===typeof e){if(e=e.toLowerCase(),32===(0,k.hexDataLength)(e))return"tx:"+e;if(-1===e.indexOf(":"))return e}else{if(Array.isArray(e))return"filter:*:"+H(e);if(r.Sg.isForkEvent(e))throw U.warn("not implemented"),new Error("not implemented");if(e&&"object"===typeof e)return"filter:"+(e.address||"*")+":"+H(e.topics||[])}throw new Error("invalid event - "+e)}function W(){return(new Date).getTime()}function V(e){return new Promise((function(t){setTimeout(t,e)}))}var G=["block","network","pending","poll"],K=function(){function e(t,n,r){(0,y.Z)(this,e),(0,A.defineReadOnly)(this,"tag",t),(0,A.defineReadOnly)(this,"listener",n),(0,A.defineReadOnly)(this,"once",r),this._lastBlockNumber=-2,this._inflight=!1}return(0,g.Z)(e,[{key:"event",get:function(){switch(this.type){case"tx":return this.hash;case"filter":return this.filter}return this.tag}},{key:"type",get:function(){return this.tag.split(":")[0]}},{key:"hash",get:function(){var e=this.tag.split(":");return"tx"!==e[0]?null:e[1]}},{key:"filter",get:function(){var e=this.tag.split(":");if("filter"!==e[0])return null;var t,n=e[1],r=""===(t=e[2])?[]:t.split(/&/g).map((function(e){if(""===e)return[];var t=e.split("|").map((function(e){return"null"===e?null:e}));return 1===t.length?t[0]:t})),i={};return r.length>0&&(i.topics=r),n&&"*"!==n&&(i.address=n),i}},{key:"pollable",value:function(){return this.tag.indexOf(":")>=0||G.indexOf(this.tag)>=0}}]),e}(),Q={0:{symbol:"btc",p2pkh:0,p2sh:5,prefix:"bc"},2:{symbol:"ltc",p2pkh:48,p2sh:50,prefix:"ltc"},3:{symbol:"doge",p2pkh:30,p2sh:22},60:{symbol:"eth",ilk:"eth"},61:{symbol:"etc",ilk:"eth"},700:{symbol:"xdai",ilk:"eth"}};function Y(e){return(0,k.hexZeroPad)(x.O$.from(e).toHexString(),32)}function J(e){return w.Base58.encode((0,k.concat)([e,(0,k.hexDataSlice)((0,S.JQ)((0,S.JQ)(e)),0,4)]))}var X=new RegExp("^(ipfs)://(.*)$","i"),$=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),X,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function ee(e,t){try{return(0,O.ZN)(te(e,t))}catch(n){}return null}function te(e,t){if("0x"===e)return null;var n=x.O$.from((0,k.hexDataSlice)(e,t,t+32)).toNumber(),r=x.O$.from((0,k.hexDataSlice)(e,n,n+32)).toNumber();return(0,k.hexDataSlice)(e,n+32,n+32+r)}function ne(e){return e.match(/^ipfs:\/\/ipfs\//i)?e=e.substring(12):e.match(/^ipfs:\/\//i)?e=e.substring(7):U.throwArgumentError("unsupported IPFS format","link",e),"https://gateway.ipfs.io/ipfs/".concat(e)}function re(e){var t=(0,k.arrayify)(e);if(t.length>32)throw new Error("internal; should not happen");var n=new Uint8Array(32);return n.set(t,32-t.length),n}function ie(e){if(e.length%32===0)return e;var t=new Uint8Array(32*Math.ceil(e.length/32));return t.set(e),t}function oe(e){for(var t=[],n=0,r=0;r=1&&a<=75)return J((0,k.concat)([[n.p2pkh],"0x"+o[2]]))}}if(null!=n.p2sh){var s=t.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(s){var u=parseInt(s[1],16);if(s[2].length===2*u&&u>=1&&u<=75)return J((0,k.concat)([[n.p2sh],"0x"+s[2]]))}}if(null!=n.prefix){var c=r[1],l=r[0];if(0===l?20!==c&&32!==c&&(l=-1):l=-1,l>=0&&r.length===2+c&&c>=1&&c<=75){var f=P().toWords(r.slice(2));return f.unshift(l),P().encode(n.prefix,f)}}return null}},{key:"getAddress",value:function(e){return Z(this,void 0,void 0,(0,m.Z)().mark((function t(){var n,r,o;return(0,m.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null==e&&(e=60),60!==e){t.next=16;break}return t.prev=2,t.next=5,this._fetch("0x3b3b57de");case 5:if("0x"!==(n=t.sent)&&n!==E.R){t.next=8;break}return t.abrupt("return",null);case 8:return t.abrupt("return",this.provider.formatter.callAddress(n));case 11:if(t.prev=11,t.t0=t.catch(2),t.t0.code!==i.Logger.errors.CALL_EXCEPTION){t.next=15;break}return t.abrupt("return",null);case 15:throw t.t0;case 16:return t.next=18,this._fetchBytes("0xf1cb7e06",Y(e));case 18:if(null!=(r=t.sent)&&"0x"!==r){t.next=21;break}return t.abrupt("return",null);case 21:return null==(o=this._getAddress(e,r))&&U.throwError("invalid or unsupported coin data",i.Logger.errors.UNSUPPORTED_OPERATION,{operation:"getAddress(".concat(e,")"),coinType:e,data:r}),t.abrupt("return",o);case 24:case"end":return t.stop()}}),t,this,[[2,11]])})))}},{key:"getAvatar",value:function(){return Z(this,void 0,void 0,(0,m.Z)().mark((function e(){var t,n,r,i,o,a,s,u,c,l,f,h,d,p,v,y;return(0,m.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=[{type:"name",content:this.name}],e.prev=1,e.next=4,this.getText("avatar");case 4:if(null!=(n=e.sent)){e.next=7;break}return e.abrupt("return",null);case 7:r=0;case 8:if(!(r<$.length)){e.next=91;break}if(null!=(i=n.match($[r]))){e.next=12;break}return e.abrupt("continue",88);case 12:o=i[1].toLowerCase(),e.t0=o,e.next="https"===e.t0?16:"data"===e.t0?18:"ipfs"===e.t0?20:"erc721"===e.t0||"erc1155"===e.t0?22:88;break;case 16:return t.push({type:"url",content:n}),e.abrupt("return",{linkage:t,url:n});case 18:return t.push({type:"data",content:n}),e.abrupt("return",{linkage:t,url:n});case 20:return t.push({type:"ipfs",content:n}),e.abrupt("return",{linkage:t,url:ne(n)});case 22:if(a="erc721"===o?"0xc87b56dd":"0x0e89341c",t.push({type:o,content:n}),e.t1=this._resolvedAddress,e.t1){e.next=29;break}return e.next=28,this.getAddress();case 28:e.t1=e.sent;case 29:if(s=e.t1,2===(u=(i[2]||"").split("/")).length){e.next=33;break}return e.abrupt("return",null);case 33:return e.next=35,this.provider.formatter.address(u[0]);case 35:if(c=e.sent,l=(0,k.hexZeroPad)(x.O$.from(u[1]).toHexString(),32),"erc721"!==o){e.next=48;break}return e.t2=this.provider.formatter,e.next=41,this.provider.call({to:c,data:(0,k.hexConcat)(["0x6352211e",l])});case 41:if(e.t3=e.sent,f=e.t2.callAddress.call(e.t2,e.t3),s===f){e.next=45;break}return e.abrupt("return",null);case 45:t.push({type:"owner",content:f}),e.next=57;break;case 48:if("erc1155"!==o){e.next=57;break}return e.t4=x.O$,e.next=52,this.provider.call({to:c,data:(0,k.hexConcat)(["0x00fdd58e",(0,k.hexZeroPad)(s,32),l])});case 52:if(e.t5=e.sent,!(h=e.t4.from.call(e.t4,e.t5)).isZero()){e.next=56;break}return e.abrupt("return",null);case 56:t.push({type:"balance",content:h.toString()});case 57:return d={to:this.provider.formatter.address(u[0]),data:(0,k.hexConcat)([a,l])},e.t6=ee,e.next=61,this.provider.call(d);case 61:if(e.t7=e.sent,null!=(p=(0,e.t6)(e.t7,0))){e.next=65;break}return e.abrupt("return",null);case 65:return t.push({type:"metadata-url-base",content:p}),"erc1155"===o&&(p=p.replace("{id}",l.substring(2)),t.push({type:"metadata-url-expanded",content:p})),p.match(/^ipfs:/i)&&(p=ne(p)),t.push({type:"metadata-url",content:p}),e.next=71,(0,M.fetchJson)(p);case 71:if(v=e.sent){e.next=74;break}return e.abrupt("return",null);case 74:if(t.push({type:"metadata",content:JSON.stringify(v)}),"string"===typeof(y=v.image)){e.next=78;break}return e.abrupt("return",null);case 78:if(!y.match(/^(https:\/\/|data:)/i)){e.next=81;break}e.next=86;break;case 81:if(null!=y.match(X)){e.next=84;break}return e.abrupt("return",null);case 84:t.push({type:"url-ipfs",content:y}),y=ne(y);case 86:return t.push({type:"url",content:y}),e.abrupt("return",{linkage:t,url:y});case 88:r++,e.next=8;break;case 91:e.next=95;break;case 93:e.prev=93,e.t8=e.catch(1);case 95:return e.abrupt("return",null);case 96:case"end":return e.stop()}}),e,this,[[1,93]])})))}},{key:"getContentHash",value:function(){return Z(this,void 0,void 0,(0,m.Z)().mark((function e(){var t,n,r,o,a,s,u,c,l;return(0,m.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._fetchBytes("0xbc1c58d1");case 2:if(null!=(t=e.sent)&&"0x"!==t){e.next=5;break}return e.abrupt("return",null);case 5:if(!(n=t.match(/^0xe3010170(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/))){e.next=10;break}if(r=parseInt(n[3],16),n[4].length!==2*r){e.next=10;break}return e.abrupt("return","ipfs://"+w.Base58.encode("0x"+n[1]));case 10:if(!(o=t.match(/^0xe5010172(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/))){e.next=15;break}if(a=parseInt(o[3],16),o[4].length!==2*a){e.next=15;break}return e.abrupt("return","ipns://"+w.Base58.encode("0x"+o[1]));case 15:if(!(s=t.match(/^0xe40101fa011b20([0-9a-f]*)$/))){e.next=19;break}if(64!==s[1].length){e.next=19;break}return e.abrupt("return","bzz://"+s[1]);case 19:if(!(u=t.match(/^0x90b2c605([0-9a-f]*)$/))){e.next=25;break}if(68!==u[1].length){e.next=25;break}return c={"=":"","+":"-","/":"_"},l=(0,b.c)("0x"+u[1]).replace(/[=+\/]/g,(function(e){return c[e]})),e.abrupt("return","sia://"+l);case 25:return e.abrupt("return",U.throwError("invalid or unsupported content hash data",i.Logger.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:t}));case 26:case"end":return e.stop()}}),e,this)})))}},{key:"getText",value:function(e){return Z(this,void 0,void 0,(0,m.Z)().mark((function t(){var n,r;return(0,m.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=(0,O.Y0)(e),(n=(0,k.concat)([Y(64),Y(n.length),n])).length%32!==0&&(n=(0,k.concat)([n,(0,k.hexZeroPad)("0x",32-e.length%32)])),t.next=5,this._fetchBytes("0x59d1d43c",(0,k.hexlify)(n));case 5:if(null!=(r=t.sent)&&"0x"!==r){t.next=8;break}return t.abrupt("return",null);case 8:return t.abrupt("return",(0,O.ZN)(r));case 9:case"end":return t.stop()}}),t,this)})))}}]),e}(),se=null,ue=1,ce=function(e){(0,p.Z)(n,e);var t=(0,v.Z)(n);function n(e){var r;if((0,y.Z)(this,n),(r=t.call(this))._events=[],r._emitted={block:-2},r.disableCcipRead=!1,r.formatter=(this instanceof n?this.constructor:void 0).getFormatter(),(0,A.defineReadOnly)((0,d.Z)(r),"anyNetwork","any"===e),r.anyNetwork&&(e=r.detectNetwork()),e instanceof Promise)r._networkPromise=e,e.catch((function(e){})),r._ready().catch((function(e){}));else{var i=(0,A.getStatic)(this instanceof n?this.constructor:void 0,"getNetwork")(e);i?((0,A.defineReadOnly)((0,d.Z)(r),"_network",i),r.emit("network",i,null)):U.throwArgumentError("invalid network","network",e)}return r._maxInternalBlockNumber=-1024,r._lastBlockNumber=-2,r._maxFilterBlockRange=10,r._pollingInterval=4e3,r._fastQueryDate=0,r}return(0,g.Z)(n,[{key:"_ready",value:function(){return Z(this,void 0,void 0,(0,m.Z)().mark((function e(){var t;return(0,m.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=this._network){e.next=17;break}if(t=null,!this._networkPromise){e.next=11;break}return e.prev=3,e.next=6,this._networkPromise;case 6:t=e.sent,e.next=11;break;case 9:e.prev=9,e.t0=e.catch(3);case 11:if(null!=t){e.next=15;break}return e.next=14,this.detectNetwork();case 14:t=e.sent;case 15:t||U.throwError("no network detected",i.Logger.errors.UNKNOWN_ERROR,{}),null==this._network&&(this.anyNetwork?this._network=t:(0,A.defineReadOnly)(this,"_network",t),this.emit("network",t,null));case 17:return e.abrupt("return",this._network);case 18:case"end":return e.stop()}}),e,this,[[3,9]])})))}},{key:"ready",get:function(){var e=this;return(0,M.poll)((function(){return e._ready().then((function(e){return e}),(function(e){if(e.code!==i.Logger.errors.NETWORK_ERROR||"noNetwork"!==e.event)throw e}))}))}},{key:"ccipReadFetch",value:function(e,t,n){return Z(this,void 0,void 0,(0,m.Z)().mark((function r(){var o,a,s,u,c,l,f,h,d;return(0,m.Z)().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!this.disableCcipRead&&0!==n.length){r.next=2;break}return r.abrupt("return",null);case 2:o=e.to.toLowerCase(),a=t.toLowerCase(),s=[],u=0;case 6:if(!(u=0?null:JSON.stringify({data:a,sender:o}),r.next=12,(0,M.fetchJson)({url:l,errorPassThrough:!0},f,(function(e,t){return e.status=t.statusCode,e}));case 12:if(!(h=r.sent).data){r.next=15;break}return r.abrupt("return",h.data);case 15:if(d=h.message||"unknown error",!(h.status>=400&&h.status<500)){r.next=18;break}return r.abrupt("return",U.throwError("response not found during CCIP fetch: ".concat(d),i.Logger.errors.SERVER_ERROR,{url:c,errorMessage:d}));case 18:s.push(d);case 19:u++,r.next=6;break;case 22:return r.abrupt("return",U.throwError("error encountered during CCIP fetch: ".concat(s.map((function(e){return JSON.stringify(e)})).join(", ")),i.Logger.errors.SERVER_ERROR,{urls:n,errorMessages:s}));case 23:case"end":return r.stop()}}),r,this)})))}},{key:"_getInternalBlockNumber",value:function(e){return Z(this,void 0,void 0,(0,m.Z)().mark((function t(){var n,r,i,o,a=this;return(0,m.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._ready();case 2:if(!(e>0)){t.next=20;break}case 3:if(!this._internalBlockNumber){t.next=20;break}return n=this._internalBlockNumber,t.prev=5,t.next=8,n;case 8:if(r=t.sent,!(W()-r.respTime<=e)){t.next=11;break}return t.abrupt("return",r.blockNumber);case 11:return t.abrupt("break",20);case 14:if(t.prev=14,t.t0=t.catch(5),this._internalBlockNumber!==n){t.next=18;break}return t.abrupt("break",20);case 18:t.next=3;break;case 20:return i=W(),o=(0,A.resolveProperties)({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then((function(e){return null}),(function(e){return e}))}).then((function(e){var t=e.blockNumber,n=e.networkError;if(n)throw a._internalBlockNumber===o&&(a._internalBlockNumber=null),n;var r=W();return(t=x.O$.from(t).toNumber())1e3)U.warn("network block skew detected; skipping block events (emitted=".concat(this._emitted.block," blockNumber").concat(r,")")),this.emit("error",U.makeError("network block skew detected",i.Logger.errors.NETWORK_ERROR,{blockNumber:r,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",r);else for(o=this._emitted.block+1;o<=r;o++)this.emit("block",o);return this._emitted.block!==r&&(this._emitted.block=r,Object.keys(this._emitted).forEach((function(e){if("block"!==e){var t=a._emitted[e];"pending"!==t&&r-t>12&&delete a._emitted[e]}}))),-2===this._lastBlockNumber&&(this._lastBlockNumber=r-1),this._events.forEach((function(e){switch(e.type){case"tx":var t=e.hash,i=a.getTransactionReceipt(t).then((function(e){return e&&null!=e.blockNumber?(a._emitted["t:"+t]=e.blockNumber,a.emit(t,e),null):null})).catch((function(e){a.emit("error",e)}));n.push(i);break;case"filter":if(!e._inflight){e._inflight=!0,-2===e._lastBlockNumber&&(e._lastBlockNumber=r-1);var o=e.filter;o.fromBlock=e._lastBlockNumber+1,o.toBlock=r;var s=o.toBlock-a._maxFilterBlockRange;s>o.fromBlock&&(o.fromBlock=s),o.fromBlock<0&&(o.fromBlock=0);var u=a.getLogs(o).then((function(t){e._inflight=!1,0!==t.length&&t.forEach((function(t){t.blockNumber>e._lastBlockNumber&&(e._lastBlockNumber=t.blockNumber),a._emitted["b:"+t.blockHash]=t.blockNumber,a._emitted["t:"+t.transactionHash]=t.blockNumber,a.emit(o,t)}))})).catch((function(t){a.emit("error",t),e._inflight=!1}));n.push(u)}}})),this._lastBlockNumber=r,Promise.all(n).then((function(){a.emit("didPoll",t)})).catch((function(e){a.emit("error",e)})),e.abrupt("return");case 26:case"end":return e.stop()}}),e,this,[[3,9]])})))}},{key:"resetEventsBlock",value:function(e){this._lastBlockNumber=e-1,this.polling&&this.poll()}},{key:"network",get:function(){return this._network}},{key:"detectNetwork",value:function(){return Z(this,void 0,void 0,(0,m.Z)().mark((function e(){return(0,m.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",U.throwError("provider does not support network detection",i.Logger.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"}));case 1:case"end":return e.stop()}}),e)})))}},{key:"getNetwork",value:function(){return Z(this,void 0,void 0,(0,m.Z)().mark((function e(){var t,n,r;return(0,m.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._ready();case 2:return t=e.sent,e.next=5,this.detectNetwork();case 5:if(n=e.sent,t.chainId===n.chainId){e.next=23;break}if(!this.anyNetwork){e.next=20;break}return this._network=n,this._lastBlockNumber=-2,this._fastBlockNumber=null,this._fastBlockNumberPromise=null,this._fastQueryDate=0,this._emitted.block=-2,this._maxInternalBlockNumber=-1024,this._internalBlockNumber=null,this.emit("network",n,t),e.next=19,V(0);case 19:return e.abrupt("return",this._network);case 20:throw r=U.makeError("underlying network changed",i.Logger.errors.NETWORK_ERROR,{event:"changed",network:t,detectedNetwork:n}),this.emit("error",r),r;case 23:return e.abrupt("return",t);case 24:case"end":return e.stop()}}),e,this)})))}},{key:"blockNumber",get:function(){var e=this;return this._getInternalBlockNumber(100+this.pollingInterval/2).then((function(t){e._setFastBlockNumber(t)}),(function(e){})),null!=this._fastBlockNumber?this._fastBlockNumber:-1}},{key:"polling",get:function(){return null!=this._poller},set:function(e){var t=this;e&&!this._poller?(this._poller=setInterval((function(){t.poll()}),this.pollingInterval),this._bootstrapPoll||(this._bootstrapPoll=setTimeout((function(){t.poll(),t._bootstrapPoll=setTimeout((function(){t._poller||t.poll(),t._bootstrapPoll=null}),t.pollingInterval)}),0))):!e&&this._poller&&(clearInterval(this._poller),this._poller=null)}},{key:"pollingInterval",get:function(){return this._pollingInterval},set:function(e){var t=this;if("number"!==typeof e||e<=0||parseInt(String(e))!=e)throw new Error("invalid polling interval");this._pollingInterval=e,this._poller&&(clearInterval(this._poller),this._poller=setInterval((function(){t.poll()}),this._pollingInterval))}},{key:"_getFastBlockNumber",value:function(){var e=this,t=W();return t-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=t,this._fastBlockNumberPromise=this.getBlockNumber().then((function(t){return(null==e._fastBlockNumber||t>e._fastBlockNumber)&&(e._fastBlockNumber=t),e._fastBlockNumber}))),this._fastBlockNumberPromise}},{key:"_setFastBlockNumber",value:function(e){null!=this._fastBlockNumber&ðis._fastBlockNumber)&&(this._fastBlockNumber=e,this._fastBlockNumberPromise=Promise.resolve(e)))}},{key:"waitForTransaction",value:function(e,t,n){return Z(this,void 0,void 0,(0,m.Z)().mark((function r(){return(0,m.Z)().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",this._waitForTransaction(e,null==t?1:t,n||0,null));case 1:case"end":return r.stop()}}),r,this)})))}},{key:"_waitForTransaction",value:function(e,t,n,r){return Z(this,void 0,void 0,(0,m.Z)().mark((function o(){var a,s=this;return(0,m.Z)().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,this.getTransactionReceipt(e);case 2:if(!(((a=o.sent)?a.confirmations:0)>=t)){o.next=5;break}return o.abrupt("return",a);case 5:return o.abrupt("return",new Promise((function(o,a){var u=[],c=!1,l=function(){return!!c||(c=!0,u.forEach((function(e){e()})),!1)},f=function(e){e.confirmations0){var v=setTimeout((function(){l()||a(U.makeError("timeout exceeded",i.Logger.errors.TIMEOUT,{timeout:n}))}),n);v.unref&&v.unref(),u.push((function(){clearTimeout(v)}))}})));case 6:case"end":return o.stop()}}),o,this)})))}},{key:"getBlockNumber",value:function(){return Z(this,void 0,void 0,(0,m.Z)().mark((function e(){return(0,m.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._getInternalBlockNumber(0));case 1:case"end":return e.stop()}}),e,this)})))}},{key:"getGasPrice",value:function(){return Z(this,void 0,void 0,(0,m.Z)().mark((function e(){var t;return(0,m.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getNetwork();case 2:return e.next=4,this.perform("getGasPrice",{});case 4:return t=e.sent,e.prev=5,e.abrupt("return",x.O$.from(t));case 9:return e.prev=9,e.t0=e.catch(5),e.abrupt("return",U.throwError("bad result from backend",i.Logger.errors.SERVER_ERROR,{method:"getGasPrice",result:t,error:e.t0}));case 12:case"end":return e.stop()}}),e,this,[[5,9]])})))}},{key:"getBalance",value:function(e,t){return Z(this,void 0,void 0,(0,m.Z)().mark((function n(){var r,o;return(0,m.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.getNetwork();case 2:return n.next=4,(0,A.resolveProperties)({address:this._getAddress(e),blockTag:this._getBlockTag(t)});case 4:return r=n.sent,n.next=7,this.perform("getBalance",r);case 7:return o=n.sent,n.prev=8,n.abrupt("return",x.O$.from(o));case 12:return n.prev=12,n.t0=n.catch(8),n.abrupt("return",U.throwError("bad result from backend",i.Logger.errors.SERVER_ERROR,{method:"getBalance",params:r,result:o,error:n.t0}));case 15:case"end":return n.stop()}}),n,this,[[8,12]])})))}},{key:"getTransactionCount",value:function(e,t){return Z(this,void 0,void 0,(0,m.Z)().mark((function n(){var r,o;return(0,m.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.getNetwork();case 2:return n.next=4,(0,A.resolveProperties)({address:this._getAddress(e),blockTag:this._getBlockTag(t)});case 4:return r=n.sent,n.next=7,this.perform("getTransactionCount",r);case 7:return o=n.sent,n.prev=8,n.abrupt("return",x.O$.from(o).toNumber());case 12:return n.prev=12,n.t0=n.catch(8),n.abrupt("return",U.throwError("bad result from backend",i.Logger.errors.SERVER_ERROR,{method:"getTransactionCount",params:r,result:o,error:n.t0}));case 15:case"end":return n.stop()}}),n,this,[[8,12]])})))}},{key:"getCode",value:function(e,t){return Z(this,void 0,void 0,(0,m.Z)().mark((function n(){var r,o;return(0,m.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.getNetwork();case 2:return n.next=4,(0,A.resolveProperties)({address:this._getAddress(e),blockTag:this._getBlockTag(t)});case 4:return r=n.sent,n.next=7,this.perform("getCode",r);case 7:return o=n.sent,n.prev=8,n.abrupt("return",(0,k.hexlify)(o));case 12:return n.prev=12,n.t0=n.catch(8),n.abrupt("return",U.throwError("bad result from backend",i.Logger.errors.SERVER_ERROR,{method:"getCode",params:r,result:o,error:n.t0}));case 15:case"end":return n.stop()}}),n,this,[[8,12]])})))}},{key:"getStorageAt",value:function(e,t,n){return Z(this,void 0,void 0,(0,m.Z)().mark((function r(){var o,a;return(0,m.Z)().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this.getNetwork();case 2:return r.next=4,(0,A.resolveProperties)({address:this._getAddress(e),blockTag:this._getBlockTag(n),position:Promise.resolve(t).then((function(e){return(0,k.hexValue)(e)}))});case 4:return o=r.sent,r.next=7,this.perform("getStorageAt",o);case 7:return a=r.sent,r.prev=8,r.abrupt("return",(0,k.hexlify)(a));case 12:return r.prev=12,r.t0=r.catch(8),r.abrupt("return",U.throwError("bad result from backend",i.Logger.errors.SERVER_ERROR,{method:"getStorageAt",params:o,result:a,error:r.t0}));case 15:case"end":return r.stop()}}),r,this,[[8,12]])})))}},{key:"_wrapTransaction",value:function(e,t,n){var r=this;if(null!=t&&32!==(0,k.hexDataLength)(t))throw new Error("invalid response - sendTransaction");var o=e;return null!=t&&e.hash!==t&&U.throwError("Transaction hash mismatch from Provider.sendTransaction.",i.Logger.errors.UNKNOWN_ERROR,{expectedHash:e.hash,returnedHash:t}),o.wait=function(t,o){return Z(r,void 0,void 0,(0,m.Z)().mark((function r(){var a,s;return(0,m.Z)().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return null==t&&(t=1),null==o&&(o=0),a=void 0,0!==t&&null!=n&&(a={data:e.data,from:e.from,nonce:e.nonce,to:e.to,value:e.value,startBlock:n}),r.next=6,this._waitForTransaction(e.hash,t,o,a);case 6:if(null!=(s=r.sent)||0!==t){r.next=9;break}return r.abrupt("return",null);case 9:return this._emitted["t:"+e.hash]=s.blockNumber,0===s.status&&U.throwError("transaction failed",i.Logger.errors.CALL_EXCEPTION,{transactionHash:e.hash,transaction:e,receipt:s}),r.abrupt("return",s);case 12:case"end":return r.stop()}}),r,this)})))},o}},{key:"sendTransaction",value:function(e){return Z(this,void 0,void 0,(0,m.Z)().mark((function t(){var n,r,i,o;return(0,m.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getNetwork();case 2:return t.next=4,Promise.resolve(e).then((function(e){return(0,k.hexlify)(e)}));case 4:return n=t.sent,null==(r=this.formatter.transaction(e)).confirmations&&(r.confirmations=0),t.next=9,this._getInternalBlockNumber(100+2*this.pollingInterval);case 9:return i=t.sent,t.prev=10,t.next=13,this.perform("sendTransaction",{signedTransaction:n});case 13:return o=t.sent,t.abrupt("return",this._wrapTransaction(r,o,i));case 17:throw t.prev=17,t.t0=t.catch(10),t.t0.transaction=r,t.t0.transactionHash=r.hash,t.t0;case 22:case"end":return t.stop()}}),t,this,[[10,17]])})))}},{key:"_getTransactionRequest",value:function(e){return Z(this,void 0,void 0,(0,m.Z)().mark((function t(){var n,r,i=this;return(0,m.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e;case 2:return n=t.sent,r={},["from","to"].forEach((function(e){null!=n[e]&&(r[e]=Promise.resolve(n[e]).then((function(e){return e?i._getAddress(e):null})))})),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach((function(e){null!=n[e]&&(r[e]=Promise.resolve(n[e]).then((function(e){return e?x.O$.from(e):null})))})),["type"].forEach((function(e){null!=n[e]&&(r[e]=Promise.resolve(n[e]).then((function(e){return null!=e?e:null})))})),n.accessList&&(r.accessList=this.formatter.accessList(n.accessList)),["data"].forEach((function(e){null!=n[e]&&(r[e]=Promise.resolve(n[e]).then((function(e){return e?(0,k.hexlify)(e):null})))})),t.t0=this.formatter,t.next=12,(0,A.resolveProperties)(r);case 12:return t.t1=t.sent,t.abrupt("return",t.t0.transactionRequest.call(t.t0,t.t1));case 14:case"end":return t.stop()}}),t,this)})))}},{key:"_getFilter",value:function(e){return Z(this,void 0,void 0,(0,m.Z)().mark((function t(){var n,r=this;return(0,m.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e;case 2:return e=t.sent,n={},null!=e.address&&(n.address=this._getAddress(e.address)),["blockHash","topics"].forEach((function(t){null!=e[t]&&(n[t]=e[t])})),["fromBlock","toBlock"].forEach((function(t){null!=e[t]&&(n[t]=r._getBlockTag(e[t]))})),t.t0=this.formatter,t.next=10,(0,A.resolveProperties)(n);case 10:return t.t1=t.sent,t.abrupt("return",t.t0.filter.call(t.t0,t.t1));case 12:case"end":return t.stop()}}),t,this)})))}},{key:"_call",value:function(e,t,n){return Z(this,void 0,void 0,(0,m.Z)().mark((function r(){var o,a,s,u,c,l,f,h,d,p,v,y,g,b,w;return(0,m.Z)().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return n>=10&&U.throwError("CCIP read exceeded maximum redirections",i.Logger.errors.SERVER_ERROR,{redirects:n,transaction:e}),o=e.to,r.next=4,this.perform("call",{transaction:e,blockTag:t});case 4:if(a=r.sent,!(n>=0&&"latest"===t&&null!=o&&"0x556f1830"===a.substring(0,10)&&(0,k.hexDataLength)(a)%32===4)){r.next=31;break}for(r.prev=6,s=(0,k.hexDataSlice)(a,4),u=(0,k.hexDataSlice)(s,0,32),x.O$.from(u).eq(o)||U.throwError("CCIP Read sender did not match",i.Logger.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:a}),c=[],l=x.O$.from((0,k.hexDataSlice)(s,32,64)).toNumber(),f=x.O$.from((0,k.hexDataSlice)(s,l,l+32)).toNumber(),h=(0,k.hexDataSlice)(s,l+32),d=0;dthis._emitted.block)){e.next=10;break}return e.abrupt("return",null);case 10:return e.abrupt("return",void 0);case 11:if(!t){e.next=34;break}o=null,a=0;case 14:if(!(a0}},{key:"_stopEvent",value:function(e){this.polling=this._events.filter((function(e){return e.pollable()})).length>0}},{key:"_addEventListener",value:function(e,t,n){var r=new K(q(e),t,n);return this._events.push(r),this._startEvent(r),this}},{key:"on",value:function(e,t){return this._addEventListener(e,t,!1)}},{key:"once",value:function(e,t){return this._addEventListener(e,t,!0)}},{key:"emit",value:function(e){for(var t=this,n=arguments.length,r=new Array(n>1?n-1:0),i=1;i=0&&s.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)&&me.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",i.Logger.errors.UNPREDICTABLE_GAS_LIMIT,{error:t,method:e,transaction:r}),t}function we(e){return new Promise((function(t){setTimeout(t,e)}))}function xe(e){if(e.error){var t=new Error(e.error.message);throw t.code=e.error.code,t.data=e.error.data,t}return e.result}function ke(e){return e?e.toLowerCase():e}var Ee={},_e=function(e){(0,p.Z)(n,e);var t=(0,v.Z)(n);function n(e,r,i){var o;if((0,y.Z)(this,n),o=t.call(this),e!==Ee)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");return(0,A.defineReadOnly)((0,d.Z)(o),"provider",r),null==i&&(i=0),"string"===typeof i?((0,A.defineReadOnly)((0,d.Z)(o),"_address",o.provider.formatter.address(i)),(0,A.defineReadOnly)((0,d.Z)(o),"_index",null)):"number"===typeof i?((0,A.defineReadOnly)((0,d.Z)(o),"_index",i),(0,A.defineReadOnly)((0,d.Z)(o),"_address",null)):me.throwArgumentError("invalid address or index","addressOrIndex",i),o}return(0,g.Z)(n,[{key:"connect",value:function(e){return me.throwError("cannot alter JSON-RPC Signer connection",i.Logger.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}},{key:"connectUnchecked",value:function(){return new Ae(Ee,this.provider,this._address||this._index)}},{key:"getAddress",value:function(){var e=this;return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then((function(t){return t.length<=e._index&&me.throwError("unknown account #"+e._index,i.Logger.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),e.provider.formatter.address(t[e._index])}))}},{key:"sendUncheckedTransaction",value:function(e){var t=this;e=(0,A.shallowCopy)(e);var n=this.getAddress().then((function(e){return e&&(e=e.toLowerCase()),e}));if(null==e.gasLimit){var r=(0,A.shallowCopy)(e);r.from=n,e.gasLimit=this.provider.estimateGas(r)}return null!=e.to&&(e.to=Promise.resolve(e.to).then((function(e){return ve(t,void 0,void 0,(0,m.Z)().mark((function t(){var n;return(0,m.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null!=e){t.next=2;break}return t.abrupt("return",null);case 2:return t.next=4,this.provider.resolveName(e);case 4:return null==(n=t.sent)&&me.throwArgumentError("provided ENS name resolves to null","tx.to",e),t.abrupt("return",n);case 7:case"end":return t.stop()}}),t,this)})))}))),(0,A.resolveProperties)({tx:(0,A.resolveProperties)(e),sender:n}).then((function(n){var r=n.tx,o=n.sender;null!=r.from?r.from.toLowerCase()!==o&&me.throwArgumentError("from address mismatch","transaction",e):r.from=o;var a=t.provider.constructor.hexlifyTransaction(r,{from:!0});return t.provider.send("eth_sendTransaction",[a]).then((function(e){return e}),(function(e){return"string"===typeof e.message&&e.message.match(/user denied/i)&&me.throwError("user rejected transaction",i.Logger.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:r}),be("sendTransaction",e,a)}))}))}},{key:"signTransaction",value:function(e){return me.throwError("signing transactions is unsupported",i.Logger.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}},{key:"sendTransaction",value:function(e){return ve(this,void 0,void 0,(0,m.Z)().mark((function t(){var n,r,i=this;return(0,m.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval);case 2:return n=t.sent,t.next=5,this.sendUncheckedTransaction(e);case 5:return r=t.sent,t.prev=6,t.next=9,(0,M.poll)((function(){return ve(i,void 0,void 0,(0,m.Z)().mark((function e(){var t;return(0,m.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.provider.getTransaction(r);case 2:if(null!==(t=e.sent)){e.next=5;break}return e.abrupt("return",void 0);case 5:return e.abrupt("return",this.provider._wrapTransaction(t,r,n));case 6:case"end":return e.stop()}}),e,this)})))}),{oncePoll:this.provider});case 9:return t.abrupt("return",t.sent);case 12:throw t.prev=12,t.t0=t.catch(6),t.t0.transactionHash=r,t.t0;case 16:case"end":return t.stop()}}),t,this,[[6,12]])})))}},{key:"signMessage",value:function(e){return ve(this,void 0,void 0,(0,m.Z)().mark((function t(){var n,r;return(0,m.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n="string"===typeof e?(0,O.Y0)(e):e,t.next=3,this.getAddress();case 3:return r=t.sent,t.prev=4,t.next=7,this.provider.send("personal_sign",[(0,k.hexlify)(n),r.toLowerCase()]);case 7:return t.abrupt("return",t.sent);case 10:throw t.prev=10,t.t0=t.catch(4),"string"===typeof t.t0.message&&t.t0.message.match(/user denied/i)&&me.throwError("user rejected signing",i.Logger.errors.ACTION_REJECTED,{action:"signMessage",from:r,messageData:e}),t.t0;case 14:case"end":return t.stop()}}),t,this,[[4,10]])})))}},{key:"_legacySignMessage",value:function(e){return ve(this,void 0,void 0,(0,m.Z)().mark((function t(){var n,r;return(0,m.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n="string"===typeof e?(0,O.Y0)(e):e,t.next=3,this.getAddress();case 3:return r=t.sent,t.prev=4,t.next=7,this.provider.send("eth_sign",[r.toLowerCase(),(0,k.hexlify)(n)]);case 7:return t.abrupt("return",t.sent);case 10:throw t.prev=10,t.t0=t.catch(4),"string"===typeof t.t0.message&&t.t0.message.match(/user denied/i)&&me.throwError("user rejected signing",i.Logger.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:r,messageData:e}),t.t0;case 14:case"end":return t.stop()}}),t,this,[[4,10]])})))}},{key:"_signTypedData",value:function(e,t,n){return ve(this,void 0,void 0,(0,m.Z)().mark((function r(){var o,a,s=this;return(0,m.Z)().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,pe.E.resolveNames(e,t,n,(function(e){return s.provider.resolveName(e)}));case 2:return o=r.sent,r.next=5,this.getAddress();case 5:return a=r.sent,r.prev=6,r.next=9,this.provider.send("eth_signTypedData_v4",[a.toLowerCase(),JSON.stringify(pe.E.getPayload(o.domain,t,o.value))]);case 9:return r.abrupt("return",r.sent);case 12:throw r.prev=12,r.t0=r.catch(6),"string"===typeof r.t0.message&&r.t0.message.match(/user denied/i)&&me.throwError("user rejected signing",i.Logger.errors.ACTION_REJECTED,{action:"_signTypedData",from:a,messageData:{domain:o.domain,types:t,value:o.value}}),r.t0;case 16:case"end":return r.stop()}}),r,this,[[6,12]])})))}},{key:"unlock",value:function(e){return ve(this,void 0,void 0,(0,m.Z)().mark((function t(){var n,r;return(0,m.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=this.provider,t.next=3,this.getAddress();case 3:return r=t.sent,t.abrupt("return",n.send("personal_unlockAccount",[r.toLowerCase(),e,null]));case 5:case"end":return t.stop()}}),t,this)})))}}]),n}(de.E),Ae=function(e){(0,p.Z)(n,e);var t=(0,v.Z)(n);function n(){return(0,y.Z)(this,n),t.apply(this,arguments)}return(0,g.Z)(n,[{key:"sendTransaction",value:function(e){var t=this;return this.sendUncheckedTransaction(e).then((function(e){return{hash:e,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:function(n){return t.provider.waitForTransaction(e,n)}}}))}}]),n}(_e),Se={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0},Oe=function(e){(0,p.Z)(n,e);var t=(0,v.Z)(n);function n(e,r){var i;(0,y.Z)(this,n);var o=r;return null==o&&(o=new Promise((function(e,t){setTimeout((function(){i.detectNetwork().then((function(t){e(t)}),(function(e){t(e)}))}),0)}))),i=t.call(this,o),e||(e=(0,A.getStatic)(i.constructor,"defaultUrl")()),"string"===typeof e?(0,A.defineReadOnly)((0,d.Z)(i),"connection",Object.freeze({url:e})):(0,A.defineReadOnly)((0,d.Z)(i),"connection",Object.freeze((0,A.shallowCopy)(e))),i._nextId=42,i}return(0,g.Z)(n,[{key:"_cache",get:function(){return null==this._eventLoopCache&&(this._eventLoopCache={}),this._eventLoopCache}},{key:"detectNetwork",value:function(){var e=this;return this._cache.detectNetwork||(this._cache.detectNetwork=this._uncachedDetectNetwork(),setTimeout((function(){e._cache.detectNetwork=null}),0)),this._cache.detectNetwork}},{key:"_uncachedDetectNetwork",value:function(){return ve(this,void 0,void 0,(0,m.Z)().mark((function e(){var t,n;return(0,m.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,we(0);case 2:return t=null,e.prev=3,e.next=6,this.send("eth_chainId",[]);case 6:t=e.sent,e.next=19;break;case 9:return e.prev=9,e.t0=e.catch(3),e.prev=11,e.next=14,this.send("net_version",[]);case 14:t=e.sent,e.next=19;break;case 17:e.prev=17,e.t1=e.catch(11);case 19:if(null==t){e.next=28;break}return n=(0,A.getStatic)(this.constructor,"getNetwork"),e.prev=21,e.abrupt("return",n(x.O$.from(t).toNumber()));case 25:return e.prev=25,e.t2=e.catch(21),e.abrupt("return",me.throwError("could not detect network",i.Logger.errors.NETWORK_ERROR,{chainId:t,event:"invalidNetwork",serverError:e.t2}));case 28:return e.abrupt("return",me.throwError("could not detect network",i.Logger.errors.NETWORK_ERROR,{event:"noNetwork"}));case 29:case"end":return e.stop()}}),e,this,[[3,9],[11,17],[21,25]])})))}},{key:"getSigner",value:function(e){return new _e(Ee,this,e)}},{key:"getUncheckedSigner",value:function(e){return this.getSigner(e).connectUnchecked()}},{key:"listAccounts",value:function(){var e=this;return this.send("eth_accounts",[]).then((function(t){return t.map((function(t){return e.formatter.address(t)}))}))}},{key:"send",value:function(e,t){var n=this,r={method:e,params:t,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:(0,A.deepCopy)(r),provider:this});var i=["eth_chainId","eth_blockNumber"].indexOf(e)>=0;if(i&&this._cache[e])return this._cache[e];var o=(0,M.fetchJson)(this.connection,JSON.stringify(r),xe).then((function(e){return n.emit("debug",{action:"response",request:r,response:e,provider:n}),e}),(function(e){throw n.emit("debug",{action:"response",error:e,request:r,provider:n}),e}));return i&&(this._cache[e]=o,setTimeout((function(){n._cache[e]=null}),0)),o}},{key:"prepareRequest",value:function(e,t){switch(e){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[ke(t.address),t.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[ke(t.address),t.blockTag]];case"getCode":return["eth_getCode",[ke(t.address),t.blockTag]];case"getStorageAt":return["eth_getStorageAt",[ke(t.address),(0,k.hexZeroPad)(t.position,32),t.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[t.signedTransaction]];case"getBlock":return t.blockTag?["eth_getBlockByNumber",[t.blockTag,!!t.includeTransactions]]:t.blockHash?["eth_getBlockByHash",[t.blockHash,!!t.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[t.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[t.transactionHash]];case"call":return["eth_call",[(0,A.getStatic)(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0}),t.blockTag]];case"estimateGas":return["eth_estimateGas",[(0,A.getStatic)(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0})]];case"getLogs":return t.filter&&null!=t.filter.address&&(t.filter.address=ke(t.filter.address)),["eth_getLogs",[t.filter]]}return null}},{key:"perform",value:function(e,t){return ve(this,void 0,void 0,(0,m.Z)().mark((function n(){var r,o,a;return(0,m.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if("call"!==e&&"estimateGas"!==e){n.next=8;break}if(!(r=t.transaction)||null==r.type||!x.O$.from(r.type).isZero()){n.next=8;break}if(null!=r.maxFeePerGas||null!=r.maxPriorityFeePerGas){n.next=8;break}return n.next=6,this.getFeeData();case 6:null==(o=n.sent).maxFeePerGas&&null==o.maxPriorityFeePerGas&&((t=(0,A.shallowCopy)(t)).transaction=(0,A.shallowCopy)(r),delete t.transaction.type);case 8:return null==(a=this.prepareRequest(e,t))&&me.throwError(e+" not implemented",i.Logger.errors.NOT_IMPLEMENTED,{operation:e}),n.prev=10,n.next=13,this.send(a[0],a[1]);case 13:return n.abrupt("return",n.sent);case 16:return n.prev=16,n.t0=n.catch(10),n.abrupt("return",be(e,n.t0,t));case 19:case"end":return n.stop()}}),n,this,[[10,16]])})))}},{key:"_startEvent",value:function(e){"pending"===e.tag&&this._startPending(),(0,fe.Z)((0,he.Z)(n.prototype),"_startEvent",this).call(this,e)}},{key:"_startPending",value:function(){if(null==this._pendingFilter){var e=this,t=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=t,t.then((function(n){return function r(){e.send("eth_getFilterChanges",[n]).then((function(n){if(e._pendingFilter!=t)return null;var r=Promise.resolve();return n.forEach((function(t){e._emitted["t:"+t.toLowerCase()]="pending",r=r.then((function(){return e.getTransaction(t).then((function(t){return e.emit("pending",t),null}))}))})),r.then((function(){return we(1e3)}))})).then((function(){if(e._pendingFilter==t)return setTimeout((function(){r()}),0),null;e.send("eth_uninstallFilter",[n])})).catch((function(e){}))}(),n})).catch((function(e){}))}}},{key:"_stopEvent",value:function(e){"pending"===e.tag&&0===this.listenerCount("pending")&&(this._pendingFilter=null),(0,fe.Z)((0,he.Z)(n.prototype),"_stopEvent",this).call(this,e)}}],[{key:"defaultUrl",value:function(){return"http://localhost:8545"}},{key:"hexlifyTransaction",value:function(e,t){var n=(0,A.shallowCopy)(Se);if(t)for(var r in t)t[r]&&(n[r]=!0);(0,A.checkProperties)(e,n);var i={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach((function(t){if(null!=e[t]){var n=(0,k.hexValue)(x.O$.from(e[t]));"gasLimit"===t&&(t="gas"),i[t]=n}})),["from","to","data"].forEach((function(t){null!=e[t]&&(i[t]=(0,k.hexlify)(e[t]))})),e.accessList&&(i.accessList=(0,I.accessListify)(e.accessList)),i}}]),n}(ce),Me=null;try{if(null==(Me=WebSocket))throw new Error("inject please")}catch(Bt){var Ce=new i.Logger(T);Me=function(){Ce.throwError("WebSockets not supported in this environment",i.Logger.errors.UNSUPPORTED_OPERATION,{operation:"new WebSocket()"})}}var Pe=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(t){o(t)}}function s(e){try{u(r.throw(e))}catch(t){o(t)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))},Te=new i.Logger(T),je=1,Ie=function(e){(0,p.Z)(n,e);var t=(0,v.Z)(n);function n(e,r){var o,a;(0,y.Z)(this,n),"any"===r&&Te.throwError("WebSocketProvider does not support 'any' network yet",i.Logger.errors.UNSUPPORTED_OPERATION,{operation:"network:any"}),(a="string"===typeof e?t.call(this,e,r):t.call(this,"_websocket",r))._pollingInterval=-1,a._wsReady=!1,"string"===typeof e?(0,A.defineReadOnly)((0,d.Z)(a),"_websocket",new Me(a.connection.url)):(0,A.defineReadOnly)((0,d.Z)(a),"_websocket",e),(0,A.defineReadOnly)((0,d.Z)(a),"_requests",{}),(0,A.defineReadOnly)((0,d.Z)(a),"_subs",{}),(0,A.defineReadOnly)((0,d.Z)(a),"_subIds",{}),(0,A.defineReadOnly)((0,d.Z)(a),"_detectNetwork",(0,fe.Z)((o=(0,d.Z)(a),(0,he.Z)(n.prototype)),"detectNetwork",o).call(o)),a.websocket.onopen=function(){a._wsReady=!0,Object.keys(a._requests).forEach((function(e){a.websocket.send(a._requests[e].payload)}))},a.websocket.onmessage=function(e){var t=e.data,n=JSON.parse(t);if(null!=n.id){var r=String(n.id),i=a._requests[r];if(delete a._requests[r],void 0!==n.result)i.callback(null,n.result),a.emit("debug",{action:"response",request:JSON.parse(i.payload),response:n.result,provider:(0,d.Z)(a)});else{var o=null;n.error?(o=new Error(n.error.message||"unknown error"),(0,A.defineReadOnly)(o,"code",n.error.code||null),(0,A.defineReadOnly)(o,"response",t)):o=new Error("unknown error"),i.callback(o,void 0),a.emit("debug",{action:"response",error:o,request:JSON.parse(i.payload),provider:(0,d.Z)(a)})}}else if("eth_subscription"===n.method){var s=a._subs[n.params.subscription];s&&s.processFunc(n.params.result)}else console.warn("this should not happen")};var s=setInterval((function(){a.emit("poll")}),1e3);return s.unref&&s.unref(),(0,le.Z)(a)}return(0,g.Z)(n,[{key:"websocket",get:function(){return this._websocket}},{key:"detectNetwork",value:function(){return this._detectNetwork}},{key:"pollingInterval",get:function(){return 0},set:function(e){Te.throwError("cannot set polling interval on WebSocketProvider",i.Logger.errors.UNSUPPORTED_OPERATION,{operation:"setPollingInterval"})}},{key:"resetEventsBlock",value:function(e){Te.throwError("cannot reset events block on WebSocketProvider",i.Logger.errors.UNSUPPORTED_OPERATION,{operation:"resetEventBlock"})}},{key:"poll",value:function(){return Pe(this,void 0,void 0,(0,m.Z)().mark((function e(){return(0,m.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",null);case 1:case"end":return e.stop()}}),e)})))}},{key:"polling",set:function(e){e&&Te.throwError("cannot set polling on WebSocketProvider",i.Logger.errors.UNSUPPORTED_OPERATION,{operation:"setPolling"})}},{key:"send",value:function(e,t){var n=this,r=je++;return new Promise((function(i,o){var a=JSON.stringify({method:e,params:t,id:r,jsonrpc:"2.0"});n.emit("debug",{action:"request",request:JSON.parse(a),provider:n}),n._requests[String(r)]={callback:function(e,t){return e?o(e):i(t)},payload:a},n._wsReady&&n.websocket.send(a)}))}},{key:"_subscribe",value:function(e,t,n){return Pe(this,void 0,void 0,(0,m.Z)().mark((function r(){var i,o,a=this;return(0,m.Z)().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return null==(i=this._subIds[e])&&(i=Promise.all(t).then((function(e){return a.send("eth_subscribe",e)})),this._subIds[e]=i),r.next=4,i;case 4:o=r.sent,this._subs[o]={tag:e,processFunc:n};case 6:case"end":return r.stop()}}),r,this)})))}},{key:"_startEvent",value:function(e){var t=this;switch(e.type){case"block":this._subscribe("block",["newHeads"],(function(e){var n=x.O$.from(e.number).toNumber();t._emitted.block=n,t.emit("block",n)}));break;case"pending":this._subscribe("pending",["newPendingTransactions"],(function(e){t.emit("pending",e)}));break;case"filter":this._subscribe(e.tag,["logs",this._getFilter(e.filter)],(function(n){null==n.removed&&(n.removed=!1),t.emit(e.filter,t.formatter.filterLog(n))}));break;case"tx":var n=function(e){var n=e.hash;t.getTransactionReceipt(n).then((function(e){e&&t.emit(n,e)}))};n(e),this._subscribe("tx",["newHeads"],(function(e){t._events.filter((function(e){return"tx"===e.type})).forEach(n)}));break;case"debug":case"poll":case"willPoll":case"didPoll":case"error":break;default:console.log("unhandled:",e)}}},{key:"_stopEvent",value:function(e){var t=this,n=e.tag;if("tx"===e.type){if(this._events.filter((function(e){return"tx"===e.type})).length)return;n="tx"}else if(this.listenerCount(e.event))return;var r=this._subIds[n];r&&(delete this._subIds[n],r.then((function(e){t._subs[e]&&(delete t._subs[e],t.send("eth_unsubscribe",[e]))})))}},{key:"destroy",value:function(){return Pe(this,void 0,void 0,(0,m.Z)().mark((function e(){var t=this;return(0,m.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.websocket.readyState!==Me.CONNECTING){e.next=3;break}return e.next=3,new Promise((function(e){t.websocket.onopen=function(){e(!0)},t.websocket.onerror=function(){e(!1)}}));case 3:this.websocket.close(1e3);case 4:case"end":return e.stop()}}),e,this)})))}}],[{key:"defaultUrl",value:function(){return"ws://localhost:8546"}}]),n}(Oe),Ne=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(t){o(t)}}function s(e){try{u(r.throw(e))}catch(t){o(t)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))},Re=new i.Logger(T),Be=function(e){(0,p.Z)(n,e);var t=(0,v.Z)(n);function n(){return(0,y.Z)(this,n),t.apply(this,arguments)}return(0,g.Z)(n,[{key:"detectNetwork",value:function(){var e=this,t=Object.create(null,{detectNetwork:{get:function(){return(0,fe.Z)((0,he.Z)(n.prototype),"detectNetwork",e)}}});return Ne(this,void 0,void 0,(0,m.Z)().mark((function e(){var n;return(0,m.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=(n=this.network)){e.next=7;break}return e.next=4,t.detectNetwork.call(this);case 4:(n=e.sent)||Re.throwError("no network detected",i.Logger.errors.UNKNOWN_ERROR,{}),null==this._network&&((0,A.defineReadOnly)(this,"_network",n),this.emit("network",n,null));case 7:return e.abrupt("return",n);case 8:case"end":return e.stop()}}),e,this)})))}}]),n}(Oe),De=function(e){(0,p.Z)(n,e);var t=(0,v.Z)(n);function n(e,r){var i;(0,y.Z)(this,n),Re.checkAbstract(this instanceof n?this.constructor:void 0,n),e=(0,A.getStatic)(this instanceof n?this.constructor:void 0,"getNetwork")(e),r=(0,A.getStatic)(this instanceof n?this.constructor:void 0,"getApiKey")(r);var o=(0,A.getStatic)(this instanceof n?this.constructor:void 0,"getUrl")(e,r);return i=t.call(this,o,e),"string"===typeof r?(0,A.defineReadOnly)((0,d.Z)(i),"apiKey",r):null!=r&&Object.keys(r).forEach((function(e){(0,A.defineReadOnly)((0,d.Z)(i),e,r[e])})),i}return(0,g.Z)(n,[{key:"_startPending",value:function(){Re.warn("WARNING: API provider does not support pending filters")}},{key:"isCommunityResource",value:function(){return!1}},{key:"getSigner",value:function(e){return Re.throwError("API provider does not support signing",i.Logger.errors.UNSUPPORTED_OPERATION,{operation:"getSigner"})}},{key:"listAccounts",value:function(){return Promise.resolve([])}}],[{key:"getApiKey",value:function(e){return e}},{key:"getUrl",value:function(e,t){return Re.throwError("not implemented; sub-classes must override getUrl",i.Logger.errors.NOT_IMPLEMENTED,{operation:"getUrl"})}}]),n}(Be),Le=new i.Logger(T),Fe="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC",Ze=function(e){(0,p.Z)(n,e);var t=(0,v.Z)(n);function n(e,r){var i;(0,y.Z)(this,n);var o=new Ue(e,r),a=o.connection.url.replace(/^http/i,"ws").replace(".alchemyapi.",".ws.alchemyapi.");return i=t.call(this,a,o.network),(0,A.defineReadOnly)((0,d.Z)(i),"apiKey",o.apiKey),i}return(0,g.Z)(n,[{key:"isCommunityResource",value:function(){return this.apiKey===Fe}}]),n}(Ie),Ue=function(e){(0,p.Z)(n,e);var t=(0,v.Z)(n);function n(){return(0,y.Z)(this,n),t.apply(this,arguments)}return(0,g.Z)(n,[{key:"isCommunityResource",value:function(){return this.apiKey===Fe}}],[{key:"getWebSocketProvider",value:function(e,t){return new Ze(e,t)}},{key:"getApiKey",value:function(e){return null==e?Fe:(e&&"string"!==typeof e&&Le.throwArgumentError("invalid apiKey","apiKey",e),e)}},{key:"getUrl",value:function(e,t){var n=null;switch(e.name){case"homestead":n="eth-mainnet.alchemyapi.io/v2/";break;case"goerli":n="eth-goerli.g.alchemy.com/v2/";break;case"matic":n="polygon-mainnet.g.alchemy.com/v2/";break;case"maticmum":n="polygon-mumbai.g.alchemy.com/v2/";break;case"arbitrum":n="arb-mainnet.g.alchemy.com/v2/";break;case"arbitrum-goerli":n="arb-goerli.g.alchemy.com/v2/";break;case"optimism":n="opt-mainnet.g.alchemy.com/v2/";break;case"optimism-goerli":n="opt-goerli.g.alchemy.com/v2/";break;default:Le.throwArgumentError("unsupported network","network",arguments[0])}return{allowGzip:!0,url:"https://"+n+t,throttleCallback:function(e,n){return t===Fe&&F(),Promise.resolve(!0)}}}}]),n}(De),ze=new i.Logger(T),He="9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";function qe(e){switch(e){case"homestead":return"rpc.ankr.com/eth/";case"ropsten":return"rpc.ankr.com/eth_ropsten/";case"rinkeby":return"rpc.ankr.com/eth_rinkeby/";case"goerli":return"rpc.ankr.com/eth_goerli/";case"matic":return"rpc.ankr.com/polygon/";case"arbitrum":return"rpc.ankr.com/arbitrum/"}return ze.throwArgumentError("unsupported network","name",e)}var We=function(e){(0,p.Z)(n,e);var t=(0,v.Z)(n);function n(){return(0,y.Z)(this,n),t.apply(this,arguments)}return(0,g.Z)(n,[{key:"isCommunityResource",value:function(){return this.apiKey===He}}],[{key:"getApiKey",value:function(e){return null==e?He:e}},{key:"getUrl",value:function(e,t){null==t&&(t=He);var n={allowGzip:!0,url:"https://"+qe(e.name)+t,throttleCallback:function(e,n){return t.apiKey===He&&F(),Promise.resolve(!0)}};return null!=t.projectSecret&&(n.user="",n.password=t.projectSecret),n}}]),n}(De),Ve=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(t){o(t)}}function s(e){try{u(r.throw(e))}catch(t){o(t)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))},Ge=new i.Logger(T),Ke=function(e){(0,p.Z)(n,e);var t=(0,v.Z)(n);function n(){return(0,y.Z)(this,n),t.apply(this,arguments)}return(0,g.Z)(n,[{key:"perform",value:function(e,t){var r=this,i=Object.create(null,{perform:{get:function(){return(0,fe.Z)((0,he.Z)(n.prototype),"perform",r)}}});return Ve(this,void 0,void 0,(0,m.Z)().mark((function n(){var r;return(0,m.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if("getBlockNumber"!==e){n.next=5;break}return n.next=3,i.perform.call(this,"getBlock",{blockTag:"latest"});case 3:return r=n.sent,n.abrupt("return",r.number);case 5:return n.abrupt("return",i.perform.call(this,e,t));case 6:case"end":return n.stop()}}),n,this)})))}}],[{key:"getApiKey",value:function(e){return null!=e&&Ge.throwArgumentError("apiKey not supported for cloudflare","apiKey",e),null}},{key:"getUrl",value:function(e,t){var n=null;if("homestead"===e.name)n="https://cloudflare-eth.com/";else Ge.throwArgumentError("unsupported network","network",arguments[0]);return n}}]),n}(De),Qe=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(t){o(t)}}function s(e){try{u(r.throw(e))}catch(t){o(t)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))},Ye=new i.Logger(T);function Je(e){var t={};for(var n in e)if(null!=e[n]){var r=e[n];"type"===n&&0===r||(r={type:!0,gasLimit:!0,gasPrice:!0,maxFeePerGs:!0,maxPriorityFeePerGas:!0,nonce:!0,value:!0}[n]?(0,k.hexValue)((0,k.hexlify)(r)):"accessList"===n?"["+(0,I.accessListify)(r).map((function(e){return'{address:"'.concat(e.address,'",storageKeys:["').concat(e.storageKeys.join('","'),'"]}')})).join(",")+"]":(0,k.hexlify)(r),t[n]=r)}return t}function Xe(e){if(0==e.status&&("No records found"===e.message||"No transactions found"===e.message))return e.result;if(1!=e.status||"string"!==typeof e.message||!e.message.match(/^OK/)){var t=new Error("invalid response");throw t.result=JSON.stringify(e),(e.result||"").toLowerCase().indexOf("rate limit")>=0&&(t.throttleRetry=!0),t}return e.result}function $e(e){if(e&&0==e.status&&"NOTOK"==e.message&&(e.result||"").toLowerCase().indexOf("rate limit")>=0){var t=new Error("throttled response");throw t.result=JSON.stringify(e),t.throttleRetry=!0,t}if("2.0"!=e.jsonrpc){var n=new Error("invalid response");throw n.result=JSON.stringify(e),n}if(e.error){var r=new Error(e.error.message||"unknown error");throw e.error.code&&(r.code=e.error.code),e.error.data&&(r.data=e.error.data),r}return e.result}function et(e){if("pending"===e)throw new Error("pending not supported");return"latest"===e?e:parseInt(e.substring(2),16)}function tt(e,t,n){if("call"===e&&t.code===i.Logger.errors.SERVER_ERROR){var r=t.error;if(r&&(r.message.match(/reverted/i)||r.message.match(/VM execution error/i))){var o=r.data;if(o&&(o="0x"+o.replace(/^.*0x/i,"")),(0,k.isHexString)(o))return o;Ye.throwError("missing revert data in call exception",i.Logger.errors.CALL_EXCEPTION,{error:t,data:"0x"})}}var a=t.message;throw t.code===i.Logger.errors.SERVER_ERROR&&(t.error&&"string"===typeof t.error.message?a=t.error.message:"string"===typeof t.body?a=t.body:"string"===typeof t.responseText&&(a=t.responseText)),(a=(a||"").toLowerCase()).match(/insufficient funds/)&&Ye.throwError("insufficient funds for intrinsic transaction cost",i.Logger.errors.INSUFFICIENT_FUNDS,{error:t,method:e,transaction:n}),a.match(/same hash was already imported|transaction nonce is too low|nonce too low/)&&Ye.throwError("nonce has already been used",i.Logger.errors.NONCE_EXPIRED,{error:t,method:e,transaction:n}),a.match(/another transaction with same nonce/)&&Ye.throwError("replacement fee too low",i.Logger.errors.REPLACEMENT_UNDERPRICED,{error:t,method:e,transaction:n}),a.match(/execution failed due to an exception|execution reverted/)&&Ye.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",i.Logger.errors.UNPREDICTABLE_GAS_LIMIT,{error:t,method:e,transaction:n}),t}var nt=function(e){(0,p.Z)(n,e);var t=(0,v.Z)(n);function n(e,r){var i;return(0,y.Z)(this,n),i=t.call(this,e),(0,A.defineReadOnly)((0,d.Z)(i),"baseUrl",i.getBaseUrl()),(0,A.defineReadOnly)((0,d.Z)(i),"apiKey",r||null),i}return(0,g.Z)(n,[{key:"getBaseUrl",value:function(){switch(this.network?this.network.name:"invalid"){case"homestead":return"https://api.etherscan.io";case"goerli":return"https://api-goerli.etherscan.io";case"sepolia":return"https://api-sepolia.etherscan.io";case"matic":return"https://api.polygonscan.com";case"maticmum":return"https://api-testnet.polygonscan.com";case"arbitrum":return"https://api.arbiscan.io";case"arbitrum-goerli":return"https://api-goerli.arbiscan.io";case"optimism":return"https://api-optimistic.etherscan.io";case"optimism-goerli":return"https://api-goerli-optimistic.etherscan.io"}return Ye.throwArgumentError("unsupported network","network",this.network.name)}},{key:"getUrl",value:function(e,t){var n=Object.keys(t).reduce((function(e,n){var r=t[n];return null!=r&&(e+="&".concat(n,"=").concat(r)),e}),""),r=this.apiKey?"&apikey=".concat(this.apiKey):"";return"".concat(this.baseUrl,"/api?module=").concat(e).concat(n).concat(r)}},{key:"getPostUrl",value:function(){return"".concat(this.baseUrl,"/api")}},{key:"getPostData",value:function(e,t){return t.module=e,t.apikey=this.apiKey,t}},{key:"fetch",value:function(e,t,n){return Qe(this,void 0,void 0,(0,m.Z)().mark((function r(){var i,o,a,s,u,c,l=this;return(0,m.Z)().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i=n?this.getPostUrl():this.getUrl(e,t),o=n?this.getPostData(e,t):null,a="proxy"===e?$e:Xe,this.emit("debug",{action:"request",request:i,provider:this}),s={url:i,throttleSlotInterval:1e3,throttleCallback:function(e,t){return l.isCommunityResource()&&F(),Promise.resolve(!0)}},u=null,o&&(s.headers={"content-type":"application/x-www-form-urlencoded; charset=UTF-8"},u=Object.keys(o).map((function(e){return"".concat(e,"=").concat(o[e])})).join("&")),r.next=9,(0,M.fetchJson)(s,u,a||$e);case 9:return c=r.sent,this.emit("debug",{action:"response",request:i,response:(0,A.deepCopy)(c),provider:this}),r.abrupt("return",c);case 12:case"end":return r.stop()}}),r,this)})))}},{key:"detectNetwork",value:function(){return Qe(this,void 0,void 0,(0,m.Z)().mark((function e(){return(0,m.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.network);case 1:case"end":return e.stop()}}),e,this)})))}},{key:"perform",value:function(e,t){var r=this,o=Object.create(null,{perform:{get:function(){return(0,fe.Z)((0,he.Z)(n.prototype),"perform",r)}}});return Qe(this,void 0,void 0,(0,m.Z)().mark((function n(){var r,a,s,u,c,l,f,h,d;return(0,m.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:n.t0=e,n.next="getBlockNumber"===n.t0?3:"getGasPrice"===n.t0?4:"getBalance"===n.t0?5:"getTransactionCount"===n.t0?6:"getCode"===n.t0?7:"getStorageAt"===n.t0?8:"sendTransaction"===n.t0?9:"getBlock"===n.t0?10:"getTransaction"===n.t0?13:"getTransactionReceipt"===n.t0?14:"call"===n.t0?15:"estimateGas"===n.t0?29:"getLogs"===n.t0?41:"getEtherPrice"===n.t0?65:72;break;case 3:return n.abrupt("return",this.fetch("proxy",{action:"eth_blockNumber"}));case 4:return n.abrupt("return",this.fetch("proxy",{action:"eth_gasPrice"}));case 5:return n.abrupt("return",this.fetch("account",{action:"balance",address:t.address,tag:t.blockTag}));case 6:return n.abrupt("return",this.fetch("proxy",{action:"eth_getTransactionCount",address:t.address,tag:t.blockTag}));case 7:return n.abrupt("return",this.fetch("proxy",{action:"eth_getCode",address:t.address,tag:t.blockTag}));case 8:return n.abrupt("return",this.fetch("proxy",{action:"eth_getStorageAt",address:t.address,position:t.position,tag:t.blockTag}));case 9:return n.abrupt("return",this.fetch("proxy",{action:"eth_sendRawTransaction",hex:t.signedTransaction},!0).catch((function(e){return tt("sendTransaction",e,t.signedTransaction)})));case 10:if(!t.blockTag){n.next=12;break}return n.abrupt("return",this.fetch("proxy",{action:"eth_getBlockByNumber",tag:t.blockTag,boolean:t.includeTransactions?"true":"false"}));case 12:throw new Error("getBlock by blockHash not implemented");case 13:return n.abrupt("return",this.fetch("proxy",{action:"eth_getTransactionByHash",txhash:t.transactionHash}));case 14:return n.abrupt("return",this.fetch("proxy",{action:"eth_getTransactionReceipt",txhash:t.transactionHash}));case 15:if("latest"===t.blockTag){n.next=17;break}throw new Error("EtherscanProvider does not support blockTag for call");case 17:return(r=Je(t.transaction)).module="proxy",r.action="eth_call",n.prev=20,n.next=23,this.fetch("proxy",r,!0);case 23:return n.abrupt("return",n.sent);case 26:return n.prev=26,n.t1=n.catch(20),n.abrupt("return",tt("call",n.t1,t.transaction));case 29:return(a=Je(t.transaction)).module="proxy",a.action="eth_estimateGas",n.prev=32,n.next=35,this.fetch("proxy",a,!0);case 35:return n.abrupt("return",n.sent);case 38:return n.prev=38,n.t2=n.catch(32),n.abrupt("return",tt("estimateGas",n.t2,t.transaction));case 41:return s={action:"getLogs"},t.filter.fromBlock&&(s.fromBlock=et(t.filter.fromBlock)),t.filter.toBlock&&(s.toBlock=et(t.filter.toBlock)),t.filter.address&&(s.address=t.filter.address),t.filter.topics&&t.filter.topics.length>0&&(t.filter.topics.length>1&&Ye.throwError("unsupported topic count",i.Logger.errors.UNSUPPORTED_OPERATION,{topics:t.filter.topics}),1===t.filter.topics.length&&("string"===typeof(u=t.filter.topics[0])&&66===u.length||Ye.throwError("unsupported topic format",i.Logger.errors.UNSUPPORTED_OPERATION,{topic0:u}),s.topic0=u)),n.next=48,this.fetch("logs",s);case 48:c=n.sent,l={},f=0;case 51:if(!(ft?null:(r+i)/2}function ct(e){if(null===e)return"null";if("number"===typeof e||"boolean"===typeof e)return JSON.stringify(e);if("string"===typeof e)return e;if(x.O$.isBigNumber(e))return e.toString();if(Array.isArray(e))return JSON.stringify(e.map((function(e){return ct(e)})));if("object"===typeof e){var t=Object.keys(e);return t.sort(),"{"+t.map((function(t){var n=e[t];return n="function"===typeof n?"[function]":ct(n),JSON.stringify(t)+":"+n})).join(",")+"}"}throw new Error("unknown value type: "+typeof e)}var lt=1;function ft(e){var t=null,n=null,r=new Promise((function(r){t=function(){n&&(clearTimeout(n),n=null),r()},n=setTimeout(t,e)}));return{cancel:t,getPromise:function(){return r},wait:function(e){return r=r.then(e)}}}var ht=[i.Logger.errors.CALL_EXCEPTION,i.Logger.errors.INSUFFICIENT_FUNDS,i.Logger.errors.NONCE_EXPIRED,i.Logger.errors.REPLACEMENT_UNDERPRICED,i.Logger.errors.UNPREDICTABLE_GAS_LIMIT],dt=["address","args","errorArgs","errorSignature","method","transaction"];function pt(e,t){var n={weight:e.weight};return Object.defineProperty(n,"provider",{get:function(){return e.provider}}),e.start&&(n.start=e.start),t&&(n.duration=t-e.start),e.done&&(e.error?n.error=e.error:n.result=e.result||null),n}function vt(e,t,n){var r=ct;switch(t){case"getBlockNumber":return function(t){var n=t.map((function(e){return e.result})),r=ut(t.map((function(e){return e.result})),2);if(null!=r)return r=Math.ceil(r),n.indexOf(r+1)>=0&&r++,r>=e._highestBlockNumber&&(e._highestBlockNumber=r),e._highestBlockNumber};case"getGasPrice":return function(e){var t=e.map((function(e){return e.result}));return t.sort(),t[Math.floor(t.length/2)]};case"getEtherPrice":return function(e){return ut(e.map((function(e){return e.result})))};case"getBalance":case"getTransactionCount":case"getCode":case"getStorageAt":case"call":case"estimateGas":case"getLogs":break;case"getTransaction":case"getTransactionReceipt":r=function(e){return null==e?null:((e=(0,A.shallowCopy)(e)).confirmations=-1,ct(e))};break;case"getBlock":r=n.includeTransactions?function(e){return null==e?null:((e=(0,A.shallowCopy)(e)).transactions=e.transactions.map((function(e){return(e=(0,A.shallowCopy)(e)).confirmations=-1,e})),ct(e))}:function(e){return null==e?null:ct(e)};break;default:throw new Error("unknown method: "+t)}return function(e,t){return function(n){var r={};n.forEach((function(t){var n=e(t.result);r[n]||(r[n]={count:0,result:t.result}),r[n].count++}));for(var i=Object.keys(r),o=0;o=t)return a.result}}}(r,e.quorum)}function mt(e,t){return it(this,void 0,void 0,(0,m.Z)().mark((function n(){var r;return(0,m.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!(null!=(r=e.provider).blockNumber&&r.blockNumber>=t||-1===t)){n.next=3;break}return n.abrupt("return",r);case 3:return n.abrupt("return",(0,M.poll)((function(){return new Promise((function(n,i){setTimeout((function(){return r.blockNumber>=t?n(r):e.cancelled?n(null):n(void 0)}),0)}))}),{oncePoll:r}));case 4:case"end":return n.stop()}}),n)})))}function yt(e,t,n,r){return it(this,void 0,void 0,(0,m.Z)().mark((function o(){var a,s;return(0,m.Z)().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:a=e.provider,o.t0=n,o.next="getBlockNumber"===o.t0||"getGasPrice"===o.t0?4:"getEtherPrice"===o.t0?5:"getBalance"===o.t0||"getTransactionCount"===o.t0||"getCode"===o.t0?8:"getStorageAt"===o.t0?13:"getBlock"===o.t0?18:"call"===o.t0||"estimateGas"===o.t0?23:"getTransaction"===o.t0||"getTransactionReceipt"===o.t0?30:"getLogs"===o.t0?31:37;break;case 4:return o.abrupt("return",a[n]());case 5:if(!a.getEtherPrice){o.next=7;break}return o.abrupt("return",a.getEtherPrice());case 7:return o.abrupt("break",37);case 8:if(!r.blockTag||!(0,k.isHexString)(r.blockTag)){o.next=12;break}return o.next=11,mt(e,t);case 11:a=o.sent;case 12:return o.abrupt("return",a[n](r.address,r.blockTag||"latest"));case 13:if(!r.blockTag||!(0,k.isHexString)(r.blockTag)){o.next=17;break}return o.next=16,mt(e,t);case 16:a=o.sent;case 17:return o.abrupt("return",a.getStorageAt(r.address,r.position,r.blockTag||"latest"));case 18:if(!r.blockTag||!(0,k.isHexString)(r.blockTag)){o.next=22;break}return o.next=21,mt(e,t);case 21:a=o.sent;case 22:return o.abrupt("return",a[r.includeTransactions?"getBlockWithTransactions":"getBlock"](r.blockTag||r.blockHash));case 23:if(!r.blockTag||!(0,k.isHexString)(r.blockTag)){o.next=27;break}return o.next=26,mt(e,t);case 26:a=o.sent;case 27:if("call"!==n||!r.blockTag){o.next=29;break}return o.abrupt("return",a[n](r.transaction,r.blockTag));case 29:return o.abrupt("return",a[n](r.transaction));case 30:return o.abrupt("return",a[n](r.transactionHash));case 31:if(!((s=r.filter).fromBlock&&(0,k.isHexString)(s.fromBlock)||s.toBlock&&(0,k.isHexString)(s.toBlock))){o.next=36;break}return o.next=35,mt(e,t);case 35:a=o.sent;case 36:return o.abrupt("return",a.getLogs(s));case 37:return o.abrupt("return",ot.throwError("unknown method error",i.Logger.errors.UNKNOWN_ERROR,{method:n,params:r}));case 38:case"end":return o.stop()}}),o)})))}var gt=function(e){(0,p.Z)(n,e);var t=(0,v.Z)(n);function n(e,i){var o;(0,y.Z)(this,n),0===e.length&&ot.throwArgumentError("missing providers","providers",e);var a=e.map((function(e,t){if(r.zt.isProvider(e)){var n=D(e)?2e3:750;return Object.freeze({provider:e,weight:1,stallTimeout:n,priority:1})}var i=(0,A.shallowCopy)(e);null==i.priority&&(i.priority=1),null==i.stallTimeout&&(i.stallTimeout=D(e)?2e3:750),null==i.weight&&(i.weight=1);var o=i.weight;return(o%1||o>512||o<1)&&ot.throwArgumentError("invalid weight; must be integer in [1, 512]","providers[".concat(t,"].weight"),o),Object.freeze(i)})),s=a.reduce((function(e,t){return e+t.weight}),0);null==i?i=s/2:i>s&&ot.throwArgumentError("quorum will always fail; larger than total weight","quorum",i);var u=st(a.map((function(e){return e.provider.network})));return null==u&&(u=new Promise((function(e,t){setTimeout((function(){o.detectNetwork().then(e,t)}),0)}))),o=t.call(this,u),(0,A.defineReadOnly)((0,d.Z)(o),"providerConfigs",Object.freeze(a)),(0,A.defineReadOnly)((0,d.Z)(o),"quorum",i),o._highestBlockNumber=-1,o}return(0,g.Z)(n,[{key:"detectNetwork",value:function(){return it(this,void 0,void 0,(0,m.Z)().mark((function e(){var t;return(0,m.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all(this.providerConfigs.map((function(e){return e.provider.getNetwork()})));case 2:return t=e.sent,e.abrupt("return",st(t));case 4:case"end":return e.stop()}}),e,this)})))}},{key:"perform",value:function(e,t){return it(this,void 0,void 0,(0,m.Z)().mark((function n(){var r,o,a,s,u,c,l,f,h,d,p=this;return(0,m.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if("sendTransaction"!==e){n.next=13;break}return n.next=3,Promise.all(this.providerConfigs.map((function(e){return e.provider.sendTransaction(t.signedTransaction).then((function(e){return e.hash}),(function(e){return e}))})));case 3:r=n.sent,o=0;case 5:if(!(o=p.quorum)){n.next=22;break}if(void 0===(d=s(h))){n.next=18;break}return u.forEach((function(e){e.staller&&e.staller.cancel(),e.cancelled=!0})),n.abrupt("return",{v:d});case 18:if(f){n.next=21;break}return n.next=21,ft(100).getPromise();case 21:f=!1;case 22:if(v=u.reduce((function(e,t){if(!t.done||null==t.error)return e;var n=t.error.code;return ht.indexOf(n)>=0&&(e[n]||(e[n]={error:t.error,weight:0}),e[n].weight+=t.weight),e}),{}),Object.keys(v).forEach((function(e){var t=v[e];if(!(t.weight1024||e%1||e!=e)&&o.throwArgumentError("invalid length","length",e);var t=new Uint8Array(e);return s.getRandomValues(t),(0,r.arrayify)(t)}s&&s.getRandomValues||(o.warn("WARNING: Missing strong random number source"),s={getRandomValues:function(e){return o.throwError("no secure random source avaialble",i.Logger.errors.UNSUPPORTED_OPERATION,{operation:"crypto.getRandomValues"})}})},22282:function(e,t,n){"use strict";function r(e){for(var t=(e=e.slice()).length-1;t>0;t--){var n=Math.floor(Math.random()*(t+1)),r=e[t];e[t]=e[n],e[n]=r}return e}n.d(t,{y:function(){return r}})},17986:function(e,t,n){"use strict";n.r(t),n.d(t,{decode:function(){return h},encode:function(){return c}});var r=n(49716),i=n(39502),o=new i.Logger("rlp/5.7.0");function a(e){for(var t=[];e;)t.unshift(255&e),e>>=8;return t}function s(e,t,n){for(var r=0,i=0;it+1+r&&o.throwError("child data too short",i.Logger.errors.BUFFER_OVERRUN,{})}return{consumed:1+r,result:a}}function f(e,t){if(0===e.length&&o.throwError("data too short",i.Logger.errors.BUFFER_OVERRUN,{}),e[t]>=248){var n=e[t]-247;t+1+n>e.length&&o.throwError("data short segment too short",i.Logger.errors.BUFFER_OVERRUN,{});var a=s(e,t+1,n);return t+1+n+a>e.length&&o.throwError("data long segment too short",i.Logger.errors.BUFFER_OVERRUN,{}),l(e,t,t+1+n,n+a)}if(e[t]>=192){var u=e[t]-192;return t+1+u>e.length&&o.throwError("data array too short",i.Logger.errors.BUFFER_OVERRUN,{}),l(e,t,t+1,u)}if(e[t]>=184){var c=e[t]-183;t+1+c>e.length&&o.throwError("data array too short",i.Logger.errors.BUFFER_OVERRUN,{});var f=s(e,t+1,c);return t+1+c+f>e.length&&o.throwError("data array too short",i.Logger.errors.BUFFER_OVERRUN,{}),{consumed:1+c+f,result:(0,r.hexlify)(e.slice(t+1+c,t+1+c+f))}}if(e[t]>=128){var h=e[t]-128;return t+1+h>e.length&&o.throwError("data too short",i.Logger.errors.BUFFER_OVERRUN,{}),{consumed:1+h,result:(0,r.hexlify)(e.slice(t+1,t+1+h))}}return{consumed:1,result:(0,r.hexlify)(e[t])}}function h(e){var t=(0,r.arrayify)(e),n=f(t,0);return n.consumed!==t.length&&o.throwArgumentError("invalid rlp data","data",e),n.result}},86620:function(e,t,n){"use strict";n.r(t),n.d(t,{SupportedAlgorithm:function(){return i.p},computeHmac:function(){return r.Gy},ripemd160:function(){return r.bP},sha256:function(){return r.JQ},sha512:function(){return r.o}});var r=n(39598),i=n(24667)},39598:function(e,t,n){"use strict";n.d(t,{Gy:function(){return h},bP:function(){return c},JQ:function(){return l},o:function(){return f}});var r=n(33125),i=n.n(r),o=n(49716),a=n(24667),s=n(39502),u=new s.Logger("sha2/5.7.0");function c(e){return"0x"+i().ripemd160().update((0,o.arrayify)(e)).digest("hex")}function l(e){return"0x"+i().sha256().update((0,o.arrayify)(e)).digest("hex")}function f(e){return"0x"+i().sha512().update((0,o.arrayify)(e)).digest("hex")}function h(e,t,n){return a.p[e]||u.throwError("unsupported algorithm "+e,s.Logger.errors.UNSUPPORTED_OPERATION,{operation:"hmac",algorithm:e}),"0x"+i().hmac(i()[e],(0,o.arrayify)(t)).update((0,o.arrayify)(n)).digest("hex")}},24667:function(e,t,n){"use strict";var r;n.d(t,{p:function(){return r}}),function(e){e.sha256="sha256",e.sha512="sha512"}(r||(r={}))},78865:function(e,t,n){"use strict";n.r(t),n.d(t,{SigningKey:function(){return Y},computePublicKey:function(){return X},recoverPublicKey:function(){return J}});var r=n(15671),i=n(43144),o=n(29286),a=n.n(o),s=n(33125),u=n.n(s);"undefined"!==typeof globalThis?globalThis:"undefined"!==typeof window?window:"undefined"!==typeof n.g?n.g:"undefined"!==typeof self&&self;function c(e,t,n){return n={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}((void 0===t||null===t)&&n.path)}},e(n,n.exports),n.exports}var l=f;function f(e,t){if(!e)throw new Error(t||"Assertion failed")}f.equal=function(e,t,n){if(e!=t)throw new Error(n||"Assertion failed: "+e+" != "+t)};var h=c((function(e,t){var n=t;function r(e){return 1===e.length?"0"+e:e}function i(e){for(var t="",n=0;n>8,a=255&i;o?n.push(o,a):n.push(a)}return n},n.zero2=r,n.toHex=i,n.encode=function(e,t){return"hex"===t?i(e):e}})),d=c((function(e,t){var n=t;n.assert=l,n.toArray=h.toArray,n.zero2=h.zero2,n.toHex=h.toHex,n.encode=h.encode,n.getNAF=function(e,t,n){var r=new Array(Math.max(e.bitLength(),n)+1);r.fill(0);for(var i=1<(i>>1)-1?(i>>1)-u:u,o.isubn(s)):s=0,r[a]=s,o.iushrn(1)}return r},n.getJSF=function(e,t){var n=[[],[]];e=e.clone(),t=t.clone();for(var r,i=0,o=0;e.cmpn(-i)>0||t.cmpn(-o)>0;){var a,s,u=e.andln(3)+i&3,c=t.andln(3)+o&3;3===u&&(u=-1),3===c&&(c=-1),a=0===(1&u)?0:3!==(r=e.andln(7)+i&7)&&5!==r||2!==c?u:-u,n[0].push(a),s=0===(1&c)?0:3!==(r=t.andln(7)+o&7)&&5!==r||2!==u?c:-c,n[1].push(s),2*i===a+1&&(i=1-i),2*o===s+1&&(o=1-o),e.iushrn(1),t.iushrn(1)}return n},n.cachedProperty=function(e,t,n){var r="_"+t;e.prototype[t]=function(){return void 0!==this[r]?this[r]:this[r]=n.call(this)}},n.parseBytes=function(e){return"string"===typeof e?n.toArray(e,"hex"):e},n.intFromLE=function(e){return new(a())(e,"hex","le")}})),p=d.getNAF,v=d.getJSF,m=d.assert;function y(e,t){this.type=e,this.p=new(a())(t.p,16),this.red=t.prime?a().red(t.prime):a().mont(this.p),this.zero=new(a())(0).toRed(this.red),this.one=new(a())(1).toRed(this.red),this.two=new(a())(2).toRed(this.red),this.n=t.n&&new(a())(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.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 n=this.n&&this.p.div(this.n);!n||n.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var g=y;function b(e,t){this.curve=e,this.type=t,this.precomputed=null}y.prototype.point=function(){throw new Error("Not implemented")},y.prototype.validate=function(){throw new Error("Not implemented")},y.prototype._fixedNafMul=function(e,t){m(e.precomputed);var n=e._getDoubles(),r=p(t,1,this._bitLength),i=(1<=o;u--)a=(a<<1)+r[u];s.push(a)}for(var c=this.jpoint(null,null,null),l=this.jpoint(null,null,null),f=i;f>0;f--){for(o=0;o=0;s--){for(var u=0;s>=0&&0===o[s];s--)u++;if(s>=0&&u++,a=a.dblp(u),s<0)break;var c=o[s];m(0!==c),a="affine"===e.type?c>0?a.mixedAdd(i[c-1>>1]):a.mixedAdd(i[-c-1>>1].neg()):c>0?a.add(i[c-1>>1]):a.add(i[-c-1>>1].neg())}return"affine"===e.type?a.toP():a},y.prototype._wnafMulAdd=function(e,t,n,r,i){var o,a,s,u=this._wnafT1,c=this._wnafT2,l=this._wnafT3,f=0;for(o=0;o=1;o-=2){var d=o-1,m=o;if(1===u[d]&&1===u[m]){var y=[t[d],null,null,t[m]];0===t[d].y.cmp(t[m].y)?(y[1]=t[d].add(t[m]),y[2]=t[d].toJ().mixedAdd(t[m].neg())):0===t[d].y.cmp(t[m].y.redNeg())?(y[1]=t[d].toJ().mixedAdd(t[m]),y[2]=t[d].add(t[m].neg())):(y[1]=t[d].toJ().mixedAdd(t[m]),y[2]=t[d].toJ().mixedAdd(t[m].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],b=v(n[d],n[m]);for(f=Math.max(b[0].length,f),l[d]=new Array(f),l[m]=new Array(f),a=0;a=0;o--){for(var _=0;o>=0;){var A=!0;for(a=0;a=0&&_++,k=k.dblp(_),o<0)break;for(a=0;a0?s=c[a][S-1>>1]:S<0&&(s=c[a][-S-1>>1].neg()),k="affine"===s.type?k.mixedAdd(s):k.add(s))}}for(o=0;o=Math.ceil((e.bitLength()+1)/t.step)},b.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,i=0;i=0&&(o=t,s=n),r.negative&&(r=r.neg(),i=i.neg()),o.negative&&(o=o.neg(),s=s.neg()),[{a:r,b:i},{a:o,b:s}]},k.prototype._endoSplit=function(e){var t=this.endo.basis,n=t[0],r=t[1],i=r.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=i.mul(n.a),s=o.mul(r.a),u=i.mul(n.b),c=o.mul(r.b);return{k1:e.sub(a).sub(s),k2:u.add(c).neg()}},k.prototype.pointFromX=function(e,t){(e=new(a())(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),r=n.redSqrt();if(0!==r.redSqr().redSub(n).cmp(this.zero))throw new Error("invalid point");var i=r.fromRed().isOdd();return(t&&!i||!t&&i)&&(r=r.redNeg()),this.point(e,r)},k.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,n=e.y,r=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(r).redIAdd(this.b);return 0===n.redSqr().redISub(i).cmpn(0)},k.prototype._endoWnafMulAdd=function(e,t,n){for(var r=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},_.prototype.isInfinity=function(){return this.inf},_.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var n=t.redSqr().redISub(this.x).redISub(e.x),r=t.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,r)},_.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,n=this.x.redSqr(),r=e.redInvm(),i=n.redAdd(n).redIAdd(n).redIAdd(t).redMul(r),o=i.redSqr().redISub(this.x.redAdd(this.x)),a=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},_.prototype.getX=function(){return this.x.fromRed()},_.prototype.getY=function(){return this.y.fromRed()},_.prototype.mul=function(e){return e=new(a())(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},_.prototype.mulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i):this.curve._wnafMulAdd(1,r,i,2)},_.prototype.jmulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i,!0):this.curve._wnafMulAdd(1,r,i,2,!0)},_.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},_.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,r=function(e){return e.neg()};t.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(r)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(r)}}}return t},_.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},w(A,g.BasePoint),k.prototype.jpoint=function(e,t,n){return new A(this,e,t,n)},A.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),n=this.x.redMul(t),r=this.y.redMul(t).redMul(e);return this.curve.point(n,r)},A.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},A.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),n=this.z.redSqr(),r=this.x.redMul(t),i=e.x.redMul(n),o=this.y.redMul(t.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),s=r.redSub(i),u=o.redSub(a);if(0===s.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=s.redSqr(),l=c.redMul(s),f=r.redMul(c),h=u.redSqr().redIAdd(l).redISub(f).redISub(f),d=u.redMul(f.redISub(h)).redISub(o.redMul(l)),p=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(h,d,p)},A.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),n=this.x,r=e.x.redMul(t),i=this.y,o=e.y.redMul(t).redMul(this.z),a=n.redSub(r),s=i.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),c=u.redMul(a),l=n.redMul(u),f=s.redSqr().redIAdd(c).redISub(l).redISub(l),h=s.redMul(l.redISub(f)).redISub(i.redMul(c)),d=this.z.redMul(a);return this.curve.jpoint(f,h,d)},A.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var n=this;for(t=0;t=0)return!1;if(n.redIAdd(i),0===this.x.cmp(n))return!0}},A.prototype.inspect=function(){return this.isInfinity()?"":""},A.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var S=c((function(e,t){var n=t;n.base=g,n.short=E,n.mont=null,n.edwards=null})),O=c((function(e,t){var n,r=t,i=d.assert;function o(e){"short"===e.type?this.curve=new S.short(e):"edwards"===e.type?this.curve=new S.edwards(e):this.curve=new S.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function a(e,t){Object.defineProperty(r,e,{configurable:!0,enumerable:!0,get:function(){var n=new o(t);return Object.defineProperty(r,e,{configurable:!0,enumerable:!0,value:n}),n}})}r.PresetCurve=o,a("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:u().sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),a("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:u().sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),a("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:u().sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),a("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:u().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"]}),a("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:u().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"]}),a("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:u().sha256,gRed:!1,g:["9"]}),a("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:u().sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=null.crash()}catch(s){n=void 0}a("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:u().sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})}));function M(e){if(!(this instanceof M))return new M(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=h.toArray(e.entropy,e.entropyEnc||"hex"),n=h.toArray(e.nonce,e.nonceEnc||"hex"),r=h.toArray(e.pers,e.persEnc||"hex");l(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,n,r)}var C=M;M.prototype._init=function(e,t,n){var r=e.concat(t).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},M.prototype.generate=function(e,t,n,r){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!==typeof t&&(r=n,n=t,t=null),n&&(n=h.toArray(n,r||"hex"),this._update(n));for(var i=[];i.length"};var I=d.assert;function N(e,t){if(e instanceof N)return e;this._importDER(e,t)||(I(e.r&&e.s,"Signature without r or s"),this.r=new(a())(e.r,16),this.s=new(a())(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var R=N;function B(){this.place=0}function D(e,t){var n=e[t.place++];if(!(128&n))return n;var r=15&n;if(0===r||r>4)return!1;for(var i=0,o=0,a=t.place;o>>=0;return!(i<=127)&&(t.place=a,i)}function L(e){for(var t=0,n=e.length-1;!e[t]&&!(128&e[t+1])&&t>>3);for(e.push(128|n);--n;)e.push(t>>>(n<<3)&255);e.push(t)}}N.prototype._importDER=function(e,t){e=d.toArray(e,t);var n=new B;if(48!==e[n.place++])return!1;var r=D(e,n);if(!1===r)return!1;if(r+n.place!==e.length)return!1;if(2!==e[n.place++])return!1;var i=D(e,n);if(!1===i)return!1;var o=e.slice(n.place,i+n.place);if(n.place+=i,2!==e[n.place++])return!1;var s=D(e,n);if(!1===s)return!1;if(e.length!==s+n.place)return!1;var u=e.slice(n.place,s+n.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===u[0]){if(!(128&u[1]))return!1;u=u.slice(1)}return this.r=new(a())(o),this.s=new(a())(u),this.recoveryParam=null,!0},N.prototype.toDER=function(e){var t=this.r.toArray(),n=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&n[0]&&(n=[0].concat(n)),t=L(t),n=L(n);!n[0]&&!(128&n[1]);)n=n.slice(1);var r=[2];F(r,t.length),(r=r.concat(t)).push(2),F(r,n.length);var i=r.concat(n),o=[48];return F(o,i.length),o=o.concat(i),d.encode(o,e)};var Z=function(){throw new Error("unsupported")},U=d.assert;function z(e){if(!(this instanceof z))return new z(e);"string"===typeof e&&(U(Object.prototype.hasOwnProperty.call(O,e),"Unknown curve "+e),e=O[e]),e instanceof O.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}var H=z;z.prototype.keyPair=function(e){return new j(this,e)},z.prototype.keyFromPrivate=function(e,t){return j.fromPrivate(this,e,t)},z.prototype.keyFromPublic=function(e,t){return j.fromPublic(this,e,t)},z.prototype.genKeyPair=function(e){e||(e={});for(var t=new C({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||Z(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),r=this.n.sub(new(a())(2));;){var i=new(a())(t.generate(n));if(!(i.cmp(r)>0))return i.iaddn(1),this.keyFromPrivate(i)}},z.prototype._truncateToN=function(e,t){var n=8*e.byteLength()-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},z.prototype.sign=function(e,t,n,r){"object"===typeof n&&(r=n,n=null),r||(r={}),t=this.keyFromPrivate(t,n),e=this._truncateToN(new(a())(e,16));for(var i=this.n.byteLength(),o=t.getPrivate().toArray("be",i),s=e.toArray("be",i),u=new C({hash:this.hash,entropy:o,nonce:s,pers:r.pers,persEnc:r.persEnc||"utf8"}),c=this.n.sub(new(a())(1)),l=0;;l++){var f=r.k?r.k(l):new(a())(u.generate(this.n.byteLength()));if(!((f=this._truncateToN(f,!0)).cmpn(1)<=0||f.cmp(c)>=0)){var h=this.g.mul(f);if(!h.isInfinity()){var d=h.getX(),p=d.umod(this.n);if(0!==p.cmpn(0)){var v=f.invm(this.n).mul(p.mul(t.getPrivate()).iadd(e));if(0!==(v=v.umod(this.n)).cmpn(0)){var m=(h.getY().isOdd()?1:0)|(0!==d.cmp(p)?2:0);return r.canonical&&v.cmp(this.nh)>0&&(v=this.n.sub(v),m^=1),new R({r:p,s:v,recoveryParam:m})}}}}}},z.prototype.verify=function(e,t,n,r){e=this._truncateToN(new(a())(e,16)),n=this.keyFromPublic(n,r);var i=(t=new R(t,"hex")).r,o=t.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var s,u=o.invm(this.n),c=u.mul(e).umod(this.n),l=u.mul(i).umod(this.n);return this.curve._maxwellTrick?!(s=this.g.jmulAdd(c,n.getPublic(),l)).isInfinity()&&s.eqXToP(i):!(s=this.g.mulAdd(c,n.getPublic(),l)).isInfinity()&&0===s.getX().umod(this.n).cmp(i)},z.prototype.recoverPubKey=function(e,t,n,r){U((3&n)===n,"The recovery param is more than two bits"),t=new R(t,r);var i=this.n,o=new(a())(e),s=t.r,u=t.s,c=1&n,l=n>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");s=l?this.curve.pointFromX(s.add(this.curve.n),c):this.curve.pointFromX(s,c);var f=t.r.invm(i),h=i.sub(o).mul(f).umod(i),d=u.mul(f).umod(i);return this.g.mulAdd(h,s,d)},z.prototype.getKeyRecoveryParam=function(e,t,n,r){if(null!==(t=new R(t,r)).recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(e,t,i)}catch(e){continue}if(o.eq(n))return i}throw new Error("Unable to find valid recovery factor")};var q=c((function(e,t){var n=t;n.version="6.5.4",n.utils=d,n.rand=function(){throw new Error("unsupported")},n.curve=S,n.curves=O,n.ec=H,n.eddsa=null})).ec,W=n(49716),V=n(30520),G=new(n(39502).Logger)("signing-key/5.7.0"),K=null;function Q(){return K||(K=new q("secp256k1")),K}var Y=function(){function e(t){(0,r.Z)(this,e),(0,V.defineReadOnly)(this,"curve","secp256k1"),(0,V.defineReadOnly)(this,"privateKey",(0,W.hexlify)(t)),32!==(0,W.hexDataLength)(this.privateKey)&&G.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");var n=Q().keyFromPrivate((0,W.arrayify)(this.privateKey));(0,V.defineReadOnly)(this,"publicKey","0x"+n.getPublic(!1,"hex")),(0,V.defineReadOnly)(this,"compressedPublicKey","0x"+n.getPublic(!0,"hex")),(0,V.defineReadOnly)(this,"_isSigningKey",!0)}return(0,i.Z)(e,[{key:"_addPoint",value:function(e){var t=Q().keyFromPublic((0,W.arrayify)(this.publicKey)),n=Q().keyFromPublic((0,W.arrayify)(e));return"0x"+t.pub.add(n.pub).encodeCompressed("hex")}},{key:"signDigest",value:function(e){var t=Q().keyFromPrivate((0,W.arrayify)(this.privateKey)),n=(0,W.arrayify)(e);32!==n.length&&G.throwArgumentError("bad digest length","digest",e);var r=t.sign(n,{canonical:!0});return(0,W.splitSignature)({recoveryParam:r.recoveryParam,r:(0,W.hexZeroPad)("0x"+r.r.toString(16),32),s:(0,W.hexZeroPad)("0x"+r.s.toString(16),32)})}},{key:"computeSharedSecret",value:function(e){var t=Q().keyFromPrivate((0,W.arrayify)(this.privateKey)),n=Q().keyFromPublic((0,W.arrayify)(X(e)));return(0,W.hexZeroPad)("0x"+t.derive(n.getPublic()).toString(16),32)}}],[{key:"isSigningKey",value:function(e){return!(!e||!e._isSigningKey)}}]),e}();function J(e,t){var n=(0,W.splitSignature)(t),r={r:(0,W.arrayify)(n.r),s:(0,W.arrayify)(n.s)};return"0x"+Q().recoverPubKey((0,W.arrayify)(e),r,n.recoveryParam).encode("hex",!1)}function X(e,t){var n=(0,W.arrayify)(e);if(32===n.length){var r=new Y(n);return t?"0x"+Q().keyFromPrivate(n).getPublic(!0,"hex"):r.publicKey}return 33===n.length?t?(0,W.hexlify)(n):"0x"+Q().keyFromPublic(n).getPublic(!1,"hex"):65===n.length?t?"0x"+Q().keyFromPublic(n).getPublic(!0,"hex"):(0,W.hexlify)(n):G.throwArgumentError("invalid public or private key","key","[REDACTED]")}},29286:function(e,t,n){!function(e,t){"use strict";function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function i(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function o(e,t,n){if(o.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}var a;"object"===typeof e?e.exports=o:t.BN=o,o.BN=o,o.wordSize=26;try{a="undefined"!==typeof window&&"undefined"!==typeof window.Buffer?window.Buffer:n(62808).Buffer}catch(M){}function s(e,t){var n=e.charCodeAt(t);return n>=48&&n<=57?n-48:n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:void r(!1,"Invalid character in "+e)}function u(e,t,n){var r=s(e,n);return n-1>=t&&(r|=s(e,n-1)<<4),r}function c(e,t,n,i){for(var o=0,a=0,s=Math.min(e.length,n),u=t;u=49?c-49+10:c>=17?c-17+10:c,r(c>=0&&a0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,n){if("number"===typeof e)return this._initNumber(e,t,n);if("object"===typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)a=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=a<>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===n)for(i=0,o=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},o.prototype._parseHex=function(e,t,n){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r=t;r-=2)i=u(e,t,r)<=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(r=(e.length-t)%2===0?t+1:t;r=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this._strip()},o.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var o=e.length-n,a=o%r,s=Math.min(o,o-a)+n,u=0,l=n;l1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!==typeof Symbol&&"function"===typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=f}catch(M){o.prototype.inspect=f}else o.prototype.inspect=f;function f(){return(this.red?""}var h=["","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],p=[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];o.prototype.toString=function(e,t){var n;if(t=0|t||1,16===(e=e||10)||"hex"===e){n="";for(var i=0,o=0,a=0;a>>24-i&16777215,(i+=2)>=26&&(i-=26,a--),n=0!==o||a!==this.length-1?h[6-u.length]+u+n:u+n}for(0!==o&&(n=o.toString(16)+n);n.length%t!==0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&e>=2&&e<=36){var c=d[e],l=p[e];n="";var f=this.clone();for(f.negative=0;!f.isZero();){var v=f.modrn(l).toString(e);n=(f=f.idivn(l)).isZero()?v+n:h[c-v.length]+v+n}for(this.isZero()&&(n="0"+n);n.length%t!==0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16,2)},a&&(o.prototype.toBuffer=function(e,t){return this.toArrayLike(a,e,t)}),o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)};function v(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.words[0],a=i*o,s=67108863&a,u=a/67108864|0;n.words[0]=s;for(var c=1;c>>26,f=67108863&u,h=Math.min(c,t.length-1),d=Math.max(0,c-e.length+1);d<=h;d++){var p=c-d|0;l+=(a=(i=0|e.words[p])*(o=0|t.words[d])+f)/67108864|0,f=67108863&a}n.words[c]=0|f,u=0|l}return 0!==u?n.words[c]=0|u:n.length--,n._strip()}o.prototype.toArrayLike=function(e,t,n){this._strip();var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0");var a=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,o);return this["_toArrayLike"+("le"===t?"LE":"BE")](a,i),a},o.prototype._toArrayLikeLE=function(e,t){for(var n=0,r=0,i=0,o=0;i>8&255),n>16&255),6===o?(n>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n=0&&(e[n--]=a>>8&255),n>=0&&(e[n--]=a>>16&255),6===o?(n>=0&&(e[n--]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n>=0)for(e[n--]=r;n>=0;)e[n--]=0},Math.clz32?o.prototype._countBits=function(e){return 32-Math.clz32(e)}:o.prototype._countBits=function(e){var t=e,n=0;return t>=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0===(8191&t)&&(n+=13,t>>>=13),0===(127&t)&&(n+=7,t>>>=7),0===(15&t)&&(n+=4,t>>>=4),0===(3&t)&&(n+=2,t>>>=2),0===(1&t)&&n++,n},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;ne.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;re.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){r("number"===typeof e&&e>=0);var t=0|Math.ceil(e/26),n=e%26;this._expand(t),n>0&&t--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-n),this._strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){r("number"===typeof e&&e>=0);var n=e/26|0,i=e%26;return this._expand(n+1),this.words[n]=t?this.words[n]|1<e.length?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var o=0,a=0;a>26,this.words[a]=67108863&t;for(;0!==o&&a>26,this.words[a]=67108863&t;if(0===o&&a>>13,d=0|a[1],p=8191&d,v=d>>>13,m=0|a[2],y=8191&m,g=m>>>13,b=0|a[3],w=8191&b,x=b>>>13,k=0|a[4],E=8191&k,_=k>>>13,A=0|a[5],S=8191&A,O=A>>>13,M=0|a[6],C=8191&M,P=M>>>13,T=0|a[7],j=8191&T,I=T>>>13,N=0|a[8],R=8191&N,B=N>>>13,D=0|a[9],L=8191&D,F=D>>>13,Z=0|s[0],U=8191&Z,z=Z>>>13,H=0|s[1],q=8191&H,W=H>>>13,V=0|s[2],G=8191&V,K=V>>>13,Q=0|s[3],Y=8191&Q,J=Q>>>13,X=0|s[4],$=8191&X,ee=X>>>13,te=0|s[5],ne=8191&te,re=te>>>13,ie=0|s[6],oe=8191&ie,ae=ie>>>13,se=0|s[7],ue=8191&se,ce=se>>>13,le=0|s[8],fe=8191&le,he=le>>>13,de=0|s[9],pe=8191&de,ve=de>>>13;n.negative=e.negative^t.negative,n.length=19;var me=(c+(r=Math.imul(f,U))|0)+((8191&(i=(i=Math.imul(f,z))+Math.imul(h,U)|0))<<13)|0;c=((o=Math.imul(h,z))+(i>>>13)|0)+(me>>>26)|0,me&=67108863,r=Math.imul(p,U),i=(i=Math.imul(p,z))+Math.imul(v,U)|0,o=Math.imul(v,z);var ye=(c+(r=r+Math.imul(f,q)|0)|0)+((8191&(i=(i=i+Math.imul(f,W)|0)+Math.imul(h,q)|0))<<13)|0;c=((o=o+Math.imul(h,W)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,r=Math.imul(y,U),i=(i=Math.imul(y,z))+Math.imul(g,U)|0,o=Math.imul(g,z),r=r+Math.imul(p,q)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(v,q)|0,o=o+Math.imul(v,W)|0;var ge=(c+(r=r+Math.imul(f,G)|0)|0)+((8191&(i=(i=i+Math.imul(f,K)|0)+Math.imul(h,G)|0))<<13)|0;c=((o=o+Math.imul(h,K)|0)+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,r=Math.imul(w,U),i=(i=Math.imul(w,z))+Math.imul(x,U)|0,o=Math.imul(x,z),r=r+Math.imul(y,q)|0,i=(i=i+Math.imul(y,W)|0)+Math.imul(g,q)|0,o=o+Math.imul(g,W)|0,r=r+Math.imul(p,G)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,K)|0;var be=(c+(r=r+Math.imul(f,Y)|0)|0)+((8191&(i=(i=i+Math.imul(f,J)|0)+Math.imul(h,Y)|0))<<13)|0;c=((o=o+Math.imul(h,J)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,r=Math.imul(E,U),i=(i=Math.imul(E,z))+Math.imul(_,U)|0,o=Math.imul(_,z),r=r+Math.imul(w,q)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(x,q)|0,o=o+Math.imul(x,W)|0,r=r+Math.imul(y,G)|0,i=(i=i+Math.imul(y,K)|0)+Math.imul(g,G)|0,o=o+Math.imul(g,K)|0,r=r+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,J)|0)+Math.imul(v,Y)|0,o=o+Math.imul(v,J)|0;var we=(c+(r=r+Math.imul(f,$)|0)|0)+((8191&(i=(i=i+Math.imul(f,ee)|0)+Math.imul(h,$)|0))<<13)|0;c=((o=o+Math.imul(h,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,r=Math.imul(S,U),i=(i=Math.imul(S,z))+Math.imul(O,U)|0,o=Math.imul(O,z),r=r+Math.imul(E,q)|0,i=(i=i+Math.imul(E,W)|0)+Math.imul(_,q)|0,o=o+Math.imul(_,W)|0,r=r+Math.imul(w,G)|0,i=(i=i+Math.imul(w,K)|0)+Math.imul(x,G)|0,o=o+Math.imul(x,K)|0,r=r+Math.imul(y,Y)|0,i=(i=i+Math.imul(y,J)|0)+Math.imul(g,Y)|0,o=o+Math.imul(g,J)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(v,$)|0,o=o+Math.imul(v,ee)|0;var xe=(c+(r=r+Math.imul(f,ne)|0)|0)+((8191&(i=(i=i+Math.imul(f,re)|0)+Math.imul(h,ne)|0))<<13)|0;c=((o=o+Math.imul(h,re)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,r=Math.imul(C,U),i=(i=Math.imul(C,z))+Math.imul(P,U)|0,o=Math.imul(P,z),r=r+Math.imul(S,q)|0,i=(i=i+Math.imul(S,W)|0)+Math.imul(O,q)|0,o=o+Math.imul(O,W)|0,r=r+Math.imul(E,G)|0,i=(i=i+Math.imul(E,K)|0)+Math.imul(_,G)|0,o=o+Math.imul(_,K)|0,r=r+Math.imul(w,Y)|0,i=(i=i+Math.imul(w,J)|0)+Math.imul(x,Y)|0,o=o+Math.imul(x,J)|0,r=r+Math.imul(y,$)|0,i=(i=i+Math.imul(y,ee)|0)+Math.imul(g,$)|0,o=o+Math.imul(g,ee)|0,r=r+Math.imul(p,ne)|0,i=(i=i+Math.imul(p,re)|0)+Math.imul(v,ne)|0,o=o+Math.imul(v,re)|0;var ke=(c+(r=r+Math.imul(f,oe)|0)|0)+((8191&(i=(i=i+Math.imul(f,ae)|0)+Math.imul(h,oe)|0))<<13)|0;c=((o=o+Math.imul(h,ae)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,r=Math.imul(j,U),i=(i=Math.imul(j,z))+Math.imul(I,U)|0,o=Math.imul(I,z),r=r+Math.imul(C,q)|0,i=(i=i+Math.imul(C,W)|0)+Math.imul(P,q)|0,o=o+Math.imul(P,W)|0,r=r+Math.imul(S,G)|0,i=(i=i+Math.imul(S,K)|0)+Math.imul(O,G)|0,o=o+Math.imul(O,K)|0,r=r+Math.imul(E,Y)|0,i=(i=i+Math.imul(E,J)|0)+Math.imul(_,Y)|0,o=o+Math.imul(_,J)|0,r=r+Math.imul(w,$)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(x,$)|0,o=o+Math.imul(x,ee)|0,r=r+Math.imul(y,ne)|0,i=(i=i+Math.imul(y,re)|0)+Math.imul(g,ne)|0,o=o+Math.imul(g,re)|0,r=r+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,ae)|0)+Math.imul(v,oe)|0,o=o+Math.imul(v,ae)|0;var Ee=(c+(r=r+Math.imul(f,ue)|0)|0)+((8191&(i=(i=i+Math.imul(f,ce)|0)+Math.imul(h,ue)|0))<<13)|0;c=((o=o+Math.imul(h,ce)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,r=Math.imul(R,U),i=(i=Math.imul(R,z))+Math.imul(B,U)|0,o=Math.imul(B,z),r=r+Math.imul(j,q)|0,i=(i=i+Math.imul(j,W)|0)+Math.imul(I,q)|0,o=o+Math.imul(I,W)|0,r=r+Math.imul(C,G)|0,i=(i=i+Math.imul(C,K)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,K)|0,r=r+Math.imul(S,Y)|0,i=(i=i+Math.imul(S,J)|0)+Math.imul(O,Y)|0,o=o+Math.imul(O,J)|0,r=r+Math.imul(E,$)|0,i=(i=i+Math.imul(E,ee)|0)+Math.imul(_,$)|0,o=o+Math.imul(_,ee)|0,r=r+Math.imul(w,ne)|0,i=(i=i+Math.imul(w,re)|0)+Math.imul(x,ne)|0,o=o+Math.imul(x,re)|0,r=r+Math.imul(y,oe)|0,i=(i=i+Math.imul(y,ae)|0)+Math.imul(g,oe)|0,o=o+Math.imul(g,ae)|0,r=r+Math.imul(p,ue)|0,i=(i=i+Math.imul(p,ce)|0)+Math.imul(v,ue)|0,o=o+Math.imul(v,ce)|0;var _e=(c+(r=r+Math.imul(f,fe)|0)|0)+((8191&(i=(i=i+Math.imul(f,he)|0)+Math.imul(h,fe)|0))<<13)|0;c=((o=o+Math.imul(h,he)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,r=Math.imul(L,U),i=(i=Math.imul(L,z))+Math.imul(F,U)|0,o=Math.imul(F,z),r=r+Math.imul(R,q)|0,i=(i=i+Math.imul(R,W)|0)+Math.imul(B,q)|0,o=o+Math.imul(B,W)|0,r=r+Math.imul(j,G)|0,i=(i=i+Math.imul(j,K)|0)+Math.imul(I,G)|0,o=o+Math.imul(I,K)|0,r=r+Math.imul(C,Y)|0,i=(i=i+Math.imul(C,J)|0)+Math.imul(P,Y)|0,o=o+Math.imul(P,J)|0,r=r+Math.imul(S,$)|0,i=(i=i+Math.imul(S,ee)|0)+Math.imul(O,$)|0,o=o+Math.imul(O,ee)|0,r=r+Math.imul(E,ne)|0,i=(i=i+Math.imul(E,re)|0)+Math.imul(_,ne)|0,o=o+Math.imul(_,re)|0,r=r+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,ae)|0)+Math.imul(x,oe)|0,o=o+Math.imul(x,ae)|0,r=r+Math.imul(y,ue)|0,i=(i=i+Math.imul(y,ce)|0)+Math.imul(g,ue)|0,o=o+Math.imul(g,ce)|0,r=r+Math.imul(p,fe)|0,i=(i=i+Math.imul(p,he)|0)+Math.imul(v,fe)|0,o=o+Math.imul(v,he)|0;var Ae=(c+(r=r+Math.imul(f,pe)|0)|0)+((8191&(i=(i=i+Math.imul(f,ve)|0)+Math.imul(h,pe)|0))<<13)|0;c=((o=o+Math.imul(h,ve)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,r=Math.imul(L,q),i=(i=Math.imul(L,W))+Math.imul(F,q)|0,o=Math.imul(F,W),r=r+Math.imul(R,G)|0,i=(i=i+Math.imul(R,K)|0)+Math.imul(B,G)|0,o=o+Math.imul(B,K)|0,r=r+Math.imul(j,Y)|0,i=(i=i+Math.imul(j,J)|0)+Math.imul(I,Y)|0,o=o+Math.imul(I,J)|0,r=r+Math.imul(C,$)|0,i=(i=i+Math.imul(C,ee)|0)+Math.imul(P,$)|0,o=o+Math.imul(P,ee)|0,r=r+Math.imul(S,ne)|0,i=(i=i+Math.imul(S,re)|0)+Math.imul(O,ne)|0,o=o+Math.imul(O,re)|0,r=r+Math.imul(E,oe)|0,i=(i=i+Math.imul(E,ae)|0)+Math.imul(_,oe)|0,o=o+Math.imul(_,ae)|0,r=r+Math.imul(w,ue)|0,i=(i=i+Math.imul(w,ce)|0)+Math.imul(x,ue)|0,o=o+Math.imul(x,ce)|0,r=r+Math.imul(y,fe)|0,i=(i=i+Math.imul(y,he)|0)+Math.imul(g,fe)|0,o=o+Math.imul(g,he)|0;var Se=(c+(r=r+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,ve)|0)+Math.imul(v,pe)|0))<<13)|0;c=((o=o+Math.imul(v,ve)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,r=Math.imul(L,G),i=(i=Math.imul(L,K))+Math.imul(F,G)|0,o=Math.imul(F,K),r=r+Math.imul(R,Y)|0,i=(i=i+Math.imul(R,J)|0)+Math.imul(B,Y)|0,o=o+Math.imul(B,J)|0,r=r+Math.imul(j,$)|0,i=(i=i+Math.imul(j,ee)|0)+Math.imul(I,$)|0,o=o+Math.imul(I,ee)|0,r=r+Math.imul(C,ne)|0,i=(i=i+Math.imul(C,re)|0)+Math.imul(P,ne)|0,o=o+Math.imul(P,re)|0,r=r+Math.imul(S,oe)|0,i=(i=i+Math.imul(S,ae)|0)+Math.imul(O,oe)|0,o=o+Math.imul(O,ae)|0,r=r+Math.imul(E,ue)|0,i=(i=i+Math.imul(E,ce)|0)+Math.imul(_,ue)|0,o=o+Math.imul(_,ce)|0,r=r+Math.imul(w,fe)|0,i=(i=i+Math.imul(w,he)|0)+Math.imul(x,fe)|0,o=o+Math.imul(x,he)|0;var Oe=(c+(r=r+Math.imul(y,pe)|0)|0)+((8191&(i=(i=i+Math.imul(y,ve)|0)+Math.imul(g,pe)|0))<<13)|0;c=((o=o+Math.imul(g,ve)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,r=Math.imul(L,Y),i=(i=Math.imul(L,J))+Math.imul(F,Y)|0,o=Math.imul(F,J),r=r+Math.imul(R,$)|0,i=(i=i+Math.imul(R,ee)|0)+Math.imul(B,$)|0,o=o+Math.imul(B,ee)|0,r=r+Math.imul(j,ne)|0,i=(i=i+Math.imul(j,re)|0)+Math.imul(I,ne)|0,o=o+Math.imul(I,re)|0,r=r+Math.imul(C,oe)|0,i=(i=i+Math.imul(C,ae)|0)+Math.imul(P,oe)|0,o=o+Math.imul(P,ae)|0,r=r+Math.imul(S,ue)|0,i=(i=i+Math.imul(S,ce)|0)+Math.imul(O,ue)|0,o=o+Math.imul(O,ce)|0,r=r+Math.imul(E,fe)|0,i=(i=i+Math.imul(E,he)|0)+Math.imul(_,fe)|0,o=o+Math.imul(_,he)|0;var Me=(c+(r=r+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,ve)|0)+Math.imul(x,pe)|0))<<13)|0;c=((o=o+Math.imul(x,ve)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,r=Math.imul(L,$),i=(i=Math.imul(L,ee))+Math.imul(F,$)|0,o=Math.imul(F,ee),r=r+Math.imul(R,ne)|0,i=(i=i+Math.imul(R,re)|0)+Math.imul(B,ne)|0,o=o+Math.imul(B,re)|0,r=r+Math.imul(j,oe)|0,i=(i=i+Math.imul(j,ae)|0)+Math.imul(I,oe)|0,o=o+Math.imul(I,ae)|0,r=r+Math.imul(C,ue)|0,i=(i=i+Math.imul(C,ce)|0)+Math.imul(P,ue)|0,o=o+Math.imul(P,ce)|0,r=r+Math.imul(S,fe)|0,i=(i=i+Math.imul(S,he)|0)+Math.imul(O,fe)|0,o=o+Math.imul(O,he)|0;var Ce=(c+(r=r+Math.imul(E,pe)|0)|0)+((8191&(i=(i=i+Math.imul(E,ve)|0)+Math.imul(_,pe)|0))<<13)|0;c=((o=o+Math.imul(_,ve)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,r=Math.imul(L,ne),i=(i=Math.imul(L,re))+Math.imul(F,ne)|0,o=Math.imul(F,re),r=r+Math.imul(R,oe)|0,i=(i=i+Math.imul(R,ae)|0)+Math.imul(B,oe)|0,o=o+Math.imul(B,ae)|0,r=r+Math.imul(j,ue)|0,i=(i=i+Math.imul(j,ce)|0)+Math.imul(I,ue)|0,o=o+Math.imul(I,ce)|0,r=r+Math.imul(C,fe)|0,i=(i=i+Math.imul(C,he)|0)+Math.imul(P,fe)|0,o=o+Math.imul(P,he)|0;var Pe=(c+(r=r+Math.imul(S,pe)|0)|0)+((8191&(i=(i=i+Math.imul(S,ve)|0)+Math.imul(O,pe)|0))<<13)|0;c=((o=o+Math.imul(O,ve)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,r=Math.imul(L,oe),i=(i=Math.imul(L,ae))+Math.imul(F,oe)|0,o=Math.imul(F,ae),r=r+Math.imul(R,ue)|0,i=(i=i+Math.imul(R,ce)|0)+Math.imul(B,ue)|0,o=o+Math.imul(B,ce)|0,r=r+Math.imul(j,fe)|0,i=(i=i+Math.imul(j,he)|0)+Math.imul(I,fe)|0,o=o+Math.imul(I,he)|0;var Te=(c+(r=r+Math.imul(C,pe)|0)|0)+((8191&(i=(i=i+Math.imul(C,ve)|0)+Math.imul(P,pe)|0))<<13)|0;c=((o=o+Math.imul(P,ve)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,r=Math.imul(L,ue),i=(i=Math.imul(L,ce))+Math.imul(F,ue)|0,o=Math.imul(F,ce),r=r+Math.imul(R,fe)|0,i=(i=i+Math.imul(R,he)|0)+Math.imul(B,fe)|0,o=o+Math.imul(B,he)|0;var je=(c+(r=r+Math.imul(j,pe)|0)|0)+((8191&(i=(i=i+Math.imul(j,ve)|0)+Math.imul(I,pe)|0))<<13)|0;c=((o=o+Math.imul(I,ve)|0)+(i>>>13)|0)+(je>>>26)|0,je&=67108863,r=Math.imul(L,fe),i=(i=Math.imul(L,he))+Math.imul(F,fe)|0,o=Math.imul(F,he);var Ie=(c+(r=r+Math.imul(R,pe)|0)|0)+((8191&(i=(i=i+Math.imul(R,ve)|0)+Math.imul(B,pe)|0))<<13)|0;c=((o=o+Math.imul(B,ve)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863;var Ne=(c+(r=Math.imul(L,pe))|0)+((8191&(i=(i=Math.imul(L,ve))+Math.imul(F,pe)|0))<<13)|0;return c=((o=Math.imul(F,ve))+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,u[0]=me,u[1]=ye,u[2]=ge,u[3]=be,u[4]=we,u[5]=xe,u[6]=ke,u[7]=Ee,u[8]=_e,u[9]=Ae,u[10]=Se,u[11]=Oe,u[12]=Me,u[13]=Ce,u[14]=Pe,u[15]=Te,u[16]=je,u[17]=Ie,u[18]=Ne,0!==c&&(u[19]=c,n.length++),n};function y(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n._strip()}function g(e,t,n){return y(e,t,n)}function b(e,t){this.x=e,this.y=t}Math.imul||(m=v),o.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?m(this,e,t):n<63?v(this,e,t):n<1024?y(this,e,t):g(this,e,t)},b.prototype.makeRBT=function(e){for(var t=new Array(e),n=o.prototype._countBits(e)-1,r=0;r>=1;return r},b.prototype.permute=function(e,t,n,r,i,o){for(var a=0;a>>=1)i++;return 1<>>=13,n[2*a+1]=8191&o,o>>>=13;for(a=2*t;a>=26,n+=o/67108864|0,n+=a>>>26,this.words[i]=67108863&a}return 0!==n&&(this.words[i]=n,this.length++),t?this.ineg():this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),n=0;n>>i&1}return t}(e);if(0===t.length)return new o(1);for(var n=this,r=0;r=0);var t,n=e%26,i=(e-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var a=0;for(t=0;t>>26-n}a&&(this.words[t]=a,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t=0),i=t?(t-t%26)/26:0;var o=e%26,a=Math.min((e-o)/26,this.length),s=67108863^67108863>>>o<a)for(this.length-=a,c=0;c=0&&(0!==l||c>=i);c--){var f=0|this.words[c];this.words[c]=l<<26-o|f>>>o,l=f&s}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){r("number"===typeof e&&e>=0);var t=e%26,n=(e-t)/26,i=1<=0);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==t&&n++,this.length=Math.min(n,this.length),0!==t){var i=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(r("number"===typeof e),r(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(u/67108864|0),this.words[i+n]=67108863&o}for(;i>26,this.words[i+n]=67108863&o;if(0===s)return this._strip();for(r(-1===s),s=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),i=e,a=0|i.words[i.length-1];0!==(n=26-this._countBits(a))&&(i=i.ushln(n),r.iushln(n),a=0|i.words[i.length-1]);var s,u=r.length-i.length;if("mod"!==t){(s=new o(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c=0;f--){var h=67108864*(0|r.words[i.length+f])+(0|r.words[i.length+f-1]);for(h=Math.min(h/a|0,67108863),r._ishlnsubmul(i,h,f);0!==r.negative;)h--,r.negative=0,r._ishlnsubmul(i,1,f),r.isZero()||(r.negative^=1);s&&(s.words[f]=h)}return s&&s._strip(),r._strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},o.prototype.divmod=function(e,t,n){return r(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(i=s.div.neg()),"div"!==t&&(a=s.mod.neg(),n&&0!==a.negative&&a.iadd(e)),{div:i,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(i=s.div.neg()),{div:i,mod:s.mod}):0!==(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),n&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modrn(e.words[0]))}:this._wordDiv(e,t);var i,a,s},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modrn=function(e){var t=e<0;t&&(e=-e),r(e<=67108863);for(var n=(1<<26)%e,i=0,o=this.length-1;o>=0;o--)i=(n*i+(0|this.words[o]))%e;return t?-i:i},o.prototype.modn=function(e){return this.modrn(e)},o.prototype.idivn=function(e){var t=e<0;t&&(e=-e),r(e<=67108863);for(var n=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*n;this.words[i]=o/e|0,n=o%e}return this._strip(),t?this.ineg():this},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new o(1),a=new o(0),s=new o(0),u=new o(1),c=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++c;for(var l=n.clone(),f=t.clone();!t.isZero();){for(var h=0,d=1;0===(t.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(l),a.isub(f)),i.iushrn(1),a.iushrn(1);for(var p=0,v=1;0===(n.words[0]&v)&&p<26;++p,v<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(f)),s.iushrn(1),u.iushrn(1);t.cmp(n)>=0?(t.isub(n),i.isub(s),a.isub(u)):(n.isub(t),s.isub(i),u.isub(a))}return{a:s,b:u,gcd:n.iushln(c)}},o.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,a=new o(1),s=new o(0),u=n.clone();t.cmpn(1)>0&&n.cmpn(1)>0;){for(var c=0,l=1;0===(t.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(t.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var f=0,h=1;0===(n.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(n.iushrn(f);f-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);t.cmp(n)>=0?(t.isub(n),a.isub(s)):(n.isub(t),s.isub(a))}return(i=0===t.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(e),i},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var o=t;t=n,n=o}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return 0===(1&this.words[0])},o.prototype.isOdd=function(){return 1===(1&this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){r("number"===typeof e);var t=e%26,n=(e-t)/26,i=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(e){var t,n=e<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this._strip(),this.length>1)t=1;else{n&&(e=-e),r(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:ie.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){ri&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new S(e)},o.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var w={k256:null,p224:null,p192:null,p25519:null};function x(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function k(){x.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function E(){x.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){x.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function A(){x.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(e){if("string"===typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function O(e){S.call(this,e),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(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)}x.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},x.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},x.prototype.split=function(e,t){e.iushrn(this.n,0,t)},x.prototype.imulK=function(e){return e.imul(this.k)},i(k,x),k.prototype.split=function(e,t){for(var n=4194303,r=Math.min(e.length,9),i=0;i>>22,o=a}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},k.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(w[e])return w[e];var t;if("k256"===e)t=new k;else if("p224"===e)t=new E;else if("p192"===e)t=new _;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new A}return w[e]=t,t},S.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},S.prototype._verify2=function(e,t){r(0===(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},S.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(l(e,e.umod(this.m)._forceRed(this)),e)},S.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},S.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},S.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},S.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},S.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},S.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},S.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},S.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},S.prototype.isqr=function(e){return this.imul(e,e.clone())},S.prototype.sqr=function(e){return this.mul(e,e)},S.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2===1),3===t){var n=this.m.add(new o(1)).iushrn(2);return this.pow(e,n)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);r(!i.isZero());var s=new o(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,c).cmp(u);)l.redIAdd(u);for(var f=this.pow(l,i),h=this.pow(e,i.addn(1).iushrn(1)),d=this.pow(e,i),p=a;0!==d.cmp(s);){for(var v=d,m=0;0!==v.cmp(s);m++)v=v.redSqr();r(m=0;r--){for(var c=t.words[r],l=u-1;l>=0;l--){var f=c>>l&1;i!==n[0]&&(i=this.sqr(i)),0!==f||0!==a?(a<<=1,a|=f,(4===++s||0===r&&0===l)&&(i=this.mul(i,n[a]),s=0,a=0)):s=0}u=26}return i},S.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},S.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new O(e)},i(O,S),O.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},O.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},O.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},O.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},O.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=n.nmd(e),this)},84530:function(e,t,n){"use strict";n.r(t),n.d(t,{keccak256:function(){return m},pack:function(){return v},sha256:function(){return y}});var r=n(2257),i=n(49716),o=n(88062),a=n(39598),s=n(83374),u=n(39502),c=new RegExp("^bytes([0-9]+)$"),l=new RegExp("^(u?int)([0-9]*)$"),f=new RegExp("^(.*)\\[([0-9]*)\\]$"),h="0000000000000000000000000000000000000000000000000000000000000000",d=new u.Logger("solidity/5.7.0");function p(e,t,n){switch(e){case"address":return n?(0,i.zeroPad)(t,32):(0,i.arrayify)(t);case"string":return(0,s.Y0)(t);case"bytes":return(0,i.arrayify)(t);case"bool":return t=t?"0x01":"0x00",n?(0,i.zeroPad)(t,32):(0,i.arrayify)(t)}var o=e.match(l);if(o){var a=parseInt(o[2]||"256");return(o[2]&&String(a)!==o[2]||a%8!==0||0===a||a>256)&&d.throwArgumentError("invalid number type","type",e),n&&(a=256),t=r.O$.from(t).toTwos(a),(0,i.zeroPad)(t,a/8)}if(o=e.match(c)){var u=parseInt(o[1]);return(String(u)!==o[1]||0===u||u>32)&&d.throwArgumentError("invalid bytes type","type",e),(0,i.arrayify)(t).byteLength!==u&&d.throwArgumentError("invalid value for ".concat(e),"value",t),n?(0,i.arrayify)((t+h).substring(0,66)):t}if((o=e.match(f))&&Array.isArray(t)){var v=o[1];parseInt(o[2]||String(t.length))!=t.length&&d.throwArgumentError("invalid array length for ".concat(e),"value",t);var m=[];return t.forEach((function(e){m.push(p(v,e,!0))})),(0,i.concat)(m)}return d.throwArgumentError("invalid type","type",e)}function v(e,t){e.length!=t.length&&d.throwArgumentError("wrong number of values; expected ${ types.length }","values",t);var n=[];return e.forEach((function(e,r){n.push(p(e,t[r]))})),(0,i.hexlify)((0,i.concat)(n))}function m(e,t){return(0,o.keccak256)(v(e,t))}function y(e,t){return(0,a.JQ)(v(e,t))}},23902:function(e,t,n){"use strict";n.r(t),n.d(t,{UnicodeNormalizationForm:function(){return o.Uj},Utf8ErrorFuncs:function(){return o.te},Utf8ErrorReason:function(){return o.Uw},_toEscapedUtf8String:function(){return o.U$},formatBytes32String:function(){return a},nameprep:function(){return g},parseBytes32String:function(){return s},toUtf8Bytes:function(){return o.Y0},toUtf8CodePoints:function(){return o.XL},toUtf8String:function(){return o.ZN}});var r=n(84867),i=n(49716),o=n(83374);function a(e){var t=(0,o.Y0)(e);if(t.length>31)throw new Error("bytes32 string must be less than 32 bytes");return(0,i.hexlify)((0,i.concat)([t,r.R]).slice(0,32))}function s(e){var t=(0,i.arrayify)(e);if(32!==t.length)throw new Error("invalid bytes32 - not 32 bytes long");if(0!==t[31])throw new Error("invalid bytes32 string - no null terminator");for(var n=31;0===t[n-1];)n--;return(0,o.ZN)(t.slice(0,n))}function u(e,t){t||(t=function(e){return[parseInt(e,16)]});var n=0,r={};return e.split(",").forEach((function(e){var i=e.split(":");n+=parseInt(i[0],16),r[n]=t(i[1])})),r}function c(e){var t=0;return e.split(",").map((function(e){var n=e.split("-");return 1===n.length?n[1]="0":""===n[1]&&(n[1]="1"),{l:t+parseInt(n[0],16),h:t=parseInt(n[1],16)}}))}function l(e,t){for(var n=0,r=0;r=(n+=i.l)&&e<=n+i.h&&(e-n)%(i.d||1)===0){if(i.e&&-1!==i.e.indexOf(e-n))continue;return i}}return null}var f=c("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"),h="ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map((function(e){return parseInt(e,16)})),d=[{h:25,s:32,l:65},{h:30,s:32,e:[23],l:127},{h:54,s:1,e:[48],l:64,d:2},{h:14,s:1,l:57,d:2},{h:44,s:1,l:17,d:2},{h:10,s:1,e:[2,6,8],l:61,d:2},{h:16,s:1,l:68,d:2},{h:84,s:1,e:[18,24,66],l:19,d:2},{h:26,s:32,e:[17],l:435},{h:22,s:1,l:71,d:2},{h:15,s:80,l:40},{h:31,s:32,l:16},{h:32,s:1,l:80,d:2},{h:52,s:1,l:42,d:2},{h:12,s:1,l:55,d:2},{h:40,s:1,e:[38],l:15,d:2},{h:14,s:1,l:48,d:2},{h:37,s:48,l:49},{h:148,s:1,l:6351,d:2},{h:88,s:1,l:160,d:2},{h:15,s:16,l:704},{h:25,s:26,l:854},{h:25,s:32,l:55915},{h:37,s:40,l:1247},{h:25,s:-119711,l:53248},{h:25,s:-119763,l:52},{h:25,s:-119815,l:52},{h:25,s:-119867,e:[1,4,5,7,8,11,12,17],l:52},{h:25,s:-119919,l:52},{h:24,s:-119971,e:[2,7,8,17],l:52},{h:24,s:-120023,e:[2,7,13,15,16,17],l:52},{h:25,s:-120075,l:52},{h:25,s:-120127,l:52},{h:25,s:-120179,l:52},{h:25,s:-120231,l:52},{h:25,s:-120283,l:52},{h:25,s:-120335,l:52},{h:24,s:-119543,e:[17],l:56},{h:24,s:-119601,e:[17],l:58},{h:24,s:-119659,e:[17],l:58},{h:24,s:-119717,e:[17],l:58},{h:24,s:-119775,e:[17],l:58}],p=u("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"),v=u("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"),m=u("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(e){if(e.length%4!==0)throw new Error("bad data");for(var t=[],n=0;n=0)return[];if(e>=65024&&e<=65039)return[];var t=function(e){var t=l(e,d);if(t)return[e+t.s];var n=p[e];if(n)return n;var r=v[e];return r?[e+r[0]]:m[e]||null}(e);return t||[e]})),n=t.reduce((function(e,t){return t.forEach((function(t){e.push(t)})),e}),[]),(n=(0,o.XL)((0,o.uu)(n),o.Uj.NFKC)).forEach((function(e){if(l(e,y))throw new Error("STRINGPREP_CONTAINS_PROHIBITED")})),n.forEach((function(e){if(l(e,f))throw new Error("STRINGPREP_CONTAINS_UNASSIGNED")}));var r=(0,o.uu)(n);if("-"===r.substring(0,1)||"--"===r.substring(2,4)||"-"===r.substring(r.length-1))throw new Error("invalid hyphen");return r}},83374:function(e,t,n){"use strict";n.d(t,{Uj:function(){return r},te:function(){return u},Uw:function(){return i},U$:function(){return h},uu:function(){return d},Y0:function(){return l},XL:function(){return v},ZN:function(){return p}});var r,i,o=n(49716),a=new(n(39502).Logger)("strings/5.7.0");function s(e,t,n,r,o){if(e===i.BAD_PREFIX||e===i.UNEXPECTED_CONTINUE){for(var a=0,s=t+1;s>6===2;s++)a++;return a}return e===i.OVERRUN?n.length-t-1:0}!function(e){e.current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD"}(r||(r={})),function(e){e.UNEXPECTED_CONTINUE="unexpected continuation byte",e.BAD_PREFIX="bad codepoint prefix",e.OVERRUN="string overrun",e.MISSING_CONTINUE="missing continuation byte",e.OUT_OF_RANGE="out of UTF-8 range",e.UTF16_SURROGATE="UTF-16 surrogate",e.OVERLONG="overlong representation"}(i||(i={}));var u=Object.freeze({error:function(e,t,n,r,i){return a.throwArgumentError("invalid codepoint at offset ".concat(t,"; ").concat(e),"bytes",n)},ignore:s,replace:function(e,t,n,r,o){return e===i.OVERLONG?(r.push(o),0):(r.push(65533),s(e,t,n))}});function c(e,t){null==t&&(t=u.error),e=(0,o.arrayify)(e);for(var n=[],r=0;r>7!==0){var s=null,c=null;if(192===(224&a))s=1,c=127;else if(224===(240&a))s=2,c=2047;else{if(240!==(248&a)){r+=t(128===(192&a)?i.UNEXPECTED_CONTINUE:i.BAD_PREFIX,r-1,e,n);continue}s=3,c=65535}if(r-1+s>=e.length)r+=t(i.OVERRUN,r-1,e,n);else{for(var l=a&(1<<8-s-1)-1,f=0;f1114111?r+=t(i.OUT_OF_RANGE,r-1-s,e,n,l):l>=55296&&l<=57343?r+=t(i.UTF16_SURROGATE,r-1-s,e,n,l):l<=c?r+=t(i.OVERLONG,r-1-s,e,n,l):n.push(l))}}else n.push(a)}return n}function l(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r.current;t!=r.current&&(a.checkNormalize(),e=e.normalize(t));for(var n=[],i=0;i>6|192),n.push(63&s|128);else if(55296==(64512&s)){i++;var u=e.charCodeAt(i);if(i>=e.length||56320!==(64512&u))throw new Error("invalid utf-8 string");var c=65536+((1023&s)<<10)+(1023&u);n.push(c>>18|240),n.push(c>>12&63|128),n.push(c>>6&63|128),n.push(63&c|128)}else n.push(s>>12|224),n.push(s>>6&63|128),n.push(63&s|128)}return(0,o.arrayify)(n)}function f(e){var t="0000"+e.toString(16);return"\\u"+t.substring(t.length-4)}function h(e,t){return'"'+c(e,t).map((function(e){if(e<256){switch(e){case 8:return"\\b";case 9:return"\\t";case 10:return"\\n";case 13:return"\\r";case 34:return'\\"';case 92:return"\\\\"}if(e>=32&&e<127)return String.fromCharCode(e)}return e<=65535?f(e):f(55296+((e-=65536)>>10&1023))+f(56320+(1023&e))})).join("")+'"'}function d(e){return e.map((function(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10&1023),56320+(1023&e)))})).join("")}function p(e,t){return d(c(e,t))}function v(e){return c(l(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:r.current))}},25452:function(e,t,n){"use strict";n.r(t),n.d(t,{TransactionTypes:function(){return r},accessListify:function(){return k},computeAddress:function(){return g},parse:function(){return M},recoverAddress:function(){return b},serialize:function(){return S}});var r,i=n(97419),o=n(2257),a=n(49716),s=n(75422),u=n(88062),c=n(30520),l=n(17986),f=n(78865),h=n(39502),d=new h.Logger("transactions/5.7.0");function p(e){return"0x"===e?null:(0,i.getAddress)(e)}function v(e){return"0x"===e?s._Y:o.O$.from(e)}!function(e){e[e.legacy=0]="legacy",e[e.eip2930=1]="eip2930",e[e.eip1559=2]="eip1559"}(r||(r={}));var m=[{name:"nonce",maxLength:32,numeric:!0},{name:"gasPrice",maxLength:32,numeric:!0},{name:"gasLimit",maxLength:32,numeric:!0},{name:"to",length:20},{name:"value",maxLength:32,numeric:!0},{name:"data"}],y={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,type:!0,value:!0};function g(e){var t=(0,f.computePublicKey)(e);return(0,i.getAddress)((0,a.hexDataSlice)((0,u.keccak256)((0,a.hexDataSlice)(t,1)),12))}function b(e,t){return g((0,f.recoverPublicKey)((0,a.arrayify)(e),t))}function w(e,t){var n=(0,a.stripZeros)(o.O$.from(e).toHexString());return n.length>32&&d.throwArgumentError("invalid length for "+t,"transaction:"+t,e),n}function x(e,t){return{address:(0,i.getAddress)(e),storageKeys:(t||[]).map((function(t,n){return 32!==(0,a.hexDataLength)(t)&&d.throwArgumentError("invalid access list storageKey","accessList[".concat(e,":").concat(n,"]"),t),t.toLowerCase()}))}}function k(e){if(Array.isArray(e))return e.map((function(e,t){return Array.isArray(e)?(e.length>2&&d.throwArgumentError("access list expected to be [ address, storageKeys[] ]","value[".concat(t,"]"),e),x(e[0],e[1])):x(e.address,e.storageKeys)}));var t=Object.keys(e).map((function(t){var n=e[t].reduce((function(e,t){return e[t]=!0,e}),{});return x(t,Object.keys(n).sort())}));return t.sort((function(e,t){return e.address.localeCompare(t.address)})),t}function E(e){return k(e).map((function(e){return[e.address,e.storageKeys]}))}function _(e,t){if(null!=e.gasPrice){var n=o.O$.from(e.gasPrice),r=o.O$.from(e.maxFeePerGas||0);n.eq(r)||d.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:n,maxFeePerGas:r})}var s=[w(e.chainId||0,"chainId"),w(e.nonce||0,"nonce"),w(e.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),w(e.maxFeePerGas||0,"maxFeePerGas"),w(e.gasLimit||0,"gasLimit"),null!=e.to?(0,i.getAddress)(e.to):"0x",w(e.value||0,"value"),e.data||"0x",E(e.accessList||[])];if(t){var u=(0,a.splitSignature)(t);s.push(w(u.recoveryParam,"recoveryParam")),s.push((0,a.stripZeros)(u.r)),s.push((0,a.stripZeros)(u.s))}return(0,a.hexConcat)(["0x02",l.encode(s)])}function A(e,t){var n=[w(e.chainId||0,"chainId"),w(e.nonce||0,"nonce"),w(e.gasPrice||0,"gasPrice"),w(e.gasLimit||0,"gasLimit"),null!=e.to?(0,i.getAddress)(e.to):"0x",w(e.value||0,"value"),e.data||"0x",E(e.accessList||[])];if(t){var r=(0,a.splitSignature)(t);n.push(w(r.recoveryParam,"recoveryParam")),n.push((0,a.stripZeros)(r.r)),n.push((0,a.stripZeros)(r.s))}return(0,a.hexConcat)(["0x01",l.encode(n)])}function S(e,t){if(null==e.type||0===e.type)return null!=e.accessList&&d.throwArgumentError("untyped transactions do not support accessList; include type: 1","transaction",e),function(e,t){(0,c.checkProperties)(e,y);var n=[];m.forEach((function(t){var r=e[t.name]||[],i={};t.numeric&&(i.hexPad="left"),r=(0,a.arrayify)((0,a.hexlify)(r,i)),t.length&&r.length!==t.length&&r.length>0&&d.throwArgumentError("invalid length for "+t.name,"transaction:"+t.name,r),t.maxLength&&(r=(0,a.stripZeros)(r)).length>t.maxLength&&d.throwArgumentError("invalid length for "+t.name,"transaction:"+t.name,r),n.push((0,a.hexlify)(r))}));var r=0;if(null!=e.chainId?"number"!==typeof(r=e.chainId)&&d.throwArgumentError("invalid transaction.chainId","transaction",e):t&&!(0,a.isBytesLike)(t)&&t.v>28&&(r=Math.floor((t.v-35)/2)),0!==r&&(n.push((0,a.hexlify)(r)),n.push("0x"),n.push("0x")),!t)return l.encode(n);var i=(0,a.splitSignature)(t),o=27+i.recoveryParam;return 0!==r?(n.pop(),n.pop(),n.pop(),o+=2*r+8,i.v>28&&i.v!==o&&d.throwArgumentError("transaction.chainId/signature.v mismatch","signature",t)):i.v!==o&&d.throwArgumentError("transaction.chainId/signature.v mismatch","signature",t),n.push((0,a.hexlify)(o)),n.push((0,a.stripZeros)((0,a.arrayify)(i.r))),n.push((0,a.stripZeros)((0,a.arrayify)(i.s))),l.encode(n)}(e,t);switch(e.type){case 1:return A(e,t);case 2:return _(e,t)}return d.throwError("unsupported transaction type: ".concat(e.type),h.Logger.errors.UNSUPPORTED_OPERATION,{operation:"serializeTransaction",transactionType:e.type})}function O(e,t,n){try{var r=v(t[0]).toNumber();if(0!==r&&1!==r)throw new Error("bad recid");e.v=r}catch(o){d.throwArgumentError("invalid v for transaction type: 1","v",t[0])}e.r=(0,a.hexZeroPad)(t[1],32),e.s=(0,a.hexZeroPad)(t[2],32);try{var i=(0,u.keccak256)(n(e));e.from=b(i,{r:e.r,s:e.s,recoveryParam:e.v})}catch(o){}}function M(e){var t=(0,a.arrayify)(e);if(t[0]>127)return function(e){var t=l.decode(e);9!==t.length&&6!==t.length&&d.throwArgumentError("invalid raw transaction","rawTransaction",e);var n={nonce:v(t[0]).toNumber(),gasPrice:v(t[1]),gasLimit:v(t[2]),to:p(t[3]),value:v(t[4]),data:t[5],chainId:0};if(6===t.length)return n;try{n.v=o.O$.from(t[6]).toNumber()}catch(c){return n}if(n.r=(0,a.hexZeroPad)(t[7],32),n.s=(0,a.hexZeroPad)(t[8],32),o.O$.from(n.r).isZero()&&o.O$.from(n.s).isZero())n.chainId=n.v,n.v=0;else{n.chainId=Math.floor((n.v-35)/2),n.chainId<0&&(n.chainId=0);var r=n.v-27,i=t.slice(0,6);0!==n.chainId&&(i.push((0,a.hexlify)(n.chainId)),i.push("0x"),i.push("0x"),r-=2*n.chainId+8);var s=(0,u.keccak256)(l.encode(i));try{n.from=b(s,{r:(0,a.hexlify)(n.r),s:(0,a.hexlify)(n.s),recoveryParam:r})}catch(c){}n.hash=(0,u.keccak256)(e)}return n.type=null,n}(t);switch(t[0]){case 1:return function(e){var t=l.decode(e.slice(1));8!==t.length&&11!==t.length&&d.throwArgumentError("invalid component count for transaction type: 1","payload",(0,a.hexlify)(e));var n={type:1,chainId:v(t[0]).toNumber(),nonce:v(t[1]).toNumber(),gasPrice:v(t[2]),gasLimit:v(t[3]),to:p(t[4]),value:v(t[5]),data:t[6],accessList:k(t[7])};return 8===t.length||(n.hash=(0,u.keccak256)(e),O(n,t.slice(8),A)),n}(t);case 2:return function(e){var t=l.decode(e.slice(1));9!==t.length&&12!==t.length&&d.throwArgumentError("invalid component count for transaction type: 2","payload",(0,a.hexlify)(e));var n=v(t[2]),r=v(t[3]),i={type:2,chainId:v(t[0]).toNumber(),nonce:v(t[1]).toNumber(),maxPriorityFeePerGas:n,maxFeePerGas:r,gasPrice:null,gasLimit:v(t[4]),to:p(t[5]),value:v(t[6]),data:t[7],accessList:k(t[8])};return 9===t.length||(i.hash=(0,u.keccak256)(e),O(i,t.slice(9),_)),i}(t)}return d.throwError("unsupported transaction type: ".concat(t[0]),h.Logger.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:t[0]})}},19601:function(e,t,n){"use strict";n.r(t),n.d(t,{commify:function(){return _},formatEther:function(){return O},formatUnits:function(){return A},parseEther:function(){return M},parseUnits:function(){return S}});var r=n(15671),i=n(43144),o=n(49716),a=n(39502),s=n(86945),u=n(2257),c=new a.Logger(s.i),l={},f=u.O$.from(0),h=u.O$.from(-1);function d(e,t,n,r){var i={fault:t,operation:n};return void 0!==r&&(i.value=r),c.throwError(e,a.Logger.errors.NUMERIC_FAULT,i)}for(var p="0";p.length<256;)p+=p;function v(e){if("number"!==typeof e)try{e=u.O$.from(e).toNumber()}catch(t){}return"number"===typeof e&&e>=0&&e<=256&&!(e%1)?"1"+p.substring(0,e):c.throwArgumentError("invalid decimal size","decimals",e)}function m(e,t){null==t&&(t=0);var n=v(t),r=(e=u.O$.from(e)).lt(f);r&&(e=e.mul(h));for(var i=e.mod(n).toString();i.length2&&c.throwArgumentError("too many decimal points","value",e);var o=i[0],a=i[1];for(o||(o="0"),a||(a="0");"0"===a[a.length-1];)a=a.substring(0,a.length-1);for(a.length>n.length-1&&d("fractional component exceeds decimals","underflow","parseFixed"),""===a&&(a="0");a.length80&&c.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",i),new e(l,n,r,i)}}]),e}(),b=function(){function e(t,n,i,o){(0,r.Z)(this,e),t!==l&&c.throwError("cannot use FixedNumber constructor; use FixedNumber.from",a.Logger.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=o,this._hex=n,this._value=i,this._isFixedNumber=!0,Object.freeze(this)}return(0,i.Z)(e,[{key:"_checkFormat",value:function(e){this.format.name!==e.format.name&&c.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}},{key:"addUnsafe",value:function(t){this._checkFormat(t);var n=y(this._value,this.format.decimals),r=y(t._value,t.format.decimals);return e.fromValue(n.add(r),this.format.decimals,this.format)}},{key:"subUnsafe",value:function(t){this._checkFormat(t);var n=y(this._value,this.format.decimals),r=y(t._value,t.format.decimals);return e.fromValue(n.sub(r),this.format.decimals,this.format)}},{key:"mulUnsafe",value:function(t){this._checkFormat(t);var n=y(this._value,this.format.decimals),r=y(t._value,t.format.decimals);return e.fromValue(n.mul(r).div(this.format._multiplier),this.format.decimals,this.format)}},{key:"divUnsafe",value:function(t){this._checkFormat(t);var n=y(this._value,this.format.decimals),r=y(t._value,t.format.decimals);return e.fromValue(n.mul(this.format._multiplier).div(r),this.format.decimals,this.format)}},{key:"floor",value:function(){var t=this.toString().split(".");1===t.length&&t.push("0");var n=e.from(t[0],this.format),r=!t[1].match(/^(0*)$/);return this.isNegative()&&r&&(n=n.subUnsafe(w.toFormat(n.format))),n}},{key:"ceiling",value:function(){var t=this.toString().split(".");1===t.length&&t.push("0");var n=e.from(t[0],this.format),r=!t[1].match(/^(0*)$/);return!this.isNegative()&&r&&(n=n.addUnsafe(w.toFormat(n.format))),n}},{key:"round",value:function(t){null==t&&(t=0);var n=this.toString().split(".");if(1===n.length&&n.push("0"),(t<0||t>80||t%1)&&c.throwArgumentError("invalid decimal count","decimals",t),n[1].length<=t)return this;var r=e.from("1"+p.substring(0,t),this.format),i=x.toFormat(this.format);return this.mulUnsafe(r).addUnsafe(i).floor().divUnsafe(r)}},{key:"isZero",value:function(){return"0.0"===this._value||"0"===this._value}},{key:"isNegative",value:function(){return"-"===this._value[0]}},{key:"toString",value:function(){return this._value}},{key:"toHexString",value:function(e){if(null==e)return this._hex;e%8&&c.throwArgumentError("invalid byte width","width",e);var t=u.O$.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString();return(0,o.hexZeroPad)(t,e/8)}},{key:"toUnsafeFloat",value:function(){return parseFloat(this.toString())}},{key:"toFormat",value:function(t){return e.fromString(this._value,t)}}],[{key:"fromValue",value:function(t,n,r){return null!=r||null==n||(0,u.Zm)(n)||(r=n,n=null),null==n&&(n=0),null==r&&(r="fixed"),e.fromString(m(t,n),g.from(r))}},{key:"fromString",value:function(t,n){null==n&&(n="fixed");var r=g.from(n),i=y(t,r.decimals);!r.signed&&i.lt(f)&&d("unsigned value cannot be negative","overflow","value",t);var a=null;r.signed?a=i.toTwos(r.width).toHexString():(a=i.toHexString(),a=(0,o.hexZeroPad)(a,r.width/8));var s=m(i,r.decimals);return new e(l,a,s,r)}},{key:"fromBytes",value:function(t,n){null==n&&(n="fixed");var r=g.from(n);if((0,o.arrayify)(t).length>r.width/8)throw new Error("overflow");var i=u.O$.from(t);r.signed&&(i=i.fromTwos(r.width));var a=i.toTwos((r.signed?0:1)+r.width).toHexString(),s=m(i,r.decimals);return new e(l,a,s,r)}},{key:"from",value:function(t,n){if("string"===typeof t)return e.fromString(t,n);if((0,o.isBytes)(t))return e.fromBytes(t,n);try{return e.fromValue(t,0,n)}catch(r){if(r.code!==a.Logger.errors.INVALID_ARGUMENT)throw r}return c.throwArgumentError("invalid FixedNumber value","value",t)}},{key:"isFixedNumber",value:function(e){return!(!e||!e._isFixedNumber)}}]),e}(),w=b.from(1),x=b.from("0.5"),k=new a.Logger("units/5.7.0"),E=["wei","kwei","mwei","gwei","szabo","finney","ether"];function _(e){var t=String(e).split(".");(t.length>2||!t[0].match(/^-?[0-9]*$/)||t[1]&&!t[1].match(/^[0-9]*$/)||"."===e||"-."===e)&&k.throwArgumentError("invalid value","value",e);var n=t[0],r="";for("-"===n.substring(0,1)&&(r="-",n=n.substring(1));"0"===n.substring(0,1);)n=n.substring(1);""===n&&(n="0");var i="";for(2===t.length&&(i="."+(t[1]||"0"));i.length>2&&"0"===i[i.length-1];)i=i.substring(0,i.length-1);for(var o=[];n.length;){if(n.length<=3){o.unshift(n);break}var a=n.length-3;o.unshift(n.substring(a)),n=n.substring(0,a)}return r+o.join(",")+i}function A(e,t){if("string"===typeof t){var n=E.indexOf(t);-1!==n&&(t=3*n)}return m(e,null!=t?t:18)}function S(e,t){if("string"!==typeof e&&k.throwArgumentError("value must be a string","value",e),"string"===typeof t){var n=E.indexOf(t);-1!==n&&(t=3*n)}return y(e,null!=t?t:18)}function O(e){return A(e,18)}function M(e){return S(e,18)}},22876:function(e,t,n){"use strict";n.r(t),n.d(t,{Wallet:function(){return S},verifyMessage:function(){return O},verifyTypedData:function(){return M}});var r=n(74165),i=n(15671),o=n(43144),a=n(97326),s=n(60136),u=n(29388),c=n(97419),l=n(69745),f=n(68408),h=n(49716),d=n(2273),p=n(35992),v=n(15148),m=n(88062),y=n(30520),g=n(15244),b=n(78865),w=n(13463),x=n(31529),k=n(25452),E=n(39502),_=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(t){o(t)}}function s(e){try{u(r.throw(e))}catch(t){o(t)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))},A=new E.Logger("wallet/5.7.0");var S=function(e){(0,s.Z)(n,e);var t=(0,u.Z)(n);function n(e,r){var o,s;if((0,i.Z)(this,n),o=t.call(this),null!=(s=e)&&(0,h.isHexString)(s.privateKey,32)&&null!=s.address){var u=new b.SigningKey(e.privateKey);if((0,y.defineReadOnly)((0,a.Z)(o),"_signingKey",(function(){return u})),(0,y.defineReadOnly)((0,a.Z)(o),"address",(0,k.computeAddress)(o.publicKey)),o.address!==(0,c.getAddress)(e.address)&&A.throwArgumentError("privateKey/address mismatch","privateKey","[REDACTED]"),function(e){var t=e.mnemonic;return t&&t.phrase}(e)){var f=e.mnemonic;(0,y.defineReadOnly)((0,a.Z)(o),"_mnemonic",(function(){return{phrase:f.phrase,path:f.path||v.defaultPath,locale:f.locale||"en"}}));var d=o.mnemonic,p=v.HDNode.fromMnemonic(d.phrase,null,d.locale).derivePath(d.path);(0,k.computeAddress)(p.privateKey)!==o.address&&A.throwArgumentError("mnemonic/address mismatch","privateKey","[REDACTED]")}else(0,y.defineReadOnly)((0,a.Z)(o),"_mnemonic",(function(){return null}))}else{if(b.SigningKey.isSigningKey(e))"secp256k1"!==e.curve&&A.throwArgumentError("unsupported curve; must be secp256k1","privateKey","[REDACTED]"),(0,y.defineReadOnly)((0,a.Z)(o),"_signingKey",(function(){return e}));else{"string"===typeof e&&e.match(/^[0-9a-f]*$/i)&&64===e.length&&(e="0x"+e);var m=new b.SigningKey(e);(0,y.defineReadOnly)((0,a.Z)(o),"_signingKey",(function(){return m}))}(0,y.defineReadOnly)((0,a.Z)(o),"_mnemonic",(function(){return null})),(0,y.defineReadOnly)((0,a.Z)(o),"address",(0,k.computeAddress)(o.publicKey))}return r&&!l.zt.isProvider(r)&&A.throwArgumentError("invalid provider","provider",r),(0,y.defineReadOnly)((0,a.Z)(o),"provider",r||null),o}return(0,o.Z)(n,[{key:"mnemonic",get:function(){return this._mnemonic()}},{key:"privateKey",get:function(){return this._signingKey().privateKey}},{key:"publicKey",get:function(){return this._signingKey().publicKey}},{key:"getAddress",value:function(){return Promise.resolve(this.address)}},{key:"connect",value:function(e){return new n(this,e)}},{key:"signTransaction",value:function(e){var t=this;return(0,y.resolveProperties)(e).then((function(n){null!=n.from&&((0,c.getAddress)(n.from)!==t.address&&A.throwArgumentError("transaction from address mismatch","transaction.from",e.from),delete n.from);var r=t._signingKey().signDigest((0,m.keccak256)((0,k.serialize)(n)));return(0,k.serialize)(n,r)}))}},{key:"signMessage",value:function(e){return _(this,void 0,void 0,(0,r.Z)().mark((function t(){return(0,r.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",(0,h.joinSignature)(this._signingKey().signDigest((0,d.r)(e))));case 1:case"end":return t.stop()}}),t,this)})))}},{key:"_signTypedData",value:function(e,t,n){return _(this,void 0,void 0,(0,r.Z)().mark((function i(){var o,a=this;return(0,r.Z)().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,p.E.resolveNames(e,t,n,(function(e){return null==a.provider&&A.throwError("cannot resolve ENS names without a provider",E.Logger.errors.UNSUPPORTED_OPERATION,{operation:"resolveName",value:e}),a.provider.resolveName(e)}));case 2:return o=r.sent,r.abrupt("return",(0,h.joinSignature)(this._signingKey().signDigest(p.E.hash(o.domain,t,o.value))));case 4:case"end":return r.stop()}}),i,this)})))}},{key:"encrypt",value:function(e,t,n){if("function"!==typeof t||n||(n=t,t={}),n&&"function"!==typeof n)throw new Error("invalid callback");return t||(t={}),(0,w.HI)(this,e,t,n)}}],[{key:"createRandom",value:function(e){var t=(0,g.O)(16);e||(e={}),e.extraEntropy&&(t=(0,h.arrayify)((0,h.hexDataSlice)((0,m.keccak256)((0,h.concat)([t,e.extraEntropy])),0,16)));var r=(0,v.entropyToMnemonic)(t,e.locale);return n.fromMnemonic(r,e.path,e.locale)}},{key:"fromEncryptedJson",value:function(e,t,r){return(0,x.decryptJsonWallet)(e,t,r).then((function(e){return new n(e)}))}},{key:"fromEncryptedJsonSync",value:function(e,t){return new n((0,x.decryptJsonWalletSync)(e,t))}},{key:"fromMnemonic",value:function(e,t,r){return t||(t=v.defaultPath),new n(v.HDNode.fromMnemonic(e,null,r).derivePath(t))}}]),n}(f.E);function O(e,t){return(0,k.recoverAddress)((0,d.r)(e),t)}function M(e,t,n,r){return(0,k.recoverAddress)(p.E.hash(e,t,n),r)}},65889:function(e,t,n){"use strict";n.r(t),n.d(t,{_fetchData:function(){return v},fetchJson:function(){return m},poll:function(){return y}});var r=n(74165),i=n(87354),o=n(49716),a=n(30520),s=n(83374),u=n(39502),c=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(t){o(t)}}function s(e){try{u(r.throw(e))}catch(t){o(t)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))};function l(e,t){return c(this,void 0,void 0,(0,r.Z)().mark((function n(){var i,a,s,u,c;return(0,r.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return null==t&&(t={}),i={method:t.method||"GET",headers:t.headers||{},body:t.body||void 0},!0!==t.skipFetchSetup&&(i.mode="cors",i.cache="no-cache",i.credentials="same-origin",i.redirect="follow",i.referrer="client"),null!=t.fetchOptions&&((a=t.fetchOptions).mode&&(i.mode=a.mode),a.cache&&(i.cache=a.cache),a.credentials&&(i.credentials=a.credentials),a.redirect&&(i.redirect=a.redirect),a.referrer&&(i.referrer=a.referrer)),n.next=7,fetch(e,i);case 7:return s=n.sent,n.next=10,s.arrayBuffer();case 10:return u=n.sent,c={},s.headers.forEach?s.headers.forEach((function(e,t){c[t.toLowerCase()]=e})):s.headers.keys().forEach((function(e){c[e.toLowerCase()]=s.headers.get(e)})),n.abrupt("return",{headers:c,statusCode:s.status,statusMessage:s.statusText,body:(0,o.arrayify)(new Uint8Array(u))});case 14:case"end":return n.stop()}}),n)})))}var f=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(t){o(t)}}function s(e){try{u(r.throw(e))}catch(t){o(t)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))},h=new u.Logger("web/5.7.1");function d(e){return new Promise((function(t){setTimeout(t,e)}))}function p(e,t){if(null==e)return null;if("string"===typeof e)return e;if((0,o.isBytesLike)(e)){if(t&&("text"===t.split("/")[0]||"application/json"===t.split(";")[0].trim()))try{return(0,s.ZN)(e)}catch(n){}return(0,o.hexlify)(e)}return e}function v(e,t,n){var o="object"===typeof e&&null!=e.throttleLimit?e.throttleLimit:12;h.assertArgument(o>0&&o%1===0,"invalid connection throttle limit","connection.throttleLimit",o);var c="object"===typeof e?e.throttleCallback:null,v="object"===typeof e&&"number"===typeof e.throttleSlotInterval?e.throttleSlotInterval:100;h.assertArgument(v>0&&v%1===0,"invalid connection throttle slot interval","connection.throttleSlotInterval",v);var m="object"===typeof e&&!!e.errorPassThrough,y={},g=null,b={method:"GET"},w=!1,x=12e4;if("string"===typeof e)g=e;else if("object"===typeof e){if(null!=e&&null!=e.url||h.throwArgumentError("missing URL","connection.url",e),g=e.url,"number"===typeof e.timeout&&e.timeout>0&&(x=e.timeout),e.headers)for(var k in e.headers)y[k.toLowerCase()]={key:k,value:String(e.headers[k])},["if-none-match","if-modified-since"].indexOf(k.toLowerCase())>=0&&(w=!0);if(b.allowGzip=!!e.allowGzip,null!=e.user&&null!=e.password){"https:"!==g.substring(0,6)&&!0!==e.allowInsecureAuthentication&&h.throwError("basic authentication requires a secure https url",u.Logger.errors.INVALID_ARGUMENT,{argument:"url",url:g,user:e.user,password:"[REDACTED]"});var E=e.user+":"+e.password;y.authorization={key:"Authorization",value:"Basic "+(0,i.c)((0,s.Y0)(E))}}null!=e.skipFetchSetup&&(b.skipFetchSetup=!!e.skipFetchSetup),null!=e.fetchOptions&&(b.fetchOptions=(0,a.shallowCopy)(e.fetchOptions))}var _,A=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),S=g?g.match(A):null;if(S)try{var O={statusCode:200,statusMessage:"OK",headers:{"content-type":S[1]||"text/plain"},body:S[2]?(0,i.J)(S[3]):(_=S[3],(0,s.Y0)(_.replace(/%([0-9a-f][0-9a-f])/gi,(function(e,t){return String.fromCharCode(parseInt(t,16))}))))},M=O.body;return n&&(M=n(O.body,O)),Promise.resolve(M)}catch(j){h.throwError("processing response error",u.Logger.errors.SERVER_ERROR,{body:p(S[1],S[2]),error:j,requestBody:null,requestMethod:"GET",url:g})}t&&(b.method="POST",b.body=t,null==y["content-type"]&&(y["content-type"]={key:"Content-Type",value:"application/octet-stream"}),null==y["content-length"]&&(y["content-length"]={key:"Content-Length",value:String(t.length)}));var C={};Object.keys(y).forEach((function(e){var t=y[e];C[t.key]=t.value})),b.headers=C;var P=function(){var e=null;return{promise:new Promise((function(t,n){x&&(e=setTimeout((function(){null!=e&&(e=null,n(h.makeError("timeout",u.Logger.errors.TIMEOUT,{requestBody:p(b.body,C["content-type"]),requestMethod:b.method,timeout:x,url:g})))}),x))})),cancel:function(){null!=e&&(clearTimeout(e),e=null)}}}(),T=function(){return f(this,void 0,void 0,(0,r.Z)().mark((function e(){var t,i,a,s,f,y,x,k,E,_;return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=0;case 1:if(!(t=300)&&(P.cancel(),h.throwError("bad response",u.Logger.errors.SERVER_ERROR,{status:i.statusCode,headers:i.headers,body:p(x,i.headers?i.headers["content-type"]:null),requestBody:p(b.body,C["content-type"]),requestMethod:b.method,url:g})),!n){e.next=60;break}return e.prev=37,e.next=40,n(x,i);case 40:return k=e.sent,P.cancel(),e.abrupt("return",k);case 45:if(e.prev=45,e.t1=e.catch(37),!(e.t1.throttleRetry&&ts)return void(a()&&r(new Error("retry limit reached")));var c=t.interval*parseInt(String(Math.random()*Math.pow(2,u)));ct.ceiling&&(c=t.ceiling),setTimeout(i,c)}return null}),(function(e){a()&&r(e)}))}()}))}},80226:function(e){"use strict";e.exports=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.mustBeMetaMask,n=void 0!==t&&t,r=e.silent,i=void 0!==r&&r,o=e.timeout,a=void 0===o?3e3:o;!function(){if("boolean"!==typeof n)throw new Error("@metamask/detect-provider: Expected option 'mustBeMetaMask' to be a boolean.");if("boolean"!==typeof i)throw new Error("@metamask/detect-provider: Expected option 'silent' to be a boolean.");if("number"!==typeof a)throw new Error("@metamask/detect-provider: Expected option 'timeout' to be a number.")}();var s=!1;return new Promise((function(e){function t(){if(!s){s=!0,window.removeEventListener("ethereum#initialized",t);var r=window.ethereum;if(!r||n&&!r.isMetaMask){var o=n&&r?"Non-MetaMask window.ethereum detected.":"Unable to detect window.ethereum.";!i&&console.error("@metamask/detect-provider:",o),e(null)}else e(r)}}window.ethereum?t():(window.addEventListener("ethereum#initialized",t,{once:!0}),setTimeout((function(){t()}),a))}))}},76232:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(45073);function i(e,t,n){return void 0===t&&(t=new Uint8Array(2)),void 0===n&&(n=0),t[n+0]=e>>>8,t[n+1]=e>>>0,t}function o(e,t,n){return void 0===t&&(t=new Uint8Array(2)),void 0===n&&(n=0),t[n+0]=e>>>0,t[n+1]=e>>>8,t}function a(e,t){return void 0===t&&(t=0),e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function s(e,t){return void 0===t&&(t=0),(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}function u(e,t){return void 0===t&&(t=0),e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t]}function c(e,t){return void 0===t&&(t=0),(e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t])>>>0}function l(e,t,n){return void 0===t&&(t=new Uint8Array(4)),void 0===n&&(n=0),t[n+0]=e>>>24,t[n+1]=e>>>16,t[n+2]=e>>>8,t[n+3]=e>>>0,t}function f(e,t,n){return void 0===t&&(t=new Uint8Array(4)),void 0===n&&(n=0),t[n+0]=e>>>0,t[n+1]=e>>>8,t[n+2]=e>>>16,t[n+3]=e>>>24,t}function h(e,t,n){return void 0===t&&(t=new Uint8Array(8)),void 0===n&&(n=0),l(e/4294967296>>>0,t,n),l(e>>>0,t,n+4),t}function d(e,t,n){return void 0===t&&(t=new Uint8Array(8)),void 0===n&&(n=0),f(e>>>0,t,n),f(e/4294967296>>>0,t,n+4),t}t.readInt16BE=function(e,t){return void 0===t&&(t=0),(e[t+0]<<8|e[t+1])<<16>>16},t.readUint16BE=function(e,t){return void 0===t&&(t=0),(e[t+0]<<8|e[t+1])>>>0},t.readInt16LE=function(e,t){return void 0===t&&(t=0),(e[t+1]<<8|e[t])<<16>>16},t.readUint16LE=function(e,t){return void 0===t&&(t=0),(e[t+1]<<8|e[t])>>>0},t.writeUint16BE=i,t.writeInt16BE=i,t.writeUint16LE=o,t.writeInt16LE=o,t.readInt32BE=a,t.readUint32BE=s,t.readInt32LE=u,t.readUint32LE=c,t.writeUint32BE=l,t.writeInt32BE=l,t.writeUint32LE=f,t.writeInt32LE=f,t.readInt64BE=function(e,t){void 0===t&&(t=0);var n=a(e,t),r=a(e,t+4);return 4294967296*n+r-4294967296*(r>>31)},t.readUint64BE=function(e,t){return void 0===t&&(t=0),4294967296*s(e,t)+s(e,t+4)},t.readInt64LE=function(e,t){void 0===t&&(t=0);var n=u(e,t);return 4294967296*u(e,t+4)+n-4294967296*(n>>31)},t.readUint64LE=function(e,t){void 0===t&&(t=0);var n=c(e,t);return 4294967296*c(e,t+4)+n},t.writeUint64BE=h,t.writeInt64BE=h,t.writeUint64LE=d,t.writeInt64LE=d,t.readUintBE=function(e,t,n){if(void 0===n&&(n=0),e%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(e/8>t.length-n)throw new Error("readUintBE: array is too short for the given bitLength");for(var r=0,i=1,o=e/8+n-1;o>=n;o--)r+=t[o]*i,i*=256;return r},t.readUintLE=function(e,t,n){if(void 0===n&&(n=0),e%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(e/8>t.length-n)throw new Error("readUintLE: array is too short for the given bitLength");for(var r=0,i=1,o=n;o=i;a--)n[a]=t/o&255,o*=256;return n},t.writeUintLE=function(e,t,n,i){if(void 0===n&&(n=new Uint8Array(e/8)),void 0===i&&(i=0),e%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!r.isSafeInteger(t))throw new Error("writeUintLE value must be an integer");for(var o=1,a=i;a>>16|I<<16)|0)>>>20|A<<12,S=(S^=P=P+(N=(N^=k=k+S|0)>>>16|N<<16)|0)>>>20|S<<12,O=(O^=T=T+(R=(R^=E=E+O|0)>>>16|R<<16)|0)>>>20|O<<12,M=(M^=j=j+(B=(B^=_=_+M|0)>>>16|B<<16)|0)>>>20|M<<12,O=(O^=T=T+(R=(R^=E=E+O|0)>>>24|R<<8)|0)>>>25|O<<7,M=(M^=j=j+(B=(B^=_=_+M|0)>>>24|B<<8)|0)>>>25|M<<7,S=(S^=P=P+(N=(N^=k=k+S|0)>>>24|N<<8)|0)>>>25|S<<7,A=(A^=C=C+(I=(I^=x=x+A|0)>>>24|I<<8)|0)>>>25|A<<7,S=(S^=T=T+(B=(B^=x=x+S|0)>>>16|B<<16)|0)>>>20|S<<12,O=(O^=j=j+(I=(I^=k=k+O|0)>>>16|I<<16)|0)>>>20|O<<12,M=(M^=C=C+(N=(N^=E=E+M|0)>>>16|N<<16)|0)>>>20|M<<12,A=(A^=P=P+(R=(R^=_=_+A|0)>>>16|R<<16)|0)>>>20|A<<12,M=(M^=C=C+(N=(N^=E=E+M|0)>>>24|N<<8)|0)>>>25|M<<7,A=(A^=P=P+(R=(R^=_=_+A|0)>>>24|R<<8)|0)>>>25|A<<7,O=(O^=j=j+(I=(I^=k=k+O|0)>>>24|I<<8)|0)>>>25|O<<7,S=(S^=T=T+(B=(B^=x=x+S|0)>>>24|B<<8)|0)>>>25|S<<7;r.writeUint32LE(x+i|0,e,0),r.writeUint32LE(k+a|0,e,4),r.writeUint32LE(E+s|0,e,8),r.writeUint32LE(_+u|0,e,12),r.writeUint32LE(A+c|0,e,16),r.writeUint32LE(S+l|0,e,20),r.writeUint32LE(O+f|0,e,24),r.writeUint32LE(M+h|0,e,28),r.writeUint32LE(C+d|0,e,32),r.writeUint32LE(P+p|0,e,36),r.writeUint32LE(T+v|0,e,40),r.writeUint32LE(j+m|0,e,44),r.writeUint32LE(I+y|0,e,48),r.writeUint32LE(N+g|0,e,52),r.writeUint32LE(R+b|0,e,56),r.writeUint32LE(B+w|0,e,60)}function s(e,t,n,r,o){if(void 0===o&&(o=0),32!==e.length)throw new Error("ChaCha: key size must be 32 bytes");if(r.length>>=8,t++;if(r>0)throw new Error("ChaCha: counter overflow")}t.streamXOR=s,t.stream=function(e,t,n,r){return void 0===r&&(r=0),i.wipe(n),s(e,t,n,n,r)}},53642:function(e,t,n){"use strict";var r=n(78284),i=n(75629),o=n(9116),a=n(76232),s=n(68770);t.Cv=32,t.WH=12,t.pg=16;var u=new Uint8Array(16),c=function(){function e(e){if(this.nonceLength=t.WH,this.tagLength=t.pg,e.length!==t.Cv)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(e)}return e.prototype.seal=function(e,t,n,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var a=new Uint8Array(16);a.set(e,a.length-e.length);var s=new Uint8Array(32);r.stream(this._key,a,s,4);var u,c=t.length+this.tagLength;if(i){if(i.length!==c)throw new Error("ChaCha20Poly1305: incorrect destination length");u=i}else u=new Uint8Array(c);return r.streamXOR(this._key,a,t,u,4),this._authenticate(u.subarray(u.length-this.tagLength,u.length),s,u.subarray(0,u.length-this.tagLength),n),o.wipe(a),u},e.prototype.open=function(e,t,n,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(t.length0&&s.update(u.subarray(r.length%16))),s.update(n),n.length%16>0&&s.update(u.subarray(n.length%16));var c=new Uint8Array(8);r&&a.writeUint64LE(r.length,c),s.update(c),a.writeUint64LE(n.length,c),s.update(c);for(var l=s.digest(),f=0;f>>8}Object.defineProperty(t,"__esModule",{value:!0}),t.select=function(e,t,n){return~(e-1)&t|e-1&n},t.lessOrEqual=function(e,t){return(0|e)-(0|t)-1>>>31&1},t.compare=n,t.equal=function(e,t){return 0!==e.length&&0!==t.length&&0!==n(e,t)}},2421:function(e,t,n){"use strict";t.Xx=t._w=t.aP=t.KS=t.jQ=void 0;var r=n(56271),i=n(40526),o=n(9116);function a(e){var t=new Float64Array(16);if(e)for(var n=0;n>16&1),n[s-1]&=65535;n[15]=r[15]-32767-(n[14]>>16&1);var u=n[15]>>16&1;n[14]&=65535,m(r,n,1-u)}for(var c=0;c<16;c++)e[2*c]=255&r[c],e[2*c+1]=r[c]>>8}function g(e,t){for(var n=0,r=0;r<32;r++)n|=e[r]^t[r];return(1&n-1>>>8)-1}function b(e,t){var n=new Uint8Array(32),r=new Uint8Array(32);return y(n,e),y(r,t),g(n,r)}function w(e){var t=new Uint8Array(32);return y(t,e),1&t[0]}function x(e,t,n){for(var r=0;r<16;r++)e[r]=t[r]+n[r]}function k(e,t,n){for(var r=0;r<16;r++)e[r]=t[r]-n[r]}function E(e,t,n){var r,i,o=0,a=0,s=0,u=0,c=0,l=0,f=0,h=0,d=0,p=0,v=0,m=0,y=0,g=0,b=0,w=0,x=0,k=0,E=0,_=0,A=0,S=0,O=0,M=0,C=0,P=0,T=0,j=0,I=0,N=0,R=0,B=n[0],D=n[1],L=n[2],F=n[3],Z=n[4],U=n[5],z=n[6],H=n[7],q=n[8],W=n[9],V=n[10],G=n[11],K=n[12],Q=n[13],Y=n[14],J=n[15];o+=(r=t[0])*B,a+=r*D,s+=r*L,u+=r*F,c+=r*Z,l+=r*U,f+=r*z,h+=r*H,d+=r*q,p+=r*W,v+=r*V,m+=r*G,y+=r*K,g+=r*Q,b+=r*Y,w+=r*J,a+=(r=t[1])*B,s+=r*D,u+=r*L,c+=r*F,l+=r*Z,f+=r*U,h+=r*z,d+=r*H,p+=r*q,v+=r*W,m+=r*V,y+=r*G,g+=r*K,b+=r*Q,w+=r*Y,x+=r*J,s+=(r=t[2])*B,u+=r*D,c+=r*L,l+=r*F,f+=r*Z,h+=r*U,d+=r*z,p+=r*H,v+=r*q,m+=r*W,y+=r*V,g+=r*G,b+=r*K,w+=r*Q,x+=r*Y,k+=r*J,u+=(r=t[3])*B,c+=r*D,l+=r*L,f+=r*F,h+=r*Z,d+=r*U,p+=r*z,v+=r*H,m+=r*q,y+=r*W,g+=r*V,b+=r*G,w+=r*K,x+=r*Q,k+=r*Y,E+=r*J,c+=(r=t[4])*B,l+=r*D,f+=r*L,h+=r*F,d+=r*Z,p+=r*U,v+=r*z,m+=r*H,y+=r*q,g+=r*W,b+=r*V,w+=r*G,x+=r*K,k+=r*Q,E+=r*Y,_+=r*J,l+=(r=t[5])*B,f+=r*D,h+=r*L,d+=r*F,p+=r*Z,v+=r*U,m+=r*z,y+=r*H,g+=r*q,b+=r*W,w+=r*V,x+=r*G,k+=r*K,E+=r*Q,_+=r*Y,A+=r*J,f+=(r=t[6])*B,h+=r*D,d+=r*L,p+=r*F,v+=r*Z,m+=r*U,y+=r*z,g+=r*H,b+=r*q,w+=r*W,x+=r*V,k+=r*G,E+=r*K,_+=r*Q,A+=r*Y,S+=r*J,h+=(r=t[7])*B,d+=r*D,p+=r*L,v+=r*F,m+=r*Z,y+=r*U,g+=r*z,b+=r*H,w+=r*q,x+=r*W,k+=r*V,E+=r*G,_+=r*K,A+=r*Q,S+=r*Y,O+=r*J,d+=(r=t[8])*B,p+=r*D,v+=r*L,m+=r*F,y+=r*Z,g+=r*U,b+=r*z,w+=r*H,x+=r*q,k+=r*W,E+=r*V,_+=r*G,A+=r*K,S+=r*Q,O+=r*Y,M+=r*J,p+=(r=t[9])*B,v+=r*D,m+=r*L,y+=r*F,g+=r*Z,b+=r*U,w+=r*z,x+=r*H,k+=r*q,E+=r*W,_+=r*V,A+=r*G,S+=r*K,O+=r*Q,M+=r*Y,C+=r*J,v+=(r=t[10])*B,m+=r*D,y+=r*L,g+=r*F,b+=r*Z,w+=r*U,x+=r*z,k+=r*H,E+=r*q,_+=r*W,A+=r*V,S+=r*G,O+=r*K,M+=r*Q,C+=r*Y,P+=r*J,m+=(r=t[11])*B,y+=r*D,g+=r*L,b+=r*F,w+=r*Z,x+=r*U,k+=r*z,E+=r*H,_+=r*q,A+=r*W,S+=r*V,O+=r*G,M+=r*K,C+=r*Q,P+=r*Y,T+=r*J,y+=(r=t[12])*B,g+=r*D,b+=r*L,w+=r*F,x+=r*Z,k+=r*U,E+=r*z,_+=r*H,A+=r*q,S+=r*W,O+=r*V,M+=r*G,C+=r*K,P+=r*Q,T+=r*Y,j+=r*J,g+=(r=t[13])*B,b+=r*D,w+=r*L,x+=r*F,k+=r*Z,E+=r*U,_+=r*z,A+=r*H,S+=r*q,O+=r*W,M+=r*V,C+=r*G,P+=r*K,T+=r*Q,j+=r*Y,I+=r*J,b+=(r=t[14])*B,w+=r*D,x+=r*L,k+=r*F,E+=r*Z,_+=r*U,A+=r*z,S+=r*H,O+=r*q,M+=r*W,C+=r*V,P+=r*G,T+=r*K,j+=r*Q,I+=r*Y,N+=r*J,w+=(r=t[15])*B,a+=38*(k+=r*L),s+=38*(E+=r*F),u+=38*(_+=r*Z),c+=38*(A+=r*U),l+=38*(S+=r*z),f+=38*(O+=r*H),h+=38*(M+=r*q),d+=38*(C+=r*W),p+=38*(P+=r*V),v+=38*(T+=r*G),m+=38*(j+=r*K),y+=38*(I+=r*Q),g+=38*(N+=r*Y),b+=38*(R+=r*J),o=(r=(o+=38*(x+=r*D))+(i=1)+65535)-65536*(i=Math.floor(r/65536)),a=(r=a+i+65535)-65536*(i=Math.floor(r/65536)),s=(r=s+i+65535)-65536*(i=Math.floor(r/65536)),u=(r=u+i+65535)-65536*(i=Math.floor(r/65536)),c=(r=c+i+65535)-65536*(i=Math.floor(r/65536)),l=(r=l+i+65535)-65536*(i=Math.floor(r/65536)),f=(r=f+i+65535)-65536*(i=Math.floor(r/65536)),h=(r=h+i+65535)-65536*(i=Math.floor(r/65536)),d=(r=d+i+65535)-65536*(i=Math.floor(r/65536)),p=(r=p+i+65535)-65536*(i=Math.floor(r/65536)),v=(r=v+i+65535)-65536*(i=Math.floor(r/65536)),m=(r=m+i+65535)-65536*(i=Math.floor(r/65536)),y=(r=y+i+65535)-65536*(i=Math.floor(r/65536)),g=(r=g+i+65535)-65536*(i=Math.floor(r/65536)),b=(r=b+i+65535)-65536*(i=Math.floor(r/65536)),w=(r=w+i+65535)-65536*(i=Math.floor(r/65536)),o=(r=(o+=i-1+37*(i-1))+(i=1)+65535)-65536*(i=Math.floor(r/65536)),a=(r=a+i+65535)-65536*(i=Math.floor(r/65536)),s=(r=s+i+65535)-65536*(i=Math.floor(r/65536)),u=(r=u+i+65535)-65536*(i=Math.floor(r/65536)),c=(r=c+i+65535)-65536*(i=Math.floor(r/65536)),l=(r=l+i+65535)-65536*(i=Math.floor(r/65536)),f=(r=f+i+65535)-65536*(i=Math.floor(r/65536)),h=(r=h+i+65535)-65536*(i=Math.floor(r/65536)),d=(r=d+i+65535)-65536*(i=Math.floor(r/65536)),p=(r=p+i+65535)-65536*(i=Math.floor(r/65536)),v=(r=v+i+65535)-65536*(i=Math.floor(r/65536)),m=(r=m+i+65535)-65536*(i=Math.floor(r/65536)),y=(r=y+i+65535)-65536*(i=Math.floor(r/65536)),g=(r=g+i+65535)-65536*(i=Math.floor(r/65536)),b=(r=b+i+65535)-65536*(i=Math.floor(r/65536)),w=(r=w+i+65535)-65536*(i=Math.floor(r/65536)),o+=i-1+37*(i-1),e[0]=o,e[1]=a,e[2]=s,e[3]=u,e[4]=c,e[5]=l,e[6]=f,e[7]=h,e[8]=d,e[9]=p,e[10]=v,e[11]=m,e[12]=y,e[13]=g,e[14]=b,e[15]=w}function _(e,t){E(e,t,t)}function A(e,t){var n,r=a();for(n=0;n<16;n++)r[n]=t[n];for(n=253;n>=0;n--)_(r,r),2!==n&&4!==n&&E(r,r,t);for(n=0;n<16;n++)e[n]=r[n]}function S(e,t){var n=a(),r=a(),i=a(),o=a(),s=a(),u=a(),c=a(),f=a(),h=a();k(n,e[1],e[0]),k(h,t[1],t[0]),E(n,n,h),x(r,e[0],e[1]),x(h,t[0],t[1]),E(r,r,h),E(i,e[3],t[3]),E(i,i,l),E(o,e[2],t[2]),x(o,o,o),k(s,r,n),k(u,o,i),x(c,o,i),x(f,r,n),E(e[0],s,u),E(e[1],f,c),E(e[2],c,u),E(e[3],s,f)}function O(e,t,n){for(var r=0;r<4;r++)m(e[r],t[r],n)}function M(e,t){var n=a(),r=a(),i=a();A(i,t[2]),E(n,t[0],i),E(r,t[1],i),y(e,r),e[31]^=w(n)<<7}function C(e,t,n){p(e[0],s),p(e[1],u),p(e[2],u),p(e[3],s);for(var r=255;r>=0;--r){var i=n[r/8|0]>>(7&r)&1;O(e,t,i),S(t,e),S(e,e),O(e,t,i)}}function P(e,t){var n=[a(),a(),a(),a()];p(n[0],f),p(n[1],h),p(n[2],u),E(n[3],f,h),C(e,n,t)}function T(e){if(e.length!==t.aP)throw new Error("ed25519: seed must be ".concat(t.aP," bytes"));var n=(0,i.hash)(e);n[0]&=248,n[31]&=127,n[31]|=64;var r=new Uint8Array(32),o=[a(),a(),a(),a()];P(o,n),M(r,o);var s=new Uint8Array(64);return s.set(e),s.set(r,32),{publicKey:r,secretKey:s}}t._w=T;var j=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 I(e,t){var n,r,i,o;for(r=63;r>=32;--r){for(n=0,i=r-32,o=r-12;i>4)*j[i],n=t[i]>>8,t[i]&=255;for(i=0;i<32;i++)t[i]-=n*j[i];for(r=0;r<32;r++)t[r+1]+=t[r]>>8,e[r]=255&t[r]}function N(e){for(var t=new Float64Array(64),n=0;n<64;n++)t[n]=e[n];for(var r=0;r<64;r++)e[r]=0;I(e,t)}function R(e,t){var n=a(),r=a(),i=a(),o=a(),l=a(),f=a(),h=a();return p(e[2],u),function(e,t){for(var n=0;n<16;n++)e[n]=t[2*n]+(t[2*n+1]<<8);e[15]&=32767}(e[1],t),_(i,e[1]),E(o,i,c),k(i,i,e[2]),x(o,e[2],o),_(l,o),_(f,l),E(h,f,l),E(n,h,i),E(n,n,o),function(e,t){var n,r=a();for(n=0;n<16;n++)r[n]=t[n];for(n=250;n>=0;n--)_(r,r),1!==n&&E(r,r,t);for(n=0;n<16;n++)e[n]=r[n]}(n,n),E(n,n,i),E(n,n,o),E(n,n,o),E(e[0],n,o),_(r,e[0]),E(r,r,o),b(r,i)&&E(e[0],e[0],d),_(r,e[0]),E(r,r,o),b(r,i)?-1:(w(e[0])===t[31]>>7&&k(e[0],s,e[0]),E(e[3],e[0],e[1]),0)}t.Xx=function(e,t){var n=new Float64Array(64),r=[a(),a(),a(),a()],o=(0,i.hash)(e.subarray(0,32));o[0]&=248,o[31]&=127,o[31]|=64;var s=new Uint8Array(64);s.set(o.subarray(32),32);var u=new i.SHA512;u.update(s.subarray(32)),u.update(t);var c=u.digest();u.clean(),N(c),P(r,c),M(s,r),u.reset(),u.update(s.subarray(0,32)),u.update(e.subarray(32)),u.update(t);var l=u.digest();N(l);for(var f=0;f<32;f++)n[f]=c[f];for(var h=0;h<32;h++)for(var d=0;d<32;d++)n[h+d]+=l[h]*o[d];return I(s.subarray(32),n),s}},41412:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isSerializableHash=function(e){return"undefined"!==typeof e.saveState&&"undefined"!==typeof e.restoreState&&"undefined"!==typeof e.cleanSavedState}},52497:function(e,t,n){"use strict";var r=n(5499),i=n(9116),o=function(){function e(e,t,n,i){void 0===n&&(n=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=i;var o=r.hmac(this._hash,n,t);this._hmac=new r.HMAC(e,o),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return e.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(0===e)throw new Error("hkdf: cannot expand more");this._hmac.reset(),e>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},e.prototype.expand=function(e){for(var t=new Uint8Array(e),n=0;nthis.blockSize?this._inner.update(t).finish(n).clean():n.set(t);for(var i=0;i>>16&65535)*r+n*(t>>>16&65535)<<16>>>0)|0},t.add=function(e,t){return e+t|0},t.sub=function(e,t){return e-t|0},t.rotl=function(e,t){return e<>>32-t},t.rotr=function(e,t){return e<<32-t|e>>>t},t.isInteger=Number.isInteger||function(e){return"number"===typeof e&&isFinite(e)&&Math.floor(e)===e},t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(e){return t.isInteger(e)&&e>=-t.MAX_SAFE_INTEGER&&e<=t.MAX_SAFE_INTEGER}},75629:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(68770),i=n(9116);t.DIGEST_LENGTH=16;var o=function(){function e(e){this.digestLength=t.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 n=e[0]|e[1]<<8;this._r[0]=8191&n;var r=e[2]|e[3]<<8;this._r[1]=8191&(n>>>13|r<<3);var i=e[4]|e[5]<<8;this._r[2]=7939&(r>>>10|i<<6);var o=e[6]|e[7]<<8;this._r[3]=8191&(i>>>7|o<<9);var a=e[8]|e[9]<<8;this._r[4]=255&(o>>>4|a<<12),this._r[5]=a>>>1&8190;var s=e[10]|e[11]<<8;this._r[6]=8191&(a>>>14|s<<2);var u=e[12]|e[13]<<8;this._r[7]=8065&(s>>>11|u<<5);var c=e[14]|e[15]<<8;this._r[8]=8191&(u>>>8|c<<8),this._r[9]=c>>>5&127,this._pad[0]=e[16]|e[17]<<8,this._pad[1]=e[18]|e[19]<<8,this._pad[2]=e[20]|e[21]<<8,this._pad[3]=e[22]|e[23]<<8,this._pad[4]=e[24]|e[25]<<8,this._pad[5]=e[26]|e[27]<<8,this._pad[6]=e[28]|e[29]<<8,this._pad[7]=e[30]|e[31]<<8}return e.prototype._blocks=function(e,t,n){for(var r=this._fin?0:2048,i=this._h[0],o=this._h[1],a=this._h[2],s=this._h[3],u=this._h[4],c=this._h[5],l=this._h[6],f=this._h[7],h=this._h[8],d=this._h[9],p=this._r[0],v=this._r[1],m=this._r[2],y=this._r[3],g=this._r[4],b=this._r[5],w=this._r[6],x=this._r[7],k=this._r[8],E=this._r[9];n>=16;){var _=e[t+0]|e[t+1]<<8;i+=8191&_;var A=e[t+2]|e[t+3]<<8;o+=8191&(_>>>13|A<<3);var S=e[t+4]|e[t+5]<<8;a+=8191&(A>>>10|S<<6);var O=e[t+6]|e[t+7]<<8;s+=8191&(S>>>7|O<<9);var M=e[t+8]|e[t+9]<<8;u+=8191&(O>>>4|M<<12),c+=M>>>1&8191;var C=e[t+10]|e[t+11]<<8;l+=8191&(M>>>14|C<<2);var P=e[t+12]|e[t+13]<<8;f+=8191&(C>>>11|P<<5);var T=e[t+14]|e[t+15]<<8,j=0,I=j;I+=i*p,I+=o*(5*E),I+=a*(5*k),I+=s*(5*x),j=(I+=u*(5*w))>>>13,I&=8191,I+=c*(5*b),I+=l*(5*g),I+=f*(5*y),I+=(h+=8191&(P>>>8|T<<8))*(5*m);var N=j+=(I+=(d+=T>>>5|r)*(5*v))>>>13;N+=i*v,N+=o*p,N+=a*(5*E),N+=s*(5*k),j=(N+=u*(5*x))>>>13,N&=8191,N+=c*(5*w),N+=l*(5*b),N+=f*(5*g),N+=h*(5*y),j+=(N+=d*(5*m))>>>13,N&=8191;var R=j;R+=i*m,R+=o*v,R+=a*p,R+=s*(5*E),j=(R+=u*(5*k))>>>13,R&=8191,R+=c*(5*x),R+=l*(5*w),R+=f*(5*b),R+=h*(5*g);var B=j+=(R+=d*(5*y))>>>13;B+=i*y,B+=o*m,B+=a*v,B+=s*p,j=(B+=u*(5*E))>>>13,B&=8191,B+=c*(5*k),B+=l*(5*x),B+=f*(5*w),B+=h*(5*b);var D=j+=(B+=d*(5*g))>>>13;D+=i*g,D+=o*y,D+=a*m,D+=s*v,j=(D+=u*p)>>>13,D&=8191,D+=c*(5*E),D+=l*(5*k),D+=f*(5*x),D+=h*(5*w);var L=j+=(D+=d*(5*b))>>>13;L+=i*b,L+=o*g,L+=a*y,L+=s*m,j=(L+=u*v)>>>13,L&=8191,L+=c*p,L+=l*(5*E),L+=f*(5*k),L+=h*(5*x);var F=j+=(L+=d*(5*w))>>>13;F+=i*w,F+=o*b,F+=a*g,F+=s*y,j=(F+=u*m)>>>13,F&=8191,F+=c*v,F+=l*p,F+=f*(5*E),F+=h*(5*k);var Z=j+=(F+=d*(5*x))>>>13;Z+=i*x,Z+=o*w,Z+=a*b,Z+=s*g,j=(Z+=u*y)>>>13,Z&=8191,Z+=c*m,Z+=l*v,Z+=f*p,Z+=h*(5*E);var U=j+=(Z+=d*(5*k))>>>13;U+=i*k,U+=o*x,U+=a*w,U+=s*b,j=(U+=u*g)>>>13,U&=8191,U+=c*y,U+=l*m,U+=f*v,U+=h*p;var z=j+=(U+=d*(5*E))>>>13;z+=i*E,z+=o*k,z+=a*x,z+=s*w,j=(z+=u*b)>>>13,z&=8191,z+=c*g,z+=l*y,z+=f*m,z+=h*v,i=I=8191&(j=(j=((j+=(z+=d*p)>>>13)<<2)+j|0)+(I&=8191)|0),o=N+=j>>>=13,a=R&=8191,s=B&=8191,u=D&=8191,c=L&=8191,l=F&=8191,f=Z&=8191,h=U&=8191,d=z&=8191,t+=16,n-=16}this._h[0]=i,this._h[1]=o,this._h[2]=a,this._h[3]=s,this._h[4]=u,this._h[5]=c,this._h[6]=l,this._h[7]=f,this._h[8]=h,this._h[9]=d},e.prototype.finish=function(e,t){void 0===t&&(t=0);var n,r,i,o,a=new Uint16Array(10);if(this._leftover){for(o=this._leftover,this._buffer[o++]=1;o<16;o++)this._buffer[o]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(n=this._h[1]>>>13,this._h[1]&=8191,o=2;o<10;o++)this._h[o]+=n,n=this._h[o]>>>13,this._h[o]&=8191;for(this._h[0]+=5*n,n=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=n,n=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=n,a[0]=this._h[0]+5,n=a[0]>>>13,a[0]&=8191,o=1;o<10;o++)a[o]=this._h[o]+n,n=a[o]>>>13,a[o]&=8191;for(a[9]-=8192,r=(1^n)-1,o=0;o<10;o++)a[o]&=r;for(r=~r,o=0;o<10;o++)this._h[o]=this._h[o]&r|a[o];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),i=this._h[0]+this._pad[0],this._h[0]=65535&i,o=1;o<8;o++)i=(this._h[o]+this._pad[o]|0)+(i>>>16)|0,this._h[o]=65535&i;return e[t+0]=this._h[0]>>>0,e[t+1]=this._h[0]>>>8,e[t+2]=this._h[1]>>>0,e[t+3]=this._h[1]>>>8,e[t+4]=this._h[2]>>>0,e[t+5]=this._h[2]>>>8,e[t+6]=this._h[3]>>>0,e[t+7]=this._h[3]>>>8,e[t+8]=this._h[4]>>>0,e[t+9]=this._h[4]>>>8,e[t+10]=this._h[5]>>>0,e[t+11]=this._h[5]>>>8,e[t+12]=this._h[6]>>>0,e[t+13]=this._h[6]>>>8,e[t+14]=this._h[7]>>>0,e[t+15]=this._h[7]>>>8,this._finished=!0,this},e.prototype.update=function(e){var t,n=0,r=e.length;if(this._leftover){(t=16-this._leftover)>r&&(t=r);for(var i=0;i=16&&(t=r-r%16,this._blocks(e,n,t),n+=t,r-=t),r){for(i=0;i1&&void 0!==arguments[1]?arguments[1]:t.defaultRandomSource).randomBytes(e)}t.defaultRandomSource=new r.SystemRandomSource,t.randomBytes=a,t.randomUint32=function(){var e=a(4,arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.defaultRandomSource),n=(0,i.readUint32LE)(e);return(0,o.wipe)(e),n};var s="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function u(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.defaultRandomSource;if(n.length<2)throw new Error("randomString charset is too short");if(n.length>256)throw new Error("randomString charset is too long");for(var i="",u=n.length,c=256-256%u;e>0;){for(var l=a(Math.ceil(256*e/c),r),f=0;f0;f++){var h=l[f];h1&&void 0!==arguments[1]?arguments[1]:s,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.defaultRandomSource;return u(Math.ceil(e/(Math.log(n.length)/Math.LN2)),n,r)}},98136:function(e,t,n){"use strict";var r=n(56690).default,i=n(89728).default;Object.defineProperty(t,"__esModule",{value:!0}),t.BrowserRandomSource=void 0;var o=function(){function e(){r(this,e),this.isAvailable=!1,this.isInstantiated=!1;var t="undefined"!==typeof self?self.crypto||self.msCrypto:null;t&&void 0!==t.getRandomValues&&(this._crypto=t,this.isAvailable=!0,this.isInstantiated=!0)}return i(e,[{key:"randomBytes",value:function(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");for(var t=new Uint8Array(e),n=0;n0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=e[n++],t--;this._bufferLength===this.blockSize&&(s(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(t>=this.blockSize&&(n=s(this._temp,this._state,e,n,t),t%=this.blockSize);t>0;)this._buffer[this._bufferLength++]=e[n++],t--;return this},e.prototype.finish=function(e){if(!this._finished){var t=this._bytesHashed,n=this._bufferLength,i=t/536870912|0,o=t<<3,a=t%64<56?64:128;this._buffer[n]=128;for(var u=n+1;u0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},e.prototype.restoreState=function(e){return this._state.set(e.state),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},e.prototype.cleanSavedState=function(e){i.wipe(e.state),e.buffer&&i.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},e}();t.mE=o;var a=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 s(e,t,n,i,o){for(;o>=64;){for(var s=t[0],u=t[1],c=t[2],l=t[3],f=t[4],h=t[5],d=t[6],p=t[7],v=0;v<16;v++){var m=i+4*v;e[v]=r.readUint32BE(n,m)}for(v=16;v<64;v++){var y=e[v-2],g=(y>>>17|y<<15)^(y>>>19|y<<13)^y>>>10,b=((y=e[v-15])>>>7|y<<25)^(y>>>18|y<<14)^y>>>3;e[v]=(g+e[v-7]|0)+(b+e[v-16]|0)}for(v=0;v<64;v++){g=(((f>>>6|f<<26)^(f>>>11|f<<21)^(f>>>25|f<<7))+(f&h^~f&d)|0)+(p+(a[v]+e[v]|0)|0)|0,b=((s>>>2|s<<30)^(s>>>13|s<<19)^(s>>>22|s<<10))+(s&u^s&c^u&c)|0;p=d,d=h,h=f,f=l+g|0,l=c,c=u,u=s,s=g+b|0}t[0]+=s,t[1]+=u,t[2]+=c,t[3]+=l,t[4]+=f,t[5]+=h,t[6]+=d,t[7]+=p,i+=64,o-=64}return i}t.vp=function(e){var t=new o;t.update(e);var n=t.digest();return t.clean(),n}},40526:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(76232),i=n(9116);t.DIGEST_LENGTH=64,t.BLOCK_SIZE=128;var o=function(){function e(){this.digestLength=t.DIGEST_LENGTH,this.blockSize=t.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 e.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},e.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},e.prototype.clean=function(){i.wipe(this._buffer),i.wipe(this._tempHi),i.wipe(this._tempLo),this.reset()},e.prototype.update=function(e,n){if(void 0===n&&(n=e.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var r=0;if(this._bytesHashed+=n,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=e[r++],n--;this._bufferLength===this.blockSize&&(s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(n>=this.blockSize&&(r=s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,e,r,n),n%=this.blockSize);n>0;)this._buffer[this._bufferLength++]=e[r++],n--;return this},e.prototype.finish=function(e){if(!this._finished){var t=this._bytesHashed,n=this._bufferLength,i=t/536870912|0,o=t<<3,a=t%128<112?128:256;this._buffer[n]=128;for(var u=n+1;u0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},e.prototype.restoreState=function(e){return this._stateHi.set(e.stateHi),this._stateLo.set(e.stateLo),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},e.prototype.cleanSavedState=function(e){i.wipe(e.stateHi),i.wipe(e.stateLo),e.buffer&&i.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},e}();t.SHA512=o;var a=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 s(e,t,n,i,o,s,u){for(var c,l,f,h,d,p,v,m,y=n[0],g=n[1],b=n[2],w=n[3],x=n[4],k=n[5],E=n[6],_=n[7],A=i[0],S=i[1],O=i[2],M=i[3],C=i[4],P=i[5],T=i[6],j=i[7];u>=128;){for(var I=0;I<16;I++){var N=8*I+s;e[I]=r.readUint32BE(o,N),t[I]=r.readUint32BE(o,N+4)}for(I=0;I<80;I++){var R,B,D=y,L=g,F=b,Z=w,U=x,z=k,H=E,q=A,W=S,V=O,G=M,K=C,Q=P,Y=T;if(d=65535&(l=j),p=l>>>16,v=65535&(c=_),m=c>>>16,d+=65535&(l=(C>>>14|x<<18)^(C>>>18|x<<14)^(x>>>9|C<<23)),p+=l>>>16,v+=65535&(c=(x>>>14|C<<18)^(x>>>18|C<<14)^(C>>>9|x<<23)),m+=c>>>16,d+=65535&(l=C&P^~C&T),p+=l>>>16,v+=65535&(c=x&k^~x&E),m+=c>>>16,c=a[2*I],d+=65535&(l=a[2*I+1]),p+=l>>>16,v+=65535&c,m+=c>>>16,c=e[I%16],p+=(l=t[I%16])>>>16,v+=65535&c,m+=c>>>16,v+=(p+=(d+=65535&l)>>>16)>>>16,d=65535&(l=h=65535&d|p<<16),p=l>>>16,v=65535&(c=f=65535&v|(m+=v>>>16)<<16),m=c>>>16,d+=65535&(l=(A>>>28|y<<4)^(y>>>2|A<<30)^(y>>>7|A<<25)),p+=l>>>16,v+=65535&(c=(y>>>28|A<<4)^(A>>>2|y<<30)^(A>>>7|y<<25)),m+=c>>>16,p+=(l=A&S^A&O^S&O)>>>16,v+=65535&(c=y&g^y&b^g&b),m+=c>>>16,R=65535&(v+=(p+=(d+=65535&l)>>>16)>>>16)|(m+=v>>>16)<<16,B=65535&d|p<<16,d=65535&(l=G),p=l>>>16,v=65535&(c=Z),m=c>>>16,p+=(l=h)>>>16,v+=65535&(c=f),m+=c>>>16,g=D,b=L,w=F,x=Z=65535&(v+=(p+=(d+=65535&l)>>>16)>>>16)|(m+=v>>>16)<<16,k=U,E=z,_=H,y=R,S=q,O=W,M=V,C=G=65535&d|p<<16,P=K,T=Q,j=Y,A=B,I%16===15)for(N=0;N<16;N++)c=e[N],d=65535&(l=t[N]),p=l>>>16,v=65535&c,m=c>>>16,c=e[(N+9)%16],d+=65535&(l=t[(N+9)%16]),p+=l>>>16,v+=65535&c,m+=c>>>16,f=e[(N+1)%16],d+=65535&(l=((h=t[(N+1)%16])>>>1|f<<31)^(h>>>8|f<<24)^(h>>>7|f<<25)),p+=l>>>16,v+=65535&(c=(f>>>1|h<<31)^(f>>>8|h<<24)^f>>>7),m+=c>>>16,f=e[(N+14)%16],p+=(l=((h=t[(N+14)%16])>>>19|f<<13)^(f>>>29|h<<3)^(h>>>6|f<<26))>>>16,v+=65535&(c=(f>>>19|h<<13)^(h>>>29|f<<3)^f>>>6),m+=c>>>16,m+=(v+=(p+=(d+=65535&l)>>>16)>>>16)>>>16,e[N]=65535&v|m<<16,t[N]=65535&d|p<<16}d=65535&(l=A),p=l>>>16,v=65535&(c=y),m=c>>>16,c=n[0],p+=(l=i[0])>>>16,v+=65535&c,m+=c>>>16,m+=(v+=(p+=(d+=65535&l)>>>16)>>>16)>>>16,n[0]=y=65535&v|m<<16,i[0]=A=65535&d|p<<16,d=65535&(l=S),p=l>>>16,v=65535&(c=g),m=c>>>16,c=n[1],p+=(l=i[1])>>>16,v+=65535&c,m+=c>>>16,m+=(v+=(p+=(d+=65535&l)>>>16)>>>16)>>>16,n[1]=g=65535&v|m<<16,i[1]=S=65535&d|p<<16,d=65535&(l=O),p=l>>>16,v=65535&(c=b),m=c>>>16,c=n[2],p+=(l=i[2])>>>16,v+=65535&c,m+=c>>>16,m+=(v+=(p+=(d+=65535&l)>>>16)>>>16)>>>16,n[2]=b=65535&v|m<<16,i[2]=O=65535&d|p<<16,d=65535&(l=M),p=l>>>16,v=65535&(c=w),m=c>>>16,c=n[3],p+=(l=i[3])>>>16,v+=65535&c,m+=c>>>16,m+=(v+=(p+=(d+=65535&l)>>>16)>>>16)>>>16,n[3]=w=65535&v|m<<16,i[3]=M=65535&d|p<<16,d=65535&(l=C),p=l>>>16,v=65535&(c=x),m=c>>>16,c=n[4],p+=(l=i[4])>>>16,v+=65535&c,m+=c>>>16,m+=(v+=(p+=(d+=65535&l)>>>16)>>>16)>>>16,n[4]=x=65535&v|m<<16,i[4]=C=65535&d|p<<16,d=65535&(l=P),p=l>>>16,v=65535&(c=k),m=c>>>16,c=n[5],p+=(l=i[5])>>>16,v+=65535&c,m+=c>>>16,m+=(v+=(p+=(d+=65535&l)>>>16)>>>16)>>>16,n[5]=k=65535&v|m<<16,i[5]=P=65535&d|p<<16,d=65535&(l=T),p=l>>>16,v=65535&(c=E),m=c>>>16,c=n[6],p+=(l=i[6])>>>16,v+=65535&c,m+=c>>>16,m+=(v+=(p+=(d+=65535&l)>>>16)>>>16)>>>16,n[6]=E=65535&v|m<<16,i[6]=T=65535&d|p<<16,d=65535&(l=j),p=l>>>16,v=65535&(c=_),m=c>>>16,c=n[7],p+=(l=i[7])>>>16,v+=65535&c,m+=c>>>16,m+=(v+=(p+=(d+=65535&l)>>>16)>>>16)>>>16,n[7]=_=65535&v|m<<16,i[7]=j=65535&d|p<<16,s+=128,u-=128}return s}t.hash=function(e){var t=new o;t.update(e);var n=t.digest();return t.clean(),n}},9116:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.wipe=function(e){for(var t=0;t=0;--w){var x=n[w>>>3]>>>(7&w)&1;c(i,a,x),c(p,v,x),l(m,i,p),f(i,i,p),l(p,a,v),f(a,a,v),d(v,m),d(y,i),h(i,p,i),h(p,a,m),l(m,i,p),f(i,i,p),d(a,i),f(p,v,y),h(i,p,s),l(i,i,v),h(p,p,i),h(i,v,y),h(v,a,r),d(a,m),c(i,a,x),c(p,v,x)}for(var k=0;k<16;k++)r[k+16]=i[k],r[k+32]=p[k],r[k+48]=a[k],r[k+64]=v[k];var E=r.subarray(32),_=r.subarray(16);!function(e,t){for(var n=o(),r=0;r<16;r++)n[r]=t[r];for(var i=253;i>=0;i--)d(n,n),2!==i&&4!==i&&h(n,n,t);for(var a=0;a<16;a++)e[a]=n[a]}(E,E),h(_,_,E);var A=new Uint8Array(32);return function(e,t){for(var n=o(),r=o(),i=0;i<16;i++)r[i]=t[i];u(r),u(r),u(r);for(var a=0;a<2;a++){n[0]=r[0]-65517;for(var s=1;s<15;s++)n[s]=r[s]-65535-(n[s-1]>>16&1),n[s-1]&=65535;n[15]=r[15]-32767-(n[14]>>16&1);var l=n[15]>>16&1;n[14]&=65535,c(r,n,1-l)}for(var f=0;f<16;f++)e[2*f]=255&r[f],e[2*f+1]=r[f]>>8}(A,_),A}function v(e){return p(e,a)}function m(e){if(e.length!==t.KS)throw new Error("x25519: seed must be ".concat(t.KS," bytes"));var n=new Uint8Array(e);return{publicKey:v(n),secretKey:n}}t.Au=function(e){var t=(0,r.randomBytes)(32,e),n=m(t);return(0,i.wipe)(t),n},t.gi=function(e,n){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e.length!==t.kz)throw new Error("X25519: incorrect secret key length");if(n.length!==t.kz)throw new Error("X25519: incorrect public key length");var i=p(e,n);if(r){for(var o=0,a=0;a0&&void 0!==arguments[0]?arguments[0]:0;return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?j(globalThis.Buffer.allocUnsafe(e)):new Uint8Array(e)}function N(e,t){t||(t=e.reduce((function(e,t){return e+t.length}),0));var n,r=I(t),i=0,o=(0,_.Z)(e);try{for(o.s();!(n=o.n()).done;){var a=n.value;r.set(a,i),i+=a.length}}catch(s){o.e(s)}finally{o.f()}return j(r)}var R=n(1413);var B=function(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),r=0;r>>0,a=new Uint8Array(o);e[t];){var l=n[e.charCodeAt(t)];if(255===l)return;for(var f=0,h=o-1;(0!==l||f>>0,a[h]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");i=f,t++}if(" "!==e[t]){for(var d=o-i;d!==o&&0===a[d];)d++;for(var p=new Uint8Array(r+(o-d)),v=r;d!==o;)p[v++]=a[d++];return p}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var n=0,r=0,i=0,o=t.length;i!==o&&0===t[i];)i++,n++;for(var a=(o-i)*l+1>>>0,c=new Uint8Array(a);i!==o;){for(var f=t[i],h=0,d=a-1;(0!==f||h>>0,c[d]=f%s>>>0,f=f/s>>>0;if(0!==f)throw new Error("Non-zero carry");r=h,i++}for(var p=a-r;p!==a&&0===c[p];)p++;for(var v=u.repeat(n);pn;)o+=t[i&s>>(a-=n)];if(a&&(o+=t[i&s<=8&&(u-=8,s[l++]=255&c>>u)}if(u>=n||255&c<<8-u)throw new SyntaxError("Unexpected end of data");return s}(e,i,r,t)}})},G=q({prefix:"\0",name:"identity",encode:function(e){return function(e){return(new TextDecoder).decode(e)}(e)},decode:function(e){return function(e){return(new TextEncoder).encode(e)}(e)}}),K=V({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),Q=V({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),Y=W({prefix:"9",name:"base10",alphabet:"0123456789"}),J=V({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),X=V({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),$=V({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),ee=V({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),te=V({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),ne=V({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),re=V({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),ie=V({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),oe=V({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),ae=V({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),se=V({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),ue=W({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),ce=W({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),le=W({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),fe=W({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),he=V({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),de=V({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),pe=V({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),ve=V({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),me=Array.from("\ud83d\ude80\ud83e\ude90\u2604\ud83d\udef0\ud83c\udf0c\ud83c\udf11\ud83c\udf12\ud83c\udf13\ud83c\udf14\ud83c\udf15\ud83c\udf16\ud83c\udf17\ud83c\udf18\ud83c\udf0d\ud83c\udf0f\ud83c\udf0e\ud83d\udc09\u2600\ud83d\udcbb\ud83d\udda5\ud83d\udcbe\ud83d\udcbf\ud83d\ude02\u2764\ud83d\ude0d\ud83e\udd23\ud83d\ude0a\ud83d\ude4f\ud83d\udc95\ud83d\ude2d\ud83d\ude18\ud83d\udc4d\ud83d\ude05\ud83d\udc4f\ud83d\ude01\ud83d\udd25\ud83e\udd70\ud83d\udc94\ud83d\udc96\ud83d\udc99\ud83d\ude22\ud83e\udd14\ud83d\ude06\ud83d\ude44\ud83d\udcaa\ud83d\ude09\u263a\ud83d\udc4c\ud83e\udd17\ud83d\udc9c\ud83d\ude14\ud83d\ude0e\ud83d\ude07\ud83c\udf39\ud83e\udd26\ud83c\udf89\ud83d\udc9e\u270c\u2728\ud83e\udd37\ud83d\ude31\ud83d\ude0c\ud83c\udf38\ud83d\ude4c\ud83d\ude0b\ud83d\udc97\ud83d\udc9a\ud83d\ude0f\ud83d\udc9b\ud83d\ude42\ud83d\udc93\ud83e\udd29\ud83d\ude04\ud83d\ude00\ud83d\udda4\ud83d\ude03\ud83d\udcaf\ud83d\ude48\ud83d\udc47\ud83c\udfb6\ud83d\ude12\ud83e\udd2d\u2763\ud83d\ude1c\ud83d\udc8b\ud83d\udc40\ud83d\ude2a\ud83d\ude11\ud83d\udca5\ud83d\ude4b\ud83d\ude1e\ud83d\ude29\ud83d\ude21\ud83e\udd2a\ud83d\udc4a\ud83e\udd73\ud83d\ude25\ud83e\udd24\ud83d\udc49\ud83d\udc83\ud83d\ude33\u270b\ud83d\ude1a\ud83d\ude1d\ud83d\ude34\ud83c\udf1f\ud83d\ude2c\ud83d\ude43\ud83c\udf40\ud83c\udf37\ud83d\ude3b\ud83d\ude13\u2b50\u2705\ud83e\udd7a\ud83c\udf08\ud83d\ude08\ud83e\udd18\ud83d\udca6\u2714\ud83d\ude23\ud83c\udfc3\ud83d\udc90\u2639\ud83c\udf8a\ud83d\udc98\ud83d\ude20\u261d\ud83d\ude15\ud83c\udf3a\ud83c\udf82\ud83c\udf3b\ud83d\ude10\ud83d\udd95\ud83d\udc9d\ud83d\ude4a\ud83d\ude39\ud83d\udde3\ud83d\udcab\ud83d\udc80\ud83d\udc51\ud83c\udfb5\ud83e\udd1e\ud83d\ude1b\ud83d\udd34\ud83d\ude24\ud83c\udf3c\ud83d\ude2b\u26bd\ud83e\udd19\u2615\ud83c\udfc6\ud83e\udd2b\ud83d\udc48\ud83d\ude2e\ud83d\ude46\ud83c\udf7b\ud83c\udf43\ud83d\udc36\ud83d\udc81\ud83d\ude32\ud83c\udf3f\ud83e\udde1\ud83c\udf81\u26a1\ud83c\udf1e\ud83c\udf88\u274c\u270a\ud83d\udc4b\ud83d\ude30\ud83e\udd28\ud83d\ude36\ud83e\udd1d\ud83d\udeb6\ud83d\udcb0\ud83c\udf53\ud83d\udca2\ud83e\udd1f\ud83d\ude41\ud83d\udea8\ud83d\udca8\ud83e\udd2c\u2708\ud83c\udf80\ud83c\udf7a\ud83e\udd13\ud83d\ude19\ud83d\udc9f\ud83c\udf31\ud83d\ude16\ud83d\udc76\ud83e\udd74\u25b6\u27a1\u2753\ud83d\udc8e\ud83d\udcb8\u2b07\ud83d\ude28\ud83c\udf1a\ud83e\udd8b\ud83d\ude37\ud83d\udd7a\u26a0\ud83d\ude45\ud83d\ude1f\ud83d\ude35\ud83d\udc4e\ud83e\udd32\ud83e\udd20\ud83e\udd27\ud83d\udccc\ud83d\udd35\ud83d\udc85\ud83e\uddd0\ud83d\udc3e\ud83c\udf52\ud83d\ude17\ud83e\udd11\ud83c\udf0a\ud83e\udd2f\ud83d\udc37\u260e\ud83d\udca7\ud83d\ude2f\ud83d\udc86\ud83d\udc46\ud83c\udfa4\ud83d\ude47\ud83c\udf51\u2744\ud83c\udf34\ud83d\udca3\ud83d\udc38\ud83d\udc8c\ud83d\udccd\ud83e\udd40\ud83e\udd22\ud83d\udc45\ud83d\udca1\ud83d\udca9\ud83d\udc50\ud83d\udcf8\ud83d\udc7b\ud83e\udd10\ud83e\udd2e\ud83c\udfbc\ud83e\udd75\ud83d\udea9\ud83c\udf4e\ud83c\udf4a\ud83d\udc7c\ud83d\udc8d\ud83d\udce3\ud83e\udd42"),ye=me.reduce((function(e,t,n){return e[n]=t,e}),[]),ge=me.reduce((function(e,t,n){return e[t.codePointAt(0)]=n,e}),[]);var be=q({prefix:"\ud83d\ude80",name:"base256emoji",encode:function(e){return e.reduce((function(e,t){return e+=ye[t]}),"")},decode:function(e){var t,n=[],r=(0,_.Z)(e);try{for(r.s();!(t=r.n()).done;){var i=t.value,o=ge[i.codePointAt(0)];if(void 0===o)throw new Error("Non-base256emoji character: ".concat(i));n.push(o)}}catch(a){r.e(a)}finally{r.f()}return new Uint8Array(n)}}),we=function e(t,n,r){n=n||[];var i=r=r||0;for(;t>=Ee;)n[r++]=255&t|xe,t/=128;for(;t&ke;)n[r++]=255&t|xe,t>>>=7;return n[r]=0|t,e.bytes=r-i+1,n},xe=128,ke=-128,Ee=Math.pow(2,31);var _e=function e(t,n){var r,i=0,o=0,a=n=n||0,s=t.length;do{if(a>=s)throw e.bytes=0,new RangeError("Could not decode varint");r=t[a++],i+=o<28?(r&Se)<=Ae);return e.bytes=a-n,i},Ae=128,Se=127;var Oe=Math.pow(2,7),Me=Math.pow(2,14),Ce=Math.pow(2,21),Pe=Math.pow(2,28),Te=Math.pow(2,35),je=Math.pow(2,42),Ie=Math.pow(2,49),Ne=Math.pow(2,56),Re=Math.pow(2,63),Be={encode:we,decode:_e,encodingLength:function(e){return e1&&void 0!==arguments[1]?arguments[1]:0;return[Be.decode(e,t),Be.decode.bytes]},Le=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Be.encode(e,t,n),t},Fe=function(e){return Be.encodingLength(e)},Ze=function(e,t){var n=t.byteLength,r=Fe(e),i=r+Fe(n),o=new Uint8Array(i+n);return Le(e,o,0),Le(n,o,r),o.set(t,i),new Ue(e,n,t,o)},Ue=(0,x.Z)((function e(t,n,r,i){(0,w.Z)(this,e),this.code=t,this.size=n,this.digest=r,this.bytes=i})),ze=function(e){var t=e.name,n=e.code,r=e.encode;return new He(t,n,r)},He=function(){function e(t,n,r){(0,w.Z)(this,e),this.name=t,this.code=n,this.encode=r}return(0,x.Z)(e,[{key:"digest",value:function(e){var t=this;if(e instanceof Uint8Array){var n=this.encode(e);return n instanceof Uint8Array?Ze(this.code,n):n.then((function(e){return Ze(t.code,e)}))}throw Error("Unknown type, must be binary type")}}]),e}(),qe=function(e){return function(){var t=(0,b.Z)((0,g.Z)().mark((function t(n){return(0,g.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=Uint8Array,t.next=3,crypto.subtle.digest(e,n);case 3:return t.t1=t.sent,t.abrupt("return",new t.t0(t.t1));case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()},We=ze({name:"sha2-256",code:18,encode:qe("SHA-256")}),Ve=ze({name:"sha2-512",code:19,encode:qe("SHA-512")}),Ge=L,Ke={code:0,name:"identity",encode:Ge,digest:function(e){return Ze(0,Ge(e))}},Qe="raw",Ye=85,Je=function(e){return L(e)},Xe=function(e){return L(e)},$e=new TextEncoder,et=new TextDecoder,tt="json",nt=512,rt=function(e){return $e.encode(JSON.stringify(e))},it=function(e){return JSON.parse(et.decode(e))},ot=(Symbol.toStringTag,Symbol.for("nodejs.util.inspect.custom"),function(e,t){switch(e[0]){case"Q":var n=t||le;return[le.prefix,n.decode("".concat(le.prefix).concat(e))];case le.prefix:var r=t||le;return[le.prefix,r.decode(e)];case $.prefix:var i=t||$;return[$.prefix,i.decode(e)];default:if(null==t)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[e[0],t.decode(e)]}}),at=function(e,t,n){var r=n.prefix;if(r!==le.prefix)throw Error("Cannot string encode V0 in ".concat(n.name," encoding"));var i=t.get(r);if(null==i){var o=n.encode(e).slice(1);return t.set(r,o),o}return i},st=function(e,t,n){var r=n.prefix,i=t.get(r);if(null==i){var o=n.encode(e);return t.set(r,o),o}return i},ut=112,ct=18,lt=function(e,t,n){var r=Fe(e),i=r+Fe(t),o=new Uint8Array(i+n.byteLength);return Le(e,o,0),Le(t,o,r),o.set(n,i),o},ft=Symbol.for("@ipld/js-cid/CID"),ht={writable:!1,configurable:!1,enumerable:!0},dt={writable:!1,enumerable:!1,configurable:!1},pt=function(e,t){if(!e.test("0.0.0-dev"))throw new Error(t);console.warn(t)},vt="CID.isCID(v) is deprecated and will be removed in the next major release.\nFollowing code pattern:\n\nif (CID.isCID(value)) {\n doSomethingWithCID(value)\n}\n\nIs replaced with:\n\nconst cid = CID.asCID(value)\nif (cid) {\n // Make sure to use cid instead of value\n doSomethingWithCID(cid)\n}\n",mt=(0,R.Z)((0,R.Z)((0,R.Z)((0,R.Z)((0,R.Z)((0,R.Z)((0,R.Z)((0,R.Z)((0,R.Z)((0,R.Z)({},r),i),o),a),s),u),c),l),f),h);(0,R.Z)((0,R.Z)({},d),p);function yt(e,t,n,r){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:n},decoder:{decode:r}}}var gt=yt("utf8","u",(function(e){return"u"+new TextDecoder("utf8").decode(e)}),(function(e){return(new TextEncoder).encode(e.substring(1))})),bt=yt("ascii","a",(function(e){for(var t="a",n=0;n1&&void 0!==arguments[1]?arguments[1]:"utf8",n=wt[t];if(!n)throw new Error('Unsupported encoding "'.concat(t,'"'));return"utf8"!==t&&"utf-8"!==t||null==globalThis.Buffer||null==globalThis.Buffer.from?n.decoder.decode("".concat(n.prefix).concat(e)):j(globalThis.Buffer.from(e,"utf-8"))}function kt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"utf8",n=wt[t];if(!n)throw new Error('Unsupported encoding "'.concat(t,'"'));return"utf8"!==t&&"utf-8"!==t||null==globalThis.Buffer||null==globalThis.Buffer.from?n.encoder.encode(e).substring(1):globalThis.Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("utf8")}var Et=n(63182),_t=(n(4445),n(43136),n(5199),n(2023),{waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe"}});n(1426);function At(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=[];return Object.keys(e).forEach((function(r){if(!t.length||t.includes(r)){var i=e[r];n.push.apply(n,(0,k.Z)(i.accounts))}})),n}Object.defineProperty,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.defineProperty,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.defineProperty,Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;var St={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}};function Ot(e,t){var n=St[e],r=n.message,i=n.code;return{message:t?"".concat(r," ").concat(t):r,code:i}}function Mt(e,t){return!!Array.isArray(e)&&(!(typeof t<"u"&&e.length)||e.every(t))}var Ct=n(97326),Pt=n(60136),Tt=n(29388),jt=n(53719),It=n(6961),Nt=n(21581),Rt=n(90948),Bt=function(e){(0,Pt.Z)(n,e);var t=(0,Tt.Z)(n);function n(e){var r;return(0,w.Z)(this,n),(r=t.call(this)).opts=e,r.protocol="wc",r.version=2,r}return(0,x.Z)(n)}(Rt.q),Dt=function(e){(0,Pt.Z)(n,e);var t=(0,Tt.Z)(n);function n(e,r){var i;return(0,w.Z)(this,n),(i=t.call(this)).core=e,i.logger=r,i.records=new Map,i}return(0,x.Z)(n)}(Rt.q),Lt=(0,x.Z)((function e(t,n){(0,w.Z)(this,e),this.logger=t,this.core=n})),Ft=function(e){(0,Pt.Z)(n,e);var t=(0,Tt.Z)(n);function n(e,r){var i;return(0,w.Z)(this,n),(i=t.call(this)).relayer=e,i.logger=r,i}return(0,x.Z)(n)}(Rt.q),Zt=function(e){(0,Pt.Z)(n,e);var t=(0,Tt.Z)(n);function n(e){return(0,w.Z)(this,n),t.call(this)}return(0,x.Z)(n)}(Rt.q),Ut=(0,x.Z)((function e(t,n,r,i){(0,w.Z)(this,e),this.core=t,this.logger=n,this.name=r})),zt=function(e){(0,Pt.Z)(n,e);var t=(0,Tt.Z)(n);function n(e,r){var i;return(0,w.Z)(this,n),(i=t.call(this)).relayer=e,i.logger=r,i}return(0,x.Z)(n)}(Rt.q),Ht=function(e){(0,Pt.Z)(n,e);var t=(0,Tt.Z)(n);function n(e,r){var i;return(0,w.Z)(this,n),(i=t.call(this)).core=e,i.logger=r,i}return(0,x.Z)(n)}(Rt.q),qt=(0,x.Z)((function e(t,n){(0,w.Z)(this,e),this.projectId=t,this.logger=n})),Wt=(0,x.Z)((function e(t){(0,w.Z)(this,e),this.opts=t,this.protocol="wc",this.version=2})),Vt=(0,x.Z)((function e(t){(0,w.Z)(this,e),this.client=t}));function Gt(e){if("string"!==typeof e)throw new Error("Cannot safe json parse value of type ".concat(typeof e));try{return function(e){var t=e.replace(/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,'$1"$2n"$3');return JSON.parse(t,(function(e,t){return"string"===typeof t&&t.match(/^\d+n$/)?BigInt(t.substring(0,t.length-1)):t}))}(e)}catch(t){return e}}function Kt(e){return"string"===typeof e?e:(t=e,JSON.stringify(t,(function(e,t){return"bigint"===typeof t?t.toString()+"n":t}))||"");var t}var Qt=n(2421),Yt="EdDSA",Jt="JWT",Xt=".",$t="base64url",en="utf8",tn="utf8",nn=":",rn="did",on="key",an="base58btc",sn="z",un="K36",cn=function(e){return JSON.stringify(e,(function(e,t){return"bigint"===typeof t?t.toString()+"n":t}))};function ln(e){return kt(xt("string"===typeof(t=e)?t:cn(t)||"",en),$t);var t}function fn(e){var t=xt(un,an),n=sn+kt(N([t,e]),an);return[rn,on,n].join(nn)}function hn(e){return[ln(e.header),ln(e.payload),(t=e.signature,kt(t,$t))].join(Xt);var t}function dn(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,C.randomBytes)(32);return Qt._w(e)}function pn(e,t,n,r){return vn.apply(this,arguments)}function vn(){return vn=(0,b.Z)((0,g.Z)().mark((function e(t,n,r,i){var o,a,s,u,c,l,f=arguments;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=f.length>4&&void 0!==f[4]?f[4]:(0,Et.fromMiliseconds)(Date.now()),a={alg:Yt,typ:Jt},s=fn(i.publicKey),c=xt([ln((h={header:a,payload:u={iss:s,sub:t,aud:n,iat:o,exp:o+r}}).header),ln(h.payload)].join(Xt),tn),l=Qt.Xx(i.secretKey,c),e.abrupt("return",hn({header:a,payload:u,signature:l}));case 8:case"end":return e.stop()}var h}),e)}))),vn.apply(this,arguments)}n(6584);var mn=n(1426),yn=function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i"u")throw new Error("Missing sender public key for type 1 envelope");var n=typeof e.senderPublicKey<"u"?xt(e.senderPublicKey,Bn):void 0,r=typeof e.iv<"u"?xt(e.iv,Bn):(0,C.randomBytes)(Hn);return function(e){if(Kn(e.type)===Zn){if(typeof e.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return kt(N([e.type,e.senderPublicKey,e.iv,e.sealed]),Dn)}return kt(N([e.type,e.iv,e.sealed]),Dn)}({type:t,sealed:new O.OK(xt(e.symKey,Bn)).seal(r,xt(e.message,Ln)),iv:r,senderPublicKey:n})}function Yn(e){var t=new O.OK(xt(e.symKey,Bn)),n=Jn(e.encoded),r=n.sealed,i=n.iv,o=t.open(i,r);if(null===o)throw new Error("Failed to decrypt");return kt(o,Ln)}function Jn(e){var t=xt(e,Dn),n=t.slice(Un,zn),r=zn;if(Kn(n)===Zn){var i=r+qn,o=i+Hn,a=t.slice(r,i),s=t.slice(i,o);return{type:n,sealed:t.slice(o),iv:s,senderPublicKey:a}}var u=r+Hn,c=t.slice(r,u);return{type:n,sealed:t.slice(u),iv:c}}function Xn(e,t){var n=Jn(e);return $n({type:Kn(n.type),senderPublicKey:typeof n.senderPublicKey<"u"?kt(n.senderPublicKey,Bn):void 0,receiverPublicKey:null===t||void 0===t?void 0:t.receiverPublicKey})}function $n(e){var t=(null===e||void 0===e?void 0:e.type)||Fn;if(t===Zn){if(typeof(null===e||void 0===e?void 0:e.senderPublicKey)>"u")throw new Error("missing sender public key");if(typeof(null===e||void 0===e?void 0:e.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:t,senderPublicKey:null===e||void 0===e?void 0:e.senderPublicKey,receiverPublicKey:null===e||void 0===e?void 0:e.receiverPublicKey}}function er(e){return e.type===Zn&&"string"==typeof e.senderPublicKey&&"string"==typeof e.receiverPublicKey}var tr=Object.defineProperty,nr=Object.getOwnPropertySymbols,rr=Object.prototype.hasOwnProperty,ir=Object.prototype.propertyIsEnumerable,or=function(e,t,n){return t in e?tr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},ar=function(e,t){for(var n in t||(t={}))rr.call(t,n)&&or(e,n,t[n]);if(nr){var r,i=(0,_.Z)(nr(t));try{for(i.s();!(r=i.n()).done;){n=r.value;ir.call(t,n)&&or(e,n,t[n])}}catch(o){i.e(o)}finally{i.f()}}return e},sr="ReactNative",ur={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},cr="js";function lr(){return typeof In<"u"&&typeof In.versions<"u"&&typeof In.versions.node<"u"}function fr(){return!(0,Pn.getDocument)()&&!!(0,Pn.getNavigator)()&&navigator.product===sr}function hr(){return!lr()&&!!(0,Pn.getNavigator)()}function dr(){return fr()?ur.reactNative:lr()?ur.node:hr()?ur.browser:ur.unknown}function pr(e,t,r){var i=function(){if(dr()===ur.reactNative&&typeof n.g<"u"&&typeof(null==n.g?void 0:n.g.Platform)<"u"){var e=n.g.Platform;return[e.OS,e.Version].join("-")}var t=On();if(null===t)return"unknown";var r=t.os?t.os.replace(" ","").toLowerCase():"unknown";return"browser"===t.type?[r,t.name,t.version].join("-"):[r,t.version].join("-")}(),o=function(){var e,t=dr();return t===ur.browser?[t,(null==(e=(0,Pn.getLocation)())?void 0:e.host)||"unknown"].join(":"):t}();return[[e,t].join("-"),[cr,r].join("-"),i,o].join("/")}function vr(e){var t=e.protocol,n=e.version,r=e.relayUrl,i=e.sdkVersion,o=e.auth,a=e.projectId,s=e.useOnCloseEvent,u=r.split("?"),c={auth:o,ua:pr(t,n,i),projectId:a,useOnCloseEvent:s||void 0},l=function(e,t){var n=jn.parse(e);return n=ar(ar({},n),t),jn.stringify(n)}(u[1]||"",c);return u[0]+"?"+l}function mr(e,t){return e.filter((function(e){return t.includes(e)})).length===e.length}function yr(e){return Object.fromEntries(e.entries())}function gr(e){return new Map(Object.entries(e))}function br(){var e,t,n,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Et.FIVE_MINUTES,i=arguments.length>1?arguments[1]:void 0,o=(0,Et.toMiliseconds)(r||Et.FIVE_MINUTES);return{resolve:function(t){n&&e&&(clearTimeout(n),e(t))},reject:function(e){n&&t&&(clearTimeout(n),t(e))},done:function(){return new Promise((function(r,a){n=setTimeout((function(){a(new Error(i))}),o),e=r,t=a}))}}}function wr(e,t,n){return new Promise(function(){var r=(0,b.Z)((0,g.Z)().mark((function r(i,o){var a,s;return(0,g.Z)().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return a=setTimeout((function(){return o(new Error(n))}),t),r.prev=1,r.next=4,e;case 4:s=r.sent,i(s),r.next=11;break;case 8:r.prev=8,r.t0=r.catch(1),o(r.t0);case 11:clearTimeout(a);case 12:case"end":return r.stop()}}),r,null,[[1,8]])})));return function(e,t){return r.apply(this,arguments)}}())}function xr(e,t){if("string"==typeof t&&t.startsWith("".concat(e,":")))return t;if("topic"===e.toLowerCase()){if("string"!=typeof t)throw new Error('Value must be "string" for expirer target type: topic');return"topic:".concat(t)}if("id"===e.toLowerCase()){if("number"!=typeof t)throw new Error('Value must be "number" for expirer target type: id');return"id:".concat(t)}throw new Error("Unknown expirer target type: ".concat(e))}function kr(e){var t=e.split(":"),n=(0,y.Z)(t,2),r=n[0],i=n[1],o={id:void 0,topic:void 0};if("topic"===r&&"string"==typeof i)o.topic=i;else{if("id"!==r||!Number.isInteger(Number(i)))throw new Error("Invalid target, expected id:number or topic:string, got ".concat(r,":").concat(i));o.id=Number(i)}return o}function Er(e,t){return(0,Et.fromMiliseconds)((t||Date.now())+(0,Et.toMiliseconds)(e))}function _r(e){return Date.now()>=(0,Et.toMiliseconds)(e)}function Ar(e,t){return"".concat(e).concat(t?":".concat(t):"")}function Sr(e){return Or.apply(this,arguments)}function Or(){return Or=(0,b.Z)((0,g.Z)().mark((function e(t){var r,i,o,a,s,u,c;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.id,i=t.topic,o=t.wcDeepLink,e.prev=1,o){e.next=4;break}return e.abrupt("return");case 4:if(a="string"==typeof o?JSON.parse(o):o,"string"==typeof(s=null===a||void 0===a?void 0:a.href)){e.next=8;break}return e.abrupt("return");case 8:if(s.endsWith("/")&&(s=s.slice(0,-1)),u="".concat(s,"/wc?requestId=").concat(r,"&sessionTopic=").concat(i),(c=dr())!==ur.browser){e.next=14;break}u.startsWith("https://")?window.open(u,"_blank","noreferrer noopener"):window.open(u,"_self","noreferrer noopener"),e.next=18;break;case 14:if(e.t0=c===ur.reactNative&&typeof(null==n.g?void 0:n.g.Linking)<"u",!e.t0){e.next=18;break}return e.next=18,n.g.Linking.openURL(u);case 18:e.next=23;break;case 20:e.prev=20,e.t1=e.catch(1),console.error(e.t1);case 23:case"end":return e.stop()}}),e,null,[[1,20]])}))),Or.apply(this,arguments)}function Mr(e){return(null===e||void 0===e?void 0:e.relay)||{protocol:"irn"}}function Cr(e){var t=_t[e];if(typeof t>"u")throw new Error("Relay Protocol not supported: ".concat(e));return t}var Pr=Object.defineProperty,Tr=Object.getOwnPropertySymbols,jr=Object.prototype.hasOwnProperty,Ir=Object.prototype.propertyIsEnumerable,Nr=function(e,t,n){return t in e?Pr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n};function Rr(e){var t={},n="relay"+(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"-");return Object.keys(e).forEach((function(r){if(r.startsWith(n)){var i=r.replace(n,""),o=e[r];t[i]=o}})),t}function Br(e){var t=e.indexOf(":"),n=-1!==e.indexOf("?")?e.indexOf("?"):void 0,r=e.substring(0,t),i=e.substring(t+1,n).split("@"),o=typeof n<"u"?e.substring(n):"",a=jn.parse(o);return{protocol:r,topic:Dr(i[0]),version:parseInt(i[1],10),symKey:a.symKey,relay:Rr(a)}}function Dr(e){return e.startsWith("//")?e.substring(2):e}function Lr(e){return"".concat(e.protocol,":").concat(e.topic,"@").concat(e.version,"?")+jn.stringify(function(e,t){for(var n in t||(t={}))jr.call(t,n)&&Nr(e,n,t[n]);if(Tr){var r,i=(0,_.Z)(Tr(t));try{for(i.s();!(r=i.n()).done;)n=r.value,Ir.call(t,n)&&Nr(e,n,t[n])}catch(o){i.e(o)}finally{i.f()}}return e}({symKey:e.symKey},function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"-",n={};return Object.keys(e).forEach((function(r){var i="relay"+t+r;e[r]&&(n[i]=e[r])})),n}(e.relay)))}Object.defineProperty,Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;function Fr(e){var t=[];return e.forEach((function(e){var n=e.split(":"),r=(0,y.Z)(n,2),i=r[0],o=r[1];t.push("".concat(i,":").concat(o))})),t}function Zr(e,t){var n=ri(e,t);if(n)throw new Error(n.message);for(var r={},i=0,o=Object.entries(e);i"u"}function Kr(e,t){return!(!t||!Gr(e))||"string"==typeof e&&!!e.trim().length}function Qr(e,t){return!(!t||!Gr(e))||"number"==typeof e&&!isNaN(e)}function Yr(e){return!(!Kr(e,!1)||!e.includes(":"))&&2===e.split(":").length}function Jr(e){var t;return null==(t=null===e||void 0===e?void 0:e.proposer)?void 0:t.publicKey}function Xr(e){return null===e||void 0===e?void 0:e.topic}function $r(e){var t=!0;return Wr(e)?e.length&&(t=e.every((function(e){return Kr(e,!1)}))):t=!1,t}function ei(e,t,n){var r=null;return Object.entries(e).forEach((function(e){var i=(0,y.Z)(e,2),o=i[0],a=i[1];if(!r){var s=function(e,t,n){var r=null;return Wr(t)&&t.length?t.forEach((function(e){r||Yr(e)||(r=qr("UNSUPPORTED_CHAINS","".concat(n,", chain ").concat(e,' should be a string and conform to "namespace:chainId" format')))})):Yr(e)||(r=qr("UNSUPPORTED_CHAINS","".concat(n,', 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"] }'))),r}(o,Nn(o,a),"".concat(t," ").concat(n));s&&(r=s)}})),r}function ti(e,t){var n=null;return Wr(e)?e.forEach((function(e){n||function(e){if(Kr(e,!1)&&e.includes(":")){var t=e.split(":");if(3===t.length){var n=t[0]+":"+t[1];return!!t[2]&&Yr(n)}}return!1}(e)||(n=qr("UNSUPPORTED_ACCOUNTS","".concat(t,", account ").concat(e,' should be a string and conform to "namespace:chainId:address" format')))})):n=qr("UNSUPPORTED_ACCOUNTS","".concat(t,', accounts should be an array of strings conforming to "namespace:chainId:address" format')),n}function ni(e,t){var n=null;return Object.values(e).forEach((function(e){if(!n){var r=function(e,t){var n=null;return $r(null===e||void 0===e?void 0:e.methods)?$r(null===e||void 0===e?void 0:e.events)||(n=qr("UNSUPPORTED_EVENTS","".concat(t,", events should be an array of strings or empty array for no events"))):n=qr("UNSUPPORTED_METHODS","".concat(t,", methods should be an array of strings or empty array for no methods")),n}(e,"".concat(t,", namespace"));r&&(n=r)}})),n}function ri(e,t){var n=null;if(e&&Vr(e)){var r=ni(e,t);r&&(n=r);var i=function(e,t){var n=null;return Object.values(e).forEach((function(e){if(!n){var r=ti(null===e||void 0===e?void 0:e.accounts,"".concat(t," namespace"));r&&(n=r)}})),n}(e,t);i&&(n=i)}else n=Hr("MISSING_OR_INVALID","".concat(t,", namespaces should be an object with data"));return n}function ii(e){return Kr(e.protocol,!0)}function oi(e,t){var n=!1;return t&&!e?n=!0:e&&Wr(e)&&e.length&&e.forEach((function(e){n=ii(e)})),n}function ai(e){return"number"==typeof e}function si(e){return typeof e<"u"&&null!==typeof e}function ui(e){return!(!e||"object"!=typeof e||!e.code||!Qr(e.code,!1)||!e.message||!Kr(e.message,!1))}function ci(e){return!(Gr(e)||!Kr(e.method,!1))}function li(e){return!(Gr(e)||Gr(e.result)&&Gr(e.error)||!Qr(e.id,!1)||!Kr(e.jsonrpc,!1))}function fi(e){return!(Gr(e)||!Kr(e.name,!1))}function hi(e,t){return!(!Yr(t)||!function(e){var t=[];return Object.values(e).forEach((function(e){t.push.apply(t,(0,k.Z)(Fr(e.accounts)))})),t}(e).includes(t))}function di(e,t,n){return!!Kr(n,!1)&&function(e,t){var n=[];return Object.values(e).forEach((function(e){Fr(e.accounts).includes(t)&&n.push.apply(n,(0,k.Z)(e.methods))})),n}(e,t).includes(n)}function pi(e,t,n){return!!Kr(n,!1)&&function(e,t){var n=[];return Object.values(e).forEach((function(e){Fr(e.accounts).includes(t)&&n.push.apply(n,(0,k.Z)(e.events))})),n}(e,t).includes(n)}function vi(e,t,n){var r=null,i=function(e){var t={};return Object.keys(e).forEach((function(n){var r;n.includes(":")?t[n]=e[n]:null==(r=e[n].chains)||r.forEach((function(r){t[r]={methods:e[n].methods,events:e[n].events}}))})),t}(e),o=function(e){var t={};return Object.keys(e).forEach((function(n){if(n.includes(":"))t[n]=e[n];else{var r=Fr(e[n].accounts);null===r||void 0===r||r.forEach((function(r){t[r]={accounts:e[n].accounts.filter((function(e){return e.includes("".concat(r,":"))})),methods:e[n].methods,events:e[n].events}}))}})),t}(t),a=Object.keys(i),s=Object.keys(o),u=mi(Object.keys(e)),c=mi(Object.keys(t)),l=u.filter((function(e){return!c.includes(e)}));return l.length&&(r=Hr("NON_CONFORMING_NAMESPACES","".concat(n," namespaces keys don't satisfy requiredNamespaces.\n Required: ").concat(l.toString(),"\n Received: ").concat(Object.keys(t).toString()))),mr(a,s)||(r=Hr("NON_CONFORMING_NAMESPACES","".concat(n," namespaces chains don't satisfy required namespaces.\n Required: ").concat(a.toString(),"\n Approved: ").concat(s.toString()))),Object.keys(t).forEach((function(e){if(e.includes(":")&&!r){var i=Fr(t[e].accounts);i.includes(e)||(r=Hr("NON_CONFORMING_NAMESPACES","".concat(n," namespaces accounts don't satisfy namespace accounts for ").concat(e,"\n Required: ").concat(e,"\n Approved: ").concat(i.toString())))}})),a.forEach((function(e){r||(mr(i[e].methods,o[e].methods)?mr(i[e].events,o[e].events)||(r=Hr("NON_CONFORMING_NAMESPACES","".concat(n," namespaces events don't satisfy namespace events for ").concat(e))):r=Hr("NON_CONFORMING_NAMESPACES","".concat(n," namespaces methods don't satisfy namespace methods for ").concat(e)))})),r}function mi(e){return(0,k.Z)(new Set(e.map((function(e){return e.includes(":")?e.split(":")[0]:e}))))}function yi(e,t){return Qr(e,!1)&&e<=t.max&&e>=t.min}function gi(){var e=dr();return new Promise((function(t){switch(e){case ur.browser:t(function(){var e;return hr()&&(null===(e=navigator)||void 0===e?void 0:e.onLine)}());break;case ur.reactNative:t(function(){return bi.apply(this,arguments)}());break;case ur.node:default:t(!0)}}))}function bi(){return(bi=(0,b.Z)((0,g.Z)().mark((function e(){var t;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(fr()&&typeof n.g<"u"&&null!=n.g&&n.g.NetInfo)){e.next=5;break}return e.next=3,null==n.g?void 0:n.g.NetInfo.fetch();case 3:return t=e.sent,e.abrupt("return",null===t||void 0===t?void 0:t.isConnected);case 5:return e.abrupt("return",!0);case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function wi(e){switch(dr()){case ur.browser:!function(e){hr()&&(window.addEventListener("online",(function(){return e(!0)})),window.addEventListener("offline",(function(){return e(!1)})))}(e);break;case ur.reactNative:!function(e){var t;fr()&&typeof n.g<"u"&&null!=n.g&&n.g.NetInfo&&(null===(t=n.g)||void 0===t||t.NetInfo.addEventListener((function(t){return e(null===t||void 0===t?void 0:t.isConnected)})))}(e);case ur.node:}}var xi={},ki=function(){function e(){(0,w.Z)(this,e)}return(0,x.Z)(e,null,[{key:"get",value:function(e){return xi[e]}},{key:"set",value:function(e,t){xi[e]=t}},{key:"delete",value:function(e){delete xi[e]}}]),e}(),Ei=n(42829),_i=n(28477);function Ai(e){if("string"!==typeof e)throw new Error("Cannot safe json parse value of type ".concat(typeof e));try{return function(e){var t=e.replace(/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,'$1"$2n"$3');return JSON.parse(t,(function(e,t){return"string"===typeof t&&t.match(/^\d+n$/)?BigInt(t.substring(0,t.length-1)):t}))}(e)}catch(t){return e}}function Si(e){return"string"===typeof e?e:(t=e,JSON.stringify(t,(function(e,t){return"bigint"===typeof t?t.toString()+"n":t}))||"");var t}var Oi=function(e){return e.split("?")[0]},Mi="undefined"!==typeof WebSocket?WebSocket:"undefined"!==typeof n.g&&"undefined"!==typeof n.g.WebSocket?n.g.WebSocket:"undefined"!==typeof window&&"undefined"!==typeof window.WebSocket?window.WebSocket:"undefined"!==typeof self&&"undefined"!==typeof self.WebSocket?self.WebSocket:n(68931),Ci=function(){function e(t){if((0,w.Z)(this,e),this.url=t,this.events=new A.EventEmitter,this.registering=!1,!(0,_i.isWsUrl)(t))throw new Error("Provided URL is not compatible with WebSocket connection: ".concat(t));this.url=t}return(0,x.Z)(e,[{key:"connected",get:function(){return"undefined"!==typeof this.socket}},{key:"connecting",get:function(){return this.registering}},{key:"on",value:function(e,t){this.events.on(e,t)}},{key:"once",value:function(e,t){this.events.once(e,t)}},{key:"off",value:function(e,t){this.events.off(e,t)}},{key:"removeListener",value:function(e,t){this.events.removeListener(e,t)}},{key:"open",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(){var t,n=arguments;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=n.length>0&&void 0!==n[0]?n[0]:this.url,e.next=3,this.register(t);case 3:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"close",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(){var t=this;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,n){"undefined"!==typeof t.socket?(t.socket.onclose=function(n){t.onClose(n),e()},t.socket.close()):n(new Error("Connection already closed"))})));case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()},{key:"send",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t,n){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("undefined"!==typeof this.socket){e.next=4;break}return e.next=3,this.register();case 3:this.socket=e.sent;case 4:try{this.socket.send(Si(t))}catch(n){this.onError(t.id,n)}case 5:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}()},{key:"register",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.url;if(!(0,_i.isWsUrl)(t))throw new Error("Provided URL is not compatible with WebSocket connection: ".concat(t));if(this.registering){var r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((function(t,n){e.events.once("register_error",(function(t){e.resetMaxListeners(),n(t)})),e.events.once("open",(function(){if(e.resetMaxListeners(),"undefined"===typeof e.socket)return n(new Error("WebSocket connection is missing or invalid"));t(e.socket)}))}))}return this.url=t,this.registering=!0,new Promise((function(r,i){var o=(0,_i.isReactNative)()?void 0:{rejectUnauthorized:!(0,_i.isLocalhostUrl)(t)},a=new Mi(t,[],o);"undefined"!==typeof WebSocket||"undefined"!==typeof n.g&&"undefined"!==typeof n.g.WebSocket||"undefined"!==typeof window&&"undefined"!==typeof window.WebSocket||"undefined"!==typeof self&&"undefined"!==typeof self.WebSocket?a.onerror=function(t){var n=t;i(e.emitError(n.error))}:a.on("error",(function(t){i(e.emitError(t))})),a.onopen=function(){e.onOpen(a),r(a)}}))}},{key:"onOpen",value:function(e){var t=this;e.onmessage=function(e){return t.onPayload(e)},e.onclose=function(e){return t.onClose(e)},this.socket=e,this.registering=!1,this.events.emit("open")}},{key:"onClose",value:function(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}},{key:"onPayload",value:function(e){if("undefined"!==typeof e.data){var t="string"===typeof e.data?Ai(e.data):e.data;this.events.emit("payload",t)}}},{key:"onError",value:function(e,t){var n=this.parseError(t),r=n.message||n.toString(),i=(0,_i.formatJsonRpcError)(e,r);this.events.emit("payload",i)}},{key:"parseError",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.url;return(0,_i.parseConnectionError)(e,Oi(t),"WS")}},{key:"resetMaxListeners",value:function(){this.events.getMaxListeners()>10&&this.events.setMaxListeners(10)}},{key:"emitError",value:function(e){var t=this.parseError(new Error((null===e||void 0===e?void 0:e.message)||"WebSocket connection failed for host: ".concat(Oi(this.url))));return this.events.emit("register_error",t),t}}]),e}(),Pi=Ci,Ti=n(32467),ji=n.n(Ti);var Ii=function(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),r=0;r>>0,a=new Uint8Array(o);e[t];){var l=n[e.charCodeAt(t)];if(255===l)return;for(var f=0,h=o-1;(0!==l||f>>0,a[h]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");i=f,t++}if(" "!==e[t]){for(var d=o-i;d!==o&&0===a[d];)d++;for(var p=new Uint8Array(r+(o-d)),v=r;d!==o;)p[v++]=a[d++];return p}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var n=0,r=0,i=0,o=t.length;i!==o&&0===t[i];)i++,n++;for(var a=(o-i)*l+1>>>0,c=new Uint8Array(a);i!==o;){for(var f=t[i],h=0,d=a-1;(0!==f||h>>0,c[d]=f%s>>>0,f=f/s>>>0;if(0!==f)throw new Error("Non-zero carry");r=h,i++}for(var p=a-r;p!==a&&0===c[p];)p++;for(var v=u.repeat(n);pn;)o+=t[i&s>>(a-=n)];if(a&&(o+=t[i&s<=8&&(u-=8,s[l++]=255&c>>u)}if(u>=n||255&c<<8-u)throw new SyntaxError("Unexpected end of data");return s}(e,i,r,t)}})},qi=Ui({prefix:"\0",name:"identity",encode:function(e){return function(e){return(new TextDecoder).decode(e)}(e)},decode:function(e){return function(e){return(new TextEncoder).encode(e)}(e)}}),Wi=Object.freeze({__proto__:null,identity:qi}),Vi=Hi({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),Gi=Object.freeze({__proto__:null,base2:Vi}),Ki=Hi({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),Qi=Object.freeze({__proto__:null,base8:Ki}),Yi=zi({prefix:"9",name:"base10",alphabet:"0123456789"}),Ji=Object.freeze({__proto__:null,base10:Yi}),Xi=Hi({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),$i=Hi({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),eo=Object.freeze({__proto__:null,base16:Xi,base16upper:$i}),to=Hi({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),no=Hi({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),ro=Hi({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),io=Hi({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),oo=Hi({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),ao=Hi({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),so=Hi({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),uo=Hi({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),co=Hi({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),lo=Object.freeze({__proto__:null,base32:to,base32upper:no,base32pad:ro,base32padupper:io,base32hex:oo,base32hexupper:ao,base32hexpad:so,base32hexpadupper:uo,base32z:co}),fo=zi({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),ho=zi({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),po=Object.freeze({__proto__:null,base36:fo,base36upper:ho}),vo=zi({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),mo=zi({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),yo=Object.freeze({__proto__:null,base58btc:vo,base58flickr:mo}),go=Hi({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),bo=Hi({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),wo=Hi({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),xo=Hi({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),ko=Object.freeze({__proto__:null,base64:go,base64pad:bo,base64url:wo,base64urlpad:xo}),Eo=Array.from("\ud83d\ude80\ud83e\ude90\u2604\ud83d\udef0\ud83c\udf0c\ud83c\udf11\ud83c\udf12\ud83c\udf13\ud83c\udf14\ud83c\udf15\ud83c\udf16\ud83c\udf17\ud83c\udf18\ud83c\udf0d\ud83c\udf0f\ud83c\udf0e\ud83d\udc09\u2600\ud83d\udcbb\ud83d\udda5\ud83d\udcbe\ud83d\udcbf\ud83d\ude02\u2764\ud83d\ude0d\ud83e\udd23\ud83d\ude0a\ud83d\ude4f\ud83d\udc95\ud83d\ude2d\ud83d\ude18\ud83d\udc4d\ud83d\ude05\ud83d\udc4f\ud83d\ude01\ud83d\udd25\ud83e\udd70\ud83d\udc94\ud83d\udc96\ud83d\udc99\ud83d\ude22\ud83e\udd14\ud83d\ude06\ud83d\ude44\ud83d\udcaa\ud83d\ude09\u263a\ud83d\udc4c\ud83e\udd17\ud83d\udc9c\ud83d\ude14\ud83d\ude0e\ud83d\ude07\ud83c\udf39\ud83e\udd26\ud83c\udf89\ud83d\udc9e\u270c\u2728\ud83e\udd37\ud83d\ude31\ud83d\ude0c\ud83c\udf38\ud83d\ude4c\ud83d\ude0b\ud83d\udc97\ud83d\udc9a\ud83d\ude0f\ud83d\udc9b\ud83d\ude42\ud83d\udc93\ud83e\udd29\ud83d\ude04\ud83d\ude00\ud83d\udda4\ud83d\ude03\ud83d\udcaf\ud83d\ude48\ud83d\udc47\ud83c\udfb6\ud83d\ude12\ud83e\udd2d\u2763\ud83d\ude1c\ud83d\udc8b\ud83d\udc40\ud83d\ude2a\ud83d\ude11\ud83d\udca5\ud83d\ude4b\ud83d\ude1e\ud83d\ude29\ud83d\ude21\ud83e\udd2a\ud83d\udc4a\ud83e\udd73\ud83d\ude25\ud83e\udd24\ud83d\udc49\ud83d\udc83\ud83d\ude33\u270b\ud83d\ude1a\ud83d\ude1d\ud83d\ude34\ud83c\udf1f\ud83d\ude2c\ud83d\ude43\ud83c\udf40\ud83c\udf37\ud83d\ude3b\ud83d\ude13\u2b50\u2705\ud83e\udd7a\ud83c\udf08\ud83d\ude08\ud83e\udd18\ud83d\udca6\u2714\ud83d\ude23\ud83c\udfc3\ud83d\udc90\u2639\ud83c\udf8a\ud83d\udc98\ud83d\ude20\u261d\ud83d\ude15\ud83c\udf3a\ud83c\udf82\ud83c\udf3b\ud83d\ude10\ud83d\udd95\ud83d\udc9d\ud83d\ude4a\ud83d\ude39\ud83d\udde3\ud83d\udcab\ud83d\udc80\ud83d\udc51\ud83c\udfb5\ud83e\udd1e\ud83d\ude1b\ud83d\udd34\ud83d\ude24\ud83c\udf3c\ud83d\ude2b\u26bd\ud83e\udd19\u2615\ud83c\udfc6\ud83e\udd2b\ud83d\udc48\ud83d\ude2e\ud83d\ude46\ud83c\udf7b\ud83c\udf43\ud83d\udc36\ud83d\udc81\ud83d\ude32\ud83c\udf3f\ud83e\udde1\ud83c\udf81\u26a1\ud83c\udf1e\ud83c\udf88\u274c\u270a\ud83d\udc4b\ud83d\ude30\ud83e\udd28\ud83d\ude36\ud83e\udd1d\ud83d\udeb6\ud83d\udcb0\ud83c\udf53\ud83d\udca2\ud83e\udd1f\ud83d\ude41\ud83d\udea8\ud83d\udca8\ud83e\udd2c\u2708\ud83c\udf80\ud83c\udf7a\ud83e\udd13\ud83d\ude19\ud83d\udc9f\ud83c\udf31\ud83d\ude16\ud83d\udc76\ud83e\udd74\u25b6\u27a1\u2753\ud83d\udc8e\ud83d\udcb8\u2b07\ud83d\ude28\ud83c\udf1a\ud83e\udd8b\ud83d\ude37\ud83d\udd7a\u26a0\ud83d\ude45\ud83d\ude1f\ud83d\ude35\ud83d\udc4e\ud83e\udd32\ud83e\udd20\ud83e\udd27\ud83d\udccc\ud83d\udd35\ud83d\udc85\ud83e\uddd0\ud83d\udc3e\ud83c\udf52\ud83d\ude17\ud83e\udd11\ud83c\udf0a\ud83e\udd2f\ud83d\udc37\u260e\ud83d\udca7\ud83d\ude2f\ud83d\udc86\ud83d\udc46\ud83c\udfa4\ud83d\ude47\ud83c\udf51\u2744\ud83c\udf34\ud83d\udca3\ud83d\udc38\ud83d\udc8c\ud83d\udccd\ud83e\udd40\ud83e\udd22\ud83d\udc45\ud83d\udca1\ud83d\udca9\ud83d\udc50\ud83d\udcf8\ud83d\udc7b\ud83e\udd10\ud83e\udd2e\ud83c\udfbc\ud83e\udd75\ud83d\udea9\ud83c\udf4e\ud83c\udf4a\ud83d\udc7c\ud83d\udc8d\ud83d\udce3\ud83e\udd42"),_o=Eo.reduce((function(e,t,n){return e[n]=t,e}),[]),Ao=Eo.reduce((function(e,t,n){return e[t.codePointAt(0)]=n,e}),[]);var So=Ui({prefix:"\ud83d\ude80",name:"base256emoji",encode:function(e){return e.reduce((function(e,t){return e+=_o[t]}),"")},decode:function(e){var t,n=[],r=(0,_.Z)(e);try{for(r.s();!(t=r.n()).done;){var i=t.value,o=Ao[i.codePointAt(0)];if(void 0===o)throw new Error("Non-base256emoji character: ".concat(i));n.push(o)}}catch(a){r.e(a)}finally{r.f()}return new Uint8Array(n)}}),Oo=Object.freeze({__proto__:null,base256emoji:So}),Mo=function e(t,n,r){n=n||[];for(var i=r=r||0;t>=To;)n[r++]=255&t|Co,t/=128;for(;t&Po;)n[r++]=255&t|Co,t>>>=7;return n[r]=0|t,e.bytes=r-i+1,n},Co=128,Po=-128,To=Math.pow(2,31);var jo=function e(t,n){var r,i=0,o=0,a=n=n||0,s=t.length;do{if(a>=s)throw e.bytes=0,new RangeError("Could not decode varint");r=t[a++],i+=o<28?(r&No)<=Io);return e.bytes=a-n,i},Io=128,No=127;var Ro=Math.pow(2,7),Bo=Math.pow(2,14),Do=Math.pow(2,21),Lo=Math.pow(2,28),Fo=Math.pow(2,35),Zo=Math.pow(2,42),Uo=Math.pow(2,49),zo=Math.pow(2,56),Ho=Math.pow(2,63),qo={encode:Mo,decode:jo,encodingLength:function(e){return e2&&void 0!==arguments[2]?arguments[2]:0;return qo.encode(e,t,n),t},Vo=function(e){return qo.encodingLength(e)},Go=function(e,t){var n=t.byteLength,r=Vo(e),i=r+Vo(n),o=new Uint8Array(i+n);return Wo(e,o,0),Wo(n,o,r),o.set(t,i),new Ko(e,n,t,o)},Ko=(0,x.Z)((function e(t,n,r,i){(0,w.Z)(this,e),this.code=t,this.size=n,this.digest=r,this.bytes=i})),Qo=function(e){var t=e.name,n=e.code,r=e.encode;return new Yo(t,n,r)},Yo=function(){function e(t,n,r){(0,w.Z)(this,e),this.name=t,this.code=n,this.encode=r}return(0,x.Z)(e,[{key:"digest",value:function(e){var t=this;if(e instanceof Uint8Array){var n=this.encode(e);return n instanceof Uint8Array?Go(this.code,n):n.then((function(e){return Go(t.code,e)}))}throw Error("Unknown type, must be binary type")}}]),e}(),Jo=function(e){return function(){var t=(0,b.Z)((0,g.Z)().mark((function t(n){return(0,g.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=Uint8Array,t.next=3,crypto.subtle.digest(e,n);case 3:return t.t1=t.sent,t.abrupt("return",new t.t0(t.t1));case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()},Xo=Qo({name:"sha2-256",code:18,encode:Jo("SHA-256")}),$o=Qo({name:"sha2-512",code:19,encode:Jo("SHA-512")}),ea=Object.freeze({__proto__:null,sha256:Xo,sha512:$o}),ta=Ri,na={code:0,name:"identity",encode:ta,digest:function(e){return Go(0,ta(e))}},ra=Object.freeze({__proto__:null,identity:na});new TextEncoder,new TextDecoder;var ia=(0,R.Z)((0,R.Z)((0,R.Z)((0,R.Z)((0,R.Z)((0,R.Z)((0,R.Z)((0,R.Z)((0,R.Z)((0,R.Z)({},Wi),Gi),Qi),Ji),eo),lo),po),yo),ko),Oo);function oa(e){return null!=globalThis.Buffer?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e}function aa(e,t,n,r){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:n},decoder:{decode:r}}}(0,R.Z)((0,R.Z)({},ea),ra);var sa=aa("utf8","u",(function(e){return"u"+new TextDecoder("utf8").decode(e)}),(function(e){return(new TextEncoder).encode(e.substring(1))})),ua=aa("ascii","a",(function(e){for(var t="a",n=0;n0&&void 0!==arguments[0]?arguments[0]:0;return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?oa(globalThis.Buffer.allocUnsafe(e)):new Uint8Array(e)}((e=e.substring(1)).length),n=0;n1&&void 0!==arguments[1]?arguments[1]:"utf8",n=ca[t];if(!n)throw new Error('Unsupported encoding "'.concat(t,'"'));return"utf8"!==t&&"utf-8"!==t||null==globalThis.Buffer||null==globalThis.Buffer.from?n.decoder.decode("".concat(n.prefix).concat(e)):oa(globalThis.Buffer.from(e,"utf-8"))}var fa="core",ha="".concat("wc","@2:").concat(fa,":"),da="error",pa={database:":memory:"},va="client_ed25519_seed",ma=Et.ONE_DAY,ya=Et.SIX_HOURS,ga="wss://relay.walletconnect.com",ba="wss://relay.walletconnect.org",wa="relayer_message",xa="relayer_message_ack",ka="relayer_connect",Ea="relayer_disconnect",_a="relayer_error",Aa="relayer_connection_stalled",Sa="relayer_publish",Oa="payload",Ma="connect",Ca="disconnect",Pa="error",Ta=Et.ONE_SECOND,ja="subscription_created",Ia="subscription_deleted",Na="subscription_sync",Ra="subscription_resubscribed",Ba=1e3*Et.FIVE_SECONDS,Da={wc_pairingDelete:{req:{ttl:Et.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:Et.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:Et.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:Et.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:Et.ONE_DAY,prompt:!1,tag:0},res:{ttl:Et.ONE_DAY,prompt:!1,tag:0}}},La="history_created",Fa="history_updated",Za="history_deleted",Ua="history_sync",za="expirer_created",Ha="expirer_deleted",qa="expirer_expired",Wa="expirer_sync",Va="verify-api",Ga="https://verify.walletconnect.com",Ka="https://verify.walletconnect.org",Qa=function(){function e(t,n){var r=this;(0,w.Z)(this,e),this.core=t,this.logger=n,this.keychain=new Map,this.name="keychain",this.version="0.3",this.initialized=!1,this.storagePrefix=ha,this.init=(0,b.Z)((0,g.Z)().mark((function e(){var t;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r.initialized){e.next=5;break}return e.next=3,r.getKeyChain();case 3:typeof(t=e.sent)<"u"&&(r.keychain=t),r.initialized=!0;case 5:case"end":return e.stop()}}),e)}))),this.has=function(e){return r.isInitialized(),r.keychain.has(e)},this.set=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t,n){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r.isInitialized(),r.keychain.set(t,n),e.next=4,r.persist();case 4:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),this.get=function(e){r.isInitialized();var t=r.keychain.get(e);if(typeof t>"u"){var n=Hr("NO_MATCHING_KEY","".concat(r.name,": ").concat(e)).message;throw new Error(n)}return t},this.del=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r.isInitialized(),r.keychain.delete(t),e.next=4,r.persist();case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),this.core=t,this.logger=(0,Nt.generateChildLogger)(n,this.name)}return(0,x.Z)(e,[{key:"context",get:function(){return(0,Nt.getLoggerContext)(this.logger)}},{key:"storageKey",get:function(){return this.storagePrefix+this.version+"//"+this.name}},{key:"setKeyChain",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.core.storage.setItem(this.storageKey,yr(t));case 2:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"getKeyChain",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(){var t;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.core.storage.getItem(this.storageKey);case 2:return t=e.sent,e.abrupt("return",typeof t<"u"?gr(t):void 0);case 4:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"persist",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.setKeyChain(this.keychain);case 2:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"isInitialized",value:function(){if(!this.initialized){var e=Hr("NOT_INITIALIZED",this.name).message;throw new Error(e)}}}]),e}(),Ya=function(){function e(t,n,r){var i=this;(0,w.Z)(this,e),this.core=t,this.logger=n,this.name="crypto",this.initialized=!1,this.init=(0,b.Z)((0,g.Z)().mark((function e(){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=i.initialized,e.t0){e.next=5;break}return e.next=4,i.keychain.init();case 4:i.initialized=!0;case 5:case"end":return e.stop()}}),e)}))),this.hasKeys=function(e){return i.isInitialized(),i.keychain.has(e)},this.getClientId=(0,b.Z)((0,g.Z)().mark((function e(){var t,n;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i.isInitialized(),e.next=3,i.getClientSeed();case 3:return t=e.sent,n=dn(t),e.abrupt("return",fn(n.publicKey));case 6:case"end":return e.stop()}}),e)}))),this.generateKeyPair=function(){i.isInitialized();var e=function(){var e=T.Au();return{privateKey:kt(e.secretKey,Bn),publicKey:kt(e.publicKey,Bn)}}();return i.setPrivateKey(e.publicKey,e.privateKey)},this.signJWT=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){var n,r,o,a;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i.isInitialized(),e.next=3,i.getClientSeed();case 3:return n=e.sent,r=dn(n),o=Wn(),a=ma,e.next=9,pn(o,t,a,r);case 9:return e.abrupt("return",e.sent);case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),this.generateSharedKey=function(e,t,n){i.isInitialized();var r=function(e,t){var n=T.gi(xt(e,Bn),xt(t,Bn));return kt(new M.t(P.mE,n).expand(qn),Bn)}(i.getPrivateKey(e),t);return i.setSymKey(r,n)},this.setSymKey=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t,n){var r;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i.isInitialized(),r=n||Vn(t),e.next=4,i.keychain.set(r,t);case 4:return e.abrupt("return",r);case 5:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),this.deleteKeyPair=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i.isInitialized(),e.next=3,i.keychain.del(t);case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),this.deleteSymKey=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i.isInitialized(),e.next=3,i.keychain.del(t);case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),this.encode=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t,n,r){var o,a,s,u,c,l,f;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i.isInitialized(),o=$n(r),a=Kt(n),!er(o)){e.next=7;break}return s=o.senderPublicKey,u=o.receiverPublicKey,e.next=6,i.generateSharedKey(s,u);case 6:t=e.sent;case 7:return c=i.getSymKey(t),l=o.type,f=o.senderPublicKey,e.abrupt("return",Qn({type:l,symKey:c,message:a,senderPublicKey:f}));case 9:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}(),this.decode=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t,n,r){var o,a,s,u,c;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i.isInitialized(),!er(o=Xn(n,r))){e.next=7;break}return a=o.receiverPublicKey,s=o.senderPublicKey,e.next=6,i.generateSharedKey(a,s);case 6:t=e.sent;case 7:return e.prev=7,u=i.getSymKey(t),c=Yn({symKey:u,encoded:n}),e.abrupt("return",Gt(c));case 12:return e.prev=12,e.t0=e.catch(7),e.t1=i.logger,e.t2="Failed to decode message from topic: '".concat(t,"', clientId: '"),e.next=18,i.getClientId();case 18:e.t3=e.sent,e.t4=e.t2.concat.call(e.t2,e.t3,"'"),e.t1.error.call(e.t1,e.t4),i.logger.error(e.t0);case 22:case"end":return e.stop()}}),e,null,[[7,12]])})));return function(t,n,r){return e.apply(this,arguments)}}(),this.getPayloadType=function(e){return Kn(Jn(e).type)},this.getPayloadSenderPublicKey=function(e){var t=Jn(e);return t.senderPublicKey?kt(t.senderPublicKey,Bn):void 0},this.core=t,this.logger=(0,Nt.generateChildLogger)(n,this.name),this.keychain=r||new Qa(this.core,this.logger)}return(0,x.Z)(e,[{key:"context",get:function(){return(0,Nt.getLoggerContext)(this.logger)}},{key:"setPrivateKey",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t,n){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.keychain.set(t,n);case 2:return e.abrupt("return",t);case 3:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}()},{key:"getPrivateKey",value:function(e){return this.keychain.get(e)}},{key:"getClientSeed",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(){var t;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t="",e.prev=1,t=this.keychain.get(va),e.next=10;break;case 5:return e.prev=5,e.t0=e.catch(1),t=Wn(),e.next=10,this.keychain.set(va,t);case 10:return e.abrupt("return",la(t,"base16"));case 11:case"end":return e.stop()}}),e,this,[[1,5]])})));return function(){return e.apply(this,arguments)}}()},{key:"getSymKey",value:function(e){return this.keychain.get(e)}},{key:"isInitialized",value:function(){if(!this.initialized){var e=Hr("NOT_INITIALIZED",this.name).message;throw new Error(e)}}}]),e}(),Ja=function(e){(0,Pt.Z)(n,e);var t=(0,Tt.Z)(n);function n(e,r){var i;return(0,w.Z)(this,n),(i=t.call(this,e,r)).logger=e,i.core=r,i.messages=new Map,i.name="messages",i.version="0.3",i.initialized=!1,i.storagePrefix=ha,i.init=(0,b.Z)((0,g.Z)().mark((function e(){var t;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i.initialized){e.next=15;break}return i.logger.trace("Initialized"),e.prev=2,e.next=5,i.getRelayerMessages();case 5:typeof(t=e.sent)<"u"&&(i.messages=t),i.logger.debug("Successfully Restored records for ".concat(i.name)),i.logger.trace({type:"method",method:"restore",size:i.messages.size}),e.next=12;break;case 9:e.prev=9,e.t0=e.catch(2),i.logger.debug("Failed to Restore records for ".concat(i.name)),i.logger.error(e.t0);case 12:return e.prev=12,i.initialized=!0,e.finish(12);case 15:case"end":return e.stop()}}),e,null,[[2,9,12,15]])}))),i.set=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t,n){var r,o;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i.isInitialized(),r=Gn(n),typeof(o=i.messages.get(t))>"u"&&(o={}),e.t0=typeof o[r]<"u",e.t0){e.next=10;break}return o[r]=n,i.messages.set(t,o),e.next=10,i.persist();case 10:return e.abrupt("return",r);case 11:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),i.get=function(e){i.isInitialized();var t=i.messages.get(e);return typeof t>"u"&&(t={}),t},i.has=function(e,t){return i.isInitialized(),typeof i.get(e)[Gn(t)]<"u"},i.del=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i.isInitialized(),i.messages.delete(t),e.next=4,i.persist();case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),i.logger=(0,Nt.generateChildLogger)(e,i.name),i.core=r,i}return(0,x.Z)(n,[{key:"context",get:function(){return(0,Nt.getLoggerContext)(this.logger)}},{key:"storageKey",get:function(){return this.storagePrefix+this.version+"//"+this.name}},{key:"setRelayerMessages",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.core.storage.setItem(this.storageKey,yr(t));case 2:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"getRelayerMessages",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(){var t;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.core.storage.getItem(this.storageKey);case 2:return t=e.sent,e.abrupt("return",typeof t<"u"?gr(t):void 0);case 4:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"persist",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.setRelayerMessages(this.messages);case 2:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"isInitialized",value:function(){if(!this.initialized){var e=Hr("NOT_INITIALIZED",this.name).message;throw new Error(e)}}}]),n}(Lt),Xa=function(e){(0,Pt.Z)(n,e);var t=(0,Tt.Z)(n);function n(e,r){var i;return(0,w.Z)(this,n),(i=t.call(this,e,r)).relayer=e,i.logger=r,i.events=new A.EventEmitter,i.name="publisher",i.queue=new Map,i.publishTimeout=(0,Et.toMiliseconds)(Et.TEN_SECONDS),i.needsTransportRestart=!1,i.publish=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t,n,r){var o,a,s,u,c,l,f,h;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i.logger.debug("Publishing Payload"),i.logger.trace({type:"method",method:"publish",params:{topic:t,message:n,opts:r}}),e.prev=1,a=(null===r||void 0===r?void 0:r.ttl)||ya,s=Mr(r),u=(null===r||void 0===r?void 0:r.prompt)||!1,c=(null===r||void 0===r?void 0:r.tag)||0,l=(null===r||void 0===r?void 0:r.id)||(0,_i.getBigIntRpcId)().toString(),f={topic:t,message:n,opts:{ttl:a,relay:s,prompt:u,tag:c,id:l}},h=setTimeout((function(){return i.queue.set(l,f)}),i.publishTimeout),e.prev=3,e.next=6,wr(i.rpcPublish(t,n,a,s,u,c,l),i.publishTimeout,"Failed to publish payload, please try again.");case 6:return e.next=8,e.sent;case 8:i.removeRequestFromQueue(l),i.relayer.events.emit(Sa,f),e.next=17;break;case 12:if(e.prev=12,e.t0=e.catch(3),i.logger.debug("Publishing Payload stalled"),i.needsTransportRestart=!0,null==(o=null===r||void 0===r?void 0:r.internal)||!o.throwOnFailedPublish){e.next=16;break}throw i.removeRequestFromQueue(l),e.t0;case 16:return e.abrupt("return");case 17:return e.prev=17,clearTimeout(h),e.finish(17);case 20:i.logger.debug("Successfully Published Payload"),i.logger.trace({type:"method",method:"publish",params:{topic:t,message:n,opts:r}}),e.next=26;break;case 23:throw e.prev=23,e.t1=e.catch(1),i.logger.debug("Failed to Publish Payload"),i.logger.error(e.t1),e.t1;case 26:case"end":return e.stop()}}),e,null,[[1,23],[3,12,17,20]])})));return function(t,n,r){return e.apply(this,arguments)}}(),i.on=function(e,t){i.events.on(e,t)},i.once=function(e,t){i.events.once(e,t)},i.off=function(e,t){i.events.off(e,t)},i.removeListener=function(e,t){i.events.removeListener(e,t)},i.relayer=e,i.logger=(0,Nt.generateChildLogger)(r,i.name),i.registerEventListeners(),i}return(0,x.Z)(n,[{key:"context",get:function(){return(0,Nt.getLoggerContext)(this.logger)}},{key:"rpcPublish",value:function(e,t,n,r,i,o,a){var s,u,c,l,f={method:Cr(r.protocol).publish,params:{topic:e,message:t,ttl:n,prompt:i,tag:o},id:a};return Gr(null==(s=f.params)?void 0:s.prompt)&&(null==(u=f.params)||delete u.prompt),Gr(null==(c=f.params)?void 0:c.tag)&&(null==(l=f.params)||delete l.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:f}),this.relayer.request(f)}},{key:"removeRequestFromQueue",value:function(e){this.queue.delete(e)}},{key:"checkQueue",value:function(){var e=this;this.queue.forEach(function(){var t=(0,b.Z)((0,g.Z)().mark((function t(n){var r,i,o;return(0,g.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=n.topic,i=n.message,o=n.opts,t.next=3,e.publish(r,i,o);case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())}},{key:"registerEventListeners",value:function(){var e=this;this.relayer.core.heartbeat.on(It.HEARTBEAT_EVENTS.pulse,(function(){if(e.needsTransportRestart)return e.needsTransportRestart=!1,void e.relayer.events.emit(Aa);e.checkQueue()})),this.relayer.on(xa,(function(t){e.removeRequestFromQueue(t.id.toString())}))}}]),n}(Ft),$a=function(){function e(){var t=this;(0,w.Z)(this,e),this.map=new Map,this.set=function(e,n){var r=t.get(e);t.exists(e,n)||t.map.set(e,[].concat((0,k.Z)(r),[n]))},this.get=function(e){return t.map.get(e)||[]},this.exists=function(e,n){return t.get(e).includes(n)},this.delete=function(e,n){if(typeof n>"u")t.map.delete(e);else if(t.map.has(e)){var r=t.get(e);if(t.exists(e,n)){var i=r.filter((function(e){return e!==n}));i.length?t.map.set(e,i):t.map.delete(e)}}},this.clear=function(){t.map.clear()}}return(0,x.Z)(e,[{key:"topics",get:function(){return Array.from(this.map.keys())}}]),e}(),es=Object.defineProperty,ts=Object.defineProperties,ns=Object.getOwnPropertyDescriptors,rs=Object.getOwnPropertySymbols,is=Object.prototype.hasOwnProperty,os=Object.prototype.propertyIsEnumerable,as=function(e,t,n){return t in e?es(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},ss=function(e,t){for(var n in t||(t={}))is.call(t,n)&&as(e,n,t[n]);if(rs){var r,i=(0,_.Z)(rs(t));try{for(i.s();!(r=i.n()).done;){n=r.value;os.call(t,n)&&as(e,n,t[n])}}catch(o){i.e(o)}finally{i.f()}}return e},us=function(e,t){return ts(e,ns(t))},cs=function(e){(0,Pt.Z)(n,e);var t=(0,Tt.Z)(n);function n(e,r){var i;return(0,w.Z)(this,n),(i=t.call(this,e,r)).relayer=e,i.logger=r,i.subscriptions=new Map,i.topicMap=new $a,i.events=new A.EventEmitter,i.name="subscription",i.version="0.3",i.pending=new Map,i.cached=[],i.initialized=!1,i.pendingSubscriptionWatchLabel="pending_sub_watch_label",i.pollingInterval=20,i.storagePrefix=ha,i.subscribeTimeout=1e4,i.restartInProgress=!1,i.batchSubscribeTopicsLimit=500,i.init=(0,b.Z)((0,g.Z)().mark((function e(){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=i.initialized,e.t0){e.next=7;break}return i.logger.trace("Initialized"),i.registerEventListeners(),e.next=6,i.relayer.core.crypto.getClientId();case 6:i.clientId=e.sent;case 7:case"end":return e.stop()}}),e)}))),i.subscribe=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t,n){var r,o,a;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,i.restartToComplete();case 2:return i.isInitialized(),i.logger.debug("Subscribing Topic"),i.logger.trace({type:"method",method:"subscribe",params:{topic:t,opts:n}}),e.prev=5,r=Mr(n),o={topic:t,relay:r},i.pending.set(t,o),e.next=10,i.rpcSubscribe(t,r);case 10:return a=e.sent,e.abrupt("return",(i.onSubscribe(a,o),i.logger.debug("Successfully Subscribed Topic"),i.logger.trace({type:"method",method:"subscribe",params:{topic:t,opts:n}}),a));case 14:throw e.prev=14,e.t0=e.catch(5),i.logger.debug("Failed to Subscribe Topic"),i.logger.error(e.t0),e.t0;case 17:case"end":return e.stop()}}),e,null,[[5,14]])})));return function(t,n){return e.apply(this,arguments)}}(),i.unsubscribe=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t,n){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,i.restartToComplete();case 2:if(i.isInitialized(),!(typeof(null===n||void 0===n?void 0:n.id)<"u")){e.next=8;break}return e.next=6,i.unsubscribeById(t,n.id,n);case 6:e.next=10;break;case 8:return e.next=10,i.unsubscribeByTopic(t,n);case 10:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),i.isSubscribed=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!i.topics.includes(t)){e.next=4;break}e.t0=!0,e.next=7;break;case 4:return e.next=6,new Promise((function(e,n){var r=new Et.Watch;r.start(i.pendingSubscriptionWatchLabel);var o=setInterval((function(){!i.pending.has(t)&&i.topics.includes(t)&&(clearInterval(o),r.stop(i.pendingSubscriptionWatchLabel),e(!0)),r.elapsed(i.pendingSubscriptionWatchLabel)>=Ba&&(clearInterval(o),r.stop(i.pendingSubscriptionWatchLabel),n(new Error("Subscription resolution timeout")))}),i.pollingInterval)})).catch((function(){return!1}));case 6:e.t0=e.sent;case 7:return e.abrupt("return",e.t0);case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),i.on=function(e,t){i.events.on(e,t)},i.once=function(e,t){i.events.once(e,t)},i.off=function(e,t){i.events.off(e,t)},i.removeListener=function(e,t){i.events.removeListener(e,t)},i.restart=(0,b.Z)((0,g.Z)().mark((function e(){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i.restartInProgress=!0,e.next=3,i.restore();case 3:return e.next=5,i.reset();case 5:i.restartInProgress=!1;case 6:case"end":return e.stop()}}),e)}))),i.relayer=e,i.logger=(0,Nt.generateChildLogger)(r,i.name),i.clientId="",i}return(0,x.Z)(n,[{key:"context",get:function(){return(0,Nt.getLoggerContext)(this.logger)}},{key:"storageKey",get:function(){return this.storagePrefix+this.version+"//"+this.name}},{key:"length",get:function(){return this.subscriptions.size}},{key:"ids",get:function(){return Array.from(this.subscriptions.keys())}},{key:"values",get:function(){return Array.from(this.subscriptions.values())}},{key:"topics",get:function(){return this.topicMap.topics}},{key:"hasSubscription",value:function(e,t){var n=!1;try{n=this.getSubscription(e).topic===t}catch(r){}return n}},{key:"onEnable",value:function(){this.cached=[],this.initialized=!0}},{key:"onDisable",value:function(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}},{key:"unsubscribeByTopic",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t,n){var r,i=this;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this.topicMap.get(t),e.next=3,Promise.all(r.map(function(){var e=(0,b.Z)((0,g.Z)().mark((function e(r){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,i.unsubscribeById(t,r,n);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 3:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}()},{key:"unsubscribeById",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t,n,r){var i,o;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:t,id:n,opts:r}}),e.prev=1,i=Mr(r),e.next=5,this.rpcUnsubscribe(t,n,i);case 5:return o=qr("USER_DISCONNECTED","".concat(this.name,", ").concat(t)),e.next=8,this.onUnsubscribe(t,n,o);case 8:this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:t,id:n,opts:r}}),e.next=15;break;case 12:throw e.prev=12,e.t0=e.catch(1),this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(e.t0),e.t0;case 15:case"end":return e.stop()}}),e,this,[[1,12]])})));return function(t,n,r){return e.apply(this,arguments)}}()},{key:"rpcSubscribe",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t,n){var r;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r={method:Cr(n.protocol).subscribe,params:{topic:t}},this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r}),e.prev=2,e.next=5,wr(this.relayer.request(r),this.subscribeTimeout);case 5:return e.next=7,e.sent;case 7:e.next=12;break;case 9:e.prev=9,e.t0=e.catch(2),this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(Aa);case 12:return e.abrupt("return",Gn(t+this.clientId));case 13:case"end":return e.stop()}}),e,this,[[2,9]])})));return function(t,n){return e.apply(this,arguments)}}()},{key:"rpcBatchSubscribe",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){var n,r;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.length){e.next=2;break}return e.abrupt("return");case 2:return n=t[0].relay,r={method:Cr(n.protocol).batchSubscribe,params:{topics:t.map((function(e){return e.topic}))}},this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r}),e.prev=4,e.next=7,wr(this.relayer.request(r),this.subscribeTimeout);case 7:return e.next=9,e.sent;case 9:return e.abrupt("return",e.sent);case 12:e.prev=12,e.t0=e.catch(4),this.logger.debug("Outgoing Relay Payload stalled"),this.relayer.events.emit(Aa);case 15:case"end":return e.stop()}}),e,this,[[4,12]])})));return function(t){return e.apply(this,arguments)}}()},{key:"rpcUnsubscribe",value:function(e,t,n){var r={method:Cr(n.protocol).unsubscribe,params:{topic:e,id:t}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r}),this.relayer.request(r)}},{key:"onSubscribe",value:function(e,t){this.setSubscription(e,us(ss({},t),{id:e})),this.pending.delete(t.topic)}},{key:"onBatchSubscribe",value:function(e){var t=this;e.length&&e.forEach((function(e){t.setSubscription(e.id,ss({},e)),t.pending.delete(e.topic)}))}},{key:"onUnsubscribe",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t,n,r){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.events.removeAllListeners(n),this.hasSubscription(n,t)&&this.deleteSubscription(n,r),e.next=4,this.relayer.messages.del(t);case 4:case"end":return e.stop()}}),e,this)})));return function(t,n,r){return e.apply(this,arguments)}}()},{key:"setRelayerSubscriptions",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.relayer.core.storage.setItem(this.storageKey,t);case 2:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"getRelayerSubscriptions",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.relayer.core.storage.getItem(this.storageKey);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"setSubscription",value:function(e,t){this.subscriptions.has(e)||(this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:t}),this.addSubscription(e,t))}},{key:"addSubscription",value:function(e,t){this.subscriptions.set(e,ss({},t)),this.topicMap.set(t.topic,e),this.events.emit(ja,t)}},{key:"getSubscription",value:function(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});var t=this.subscriptions.get(e);if(!t){var n=Hr("NO_MATCHING_KEY","".concat(this.name,": ").concat(e)).message;throw new Error(n)}return t}},{key:"deleteSubscription",value:function(e,t){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:t});var n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(Ia,us(ss({},n),{reason:t}))}},{key:"persist",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.setRelayerSubscriptions(this.values);case 2:this.events.emit(Na);case 3:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"reset",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(){var t,n,r;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.cached.length){e.next=10;break}t=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit),n=0;case 3:if(!(n"u")&&t.length){e.next=6;break}return e.abrupt("return");case 6:if(!this.subscriptions.size){e.next=9;break}throw n=Hr("RESTORE_WILL_OVERRIDE",this.name),r=n.message,this.logger.error(r),this.logger.error("".concat(this.name,": ").concat(JSON.stringify(this.values))),new Error(r);case 9:this.cached=t,this.logger.debug("Successfully Restored subscriptions for ".concat(this.name)),this.logger.trace({type:"method",method:"restore",subscriptions:this.values}),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(0),this.logger.debug("Failed to Restore subscriptions for ".concat(this.name)),this.logger.error(e.t0);case 15:case"end":return e.stop()}}),e,this,[[0,12]])})));return function(){return e.apply(this,arguments)}}()},{key:"batchSubscribe",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){var n;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.length){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,this.rpcBatchSubscribe(t);case 4:Wr(n=e.sent)&&this.onBatchSubscribe(n.map((function(e,n){return us(ss({},t[n]),{id:e})})));case 6:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"onConnect",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=this.restartInProgress,e.t0){e.next=5;break}return e.next=4,this.restart();case 4:this.onEnable();case 5:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"onDisconnect",value:function(){this.onDisable()}},{key:"checkPending",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(){var t;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.initialized&&!this.relayer.transportExplicitlyClosed){e.next=2;break}return e.abrupt("return");case 2:return t=[],this.pending.forEach((function(e){t.push(e)})),e.next=6,this.batchSubscribe(t);case 6:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"registerEventListeners",value:function(){var e=this;this.relayer.core.heartbeat.on(It.HEARTBEAT_EVENTS.pulse,(0,b.Z)((0,g.Z)().mark((function t(){return(0,g.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.checkPending();case 2:case"end":return t.stop()}}),t)})))),this.relayer.on(ka,(0,b.Z)((0,g.Z)().mark((function t(){return(0,g.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.onConnect();case 2:case"end":return t.stop()}}),t)})))),this.relayer.on(Ea,(function(){e.onDisconnect()})),this.events.on(ja,function(){var t=(0,b.Z)((0,g.Z)().mark((function t(n){var r;return(0,g.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=ja,e.logger.info("Emitting ".concat(r)),e.logger.debug({type:"event",event:r,data:n}),t.next=5,e.persist();case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),this.events.on(Ia,function(){var t=(0,b.Z)((0,g.Z)().mark((function t(n){var r;return(0,g.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=Ia,e.logger.info("Emitting ".concat(r)),e.logger.debug({type:"event",event:r,data:n}),t.next=5,e.persist();case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())}},{key:"isInitialized",value:function(){if(!this.initialized){var e=Hr("NOT_INITIALIZED",this.name).message;throw new Error(e)}}},{key:"restartToComplete",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(){var t=this;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=this.restartInProgress,!e.t0){e.next=4;break}return e.next=4,new Promise((function(e){var n=setInterval((function(){t.restartInProgress||(clearInterval(n),e())}),t.pollingInterval)}));case 4:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()}]),n}(zt),ls=Object.defineProperty,fs=Object.getOwnPropertySymbols,hs=Object.prototype.hasOwnProperty,ds=Object.prototype.propertyIsEnumerable,ps=function(e,t,n){return t in e?ls(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},vs=function(e,t){for(var n in t||(t={}))hs.call(t,n)&&ps(e,n,t[n]);if(fs){var r,i=(0,_.Z)(fs(t));try{for(i.s();!(r=i.n()).done;){n=r.value;ds.call(t,n)&&ps(e,n,t[n])}}catch(o){i.e(o)}finally{i.f()}}return e},ms=function(e){(0,Pt.Z)(n,e);var t=(0,Tt.Z)(n);function n(e){var r;return(0,w.Z)(this,n),(r=t.call(this,e)).protocol="wc",r.version=2,r.events=new A.EventEmitter,r.name="relayer",r.transportExplicitlyClosed=!1,r.initialized=!1,r.connectionAttemptInProgress=!1,r.connectionStatusPollingInterval=20,r.staleConnectionErrors=["socket hang up","socket stalled"],r.hasExperiencedNetworkDisruption=!1,r.request=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r.logger.debug("Publishing Request Payload"),e.prev=1,e.next=4,r.toEstablishConnection();case 4:return e.next=6,r.provider.request(t);case 6:return e.abrupt("return",e.sent);case 9:throw e.prev=9,e.t0=e.catch(1),r.logger.debug("Failed to Publish Request"),r.logger.error(e.t0),e.t0;case 12:case"end":return e.stop()}}),e,null,[[1,9]])})));return function(t){return e.apply(this,arguments)}}(),r.onPayloadHandler=function(e){r.onProviderPayload(e)},r.onConnectHandler=function(){r.events.emit(ka)},r.onDisconnectHandler=function(){r.onProviderDisconnect()},r.onProviderErrorHandler=function(e){r.logger.error(e),r.events.emit(_a,e)},r.registerProviderListeners=function(){r.provider.on(Oa,r.onPayloadHandler),r.provider.on(Ma,r.onConnectHandler),r.provider.on(Ca,r.onDisconnectHandler),r.provider.on(Pa,r.onProviderErrorHandler)},r.core=e.core,r.logger=typeof e.logger<"u"&&"string"!=typeof e.logger?(0,Nt.generateChildLogger)(e.logger,r.name):(0,Nt.pino)((0,Nt.getDefaultLoggerOptions)({level:e.logger||"error"})),r.messages=new Ja(r.logger,e.core),r.subscriber=new cs((0,Ct.Z)(r),r.logger),r.publisher=new Xa((0,Ct.Z)(r),r.logger),r.relayUrl=(null===e||void 0===e?void 0:e.relayUrl)||ga,r.projectId=e.projectId,r.provider={},r}return(0,x.Z)(n,[{key:"init",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(){var t=this;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.trace("Initialized"),this.registerEventListeners(),e.next=4,this.createProvider();case 4:return e.next=6,Promise.all([this.messages.init(),this.subscriber.init()]);case 6:return e.prev=6,e.next=9,this.transportOpen();case 9:e.next=16;break;case 11:return e.prev=11,e.t0=e.catch(6),this.logger.warn("Connection via ".concat(this.relayUrl," failed, attempting to connect via failover domain ").concat(ba,"...")),e.next=16,this.restartTransport(ba);case 16:this.initialized=!0,setTimeout((0,b.Z)((0,g.Z)().mark((function e(){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=0===t.subscriber.topics.length,!e.t0){e.next=6;break}return t.logger.info("No topics subscribed to after init, closing transport"),e.next=5,t.transportClose();case 5:t.transportExplicitlyClosed=!1;case 6:case"end":return e.stop()}}),e)}))),1e4);case 17:case"end":return e.stop()}}),e,this,[[6,11]])})));return function(){return e.apply(this,arguments)}}()},{key:"context",get:function(){return(0,Nt.getLoggerContext)(this.logger)}},{key:"connected",get:function(){return this.provider.connection.connected}},{key:"connecting",get:function(){return this.provider.connection.connecting}},{key:"publish",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t,n,r){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.isInitialized(),e.next=3,this.publisher.publish(t,n,r);case 3:return e.next=5,this.recordMessageEvent({topic:t,message:n,publishedAt:Date.now()});case 5:case"end":return e.stop()}}),e,this)})));return function(t,n,r){return e.apply(this,arguments)}}()},{key:"subscribe",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t,n){var r,i,o=this;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isInitialized(),i=(null==(r=this.subscriber.topicMap.get(t))?void 0:r[0])||"",e.t0=i,e.t0){e.next=7;break}return e.next=6,Promise.all([new Promise((function(e){o.subscriber.once(ja,(function(n){n.topic===t&&e()}))})),new Promise(function(){var e=(0,b.Z)((0,g.Z)().mark((function e(r){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,o.subscriber.subscribe(t,n);case 2:i=e.sent,r();case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())]);case 6:e.t0=i;case 7:return e.abrupt("return",e.t0);case 8:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}()},{key:"unsubscribe",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t,n){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.isInitialized(),e.next=3,this.subscriber.unsubscribe(t,n);case 3:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}()},{key:"on",value:function(e,t){this.events.on(e,t)}},{key:"once",value:function(e,t){this.events.once(e,t)}},{key:"off",value:function(e,t){this.events.off(e,t)}},{key:"removeListener",value:function(e,t){this.events.removeListener(e,t)}},{key:"transportClose",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(){var t=this;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.transportExplicitlyClosed=!0,!this.hasExperiencedNetworkDisruption||!this.connected){e.next=6;break}return e.next=4,wr(this.provider.disconnect(),1e3,"provider.disconnect()").catch((function(){return t.onProviderDisconnect()}));case 4:e.next=10;break;case 6:if(e.t0=this.connected,!e.t0){e.next=10;break}return e.next=10,this.provider.disconnect();case 10:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"transportOpen",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){var n,r=this;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.transportExplicitlyClosed=!1,e.next=3,this.confirmOnlineStateOrThrow();case 3:if(this.connectionAttemptInProgress){e.next=27;break}if(e.t0=t&&t!==this.relayUrl,!e.t0){e.next=11;break}return this.relayUrl=t,e.next=9,this.transportClose();case 9:return e.next=11,this.createProvider();case 11:return this.connectionAttemptInProgress=!0,e.prev=12,e.next=15,Promise.all([new Promise((function(e){if(!r.initialized)return e();r.subscriber.once(Ra,(function(){e()}))})),new Promise(function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t,n){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,wr(r.provider.connect(),1e4,"Socket stalled when trying to connect to ".concat(r.relayUrl));case 3:e.next=9;break;case 5:return e.prev=5,e.t0=e.catch(0),n(e.t0),e.abrupt("return");case 9:t();case 10:case"end":return e.stop()}}),e,null,[[0,5]])})));return function(t,n){return e.apply(this,arguments)}}())]);case 15:e.next=24;break;case 17:if(e.prev=17,e.t1=e.catch(12),this.logger.error(e.t1),n=e.t1,this.isConnectionStalled(n.message)){e.next=23;break}throw e.t1;case 23:this.provider.events.emit(Ca);case 24:return e.prev=24,this.connectionAttemptInProgress=!1,this.hasExperiencedNetworkDisruption=!1,e.finish(24);case 27:case"end":return e.stop()}}),e,this,[[12,17,24,27]])})));return function(t){return e.apply(this,arguments)}}()},{key:"restartTransport",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.confirmOnlineStateOrThrow();case 2:if(e.t0=!this.connectionAttemptInProgress,!e.t0){e.next=11;break}return this.relayUrl=t||this.relayUrl,e.next=7,this.transportClose();case 7:return e.next=9,this.createProvider();case 9:return e.next=11,this.transportOpen();case 11:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"confirmOnlineStateOrThrow",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,gi();case 2:if(e.sent){e.next=4;break}throw new Error("No internet connection detected. Please restart your network and try again.");case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()},{key:"isConnectionStalled",value:function(e){return this.staleConnectionErrors.some((function(t){return e.includes(t)}))}},{key:"createProvider",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(){var t;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.provider.connection&&this.unregisterProviderListeners(),e.next=3,this.core.crypto.signJWT(this.relayUrl);case 3:t=e.sent,this.provider=new Ei.JsonRpcProvider(new Pi(vr({sdkVersion:"2.10.0",protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:t,useOnCloseEvent:!0}))),this.registerProviderListeners();case 5:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"recordMessageEvent",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){var n,r;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.topic,r=t.message,e.next=3,this.messages.set(n,r);case 3:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"shouldIgnoreMessageEvent",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){var n,r,i;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.topic,(r=t.message)&&0!==r.length){e.next=3;break}return e.abrupt("return",(this.logger.debug("Ignoring invalid/empty message: ".concat(r)),!0));case 3:return e.next=5,this.subscriber.isSubscribed(n);case 5:if(e.sent){e.next=7;break}return e.abrupt("return",(this.logger.debug("Ignoring message for non-subscribed topic ".concat(n)),!0));case 7:return i=this.messages.has(n,r),e.abrupt("return",(i&&this.logger.debug("Ignoring duplicate message: ".concat(r)),i));case 9:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"onProviderPayload",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){var n,r,i,o,a,s;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:t}),!(0,_i.isJsonRpcRequest)(t)){e.next=13;break}if(t.method.endsWith("_subscription")){e.next=3;break}return e.abrupt("return");case 3:return n=t.params,r=n.data,i=r.topic,o=r.message,a=r.publishedAt,s={topic:i,message:o,publishedAt:a},this.logger.debug("Emitting Relayer Payload"),this.logger.trace(vs({type:"event",event:n.id},s)),this.events.emit(n.id,s),e.next=9,this.acknowledgePayload(t);case 9:return e.next=11,this.onMessageEvent(s);case 11:e.next=14;break;case 13:(0,_i.isJsonRpcResponse)(t)&&this.events.emit(xa,t);case 14:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"onMessageEvent",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.shouldIgnoreMessageEvent(t);case 2:if(e.t0=e.sent,e.t0){e.next=7;break}return this.events.emit(wa,t),e.next=7,this.recordMessageEvent(t);case 7:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"acknowledgePayload",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){var n;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=(0,_i.formatJsonRpcResult)(t.id,!0),e.next=3,this.provider.connection.send(n);case 3:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"unregisterProviderListeners",value:function(){this.provider.off(Oa,this.onPayloadHandler),this.provider.off(Ma,this.onConnectHandler),this.provider.off(Ca,this.onDisconnectHandler),this.provider.off(Pa,this.onProviderErrorHandler)}},{key:"registerEventListeners",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(){var t,n=this;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.events.on(Aa,(function(){n.restartTransport().catch((function(e){return n.logger.error(e)}))})),e.next=3,gi();case 3:t=e.sent,wi(function(){var e=(0,b.Z)((0,g.Z)().mark((function e(r){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=n.initialized&&t!==r,!e.t0){e.next=11;break}if(t=r,!r){e.next=8;break}return e.next=6,n.restartTransport().catch((function(e){return n.logger.error(e)}));case 6:e.next=11;break;case 8:return n.hasExperiencedNetworkDisruption=!0,e.next=11,n.transportClose().catch((function(e){return n.logger.error(e)}));case 11:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());case 5:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"onProviderDisconnect",value:function(){this.events.emit(Ea),this.attemptToReconnect()}},{key:"attemptToReconnect",value:function(){var e=this;this.transportExplicitlyClosed||(this.logger.info("attemptToReconnect called. Connecting..."),setTimeout((0,b.Z)((0,g.Z)().mark((function t(){return(0,g.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.restartTransport().catch((function(t){return e.logger.error(t)}));case 2:case"end":return t.stop()}}),t)}))),(0,Et.toMiliseconds)(Ta)))}},{key:"isInitialized",value:function(){if(!this.initialized){var e=Hr("NOT_INITIALIZED",this.name).message;throw new Error(e)}}},{key:"toEstablishConnection",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(){var t=this;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.confirmOnlineStateOrThrow();case 2:if(this.connected){e.next=9;break}if(!this.connectionAttemptInProgress){e.next=7;break}return e.next=6,new Promise((function(e){var n=setInterval((function(){t.connected&&(clearInterval(n),e())}),t.connectionStatusPollingInterval)}));case 6:return e.abrupt("return",e.sent);case 7:return e.next=9,this.restartTransport();case 9:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()}]),n}(Zt),ys=Object.defineProperty,gs=Object.getOwnPropertySymbols,bs=Object.prototype.hasOwnProperty,ws=Object.prototype.propertyIsEnumerable,xs=function(e,t,n){return t in e?ys(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},ks=function(e,t){for(var n in t||(t={}))bs.call(t,n)&&xs(e,n,t[n]);if(gs){var r,i=(0,_.Z)(gs(t));try{for(i.s();!(r=i.n()).done;){n=r.value;ws.call(t,n)&&xs(e,n,t[n])}}catch(o){i.e(o)}finally{i.f()}}return e},Es=function(e){(0,Pt.Z)(n,e);var t=(0,Tt.Z)(n);function n(e,r,i){var o,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:ha,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0;return(0,w.Z)(this,n),(o=t.call(this,e,r,i,a)).core=e,o.logger=r,o.name=i,o.map=new Map,o.version="0.3",o.cached=[],o.initialized=!1,o.storagePrefix=ha,o.init=(0,b.Z)((0,g.Z)().mark((function e(){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=o.initialized,e.t0){e.next=8;break}return o.logger.trace("Initialized"),e.next=5,o.restore();case 5:o.cached.forEach((function(e){o.getKey&&null!==e&&!Gr(e)?o.map.set(o.getKey(e),e):Jr(e)?o.map.set(e.id,e):Xr(e)&&o.map.set(e.topic,e)})),o.cached=[],o.initialized=!0;case 8:case"end":return e.stop()}}),e)}))),o.set=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t,n){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o.isInitialized(),!o.map.has(t)){e.next=6;break}return e.next=4,o.update(t,n);case 4:e.next=11;break;case 6:return o.logger.debug("Setting value"),o.logger.trace({type:"method",method:"set",key:t,value:n}),o.map.set(t,n),e.next=11,o.persist();case 11:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),o.get=function(e){return o.isInitialized(),o.logger.debug("Getting value"),o.logger.trace({type:"method",method:"get",key:e}),o.getData(e)},o.getAll=function(e){return o.isInitialized(),e?o.values.filter((function(t){return Object.keys(e).every((function(n){return ji()(t[n],e[n])}))})):o.values},o.update=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t,n){var r;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o.isInitialized(),o.logger.debug("Updating value"),o.logger.trace({type:"method",method:"update",key:t,update:n}),r=ks(ks({},o.getData(t)),n),o.map.set(t,r),e.next=5,o.persist();case 5:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),o.delete=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t,n){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o.isInitialized(),e.t0=o.map.has(t),!e.t0){e.next=8;break}return o.logger.debug("Deleting value"),o.logger.trace({type:"method",method:"delete",key:t,reason:n}),o.map.delete(t),e.next=8,o.persist();case 8:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),o.logger=(0,Nt.generateChildLogger)(r,o.name),o.storagePrefix=a,o.getKey=s,o}return(0,x.Z)(n,[{key:"context",get:function(){return(0,Nt.getLoggerContext)(this.logger)}},{key:"storageKey",get:function(){return this.storagePrefix+this.version+"//"+this.name}},{key:"length",get:function(){return this.map.size}},{key:"keys",get:function(){return Array.from(this.map.keys())}},{key:"values",get:function(){return Array.from(this.map.values())}},{key:"setDataStore",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.core.storage.setItem(this.storageKey,t);case 2:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"getDataStore",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.core.storage.getItem(this.storageKey);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"getData",value:function(e){var t=this.map.get(e);if(!t){var n=Hr("NO_MATCHING_KEY","".concat(this.name,": ").concat(e)).message;throw this.logger.error(n),new Error(n)}return t}},{key:"persist",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.setDataStore(this.values);case 2:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"restore",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(){var t,n,r;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.getDataStore();case 3:if(!(typeof(t=e.sent)>"u")&&t.length){e.next=6;break}return e.abrupt("return");case 6:if(!this.map.size){e.next=9;break}throw n=Hr("RESTORE_WILL_OVERRIDE",this.name),r=n.message,this.logger.error(r),new Error(r);case 9:this.cached=t,this.logger.debug("Successfully Restored value for ".concat(this.name)),this.logger.trace({type:"method",method:"restore",value:this.values}),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(0),this.logger.debug("Failed to Restore value for ".concat(this.name)),this.logger.error(e.t0);case 15:case"end":return e.stop()}}),e,this,[[0,12]])})));return function(){return e.apply(this,arguments)}}()},{key:"isInitialized",value:function(){if(!this.initialized){var e=Hr("NOT_INITIALIZED",this.name).message;throw new Error(e)}}}]),n}(Ut),_s=function(){function e(t,n){var r=this;(0,w.Z)(this,e),this.core=t,this.logger=n,this.name="pairing",this.version="0.3",this.events=new(S()),this.initialized=!1,this.storagePrefix=ha,this.ignoredPayloadTypes=[Zn],this.registeredMethods=[],this.init=(0,b.Z)((0,g.Z)().mark((function e(){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=r.initialized,e.t0){e.next=10;break}return e.next=4,r.pairings.init();case 4:return e.next=6,r.cleanup();case 6:r.registerRelayerEvents(),r.registerExpirerEvents(),r.initialized=!0,r.logger.trace("Initialized");case 10:case"end":return e.stop()}}),e)}))),this.register=function(e){var t=e.methods;r.isInitialized(),r.registeredMethods=(0,k.Z)(new Set([].concat((0,k.Z)(r.registeredMethods),(0,k.Z)(t))))},this.create=(0,b.Z)((0,g.Z)().mark((function e(){var t,n,i,o,a,s;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r.isInitialized(),t=Wn(),e.next=4,r.core.crypto.setSymKey(t);case 4:return n=e.sent,i=Er(Et.FIVE_MINUTES),a={topic:n,expiry:i,relay:o={protocol:"irn"},active:!1},s=Lr({protocol:r.core.protocol,version:r.core.version,topic:n,symKey:t,relay:o}),e.next=11,r.pairings.set(n,a);case 11:return e.next=13,r.core.relayer.subscribe(n);case 13:return r.core.expirer.set(n,i),e.abrupt("return",{topic:n,uri:s});case 15:case"end":return e.stop()}}),e)}))),this.pair=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){var n,i,o,a,s,u;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r.isInitialized(),r.isValidPair(t),n=Br(t.uri),i=n.topic,o=n.symKey,a=n.relay,!r.pairings.keys.includes(i)){e.next=4;break}throw new Error("Pairing already exists: ".concat(i));case 4:if(!r.core.crypto.hasKeys(i)){e.next=6;break}throw new Error("Keychain already exists: ".concat(i));case 6:return s=Er(Et.FIVE_MINUTES),u={topic:i,relay:a,expiry:s,active:!1},e.next=9,r.pairings.set(i,u);case 9:return e.next=11,r.core.crypto.setSymKey(o,i);case 11:return e.next=13,r.core.relayer.subscribe(i,{relay:a});case 13:if(r.core.expirer.set(i,s),e.t0=t.activatePairing,!e.t0){e.next=18;break}return e.next=18,r.activate({topic:i});case 18:return e.abrupt("return",u);case 19:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),this.activate=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){var n,i;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.topic,r.isInitialized(),i=Er(Et.THIRTY_DAYS),e.next=5,r.pairings.update(n,{active:!0,expiry:i});case 5:r.core.expirer.set(n,i);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),this.ping=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){var n,i,o,a,s,u;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r.isInitialized(),e.next=3,r.isValidPing(t);case 3:if(n=t.topic,!r.pairings.keys.includes(n)){e.next=15;break}return e.next=7,r.sendRequest(n,"wc_pairingPing",{});case 7:return i=e.sent,o=br(),a=o.done,s=o.resolve,u=o.reject,r.events.once(Ar("pairing_ping",i),(function(e){var t=e.error;t?u(t):s()})),e.next=15,a();case 15:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),this.updateExpiry=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){var n,i;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.topic,i=t.expiry,r.isInitialized(),e.next=4,r.pairings.update(n,{expiry:i});case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),this.updateMetadata=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){var n,i;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.topic,i=t.metadata,r.isInitialized(),e.next=4,r.pairings.update(n,{peerMetadata:i});case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),this.getPairings=function(){return r.isInitialized(),r.pairings.values},this.disconnect=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){var n;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r.isInitialized(),e.next=3,r.isValidDisconnect(t);case 3:if(n=t.topic,e.t0=r.pairings.keys.includes(n),!e.t0){e.next=10;break}return e.next=8,r.sendRequest(n,"wc_pairingDelete",qr("USER_DISCONNECTED"));case 8:return e.next=10,r.deletePairing(n);case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),this.sendRequest=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t,n,i){var o,a,s;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=(0,_i.formatJsonRpcRequest)(n,i),e.next=3,r.core.crypto.encode(t,o);case 3:return a=e.sent,s=Da[n].req,e.abrupt("return",(r.core.history.set(t,o),r.core.relayer.publish(t,a,s),o.id));case 6:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}(),this.sendResult=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t,n,i){var o,a,s,u;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=(0,_i.formatJsonRpcResult)(t,i),e.next=3,r.core.crypto.encode(n,o);case 3:return a=e.sent,e.next=6,r.core.history.get(n,t);case 6:return s=e.sent,u=Da[s.request.method].res,e.next=10,r.core.relayer.publish(n,a,u);case 10:return e.next=12,r.core.history.resolve(o);case 12:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}(),this.sendError=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t,n,i){var o,a,s,u;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=(0,_i.formatJsonRpcError)(t,i),e.next=3,r.core.crypto.encode(n,o);case 3:return a=e.sent,e.next=6,r.core.history.get(n,t);case 6:return s=e.sent,u=Da[s.request.method]?Da[s.request.method].res:Da.unregistered_method.res,e.next=10,r.core.relayer.publish(n,a,u);case 10:return e.next=12,r.core.history.resolve(o);case 12:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}(),this.deletePairing=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t,n){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.core.relayer.unsubscribe(t);case 2:return e.next=4,Promise.all([r.pairings.delete(t,qr("USER_DISCONNECTED")),r.core.crypto.deleteSymKey(t),n?Promise.resolve():r.core.expirer.del(t)]);case 4:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),this.cleanup=(0,b.Z)((0,g.Z)().mark((function e(){var t;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.pairings.getAll().filter((function(e){return _r(e.expiry)})),e.next=3,Promise.all(t.map((function(e){return r.deletePairing(e.topic)})));case 3:case"end":return e.stop()}}),e)}))),this.onRelayEventRequest=function(e){var t=e.topic,n=e.payload;switch(n.method){case"wc_pairingPing":return r.onPairingPingRequest(t,n);case"wc_pairingDelete":return r.onPairingDeleteRequest(t,n);default:return r.onUnknownRpcMethodRequest(t,n)}},this.onRelayEventResponse=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){var n,i,o;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.topic,i=t.payload,e.next=4,r.core.history.get(n,i.id);case 4:o=e.sent.request.method,e.t0=o,e.next="wc_pairingPing"===e.t0?8:9;break;case 8:return e.abrupt("return",r.onPairingPingResponse(n,i));case 9:return e.abrupt("return",r.onUnknownRpcMethodResponse(o));case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),this.onPairingPingRequest=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t,n){var i;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=n.id,e.prev=1,r.isValidPing({topic:t}),e.next=5,r.sendResult(i,t,!0);case 5:r.events.emit("pairing_ping",{id:i,topic:t}),e.next=13;break;case 8:return e.prev=8,e.t0=e.catch(1),e.next=12,r.sendError(i,t,e.t0);case 12:r.logger.error(e.t0);case 13:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(t,n){return e.apply(this,arguments)}}(),this.onPairingPingResponse=function(e,t){var n=t.id;setTimeout((function(){(0,_i.isJsonRpcResult)(t)?r.events.emit(Ar("pairing_ping",n),{}):(0,_i.isJsonRpcError)(t)&&r.events.emit(Ar("pairing_ping",n),{error:t.error})}),500)},this.onPairingDeleteRequest=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t,n){var i;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=n.id,e.prev=1,r.isValidDisconnect({topic:t}),e.next=5,r.deletePairing(t);case 5:r.events.emit("pairing_delete",{id:i,topic:t}),e.next=13;break;case 8:return e.prev=8,e.t0=e.catch(1),e.next=12,r.sendError(i,t,e.t0);case 12:r.logger.error(e.t0);case 13:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(t,n){return e.apply(this,arguments)}}(),this.onUnknownRpcMethodRequest=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t,n){var i,o,a;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=n.id,o=n.method,e.prev=1,!r.registeredMethods.includes(o)){e.next=4;break}return e.abrupt("return");case 4:return a=qr("WC_METHOD_UNSUPPORTED",o),e.next=7,r.sendError(i,t,a);case 7:r.logger.error(a),e.next=15;break;case 10:return e.prev=10,e.t0=e.catch(1),e.next=14,r.sendError(i,t,e.t0);case 14:r.logger.error(e.t0);case 15:case"end":return e.stop()}}),e,null,[[1,10]])})));return function(t,n){return e.apply(this,arguments)}}(),this.onUnknownRpcMethodResponse=function(e){r.registeredMethods.includes(e)||r.logger.error(qr("WC_METHOD_UNSUPPORTED",e))},this.isValidPair=function(e){if(!si(e)){var t=Hr("MISSING_OR_INVALID","pair() params: ".concat(e)).message;throw new Error(t)}if(!function(e){if(Kr(e,!1))try{return typeof new URL(e)<"u"}catch(t){return!1}return!1}(e.uri)){var n=Hr("MISSING_OR_INVALID","pair() uri: ".concat(e.uri)).message;throw new Error(n)}},this.isValidPing=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){var n,i,o;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(si(t)){e.next=3;break}throw n=Hr("MISSING_OR_INVALID","ping() params: ".concat(t)),i=n.message,new Error(i);case 3:return o=t.topic,e.next=6,r.isValidPairingTopic(o);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),this.isValidDisconnect=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){var n,i,o;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(si(t)){e.next=3;break}throw n=Hr("MISSING_OR_INVALID","disconnect() params: ".concat(t)),i=n.message,new Error(i);case 3:return o=t.topic,e.next=6,r.isValidPairingTopic(o);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),this.isValidPairingTopic=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){var n,i,o,a,s,u;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Kr(t,!1)){e.next=3;break}throw n=Hr("MISSING_OR_INVALID","pairing topic should be a string: ".concat(t)),i=n.message,new Error(i);case 3:if(r.pairings.keys.includes(t)){e.next=6;break}throw o=Hr("NO_MATCHING_KEY","pairing topic doesn't exist: ".concat(t)),a=o.message,new Error(a);case 6:if(!_r(r.pairings.get(t).expiry)){e.next=11;break}return e.next=9,r.deletePairing(t);case 9:throw s=Hr("EXPIRED","pairing topic: ".concat(t)),u=s.message,new Error(u);case 11:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),this.core=t,this.logger=(0,Nt.generateChildLogger)(n,this.name),this.pairings=new Es(this.core,this.logger,this.name,this.storagePrefix)}return(0,x.Z)(e,[{key:"context",get:function(){return(0,Nt.getLoggerContext)(this.logger)}},{key:"isInitialized",value:function(){if(!this.initialized){var e=Hr("NOT_INITIALIZED",this.name).message;throw new Error(e)}}},{key:"registerRelayerEvents",value:function(){var e=this;this.core.relayer.on(wa,function(){var t=(0,b.Z)((0,g.Z)().mark((function t(n){var r,i,o;return(0,g.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=n.topic,i=n.message,e.pairings.keys.includes(r)&&!e.ignoredPayloadTypes.includes(e.core.crypto.getPayloadType(i))){t.next=3;break}return t.abrupt("return");case 3:return t.next=5,e.core.crypto.decode(r,i);case 5:if(o=t.sent,t.prev=6,!(0,_i.isJsonRpcRequest)(o)){t.next=11;break}e.core.history.set(r,o),e.onRelayEventRequest({topic:r,payload:o}),t.next=18;break;case 11:if(t.t0=(0,_i.isJsonRpcResponse)(o),!t.t0){t.next=18;break}return t.next=15,e.core.history.resolve(o);case 15:return t.next=17,e.onRelayEventResponse({topic:r,payload:o});case 17:e.core.history.delete(r,o.id);case 18:t.next=23;break;case 20:t.prev=20,t.t1=t.catch(6),e.logger.error(t.t1);case 23:case"end":return t.stop()}}),t,null,[[6,20]])})));return function(e){return t.apply(this,arguments)}}())}},{key:"registerExpirerEvents",value:function(){var e=this;this.core.expirer.on(qa,function(){var t=(0,b.Z)((0,g.Z)().mark((function t(n){var r,i;return(0,g.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=kr(n.target),i=r.topic,t.t0=i&&e.pairings.keys.includes(i),!t.t0){t.next=6;break}return t.next=5,e.deletePairing(i,!0);case 5:e.events.emit("pairing_expire",{topic:i});case 6:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())}}]),e}(),As=function(e){(0,Pt.Z)(n,e);var t=(0,Tt.Z)(n);function n(e,r){var i;return(0,w.Z)(this,n),(i=t.call(this,e,r)).core=e,i.logger=r,i.records=new Map,i.events=new A.EventEmitter,i.name="history",i.version="0.3",i.cached=[],i.initialized=!1,i.storagePrefix=ha,i.init=(0,b.Z)((0,g.Z)().mark((function e(){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=i.initialized,e.t0){e.next=9;break}return i.logger.trace("Initialized"),e.next=5,i.restore();case 5:i.cached.forEach((function(e){return i.records.set(e.id,e)})),i.cached=[],i.registerEventListeners(),i.initialized=!0;case 9:case"end":return e.stop()}}),e)}))),i.set=function(e,t,n){if(i.isInitialized(),i.logger.debug("Setting JSON-RPC request history record"),i.logger.trace({type:"method",method:"set",topic:e,request:t,chainId:n}),!i.records.has(t.id)){var r={id:t.id,topic:e,request:{method:t.method,params:t.params||null},chainId:n,expiry:Er(Et.THIRTY_DAYS)};i.records.set(r.id,r),i.events.emit(La,r)}},i.resolve=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){var n;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i.isInitialized(),i.logger.debug("Updating JSON-RPC response history record"),i.logger.trace({type:"method",method:"update",response:t}),i.records.has(t.id)){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,i.getRecord(t.id);case 4:typeof(n=e.sent).response>"u"&&(n.response=(0,_i.isJsonRpcError)(t)?{error:t.error}:{result:t.result},i.records.set(n.id,n),i.events.emit(Fa,n));case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),i.get=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t,n){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i.isInitialized(),i.logger.debug("Getting record"),i.logger.trace({type:"method",method:"get",topic:t,id:n}),e.next=5,i.getRecord(n);case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),i.delete=function(e,t){i.isInitialized(),i.logger.debug("Deleting record"),i.logger.trace({type:"method",method:"delete",id:t}),i.values.forEach((function(n){if(n.topic===e){if(typeof t<"u"&&n.id!==t)return;i.records.delete(n.id),i.events.emit(Za,n)}}))},i.exists=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t,n){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i.isInitialized(),!i.records.has(n)){e.next=9;break}return e.next=4,i.getRecord(n);case 4:e.t1=e.sent.topic,e.t2=t,e.t0=e.t1===e.t2,e.next=10;break;case 9:e.t0=!1;case 10:return e.abrupt("return",e.t0);case 11:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),i.on=function(e,t){i.events.on(e,t)},i.once=function(e,t){i.events.once(e,t)},i.off=function(e,t){i.events.off(e,t)},i.removeListener=function(e,t){i.events.removeListener(e,t)},i.logger=(0,Nt.generateChildLogger)(r,i.name),i}return(0,x.Z)(n,[{key:"context",get:function(){return(0,Nt.getLoggerContext)(this.logger)}},{key:"storageKey",get:function(){return this.storagePrefix+this.version+"//"+this.name}},{key:"size",get:function(){return this.records.size}},{key:"keys",get:function(){return Array.from(this.records.keys())}},{key:"values",get:function(){return Array.from(this.records.values())}},{key:"pending",get:function(){var e=[];return this.values.forEach((function(t){if(!(typeof t.response<"u")){var n={topic:t.topic,request:(0,_i.formatJsonRpcRequest)(t.request.method,t.request.params,t.id),chainId:t.chainId};return e.push(n)}})),e}},{key:"setJsonRpcRecords",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.core.storage.setItem(this.storageKey,t);case 2:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"getJsonRpcRecords",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.core.storage.getItem(this.storageKey);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"getRecord",value:function(e){this.isInitialized();var t=this.records.get(e);if(!t){var n=Hr("NO_MATCHING_KEY","".concat(this.name,": ").concat(e)).message;throw new Error(n)}return t}},{key:"persist",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.setJsonRpcRecords(this.values);case 2:this.events.emit(Ua);case 3:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"restore",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(){var t,n,r;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.getJsonRpcRecords();case 3:if(!(typeof(t=e.sent)>"u")&&t.length){e.next=6;break}return e.abrupt("return");case 6:if(!this.records.size){e.next=9;break}throw n=Hr("RESTORE_WILL_OVERRIDE",this.name),r=n.message,this.logger.error(r),new Error(r);case 9:this.cached=t,this.logger.debug("Successfully Restored records for ".concat(this.name)),this.logger.trace({type:"method",method:"restore",records:this.values}),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(0),this.logger.debug("Failed to Restore records for ".concat(this.name)),this.logger.error(e.t0);case 15:case"end":return e.stop()}}),e,this,[[0,12]])})));return function(){return e.apply(this,arguments)}}()},{key:"registerEventListeners",value:function(){var e=this;this.events.on(La,(function(t){var n=La;e.logger.info("Emitting ".concat(n)),e.logger.debug({type:"event",event:n,record:t}),e.persist()})),this.events.on(Fa,(function(t){var n=Fa;e.logger.info("Emitting ".concat(n)),e.logger.debug({type:"event",event:n,record:t}),e.persist()})),this.events.on(Za,(function(t){var n=Za;e.logger.info("Emitting ".concat(n)),e.logger.debug({type:"event",event:n,record:t}),e.persist()})),this.core.heartbeat.on(It.HEARTBEAT_EVENTS.pulse,(function(){e.cleanup()}))}},{key:"cleanup",value:function(){var e=this;try{this.records.forEach((function(t){(0,Et.toMiliseconds)(t.expiry||0)-Date.now()<=0&&(e.logger.info("Deleting expired history log: ".concat(t.id)),e.delete(t.topic,t.id))}))}catch(t){this.logger.warn(t)}}},{key:"isInitialized",value:function(){if(!this.initialized){var e=Hr("NOT_INITIALIZED",this.name).message;throw new Error(e)}}}]),n}(Dt),Ss=function(e){(0,Pt.Z)(n,e);var t=(0,Tt.Z)(n);function n(e,r){var i;return(0,w.Z)(this,n),(i=t.call(this,e,r)).core=e,i.logger=r,i.expirations=new Map,i.events=new A.EventEmitter,i.name="expirer",i.version="0.3",i.cached=[],i.initialized=!1,i.storagePrefix=ha,i.init=(0,b.Z)((0,g.Z)().mark((function e(){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=i.initialized,e.t0){e.next=9;break}return i.logger.trace("Initialized"),e.next=5,i.restore();case 5:i.cached.forEach((function(e){return i.expirations.set(e.target,e)})),i.cached=[],i.registerEventListeners(),i.initialized=!0;case 9:case"end":return e.stop()}}),e)}))),i.has=function(e){try{var t=i.formatTarget(e);return typeof i.getExpiration(t)<"u"}catch(n){return!1}},i.set=function(e,t){i.isInitialized();var n=i.formatTarget(e),r={target:n,expiry:t};i.expirations.set(n,r),i.checkExpiry(n,r),i.events.emit(za,{target:n,expiration:r})},i.get=function(e){i.isInitialized();var t=i.formatTarget(e);return i.getExpiration(t)},i.del=function(e){if(i.isInitialized(),i.has(e)){var t=i.formatTarget(e),n=i.getExpiration(t);i.expirations.delete(t),i.events.emit(Ha,{target:t,expiration:n})}},i.on=function(e,t){i.events.on(e,t)},i.once=function(e,t){i.events.once(e,t)},i.off=function(e,t){i.events.off(e,t)},i.removeListener=function(e,t){i.events.removeListener(e,t)},i.logger=(0,Nt.generateChildLogger)(r,i.name),i}return(0,x.Z)(n,[{key:"context",get:function(){return(0,Nt.getLoggerContext)(this.logger)}},{key:"storageKey",get:function(){return this.storagePrefix+this.version+"//"+this.name}},{key:"length",get:function(){return this.expirations.size}},{key:"keys",get:function(){return Array.from(this.expirations.keys())}},{key:"values",get:function(){return Array.from(this.expirations.values())}},{key:"formatTarget",value:function(e){if("string"==typeof e)return function(e){return xr("topic",e)}(e);if("number"==typeof e)return function(e){return xr("id",e)}(e);var t=Hr("UNKNOWN_TYPE","Target type: ".concat(typeof e)).message;throw new Error(t)}},{key:"setExpirations",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.core.storage.setItem(this.storageKey,t);case 2:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"getExpirations",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.core.storage.getItem(this.storageKey);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"persist",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.setExpirations(this.values);case 2:this.events.emit(Wa);case 3:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"restore",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(){var t,n,r;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.getExpirations();case 3:if(!(typeof(t=e.sent)>"u")&&t.length){e.next=6;break}return e.abrupt("return");case 6:if(!this.expirations.size){e.next=9;break}throw n=Hr("RESTORE_WILL_OVERRIDE",this.name),r=n.message,this.logger.error(r),new Error(r);case 9:this.cached=t,this.logger.debug("Successfully Restored expirations for ".concat(this.name)),this.logger.trace({type:"method",method:"restore",expirations:this.values}),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(0),this.logger.debug("Failed to Restore expirations for ".concat(this.name)),this.logger.error(e.t0);case 15:case"end":return e.stop()}}),e,this,[[0,12]])})));return function(){return e.apply(this,arguments)}}()},{key:"getExpiration",value:function(e){var t=this.expirations.get(e);if(!t){var n=Hr("NO_MATCHING_KEY","".concat(this.name,": ").concat(e)).message;throw this.logger.error(n),new Error(n)}return t}},{key:"checkExpiry",value:function(e,t){var n=t.expiry;(0,Et.toMiliseconds)(n)-Date.now()<=0&&this.expire(e,t)}},{key:"expire",value:function(e,t){this.expirations.delete(e),this.events.emit(qa,{target:e,expiration:t})}},{key:"checkExpirations",value:function(){var e=this;this.core.relayer.connected&&this.expirations.forEach((function(t,n){return e.checkExpiry(n,t)}))}},{key:"registerEventListeners",value:function(){var e=this;this.core.heartbeat.on(It.HEARTBEAT_EVENTS.pulse,(function(){return e.checkExpirations()})),this.events.on(za,(function(t){var n=za;e.logger.info("Emitting ".concat(n)),e.logger.debug({type:"event",event:n,data:t}),e.persist()})),this.events.on(qa,(function(t){var n=qa;e.logger.info("Emitting ".concat(n)),e.logger.debug({type:"event",event:n,data:t}),e.persist()})),this.events.on(Ha,(function(t){var n=Ha;e.logger.info("Emitting ".concat(n)),e.logger.debug({type:"event",event:n,data:t}),e.persist()}))}},{key:"isInitialized",value:function(){if(!this.initialized){var e=Hr("NOT_INITIALIZED",this.name).message;throw new Error(e)}}}]),n}(Ht),Os=function(e){(0,Pt.Z)(n,e);var t=(0,Tt.Z)(n);function n(e,r){var i;return(0,w.Z)(this,n),(i=t.call(this,e,r)).projectId=e,i.logger=r,i.name=Va,i.initialized=!1,i.queue=[],i.verifyDisabled=!1,i.init=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){var n;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!i.verifyDisabled&&!fr()&&hr()){e.next=2;break}return e.abrupt("return");case 2:return n=(null===t||void 0===t?void 0:t.verifyUrl)||Ga,i.verifyUrl!==n&&i.removeIframe(),i.verifyUrl=n,e.prev=4,e.next=7,i.createIframe();case 7:e.next=12;break;case 9:e.prev=9,e.t0=e.catch(4),i.logger.warn("Verify iframe failed to load: ".concat(i.verifyUrl)),i.logger.warn(e.t0);case 12:if(i.initialized){e.next=22;break}return i.removeIframe(),i.verifyUrl=Ka,e.prev=14,e.next=17,i.createIframe();case 17:e.next=22;break;case 19:e.prev=19,e.t1=e.catch(14),i.logger.error("Verify iframe failed to load: ".concat(i.verifyUrl)),i.logger.error(e.t1),i.verifyDisabled=!0;case 22:case"end":return e.stop()}}),e,null,[[4,9],[14,19]])})));return function(t){return e.apply(this,arguments)}}(),i.register=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!i.initialized){e.next=4;break}i.sendPost(t.attestationId),e.next=7;break;case 4:return i.addToQueue(t.attestationId),e.next=7,i.init();case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),i.resolve=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){var n,r;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!i.isDevEnv){e.next=2;break}return e.abrupt("return","");case 2:return n=(null===t||void 0===t?void 0:t.verifyUrl)||Ga,r="",e.prev=4,e.next=7,i.fetchAttestation(t.attestationId,n);case 7:r=e.sent,e.next=17;break;case 10:return e.prev=10,e.t0=e.catch(4),i.logger.warn("failed to resolve attestation: ".concat(t.attestationId," from url: ").concat(n)),i.logger.warn(e.t0),e.next=16,i.fetchAttestation(t.attestationId,Ka);case 16:r=e.sent;case 17:return e.abrupt("return",r);case 18:case"end":return e.stop()}}),e,null,[[4,10]])})));return function(t){return e.apply(this,arguments)}}(),i.fetchAttestation=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t,n){var r,o,a;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i.logger.info("resolving attestation: ".concat(t," from url: ").concat(n)),o=i.startAbortTimer(2*Et.ONE_SECOND),e.next=4,fetch("".concat(n,"/attestation/").concat(t),{signal:i.abortController.signal});case 4:if(a=e.sent,clearTimeout(o),200!==a.status){e.next=18;break}return e.next=9,a.json();case 9:if(e.t1=r=e.sent,null!=e.t1){e.next=14;break}e.t2=void 0,e.next=15;break;case 14:e.t2=r.origin;case 15:e.t0=e.t2,e.next=19;break;case 18:e.t0="";case 19:return e.abrupt("return",e.t0);case 20:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),i.addToQueue=function(e){i.queue.push(e)},i.processQueue=function(){0!==i.queue.length&&(i.queue.forEach((function(e){return i.sendPost(e)})),i.queue=[])},i.sendPost=function(e){var t;try{if(!i.iframe)return;null==(t=i.iframe.contentWindow)||t.postMessage(e,"*"),i.logger.info("postMessage sent: ".concat(e," ").concat(i.verifyUrl))}catch(n){}},i.createIframe=(0,b.Z)((0,g.Z)().mark((function e(){var t,n;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=function e(n){"verify_ready"===n.data&&(i.initialized=!0,i.processQueue(),window.removeEventListener("message",e),t())},e.next=3,Promise.race([new Promise((function(e){if(document.getElementById(Va))return e();window.addEventListener("message",n);var r=document.createElement("iframe");r.id=Va,r.src="".concat(i.verifyUrl,"/").concat(i.projectId),r.style.display="none",document.body.append(r),i.iframe=r,t=e})),new Promise((function(e,t){return setTimeout((function(){window.removeEventListener("message",n),t("verify iframe load timeout")}),(0,Et.toMiliseconds)(Et.FIVE_SECONDS))}))]);case 3:case"end":return e.stop()}}),e)}))),i.removeIframe=function(){i.iframe&&(i.iframe.remove(),i.iframe=void 0,i.initialized=!1)},i.logger=(0,Nt.generateChildLogger)(r,i.name),i.verifyUrl=Ga,i.abortController=new AbortController,i.isDevEnv=lr()&&{NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0}.IS_VITEST,i}return(0,x.Z)(n,[{key:"context",get:function(){return(0,Nt.getLoggerContext)(this.logger)}},{key:"startAbortTimer",value:function(e){var t=this;return this.abortController=new AbortController,setTimeout((function(){return t.abortController.abort()}),(0,Et.toMiliseconds)(e))}}]),n}(qt),Ms=Object.defineProperty,Cs=Object.getOwnPropertySymbols,Ps=Object.prototype.hasOwnProperty,Ts=Object.prototype.propertyIsEnumerable,js=function(e,t,n){return t in e?Ms(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},Is=function(e,t){for(var n in t||(t={}))Ps.call(t,n)&&js(e,n,t[n]);if(Cs){var r,i=(0,_.Z)(Cs(t));try{for(i.s();!(r=i.n()).done;){n=r.value;Ts.call(t,n)&&js(e,n,t[n])}}catch(o){i.e(o)}finally{i.f()}}return e},Ns=function(e){(0,Pt.Z)(n,e);var t=(0,Tt.Z)(n);function n(e){var r;(0,w.Z)(this,n),(r=t.call(this,e)).protocol="wc",r.version=2,r.name=fa,r.events=new A.EventEmitter,r.initialized=!1,r.on=function(e,t){return r.events.on(e,t)},r.once=function(e,t){return r.events.once(e,t)},r.off=function(e,t){return r.events.off(e,t)},r.removeListener=function(e,t){return r.events.removeListener(e,t)},r.projectId=null===e||void 0===e?void 0:e.projectId,r.relayUrl=(null===e||void 0===e?void 0:e.relayUrl)||ga;var i=typeof(null===e||void 0===e?void 0:e.logger)<"u"&&"string"!=typeof(null===e||void 0===e?void 0:e.logger)?e.logger:(0,Nt.pino)((0,Nt.getDefaultLoggerOptions)({level:(null===e||void 0===e?void 0:e.logger)||da}));return r.logger=(0,Nt.generateChildLogger)(i,r.name),r.heartbeat=new It.HeartBeat,r.crypto=new Ya((0,Ct.Z)(r),r.logger,null===e||void 0===e?void 0:e.keychain),r.history=new As((0,Ct.Z)(r),r.logger),r.expirer=new Ss((0,Ct.Z)(r),r.logger),r.storage=null!=e&&e.storage?e.storage:new jt.ZP(Is(Is({},pa),null===e||void 0===e?void 0:e.storageOptions)),r.relayer=new ms({core:(0,Ct.Z)(r),logger:r.logger,relayUrl:r.relayUrl,projectId:r.projectId}),r.pairing=new _s((0,Ct.Z)(r),r.logger),r.verify=new Os(r.projectId||"",r.logger),r}return(0,x.Z)(n,[{key:"context",get:function(){return(0,Nt.getLoggerContext)(this.logger)}},{key:"start",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=this.initialized,e.t0){e.next=4;break}return e.next=4,this.initialize();case 4:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"initialize",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.trace("Initialized"),e.prev=1,e.next=4,this.crypto.init();case 4:return e.next=6,this.history.init();case 6:return e.next=8,this.expirer.init();case 8:return e.next=10,this.relayer.init();case 10:return e.next=12,this.heartbeat.init();case 12:return e.next=14,this.pairing.init();case 14:this.initialized=!0,this.logger.info("Core Initialization Success"),e.next=21;break;case 18:throw e.prev=18,e.t0=e.catch(1),this.logger.warn("Core Initialization Failure at epoch ".concat(Date.now()),e.t0),this.logger.error(e.t0.message),e.t0;case 21:case"end":return e.stop()}}),e,this,[[1,18]])})));return function(){return e.apply(this,arguments)}}()}],[{key:"init",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){var r,i;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=new n(t),e.next=3,r.initialize();case 3:return e.next=5,r.crypto.getClientId();case 5:return i=e.sent,e.next=8,r.storage.setItem("WALLETCONNECT_CLIENT_ID",i);case 8:return e.abrupt("return",r);case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()}]),n}(Bt),Rs=Ns,Bs="client",Ds="".concat("wc","@").concat(2,":").concat(Bs,":"),Ls=Bs,Fs="error",Zs="WALLETCONNECT_DEEPLINK_CHOICE",Us="Proposal expired",zs=Et.SEVEN_DAYS,Hs={wc_sessionPropose:{req:{ttl:Et.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:Et.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:Et.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:Et.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:Et.ONE_DAY,prompt:!1,tag:1104},res:{ttl:Et.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:Et.ONE_DAY,prompt:!1,tag:1106},res:{ttl:Et.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:Et.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:Et.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:Et.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:Et.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:Et.ONE_DAY,prompt:!1,tag:1112},res:{ttl:Et.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:Et.THIRTY_SECONDS,prompt:!1,tag:1114},res:{ttl:Et.THIRTY_SECONDS,prompt:!1,tag:1115}}},qs={min:Et.FIVE_MINUTES,max:Et.SEVEN_DAYS},Ws="IDLE",Vs="ACTIVE",Gs=["wc_sessionPropose","wc_sessionRequest","wc_authRequest"],Ks=Object.defineProperty,Qs=Object.defineProperties,Ys=Object.getOwnPropertyDescriptors,Js=Object.getOwnPropertySymbols,Xs=Object.prototype.hasOwnProperty,$s=Object.prototype.propertyIsEnumerable,eu=function(e,t,n){return t in e?Ks(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},tu=function(e,t){for(var n in t||(t={}))Xs.call(t,n)&&eu(e,n,t[n]);if(Js){var r,i=(0,_.Z)(Js(t));try{for(i.s();!(r=i.n()).done;){n=r.value;$s.call(t,n)&&eu(e,n,t[n])}}catch(o){i.e(o)}finally{i.f()}}return e},nu=function(e,t){return Qs(e,Ys(t))},ru=function(e){(0,Pt.Z)(n,e);var t=(0,Tt.Z)(n);function n(e){var r;return(0,w.Z)(this,n),(r=t.call(this,e)).name="engine",r.events=new(S()),r.initialized=!1,r.ignoredPayloadTypes=[Zn],r.requestQueue={state:Ws,queue:[]},r.sessionRequestQueue={state:Ws,queue:[]},r.requestQueueDelay=Et.ONE_SECOND,r.init=(0,b.Z)((0,g.Z)().mark((function e(){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=r.initialized,e.t0){e.next=9;break}return e.next=4,r.cleanup();case 4:r.registerRelayerEvents(),r.registerExpirerEvents(),r.client.core.pairing.register({methods:Object.keys(Hs)}),r.initialized=!0,setTimeout((function(){r.sessionRequestQueue.queue=r.getPendingSessionRequests(),r.processSessionRequestQueue()}),(0,Et.toMiliseconds)(r.requestQueueDelay));case 9:case"end":return e.stop()}}),e)}))),r.connect=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){var n,i,o,a,s,u,c,l,f,h,d,p,v,m,y,w,x,k,E,_,A,S;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.isInitialized();case 2:return n=nu(tu({},t),{requiredNamespaces:t.requiredNamespaces||{},optionalNamespaces:t.optionalNamespaces||{}}),e.next=5,r.isValidConnect(n);case 5:if(i=n.pairingTopic,o=n.requiredNamespaces,a=n.optionalNamespaces,s=n.sessionProperties,u=n.relays,f=!1,(c=i)&&(f=r.client.core.pairing.pairings.get(c).active),c&&f){e.next=14;break}return e.next=10,r.client.core.pairing.create();case 10:h=e.sent,d=h.topic,p=h.uri,c=d,l=p;case 14:return e.next=16,r.client.core.crypto.generateKeyPair();case 16:if(v=e.sent,m=tu({requiredNamespaces:o,optionalNamespaces:a,relays:null!==u&&void 0!==u?u:[{protocol:"irn"}],proposer:{publicKey:v,metadata:r.client.metadata}},s&&{sessionProperties:s}),y=br(Et.FIVE_MINUTES,Us),w=y.reject,x=y.resolve,k=y.done,r.events.once(Ar("session_connect"),function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){var n,i,o;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.error,i=t.session,!n){e.next=5;break}w(n),e.next=17;break;case 5:if(!i){e.next=17;break}return i.self.publicKey=v,o=nu(tu({},i),{requiredNamespaces:i.requiredNamespaces,optionalNamespaces:i.optionalNamespaces}),e.next=10,r.client.session.set(i.topic,o);case 10:return e.next=12,r.setExpiry(i.topic,i.expiry);case 12:if(e.t0=c,!e.t0){e.next=16;break}return e.next=16,r.client.core.pairing.updateMetadata({topic:c,metadata:i.peer.metadata});case 16:x(o);case 17:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),c){e.next=25;break}throw E=Hr("NO_MATCHING_KEY","connect() pairing topic: ".concat(c)),_=E.message,new Error(_);case 25:return e.next=27,r.sendRequest({topic:c,method:"wc_sessionPropose",params:m});case 27:return A=e.sent,S=Er(Et.FIVE_MINUTES),e.next=31,r.setProposal(A,tu({id:A,expiry:S},m));case 31:return e.abrupt("return",{uri:l,approval:k});case 32:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),r.pair=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.isInitialized();case 2:return e.next=4,r.client.core.pairing.pair(t);case 4:return e.abrupt("return",e.sent);case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),r.approve=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){var n,i,o,a,s,u,c,l,f,h,d,p,v,m;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.isInitialized();case 2:return e.next=4,r.isValidApprove(t);case 4:return n=t.id,i=t.relayProtocol,o=t.namespaces,a=t.sessionProperties,s=r.client.proposal.get(n),u=s.pairingTopic,c=s.proposer,l=s.requiredNamespaces,f=s.optionalNamespaces,u=u||"",Vr(l)||(l=Zr(o,"approve()")),e.next=9,r.client.core.crypto.generateKeyPair();case 9:return h=e.sent,d=c.publicKey,e.next=13,r.client.core.crypto.generateSharedKey(h,d);case 13:if(p=e.sent,e.t0=u&&n,!e.t0){e.next=24;break}return e.next=18,r.client.core.pairing.updateMetadata({topic:u,metadata:c.metadata});case 18:return e.next=20,r.sendResult({id:n,topic:u,result:{relay:{protocol:null!==i&&void 0!==i?i:"irn"},responderPublicKey:h}});case 20:return e.next=22,r.client.proposal.delete(n,qr("USER_DISCONNECTED"));case 22:return e.next=24,r.client.core.pairing.activate({topic:u});case 24:return v=tu({relay:{protocol:null!==i&&void 0!==i?i:"irn"},namespaces:o,requiredNamespaces:l,optionalNamespaces:f,pairingTopic:u,controller:{publicKey:h,metadata:r.client.metadata},expiry:Er(zs)},a&&{sessionProperties:a}),e.next=27,r.client.core.relayer.subscribe(p);case 27:return e.next=29,r.sendRequest({topic:p,method:"wc_sessionSettle",params:v,throwOnFailedPublish:!0});case 29:return m=nu(tu({},v),{topic:p,pairingTopic:u,acknowledged:!1,self:v.controller,peer:{publicKey:c.publicKey,metadata:c.metadata},controller:h}),e.next=32,r.client.session.set(p,m);case 32:return e.next=34,r.setExpiry(p,Er(zs));case 34:return e.abrupt("return",{topic:p,acknowledged:function(){return new Promise((function(e){return setTimeout((function(){return e(r.client.session.get(p))}),500)}))}});case 35:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),r.reject=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){var n,i,o,a;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.isInitialized();case 2:return e.next=4,r.isValidReject(t);case 4:if(n=t.id,i=t.reason,o=r.client.proposal.get(n),a=o.pairingTopic,e.t0=a,!e.t0){e.next=11;break}return e.next=9,r.sendError(n,a,i);case 9:return e.next=11,r.client.proposal.delete(n,qr("USER_DISCONNECTED"));case 11:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),r.update=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){var n,i,o,a,s,u,c;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.isInitialized();case 2:return e.next=4,r.isValidUpdate(t);case 4:return n=t.topic,i=t.namespaces,e.next=8,r.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:i}});case 8:return o=e.sent,a=br(),s=a.done,u=a.resolve,c=a.reject,r.events.once(Ar("session_update",o),(function(e){var t=e.error;t?c(t):u()})),e.next=16,r.client.session.update(n,{namespaces:i});case 16:return e.abrupt("return",{acknowledged:s});case 17:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),r.extend=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){var n,i,o,a,s,u;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.isInitialized();case 2:return e.next=4,r.isValidExtend(t);case 4:return n=t.topic,e.next=7,r.sendRequest({topic:n,method:"wc_sessionExtend",params:{}});case 7:return i=e.sent,o=br(),a=o.done,s=o.resolve,u=o.reject,r.events.once(Ar("session_extend",i),(function(e){var t=e.error;t?u(t):s()})),e.next=15,r.setExpiry(n,Er(zs));case 15:return e.abrupt("return",{acknowledged:a});case 16:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),r.request=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){var n,i,o,a,s,u,c,l,f;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.isInitialized();case 2:return e.next=4,r.isValidRequest(t);case 4:return n=t.chainId,i=t.request,o=t.topic,a=t.expiry,s=(0,_i.payloadId)(),u=br(a),c=u.done,l=u.resolve,f=u.reject,r.events.once(Ar("session_request",s),(function(e){var t=e.error,n=e.result;t?f(t):l(n)})),e.next=8,Promise.all([new Promise(function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.sendRequest({clientRpcId:s,topic:o,method:"wc_sessionRequest",params:{request:i,chainId:n},expiry:a,throwOnFailedPublish:!0}).catch((function(e){return f(e)}));case 2:r.client.events.emit("session_request_sent",{topic:o,request:i,chainId:n,id:s}),t();case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),new Promise(function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){var n;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.client.core.storage.getItem(Zs);case 2:n=e.sent,Sr({id:s,topic:o,wcDeepLink:n}),t();case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),c()]).then((function(e){return e[2]}));case 8:return e.abrupt("return",e.sent);case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),r.respond=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){var n,i,o;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.isInitialized();case 2:return e.next=4,r.isValidRespond(t);case 4:if(n=t.topic,i=t.response,o=i.id,!(0,_i.isJsonRpcResult)(i)){e.next=10;break}return e.next=8,r.sendResult({id:o,topic:n,result:i.result,throwOnFailedPublish:!0});case 8:e.next=14;break;case 10:if(e.t0=(0,_i.isJsonRpcError)(i),!e.t0){e.next=14;break}return e.next=14,r.sendError(o,n,i.error);case 14:r.cleanupAfterResponse(t);case 15:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),r.ping=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){var n,i,o,a,s,u;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.isInitialized();case 2:return e.next=4,r.isValidPing(t);case 4:if(n=t.topic,!r.client.session.keys.includes(n)){e.next=18;break}return e.next=8,r.sendRequest({topic:n,method:"wc_sessionPing",params:{}});case 8:return i=e.sent,o=br(),a=o.done,s=o.resolve,u=o.reject,r.events.once(Ar("session_ping",i),(function(e){var t=e.error;t?u(t):s()})),e.next=16,a();case 16:e.next=22;break;case 18:if(e.t0=r.client.core.pairing.pairings.keys.includes(n),!e.t0){e.next=22;break}return e.next=22,r.client.core.pairing.ping({topic:n});case 22:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),r.emit=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){var n,i,o;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.isInitialized();case 2:return e.next=4,r.isValidEmit(t);case 4:return n=t.topic,i=t.event,o=t.chainId,e.next=7,r.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:i,chainId:o}});case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),r.disconnect=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){var n;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.isInitialized();case 2:return e.next=4,r.isValidDisconnect(t);case 4:if(n=t.topic,!r.client.session.keys.includes(n)){e.next=12;break}return e.next=8,r.sendRequest({topic:n,method:"wc_sessionDelete",params:qr("USER_DISCONNECTED"),throwOnFailedPublish:!0});case 8:return e.next=10,r.deleteSession(n);case 10:e.next=14;break;case 12:return e.next=14,r.client.core.pairing.disconnect({topic:n});case 14:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),r.find=function(e){return r.isInitialized(),r.client.session.getAll().filter((function(t){return function(e,t){var n=t.requiredNamespaces,r=Object.keys(e.namespaces),i=Object.keys(n),o=!0;return!!mr(i,r)&&(r.forEach((function(t){var r=e.namespaces[t],i=r.accounts,a=r.methods,s=r.events,u=Fr(i),c=n[t];(!mr(Nn(t,c),u)||!mr(c.methods,a)||!mr(c.events,s))&&(o=!1)})),o)}(t,e)}))},r.getPendingSessionRequests=function(){return r.isInitialized(),r.client.pendingRequest.getAll()},r.cleanupDuplicatePairings=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){var n,i;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.pairingTopic){e.next=14;break}if(e.prev=1,n=r.client.core.pairing.pairings.get(t.pairingTopic),i=r.client.core.pairing.pairings.getAll().filter((function(e){var r,i;return(null==(r=e.peerMetadata)?void 0:r.url)&&(null==(i=e.peerMetadata)?void 0:i.url)===t.peer.metadata.url&&e.topic&&e.topic!==n.topic})),0!==i.length){e.next=5;break}return e.abrupt("return");case 5:return r.client.logger.info("Cleaning up ".concat(i.length," duplicate pairing(s)")),e.next=8,Promise.all(i.map((function(e){return r.client.core.pairing.disconnect({topic:e.topic})})));case 8:r.client.logger.info("Duplicate pairings clean up finished"),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(1),r.client.logger.error(e.t0);case 14:case"end":return e.stop()}}),e,null,[[1,11]])})));return function(t){return e.apply(this,arguments)}}(),r.deleteSession=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t,n){var i,o;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=r.client.session.get(t),o=i.self,e.next=3,r.client.core.relayer.unsubscribe(t);case 3:if(r.client.session.delete(t,qr("USER_DISCONNECTED")),e.t0=r.client.core.crypto.keychain.has(o.publicKey),!e.t0){e.next=8;break}return e.next=8,r.client.core.crypto.deleteKeyPair(o.publicKey);case 8:if(e.t1=r.client.core.crypto.keychain.has(t),!e.t1){e.next=12;break}return e.next=12,r.client.core.crypto.deleteSymKey(t);case 12:n||r.client.core.expirer.del(t),r.client.core.storage.removeItem(Zs).catch((function(e){return r.client.logger.warn(e)}));case 14:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),r.deleteProposal=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t,n){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([r.client.proposal.delete(t,qr("USER_DISCONNECTED")),n?Promise.resolve():r.client.core.expirer.del(t)]);case 2:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),r.deletePendingSessionRequest=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t,n){var i,o=arguments;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=o.length>2&&void 0!==o[2]&&o[2],e.next=3,Promise.all([r.client.pendingRequest.delete(t,n),i?Promise.resolve():r.client.core.expirer.del(t)]);case 3:r.sessionRequestQueue.queue=r.sessionRequestQueue.queue.filter((function(e){return e.id!==t})),i&&(r.sessionRequestQueue.state=Ws);case 5:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),r.setExpiry=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t,n){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=r.client.session.keys.includes(t),!e.t0){e.next=4;break}return e.next=4,r.client.session.update(t,{expiry:n});case 4:r.client.core.expirer.set(t,n);case 5:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),r.setProposal=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t,n){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.client.proposal.set(t,n);case 2:r.client.core.expirer.set(t,n.expiry);case 3:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),r.setPendingSessionRequest=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){var n,i,o,a;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=Hs.wc_sessionRequest.req.ttl,i=t.id,o=t.topic,a=t.params,e.next=3,r.client.pendingRequest.set(i,{id:i,topic:o,params:a});case 3:n&&r.client.core.expirer.set(i,Er(n));case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),r.sendRequest=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){var n,i,o,a,s,u,c,l,f,h,d;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.topic,i=t.method,o=t.params,a=t.expiry,s=t.relayRpcId,u=t.clientRpcId,c=t.throwOnFailedPublish,l=(0,_i.formatJsonRpcRequest)(i,o,u),hr()&&Gs.includes(i)&&(f=Gn(JSON.stringify(l)),r.client.core.verify.register({attestationId:f})),e.next=4,r.client.core.crypto.encode(n,l);case 4:if(h=e.sent,d=Hs[i].req,a&&(d.ttl=a),s&&(d.id=s),r.client.core.history.set(n,l),!c){e.next=15;break}return d.internal=nu(tu({},d.internal),{throwOnFailedPublish:!0}),e.next=13,r.client.core.relayer.publish(n,h,d);case 13:e.next=16;break;case 15:r.client.core.relayer.publish(n,h,d).catch((function(e){return r.client.logger.error(e)}));case 16:return e.abrupt("return",l.id);case 17:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),r.sendResult=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){var n,i,o,a,s,u,c,l;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.id,i=t.topic,o=t.result,a=t.throwOnFailedPublish,s=(0,_i.formatJsonRpcResult)(n,o),e.next=7,r.client.core.crypto.encode(i,s);case 7:return u=e.sent,e.next=10,r.client.core.history.get(i,n);case 10:if(c=e.sent,l=Hs[c.request.method].res,!a){e.next=18;break}return l.internal=nu(tu({},l.internal),{throwOnFailedPublish:!0}),e.next=16,r.client.core.relayer.publish(i,u,l);case 16:e.next=19;break;case 18:r.client.core.relayer.publish(i,u,l).catch((function(e){return r.client.logger.error(e)}));case 19:return e.next=21,r.client.core.history.resolve(s);case 21:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),r.sendError=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t,n,i){var o,a,s,u;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=(0,_i.formatJsonRpcError)(t,i),e.next=3,r.client.core.crypto.encode(n,o);case 3:return a=e.sent,e.next=6,r.client.core.history.get(n,t);case 6:return s=e.sent,u=Hs[s.request.method].res,r.client.core.relayer.publish(n,a,u),e.next=11,r.client.core.history.resolve(o);case 11:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}(),r.cleanup=(0,b.Z)((0,g.Z)().mark((function e(){var t,n;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=[],n=[],r.client.session.getAll().forEach((function(e){_r(e.expiry)&&t.push(e.topic)})),r.client.proposal.getAll().forEach((function(e){_r(e.expiry)&&n.push(e.id)})),e.next=5,Promise.all([].concat((0,k.Z)(t.map((function(e){return r.deleteSession(e)}))),(0,k.Z)(n.map((function(e){return r.deleteProposal(e)})))));case 5:case"end":return e.stop()}}),e)}))),r.onRelayEventRequest=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r.requestQueue.queue.push(t),e.next=3,r.processRequestsQueue();case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),r.processRequestsQueue=(0,b.Z)((0,g.Z)().mark((function e(){var t;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r.requestQueue.state!==Vs){e.next=3;break}return r.client.logger.info("Request queue already active, skipping..."),e.abrupt("return");case 3:r.client.logger.info("Request queue starting with ".concat(r.requestQueue.queue.length," requests"));case 4:if(!(r.requestQueue.queue.length>0)){e.next=19;break}if(r.requestQueue.state=Vs,!(t=r.requestQueue.queue.shift())){e.next=17;break}return e.prev=8,r.processRequest(t),e.next=12,new Promise((function(e){return setTimeout(e,300)}));case 12:e.next=17;break;case 14:e.prev=14,e.t0=e.catch(8),r.client.logger.warn(e.t0);case 17:e.next=4;break;case 19:r.requestQueue.state=Ws;case 20:case"end":return e.stop()}}),e,null,[[8,14]])}))),r.processRequest=function(e){var t=e.topic,n=e.payload,i=n.method;switch(i){case"wc_sessionPropose":return r.onSessionProposeRequest(t,n);case"wc_sessionSettle":return r.onSessionSettleRequest(t,n);case"wc_sessionUpdate":return r.onSessionUpdateRequest(t,n);case"wc_sessionExtend":return r.onSessionExtendRequest(t,n);case"wc_sessionPing":return r.onSessionPingRequest(t,n);case"wc_sessionDelete":return r.onSessionDeleteRequest(t,n);case"wc_sessionRequest":return r.onSessionRequest(t,n);case"wc_sessionEvent":return r.onSessionEventRequest(t,n);default:return r.client.logger.info("Unsupported request method ".concat(i))}},r.onRelayEventResponse=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){var n,i,o;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.topic,i=t.payload,e.next=4,r.client.core.history.get(n,i.id);case 4:o=e.sent.request.method,e.t0=o,e.next="wc_sessionPropose"===e.t0?8:"wc_sessionSettle"===e.t0?9:"wc_sessionUpdate"===e.t0?10:"wc_sessionExtend"===e.t0?11:"wc_sessionPing"===e.t0?12:"wc_sessionRequest"===e.t0?13:14;break;case 8:return e.abrupt("return",r.onSessionProposeResponse(n,i));case 9:return e.abrupt("return",r.onSessionSettleResponse(n,i));case 10:return e.abrupt("return",r.onSessionUpdateResponse(n,i));case 11:return e.abrupt("return",r.onSessionExtendResponse(n,i));case 12:return e.abrupt("return",r.onSessionPingResponse(n,i));case 13:return e.abrupt("return",r.onSessionRequestResponse(n,i));case 14:return e.abrupt("return",r.client.logger.info("Unsupported response method ".concat(o)));case 15:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),r.onRelayEventUnknownPayload=function(e){var t=e.topic,n=Hr("MISSING_OR_INVALID","Decoded payload on topic ".concat(t," is not identifiable as a JSON-RPC request or a response.")).message;throw new Error(n)},r.onSessionProposeRequest=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t,n){var i,o,a,s,u,c;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=n.params,o=n.id,e.prev=1,r.isValidConnect(tu({},n.params)),a=Er(Et.FIVE_MINUTES),s=tu({id:o,pairingTopic:t,expiry:a},i),e.next=6,r.setProposal(o,s);case 6:return u=Gn(JSON.stringify(n)),e.next=9,r.getVerifyContext(u,s.proposer.metadata);case 9:c=e.sent,r.client.events.emit("session_proposal",{id:o,params:s,verifyContext:c}),e.next=18;break;case 13:return e.prev=13,e.t0=e.catch(1),e.next=17,r.sendError(o,t,e.t0);case 17:r.client.logger.error(e.t0);case 18:case"end":return e.stop()}}),e,null,[[1,13]])})));return function(t,n){return e.apply(this,arguments)}}(),r.onSessionProposeResponse=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t,n){var i,o,a,s,u,c,l;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=n.id,!(0,_i.isJsonRpcResult)(n)){e.next=22;break}return o=n.result,r.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:o}),a=r.client.proposal.get(i),r.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:a}),s=a.proposer.publicKey,r.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:s}),u=o.responderPublicKey,r.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:u}),e.next=12,r.client.core.crypto.generateSharedKey(s,u);case 12:return c=e.sent,r.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:c}),e.next=16,r.client.core.relayer.subscribe(c);case 16:return l=e.sent,r.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:l}),e.next=20,r.client.core.pairing.activate({topic:t});case 20:e.next=27;break;case 22:if(e.t0=(0,_i.isJsonRpcError)(n),!e.t0){e.next=27;break}return e.next=26,r.client.proposal.delete(i,qr("USER_DISCONNECTED"));case 26:r.events.emit(Ar("session_connect"),{error:n.error});case 27:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),r.onSessionSettleRequest=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t,n){var i,o,a,s,u,c,l,f,h,d,p,v;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=n.id,o=n.params,e.prev=1,r.isValidSessionSettleRequest(o),a=n.params,s=a.relay,u=a.controller,c=a.expiry,l=a.namespaces,f=a.requiredNamespaces,h=a.optionalNamespaces,d=a.sessionProperties,p=a.pairingTopic,v=tu({topic:t,relay:s,expiry:c,namespaces:l,acknowledged:!0,pairingTopic:p,requiredNamespaces:f,optionalNamespaces:h,controller:u.publicKey,self:{publicKey:"",metadata:r.client.metadata},peer:{publicKey:u.publicKey,metadata:u.metadata}},d&&{sessionProperties:d}),e.next=6,r.sendResult({id:n.id,topic:t,result:!0});case 6:r.events.emit(Ar("session_connect"),{session:v}),r.cleanupDuplicatePairings(v),e.next=15;break;case 10:return e.prev=10,e.t0=e.catch(1),e.next=14,r.sendError(i,t,e.t0);case 14:r.client.logger.error(e.t0);case 15:case"end":return e.stop()}}),e,null,[[1,10]])})));return function(t,n){return e.apply(this,arguments)}}(),r.onSessionSettleResponse=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t,n){var i;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=n.id,!(0,_i.isJsonRpcResult)(n)){e.next=7;break}return e.next=4,r.client.session.update(t,{acknowledged:!0});case 4:r.events.emit(Ar("session_approve",i),{}),e.next=12;break;case 7:if(e.t0=(0,_i.isJsonRpcError)(n),!e.t0){e.next=12;break}return e.next=11,r.client.session.delete(t,qr("USER_DISCONNECTED"));case 11:r.events.emit(Ar("session_approve",i),{error:n.error});case 12:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),r.onSessionUpdateRequest=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t,n){var i,o,a,s;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=n.params,o=n.id,e.prev=1,a="".concat(t,"_session_update"),!(s=ki.get(a))||!r.isRequestOutOfSync(s,o)){e.next=6;break}return r.client.logger.info("Discarding out of sync request - ".concat(o)),e.abrupt("return");case 6:return r.isValidUpdate(tu({topic:t},i)),e.next=9,r.client.session.update(t,{namespaces:i.namespaces});case 9:return e.next=11,r.sendResult({id:o,topic:t,result:!0});case 11:r.client.events.emit("session_update",{id:o,topic:t,params:i}),ki.set(a,o),e.next=20;break;case 15:return e.prev=15,e.t0=e.catch(1),e.next=19,r.sendError(o,t,e.t0);case 19:r.client.logger.error(e.t0);case 20:case"end":return e.stop()}}),e,null,[[1,15]])})));return function(t,n){return e.apply(this,arguments)}}(),r.isRequestOutOfSync=function(e,t){return parseInt(t.toString().slice(0,-3))<=parseInt(e.toString().slice(0,-3))},r.onSessionUpdateResponse=function(e,t){var n=t.id;(0,_i.isJsonRpcResult)(t)?r.events.emit(Ar("session_update",n),{}):(0,_i.isJsonRpcError)(t)&&r.events.emit(Ar("session_update",n),{error:t.error})},r.onSessionExtendRequest=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t,n){var i;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=n.id,e.prev=1,r.isValidExtend({topic:t}),e.next=5,r.setExpiry(t,Er(zs));case 5:return e.next=7,r.sendResult({id:i,topic:t,result:!0});case 7:r.client.events.emit("session_extend",{id:i,topic:t}),e.next=15;break;case 10:return e.prev=10,e.t0=e.catch(1),e.next=14,r.sendError(i,t,e.t0);case 14:r.client.logger.error(e.t0);case 15:case"end":return e.stop()}}),e,null,[[1,10]])})));return function(t,n){return e.apply(this,arguments)}}(),r.onSessionExtendResponse=function(e,t){var n=t.id;(0,_i.isJsonRpcResult)(t)?r.events.emit(Ar("session_extend",n),{}):(0,_i.isJsonRpcError)(t)&&r.events.emit(Ar("session_extend",n),{error:t.error})},r.onSessionPingRequest=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t,n){var i;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=n.id,e.prev=1,r.isValidPing({topic:t}),e.next=5,r.sendResult({id:i,topic:t,result:!0});case 5:r.client.events.emit("session_ping",{id:i,topic:t}),e.next=13;break;case 8:return e.prev=8,e.t0=e.catch(1),e.next=12,r.sendError(i,t,e.t0);case 12:r.client.logger.error(e.t0);case 13:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(t,n){return e.apply(this,arguments)}}(),r.onSessionPingResponse=function(e,t){var n=t.id;setTimeout((function(){(0,_i.isJsonRpcResult)(t)?r.events.emit(Ar("session_ping",n),{}):(0,_i.isJsonRpcError)(t)&&r.events.emit(Ar("session_ping",n),{error:t.error})}),500)},r.onSessionDeleteRequest=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t,n){var i;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=n.id,e.prev=1,r.isValidDisconnect({topic:t,reason:n.params}),e.next=5,Promise.all([new Promise((function(e){r.client.core.relayer.once(Sa,(0,b.Z)((0,g.Z)().mark((function n(){return(0,g.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.t0=e,n.next=3,r.deleteSession(t);case 3:n.t1=n.sent,(0,n.t0)(n.t1);case 5:case"end":return n.stop()}}),n)}))))})),r.sendResult({id:i,topic:t,result:!0})]);case 5:r.client.events.emit("session_delete",{id:i,topic:t}),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),r.client.logger.error(e.t0);case 11:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(t,n){return e.apply(this,arguments)}}(),r.onSessionRequest=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t,n){var i,o;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=n.id,o=n.params,e.prev=1,r.isValidRequest(tu({topic:t},o)),e.next=5,r.setPendingSessionRequest({id:i,topic:t,params:o});case 5:return r.addSessionRequestToSessionRequestQueue({id:i,topic:t,params:o}),e.next=8,r.processSessionRequestQueue();case 8:e.next=15;break;case 10:return e.prev=10,e.t0=e.catch(1),e.next=14,r.sendError(i,t,e.t0);case 14:r.client.logger.error(e.t0);case 15:case"end":return e.stop()}}),e,null,[[1,10]])})));return function(t,n){return e.apply(this,arguments)}}(),r.onSessionRequestResponse=function(e,t){var n=t.id;(0,_i.isJsonRpcResult)(t)?r.events.emit(Ar("session_request",n),{result:t.result}):(0,_i.isJsonRpcError)(t)&&r.events.emit(Ar("session_request",n),{error:t.error})},r.onSessionEventRequest=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t,n){var i,o,a,s;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=n.id,o=n.params,e.prev=1,a="".concat(t,"_session_event_").concat(o.event.name),!(s=ki.get(a))||!r.isRequestOutOfSync(s,i)){e.next=6;break}return r.client.logger.info("Discarding out of sync request - ".concat(i)),e.abrupt("return");case 6:r.isValidEmit(tu({topic:t},o)),r.client.events.emit("session_event",{id:i,topic:t,params:o}),ki.set(a,i),e.next=14;break;case 9:return e.prev=9,e.t0=e.catch(1),e.next=13,r.sendError(i,t,e.t0);case 13:r.client.logger.error(e.t0);case 14:case"end":return e.stop()}}),e,null,[[1,9]])})));return function(t,n){return e.apply(this,arguments)}}(),r.addSessionRequestToSessionRequestQueue=function(e){r.sessionRequestQueue.queue.push(e)},r.cleanupAfterResponse=function(e){r.deletePendingSessionRequest(e.response.id,{message:"fulfilled",code:0}),setTimeout((function(){r.sessionRequestQueue.state=Ws,r.processSessionRequestQueue()}),(0,Et.toMiliseconds)(r.requestQueueDelay))},r.processSessionRequestQueue=(0,b.Z)((0,g.Z)().mark((function e(){var t,n,i,o,a,s,u;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r.sessionRequestQueue.state!==Vs){e.next=3;break}return r.client.logger.info("session request queue is already active."),e.abrupt("return");case 3:if(t=r.sessionRequestQueue.queue[0]){e.next=7;break}return r.client.logger.info("session request queue is empty."),e.abrupt("return");case 7:return e.prev=7,n=t.id,i=t.topic,o=t.params,a=Gn(JSON.stringify((0,_i.formatJsonRpcRequest)("wc_sessionRequest",o,n))),s=r.client.session.get(i),e.next=15,r.getVerifyContext(a,s.peer.metadata);case 15:u=e.sent,r.sessionRequestQueue.state=Vs,r.client.events.emit("session_request",{id:n,topic:i,params:o,verifyContext:u}),e.next=22;break;case 19:e.prev=19,e.t0=e.catch(7),r.client.logger.error(e.t0);case 22:case"end":return e.stop()}}),e,null,[[7,19]])}))),r.isValidConnect=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){var n,i,o,a,s,u,c,l,f;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(si(t)){e.next=3;break}throw n=Hr("MISSING_OR_INVALID","connect() params: ".concat(JSON.stringify(t))),i=n.message,new Error(i);case 3:if(o=t.pairingTopic,a=t.requiredNamespaces,s=t.optionalNamespaces,u=t.sessionProperties,c=t.relays,e.t0=Gr(o),e.t0){e.next=8;break}return e.next=8,r.isValidPairingTopic(o);case 8:if(oi(c,!0)){e.next=11;break}throw l=Hr("MISSING_OR_INVALID","connect() relays: ".concat(c)),f=l.message,new Error(f);case 11:!Gr(a)&&0!==Vr(a)&&r.validateNamespaces(a,"requiredNamespaces"),!Gr(s)&&0!==Vr(s)&&r.validateNamespaces(s,"optionalNamespaces"),Gr(u)||r.validateSessionProps(u,"sessionProperties");case 12:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),r.validateNamespaces=function(e,t){var n=function(e,t,n){var r=null;if(e&&Vr(e)){var i=ni(e,t);i&&(r=i);var o=ei(e,t,n);o&&(r=o)}else r=Hr("MISSING_OR_INVALID","".concat(t,", ").concat(n," should be an object with data"));return r}(e,"connect()",t);if(n)throw new Error(n.message)},r.isValidApprove=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){var n,i,o,a,s,u,c,l,f;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(si(t)){e.next=2;break}throw new Error(Hr("MISSING_OR_INVALID","approve() params: ".concat(t)).message);case 2:return n=t.id,i=t.namespaces,o=t.relayProtocol,a=t.sessionProperties,e.next=5,r.isValidProposalId(n);case 5:if(s=r.client.proposal.get(n),!(u=ri(i,"approve()"))){e.next=8;break}throw new Error(u.message);case 8:if(!(c=vi(s.requiredNamespaces,i,"approve()"))){e.next=11;break}throw new Error(c.message);case 11:if(Kr(o,!0)){e.next=14;break}throw l=Hr("MISSING_OR_INVALID","approve() relayProtocol: ".concat(o)),f=l.message,new Error(f);case 14:Gr(a)||r.validateSessionProps(a,"sessionProperties");case 15:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),r.isValidReject=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){var n,i,o,a,s,u;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(si(t)){e.next=3;break}throw n=Hr("MISSING_OR_INVALID","reject() params: ".concat(t)),i=n.message,new Error(i);case 3:return o=t.id,a=t.reason,e.next=6,r.isValidProposalId(o);case 6:if(ui(a)){e.next=9;break}throw s=Hr("MISSING_OR_INVALID","reject() reason: ".concat(JSON.stringify(a))),u=s.message,new Error(u);case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),r.isValidSessionSettleRequest=function(e){if(!si(e)){var t=Hr("MISSING_OR_INVALID","onSessionSettleRequest() params: ".concat(e)).message;throw new Error(t)}var n=e.relay,r=e.controller,i=e.namespaces,o=e.expiry;if(!ii(n)){var a=Hr("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string").message;throw new Error(a)}var s=function(e,t){var n=null;return Kr(null===e||void 0===e?void 0:e.publicKey,!1)||(n=Hr("MISSING_OR_INVALID","".concat(t," controller public key should be a string"))),n}(r,"onSessionSettleRequest()");if(s)throw new Error(s.message);var u=ri(i,"onSessionSettleRequest()");if(u)throw new Error(u.message);if(_r(o)){var c=Hr("EXPIRED","onSessionSettleRequest()").message;throw new Error(c)}},r.isValidUpdate=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){var n,i,o,a,s,u,c;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(si(t)){e.next=3;break}throw n=Hr("MISSING_OR_INVALID","update() params: ".concat(t)),i=n.message,new Error(i);case 3:return o=t.topic,a=t.namespaces,e.next=6,r.isValidSessionTopic(o);case 6:if(s=r.client.session.get(o),!(u=ri(a,"update()"))){e.next=9;break}throw new Error(u.message);case 9:if(!(c=vi(s.requiredNamespaces,a,"update()"))){e.next=12;break}throw new Error(c.message);case 12:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),r.isValidExtend=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){var n,i,o;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(si(t)){e.next=3;break}throw n=Hr("MISSING_OR_INVALID","extend() params: ".concat(t)),i=n.message,new Error(i);case 3:return o=t.topic,e.next=6,r.isValidSessionTopic(o);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),r.isValidRequest=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){var n,i,o,a,s,u,c,l,f,h,d,p,v,m,y,b;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(si(t)){e.next=3;break}throw n=Hr("MISSING_OR_INVALID","request() params: ".concat(t)),i=n.message,new Error(i);case 3:return o=t.topic,a=t.request,s=t.chainId,u=t.expiry,e.next=6,r.isValidSessionTopic(o);case 6:if(c=r.client.session.get(o),hi(l=c.namespaces,s)){e.next=10;break}throw f=Hr("MISSING_OR_INVALID","request() chainId: ".concat(s)),h=f.message,new Error(h);case 10:if(ci(a)){e.next=13;break}throw d=Hr("MISSING_OR_INVALID","request() ".concat(JSON.stringify(a))),p=d.message,new Error(p);case 13:if(di(l,s,a.method)){e.next=16;break}throw v=Hr("MISSING_OR_INVALID","request() method: ".concat(a.method)),m=v.message,new Error(m);case 16:if(!u||yi(u,qs)){e.next=19;break}throw y=Hr("MISSING_OR_INVALID","request() expiry: ".concat(u,". Expiry must be a number (in seconds) between ").concat(qs.min," and ").concat(qs.max)),b=y.message,new Error(b);case 19:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),r.isValidRespond=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){var n,i,o,a,s,u;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(si(t)){e.next=3;break}throw n=Hr("MISSING_OR_INVALID","respond() params: ".concat(t)),i=n.message,new Error(i);case 3:return o=t.topic,a=t.response,e.next=6,r.isValidSessionTopic(o);case 6:if(li(a)){e.next=9;break}throw s=Hr("MISSING_OR_INVALID","respond() response: ".concat(JSON.stringify(a))),u=s.message,new Error(u);case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),r.isValidPing=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){var n,i,o;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(si(t)){e.next=3;break}throw n=Hr("MISSING_OR_INVALID","ping() params: ".concat(t)),i=n.message,new Error(i);case 3:return o=t.topic,e.next=6,r.isValidSessionOrPairingTopic(o);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),r.isValidEmit=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){var n,i,o,a,s,u,c,l,f,h,d,p,v;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(si(t)){e.next=3;break}throw n=Hr("MISSING_OR_INVALID","emit() params: ".concat(t)),i=n.message,new Error(i);case 3:return o=t.topic,a=t.event,s=t.chainId,e.next=6,r.isValidSessionTopic(o);case 6:if(u=r.client.session.get(o),hi(c=u.namespaces,s)){e.next=10;break}throw l=Hr("MISSING_OR_INVALID","emit() chainId: ".concat(s)),f=l.message,new Error(f);case 10:if(fi(a)){e.next=13;break}throw h=Hr("MISSING_OR_INVALID","emit() event: ".concat(JSON.stringify(a))),d=h.message,new Error(d);case 13:if(pi(c,s,a.name)){e.next=16;break}throw p=Hr("MISSING_OR_INVALID","emit() event: ".concat(JSON.stringify(a))),v=p.message,new Error(v);case 16:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),r.isValidDisconnect=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){var n,i,o;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(si(t)){e.next=3;break}throw n=Hr("MISSING_OR_INVALID","disconnect() params: ".concat(t)),i=n.message,new Error(i);case 3:return o=t.topic,e.next=6,r.isValidSessionOrPairingTopic(o);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),r.getVerifyContext=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t,n){var i,o;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i={verified:{verifyUrl:n.verifyUrl||Ga,validation:"UNKNOWN",origin:n.url||""}},e.prev=1,e.next=4,r.client.core.verify.resolve({attestationId:t,verifyUrl:n.verifyUrl});case 4:(o=e.sent)&&(i.verified.origin=o,i.verified.validation=o===new URL(n.url).origin?"VALID":"INVALID"),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),r.client.logger.error(e.t0);case 11:return e.abrupt("return",(r.client.logger.info("Verify context: ".concat(JSON.stringify(i))),i));case 12:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(t,n){return e.apply(this,arguments)}}(),r.validateSessionProps=function(e,t){Object.values(e).forEach((function(e){if(!Kr(e,!1)){var n=Hr("MISSING_OR_INVALID","".concat(t," must be in Record format. Received: ").concat(JSON.stringify(e))).message;throw new Error(n)}}))},r}return(0,x.Z)(n,[{key:"isInitialized",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(){var t,n;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.initialized){e.next=3;break}throw t=Hr("NOT_INITIALIZED",this.name),n=t.message,new Error(n);case 3:return e.next=5,this.client.core.relayer.confirmOnlineStateOrThrow();case 5:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"registerRelayerEvents",value:function(){var e=this;this.client.core.relayer.on(wa,function(){var t=(0,b.Z)((0,g.Z)().mark((function t(n){var r,i,o;return(0,g.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=n.topic,i=n.message,!e.ignoredPayloadTypes.includes(e.client.core.crypto.getPayloadType(i))){t.next=3;break}return t.abrupt("return");case 3:return t.next=5,e.client.core.crypto.decode(r,i);case 5:if(o=t.sent,t.prev=6,!(0,_i.isJsonRpcRequest)(o)){t.next=11;break}e.client.core.history.set(r,o),e.onRelayEventRequest({topic:r,payload:o}),t.next=20;break;case 11:if(!(0,_i.isJsonRpcResponse)(o)){t.next=19;break}return t.next=14,e.client.core.history.resolve(o);case 14:return t.next=16,e.onRelayEventResponse({topic:r,payload:o});case 16:e.client.core.history.delete(r,o.id),t.next=20;break;case 19:e.onRelayEventUnknownPayload({topic:r,payload:o});case 20:t.next=25;break;case 22:t.prev=22,t.t0=t.catch(6),e.client.logger.error(t.t0);case 25:case"end":return t.stop()}}),t,null,[[6,22]])})));return function(e){return t.apply(this,arguments)}}())}},{key:"registerExpirerEvents",value:function(){var e=this;this.client.core.expirer.on(qa,function(){var t=(0,b.Z)((0,g.Z)().mark((function t(n){var r,i,o;return(0,g.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=kr(n.target),i=r.topic,!(o=r.id)||!e.client.pendingRequest.keys.includes(o)){t.next=5;break}return t.next=4,e.deletePendingSessionRequest(o,Hr("EXPIRED"),!0);case 4:return t.abrupt("return",t.sent);case 5:if(!i){t.next=13;break}if(t.t0=e.client.session.keys.includes(i),!t.t0){t.next=11;break}return t.next=10,e.deleteSession(i,!0);case 10:e.client.events.emit("session_expire",{topic:i});case 11:t.next=18;break;case 13:if(t.t1=o,!t.t1){t.next=18;break}return t.next=17,e.deleteProposal(o,!0);case 17:e.client.events.emit("proposal_expire",{id:o});case 18:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())}},{key:"isValidPairingTopic",value:function(e){if(!Kr(e,!1)){var t=Hr("MISSING_OR_INVALID","pairing topic should be a string: ".concat(e)).message;throw new Error(t)}if(!this.client.core.pairing.pairings.keys.includes(e)){var n=Hr("NO_MATCHING_KEY","pairing topic doesn't exist: ".concat(e)).message;throw new Error(n)}if(_r(this.client.core.pairing.pairings.get(e).expiry)){var r=Hr("EXPIRED","pairing topic: ".concat(e)).message;throw new Error(r)}}},{key:"isValidSessionTopic",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){var n,r,i,o,a,s;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Kr(t,!1)){e.next=3;break}throw n=Hr("MISSING_OR_INVALID","session topic should be a string: ".concat(t)),r=n.message,new Error(r);case 3:if(this.client.session.keys.includes(t)){e.next=6;break}throw i=Hr("NO_MATCHING_KEY","session topic doesn't exist: ".concat(t)),o=i.message,new Error(o);case 6:if(!_r(this.client.session.get(t).expiry)){e.next=11;break}return e.next=9,this.deleteSession(t);case 9:throw a=Hr("EXPIRED","session topic: ".concat(t)),s=a.message,new Error(s);case 11:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"isValidSessionOrPairingTopic",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){var n,r,i,o;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.client.session.keys.includes(t)){e.next=5;break}return e.next=3,this.isValidSessionTopic(t);case 3:e.next=16;break;case 5:if(!this.client.core.pairing.pairings.keys.includes(t)){e.next=9;break}this.isValidPairingTopic(t),e.next=16;break;case 9:if(!Kr(t,!1)){e.next=14;break}throw n=Hr("NO_MATCHING_KEY","session or pairing topic doesn't exist: ".concat(t)),r=n.message,new Error(r);case 14:throw i=Hr("MISSING_OR_INVALID","session or pairing topic should be a string: ".concat(t)),o=i.message,new Error(o);case 16:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"isValidProposalId",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){var n,r,i,o,a,s;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(ai(t)){e.next=3;break}throw n=Hr("MISSING_OR_INVALID","proposal id should be a number: ".concat(t)),r=n.message,new Error(r);case 3:if(this.client.proposal.keys.includes(t)){e.next=6;break}throw i=Hr("NO_MATCHING_KEY","proposal id doesn't exist: ".concat(t)),o=i.message,new Error(o);case 6:if(!_r(this.client.proposal.get(t).expiry)){e.next=11;break}return e.next=9,this.deleteProposal(t);case 9:throw a=Hr("EXPIRED","proposal id: ".concat(t)),s=a.message,new Error(s);case 11:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()}]),n}(Vt),iu=function(e){(0,Pt.Z)(n,e);var t=(0,Tt.Z)(n);function n(e,r){var i;return(0,w.Z)(this,n),(i=t.call(this,e,r,"proposal",Ds)).core=e,i.logger=r,i}return(0,x.Z)(n)}(Es),ou=function(e){(0,Pt.Z)(n,e);var t=(0,Tt.Z)(n);function n(e,r){var i;return(0,w.Z)(this,n),(i=t.call(this,e,r,"session",Ds)).core=e,i.logger=r,i}return(0,x.Z)(n)}(Es),au=function(e){(0,Pt.Z)(n,e);var t=(0,Tt.Z)(n);function n(e,r){var i;return(0,w.Z)(this,n),(i=t.call(this,e,r,"request",Ds,(function(e){return e.id}))).core=e,i.logger=r,i}return(0,x.Z)(n)}(Es),su=function(e){(0,Pt.Z)(n,e);var t=(0,Tt.Z)(n);function n(e){var r;(0,w.Z)(this,n),(r=t.call(this,e)).protocol="wc",r.version=2,r.name=Ls,r.events=new A.EventEmitter,r.on=function(e,t){return r.events.on(e,t)},r.once=function(e,t){return r.events.once(e,t)},r.off=function(e,t){return r.events.off(e,t)},r.removeListener=function(e,t){return r.events.removeListener(e,t)},r.removeAllListeners=function(e){return r.events.removeAllListeners(e)},r.connect=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,r.engine.connect(t);case 3:return e.abrupt("return",e.sent);case 6:throw e.prev=6,e.t0=e.catch(0),r.logger.error(e.t0.message),e.t0;case 9:case"end":return e.stop()}}),e,null,[[0,6]])})));return function(t){return e.apply(this,arguments)}}(),r.pair=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,r.engine.pair(t);case 3:return e.abrupt("return",e.sent);case 6:throw e.prev=6,e.t0=e.catch(0),r.logger.error(e.t0.message),e.t0;case 9:case"end":return e.stop()}}),e,null,[[0,6]])})));return function(t){return e.apply(this,arguments)}}(),r.approve=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,r.engine.approve(t);case 3:return e.abrupt("return",e.sent);case 6:throw e.prev=6,e.t0=e.catch(0),r.logger.error(e.t0.message),e.t0;case 9:case"end":return e.stop()}}),e,null,[[0,6]])})));return function(t){return e.apply(this,arguments)}}(),r.reject=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,r.engine.reject(t);case 3:return e.abrupt("return",e.sent);case 6:throw e.prev=6,e.t0=e.catch(0),r.logger.error(e.t0.message),e.t0;case 9:case"end":return e.stop()}}),e,null,[[0,6]])})));return function(t){return e.apply(this,arguments)}}(),r.update=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,r.engine.update(t);case 3:return e.abrupt("return",e.sent);case 6:throw e.prev=6,e.t0=e.catch(0),r.logger.error(e.t0.message),e.t0;case 9:case"end":return e.stop()}}),e,null,[[0,6]])})));return function(t){return e.apply(this,arguments)}}(),r.extend=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,r.engine.extend(t);case 3:return e.abrupt("return",e.sent);case 6:throw e.prev=6,e.t0=e.catch(0),r.logger.error(e.t0.message),e.t0;case 9:case"end":return e.stop()}}),e,null,[[0,6]])})));return function(t){return e.apply(this,arguments)}}(),r.request=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,r.engine.request(t);case 3:return e.abrupt("return",e.sent);case 6:throw e.prev=6,e.t0=e.catch(0),r.logger.error(e.t0.message),e.t0;case 9:case"end":return e.stop()}}),e,null,[[0,6]])})));return function(t){return e.apply(this,arguments)}}(),r.respond=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,r.engine.respond(t);case 3:return e.abrupt("return",e.sent);case 6:throw e.prev=6,e.t0=e.catch(0),r.logger.error(e.t0.message),e.t0;case 9:case"end":return e.stop()}}),e,null,[[0,6]])})));return function(t){return e.apply(this,arguments)}}(),r.ping=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,r.engine.ping(t);case 3:return e.abrupt("return",e.sent);case 6:throw e.prev=6,e.t0=e.catch(0),r.logger.error(e.t0.message),e.t0;case 9:case"end":return e.stop()}}),e,null,[[0,6]])})));return function(t){return e.apply(this,arguments)}}(),r.emit=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,r.engine.emit(t);case 3:return e.abrupt("return",e.sent);case 6:throw e.prev=6,e.t0=e.catch(0),r.logger.error(e.t0.message),e.t0;case 9:case"end":return e.stop()}}),e,null,[[0,6]])})));return function(t){return e.apply(this,arguments)}}(),r.disconnect=function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,r.engine.disconnect(t);case 3:return e.abrupt("return",e.sent);case 6:throw e.prev=6,e.t0=e.catch(0),r.logger.error(e.t0.message),e.t0;case 9:case"end":return e.stop()}}),e,null,[[0,6]])})));return function(t){return e.apply(this,arguments)}}(),r.find=function(e){try{return r.engine.find(e)}catch(t){throw r.logger.error(t.message),t}},r.getPendingSessionRequests=function(){try{return r.engine.getPendingSessionRequests()}catch(e){throw r.logger.error(e.message),e}},r.name=(null===e||void 0===e?void 0:e.name)||Ls,r.metadata=(null===e||void 0===e?void 0:e.metadata)||(0,Tn.D)()||{name:"",description:"",url:"",icons:[""]};var i=typeof(null===e||void 0===e?void 0:e.logger)<"u"&&"string"!=typeof(null===e||void 0===e?void 0:e.logger)?e.logger:(0,Nt.pino)((0,Nt.getDefaultLoggerOptions)({level:(null===e||void 0===e?void 0:e.logger)||Fs}));return r.core=(null===e||void 0===e?void 0:e.core)||new Rs(e),r.logger=(0,Nt.generateChildLogger)(i,r.name),r.session=new ou(r.core,r.logger),r.proposal=new iu(r.core,r.logger),r.pendingRequest=new au(r.core,r.logger),r.engine=new ru((0,Ct.Z)(r)),r}return(0,x.Z)(n,[{key:"context",get:function(){return(0,Nt.getLoggerContext)(this.logger)}},{key:"pairing",get:function(){return this.core.pairing.pairings}},{key:"initialize",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(){return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.trace("Initialized"),e.prev=1,e.next=4,this.core.start();case 4:return e.next=6,this.session.init();case 6:return e.next=8,this.proposal.init();case 8:return e.next=10,this.pendingRequest.init();case 10:return e.next=12,this.engine.init();case 12:this.core.verify.init({verifyUrl:this.metadata.verifyUrl}),this.logger.info("SignClient Initialization Success"),e.next=19;break;case 16:throw e.prev=16,e.t0=e.catch(1),this.logger.info("SignClient Initialization Failure"),this.logger.error(e.t0.message),e.t0;case 19:case"end":return e.stop()}}),e,this,[[1,16]])})));return function(){return e.apply(this,arguments)}}()}],[{key:"init",value:function(){var e=(0,b.Z)((0,g.Z)().mark((function e(t){var r;return(0,g.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=new n(t),e.next=3,r.initialize();case 3:return e.abrupt("return",r);case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()}]),n}(Wt);n(54538),n(67021),n(33584),n(1426);Object.defineProperty,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;function uu(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return(0,k.Z)(new Set([].concat((0,k.Z)(e),(0,k.Z)(t))))}Object.defineProperty,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.defineProperty,Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;function cu(e){return e.includes(":")}function lu(e){return cu(e)?e.split(":")[0]:e}var fu={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}};function hu(e,t){var n=fu[e],r=n.message,i=n.code;return{message:t?"".concat(r," ").concat(t):r,code:i}}function du(e,t){return!!Array.isArray(e)&&(!(typeof t<"u"&&e.length)||e.every(t))}function pu(e){return Object.getPrototypeOf(e)===Object.prototype&&Object.keys(e).length}var vu=n(85457),mu="error",yu="".concat("wc","@2:").concat("universal_provider",":"),gu="default_chain_changed",bu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof n.g<"u"?n.g:typeof self<"u"?self:{},wu={exports:{}};!function(e,t){(function(){var n,r="Expected a function",i="__lodash_hash_undefined__",o="__lodash_placeholder__",a=16,s=32,u=64,c=128,l=256,f=1/0,h=9007199254740991,d=NaN,p=4294967295,v=[["ary",c],["bind",1],["bindKey",2],["curry",8],["curryRight",a],["flip",512],["partial",s],["partialRight",u],["rearg",l]],m="[object Arguments]",y="[object Array]",g="[object Boolean]",b="[object Date]",w="[object Error]",x="[object Function]",k="[object GeneratorFunction]",E="[object Map]",_="[object Number]",A="[object Object]",S="[object Promise]",O="[object RegExp]",M="[object Set]",C="[object String]",P="[object Symbol]",T="[object WeakMap]",j="[object ArrayBuffer]",I="[object DataView]",N="[object Float32Array]",R="[object Float64Array]",B="[object Int8Array]",D="[object Int16Array]",L="[object Int32Array]",F="[object Uint8Array]",Z="[object Uint8ClampedArray]",U="[object Uint16Array]",z="[object Uint32Array]",H=/\b__p \+= '';/g,q=/\b(__p \+=) '' \+/g,W=/(__e\(.*?\)|\b__t\)) \+\n'';/g,V=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(V.source),Q=RegExp(G.source),Y=/<%-([\s\S]+?)%>/g,J=/<%([\s\S]+?)%>/g,X=/<%=([\s\S]+?)%>/g,$=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ee=/^\w*$/,te=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ne=/[\\^$.*+?()[\]{}|]/g,re=RegExp(ne.source),ie=/^\s+/,oe=/\s/,ae=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,se=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,ce=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,le=/[()=,{}\[\]\/\s]/,fe=/\\(\\)?/g,he=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,de=/\w*$/,pe=/^[-+]0x[0-9a-f]+$/i,ve=/^0b[01]+$/i,me=/^\[object .+?Constructor\]$/,ye=/^0o[0-7]+$/i,ge=/^(?:0|[1-9]\d*)$/,be=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,we=/($^)/,xe=/['\n\r\u2028\u2029\\]/g,ke="\\ud800-\\udfff",Ee="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",_e="\\u2700-\\u27bf",Ae="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Oe="\\ufe0e\\ufe0f",Me="\\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",Ce="['\u2019]",Pe="["+ke+"]",Te="["+Me+"]",je="["+Ee+"]",Ie="\\d+",Ne="["+_e+"]",Re="["+Ae+"]",Be="[^"+ke+Me+Ie+_e+Ae+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Le="[^"+ke+"]",Fe="(?:\\ud83c[\\udde6-\\uddff]){2}",Ze="[\\ud800-\\udbff][\\udc00-\\udfff]",Ue="["+Se+"]",ze="\\u200d",He="(?:"+Re+"|"+Be+")",qe="(?:"+Ue+"|"+Be+")",We="(?:['\u2019](?:d|ll|m|re|s|t|ve))?",Ve="(?:['\u2019](?:D|LL|M|RE|S|T|VE))?",Ge="(?:"+je+"|"+De+")"+"?",Ke="["+Oe+"]?",Qe=Ke+Ge+("(?:"+ze+"(?:"+[Le,Fe,Ze].join("|")+")"+Ke+Ge+")*"),Ye="(?:"+[Ne,Fe,Ze].join("|")+")"+Qe,Je="(?:"+[Le+je+"?",je,Fe,Ze,Pe].join("|")+")",Xe=RegExp(Ce,"g"),$e=RegExp(je,"g"),et=RegExp(De+"(?="+De+")|"+Je+Qe,"g"),tt=RegExp([Ue+"?"+Re+"+"+We+"(?="+[Te,Ue,"$"].join("|")+")",qe+"+"+Ve+"(?="+[Te,Ue+He,"$"].join("|")+")",Ue+"?"+He+"+"+We,Ue+"+"+Ve,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,Ye].join("|"),"g"),nt=RegExp("["+ze+ke+Ee+Oe+"]"),rt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,it=["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"],ot=-1,at={};at[N]=at[R]=at[B]=at[D]=at[L]=at[F]=at[Z]=at[U]=at[z]=!0,at[m]=at[y]=at[j]=at[g]=at[I]=at[b]=at[w]=at[x]=at[E]=at[_]=at[A]=at[O]=at[M]=at[C]=at[T]=!1;var st={};st[m]=st[y]=st[j]=st[I]=st[g]=st[b]=st[N]=st[R]=st[B]=st[D]=st[L]=st[E]=st[_]=st[A]=st[O]=st[M]=st[C]=st[P]=st[F]=st[Z]=st[U]=st[z]=!0,st[w]=st[x]=st[T]=!1;var ut={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ct=parseFloat,lt=parseInt,ft="object"==typeof bu&&bu&&bu.Object===Object&&bu,ht="object"==typeof self&&self&&self.Object===Object&&self,dt=ft||ht||Function("return this")(),pt=t&&!t.nodeType&&t,vt=pt&&e&&!e.nodeType&&e,mt=vt&&vt.exports===pt,yt=mt&&ft.process,gt=function(){try{return vt&&vt.require&&vt.require("util").types||yt&&yt.binding&&yt.binding("util")}catch(e){}}(),bt=gt&>.isArrayBuffer,wt=gt&>.isDate,xt=gt&>.isMap,kt=gt&>.isRegExp,Et=gt&>.isSet,_t=gt&>.isTypedArray;function At(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function St(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function jt(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function tn(e,t){for(var n=e.length;n--&&Ut(t,e[n],0)>-1;);return n}var nn=Vt({"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a","\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I","\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"Ae","\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss","\u0100":"A","\u0102":"A","\u0104":"A","\u0101":"a","\u0103":"a","\u0105":"a","\u0106":"C","\u0108":"C","\u010a":"C","\u010c":"C","\u0107":"c","\u0109":"c","\u010b":"c","\u010d":"c","\u010e":"D","\u0110":"D","\u010f":"d","\u0111":"d","\u0112":"E","\u0114":"E","\u0116":"E","\u0118":"E","\u011a":"E","\u0113":"e","\u0115":"e","\u0117":"e","\u0119":"e","\u011b":"e","\u011c":"G","\u011e":"G","\u0120":"G","\u0122":"G","\u011d":"g","\u011f":"g","\u0121":"g","\u0123":"g","\u0124":"H","\u0126":"H","\u0125":"h","\u0127":"h","\u0128":"I","\u012a":"I","\u012c":"I","\u012e":"I","\u0130":"I","\u0129":"i","\u012b":"i","\u012d":"i","\u012f":"i","\u0131":"i","\u0134":"J","\u0135":"j","\u0136":"K","\u0137":"k","\u0138":"k","\u0139":"L","\u013b":"L","\u013d":"L","\u013f":"L","\u0141":"L","\u013a":"l","\u013c":"l","\u013e":"l","\u0140":"l","\u0142":"l","\u0143":"N","\u0145":"N","\u0147":"N","\u014a":"N","\u0144":"n","\u0146":"n","\u0148":"n","\u014b":"n","\u014c":"O","\u014e":"O","\u0150":"O","\u014d":"o","\u014f":"o","\u0151":"o","\u0154":"R","\u0156":"R","\u0158":"R","\u0155":"r","\u0157":"r","\u0159":"r","\u015a":"S","\u015c":"S","\u015e":"S","\u0160":"S","\u015b":"s","\u015d":"s","\u015f":"s","\u0161":"s","\u0162":"T","\u0164":"T","\u0166":"T","\u0163":"t","\u0165":"t","\u0167":"t","\u0168":"U","\u016a":"U","\u016c":"U","\u016e":"U","\u0170":"U","\u0172":"U","\u0169":"u","\u016b":"u","\u016d":"u","\u016f":"u","\u0171":"u","\u0173":"u","\u0174":"W","\u0175":"w","\u0176":"Y","\u0177":"y","\u0178":"Y","\u0179":"Z","\u017b":"Z","\u017d":"Z","\u017a":"z","\u017c":"z","\u017e":"z","\u0132":"IJ","\u0133":"ij","\u0152":"Oe","\u0153":"oe","\u0149":"'n","\u017f":"s"}),rn=Vt({"&":"&","<":"<",">":">",'"':""","'":"'"});function on(e){return"\\"+ut[e]}function an(e){return nt.test(e)}function sn(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function un(e,t){return function(n){return e(t(n))}}function cn(e,t){for(var n=-1,r=e.length,i=0,a=[];++n",""":'"',"'":"'"});var vn=function e(t){var oe=(t=null==t?dt:vn.defaults(dt.Object(),t,vn.pick(dt,it))).Array,ke=t.Date,Ee=t.Error,_e=t.Function,Ae=t.Math,Se=t.Object,Oe=t.RegExp,Me=t.String,Ce=t.TypeError,Pe=oe.prototype,Te=_e.prototype,je=Se.prototype,Ie=t["__core-js_shared__"],Ne=Te.toString,Re=je.hasOwnProperty,Be=0,De=function(){var e=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Le=je.toString,Fe=Ne.call(Se),Ze=dt._,Ue=Oe("^"+Ne.call(Re).replace(ne,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ze=mt?t.Buffer:n,He=t.Symbol,qe=t.Uint8Array,We=ze?ze.allocUnsafe:n,Ve=un(Se.getPrototypeOf,Se),Ge=Se.create,Ke=je.propertyIsEnumerable,Qe=Pe.splice,Ye=He?He.isConcatSpreadable:n,Je=He?He.iterator:n,et=He?He.toStringTag:n,nt=function(){try{var e=lo(Se,"defineProperty");return e({},"",{}),e}catch(t){}}(),ut=t.clearTimeout!==dt.clearTimeout&&t.clearTimeout,ft=ke&&ke.now!==dt.Date.now&&ke.now,ht=t.setTimeout!==dt.setTimeout&&t.setTimeout,pt=Ae.ceil,vt=Ae.floor,yt=Se.getOwnPropertySymbols,gt=ze?ze.isBuffer:n,Lt=t.isFinite,Vt=Pe.join,mn=un(Se.keys,Se),yn=Ae.max,gn=Ae.min,bn=ke.now,wn=t.parseInt,xn=Ae.random,kn=Pe.reverse,En=lo(t,"DataView"),_n=lo(t,"Map"),An=lo(t,"Promise"),Sn=lo(t,"Set"),On=lo(t,"WeakMap"),Mn=lo(Se,"create"),Cn=On&&new On,Pn={},Tn=Do(En),jn=Do(_n),In=Do(An),Nn=Do(Sn),Rn=Do(On),Bn=He?He.prototype:n,Dn=Bn?Bn.valueOf:n,Ln=Bn?Bn.toString:n;function Fn(e){if(es(e)&&!Ha(e)&&!(e instanceof Hn)){if(e instanceof zn)return e;if(Re.call(e,"__wrapped__"))return Lo(e)}return new zn(e)}var Zn=function(){function e(){}return function(t){if(!$a(t))return{};if(Ge)return Ge(t);e.prototype=t;var r=new e;return e.prototype=n,r}}();function Un(){}function zn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=n}function Hn(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=p,this.__views__=[]}function qn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function sr(e,t,r,i,o,a){var s,u=1&t,c=2&t,l=4&t;if(r&&(s=o?r(e,i,o,a):r(e)),s!==n)return s;if(!$a(e))return e;var f=Ha(e);if(f){if(s=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Re.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!u)return Mi(e,s)}else{var h=po(e),d=h==x||h==k;if(Ga(e))return ki(e,u);if(h==A||h==m||d&&!o){if(s=c||d?{}:mo(e),!u)return c?function(e,t){return Ci(e,ho(e),t)}(e,function(e,t){return e&&Ci(t,Ts(t),e)}(s,e)):function(e,t){return Ci(e,fo(e),t)}(e,rr(s,e))}else{if(!st[h])return o?e:{};s=function(e,t,n){var r=e.constructor;switch(t){case j:return Ei(e);case g:case b:return new r(+e);case I:return function(e,t){var n=t?Ei(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case R:case B:case D:case L:case F:case Z:case U:case z:return _i(e,n);case E:return new r;case _:case C:return new r(e);case O:return function(e){var t=new e.constructor(e.source,de.exec(e));return t.lastIndex=e.lastIndex,t}(e);case M:return new r;case P:return function(e){return Dn?Se(Dn.call(e)):{}}(e)}}(e,h,u)}}a||(a=new Kn);var p=a.get(e);if(p)return p;a.set(e,s),os(e)?e.forEach((function(n){s.add(sr(n,t,r,n,e,a))})):ts(e)&&e.forEach((function(n,i){s.set(i,sr(n,t,r,i,e,a))}));var v=f?n:(l?c?ro:no:c?Ts:Ps)(e);return Ot(v||e,(function(n,i){v&&(n=e[i=n]),er(s,i,sr(n,t,r,i,e,a))})),s}function ur(e,t,r){var i=r.length;if(null==e)return!i;for(e=Se(e);i--;){var o=r[i],a=t[o],s=e[o];if(s===n&&!(o in e)||!a(s))return!1}return!0}function cr(e,t,i){if("function"!=typeof e)throw new Ce(r);return Po((function(){e.apply(n,i)}),t)}function lr(e,t,n,r){var i=-1,o=Tt,a=!0,s=e.length,u=[],c=t.length;if(!s)return u;n&&(t=It(t,Jt(n))),r?(o=jt,a=!1):t.length>=200&&(o=$t,a=!1,t=new Gn(t));e:for(;++i-1},Wn.prototype.set=function(e,t){var n=this.__data__,r=tr(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Vn.prototype.clear=function(){this.size=0,this.__data__={hash:new qn,map:new(_n||Wn),string:new qn}},Vn.prototype.delete=function(e){var t=uo(this,e).delete(e);return this.size-=t?1:0,t},Vn.prototype.get=function(e){return uo(this,e).get(e)},Vn.prototype.has=function(e){return uo(this,e).has(e)},Vn.prototype.set=function(e,t){var n=uo(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,i),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new Wn,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Wn){var r=n.__data__;if(!_n||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Vn(r)}return n.set(e,t),this.size=n.size,this};var fr=ji(br),hr=ji(wr,!0);function dr(e,t){var n=!0;return fr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function pr(e,t,r){for(var i=-1,o=e.length;++i0&&n(s)?t>1?mr(s,t-1,n,r,i):Nt(i,s):r||(i[i.length]=s)}return i}var yr=Ii(),gr=Ii(!0);function br(e,t){return e&&yr(e,t,Ps)}function wr(e,t){return e&&gr(e,t,Ps)}function xr(e,t){return Pt(t,(function(t){return Ya(e[t])}))}function kr(e,t){for(var r=0,i=(t=gi(t,e)).length;null!=e&&rt}function Sr(e,t){return null!=e&&Re.call(e,t)}function Or(e,t){return null!=e&&t in Se(e)}function Mr(e,t,r){for(var i=r?jt:Tt,o=e[0].length,a=e.length,s=a,u=oe(a),c=1/0,l=[];s--;){var f=e[s];s&&t&&(f=It(f,Jt(t))),c=gn(f.length,c),u[s]=!r&&(t||o>=120&&f.length>=120)?new Gn(s&&f):n}f=e[0];var h=-1,d=u[0];e:for(;++h=s?u:u*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}))}function qr(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)s!==e&&Qe.call(s,u,1),Qe.call(e,u,1);return e}function Vr(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;go(i)?Qe.call(e,i,1):li(e,i)}}return e}function Gr(e,t){return e+vt(xn()*(t-e+1))}function Kr(e,t){var n="";if(!e||t<1||t>h)return n;do{t%2&&(n+=e),(t=vt(t/2))&&(e+=e)}while(t);return n}function Qr(e,t){return To(So(e,t,nu),e+"")}function Yr(e){return Yn(Fs(e))}function Jr(e,t){var n=Fs(e);return No(n,ar(t,0,n.length))}function Xr(e,t,r,i){if(!$a(e))return e;for(var o=-1,a=(t=gi(t,e)).length,s=a-1,u=e;null!=u&&++oi?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=oe(i);++r>>1,a=e[o];null!==a&&!ss(a)&&(n?a<=t:a=200){var c=t?null:Ki(e);if(c)return ln(c);a=!1,i=$t,u=new Gn}else u=t?[]:s;e:for(;++r=i?e:ni(e,t,r)}var xi=ut||function(e){return dt.clearTimeout(e)};function ki(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function Ei(e){var t=new e.constructor(e.byteLength);return new qe(t).set(new qe(e)),t}function _i(e,t){var n=t?Ei(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Ai(e,t){if(e!==t){var r=e!==n,i=null===e,o=e===e,a=ss(e),s=t!==n,u=null===t,c=t===t,l=ss(t);if(!u&&!l&&!a&&e>t||a&&s&&c&&!u&&!l||i&&s&&c||!r&&c||!o)return 1;if(!i&&!a&&!l&&e1?r[o-1]:n,s=o>2?r[2]:n;for(a=e.length>3&&"function"==typeof a?(o--,a):n,s&&bo(r[0],r[1],s)&&(a=o<3?n:a,o=1),t=Se(t);++i-1?o[a?t[s]:s]:n}}function Li(e){return to((function(t){var i=t.length,o=i,a=zn.prototype.thru;for(e&&t.reverse();o--;){var s=t[o];if("function"!=typeof s)throw new Ce(r);if(a&&!u&&"wrapper"==oo(s))var u=new zn([],!0)}for(o=u?o:i;++o1&&b.reverse(),h&&lu))return!1;var l=a.get(e),f=a.get(t);if(l&&f)return l==t&&f==e;var h=-1,d=!0,p=2&r?new Gn:n;for(a.set(e,t),a.set(t,e);++h-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(ae,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return Ot(v,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(se);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,r=0;return function(){var i=bn(),o=16-(i-r);if(r=i,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(n,arguments)}}function No(e,t){var r=-1,i=e.length,o=i-1;for(t=t===n?i:t;++r1?e[t-1]:n;return r="function"==typeof r?(e.pop(),r):n,ia(e,r)}));function fa(e){var t=Fn(e);return t.__chain__=!0,t}function ha(e,t){return t(e)}var da=to((function(e){var t=e.length,r=t?e[0]:0,i=this.__wrapped__,o=function(t){return or(t,e)};return!(t>1||this.__actions__.length)&&i instanceof Hn&&go(r)?((i=i.slice(r,+r+(t?1:0))).__actions__.push({func:ha,args:[o],thisArg:n}),new zn(i,this.__chain__).thru((function(e){return t&&!e.length&&e.push(n),e}))):this.thru(o)}));var pa=Pi((function(e,t,n){Re.call(e,n)?++e[n]:ir(e,n,1)}));var va=Di(zo),ma=Di(Ho);function ya(e,t){return(Ha(e)?Ot:fr)(e,so(t,3))}function ga(e,t){return(Ha(e)?Mt:hr)(e,so(t,3))}var ba=Pi((function(e,t,n){Re.call(e,n)?e[n].push(t):ir(e,n,[t])}));var wa=Qr((function(e,t,n){var r=-1,i="function"==typeof t,o=Wa(e)?oe(e.length):[];return fr(e,(function(e){o[++r]=i?At(t,e,n):Cr(e,t,n)})),o})),xa=Pi((function(e,t,n){ir(e,n,t)}));function ka(e,t){return(Ha(e)?It:Lr)(e,so(t,3))}var Ea=Pi((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]}));var _a=Qr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&bo(e,t[0],t[1])?t=[]:n>2&&bo(t[0],t[1],t[2])&&(t=[t[0]]),Hr(e,mr(t,1),[])})),Aa=ft||function(){return dt.Date.now()};function Sa(e,t,r){return t=r?n:t,t=e&&null==t?e.length:t,Yi(e,c,n,n,n,n,t)}function Oa(e,t){var i;if("function"!=typeof t)throw new Ce(r);return e=ds(e),function(){return--e>0&&(i=t.apply(this,arguments)),e<=1&&(t=n),i}}var Ma=Qr((function(e,t,n){var r=1;if(n.length){var i=cn(n,ao(Ma));r|=s}return Yi(e,r,t,n,i)})),Ca=Qr((function(e,t,n){var r=3;if(n.length){var i=cn(n,ao(Ca));r|=s}return Yi(t,r,e,n,i)}));function Pa(e,t,i){var o,a,s,u,c,l,f=0,h=!1,d=!1,p=!0;if("function"!=typeof e)throw new Ce(r);function v(t){var r=o,i=a;return o=a=n,f=t,u=e.apply(i,r)}function m(e){var r=e-l;return l===n||r>=t||r<0||d&&e-f>=s}function y(){var e=Aa();if(m(e))return g(e);c=Po(y,function(e){var n=t-(e-l);return d?gn(n,s-(e-f)):n}(e))}function g(e){return c=n,p&&o?v(e):(o=a=n,u)}function b(){var e=Aa(),r=m(e);if(o=arguments,a=this,l=e,r){if(c===n)return function(e){return f=e,c=Po(y,t),h?v(e):u}(l);if(d)return xi(c),c=Po(y,t),v(l)}return c===n&&(c=Po(y,t)),u}return t=vs(t)||0,$a(i)&&(h=!!i.leading,s=(d="maxWait"in i)?yn(vs(i.maxWait)||0,t):s,p="trailing"in i?!!i.trailing:p),b.cancel=function(){c!==n&&xi(c),f=0,o=l=a=c=n},b.flush=function(){return c===n?u:g(Aa())},b}var Ta=Qr((function(e,t){return cr(e,1,t)})),ja=Qr((function(e,t,n){return cr(e,vs(t)||0,n)}));function Ia(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new Ce(r);var n=function n(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Ia.Cache||Vn),n}function Na(e){if("function"!=typeof e)throw new Ce(r);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Ia.Cache=Vn;var Ra=bi((function(e,t){var n=(t=1==t.length&&Ha(t[0])?It(t[0],Jt(so())):It(mr(t,1),Jt(so()))).length;return Qr((function(r){for(var i=-1,o=gn(r.length,n);++i=t})),za=Pr(function(){return arguments}())?Pr:function(e){return es(e)&&Re.call(e,"callee")&&!Ke.call(e,"callee")},Ha=oe.isArray,qa=bt?Jt(bt):function(e){return es(e)&&_r(e)==j};function Wa(e){return null!=e&&Xa(e.length)&&!Ya(e)}function Va(e){return es(e)&&Wa(e)}var Ga=gt||vu,Ka=wt?Jt(wt):function(e){return es(e)&&_r(e)==b};function Qa(e){if(!es(e))return!1;var t=_r(e);return t==w||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!rs(e)}function Ya(e){if(!$a(e))return!1;var t=_r(e);return t==x||t==k||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Ja(e){return"number"==typeof e&&e==ds(e)}function Xa(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=h}function $a(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function es(e){return null!=e&&"object"==typeof e}var ts=xt?Jt(xt):function(e){return es(e)&&po(e)==E};function ns(e){return"number"==typeof e||es(e)&&_r(e)==_}function rs(e){if(!es(e)||_r(e)!=A)return!1;var t=Ve(e);if(null===t)return!0;var n=Re.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Ne.call(n)==Fe}var is=kt?Jt(kt):function(e){return es(e)&&_r(e)==O};var os=Et?Jt(Et):function(e){return es(e)&&po(e)==M};function as(e){return"string"==typeof e||!Ha(e)&&es(e)&&_r(e)==C}function ss(e){return"symbol"==typeof e||es(e)&&_r(e)==P}var us=_t?Jt(_t):function(e){return es(e)&&Xa(e.length)&&!!at[_r(e)]};var cs=Wi(Dr),ls=Wi((function(e,t){return e<=t}));function fs(e){if(!e)return[];if(Wa(e))return as(e)?hn(e):Mi(e);if(Je&&e[Je])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Je]());var t=po(e);return(t==E?sn:t==M?ln:Fs)(e)}function hs(e){return e?(e=vs(e))===f||e===-f?17976931348623157e292*(e<0?-1:1):e===e?e:0:0===e?e:0}function ds(e){var t=hs(e),n=t%1;return t===t?n?t-n:t:0}function ps(e){return e?ar(ds(e),0,p):0}function vs(e){if("number"==typeof e)return e;if(ss(e))return d;if($a(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=$a(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Yt(e);var n=ve.test(e);return n||ye.test(e)?lt(e.slice(2),n?2:8):pe.test(e)?d:+e}function ms(e){return Ci(e,Ts(e))}function ys(e){return null==e?"":ui(e)}var gs=Ti((function(e,t){if(Eo(t)||Wa(t))Ci(t,Ps(t),e);else for(var n in t)Re.call(t,n)&&er(e,n,t[n])})),bs=Ti((function(e,t){Ci(t,Ts(t),e)})),ws=Ti((function(e,t,n,r){Ci(t,Ts(t),e,r)})),xs=Ti((function(e,t,n,r){Ci(t,Ps(t),e,r)})),ks=to(or);var Es=Qr((function(e,t){e=Se(e);var r=-1,i=t.length,o=i>2?t[2]:n;for(o&&bo(t[0],t[1],o)&&(i=1);++r1),t})),Ci(e,ro(e),n),r&&(n=sr(n,7,$i));for(var i=t.length;i--;)li(n,t[i]);return n}));var Rs=to((function(e,t){return null==e?{}:function(e,t){return qr(e,t,(function(t,n){return Ss(e,n)}))}(e,t)}));function Bs(e,t){if(null==e)return{};var n=It(ro(e),(function(e){return[e]}));return t=so(t),qr(e,n,(function(e,n){return t(e,n[0])}))}var Ds=Qi(Ps),Ls=Qi(Ts);function Fs(e){return null==e?[]:Xt(e,Ps(e))}var Zs=Ri((function(e,t,n){return t=t.toLowerCase(),e+(n?Us(t):t)}));function Us(e){return Qs(ys(e).toLowerCase())}function zs(e){return(e=ys(e))&&e.replace(be,nn).replace($e,"")}var Hs=Ri((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),qs=Ri((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Ws=Ni("toLowerCase");var Vs=Ri((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}));var Gs=Ri((function(e,t,n){return e+(n?" ":"")+Qs(t)}));var Ks=Ri((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Qs=Ni("toUpperCase");function Ys(e,t,r){return e=ys(e),(t=r?n:t)===n?function(e){return rt.test(e)}(e)?function(e){return e.match(tt)||[]}(e):function(e){return e.match(ce)||[]}(e):e.match(t)||[]}var Js=Qr((function(e,t){try{return At(e,n,t)}catch(r){return Qa(r)?r:new Ee(r)}})),Xs=to((function(e,t){return Ot(t,(function(t){t=Bo(t),ir(e,t,Ma(e[t],e))})),e}));function $s(e){return function(){return e}}var eu=Li(),tu=Li(!0);function nu(e){return e}function ru(e){return Nr("function"==typeof e?e:sr(e,1))}var iu=Qr((function(e,t){return function(n){return Cr(n,e,t)}})),ou=Qr((function(e,t){return function(n){return Cr(e,n,t)}}));function au(e,t,n){var r=Ps(t),i=xr(t,r);null==n&&(!$a(t)||!i.length&&r.length)&&(n=t,t=e,e=this,i=xr(t,Ps(t)));var o=!($a(n)&&"chain"in n)||!!n.chain,a=Ya(e);return Ot(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Mi(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,Nt([this.value()],arguments))})})),e}function su(){}var uu=zi(It),cu=zi(Ct),lu=zi(Dt);function fu(e){return wo(e)?Wt(Bo(e)):function(e){return function(t){return kr(t,e)}}(e)}var hu=qi(),du=qi(!0);function pu(){return[]}function vu(){return!1}var mu=Ui((function(e,t){return e+t}),0),yu=Gi("ceil"),gu=Ui((function(e,t){return e/t}),1),bu=Gi("floor");var wu=Ui((function(e,t){return e*t}),1),xu=Gi("round"),ku=Ui((function(e,t){return e-t}),0);return Fn.after=function(e,t){if("function"!=typeof t)throw new Ce(r);return e=ds(e),function(){if(--e<1)return t.apply(this,arguments)}},Fn.ary=Sa,Fn.assign=gs,Fn.assignIn=bs,Fn.assignInWith=ws,Fn.assignWith=xs,Fn.at=ks,Fn.before=Oa,Fn.bind=Ma,Fn.bindAll=Xs,Fn.bindKey=Ca,Fn.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Ha(e)?e:[e]},Fn.chain=fa,Fn.chunk=function(e,t,r){t=(r?bo(e,t,r):t===n)?1:yn(ds(t),0);var i=null==e?0:e.length;if(!i||t<1)return[];for(var o=0,a=0,s=oe(pt(i/t));oo?0:o+r),(i=i===n||i>o?o:ds(i))<0&&(i+=o),i=r>i?0:ps(i);r>>0)?(e=ys(e))&&("string"==typeof t||null!=t&&!is(t))&&(!(t=ui(t))&&an(e))?wi(hn(e),0,r):e.split(t,r):[]},Fn.spread=function(e,t){if("function"!=typeof e)throw new Ce(r);return t=null==t?0:yn(ds(t),0),Qr((function(n){var r=n[t],i=wi(n,0,t);return r&&Nt(i,r),At(e,this,i)}))},Fn.tail=function(e){var t=null==e?0:e.length;return t?ni(e,1,t):[]},Fn.take=function(e,t,r){return e&&e.length?ni(e,0,(t=r||t===n?1:ds(t))<0?0:t):[]},Fn.takeRight=function(e,t,r){var i=null==e?0:e.length;return i?ni(e,(t=i-(t=r||t===n?1:ds(t)))<0?0:t,i):[]},Fn.takeRightWhile=function(e,t){return e&&e.length?hi(e,so(t,3),!1,!0):[]},Fn.takeWhile=function(e,t){return e&&e.length?hi(e,so(t,3)):[]},Fn.tap=function(e,t){return t(e),e},Fn.throttle=function(e,t,n){var i=!0,o=!0;if("function"!=typeof e)throw new Ce(r);return $a(n)&&(i="leading"in n?!!n.leading:i,o="trailing"in n?!!n.trailing:o),Pa(e,t,{leading:i,maxWait:t,trailing:o})},Fn.thru=ha,Fn.toArray=fs,Fn.toPairs=Ds,Fn.toPairsIn=Ls,Fn.toPath=function(e){return Ha(e)?It(e,Bo):ss(e)?[e]:Mi(Ro(ys(e)))},Fn.toPlainObject=ms,Fn.transform=function(e,t,n){var r=Ha(e),i=r||Ga(e)||us(e);if(t=so(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:$a(e)&&Ya(o)?Zn(Ve(e)):{}}return(i?Ot:br)(e,(function(e,r,i){return t(n,e,r,i)})),n},Fn.unary=function(e){return Sa(e,1)},Fn.union=ea,Fn.unionBy=ta,Fn.unionWith=na,Fn.uniq=function(e){return e&&e.length?ci(e):[]},Fn.uniqBy=function(e,t){return e&&e.length?ci(e,so(t,2)):[]},Fn.uniqWith=function(e,t){return t="function"==typeof t?t:n,e&&e.length?ci(e,n,t):[]},Fn.unset=function(e,t){return null==e||li(e,t)},Fn.unzip=ra,Fn.unzipWith=ia,Fn.update=function(e,t,n){return null==e?e:fi(e,t,yi(n))},Fn.updateWith=function(e,t,r,i){return i="function"==typeof i?i:n,null==e?e:fi(e,t,yi(r),i)},Fn.values=Fs,Fn.valuesIn=function(e){return null==e?[]:Xt(e,Ts(e))},Fn.without=oa,Fn.words=Ys,Fn.wrap=function(e,t){return Ba(yi(t),e)},Fn.xor=aa,Fn.xorBy=sa,Fn.xorWith=ua,Fn.zip=ca,Fn.zipObject=function(e,t){return vi(e||[],t||[],er)},Fn.zipObjectDeep=function(e,t){return vi(e||[],t||[],Xr)},Fn.zipWith=la,Fn.entries=Ds,Fn.entriesIn=Ls,Fn.extend=bs,Fn.extendWith=ws,au(Fn,Fn),Fn.add=mu,Fn.attempt=Js,Fn.camelCase=Zs,Fn.capitalize=Us,Fn.ceil=yu,Fn.clamp=function(e,t,r){return r===n&&(r=t,t=n),r!==n&&(r=(r=vs(r))===r?r:0),t!==n&&(t=(t=vs(t))===t?t:0),ar(vs(e),t,r)},Fn.clone=function(e){return sr(e,4)},Fn.cloneDeep=function(e){return sr(e,5)},Fn.cloneDeepWith=function(e,t){return sr(e,5,t="function"==typeof t?t:n)},Fn.cloneWith=function(e,t){return sr(e,4,t="function"==typeof t?t:n)},Fn.conformsTo=function(e,t){return null==t||ur(e,t,Ps(t))},Fn.deburr=zs,Fn.defaultTo=function(e,t){return null==e||e!==e?t:e},Fn.divide=gu,Fn.endsWith=function(e,t,r){e=ys(e),t=ui(t);var i=e.length,o=r=r===n?i:ar(ds(r),0,i);return(r-=t.length)>=0&&e.slice(r,o)==t},Fn.eq=Fa,Fn.escape=function(e){return(e=ys(e))&&Q.test(e)?e.replace(G,rn):e},Fn.escapeRegExp=function(e){return(e=ys(e))&&re.test(e)?e.replace(ne,"\\$&"):e},Fn.every=function(e,t,r){var i=Ha(e)?Ct:dr;return r&&bo(e,t,r)&&(t=n),i(e,so(t,3))},Fn.find=va,Fn.findIndex=zo,Fn.findKey=function(e,t){return Ft(e,so(t,3),br)},Fn.findLast=ma,Fn.findLastIndex=Ho,Fn.findLastKey=function(e,t){return Ft(e,so(t,3),wr)},Fn.floor=bu,Fn.forEach=ya,Fn.forEachRight=ga,Fn.forIn=function(e,t){return null==e?e:yr(e,so(t,3),Ts)},Fn.forInRight=function(e,t){return null==e?e:gr(e,so(t,3),Ts)},Fn.forOwn=function(e,t){return e&&br(e,so(t,3))},Fn.forOwnRight=function(e,t){return e&&wr(e,so(t,3))},Fn.get=As,Fn.gt=Za,Fn.gte=Ua,Fn.has=function(e,t){return null!=e&&vo(e,t,Sr)},Fn.hasIn=Ss,Fn.head=Wo,Fn.identity=nu,Fn.includes=function(e,t,n,r){e=Wa(e)?e:Fs(e),n=n&&!r?ds(n):0;var i=e.length;return n<0&&(n=yn(i+n,0)),as(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&Ut(e,t,n)>-1},Fn.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:ds(n);return i<0&&(i=yn(r+i,0)),Ut(e,t,i)},Fn.inRange=function(e,t,r){return t=hs(t),r===n?(r=t,t=0):r=hs(r),function(e,t,n){return e>=gn(t,n)&&e=-h&&e<=h},Fn.isSet=os,Fn.isString=as,Fn.isSymbol=ss,Fn.isTypedArray=us,Fn.isUndefined=function(e){return e===n},Fn.isWeakMap=function(e){return es(e)&&po(e)==T},Fn.isWeakSet=function(e){return es(e)&&"[object WeakSet]"==_r(e)},Fn.join=function(e,t){return null==e?"":Vt.call(e,t)},Fn.kebabCase=Hs,Fn.last=Qo,Fn.lastIndexOf=function(e,t,r){var i=null==e?0:e.length;if(!i)return-1;var o=i;return r!==n&&(o=(o=ds(r))<0?yn(i+o,0):gn(o,i-1)),t===t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Zt(e,Ht,o,!0)},Fn.lowerCase=qs,Fn.lowerFirst=Ws,Fn.lt=cs,Fn.lte=ls,Fn.max=function(e){return e&&e.length?pr(e,nu,Ar):n},Fn.maxBy=function(e,t){return e&&e.length?pr(e,so(t,2),Ar):n},Fn.mean=function(e){return qt(e,nu)},Fn.meanBy=function(e,t){return qt(e,so(t,2))},Fn.min=function(e){return e&&e.length?pr(e,nu,Dr):n},Fn.minBy=function(e,t){return e&&e.length?pr(e,so(t,2),Dr):n},Fn.stubArray=pu,Fn.stubFalse=vu,Fn.stubObject=function(){return{}},Fn.stubString=function(){return""},Fn.stubTrue=function(){return!0},Fn.multiply=wu,Fn.nth=function(e,t){return e&&e.length?zr(e,ds(t)):n},Fn.noConflict=function(){return dt._===this&&(dt._=Ze),this},Fn.noop=su,Fn.now=Aa,Fn.pad=function(e,t,n){e=ys(e);var r=(t=ds(t))?fn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Hi(vt(i),n)+e+Hi(pt(i),n)},Fn.padEnd=function(e,t,n){e=ys(e);var r=(t=ds(t))?fn(e):0;return t&&rt){var i=e;e=t,t=i}if(r||e%1||t%1){var o=xn();return gn(e+o*(t-e+ct("1e-"+((o+"").length-1))),t)}return Gr(e,t)},Fn.reduce=function(e,t,n){var r=Ha(e)?Rt:Gt,i=arguments.length<3;return r(e,so(t,4),n,i,fr)},Fn.reduceRight=function(e,t,n){var r=Ha(e)?Bt:Gt,i=arguments.length<3;return r(e,so(t,4),n,i,hr)},Fn.repeat=function(e,t,r){return t=(r?bo(e,t,r):t===n)?1:ds(t),Kr(ys(e),t)},Fn.replace=function(){var e=arguments,t=ys(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Fn.result=function(e,t,r){var i=-1,o=(t=gi(t,e)).length;for(o||(o=1,e=n);++ih)return[];var n=p,r=gn(e,p);t=so(t),e-=p;for(var i=Qt(r,t);++n=a)return e;var u=r-fn(i);if(u<1)return i;var c=s?wi(s,0,u).join(""):e.slice(0,u);if(o===n)return c+i;if(s&&(u+=c.length-u),is(o)){if(e.slice(u).search(o)){var l,f=c;for(o.global||(o=Oe(o.source,ys(de.exec(o))+"g")),o.lastIndex=0;l=o.exec(f);)var h=l.index;c=c.slice(0,h===n?u:h)}}else if(e.indexOf(ui(o),u)!=u){var d=c.lastIndexOf(o);d>-1&&(c=c.slice(0,d))}return c+i},Fn.unescape=function(e){return(e=ys(e))&&K.test(e)?e.replace(V,pn):e},Fn.uniqueId=function(e){var t=++Be;return ys(e)+t},Fn.upperCase=Ks,Fn.upperFirst=Qs,Fn.each=ya,Fn.eachRight=ga,Fn.first=Wo,au(Fn,function(){var e={};return br(Fn,(function(t,n){Re.call(Fn.prototype,n)||(e[n]=t)})),e}(),{chain:!1}),Fn.VERSION="4.17.21",Ot(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Fn[e].placeholder=Fn})),Ot(["drop","take"],(function(e,t){Hn.prototype[e]=function(r){r=r===n?1:yn(ds(r),0);var i=this.__filtered__&&!t?new Hn(this):this.clone();return i.__filtered__?i.__takeCount__=gn(r,i.__takeCount__):i.__views__.push({size:gn(r,p),type:e+(i.__dir__<0?"Right":"")}),i},Hn.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),Ot(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Hn.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:so(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),Ot(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Hn.prototype[e]=function(){return this[n](1).value()[0]}})),Ot(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Hn.prototype[e]=function(){return this.__filtered__?new Hn(this):this[n](1)}})),Hn.prototype.compact=function(){return this.filter(nu)},Hn.prototype.find=function(e){return this.filter(e).head()},Hn.prototype.findLast=function(e){return this.reverse().find(e)},Hn.prototype.invokeMap=Qr((function(e,t){return"function"==typeof e?new Hn(this):this.map((function(n){return Cr(n,e,t)}))})),Hn.prototype.reject=function(e){return this.filter(Na(so(e)))},Hn.prototype.slice=function(e,t){e=ds(e);var r=this;return r.__filtered__&&(e>0||t<0)?new Hn(r):(e<0?r=r.takeRight(-e):e&&(r=r.drop(e)),t!==n&&(r=(t=ds(t))<0?r.dropRight(-t):r.take(t-e)),r)},Hn.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Hn.prototype.toArray=function(){return this.take(p)},br(Hn.prototype,(function(e,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),i=/^(?:head|last)$/.test(t),o=Fn[i?"take"+("last"==t?"Right":""):t],a=i||/^find/.test(t);o&&(Fn.prototype[t]=function(){var t=this.__wrapped__,s=i?[1]:arguments,u=t instanceof Hn,c=s[0],l=u||Ha(t),f=function(e){var t=o.apply(Fn,Nt([e],s));return i&&h?t[0]:t};l&&r&&"function"==typeof c&&1!=c.length&&(u=l=!1);var h=this.__chain__,d=!!this.__actions__.length,p=a&&!h,v=u&&!d;if(!a&&l){t=v?t:new Hn(this);var m=e.apply(t,s);return m.__actions__.push({func:ha,args:[f],thisArg:n}),new zn(m,h)}return p&&v?e.apply(this,s):(m=this.thru(f),p?i?m.value()[0]:m.value():m)})})),Ot(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Pe[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Fn.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Ha(i)?i:[],e)}return this[n]((function(n){return t.apply(Ha(n)?n:[],e)}))}})),br(Hn.prototype,(function(e,t){var n=Fn[t];if(n){var r=n.name+"";Re.call(Pn,r)||(Pn[r]=[]),Pn[r].push({name:t,func:n})}})),Pn[Fi(n,2).name]=[{name:"wrapper",func:n}],Hn.prototype.clone=function(){var e=new Hn(this.__wrapped__);return e.__actions__=Mi(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Mi(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Mi(this.__views__),e},Hn.prototype.reverse=function(){if(this.__filtered__){var e=new Hn(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Hn.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Ha(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?n:this.__values__[this.__index__++]}},Fn.prototype.plant=function(e){for(var t,r=this;r instanceof Un;){var i=Lo(r);i.__index__=0,i.__values__=n,t?o.__wrapped__=i:t=i;var o=i;r=r.__wrapped__}return o.__wrapped__=e,t},Fn.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Hn){var t=e;return this.__actions__.length&&(t=new Hn(this)),(t=t.reverse()).__actions__.push({func:ha,args:[$o],thisArg:n}),new zn(t,this.__chain__)}return this.thru($o)},Fn.prototype.toJSON=Fn.prototype.valueOf=Fn.prototype.value=function(){return di(this.__wrapped__,this.__actions__)},Fn.prototype.first=Fn.prototype.head,Je&&(Fn.prototype[Je]=function(){return this}),Fn}();vt?((vt.exports=vn)._=vn,pt._=vn):dt._=vn}).call(bu)}(wu,wu.exports);var xu=Object.defineProperty,ku=Object.defineProperties,Eu=Object.getOwnPropertyDescriptors,_u=Object.getOwnPropertySymbols,Au=Object.prototype.hasOwnProperty,Su=Object.prototype.propertyIsEnumerable,Ou=function(e,t,n){return t in e?xu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},Mu=function(e,t){for(var n in t||(t={}))Au.call(t,n)&&Ou(e,n,t[n]);if(_u){var r,i=(0,_.Z)(_u(t));try{for(i.s();!(r=i.n()).done;){n=r.value;Su.call(t,n)&&Ou(e,n,t[n])}}catch(o){i.e(o)}finally{i.f()}}return e},Cu=function(e,t){return ku(e,Eu(t))};function Pu(e,t,n){var r,i=Tu(e);return t.rpcMap&&(r=t.rpcMap[i]),r||(r="".concat("https://rpc.walletconnect.com/v1","?chainId=eip155:").concat(i,"&projectId=").concat(n)),r}function Tu(e){return e.includes("eip155")?Number(e.split(":")[1]):Number(e)}function ju(e){return e.map((function(e){return"".concat(e.split(":")[0],":").concat(e.split(":")[1])}))}function Iu(e){var t,n,r,i,o={};if(!pu(e))return o;for(var a=0,s=Object.entries(e);a