PageSourceSearch

https://sophon-account-sso-account-server.vercel.app/_next/static/…?dpl=dpl_BzpXcF3kqjbLkFcWaXcmA7sYQfcp

js sophon-account-sso-account-server.vercel.app collected 2026-10-03 07:46:52 UTC 452,238 bytes, 6 lines download raw bytes

1try{!function(){var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="6b757174-b0ae-4700-90cb-3c5046338eaf",e._sentryDebugIdIdentifier="sentry-dbid-6b757174-b0ae-4700-90cb-3c5046338eaf")}()}catch(e){}"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1577],{65177:(e,t,n)=>{let r;n.d(t,{Mb:()=>cy});var i,o=n(95120),a=n.n(o),s=n(28944),l=n.n(s),c=n(45100),d=n(65405),u=n.n(d),h=n(17640),f=n(18056),p=n(14298);function g(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(a,s)}l((r=r.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;var m=void 0!==n.g?n.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},y=[],v=[],b="undefined"!=typeof Uint8Array?Uint8Array:Array,E=!1;function w(){E=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)y[t]=e[t],v[e.charCodeAt(t)]=t;v[45]=62,v[95]=63}function S(e){var t;E||w();for(var n=e.length,r=n%3,i="",o=[],a=0,s=n-r;a<s;a+=16383)o.push(function(e,t,n){for(var r,i=[],o=t;o<n;o+=3)i.push(y[(r=(e[o]<<16)+(e[o+1]<<8)+e[o+2])>>18&63]+y[r>>12&63]+y[r>>6&63]+y[63&r]);return i.join("")}(e,a,a+16383>s?s:a+16383));return 1===r?(i+=y[(t=e[n-1])>>2],i+=y[t<<4&63],i+="=="):2===r&&(i+=y[(t=(e[n-2]<<8)+e[n-1])>>10],i+=y[t>>4&63],i+=y[t<<2&63],i+="="),o.push(i),o.join("")}function _(e,t,n,r,i){var o,a,s=8*i-r-1,l=(1<<s)-1,c=l>>1,d=-7,u=n?i-1:0,h=n?-1:1,f=e[t+u];for(u+=h,o=f&(1<<-d)-1,f>>=-d,d+=s;d>0;o=256*o+e[t+u],u+=h,d-=8);for(a=o&(1<<-d)-1,o>>=-d,d+=r;d>0;a=256*a+e[t+u],u+=h,d-=8);if(0===o)o=1-c;else{if(o===l)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,r),o-=c}return(f?-1:1)*a*Math.pow(2,o-r)}function C(e,t,n,r,i,o){var a,s,l,c=8*o-i-1,d=(1<<c)-1,u=d>>1,h=5960464477539062e-23*(23===i),f=r?0:o-1,p=r?1:-1,g=+(t<0||0===t&&1/t<0);for(isNaN(t=Math.abs(t))||t===1/0?(s=+!!isNaN(t),a=d):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),(t+=a+u>=1?h/l:h*Math.pow(2,1-u))*l>=2&&(a++,l/=2),a+u>=d?(s=0,a=d):a+u>=1?(s=(t*l-1)*Math.pow(2,i),a+=u):(s=t*Math.pow(2,u-1)*Math.pow(2,i),a=0));i>=8;e[n+f]=255&s,f+=p,s/=256,i-=8);for(a=a<<i|s,c+=i;c>0;e[n+f]=255&a,f+=p,a/=256,c-=8);e[n+f-p]|=128*g}var x={}.toString,k=Array.isArray||function(e){return"[object Array]"==x.call(e)};T.TYPED_ARRAY_SUPPORT=void 0===m.TYPED_ARRAY_SUPPORT||m.TYPED_ARRAY_SUPPORT;var A=M();function M(){return T.TYPED_ARRAY_SUPPORT?0x7fffffff:0x3fffffff}function I(e,t){if(M()<t)throw RangeError("Invalid typed array length");return T.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=T.prototype:(null===e&&(e=new T(t)),e.length=t),e}function T(e,t,n){if(!(T.TYPED_ARRAY_SUPPORT||this instanceof T))return new T(e,t,n);if("number"==typeof e){if("string"==typeof t)throw Error("If encoding is specified then the first argument must be a string");return O(this,e)}return R(this,e,t,n)}function R(e,t,n,r){if("number"==typeof t)throw TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,n,r){if(t.byteLength,n<0||t.byteLength<n)throw RangeError("'offset' is out of bounds");if(t.byteLength<n+(r||0))throw RangeError("'length' is out of bounds");return t=void 0===n&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,n):new Uint8Array(t,n,r),T.TYPED_ARRAY_SUPPORT?(e=t).__proto__=T.prototype:e=N(e,t),e}(e,t,n,r):"string"==typeof t?function(e,t,n){if("string"==typeof n&&""!==n||(n="utf8"),!T.isEncoding(n))throw TypeError('"encoding" must be a valid string encoding');var r=0|$(t,n),i=(e=I(e,r)).write(t,n);return i!==r&&(e=e.slice(0,i)),e}(e,t,n):function(e,t){if(D(t)){var n,r=0|L(t.length);return 0===(e=I(e,r)).length||t.copy(e,0,0,r),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(n=t.length)!=n?I(e,0):N(e,t);if("Buffer"===t.type&&k(t.data))return N(e,t.data)}throw TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function P(e){if("number"!=typeof e)throw TypeError('"size" argument must be a number');if(e<0)throw RangeError('"size" argument must not be negative')}function O(e,t){if(P(t),e=I(e,t<0?0:0|L(t)),!T.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function N(e,t){var n=t.length<0?0:0|L(t.length);e=I(e,n);for(var r=0;r<n;r+=1)e[r]=255&t[r];return e}function L(e){if(e>=M())throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+M().toString(16)+" bytes");return 0|e}function D(e){return!(null==e||!e._isBuffer)}function $(e,t){if(D(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&
vendor: 4,705 bytes, line 1
1(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return X(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return ee(e).length;default:if(r)return X(e).length;t=(""+t).toLowerCase(),r=!0}}function B(e,t,n){var r,i,o,a=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===n||n>this.length)&&(n=this.length),n<=0)||(n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,n){var r,i=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>i)&&(n=i);for(var o="",a=t;a<n;++a){o+=(r=e[a])<16?"0"+r.toString(16):r.toString(16)}return o}(this,t,n);case"utf8":case"utf-8":return F(this,t,n);case"ascii":return function(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}(this,t,n);case"latin1":case"binary":return function(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}(this,t,n);case"base64":return r=this,i=t,o=n,0===i&&o===r.length?S(r):S(r.slice(i,o));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(e,t,n){for(var r=e.slice(t,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}(this,t,n);default:if(a)throw TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),a=!0}}function K(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function j(e,t,n,r,i){if(0===e.length)return -1;if("string"==typeof n?(r=n,n=0):n>0x7fffffff?n=0x7fffffff:n<-0x80000000&&(n=-0x80000000),isNaN(n*=1)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return -1;n=e.length-1}else if(n<0){if(!i)return -1;n=0}if("string"==typeof t&&(t=T.from(t,r)),D(t))return 0===t.length?-1:U(e,t,n,r,i);if("number"==typeof t)return t&=255,T.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):U(e,[t],n,r,i);throw TypeError("val must be string, number or Buffer")}function U(e,t,n,r,i){var o,a=1,s=e.length,l=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return -1;a=2,s/=2,l/=2,n/=2}function c(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var d=-1;for(o=n;o<s;o++)if(c(e,o)===c(t,-1===d?0:o-d)){if(-1===d&&(d=o),o-d+1===l)return d*a}else -1!==d&&(o-=o-d),d=-1}else for(n+l>s&&(n=s-l),o=n;o>=0;o--){for(var u=!0,h=0;h<l;h++)if(c(e,o+h)!==c(t,h)){u=!1;break}if(u)return o}return -1}function H(e,t,n,r){return et(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function F(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i<n;){var o,a,s,l,c=e[i],d=null,u=c>239?4:c>223?3:c>191?2:1;if(i+u<=n)switch(u){case 1:c<128&&(d=c);break;case 2:128==(192&(o=e[i+1]))&&(l=(31&c)<<6|63&o)>127&&(d=l);break;case 3:o=e[i+1],a=e[i+2],128==(192&o)&&128==(192&a)&&(l=(15&c)<<12|(63&o)<<6|63&a)>2047&&(l<55296||l>57343)&&(d=l);break;case 4:o=e[i+1],a=e[i+2],s=e[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(l=(15&c)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&l<1114112&&(d=l)}null===d?(d=65533,u=1):d>65535&&(d-=65536,r.push(d>>>10&1023|55296),d=56320|1023&d),r.push(d),i+=u}var h=r.length;if(h<=z)return String.fromCharCode.apply(String,r);for(var f="",p=0;p<h;)f+=String.fromCharCode.apply(String,r.slice(p,p+=z));return f}T.poolSize=8192,T._augment=function(e){return e.__proto__=T.prototype,e},T.from=function(e,t,n){return R(null,e,t,n)},T.TYPED_ARRAY_SUPPORT&&(T.prototype.__proto__=Uint8Array.prototype,T.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&T[Symbol.species]),T.alloc=function(e,t,n){return P(e),e<=0?I(null,e):void 0!==t?"string"==typeof n?I(null,e).fill(t,n):I(null,e).fill(t):I(null,e)},T.allocUnsafe=function(e){return O(null,e)},T.allocUnsafeSlow=function(e){return O(null,e)},T.isBuffer=en,T.compare=function(e,t){if(!D(e)||!D(t))throw TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n,r);i<o;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:+(r<n)},T.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},T.concat=function(e,t){if(!k(e))throw TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return T.alloc(0);if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var n,r=T.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var o=e[n];
vendor: 10,679 bytes, line 1
1if(!D(o))throw TypeError('"list" argument must be an Array of Buffers');o.copy(r,i),i+=o.length}return r},T.byteLength=$,T.prototype._isBuffer=!0,T.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)K(this,t,t+1);return this},T.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)K(this,t,t+3),K(this,t+1,t+2);return this},T.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)K(this,t,t+7),K(this,t+1,t+6),K(this,t+2,t+5),K(this,t+3,t+4);return this},T.prototype.toString=function(){var e=0|this.length;return 0===e?"":0==arguments.length?F(this,0,e):B.apply(this,arguments)},T.prototype.equals=function(e){if(!D(e))throw TypeError("Argument must be a Buffer");return this===e||0===T.compare(this,e)},T.prototype.inspect=function(){var e="";return this.length>0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),"<Buffer "+e+">"},T.prototype.compare=function(e,t,n,r,i){if(!D(e))throw TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return -1;if(t>=n)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0),s=Math.min(o,a),l=this.slice(r,i),c=e.slice(t,n),d=0;d<s;++d)if(l[d]!==c[d]){o=l[d],a=c[d];break}return o<a?-1:+(a<o)},T.prototype.includes=function(e,t,n){return -1!==this.indexOf(e,t,n)},T.prototype.indexOf=function(e,t,n){return j(this,e,t,n,!0)},T.prototype.lastIndexOf=function(e,t,n){return j(this,e,t,n,!1)},T.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i,o,a,s,l,c,d=this.length-t;if((void 0===n||n>d)&&(n=d),e.length>0&&(n<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var u=!1;;)switch(r){case"hex":return function(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=t.length;if(o%2!=0)throw TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a<r;++a){var s=parseInt(t.substr(2*a,2),16);if(isNaN(s))break;e[n+a]=s}return a}(this,e,t,n);case"utf8":case"utf-8":return i=t,o=n,et(X(e,this.length-i),this,i,o);case"ascii":case"latin1":case"binary":return H(this,e,t,n);case"base64":return a=t,s=n,et(ee(e),this,a,s);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return l=t,c=n,et(function(e,t){for(var n,r,i=[],o=0;o<e.length&&!((t-=2)<0);++o)r=(n=e.charCodeAt(o))>>8,i.push(n%256),i.push(r);return i}(e,this.length-l),this,l,c);default:if(u)throw TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),u=!0}},T.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var z=4096;function q(e,t,n){if(e%1!=0||e<0)throw RangeError("offset is not uint");if(e+t>n)throw RangeError("Trying to access beyond buffer length")}function W(e,t,n,r,i,o){if(!D(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw RangeError('"value" argument is out of bounds');if(n+r>e.length)throw RangeError("Index out of range")}function V(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i<o;++i)e[n+i]=(t&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function G(e,t,n,r){t<0&&(t=0xffffffff+t+1);for(var i=0,o=Math.min(e.length-n,4);i<o;++i)e[n+i]=t>>>8*(r?i:3-i)&255}function Y(e,t,n,r,i,o){if(n+r>e.length||n<0)throw RangeError("Index out of range")}function Z(e,t,n,r,i){return i||Y(e,0,n,4),C(e,t,n,r,23,4),n+4}function J(e,t,n,r,i){return i||Y(e,0,n,8),C(e,t,n,r,52,8),n+8}T.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e),T.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=T.prototype;else{var i=t-e;n=new T(i,void 0);for(var o=0;o<i;++o)n[o]=this[o+e]}return n},T.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||q(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r},T.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||q(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},T.prototype.readUInt8=function(e,t){return t||q(e,1,this.length),this[e]},T.prototype.readUInt16LE=function(e,t){return t||q(e,2,this.length),this[e]|this[e+1]<<8},T.prototype.readUInt16BE=function(e,t){return t||q(e,2,this.length),this[e]<<8|this[e+1]},T.prototype.readUInt32LE=function(e,t){return t||q(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+0x1000000*this[e+3]},T.prototype.readUInt32BE=function(e,t){return t||q(e,4,this.length),0x1000000*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},T.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||q(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*t)),r},T.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||q(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},T.prototype.readInt8=function(e,t){return t||q(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},T.prototype.readInt16LE=function(e,t){t||q(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?0xffff0000|n:n},T.prototype.readInt16BE=function(e,t){t||q(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?0xffff0000|n:n},T.prototype.readInt32LE=function(e,t){return t||q(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},T.prototype.readInt32BE=function(e,t){return t||q(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},T.prototype.readFloatLE=function(e,t){return t||q(e,4,this.length),_(this,e,!0,23,4)},T.prototype.readFloatBE=function(e,t){return t||q(e,4,this.length),_(this,e,!1,23,4)},T.prototype.readDoubleLE=function(e,t){return t||q(e,8,this.length),_(this,e,!0,52,8)},T.prototype.readDoubleBE=function(e,t){return t||q(e,8,this.length),_(this,e,!1,52,8)},T.prototype.writeUIntLE=function(e,t,n,r){e*=1,t|=0,n|=0,r||W(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[t]=255&e;++o<n&&(i*=256);)this[t+o]=e/i&255;return t+n},T.prototype.writeUIntBE=function(e,t,n,r){e*=1,t|=0,n|=0,r||W(this,e,t,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+n},T.prototype.writeUInt8=function(e,t,n){return e*=1,t|=0,n||W(this,e,t,1,255,0),T.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},T.prototype.writeUInt16LE=function(e,t,n){return e*=1,t|=0,n||W(this,e,t,2,65535,0),T.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):V(this,e,t,!0),t+2},T.prototype.writeUInt16BE=function(e,t,n){return e*=1,t|=0,n||W(this,e,t,2,65535,0),T.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):V(this,e,t,!1),t+2},T.prototype.writeUInt32LE=function(e,t,n){return e*=1,t|=0,n||W(this,e,t,4,0xffffffff,0),T.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):G(this,e,t,!0),t+4},T.prototype.writeUInt32BE=function(e,t,n){return e*=1,t|=0,n||W(this,e,t,4,0xffffffff,0),T.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):G(this,e,t,!1),t+4},T.prototype.writeIntLE=function(e,t,n,r){if(e*=1,t|=0,!r){var i=Math.pow(2,8*n-1);W(this,e,t,n,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o<n&&(a*=256);)e<0&&0===s&&0!==this[t+o-1]&&(s=1),this[t+o]=(e/a|0)-s&255;return t+n},T.prototype.writeIntBE=function(e,t,n,r){if(e*=1,t|=0,!r){var i=Math.pow(2,8*n-1);W(this,e,t,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a|0)-s&255;return t+n},T.prototype.writeInt8=function(e,t,n){return e*=1,t|=0,n||W(this,e,t,1,127,-128),T.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},T.prototype.writeInt16LE=function(e,t,n){return e*=1,t|=0,n||W(this,e,t,2,32767,-32768),T.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):V(this,e,t,!0),t+2},T.prototype.writeInt16BE=function(e,t,n){return e*=1,t|=0,n||W(this,e,t,2,32767,-32768),T.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):V(this,e,t,!1),t+2},T.prototype.writeInt32LE=function(e,t,n){return e*=1,t|=0,n||W(this,e,t,4,0x7fffffff,-0x80000000),T.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):G(this,e,t,!0),t+4},T.prototype.writeInt32BE=function(e,t,n){return e*=1,t|=0,n||W(this,e,t,4,0x7fffffff,-0x80000000),e<0&&(e=0xffffffff+e+1),T.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):G(this,e,t,!1),t+4},T.prototype.writeFloatLE=function(e,t,n){return Z(this,e,t,!0,n)},T.prototype.writeFloatBE=function(e,t,n){return Z(this,e,t,!1,n)},T.prototype.writeDoubleLE=function(e,t,n){return J(this,e,t,!0,n)},T.prototype.writeDoubleBE=function(e,t,n){return J(this,e,t,!1,n)},T.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n||0===e.length||0===this.length)return 0;if(t<0)throw RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw RangeError("sourceStart out of bounds");if(r<0)throw RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var i,o=r-n;if(this===e&&n<t&&t<r)for(i=o-1;i>=0;--i)e[i+t]=this[i+n];else if(o<1e3||!T.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)e[i+t]=this[i+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+o),t);return o},T.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===e.length){var i,o=e.charCodeAt(0);o<256&&(e=o)}if(void 0!==r&&"string"!=typeof r)throw TypeError("encoding must be a string");if("string"==typeof r&&!T.isEncoding(r))throw TypeError("Unknown encoding: "+r)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw RangeError("Out of range index");if(n<=t)return this;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i<n;++i)this[i]=e;else{var a=D(e)?e:X(new T(e,r).toString()),s=a.length;for(i=0;i<n-t;++i)this[i+t]=a[i%s]}return this};var Q=/[^+\/0-9A-Za-z-_]/g;function X(e,t){var n;t=t||1/0;for(var r=e.length,i=null,o=[],a=0;a<r;++a){if((n=e.charCodeAt(a))>55295&&n<57344){if(!i){if(n>56319||a+1===r){(t-=3)>
1-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function ee(e){return function(e){E||w();var t,n,r,i,o,a,s=e.length;if(s%4>0)throw Error("Invalid string. Length must be a multiple of 4");o="="===e[s-2]?2:+("="===e[s-1]),a=new b(3*s/4-o),r=o>0?s-4:s;var l=0;for(t=0,n=0;t<r;t+=4,n+=3)i=v[e.charCodeAt(t)]<<18|v[e.charCodeAt(t+1)]<<12|v[e.charCodeAt(t+2)]<<6|v[e.charCodeAt(t+3)],a[l++]=i>>16&255,a[l++]=i>>8&255,a[l++]=255&i;return 2===o?(i=v[e.charCodeAt(t)]<<2|v[e.charCodeAt(t+1)]>>4,a[l++]=255&i):1===o&&(i=v[e.charCodeAt(t)]<<10|v[e.charCodeAt(t+1)]<<4|v[e.charCodeAt(t+2)]>>2,a[l++]=i>>8&255,a[l++]=255&i),a}(function(e){var t;if((e=((t=e).trim?t.trim():t.replace(/^\s+|\s+$/g,"")).replace(Q,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function et(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function en(e){return null!=e&&(!!e._isBuffer||er(e)||"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&er(e.slice(0,0)))}function er(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var ei=Object.freeze({__proto__:null,Buffer:T,INSPECT_MAX_BYTES:50,SlowBuffer:function(e){return+e!=e&&(e=0),T.alloc(+e)},isBuffer:en,kMaxLength:A}),eo="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{};function ea(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function es(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var n=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}),n}var el={},ec={},ed={};function eu(e){if(!Number.isSafeInteger(e)||e<0)throw Error(`positive integer expected, not ${e}`)}function eh(e){if("boolean"!=typeof e)throw Error(`boolean expected, not ${e}`)}function ef(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}function ep(e,...t){if(!ef(e))throw Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}function eg(e){if("function"!=typeof e||"function"!=typeof e.create)throw Error("hash must be wrapped by utils.wrapConstructor");eu(e.outputLen),eu(e.blockLen)}function em(e,t=!0){if(e.destroyed)throw Error("Hash instance has been destroyed");if(t&&e.finished)throw Error("Hash#digest() has already been called")}function ey(e,t){ep(e);let n=t.outputLen;if(e.length<n)throw Error(`digestInto() expects output buffer of length at least ${n}`)}Object.defineProperty(ed,"__esModule",{value:!0}),ed.isBytes=ef,ed.number=eu,ed.bool=eh,ed.bytes=ep,ed.hash=eg,ed.exists=em,ed.output=ey,ed.default={number:eu,bool:eh,bytes:ep,hash:eg,exists:em,output:ey},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.wrapCipher=e.Hash=e.nextTick=e.isLE=e.createView=e.u32=e.u16=e.u8=void 0,e.bytesToHex=r,e.hexToBytes=a,e.hexToNumber=s,e.bytesToNumberBE=function(e){return s(r(e))},e.numberToBytesBE=function(e,t){return a(e.toString(16).padStart(2*t,"0"))},e.asyncLoop=async function(t,n,r){let i=Date.now();for(let o=0;o<t;o++){r(o);let t=Date.now()-i;t>=0&&t<n||(await (0,e.nextTick)(),i+=t)}},e.utf8ToBytes=l,e.bytesToUtf8=function(e){return(new TextDecoder).decode(e)},e.toBytes=function(e){if("string"==typeof e)e=l(e);else{if(!(0,t.isBytes)(e))throw Error("Uint8Array expected, got "+typeof e);e=d(e)}return e},e.concatBytes=function(...e){let n=0;for(let r=0;r<e.length;r++){let i=e[r];(0,t.bytes)(i),n+=i.length}let r=new Uint8Array(n);for(let t=0,n=0;t<e.length;t++){let i=e[t];r.set(i,n),n+=i.length}return r},e.checkOpts=function(e,t){if(null==t||"object"!=typeof t)throw Error("options must be defined");return Object.assign(e,t)},e.equalBytes=function(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return 0===n},e.setBigUint64=c,e.u64Lengths=function(t,n){let r=new Uint8Array(16),i=(0,e.createView)(r);return c(i,0,BigInt(n?n.length:0),!0),c(i,8,BigInt(t.length),!0),r},e.isAligned32=function(e){return e.byteOffset%4==0},e.copyBytes=d,e.clean=function(...e){for(let t=0;t<e.length;t++)e[t].fill(0)};let t=ed;if(e.u8=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),e.u16=e=>new Uint16Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/2)),e.u32=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),e.createView=e=>
1new DataView(e.buffer,e.byteOffset,e.byteLength),e.isLE=68===new Uint8Array(new Uint32Array([0x11223344]).buffer)[0],!e.isLE)throw Error("Non little-endian hardware is not supported");let n=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function r(e){(0,t.bytes)(e);let r="";for(let t=0;t<e.length;t++)r+=n[e[t]];return r}let i={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function o(e){return e>=i._0&&e<=i._9?e-i._0:e>=i._A&&e<=i._F?e-(i._A-10):e>=i._a&&e<=i._f?e-(i._a-10):void 0}function a(e){if("string"!=typeof e)throw Error("hex string expected, got "+typeof e);let t=e.length,n=t/2;if(t%2)throw Error("padded hex string expected, got unpadded hex of length "+t);let r=new Uint8Array(n);for(let t=0,i=0;t<n;t++,i+=2){let n=o(e.charCodeAt(i)),a=o(e.charCodeAt(i+1));if(void 0===n||void 0===a)throw Error('hex string expected, got non-hex character "'+(e[i]+e[i+1])+'" at index '+i);r[t]=16*n+a}return r}function s(e){if("string"!=typeof e)throw Error("hex string expected, got "+typeof e);return BigInt(""===e?"0":`0x${e}`)}function l(e){if("string"!=typeof e)throw Error("string expected, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}function c(e,t,n,r){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,n,r);let i=BigInt(32),o=BigInt(0xffffffff),a=Number(n>>i&o),s=Number(n&o),l=4*!!r,c=4*!r;e.setUint32(t+l,a,r),e.setUint32(t+c,s,r)}function d(e){return Uint8Array.from(e)}e.nextTick=async()=>{},e.Hash=class{},e.wrapCipher=(e,t)=>(Object.assign(t,e),t)}(ec);var ev={},eb={};Object.defineProperty(eb,"__esModule",{value:!0}),eb.AEAD_TAG_LENGTH=eb.XCHACHA20_NONCE_LENGTH=eb.CURVE25519_PUBLIC_KEY_SIZE=eb.ETH_PUBLIC_KEY_SIZE=eb.UNCOMPRESSED_PUBLIC_KEY_SIZE=eb.COMPRESSED_PUBLIC_KEY_SIZE=eb.SECRET_KEY_LENGTH=void 0,eb.SECRET_KEY_LENGTH=32,eb.COMPRESSED_PUBLIC_KEY_SIZE=33,eb.UNCOMPRESSED_PUBLIC_KEY_SIZE=65,eb.ETH_PUBLIC_KEY_SIZE=64,eb.CURVE25519_PUBLIC_KEY_SIZE=32,eb.XCHACHA20_NONCE_LENGTH=24,eb.AEAD_TAG_LENGTH=16,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ephemeralKeySize=e.symmetricNonceLength=e.symmetricAlgorithm=e.isHkdfKeyCompressed=e.isEphemeralKeyCompressed=e.ellipticCurve=e.ECIES_CONFIG=void 0,e.ECIES_CONFIG=new function(){this.ellipticCurve="secp256k1",this.isEphemeralKeyCompressed=!1,this.isHkdfKeyCompressed=!1,this.symmetricAlgorithm="aes-256-gcm",this.symmetricNonceLength=16},e.ellipticCurve=function(){return e.ECIES_CONFIG.ellipticCurve},e.isEphemeralKeyCompressed=function(){return e.ECIES_CONFIG.isEphemeralKeyCompressed},e.isHkdfKeyCompressed=function(){return e.ECIES_CONFIG.isHkdfKeyCompressed},e.symmetricAlgorithm=function(){return e.ECIES_CONFIG.symmetricAlgorithm},e.symmetricNonceLength=function(){return e.ECIES_CONFIG.symmetricNonceLength},e.ephemeralKeySize=function(){var t={secp256k1:e.ECIES_CONFIG.isEphemeralKeyCompressed?eb.COMPRESSED_PUBLIC_KEY_SIZE:eb.UNCOMPRESSED_PUBLIC_KEY_SIZE,x25519:eb.CURVE25519_PUBLIC_KEY_SIZE,ed25519:eb.CURVE25519_PUBLIC_KEY_SIZE};if(e.ECIES_CONFIG.ellipticCurve in t)return t[e.ECIES_CONFIG.ellipticCurve];throw Error("Not implemented")}}(ev);var eE={},ew={},eS={},e_={},eC={},ex={};Object.defineProperty(ex,"__esModule",{value:!0}),ex.crypto=void 0,ex.crypto="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.gcm=e.ctr=e.cbc=e.utils=void 0,e.randomBytes=r,e.getWebcryptoSubtle=i,e.managedNonce=function(e){return(0,t.number)(e.nonceLength),(t,...i)=>({encrypt(o,...a){let{nonceLength:s}=e,l=r(s),c=e(t,l,...i).encrypt(o,...a),d=(0,n.concatBytes)(l,c);return c.fill(0),d},decrypt(n,...r){let{nonceLength:o}=e,a=n.subarray(0,o),s=n.subarray(o);return e(t,a,...i).decrypt(s,...r)}})};let t=ed,n=ec;function r(e=32){if(ex.crypto&&"function"==typeof ex.crypto.getRandomValues)return ex.crypto.getRandomValues(new Uint8Array(e));if(ex.crypto&&"function"==typeof ex.crypto.randomBytes)return ex.crypto.randomBytes(e);throw Error("crypto.getRandomValues must be defined")}function i(){if(ex.crypto&&"object"==typeof ex.crypto.subtle&&null!=ex.crypto.subtle)return ex.crypto.subtle;throw Error("crypto.subtle must be defined")}e.utils={async encrypt(e,t,n,r){let o=i(),a=await o.importKey("raw",e,t,!0,["encrypt"]);
1return new Uint8Array(await o.encrypt(n,a,r))},async decrypt(e,t,n,r){let o=i(),a=await o.importKey("raw",e,t,!0,["decrypt"]);return new Uint8Array(await o.decrypt(n,a,r))}};let o={CBC:"AES-CBC",CTR:"AES-CTR",GCM:"AES-GCM"};function a(n){return(r,i,a)=>{(0,t.bytes)(r),(0,t.bytes)(i);let s={name:n,length:8*r.length},l=function(e,t,n){if(e===o.CBC)return{name:o.CBC,iv:t};if(e===o.CTR)return{name:o.CTR,counter:t,length:64};if(e===o.GCM)return n?{name:o.GCM,iv:t,additionalData:n}:{name:o.GCM,iv:t};throw Error("unknown aes block mode")}(n,i,a);return{encrypt:n=>((0,t.bytes)(n),e.utils.encrypt(r,s,l,n)),decrypt:n=>((0,t.bytes)(n),e.utils.decrypt(r,s,l,n))}}}e.cbc=a(o.CBC),e.ctr=a(o.CTR),e.gcm=a(o.GCM)}(eC);var ek={},eA={},eM={},eI={};function eT(e){if(!Number.isSafeInteger(e)||e<0)throw Error(`positive integer expected, not ${e}`)}function eR(e){if("boolean"!=typeof e)throw Error(`boolean expected, not ${e}`)}function eP(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}function eO(e,...t){if(!eP(e))throw Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}function eN(e){if("function"!=typeof e||"function"!=typeof e.create)throw Error("Hash should be wrapped by utils.wrapConstructor");eT(e.outputLen),eT(e.blockLen)}function eL(e,t=!0){if(e.destroyed)throw Error("Hash instance has been destroyed");if(t&&e.finished)throw Error("Hash#digest() has already been called")}function eD(e,t){eO(e);let n=t.outputLen;if(e.length<n)throw Error(`digestInto() expects output buffer of length at least ${n}`)}Object.defineProperty(eI,"__esModule",{value:!0}),eI.isBytes=eP,eI.number=eT,eI.bool=eR,eI.bytes=eO,eI.hash=eN,eI.exists=eL,eI.output=eD,eI.default={number:eT,bool:eR,bytes:eO,hash:eN,exists:eL,output:eD};var e$={},eB={};Object.defineProperty(eB,"__esModule",{value:!0}),eB.crypto=void 0,eB.crypto="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Hash=e.nextTick=e.byteSwapIfBE=e.byteSwap=e.isLE=e.rotl=e.rotr=e.createView=e.u32=e.u8=void 0,e.isBytes=function(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name},e.byteSwap32=function(t){for(let n=0;n<t.length;n++)t[n]=(0,e.byteSwap)(t[n])},e.bytesToHex=function(e){(0,n.bytes)(e);let t="";for(let n=0;n<e.length;n++)t+=r[e[n]];return t},e.hexToBytes=function(e){if("string"!=typeof e)throw Error("hex string expected, got "+typeof e);let t=e.length,n=t/2;if(t%2)throw Error("padded hex string expected, got unpadded hex of length "+t);let r=new Uint8Array(n);for(let t=0,i=0;t<n;t++,i+=2){let n=o(e.charCodeAt(i)),a=o(e.charCodeAt(i+1));if(void 0===n||void 0===a)throw Error('hex string expected, got non-hex character "'+(e[i]+e[i+1])+'" at index '+i);r[t]=16*n+a}return r},e.asyncLoop=async function(t,n,r){let i=Date.now();for(let o=0;o<t;o++){r(o);let t=Date.now()-i;t>=0&&t<n||(await (0,e.nextTick)(),i+=t)}},e.utf8ToBytes=a,e.toBytes=s,e.concatBytes=function(...e){let t=0;for(let r=0;r<e.length;r++){let i=e[r];(0,n.bytes)(i),t+=i.length}let r=new Uint8Array(t);for(let t=0,n=0;t<e.length;t++){let i=e[t];r.set(i,n),n+=i.length}return r},e.checkOpts=function(e,t){if(void 0!==t&&"[object Object]"!==l.call(t))throw Error("Options should be object or undefined");return Object.assign(e,t)},e.wrapConstructor=function(e){let t=t=>e().update(s(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t},e.wrapConstructorWithOpts=function(e){let t=(t,n)=>e(n).update(s(t)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=t=>e(t),t},e.wrapXOFConstructorWithOpts=function(e){let t=(t,n)=>e(n).update(s(t)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=t=>e(t),t},e.randomBytes=function(e=32){if(t.crypto&&"function"==typeof t.crypto.getRandomValues)return t.crypto.getRandomValues(new Uint8Array(e));if(t.crypto&&"function"==typeof t.crypto.randomBytes)return t.crypto.randomBytes(e);throw Error("crypto.getRandomValues must be defined")};let t=eB,n=eI;e.u8=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),e.u32=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),e.createView=e=>
1new DataView(e.buffer,e.byteOffset,e.byteLength),e.rotr=(e,t)=>e<<32-t|e>>>t,e.rotl=(e,t)=>e<<t|e>>>32-t>>>0,e.isLE=68===new Uint8Array(new Uint32Array([0x11223344]).buffer)[0],e.byteSwap=e=>e<<24&0xff000000|e<<8&0xff0000|e>>>8&65280|e>>>24&255,e.byteSwapIfBE=e.isLE?e=>e:t=>(0,e.byteSwap)(t);let r=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0")),i={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function o(e){return e>=i._0&&e<=i._9?e-i._0:e>=i._A&&e<=i._F?e-(i._A-10):e>=i._a&&e<=i._f?e-(i._a-10):void 0}function a(e){if("string"!=typeof e)throw Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}function s(e){return"string"==typeof e&&(e=a(e)),(0,n.bytes)(e),e}e.nextTick=async()=>{},e.Hash=class{clone(){return this._cloneInto()}};let l={}.toString}(e$),Object.defineProperty(eM,"__esModule",{value:!0}),eM.HashMD=eM.Maj=eM.Chi=void 0;let eK=e$;eM.Chi=(e,t,n)=>e&t^~e&n,eM.Maj=(e,t,n)=>e&t^e&n^t&n,eM.HashMD=class extends eK.Hash{constructor(e,t,n,r){super(),this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=(0,eK.createView)(this.buffer)}update(e){(0,eI.exists)(this);let{view:t,buffer:n,blockLen:r}=this,i=(e=(0,eK.toBytes)(e)).length;for(let o=0;o<i;){let a=Math.min(r-this.pos,i-o);if(a!==r)n.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===r&&(this.process(t,0),this.pos=0);else{let t=(0,eK.createView)(e);for(;r<=i-o;o+=r)this.process(t,o)}}return this.length+=e.length,this.roundClean(),this}digestInto(e){(0,eI.exists)(this),(0,eI.output)(e,this),this.finished=!0;let{buffer:t,view:n,blockLen:r,isLE:i}=this,{pos:o}=this;t[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>r-o&&(this.process(n,0),o=0);for(let e=o;e<r;e++)t[e]=0;!function(e,t,n,r){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,n,r);let i=BigInt(32),o=BigInt(0xffffffff),a=Number(n>>i&o),s=Number(n&o),l=4*!!r,c=4*!r;e.setUint32(t+l,a,r),e.setUint32(t+c,s,r)}(n,r-8,BigInt(8*this.length),i),this.process(n,0);let a=(0,eK.createView)(e),s=this.outputLen;if(s%4)throw Error("_sha2: outputLen should be aligned to 32bit");let l=s/4,c=this.get();if(l>c.length)throw Error("_sha2: outputLen bigger than state");for(let e=0;e<l;e++)a.setUint32(4*e,c[e],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:t,buffer:n,length:r,finished:i,destroyed:o,pos:a}=this;return e.length=r,e.pos=a,e.finished=i,e.destroyed=o,r%t&&e.buffer.set(n),e}};var ej={};Object.defineProperty(ej,"__esModule",{value:!0}),ej.add5L=ej.add5H=ej.add4H=ej.add4L=ej.add3H=ej.add3L=ej.rotlBL=ej.rotlBH=ej.rotlSL=ej.rotlSH=ej.rotr32L=ej.rotr32H=ej.rotrBL=ej.rotrBH=ej.rotrSL=ej.rotrSH=ej.shrSL=ej.shrSH=ej.toBig=void 0,ej.fromBig=eF,ej.split=ez,ej.add=e5;let eU=BigInt(0x100000000-1),eH=BigInt(32);function eF(e,t=!1){return t?{h:Number(e&eU),l:Number(e>>eH&eU)}:{h:0|Number(e>>eH&eU),l:0|Number(e&eU)}}
1function ez(e,t=!1){let n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let i=0;i<e.length;i++){let{h:o,l:a}=eF(e[i],t);[n[i],r[i]]=[o,a]}return[n,r]}let eq=(e,t)=>BigInt(e>>>0)<<eH|BigInt(t>>>0);ej.toBig=eq;let eW=(e,t,n)=>e>>>n;ej.shrSH=eW;let eV=(e,t,n)=>e<<32-n|t>>>n;ej.shrSL=eV;let eG=(e,t,n)=>e>>>n|t<<32-n;ej.rotrSH=eG;let eY=(e,t,n)=>e<<32-n|t>>>n;ej.rotrSL=eY;let eZ=(e,t,n)=>e<<64-n|t>>>n-32;ej.rotrBH=eZ;let eJ=(e,t,n)=>e>>>n-32|t<<64-n;ej.rotrBL=eJ;let eQ=(e,t)=>t;ej.rotr32H=eQ;let eX=(e,t)=>e;ej.rotr32L=eX;let e0=(e,t,n)=>e<<n|t>>>32-n;ej.rotlSH=e0;let e1=(e,t,n)=>t<<n|e>>>32-n;ej.rotlSL=e1;let e2=(e,t,n)=>t<<n-32|e>>>64-n;ej.rotlBH=e2;let e3=(e,t,n)=>e<<n-32|t>>>64-n;function e5(e,t,n,r){let i=(t>>>0)+(r>>>0);return{h:e+n+(i/0x100000000|0)|0,l:0|i}}ej.rotlBL=e3;let e8=(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0);ej.add3L=e8;let e6=(e,t,n,r)=>t+n+r+(e/0x100000000|0)|0;ej.add3H=e6;let e4=(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0);ej.add4L=e4;let e9=(e,t,n,r,i)=>t+n+r+i+(e/0x100000000|0)|0;ej.add4H=e9;let e7=(e,t,n,r,i)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(i>>>0);ej.add5L=e7;let te=(e,t,n,r,i,o)=>t+n+r+i+o+(e/0x100000000|0)|0;ej.add5H=te,ej.default={fromBig:eF,split:ez,toBig:eq,shrSH:eW,shrSL:eV,rotrSH:eG,rotrSL:eY,rotrBH:eZ,rotrBL:eJ,rotr32H:eQ,rotr32L:eX,rotlSH:e0,rotlSL:e1,rotlBH:e2,rotlBL:e3,add:e5,add3L:e8,add3H:e6,add4L:e4,add4H:e9,add5H:te,add5L:e7},Object.defineProperty(eA,"__esModule",{value:!0}),eA.sha384=eA.sha512_256=eA.sha512_224=eA.sha512=eA.SHA384=eA.SHA512_256=eA.SHA512_224=eA.SHA512=void 0;let tt=eM,[tn,tr]=ej.default.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e3585
15771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e))),ti=new Uint32Array(80),to=new Uint32Array(80);class ta extends tt.HashMD{constructor(){super(128,64,16,!1),this.Ah=0x6a09e667,this.Al=-0xc4336f8,this.Bh=-0x4498517b,this.Bl=-0x7b3558c5,this.Ch=0x3c6ef372,this.Cl=-0x16b07d5,this.Dh=-0x5ab00ac6,this.Dl=0x5f1d36f1,this.Eh=0x510e527f,this.El=-0x52197d2f,this.Fh=-0x64fa9774,this.Fl=0x2b3e6c1f,this.Gh=0x1f83d9ab,this.Gl=-0x4be4295,this.Hh=0x5be0cd19,this.Hl=0x137e2179}get(){let{Ah:e,Al:t,Bh:n,Bl:r,Ch:i,Cl:o,Dh:a,Dl:s,Eh:l,El:c,Fh:d,Fl:u,Gh:h,Gl:f,Hh:p,Hl:g}=this;return[e,t,n,r,i,o,a,s,l,c,d,u,h,f,p,g]}set(e,t,n,r,i,o,a,s,l,c,d,u,h,f,p,g){this.Ah=0|e,this.Al=0|t,this.Bh=0|n,this.Bl=0|r,this.Ch=0|i,this.Cl=0|o,this.Dh=0|a,this.Dl=0|s,this.Eh=0|l,this.El=0|c,this.Fh=0|d,this.Fl=0|u,this.Gh=0|h,this.Gl=0|f,this.Hh=0|p,this.Hl=0|g}process(e,t){for(let n=0;n<16;n++,t+=4)ti[n]=e.getUint32(t),to[n]=e.getUint32(t+=4);for(let e=16;e<80;e++){let t=0|ti[e-15],n=0|to[e-15],r=ej.default.rotrSH(t,n,1)^ej.default.rotrSH(t,n,8)^ej.default.shrSH(t,n,7),i=ej.default.rotrSL(t,n,1)^ej.default.rotrSL(t,n,8)^ej.default.shrSL(t,n,7),o=0|ti[e-2],a=0|to[e-2],s=ej.default.rotrSH(o,a,19)^ej.default.rotrBH(o,a,61)^ej.default.shrSH(o,a,6),l=ej.default.rotrSL(o,a,19)^ej.default.rotrBL(o,a,61)^ej.default.shrSL(o,a,6),c=ej.default.add4L(i,l,to[e-7],to[e-16]),d=ej.default.add4H(c,r,s,ti[e-7],ti[e-16]);ti[e]=0|d,to[e]=0|c}let{Ah:n,Al:r,Bh:i,Bl:o,Ch:a,Cl:s,Dh:l,Dl:c,Eh:d,El:u,Fh:h,Fl:f,Gh:p,Gl:g,Hh:m,Hl:y}=this;for(let e=0;e<80;e++){let t=ej.default.rotrSH(d,u,14)^ej.default.rotrSH(d,u,18)^ej.default.rotrBH(d,u,41),v=ej.default.rotrSL(d,u,14)^ej.default.rotrSL(d,u,18)^ej.default.rotrBL(d,u,41),b=d&h^~d&p,E=u&f^~u&g,w=ej.default.add5L(y,v,E,tr[e],to[e]),S=ej.default.add5H(w,m,t,b,tn[e],ti[e]),_=0|w,C=ej.default.rotrSH(n,r,28)^ej.default.rotrBH(n,r,34)^ej.default.rotrBH(n,r,39),x=ej.default.rotrSL(n,r,28)^ej.default.rotrBL(n,r,34)^ej.default.rotrBL(n,r,39),k=n&i^n&a^i&a,A=r&o^r&s^o&s;m=0|p,y=0|g,p=0|h,g=0|f,h=0|d,f=0|u,({h:d,l:u}=ej.default.add(0|l,0|c,0|S,0|_)),l=0|a,c=0|s,a=0|i,s=0|o,i=0|n,o=0|r;let M=ej.default.add3L(_,x,A);n=ej.default.add3H(M,S,C,k),r=0|M}({h:n,l:r}=ej.default.add(0|this.Ah,0|this.Al,0|n,0|r)),({h:i,l:o}=ej.default.add(0|this.Bh,0|this.Bl,0|i,0|o)),({h:a,l:s}=ej.default.add(0|this.Ch,0|this.Cl,0|a,0|s)),({h:l,l:c}=ej.default.add(0|this.Dh,0|this.Dl,0|l,0|c)),({h:d,l:u}=ej.default.add(0|this.Eh,0|this.El,0|d,0|u)),({h:h,l:f}=ej.default.add(0|this.Fh,0|this.Fl,0|h,0|f)),({h:p,l:g}=ej.default.add(0|this.Gh,0|this.Gl,0|p,0|g)),({h:m,l:y}=ej.default.add(0|this.Hh,0|this.Hl,0|m,0|y)),this.set(n,r,i,o,a,s,l,c,d,u,h,f,p,g,m,y)}roundClean(){ti.fill(0),to.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}eA.SHA512=ta;class ts extends ta{constructor(){super(),this.Ah=-0x73c2c838,this.Al=0x19544da2,this.Bh=0x73e19966,this.Bl=-0x76232b2a,this.Ch=0x1dfab7ae,this.Cl=0x32ff9c82,this.Dh=0x679dd514,this.Dl=0x582f9fcf,this.Eh=0xf6d2b69,this.El=0x7bd44da8,this.Fh=0x77e36f73,this.Fl=0x4c48942,this.Gh=0x3f9d85a8,this.Gl=0x6a1d36c8,this.Hh=0x1112e6ad,this.Hl=-0x6e296d5f,this.outputLen=28}}eA.SHA512_224=ts;class tl extends ta{constructor(){super(),this.Ah=0x22312194,this.Al=-0x3d408d4,this.Bh=-0x60aaa05d,this.Bl=-0x37b39b3e,this.Ch=0x2393b86b,this.Cl=0x6f53b151,this.Dh=-0x69c788e7,this.Dl=0x5940eabd,this.Eh=-0x69d7c11e,this.El=-0x5771001d,this.Fh=-0x41a1e1db,this.Fl=0x53863992,this.Gh=0x2b0199fc,this.Gl=0x2c85b8aa,this.Hh=0xeb72ddc,this.Hl=-0x7e3ad35e,this.outputLen=32}}eA.SHA512_256=tl;class tc extends ta{constructor(){super(),this.Ah=-0x344462a3,this.Al=-0x3efa6128,this.Bh=0x629a292a,this.Bl=0x367cd507,this.Ch=-0x6ea6fea6,this.Cl=0x3070dd17,this.Dh=0x152fecd8,this.Dl=-0x8f1a6c7,this.Eh=0x67332667,this.El=-4191439,this.Fh=-0x714bb579,this.Fl=0x68581511,this.Gh=-0x24f3d1f3,this.Gl=0x64f98fa7,this.Hh=0x47b5481d,this.Hl=-0x4105b05c,this.outputLen=48}}eA.SHA384=tc,eA.sha512=(0,e$.wrapConstructor)(()=>new ta),eA.sha512_224=(0,e$.wrapConstructor)(()=>new ts),eA.sha512_256=(0,e$.wrapConstructor)(()=>new tl),eA.sha384=(0,e$.wrapConstructor)(()=>new tc);var td={},tu={},th={},tf={};
1Object.defineProperty(tf,"__esModule",{value:!0}),tf.notImplemented=tf.bitMask=void 0,tf.isBytes=ty,tf.abytes=tv,tf.abool=function(e,t){if("boolean"!=typeof t)throw Error(`${e} must be valid boolean, got "${t}".`)},tf.bytesToHex=tE,tf.numberToHexUnpadded=tw,tf.hexToNumber=tS,tf.hexToBytes=tx,tf.bytesToNumberBE=function(e){return tS(tE(e))},tf.bytesToNumberLE=function(e){return tv(e),tS(tE(Uint8Array.from(e).reverse()))},tf.numberToBytesBE=tk,tf.numberToBytesLE=function(e,t){return tk(e,t).reverse()},tf.numberToVarBytesBE=function(e){return tx(tw(e))},tf.ensureBytes=function(e,t,n){let r;if("string"==typeof t)try{r=tx(t)}catch(n){throw Error(`${e} must be valid hex string, got "${t}". Cause: ${n}`)}else{if(!ty(t))throw Error(`${e} must be hex string or Uint8Array`);r=Uint8Array.from(t)}let i=r.length;if("number"==typeof n&&i!==n)throw Error(`${e} expected ${n} bytes, got ${i}`);return r},tf.concatBytes=tA,tf.equalBytes=function(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return 0===n},tf.utf8ToBytes=function(e){if("string"!=typeof e)throw Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))},tf.inRange=tI,tf.aInRange=function(e,t,n,r){if(!tI(t,n,r))throw Error(`expected valid ${e}: ${n} <= n < ${r}, got ${typeof t} ${t}`)},tf.bitLen=function(e){let t;for(t=0;e>tp;e>>=tg,t+=1);return t},tf.bitGet=function(e,t){return e>>BigInt(t)&tg},tf.bitSet=function(e,t,n){return e|(n?tg:tp)<<BigInt(t)},tf.createHmacDrbg=function(e,t,n){if("number"!=typeof e||e<2)throw Error("hashLen must be a number");if("number"!=typeof t||t<2)throw Error("qByteLen must be a number");if("function"!=typeof n)throw Error("hmacFn must be a function");let r=tT(e),i=tT(e),o=0,a=()=>{r.fill(1),i.fill(0),o=0},s=(...e)=>n(i,r,...e),l=(e=tT())=>{i=s(tR([0]),e),r=s(),0!==e.length&&(i=s(tR([1]),e),r=s())},c=()=>{if(o++>=1e3)throw Error("drbg: tried 1000 values");let e=0,n=[];for(;e<t;){let t=(r=s()).slice();n.push(t),e+=r.length}return tA(...n)};return(e,t)=>{let n;for(a(),l(e);!(n=t(c()));)l();return a(),n}},tf.validateObject=function(e,t,n={}){let r=(t,n,r)=>{let i=tP[n];if("function"!=typeof i)throw Error(`Invalid validator "${n}", expected function`);let o=e[t];if(!(r&&void 0===o||i(o,e)))throw Error(`Invalid param ${String(t)}=${o} (${typeof o}), expected ${n}`)};for(let[e,n]of Object.entries(t))r(e,n,!1);for(let[e,t]of Object.entries(n))r(e,t,!0);return e},tf.memoized=function(e){let t=new WeakMap;return(n,...r)=>{let i=t.get(n);if(void 0!==i)return i;let o=e(n,...r);return t.set(n,o),o}};let tp=BigInt(0),tg=BigInt(1),tm=BigInt(2);function ty(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}function tv(e){if(!ty(e))throw Error("Uint8Array expected")}let tb=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function tE(e){tv(e);let t="";for(let n=0;n<e.length;n++)t+=tb[e[n]];return t}function tw(e){let t=e.toString(16);return 1&t.length?`0${t}`:t}function tS(e){if("string"!=typeof e)throw Error("hex string expected, got "+typeof e);return BigInt(""===e?"0":`0x${e}`)}let t_={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function tC(e){return e>=t_._0&&e<=t_._9?e-t_._0:e>=t_._A&&e<=t_._F?e-(t_._A-10):e>=t_._a&&e<=t_._f?e-(t_._a-10):void 0}function tx(e){if("string"!=typeof e)throw Error("hex string expected, got "+typeof e);let t=e.length,n=t/2;if(t%2)throw Error("padded hex string expected, got unpadded hex of length "+t);let r=new Uint8Array(n);for(let t=0,i=0;t<n;t++,i+=2){let n=tC(e.charCodeAt(i)),o=tC(e.charCodeAt(i+1));if(void 0===n||void 0===o)throw Error('hex string expected, got non-hex character "'+(e[i]+e[i+1])+'" at index '+i);r[t]=16*n+o}return r}function tk(e,t){return tx(e.toString(16).padStart(2*t,"0"))}function tA(...e){let t=0;for(let n=0;n<e.length;n++){let r=e[n];tv(r),t+=r.length}let n=new Uint8Array(t);for(let t=0,r=0;t<e.length;t++){let i=e[t];n.set(i,r),r+=i.length}return n}let tM=e=>"bigint"==typeof e&&tp<=e;function tI(e,t,n){return tM(e)&&tM(t)&&tM(n)&&t<=e&&e<n}tf.bitMask=e=>(tm<<BigInt(e-1))-tg;let tT=e=>new Uint8Array(e),tR=e=>Uint8Array.from(e),tP={bigint:e=>"bigint"==typeof e,function:e=>"function"==typeof e,boolean:e=>"boolean"==typeof e,string:e=>"string"==typeof e,stringOrUint8Array:e=>"string"==typeof e||ty(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>"function"==typeof e&&Number.isSafeInteger(e.outputLen)};tf.notImplemented=()=>{throw Error("not implemented")},Object.defineProperty(th,"__esModule",{value:!0}),th.isNegativeLE=void 0,th.mod=tU,th.pow=tH,th.pow2=function(e,t,n){let r=e;for(;t-- >tN;)r*=r,r%=n;return r},th.invert=tF,th.tonelliShanks=tz,th.FpSqrt=tq,th.validateField=function(e){let t=tW.reduce((e,t)=>
1(e[t]="function",e),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"});return(0,tO.validateObject)(e,t)},th.FpPow=tV,th.FpInvertBatch=tG,th.FpDiv=function(e,t,n){return e.mul(t,"bigint"==typeof n?tF(n,e.ORDER):e.inv(n))},th.FpLegendre=tY,th.FpIsSquare=function(e){let t=tY(e.ORDER);return n=>{let r=t(e,n);return e.eql(r,e.ZERO)||e.eql(r,e.ONE)}},th.nLength=tZ,th.Field=function(e,t,n=!1,r={}){if(e<=tN)throw Error(`Expected Field ORDER > 0, got ${e}`);let{nBitLength:i,nByteLength:o}=tZ(e,t);if(o>2048)throw Error("Field lengths over 2048 bytes are not supported");let a=tq(e),s=Object.freeze({ORDER:e,BITS:i,BYTES:o,MASK:(0,tO.bitMask)(i),ZERO:tN,ONE:tL,create:t=>tU(t,e),isValid:t=>{if("bigint"!=typeof t)throw Error("Invalid field element: expected bigint, got "+typeof t);return tN<=t&&t<e},is0:e=>e===tN,isOdd:e=>(e&tL)===tL,neg:t=>tU(-t,e),eql:(e,t)=>e===t,sqr:t=>tU(t*t,e),add:(t,n)=>tU(t+n,e),sub:(t,n)=>tU(t-n,e),mul:(t,n)=>tU(t*n,e),pow:(e,t)=>tV(s,e,t),div:(t,n)=>tU(t*tF(n,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>tF(t,e),sqrt:r.sqrt||(e=>a(s,e)),invertBatch:e=>tG(s,e),cmov:(e,t,n)=>n?t:e,toBytes:e=>n?(0,tO.numberToBytesLE)(e,o):(0,tO.numberToBytesBE)(e,o),fromBytes:e=>{if(e.length!==o)throw Error(`Fp.fromBytes: expected ${o}, got ${e.length}`);return n?(0,tO.bytesToNumberLE)(e):(0,tO.bytesToNumberBE)(e)}});return Object.freeze(s)},th.FpSqrtOdd=function(e,t){if(!e.isOdd)throw Error("Field doesn't have isOdd");let n=e.sqrt(t);return e.isOdd(n)?n:e.neg(n)},th.FpSqrtEven=function(e,t){if(!e.isOdd)throw Error("Field doesn't have isOdd");let n=e.sqrt(t);return e.isOdd(n)?e.neg(n):n},th.hashToPrivateScalar=function(e,t,n=!1){let r=(e=(0,tO.ensureBytes)("privateHash",e)).length,i=tZ(t).nByteLength+8;if(i<24||r<i||r>1024)throw Error(`hashToPrivateScalar: expected ${i}-1024 bytes of input, got ${r}`);return tU(n?(0,tO.bytesToNumberLE)(e):(0,tO.bytesToNumberBE)(e),t-tL)+tL},th.getFieldBytesLength=tJ,th.getMinHashLength=tQ,th.mapHashToField=function(e,t,n=!1){let r=e.length,i=tJ(t),o=tQ(t);if(r<16||r<o||r>1024)throw Error(`expected ${o}-1024 bytes of input, got ${r}`);let a=tU(n?(0,tO.bytesToNumberBE)(e):(0,tO.bytesToNumberLE)(e),t-tL)+tL;return n?(0,tO.numberToBytesLE)(a,i):(0,tO.numberToBytesBE)(a,i)};let tO=tf,tN=BigInt(0),tL=BigInt(1),tD=BigInt(2),t$=BigInt(3),tB=BigInt(4),tK=BigInt(5),tj=BigInt(8);function tU(e,t){let n=e%t;return n>=tN?n:t+n}function tH(e,t,n){if(n<=tN||t<tN)throw Error("Expected power/modulo > 0");if(n===tL)return tN;let r=tL;for(;t>tN;)t&tL&&(r=r*e%n),e=e*e%n,t>>=tL;return r}function tF(e,t){if(e===tN||t<=tN)throw Error(`invert: expected positive integers, got n=${e} mod=${t}`);let n=tU(e,t),r=t,i=tN,o=tL;for(;n!==tN;){let e=r%n,t=i-r/n*o;r=n,n=e,i=o,o=t}if(r!==tL)throw Error("invert: does not exist");return tU(i,t)}function tz(e){let t,n,r,i=(e-tL)/tD;for(t=e-tL,n=0;t%tD===tN;t/=tD,n++);for(r=tD;r<e&&tH(r,i,e)!==e-tL;r++);if(1===n){let t=(e+tL)/tB;return function(e,n){let r=e.pow(n,t);if(!e.eql(e.sqr(r),n))throw Error("Cannot find square root");return r}}let o=(t+tL)/tD;return function(e,a){if(e.pow(a,i)===e.neg(e.ONE))throw Error("Cannot find square root");let s=n,l=e.pow(e.mul(e.ONE,r),t),c=e.pow(a,o),d=e.pow(a,t);for(;!e.eql(d,e.ONE);){if(e.eql(d,e.ZERO))return e.ZERO;let t=1;for(let n=e.sqr(d);t<s&&!e.eql(n,e.ONE);t++)n=e.sqr(n);let n=e.pow(l,tL<<BigInt(s-t-1));l=e.sqr(n),c=e.mul(c,n),d=e.mul(d,l),s=t}return c}}function tq(e){if(e%tB===t$){let t=(e+tL)/tB;return function(e,n){let r=e.pow(n,t);if(!e.eql(e.sqr(r),n))throw Error("Cannot find square root");return r}}if(e%tj===tK){let t=(e-tK)/tj;return function(e,n){let r=e.mul(n,tD),i=e.pow(r,t),o=e.mul(n,i),a=e.mul(e.mul(o,tD),i),s=e.mul(o,e.sub(a,e.ONE));if(!e.eql(e.sqr(s),n))throw Error("Cannot find square root");return s}}return tz(e)}BigInt(9),BigInt(16),th.isNegativeLE=(e,t)=>(tU(e,t)&tL)===tL;let tW=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function tV(e,t,n){if(n<tN)throw Error("Expected power > 0");if(n===tN)return e.ONE;if(n===tL)return t;let r=e.ONE,i=t;for(;n>tN;
1)n&tL&&(r=e.mul(r,i)),i=e.sqr(i),n>>=tL;return r}function tG(e,t){let n=Array(t.length),r=t.reduce((t,r,i)=>e.is0(r)?t:(n[i]=t,e.mul(t,r)),e.ONE),i=e.inv(r);return t.reduceRight((t,r,i)=>e.is0(r)?t:(n[i]=e.mul(t,n[i]),e.mul(t,r)),i),n}function tY(e){let t=(e-tL)/tD;return(e,n)=>e.pow(n,t)}function tZ(e,t){let n=void 0!==t?t:e.toString(2).length;return{nBitLength:n,nByteLength:Math.ceil(n/8)}}function tJ(e){if("bigint"!=typeof e)throw Error("field order must be bigint");return Math.ceil(e.toString(2).length/8)}function tQ(e){let t=tJ(e);return t+Math.ceil(t/2)}Object.defineProperty(tu,"__esModule",{value:!0}),tu.wNAF=function(e,t){let n=(e,t)=>{let n=t.negate();return e?n:t},r=e=>{if(!Number.isSafeInteger(e)||e<=0||e>t)throw Error(`Wrong window size=${e}, should be [1..${t}]`)},i=e=>(r(e),{windows:Math.ceil(t/e)+1,windowSize:2**(e-1)});return{constTimeNegate:n,unsafeLadder(t,n){let r=e.ZERO,i=t;for(;n>t1;)n&t2&&(r=r.add(i)),i=i.double(),n>>=t2;return r},precomputeWindow(e,t){let{windows:n,windowSize:r}=i(t),o=[],a=e,s=a;for(let e=0;e<n;e++){s=a,o.push(s);for(let e=1;e<r;e++)s=s.add(a),o.push(s);a=s.double()}return o},wNAF(t,r,o){let{windows:a,windowSize:s}=i(t),l=e.ZERO,c=e.BASE,d=BigInt(2**t-1),u=2**t,h=BigInt(t);for(let e=0;e<a;e++){let t=e*s,i=Number(o&d);o>>=h,i>s&&(i-=u,o+=t2);let a=t+Math.abs(i)-1,f=e%2!=0,p=i<0;0===i?c=c.add(n(f,r[t])):l=l.add(n(p,r[a]))}return{p:l,f:c}},wNAFCached(e,t,n){let r=t5.get(e)||1,i=t3.get(e);return i||(i=this.precomputeWindow(e,r),1!==r&&t3.set(e,n(i))),this.wNAF(r,i,t)},setWindowSize(e,t){r(t),t5.set(e,t),t3.delete(e)}}},tu.pippenger=function(e,t,n,r){if(!Array.isArray(n)||!Array.isArray(r)||r.length!==n.length)throw Error("arrays of points and scalars must have equal length");r.forEach((e,n)=>{if(!t.isValid(e))throw Error(`wrong scalar at index ${n}`)}),n.forEach((t,n)=>{if(!(t instanceof e))throw Error(`wrong point at index ${n}`)});let i=(0,t0.bitLen)(BigInt(n.length)),o=i>12?i-3:i>4?i-2:i?2:1,a=(1<<o)-1,s=Array(a+1).fill(e.ZERO),l=Math.floor((t.BITS-1)/o)*o,c=e.ZERO;for(let t=l;t>=0;t-=o){s.fill(e.ZERO);for(let e=0;e<r.length;e++){let i=Number(r[e]>>BigInt(t)&BigInt(a));s[i]=s[i].add(n[e])}let i=e.ZERO;for(let t=s.length-1,n=e.ZERO;t>0;t--)n=n.add(s[t]),i=i.add(n);if(c=c.add(i),0!==t)for(let e=0;e<o;e++)c=c.double()}return c},tu.validateBasic=function(e){return(0,tX.validateField)(e.Fp),(0,t0.validateObject)(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...(0,tX.nLength)(e.n,e.nBitLength),...e,p:e.Fp.ORDER})};let tX=th,t0=tf,t1=BigInt(0),t2=BigInt(1),t3=new WeakMap,t5=new WeakMap;Object.defineProperty(td,"__esModule",{value:!0}),td.twistedEdwards=function(e){let t=function(e){let t=(0,t8.validateBasic)(e);return t4.validateObject(e,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...t})}(e),{Fp:n,n:r,prehash:i,hash:o,randomBytes:a,nByteLength:s,h:l}=t,c=nt<<BigInt(8*s)-ne,d=n.create,u=(0,t6.Field)(t.n,t.nBitLength),h=t.uvRatio||((e,t)=>{try{return{isValid:!0,value:n.sqrt(e*n.inv(t))}}catch(e){return{isValid:!1,value:t7}}}),f=t.adjustScalarBytes||(e=>e),p=t.domain||((e,t,n)=>{if((0,t9.abool)("phflag",n),t.length||n)throw Error("Contexts/pre-hash are not supported");return e});function g(e,t){t4.aInRange("coordinate "+e,t,t7,c)}function m(e){if(!(e instanceof b))throw Error("ExtendedPoint expected")}let y=(0,t9.memoized)((e,t)=>{let{ex:r,ey:i,ez:o}=e,a=e.is0();null==t&&(t=a?nn:n.inv(o));let s=d(r*t),l=d(i*t),c=d(o*t);if(a)return{x:t7,y:ne};if(c!==ne)throw Error("invZ was invalid");return{x:s,y:l}}),v=(0,t9.memoized)(e=>{let{a:n,d:r}=t;if(e.is0())throw Error("bad point: ZERO");let{ex:i,ey:o,ez:a,et:s}=e,l=d(i*i),c=d(o*o),u=d(a*a),h=d(u*u),f=d(l*n);if(d(u*d(f+c))!==d(h+d(r*d(l*c))))throw Error("bad point: equation left != right (1)");if(d(i*o)!==d(a*s))throw Error("bad point: equation left != right (2)");return!0});class b{constructor(e,t,n,r){this.ex=e,this.ey=t,this.ez=n,this.et=r,g("x",e),g("y",t),g("z",n),g("t",r),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(e){if(e instanceof b)throw Error("extended point not allowed");let{x:t,y:n}=e||{};return g("x",t),g("y",n),new b(t,n,ne,d(t*n))}static normalizeZ(e){let t=n.invertBatch(e.map(e=>e.ez));return e.map((e,n)=>e.toAffine(t[n])).map(b.fromAffine)}static msm(e,t){return(0,t8.pippenger)(b,u,e,t)}_setWindowSize(e){S.setWindowSize(this,e)}assertValidity(){v(this)}equals(e){m(e);let{ex:t,ey:n,ez:r}=this,{ex:i,ey:o,ez:a}=e,s=d(t*a),l=d(i*r),c=d(n*a),u=d(o*r);return s===l&&c===u}is0(){return this.equals(b.ZERO)}negate(){return new b(d(-this.ex),this.ey,this.ez,d(-this.et))}double(){let{a:e}=t,{ex:n,ey:r,ez:i}=this,o=d(n*n),a=d(r*r),s=d(nt*d(i*i)),l=d(e*o),c=n+r,u=d(d(c*c)-o-a),h=l+a,f=h-s,p=l-a,g=d(u*f),m=d(h*p),y=d(u*p);return new b(g,m,d(f*h),y)}add(e){m(e);let{a:n,d:r}=t,{ex:i,ey:o,ez:a,et:s}=this,{ex:l,ey:c,ez:u,et:h}=e;if(n===BigInt(-1)){let e=d((o-i)*(c+l)),t=d((o+i)*(c-l)),n=d(t-e);if(n===t7)return this.double();let r=d(a*nt*h),f=d(s*nt*u),p=f+r,g=t+e,m=f-r,y=d(p*n),v=d(g*m),E=d(p*m);return new b(y,v,d(n*g),E)}
1let f=d(i*l),p=d(o*c),g=d(s*r*h),y=d(a*u),v=d((i+o)*(l+c)-f-p),E=y-g,w=y+g,S=d(p-n*f),_=d(v*E),C=d(w*S),x=d(v*S);return new b(_,C,d(E*w),x)}subtract(e){return this.add(e.negate())}wNAF(e){return S.wNAFCached(this,e,b.normalizeZ)}multiply(e){t4.aInRange("scalar",e,ne,r);let{p:t,f:n}=this.wNAF(e);return b.normalizeZ([t,n])[0]}multiplyUnsafe(e){return t4.aInRange("scalar",e,t7,r),e===t7?w:this.equals(w)||e===ne?this:this.equals(E)?this.wNAF(e).p:S.unsafeLadder(this,e)}isSmallOrder(){return this.multiplyUnsafe(l).is0()}isTorsionFree(){return S.unsafeLadder(this,r).is0()}toAffine(e){return y(this,e)}clearCofactor(){let{h:e}=t;return e===ne?this:this.multiplyUnsafe(e)}static fromHex(e,r=!1){let{d:i,a:o}=t,a=n.BYTES;e=(0,t9.ensureBytes)("pointHex",e,a),(0,t9.abool)("zip215",r);let s=e.slice(),l=e[a-1];s[a-1]=-129&l;let u=t4.bytesToNumberLE(s),f=r?c:n.ORDER;t4.aInRange("pointHex.y",u,t7,f);let p=d(u*u),{isValid:g,value:m}=h(d(p-ne),d(i*p-o));if(!g)throw Error("Point.fromHex: invalid y coordinate");let y=(m&ne)===ne,v=0!=(128&l);if(!r&&m===t7&&v)throw Error("Point.fromHex: x=0 and x_0=1");return v!==y&&(m=d(-m)),b.fromAffine({x:m,y:u})}static fromPrivateKey(e){return x(e).point}toRawBytes(){let{x:e,y:t}=this.toAffine(),r=t4.numberToBytesLE(t,n.BYTES);return r[r.length-1]|=e&ne?128:0,r}toHex(){return t4.bytesToHex(this.toRawBytes())}}b.BASE=new b(t.Gx,t.Gy,ne,d(t.Gx*t.Gy)),b.ZERO=new b(t7,ne,ne,t7);let{BASE:E,ZERO:w}=b,S=(0,t8.wNAF)(b,8*s);function _(e){return(0,t6.mod)(e,r)}function C(e){return _(t4.bytesToNumberLE(e))}function x(e){e=(0,t9.ensureBytes)("private key",e,s);let t=(0,t9.ensureBytes)("hashed private key",o(e),2*s),n=f(t.slice(0,s)),r=t.slice(s,2*s),i=C(n),a=E.multiply(i),l=a.toRawBytes();return{head:n,prefix:r,scalar:i,point:a,pointBytes:l}}function k(e=new Uint8Array,...t){return C(o(p(t4.concatBytes(...t),(0,t9.ensureBytes)("context",e),!!i)))}return E._setWindowSize(8),{CURVE:t,getPublicKey:function(e){return x(e).pointBytes},sign:function(e,t,o={}){e=(0,t9.ensureBytes)("message",e),i&&(e=i(e));let{prefix:a,scalar:l,pointBytes:c}=x(t),d=k(o.context,a,e),u=E.multiply(d).toRawBytes(),h=_(d+k(o.context,u,c,e)*l);t4.aInRange("signature.s",h,t7,r);let f=t4.concatBytes(u,t4.numberToBytesLE(h,n.BYTES));return(0,t9.ensureBytes)("result",f,2*s)},verify:function(e,t,r,o=nr){let a,s,l,{context:c,zip215:d}=o,u=n.BYTES;e=(0,t9.ensureBytes)("signature",e,2*u),t=(0,t9.ensureBytes)("message",t),void 0!==d&&(0,t9.abool)("zip215",d),i&&(t=i(t));let h=t4.bytesToNumberLE(e.slice(u,2*u));try{a=b.fromHex(r,d),s=b.fromHex(e.slice(0,u),d),l=E.multiplyUnsafe(h)}catch(e){return!1}if(!d&&a.isSmallOrder())return!1;let f=k(c,s.toRawBytes(),a.toRawBytes(),t);return s.add(a.multiplyUnsafe(f)).subtract(l).clearCofactor().equals(b.ZERO)},ExtendedPoint:b,utils:{getExtendedPublicKey:x,randomPrivateKey:()=>a(n.BYTES),precompute:(e=8,t=b.BASE)=>(t._setWindowSize(e),t.multiply(BigInt(3)),t)}}};let t8=tu,t6=th,t4=tf,t9=tf,t7=BigInt(0),ne=BigInt(1),nt=BigInt(2),nn=BigInt(8),nr={zip215:!0};var ni={};Object.defineProperty(ni,"__esModule",{value:!0}),ni.expand_message_xmd=nl,ni.expand_message_xof=nc,ni.hash_to_field=nd,ni.isogenyMap=function(e,t){let n=t.map(e=>Array.from(e).reverse());return(t,r)=>{let[i,o,a,s]=n.map(n=>n.reduce((n,r)=>e.add(e.mul(n,t),r)));return t=e.div(i,o),r=e.mul(r,e.div(a,s)),{x:t,y:r}}},ni.createHasher=function(e,t,n){if("function"!=typeof t)throw Error("mapToCurve() must be defined");return{hashToCurve(r,i){let o=nd(r,2,{...n,DST:n.DST,...i}),a=e.fromAffine(t(o[0])),s=e.fromAffine(t(o[1])),l=a.add(s).clearCofactor();return l.assertValidity(),l},encodeToCurve(r,i){let o=nd(r,1,{...n,DST:n.encodeDST,...i}),a=e.fromAffine(t(o[0])).clearCofactor();return a.assertValidity(),a},mapToCurve(n){if(!Array.isArray(n))throw Error("mapToCurve: expected array of bigints");for(let e of n)if("bigint"!=typeof e)throw Error(`mapToCurve: expected array of bigints, got ${e} in array`);let r=e.fromAffine(t(n)).clearCofactor();return r.assertValidity(),r}}};let no=tf.bytesToNumberBE;function na(e,t){if(ns(e),ns(t),e<0||e>=1<<8*t)throw Error(`bad I2OSP call: value=${e} length=${t}`);let n=Array.from({length:t}).fill(0);for(let r=t-1;r>=0;r--)n[r]=255&e,e>>>=8;return new Uint8Array(n)}function ns(e){if(!Number.isSafeInteger(e))throw Error("number expected")}function nl(e,t,n,r){(0,tf.abytes)(e),(0,tf.abytes)(t),ns(n),t.length>255&&(t=r((0,tf.concatBytes)((0,tf.utf8ToBytes)("H2C-OVERSIZE-DST-"),t)));let{outputLen:i,blockLen:o}=r,a=Math.ceil(n/i);if(n>65535||a>
1255)throw Error("expand_message_xmd: invalid lenInBytes");let s=(0,tf.concatBytes)(t,na(t.length,1)),l=na(0,o),c=na(n,2),d=Array(a),u=r((0,tf.concatBytes)(l,e,c,na(0,1),s));d[0]=r((0,tf.concatBytes)(u,na(1,1),s));for(let e=1;e<=a;e++){let t=[function(e,t){let n=new Uint8Array(e.length);for(let r=0;r<e.length;r++)n[r]=e[r]^t[r];return n}(u,d[e-1]),na(e+1,1),s];d[e]=r((0,tf.concatBytes)(...t))}return(0,tf.concatBytes)(...d).slice(0,n)}function nc(e,t,n,r,i){if((0,tf.abytes)(e),(0,tf.abytes)(t),ns(n),t.length>255){let e=Math.ceil(2*r/8);t=i.create({dkLen:e}).update((0,tf.utf8ToBytes)("H2C-OVERSIZE-DST-")).update(t).digest()}if(n>65535||t.length>255)throw Error("expand_message_xof: invalid lenInBytes");return i.create({dkLen:n}).update(e).update(na(n,2)).update(t).update(na(t.length,1)).digest()}function nd(e,t,n){let r;(0,tf.validateObject)(n,{DST:"stringOrUint8Array",p:"bigint",m:"isSafeInteger",k:"isSafeInteger",hash:"hash"});let{p:i,k:o,m:a,hash:s,expand:l,DST:c}=n;(0,tf.abytes)(e),ns(t);let d="string"==typeof c?(0,tf.utf8ToBytes)(c):c,u=Math.ceil((i.toString(2).length+o)/8),h=t*a*u;if("xmd"===l)r=nl(e,d,h,s);else if("xof"===l)r=nc(e,d,h,o,s);else{if("_internal_pass"!==l)throw Error('expand must be "xmd" or "xof"');r=e}let f=Array(t);for(let e=0;e<t;e++){let t=Array(a);for(let n=0;n<a;n++){let o=u*(n+e*a),s=r.subarray(o,o+u);t[n]=(0,th.mod)(no(s),i)}f[e]=t}return f}var nu={};Object.defineProperty(nu,"__esModule",{value:!0}),nu.montgomery=function(e){let t=((0,nf.validateObject)(e,{a:"bigint"},{montgomeryBits:"isSafeInteger",nByteLength:"isSafeInteger",adjustScalarBytes:"function",domain:"function",powPminus2:"function",Gu:"bigint"}),Object.freeze({...e})),{P:n}=t,r=e=>(0,nh.mod)(e,n),i=t.montgomeryBits,o=Math.ceil(i/8),a=t.nByteLength,s=t.adjustScalarBytes||(e=>e),l=t.powPminus2||(e=>(0,nh.pow)(e,n-BigInt(2),n));function c(e,t,n){let i=r(e*(t-n));return[t=r(t-i),n=r(n+i)]}let d=(t.a-BigInt(2))/BigInt(4);function u(e){return(0,nf.numberToBytesLE)(r(e),o)}function h(e,t){let h=function(e,t){(0,nf.aInRange)("u",e,np,n),(0,nf.aInRange)("scalar",t,np,n);let o,a=ng,s=np,u=e,h=ng,f=np;for(let n=BigInt(i-1);n>=np;n--){let i=t>>n&ng;f^=i,a=(o=c(f,a,u))[0],u=o[1],s=(o=c(f,s,h))[0],h=o[1],f=i;let l=a+s,p=r(l*l),g=a-s,m=r(g*g),y=p-m,v=u+h,b=r((u-h)*l),E=r(v*g),w=b+E,S=b-E;u=r(w*w),h=r(e*r(S*S)),a=r(p*m),s=r(y*(p+r(d*y)))}return a=(o=c(f,a,u))[0],u=o[1],s=(o=c(f,s,h))[0],h=o[1],r(a*l(s))}(function(e){let t=(0,nf.ensureBytes)("u coordinate",e,o);return 32===a&&(t[31]&=127),(0,nf.bytesToNumberLE)(t)}(t),function(e){let t=(0,nf.ensureBytes)("scalar",e),n=t.length;if(n!==o&&n!==a)throw Error(`Expected ${o} or ${a} bytes, got ${n}`);return(0,nf.bytesToNumberLE)(s(t))}(e));if(h===np)throw Error("Invalid private or public key received");return u(h)}let f=u(t.Gu);function p(e){return h(e,f)}return{scalarMult:h,scalarMultBase:p,getSharedSecret:(e,t)=>h(e,t),getPublicKey:e=>p(e),utils:{randomPrivateKey:()=>t.randomBytes(t.nByteLength)},GuBytes:f}};let nh=th,nf=tf,np=BigInt(0),ng=BigInt(1);!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hash_to_ristretto255=e.hashToRistretto255=e.RistrettoPoint=e.encodeToCurve=e.hashToCurve=e.edwardsToMontgomery=e.x25519=e.ed25519ph=e.ed25519ctx=e.ed25519=e.ED25519_TORSION_SUBGROUP=void 0,e.edwardsToMontgomeryPub=g,e.edwardsToMontgomeryPriv=function(e){let t=f.hash(e.subarray(0,32));return f.adjustScalarBytes(t).subarray(0,32)};let t=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),n=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),r=BigInt(0),i=BigInt(1),o=BigInt(2),a=BigInt(3),s=BigInt(5),l=BigInt(8);function c(e){let n=BigInt(10),r=BigInt(20),a=BigInt(40),l=BigInt(80),c=e*e%t*e%t,d=(0,th.pow2)(c,o,t)*c%t,u=(0,th.pow2)(d,i,t)*e%t,h=(0,th.pow2)(u,s,t)*u%t,f=(0,th.pow2)(h,n,t)*h%t,p=(0,th.pow2)(f,r,t)*f%t,g=(0,th.pow2)(p,a,t)*p%t,m=(0,th.pow2)(g,l,t)*g%t,y=(0,th.pow2)(m,l,t)*g%t,v=(0,th.pow2)(y,n,t)*h%t;return{pow_p_5_8:(0,th.pow2)(v,o,t)*e%t,b2:c}}function d(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}function u(e,r){let i=(0,th.mod)(r*r*r,t),o=c(e*(0,th.mod)(i*i*r,t)).pow_p_5_8,a=(0,th.mod)(e*i*o,t),s=(0,th.mod)(r*a*a,t),l=a,d=(0,th.mod)(a*n,t),u=s===e,h=s===(0,th.mod)(-e,t),f=s===(0,th.mod)(-e*n,t);return u&&(a=l),(h||f)&&(a=d),(0,th.isNegativeLE)(a,t)&&(a=(0,th.mod)(-a,t)),{isValid:u||h,value:a}}e.ED25519_TORSION_SUBGROUP=["0100000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a","0000000000000000000000000000000000000000000000000000000000000080","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05","ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85","0000000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa"];let h=(0,th.Field)(t,void 0,!0),f={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:h,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:l,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:eA.sha512,randomBytes:e$.randomBytes,adjustScalarBytes:d,uvRatio:u};function p(e,t,n){if(t.length>255)throw Error("Context is too big");return(0,e$.concatBytes)((0,e$.utf8ToBytes)("SigEd25519 no Ed25519 collisions"),new Uint8Array([+!!n,t.length]),t,e)}function g(t){let{y:n}=e.ed25519.ExtendedPoint.fromHex(t),r=BigInt(1);return h.toBytes(h.create((r+n)*h.inv(r-n)))}e.ed25519=(0,td.twistedEdwards)(f),e.ed25519ctx=(0,td.twistedEdwards)({...f,domain:p}),e.ed25519ph=(0,td.twistedEdwards)(Object.assign({},f,{domain:p,prehash:eA.sha512})),e.x25519=(0,nu.montgomery)({P:t,a:BigInt(486662),montgomeryBits:255,nByteLength:32,Gu:BigInt(9),powPminus2:e=>
1{let{pow_p_5_8:n,b2:r}=c(e);return(0,th.mod)((0,th.pow2)(n,a,t)*r,t)},adjustScalarBytes:d,randomBytes:e$.randomBytes}),e.edwardsToMontgomery=g;let m=(h.ORDER+a)/l,y=h.pow(o,m),v=h.sqrt(h.neg(h.ONE)),b=(0,th.FpSqrtEven)(h,h.neg(BigInt(486664))),E=(0,ni.createHasher)(e.ed25519.ExtendedPoint,e=>(function(e){let{xMn:t,xMd:n,yMn:r,yMd:a}=function(e){let t=(h.ORDER-s)/l,n=BigInt(486662),r=h.sqr(e);r=h.mul(r,o);let a=h.add(r,h.ONE),c=h.neg(n),d=h.sqr(a),u=h.mul(d,a),f=h.mul(r,n);f=h.mul(f,c),f=h.add(f,d),f=h.mul(f,c);let p=h.sqr(u);d=h.sqr(p),p=h.mul(p,u),p=h.mul(p,f),d=h.mul(d,p);let g=h.pow(d,t);g=h.mul(g,p);let m=h.mul(g,v);d=h.sqr(g),d=h.mul(d,u);let b=h.eql(d,f),E=h.cmov(m,g,b),w=h.mul(c,r),S=h.mul(g,e);S=h.mul(S,y);let _=h.mul(S,v),C=h.mul(f,r);d=h.sqr(S),d=h.mul(d,u);let x=h.eql(d,C),k=h.cmov(_,S,x);d=h.sqr(E),d=h.mul(d,u);let A=h.eql(d,f),M=h.cmov(w,c,A),I=h.cmov(k,E,A),T=h.isOdd(I);return{xMn:M,xMd:a,yMn:I=h.cmov(I,h.neg(I),A!==T),yMd:i}}(e),c=h.mul(t,a);c=h.mul(c,b);let d=h.mul(n,r),u=h.sub(t,n),f=h.add(t,n),p=h.mul(d,f),g=h.eql(p,h.ZERO);c=h.cmov(c,h.ZERO,g),d=h.cmov(d,h.ONE,g),u=h.cmov(u,h.ONE,g),f=h.cmov(f,h.ONE,g);let m=h.invertBatch([d,f]);return{x:h.mul(c,m[0]),y:h.mul(u,m[1])}})(e[0]),{DST:"edwards25519_XMD:SHA-512_ELL2_RO_",encodeDST:"edwards25519_XMD:SHA-512_ELL2_NU_",p:h.ORDER,m:1,k:128,expand:"xmd",hash:eA.sha512});function w(e){if(!(e instanceof T))throw Error("RistrettoPoint expected")}e.hashToCurve=E.hashToCurve,e.encodeToCurve=E.encodeToCurve;let S=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),_=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),C=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),x=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),k=e=>u(i,e),A=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),M=t=>e.ed25519.CURVE.Fp.create((0,tf.bytesToNumberLE)(t)&A);function I(t){let{d:r}=e.ed25519.CURVE,o=e.ed25519.CURVE.Fp.ORDER,a=e.ed25519.CURVE.Fp.create,s=a(n*t*t),l=a((s+i)*C),c=BigInt(-1),d=a((c-r*s)*a(s+r)),{isValid:h,value:f}=u(l,d),p=a(f*t);(0,th.isNegativeLE)(p,o)||(p=a(-p)),h||(f=p),h||(c=s);let g=a(c*(s-i)*x-d),m=f*f,y=a((f+f)*d),v=a(g*S),b=a(i-m),E=a(i+m);return new e.ed25519.ExtendedPoint(a(y*E),a(b*v),a(v*E),a(y*b))}class T{constructor(e){this.ep=e}static fromAffine(t){return new T(e.ed25519.ExtendedPoint.fromAffine(t))}static hashToCurve(e){let t=I(M((e=(0,tf.ensureBytes)("ristrettoHash",e,64)).slice(0,32))),n=I(M(e.slice(32,64)));return new T(t.add(n))}static fromHex(t){t=(0,tf.ensureBytes)("ristrettoHex",t,32);let{a:n,d:o}=e.ed25519.CURVE,a=e.ed25519.CURVE.Fp.ORDER,s=e.ed25519.CURVE.Fp.create,l="RistrettoPoint.fromHex: the hex is not valid encoding of RistrettoPoint",c=M(t);if(!(0,tf.equalBytes)((0,tf.numberToBytesLE)(c,32),t)||(0,th.isNegativeLE)(c,a))throw Error(l);let d=s(c*c),u=s(i+n*d),h=s(i-n*d),f=s(u*u),p=s(h*h),g=s(n*o*f-p),{isValid:m,value:y}=k(s(g*p)),v=s(y*h),b=s(y*v*g),E=s((c+c)*v);(0,th.isNegativeLE)(E,a)&&(E=s(-E));let w=s(u*b),S=s(E*w);if(!m||(0,th.isNegativeLE)(S,a)||w===r)throw Error(l);return new T(new e.ed25519.ExtendedPoint(E,w,i,S))}toRawBytes(){let t,{ex:r,ey:i,ez:o,et:a}=this.ep,s=e.ed25519.CURVE.Fp.ORDER,l=e.ed25519.CURVE.Fp.create,c=l(l(o+i)*l(o-i)),d=l(r*i),u=l(d*d),{value:h}=k(l(c*u)),f=l(h*c),p=l(h*d),g=l(f*p*a);if((0,th.isNegativeLE)(a*g,s)){let e=l(i*n),o=l(r*n);r=e,i=o,t=l(f*_)}else t=p;(0,th.isNegativeLE)(r*g,s)&&(i=l(-i));let m=l((o-i)*t);return(0,th.isNegativeLE)(m,s)&&(m=l(-m)),(0,tf.numberToBytesLE)(m,32)}toHex(){return(0,tf.bytesToHex)(this.toRawBytes())}toString(){return this.toHex()}equals(t){w(t);let{ex:n,ey:r}=this.ep,{ex:i,ey:o}=t.ep,a=e.ed25519.CURVE.Fp.create,s=a(n*o)===a(r*i),l=a(r*o)===a(n*i);return s||l}add(e){return w(e),new T(this.ep.add(e.ep))}subtract(e){return w(e),new T(this.ep.subtract(e.ep))}multiply(e){return new T(this.ep.multiply(e))}multiplyUnsafe(e){return new T(this.ep.multiplyUnsafe(e))}double(){return new T(this.ep.double())}negate(){return new T(this.ep.negate())}}T.BASE||(T.BASE=new T(e.ed25519.ExtendedPoint.BASE)),T.ZERO||(T.ZERO=new T(e.ed25519.ExtendedPoint.ZERO)),e.RistrettoPoint=T,e.hashToRistretto255=(e,t)=>{let n=t.DST,r="string"==typeof n?(0,e$.utf8ToBytes)(n):n,i=(0,ni.expand_message_xmd)(e,r,64,eA.sha512);return T.hashToCurve(i)},e.hash_to_ristretto255=e.hashToRistretto255}(ek);var nm={},ny={};Object.defineProperty(ny,"__esModule",{value:!0}),ny.sha224=ny.sha256=ny.SHA256=void 0;let nv=eM,nb=new Uint32Array([0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5,0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174,0xe49b69c1,0xefbe4786,0xfc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da,0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x6ca6351,0x14292967,0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85,0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc
176c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070,0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3,0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2]),nE=new Uint32Array([0x6a09e667,0xbb67ae85,0x3c6ef372,0xa54ff53a,0x510e527f,0x9b05688c,0x1f83d9ab,0x5be0cd19]),nw=new Uint32Array(64);class nS extends nv.HashMD{constructor(){super(64,32,8,!1),this.A=0|nE[0],this.B=0|nE[1],this.C=0|nE[2],this.D=0|nE[3],this.E=0|nE[4],this.F=0|nE[5],this.G=0|nE[6],this.H=0|nE[7]}get(){let{A:e,B:t,C:n,D:r,E:i,F:o,G:a,H:s}=this;return[e,t,n,r,i,o,a,s]}set(e,t,n,r,i,o,a,s){this.A=0|e,this.B=0|t,this.C=0|n,this.D=0|r,this.E=0|i,this.F=0|o,this.G=0|a,this.H=0|s}process(e,t){for(let n=0;n<16;n++,t+=4)nw[n]=e.getUint32(t,!1);for(let e=16;e<64;e++){let t=nw[e-15],n=nw[e-2],r=(0,e$.rotr)(t,7)^(0,e$.rotr)(t,18)^t>>>3,i=(0,e$.rotr)(n,17)^(0,e$.rotr)(n,19)^n>>>10;nw[e]=i+nw[e-7]+r+nw[e-16]|0}let{A:n,B:r,C:i,D:o,E:a,F:s,G:l,H:c}=this;for(let e=0;e<64;e++){let t=c+((0,e$.rotr)(a,6)^(0,e$.rotr)(a,11)^(0,e$.rotr)(a,25))+(0,nv.Chi)(a,s,l)+nb[e]+nw[e]|0,d=((0,e$.rotr)(n,2)^(0,e$.rotr)(n,13)^(0,e$.rotr)(n,22))+(0,nv.Maj)(n,r,i)|0;c=l,l=s,s=a,a=o+t|0,o=i,i=r,r=n,n=t+d|0}n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,o=o+this.D|0,a=a+this.E|0,s=s+this.F|0,l=l+this.G|0,c=c+this.H|0,this.set(n,r,i,o,a,s,l,c)}roundClean(){nw.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}ny.SHA256=nS;class n_ extends nS{constructor(){super(),this.A=-0x3efa6128,this.B=0x367cd507,this.C=0x3070dd17,this.D=-0x8f1a6c7,this.E=-4191439,this.F=0x68581511,this.G=0x64f98fa7,this.H=-0x4105b05c,this.outputLen=28}}ny.sha256=(0,e$.wrapConstructor)(()=>new nS),ny.sha224=(0,e$.wrapConstructor)(()=>new n_);var nC={},nx={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hmac=e.HMAC=void 0;let t=e$;class n extends t.Hash{constructor(e,n){super(),this.finished=!1,this.destroyed=!1,(0,eI.hash)(e);let r=(0,t.toBytes)(n);if(this.iHash=e.create(),"function"!=typeof this.iHash.update)throw Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let i=this.blockLen,o=new Uint8Array(i);o.set(r.length>i?e.create().update(r).digest():r);for(let e=0;e<o.length;e++)o[e]^=54;this.iHash.update(o),this.oHash=e.create();for(let e=0;e<o.length;e++)o[e]^=106;this.oHash.update(o),o.fill(0)}update(e){return(0,eI.exists)(this),this.iHash.update(e),this}digestInto(e){(0,eI.exists)(this),(0,eI.bytes)(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));let{oHash:t,iHash:n,finished:r,destroyed:i,blockLen:o,outputLen:a}=this;return e.finished=r,e.destroyed=i,e.blockLen=o,e.outputLen=a,e.oHash=t._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}e.HMAC=n,e.hmac=(e,t,r)=>new n(e,t).update(r).digest(),e.hmac.create=(e,t)=>new n(e,t)}(nx);var nk={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DER=void 0,e.weierstrassPoints=f,e.weierstrass=function(a){let s=function(e){let n=(0,t.validateBasic)(e);return r.validateObject(n,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...n})}(a),{Fp:d,n:u}=s,h=d.BYTES+1,p=2*d.BYTES+1;function g(e){return n.mod(e,u)}function m(e){return n.invert(e,u)}let{ProjectivePoint:y,normPrivateKeyToScalar:v,weierstrassEquation:b,isWithinCurveOrder:E}=f({...s,toBytes(e,t,n){let o=t.toAffine(),a=d.toBytes(o.x),s=r.concatBytes;return(0,i.abool)("isCompressed",n),n?s(Uint8Array.from([t.hasEvenY()?2:3]),a):s(Uint8Array.from([4]),a,d.toBytes(o.y))},fromBytes(e){let t=e.length,n=e[0],i=e.subarray(1);if(t!==h||2!==n&&3!==n){if(t===p&&4===n)return{x:d.fromBytes(i.subarray(0,d.BYTES)),y:d.fromBytes(i.subarray(d.BYTES,2*d.BYTES))};throw Error(`Point of length ${t}
1 was invalid. Expected ${h} compressed bytes or ${p} uncompressed bytes`)}{let e,t=r.bytesToNumberBE(i);if(!r.inRange(t,c,d.ORDER))throw Error("Point is not on curve");let o=b(t);try{e=d.sqrt(o)}catch(e){throw Error("Point is not on curve"+(e instanceof Error?": "+e.message:""))}return 1==(1&n)!=((e&c)===c)&&(e=d.neg(e)),{x:t,y:e}}}}),w=e=>r.bytesToHex(r.numberToBytesBE(e,s.nByteLength)),S=(e,t,n)=>r.bytesToNumberBE(e.slice(t,n));class _{constructor(e,t,n){this.r=e,this.s=t,this.recovery=n,this.assertValidity()}static fromCompact(e){let t=s.nByteLength;return new _(S(e=(0,i.ensureBytes)("compactSignature",e,2*t),0,t),S(e,t,2*t))}static fromDER(t){let{r:n,s:r}=e.DER.toSig((0,i.ensureBytes)("DER",t));return new _(n,r)}assertValidity(){r.aInRange("r",this.r,c,u),r.aInRange("s",this.s,c,u)}addRecoveryBit(e){return new _(this.r,this.s,e)}recoverPublicKey(e){let{r:t,s:n,recovery:r}=this,o=k((0,i.ensureBytes)("msgHash",e));if(null==r||![0,1,2,3].includes(r))throw Error("recovery id invalid");let a=2===r||3===r?t+s.n:t;if(a>=d.ORDER)throw Error("recovery id 2 or 3 invalid");let l=0==(1&r)?"02":"03",c=y.fromHex(l+w(a)),u=m(a),h=g(-o*u),f=g(n*u),p=y.BASE.multiplyAndAddUnsafe(c,h,f);if(!p)throw Error("point at infinify");return p.assertValidity(),p}hasHighS(){return this.s>u>>c}normalizeS(){return this.hasHighS()?new _(this.r,g(-this.s),this.recovery):this}toDERRawBytes(){return r.hexToBytes(this.toDERHex())}toDERHex(){return e.DER.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return r.hexToBytes(this.toCompactHex())}toCompactHex(){return w(this.r)+w(this.s)}}function C(e){let t=r.isBytes(e),n="string"==typeof e,i=(t||n)&&e.length;return t?i===h||i===p:n?i===2*h||i===2*p:e instanceof y}let x=s.bits2int||function(e){let t=r.bytesToNumberBE(e),n=8*e.length-s.nBitLength;return n>0?t>>BigInt(n):t},k=s.bits2int_modN||function(e){return g(x(e))},A=r.bitMask(s.nBitLength);function M(e){return r.aInRange(`num < 2^${s.nBitLength}`,e,l,A),r.numberToBytesBE(e,s.nByteLength)}let I={lowS:s.lowS,prehash:!1},T={lowS:s.lowS,prehash:!1};return y.BASE._setWindowSize(8),{CURVE:s,getPublicKey:function(e,t=!0){return y.fromPrivateKey(e).toRawBytes(t)},getSharedSecret:function(e,t,n=!0){if(C(e))throw Error("first arg must be private key");if(!C(t))throw Error("second arg must be public key");return y.fromHex(t).multiply(v(e)).toRawBytes(n)},sign:function(e,t,n=I){let{seed:a,k2sig:h}=function(e,t,n=I){if(["recovered","canonical"].some(e=>e in n))throw Error("sign() legacy options not supported");let{hash:a,randomBytes:h}=s,{lowS:f,prehash:p,extraEntropy:b}=n;null==f&&(f=!0),e=(0,i.ensureBytes)("msgHash",e),o(n),p&&(e=(0,i.ensureBytes)("prehashed msgHash",a(e)));let w=k(e),S=v(t),C=[M(S),M(w)];if(null!=b&&!1!==b){let e=!0===b?h(d.BYTES):b;C.push((0,i.ensureBytes)("extraEntropy",e))}return{seed:r.concatBytes(...C),k2sig:function(e){let t=x(e);if(!E(t))return;let n=m(t),r=y.BASE.multiply(t).toAffine(),i=g(r.x);if(i===l)return;let o=g(n*g(w+i*S));if(o===l)return;let a=2*(r.x!==i)|Number(r.y&c),s=o;return f&&o>u>>c&&(s=o>u>>c?g(-o):o,a^=1),new _(i,s,a)}}}(e,t,n);return r.createHmacDrbg(s.hash.outputLen,s.nByteLength,s.hmac)(a,h)},verify:function(t,n,a,l=T){let c,d;if(n=(0,i.ensureBytes)("msgHash",n),a=(0,i.ensureBytes)("publicKey",a),"strict"in l)throw Error("options.strict was renamed to lowS");o(l);let{lowS:u,prehash:h}=l;try{if("string"==typeof t||r.isBytes(t))try{c=_.fromDER(t)}catch(n){if(!(n instanceof e.DER.Err))throw n;c=_.fromCompact(t)}else{if("object"!=typeof t||"bigint"!=typeof t.r||"bigint"!=typeof t.s)throw Error("PARSE");{let{r:e,s:n}=t;c=new _(e,n)}}d=y.fromHex(a)}catch(e){if("PARSE"===e.message)throw Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(u&&c.hasHighS())return!1;h&&(n=s.hash(n));let{r:f,s:p}=c,v=k(n),b=m(p),E=g(v*b),w=g(f*b),S=y.BASE.multiplyAndAddUnsafe(d,E,w)?.toAffine();return!!S&&g(S.x)===f},ProjectivePoint:y,Signature:_,utils:{isValidPrivateKey(e){try{return v(e),!0}catch(e){return!1}},normPrivateKeyToScalar:v,randomPrivateKey:()=>{let e=n.getMinHashLength(s.n);return n.mapHashToField(s.randomBytes(e),s.n)},precompute:(e=8,t=y.BASE)=>(t._setWindowSize(e),t.multiply(BigInt(3)),t)}}},e.SWUFpSqrtRatio=p,e.mapToCurveSimpleSWU=function(e,t){if(n.validateField(e),!e.isValid(t.A)||!e.isValid(t.B)||!e.isValid(t.Z))throw Error("mapToCurveSimpleSWU: invali
1d opts");let r=p(e,t.Z);if(!e.isOdd)throw Error("Fp.isOdd is not implemented!");return n=>{let i,o,a,s,l,c,d,u;i=e.sqr(n),i=e.mul(i,t.Z),o=e.sqr(i),o=e.add(o,i),a=e.add(o,e.ONE),a=e.mul(a,t.B),s=e.cmov(t.Z,e.neg(o),!e.eql(o,e.ZERO)),s=e.mul(s,t.A),o=e.sqr(a),c=e.sqr(s),l=e.mul(c,t.A),o=e.add(o,l),o=e.mul(o,a),c=e.mul(c,s),l=e.mul(c,t.B),o=e.add(o,l),d=e.mul(i,a);let{isValid:h,value:f}=r(o,c);u=e.mul(i,n),u=e.mul(u,f),d=e.cmov(d,a,h),u=e.cmov(u,f,h);let p=e.isOdd(n)===e.isOdd(u);return u=e.cmov(e.neg(u),u,p),{x:d=e.div(d,s),y:u}}};let t=tu,n=th,r=tf,i=tf;function o(e){void 0!==e.lowS&&(0,i.abool)("lowS",e.lowS),void 0!==e.prehash&&(0,i.abool)("prehash",e.prehash)}let{bytesToNumberBE:a,hexToBytes:s}=r;e.DER={Err:class extends Error{constructor(e=""){super(e)}},_tlv:{encode:(t,n)=>{let{Err:i}=e.DER;if(t<0||t>256)throw new i("tlv.encode: wrong tag");if(1&n.length)throw new i("tlv.encode: unpadded data");let o=n.length/2,a=r.numberToHexUnpadded(o);if(a.length/2&128)throw new i("tlv.encode: long form length too big");let s=o>127?r.numberToHexUnpadded(a.length/2|128):"";return`${r.numberToHexUnpadded(t)}${s}${a}${n}`},decode(t,n){let{Err:r}=e.DER,i=0;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(n.length<2||n[i++]!==t)throw new r("tlv.decode: wrong tlv");let o=n[i++],a=0;if(128&o){let e=127&o;if(!e)throw new r("tlv.decode(long): indefinite length not supported");if(e>4)throw new r("tlv.decode(long): byte length is too big");let t=n.subarray(i,i+e);if(t.length!==e)throw new r("tlv.decode: length bytes not complete");if(0===t[0])throw new r("tlv.decode(long): zero leftmost byte");for(let e of t)a=a<<8|e;if(i+=e,a<128)throw new r("tlv.decode(long): not minimal encoding")}else a=o;let s=n.subarray(i,i+a);if(s.length!==a)throw new r("tlv.decode: wrong value length");return{v:s,l:n.subarray(i+a)}}},_int:{encode(t){let{Err:n}=e.DER;if(t<l)throw new n("integer: negative integers are not allowed");let i=r.numberToHexUnpadded(t);if(8&Number.parseInt(i[0],16)&&(i="00"+i),1&i.length)throw new n("unexpected assertion");return i},decode(t){let{Err:n}=e.DER;if(128&t[0])throw new n("Invalid signature integer: negative");if(0===t[0]&&!(128&t[1]))throw new n("Invalid signature integer: unnecessary leading zero");return a(t)}},toSig(t){let{Err:n,_int:i,_tlv:o}=e.DER,a="string"==typeof t?s(t):t;r.abytes(a);let{v:l,l:c}=o.decode(48,a);if(c.length)throw new n("Invalid signature: left bytes after parsing");let{v:d,l:u}=o.decode(2,l),{v:h,l:f}=o.decode(2,u);if(f.length)throw new n("Invalid signature: left bytes after parsing");return{r:i.decode(d),s:i.decode(h)}},hexFromSig(t){let{_tlv:n,_int:r}=e.DER,i=`${n.encode(2,r.encode(t.r))}${n.encode(2,r.encode(t.s))}`;return n.encode(48,i)}};let l=BigInt(0),c=BigInt(1),d=BigInt(2),u=BigInt(3),h=BigInt(4);function f(e){let o=function(e){let n=(0,t.validateBasic)(e);r.validateObject(n,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});let{endo:i,Fp:o,a:a}=n;if(i){if(!o.eql(a,o.ZERO))throw Error("Endomorphism can only be defined for Koblitz curves that have a=0");if("object"!=typeof i||"bigint"!=typeof i.beta||"function"!=typeof i.splitScalar)throw Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...n})}(e),{Fp:a}=o,s=n.Field(o.n,o.nBitLength),d=o.toBytes||((e,t,n)=>{let i=t.toAffine();return r.concatBytes(Uint8Array.from([4]),a.toBytes(i.x),a.toBytes(i.y))}),h=o.fromBytes||(e=>{let t=e.subarray(1);return{x:a.fromBytes(t.subarray(0,a.BYTES)),y:a.fromBytes(t.subarray(a.BYTES,2*a.BYTES))}});function f(e){let{a:t,b:n}=o,r=a.sqr(e),i=a.mul(r,e);return a.add(a.add(i,a.mul(e,t)),n)}if(!a.eql(a.sqr(o.Gy),f(o.Gx)))throw Error("bad generator point: equation left != right");function p(e){let t,{allowedPrivateKeyLengths:a,nByteLength:s,wrapPrivateKey:l,n:d}=o;if(a&&"bigint"!=typeof e){if(r.isBytes(e)&&(e=r.bytesToHex(e)),"string"!=typeof e||!a.includes(e.length))throw Error("Invalid key");e=e.padStart(2*s,"0")}try{t="bigint"==typeof e?e:r.bytesToNumberBE((0,i.ensureBytes)("private key",e,s))}catch(t){throw Error(`private key must be ${s} bytes, hex or bigint, not ${typeof e}`)}return l&&(t=n.mod(t,d)),r.aInRange("private key",t,c,d),t}function g(e){if(!(e instanceof v))throw Error("ProjectivePoint expected")}let m=(0,i.memoized)((e,t)=>{let{px:n,py:r,pz:i}=e;if(a.eql(i,a.ONE))return{x:n,y:r};let o=e.is0();null==t&&(t=o?a.ONE:a.inv(i));let s=a.mul(n,t),l=a.mul(r,t),c=a.mul(i,t);if(o)return{x:a.ZERO,y:a.ZERO};
vendor: 4,337 bytes, line 1
1if(!a.eql(c,a.ONE))throw Error("invZ was invalid");return{x:s,y:l}}),y=(0,i.memoized)(e=>{if(e.is0()){if(o.allowInfinityPoint&&!a.is0(e.py))return;throw Error("bad point: ZERO")}let{x:t,y:n}=e.toAffine();if(!a.isValid(t)||!a.isValid(n))throw Error("bad point: x or y not FE");let r=a.sqr(n),i=f(t);if(!a.eql(r,i))throw Error("bad point: equation left != right");if(!e.isTorsionFree())throw Error("bad point: not in prime-order subgroup");return!0});class v{constructor(e,t,n){if(this.px=e,this.py=t,this.pz=n,null==e||!a.isValid(e))throw Error("x required");if(null==t||!a.isValid(t))throw Error("y required");if(null==n||!a.isValid(n))throw Error("z required");Object.freeze(this)}static fromAffine(e){let{x:t,y:n}=e||{};if(!e||!a.isValid(t)||!a.isValid(n))throw Error("invalid affine point");if(e instanceof v)throw Error("projective point not allowed");let r=e=>a.eql(e,a.ZERO);return r(t)&&r(n)?v.ZERO:new v(t,n,a.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(e){let t=a.invertBatch(e.map(e=>e.pz));return e.map((e,n)=>e.toAffine(t[n])).map(v.fromAffine)}static fromHex(e){let t=v.fromAffine(h((0,i.ensureBytes)("pointHex",e)));return t.assertValidity(),t}static fromPrivateKey(e){return v.BASE.multiply(p(e))}static msm(e,n){return(0,t.pippenger)(v,s,e,n)}_setWindowSize(e){E.setWindowSize(this,e)}assertValidity(){y(this)}hasEvenY(){let{y:e}=this.toAffine();if(a.isOdd)return!a.isOdd(e);throw Error("Field doesn't support isOdd")}equals(e){g(e);let{px:t,py:n,pz:r}=this,{px:i,py:o,pz:s}=e,l=a.eql(a.mul(t,s),a.mul(i,r)),c=a.eql(a.mul(n,s),a.mul(o,r));return l&&c}negate(){return new v(this.px,a.neg(this.py),this.pz)}double(){let{a:e,b:t}=o,n=a.mul(t,u),{px:r,py:i,pz:s}=this,l=a.ZERO,c=a.ZERO,d=a.ZERO,h=a.mul(r,r),f=a.mul(i,i),p=a.mul(s,s),g=a.mul(r,i);return g=a.add(g,g),d=a.mul(r,s),d=a.add(d,d),l=a.mul(e,d),c=a.mul(n,p),c=a.add(l,c),l=a.sub(f,c),c=a.add(f,c),c=a.mul(l,c),l=a.mul(g,l),d=a.mul(n,d),p=a.mul(e,p),g=a.sub(h,p),g=a.mul(e,g),g=a.add(g,d),d=a.add(h,h),h=a.add(d,h),h=a.add(h,p),h=a.mul(h,g),c=a.add(c,h),p=a.mul(i,s),p=a.add(p,p),h=a.mul(p,g),l=a.sub(l,h),d=a.mul(p,f),d=a.add(d,d),new v(l,c,d=a.add(d,d))}add(e){g(e);let{px:t,py:n,pz:r}=this,{px:i,py:s,pz:l}=e,c=a.ZERO,d=a.ZERO,h=a.ZERO,f=o.a,p=a.mul(o.b,u),m=a.mul(t,i),y=a.mul(n,s),b=a.mul(r,l),E=a.add(t,n),w=a.add(i,s);E=a.mul(E,w),w=a.add(m,y),E=a.sub(E,w),w=a.add(t,r);let S=a.add(i,l);return w=a.mul(w,S),S=a.add(m,b),w=a.sub(w,S),S=a.add(n,r),c=a.add(s,l),S=a.mul(S,c),c=a.add(y,b),S=a.sub(S,c),h=a.mul(f,w),c=a.mul(p,b),h=a.add(c,h),c=a.sub(y,h),h=a.add(y,h),d=a.mul(c,h),y=a.add(m,m),y=a.add(y,m),b=a.mul(f,b),w=a.mul(p,w),y=a.add(y,b),b=a.sub(m,b),b=a.mul(f,b),w=a.add(w,b),m=a.mul(y,w),d=a.add(d,m),m=a.mul(S,w),c=a.mul(E,c),c=a.sub(c,m),m=a.mul(E,y),h=a.mul(S,h),new v(c,d,h=a.add(h,m))}subtract(e){return this.add(e.negate())}is0(){return this.equals(v.ZERO)}wNAF(e){return E.wNAFCached(this,e,v.normalizeZ)}multiplyUnsafe(e){r.aInRange("scalar",e,l,o.n);let t=v.ZERO;if(e===l)return t;if(e===c)return this;let{endo:n}=o;if(!n)return E.unsafeLadder(this,e);let{k1neg:i,k1:s,k2neg:d,k2:u}=n.splitScalar(e),h=t,f=t,p=this;for(;s>l||u>l;)s&c&&(h=h.add(p)),u&c&&(f=f.add(p)),p=p.double(),s>>=c,u>>=c;return i&&(h=h.negate()),d&&(f=f.negate()),f=new v(a.mul(f.px,n.beta),f.py,f.pz),h.add(f)}multiply(e){let t,n,{endo:i,n:s}=o;if(r.aInRange("scalar",e,c,s),i){let{k1neg:r,k1:o,k2neg:s,k2:l}=i.splitScalar(e),{p:c,f:d}=this.wNAF(o),{p:u,f:h}=this.wNAF(l);c=E.constTimeNegate(r,c),u=E.constTimeNegate(s,u),u=new v(a.mul(u.px,i.beta),u.py,u.pz),t=c.add(u),n=d.add(h)}else{let{p:r,f:i}=this.wNAF(e);t=r,n=i}return v.normalizeZ([t,n])[0]}multiplyAndAddUnsafe(e,t,n){let r=v.BASE,i=(e,t)=>t!==l&&t!==c&&e.equals(r)?e.multiply(t):e.multiplyUnsafe(t),o=i(this,t).add(i(e,n));return o.is0()?void 0:o}toAffine(e){return m(this,e)}isTorsionFree(){let{h:e,isTorsionFree:t}=o;if(e===c)return!0;if(t)return t(v,this);throw Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:e,clearCofactor:t}=o;return e===c?this:t?t(v,this):this.multiplyUnsafe(o.h)}toRawBytes(e=!0){return(0,i.abool)("isCompressed",e),this.assertValidity(),d(v,this,e)}toHex(e=!0){return(0,i.abool)("isCompressed",e),r.bytesToHex(this.toRawBytes(e))}}v.BASE=new v(o.Gx,o.Gy,a.ONE),v.ZERO=new v(a.ZERO,a.ONE,a.ZERO);
1let b=o.nBitLength,E=(0,t.wNAF)(v,o.endo?Math.ceil(b/2):b);return{CURVE:o,ProjectivePoint:v,normPrivateKeyToScalar:p,weierstrassEquation:f,isWithinCurveOrder:function(e){return r.inRange(e,c,o.n)}}}function p(e,t){let n=e.ORDER,r=l;for(let e=n-c;e%d===l;e/=d)r+=c;let i=r,o=d<<i-c-c,a=o*d,s=(n-c)/a,f=(s-c)/d,p=a-c,g=e.pow(t,s),m=e.pow(t,(s+c)/d),y=(t,n)=>{let r=g,a=e.pow(n,p),s=e.sqr(a);s=e.mul(s,n);let l=e.mul(t,s);l=e.pow(l,f),l=e.mul(l,a),a=e.mul(l,n),s=e.mul(l,t);let u=e.mul(s,a);l=e.pow(u,o);let h=e.eql(l,e.ONE);a=e.mul(s,m),l=e.mul(u,r),s=e.cmov(a,s,h),u=e.cmov(l,u,h);for(let t=i;t>c;t--){let n=t-d;n=d<<n-c;let i=e.pow(u,n),o=e.eql(i,e.ONE);a=e.mul(s,r),r=e.mul(r,r),i=e.mul(u,r),s=e.cmov(a,s,o),u=e.cmov(i,u,o)}return{isValid:h,value:s}};if(e.ORDER%h===u){let n=(e.ORDER-u)/h,r=e.sqrt(e.neg(t));y=(t,i)=>{let o=e.sqr(i),a=e.mul(t,i);o=e.mul(o,a);let s=e.pow(o,n);s=e.mul(s,a);let l=e.mul(s,r),c=e.mul(e.sqr(s),i),d=e.eql(c,t);return{isValid:d,value:e.cmov(l,s,d)}}}return y}}(nk),Object.defineProperty(nC,"__esModule",{value:!0}),nC.getHash=nM,nC.createCurve=function(e,t){let n=t=>(0,nA.weierstrass)({...e,...nM(t)});return Object.freeze({...n(t),create:n})};let nA=nk;function nM(e){return{hash:e,hmac:(t,...n)=>(0,nx.hmac)(e,t,(0,e$.concatBytes)(...n)),randomBytes:e$.randomBytes}}!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.encodeToCurve=e.hashToCurve=e.schnorr=e.secp256k1=void 0;let t=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),r=BigInt(1),i=BigInt(2),o=(e,t)=>(e+t/i)/t;function a(e){let n=BigInt(3),r=BigInt(6),o=BigInt(11),a=BigInt(22),l=BigInt(23),c=BigInt(44),d=BigInt(88),u=e*e*e%t,h=u*u*e%t,f=(0,th.pow2)(h,n,t)*h%t,p=(0,th.pow2)(f,n,t)*h%t,g=(0,th.pow2)(p,i,t)*u%t,m=(0,th.pow2)(g,o,t)*g%t,y=(0,th.pow2)(m,a,t)*m%t,v=(0,th.pow2)(y,c,t)*y%t,b=(0,th.pow2)(v,d,t)*v%t,E=(0,th.pow2)(b,c,t)*y%t,w=(0,th.pow2)(E,n,t)*h%t,S=(0,th.pow2)(w,l,t)*m%t,_=(0,th.pow2)(S,r,t)*u%t,C=(0,th.pow2)(_,i,t);if(!s.eql(s.sqr(C),e))throw Error("Cannot find square root");return C}let s=(0,th.Field)(t,void 0,void 0,{sqrt:a});e.secp256k1=(0,nC.createCurve)({a:BigInt(0),b:BigInt(7),Fp:s,n:n,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{let t=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),i=-r*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),a=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=BigInt("0x100000000000000000000000000000000"),l=o(t*e,n),c=o(-i*e,n),d=(0,th.mod)(e-l*t-c*a,n),u=(0,th.mod)(-l*i-c*t,n),h=d>s,f=u>s;if(h&&(d=n-d),f&&(u=n-u),d>s||u>s)throw Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:h,k1:d,k2neg:f,k2:u}}}},ny.sha256);let l=BigInt(0),c={};function d(e,...t){let n=c[e];if(void 0===n){let t=(0,ny.sha256)(Uint8Array.from(e,e=>e.charCodeAt(0)));n=(0,tf.concatBytes)(t,t),c[e]=n}return(0,ny.sha256)((0,tf.concatBytes)(n,...t))}let u=e=>e.toRawBytes(!0).slice(1),h=e=>(0,tf.numberToBytesBE)(e,32),f=e=>(0,th.mod)(e,t),p=e=>(0,th.mod)(e,n),g=e.secp256k1.ProjectivePoint,m=(e,t,n)=>g.BASE.multiplyAndAddUnsafe(e,t,n);function y(t){let n=e.secp256k1.utils.normPrivateKeyToScalar(t),r=g.fromPrivateKey(n);return{scalar:r.hasEvenY()?n:p(-n),bytes:u(r)}}function v(e){(0,tf.aInRange)("x",e,r,t);let n=f(e*e),o=a(f(n*e+BigInt(7)));o%i!==l&&(o=f(-o));let s=new g(e,o,r);return s.assertValidity(),s}let b=tf.bytesToNumberBE;function E(...e){return p(b(d("BIP0340/challenge",...e)))}function w(e,i,o){let a=(0,tf.ensureBytes)("signature",e,64),s=(0,tf.ensureBytes)("message",i),l=(0,tf.ensureBytes)("publicKey",o,32);try{let e=v(b(l)),i=b(a.subarray(0,32));if(!(0,tf.inRange)(i,r,t))return!1;let o=b(a.subarray(32,64));if(!(0,tf.inRange)(o,r,n))return!1;let c=E(h(i),u(e),s),d=m(e,o,p(-c));return!(!d||!d.hasEvenY()||d.toAffine().x!==i)}catch(e){return!1}}e.schnorr={getPublicKey:function(e){return y(e).bytes},sign:function(e,t,n=(0,e$.randomBytes)(32)){let r=(0,tf.ensureBytes)("message",e),{bytes:i,scalar:o}=y(t),a=h(o^b(d("BIP0340/aux",(0,tf.ensureBytes)("auxRand",n,32)))),s=p(b(d("BIP0340/nonce",a,i,r)));if(s===l)throw Error("sign failed: k is zero");let{bytes:c,scalar:u}=y(s),f=E(c,i,r),g=new Uint8Array(64);if(g.set(c,0),g.set(h(p(u+f*o)),32),!w(g,r,i))throw Error("sign: Invalid signature produced");return g},verify:w,utils:{randomPrivateKey:e.secp256k1.utils.randomPrivateKey,lift_x:v,pointToBytes:u,numberToBytesBE:tf.numberToBytesBE,bytesToNumberBE:tf.bytesToNumberBE,taggedHash:d,mod:th.mod}};let S=(0,ni.isogenyMap)(s,[["0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7","0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581","0x534c328d23f234e6e2a4
113deca25caece4506144037c40314ecbd0b53d9dd262","0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c"],["0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b","0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14","0x0000000000000000000000000000000000000000000000000000000000000001"],["0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c","0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3","0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931","0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84"],["0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b","0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573","0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f","0x0000000000000000000000000000000000000000000000000000000000000001"]].map(e=>e.map(e=>BigInt(e)))),_=(0,nk.mapToCurveSimpleSWU)(s,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:s.create(BigInt("-11"))}),C=(0,ni.createHasher)(e.secp256k1.ProjectivePoint,e=>{let{x:t,y:n}=_(s.create(e[0]));return S(t,n)},{DST:"secp256k1_XMD:SHA-256_SSWU_RO_",encodeDST:"secp256k1_XMD:SHA-256_SSWU_NU_",p:s.ORDER,m:1,k:128,expand:"xmd",hash:ny.sha256});e.hashToCurve=C.hashToCurve,e.encodeToCurve=C.encodeToCurve}(nm);var nI={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.decodeHex=e.remove0x=void 0,e.remove0x=function(e){return e.startsWith("0x")||e.startsWith("0X")?e.slice(2):e},e.decodeHex=function(t){return(0,ec.hexToBytes)((0,e.remove0x)(t))}}(nI),function(e){function t(e,t,n,r){if("secp256k1"===e)return t(nm.secp256k1);if("x25519"===e)return n(ek.x25519);if("ed25519"===e)return r(ek.ed25519);throw Error("Not implemented")}Object.defineProperty(e,"__esModule",{value:!0}),e.hexToPublicKey=e.convertPublicKeyFormat=e.getSharedPoint=e.getPublicKey=e.isValidPrivateKey=e.getValidSecret=void 0,e.getValidSecret=function(){var t;do t=(0,eC.randomBytes)(eb.SECRET_KEY_LENGTH);while(!(0,e.isValidPrivateKey)(t));return t},e.isValidPrivateKey=function(e){return t((0,ev.ellipticCurve)(),function(t){return t.utils.isValidPrivateKey(e)},function(){return!0},function(){return!0})},e.getPublicKey=function(e){return t((0,ev.ellipticCurve)(),function(t){return t.getPublicKey(e)},function(t){return t.getPublicKey(e)},function(t){return t.getPublicKey(e)})},e.getSharedPoint=function(e,n,i){return t((0,ev.ellipticCurve)(),function(t){return t.getSharedSecret(e,n,i)},function(t){return t.getSharedSecret(e,n)},function(t){return r(t,e,n)})},e.convertPublicKeyFormat=function(e,n){return t((0,ev.ellipticCurve)(),function(t){return t.getSharedSecret(BigInt(1),e,n)},function(){return e},function(){return e})},e.hexToPublicKey=function(e){var r=(0,nI.decodeHex)(e);return t((0,ev.ellipticCurve)(),function(){return n(r)},function(){return r},function(){return r})};var n=function(e){if(e.length===eb.ETH_PUBLIC_KEY_SIZE){var t=new Uint8Array(1+e.length);return t.set([4]),t.set(e,1),t}return e},r=function(e,t,n){var r=e.utils.getExtendedPublicKey(t).scalar;return e.ExtendedPoint.fromHex(n).multiply(r).toRawBytes()}}(e_);var nT={},nR={};function nP(e,t,n){return(0,eI.hash)(e),void 0===n&&(n=new Uint8Array(e.outputLen)),(0,nx.hmac)(e,(0,e$.toBytes)(n),(0,e$.toBytes)(t))}Object.defineProperty(nR,"__esModule",{value:!0}),nR.hkdf=void 0,nR.extract=nP,nR.expand=nL;let nO=new Uint8Array([0]),nN=new Uint8Array;function nL(e,t,n,r=32){if((0,eI.hash)(e),(0,eI.number)(r),r>255*e.outputLen)throw Error("Length should be <= 255*HashLen");let i=Math.ceil(r/e.outputLen);void 0===n&&(n=nN);let o=new Uint8Array(i*e.outputLen),a=nx.hmac.create(e,t),s=a._cloneInto(),l=new Uint8Array(a.outputLen);for(let t=0;t<i;t++)nO[0]=t+1,s.update(0===t?nN:l).update(n).update(nO).digestInto(l),o.set(l,e.outputLen*t),a._cloneInto(s);return a.destroy(),s.destroy(),l.fill(0),nO.fill(0),o.slice(0,r)}nR.hkdf=(e,t,n,r,i)=>nL(e,nP(e,t,n),r,i),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getSharedKey=e.deriveKey=void 0,e.deriveKey=function(e,t,n){return(0,nR.hkdf)(ny.sha256,e,t,n,32)},e.getSharedKey=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return(0,e.deriveKey)(ec.concatBytes.apply(void 0,t))}}(nT);var nD={},n$={},nB={},nK={};Object.defineProperty(nK,"__esModule",{value:!0}),nK.polyval=nK.ghash=void 0,nK._toGHASHKey=nF;let nj=new Uint8Array(16),nU=(0,ec.u32)(nj),nH=e=>(e>>>0&255)<<24|(e>>>8&255)<<16|(e>>>16&255)<<8|e>>>24&255;function nF(e){e.reverse();let t=1&e[15],n=0;for(let t=0;t<e.length;t++){let r=e[t];e[t]=r>>>1|n,n=(1&r)<<7}return e[0]^=225&-t,e}class nz{constructor(e,t){var n,r,i,o;this.blockLen=16,this.outputLen=16,this.s0=0,this.s1=0,this.s2=0,this.s3=0,this.finished=!1,e=(0,ec.toBytes)(e),(0,ed.bytes)(e,16);let a=(0,ec.createView)(e),s=a.getUint32(0,!1),l=a.getUint32(4,!1),c=a.getUint32(8,!1),d=a.getUint32(12,!1),u=[];for(let e=0;e<128;
1e++)u.push({s0:nH(s),s1:nH(l),s2:nH(c),s3:nH(d)}),{s0:s,s1:l,s2:c,s3:d}={s3:(i=c)<<31|(o=d)>>>1,s2:(r=l)<<31|i>>>1,s1:(n=s)<<31|r>>>1,s0:n>>>1^-0x1f000000&-(1&o)};let h=(e=>e>65536?8:e>1024?4:2)(t||1024);if(![1,2,4,8].includes(h))throw Error(`ghash: wrong window size=${h}, should be 2, 4 or 8`);this.W=h;let f=128/h,p=this.windowSize=2**h,g=[];for(let e=0;e<f;e++)for(let t=0;t<p;t++){let n=0,r=0,i=0,o=0;for(let a=0;a<h;a++){if(!(t>>>h-a-1&1))continue;let{s0:s,s1:l,s2:c,s3:d}=u[h*e+a];n^=s,r^=l,i^=c,o^=d}g.push({s0:n,s1:r,s2:i,s3:o})}this.t=g}_updateBlock(e,t,n,r){e^=this.s0,t^=this.s1,n^=this.s2,r^=this.s3;let{W:i,t:o,windowSize:a}=this,s=0,l=0,c=0,d=0,u=(1<<i)-1,h=0;for(let f of[e,t,n,r])for(let e=0;e<4;e++){let t=f>>>8*e&255;for(let e=8/i-1;e>=0;e--){let{s0:n,s1:r,s2:f,s3:p}=o[h*a+(t>>>i*e&u)];s^=n,l^=r,c^=f,d^=p,h+=1}}this.s0=s,this.s1=l,this.s2=c,this.s3=d}update(e){e=(0,ec.toBytes)(e),(0,ed.exists)(this);let t=(0,ec.u32)(e),n=Math.floor(e.length/16),r=e.length%16;for(let e=0;e<n;e++)this._updateBlock(t[4*e+0],t[4*e+1],t[4*e+2],t[4*e+3]);return r&&(nj.set(e.subarray(16*n)),this._updateBlock(nU[0],nU[1],nU[2],nU[3]),(0,ec.clean)(nU)),this}destroy(){let{t:e}=this;for(let t of e)t.s0=0,t.s1=0,t.s2=0,t.s3=0}digestInto(e){(0,ed.exists)(this),(0,ed.output)(e,this),this.finished=!0;let{s0:t,s1:n,s2:r,s3:i}=this,o=(0,ec.u32)(e);return o[0]=t,o[1]=n,o[2]=r,o[3]=i,e}digest(){let e=new Uint8Array(16);return this.digestInto(e),this.destroy(),e}}class nq extends nz{constructor(e,t){e=(0,ec.toBytes)(e);let n=nF((0,ec.copyBytes)(e));super(n,t),(0,ec.clean)(n)}update(e){e=(0,ec.toBytes)(e),(0,ed.exists)(this);let t=(0,ec.u32)(e),n=e.length%16,r=Math.floor(e.length/16);for(let e=0;e<r;e++)this._updateBlock(nH(t[4*e+3]),nH(t[4*e+2]),nH(t[4*e+1]),nH(t[4*e+0]));return n&&(nj.set(e.subarray(16*r)),this._updateBlock(nH(nU[3]),nH(nU[2]),nH(nU[1]),nH(nU[0])),(0,ec.clean)(nU)),this}digestInto(e){(0,ed.exists)(this),(0,ed.output)(e,this),this.finished=!0;let{s0:t,s1:n,s2:r,s3:i}=this,o=(0,ec.u32)(e);return o[0]=t,o[1]=n,o[2]=r,o[3]=i,e.reverse()}}function nW(e){let t=(t,n)=>e(n,t.length).update((0,ec.toBytes)(t)).digest(),n=e(new Uint8Array(16),0);return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=(t,n)=>e(t,n),t}nK.ghash=nW((e,t)=>new nz(e,t)),nK.polyval=nW((e,t)=>new nq(e,t)),Object.defineProperty(nB,"__esModule",{value:!0}),nB.unsafe=nB.aeskwp=nB.aeskw=nB.siv=nB.gcm=nB.cfb=nB.cbc=nB.ecb=nB.ctr=void 0,nB.expandKeyLE=n8,nB.expandKeyDecLE=n6;let nV=new Uint8Array(16);function nG(e){return e<<1^283&-(e>>7)}function nY(e,t){let n=0;for(;t>0;t>>=1)n^=e&-(1&t),e=nG(e);return n}let nZ=(()=>{let e=new Uint8Array(256);for(let t=0,n=1;t<256;t++,n^=nG(n))e[t]=n;let t=new Uint8Array(256);t[0]=99;for(let n=0;n<255;n++){let r=e[255-n];r|=r<<8,t[e[n]]=255&(r^r>>4^r>>5^r>>6^r>>7^99)}return(0,ec.clean)(e),t})(),nJ=nZ.map((e,t)=>nZ.indexOf(t)),nQ=e=>e<<24|e>>>8,nX=e=>e<<8|e>>>24,n0=e=>e<<24&0xff000000|e<<8&0xff0000|e>>>8&65280|e>>>24&255;function n1(e,t){if(256!==e.length)throw Error("Wrong sbox length");let n=new Uint32Array(256).map((n,r)=>t(e[r])),r=n.map(nX),i=r.map(nX),o=i.map(nX),a=new Uint32Array(65536),s=new Uint32Array(65536),l=new Uint16Array(65536);for(let t=0;t<256;t++)for(let c=0;c<256;c++){let d=256*t+c;a[d]=n[t]^r[c],s[d]=i[t]^o[c],l[d]=e[t]<<8|e[c]}return{sbox:e,sbox2:l,T0:n,T1:r,T2:i,T3:o,T01:a,T23:s}}let n2=n1(nZ,e=>nY(e,3)<<24|e<<16|e<<8|nY(e,2)),n3=n1(nJ,e=>nY(e,11)<<24|nY(e,13)<<16|nY(e,9)<<8|nY(e,14)),n5=(()=>{let e=new Uint8Array(16);for(let t=0,n=1;t<16;t++,n=nG(n))e[t]=n;return e})();function n8(e){(0,ed.bytes)(e);let t=e.length;if(![16,24,32].includes(t))throw Error(`aes: wrong key size: should be 16, 24 or 32, got: ${t}`);let{sbox2:n}=n2,r=[];(0,ec.isAligned32)(e)||r.push(e=(0,ec.copyBytes)(e));let i=(0,ec.u32)(e),o=i.length,a=e=>n9(n,e,e,e,e),s=new Uint32Array(t+28);s.set(i);for(let e=o;e<s.length;e++){let t=s[e-1];e%o==0?t=a(nQ(t))^n5[e/o-1]:o>6&&e%o==4&&(t=a(t)),s[e]=s[e-o]^t}return(0,ec.clean)(...r),s}function n6(e){let t=n8(e),n=t.slice(),r=t.length,{sbox2:i}=n2,{T0:o,T1:a,T2:s,T3:l}=n3;for(let e=0;e<r;e+=4)for(let i=0;i<4;i++)n[e+i]=t[r-e-4+i];(0,ec.clean)(t);for(let e=4;e<r-4;e++){let t=n[e],r=n9(i,t,t,t,t);n[e]=o[255&r]^a[r>>>8&255]^s[r>>>16&255]^l[r>>>24]}return n}function n4(e,t,n,r,i,o){return e[n<<8&65280|r>>>8&255]^t[i>>>8&65280|o>>>24&255]}function n9(e,t,n,r,i){return e[255&t|65280&n]|e[r>>>16&255|i>>>16&65280]<<16}
1function n7(e,t,n,r,i){let{sbox2:o,T01:a,T23:s}=n2,l=0;t^=e[l++],n^=e[l++],r^=e[l++],i^=e[l++];let c=e.length/4-2;for(let o=0;o<c;o++){let o=e[l++]^n4(a,s,t,n,r,i),c=e[l++]^n4(a,s,n,r,i,t),d=e[l++]^n4(a,s,r,i,t,n),u=e[l++]^n4(a,s,i,t,n,r);t=o,n=c,r=d,i=u}return{s0:e[l++]^n9(o,t,n,r,i),s1:e[l++]^n9(o,n,r,i,t),s2:e[l++]^n9(o,r,i,t,n),s3:e[l++]^n9(o,i,t,n,r)}}function re(e,t,n,r,i){let{sbox2:o,T01:a,T23:s}=n3,l=0;t^=e[l++],n^=e[l++],r^=e[l++],i^=e[l++];let c=e.length/4-2;for(let o=0;o<c;o++){let o=e[l++]^n4(a,s,t,i,r,n),c=e[l++]^n4(a,s,n,t,i,r),d=e[l++]^n4(a,s,r,n,t,i),u=e[l++]^n4(a,s,i,r,n,t);t=o,n=c,r=d,i=u}return{s0:e[l++]^n9(o,t,i,r,n),s1:e[l++]^n9(o,n,t,i,r),s2:e[l++]^n9(o,r,n,t,i),s3:e[l++]^n9(o,i,r,n,t)}}function rt(e,t){if(void 0===t)return new Uint8Array(e);if((0,ed.bytes)(t),t.length<e)throw Error(`aes: wrong destination length, expected at least ${e}, got: ${t.length}`);if(!(0,ec.isAligned32)(t))throw Error("unaligned dst");return t}function rn(e,t,n,r){(0,ed.bytes)(t,16),(0,ed.bytes)(n);let i=n.length;r=rt(i,r);let o=(0,ec.u32)(t),{s0:a,s1:s,s2:l,s3:c}=n7(e,o[0],o[1],o[2],o[3]),d=(0,ec.u32)(n),u=(0,ec.u32)(r);for(let n=0;n+4<=d.length;n+=4){u[n+0]=d[n+0]^a,u[n+1]=d[n+1]^s,u[n+2]=d[n+2]^l,u[n+3]=d[n+3]^c;let r=1;for(let e=t.length-1;e>=0;e--)r=r+(255&t[e])|0,t[e]=255&r,r>>>=8;({s0:a,s1:s,s2:l,s3:c}=n7(e,o[0],o[1],o[2],o[3]))}let h=16*Math.floor(d.length/4);if(h<i){let e=new Uint32Array([a,s,l,c]),t=(0,ec.u8)(e);for(let e=h,o=0;e<i;e++,o++)r[e]=n[e]^t[o];(0,ec.clean)(e)}return r}function rr(e,t,n,r,i){(0,ed.bytes)(n,16),(0,ed.bytes)(r),i=rt(r.length,i);let o=(0,ec.u32)(n),a=(0,ec.createView)(n),s=(0,ec.u32)(r),l=(0,ec.u32)(i),c=12*!t,d=r.length,u=a.getUint32(c,t),{s0:h,s1:f,s2:p,s3:g}=n7(e,o[0],o[1],o[2],o[3]);for(let n=0;n+4<=s.length;n+=4)l[n+0]=s[n+0]^h,l[n+1]=s[n+1]^f,l[n+2]=s[n+2]^p,l[n+3]=s[n+3]^g,u=u+1>>>0,a.setUint32(c,u,t),{s0:h,s1:f,s2:p,s3:g}=n7(e,o[0],o[1],o[2],o[3]);let m=16*Math.floor(s.length/4);if(m<d){let e=new Uint32Array([h,f,p,g]),t=(0,ec.u8)(e);for(let e=m,n=0;e<d;e++,n++)i[e]=r[e]^t[n];(0,ec.clean)(e)}return i}function ri(e){if((0,ed.bytes)(e),e.length%16!=0)throw Error("aes/(cbc-ecb).decrypt ciphertext should consist of blocks with size 16")}function ro(e,t,n){(0,ed.bytes)(e);let r=e.length,i=r%16;if(!t&&0!==i)throw Error("aec/(cbc-ecb): unpadded plaintext with disabled padding");(0,ec.isAligned32)(e)||(e=(0,ec.copyBytes)(e));let o=(0,ec.u32)(e);if(t){let e=16-i;e||(e=16),r+=e}let a=rt(r,n);return{b:o,o:(0,ec.u32)(a),out:a}}function ra(e,t){if(!t)return e;let n=e.length;if(!n)throw Error("aes/pcks5: empty ciphertext not allowed");let r=e[n-1];if(r<=0||r>16)throw Error("aes/pcks5: wrong padding");let i=e.subarray(0,-r);for(let t=0;t<r;t++)if(e[n-t-1]!==r)throw Error("aes/pcks5: wrong padding");return i}function rs(e){let t=new Uint8Array(16),n=(0,ec.u32)(t);t.set(e);let r=16-e.length;for(let e=16-r;e<16;e++)t[e]=r;return n}function rl(e,t,n,r,i){let o=null==i?0:i.length,a=e.create(n,r.length+o);i&&a.update(i),a.update(r);let s=new Uint8Array(16),l=(0,ec.createView)(s);i&&(0,ec.setBigUint64)(l,0,BigInt(8*o),t),(0,ec.setBigUint64)(l,8,BigInt(8*r.length),t),a.update(s);let c=a.digest();return(0,ec.clean)(s),c}nB.ctr=(0,ec.wrapCipher)({blockSize:16,nonceLength:16},function(e,t){function n(n,r){if((0,ed.bytes)(n),void 0!==r&&((0,ed.bytes)(r),!(0,ec.isAligned32)(r)))throw Error("unaligned destination");let i=n8(e),o=(0,ec.copyBytes)(t),a=[i,o];(0,ec.isAligned32)(n)||a.push(n=(0,ec.copyBytes)(n));let s=rn(i,o,n,r);return(0,ec.clean)(...a),s}return(0,ed.bytes)(e),(0,ed.bytes)(t,16),{encrypt:(e,t)=>n(e,t),decrypt:(e,t)=>n(e,t)}}),nB.ecb=(0,ec.wrapCipher)({blockSize:16},function(e,t={}){(0,ed.bytes)(e);let n=!t.disablePadding;return{encrypt(t,r){let{b:i,o:o,out:a}=ro(t,n,r),s=n8(e),l=0;for(;l+4<=i.length;){let{s0:e,s1:t,s2:n,s3:r}=n7(s,i[l+0],i[l+1],i[l+2],i[l+3]);o[l++]=e,o[l++]=t,o[l++]=n,o[l++]=r}if(n){let e=rs(t.subarray(4*l)),{s0:n,s1:r,s2:i,s3:a}=n7(s,e[0],e[1],e[2],e[3]);o[l++]=n,o[l++]=r,o[l++]=i,o[l++]=a}return(0,ec.clean)(s),a},decrypt(t,r){ri(t);let i=n6(e),o=rt(t.length,r),a=[i];(0,ec.isAligned32)(t)||a.push(t=(0,ec.copyBytes)(t));let s=(0,ec.u32)(t),l=(0,ec.u32)(o);for(let e=0;e+4<=s.length;){let{s0:t,s1:n,s2:r,s3:o}=re(i,s[e+0],s[e+1],s[e+2],s[e+3]);
1l[e++]=t,l[e++]=n,l[e++]=r,l[e++]=o}return(0,ec.clean)(...a),ra(o,n)}}}),nB.cbc=(0,ec.wrapCipher)({blockSize:16,nonceLength:16},function(e,t,n={}){(0,ed.bytes)(e),(0,ed.bytes)(t,16);let r=!n.disablePadding;return{encrypt(n,i){let o=n8(e),{b:a,o:s,out:l}=ro(n,r,i),c=t,d=[o];(0,ec.isAligned32)(c)||d.push(c=(0,ec.copyBytes)(c));let u=(0,ec.u32)(c),h=u[0],f=u[1],p=u[2],g=u[3],m=0;for(;m+4<=a.length;)h^=a[m+0],f^=a[m+1],p^=a[m+2],g^=a[m+3],({s0:h,s1:f,s2:p,s3:g}=n7(o,h,f,p,g)),s[m++]=h,s[m++]=f,s[m++]=p,s[m++]=g;if(r){let e=rs(n.subarray(4*m));h^=e[0],f^=e[1],p^=e[2],g^=e[3],({s0:h,s1:f,s2:p,s3:g}=n7(o,h,f,p,g)),s[m++]=h,s[m++]=f,s[m++]=p,s[m++]=g}return(0,ec.clean)(...d),l},decrypt(n,i){ri(n);let o=n6(e),a=t,s=[o];(0,ec.isAligned32)(a)||s.push(a=(0,ec.copyBytes)(a));let l=(0,ec.u32)(a),c=rt(n.length,i);(0,ec.isAligned32)(n)||s.push(n=(0,ec.copyBytes)(n));let d=(0,ec.u32)(n),u=(0,ec.u32)(c),h=l[0],f=l[1],p=l[2],g=l[3];for(let e=0;e+4<=d.length;){let t=h,n=f,r=p,i=g;h=d[e+0],f=d[e+1];let{s0:a,s1:s,s2:l,s3:c}=re(o,h,f,p=d[e+2],g=d[e+3]);u[e++]=a^t,u[e++]=s^n,u[e++]=l^r,u[e++]=c^i}return(0,ec.clean)(...s),ra(c,r)}}}),nB.cfb=(0,ec.wrapCipher)({blockSize:16,nonceLength:16},function(e,t){function n(n,r,i){(0,ed.bytes)(n);let o=n.length;i=rt(o,i);let a=n8(e),s=t,l=[a];(0,ec.isAligned32)(s)||l.push(s=(0,ec.copyBytes)(s)),(0,ec.isAligned32)(n)||l.push(n=(0,ec.copyBytes)(n));let c=(0,ec.u32)(n),d=(0,ec.u32)(i),u=r?d:c,h=(0,ec.u32)(s),f=h[0],p=h[1],g=h[2],m=h[3];for(let e=0;e+4<=c.length;){let{s0:t,s1:n,s2:r,s3:i}=n7(a,f,p,g,m);d[e+0]=c[e+0]^t,d[e+1]=c[e+1]^n,d[e+2]=c[e+2]^r,d[e+3]=c[e+3]^i,f=u[e++],p=u[e++],g=u[e++],m=u[e++]}let y=16*Math.floor(c.length/4);if(y<o){({s0:f,s1:p,s2:g,s3:m}=n7(a,f,p,g,m));let e=(0,ec.u8)(new Uint32Array([f,p,g,m]));for(let t=y,r=0;t<o;t++,r++)i[t]=n[t]^e[r];(0,ec.clean)(e)}return(0,ec.clean)(...l),i}return(0,ed.bytes)(e),(0,ed.bytes)(t,16),{encrypt:(e,t)=>n(e,!0,t),decrypt:(e,t)=>n(e,!1,t)}}),nB.gcm=(0,ec.wrapCipher)({blockSize:16,nonceLength:12,tagLength:16},function(e,t,n){if((0,ed.bytes)(e),(0,ed.bytes)(t),void 0!==n&&(0,ed.bytes)(n),t.length<8)throw Error("aes/gcm: invalid nonce length");function r(e,t,r){let i=rl(nK.ghash,!1,e,r,n);for(let e=0;e<t.length;e++)i[e]^=t[e];return i}function i(){let n=n8(e),r=nV.slice(),i=nV.slice();if(rr(n,!1,i,i,r),12===t.length)i.set(t);else{let e=nV.slice(),n=(0,ec.createView)(e);(0,ec.setBigUint64)(n,8,BigInt(8*t.length),!1);let o=nK.ghash.create(r).update(t).update(e);o.digestInto(i),o.destroy()}return{xk:n,authKey:r,counter:i,tagMask:rr(n,!1,i,nV)}}return{encrypt(e){(0,ed.bytes)(e);let{xk:t,authKey:n,counter:o,tagMask:a}=i(),s=new Uint8Array(e.length+16),l=[t,n,o,a];(0,ec.isAligned32)(e)||l.push(e=(0,ec.copyBytes)(e)),rr(t,!1,o,e,s);let c=r(n,a,s.subarray(0,s.length-16));return l.push(c),s.set(c,e.length),(0,ec.clean)(...l),s},decrypt(e){if((0,ed.bytes)(e),e.length<16)throw Error("aes/gcm: ciphertext less than tagLen (16)");let{xk:t,authKey:n,counter:o,tagMask:a}=i(),s=[t,n,a,o];(0,ec.isAligned32)(e)||s.push(e=(0,ec.copyBytes)(e));let l=e.subarray(0,-16),c=e.subarray(-16),d=r(n,a,l);if(s.push(d),!(0,ec.equalBytes)(d,c))throw Error("aes/gcm: invalid ghash tag");let u=rr(t,!1,o,l);return(0,ec.clean)(...s),u}}});let rc=(e,t,n)=>r=>{if(!Number.isSafeInteger(r)||t>r||r>n)throw Error(`${e}: invalid value=${r}, must be [${t}..${n}]`)};function rd(e){return null!=e&&"object"==typeof e&&(e instanceof Uint32Array||"Uint32Array"===e.constructor.name)}function ru(e,t){if((0,ed.bytes)(t,16),!rd(e))throw Error("_encryptBlock accepts result of expandKeyLE");let n=(0,ec.u32)(t),{s0:r,s1:i,s2:o,s3:a}=n7(e,n[0],n[1],n[2],n[3]);return n[0]=r,n[1]=i,n[2]=o,n[3]=a,t}function rh(e,t){if((0,ed.bytes)(t,16),!rd(e))throw Error("_decryptBlock accepts result of expandKeyLE");let n=(0,ec.u32)(t),{s0:r,s1:i,s2:o,s3:a}=re(e,n[0],n[1],n[2],n[3]);return n[0]=r,n[1]=i,n[2]=o,n[3]=a,t}nB.siv=(0,ec.wrapCipher)({blockSize:16,nonceLength:12,tagLength:16},function(e,t,n){let r=rc("AAD",0,0x1000000000),i=rc("plaintext",0,0x1000000000),o=rc("nonce",12,12),a=rc("ciphertext",16,0x1000000000+16);function s(){let n=n8(e),r=new Uint8Array(e.length),i=new Uint8Array(16),o=[n,r],a=t;(0,ec.isAligned32)(a)||o.push(a=(0,ec.copyBytes)(a));let s=(0,ec.u32)(a),l=0,c=s[0],d=s[1],u=s[2],h=0;for(let e of[i,r].map(ec.u32)){let t=(0,ec.u32)(e);for(let e=0;e<t.length;e+=2){let{s0:r,s1:i}=n7(n,l,c,d,u);t[e+0]=r,t[e+1]=i,l=++h}}let f={authKey:i,encKey:n8(r)};return(0,ec.clean)(...o),f}function l(e,r,i){let o=rl(nK.polyval,!0,r,i,n);for(let e=0;e<12;e++)o[e]^=t[e];o[15]&=127;let a=(0,ec.u32)(o),s=a[0],l=a[1],c=a[2],d=a[3];return{s0:s,s1:l,s2:c,s3:d}=n7(e,s,l,c,d),a[0]=s,a[1]=l,a[2]=c,a[3]=d,o}
1function c(e,t,n){let r=(0,ec.copyBytes)(t);r[15]|=128;let i=rr(e,!0,r,n);return(0,ec.clean)(r),i}return(0,ed.bytes)(e,16,24,32),(0,ed.bytes)(t),o(t.length),void 0!==n&&((0,ed.bytes)(n),r(n.length)),{encrypt(e){(0,ed.bytes)(e),i(e.length);let{encKey:t,authKey:n}=s(),r=l(t,n,e),o=[t,n,r];(0,ec.isAligned32)(e)||o.push(e=(0,ec.copyBytes)(e));let a=new Uint8Array(e.length+16);return a.set(r,e.length),a.set(c(t,r,e)),(0,ec.clean)(...o),a},decrypt(e){(0,ed.bytes)(e),a(e.length);let t=e.subarray(-16),{encKey:n,authKey:r}=s(),i=[n,r];(0,ec.isAligned32)(e)||i.push(e=(0,ec.copyBytes)(e));let o=c(n,t,e.subarray(0,-16)),d=l(n,r,o);if(i.push(d),!(0,ec.equalBytes)(t,d))throw(0,ec.clean)(...i),Error("invalid polyval tag");return(0,ec.clean)(...i),o}}});let rf={encrypt(e,t){if(t.length>=0x100000000)throw Error("plaintext should be less than 4gb");let n=n8(e);if(16===t.length)ru(n,t);else{let e=(0,ec.u32)(t),r=e[0],i=e[1];for(let t=0,o=1;t<6;t++)for(let t=2;t<e.length;t+=2,o++){let{s0:a,s1:s,s2:l,s3:c}=n7(n,r,i,e[t],e[t+1]);r=a,i=s^n0(o),e[t]=l,e[t+1]=c}e[0]=r,e[1]=i}n.fill(0)},decrypt(e,t){if(t.length-8>=0x100000000)throw Error("ciphertext should be less than 4gb");let n=n6(e),r=t.length/8-1;if(1===r)rh(n,t);else{let e=(0,ec.u32)(t),i=e[0],o=e[1];for(let t=0,a=6*r;t<6;t++)for(let t=2*r;t>=1;t-=2,a--){let{s0:r,s1:s,s2:l,s3:c}=re(n,i,o^=n0(a),e[t],e[t+1]);i=r,o=s,e[t]=l,e[t+1]=c}e[0]=i,e[1]=o}n.fill(0)}},rp=new Uint8Array(8).fill(166);nB.aeskw=(0,ec.wrapCipher)({blockSize:8},e=>({encrypt(t){if((0,ed.bytes)(t),!t.length||t.length%8!=0)throw Error("invalid plaintext length");if(8===t.length)throw Error("8-byte keys not allowed in AESKW, use AESKWP instead");let n=(0,ec.concatBytes)(rp,t);return rf.encrypt(e,n),n},decrypt(t){if((0,ed.bytes)(t),t.length%8!=0||t.length<24)throw Error("invalid ciphertext length");let n=(0,ec.copyBytes)(t);if(rf.decrypt(e,n),!(0,ec.equalBytes)(n.subarray(0,8),rp))throw Error("integrity check failed");return n.subarray(0,8).fill(0),n.subarray(8)}})),nB.aeskwp=(0,ec.wrapCipher)({blockSize:8},e=>({encrypt(t){if((0,ed.bytes)(t),!t.length)throw Error("invalid plaintext length");let n=new Uint8Array(8+8*Math.ceil(t.length/8));n.set(t,8);let r=(0,ec.u32)(n);return r[0]=0xa65959a6,r[1]=n0(t.length),rf.encrypt(e,n),n},decrypt(t){if((0,ed.bytes)(t),t.length<16)throw Error("invalid ciphertext length");let n=(0,ec.copyBytes)(t),r=(0,ec.u32)(n);rf.decrypt(e,n);let i=n0(r[1])>>>0,o=8*Math.ceil(i/8);if(0xa65959a6!==r[0]||n.length-8!==o)throw Error("integrity check failed");for(let e=i;e<o;e++)if(0!==n[8+e])throw Error("integrity check failed");return n.subarray(0,8).fill(0),n.subarray(8,8+i)}})),nB.unsafe={expandKeyLE:n8,expandKeyDecLE:n6,encrypt:n7,decrypt:re,encryptBlock:ru,decryptBlock:rh,ctrCounter:rn,ctr32:rr},Object.defineProperty(n$,"__esModule",{value:!0}),n$.aes256cbc=n$.aes256gcm=void 0,n$.aes256gcm=function(e,t,n){return(0,nB.gcm)(e,t,n)},n$.aes256cbc=function(e,t,n){return(0,nB.cbc)(e,t)};var rg={},rm={},ry={};Object.defineProperty(ry,"__esModule",{value:!0}),ry.sigma=void 0,ry.rotl=function(e,t){return e<<t|e>>>32-t},ry.createCipher=function(e,t){let{allowShortKeys:n,extendNonceFn:r,counterLength:i,counterRight:o,rounds:a}=(0,rb.checkOpts)({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if("function"!=typeof e)throw Error("core must be a function");return(0,rv.number)(i),(0,rv.number)(a),(0,rv.bool)(o),(0,rv.bool)(n),(t,s,l,c,d=0)=>{(0,rv.bytes)(t),(0,rv.bytes)(s),(0,rv.bytes)(l);let u=l.length;if(void 0===c&&(c=new Uint8Array(u)),(0,rv.bytes)(c),(0,rv.number)(d),d<0||d>=rM)throw Error("arx: counter overflow");if(c.length<u)throw Error(`arx: output (${c.length}) is shorter than data (${u})`);let h=[],f,p,g=t.length;if(32===g)h.push(f=(0,rb.copyBytes)(t)),p=rC;else{if(16!==g||!n)throw Error(`arx: invalid 32-byte key, got length=${g}`);(f=new Uint8Array(32)).set(t),f.set(t,16),p=r_,h.push(f)}rx(s)||h.push(s=(0,rb.copyBytes)(s));let m=(0,rb.u32)(f);if(r){if(24!==s.length)throw Error("arx: extended nonce must be 24 bytes");r(p,m,(0,rb.u32)(s.subarray(0,16)),m),s=s.subarray(16)}let y=16-i;if(y!==s.length)throw Error(`arx: nonce must be ${y} or 16 bytes`);if(12!==y){let e=new Uint8Array(12);e.set(s,o?0:12-s.length),s=e,h.push(s)}return function(e,t,n,r,i,o,a,s){let l=i.length,c=new Uint8Array(rk),d=(0,rb.u32)(c),u=rx(i)&&rx(o),h=u?(0,rb.u32)(i):rI,f=u?(0,rb.u32)(o):rI;for(let p=0;p<l;a++){if(e(t,n,r,d,a,s),a>=rM)throw Error("arx: counter overflow");let g=Math.min(rk,l-p);if(u&&g===rk){let e=p/4;
1if(p%4!=0)throw Error("arx: invalid block position");for(let t,n=0;n<rA;n++)f[t=e+n]=h[t]^d[n];p+=rk}else{for(let e,t=0;t<g;t++)o[e=p+t]=i[e]^c[t];p+=g}}}(e,p,m,(0,rb.u32)(s),l,c,d,a),(0,rb.clean)(...h),c}};let rv=ed,rb=ec,rE=e=>Uint8Array.from(e.split("").map(e=>e.charCodeAt(0))),rw=rE("expand 16-byte k"),rS=rE("expand 32-byte k"),r_=(0,rb.u32)(rw),rC=(0,rb.u32)(rS);function rx(e){return e.byteOffset%4==0}ry.sigma=rC.slice();let rk=64,rA=16,rM=0x100000000-1,rI=new Uint32Array;var rT={};Object.defineProperty(rT,"__esModule",{value:!0}),rT.poly1305=void 0,rT.wrapConstructorWithKey=rO;let rR=(e,t)=>255&e[t++]|(255&e[t++])<<8;class rP{constructor(e){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,e=(0,ec.toBytes)(e),(0,ed.bytes)(e,32);let t=rR(e,0),n=rR(e,2),r=rR(e,4),i=rR(e,6),o=rR(e,8),a=rR(e,10),s=rR(e,12),l=rR(e,14);this.r[0]=8191&t,this.r[1]=8191&(t>>>13|n<<3),this.r[2]=7939&(n>>>10|r<<6),this.r[3]=8191&(r>>>7|i<<9),this.r[4]=255&(i>>>4|o<<12),this.r[5]=o>>>1&8190,this.r[6]=8191&(o>>>14|a<<2),this.r[7]=8065&(a>>>11|s<<5),this.r[8]=8191&(s>>>8|l<<8),this.r[9]=l>>>5&127;for(let t=0;t<8;t++)this.pad[t]=rR(e,16+2*t)}process(e,t,n=!1){let{h:r,r:i}=this,o=i[0],a=i[1],s=i[2],l=i[3],c=i[4],d=i[5],u=i[6],h=i[7],f=i[8],p=i[9],g=rR(e,t+0),m=rR(e,t+2),y=rR(e,t+4),v=rR(e,t+6),b=rR(e,t+8),E=rR(e,t+10),w=rR(e,t+12),S=rR(e,t+14),_=r[0]+(8191&g),C=r[1]+(8191&(g>>>13|m<<3)),x=r[2]+(8191&(m>>>10|y<<6)),k=r[3]+(8191&(y>>>7|v<<9)),A=r[4]+(8191&(v>>>4|b<<12)),M=r[5]+(b>>>1&8191),I=r[6]+(8191&(b>>>14|E<<2)),T=r[7]+(8191&(E>>>11|w<<5)),R=r[8]+(8191&(w>>>8|S<<8)),P=r[9]+(S>>>5|2048*!n),O=0,N=0+_*o+5*p*C+5*f*x+5*h*k+5*u*A;O=N>>>13,N&=8191,N+=5*d*M+5*c*I+5*l*T+5*s*R+5*a*P,O+=N>>>13,N&=8191;let L=O+_*a+C*o+5*p*x+5*f*k+5*h*A;O=L>>>13,L&=8191,L+=5*u*M+5*d*I+5*c*T+5*l*R+5*s*P,O+=L>>>13,L&=8191;let D=O+_*s+C*a+x*o+5*p*k+5*f*A;O=D>>>13,D&=8191,D+=5*h*M+5*u*I+5*d*T+5*c*R+5*l*P,O+=D>>>13,D&=8191;let $=O+_*l+C*s+x*a+k*o+5*p*A;O=$>>>13,$&=8191,$+=5*f*M+5*h*I+5*u*T+5*d*R+5*c*P,O+=$>>>13,$&=8191;let B=O+_*c+C*l+x*s+k*a+A*o;O=B>>>13,B&=8191,B+=5*p*M+5*f*I+5*h*T+5*u*R+5*d*P,O+=B>>>13,B&=8191;let K=O+_*d+C*c+x*l+k*s+A*a;O=K>>>13,K&=8191,K+=M*o+5*p*I+5*f*T+5*h*R+5*u*P,O+=K>>>13,K&=8191;let j=O+_*u+C*d+x*c+k*l+A*s;O=j>>>13,j&=8191,j+=M*a+I*o+5*p*T+5*f*R+5*h*P,O+=j>>>13,j&=8191;let U=O+_*h+C*u+x*d+k*c+A*l;O=U>>>13,U&=8191,U+=M*s+I*a+T*o+5*p*R+5*f*P,O+=U>>>13,U&=8191;let H=O+_*f+C*h+x*u+k*d+A*c;O=H>>>13,H&=8191,H+=M*l+I*s+T*a+R*o+5*p*P,O+=H>>>13,H&=8191;let F=O+_*p+C*f+x*h+k*u+A*d;O=F>>>13,F&=8191,F+=M*c+I*l+T*s+R*a+P*o,O+=F>>>13,F&=8191,N=8191&(O=(O=(O<<2)+O|0)+N|0),O>>>=13,L+=O,r[0]=N,r[1]=L,r[2]=D,r[3]=$,r[4]=B,r[5]=K,r[6]=j,r[7]=U,r[8]=H,r[9]=F}finalize(){let{h:e,pad:t}=this,n=new Uint16Array(10),r=e[1]>>>13;e[1]&=8191;for(let t=2;t<10;t++)e[t]+=r,r=e[t]>>>13,e[t]&=8191;e[0]+=5*r,r=e[0]>>>13,e[0]&=8191,e[1]+=r,r=e[1]>>>13,e[1]&=8191,e[2]+=r,n[0]=e[0]+5,r=n[0]>>>13,n[0]&=8191;for(let t=1;t<10;t++)n[t]=e[t]+r,r=n[t]>>>13,n[t]&=8191;n[9]-=8192;let i=(1^r)-1;for(let e=0;e<10;e++)n[e]&=i;i=~i;for(let t=0;t<10;t++)e[t]=e[t]&i|n[t];e[0]=65535&(e[0]|e[1]<<13),e[1]=65535&(e[1]>>>3|e[2]<<10),e[2]=65535&(e[2]>>>6|e[3]<<7),e[3]=65535&(e[3]>>>9|e[4]<<4),e[4]=65535&(e[4]>>>12|e[5]<<1|e[6]<<14),e[5]=65535&(e[6]>>>2|e[7]<<11),e[6]=65535&(e[7]>>>5|e[8]<<8),e[7]=65535&(e[8]>>>8|e[9]<<5);let o=e[0]+t[0];e[0]=65535&o;for(let n=1;n<8;n++)o=(e[n]+t[n]|0)+(o>>>16)|0,e[n]=65535&o;(0,ec.clean)(n)}update(e){(0,ed.exists)(this);let{buffer:t,blockLen:n}=this,r=(e=(0,ec.toBytes)(e)).length;for(let i=0;i<r;){let o=Math.min(n-this.pos,r-i);if(o!==n)t.set(e.subarray(i,i+o),this.pos),this.pos+=o,i+=o,this.pos===n&&(this.process(t,0,!1),this.pos=0);else for(;n<=r-i;i+=n)this.process(e,i)}return this}destroy(){(0,ec.clean)(this.h,this.r,this.buffer,this.pad)}digestInto(e){(0,ed.exists)(this),(0,ed.output)(e,this),this.finished=!0;let{buffer:t,h:n}=this,{pos:r}=this;if(r){for(t[r++]=1;r<16;r++)t[r]=0;this.process(t,0,!0)}this.finalize();let i=0;for(let t=0;t<8;t++)e[i++]=n[t]>>>0,e[i++]=n[t]>>>8;return e}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}}function rO(e){let t=(t,n)=>e(n).update((0,ec.toBytes)(t)).digest(),n=e(new Uint8Array(32));return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=t=>e(t),t}rT.poly1305=rO(e=>new rP(e)),function(e){function t(e,n,r,i,o,a=20){let s=e[0],l=e[1],c=e[2],d=e[3],u=n[0],h=n[1],f=n[2],p=n[3],g=n[4],m=n[5],y=n[6],v=n[7],b=r[0],E=r[1],w=r[2],S=s,_=l,C=c,x=d,k=u,A=h,M=f,I=p,T=g,R=m,P=y,O=v,N=o,L=b,D=E,$=w;for(let e=0;e<a;
1e+=2)S=S+k|0,T=T+(N=(0,ry.rotl)(N^S,16))|0,S=S+(k=(0,ry.rotl)(k^T,12))|0,T=T+(N=(0,ry.rotl)(N^S,8))|0,k=(0,ry.rotl)(k^T,7),_=_+A|0,R=R+(L=(0,ry.rotl)(L^_,16))|0,_=_+(A=(0,ry.rotl)(A^R,12))|0,R=R+(L=(0,ry.rotl)(L^_,8))|0,A=(0,ry.rotl)(A^R,7),C=C+M|0,P=P+(D=(0,ry.rotl)(D^C,16))|0,C=C+(M=(0,ry.rotl)(M^P,12))|0,P=P+(D=(0,ry.rotl)(D^C,8))|0,M=(0,ry.rotl)(M^P,7),x=x+I|0,O=O+($=(0,ry.rotl)($^x,16))|0,x=x+(I=(0,ry.rotl)(I^O,12))|0,O=O+($=(0,ry.rotl)($^x,8))|0,I=(0,ry.rotl)(I^O,7),S=S+A|0,P=P+($=(0,ry.rotl)($^S,16))|0,S=S+(A=(0,ry.rotl)(A^P,12))|0,P=P+($=(0,ry.rotl)($^S,8))|0,A=(0,ry.rotl)(A^P,7),_=_+M|0,O=O+(N=(0,ry.rotl)(N^_,16))|0,_=_+(M=(0,ry.rotl)(M^O,12))|0,O=O+(N=(0,ry.rotl)(N^_,8))|0,M=(0,ry.rotl)(M^O,7),C=C+I|0,T=T+(L=(0,ry.rotl)(L^C,16))|0,C=C+(I=(0,ry.rotl)(I^T,12))|0,T=T+(L=(0,ry.rotl)(L^C,8))|0,I=(0,ry.rotl)(I^T,7),x=x+k|0,R=R+(D=(0,ry.rotl)(D^x,16))|0,x=x+(k=(0,ry.rotl)(k^R,12))|0,R=R+(D=(0,ry.rotl)(D^x,8))|0,k=(0,ry.rotl)(k^R,7);let B=0;i[B++]=s+S|0,i[B++]=l+_|0,i[B++]=c+C|0,i[B++]=d+x|0,i[B++]=u+k|0,i[B++]=h+A|0,i[B++]=f+M|0,i[B++]=p+I|0,i[B++]=g+T|0,i[B++]=m+R|0,i[B++]=y+P|0,i[B++]=v+O|0,i[B++]=o+N|0,i[B++]=b+L|0,i[B++]=E+D|0,i[B++]=w+$|0}function n(e,t,n,r){let i=e[0],o=e[1],a=e[2],s=e[3],l=t[0],c=t[1],d=t[2],u=t[3],h=t[4],f=t[5],p=t[6],g=t[7],m=n[0],y=n[1],v=n[2],b=n[3];for(let e=0;e<20;e+=2)i=i+l|0,h=h+(m=(0,ry.rotl)(m^i,16))|0,i=i+(l=(0,ry.rotl)(l^h,12))|0,h=h+(m=(0,ry.rotl)(m^i,8))|0,l=(0,ry.rotl)(l^h,7),o=o+c|0,f=f+(y=(0,ry.rotl)(y^o,16))|0,o=o+(c=(0,ry.rotl)(c^f,12))|0,f=f+(y=(0,ry.rotl)(y^o,8))|0,c=(0,ry.rotl)(c^f,7),a=a+d|0,p=p+(v=(0,ry.rotl)(v^a,16))|0,a=a+(d=(0,ry.rotl)(d^p,12))|0,p=p+(v=(0,ry.rotl)(v^a,8))|0,d=(0,ry.rotl)(d^p,7),s=s+u|0,g=g+(b=(0,ry.rotl)(b^s,16))|0,s=s+(u=(0,ry.rotl)(u^g,12))|0,g=g+(b=(0,ry.rotl)(b^s,8))|0,u=(0,ry.rotl)(u^g,7),i=i+c|0,p=p+(b=(0,ry.rotl)(b^i,16))|0,i=i+(c=(0,ry.rotl)(c^p,12))|0,p=p+(b=(0,ry.rotl)(b^i,8))|0,c=(0,ry.rotl)(c^p,7),o=o+d|0,g=g+(m=(0,ry.rotl)(m^o,16))|0,o=o+(d=(0,ry.rotl)(d^g,12))|0,g=g+(m=(0,ry.rotl)(m^o,8))|0,d=(0,ry.rotl)(d^g,7),a=a+u|0,h=h+(y=(0,ry.rotl)(y^a,16))|0,a=a+(u=(0,ry.rotl)(u^h,12))|0,h=h+(y=(0,ry.rotl)(y^a,8))|0,u=(0,ry.rotl)(u^h,7),s=s+l|0,f=f+(v=(0,ry.rotl)(v^s,16))|0,s=s+(l=(0,ry.rotl)(l^f,12))|0,f=f+(v=(0,ry.rotl)(v^s,8))|0,l=(0,ry.rotl)(l^f,7);let E=0;r[E++]=i,r[E++]=o,r[E++]=a,r[E++]=s,r[E++]=m,r[E++]=y,r[E++]=v,r[E++]=b}Object.defineProperty(e,"__esModule",{value:!0}),e.xchacha20poly1305=e.chacha20poly1305=e._poly1305_aead=e.chacha12=e.chacha8=e.xchacha20=e.chacha20=e.chacha20orig=void 0,e.hchacha=n,e.chacha20orig=(0,ry.createCipher)(t,{counterRight:!1,counterLength:8,allowShortKeys:!0}),e.chacha20=(0,ry.createCipher)(t,{counterRight:!1,counterLength:4,allowShortKeys:!1}),e.xchacha20=(0,ry.createCipher)(t,{counterRight:!1,counterLength:8,extendNonceFn:n,allowShortKeys:!1}),e.chacha8=(0,ry.createCipher)(t,{counterRight:!1,counterLength:4,rounds:8}),e.chacha12=(0,ry.createCipher)(t,{counterRight:!1,counterLength:4,rounds:12});let r=new Uint8Array(16),i=(e,t)=>{e.update(t);let n=t.length%16;n&&e.update(r.subarray(n))},o=new Uint8Array(32);function a(e,t,n,r,a){let s=e(t,n,o),l=rT.poly1305.create(s);a&&i(l,a),i(l,r);let c=new Uint8Array(16),d=(0,ec.createView)(c);(0,ec.setBigUint64)(d,0,BigInt(a?a.length:0),!0),(0,ec.setBigUint64)(d,8,BigInt(r.length),!0),l.update(c);let u=l.digest();return(0,ec.clean)(s,c),u}e._poly1305_aead=e=>(t,n,r)=>((0,ed.bytes)(t,32),(0,ed.bytes)(n),{encrypt(i,o){let s=i.length,l=s+16;o?(0,ed.bytes)(o,l):o=new Uint8Array(l),e(t,n,i,o,1);let c=a(e,t,n,o.subarray(0,-16),r);return o.set(c,s),(0,ec.clean)(c),o},decrypt(i,o){let s=i.length,l=s-16;if(s<16)throw Error("encrypted data must be at least 16 bytes");o?(0,ed.bytes)(o,l):o=new Uint8Array(l);let c=i.subarray(0,-16),d=i.subarray(-16),u=a(e,t,n,c,r);if(!(0,ec.equalBytes)(d,u))throw Error("invalid tag");return e(t,n,c,o,1),(0,ec.clean)(u),o}}),e.chacha20poly1305=(0,ec.wrapCipher)({blockSize:64,nonceLength:12,tagLength:16},(0,e._poly1305_aead)(e.chacha20)),e.xchacha20poly1305=(0,ec.wrapCipher)({blockSize:64,nonceLength:24,tagLength:16},(0,e._poly1305_aead)(e.xchacha20))}
1(rm),Object.defineProperty(rg,"__esModule",{value:!0}),rg.xchacha20=void 0,rg.xchacha20=function(e,t,n){return(0,rm.xchacha20poly1305)(e,t,n)},function(e){function t(e,t,n,r){var i=(0,ev.symmetricAlgorithm)();if("aes-256-gcm"===i)return e(n$.aes256gcm,t,n,(0,ev.symmetricNonceLength)(),eb.AEAD_TAG_LENGTH,r);if("xchacha20"===i)return e(rg.xchacha20,t,n,eb.XCHACHA20_NONCE_LENGTH,eb.AEAD_TAG_LENGTH,r);if("aes-256-cbc"===i)return e(n$.aes256cbc,t,n,16,0);throw Error("Not implemented")}function n(e,t,n,r,i,o){var a=(0,eC.randomBytes)(r),s=e(t,a,o).encrypt(n);if(0===i)return(0,ec.concatBytes)(a,s);var l=s.length-i,c=s.subarray(0,l),d=s.subarray(l);return(0,ec.concatBytes)(a,d,c)}function r(e,t,n,r,i,o){var a=n.subarray(0,r),s=e(t,Uint8Array.from(a),o),l=n.subarray(r);if(0===i)return s.decrypt(l);var c=l.subarray(0,i),d=l.subarray(i);return s.decrypt((0,ec.concatBytes)(d,c))}Object.defineProperty(e,"__esModule",{value:!0}),e.aesDecrypt=e.aesEncrypt=e.symDecrypt=e.symEncrypt=void 0,e.symEncrypt=function(e,r,i){return t(n,e,r,i)},e.symDecrypt=function(e,n,i){return t(r,e,n,i)},e.aesEncrypt=e.symEncrypt,e.aesDecrypt=e.symDecrypt}(nD),iU=eo&&eo.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),iH=eo&&eo.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||iU(t,e,n)},Object.defineProperty(eS,"__esModule",{value:!0}),iH(e_,eS),iH(nT,eS),iH(nI,eS),iH(nD,eS);var rN={};Object.defineProperty(rN,"__esModule",{value:!0}),rN.PublicKey=void 0,rN.PublicKey=function(){function e(e){this.data=(0,eS.convertPublicKeyFormat)(e,!0)}return e.fromHex=function(t){return new e((0,eS.hexToPublicKey)(t))},Object.defineProperty(e.prototype,"uncompressed",{get:function(){return T.from((0,eS.convertPublicKeyFormat)(this.data,!1))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"compressed",{get:function(){return T.from(this.data)},enumerable:!1,configurable:!0}),e.prototype.toHex=function(e){return void 0===e&&(e=!0),(0,ec.bytesToHex)(e?this.data:this.uncompressed)},e.prototype.decapsulate=function(e,t){void 0===t&&(t=!1);var n=t?this.data:this.uncompressed,r=e.multiply(this,t);return(0,eS.getSharedKey)(n,r)},e.prototype.equals=function(e){return(0,ec.equalBytes)(this.data,e.data)},e}(),Object.defineProperty(ew,"__esModule",{value:!0}),ew.PrivateKey=void 0,ew.PrivateKey=function(){function e(e){if(void 0===e)this.data=(0,eS.getValidSecret)();else{if(!(0,eS.isValidPrivateKey)(e))throw Error("Invalid private key");this.data=e}this.publicKey=new rN.PublicKey((0,eS.getPublicKey)(this.data))}return e.fromHex=function(t){return new e((0,eS.decodeHex)(t))},Object.defineProperty(e.prototype,"secret",{get:function(){return T.from(this.data)},enumerable:!1,configurable:!0}),e.prototype.toHex=function(){return(0,ec.bytesToHex)(this.data)},e.prototype.encapsulate=function(e,t){void 0===t&&(t=!1);var n=t?this.publicKey.compressed:this.publicKey.uncompressed,r=this.multiply(e,t);return(0,eS.getSharedKey)(n,r)},e.prototype.multiply=function(e,t){return void 0===t&&(t=!1),(0,eS.getSharedPoint)(this.data,e.compressed,t)},e.prototype.equals=function(e){return(0,ec.equalBytes)(this.data,e.data)},e}(),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.PublicKey=e.PrivateKey=void 0,Object.defineProperty(e,"PrivateKey",{enumerable:!0,get:function(){return ew.PrivateKey}}),Object.defineProperty(e,"PublicKey",{enumerable:!0,get:function(){return rN.PublicKey}})}(eE),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.utils=e.PublicKey=e.PrivateKey=e.ECIES_CONFIG=void 0,e.encrypt=function(e,o){var a=new r.PrivateKey,s=e instanceof Uint8Array?new r.PublicKey(e):r.PublicKey.fromHex(e),l=a.encapsulate(s,(0,n.isHkdfKeyCompressed)()),c=(0,n.isEphemeralKeyCompressed)()?a.publicKey.compressed:a.publicKey.uncompressed,d=(0,i.symEncrypt)(l,o);return T.from((0,t.concatBytes)(c,d))},e.decrypt=function(e,t){var o=e instanceof Uint8Array?new r.PrivateKey(e):r.PrivateKey.fromHex(e),a=(0,n.ephemeralKeySize)(),s=new r.PublicKey(t.subarray(0,a)),l=t.subarray(a),c=s.decapsulate(
1o,(0,n.isHkdfKeyCompressed)());return T.from((0,i.symDecrypt)(c,l))};var t=ec,n=ev,r=eE,i=eS;Object.defineProperty(e,"ECIES_CONFIG",{enumerable:!0,get:function(){return ev.ECIES_CONFIG}}),Object.defineProperty(e,"PrivateKey",{enumerable:!0,get:function(){return eE.PrivateKey}}),Object.defineProperty(e,"PublicKey",{enumerable:!0,get:function(){return eE.PublicKey}}),e.utils={aesEncrypt:i.aesEncrypt,aesDecrypt:i.aesDecrypt,symEncrypt:i.symEncrypt,symDecrypt:i.symDecrypt,decodeHex:i.decodeHex,getValidSecret:i.getValidSecret,remove0x:i.remove0x}}(el);let rL=l()("KeyExchange:Layer"),rD=l()("SocketService:Layer"),r$=l()("Ecies:Layer"),rB=l()("RemoteCommunication:Layer");rL.color="##95c44e",rD.color="#f638d7",r$.color="#465b9c",rB.color="#47a2be";let rK={KeyExchange:rL,SocketService:rD,Ecies:r$,RemoteCommunication:rB},rj,rU=[],rH=[],rF=(e,t)=>g(void 0,void 0,void 0,function*(){rj=t,rH.push(e),(function(e){return g(this,void 0,void 0,function*(){if(!rj||!e)return;let t=rH;rH=rU,rU=t;let n=rj.endsWith("/")?`${rj}evt`:`${rj}/evt`,r=Object.assign({},e);if(delete r.params,e.params)for(let[t,n]of Object.entries(e.params))r[t]=n;let i=JSON.stringify(r);rK.RemoteCommunication(`[sendBufferedEvents] Sending ${rU.length} analytics events to ${n}`);try{let e=yield a()(n,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:i}),t=yield e.text();rK.RemoteCommunication(`[sendBufferedEvents] Response: ${t}`),rU.length=0}catch(e){}})})(e).catch(()=>{})});class rz{constructor(e){this.enabled=!0,(null==e?void 0:e.debug)&&l().enable("Ecies:Layer"),this.ecies=(null==e?void 0:e.privateKey)?el.PrivateKey.fromHex(e.privateKey):new el.PrivateKey,rK.Ecies("[ECIES constructor()] initialized secret: ",this.ecies.toHex()),rK.Ecies("[ECIES constructor()] initialized public: ",this.ecies.publicKey.toHex()),rK.Ecies("[ECIES constructor()] init with",this)}generateECIES(){this.ecies=new el.PrivateKey}getPublicKey(){return this.ecies.publicKey.toHex()}encrypt(e,t){let n=e;if(this.enabled)try{rK.Ecies("[ECIES: encrypt()] using otherPublicKey",t);let r=T.from(e),i=el.encrypt(t,r);n=T.from(i).toString("base64")}catch(n){throw rK.Ecies("[ECIES: encrypt()] error encrypt:",n),rK.Ecies("[ECIES: encrypt()] private: ",this.ecies.toHex()),rK.Ecies("[ECIES: encrypt()] data: ",e),rK.Ecies("[ECIES: encrypt()] otherkey: ",t),n}return n}decrypt(e){let t=e;if(this.enabled)try{rK.Ecies("[ECIES: decrypt()] using privateKey",this.ecies.toHex());let n=T.from(e.toString(),"base64");t=el.decrypt(this.ecies.toHex(),n).toString()}catch(t){throw rK.Ecies("[ECIES: decrypt()] error decrypt",t),rK.Ecies("[ECIES: decrypt()] private: ",this.ecies.toHex()),rK.Ecies("[ECIES: decrypt()] encryptedData: ",e),t}return t}getKeyInfo(){return{private:this.ecies.toHex(),public:this.ecies.publicKey.toHex()}}toString(){rK.Ecies("[ECIES: toString()]",this.getKeyInfo())}}var rq={version:"0.33.0"};let rW="https://metamask-sdk.api.cx.metamask.io/",rV=["websocket"],rG={METAMASK_CONNECTSIGN:"metamask_connectSign",METAMASK_CONNECTWITH:"metamask_connectWith",METAMASK_OPEN:"metamask_open",METAMASK_BATCH:"metamask_batch",PERSONAL_SIGN:"personal_sign",WALLET_REQUESTPERMISSIONS:"wallet_requestPermissions",WALLET_REVOKEPERMISSIONS:"wallet_revokePermissions",WALLET_WATCHASSET:"wallet_watchAsset",ETH_REQUESTACCOUNTS:"eth_requestAccounts",ETH_SENDTRANSACTION:"eth_sendTransaction",ETH_SIGNTYPEDDATA:"eth_signTypedData",ETH_SIGNTYPEDDATA_V3:"eth_signTypedData_v3",ETH_SIGNTYPEDDATA_V4:"eth_signTypedData_v4",ETH_SIGNTRANSACTION:"eth_signTransaction",ETH_SIGN:"eth_sign",PERSONAL_EC_RECOVER:"personal_ecRecover"},rY=[rG.METAMASK_CONNECTSIGN,rG.METAMASK_CONNECTWITH,rG.METAMASK_OPEN,rG.METAMASK_BATCH,rG.PERSONAL_SIGN,rG.WALLET_REQUESTPERMISSIONS,rG.WALLET_REVOKEPERMISSIONS,rG.WALLET_WATCHASSET,rG.ETH_SENDTRANSACTION,rG.ETH_SIGNTYPEDDATA,rG.ETH_SIGNTYPEDDATA_V3,rG.ETH_SIGNTYPEDDATA_V4,rG.ETH_SIGNTRANSACTION,rG.ETH_SIGN,rG.PERSONAL_EC_RECOVER];function rZ(e){return rY.includes(e)}function rJ(e){let{context:t}=e;rK.RemoteCommunication(`[RemoteCommunication: clean()] context=${t}`),e.channelConfig=void 0,e.ready=!1,e.originatorConnectStarted=!1}(iY=iF||(iF={})).DISCONNECTED="disconnected",iY.WAITING="waiting",iY.TIMEOUT="timeout",iY.LINKED="linked",iY.PAUSED="paused",iY.TERMINATED="terminated",function(e){e.KEY_INFO="key_info",e.SERVICE_STATUS="service_status",e.PROVIDER_UPDATE="provider_update",e.RPC_UPDATE="rpc_update",e.KEYS_EXCHANGED="keys_exchanged",e.JOIN_CHANNEL="join_channel",e.PUBLIC_KEY="public_key",e.CHANNEL_CREATED="channel_created",e.CLIENTS_CONNECTED="clients_connected",e.CLIENTS_DISCONNECTED="clients_disconnected",e.CLIENTS_WAITING="clients_w
1aiting",e.CLIENTS_READY="clients_ready",e.REJECTED="rejected",e.WALLET_INIT="wallet_init",e.CHANNEL_PERSISTENCE="channel_persistence",e.CONFIG="config",e.MESSAGE_ACK="ack",e.SOCKET_DISCONNECTED="socket_disconnected",e.SOCKET_RECONNECT="socket_reconnect",e.OTP="otp",e.SDK_RPC_CALL="sdk_rpc_call",e.AUTHORIZED="authorized",e.CONNECTION_STATUS="connection_status",e.MESSAGE="message",e.TERMINATE="terminate"}(iz||(iz={})),(iq||(iq={})).KEY_EXCHANGE="key_exchange",function(e){e.KEY_HANDSHAKE_START="key_handshake_start",e.KEY_HANDSHAKE_CHECK="key_handshake_check",e.KEY_HANDSHAKE_SYN="key_handshake_SYN",e.KEY_HANDSHAKE_SYNACK="key_handshake_SYNACK",e.KEY_HANDSHAKE_ACK="key_handshake_ACK",e.KEY_HANDSHAKE_WALLET="key_handshake_wallet",e.KEY_HANDSHAKE_NONE="none"}(iW||(iW={}));class rQ extends d.EventEmitter2{constructor({communicationLayer:e,otherPublicKey:t,context:n,ecies:r,logging:i}){super(),this.keysExchanged=!1,this.step=iW.KEY_HANDSHAKE_NONE,this.debug=!1,this.context=n,this.communicationLayer=e,(null==r?void 0:r.privateKey)&&t&&(rK.KeyExchange(`[KeyExchange: constructor()] otherPubKey=${t} set keysExchanged to true!`,r),this.keysExchanged=!0),this.myECIES=new rz(Object.assign(Object.assign({},r),{debug:null==i?void 0:i.eciesLayer})),this.communicationLayer.state.eciesInstance=this.myECIES,this.myPublicKey=this.myECIES.getPublicKey(),this.debug=!0===(null==i?void 0:i.keyExchangeLayer),t&&this.setOtherPublicKey(t),this.communicationLayer.on(iq.KEY_EXCHANGE,this.onKeyExchangeMessage.bind(this))}onKeyExchangeMessage(e){let{relayPersistence:t}=this.communicationLayer.remote.state;if(rK.KeyExchange(`[KeyExchange: onKeyExchangeMessage()] context=${this.context} keysExchanged=${this.keysExchanged} relayPersistence=${t}`,e),t)return void rK.KeyExchange("[KeyExchange: onKeyExchangeMessage()] Ignoring key exchange message because relay persistence is activated");let{message:n}=e;this.keysExchanged&&rK.KeyExchange(`[KeyExchange: onKeyExchangeMessage()] context=${this.context} received handshake while already exchanged. step=${this.step} otherPubKey=${this.otherPublicKey}`),this.emit(iz.KEY_INFO,n.type),n.type===iW.KEY_HANDSHAKE_SYN?(this.checkStep([iW.KEY_HANDSHAKE_NONE,iW.KEY_HANDSHAKE_ACK]),rK.KeyExchange("[KeyExchange: onKeyExchangeMessage()] KEY_HANDSHAKE_SYN",n),n.pubkey&&this.setOtherPublicKey(n.pubkey),this.communicationLayer.sendMessage({type:iW.KEY_HANDSHAKE_SYNACK,pubkey:this.myPublicKey}).catch(e=>{rK.KeyExchange("[KeyExchange: onKeyExchangeMessage()] Error sending KEY_HANDSHAKE_SYNACK",e)}),this.setStep(iW.KEY_HANDSHAKE_ACK)):n.type===iW.KEY_HANDSHAKE_SYNACK?(this.checkStep([iW.KEY_HANDSHAKE_SYNACK,iW.KEY_HANDSHAKE_ACK,iW.KEY_HANDSHAKE_NONE]),rK.KeyExchange("[KeyExchange: onKeyExchangeMessage()] KEY_HANDSHAKE_SYNACK"),n.pubkey&&this.setOtherPublicKey(n.pubkey),this.communicationLayer.sendMessage({type:iW.KEY_HANDSHAKE_ACK}).catch(e=>{rK.KeyExchange("[KeyExchange: onKeyExchangeMessage()] Error sending KEY_HANDSHAKE_ACK",e)}),this.keysExchanged=!0,this.setStep(iW.KEY_HANDSHAKE_ACK),this.emit(iz.KEYS_EXCHANGED)):n.type===iW.KEY_HANDSHAKE_ACK&&(rK.KeyExchange("[KeyExchange: onKeyExchangeMessage()] KEY_HANDSHAKE_ACK set keysExchanged to true!"),this.checkStep([iW.KEY_HANDSHAKE_ACK,iW.KEY_HANDSHAKE_NONE]),this.keysExchanged=!0,this.setStep(iW.KEY_HANDSHAKE_ACK),this.emit(iz.KEYS_EXCHANGED))}resetKeys(e){this.clean(),this.myECIES=new rz(e)}clean(){rK.KeyExchange(`[KeyExchange: clean()] context=${this.context} reset handshake state`),this.setStep(iW.KEY_HANDSHAKE_NONE),this.emit(iz.KEY_INFO,this.step),this.keysExchanged=!1}start({isOriginator:e,force:t}){let{relayPersistence:n,protocolVersion:r}=this.communicationLayer.remote.state;n?rK.KeyExchange("[KeyExchange: start()] Ignoring key exchange message because relay persistence is activated"):(rK.KeyExchange(`[KeyExchange: start()] context=${this.context} protocolVersion=${r} isOriginator=${e} step=${this.step} force=${t} relayPersistence=${n} keysExchanged=${this.keysExchanged}`),e?!(this.keysExchanged||this.step!==iW.KEY_HANDSHAKE_NONE&&this.step!==iW.KEY_HANDSHAKE_SYNACK)||t?(rK.KeyExchange(`[KeyExchange: start()] context=${this.context} -- start key exchange (force=${t}) -- step=${this.step}`,this.step),this.clean(),this.setStep(iW.KEY_HANDSHAKE_SYNACK),this.communicationLayer.sendMessage({type:iW.KEY_HANDSHAKE_SYN,pubkey:this.myPublicKey,v:2}).catch(e=>{rK.KeyExchange("[KeyExchange: start()] Error sending KEY_HANDSHAKE_SYN",e)})):rK.KeyExchange(`[KeyExchange: start()] context=${this.context} -- key exchange already ${this.keysExchanged?"done":"in progress"} -- aborted.`,this.step):this.keysExchanged&&!0!==t?rK.KeyExchange("[KeyExchange: start()] don't send KEY_HANDSHAKE_START -- exchange already done."):r>=2?this.communicationLayer.sendMessage({type:iW.KEY_HANDSHAKE_SYNACK,pubkey:this.myPublicKey,v:2}).catch(e=>{rK.KeyExchange("[KeyExchange: start()] Error sending KEY_HANDSHAKE_SYNACK",e)}):(this.communicationLayer.sendMessage({type:iW.KEY_HANDSHAKE_START}).catch(e=>{rK.KeyExchange("[KeyExchange: start()] Error sending KEY_HANDSHAKE_START",e)}),this.clean()))}
1setStep(e){this.step=e,this.emit(iz.KEY_INFO,e)}checkStep(e){e.length>0&&e.indexOf(this.step.toString())}setRelayPersistence({localKey:e,otherKey:t}){this.otherPublicKey=t,this.myECIES=new rz({privateKey:e,debug:this.debug}),this.keysExchanged=!0}setKeysExchanged(e){this.keysExchanged=e}areKeysExchanged(){return this.keysExchanged}getMyPublicKey(){return this.myPublicKey}getOtherPublicKey(){return this.otherPublicKey}setOtherPublicKey(e){rK.KeyExchange("[KeyExchange: setOtherPubKey()]",e),this.otherPublicKey=e}encryptMessage(e){if(!this.otherPublicKey)throw Error("encryptMessage: Keys not exchanged - missing otherPubKey");return this.myECIES.encrypt(e,this.otherPublicKey)}decryptMessage(e){if(!this.otherPublicKey)throw Error("decryptMessage: Keys not exchanged - missing otherPubKey");return this.myECIES.decrypt(e)}getKeyInfo(){return{ecies:Object.assign(Object.assign({},this.myECIES.getKeyInfo()),{otherPubKey:this.otherPublicKey}),step:this.step,keysExchanged:this.areKeysExchanged()}}toString(){return JSON.stringify({keyInfo:this.getKeyInfo(),keysExchanged:this.keysExchanged,step:this.step})}}!function(e){e.TERMINATE="terminate",e.ANSWER="answer",e.OFFER="offer",e.CANDIDATE="candidate",e.JSONRPC="jsonrpc",e.WALLET_INFO="wallet_info",e.WALLET_INIT="wallet_init",e.ORIGINATOR_INFO="originator_info",e.PAUSE="pause",e.OTP="otp",e.AUTHORIZED="authorized",e.PING="ping",e.READY="ready"}(iV||(iV={})),function(e){e.REQUEST="sdk_connect_request_started",e.REQUEST_MOBILE="sdk_connect_request_started_mobile",e.RECONNECT="sdk_reconnect_request_started",e.CONNECTED="sdk_connection_established",e.CONNECTED_MOBILE="sdk_connection_established_mobile",e.AUTHORIZED="sdk_connection_authorized",e.REJECTED="sdk_connection_rejected",e.TERMINATED="sdk_connection_terminated",e.DISCONNECTED="sdk_disconnected",e.SDK_USE_EXTENSION="sdk_use_extension",e.SDK_RPC_REQUEST="sdk_rpc_request",e.SDK_RPC_REQUEST_RECEIVED="sdk_rpc_request_received",e.SDK_RPC_REQUEST_DONE="sdk_rpc_request_done",e.SDK_EXTENSION_UTILIZED="sdk_extension_utilized",e.SDK_USE_INAPP_BROWSER="sdk_use_inapp_browser"}(iG||(iG={}));let rX=(e,t,n)=>g(void 0,void 0,void 0,function*(){var r,i,o,a,s,l;let{remote:c,state:d}=e,{channelId:u,isOriginator:h}=d;if("error_terminated"===t)return rK.SocketService(`handleJoinChannelResults: Channel ${u} terminated`),void e.emit(iz.TERMINATE);if(!n)return void rK.SocketService(`handleJoinChannelResults: No result for channel ${u}`);let{persistence:f,walletKey:p,rejected:g}=n;if(rK.SocketService(`handleJoinChannelResults: Channel ${u} persistence=${f} walletKey=${p} rejected=${g}`),g)return rK.SocketService(`handleJoinChannelResults: Channel ${u} rejected`),yield e.remote.disconnect({terminate:!0}),e.remote.emit(iz.REJECTED,{channelId:u}),void e.remote.emitServiceStatusEvent();if(p&&!(null==(r=c.state.channelConfig)?void 0:r.otherKey)){e.getKeyExchange().setOtherPublicKey(p),null==(i=e.state.keyExchange)||i.setKeysExchanged(!0),c.state.ready=!0,c.state.authorized=!0,c.emit(iz.AUTHORIZED);let{communicationLayer:t,storageManager:n}=c.state,r=Object.assign(Object.assign({},c.state.channelConfig),{channelId:null!=(o=c.state.channelId)?o:"",validUntil:Date.now()+6048e5,localKey:null==t?void 0:t.getKeyInfo().ecies.private,otherKey:p});e.sendMessage({type:iW.KEY_HANDSHAKE_ACK}).catch(e=>{}),null==(a=e.state.socket)||a.emit(iV.PING,{id:u,clientType:h?"dapp":"wallet",context:"on_channel_reconnect",message:""}),yield null==n?void 0:n.persistChannelConfig(r),c.emitServiceStatusEvent(),c.setConnectionStatus(iF.LINKED)}f&&(e.emit(iz.CHANNEL_PERSISTENCE),null==(s=e.state.keyExchange)||s.setKeysExchanged(!0),c.state.ready=!0,c.state.authorized=!0,c.emit(iz.AUTHORIZED),rF(Object.assign(Object.assign({id:null!=u?u:"",event:h?iG.CONNECTED:iG.CONNECTED_MOBILE},e.remote.state.originatorInfo),{sdkVersion:e.remote.state.sdkVersion,commLayer:e.state.communicationLayerPreference,commLayerVersion:rq.version,walletVersion:null==(l=e.remote.state.walletInfo)?void 0:l.version}),d.communicationServerUrl).catch(e=>{}))}),r0=e=>new Promise(t=>{setTimeout(t,e)}),r1=(e,t,...n)=>g(void 0,[e,t,...n],void 0,function*(e,t,n=200){let r,i=Date.now(),o=!1;for(;!o;){if(o=Date.now()-i>3e5,void 0!==(r=t[e]).elapsedTime)return r;yield r0(n)}throw Error(`RPC ${e} timed out`)}),r2=e=>g(void 0,void 0,void 0,function*(){let{state:t}=e,{socket:n,channelId:r,context:i,isOriginator:o,isReconnecting:a}=t;if(a)return rK.SocketService("[SocketService: reconnectSocket()] Reconnection already in progress, skipping",e),!1;if(!n)return rK.SocketService("[SocketService: reconnectSocket()] socket is not defined",e),!1;if(!r)return!1;let{connected:s}=n;t.isReconnecting=!0,t.reconnectionAttempts=0,rK.SocketService(`[SocketService: reconnectSocket()] connected=${s}
1 trying to reconnect after socketio disconnection`,e);try{for(;3>t.reconnectionAttempts;){if(rK.SocketService(`[SocketService: reconnectSocket()] Attempt ${t.reconnectionAttempts+1} of 3`,e),yield r0(200),n.connected)return rK.SocketService("Socket already connected --- ping to retrieve messages"),n.emit(iV.PING,{id:r,clientType:o?"dapp":"wallet",context:"on_channel_config",message:""}),!0;t.resumed=!0,n.connect(),e.emit(iz.SOCKET_RECONNECT);try{if(yield new Promise((t,a)=>{n.emit(iz.JOIN_CHANNEL,{channelId:r,context:`${i}connect_again`,clientType:o?"dapp":"wallet"},(n,r)=>g(void 0,void 0,void 0,function*(){try{yield rX(e,n,r),t()}catch(e){a(e)}}))}),yield r0(100),n.connected)return rK.SocketService(`Reconnection successful on attempt ${t.reconnectionAttempts+1}`),!0}catch(e){rK.SocketService(`Error during reconnection attempt ${t.reconnectionAttempts+1}:`,e)}t.reconnectionAttempts+=1,3>t.reconnectionAttempts&&(yield r0(200))}return rK.SocketService("Failed to reconnect after 3 attempts"),!1}finally{t.isReconnecting=!1,t.reconnectionAttempts=0}});function r3(e,t){return g(this,void 0,void 0,function*(){var n;let r=null==(n=e.state.keyExchange)?void 0:n.encryptMessage(JSON.stringify(t)),i={id:e.state.channelId,context:e.state.context,clientType:e.state.isOriginator?"dapp":"wallet",message:r,plaintext:e.state.hasPlaintext?JSON.stringify(t):void 0};return rK.SocketService(`[SocketService: encryptAndSendMessage()] context=${e.state.context}`,i),t.type===iV.TERMINATE&&(e.state.manualDisconnect=!0),new Promise((t,n)=>{var r;null==(r=e.state.socket)||r.emit(iz.MESSAGE,i,(e,r)=>{var i;e&&(rK.SocketService(`[SocketService: encryptAndSendMessage()] error=${e}`),n(e)),rK.SocketService("[encryptAndSendMessage] response",r),t(null!=(i=null==r?void 0:r.success)&&i)})})})}!function(e){e.RPC_CHECK="rpcCheck",e.SKIPPED_RPC="skippedRpc"}(iZ||(iZ={}));let r5=["eth_sendTransaction","eth_signTypedData","eth_signTransaction","personal_sign","wallet_requestPermissions","wallet_switchEthereumChain","eth_signTypedData_v3","eth_signTypedData_v4","metamask_connectSign","metamask_connectWith","metamask_batch"].map(e=>e.toLowerCase()),r8=[{event:iz.CLIENTS_CONNECTED,handler:function(e,t){return n=>g(this,void 0,void 0,function*(){var n,r,i,o,a,s,l,c,d,u,h;let f=null!=(r=null==(n=e.remote.state.channelConfig)?void 0:n.relayPersistence)&&r;if(rK.SocketService(`[SocketService: handleClientsConnected()] context=${e.state.context} on 'clients_connected-${t}' relayPersistence=${f} resumed=${e.state.resumed}  clientsPaused=${e.state.clientsPaused} keysExchanged=${null==(i=e.state.keyExchange)?void 0:i.areKeysExchanged()} isOriginator=${e.state.isOriginator}`),e.emit(iz.CLIENTS_CONNECTED,{isOriginator:e.state.isOriginator,keysExchanged:null==(o=e.state.keyExchange)?void 0:o.areKeysExchanged(),context:e.state.context}),e.state.resumed)e.state.isOriginator||(rK.SocketService(`[SocketService: handleClientsConnected()] context=${e.state.context} 'clients_connected' / keysExchanged=${null==(a=e.state.keyExchange)?void 0:a.areKeysExchanged()} -- backward compatibility`),null==(s=e.state.keyExchange)||s.start({isOriginator:null!=(l=e.state.isOriginator)&&l})),e.state.resumed=!1;else if(e.state.clientsPaused)rK.SocketService("[SocketService: handleClientsConnected()] 'clients_connected' skip sending originatorInfo on pause");else if(!e.state.isOriginator){let t=!f;rK.SocketService(`[SocketService: handleClientsConnected()] context=${e.state.context} on 'clients_connected' / keysExchanged=${null==(c=e.state.keyExchange)?void 0:c.areKeysExchanged()} -- force=${t} -- backward compatibility`),rK.SocketService(`[SocketService: handleClientsConnected()] context=${e.state.context} on 'clients_connected' / keysExchanged=${null==(d=e.state.keyExchange)?void 0:d.areKeysExchanged()} -- force=${t} -- backward compatibility`),null==(u=e.state.keyExchange)||u.start({isOriginator:null!=(h=e.state.isOriginator)&&h,force:t})}e.state.clientsConnected=!0,e.state.clientsPaused=!1})}},{event:iz.CHANNEL_CREATED,handler:function(e,t){return n=>{rK.SocketService(`[SocketService: handleChannelCreated()] context=${e.state.context} on 'channel_created-${t}'`,n),e.emit(iz.CHANNEL_CREATED,n)}}},{event:iz.CLIENTS_DISCONNECTED,handler:function(e,t){return()=>{var n;e.state.clientsConnected=!1,rK.SocketService(`[SocketService: handlesClientsDisconnected()] context=${e.state.context} on 'clients_disconnected-${t}'`),e.remote.state.relayPersistence?rK.SocketService(`[SocketService: handlesClientsDisconnected()] context=${e.state.context} on 'clients_disconnected-${t}' - relayPersistence enabled, skipping key exchange cleanup.`):(e.state.isOriginator&&!e.state.clientsPaused&&(null==(n=e.state.keyExchange)||n.clean()),e.emit(iz.CLIENTS_DISCONNECTED,t))}}},{event:iz.CONFIG,handler:function(e,t){return n=>g(this,void 0,void 0,function*(){var r,i,o;rK.SocketService(`[SocketService: handleChannelConfig()] update relayPersistence on 'config-${t}'`,n);let{persistence:a,walletKey:s}=n;e.state.isOriginator&&e.remote.state.channelConfig?(n.walletKey&&!e.remote.state.channelConfig.otherKey&&(rK.SocketService(`Setting wallet key ${s}`),e.remote.state.channelConfig.otherKey=s,e.getKeyExchange().setOtherPublicKey(n.walletKey),null==(r=e.state.keyExchange)||r.setKeysExchanged(!0),yield e.remote.sendMessage({type:iW.KEY_HANDSHAKE_ACK}),yield e.remote.sendMessage({type:iV.PING}),yield null==(i=e.remote.state.storageManager)?void 0:i.persist
1ChannelConfig(e.remote.state.channelConfig)),!0!==a||e.remote.state.channelConfig.relayPersistence||(rK.SocketService(`Setting relay persistence ${a}`),e.remote.state.channelConfig.relayPersistence=a,e.remote.state.relayPersistence=!0,e.remote.emit(iz.CHANNEL_PERSISTENCE),e.remote.state.authorized=!0,e.remote.state.ready=!0,e.remote.emit(iz.AUTHORIZED),yield null==(o=e.remote.state.storageManager)?void 0:o.persistChannelConfig(e.remote.state.channelConfig))):e.state.isOriginator||n.persistence&&(e.remote.state.relayPersistence=!0,e.remote.emit(iz.CHANNEL_PERSISTENCE))})}},{event:iz.MESSAGE,handler:function(e,t){return n=>{var r,i,o,a,s,l,d,u,h,f,p,g,m,y,v,b,E,w;let{ackId:S,message:_,error:C}=n,x=null!=(r=e.remote.state.relayPersistence)&&r;if(rK.SocketService(`[SocketService handleMessage()]  relayPersistence=${x}  context=${e.state.context} on 'message' ${t} keysExchanged=${null==(i=e.state.keyExchange)?void 0:i.areKeysExchanged()}`,n),C)throw rK.SocketService(`
2      [SocketService handleMessage()] context=${e.state.context}::on 'message' error=${C}`),Error(C);let k="string"==typeof _;if(!k&&(null==_?void 0:_.type)===iW.KEY_HANDSHAKE_START){if(x)return;return rK.SocketService(`[SocketService handleMessage()] context=${e.state.context}::on 'message' received HANDSHAKE_START isOriginator=${e.state.isOriginator}`,_),void(null==(o=e.state.keyExchange)||o.start({isOriginator:null!=(a=e.state.isOriginator)&&a,force:!0}))}if(!k&&(null==(s=null==_?void 0:_.type)?void 0:s.startsWith("key_handshake"))){if(x)return;return rK.SocketService(`[SocketService handleMessage()] context=${e.state.context}::on 'message' emit KEY_EXCHANGE`,_),void e.emit(iq.KEY_EXCHANGE,{message:_,context:e.state.context})}if(!k||(null==(l=e.state.keyExchange)?void 0:l.areKeysExchanged())){if(!k&&(null==_?void 0:_.type))return void e.emit(iz.MESSAGE,_)}else{let t=!1;try{rK.SocketService(`[SocketService handleMessage()] context=${e.state.context}::on 'message' trying to decrypt message`),null==(d=e.state.keyExchange)||d.decryptMessage(_),t=!0}catch(t){rK.SocketService(`[SocketService handleMessage()] context=${e.state.context}::on 'message' error`,t)}if(!t)return e.state.isOriginator?null==(h=e.state.keyExchange)||h.start({isOriginator:null!=(f=e.state.isOriginator)&&f}):e.sendMessage({type:iW.KEY_HANDSHAKE_START}).catch(e=>{}),void rK.SocketService(`Message ignored because invalid key exchange status. step=${null==(p=e.state.keyExchange)?void 0:p.getKeyInfo().step}`,null==(g=e.state.keyExchange)?void 0:g.getKeyInfo(),_);rK.SocketService("Invalid key exchange status detected --- updating it."),null==(u=e.state.keyExchange)||u.setKeysExchanged(!0)}if(!k)return void e.emit(iz.MESSAGE,_);let A=null==(m=e.state.keyExchange)?void 0:m.decryptMessage(_),M=JSON.parse(null!=A?A:"{}");if(S&&(null==S?void 0:S.length)>0&&(rK.SocketService(`[SocketService handleMessage()] context=${e.state.context}::on 'message' ackid=${S} channelId=${t}`),null==(y=e.state.socket)||y.emit(iz.MESSAGE_ACK,{ackId:S,channelId:t,clientType:e.state.isOriginator?"dapp":"wallet"})),e.state.clientsPaused=(null==M?void 0:M.type)===iV.PAUSE,e.state.isOriginator&&M.data){let t=M.data,n=e.state.rpcMethodTracker[t.id];if(n){let r=Date.now()-n.timestamp;rK.SocketService(`[SocketService handleMessage()] context=${e.state.context}::on 'message' received answer for id=${t.id} method=${n.method} responseTime=${r}`,M),e.remote.state.analytics&&r5.includes(n.method.toLowerCase())&&rF(Object.assign(Object.assign({id:null!=(v=e.remote.state.channelId)?v:"",event:iG.SDK_RPC_REQUEST_DONE,sdkVersion:e.remote.state.sdkVersion,commLayerVersion:rq.version},e.remote.state.originatorInfo),{walletVersion:null==(b=e.remote.state.walletInfo)?void 0:b.version,params:{method:n.method,from:"mobile"}}),e.remote.state.communicationServerUrl).catch(e=>{}),rZ(n.method)&&c.analytics.track(t.error?4001===t.error.code?"sdk_action_rejected":"sdk_action_failed":"sdk_action_succeeded",{action:n.method});let i=Object.assign(Object.assign({},n),{result:t.result,error:t.error?{code:null==(E=t.error)?void 0:E.code,message:null==(w=t.error)?void 0:w.message}:void 0,elapsedTime:r});e.state.rpcMethodTracker[t.id]=i,e.emit(iz.RPC_UPDATE,i)}}e.emit(iz.MESSAGE,{message:M})}}},{event:iz.REJECTED,handler:function(e,t){return n=>g(this,void 0,void 0,function*(){var n;e.state.isOriginator&&!e.remote.state.ready?(rK.SocketService(`[SocketService: handleChannelRejected()] context=${e.state.context} channelId=${t} isOriginator=${e.state.isOriginator} ready=${e.remote.state.ready}`,e.remote.state.originatorInfo),rF(Object.assign(Object.assign({id:t,event:iG.REJECTED},e.remote.state.originatorInfo),{sdkVersion:e.remote.state.sdkVersion,commLayer:e.state.communicationLayerPreference,commLayerVersion:rq.version,walletVersion:null==(n=e.remote.state.walletInfo)?void 0:n.version}),e.remote.state.communicationServerUrl).catch(e=>{}),c.analytics.track("sdk_connection_rejected",{transport_type:"websocket"}),yield e.remote.disconnect({terminate:!0}
2),e.remote.emit(iz.REJECTED,{channelId:t}),e.remote.setConnectionStatus(iF.DISCONNECTED)):rK.SocketService(`[SocketService: handleChannelRejected()] SKIP -- channelId=${t} isOriginator=${e.state.isOriginator} ready=${e.remote.state.ready}`)})}},{event:"clients_waiting_to_join",handler:function(e,t){return n=>{rK.SocketService(`[SocketService: handleClientsWaitingToJoin()] context=${e.state.context} on 'clients_waiting_to_join-${t}'`,n),e.emit(iz.CLIENTS_WAITING,n)}}}],r6=[{event:iz.KEY_INFO,handler:function(e){return t=>{rK.SocketService("[SocketService: handleKeyInfo()] on 'KEY_INFO'",t),e.emit(iz.KEY_INFO,t)}}},{event:iz.KEYS_EXCHANGED,handler:function(e){return()=>{var t,n,r;rK.SocketService(`[SocketService: handleKeysExchanged()] on 'keys_exchanged' keyschanged=${null==(t=e.state.keyExchange)?void 0:t.areKeysExchanged()}`);let{channelConfig:i}=e.remote.state;if(i){let t=e.getKeyExchange().getKeyInfo().ecies;i.localKey=t.private,i.otherKey=t.otherPubKey,e.remote.state.channelConfig=i,null==(n=e.remote.state.storageManager)||n.persistChannelConfig(i).catch(e=>{})}e.emit(iz.KEYS_EXCHANGED,{keysExchanged:null==(r=e.state.keyExchange)?void 0:r.areKeysExchanged(),isOriginator:e.state.isOriginator});let o={keyInfo:e.getKeyInfo()};e.emit(iz.SERVICE_STATUS,o)}}}];function r4(e,t){rK.SocketService(`[SocketService: setupChannelListener()] context=${e.state.context} setting socket listeners for channel ${t}...`);let{socket:n}=e.state,{keyExchange:r}=e.state;n&&e.state.isOriginator&&(e.state.debug&&(null==n||n.io.on("error",t=>{rK.SocketService(`[SocketService: setupChannelListener()] context=${e.state.context} socket event=error`,t)}),null==n||n.io.on("reconnect",t=>{rK.SocketService(`[SocketService: setupChannelListener()] context=${e.state.context} socket event=reconnect`,t),r2(e).catch(e=>{})}),null==n||n.io.on("reconnect_error",t=>{rK.SocketService(`[SocketService: setupChannelListener()] context=${e.state.context} socket event=reconnect_error`,t)}),null==n||n.io.on("reconnect_failed",()=>{rK.SocketService(`[SocketService: setupChannelListener()] context=${e.state.context} socket event=reconnect_failed`)})),null==n||n.on("disconnect",t=>(rK.SocketService(`[SocketService: setupChannelListener()] on 'disconnect' -- MetaMaskSDK socket disconnected '${t}' begin recovery...`),(t=>{rK.SocketService(`[SocketService: handleDisconnect()] on 'disconnect' manualDisconnect=${e.state.manualDisconnect}`,t),e.state.manualDisconnect||(e.emit(iz.SOCKET_DISCONNECTED),r2(e).catch(e=>{}))})(t)))),r8.forEach(({event:r,handler:i})=>{null==n||n.on(`${r}-${t}`,i(e,t))}
2),r6.forEach(({event:t,handler:n})=>{null==r||r.on(t,n(e))}),e.state.setupChannelListeners=!0}class r9 extends d.EventEmitter2{constructor(e){super(),this.state={clientsConnected:!1,clientsPaused:!1,manualDisconnect:!1,lastRpcId:void 0,rpcMethodTracker:{},hasPlaintext:!1,communicationServerUrl:"",focusListenerAdded:!1,removeFocusListener:void 0,isReconnecting:!1,reconnectionAttempts:0},this.options=e;let{reconnect:t,communicationLayerPreference:n,communicationServerUrl:r,context:i,remote:o,logging:a}=e;this.state.resumed=t,this.state.context=i,this.state.isOriginator=o.state.isOriginator,this.state.communicationLayerPreference=n,this.state.debug=!0===(null==a?void 0:a.serviceLayer),this.remote=o,!0===(null==a?void 0:a.serviceLayer)&&l().enable("SocketService:Layer"),this.state.communicationServerUrl=r,this.state.hasPlaintext=this.state.communicationServerUrl!==rW&&!0===(null==a?void 0:a.plaintext),rK.SocketService(`[SocketService: constructor()] Socket IO url: ${this.state.communicationServerUrl}`),this.initSocket()}initSocket(){var e;let{otherPublicKey:t,ecies:n,logging:r}=this.options,i=this.state.communicationServerUrl;rK.SocketService(`[SocketService: initSocket()] Socket IO url: ${i}`),this.state.socket=(0,p.io)(i,{autoConnect:!1,transports:rV,withCredentials:!0}),function(e){if("undefined"!=typeof window&&"undefined"!=typeof document&&(rK.SocketService(`[SocketService: setupSocketFocusListener()] hasFocus=${document.hasFocus()}`,e),!e.state.focusListenerAdded)){let t=()=>{rK.SocketService("Document has focus --- reconnecting socket"),r2(e).catch(e=>{})};window.addEventListener("focus",t),e.state.focusListenerAdded=!0,e.state.removeFocusListener=()=>{window.removeEventListener("focus",t),e.state.focusListenerAdded=!1}}}(this);let o={communicationLayer:this,otherPublicKey:t,sendPublicKey:!1,context:null!=(e=this.state.context)?e:"",ecies:n,logging:r};this.state.keyExchange=new rQ(o)}resetKeys(){var e;return rK.SocketService("[SocketService: resetKeys()] Resetting keys."),void(null==(e=this.state.keyExchange)||e.resetKeys())}createChannel(){return g(this,void 0,void 0,function*(){return function(e){return g(this,void 0,void 0,function*(){var t,n,r;if(rK.SocketService(`[SocketService: createChannel()] context=${e.state.context}`),e.state.socket||e.initSocket(),null==(t=e.state.socket)?void 0:t.connected)throw Error("socket already connected");null==(n=e.state.socket)||n.connect(),e.state.manualDisconnect=!1,e.state.isOriginator=!0;let i=(0,h.A)();e.state.channelId=i,r4(e,i),yield new Promise((t,n)=>{var r;null==(r=e.state.socket)||r.emit(iz.JOIN_CHANNEL,{channelId:i,context:`${e.state.context}createChannel`,clientType:"dapp"},(r,i)=>g(this,void 0,void 0,function*(){try{yield rX(e,r,i),t()}catch(e){n(e)}}))});let o=null==(r=e.state.keyExchange)?void 0:r.getKeyInfo();return{channelId:i,pubKey:(null==o?void 0:o.ecies.public)||"",privKey:(null==o?void 0:o.ecies.private)||""}})}(this)})}connectToChannel({channelId:e,withKeyExchange:t=!1,authorized:n}){return function(e){return g(this,arguments,void 0,function*({options:e,instance:t}){let{channelId:n,authorized:r,withKeyExchange:i}=e,{state:o,remote:a}=t,{isOriginator:s=!1,socket:l,keyExchange:c}=o,{channelConfig:d}=a.state;if(null==l?void 0:l.connected)throw Error("socket already connected");if(s&&(null==d?void 0:d.relayPersistence)){let{localKey:e,otherKey:t}=d;e&&t&&(null==c||c.setRelayPersistence({localKey:e,otherKey:t}))}return Object.assign(o,{manualDisconnect:!1,withKeyExchange:i,isOriginator:s,channelId:n}),null==l||l.connect(),r4(t,n),!s&&r&&(null==c||c.setKeysExchanged(!0),Object.assign(a.state,{ready:!0,authorized:!0})),new Promise(e=>{var i;let a=null==(i=null==c?void 0:c.getKeyInfo())?void 0:i.ecies.public;null==l||l.emit(iz.JOIN_CHANNEL,{channelId:n,context:`${o.context}_connectToChannel`,clientType:s?"dapp":"wallet",publicKey:r&&!s?a:void 0},(n,r)=>g(this,void 0,void 0,function*(){yield rX(t,n,r),e()}))})})}({options:{channelId:e,withKeyExchange:t,authorized:n},instance:this})}getKeyInfo(){return this.state.keyExchange.getKeyInfo()}keyCheck(){var e;null==(e=this.state.socket)||e.emit(iz.MESSAGE,{id:this.state.channelId,context:this.state.context,message:{type:iW.KEY_HANDSHAKE_CHECK,pubkey:this.getKeyInfo().ecies.otherPubKey}})}getKeyExchange(){return this.state.keyExchange}sendMessage(e){return g(this,void 0,void 0,function*(){return function(e,t){return g(this,void 0,void 0,function*(){var n,r,i,o;if(!e.state.channelId)throw rK.SocketService("handleSendMessage: no channelId - Create a channel first"),Error("Create a channel first");
2if(rK.SocketService(`[SocketService: handleSendMessage()] context=${e.state.context} areKeysExchanged=${null==(n=e.state.keyExchange)?void 0:n.areKeysExchanged()}`,t),null==(r=null==t?void 0:t.type)?void 0:r.startsWith("key_handshake"))return rK.SocketService(`[SocketService: handleKeyHandshake()] context=${e.state.context}`,t),null==(o=e.state.socket)||o.emit(iz.MESSAGE,{id:e.state.channelId,context:e.state.context,clientType:e.state.isOriginator?"dapp":"wallet",message:t}),!0;!function(e,t){var n;if(!(null==(n=e.state.keyExchange)?void 0:n.areKeysExchanged())&&!e.remote.state.relayPersistence)throw rK.SocketService(`[SocketService: validateKeyExchange()] context=${e.state.context} ERROR keys not exchanged`,t),Error("Keys not exchanged BBB")}(e,t),function(e,t){var n;let r=null!=(n=null==t?void 0:t.method)?n:"",i=null==t?void 0:t.id;e.state.isOriginator&&i&&(e.state.rpcMethodTracker[i]={id:i,timestamp:Date.now(),method:r},e.emit(iz.RPC_UPDATE,e.state.rpcMethodTracker[i]))}(e,t);let a=yield r3(e,t);return e.remote.state.analytics&&e.remote.state.isOriginator&&t.method&&r5.includes(t.method.toLowerCase())&&rF({id:null!=(i=e.remote.state.channelId)?i:"",event:iG.SDK_RPC_REQUEST,params:{method:t.method,from:"mobile"}},e.remote.state.communicationServerUrl).catch(e=>{}),e.remote.state.isOriginator&&t.method&&rZ(t.method)&&c.analytics.track("sdk_action_requested",{action:t.method}),(function(e,t){return g(this,void 0,void 0,function*(){var n;let r=null==t?void 0:t.id,i=null!=(n=null==t?void 0:t.method)?n:"";if(e.state.isOriginator&&r)try{let n=r1(r,e.state.rpcMethodTracker,200).then(e=>({type:iZ.RPC_CHECK,result:e})),o=g(this,void 0,void 0,function*(){let t,n=yield(t={instance:e,rpcId:r},g(void 0,[t],void 0,function*({rpcId:e,instance:t}){for(;t.state.lastRpcId===e||void 0===t.state.lastRpcId;)yield r0(200);return t.state.lastRpcId})),i=yield r1(n,e.state.rpcMethodTracker,200);return{type:iZ.SKIPPED_RPC,result:i}}),a=yield Promise.race([n,o]);if(a.type===iZ.RPC_CHECK){let e=a.result;rK.SocketService(`[SocketService:handleRpcReplies()] id=${t.id} ${i} ( ${e.elapsedTime} ms)`,e.result)}else{if(a.type!==iZ.SKIPPED_RPC)throw Error(`Error handling RPC replies for ${r}`);{let t=Object.assign(Object.assign({},e.state.rpcMethodTracker[r]),{error:Error("SDK_CONNECTION_ISSUE")});e.emit(iz.RPC_UPDATE,t);let n={data:Object.assign(Object.assign({},t),{jsonrpc:"2.0"}),name:"metamask-provider"};e.emit(iz.MESSAGE,{message:n})}}}catch(e){throw e}})})(e,t).catch(e=>{}),a})}(this,e)})}ping(){return function(e){return g(this,void 0,void 0,function*(){var t,n;rK.SocketService(`[SocketService: ping()] context=${e.state.context} originator=${e.state.isOriginator} keysExchanged=${null==(t=e.state.keyExchange)?void 0:t.areKeysExchanged()}`),null==(n=e.state.socket)||n.emit(iV.PING,{id:e.state.channelId,context:"ping",clientType:e.remote.state.isOriginator?"dapp":"wallet",message:""})})}(this)}pause(){return function(e){return g(this,void 0,void 0,function*(){var t,n;rK.SocketService(`[SocketService: pause()] context=${e.state.context}`),e.state.manualDisconnect=!0,(null==(t=e.state.keyExchange)?void 0:t.areKeysExchanged())&&(yield e.sendMessage({type:iV.PAUSE})),null==(n=e.state.socket)||n.disconnect()})}(this)}isConnected(){var e;return null==(e=this.state.socket)?void 0:e.connected}resume(){return function(e){return g(this,void 0,void 0,function*(){let{state:t,remote:n}=e,{socket:r,channelId:i,context:o,keyExchange:a,isOriginator:s}=t,{isOriginator:l}=n.state;if(rK.SocketService(`[SocketService: resume()] channelId=${i} context=${o} connected=${null==r?void 0:r.connected} manualDisconnect=${t.manualDisconnect} resumed=${t.resumed} keysExchanged=${null==a?void 0:a.areKeysExchanged()}`),!i)throw rK.SocketService("[SocketService: resume()] channelId is not defined"),Error("ChannelId is not defined");(null==r?void 0:r.connected)?(rK.SocketService("[SocketService: resume()] already connected."),r.emit(iV.PING,{id:i,clientType:l?"dapp":"wallet",context:"on_channel_config",message:""}),n.hasRelayPersistence()||(null==a?void 0:a.areKeysExchanged())||(s?yield e.sendMessage({type:iV.READY}):null==a||a.start({isOriginator:!1}))):(null==r||r.connect(),rK.SocketService(`[SocketService: resume()] after connecting socket --> connected=${null==r?void 0:r.connected}`),null==r||r.emit(iz.JOIN_CHANNEL,{channelId:i,context:`${o}_resume`,clientType:l?"dapp":"wallet"},(t,n)=>
2g(this,void 0,void 0,function*(){try{yield rX(e,t,n)}catch(e){}}))),t.manualDisconnect=!1,t.resumed=!0})}(this)}getRPCMethodTracker(){return this.state.rpcMethodTracker}disconnect(e){var t,n,r,i,o;rK.SocketService(`[SocketService: disconnect()] context=${this.state.context}`,e),(null==e?void 0:e.terminate)&&(null==(n=(t=this.state).removeFocusListener)||n.call(t),this.state.channelId=e.channelId,null==(r=this.state.socket)||r.removeAllListeners(),null==(i=this.state.keyExchange)||i.clean(),this.remote.state.ready=!1,this.state.socket=void 0,this.state.rpcMethodTracker={}),this.state.manualDisconnect=!0,null==(o=this.state.socket)||o.disconnect()}}function r7({communicationLayerPreference:e,otherPublicKey:t,reconnect:n,ecies:r,communicationServerUrl:i=rW,instance:o}){var a,s,l,d,u,h,f,p,m,y,v;let{state:b}=o;if(rK.RemoteCommunication("[initCommunicationLayer()] ",JSON.stringify(b,null,2)),e!==iJ.SOCKET)throw Error("Invalid communication protocol");b.communicationLayer=new r9({communicationLayerPreference:e,otherPublicKey:t,reconnect:n,transports:b.transports,communicationServerUrl:i,context:b.context,ecies:r,logging:b.logging,remote:o});let E="undefined"!=typeof document&&document.URL||"",w="undefined"!=typeof document&&document.title||"";(null==(a=b.dappMetadata)?void 0:a.url)&&(E=b.dappMetadata.url),(null==(s=b.dappMetadata)?void 0:s.name)&&(w=b.dappMetadata.name);let S=null!=(h=null!=(d=null==(l=b.dappMetadata)?void 0:l.name)?d:null==(u=b.dappMetadata)?void 0:u.url)?h:"N/A",_="undefined"!=typeof window&&void 0!==window.location&&null!=(f=window.location.hostname)?f:S,C={url:E,title:w,source:null==(p=b.dappMetadata)?void 0:p.source,dappId:_,anonId:b.anonId,icon:(null==(m=b.dappMetadata)?void 0:m.iconUrl)||(null==(y=b.dappMetadata)?void 0:y.base64Icon),platform:b.platformType,apiVersion:rq.version,connector:null==(v=b.dappMetadata)?void 0:v.connector};for(let[t,n]of(b.originatorInfo=C,Object.entries({[iz.AUTHORIZED]:function(e){return()=>g(this,void 0,void 0,function*(){var t,n,r;let{state:i}=e;if(i.authorized)return;yield g(this,void 0,void 0,function*(){for(;!i.walletInfo;)yield r0(500)});let o="7.3".localeCompare((null==(t=i.walletInfo)?void 0:t.version)||"");if(rK.RemoteCommunication(`[RemoteCommunication: handleAuthorizedEvent()] HACK 'authorized' version=${null==(n=i.walletInfo)?void 0:n.version} compareValue=${o}`),1!==o)return;let a=i.platformType===iQ.MobileWeb||i.platformType===iQ.ReactNative||i.platformType===iQ.MetaMaskMobileWebview;rK.RemoteCommunication(`[RemoteCommunication: handleAuthorizedEvent()] HACK 'authorized' platform=${i.platformType} secure=${a} channel=${i.channelId} walletVersion=${null==(r=i.walletInfo)?void 0:r.version}`),a&&(i.authorized=!0,e.emit(iz.AUTHORIZED))})}(o),[iz.MESSAGE]:e=>{let t=e;e.message&&(t=t.message),function(e,t){var n,r;let{state:i}=t;if(rK.RemoteCommunication(`[RemoteCommunication: onCommunicationLayerMessage()] context=${i.context} on 'message' typeof=${typeof e}`,e),t.state.ready=!0,i.isOriginator||e.type!==iV.ORIGINATOR_INFO)if(i.isOriginator&&e.type===iV.WALLET_INFO){let{state:n}=t;n.walletInfo=e.walletInfo,n.paused=!1}else{if(i.isOriginator&&e.type===iV.WALLET_INIT)(function(e,t){return g(this,void 0,void 0,function*(){var n,r,i;let{state:o}=e;if(o.isOriginator){let o=t.data||{};if("object"==typeof o&&"accounts"in o&&"chainId"in o&&"walletKey"in o)try{let{channelConfig:t}=e.state;if(rK.RemoteCommunication("WALLET_INIT: channelConfig",JSON.stringify(t,null,2)),t){let a=o.accounts,s=o.chainId,l=o.walletKey,c,d=!1;"deeplinkProtocol"in o&&(d=!!o.deeplinkProtocol,e.state.deeplinkProtocolAvailable=d),"walletVersion"in o&&(c=o.walletVersion),yield null==(n=e.state.storageManager)?void 0:n.persistChannelConfig(Object.assign(Object.assign({},t),{otherKey:l,walletVersion:c,deeplinkProtocolAvailable:d,relayPersistence:!0})),yield null==(r=e.state.storageManager)?void 0:r.persistAccounts(a),yield null==(i=e.state.storageManager)?void 0:i.persistChainId(s)}e.emit(iz.WALLET_INIT,{accounts:o.accounts,chainId:o.chainId})}catch(e){}}})})(t,e).catch(e=>{rK.RemoteCommunication(`[RemoteCommunication: onCommunicationLayerMessage()] error=${e}`)});else if(e.type===iV.TERMINATE)(function(e){return g(this,void 0,void 0,function*(){let{state:t}=e;t.isOriginator&&(yield ie({options:{terminate:!0,sendMessage:!1},instance:e}),e.emit(iz.TERMINATE))})}
2)(t).catch(e=>{rK.RemoteCommunication(`[RemoteCommunication: onCommunicationLayerMessage()] error=${e}`)});else if(e.type===iV.PAUSE){let{state:e}=t;e.paused=!0,t.setConnectionStatus(iF.PAUSED)}else if(e.type===iV.READY&&i.isOriginator){let{state:e}=t;t.setConnectionStatus(iF.LINKED);let n=e.paused;e.paused=!1,t.emit(iz.CLIENTS_READY,{isOriginator:e.isOriginator,walletInfo:e.walletInfo}),n&&(e.authorized=!0,t.emit(iz.AUTHORIZED))}else{if(e.type===iV.OTP&&i.isOriginator){let{state:r}=t;t.emit(iz.OTP,e.otpAnswer),1==="6.6".localeCompare((null==(n=r.walletInfo)?void 0:n.version)||"")&&t.emit(iz.SDK_RPC_CALL,{method:rG.ETH_REQUESTACCOUNTS,params:[]});return}e.type===iV.AUTHORIZED&&i.isOriginator&&function(e){let{state:t}=e;t.authorized=!0,e.emit(iz.AUTHORIZED)}(t)}t.emit(iz.MESSAGE,e)}else{let{state:n}=t;null==(r=n.communicationLayer)||r.sendMessage({type:iV.WALLET_INFO,walletInfo:n.walletInfo}),n.originatorInfo=e.originatorInfo||e.originator,t.emit(iz.CLIENTS_READY,{isOriginator:n.isOriginator,originatorInfo:n.originatorInfo}),n.paused=!1}}(t,o)},[iz.CHANNEL_PERSISTENCE]:function(e){return()=>g(this,void 0,void 0,function*(){var t,n,r,i,o,a,s;let{state:l}=e;rK.RemoteCommunication(`[RemoteCommunication: handleFullPersistenceEvent()] context=${l.context}`),e.state.ready=!0,e.state.clientsConnected=!0,e.state.authorized=!0,e.state.relayPersistence=!0,null==(t=e.state.communicationLayer)||t.getKeyExchange().setKeysExchanged(!0),e.emit(iz.KEYS_EXCHANGED,{keysExchanged:!0,isOriginator:!0}),e.emit(iz.AUTHORIZED),e.emit(iz.CLIENTS_READY),e.emit(iz.CHANNEL_PERSISTENCE);try{l.channelConfig=Object.assign(Object.assign({},l.channelConfig),{localKey:null==(n=l.communicationLayer)?void 0:n.getKeyExchange().getKeyInfo().ecies.private,otherKey:null==(r=l.communicationLayer)?void 0:r.getKeyExchange().getOtherPublicKey(),channelId:null!=(i=l.channelId)?i:"",validUntil:null!=(a=null==(o=l.channelConfig)?void 0:o.validUntil)?a:6048e5,relayPersistence:!0}),yield null==(s=l.storageManager)?void 0:s.persistChannelConfig(l.channelConfig)}catch(e){}})}(o),[iz.CLIENTS_CONNECTED]:()=>{var t,n,r,i;let{state:a}=o;rK.RemoteCommunication(`[RemoteCommunication: handleClientsConnectedEvent()] on 'clients_connected' channel=${a.channelId} keysExchanged=${null==(n=null==(t=a.communicationLayer)?void 0:t.getKeyInfo())?void 0:n.keysExchanged}`),a.analytics&&rF(Object.assign(Object.assign({id:null!=(r=a.channelId)?r:"",event:a.reconnection?iG.RECONNECT:a.isOriginator?iG.REQUEST:iG.REQUEST_MOBILE},a.originatorInfo),{commLayer:e,sdkVersion:a.sdkVersion,walletVersion:null==(i=a.walletInfo)?void 0:i.version,commLayerVersion:rq.version}),a.communicationServerUrl).catch(e=>{}),a.isOriginator&&!a.reconnection&&c.analytics.track("sdk_connection_established",{transport_type:"websocket"}),a.clientsConnected=!0,a.originatorInfoSent=!1,o.emit(iz.CLIENTS_CONNECTED)},[iz.KEYS_EXCHANGED]:t=>{var n,r,i,a,s,l,c,d;let{state:u}=o;if(rK.RemoteCommunication(`[RemoteCommunication: handleKeysExchangedEvent()] context=${u.context} on commLayer.'keys_exchanged' channel=${u.channelId}`,t),null==(r=null==(n=u.communicationLayer)?void 0:n.getKeyInfo())?void 0:r.keysExchanged){let e=Object.assign(Object.assign({},u.channelConfig),{channelId:null!=(i=u.channelId)?i:"",validUntil:(null==(a=u.channelConfig)?void 0:a.validUntil)||6048e5,localKey:u.communicationLayer.getKeyInfo().ecies.private,otherKey:u.communicationLayer.getKeyInfo().ecies.otherPubKey});null==(s=u.storageManager)||s.persistChannelConfig(e).catch(e=>{}),o.setConnectionStatus(iF.LINKED)}!function(e,t){var n,r,i,o,a,s,l,c;let{state:d}=e;rK.RemoteCommunication(`[RemoteCommunication: setLastActiveDate()] channel=${d.channelId}`,t);let u=Object.assign(Object.assign({},d.channelConfig),{channelId:null!=(n=d.channelId)?n:"",validUntil:null!=(i=null==(r=d.channelConfig)?void 0:r.validUntil)?i:0,relayPersistence:d.relayPersistence,localKey:null==(a=null==(o=d.communicationLayer)?void 0:o.state.keyExchange)?void 0:a.getKeyInfo().ecies.private,otherKey:null==(l=null==(s=d.communicationLayer)?void 0:s.state.keyExchange)?void 0:l.getKeyInfo().ecies.otherPubKey,lastActive:t.getTime()});
2null==(c=d.storageManager)||c.persistChannelConfig(u)}(o,new Date),u.analytics&&u.channelId&&rF(Object.assign(Object.assign({id:u.channelId,event:t.isOriginator?iG.CONNECTED:iG.CONNECTED_MOBILE},u.originatorInfo),{sdkVersion:u.sdkVersion,commLayer:e,commLayerVersion:rq.version,walletVersion:null==(l=u.walletInfo)?void 0:l.version}),u.communicationServerUrl).catch(e=>{}),u.isOriginator=t.isOriginator,t.isOriginator||(null==(c=u.communicationLayer)||c.sendMessage({type:iV.READY}),u.ready=!0,u.paused=!1),t.isOriginator&&!u.originatorInfoSent&&(null==(d=u.communicationLayer)||d.sendMessage({type:iV.ORIGINATOR_INFO,originatorInfo:u.originatorInfo,originator:u.originatorInfo}),u.originatorInfoSent=!0)},[iz.SOCKET_DISCONNECTED]:()=>{let{state:e}=o;rK.RemoteCommunication("[RemoteCommunication: handleSocketDisconnectedEvent()] on 'socket_Disconnected' set ready to false"),e.ready=!1},[iz.SOCKET_RECONNECT]:()=>{let{state:e}=o;rK.RemoteCommunication("[RemoteCommunication: handleSocketReconnectEvent()] on 'socket_reconnect' -- reset key exchange status / set ready to false"),e.ready=!1,e.authorized=!1,rJ(e),o.emitServiceStatusEvent({context:"socket_reconnect"})},[iz.CLIENTS_DISCONNECTED]:e=>{let{state:t}=o;rK.RemoteCommunication(`[RemoteCommunication: handleClientsDisconnectedEvent()] context=${t.context} on 'clients_disconnected' channelId=${e}`),t.relayPersistence||(t.clientsConnected=!1,t.ready=!1,t.authorized=!1),o.emit(iz.CLIENTS_DISCONNECTED,t.channelId),o.setConnectionStatus(iF.DISCONNECTED)},[iz.KEY_INFO]:()=>{},[iz.CHANNEL_CREATED]:e=>{let{state:t}=o;rK.RemoteCommunication(`[RemoteCommunication: handleChannelCreatedEvent()] context=${t.context} on 'channel_created' channelId=${e}`),o.emit(iz.CHANNEL_CREATED,e)},[iz.CLIENTS_WAITING]:e=>{var t;let{state:n}=o;if(rK.RemoteCommunication(`[RemoteCommunication: handleClientsWaitingEvent()] context=${n.context} on 'clients_waiting' numberUsers=${e} ready=${n.ready} autoStarted=${n.originatorConnectStarted}`),o.setConnectionStatus(iF.WAITING),o.emit(iz.CLIENTS_WAITING,e),n.originatorConnectStarted){rK.RemoteCommunication(`[RemoteCommunication: handleClientsWaitingEvent()] on 'clients_waiting' watch autoStarted=${n.originatorConnectStarted} timeout`,n.autoConnectOptions);let e=(null==(t=n.autoConnectOptions)?void 0:t.timeout)||3e3,r=setTimeout(()=>{rK.RemoteCommunication(`[RemoteCommunication: handleClientsWaitingEvent()] setTimeout(${e}) terminate channelConfig`,n.autoConnectOptions),n.originatorConnectStarted=!1,n.ready||o.setConnectionStatus(iF.TIMEOUT),clearTimeout(r)},e)}},[iz.RPC_UPDATE]:e=>{o.emit(iz.RPC_UPDATE,e)}})))try{b.communicationLayer.on(t,n)}catch(e){}}function ie(e){return g(this,arguments,void 0,function*({options:e,instance:t}){let{state:n}=t;return rK.RemoteCommunication(`[RemoteCommunication: disconnect()] channel=${n.channelId}`,e),new Promise((r,i)=>{var o,a,s,l,c,d;(null==e?void 0:e.terminate)?(t.state.ready&&rF({id:null!=(o=t.state.channelId)?o:"",event:iG.TERMINATED},t.state.communicationServerUrl).catch(e=>{}),n.ready=!1,n.paused=!1,null==(a=n.storageManager)||a.terminate(null!=(s=n.channelId)?s:""),t.state.terminated=!0,e.sendMessage?(null==(l=n.communicationLayer)?void 0:l.getKeyInfo().keysExchanged)&&t.state.communicationLayer&&r3(t.state.communicationLayer,{type:iV.TERMINATE}).then(()=>{r(!0)}).catch(e=>{i(e)}):r(!0),n.authorized=!1,n.relayPersistence=!1,n.channelId=(0,h.A)(),e.channelId=n.channelId,n.channelConfig=void 0,n.originatorConnectStarted=!1,null==(c=n.communicationLayer)||c.disconnect(e),t.setConnectionStatus(iF.TERMINATED)):(null==(d=n.communicationLayer)||d.disconnect(e),t.setConnectionStatus(iF.DISCONNECTED),r(!0))})})}(iJ||(iJ={})).SOCKET="socket",function(e){e.NonBrowser="nodejs",e.MetaMaskMobileWebview="in-app-browser",e.DesktopWeb="web-desktop",e.MobileWeb="web-mobile",e.ReactNative="react-native"}(iQ||(iQ={}));class it extends d.EventEmitter2{constructor(e){super(),this.state={ready:!1,anonId:"",authorized:!1,isOriginator:!1,terminated:!1,protocolVersion:1,paused:!1,deeplinkProtocolAvailable:!1,platformType:"metamask-mobile",analytics:!1,reconnection:!1,originatorInfoSent:!1,communicationServerUrl:rW,context:"",persist:!1,clientsConnected:!1,sessionDuration:6048e5,originatorConnectStarted:!1,debug:!1,_connectionStatus:iF.DISCONNECTED},this._options=e;let{anonId:t,platformType:n,communicationLayerPreference:r,otherPublicKey:i,reconnect:o,walletInfo:a,dappMetadata:s,protocolVersion:c,transports:d,context:u,relayPersistence:h,ecies:f,analytics:p=!1,storage:g,s
2dkVersion:m,communicationServerUrl:y=rW,logging:v,autoConnect:b={timeout:3e3}}=e;this.state.anonId=t,this.state.otherPublicKey=i,this.state.dappMetadata=s,this.state.walletInfo=a,this.state.transports=d,this.state.platformType=n,this.state.analytics=p,this.state.protocolVersion=null!=c?c:1,this.state.isOriginator=!i,this.state.relayPersistence=h,this.state.communicationServerUrl=y,this.state.context=u,this.state.terminated=!1,this.state.sdkVersion=m,this.setMaxListeners(50),this.setConnectionStatus(iF.DISCONNECTED),(null==g?void 0:g.duration)&&(this.state.sessionDuration=6048e5),this.state.storageOptions=g,this.state.autoConnectOptions=b,this.state.debug=!0===(null==v?void 0:v.remoteLayer),!0===(null==v?void 0:v.remoteLayer)&&l().enable("RemoteCommunication:Layer"),!0===(null==v?void 0:v.serviceLayer)&&l().enable("SocketService:Layer"),!0===(null==v?void 0:v.eciesLayer)&&l().enable("ECIES:Layer"),!0===(null==v?void 0:v.keyExchangeLayer)&&l().enable("KeyExchange:Layer"),this.state.logging=v,(null==g?void 0:g.storageManager)&&(this.state.storageManager=g.storageManager),rK.RemoteCommunication(`[RemoteCommunication: constructor()] protocolVersion=${c} relayPersistence=${h} isOriginator=${this.state.isOriginator} communicationLayerPreference=${r} otherPublicKey=${i} reconnect=${o}`),this.state.isOriginator||r7({communicationLayerPreference:r,otherPublicKey:i,reconnect:o,ecies:f,communicationServerUrl:y,instance:this}),this.emitServiceStatusEvent({context:"constructor"})}initFromDappStorage(){return g(this,void 0,void 0,function*(){var e;if(this.state.storageManager){let t=yield this.state.storageManager.getPersistedChannelConfig({});t&&(this.state.channelConfig=t,this.state.channelId=t.channelId,this.state.deeplinkProtocolAvailable=null!=(e=t.deeplinkProtocolAvailable)&&e,t.relayPersistence&&(this.state.authorized=!0,this.state.ready=!0,this.setConnectionStatus(iF.LINKED),yield this.connectToChannel({channelId:t.channelId})))}r7({communicationLayerPreference:iJ.SOCKET,otherPublicKey:this.state.otherPublicKey,reconnect:this._options.reconnect,ecies:this._options.ecies,communicationServerUrl:this.state.communicationServerUrl,instance:this})})}originatorSessionConnect(){return g(this,void 0,void 0,function*(){return yield function(e){return g(this,void 0,void 0,function*(){var t;let{state:n}=e;if(!n.storageManager)return void rK.RemoteCommunication("[RemoteCommunication: originatorSessionConnect()] no storage manager defined - skip");let r=yield n.storageManager.getPersistedChannelConfig({});if(rK.RemoteCommunication(`[RemoteCommunication: originatorSessionConnect()] autoStarted=${n.originatorConnectStarted} channelConfig`,r),null==(t=n.communicationLayer)?void 0:t.isConnected())return rK.RemoteCommunication("[RemoteCommunication: originatorSessionConnect()] socket already connected - skip"),r;if(r){if(r.validUntil>Date.now())return n.channelConfig=r,n.originatorConnectStarted=!0,n.channelId=null==r?void 0:r.channelId,n.reconnection=!0,r;rK.RemoteCommunication("[RemoteCommunication: autoConnect()] Session has expired")}n.originatorConnectStarted=!1})}(this)})}generateChannelIdConnect(){return g(this,void 0,void 0,function*(){return function(e){return g(this,void 0,void 0,function*(){var t,n,r,i,o,a;if(!e.communicationLayer)throw Error("communication layer not initialized");if(e.ready)throw Error("Channel already connected");if(e.channelId&&(null==(t=e.communicationLayer)?void 0:t.isConnected()))return e.channelConfig=Object.assign(Object.assign({},e.channelConfig),{channelId:e.channelId,validUntil:Date.now()+e.sessionDuration}),null==(n=e.storageManager)||n.persistChannelConfig(e.channelConfig),{channelId:e.channelId,privKey:null==(i=null==(r=e.communicationLayer)?void 0:r.getKeyInfo())?void 0:i.ecies.private,pubKey:null==(a=null==(o=e.communicationLayer)?void 0:o.getKeyInfo())?void 0:a.ecies.public};rK.RemoteCommunication("[RemoteCommunication: generateChannelId()]");let s=yield e.communicationLayer.createChannel();rK.RemoteCommunication("[RemoteCommunication: generateChannelId()] channel created",s);let l=Object.assign(Object.assign({},e.channelConfig),{channelId:s.channelId,localKey:s.privKey,validUntil:Date.now()+e.sessionDuration});return e.channelId=s.channelId,e.channelConfig=l,{channelId:e.channelId,pubKey:s.pubKey,privKey:s.privKey}})}(this.state)})}clean(){return rJ(this.state)}
2connectToChannel({channelId:e,withKeyExchange:t,authorized:n}){return function(e){return g(this,arguments,void 0,function*({channelId:e,withKeyExchange:t,authorized:n,state:r}){var i,o,a;if(!(0,f.A)(e))throw rK.RemoteCommunication(`[RemoteCommunication: connectToChannel()] context=${r.context} invalid channel channelId=${e}`),Error(`Invalid channel ${e}`);if(rK.RemoteCommunication(`[RemoteCommunication: connectToChannel()] context=${r.context} channelId=${e} withKeyExchange=${t}`),null==(i=r.communicationLayer)?void 0:i.isConnected())return void rK.RemoteCommunication(`[RemoteCommunication: connectToChannel()] context=${r.context} already connected - interrupt connection.`);r.channelId=e,yield null==(o=r.communicationLayer)?void 0:o.connectToChannel({channelId:e,authorized:n,withKeyExchange:t});let s=Object.assign(Object.assign({},r.channelConfig),{channelId:e,validUntil:Date.now()+r.sessionDuration});r.channelConfig=s,null==(a=r.storageManager)||a.persistChannelConfig(s)})}({channelId:e,authorized:n,withKeyExchange:t,state:this.state})}sendMessage(e){return g(this,void 0,void 0,function*(){let t=this.state.isOriginator&&e.method&&rZ(e.method);t&&c.analytics.track("sdk_action_requested",{action:e.method});try{return yield function(e,t){return g(this,void 0,void 0,function*(){var n,r;let{state:i}=e;rK.RemoteCommunication(`[RemoteCommunication: sendMessage()] context=${i.context} paused=${i.paused} ready=${i.ready} relayPersistence=${i.relayPersistence} authorized=${i.authorized} socket=${null==(n=i.communicationLayer)?void 0:n.isConnected()} clientsConnected=${i.clientsConnected} status=${i._connectionStatus}`,t),i.relayPersistence||i.ready&&(null==(r=i.communicationLayer)?void 0:r.isConnected())&&i.clientsConnected||(rK.RemoteCommunication(`[RemoteCommunication: sendMessage()] context=${i.context}  SKIP message waiting for MM mobile readiness.`),yield new Promise(t=>{e.once(iz.CLIENTS_READY,t)}),rK.RemoteCommunication(`[RemoteCommunication: sendMessage()] context=${i.context}  AFTER SKIP / READY -- sending pending message`));try{return yield function(e,t){return g(this,void 0,void 0,function*(){return new Promise(n=>{var r;let{state:i}=e;rK.RemoteCommunication(`[RemoteCommunication: handleAuthorization()] context=${i.context} ready=${i.ready} authorized=${i.authorized} method=${t.method}`),!i.isOriginator||i.authorized||i.relayPersistence?null==(r=i.communicationLayer)||r.sendMessage(t).then(e=>{n(e)}).catch(e=>{n(!1)}):e.once(iz.AUTHORIZED,()=>{var e;rK.RemoteCommunication(`[RemoteCommunication: handleAuthorization()] context=${i.context}  AFTER SKIP / AUTHORIZED -- sending pending message`),null==(e=i.communicationLayer)||e.sendMessage(t).then(e=>{n(e)}).catch(e=>{n(!1)})})})})}(e,t)}catch(e){throw e}})}(this,e)}catch(n){throw t&&c.analytics.track("sdk_action_failed",{action:e.method}),n}})}testStorage(){return g(this,void 0,void 0,function*(){return function(e){return g(this,void 0,void 0,function*(){var t;let n=yield null==(t=e.storageManager)?void 0:t.getPersistedChannelConfig();rK.RemoteCommunication("[RemoteCommunication: testStorage()] res",n)})}(this.state)})}hasDeeplinkProtocol(){return this.state.deeplinkProtocolAvailable}getChannelConfig(){return this.state.channelConfig}isReady(){return this.state.ready}isConnected(){var e;return null==(e=this.state.communicationLayer)?void 0:e.isConnected()}isAuthorized(){return this.state.authorized}isPaused(){return this.state.paused}getCommunicationLayer(){return this.state.communicationLayer}ping(){return g(this,void 0,void 0,function*(){var e;rK.RemoteCommunication(`[RemoteCommunication: ping()] channel=${this.state.channelId}`),yield null==(e=this.state.communicationLayer)?void 0:e.ping()})}testLogger(){rK.RemoteCommunication(`testLogger() channel=${this.state.channelId}`),rK.SocketService(`testLogger() channel=${this.state.channelId}`),rK.Ecies(`testLogger() channel=${this.state.channelId}`),rK.KeyExchange(`testLogger() channel=${this.state.channelId}`)}keyCheck(){var e;rK.RemoteCommunication(`[RemoteCommunication: keyCheck()] channel=${this.state.channelId}`),null==(e=this.state.communicationLayer)||e.keyCheck()}setConnectionStatus(e){this.state._connectionStatus!==e&&(this.state._connectionStatus=e,this.emit
2(iz.CONNECTION_STATUS,e),this.emitServiceStatusEvent({context:"setConnectionStatus"}))}emitServiceStatusEvent(e={}){this.emit(iz.SERVICE_STATUS,this.getServiceStatus())}getConnectionStatus(){return this.state._connectionStatus}getServiceStatus(){return{originatorInfo:this.state.originatorInfo,keyInfo:this.getKeyInfo(),connectionStatus:this.state._connectionStatus,channelConfig:this.state.channelConfig,channelId:this.state.channelId}}getKeyInfo(){var e;return null==(e=this.state.communicationLayer)?void 0:e.getKeyInfo()}resetKeys(){var e;null==(e=this.state.communicationLayer)||e.resetKeys()}setOtherPublicKey(e){var t;let n=null==(t=this.state.communicationLayer)?void 0:t.getKeyExchange();if(!n)throw Error("KeyExchange is not initialized.");n.getOtherPublicKey()!==e&&n.setOtherPublicKey(e)}pause(){return g(this,void 0,void 0,function*(){var e;rK.RemoteCommunication(`[RemoteCommunication: pause()] channel=${this.state.channelId}`),yield null==(e=this.state.communicationLayer)?void 0:e.pause(),this.setConnectionStatus(iF.PAUSED)})}getVersion(){return rq.version}hasRelayPersistence(){var e;return null!=(e=this.state.relayPersistence)&&e}resume(){return g(this,void 0,void 0,function*(){return function(e){return g(this,void 0,void 0,function*(){var t;let{state:n}=e;rK.RemoteCommunication(`[RemoteCommunication: resume()] channel=${n.channelId}`),yield null==(t=n.communicationLayer)?void 0:t.resume(),e.setConnectionStatus(iF.LINKED)})}(this)})}encrypt(e){var t,n,r;let i=null==(t=this.state.communicationLayer)?void 0:t.getKeyExchange(),o=null==i?void 0:i.getOtherPublicKey();if(!o)throw Error("KeyExchange not completed");return null==(r=null==(n=this.state.communicationLayer)?void 0:n.state.eciesInstance)?void 0:r.encrypt(e,o)}decrypt(e){var t,n,r;if(!(null==(t=this.state.communicationLayer)?void 0:t.state.eciesInstance))throw Error("ECIES instance is not initialized");return null==(r=null==(n=this.state.communicationLayer)?void 0:n.state.eciesInstance)?void 0:r.decrypt(e)}getChannelId(){return this.state.channelId}getRPCMethodTracker(){var e;return null==(e=this.state.communicationLayer)?void 0:e.getRPCMethodTracker()}reject({channelId:e}){return function(e){return g(this,arguments,void 0,function*({channelId:e,state:t}){var n,r,i;if(!(0,f.A)(e))throw rK.RemoteCommunication(`[RemoteCommunication: connectToChannel()] context=${t.context} invalid channel channelId=${e}`),Error(`Invalid channel ${e}`);if(t.isOriginator)return void rK.RemoteCommunication(`[RemoteCommunication: reject()] context=${t.context} isOriginator=${t.isOriginator} channelId=${e}`);let{socket:o}=null!=(r=null==(n=t.communicationLayer)?void 0:n.state)?r:{};(null==o?void 0:o.connected)||(rK.RemoteCommunication(`[RemoteCommunication: reject()] context=${t.context} socket already connected`),null==o||o.connect()),rF(Object.assign(Object.assign({id:e,event:iG.REJECTED},t.originatorInfo),{sdkVersion:t.sdkVersion,commLayerVersion:rq.version,walletVersion:null==(i=t.walletInfo)?void 0:i.version}),t.communicationServerUrl).catch(e=>{}),yield new Promise((n,r)=>{null==o||o.emit(iz.REJECTED,{channelId:e},(e,i)=>{rK.RemoteCommunication(`[RemoteCommunication: reject()] context=${t.context} socket=${null==o?void 0:o.id}`,{error:e,response:i}),e?r(e):n(i)})})})}({channelId:e,state:this.state})}disconnect(e){return g(this,void 0,void 0,function*(){return ie({options:e,instance:this})})}}!function(e){e.RENEW="renew",e.LINK="link"}(iX||(iX={}));var ir={errors:{disconnected:()=>"MetaMask: Disconnected from chain. Attempting to connect.",permanentlyDisconnected:()=>"MetaMask: Disconnected from MetaMask background. Page reload required.",sendSiteMetadata:()=>"MetaMask: Failed to send site metadata. This is an internal error, please report this bug.",unsupportedSync:e=>`MetaMask: The MetaMask Ethereum provider does not support synchronous methods like ${e} without a callback parameter.`,invalidDuplexStream:()=>"Must provide a Node.js-style duplex stream.",invalidNetworkParams:()=>"MetaMask: Received invalid network parameters. Please report this bug.",invalidRequestArgs:()=>"Expected a single, non-array, object argument.",invalidRequestMethod:()=>
2"'args.method' must be a non-empty string.",invalidRequestParams:()=>"'args.params' must be an object or array if provided.",invalidLoggerObject:()=>"'args.logger' must be an object if provided.",invalidLoggerMethod:e=>`'args.logger' must include required method '${e}'.`},info:{connected:e=>`MetaMask: Connected to chain with ID "${e}".`},warnings:{chainIdDeprecation:"MetaMask: 'ethereum.chainId' is deprecated and may be removed in the future. Please use the 'eth_chainId' RPC method instead.\nFor more information, see: https://github.com/MetaMask/metamask-improvement-proposals/discussions/23",networkVersionDeprecation:"MetaMask: 'ethereum.networkVersion' is deprecated and may be removed in the future. Please use the 'net_version' RPC method instead.\nFor more information, see: https://github.com/MetaMask/metamask-improvement-proposals/discussions/23",selectedAddressDeprecation:"MetaMask: 'ethereum.selectedAddress' is deprecated and may be removed in the future. Please use the 'eth_accounts' RPC method instead.\nFor more information, see: https://github.com/MetaMask/metamask-improvement-proposals/discussions/23",enableDeprecation:"MetaMask: 'ethereum.enable()' is deprecated and may be removed in the future. Please use the 'eth_requestAccounts' RPC method instead.\nFor more information, see: https://eips.ethereum.org/EIPS/eip-1102",sendDeprecation:"MetaMask: 'ethereum.send(...)' is deprecated and may be removed in the future. Please use 'ethereum.sendAsync(...)' or 'ethereum.request(...)' instead.\nFor more information, see: https://eips.ethereum.org/EIPS/eip-1193",events:{close:"MetaMask: The event 'close' is deprecated and may be removed in the future. Please use 'disconnect' instead.\nFor more information, see: https://eips.ethereum.org/EIPS/eip-1193#disconnect",data:"MetaMask: The event 'data' is deprecated and will be removed in the future. Use 'message' instead.\nFor more information, see: https://eips.ethereum.org/EIPS/eip-1193#message",networkChanged:"MetaMask: The event 'networkChanged' is deprecated and may be removed in the future. Use 'chainChanged' instead.\nFor more information, see: https://eips.ethereum.org/EIPS/eip-1193#chainchanged",notification:"MetaMask: The event 'notification' is deprecated and may be removed in the future. Use 'message' instead.\nFor more information, see: https://eips.ethereum.org/EIPS/eip-1193#message"},rpc:{ethDecryptDeprecation:"MetaMask: The RPC method 'eth_decrypt' is deprecated and may be removed in the future.\nFor more information, see: https://medium.com/metamask/metamask-api-method-deprecation-2b0564a84686",ethGetEncryptionPublicKeyDeprecation:"MetaMask: The RPC method 'eth_getEncryptionPublicKey' is deprecated and may be removed in the future.\nFor more information, see: https://medium.com/metamask/metamask-api-method-deprecation-2b0564a84686",walletWatchAssetNFTExperimental:"MetaMask: The RPC method 'wallet_watchAsset' is experimental for ERC721/ERC1155 assets and may change in the future.\nFor more information, see: https://github.com/MetaMask/metamask-improvement-proposals/blob/main/MIPs/mip-1.md and https://github.com/MetaMask/metamask-improvement-proposals/blob/main/PROCESS-GUIDE.md#proposal-lifecycle"},experimentalMethods:"MetaMask: 'ethereum._metamask' exposes non-standard, experimental methods. They may be removed or changed without warning."}},ii=Math.floor(0xffffffff*Math.random()),io=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},ia=(e,t,n)=>(io(e,t,"read from private field"),n?n.call(e):t.get(e)),is=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},il=(e,t,n,r)=>(io(e,t,"write to private field"),t.set(e,n),n),ic=(e,t,n)=>(io(e,t,"access private method"),n),id={invalidRequest:-32600,internal:-32603},iu={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."}};function ih(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}var ip=(e,t)=>Object.hasOwnProperty.call(e,t);class ig extends TypeError{constructor(e,t){let n,{message:r,explanation:i,...o}=e,{path:a}=e,s=0===a.length?r:`At path: ${a.join(".")} -- ${r}`;super(i??s),null!=i&&(this.cause=s),Object.assign(this,o),this.name=this.constructor.name,this.failures=()=>n??(n=[e,...t()])}}function im(e){return"object"==typeof e&&null!=e}function iy(e){return"symbol"==typeof e?e.toString():"string"==typeof e?JSON.stringify(e):`${e}`}function*iv(e,t,n,r){var i;for(let o of(im(i=e)&&"function"==typeof i[Symbol.iterator]||(e=[e]),e)){let e=function(e,t,n,r){if(!0===e)return;!1===e?e={}:"string"==typeof e&&(e={message:e});let{path:i,branch:o}=t,{type:a}=n,{refinement:s,message:l=`Expected a value of type \`${a}\`${s?` with refinement \`${s}\``:""}, but received: \`${iy(r)}\``}=e;return{value:r,type:a,refinement:s,key:i[i.length-1],path:i,branch:o,...e,message:l}}(o,t,n,r);e&&(yield e)}}function*ib(e,t,n={}){let{path:r=[],branch:i=[e],coerce:o=!1,mask:a=!1}=n,s={path:r,branch:i};if(o&&(e=t.coercer(e,s),a&&"type"!==t.type&&im(t.schema)&&im(e)&&!Array.isArray(e)))for(let n in e)void 0===t.schema[n]&&delete e[n];let l="valid";for(let r of t.validator(e,s))r.explanation=n.message,l="not_val
2id",yield[r,void 0];for(let[c,d,u]of t.entries(e,s))for(let t of ib(d,u,{path:void 0===c?r:[...r,c],branch:void 0===c?i:[...i,d],coerce:o,mask:a,message:n.message}))t[0]?(l=null!=t[0].refinement?"not_refined":"not_valid",yield[t[0],void 0]):o&&(d=t[1],void 0===c?e=d:e instanceof Map?e.set(c,d):e instanceof Set?e.add(d):im(e)&&(void 0!==d||c in e)&&(e[c]=d));if("not_valid"!==l)for(let r of t.refiner(e,s))r.explanation=n.message,l="not_refined",yield[r,void 0];"valid"===l&&(yield[void 0,e])}class iE{constructor(e){let{type:t,schema:n,validator:r,refiner:i,coercer:o=e=>e,entries:a=function*(){}}=e;this.type=t,this.schema=n,this.entries=a,this.coercer=o,this.validator=r?(e,t)=>iv(r(e,t),t,this,e):()=>[],this.refiner=i?(e,t)=>iv(i(e,t),t,this,e):()=>[]}assert(e,t){return iw(e,this,t)}create(e,t){return iS(e,this,t)}is(e){return i_(e,this)}mask(e,t){let n=iC(e,this,{coerce:!0,mask:!0,message:t});if(n[0])throw n[0];return n[1]}validate(e,t={}){return iC(e,this,t)}}function iw(e,t,n){let r=iC(e,t,{message:n});if(r[0])throw r[0]}function iS(e,t,n){let r=iC(e,t,{coerce:!0,message:n});if(r[0])throw r[0];return r[1]}function i_(e,t){return!iC(e,t)[0]}function iC(e,t,n={}){let r=ib(e,t,n),i=function(e){let{done:t,value:n}=e.next();return t?void 0:n}(r);return i[0]?[new ig(i[0],function*(){for(let e of r)e[0]&&(yield e[0])}),void 0]:[void 0,i[1]]}function ix(e,t){return new iE({type:e,schema:null,validator:t})}function ik(e){let t;return new iE({type:"lazy",schema:null,*entries(n,r){t??(t=e()),yield*t.entries(n,r)},validator:(n,r)=>(t??(t=e()),t.validator(n,r)),coercer:(n,r)=>(t??(t=e()),t.coercer(n,r)),refiner:(n,r)=>(t??(t=e()),t.refiner(n,r))})}function iA(e){return new iE({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(let[n,r]of t.entries())yield[n,r,e]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||`Expected an array value, but received: ${iy(e)}`})}function iM(e){let t=iy(e),n=typeof e;return new iE({type:"literal",schema:"string"===n||"number"===n||"boolean"===n?e:null,validator:n=>n===e||`Expected the literal \`${t}\`, but received: ${iy(n)}`})}function iI(){return ix("number",e=>"number"==typeof e&&!isNaN(e)||`Expected a number, but received: ${iy(e)}`)}function iT(e){let t=e?Object.keys(e):[],n=ix("never",()=>!1);return new iE({type:"object",schema:e||null,*entries(r){if(e&&im(r)){let i=new Set(Object.keys(r));for(let n of t)i.delete(n),yield[n,r[n],e[n]];for(let e of i)yield[e,r[e],n]}},validator:e=>im(e)||`Expected an object, but received: ${iy(e)}`,coercer:e=>im(e)?{...e}:e})}function iR(e){return new iE({...e,validator:(t,n)=>void 0===t||e.validator(t,n),refiner:(t,n)=>void 0===t||e.refiner(t,n)})}function iP(e,t){return new iE({type:"record",schema:null,*entries(n){if(im(n))for(let r in n){let i=n[r];yield[r,r,e],yield[r,i,t]}},validator:e=>im(e)||`Expected an object, but received: ${iy(e)}`})}function iO(){return ix("string",e=>"string"==typeof e||`Expected a string, but received: ${iy(e)}`)}function iN(e){let t=e.map(e=>e.type).join(" | ");return new iE({type:"union",schema:null,coercer(t){for(let n of e){let[e,r]=n.validate(t,{coerce:!0});if(!e)return r}return t},validator(n,r){let i=[];for(let t of e){let[...e]=ib(n,t,r),[o]=e;if(!o[0])return[];for(let[t]of e)t&&i.push(t)}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${iy(n)}`,...i]}})}var iL=class extends Error{constructor(e){super(e.message),this.code="ERR_ASSERTION"}};function iD(){throw Error("setTimeout has not been defined")}function i$(){throw Error("clearTimeout has not been defined")}var iB=iD,iK=i$;function ij(e){if(iB===setTimeout)return setTimeout(e,0);if((iB===iD||!iB)&&setTimeout)return iB=setTimeout,setTimeout(e,0);try{return iB(e,0)}catch(t){try{return iB.call(null,e,0)}catch(t){return iB.call(this,e,0)}}}"function"==typeof m.setTimeout&&(iB=setTimeout),"function"==typeof m.clearTimeout&&(iK=clearTimeout);var iU,iH,iF,iz,iq,iW,iV,iG,iY,iZ,iJ,iQ,iX,i0,i1=[],i2=!1,i3=-1;function i5(){i2&&i0&&(i2=!1,i0.length?i1=i0.concat(i1):i3=-1,i1.length&&i8())}function i8(){if(!i2){var e=ij(i5);i2=!0;for(var t=i1.length;t;){for(i0=i1,i1=[];++i3<t;)i0&&i0[i3].run();i3=-1,t=i1.length}i0=null,i2=!1,function(e){if(iK===clearTimeout)return clearTimeout(e);if((iK===i$||!iK)&&clearTimeout)return iK=clearTimeout,clearTimeout(e);try{iK(e)}catch(t){try{return iK.call(null,e)}catch(t){return iK.call(this,e)}}}(e)}}function i6(e,t){this.fun=e,this.array=t}function i4(){}i6.prototype.run=function(){this.fun.apply(null,this.array)};var i9=m.performance||{},i7=i9.now||i9.mozNow||i9.msNow||i9.oNow||i9.webkitNow||function(){return(new Date).getTime()},oe=new Date,ot={nextTick:function(e){var t=Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];i1.push(new i6(e,t)),1!==i1.length||i2||ij(i8)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:i4,addListener:i4,once:i4,off:i4,removeListener:i4,removeAllListeners:i4,emit:i4,binding:function(e){throw Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(e){throw Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(e){var t=.001*i7.call(i9),n=Math.floor(t),r=Math.floor(t%1*1e9);return e&&(n-=e[0],(r-=e[1])<0&&(n--,r+=1e9)),[n,r]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-oe)/1e3}},on=e=>iT(e);function or({path:e,branch:t}){let n=e[e.length-1];return ip(t[t.length-2],n)}function oi(e){return new iE({...e,type:`optional ${e.type}`,validator:(t,n)=>!or(n)||e.validator(t,n),refiner:(t,n)=>!or(n)||e.refiner(t,n)})}var oo,oa,os=iN([iM(null),ix("boolean",e=>"boolean"==typeof e),ix("finite number",e=>i_(e,iI())&&Number.isFinite(e)),iO(),iA(ik(()=>os)),iP(iO(),ik(()=>os))]),ol=(oo=ix("any",()=>!0),oa=e=>((function(e,t,n="Assertion failed",r=iL){try{iw(e,t)}catch(e){var i,o;throw i=r,o=`${n}: ${("object"==typeof e&&null!==e&&"message"in e&&"string"==typeof e.message?e.message:null==e?"":String(e)).replace(/\.$/u,"")}.`,"string"==typeof i?.prototype?.constructor?.name?new i({message:o}):i({message:o})}})(e,os),JSON.parse(JSON.stringify(e,(e,t)=>{if("__proto__"!==e&&"constructor"!==e)return t}))),new iE({...os,coercer:(e,t)=>i_(e,oo)?os.coercer(oa(e,t),t):os.coercer(e,t)}));function oc(e){try{return iS(e,ol),!0}catch{return!1}}var od=iM("2.0"),ou=function(e){return new iE({...e,validator:(t,n)=>null===t||e.validator(t,n),refiner:(t,n)=>null===t||e.refiner(t,n)})}(iN([iI(),iO()])),oh=on({code:ix("integer",e=>"number"==typeof e&&!isNaN(e)&&Number.isInteger(e)||`Expected an integer, but received: ${iy(e)}`),message:iO(),data:oi(ol),stack:oi(iO())}),of=iN([iP(iO(),ol),iA(ol)]),op=on({id:ou,jsonrpc:od,method:iO(),params:oi(of)}),og=on({jsonrpc:od,method:iO(),params:oi(of)});iT({id:ou,jsonrpc:od,result:iR(ix("unknown",()=>!0)),error:iR(oh)}),iN([on({id:ou,jsonrpc:od,result:ol}),on({id:ou,jsonrpc:od,error:oh})]);var om=id.internal,oy={code:om,message:ov(om)};function ov(e,t="Unspecified error message. This is a bug, please report it."){if(Number.isInteger(e)){let t=e.toString();if(ip(iu,t))return iu[t].message;if(e>=-32099&&e<=-32e3)return"Unspecified server error."}return t}function ob(e,{fallbackError:t=oy,shouldIncludeStack:n=!0}={}
2){if(!i_(t,oh))throw Error("Must provide fallback error with integer number code and string message.");let r=function(e,t){if(e&&"object"==typeof e&&"serialize"in e&&"function"==typeof e.serialize)return e.serialize();if(i_(e,oh))return e;let n=oE(e);return{...t,data:{cause:n}}}(e,t);return n||delete r.stack,r}function oE(e){return Array.isArray(e)?e.map(e=>oc(e)?e:ih(e)?ow(e):null):ih(e)?ow(e):oc(e)?e:null}function ow(e){return Object.getOwnPropertyNames(e).reduce((t,n)=>{let r=e[n];return oc(r)&&(t[n]=r),t},{})}oA.default=oA,oA.stable=oT,oA.stableStringify=oT;var oS="[...]",o_="[Circular]",oC=[],ox=[];function ok(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function oA(e,t,n,r){var i;void 0===r&&(r=ok()),function e(t,n,r,i,o,a,s){var l;if(a+=1,"object"==typeof t&&null!==t){for(l=0;l<i.length;l++)if(i[l]===t)return void oM(o_,t,n,o);if(void 0!==s.depthLimit&&a>s.depthLimit||void 0!==s.edgesLimit&&r+1>s.edgesLimit)return void oM(oS,t,n,o);if(i.push(t),Array.isArray(t))for(l=0;l<t.length;l++)e(t[l],l,l,i,t,a,s);else{var c=Object.keys(t);for(l=0;l<c.length;l++){var d=c[l];e(t[d],d,l,i,t,a,s)}}i.pop()}}(e,"",0,[],void 0,0,r);try{i=0===ox.length?JSON.stringify(e,t,n):JSON.stringify(e,oR(t),n)}catch(e){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==oC.length;){var o=oC.pop();4===o.length?Object.defineProperty(o[0],o[1],o[3]):o[0][o[1]]=o[2]}}return i}function oM(e,t,n,r){var i=Object.getOwnPropertyDescriptor(r,n);void 0!==i.get?i.configurable?(Object.defineProperty(r,n,{value:e}),oC.push([r,n,t,i])):ox.push([t,n,e]):(r[n]=e,oC.push([r,n,t]))}function oI(e,t){return e<t?-1:+(e>t)}function oT(e,t,n,r){void 0===r&&(r=ok());var i,o=function e(t,n,r,i,o,a,s){var l;if(a+=1,"object"==typeof t&&null!==t){for(l=0;l<i.length;l++)if(i[l]===t)return void oM(o_,t,n,o);try{if("function"==typeof t.toJSON)return}catch(e){return}if(void 0!==s.depthLimit&&a>s.depthLimit||void 0!==s.edgesLimit&&r+1>s.edgesLimit)return void oM(oS,t,n,o);if(i.push(t),Array.isArray(t))for(l=0;l<t.length;l++)e(t[l],l,l,i,t,a,s);else{var c={},d=Object.keys(t).sort(oI);for(l=0;l<d.length;l++){var u=d[l];e(t[u],u,l,i,t,a,s),c[u]=t[u]}if(void 0===o)return c;oC.push([o,n,t]),o[n]=c}i.pop()}}(e,"",0,[],void 0,0,r)||e;try{i=0===ox.length?JSON.stringify(o,t,n):JSON.stringify(o,oR(t),n)}catch(e){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==oC.length;){var a=oC.pop();4===a.length?Object.defineProperty(a[0],a[1],a[3]):a[0][a[1]]=a[2]}}return i}function oR(e){return e=void 0!==e?e:function(e,t){return t},function(t,n){if(ox.length>0)for(var r=0;r<ox.length;r++){var i=ox[r];if(i[1]===t&&i[0]===n){n=i[2],ox.splice(r,1);break}}return e.call(this,t,n)}}var oP=ea(oA),oO=class extends Error{constructor(e,t,n){if(!Number.isInteger(e))throw Error('"code" must be an integer.');if(!t||"string"!=typeof t)throw Error('"message" must be a non-empty string.');super(t),this.code=e,void 0!==n&&(this.data=n)}serialize(){let e={code:this.code,message:this.message};return void 0!==this.data&&(e.data=this.data,function(e){if("object"!=typeof e||null===e)return!1;try{let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}catch(e){return!1}}(this.data)&&(e.data.cause=oE(this.data.cause))),this.stack&&(e.stack=this.stack),e}toString(){return oP(this.serialize(),oN,2)}};function oN(e,t){if("[Circular]"!==t)return t}var oL=e=>(function(e,t){let[n,r]=function(e){if(e){if("string"==typeof e)return[e];if("object"==typeof e&&!Array.isArray(e)){let{message:t,data:n}=e;if(t&&"string"!=typeof t)throw Error("Must specify string message.");return[t??void 0,n]}}return[]}(t);return new oO(e,n??ov(e),r)})(id.invalidRequest,e),oD={};function o$(){}function oB(){oB.init.call(this)}function oK(e){return void 0===e._maxListeners?oB.defaultMaxListeners:e._maxListeners}function oj(e,t,n,r){var i,o,a;if("function"!=typeof n)throw TypeError('"listener" argument must be a function');if((o=e._events)?(o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),a=o[t]):(o=e._events=new o$,e._eventsCount=0),a){if("function"==typeof a?a=o[t]=r?[n,a]:[a,n]:r?a.unshift(n):a.push(n),!a.warned&&(i=oK(e))&&i>0&&a.length>i){a.warned=!0;var s=Error("Possible EventEmitter memory leak detected. "+a.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");s.name="MaxListenersExceededWarning",s.emitter=e,s.type=t,s.count=a.length,"function"==typeof console.warn?console.warn(s):console.log(s)}}else a=o[t]=n,++e._eventsCount;return e}function oU(e,t,n){var r=!1;function i(){e.removeListener(t,i),r||(r=!0,n.apply(e,arguments))}return i.listener=n,i}function oH(e){var t=this._events;if(t){var n=t[e];if("function"==typeof n)return 1;if(n)return n.length}return 0}function oF(e,t){for(var n=Array(t);t--;)n[t]=e[t];return n}o$.prototype=Object.create(null),oB.EventEmitter=oB,oB.usingDomains=!1,oB.prototype.domain=void 0,oB.prototype._events=void 0,oB.prototype._maxListeners=void 0,oB.defaultMaxListeners=10,oB.init=function(){this.domain=null,oB.usingDomains&&(void 0).active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new o$,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},oB.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},oB.prototype.getMaxListeners=function(){return oK(this)},oB.prototype.emit=function(e){var t,n,r,i,o,a,s,l="error"===e;if(a=this._events)l=l&&null==a.error;else if(!l)return!1;if(s=this.domain,l){if(t=arguments[1],!s){if(t instanceof Error)throw t;var c=Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}return t||(t=Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=s,t.domainThrown=!1,s.emit("error",t),!1}if(!(n=a[e]))return!1;var d="function"==typeof n;switch(r=arguments.length){case 1:!function(e,t,n){if(t)e.call(n);else for(var r=e.length,i=oF(e,r),o=0;o<r;++o)i[o].call(n)}(n,d,this);break;case 2:!function(e,t,n,r){if(t)e.call(n,r);else for(var i=e.length,o=oF(e,i),a=0;a<i;++a)o[a].call(n,r)}(n,d,this,arguments[1]);break;case 3:!function(e,t,n,r,i){if(t)e.call(n,r,i);else for(var o=e.length,a=oF(e,o),s=0;s<o;++s)a[s].call(n,r,i)}(n,d,this,arguments[1],arguments[2]);break;case 4:!function(e,t,n,r,i,o){if(t)e.call(n,r,i,o);else for(var a=e.length,s=oF(e,a),l=0;l<a;++l)s[l].call(n,r,i,o)}(n,d,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=Array(r-1),o=1;o<r;o++)i[o-1]=arguments[o];!function(e,t,n,r){if(t)e.apply(n,r);else for(var i=e.length,o=oF(e,i),a=0;a<i;++a)o[a].apply(n,r)}(n,d,this,i)}return!0},oB.prototype.addListener=function(e,t){return oj(this,e,t,!1)},oB.prototype.on=oB.prototype.addListener,oB.prototype.prependListener=function(e,t){return oj(this,e,t,!0)},oB.prototype.once=function(e,t){if("function"!=typeof t)throw TypeError('"listener" argument must be a function');return this.on(e,oU(this,e,t)),this},oB.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw TypeError('"listener" argument must be a function');return this.prependListener(e,oU(this,e,t)),this},oB.prototype.removeListener=function(e,t){var n,r,i,o,a;if("function"!=typeof t)throw TypeError('"listener" argument must be a function');if(!(r=this._events)||!(n=r[e]))return this;if(n===t||n.listener&&n.listener===t)0==--this._eventsCount?this._events=new o$:(delete r[e],r.removeListener&&this.emit
2("removeListener",e,n.listener||t));else if("function"!=typeof n){for(i=-1,o=n.length;o-- >0;)if(n[o]===t||n[o].listener&&n[o].listener===t){a=n[o].listener,i=o;break}if(i<0)return this;if(1===n.length){if(n[0]=void 0,0==--this._eventsCount)return this._events=new o$,this;delete r[e]}else{for(var s=n,l=i,c=l,d=c+1,u=s.length;d<u;c+=1,d+=1)s[c]=s[d];s.pop()}r.removeListener&&this.emit("removeListener",e,a||t)}return this},oB.prototype.off=function(e,t){return this.removeListener(e,t)},oB.prototype.removeAllListeners=function(e){var t,n;if(!(n=this._events))return this;if(!n.removeListener)return 0==arguments.length?(this._events=new o$,this._eventsCount=0):n[e]&&(0==--this._eventsCount?this._events=new o$:delete n[e]),this;if(0==arguments.length){for(var r,i=Object.keys(n),o=0;o<i.length;++o)"removeListener"!==(r=i[o])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=new o$,this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(t)do this.removeListener(e,t[t.length-1]);while(t[0]);return this},oB.prototype.listeners=function(e){var t,n=this._events;return n&&(t=n[e])?"function"==typeof t?[t.listener||t]:function(e){for(var t=Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(t):[]},oB.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):oH.call(e,t)},oB.prototype.listenerCount=oH,oB.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};var oz=es(Object.freeze({__proto__:null,EventEmitter:oB,default:oB}));Object.defineProperty(oD,"__esModule",{value:!0});let oq=oz;function oW(e,t,n){try{Reflect.apply(e,t,n)}catch(e){setTimeout(()=>{throw e})}}var oV,oG,oY,oZ,oJ,oQ,oX,o0,o1,o2,o3,o5,o8,o6,o4,o9,o7,ae,at,an=oD.default=class extends oq.EventEmitter{emit(e,...t){let n="error"===e,r=this._events;if(void 0!==r)n=n&&void 0===r.error;else if(!n)return!1;if(n){let e;if(t.length>0&&([e]=t),e instanceof Error)throw e;let n=Error("Unhandled error."+(e?` (${e.message})`:""));throw n.context=e,n}let i=r[e];if(void 0===i)return!1;if("function"==typeof i)oW(i,this,t);else{let e=i.length,n=function(e){let t=e.length,n=Array(t);for(let r=0;r<t;r+=1)n[r]=e[r];return n}(i);for(let r=0;r<e;r+=1)oW(n[r],this,t)}return!0}},ar=class e extends an{constructor({notificationHandler:e}={}){super(),is(this,oZ),is(this,oQ),is(this,o0),is(this,oV,!1),is(this,oG,void 0),is(this,oY,void 0),il(this,oG,[]),il(this,oY,e)}destroy(){ia(this,oG).forEach(e=>{"destroy"in e&&"function"==typeof e.destroy&&e.destroy()}),il(this,oG,[]),il(this,oV,!0)}push(e){ic(this,oZ,oJ).call(this),ia(this,oG).push(e)}handle(e,t){if(ic(this,oZ,oJ).call(this),t&&"function"!=typeof t)throw Error('"callback" must be a function if provided.');return Array.isArray(e)?t?ic(this,oQ,oX).call(this,e,t):ic(this,oQ,oX).call(this,e):t?ic(this,o0,o1).call(this,e,t):this._promiseHandle(e)}asMiddleware(){return ic(this,oZ,oJ).call(this),async(t,n,r,i)=>{try{let[o,a,s]=await ic(e,o5,o8).call(e,t,n,ia(this,oG));return a?(await ic(e,o9,o7).call(e,s),i(o)):r(async t=>{try{await ic(e,o9,o7).call(e,s)}catch(e){return t(e)}return t()})}catch(e){return i(e)}}}async _promiseHandle(e){return new Promise((t,n)=>{ic(this,o0,o1).call(this,e,(e,r)=>{e&&void 0===r?n(e):t(r)}).catch(n)})}};function ai(e){return JSON.stringify(e,null,2)}oV=new WeakMap,oG=new WeakMap,oY=new WeakMap,oZ=new WeakSet,oJ=function(){if(ia(this,oV))throw Error("This engine is destroyed and can no longer be used.")},oQ=new WeakSet,oX=async function(e,t){try{if(0===e.length){let e=[{id:null,jsonrpc:"2.0",error:new oO(id.invalidRequest,"Request batch must contain plain objects. Received an empty array")}];return t?t(null,e):e}let n=(await Promise.all(e.map(this._promiseHandle.bind(this)))).filter(e=>void 0!==e);return t?t(null,n):n}catch(e){if(t)return t(e);throw e}},o0=new WeakSet,o1=async function(e,t){if(!e||Array.isArray(e)||"object"!=typeof e){let n=new oO(id.invalidRequest,"Requests must be plain objects. Received: "+typeof e,{request:e});return t(n,{id:null,jsonrpc:"2.0",error:n})}if("string"!=typeof e.method){let n=new oO(id.invalidRequest,"Must specify a string method. Received: "+typeof e.method,{request:e});
2return ia(this,oY)&&!i_(e,op)?t(null):t(n,{id:e.id??null,jsonrpc:"2.0",error:n})}if(ia(this,oY)&&i_(e,og)&&!i_(e,op)){try{await ia(this,oY).call(this,e)}catch(e){return t(e)}return t(null)}let n=null,r={...e},i={id:r.id,jsonrpc:r.jsonrpc};try{await ic(ar,o2,o3).call(ar,r,i,ia(this,oG))}catch(e){n=e}return n&&(delete i.result,i.error||(i.error=ob(n))),t(n,i)},o2=new WeakSet,o3=async function(e,t,n){let[r,i,o]=await ic(ar,o5,o8).call(ar,e,t,n);if(ic(ar,ae,at).call(ar,e,t,i),await ic(ar,o9,o7).call(ar,o),r)throw r},o5=new WeakSet,o8=async function(e,t,n){let r=[],i=null,o=!1;for(let a of n)if([i,o]=await ic(ar,o6,o4).call(ar,e,t,a,r),o)break;return[i,o,r.reverse()]},o6=new WeakSet,o4=async function(e,t,n,r){return new Promise(i=>{let o=e=>{let n=e||t.error;n&&(t.error=ob(n)),i([n,!0])};try{n(e,t,n=>{t.error?o(t.error):(n&&("function"!=typeof n&&o(new oO(id.internal,`JsonRpcEngine: "next" return handlers must be functions. Received "${typeof n}" for request:
3${ai(e)}`,{request:e})),r.push(n)),i([null,!1]))},o)}catch(e){o(e)}})},o9=new WeakSet,o7=async function(e){for(let t of e)await new Promise((e,n)=>{t(t=>t?n(t):e())})},ae=new WeakSet,at=function(e,t,n){if(!ip(t,"result")&&!ip(t,"error"))throw new oO(id.internal,`JsonRpcEngine: Response has no error or result for request:
4${ai(e)}`,{request:e});if(!n)throw new oO(id.internal,`JsonRpcEngine: Nothing ended request:
5${ai(e)}`,{request:e})},is(ar,o2),is(ar,o5),is(ar,o6),is(ar,o9),is(ar,ae);var ao=Object.freeze(["eth_subscription"]),aa=(e=console)=>{var t;return[(e,t,n,r)=>{let i=e.id,o=ii=(ii+1)%0xffffffff;e.id=o,t.id=o,n(n=>{e.id=i,t.id=i,n()})},(t=e,(e,n,r)=>{"string"==typeof e.method&&e.method||(n.error=oL({message:"The request 'method' must be a non-empty string.",data:e})),r(e=>{let{error:r}=n;return r&&t.error(`MetaMask - RPC Error: ${r.message}`,r),e()})}),function(e){let t={ethDecryptDeprecation:!1,ethGetEncryptionPublicKeyDeprecation:!1,walletWatchAssetNFTExperimental:!1};return(n,r,i)=>{t.ethDecryptDeprecation||"eth_decrypt"!==n.method?t.ethGetEncryptionPublicKeyDeprecation||"eth_getEncryptionPublicKey"!==n.method?!t.walletWatchAssetNFTExperimental&&"wallet_watchAsset"===n.method&&["ERC721","ERC1155"].includes(n.params?.type||"")&&(e.warn(ir.warnings.rpc.walletWatchAssetNFTExperimental),t.walletWatchAssetNFTExperimental=!0):(e.warn(ir.warnings.rpc.ethGetEncryptionPublicKeyDeprecation),t.ethGetEncryptionPublicKeyDeprecation=!0):(e.warn(ir.warnings.rpc.ethDecryptDeprecation),t.ethDecryptDeprecation=!0),i()}}(e)]},as=(e,t,n=!0)=>(r,i)=>{r||i.error?t(r||i.error):!n||Array.isArray(i)?e(i):e(i.result)},al=e=>!!e&&"string"==typeof e&&e.startsWith("0x"),ac=()=>{};async function ad(e,t){try{let t=await async function(){return{name:function(e){let{document:t}=e,n=t.querySelector('head > meta[property="og:site_name"]');if(n)return n.content;let r=t.querySelector('head > meta[name="title"]');return r?r.content:t.title&&t.title.length>0?t.title:window.location.hostname}(window),icon:await au(window)}}();e.handle({jsonrpc:"2.0",id:1,method:"metamask_sendDomainMetadata",params:t},ac)}catch(e){t.error({message:ir.errors.sendSiteMetadata(),originalError:e})}}async function au(e){let{document:t}=e;for(let e of Array.from(t.querySelectorAll('head > link[rel~="icon"]')))if(e&&await ah(e.href))return e.href;return null}async function ah(e){return new Promise((t,n)=>{try{let n=document.createElement("img");n.onload=()=>t(!0),n.onerror=()=>t(!1),n.src=e}catch(e){n(e)}})}var af=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},ap=(e,t,n)=>(af(e,t,"read from private field"),n?n.call(e):t.get(e)),ag=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},am=(e,t,n,r)=>(af(e,t,"write to private field"),t.set(e,n),n);function ay(e,t,n){try{Reflect.apply(e,t,n)}catch(e){setTimeout(()=>{throw e})}}class av extends oB{emit(e,...t){let n="error"===e,r=this._events;if(void 0!==r)n=n&&void 0===r.error;else if(!n)return!1;if(n){let e;if(t.length>0&&([e]=t),e instanceof Error)throw e;let n=Error("Unhandled error."+(e?` (${e.message})`:""));throw n.context=e,n}let i=r[e];if(void 0===i)return!1;if("function"==typeof i)ay(i,this,t);else{let e=i.length,n=function(e){let t=e.length,n=Array(t);for(let r=0;r<t;r+=1)n[r]=e[r];return n}(i);for(let r=0;r<e;r+=1)ay(n[r],this,t)}return!0}}var ab,aE,aw=ea(function e(t,n){if(t===n)return!0;
5if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;if(Array.isArray(t)){if((r=t.length)!=n.length)return!1;for(i=r;0!=i--;)if(!e(t[i],n[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((r=(o=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(i=r;0!=i--;)if(!Object.prototype.hasOwnProperty.call(n,o[i]))return!1;for(i=r;0!=i--;){var r,i,o,a=o[i];if(!e(t[a],n[a]))return!1}return!0}return t!=t&&n!=n}),aS=class e extends av{constructor({logger:t=console,maxEventListeners:n=100,rpcMiddleware:r=[]}={}){super(),ag(this,ab,void 0),ag(this,aE,void 0),this._log=t,this.setMaxListeners(n),this._state={...e._defaultState},am(this,aE,null),am(this,ab,null),this._handleAccountsChanged=this._handleAccountsChanged.bind(this),this._handleConnect=this._handleConnect.bind(this),this._handleChainChanged=this._handleChainChanged.bind(this),this._handleDisconnect=this._handleDisconnect.bind(this),this._handleUnlockStateChanged=this._handleUnlockStateChanged.bind(this),this._rpcRequest=this._rpcRequest.bind(this),this.request=this.request.bind(this);let i=new ar;r.forEach(e=>i.push(e)),this._rpcEngine=i}get chainId(){return ap(this,ab)}get selectedAddress(){return ap(this,aE)}isConnected(){return this._state.isConnected}async request(e){if(!e||"object"!=typeof e||Array.isArray(e))throw oL({message:ir.errors.invalidRequestArgs(),data:e});let{method:t,params:n}=e;if("string"!=typeof t||0===t.length)throw oL({message:ir.errors.invalidRequestMethod(),data:e});if(void 0!==n&&!Array.isArray(n)&&("object"!=typeof n||null===n))throw oL({message:ir.errors.invalidRequestParams(),data:e});let r=null==n?{method:t}:{method:t,params:n};return new Promise((e,t)=>{this._rpcRequest(r,as(e,t))})}_initializeState(e){if(this._state.initialized)throw Error("Provider already initialized.");if(e){let{accounts:t,chainId:n,isUnlocked:r,networkVersion:i}=e;this._handleConnect(n),this._handleChainChanged({chainId:n,networkVersion:i}),this._handleUnlockStateChanged({accounts:t,isUnlocked:r}),this._handleAccountsChanged(t)}this._state.initialized=!0,this.emit("_initialized")}_rpcRequest(e,t){let n=t;return Array.isArray(e)||(e.jsonrpc||(e.jsonrpc="2.0"),"eth_accounts"!==e.method&&"eth_requestAccounts"!==e.method||(n=(n,r)=>{this._handleAccountsChanged(r.result??[],"eth_accounts"===e.method),t(n,r)})),this._rpcEngine.handle(e,n)}_handleConnect(e){this._state.isConnected||(this._state.isConnected=!0,this.emit("connect",{chainId:e}),this._log.debug(ir.info.connected(e)))}_handleDisconnect(e,t){if(this._state.isConnected||!this._state.isPermanentlyDisconnected&&!e){let n;this._state.isConnected=!1,e?(n=new oO(1013,t??ir.errors.disconnected()),this._log.debug(n)):(n=new oO(1011,t??ir.errors.permanentlyDisconnected()),this._log.error(n),am(this,ab,null),this._state.accounts=null,am(this,aE,null),this._state.isUnlocked=!1,this._state.isPermanentlyDisconnected=!0),this.emit("disconnect",n)}}_handleChainChanged({chainId:e}={}){al(e)?(this._handleConnect(e),e!==ap(this,ab)&&(am(this,ab,e),this._state.initialized&&this.emit("chainChanged",ap(this,ab)))):this._log.error(ir.errors.invalidNetworkParams(),{chainId:e})}_handleAccountsChanged(e,t=!1){let n=e;for(let t of(Array.isArray(e)||(this._log.error("MetaMask: Received invalid accounts parameter. Please report this bug.",e),n=[]),e))if("string"!=typeof t){this._log.error("MetaMask: Received non-string account. Please report this bug.",e),n=[];break}if(!aw(this._state.accounts,n)&&(t&&null!==this._state.accounts&&this._log.error("MetaMask: 'eth_accounts' unexpectedly updated accounts. Please report this bug.",n),this._state.accounts=n,ap(this,aE)!==n[0]&&am(this,aE,n[0]||null),this._state.initialized)){let e=[...n];this.emit("accountsChanged",e)}}_handleUnlockStateChanged({accounts:e,isUnlocked:t}={}){"boolean"==typeof t?t!==this._state.isUnlocked&&(this._state.isUnlocked=t,this._handleAccountsChanged(e??[])):this._log.error("MetaMask: Received invali
5d isUnlocked parameter. Please report this bug.")}};ab=new WeakMap,aE=new WeakMap,aS._defaultState={accounts:null,isConnected:!1,isUnlocked:!1,initialized:!1,isPermanentlyDisconnected:!1};var a_,aC,ax=aS,ak={exports:{}};function aA(){return aC?a_:(aC=1,a_=oz.EventEmitter)}var aM,aI=es(ei);aM="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e};var aT=Object.getOwnPropertyDescriptors||function(e){for(var t=Object.keys(e),n={},r=0;r<t.length;r++)n[t[r]]=Object.getOwnPropertyDescriptor(e,t[r]);return n},aR=/%[sdj%]/g;function aP(e){if(!aG(e)){for(var t=[],n=0;n<arguments.length;n++)t.push(a$(arguments[n]));return t.join(" ")}n=1;for(var r=arguments,i=r.length,o=String(e).replace(aR,function(e){if("%%"===e)return"%";if(n>=i)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}}),a=r[n];n<i;a=r[++n])aq(a)||!aQ(a)?o+=" "+a:o+=" "+a$(a);return o}function aO(e,t){if(aZ(m.process))return function(){return aO(e,t).apply(this,arguments)};if(!0===ot.noDeprecation)return e;var n=!1;return function(){if(!n){if(ot.throwDeprecation)throw Error(t);ot.traceDeprecation?console.trace(t):console.error(t),n=!0}return e.apply(this,arguments)}}var aN,aL={};function aD(e){return aZ(aN)&&(aN=ot.env.NODE_DEBUG||""),aL[e=e.toUpperCase()]||(RegExp("\\b"+e+"\\b","i").test(aN)?aL[e]=function(){var t=aP.apply(null,arguments);console.error("%s %d: %s",e,0,t)}:aL[e]=function(){}),aL[e]}function a$(e,t){var n={seen:[],stylize:aK};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),az(t)?n.showHidden=t:t&&a9(n,t),aZ(n.showHidden)&&(n.showHidden=!1),aZ(n.depth)&&(n.depth=2),aZ(n.colors)&&(n.colors=!1),aZ(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=aB),aj(n,e,n.depth)}function aB(e,t){var n=a$.styles[t];return n?"\x1b["+a$.colors[n][0]+"m"+e+"\x1b["+a$.colors[n][1]+"m":e}function aK(e,t){return e}function aj(e,t,n){if(e.customInspect&&t&&a1(t.inspect)&&t.inspect!==a$&&(!t.constructor||t.constructor.prototype!==t)){var r,i,o=t.inspect(n,e);return aG(o)||(o=aj(e,o,n)),o}var a=function(e,t){if(aZ(t))return e.stylize("undefined","undefined");if(aG(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return aV(t)?e.stylize(""+t,"number"):az(t)?e.stylize(""+t,"boolean"):aq(t)?e.stylize("null","null"):void 0}(e,t);if(a)return a;var s=Object.keys(t),l=(d={},s.forEach(function(e,t){d[e]=!0}),d);if(e.showHidden&&(s=Object.getOwnPropertyNames(t)),a0(t)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return aU(t);if(0===s.length){if(a1(t)){var c=t.name?": "+t.name:"";return e.stylize("[Function"+c+"]","special")}if(aJ(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(aX(t))return e.stylize(Date.prototype.toString.call(t),"date");if(a0(t))return aU(t)}var d,u,h="",f=!1,p=["{","}"];return aF(t)&&(f=!0,p=["[","]"]),a1(t)&&(h=" [Function"+(t.name?": "+t.name:"")+"]"),aJ(t)&&(h=" "+RegExp.prototype.toString.call(t)),aX(t)&&(h=" "+Date.prototype.toUTCString.call(t)),a0(t)&&(h=" "+aU(t)),0!==s.length||f&&0!=t.length?n<0?aJ(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),u=f?function(e,t,n,r,i){for(var o=[],a=0,s=t.length;a<s;++a)a7(t,String(a))?o.push(aH(e,t,n,r,String(a),!0)):o.push("");return i.forEach(function(i){i.match(/^\d+$/)||o.push(aH(e,t,n,r,i,!0))}),o}(e,t,n,l,s):s.map(function(r){return aH(e,t,n,l,r,f)}),e.seen.pop(),r=h,i=p,u.reduce(function(e,t){return t.indexOf("\n"),e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60?i[0]+(""===r?"":r+"\n ")+" "+u.join(",\n  ")+" "+i[1]:i[0]+r+" "+u.join(", ")+" "+i[1]):p[0]+h+p[1]}function aU(e){return"["+Error.prototype.toString.call(e)+"]"}function aH(e,t,n,r,i,o){var a,s,l;if((l=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?s=l.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):l.set&&(s=e.stylize("[
5Setter]","special")),a7(r,i)||(a="["+i+"]"),s||(0>e.seen.indexOf(l.value)?(s=aq(n)?aj(e,l.value,null):aj(e,l.value,n-1)).indexOf("\n")>-1&&(s=o?s.split("\n").map(function(e){return"  "+e}).join("\n").substr(2):"\n"+s.split("\n").map(function(e){return"   "+e}).join("\n")):s=e.stylize("[Circular]","special")),aZ(a)){if(o&&i.match(/^\d+$/))return s;(a=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function aF(e){return Array.isArray(e)}function az(e){return"boolean"==typeof e}function aq(e){return null===e}function aW(e){return null==e}function aV(e){return"number"==typeof e}function aG(e){return"string"==typeof e}function aY(e){return"symbol"==typeof e}function aZ(e){return void 0===e}function aJ(e){return aQ(e)&&"[object RegExp]"===a5(e)}function aQ(e){return"object"==typeof e&&null!==e}function aX(e){return aQ(e)&&"[object Date]"===a5(e)}function a0(e){return aQ(e)&&("[object Error]"===a5(e)||e instanceof Error)}function a1(e){return"function"==typeof e}function a2(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e}function a3(e){return T.isBuffer(e)}function a5(e){return Object.prototype.toString.call(e)}function a8(e){return e<10?"0"+e.toString(10):e.toString(10)}a$.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},a$.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};var a6=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function a4(){var e,t;console.log("%s - %s",(t=[a8((e=new Date).getHours()),a8(e.getMinutes()),a8(e.getSeconds())].join(":"),[e.getDate(),a6[e.getMonth()],t].join(" ")),aP.apply(null,arguments))}function a9(e,t){if(!t||!aQ(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}function a7(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var se="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function st(e){if("function"!=typeof e)throw TypeError('The "original" argument must be of type Function');if(se&&e[se]){var t;if("function"!=typeof(t=e[se]))throw TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,se,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(){for(var t,n,r=new Promise(function(e,r){t=e,n=r}),i=[],o=0;o<arguments.length;o++)i.push(arguments[o]);i.push(function(e,r){e?n(e):t(r)});try{e.apply(this,i)}catch(e){n(e)}return r}return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),se&&Object.defineProperty(t,se,{value:t,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(t,aT(e))}function sn(e,t){if(!e){var n=Error("Promise was rejected with a falsy value");n.reason=e,e=n}return t(e)}function sr(e){if("function"!=typeof e)throw TypeError('The "original" argument must be of type Function');function t(){for(var t=[],n=0;n<arguments.length;n++)t.push(arguments[n]);var r=t.pop();if("function"!=typeof r)throw TypeError("The last argument must be of type Function");var i=this,o=function(){return r.apply(i,arguments)};e.apply(this,t).then(function(e){ot.nextTick(o.bind(null,null,e))},function(e){ot.nextTick(sn.bind(null,e,o))})}return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),Object.defineProperties(t,aT(e)),t}st.custom=se;var si,so,sa,ss,sl=es(Object.freeze({__proto__:null,_extend:a9,callbackify:sr,debuglog:aD,default:{inherits:aM,_extend:a9,log:a4,isBuffer:a3,isPrimitive:a2,isFunction:a1,isError:a0,isDate:aX,isObject:aQ,isRegExp:aJ,isUndefined:aZ,isSymbol:aY,isString:aG,isNumber:aV,isNullOrUndefined:aW,isNull:aq,isBoolean:az,isArray:aF,inspect:a$,deprecate:aO,format:aP,debuglog:aD,promisify:st,callbackify:sr},deprecate:aO,format:aP,inherits:aM,inspect:a$,isArray:aF,isBoolean:az,isBuffer:a3,isDate:aX,isError:a0,isFunction:a1,isNull:aq,isNullOrUndefined:aW,isNumber:aV,isObject:aQ,isPrimitive:a2,isRegExp:aJ,isString:aG,isSymbol:aY,isUndefined:aZ,log:a4,promisify:st}));function sc(){if(ss)return sa;function e(e,r){n(e,r),t(e)}function t(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function n(e,t){e.emit("error",t)}return ss=1,sa={destroy:function(r,i){var o=this,a=this._readableState&&this._readableState.destroyed,s=this._writableState&&this._writableState.destroyed;return a||s?i?i(r):r&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,ot.nextTick(n,this,r)):ot.nextTick(n,this,r)):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(r||null,function(n){!i&&n?o._writableState?o._writableState.errorEmitted?ot.nextTick(t,o):(o._writableState.errorEmitted=!0,ot.nextTick(e,o,n)):ot.nextTick(e,o,n):i?(ot.nextTick(t,o),i(n)):ot.nextTick(t,o)})),this},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var n=e._readableState,r=e._writableState;n&&n.autoDestroy||r&&r.autoDestroy?e.destroy(t):e.emit("error",t)}}}var sd,su,sh={},sf={};
5function sp(e,t,n){n||(n=Error);var r=function(e){function n(n,r,i){return e.call(this,"string"==typeof t?t:t(n,r,i))||this}return n.prototype=Object.create(e.prototype),n.prototype.constructor=n,n.__proto__=e,n}(n);r.prototype.name=n.name,r.prototype.code=e,sf[e]=r}function sg(e,t){if(Array.isArray(e)){var n=e.length;return e=e.map(function(e){return String(e)}),n>2?"one of ".concat(t," ").concat(e.slice(0,n-1).join(", "),", or ")+e[n-1]:2===n?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}function sm(){if(su)return sd;su=1;var e=sh.codes.ERR_INVALID_OPT_VALUE;return sd={getHighWaterMark:function(t,n,r,i){var o=null!=n.highWaterMark?n.highWaterMark:i?n[r]:null;if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new e(i?r:"highWaterMark",o);return Math.floor(o)}return t.objectMode?16:16384}}}sp("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError),sp("ERR_INVALID_ARG_TYPE",function(e,t,n){if("string"==typeof t&&(i="not ",t.substr(0,i.length)===i)?(r="must not be",t=t.replace(/^not /,"")):r="must be",a=" argument",(void 0===s||s>e.length)&&(s=e.length),e.substring(s-a.length,s)===a)o="The ".concat(e," ").concat(r," ").concat(sg(t,"type"));else{var r,i,o,a,s,l,c=("number"!=typeof l&&(l=0),l+1>e.length||-1===e.indexOf(".",l))?"argument":"property";o='The "'.concat(e,'" ').concat(c," ").concat(r," ").concat(sg(t,"type"))}return o+". Received type ".concat(typeof n)},TypeError),sp("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),sp("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),sp("ERR_STREAM_PREMATURE_CLOSE","Premature close"),sp("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),sp("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),sp("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),sp("ERR_STREAM_WRITE_AFTER_END","write after end"),sp("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),sp("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),sp("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),sh.codes=sf;var sy,sv,sb,sE,sw,sS,s_=es(Object.freeze({__proto__:null,default:"function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}));function sC(){if(sE)return sb;function e(e){var t=this;this.next=null,this.entry=null,this.finish=function(){var n=t.entry;for(t.entry=null;n;){var r=n.callback;e.pendingcb--,r(void 0),n=n.next}e.corkedRequestsFree.next=t}}sE=1,sb=w,w.WritableState=E;var t,n,r={deprecate:function(){if(sv)return sy;function e(e){try{if(!eo.localStorage)return!1}catch(e){return!1}var t=eo.localStorage[e];return null!=t&&"true"===String(t).toLowerCase()}return sv=1,sy=function(t,n){if(e("noDeprecation"))return t;var r=!1;return function(){if(!r){if(e("throwDeprecation"))throw Error(n);e("traceDeprecation")?console.trace(n):console.warn(n),r=!0}return t.apply(this,arguments)}}}()},i=aA(),o=aI.Buffer,a=(void 0!==eo?eo:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},s=sc(),l=sm().getHighWaterMark,c=sh.codes,d=c.ERR_INVALID_ARG_TYPE,u=c.ERR_METHOD_NOT_IMPLEMENTED,h=c.ERR_MULTIPLE_CALLBACK,f=c.ERR_STREAM_CANNOT_PIPE,p=c.ERR_STREAM_DESTROYED,g=c.ERR_STREAM_NULL_VALUES,m=c.ERR_STREAM_WRITE_AFTER_END,y=c.ERR_UNKNOWN_ENCODING,v=s.errorOrDestroy;function b(){}function E(n,r,i){t=t||sx(),n=n||{},"boolean"!=typeof i&&(i=r instanceof t),this.objectMode=!!n.objectMode,i&&(this.objectMode=this.objectMode||!!n.writableObjectMode),this.highWaterMark=l(this,n,"writableHighWaterMark",i),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var o=!1===n.decodeStrings;this.decodeStrings=!o,this.defaultEncoding=n.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,r=n.sync,i=n.writecb;if("function"!=typeof i)throw new h;if(n.writing=!1,n.writecb=null,n.length-=n.writelen,n.writelen=0,t)--n.pendingcb,r?(ot.nextTick(i,t),ot.nextTick(A,e,n),e._writableState.errorEmitted=!0,v(e,t)):(i(t),e._writableState.errorEmitted=!0,v(e,t),A(e,n));else{var o=x(n)||e.destroyed;o||n.corked||n.bufferProcessing||!n.bufferedRequest||C(e,n),r?ot.nextTick(_,e,n,o,i):_(e,n,o,i)}}(r,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==n.emitClose,this.autoDestroy=!!n.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}function w(e){var r=this instanceof(t=t||sx());if(!r&&!n.call(w,this))return new w(e);this._writableState=new E(e,this,r),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),i.call(this)}function S(e,t,n,r,i,o,a){t.writelen=r,t.writecb=a,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new p("write")):n?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function _(e,t,n,r){n||0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain")),t.pendingcb--,r(),A(e,t)}function C(t,n){n.bufferProcessing=!0;var r=n.bufferedRequest;if(t._writev&&r&&r.next){var i=Array(n.bufferedRequestCount),o=n.corkedRequestsFree;o.entry=r;for(var a=0,s=!0;r;)i[a]=r,r.isBuf||(s=!1),r=r.next,a+=1;
5i.allBuffers=s,S(t,n,!0,n.length,i,"",o.finish),n.pendingcb++,n.lastBufferedRequest=null,o.next?(n.corkedRequestsFree=o.next,o.next=null):n.corkedRequestsFree=new e(n),n.bufferedRequestCount=0}else{for(;r;){var l=r.chunk,c=r.encoding,d=r.callback;if(S(t,n,!1,n.objectMode?1:l.length,l,c,d),r=r.next,n.bufferedRequestCount--,n.writing)break}null===r&&(n.lastBufferedRequest=null)}n.bufferedRequest=r,n.bufferProcessing=!1}function x(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function k(e,t){e._final(function(n){t.pendingcb--,n&&v(e,n),t.prefinished=!0,e.emit("prefinish"),A(e,t)})}function A(e,t){var n=x(t);if(n&&(t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,ot.nextTick(k,e,t))),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var r=e._readableState;(!r||r.autoDestroy&&r.endEmitted)&&e.destroy()}return n}return s_(w,i),E.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(E.prototype,"buffer",{get:r.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(n=Function.prototype[Symbol.hasInstance],Object.defineProperty(w,Symbol.hasInstance,{value:function(e){return!!n.call(this,e)||this===w&&e&&e._writableState instanceof E}})):n=function(e){return e instanceof this},w.prototype.pipe=function(){v(this,new f)},w.prototype.write=function(e,t,n){var r,i,s,l,c,u,h,f=this._writableState,p=!1,y=!f.objectMode&&(h=e,o.isBuffer(h)||h instanceof a);return y&&!o.isBuffer(e)&&(r=e,e=o.from(r)),"function"==typeof t&&(n=t,t=null),y?t="buffer":t||(t=f.defaultEncoding),"function"!=typeof n&&(n=b),f.ending?(i=n,v(this,s=new m),ot.nextTick(i,s)):(y||(l=e,c=n,null===l?u=new g:"string"==typeof l||f.objectMode||(u=new d("chunk",["string","Buffer"],l)),!u||(v(this,u),ot.nextTick(c,u),0)))&&(f.pendingcb++,p=function(e,t,n,r,i,a){if(!n){var s,l,c=(s=r,l=i,t.objectMode||!1===t.decodeStrings||"string"!=typeof s||(s=o.from(s,l)),s);r!==c&&(n=!0,i="buffer",r=c)}var d=t.objectMode?1:r.length;t.length+=d;var u=t.length<t.highWaterMark;if(u||(t.needDrain=!0),t.writing||t.corked){var h=t.lastBufferedRequest;t.lastBufferedRequest={chunk:r,encoding:i,isBuf:n,callback:a,next:null},h?h.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else S(e,t,!1,d,r,i,a);return u}(this,f,y,e,t,n)),p},w.prototype.cork=function(){this._writableState.corked++},w.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||C(this,e))},w.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new y(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(w.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(w.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),w.prototype._write=function(e,t,n){n(new u("_write()"))},w.prototype._writev=null,w.prototype.end=function(e,t,n){var r,i=this._writableState;return"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),i.corked&&(i.corked=1,this.uncork()),i.ending||(r=n,i.ending=!0,A(this,i),r&&(i.finished?ot.nextTick(r):this.once("finish",r)),i.ended=!0,this.writable=!1),this},Object.defineProperty(w.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(w.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),w.prototype.destroy=s.destroy,w.prototype._undestroy=s.undestroy,w.prototype._destroy=function(e,t){t(e)},sb}function sx(){if(sS)return sw;sS=1;var e=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};sw=a;var t=sU(),n=sC();s_(a,t);for(var r=e(n.prototype),i=0;i<r.length;i++){var o=r[i];a.prototype[o]||(a.prototype[o]=n.prototype[o])}function a(e){if(!(this instanceof a))return new a(e);t.call(this,e),n.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",s)))}function s(){this._writableState.ended||ot.nextTick(l,this)}function l(e){e.end()}return Object.defineProperty(a.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(a.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(a.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(a.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&this._readableState.destroyed&&this._writableState.destroyed},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}}),sw}var sk=T.isEncoding||function(e){switch(e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function sA(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),function(e){if(e&&!sk(e))throw Error("Unknown encoding: "+e)}(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=sI;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=sT;break;default:return void(this.write=sM)}this.charBuffer=new T(6),this.charReceived=0,this.charLength=0}function sM(e){return e.toString(this.encoding)}function sI(e){this.charReceived=e.length%2,this.charLength=2*!!this.charReceived}function sT(e){this.charReceived=e.length%3,this.charLength=3*!!this.charReceived}sA.prototype.write=function(e){for(var t,n="";this.charLength;){var r=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,r),this.charReceived+=r,this.charReceived<this.charLength)return"";if(e=e.slice(r,e.length),!((t=(n=this.charBuffer.slice(0,this.charLength).toString(this.encoding)).charCo
5deAt(n.length-1))>=55296&&t<=56319)){if(this.charReceived=this.charLength=0,0===e.length)return n;break}this.charLength+=this.surrogateSize,n=""}this.detectIncompleteChar(e);var i=e.length;if(this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,i),i-=this.charReceived),i=(n+=e.toString(this.encoding,0,i)).length-1,(t=n.charCodeAt(i))>=55296&&t<=56319){var o=this.surrogateSize;return this.charLength+=o,this.charReceived+=o,this.charBuffer.copy(this.charBuffer,o,0,o),e.copy(this.charBuffer,0,0,o),n.substring(0,i)}return n},sA.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var n=e[e.length-t];if(1==t&&n>>5==6){this.charLength=2;break}if(t<=2&&n>>4==14){this.charLength=3;break}if(t<=3&&n>>3==30){this.charLength=4;break}}this.charReceived=t},sA.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var n=this.charReceived,r=this.charBuffer,i=this.encoding;t+=r.slice(0,n).toString(i)}return t};var sR=es(Object.freeze({__proto__:null,StringDecoder:sA})),sP=sh.codes.ERR_STREAM_PREMATURE_CLOSE;function sO(){}var sN,sL,sD,s$,sB,sK,sj=function e(t,n,r){if("function"==typeof n)return e(t,null,n);n||(n={}),i=r||sO,o=!1,r=function(){if(!o){o=!0;for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];i.apply(this,t)}};var i,o,a=n.readable||!1!==n.readable&&t.readable,s=n.writable||!1!==n.writable&&t.writable,l=function(){t.writable||d()},c=t._writableState&&t._writableState.finished,d=function(){s=!1,c=!0,a||r.call(t)},u=t._readableState&&t._readableState.endEmitted,h=function(){a=!1,u=!0,s||r.call(t)},f=function(e){r.call(t,e)},p=function(){var e;return a&&!u?(t._readableState&&t._readableState.ended||(e=new sP),r.call(t,e)):s&&!c?(t._writableState&&t._writableState.ended||(e=new sP),r.call(t,e)):void 0},g=function(){t.req.on("finish",d)};return t.setHeader&&"function"==typeof t.abort?(t.on("complete",d),t.on("abort",p),t.req?g():t.on("request",g)):s&&!t._writableState&&(t.on("end",l),t.on("close",l)),t.on("end",h),t.on("finish",d),!1!==n.error&&t.on("error",f),t.on("close",p),function(){t.removeListener("complete",d),t.removeListener("abort",p),t.removeListener("request",g),t.req&&t.req.removeListener("finish",d),t.removeListener("end",l),t.removeListener("close",l),t.removeListener("finish",d),t.removeListener("end",h),t.removeListener("error",f),t.removeListener("close",p)}};function sU(){if(sK)return sB;sK=1,sB=E,E.ReadableState=b,oz.EventEmitter;var e=function(e,t){return e.listeners(t).length},t=aA(),n=aI.Buffer,r=(void 0!==eo?eo:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},i,o,a,s,l=sl&&sl.debuglog?sl.debuglog("stream"):function(){},c=function(){if(so)return si;function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function t(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?e(Object(i),!0).forEach(function(e){var r,o,a;r=t,o=e,a=i[e],(o=n(o))in r?Object.defineProperty(r,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[o]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):e(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}function n(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}so=1;var r=aI.Buffer,i=sl.inspect,o=i&&i.custom||"inspect";return si=function(){var e;function a(){!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,a),this.head=null,this.tail=null,this.length=0}return e=[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n}},{key:"concat",value:function(e){if(0===this.length)return r.alloc(0);for(var t,n,i=r.allocUnsafe(e>>>0),o=this.head,a=0;o;)t=o.data,n=a,r.prototype.copy.call(t,i,n),a+=o.data.length,o=o.next;return i}},{key:"consume",value:function(e,t){var n;return e<this.head.data.length?(n=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):n=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),n}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,n=1,r=t.data;for(e-=r.length;t=t.next;){var i=t.data,o=e>i.length?i.length:e;if(o===i.length?r+=i:r+=i.slice(0,e),0==(e-=o)){o===i.length?(++n,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(o));break}++n}return this.length-=n,r}},{key:"_getBuffer",value:function(e){var t=r.allocUnsafe(e),n=this.head,i=1;for(n.data.copy(t),e-=n.data.length;n=n.next;){var o=n.data,a=e>o.length?o.length:e;if(o.copy(t,t.length-e,0,a),0==(e-=a)){a===o.length?(++i,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=o.slice(a));break}++i}return this.length-=i,t}},{key:o,value:function(e,n){return i(this,t(t({},n),{},{depth:0,customInspect:!1}))}}],function(e,t){for(var r=0;r<t.length;r++){var i=t[r];
vendor: 5,513 bytes, line 5
5i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,n(i.key),i)}}(a.prototype,e),Object.defineProperty(a,"prototype",{writable:!1}),a}()}(),d=sc(),u=sm().getHighWaterMark,h=sh.codes,f=h.ERR_INVALID_ARG_TYPE,p=h.ERR_STREAM_PUSH_AFTER_EOF,g=h.ERR_METHOD_NOT_IMPLEMENTED,m=h.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;s_(E,t);var y=d.errorOrDestroy,v=["error","close","destroy","pause","resume"];function b(e,t,n){i=i||sx(),e=e||{},"boolean"!=typeof n&&(n=t instanceof i),this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=u(this,e,"readableHighWaterMark",n),this.buffer=new c,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(o||(o=sR.StringDecoder),this.decoder=new o(e.encoding),this.encoding=e.encoding)}function E(e){if(i=i||sx(),!(this instanceof E))return new E(e);var n=this instanceof i;this._readableState=new b(e,this,n),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),t.call(this)}function w(e,t,i,o,a){l("readableAddChunk",t);var s,c,d,u,h,g=e._readableState;if(null===t)g.reading=!1,function(e,t){if(l("onEofChunk"),!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,t.sync?C(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,x(e)))}}(e,g);else{if(a||(s=g,c=t,n.isBuffer(c)||c instanceof r||"string"==typeof c||void 0===c||s.objectMode||(d=new f("chunk",["string","Buffer","Uint8Array"],c)),h=d),h)y(e,h);else if(g.objectMode||t&&t.length>0)if("string"==typeof t||g.objectMode||Object.getPrototypeOf(t)===n.prototype||(u=t,t=n.from(u)),o)g.endEmitted?y(e,new m):S(e,g,t,!0);else if(g.ended)y(e,new p);else{if(g.destroyed)return!1;g.reading=!1,g.decoder&&!i?(t=g.decoder.write(t),g.objectMode||0!==t.length?S(e,g,t,!1):k(e,g)):S(e,g,t,!1)}else o||(g.reading=!1,k(e,g))}return!g.ended&&(g.length<g.highWaterMark||0===g.length)}function S(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",n)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&C(e)),k(e,t)}function _(e,t){var n;return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&((n=e)>=0x40000000?n=0x40000000:(n--,n|=n>>>1,n|=n>>>2,n|=n>>>4,n|=n>>>8,n|=n>>>16,n++),t.highWaterMark=n),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function C(e){var t=e._readableState;l("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(l("emitReadable",t.flowing),t.emittedReadable=!0,ot.nextTick(x,e))}function x(e){var t=e._readableState;l("emitReadable_",t.destroyed,t.length,t.ended),!t.destroyed&&(t.length||t.ended)&&(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,R(e)}function k(e,t){t.readingMore||(t.readingMore=!0,ot.nextTick(A,e,t))}function A(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var n=t.length;if(l("maybeReadMore read 0"),e.read(0),n===t.length)break}t.readingMore=!1}function M(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function I(e){l("readable nexttick read 0"),e.read(0)}function T(e,t){l("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),R(e),t.flowing&&!t.reading&&e.read(0)}function R(e){var t=e._readableState;for(l("flow",t.flowing);t.flowing&&null!==e.read(););}function P(e,t){var n;return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n)}function O(e){var t=e._readableState;l("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,ot.nextTick(N,t,e))}function N(e,t){if(l("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var n=t._writableState;(!n||n.autoDestroy&&n.finished)&&t.destroy()}}function L(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return -1}return Object.defineProperty(E.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),E.prototype.destroy=d.destroy,E.prototype._undestroy=d.undestroy,E.prototype._destroy=function(e,t){t(e)},E.prototype.push=function(e,t){var r,i=this._readableState;return i.objectMode?r=!0:"string"==typeof e&&((t=t||i.defaultEncoding)!==i.encoding&&(e=n.from(e,t),t=""),r=!0),w(this,e,t,!1,r)},E.prototype.unshift=function(e){return w(this,e,null,!0,!1)},E.prototype.isPaused=function(){return!1===this._readableState.flowing},E.prototype.setEncoding=function(e){o||(o=sR.StringDecoder);var t=new o(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;
vendor: 2,616 bytes, line 5
5for(var n=this._readableState.buffer.head,r="";null!==n;)r+=t.write(n.data),n=n.next;return this._readableState.buffer.clear(),""!==r&&this._readableState.buffer.push(r),this._readableState.length=r.length,this},E.prototype.read=function(e){l("read",e),e=parseInt(e,10);var t=this._readableState,n=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return l("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?O(this):C(this),null;if(0===(e=_(e,t))&&t.ended)return 0===t.length&&O(this),null;var r,i=t.needReadable;return l("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&l("length less than watermark",i=!0),t.ended||t.reading?l("reading or ended",i=!1):i&&(l("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=_(n,t))),null===(r=e>0?P(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&O(this)),null!==r&&this.emit("data",r),r},E.prototype._read=function(e){y(this,new g("_read()"))},E.prototype.pipe=function(t,n){var r=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=t;break;case 1:i.pipes=[i.pipes,t];break;default:i.pipes.push(t)}i.pipesCount+=1,l("pipe count=%d opts=%j",i.pipesCount,n);var o=n&&!1===n.end||t===ot.stdout||t===ot.stderr?p:a;function a(){l("onend"),t.end()}i.endEmitted?ot.nextTick(o):r.once("end",o),t.on("unpipe",function e(n,o){l("onunpipe"),n===r&&o&&!1===o.hasUnpiped&&(o.hasUnpiped=!0,l("cleanup"),t.removeListener("close",h),t.removeListener("finish",f),t.removeListener("drain",s),t.removeListener("error",u),t.removeListener("unpipe",e),r.removeListener("end",a),r.removeListener("end",p),r.removeListener("data",d),c=!0,i.awaitDrain&&(!t._writableState||t._writableState.needDrain)&&s())});var s=function(){var t=r._readableState;l("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&e(r,"data")&&(t.flowing=!0,R(r))};t.on("drain",s);var c=!1;function d(e){l("ondata");var n=t.write(e);l("dest.write",n),!1===n&&((1===i.pipesCount&&i.pipes===t||i.pipesCount>1&&-1!==L(i.pipes,t))&&!c&&(l("false write response, pause",i.awaitDrain),i.awaitDrain++),r.pause())}function u(n){l("onerror",n),p(),t.removeListener("error",u),0===e(t,"error")&&y(t,n)}function h(){t.removeListener("finish",f),p()}function f(){l("onfinish"),t.removeListener("close",h),p()}function p(){l("unpipe"),r.unpipe(t)}return r.on("data",d),function(e,t,n){if("function"==typeof e.prependListener)return e.prepe
vendor: 4,554 bytes, line 5
5ndListener(t,n);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(t,"error",u),t.once("close",h),t.once("finish",f),t.emit("pipe",r),i.flowing||(l("pipe resume"),r.resume()),t},E.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n)),this;if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o<i;o++)r[o].emit("unpipe",this,{hasUnpiped:!1});return this}var a=L(t.pipes,e);return -1===a||(t.pipes.splice(a,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,n)),this},E.prototype.on=function(e,n){var r=t.prototype.on.call(this,e,n),i=this._readableState;return"data"===e?(i.readableListening=this.listenerCount("readable")>0,!1!==i.flowing&&this.resume()):"readable"===e&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,l("on readable",i.length,i.reading),i.length?C(this):i.reading||ot.nextTick(I,this))),r},E.prototype.addListener=E.prototype.on,E.prototype.removeListener=function(e,n){var r=t.prototype.removeListener.call(this,e,n);return"readable"===e&&ot.nextTick(M,this),r},E.prototype.removeAllListeners=function(e){var n=t.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||ot.nextTick(M,this),n},E.prototype.resume=function(){var e=this._readableState;return e.flowing||(l("resume"),e.flowing=!e.readableListening,e.resumeScheduled||(e.resumeScheduled=!0,ot.nextTick(T,this,e))),e.paused=!1,this},E.prototype.pause=function(){return l("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(l("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},E.prototype.wrap=function(e){var t=this,n=this._readableState,r=!1;for(var i in e.on("end",function(){if(l("wrapped end"),n.decoder&&!n.ended){var e=n.decoder.end();e&&e.length&&t.push(e)}t.push(null)}),e.on("data",function(i){l("wrapped data"),n.decoder&&(i=n.decoder.write(i)),n.objectMode&&null==i||(n.objectMode||i&&i.length)&&(t.push(i)||(r=!0,e.pause()))}),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var o=0;o<v.length;o++)e.on(v[o],this.emit.bind(this,v[o]));return this._read=function(t){l("wrapped _read",t),r&&(r=!1,e.resume())},this},"function"==typeof Symbol&&(E.prototype[Symbol.asyncIterator]=function(){return void 0===a&&(a=function(){if(sL)return sN;function e(e,t,n){var r;return(t="symbol"==typeof(r=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"))?r:String(r))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}sL=1;var t,n=Symbol("lastResolve"),r=Symbol("lastReject"),i=Symbol("error"),o=Symbol("ended"),a=Symbol("lastPromise"),s=Symbol("handlePromise"),l=Symbol("stream");function c(e,t){return{value:e,done:t}}function d(e){var t=e[n];if(null!==t){var i=e[l].read();null!==i&&(e[a]=null,e[n]=null,e[r]=null,t(c(i,!1)))}}function u(e){ot.nextTick(d,e)}var h=Object.getPrototypeOf(function(){}),f=Object.setPrototypeOf((e(t={get stream(){return this[l]},next:function(){var e,t=this,n=this[i];if(null!==n)return Promise.reject(n);if(this[o])return Promise.resolve(c(void 0,!0));if(this[l].destroyed)return new Promise(function(e,n){ot.nextTick(function(){t[i]?n(t[i]):e(c(void 0,!0))})});var r,d=this[a];if(d)r=new Promise((e=this,function(t,n){d.then(function(){e[o]?t(c(void 0,!0)):e[s](t,n)},n)}));else{var u=this[l].read();if(null!==u)return Promise.resolve(c(u,!1));r=new Promise(this[s])}return this[a]=r,r}},Symbol.asyncIterator,function(){return this}),e(t,"return",function(){var e=this;return new Promise(function(t,n){e[l].destroy(null,function(e){e?n(e):t(c(void 0,!0))})})}),t),h);return sN=function(t){var d,h=Object.create(f,(e(d={},l,{value:t,writable:!0}),e(d,n,{value:null,writable:!0}),e(d,r,{value:null,writable:!0}),e(d,i,{value:null,writable:!0}),e(d,o,{value:t._readableState.endEmitted,writable:!0}),e(d,s,{value:function(e,t){var i=h[l].read();i?(h[a]=null,h[n]=null,h[r]=null,e(c(i,!1))):(h[n]=e,h[r]=t)},writable:!0}),d));
5return h[a]=null,sj(t,function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=h[r];return null!==t&&(h[a]=null,h[n]=null,h[r]=null,t(e)),void(h[i]=e)}var s=h[n];null!==s&&(h[a]=null,h[n]=null,h[r]=null,s(c(void 0,!0))),h[o]=!0}),t.on("readable",u.bind(null,h)),h}}()),a(this)}),Object.defineProperty(E.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(E.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(E.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),E._fromList=P,Object.defineProperty(E.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(E.from=function(e,t){return void 0===s&&(s=s$?sD:(s$=1,sD=function(){throw Error("Readable.from is not available in the browser")})),s(E,e,t)}),sB}var sH=sh.codes,sF=sH.ERR_METHOD_NOT_IMPLEMENTED,sz=sH.ERR_MULTIPLE_CALLBACK,sq=sH.ERR_TRANSFORM_ALREADY_TRANSFORMING,sW=sH.ERR_TRANSFORM_WITH_LENGTH_0,sV=sx();function sG(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(null===r)return this.emit("error",new sz);n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function sY(e){if(!(this instanceof sY))return new sY(e);sV.call(this,e),this._transformState={afterTransform:sG.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",sZ)}function sZ(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?sJ(this,null,null):this._flush(function(t,n){sJ(e,t,n)})}function sJ(e,t,n){if(t)return e.emit("error",t);if(null!=n&&e.push(n),e._writableState.length)throw new sW;if(e._transformState.transforming)throw new sq;return e.push(null)}function sQ(e){if(!(this instanceof sQ))return new sQ(e);sY.call(this,e)}s_(sY,sV),sY.prototype.push=function(e,t){return this._transformState.needTransform=!1,sV.prototype.push.call(this,e,t)},sY.prototype._transform=function(e,t,n){n(new sF("_transform()"))},sY.prototype._write=function(e,t,n){var r=this._transformState;if(r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},sY.prototype._read=function(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},sY.prototype._destroy=function(e,t){sV.prototype._destroy.call(this,e,function(e){t(e)})},s_(sQ,sY),sQ.prototype._transform=function(e,t,n){n(null,e)};var sX=sh.codes,s0=sX.ERR_MISSING_ARGS,s1=sX.ERR_STREAM_DESTROYED;function s2(e){if(e)throw e}function s3(e){e()}function s5(e,t){return e.pipe(t)}var s8=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];var r,i,o=(r=t).length?"function"!=typeof r[r.length-1]?s2:r.pop():s2;if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new s0("streams");var a=t.map(function(e,n){var r,s,l,c,d,u,h=n<t.length-1;return r=n>0,l=s=function(e){i||(i=e),e&&a.forEach(s3),h||(a.forEach(s3),o(i))},c=!1,s=function(){c||(c=!0,l.apply(void 0,arguments))},d=!1,e.on("close",function(){d=!0}),void 0===lh&&(lh=sj),lh(e,{readable:h,writable:r},function(e){if(e)return s(e);d=!0,s()}),u=!1,function(t){if(!d&&!u)return u=!0,e.setHeader&&"function"==typeof e.abort?e.abort():"function"==typeof e.destroy?e.destroy():void s(t||new s1("pipe"))}});return t.reduce(s5)};!function(e,t){(t=ak.exports=sU()).Stream=t,t.Readable=t,t.Writable=sC(),t.Duplex=sx(),t.Transform=sY,t.PassThrough=sQ,t.finished=sj,t.pipeline=s8}
5(0,ak.exports);var s6=ak.exports,s4={},s9={exports:{}},s7=function e(t,n){if(t&&n)return e(t)(n);if("function"!=typeof t)throw TypeError("need wrapper function");return Object.keys(t).forEach(function(e){r[e]=t[e]}),r;function r(){for(var e=Array(arguments.length),n=0;n<e.length;n++)e[n]=arguments[n];var r=t.apply(this,e),i=e[e.length-1];return"function"==typeof r&&r!==i&&Object.keys(i).forEach(function(e){r[e]=i[e]}),r}};function le(e){var t=function(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))};return t.called=!1,t}function lt(e){var t=function(){if(t.called)throw Error(t.onceError);return t.called=!0,t.value=e.apply(this,arguments)};return t.onceError=(e.name||"Function wrapped with `once`")+" shouldn't be called more than once",t.called=!1,t}s9.exports=s7(le),s9.exports.strict=s7(lt),le.proto=le(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return le(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return lt(this)},configurable:!0})});var ln=s9.exports,lr={};Object.defineProperty(lr,"__esModule",{value:!0}),lr.Substream=void 0;let li=s6;class lo extends li.Duplex{constructor({parent:e,name:t}){super({objectMode:!0}),this._parent=e,this._name=t}_read(){}_write(e,t,n){this._parent.push({name:this._name,data:e}),n()}}lr.Substream=lo;var la=eo&&eo.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s4,"__esModule",{value:!0}),s4.ObjectMultiplex=void 0;let ls=s6,ll=la(ln),lc=Symbol("IGNORE_SUBSTREAM");s4.ObjectMultiplex=class extends ls.Duplex{constructor(e={}){super(Object.assign(Object.assign({},e),{objectMode:!0})),this._substreams={}}createStream(e){if(this.destroyed)throw Error(`ObjectMultiplex - parent stream for name "${e}" already destroyed`);if(this._readableState.ended||this._writableState.ended)throw Error(`ObjectMultiplex - parent stream for name "${e}" already ended`);if(!e)throw Error("ObjectMultiplex - name must not be empty");if(this._substreams[e])throw Error(`ObjectMultiplex - Substream for name "${e}" already exists`);let t=new lr.Substream({parent:this,name:e});return this._substreams[e]=t,function(e,t){let n=(0,ll.default)(t);(0,ls.finished)(e,{readable:!1},n),(0,ls.finished)(e,{writable:!1},n)}(this,e=>t.destroy(e||void 0)),t}ignoreStream(e){if(!e)throw Error("ObjectMultiplex - name must not be empty");if(this._substreams[e])throw Error(`ObjectMultiplex - Substream for name "${e}" already exists`);this._substreams[e]=lc}_read(){}_write(e,t,n){let{name:r,data:i}=e;if(!r)return console.warn(`ObjectMultiplex - malformed chunk without name "${e}"`),n();let o=this._substreams[r];return o?o!==lc&&o.push(i):console.warn(`ObjectMultiplex - orphaned data for stream "${r}"`),n()}};var ld=ea(s4.ObjectMultiplex);let lu=e=>null!==e&&"object"==typeof e&&"function"==typeof e.pipe;lu.writable=e=>lu(e)&&!1!==e.writable&&"function"==typeof e._write&&"object"==typeof e._writableState,lu.readable=e=>lu(e)&&!1!==e.readable&&"function"==typeof e._read&&"object"==typeof e._readableState,lu.duplex=e=>lu.writable(e)&&lu.readable(e),lu.transform=e=>lu.duplex(e)&&"function"==typeof e._transform;var lh,lf,lp=class extends ax{constructor(e,{jsonRpcStreamName:t,logger:n=console,maxEventListeners:r=100,rpcMiddleware:i=[]}){if(super({logger:n,maxEventListeners:r,rpcMiddleware:i}),!lu.duplex(e))throw Error(ir.errors.invalidDuplexStream());this._handleStreamDisconnect=this._handleStreamDisconnect.bind(this);let o=new ld;s6.pipeline(e,o,e,this._handleStreamDisconnect.bind(this,"MetaMask")),this._jsonRpcConnection=function(e={}){let t={},n=new s6.Duplex({objectMode:!0,read:()=>{},write:function(i,o,a){let s=null;try{i.id?function(e){let{id:n}=e;if(null===n)return;let r=t[n];if(!r)return console.warn(`StreamMiddleware - Unknown response id "${n}"`);delete t[n],Object.assign(r.res,e),setTimeout(r.end)}(i):(e?.retryOnMessage&&i.method===e.retryOnMessage&&Object.values(t).forEach(({req:e,retryCount:r=0})=>{var i;if(!e.id)return;if(r>=3)throw Error(`StreamMiddleware - Retry limit exceeded for request id "${e.id}"`);let o=t[e.id];o&&(o.retryCount=r+1),i=e,n.push(i)}),r.emit("notification",i))}catch(e){s=e}a(s)}}),r=new an;return{events:r,middleware:(e,r,i,o)=>{var a;t[e.id]={req:e,res:r,next:i,end:o},a=e,n.push(a)},stream:n}}
5({retryOnMessage:"METAMASK_EXTENSION_CONNECT_CAN_RETRY"}),s6.pipeline(this._jsonRpcConnection.stream,o.createStream(t),this._jsonRpcConnection.stream,this._handleStreamDisconnect.bind(this,"MetaMask RpcProvider")),this._rpcEngine.push(this._jsonRpcConnection.middleware),this._jsonRpcConnection.events.on("notification",t=>{let{method:n,params:r}=t;"metamask_accountsChanged"===n?this._handleAccountsChanged(r):"metamask_unlockStateChanged"===n?this._handleUnlockStateChanged(r):"metamask_chainChanged"===n?this._handleChainChanged(r):ao.includes(n)?this.emit("message",{type:n,data:r}):"METAMASK_STREAM_FAILURE"===n&&e.destroy(Error(ir.errors.permanentlyDisconnected()))})}async _initializeStateAsync(){let e;try{e=await this.request({method:"metamask_getProviderState"})}catch(e){this._log.error("MetaMask: Failed to get initial state. Please report this bug.",e)}this._initializeState(e)}_handleStreamDisconnect(e,t){let n=`MetaMask: Lost connection to "${e}".`;t?.stack&&(n+=`
6${t.stack}`),this._log.warn(n),this.listenerCount("error")>0&&this.emit("error",n),this._handleDisconnect(!1,t?t.message:void 0)}_handleChainChanged({chainId:e,networkVersion:t}={}){al(e)&&t&&"string"==typeof t?"loading"===t?this._handleDisconnect(!0):super._handleChainChanged({chainId:e}):this._log.error(ir.errors.invalidNetworkParams(),{chainId:e,networkVersion:t})}},lg=class extends lp{constructor(e,{jsonRpcStreamName:t="metamask-provider",logger:n=console,maxEventListeners:r=100,shouldSendMetadata:i}={}){if(super(e,{jsonRpcStreamName:t,logger:n,maxEventListeners:r,rpcMiddleware:aa(n)}),this._sentWarnings={chainId:!1,networkVersion:!1,selectedAddress:!1,enable:!1,experimentalMethods:!1,send:!1,events:{close:!1,data:!1,networkChanged:!1,notification:!1}},ag(this,lf,void 0),this._initializeStateAsync(),am(this,lf,null),this.isMetaMask=!0,this._sendSync=this._sendSync.bind(this),this.enable=this.enable.bind(this),this.send=this.send.bind(this),this.sendAsync=this.sendAsync.bind(this),this._warnOfDeprecation=this._warnOfDeprecation.bind(this),this._metamask=this._getExperimentalApi(),this._jsonRpcConnection.events.on("notification",e=>{let{method:t}=e;ao.includes(t)&&(this.emit("data",e),this.emit("notification",e.params.result))}),i)if("complete"===document.readyState)ad(this._rpcEngine,this._log);else{let e=()=>{ad(this._rpcEngine,this._log),window.removeEventListener("DOMContentLoaded",e)};window.addEventListener("DOMContentLoaded",e)}}get chainId(){return this._sentWarnings.chainId||(this._log.warn(ir.warnings.chainIdDeprecation),this._sentWarnings.chainId=!0),super.chainId}get networkVersion(){return this._sentWarnings.networkVersion||(this._log.warn(ir.warnings.networkVersionDeprecation),this._sentWarnings.networkVersion=!0),ap(this,lf)}get selectedAddress(){return this._sentWarnings.selectedAddress||(this._log.warn(ir.warnings.selectedAddressDeprecation),this._sentWarnings.selectedAddress=!0),super.selectedAddress}sendAsync(e,t){this._rpcRequest(e,t)}addListener(e,t){return this._warnOfDeprecation(e),super.addListener(e,t)}on(e,t){return this._warnOfDeprecation(e),super.on(e,t)}once(e,t){return this._warnOfDeprecation(e),super.once(e,t)}prependListener(e,t){return this._warnOfDeprecation(e),super.prependListener(e,t)}prependOnceListener(e,t){return this._warnOfDeprecation(e),super.prependOnceListener(e,t)}_handleDisconnect(e,t){super._handleDisconnect(e,t),ap(this,lf)&&!e&&am(this,lf,null)}_warnOfDeprecation(e){!1===this._sentWarnings?.events[e]&&(this._log.warn(ir.warnings.events[e]),this._sentWarnings.events[e]=!0)}async enable(){return this._sentWarnings.enable||(this._log.warn(ir.warnings.enableDeprecation),this._sentWarnings.enable=!0),new Promise((e,t)=>{try{this._rpcRequest({method:"eth_requestAccounts",params:[]},as(e,t))}catch(e){t(e)}})}send(e,t){return this._sentWarnings.send||(this._log.warn(ir.warnings.sendDeprecation),this._sentWarnings.send=!0),"string"!=typeof e||t&&!Array.isArray(t)?e&&"object"==typeof e&&"function"==typeof t?this._rpcRequest(e,t):this._sendSync(e):new Promise((n,r)=>{try{this._rpcRequest({method:e,params:t},as(n,r,!1))}catch(e){r(e)}})}_sendSync(e){let t;switch(e.method){case"eth_accounts":t=this.selectedAddress?[this.selectedAddress]:[];break;case"eth_coinbase":t=this.selectedAddress??null;break;case"eth_uninstallFilter":this._rpcRequest(e,ac),t=!0;break;case"net_version":t=ap(this,lf)??null;break;default:throw Error(ir.errors.unsupportedSync(e.method))}return{id:e.id,jsonrpc:e.jsonrpc,result:t}}_getExperimentalApi(){return new Proxy({isUnlocked:async()=>(this._state.initialized||await new Promise(e=>{this.on("_initialized",()=>e())}),this._state.isUnlocked),requestBatch:async e=>{if(!Array.isArray(e))throw oL({message:"Batch requests must be made with an array of request objects.",data:e});return new Promise((t,n)=>{this._rpcRequest(e,as(t,n))})}},{get:(e,t,...n)=>(this._sentWarnings.experimentalMethods||(this._log.warn(ir.warnings.experimentalMethods),this._sentWarnings.experimentalMethods=!0),Reflect.get(e,t,...n))})}_handleChainChanged({chainId:e,networkVersion:t}={}){super._handleChainChanged({chainId:e,networkVersion:t}),this._state.isConnected&&t!==ap(this,lf)&&(am(this,lf,t),this._state.initialized&&this.emit
6("networkChanged",ap(this,lf)))}};lf=new WeakMap;let lm=l()("MM_SDK");lm.color="#FFAC1C";var ly={},lv={};Object.defineProperty(lv,"__esModule",{value:!0}),lv.EthereumProviderError=lv.EthereumRpcError=void 0;class lb extends Error{constructor(e,t,n){if(!Number.isInteger(e))throw Error('"code" must be an integer.');if(!t||"string"!=typeof t)throw Error('"message" must be a nonempty string.');super(t),this.code=e,void 0!==n&&(this.data=n)}serialize(){let e={code:this.code,message:this.message};return void 0!==this.data&&(e.data=this.data),this.stack&&(e.stack=this.stack),e}toString(){return oA.default(this.serialize(),lE,2)}}function lE(e,t){if("[Circular]"!==t)return t}lv.EthereumRpcError=lb,lv.EthereumProviderError=class extends lb{constructor(e,t,n){if(!function(e){return Number.isInteger(e)&&e>=1e3&&e<=4999}(e))throw Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,t,n)}};var lw={},lS={};Object.defineProperty(lS,"__esModule",{value:!0}),lS.errorValues=lS.errorCodes=void 0,lS.errorCodes={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901}},lS.errorValues={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.serializeError=e.isValidCode=e.getMessageFromCode=e.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;let t=lS.errorCodes.rpc.internal,n={code:t,message:r(t)};function r(t,n="Unspecified error message. This is a bug, please report it."){if(Number.isInteger(t)){var i;let n=t.toString();if(a(lS.errorValues,n))return lS.errorValues[n].message;if((i=t)>=-32099&&i<=-32e3)return e.JSON_RPC_SERVER_ERROR_MESSAGE}return n}function i(e){var t;if(!Number.isInteger(e))return!1;let n=e.toString();return!!lS.errorValues[n]||!!((t=e)>=-32099&&t<=-32e3)}function o(e){return e&&"object"==typeof e&&!Array.isArray(e)?Object.assign({},e):e}function a(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.",e.getMessageFromCode=r,e.isValidCode=i,e.serializeError=function(e,{fallbackError:t=n,shouldIncludeStack:s=!1}={}){if(!t||!Number.isInteger(t.code)||"string"!=typeof t.message)throw Error("Must provide fallback error with integer number code and string message.");if(e instanceof lv.EthereumRpcError)return e.serialize();let l={};if(e&&"object"==typeof e&&!Array.isArray(e)&&a(e,"code")&&i(e.code))l.code=e.code,e.message&&"string"==typeof e.message?(l.message=e.message,a(e,"data")&&(l.data=e.data)):(l.message=r(l.code),l.data={originalError:o(e)});else{l.code=t.code;let n=null==e?void 0:e.message;l.message=n&&"string"==typeof n?n:t.message,l.data={originalError:o(e)}}let c=null==e?void 0:e.stack;return s&&e&&c&&"string"==typeof c&&(l.stack=c),l}}(lw);var l_={};function lC(e,t){let[n,r]=lk(t);return new lv.EthereumRpcError(e,n||lw.getMessageFromCode(e),r)}function lx(e,t){let[n,r]=lk(t);return new lv.EthereumProviderError(e,n||lw.getMessageFromCode(e),r)}function lk(e){if(e){if("string"==typeof e)return[e];if("object"==typeof e&&!Array.isArray(e)){let{message:t,data:n}=e;
6if(t&&"string"!=typeof t)throw Error("Must specify string message.");return[t||void 0,n]}}return[]}Object.defineProperty(l_,"__esModule",{value:!0}),l_.ethErrors=void 0,l_.ethErrors={rpc:{parse:e=>lC(lS.errorCodes.rpc.parse,e),invalidRequest:e=>lC(lS.errorCodes.rpc.invalidRequest,e),invalidParams:e=>lC(lS.errorCodes.rpc.invalidParams,e),methodNotFound:e=>lC(lS.errorCodes.rpc.methodNotFound,e),internal:e=>lC(lS.errorCodes.rpc.internal,e),server:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw Error("Ethereum RPC Server errors must provide single object argument.");let{code:t}=e;if(!Number.isInteger(t)||t>-32005||t<-32099)throw Error('"code" must be an integer such that: -32099 <= code <= -32005');return lC(t,e)},invalidInput:e=>lC(lS.errorCodes.rpc.invalidInput,e),resourceNotFound:e=>lC(lS.errorCodes.rpc.resourceNotFound,e),resourceUnavailable:e=>lC(lS.errorCodes.rpc.resourceUnavailable,e),transactionRejected:e=>lC(lS.errorCodes.rpc.transactionRejected,e),methodNotSupported:e=>lC(lS.errorCodes.rpc.methodNotSupported,e),limitExceeded:e=>lC(lS.errorCodes.rpc.limitExceeded,e)},provider:{userRejectedRequest:e=>lx(lS.errorCodes.provider.userRejectedRequest,e),unauthorized:e=>lx(lS.errorCodes.provider.unauthorized,e),unsupportedMethod:e=>lx(lS.errorCodes.provider.unsupportedMethod,e),disconnected:e=>lx(lS.errorCodes.provider.disconnected,e),chainDisconnected:e=>lx(lS.errorCodes.provider.chainDisconnected,e),custom:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw Error("Ethereum Provider custom errors must provide single object argument.");let{code:t,message:n,data:r}=e;if(!n||"string"!=typeof n)throw Error('"message" must be a nonempty string');return new lv.EthereumProviderError(t,n,r)}}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getMessageFromCode=e.serializeError=e.EthereumProviderError=e.EthereumRpcError=e.ethErrors=e.errorCodes=void 0,Object.defineProperty(e,"EthereumRpcError",{enumerable:!0,get:function(){return lv.EthereumRpcError}}),Object.defineProperty(e,"EthereumProviderError",{enumerable:!0,get:function(){return lv.EthereumProviderError}}),Object.defineProperty(e,"serializeError",{enumerable:!0,get:function(){return lw.serializeError}}),Object.defineProperty(e,"getMessageFromCode",{enumerable:!0,get:function(){return lw.getMessageFromCode}}),Object.defineProperty(e,"ethErrors",{enumerable:!0,get:function(){return l_.ethErrors}}),Object.defineProperty(e,"errorCodes",{enumerable:!0,get:function(){return lS.errorCodes}})}(ly);var lA={exports:{}};lA.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t||4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,(function(t){return e[t]}).bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=90)}({17:function(e,t,n){t.__esModule=!0,t.default=void 0;var r=n(18);t.default=function(){function e(){}return e.getFirstMatch=function(e,t){var n=t.match(e);return n&&n.length>0&&n[1]||""},e.getSecondMatch=function(e,t){var n=t.match(e);return n&&n.length>1&&n[2]||""},e.matchAndReturnConst=function(e,t,n){if(e.test(t))return n},e.getWindowsVersionName=function(e){switch(e){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},e.getMacOSVersionName=function(e){var t=e.split(".").splice(0,2).map(function(e){return parseInt(e,10)||0});if(t.push(0),10===t[0])switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";
vendor: 24,019 bytes, line 6
6case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},e.getAndroidVersionName=function(e){var t=e.split(".").splice(0,2).map(function(e){return parseInt(e,10)||0});if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0},e.getVersionPrecision=function(e){return e.split(".").length},e.compareVersions=function(t,n,r){void 0===r&&(r=!1);var i=e.getVersionPrecision(t),o=e.getVersionPrecision(n),a=Math.max(i,o),s=0,l=e.map([t,n],function(t){var n=a-e.getVersionPrecision(t),r=t+Array(n+1).join(".0");return e.map(r.split("."),function(e){return Array(20-e.length).join("0")+e}).reverse()});for(r&&(s=a-Math.min(i,o)),a-=1;a>=s;){if(l[0][a]>l[1][a])return 1;if(l[0][a]===l[1][a]){if(a===s)return 0;a-=1}else if(l[0][a]<l[1][a])return -1}},e.map=function(e,t){var n,r=[];if(Array.prototype.map)return Array.prototype.map.call(e,t);for(n=0;n<e.length;n+=1)r.push(t(e[n]));return r},e.find=function(e,t){var n,r;if(Array.prototype.find)return Array.prototype.find.call(e,t);for(n=0,r=e.length;n<r;n+=1){var i=e[n];if(t(i,n))return i}},e.assign=function(e){for(var t,n,r=arguments.length,i=Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];if(Object.assign)return Object.assign.apply(Object,[e].concat(i));for(t=0,n=i.length;t<n;t+=1)!function(){var n=i[t];"object"==typeof n&&null!==n&&Object.keys(n).forEach(function(t){e[t]=n[t]})}();return e},e.getBrowserAlias=function(e){return r.BROWSER_ALIASES_MAP[e]},e.getBrowserTypeByAlias=function(e){return r.BROWSER_MAP[e]||""},e}(),e.exports=t.default},18:function(e,t,n){t.__esModule=!0,t.ENGINE_MAP=t.OS_MAP=t.PLATFORMS_MAP=t.BROWSER_MAP=t.BROWSER_ALIASES_MAP=void 0,t.BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},t.BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},t.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},t.OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},t.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}},90:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(91))&&r.__esModule?r:{default:r},o=n(18);t.default=function(){function e(){}return e.getParser=function(e,t){if(void 0===t&&(t=!1),"string"!=typeof e)throw Error("UserAgent should be a string");return new i.default(e,t)},e.parse=function(e){return new i.default(e).getResult()},function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e,[{key:"BROWSER_MAP",get:function(){return o.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return o.ENGINE_MAP}},{key:"OS_MAP",get:function(){return o.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return o.PLATFORMS_MAP}}]),e}(),e.exports=t.default},91:function(e,t,n){t.__esModule=!0,t.default=void 0;var r=l(n(92)),i=l(n(93)),o=l(n(94)),a=l(n(95)),s=l(n(17));function l(e){return e&&e.__esModule?e:{default:e}}t.default=function(){function e(e,t){if(void 0===t&&(t=!1),null==e||""===e)throw Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},!0!==t&&this.parse()}var t=e.prototype;return t.getUA=function(){return this._ua},t.test=function(e){return e.test(this._ua)},t.parseBrowser=function(){var e=this;this.parsedResult.browser={};var t=s.default.find(r.default,function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some(function(t){return e.test(t)});throw Error("Browser's test function is not valid")});return t&&(this.parsedResult.browser=t.describe(this.getUA())),this.parsedResult.browser},t.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},t.getBrowserName=function(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},t.getBrowserVersion=function(){return this.getBrowser().version},t.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},t.parseOS=function(){var e=this;this.parsedResult.os={};var t=s.default.find(i.default,function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some(function(t){return e.test(t)});throw Error("Browser's test function is not valid")});return t&&(this.parsedResult.os=t.describe(this.getUA())),this.parsedResult.os},t.getOSName=function(e){var t=this.getOS().name;return e?String(t).toLowerCase()||"":t||""},t.getOSVersion=function(){return this.getOS().version},t.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},t.getPlatformType=function(e){void 0===e&&(e=!1);var t=this.getPlatform().type;return e?String(t).toLowerCase()||"":t||""},t.parsePlatform=function(){var e=this;this.parsedResult.platform={};var t=s.default.find(o.default,function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some(function(t){return e.test(t)});throw Error("Browser's test function is not valid")});return t&&(this.parsedResult.platform=t.describe(this.getUA())),this.parsedResult.platform},t.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},t.getEngineName=function(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},t.parseEngine=function(){var e=this;this.parsedResult.engine={};var t=s.default.find(a.default,function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some(function(t){return e.test(t)});throw Error("Browser's test function is not valid")});return t&&(this.parsedResult.engine=t.describe(this.getUA())),this.parsedResult.engine},t.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},t.getResult=function(){return s.default.assign({},this.parsedResult)},t.satisfies=function(e){var t=this,n={},r=0,i={},o=0;if(Object.keys(e).forEach(function(t){var a=e[t];"string"==typeof a?(i[t]=a,o+=1):"object"==typeof a&&(n[t]=a,r+=1)}),r>0){var a=Object.keys(n),l=s.default.find(a,function(e){return t.isOS(e)});if(l){var c=this.satisfies(n[l]);if(void 0!==c)return c}var d=s.default.find(a,function(e){return t.isPlatform(e)});if(d){var u=this.satisfies(n[d]);if(void 0!==u)return u}}if(o>0){var h=Object.keys(i),f=s.default.find(h,function(e){return t.isBrowser(e,!0)});if(void 0!==f)return this.compareVersion(i[f])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var n=this.getBrowserName().toLowerCase(),r=e.toLowerCase(),i=s.default.getBrowserTypeByAlias(r);return t&&i&&(r=i.toLowerCase()),r===n},t.compareVersion=function(e){var t=[0],n=e,r=!1,i=this.getBrowserVersion();if("string"==typeof i)return">"===e[0]||"<"===e[0]?(n=e.substr(1),"="===e[1]?(r=!0,n=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?n=e.substr(1):"~"===e[0]&&(r=!0,n=e.substr(1)),t.indexOf(s.default.compareVersions(i,n,r))>-1},t.isOS=function(e){return this.getOSName(!0)===String(e).toLowerCase()},t.isPlatform=function(e){return this.getPlatformType(!0)===String(e).toLowerCase()},t.isEngine=function(e){return this.getEngineName(!0)===String(e).toLowerCase()},t.is=function(e,t){return void 0===t&&(t=!1),this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)},t.some=function(e){var t=this;return void 0===e&&(e=[]),e.some(function(e){return t.is(e)})},e}(),e.exports=t.default},92:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=/version\/(\d+(\.?_?\d+)+)/i;t.default=[{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},n=i.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opr\/|opios/i],describe:function(e){var t={name:"Opera"},n=i.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Whale/i],describe:function(e){var t={name:"NAVER Whale Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MZBrowser/i],describe:function(e){var t={name:"MZ Browser"},n=i.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/focus/i],describe:function(e){var t={name:"Focus"},n=i.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/swing/i],describe:function(e){var t={name:"Swing"},n=i.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(e){var t={name:"Opera Touch"},n=i.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/yabrowser/i],describe:function(e){var t={name:"Yandex Browser"},n=i.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Maxthon|mxios/i],describe:function(e){var t={name:"Maxthon"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/epiphany/i],describe:function(e){var t={name:"Epiphany"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/puffin/i],describe:function(e){var t={name:"Puffin"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sleipnir/i],describe:function(e){var t={name:"Sleipnir"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/k-meleon/i],describe:function(e){var t={name:"K-Meleon"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/micromessenger/i],describe:function(e){var t={name:"WeChat"},n=i.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/qqbrowser/i],describe:function(e){var t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},n=i.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/msie|trident/i],describe:function(e){var t={name:"Internet Explorer"},n=i.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/\sedg\//i],describe:function(e){var t={name:"Microsoft Edge"},n=i.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/edg([ea]|ios)/i],describe:function(e){var t={name:"Microsoft Edge"},n=i.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/vivaldi/i],describe:function(e){var t={name:"Vivaldi"},n=i.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/seamonkey/i],describe:function(e){var t={name:"SeaMonkey"},n=i.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sailfish/i],describe:function(e){var t={name:"Sailfish"},n=i.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return n&&(t.version=n),t}},{test:[/silk/i],describe:function(e){var t={name:"Amazon Silk"},n=i.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/phantom/i],describe:function(e){var t={name:"PhantomJS"},n=i.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/slimerjs/i],describe:function(e){var t={name:"SlimerJS"},n=i.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t={name:"BlackBerry"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t={name:"WebOS Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/bada/i],describe:function(e){var t={name:"Bada"},n=i.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/tizen/i],describe:function(e){var t={name:"Tizen"},n=i.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/qupzilla/i],describe:function(e){var t={name:"QupZilla"},n=i.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/firefox|iceweasel|fxios/i],describe:function(e){var t={name:"Firefox"},n=i.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/electron/i],describe:function(e){var t={name:"Electron"},n=i.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MiuiBrowser/i],describe:function(e){var t={name:"Miui"},n=i.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/chromium/i],describe:function(e){var t={name:"Chromium"},n=i.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/chrome|crios|crmo/i],describe:function(e){var t={name:"Chrome"},n=i.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/GSA/i],describe:function(e){var t={name:"Google Search"},n=i.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){var t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe:function(e){var t={name:"Android Browser"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/.*/i],describe:function(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:i.default.getFirstMatch(t,e),version:i.default.getSecondMatch(t,e)}}}],e.exports=t.default},93:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18);t.default=[{test:[/Roku\/DVP/],describe:function(e){var t=i.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:o.OS_MAP.Roku,version:t}}},{test:[/windows phone/i],describe:function(e){var t=i.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.WindowsPhone,version:t}}},{test:[/windows /i],describe:function(e){var t=i.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),n=i.default.getWindowsVersionName(t);return{name:o.OS_MAP.Windows,version:t,versionName:n}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(e){var t={name:o.OS_MAP.iOS},n=i.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return n&&(t.version=n),t}},{test:[/macintosh/i],describe:function(e){var t=i.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),n=i.default.getMacOSVersionName(t),r={name:o.OS_MAP.MacOS,version:t};return n&&(r.versionName=n),r}},{test:[/(ipod|iphone|ipad)/i],describe:function(e){var t=i.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:o.OS_MAP.iOS,version:t}}},{test:function(e){var t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe:function(e){var t=i.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),n=i.default.getAndroidVersionName(t),r={name:o.OS_MAP.Android,version:t};return n&&(r.versionName=n),r}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t=i.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),n={name:o.OS_MAP.WebOS};return t&&t.length&&(n.version=t),n}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t=i.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||i.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||i.default.getFirstMatch(/\bbb(\d+)/i,e);return{name:o.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=i.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=i.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return{name:o.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:o.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=i.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.PlayStation4,version:t}}}],e.exports=t.default},94:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18);t.default=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(e){var t=i.default.getFirstMatch(/(can-l01)/i,e)&&"Nova",n={type:o.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(n.model=t),n}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){var t=e.test(/ipod|iphone/i),n=e.test(/like (ipod|iphone)/i);return t&&!n},describe:function(e){var t=i.default.getFirstMatch(/(ipod|iphone)/i,e);return{type:o.PLATFORMS_MAP.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"blackberry"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e){return"bada"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"windows phone"===e.getBrowserName()},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(e){var t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){return"android"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"macos"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e){return"windows"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"linux"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"playstation 4"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}},{test:function(e){return"roku"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}}],e.exports=t.default},95:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18);t.default=[{test:function(e){return"microsoft edge"===e.getBrowserName(!0)},describe:function(e){if(/\sedg\//i.test(e))return{name:o.ENGINE_MAP.Blink};var t=i.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:o.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:o.ENGINE_MAP.Trident},n=i.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){return e.test(/presto/i)},describe:function(e){var t={name:o.ENGINE_MAP.Presto},n=i.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){var t=e.test(/gecko/i),n=e.test(/like gecko/i);return t&&!n},describe:function(e){var t={name:o.ENGINE_MAP.Gecko},n=i.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:o.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:o.ENGINE_MAP.WebKit},n=i.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}}],e.exports=t.default}});var lM=ea(lA.exports);let lI={Initialized:"initialized",DisplayURI:"display_uri",ProviderUpdate:"provider_update",ConnectWithResponse:"connectWithResponse",ConnectionStatus:"connection_status",ServiceStatus:"service_status"};class lT{constructor({shouldSetOnWindow:e,connectionStream:t,shouldSe
6ndMetadata:n=!1,shouldShimWeb3:r,sdkInstance:i}){let o=new lO({connectionStream:t,shouldSendMetadata:n,shouldSetOnWindow:e,shouldShimWeb3:r,autoRequestAccounts:!1}),a=new Proxy(o,{deleteProperty:()=>!0});if(this.provider=a,this.sdkInstance=i,e&&"undefined"!=typeof window)try{window.ethereum=o,window.dispatchEvent(new Event("ethereum#initialized"))}catch(e){lm("[Ethereum] Unable to set global provider - window.ethereum may be read-only",e)}if(r&&"undefined"!=typeof window)try{!function(e,t=console){let n=!1,r=!1;if(!window.web3){let i="__isMetaMaskShim__",o={currentProvider:e};Object.defineProperty(o,i,{value:!0,enumerable:!0,configurable:!1,writable:!1}),o=new Proxy(o,{get:(o,a,...s)=>("currentProvider"!==a||n?"currentProvider"===a||a===i||r||(r=!0,t.error("MetaMask no longer injects web3. For details, see: https://docs.metamask.io/guide/provider-migration.html#replacing-window-web3"),e.request({method:"metamask_logWeb3ShimUsage"}).catch(e=>{t.debug("MetaMask: Failed to log web3 shim usage.",e)})):(n=!0,t.warn("You are accessing the MetaMask window.web3.currentProvider shim. This property is deprecated; use window.ethereum instead. For details, see: https://docs.metamask.io/guide/provider-migration.html#replacing-window-web3")),Reflect.get(o,a,...s)),set:(...e)=>(t.warn("You are accessing the MetaMask window.web3 shim. This object is deprecated; use window.ethereum instead. For details, see: https://docs.metamask.io/guide/provider-migration.html#replacing-window-web3"),Reflect.set(...e))}),Object.defineProperty(window,"web3",{value:o,enumerable:!1,configurable:!0,writable:!0})}}(this.provider)}catch(e){lm("[Ethereum] Unable to shim web3 - window.web3 may be read-only",e)}this.provider.on("display_uri",e=>{this.sdkInstance.emit(lI.DisplayURI,e)}),this.provider.on("_initialized",()=>{let e={chainId:this.provider.getChainId(),isConnected:this.provider.isConnected(),isMetaMask:this.provider.isMetaMask,selectedAddress:this.provider.getSelectedAddress(),networkVersion:this.provider.getNetworkVersion()};this.sdkInstance.emit(lI.Initialized,e),lm("[Ethereum: constructor()] provider initialized",e)})}static init(e){var t;return lm("[Ethereum: init()] Initializing Ethereum service"),this.instance=new lT(e),null==(t=this.instance)?void 0:t.provider}static destroy(){}static getInstance(){var e;if(!(null==(e=this.instance)?void 0:e.provider))throw Error("Ethereum instance not intiialized - call Ethereum.factory first.");return this.instance}static getProvider(){var e;if(!(null==(e=this.instance)?void 0:e.provider))throw Error("Ethereum instance not intiialized - call Ethereum.factory first.");return this.instance.provider}}class lR{constructor({useDeepLink:e,preferredOpenLink:t,debug:n=!1}){this.state={platformType:void 0,useDeeplink:!1,preferredOpenLink:void 0,debug:!1},this.state.platformType=this.getPlatformType(),this.state.useDeeplink=e,this.state.preferredOpenLink=t,this.state.debug=n}openDeeplink(e,t,n){let{state:r}=this;lm(`[PlatfformManager: openDeeplink()] universalLink --> ${e}`),lm(`[PlatfformManager: openDeeplink()] deepLink --> ${t}`);try{if(r.preferredOpenLink)return void r.preferredOpenLink(r.useDeeplink?t:e,n);if(lm(`[PlatfformManager: openDeeplink()] open link now useDeepLink=${r.useDeeplink} link=${r.useDeeplink?t:e}`),r.useDeeplink)"undefined"!=typeof window&&(window.location.href=t);else if("undefined"!=typeof document){let t=document.createElement("a");t.href=e,t.target="_self",t.rel="noreferrer noopener",t.click()}}catch(e){console.log("[PlatfformManager: openDeeplink()] can't open link",e)}}isReactNative(){var e;return this.isNotBrowser()&&"undefined"!=typeof window&&(null==window?void 0:window.navigator)&&"ReactNative"===(null==(e=window.navigator)?void 0:e.product)}isMetaMaskInstalled(){let e=lT.getProvider()||(null==window?void 0:window.ethereum);return lm(`[PlatfformManager: isMetaMaskInstalled()] isMetaMask=${null==e?void 0:e.isMetaMask} isConnected=${null==e?void 0:e.isConnected()}`),(null==e?void 0:e.isMetaMask)&&(null==e?void 0:e.isConnected())}isDesktopWeb(){return this.isBrowser()&&!this.isMobileWeb()}isMobile(){var e,t;let n=lM.parse(window.navigator.userAgent);return"mobile"===(null==(e=null==n?void 0:n.platform)?void 0:e.type)||"tablet"===(null==(t=null==n?void 0:n.platform)?void 0:t.type)}isSecure(){return this.isReactNative()||this.isMobileWeb()}isMetaMaskMobileWebView(){return"undefined"!=typeof window&&!!window.ReactNativeWebView&&!!navigator.userAgent.endsWith("MetaMaskMobile")}isMobileWeb(){return this.state.platformType===iQ.MobileWeb}static isNotBrowser(){var e;return"undefined"==typeof window||!(null==window?void 0:window.navigator)||void 0!==m&&"ReactNative"===(null==(e=null==m?void 0:m.navigator)?void 0:e.product)||"ReactNative"===(null==navigator?void 0:navigator.product)}isNotBrowser(){return lR.isNotBrowser()}static isBrowser(){return!this.isNotBrowser()}isBrowser(){return lR.isBrowser()}isNodeJS(){return this.isNotBrowser()&&!this.isReactNative()}isUseDeepLink(){return this.state.useDeeplink}getPlatformType(){let{state:e}=this;return e.platformType?e.platformType:this.isReactNative()?iQ.ReactNative:this.isNotBrowser()?iQ.NonBrowser:this.isMetaMaskMobileWebView()?iQ.MetaMaskMobileWebview:this.isMobile()?iQ.MobileWeb:iQ.DesktopWeb}}let lP=e=>g(void 0,void 0,void 0,function*(){if(lR.isBrowser()){let{StorageManagerWeb:t}=yield Promise.resolve().then(function(){return cv});return new t(e)}return Promise.resolve({persistChannelConfig:()=>g(void 0,void 0,void 0,function*(){}),getPersistedChannelConfig:()=>g(void 0,void 0,void 0,function*(){}),persistAccounts:()=>g(void 0,void 0,void 0,function*(){}),getCachedAccounts:()=>g(void 0,void 0,void 0,function*(){return[]}
6),persistChainId:()=>g(void 0,void 0,void 0,function*(){}),getCachedChainId:()=>g(void 0,void 0,void 0,function*(){}),terminate:()=>g(void 0,void 0,void 0,function*(){})})});class lO extends lg{constructor({connectionStream:e,shouldSendMetadata:t,autoRequestAccounts:n=!1}){super(e,{logger:console,maxEventListeners:100,shouldSendMetadata:t}),this.state={accounts:null,autoRequestAccounts:!1,providerStateRequested:!1,chainId:"",networkVersion:""},lm(`[SDKProvider: constructor()] autoRequestAccounts=${n}`),this.state.autoRequestAccounts=n}forceInitializeState(){return g(this,void 0,void 0,function*(){return lm(`[SDKProvider: forceInitializeState()] autoRequestAccounts=${this.state.autoRequestAccounts}`),this._initializeStateAsync()})}_setConnected(){lm("[SDKProvider: _setConnected()] Setting connected state"),this._state.isConnected=!0}getState(){return this._state}getSDKProviderState(){return this.state}getSelectedAddress(){var e;let{accounts:t}=this._state;return t&&0!==t.length?(null==(e=t[0])?void 0:e.toLowerCase())||"":(lm("[SDKProvider: getSelectedAddress] No accounts found"),null)}getChainId(){return this.state.chainId}getNetworkVersion(){return this.state.networkVersion}setSDKProviderState(e){this.state=Object.assign(Object.assign({},this.state),e)}handleAccountsChanged(e,t){return this._handleAccountsChanged(e,t)}handleDisconnect({terminate:e=!1}){!function({terminate:e=!1,instance:t}){let{state:n}=t;lm(`[SDKProvider: handleDisconnect()] cleaning up provider state terminate=${e}`,t),e&&(t._state.accounts=null,t._state.isUnlocked=!1,t._state.isPermanentlyDisconnected=!0,t._state.initialized=!1),t._handleAccountsChanged([]),t._state.isConnected=!1,t.emit("disconnect",ly.ethErrors.provider.disconnected()),n.providerStateRequested=!1}({terminate:e,instance:this})}_initializeStateAsync(){return g(this,void 0,void 0,function*(){return function(e){var t,n;return g(this,void 0,void 0,function*(){let r;void 0===e.state&&(e.state={accounts:null,autoRequestAccounts:!1,providerStateRequested:!1,chainId:""});let{state:i}=e;if(i.providerStateRequested)lm("[SDKProvider: initializeStateAsync()] initialization already in progress");else{let o;i.providerStateRequested=!0;let a=null,s=!1,l=!1,c=yield lP({enabled:!0});if(c){let e=yield c.getPersistedChannelConfig({});s=null!=(t=null==e?void 0:e.relayPersistence)&&t,o=yield c.getCachedChainId();let n=yield c.getCachedAccounts();n.length>0&&(a=n[0])}if(lm(`[SDKProvider: initializeStateAsync()] relayPersistence=${s}`,{relayPersistence:s,cachedChainId:o,cachedSelectedAddress:a}),s)if(o&&a)r={accounts:[a],chainId:o,isUnlocked:!1},l=!0;else try{r=yield e.request({method:"metamask_getProviderState"})}catch(t){return e._log.error("MetaMask: Failed to get initial state. Please report this bug.",t),void(i.providerStateRequested=!1)}if(0===(null==(n=null==r?void 0:r.accounts)?void 0:n.length))if(e.getSelectedAddress())r.accounts=[e.getSelectedAddress()];else{lm("[SDKProvider: initializeStateAsync()] Fetch accounts remotely.");let t=yield e.request({method:"eth_requestAccounts",params:[]});r.accounts=t}e._initializeState(r),i.providerStateRequested=!1,l&&(e._state.isConnected=!0,e.emit("connect",{chainId:null==r?void 0:r.chainId}))}})}(this)})}_initializeState(e){var t;return lm("[SDKProvider: _initializeState()]",e),t=super._initializeState.bind(this),lm("[SDKProvider: initializeState()] set state._initialized to false"),this._state.initialized=!1,t(e)}_handleChainChanged({chainId:e,networkVersion:t}={}){this.state.chainId=e,this.state.networkVersion=t,function({instance:e,chainId:t,networkVersion:n,superHandleChainChanged:i}){lm(`[SDKProvider: handleChainChanged()] chainId=${t} networkVersion=${n}`);let o=n;n||(lm("[SDKProvider: handleChainChanged()] forced network version to prevent provider error"),o="1"),t!==r&&(c.analytics.track("sdk_used_chain",{caip_chain_id:`eip155:${parseInt(null!=t?t:"0x1",16)}`}),r=t),e._state.isConnected=!0,e.emit("connect",{chainId:t}),i({chainId:t,networkVersion:o})}({instance:this,chainId:e,networkVersion:t,superHandleChainChanged:super._handleChainChanged.bind(this)})}}var lN,lL={version:"0.33.0"};!function(e){e.INPAGE="metamask-inpage",e.CONTENT_SCRIPT="metamask-contentscript",e.PROVIDER="metamask-provider"}(lN||(lN={}));let lD="direct",l$="https://metamask.app.link/connect",lB="metamask://connect",lK={NAME:"MetaMask",RDNS:["io.metamask","io.metamask.flask"]},lj=/(?:^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}$)|(?:^0{8}-0{4}-0{4}-0{4}-0{12}$)/u,lU={METAMASK_GETPROVIDERSTATE:"metamask_getProviderState",METAMASK_CONNECTSIGN:"metamask_connectSign",METAMASK_CONNECTWITH:"metamask_connectWith",METAMASK_OPEN:"metamask_open",METAMASK_BATCH:"metamask_batch",PERSONAL_SIGN:"personal_sign",WALLET_REQUESTPERMISSIONS:"wallet_requestPermissions",WALLET_REVOKEPERMISSIONS:"wallet_revokePermissions",WALLET_GETPE
6RMISSIONS:"wallet_getPermissions",WALLET_WATCHASSET:"wallet_watchAsset",WALLET_ADDETHEREUMCHAIN:"wallet_addEthereumChain",WALLET_SWITCHETHETHEREUMCHAIN:"wallet_switchEthereumChain",ETH_REQUESTACCOUNTS:"eth_requestAccounts",ETH_ACCOUNTS:"eth_accounts",ETH_CHAINID:"eth_chainId",ETH_SENDTRANSACTION:"eth_sendTransaction",ETH_SIGNTYPEDDATA:"eth_signTypedData",ETH_SIGNTYPEDDATA_V3:"eth_signTypedData_v3",ETH_SIGNTYPEDDATA_V4:"eth_signTypedData_v4",ETH_SIGNTRANSACTION:"eth_signTransaction",ETH_SIGN:"eth_sign",PERSONAL_EC_RECOVER:"personal_ecRecover"},lH={[lU.ETH_REQUESTACCOUNTS]:!0,[lU.ETH_SENDTRANSACTION]:!0,[lU.ETH_SIGNTRANSACTION]:!0,[lU.ETH_SIGN]:!0,[lU.PERSONAL_SIGN]:!0,[lU.ETH_ACCOUNTS]:!1,[lU.ETH_CHAINID]:!1,[lU.PERSONAL_SIGN]:!0,[lU.ETH_SIGNTYPEDDATA]:!0,[lU.ETH_SIGNTYPEDDATA_V3]:!0,[lU.ETH_SIGNTYPEDDATA_V4]:!0,[lU.WALLET_REQUESTPERMISSIONS]:!0,[lU.WALLET_GETPERMISSIONS]:!0,[lU.WALLET_WATCHASSET]:!0,[lU.WALLET_ADDETHEREUMCHAIN]:!0,[lU.WALLET_SWITCHETHETHEREUMCHAIN]:!0,[lU.METAMASK_CONNECTSIGN]:!0,[lU.METAMASK_CONNECTWITH]:!0,[lU.PERSONAL_EC_RECOVER]:!0,[lU.METAMASK_BATCH]:!0,[lU.METAMASK_OPEN]:!0},lF=Object.keys(lH).filter(e=>!0===lH[e]).map(e=>e.toLowerCase()),lz=["eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sign"].map(e=>e.toLowerCase()),lq=".sdk-comm",lW="providerType",lV=".MMSDK_cached_address",lG=".MMSDK_cached_chainId",lY={CHAIN_CHANGED:"chainChanged",ACCOUNTS_CHANGED:"accountsChanged",DISCONNECT:"disconnect",CONNECT:"connect",CONNECTED:"connected"};!function(e){e.TERMINATE="terminate",e.EXTENSION="extension",e.INITIALIZED="initialized"}(cq||(cq={}));let lZ="undefined"!=typeof window&&window.localStorage;function lJ(e){var t,n;return g(this,void 0,void 0,function*(){lm("[MetaMaskSDK: connectWithExtensionProvider()] ",e),e.sdkProvider=e.activeProvider,e.activeProvider=window.extension,window.ethereum=window.extension;try{let e=yield null==(t=window.extension)?void 0:t.request({method:"eth_requestAccounts"});lm(`[MetaMaskSDK: connectWithExtensionProvider()] accounts=${e}`)}catch(e){return void console.warn("[MetaMaskSDK: connectWithExtensionProvider()] can't request accounts error",e)}localStorage.setItem(lW,"extension"),e.extensionActive=!0,e.emit(lI.ProviderUpdate,cq.EXTENSION),e.options.enableAnalytics&&(null==(n=e.analytics)||n.send({event:iG.SDK_USE_EXTENSION}))})}function lQ(e){let t;if(void 0!==T)t=T.from(e,"utf8").toString("base64");else if("function"==typeof btoa)t=btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/gu,(e,t)=>String.fromCharCode(parseInt(t,16))));else{if("object"!=typeof m||!("Buffer"in m))throw Error("Unable to base64 encode: No available method.");t=m.Buffer.from(e,"utf8").toString("base64")}return t}class lX extends s6.Duplex{constructor({name:e,remote:t,deeplinkProtocol:n,platformManager:r}){super({objectMode:!0}),this.state={_name:null,remote:null,deeplinkProtocol:!1,platformManager:null},this.state._name=e,this.state.remote=t,this.state.deeplinkProtocol=n,this.state.platformManager=r,this._onMessage=this._onMessage.bind(this),this.state.remote.on(iz.MESSAGE,this._onMessage)}_write(e,t,n){return g(this,void 0,void 0,function*(){return function(e,t,n,r){var i,o,a,s,l,c,d,u,h,f,p,m,y,v,b,E,w,S,_,C;return g(this,void 0,void 0,function*(){let n=null==(i=e.state.remote)?void 0:i.isReady(),g=null==(o=e.state.remote)?void 0:o.isConnected(),x=null==(a=e.state.remote)?void 0:a.isPaused(),k=lT.getProvider(),A=null==(s=e.state.remote)?void 0:s.getChannelId(),M=null==(l=e.state.remote)?void 0:l.isAuthorized(),{deeplinkProtocol:I}=e.state,{method:R,data:P,triggeredInstaller:O}=(e=>{var t,n,r,i;let o;T.isBuffer(e)?(o=e.toJSON())._isBuffer=!0:o=e;let a=null==(t=null==o?void 0:o.data)?void 0:t.method,s=!1;return"object"==typeof(null==(n=null==o?void 0:o.data)?void 0:n.params)&&!0===(null==(i=null==(r=null==o?void 0:o.data)?void 0:r.params)?void 0:i.__triggeredInstaller)&&(s=!0,o.data.params=o.data.params.wrappedParams),{method:a,data:o,triggeredInstaller:s}})(t);if(lm(`[RCPMS: write()] method='${R}' isRemoteReady=${n} channelId=${A} isSocketConnected=${g} isRemotePaused=${x} providerConnected=${k.isConnected()}`,t),!A)return R!==lU.METAMASK_GETPROVIDERSTATE&&lm(`[RCPMS: write()] ${R} --> channelId is undefined`),r(Error("disconnected"));
6lm(`[RCPMS: write()] remote.isPaused()=${null==(c=e.state.remote)?void 0:c.isPaused()} authorized=${M} ready=${n} socketConnected=${g}`,t);let N=null==(d=e.state.platformManager)?void 0:d.isSecure(),L=null!=(h=null==(u=e.state.platformManager)?void 0:u.isMobileWeb())&&h,D=null!=(p=null==(f=e.state.remote)?void 0:f.hasDeeplinkProtocol())&&p&&L&&M;try{if(!O){let t=JSON.stringify(null==P?void 0:P.data);if(t.length>1e6)return r(Error(`Message size ${t.length} exceeds maximum allowed size of 1000000 bytes`));null==(m=e.state.remote)||m.sendMessage(null==P?void 0:P.data).then(()=>{lm(`[RCPMS: _write()] ${R} sent successfully`)}).catch(e=>{lm("[RCPMS: _write()] error sending message",e)})}if(!N)return lm(`[RCPMS: _write()] unsecure platform for method ${R} -- return callback`),r();if(O)return lm("[RCPMS: _write()] prevent deeplink -- installation completed separately."),r();let t=null!=(b=null==(v=null==(y=e.state.remote)?void 0:y.getKeyInfo())?void 0:v.ecies.public)?b:"",n=encodeURI(`channelId=${A}&pubkey=${t}&comm=socket&t=d&v=2`);if(D){let t=JSON.stringify(null==P?void 0:P.data),i=null==(E=e.state.remote)?void 0:E.encrypt(t);if(!i)return lm("[RCPMS: _write()] error encrypting message"),r(Error("RemoteCommunicationPostMessageStream - disconnected"));n+=`&scheme=${I}&rpc=${lQ(i)}`}if(!(null==(w=e.state.platformManager)?void 0:w.isMetaMaskInstalled()))return lm("[RCPMS: _write()] prevent deeplink until installation is completed."),r();lH[R]?(lm(`[RCPMS: _write()] redirect link for '${R}' socketConnected=${g} connect?${n}`),null==(S=e.state.platformManager)||S.openDeeplink(`${l$}?${n}`,`${lB}?${n}`,"_self")):(null==(_=e.state.remote)?void 0:_.isPaused())?(lm(`[RCPMS: _write()] MM is PAUSED! deeplink with connect! targetMethod=${R}`),null==(C=e.state.platformManager)||C.openDeeplink(`${l$}?redirect=true&${n}`,`${lB}?redirect=true&${n}`,"_self")):lm(`[RCPMS: _write()] method ${R} doesn't need redirect.`)}catch(e){return lm("[RCPMS: _write()] error sending message",e),r(Error("RemoteCommunicationPostMessageStream - disconnected"))}return r()})}(this,e,0,n)})}_read(){}_onMessage(e){try{if(lm("[RCPMS: onMessage()] message",e),!e||"object"!=typeof e||"object"!=typeof(null==e?void 0:e.data))return;if(!(null==e?void 0:e.name))return void lm("[RCPMS: onMessage()] ignore message without name",e);if((null==e?void 0:e.name)!==lN.PROVIDER)return void lm(`[RCPMS: onMessage()] ignore message with wrong name message=${e}`);if(T.isBuffer(e)){let t=T.from(e);this.push(t)}else this.push(e)}catch(e){lm(`[RCPMS: onMessage()] ignore message error err=${e}`)}}start(){}}let l0=1,l1=e=>new Promise(t=>{setTimeout(()=>{t(!0)},e)}),l2=({checkInstallationOnAllCalls:e=!1,communicationLayerPreference:t,injectProvider:n,shouldShimWeb3:r,platformManager:i,installer:o,sdk:s,remoteConnection:l,debug:c})=>g(void 0,void 0,void 0,function*(){var d,u;let h=(({name:e,remoteConnection:t})=>{if(!t||!(null==t?void 0:t.getConnector()))throw Error("Missing remote connection parameter");return new lX({name:e,remote:null==t?void 0:t.getConnector(),deeplinkProtocol:null==t?void 0:t.state.deeplinkProtocol,platformManager:null==t?void 0:t.getPlatformManager()})})({name:lN.INPAGE,target:lN.CONTENT_SCRIPT,platformManager:i,communicationLayerPreference:t,remoteConnection:l}),f=i.getPlatformType(),p=s.options.dappMetadata,m=`Sdk/Javascript SdkVersion/${lL.version} Platform/${f} dApp/${null!=(d=p.url)?d:p.name} dAppTitle/${p.name}`,y=null,v=null,b=null==(u=s.options.storage)?void 0:u.storageManager;if(b){try{let e=yield b.getCachedAccounts();e.length>0&&(y=e[0])}catch(e){console.error(`[initializeMobileProvider] failed to get cached addresses: ${e}`)}try{let e=yield b.getCachedChainId();e&&(v=e)}catch(e){console.error(`[initializeMobileProvider] failed to parse cached chainId: ${e}`)}}lm(`[initializeMobileProvider] cachedAccountAddress: ${y}, cachedChainId: ${v}`);let E=!(!n||f===iQ.NonBrowser||f===iQ.ReactNative),w=lT.init({shouldSetOnWindow:E,connectionStream:h,shouldShimWeb3:r,sdkInstance:s}),S=!1,_=e=>{S=e},C=()=>S,x=(t,n,r,c)=>g(void 0,void 0,void 0,function*(){var d,u,h,f,p,E,w,x,k;let A=lT.getProvider();if(S){A.emit("display_uri",(null==l?void 0:l.state.qrcodeLink)||""),null==l||l.showActiveModal();let e=C();for(;e;){let t=C(),n=null==l?void 0:l.isAuthorized();e=t&&!n,lm(`[initializeMobileProvider: sendRequest()] waiting for initialization to complete - initializing: ${t} authorized: ${n}`),yield l1(1e3)}return lm("[initializeMobileProvider: sendRequest()] initial method completed -- prevent installation and call provider"),r(...n)}let M=i.isMetaMaskInstalled(),I=null==l?void 0:l.isConnected(),T=null,R=null,P=null;if(T=null!=(d=A.getSelectedAddress())?d:y,P=A.getChainId()||v,T&&b&&T!==y&&b.persistAccounts([T]).catch(e=>{console.error(`[initializeMobileProvider] failed to persist account: ${e}`)}
6),P&&(v=P,b&&b.persistChainId(P).catch(e=>{console.error(`[initializeMobileProvider] failed to persist chainId: ${e}`)})),lm("[initializeMobileProvider: sendRequest()]",{selectedAddress:T,chainId:P}),c&&lm(`[initializeMobileProvider: sendRequest()] method=${t} ongoing=${S} selectedAddress=${T} isInstalled=${M} checkInstallationOnAllCalls=${e} socketConnected=${I}`),T&&t.toLowerCase()===lU.ETH_ACCOUNTS.toLowerCase())return[T];if(P&&t.toLowerCase()===lU.ETH_CHAINID.toLowerCase())return P;let O=[lU.ETH_REQUESTACCOUNTS,lU.WALLET_REQUESTPERMISSIONS,lU.METAMASK_CONNECTSIGN,lU.METAMASK_CONNECTWITH],N=!lH[t],L=null==(u=s.options.readonlyRPCMap)?void 0:u[P];if(L&&N)try{let e=null==(h=null==n?void 0:n[0])?void 0:h.params,r=yield(({rpcEndpoint:e,method:t,sdkInfo:n,params:r})=>g(void 0,void 0,void 0,function*(){let i,o=JSON.stringify({jsonrpc:"2.0",method:t,params:r,id:l0+=1}),s={Accept:"application/json","Content-Type":"application/json"};e.includes("infura")&&(s["Metamask-Sdk-Info"]=n);try{i=yield a()(e,{method:"POST",headers:s,body:o})}catch(e){throw e instanceof Error?Error(`Failed to fetch from RPC: ${e.message}`):Error(`Failed to fetch from RPC: ${e}`)}if(!i.ok)throw Error(`Server responded with a status of ${i.status}`);return(yield i.json()).result}))({rpcEndpoint:L,sdkInfo:m,method:t,params:e||[]});return c&&lm(`initializeProvider::ReadOnlyRPCResponse ${r}`),r}catch(e){console.warn(`[initializeMobileProvider: sendRequest()] method=${t} readOnlyRPCRequest failed:`,e)}if((!M||M&&!I)&&t!==lU.METAMASK_GETPROVIDERSTATE){let a=(null==(f=null==n?void 0:n[0])?void 0:f.params)||[];if(-1!==O.indexOf(t)||e){_(!0);let e=t===lU.METAMASK_CONNECTWITH,i=`${Date.now()}`;try{yield o.start({wait:!1,connectWith:e?{method:t,id:i,params:a}:void 0}),yield new Promise((e,t)=>{(null==l?void 0:l.isAuthorized())&&(lm("[initializeMobileProvider: sendRequest()] already authorized"),e(!0)),null==l||l.getConnector().once(iz.AUTHORIZED,()=>{e(!0)}),s.once(iz.PROVIDER_UPDATE,e=>{lm(`[initializeMobileProvider: sendRequest()] PROVIDER_UPDATE --- remote provider request interupted type=${e}`),e===cq.EXTENSION?t(iz.PROVIDER_UPDATE):t(Error("Connection Terminated"))})})}catch(e){if(cq.EXTENSION===e){if(lm(`[initializeMobileProvider: sendRequest()] extension provider detect: re-create ${t} on the active provider`),t.toLowerCase()===lU.METAMASK_CONNECTSIGN.toLowerCase()){let e=yield null==(p=s.getProvider())?void 0:p.request({method:lU.ETH_REQUESTACCOUNTS,params:[]});if(!e.length)throw Error("SDK state invalid -- undefined accounts");let t=yield null==(E=s.getProvider())?void 0:E.request({method:lU.PERSONAL_SIGN,params:[a[0],e[0]]});return s.emit(lI.ConnectWithResponse,t),t}if(t.toLowerCase()===lU.METAMASK_CONNECTWITH.toLowerCase()){let[e]=a,t=yield(({method:e,sdk:t,params:n})=>g(void 0,void 0,void 0,function*(){var r,i,o,a;if(!t.isExtensionActive())throw Error("SDK state invalid -- extension is not active");lm("[MetaMaskProvider: extensionConnectWithOverwrite()] Overwriting request method",e,n);let s=yield null==(r=t.getProvider())?void 0:r.request({method:lU.ETH_REQUESTACCOUNTS,params:[]});if(!s.length)throw Error("SDK state invalid -- undefined accounts");if((null==e?void 0:e.toLowerCase())===lU.PERSONAL_SIGN.toLowerCase()){let r={method:e,params:[n[0],s[0]]};return yield null==(i=t.getProvider())?void 0:i.request(r)}if((null==e?void 0:e.toLowerCase())===lU.ETH_SENDTRANSACTION.toLowerCase()){let r={method:e,params:[Object.assign(Object.assign({},n[0]),{from:s[0]})]};return yield null==(o=t.getProvider())?void 0:o.request(r)}return lz.includes(e.toLowerCase())?(console.warn(`MetaMaskSDK connectWith method=${e} -- not handled by the extension -- call separately`),s):yield null==(a=t.getProvider())?void 0:a.request({method:e,params:n})}))({method:e.method,sdk:s,params:e.params});return s.emit(lI.ConnectWithResponse,t),t}return lm(`[initializeMobileProvider: sendRequest()] sending '${t}' on active provider`,a),yield null==(w=s.getProvider())?void 0:w.request({method:t,params:a})}if(e===iz.REJECTED)throw null==l||l.closeModal(),null==(x=s.getProvider())||x.handleDisconnect({terminate:!1}),Object.assign(Error("User rejected connection"),{code:4001});throw lm(`[initializeMobileProvider: sendRequest()] failed to start installer: ${e}`),e}finally{_(!1)}
6if(t===lU.ETH_REQUESTACCOUNTS)return R=yield new Promise(e=>{let t=setInterval(()=>{let{accounts:n}=A.getState();n&&(clearInterval(t),e(n))},100)}),lm(`[initializeMobileProvider: sendRequest()] selectedAddress: ${T} --- SKIP rpc call`),R;if(t===lU.METAMASK_CONNECTWITH)try{let e,t,n=0,r=({resolve:e,reject:t})=>{n+=1;let r=null==l?void 0:l.getConnector().getRPCMethodTracker(),o=null==r?void 0:r[i];return lm(`TRACKER: update method ${i}`,o),(null==o?void 0:o.result)?(lm("[initializeMobileProvider: sendRequest()] found result",o.result),s.emit(lI.ConnectWithResponse,o.result),void e(o.result)):(null==o?void 0:o.error)?(lm("[initializeMobileProvider: sendRequest()] found error",o.error),void t(o.error)):n>=5?(lm("[initializeMobileProvider: sendRequest()] max message count reached without result"),void t(Error("Max message count reached without result"))):void lm("[initializeMobileProvider: sendRequest()] not found yet, need to wait for next update")},o=yield new Promise((n,o)=>{let a=null==l?void 0:l.getConnector().getRPCMethodTracker();lm(`TRACKER: method ${i}`,a),(null==a?void 0:a[i].result)?(lm("[initializeMobileProvider: sendRequest()] found result",null==a?void 0:a[i].result),n(null==a?void 0:a[i].result)):(null==a?void 0:a[i].error)&&(lm("[initializeMobileProvider: sendRequest()] found error",null==a?void 0:a[i].error),o(null==a?void 0:a[i].error)),t=()=>r({resolve:n,reject:o}),e=null==l?void 0:l.getConnector().on(iz.RPC_UPDATE,t)});return t&&(null==e||e.off(iz.RPC_UPDATE,t)),lm("TRACKER: result",o),o}catch(e){throw lm("[initializeMobileProvider: sendRequest()] error:",e),e}return n[0]&&"object"==typeof n[0]&&(n[0].params={__triggeredInstaller:!0,wrappedParams:n[0].params}),r(...n)}if(i.isSecure()&&lH[t])return r(...n);if(s.isExtensionActive())return lm(`[initializeMobileProvider: sendRequest()] EXTENSION active - redirect request '${t}' to it`,n,a),yield null==(k=s.getProvider())?void 0:k.request({method:t,params:a});throw lm(`[initializeMobileProvider: sendRequest()] method=${t} --- skip --- not connected/installed`),Error("MetaMask is not connected/installed, please call eth_requestAccounts to connect first.")}try{let e=yield r(...n);if(lm(`[initializeMobileProvider: sendRequest()] method=${t} rpcResponse`,e),t===lU.WALLET_REQUESTPERMISSIONS){let t=e.reduce((e,t)=>{var n;if("eth_accounts"===t.parentCapability){let r=null==(n=t.caveats.find(e=>"restrictReturnedAccounts"===e.type))?void 0:n.value;r&&e.push(...r)}return e},[]);lm("[initializeMobileProvider: sendRequest()] accountsToPersist:",t),t.length>0&&(A.handleAccountsChanged(t,!1),null==b||b.persistAccounts(t))}return e}catch(e){throw console.error("[initializeMobileProvider: sendRequest()] error:",e),e}}),{request:k}=w;w.request=(...e)=>g(void 0,void 0,void 0,function*(){return x(null==e?void 0:e[0].method,e,k,c)});let{send:A}=w;return w.send=(...e)=>g(void 0,void 0,void 0,function*(){return x(null==e?void 0:e[0],e,A,c)}),lm("[initializeMobileProvider: sendRequest()] metamaskStream.start()"),h.start(),w});class l3{constructor({serverUrl:e,enabled:t,originatorInfo:n}){this.serverURL=rW,this.serverURL=e,this.originatorInfo=n,this.enabled=null==t||t}send({event:e,params:t}){if(!this.enabled)return;let n=Object.assign(Object.assign({id:"sdk",event:e,sdkVersion:lL.version},this.originatorInfo),{params:t});lm(`[Analytics: send()] event: ${e}`,n),rF(n,this.serverURL).catch(e=>{lm(`[Analytics: send()] error: ${e}`)})}}let l5=()=>{let e;if("undefined"==typeof document)return;let t=document.getElementsByTagName("link");for(let n=0;n<t.length;n++)"icon"!==t[n].getAttribute("rel")&&"shortcut icon"!==t[n].getAttribute("rel")||(e=t[n].getAttribute("href"));return e};function l8(e){var t,n,r;let{dappMetadata:i}=e,o=function({url:e,name:t}){var n;let r=lQ(e+t);if(!localStorage)return"";let i=null!=(n=localStorage.getItem(r))?n:"";if(!i){i=(0,h.A)();try{localStorage.setItem(r,i)}catch(e){return""}}return i}({url:null!=(t=null==i?void 0:i.url)?t:"no_url",name:null!=(n=null==i?void 0:i.name)?n:"no_name"}),a=null==(r=e.platformManager)?void 0:r.getPlatformType(),s=a===iQ.DesktopWeb,l=a===iQ.MetaMaskMobileWebview,c="N/A";return s?c="extension":l&&(c="mobile"),{id:o,from:c}}let l6=(e,t,n)=>{if(rZ(e))if(n||t&&"object"==typeof t&&null!==t&&"error"in t){let r=n||(null==t?void 0:t.error);r&&4001===r.code?c.analytics.track("sdk_action_rejected",{action:e}):c.analytics.track("sdk_action_failed",{action:e})}else c.analytics.track("sdk_action_succeeded",{action:e})},l4=({provider:e,sdkInstance:t})=>{if("state"in e)throw Error("INVALID EXTENSION PROVIDER");return new Proxy(e,{get:(n,r)=>"request"===r?function(e){var r,i;return g(this,void 0,void 0,function*(){lm("[wrapExtensionProvider()] Overwriting request method",e);let{method:o,params:a}=e,s=lF.includes(o.toLowerCase()),{id:l,from:d}=l8(t);if(s&&(null==(r=t.analytics)||r.send({event:iG.SDK_RPC_REQUEST,params:{method:o,from:d,id:l}})),rZ(o)&&c.analytics.track("sdk_action_requested",{action:o}),o===lU.METAMASK_BATCH&&Array.isArray(a))return(({target:e,args:t,trackEvent:n,sdkInstance:r})=>g(void 0,void 0,void 0,function*(){var i,o;if("metamask_batch"!==t.method)throw Error("Invalid usage");let a=[];for(let n of null!=(i=null==t?void 0:t.params)?i:[]){let t=yield null==e?void 0:e.request({method:n.method,params:n.params});a.push(t)}let{id:s,from:l}=l8(r);for(let e of(n&&(null==(o=r.analytics)||o.send({event:iG.SDK_RPC_REQUEST_DONE,params:{method:t.method,from:l,id:s}})),a))l6(t.method,e,null);return a}))({target:n,args:e,trackEvent:s,sdkInstance:t});if(o.toLowerCase()===lU.METAMASK_CONNECTSIGN.toLowerCase()&&Array.isArray(a))return(({target:e,params:t})=>g(void 0,void 0,void 0,function*(){let n,r=null;try{let r=yield e.request({method:lU.ETH_REQUESTACCOUNTS,params:[]});if(!r.length)throw Error("SDK state invalid -- undefined accounts");return n=yield e.request({method:lU.PERSONAL_SIGN,params:[t[0],r[0]]})}catch(e){throw r=e,e}
6finally{l6(lU.PERSONAL_SIGN,n,r)}}))({target:n,params:a});if(o.toLowerCase()===lU.METAMASK_CONNECTWITH.toLowerCase()&&Array.isArray(a))return(({target:e,params:t})=>g(void 0,void 0,void 0,function*(){let[n]=t,r=n.method,i=n.params,o,a=null;try{let t=yield e.request({method:lU.ETH_REQUESTACCOUNTS,params:[]});if(!Array.isArray(t)||!t.length)throw Error("SDK state invalid -- undefined accounts");return(null==r?void 0:r.toLowerCase())===lU.PERSONAL_SIGN.toLowerCase()?o=yield e.request({method:r,params:[i[0],t[0]]}):(null==r?void 0:r.toLowerCase())===lU.ETH_SENDTRANSACTION.toLowerCase()?o=yield e.request({method:r,params:[Object.assign(Object.assign({},i[0]),{from:t[0]})]}):lz.includes(r.toLowerCase())?(console.warn(`MetaMaskSDK connectWith method=${r} -- not handled by the extension -- call separately`),o=t):o=yield e.request({method:r,params:i})}catch(e){throw a=e,e}finally{l6(r,o,a)}}))({target:n,params:a});let u,h=null;try{return u=yield n.request(e)}catch(e){throw h=e,e}finally{s&&(null==(i=t.analytics)||i.send({event:iG.SDK_RPC_REQUEST_DONE,params:{method:o,from:d,id:l}})),l6(o,u,h)}})}:"getChainId"===r?function(){return e.chainId}:"getNetworkVersion"===r?function(){return e.networkVersion}:"getSelectedAddress"===r?function(){return e.selectedAddress}:"isConnected"===r?function(){return e._state.isConnected}:n[r]})};!function(e){e.Announce="eip6963:announceProvider",e.Request="eip6963:requestProvider"}(cW||(cW={}));let l9=e=>g(void 0,void 0,void 0,function*(){let{options:t}=e,{infuraAPIKey:n}=t;if(!n)return;let r={"0x1":`https://mainnet.infura.io/v3/${n}`,"0x5":`https://goerli.infura.io/v3/${n}`,"0xaa36a7":`https://sepolia.infura.io/v3/${n}`,"0xe708":`https://linea-mainnet.infura.io/v3/${n}`,"0xe704":`https://linea-goerli.infura.io/v3/${n}`,"0x89":`https://polygon-mainnet.infura.io/v3/${n}`,"0x13881":`https://polygon-mumbai.infura.io/v3/${n}`,"0x45":`https://optimism-mainnet.infura.io/v3/${n}`,"0x1a4":`https://optimism-goerli.infura.io/v3/${n}`,"0xa4b1":`https://arbitrum-mainnet.infura.io/v3/${n}`,"0x66eed":`https://arbitrum-goerli.infura.io/v3/${n}`,"0x2a15c308d":`https://palm-mainnet.infura.io/v3/${n}`,"0x2a15c3083":`https://palm-testnet.infura.io/v3/${n}`,"0xa86a":`https://avalanche-mainnet.infura.io/v3/${n}`,"0xa869":`https://avalanche-fuji.infura.io/v3/${n}`,"0x4e454152":`https://aurora-mainnet.infura.io/v3/${n}`,"0x4e454153":`https://aurora-testnet.infura.io/v3/${n}`,"0x534e5f4d41494e":`https://starknet-mainnet.infura.io/v3/${n}`,"0x534e5f474f45524c49":`https://starknet-goerli.infura.io/v3/${n}`,"0x534e5f474f45524c4932":`https://starknet-goerli2.infura.io/v3/${n}`,"0xa4ec":`https://celo-mainnet.infura.io/v3/${n}`,"0xaef3":`https://celo-alfajores.infura.io/v3/${n}`};e.options.readonlyRPCMap?e.options.readonlyRPCMap=Object.assign(Object.assign({},e.options.readonlyRPCMap),r):e.options.readonlyRPCMap=r}),l7=e=>g(void 0,void 0,void 0,function*(){let{options:t}=e,{readonlyRPCMap:n}=t;if(n)try{lm("[MetaMaskSDK: setupReadOnlyRPCProviders()] Setting up Readonly RPC Providers",n),e.setReadOnlyRPCCalls(!0)}catch(e){throw Error("Invalid Infura Settings")}});var ce="INSTALLED",ct="NOT_INSTALLED",cn="REGISTERED",cr="REGISTERING",ci="RELOADING",co={CHROME:"https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn",FIREFOX:"https://addons.mozilla.org/firefox/addon/ether-metamask/",DEFAULT:"https://metamask.io"},ca="REGISTRATION_IN_PROGRESS",cs="FORWARDER_ID",cl=function(){function e(t){var n=void 0===t?{}:t,r=n.forwarderOrigin,i=n.forwarderMode,o=void 0===i?e.FORWARDER_MODE.INJECT:i;this.forwarderOrigin=void 0===r?"https://fwd.metamask.io":r,this.forwarderMode=o,this.state=e.isMetaMaskInstalled()?ce:ct;var a=e._detectBrowser();this.downloadUrl=a?co[a]:co.DEFAULT,this._onMessage=this._onMessage.bind(this),this._onMessageFromForwarder=this._onMessageFromForwarder.bind(this),this._openForwarder=this._openForwarder.bind(this),this._openDownloadPage=this._openDownloadPage.bind(this),this.startOnboarding=this.startOnboarding.bind(this),this.stopOnboarding=this.stopOnboarding.bind(this),window.addEventListener("message",this._onMessage),o===e.FORWARDER_MODE.INJECT&&"true"===sessionStorage.getItem(ca)&&e._injectForwarder(this.forwarderOrigin)}return e.prototype._onMessage=function(e){if(e.origin===this.forwarderOrigin)return"metamask:reload"===e.data.type?this._onMessageFromForwarder(e):void console.debug("Unknown message from '"+e.origin+"' with data "+JSON.stringify(e.data))},e.prototype._onMessageUnknownStateError=function(e){throw Error("Unknown state: '"+e+"'")},e.prototype._onMessageFromForwarder=function(t){var n,r,i;return n=this,r=void 0,i=function(){return function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){var l=[o,s];if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&l[0]?r.return:l[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,l[1])).done)return i;switch(r=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return a.label++,{value:l[1],done:!1};case 5:a.label++,r=l[1],l=[0];continue;case 7:l=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===l[0]||2===l[0])){a=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){a.label=l[1];break}if(6===l[0]&&a.label<i[1]){a.label=i[1],i=l;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(l);break}i[2]&&a.ops.pop(),a.trys.pop();continue}l=t.call(e,a)}catch(e){l=[6,e],r=0}finally{n=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(n){switch(n.label){case 0:switch(this.state){case ci:return[3,1];case ct:return[3,2];case ce:return[3,3];case cr:return[3,5];case cn:return[3,6]}return[3,7];case 1:return console.debug("Ignoring message while reloading"),[3,8];case 2:return console.debug("Reloading now to register with MetaMask"),this.state=ci,location.reload(),[3,8];case 3:return console.debug("Registering with MetaMask"),this.state=cr,[4,e._register()];case 4:return n.sent(),this.state=cn,t.source.postMessage({type:"metamask:registrationCompleted"},t.origin),this.stopOnboarding(),[3,8];case 5:return console.debug("Already registering - ignoring reload message"),[3,8];case 6:return console.debug("Already registered - ignoring reload message"),[3,8];case 7:this._onMessageUnknownStateError(this.state),n.label=8;case 8:return[2]}})},new(r||(r=Promise))(function(e,t){function o(e){try{s(i.next(e))}catch(e){t(e)}}function a(e){try{s(i.throw(e))}catch(e){t(e)}}function s(t){var n;t.done?e(t.value):((n=t.value)instanceof r?n:new r(function(e){e(n)})).then(o,a)}s((i=i.apply(n,[])).next())})},e.prototype.startOnboarding=function(){sessionStorage.setItem(ca,"true"),this._openDownloadPage(),this._openForwarder()},e.prototype.stopOnboarding=function(){"true"===sessionStorage.getItem(ca)&&(this.forwarderMode===e.FORWARDER_MODE.INJECT&&(console.debug("Removing forwarder"),e._removeForwarder()),sessionStorage.setItem(ca,"false"))},e.prototype._openForwarder=function(){this.forwarderMode===e.FORWARDER_MODE.OPEN_TAB?window.open(this.forwarderOrigin,"_blank"):e._injectForwarder(this.forwarderOrigin)},e.prototype._openDownloadPage=function(){window.open(this.downloadUrl,"_blank")},e.isMetaMaskInstalled=function(){return!!(window.ethereum&&window.ethereum.isMetaMask)},e._register=function(){return window.ethereum.request({method:"wallet_registerOnboarding"})},e._injectForwarder=function(e){var t=document.body,n=document.createElement("iframe");n.setAttribute("height","0"),n.setAttribute("width","0"),n.setAttribute("style","display: none;"),n.setAttribute("src",e),n.setAttribute("id",cs),t.insertBefore(n,t.children[0])},e._removeForwarder=function(){var e;
6null==(e=document.getElementById(cs))||e.remove()},e._detectBrowser=function(){var e=lM.parse(window.navigator.userAgent);return"Firefox"===e.browser.name?"FIREFOX":["Chrome","Chromium"].includes(e.browser.name||"")?"CHROME":null},e.FORWARDER_MODE={INJECT:"INJECT",OPEN_TAB:"OPEN_TAB"},e}();class cc{constructor({remote:e,preferDesktop:t,platformManager:n,debug:r=!1}){this.state={isInstalling:!1,hasInstalled:!1,resendRequest:null,preferDesktop:!1,platformManager:null,remote:null,debug:!1,connectWith:void 0},this.state.remote=e,this.state.preferDesktop=t,this.state.platformManager=n,this.state.debug=r}startDesktopOnboarding(){return function(){return g(this,void 0,void 0,function*(){lm("[MetamaskInstaller: startDesktopOnboarding() starting desktop onboarding"),window.ethereum&&(window.ethereum=void 0),(new cl).startOnboarding()})}()}redirectToProperInstall(){return g(this,void 0,void 0,function*(){return function(e){var t,n;return g(this,void 0,void 0,function*(){let{state:r}=e,i=null==(t=r.platformManager)?void 0:t.getPlatformType();if(lm(`[MetamaskInstaller: redirectToProperInstall()] platform=${i}`),i===iQ.MetaMaskMobileWebview)return!1;r.isInstalling=!0;try{yield null==(n=r.remote)?void 0:n.startConnection({connectWith:r.connectWith}),r.isInstalling=!1,r.hasInstalled=!0}catch(e){throw r.isInstalling=!1,e}return!0})}(this)})}checkInstallation(){return g(this,void 0,void 0,function*(){return function(e){var t;return g(this,void 0,void 0,function*(){let{state:n}=e,r=null==(t=n.platformManager)?void 0:t.isMetaMaskInstalled();return lm(`[MetamaskInstaller: checkInstallation()] isInstalled=${r}`),!!r||(yield e.redirectToProperInstall())})}(this)})}start({wait:e=!1,connectWith:t}){return g(this,void 0,void 0,function*(){this.state.connectWith=t,lm(`[MetaMaskInstaller: start()] wait=${e}`,t),yield function(e,{wait:t=!1}){return g(this,void 0,void 0,function*(){return lm(`[MetamaskInstaller: startInstaller()] wait=${t}`),t&&(yield l1(1e3)),yield e.checkInstallation()})}(this,{wait:e})})}}class cd{constructor({debug:e,sdkVersion:t}){this.containers={install:void 0,pending:void 0,select:void 0},this.defined={install:!1,pending:!1,select:!1},this.debug=null!=e&&e,this.sdkVersion=t}loadComponent(e){return g(this,void 0,void 0,function*(){if(!this.defined[e]){this.defined[e]=!0;try{let e=yield Promise.resolve().then(function(){return dO});console.log("loader",e),e.defineCustomElements()}catch(t){console.error(`Failed to load ${e} modal:`,t)}}})}renderInstallModal(e){var t;return g(this,void 0,void 0,function*(){this.debug&&console.debug("ModalLoader: renderInstallModal",e),this.containers.install=e.parentElement,yield this.loadComponent("install");let n=document.createElement("mm-install-modal");n.link=e.link,n.preferDesktop=e.preferDesktop,n.sdkVersion=null!=(t=e.sdkVersion)?t:this.sdkVersion,n.addEventListener("close",({detail:{shouldTerminate:t}})=>e.onClose(t)),n.addEventListener("startDesktopOnboarding",e.metaMaskInstaller.startDesktopOnboarding),n.addEventListener("trackAnalytics",t=>{var n;return null==(n=e.onAnalyticsEvent)?void 0:n.call(e,t.detail)}),e.parentElement.appendChild(n)})}renderSelectModal(e){var t;return g(this,void 0,void 0,function*(){this.containers.select=e.parentElement,yield this.loadComponent("select");let n=document.createElement("mm-select-modal");n.link=e.link,n.sdkVersion=null!=(t=e.sdkVersion)?t:this.sdkVersion,n.preferDesktop=e.preferDesktop,n.addEventListener("close",({detail:{shouldTerminate:t}})=>e.onClose(t)),n.addEventListener("connectWithExtension",e.connectWithExtension),e.parentElement.appendChild(n),setTimeout(()=>this.updateQRCode(e.link),100)})}renderPendingModal(e){var t;return g(this,void 0,void 0,function*(){this.containers.pending=e.parentElement,yield this.loadComponent("pending");let n=document.createElement("mm-pending-modal");n.sdkVersion=null!=(t=e.sdkVersion)?t:this.sdkVersion,n.displayOTP=e.displayOTP,n.addEventListener("close",e.onClose),n.addEventListener("updateOTPValue",({detail:{otpValue:t}})=>e.updateOTPValue(t)),e.onDisconnect&&n.addEventListener("disconnect",e.onDisconnect),e.parentElement.appendChild(n)})}updateOTPValue(e){let t=()=>{var t;let n=null==(t=this.containers.pending)?void 0:t.querySelector("mm-pending-modal");return!!n&&(n.otpCode=e,!0)};setTimeout(()=>{t()},800)}updateQRCode(e){var t,n;let r=null==(t=this.containers.install)?void 0:t.querySelector("mm-install-modal");if(r)r.link=e;else{let t=null==(n=this.containers.select)?void 0:n.querySelector("mm-select-modal");t&&(t.link=e)}}
6unmount(){Object.entries(this.containers).forEach(([e,t])=>{var n;null==(n=null==t?void 0:t.parentNode)||n.removeChild(t),this.containers[e]=void 0})}}let cu=({link:e,debug:t,installer:n,terminate:r,connectWithExtension:i,preferDesktop:o,onAnalyticsEvent:a})=>{let s=null,l=null;lm("[UI: InstallModal-web: sdkWebInstallModal()] ################## Installing Modal #################"),lm(`[UI: InstallModal-web: sdkWebInstallModal()] link=${e}`),lm(`[UI: InstallModal-web: sdkWebInstallModal()] npx uri-scheme open "${e}" --ios`),lm(`[UI: InstallModal-web: sdkWebInstallModal()] npx uri-scheme open "${e}" --android`),lm(`[UI: InstallModal-web: sdkWebInstallModal()] adb shell am start -a android.intent.action.VIEW -d "${e}"`);let c=e=>{var t;lm("[UI: InstallModal-web: sdkWebInstallModal()] installModal-web unmounting install modal -- shouldTerminate:",e,l),(null==l?void 0:l.parentNode)&&(null==(t=l.parentNode)||t.removeChild(l)),l=null,s=null,!0===e&&(null==r||r())};return{mount:r=>{if(lm("[UI: InstallModal-web: sdkWebInstallModal()] installModal-web mounting install modal",l),l)return l.style.display="block",void(null==s||s.updateQRCode(r));s=new cd({debug:t,sdkVersion:lL.version}),l=document.createElement("div"),document.body.appendChild(l),window.extension?s.renderSelectModal({parentElement:l,connectWithExtension:()=>{c(),null==i||i()},onClose:c,link:e,preferDesktop:null!=o&&o}).catch(e=>{console.error(e)}):s.renderInstallModal({parentElement:l,preferDesktop:null!=o&&o,link:e,metaMaskInstaller:n,onClose:c,onAnalyticsEvent:a}).catch(e=>{console.error("[UI: InstallModal-web: sdkWebInstallModal()]",e)})},unmount:c}},ch=({onDisconnect:e,debug:t})=>{let n=null,r=null,i=()=>{lm("[UI: pendingModal-web: sdkWebPendingModal()] pendingModal-web unmount",n),(null==n?void 0:n.parentNode)&&n.parentNode.removeChild(n),n=null,r=null},o=e=>{lm("[UI: pendingModal-web: sdkWebPendingModal()] pendingModal-web updateOTPValue",e),r&&r.updateOTPValue(e)},a=({displayOTP:a}={displayOTP:!0})=>{lm("[UI: pendingModal-web: sdkWebPendingModal()] pendingModal-web mount",n),n?n.style.display="block":(r=new cd({debug:t,sdkVersion:lL.version}),n=document.createElement("div"),document.body.appendChild(n),r.renderPendingModal({parentElement:n,onClose:i,onDisconnect:e,updateOTPValue:o,displayOTP:a}).catch(e=>{console.error("[UI: pendingModal-web: sdkWebPendingModal()]",e)}))};return a(),{mount:a,unmount:i,updateOTPValue:o}};function cf(e,t){var n,r,i,o;e.connector||(lm("[RemoteConnection: initializeConnector()] initialize connector"),e.connector=new it({anonId:t.anonId,platformType:t.platformManager.getPlatformType(),communicationLayerPreference:t.communicationLayerPreference,transports:t.transports,dappMetadata:Object.assign(Object.assign({},t.dappMetadata),{source:t._source}),analytics:t.enableAnalytics,communicationServerUrl:t.communicationServerUrl,sdkVersion:lL.version,context:"dapp",ecies:t.ecies,storage:t.storage,logging:t.logging}),t.timer&&(lm("[RemoteConnection: initializeConnector()] reset background timer",t.timer),null==(r=null==(n=t.timer)?void 0:n.stopBackgroundTimer)||r.call(n),null==(o=null==(i=t.timer)?void 0:i.runBackgroundTimer)||o.call(i,()=>!1,1e4)))}function cp(e){e.listeners.forEach(({event:t,handler:n})=>{var r;null==(r=e.connector)||r.off(t,n)}),e.listeners=[]}function cg(e,t){function n(t,n){var r;null==(r=e.connector)||r.on(t,n),e.listeners.push({event:t,handler:n})}e.connector&&(cp(e),n(iz.WALLET_INIT,({accounts:e,chainId:t})=>g(this,void 0,void 0,function*(){lm(`[RemoteConnection: setupListeners() => EventType.WALLET_INIT] 'wallet_init' accounts=${e} chainId=${t}`);let n=lT.getProvider();n._setConnected(),n._initializeState({accounts:e,chainId:t,isUnlocked:!1}),n.emit("chainChanged",t),n.emit("accountsChanged",e)})),n(iz.AUTHORIZED,()=>g(this,void 0,void 0,function*(){var t,n,r,i;try{lm("[RemoteConnection: setupListeners() => EventType.AUTHORIZED] 'authorized' closing modals",e.pendingModal,e.installModal);let o=lT.getProvider();o._setConnected(),null==(n=null==(t=e.pendingModal)?void 0:t.unmount)||n.call(t),null==(i=null==(r=e.installModal)?void 0:r.unmount)||i.call(r,!1),e.otpAnswer=void 0,e.authorized=!0,lm("[RemoteConnection: setupListeners() => EventType.AUTHORIZED] 'authorized' provider.state",o.getState()),yield o.forceInitializeState()}catch(e){}})),n(iz.TERMINATE,()=>{var t,n,r,i,o;null==(n=null==(t=e.pendingModal)?void 0:t.unmount)||n.call(t),null==(i=null==(r=e.installModal)?void 0:r.unmount)||i.call(r,!0),e.pendingModal=void 0,e.installModal=void 0,e.otpAnswer=void 0,null==(o=e.connector)||o.disconnect({terminate:!0}),e.authorized=!1,lT.getProvider().handleDisconnect({terminate:!0}),cp(e),lm("[RemoteConnection: setupListeners()] All listeners cleaned up")}))}
6class cm{constructor(e){var t,n,r;this.state={connector:void 0,qrcodeLink:void 0,analytics:void 0,developerMode:!1,authorized:!1,reconnection:!1,preferDesktop:!1,deeplinkProtocol:!1,listeners:[],communicationLayerPreference:void 0,platformManager:void 0,pendingModal:void 0,installModal:void 0,otpAnswer:void 0},this.options=e;let i=!0===(null==(t=e.logging)?void 0:t.developerMode)||!0===(null==(n=e.logging)?void 0:n.sdk);this.state.developerMode=i,this.state.analytics=e.analytics,this.state.preferDesktop=null!=(r=e.preferDesktop)&&r,this.state.useDeeplink=e.sdk.options.useDeeplink,this.state.communicationLayerPreference=e.communicationLayerPreference,this.state.platformManager=e.platformManager,e.modals.install||(e.modals.install=cu),e.modals.otp||(e.modals.otp=ch)}startConnection(e){return g(this,void 0,void 0,function*(){return function(e,t,{initialCheck:n,connectWith:r}={}){var i,o,a,s,l,d,u,h,f,p,m,y,v,b,E,w,S,_,C;return g(this,void 0,void 0,function*(){try{if(cf(e,t),!e.connector)throw Error("no connector defined");cg(e);let x=lT.getProvider();e.authorized=!1,x.emit("connecting");let k=yield null==(i=e.connector)?void 0:i.originatorSessionConnect();lm(`[RemoteConnection: startConnection()] after originatorSessionConnect initialCheck=${n}`,k);let A=null!=(o=null==k?void 0:k.channelId)?o:"",M=null!=(s=null==(a=e.connector.getKeyInfo())?void 0:a.ecies.public)?s:"",I=null!=(d=null==(l=e.connector.getKeyInfo())?void 0:l.ecies.private)?d:"";if(n&&!k)return Promise.resolve();if(!k&&!n){let t=yield e.connector.generateChannelIdConnect();A=null!=(u=t.channelId)?u:"",M=null!=(h=t.pubKey)?h:"",I=null!=(f=t.privKey)?f:"";let n=Date.now();null==(p=e.connector.state.storageManager)||p.persistChannelConfig({channelId:A,localKey:I,lastActive:n,validUntil:n+6048e5})}if(n&&(null==k?void 0:k.channelId))return(null==(m=e.connector)?void 0:m.isConnected())||(lm(`[RemoteConnection: startConnection()] reconnecting to channel initialCheck=${n}`,k),yield null==(y=e.connector)?void 0:y.connectToChannel({channelId:A})),Promise.resolve();!k||(null==(v=e.connector)?void 0:v.isConnected())||(lm("[RemoteConnection: startConnection()] reconnecting to channel",k),yield null==(b=e.connector)?void 0:b.connectToChannel({channelId:A}));let T=(null==(E=e.platformManager)?void 0:E.isSecure())?"":"&t=q",R=lL.version,{iconUrl:P,name:O,url:N,scheme:L}=t.dappMetadata||{},D=null==(w=e.platformManager)?void 0:w.getPlatformType(),$="N/A";"undefined"!=typeof window&&window.location&&window.location.hostname?$=window.location.hostname:void 0!==O?$=O:void 0!==N&&($=N);let B={url:null!=N?N:"",title:null!=O?O:"",icon:P,scheme:null!=L?L:"",apiVersion:R,dappId:$||N||"N/A",anonId:t.anonId,platform:null!=D?D:"",source:null!=(S=t._source)?S:""},K=lQ(JSON.stringify(B)),j=`channelId=${A}&v=2&comm=${null!=(_=e.communicationLayerPreference)?_:""}&pubkey=${M}${T}&originatorInfo=${K}`;if(r){j+=`&rpc=${lQ(JSON.stringify(r))}`;let t=e.connector.getRPCMethodTracker();t&&(t[`${r.id}`]=Object.assign(Object.assign({},r),{id:`${r.id}`,timestamp:Date.now()}))}let U=encodeURI(j),H=`${e.useDeeplink?lB:l$}?${j}`;if(e.qrcodeLink=H,e.developerMode&&lm(`[RemoteConnection: startConnection()] qrcodeLink=${U}`),x.emit("display_uri",H),c.analytics.track("sdk_connection_initiated",{transport_type:"websocket"}),null==(C=e.platformManager)?void 0:C.isSecure()){let t=setTimeout(()=>{c.analytics.track("sdk_connection_failed",{transport_type:"websocket"})},6e4);return yield function(e,t){var n,r;return g(this,void 0,void 0,function*(){let i=`${l$}?${t}`,o=`${lB}?${t}`;null==(r=null==(n=e.platformManager)?void 0:n.openDeeplink)||r.call(n,i,o,"_self")})}(e,U),new Promise((n,r)=>{var i,o,a;if(null==(i=e.connector)?void 0:i.isAuthorized())return clearTimeout(t),void n();null==(o=e.connector)||o.once(iz.AUTHORIZED,()=>{clearTimeout(t),n()}),null==(a=e.connector)||a.once(iz.REJECTED,()=>{clearTimeout(t),r(iz.REJECTED)})})}return function(e,t,n){return g(this,void 0,void 0,function*(){let r=setTimeout(()=>{c.analytics.track("sdk_connection_failed",{transport_type:"websocket"})},6e4);return new Promise((i,o)=>{var a,s,l,c;if(!e.connector)return void o(Error("No connector available"));lm("[RemoteConnection: connectWithModalInstaller()]",{state:e,options:t,linkParams:n});let d=`${e.useDeeplink?lB:l$}?${n}`;e.installModal=null==(s=(a=t.modals).install)?void 0:s.call(a,{link:d,preferDesktop:e.preferDesktop,installer:t.getMetaMaskInstaller(),terminate:()=>{lm("[RemoteConnection: showInstallModal() => terminate()] terminate connection"),t.sdk.terminate().catch(e=>{console.warn("[MMSDK] failed to terminate connection",e)})},debug:e.developerMode,connectWithExtension:()=>{var e;return null==(e=t.connectWithExtensionProvider)||e.call(t),!1},onAnalyticsEvent:({event:n,params:r})=>{var i,o,a;let s=Object.assign(Object.assign({},r),{sdkVersion:t.sdk.getVersion(),dappId:null==(i=t.dappMetadata)?void 0:i.name,source:t._source,url:null==(o=t.dappMetadata)?void 0:o.url});null==(a=e.analytics)||a.send({event:n,params:s})}}),null==(c=null==(l=e.installModal)?void 0:l.mount)||c.call(l,d),t.sdk.once(iz.PROVIDER_UPDATE,e=>g(this,void 0,void 0,function*(){if(lm("[RemoteConnection: connectWithModalInstaller()] once provider_update -- resolving startConnection promise"),e===cq.TERMINATE)return clearTimeout(r),void o({code:4001,message:"User rejected the request."});o(e)})),e.connector.once(iz.AUTHORIZED,()=>{clearTimeout(r),i()}),e.connector.once(iz.REJECTED,()=>{clearTimeout(r),o(iz.REJECTED)}),e.connector.once(iz.CLIENTS_READY,()=>g(this,void 0,void 0,function*(){lm("[RemoteConnection: connectWithModalInstaller()] once clients_ready -- resolving startConnection promise"),clearTimeout(r),i()}))})})}(e,t,U)}catch(e){throw console.error("[startConnection] error",e),e}})}(this.state,this.options,e)})}initRemoteCommunication({sdkInstance:e}){var t,n,r;return g(this,void 0,void 0,function*(){let i=yield null==(n=null==(t=e.options.storage)?void 0:t.storageManager)?void 0:n.getPersistedChannelConfig();if(!this.options.ecies){let e={privateKey:null==i?void 0:i.localKey};this.options.ecies=e}cf(this.state,this.options),yield null==(r=this.getConnector())?void 0:r.initFromDappStorage(),cg(this.state,this.options)})}showActiveModal(){var e,t,n,r,i;(e=this.state).authorized?lm("[RemoteConnection: showActiveModal()] already authorized"):e.pendingModal?null==(n=(t=e.pendingModal).mount)||n.call(t):e.installModal&&(null==(i=(r=e.installModal).mount)||i.call(r,e.qrcodeLink||""))}closeModal(){var e,t,n,r;null==(t=null==(e=this.state.pendingModal)?void 0:e.unmount)||t.call(e),null==(r=null==(n=this.state.installModal)?void 0:n.unmount)||r.call(n,!1)}getUniversalLink(){if(!this.state.qrcodeLink)throw Error("connection not started. run startConnection() first.");return this.state.qrcodeLink}getChannelConfig(){var e;return null==(e=this.state.connector)?void 0:e.getChannelConfig()}
6getKeyInfo(){var e;return null==(e=this.state.connector)?void 0:e.getKeyInfo()}getConnector(){if(!this.state.connector)throw Error("invalid remote connector");return this.state.connector}getPlatformManager(){if(!this.state.platformManager)throw Error("PlatformManager not available");return this.state.platformManager}isConnected(){var e;return(null==(e=this.state.connector)?void 0:e.isReady())||!1}isAuthorized(){var e;return(null==(e=this.state.connector)?void 0:e.isAuthorized())||!1}isPaused(){var e;return null==(e=this.state.connector)?void 0:e.isPaused()}disconnect(e){var t,n,r,i;lm("[RemoteConnection: disconnect()]",e),(null==e?void 0:e.terminate)&&(lT.getProvider().handleDisconnect({terminate:!0}),null==(n=null==(t=this.state.pendingModal)?void 0:t.unmount)||n.call(t),this.state.otpAnswer=void 0),null==(r=this.state.connector)||r.disconnect(e),i=this.state,lm("[RemoteConnection: cleanupConnector()] cleaning up connector"),i.connector&&(cp(i),i.connector.disconnect({terminate:!0}).catch(e=>{lm("[RemoteConnection: cleanupConnector()] error disconnecting connector",e)}))}}class cy extends u(){constructor(e={storage:{enabled:!0},injectProvider:!0,forceInjectProvider:!1,enableAnalytics:!0,shouldShimWeb3:!0,useDeeplink:!0,extensionOnly:!0,headless:!1,dappMetadata:{name:"",url:"",iconUrl:""},_source:lD,i18nOptions:{enabled:!1}}){var t,n,r;super(),this.extensionActive=!1,this._initialized=!1,this.sdkInitPromise=void 0,this.debug=!1,this.readonlyRPCCalls=!1,this.availableLanguages=["en"],this.ANON_ID_STORAGE_KEY="mm-sdk-anon-id",l().disable();let i=!0===(null==(t=e.logging)?void 0:t.developerMode);if(((null==(n=e.logging)?void 0:n.sdk)||i)&&l().enable("MM_SDK"),lm("[MetaMaskSDK: constructor()]: begin."),this.setMaxListeners(50),!(null==(r=e.dappMetadata)?void 0:r.url)){if("undefined"==typeof window||"undefined"==typeof document)throw Error("You must provide dAppMetadata url");e.dappMetadata=Object.assign(Object.assign({},e.dappMetadata),{url:`${window.location.protocol}//${window.location.host}`})}this.options=e,this.options._source||(e._source=lD),this.init().then(()=>{lm("[MetaMaskSDK: constructor()]: initialized successfully."),"undefined"!=typeof window&&(window.mmsdk=this)}).catch(e=>{console.error("[MetaMaskSDK: constructor()] error during initialization",e)})}init(){return g(this,void 0,void 0,function*(){return function(e){var t;return g(this,void 0,void 0,function*(){if("undefined"!=typeof window&&(null==(t=window.mmsdk)?void 0:t.isInitialized()))return lm("[MetaMaskSDK: initializeMetaMaskSDK()] already initialized"),Promise.resolve(window.mmsdk);if(e._initialized)return lm("[MetaMaskSDK: initializeMetaMaskSDK()] already initialized"),e.sdkInitPromise;if(e.sdkInitPromise)return lm("[MetaMaskSDK: initializeMetaMaskSDK()] already initializing"),e.sdkInitPromise;try{e.sdkInitPromise=function(e){var t,n,r,i,o,a,s,d,u,h,f;return g(this,void 0,void 0,function*(){let{options:p}=e;if(p.logging=null!=(t=p.logging)?t:{},p.communicationLayerPreference=null!=(n=p.communicationLayerPreference)?n:iJ.SOCKET,void 0!==p.enableDebug&&(l().enable("MM_SDK"),console.warn("enableDebug is removed. Please use enableAnalytics instead.")),p.enableAnalytics=null==(r=p.enableAnalytics)||r,p.injectProvider=null==(i=p.injectProvider)||i,p.shouldShimWeb3=null==(o=p.shouldShimWeb3)||o,p.extensionOnly=null==(a=p.extensionOnly)||a,p.useDeeplink=null==(s=p.useDeeplink)||s,p.storage=null!=(d=p.storage)?d:{enabled:!0},p.headless){l()("[MetaMaskSDK: performSDKInitialization()] headless mode enabled");let e=()=>{};p.modals={install:()=>({mount:e,unmount:e})},p.ui={installer:e}}let m=!0===(null==(u=p.logging)?void 0:u.developerMode);e.debug=(null==(h=p.logging)?void 0:h.sdk)||m,lm("[MetaMaskSDK: performSDKInitialization()] options",e.options);let y=Object.assign({},p.logging);m&&(y.sdk=!0,y.eciesLayer=!0,y.keyExchangeLayer=!0,y.remoteLayer=!0,y.serviceLayer=!0,y.plaintext=!0),yield function(e){var t;return g(this,void 0,void 0,function*(){let{options:n}=e;e.platformManager=new lR({useDeepLink:null!=(t=n.useDeeplink)&&t,preferredOpenLink:n.openDeeplink,debug:e.debug})})}(e),yield function(e){var t,n,r,i,o;return g(this,void 0,void 0,function*(){let{options:a}=e,s=null==(t=e.platformManager)?void 0:t.getPlatformType();e.analytics=new l3({serverUrl:null!=(n=a.communicationServerUrl)?n:rW,enabled:a.enableAnalytics,originatorInfo:{url:null!=(r=a.dappMetadata.url)?r:"",title:null!=(i=a.dappMetadata.name)?i:"",dappId:e.getDappId(),platform:null!=s?s:"",source:null!=(o=a._source)?o:"",anonId:""}})})}(e),yield function(e){var t,n,r;return g(this,void 0,void 0,function*(){if(!e.options.enableAnalytics||!(null==(t=e.platformManager)?void 0:t.isBrowser())&&!(null==(n=e.platformManager)?void 0:n.isReactNative()))return;let i=e.getVersion(),o=e.getDappId(),a=yield e.getAnonId(),s=null==(r=e.platformManager)?void 0:r.getPlatformType(),l=e.options._source;c.analytics.setGlobalProperty("sdk_version",i),c.analytics.setGlobalProperty("dapp_id",o),c.analytics.setGlobalProperty("anon_id",a),c.analytics.setGlobalProperty("platform",s),c.analytics.setGlobalProperty("integration_type",l),c.analytics.enable(),c.analytics.track("sdk_initialized",{})})}(e),yield function(e){var t;return g(this,void 0,void 0,function*(){let{options:n}=e;!0!==(null==(t=n.storage)?void 0:t.enabled)||n.storage.storageManager||(n.storage.storageManager=yield lP(n.storage))})}(e),yield function(e){return g(this,void 0,void 0,function*(){let{options:t}=e,n=/^(http|https):\/\/[^\s]*$/;if(t.dappMetadata){t.dappMetadata.iconUrl&&!n.test(t.dappMetadata.iconUrl)&&(console.warn("Invalid dappMetadata.iconUrl: URL must start with http:// or https://"),t.dappMetadata.iconUrl=void 0),t.dappMetadata.base64Icon&&t.dappMetadata.base64Icon.length>163400&&(console.warn("Invalid dappMetadata.base64Icon: Base64-encoded icon string length must be less than 163400 characters"),t.dappMetadata.base64Icon=void 0),t.dappMetadata.url&&!n.test(t.dappMetadata.url)&&console.warn("Invalid dappMetadata.url: URL must start with http:// or https://");let e=l5();if(e&&!t.dappMetadata.iconUrl&&!t.dappMetadata.base64Icon){let n=`${window.location.protocol}//${window.location.host}${e}`;t.dappMetadata.iconUrl=n}}e.dappMetadata=t.dappMetadata})}(e),yield l9(e),yield l7(e);let{metamaskBrowserExtension:v,preferExtension:b,shouldReturn:E}=yield function(e){var t,n,r,i;return g(this,void 0,void 0,function*(){let{options:o}=e,a,s=!1,l=!1;if("undefined"==typeof window||!window.ethereum||(null==(t=e.platformManager)?void 0:t.isMetaMaskMobileWebView()))(null==(n=e.platformManager)?void 0:n.isMetaMaskMobileWebView())&&(null==(r=e.anal
6ytics)||r.send({event:iG.SDK_USE_INAPP_BROWSER}),e.activeProvider=l4({provider:window.ethereum,sdkInstance:e}),e._initialized=!0,l=!0);else{s="extension"===localStorage.getItem(lW);try{a=yield function({mustBeMetaMask:e,sdkInstance:t}){return g(this,void 0,void 0,function*(){if("undefined"==typeof window)throw Error("window not available");try{let e=yield new Promise((e,t)=>{let n=setTimeout(()=>{t(Error("eip6963RequestProvider timed out"))},500);window.addEventListener(cW.Announce,t=>{let{detail:{info:r,provider:i}={}}=t,{name:o,rdns:a,uuid:s}=null!=r?r:{};lj.test(s)&&o.startsWith(lK.NAME)&&lK.RDNS.includes(a)&&(clearTimeout(n),e(i))}),window.dispatchEvent(new Event(cW.Request))});return l4({provider:e,sdkInstance:t})}catch(n){if(!e&&window.ethereum)return l4({provider:window.ethereum,sdkInstance:t});throw Error("Provider not found")}})}({mustBeMetaMask:!0,sdkInstance:e}),window.extension=a,a.on(lY.CHAIN_CHANGED,t=>{lm(`[MetaMaskSDK: setupExtensionPreferences()] PROPAGATE chainChanged chainId=${t}`),e.sdkProvider&&e.getMobileProvider().emit(lY.CHAIN_CHANGED,t)}),a.on(lY.ACCOUNTS_CHANGED,t=>g(this,void 0,void 0,function*(){var n;lm(`[MetaMaskSDK: setupExtensionPreferences()] PROPAGATE accountsChanged accounts=${t}`);let r=!!e.sdkProvider,i=!!e.extensionActive;if(r&&e.getMobileProvider().emit(lY.ACCOUNTS_CHANGED,t),i&&0===(null==t?void 0:t.length)&&0===(yield null==(n=e.getProvider())?void 0:n.request({method:lU.WALLET_GETPERMISSIONS,params:[]})).length)try{yield e.terminate()}catch(e){lm("[MetaMaskSDK: setupExtensionPreferences()] error terminating on permissions revoked",e)}})),a.on(lY.DISCONNECT,t=>{lm(`[MetaMaskSDK: setupExtensionPreferences()] PROPAGATE disconnect error=${t}`),e.sdkProvider&&e.getMobileProvider().emit(lY.DISCONNECT,t)}),a.on(lY.CONNECT,t=>{lm(`[MetaMaskSDK: setupExtensionPreferences()] PROPAGATE connect args=${t}`),e.sdkProvider&&e.getMobileProvider().emit(lY.CONNECT,t)}),a.on(lY.CONNECTED,t=>{lm("[MetaMaskSDK: setupExtensionPreferences()] PROPAGATE connected",t),e.sdkProvider&&e.getMobileProvider().emit(lY.CONNECTED,t)})}catch(e){window.extension=void 0}}return a&&o.extensionOnly&&(lm("[MetaMaskSDK: setupExtensionPreferences()] EXTENSION ONLY --- prevent sdk initialization"),null==(i=e.analytics)||i.send({event:iG.SDK_USE_EXTENSION}),e.activeProvider=a,e.extensionActive=!0,e.extension=a,e._initialized=!0,l=!0),{preferExtension:s,shouldReturn:l,metamaskBrowserExtension:a}})}(e);if(E)lm("[MetaMaskSDK: performSDKInitialization()] shouldReturn=true --- prevent sdk initialization");else{yield function(e,t){var n,r,i,o,a;return g(this,void 0,void 0,function*(){let{options:s}=e,l=Object.assign({},s.logging);e.remoteConnection=new cm({anonId:yield e.getAnonId(),preferDesktop:null!=(n=s.preferDesktop)&&n,communicationLayerPreference:null!=(r=s.communicationLayerPreference)?r:iJ.SOCKET,analytics:e.analytics,dappMetadata:s.dappMetadata,_source:s._source,enableAnalytics:null==(i=s.enableAnalytics)||i,timer:s.timer,sdk:e,platformManager:e.platformManager,transports:s.transports,communicationServerUrl:s.communicationServerUrl,storage:null!=(o=s.storage)?o:{enabled:!0},getMetaMaskInstaller:()=>{if(!e.installer)throw Error("Invalid SDK status -- installer not initialized");return e.installer},logging:l,connectWithExtensionProvider:void 0===t?void 0:()=>lJ(e),modals:Object.assign(Object.assign({},s.modals),{onPendingModalDisconnect:e.terminate.bind(e)})}),yield e.remoteConnection.initRemoteCommunication({sdkInstance:e}),e.installer=new cc({remote:e.remoteConnection,preferDesktop:null!=(a=s.preferDesktop)&&a,platformManager:e.platformManager,debug:e.debug})})}(e,v),yield function(e){var t,n,r,i;return g(this,void 0,void 0,function*(){var o,a,s,l;let{options:c}=e,d={communicationLayerPreference:null!=(t=c.communicationLayerPreference)?t:iJ.SOCKET,platformManager:e.platformManager,sdk:e,checkInstallationOnAllCalls:c.checkInstallationOnAllCalls,injectProvider:null==(n=c.injectProvider)||n,shouldShimWeb3:null==(r=c.shouldShimWeb3)||r,extensionOnly:null==(i=c.extensionOnly)||i,installer:e.installer,remoteConnection:e.remoteConnection,debug:e.debug};e.activeProvider=yield l2(d),null==(a=null==(o=e.remoteConnection)?void 0:o.getConnector())||a.on(lI.ConnectionStatus,t=>{e.emit(lI.ConnectionStatus,t)}),null==(l=null==(s=e.remoteConnection)?void 0:s.getConnector())||l.on(lI.ServiceStatus,t=>{e.emit(lI.ServiceStatus,t)})})}(e),yield function(e,t){var n,r;return g(this,void 0,void 0,function*(){let{options:i}=e;t?(lm("[MetaMaskSDK: handleAutoAndExtensionConnections()] preferExtension is detected -- connect with it."),null==(n=e.analytics)||n.send({event:iG.SDK_EXTENSION_UTILIZED}),lJ(e).catch(e=>{console.warn("Can't connect with MetaMask extension...",e),localStorage.removeItem(lW)})):i.checkInstallationImmediately&&((null==(r=e.platformManager)?void 0:r.isDesktopWeb())?(lm("[MetaMaskSDK: handleAutoAndExtensionConnections()] checkInstallationImmediately"),e.connect().catch(e=>{lm(`[MetaMaskSDK: handleAutoAndExtensionConnections()] checkInstallationImmediately --- IGNORED --- error on autoconnect _err=${e}`)})):console.warn("[handleAutoAndExtensionConnections()] checkInstallationImmediately --- IGNORED --- only for web desktop")),e._initialized=!0})}(e,b);try{yield null==(f=e.remoteConnection)?void 0:f.startConnection({initialCheck:!0})}catch(e){console.error("[MetaMaskSDK: setupRemoteConnectionAndInstaller()] Error while checking installation",e)}
6e.emit(lI.ProviderUpdate,cq.INITIALIZED)}})}(e),yield e.sdkInitPromise}catch(e){throw console.error(e),e}return e.sdkInitPromise})}(this)})}isExtensionActive(){return this.extensionActive}checkExtensionAvailability(){var e;return"undefined"!=typeof window&&!!(null==(e=window.ethereum)?void 0:e.isMetaMask)}connect(){return g(this,void 0,void 0,function*(){return function(e){return g(this,void 0,void 0,function*(){if(e._initialized||(lm("[MetaMaskSDK: connect()] provider not ready -- wait for init()"),yield e.init()),lm(`[MetaMaskSDK: connect()] isExtensionActive=${e.isExtensionActive()} activeProvider`,e.activeProvider),!e.activeProvider)throw Error("SDK state invalid -- undefined provider");let t=e.activeProvider.getSelectedAddress();return t?[t]:e.activeProvider.request({method:lU.ETH_REQUESTACCOUNTS,params:[]})})}(this)})}connectAndSign({msg:e}){return g(this,void 0,void 0,function*(){return function({instance:e,msg:t}){return g(this,void 0,void 0,function*(){if(e._initialized||(lm("[MetaMaskSDK: connectAndSign()] provider not ready -- wait for init()"),yield e.init()),lm(`[MetaMaskSDK: connectAndSign()] activeProvider=${e.activeProvider}`),!e.activeProvider)throw Error("SDK state invalid -- undefined provider");let n=/^0x([0-9A-Fa-f]{2})*$/u.test(t)?t:function(e){let t;if(void 0!==T)t=T.from(e,"utf8").toString("hex");else if("undefined"!=typeof TextEncoder)t=Array.from((new TextEncoder).encode(e)).map(e=>e.toString(16).padStart(2,"0")).join("");else{if("object"!=typeof m||!("Buffer"in m))throw Error("Unable to convert string to hex: No available method.");t=m.Buffer.from(e,"utf8").toString("hex")}return`0x${t}`}(t);return e.activeProvider.request({method:lU.METAMASK_CONNECTWITH,params:[{method:lU.PERSONAL_SIGN,params:[n]}]})})}({instance:this,msg:e})})}connectWith(e){return g(this,void 0,void 0,function*(){return function({instance:e,rpc:t}){return g(this,void 0,void 0,function*(){if(e._initialized||(lm("[MetaMaskSDK: connectWith()] provider not ready -- wait for init()"),yield e.init()),lm(`[MetaMaskSDK: connectWith()] method: ${t.method} rpc=${t}`),!e.activeProvider)throw Error("SDK state invalid -- undefined provider");return e.activeProvider.request({method:lU.METAMASK_CONNECTWITH,params:[t]})})}({instance:this,rpc:e})})}resume(){return function(e){var t,n,r;return g(this,void 0,void 0,function*(){if(!(null==(n=null==(t=e.remoteConnection)?void 0:t.getConnector())?void 0:n.isReady()))return lm("[MetaMaskSDK: resume()] channel is not ready -- starting connection"),void(null==(r=e.remoteConnection)||r.startConnection());lm("[MetaMaskSDK: resume()] channel is ready")})}(this)}disconnect(){return console.warn("MetaMaskSDK.disconnect() is deprecated, use terminate()"),this.terminate()}isAuthorized(){var e;null==(e=this.remoteConnection)||e.isAuthorized()}terminate(){return function(e){var t,n,r;return g(this,void 0,void 0,function*(){if(!(null==(t=e.platformManager)?void 0:t.isMetaMaskMobileWebView())){if(lZ&&(window.localStorage.removeItem(lW),window.localStorage.removeItem(lG),window.localStorage.removeItem(lV)),e.extensionActive){try{yield null==(n=e.activeProvider)?void 0:n.request({method:lU.WALLET_REVOKEPERMISSIONS,params:[{eth_accounts:{}}]})}catch(e){lm("[MetaMaskSDK: terminate()] error revoking permissions",e)}return e.options.extensionOnly?(e.emit(lI.ProviderUpdate,cq.TERMINATE),void lm("[MetaMaskSDK: terminate()] extensionOnly --- prevent switching providers")):(e.activeProvider=e.sdkProvider,window.ethereum=e.activeProvider,e.extensionActive=!1,void e.emit(lI.ProviderUpdate,cq.TERMINATE))}e.emit(lI.ProviderUpdate,cq.TERMINATE),lm(`[MetaMaskSDK: terminate()] remoteConnection=${e.remoteConnection}`),null==(r=e.remoteConnection)||r.disconnect({terminate:!0,sendMessage:!0})}})}(this)}isInitialized(){return this._initialized}setReadOnlyRPCCalls(e){this.readonlyRPCCalls=e}hasReadOnlyRPCCalls(){return this.readonlyRPCCalls}
6getProvider(){if(this.activeProvider)return this.activeProvider;console.warn("MetaMaskSDK: No active provider found")}getMobileProvider(){if(!this.sdkProvider)throw Error("SDK state invalid -- undefined mobile provider");return this.sdkProvider}getUniversalLink(){var e;let t=null==(e=this.remoteConnection)?void 0:e.getUniversalLink();if(!t)throw Error("No Universal Link available, please call eth_requestAccounts first.");return t}getChannelId(){var e,t;return null==(t=null==(e=this.remoteConnection)?void 0:e.getChannelConfig())?void 0:t.channelId}getRPCHistory(){var e,t;return null==(t=null==(e=this.remoteConnection)?void 0:e.getConnector())?void 0:t.getRPCMethodTracker()}getVersion(){return lL.version}getDappId(){var e,t,n,r;return"undefined"==typeof window||void 0===window.location?null!=(r=null!=(t=null==(e=this.options.dappMetadata)?void 0:e.name)?t:null==(n=this.options.dappMetadata)?void 0:n.url)?r:"N/A":window.location.hostname}getAnonId(){var e,t;return g(this,void 0,void 0,function*(){let n;return this._anonId?this._anonId:(n=(null==(e=this.platformManager)?void 0:e.isBrowser())?this.getBrowserAnonId():(null==(t=this.platformManager)?void 0:t.isReactNative())?yield this.getReactNativeAnonId():(0,h.A)(),this._anonId=n,n)})}getBrowserAnonId(){let e=this.ANON_ID_STORAGE_KEY;try{let t=localStorage.getItem(e);if(t)return t;let n=(0,h.A)();return localStorage.setItem(e,n),n}catch(e){return console.error("[MetaMaskSDK: getBrowserAnonId()] LocalStorage access error:",e),(0,h.A)()}}getReactNativeAnonId(){return g(this,void 0,void 0,function*(){let e=this.ANON_ID_STORAGE_KEY;try{let t=Object(function(){var e=Error("Cannot find module '@react-native-async-storage/async-storage'");throw e.code="MODULE_NOT_FOUND",e}()),n=yield t.getItem(e);if(n)return n;let r=(0,h.A)();return yield t.setItem(e,r),r}catch(e){return console.error("[MetaMaskSDK: getReactNativeAnonId()] Error accessing AsyncStorage:",e),(0,h.A)()}})}getWalletStatus(){var e,t;return null==(t=null==(e=this.remoteConnection)?void 0:e.getConnector())?void 0:t.getConnectionStatus()}_getChannelConfig(){var e;return null==(e=this.remoteConnection)?void 0:e.getChannelConfig()}_ping(){var e,t;null==(t=null==(e=this.remoteConnection)?void 0:e.getConnector())||t.ping()}_keyCheck(){var e,t;null==(t=null==(e=this.remoteConnection)?void 0:e.getConnector())||t.keyCheck()}_getServiceStatus(){var e,t;return null==(t=null==(e=this.remoteConnection)?void 0:e.getConnector())?void 0:t.getServiceStatus()}_getRemoteConnection(){return this.remoteConnection}_getDappMetadata(){return this.dappMetadata}_getKeyInfo(){var e;return null==(e=this.remoteConnection)?void 0:e.getKeyInfo()}_resetKeys(){var e,t;null==(t=null==(e=this.remoteConnection)?void 0:e.getConnector())||t.resetKeys()}_getConnection(){return this.remoteConnection}emit(e,t){return super.emit(e,t)}on(e,t){return super.on(e,t)}}var cv=Object.freeze({__proto__:null,StorageManagerWeb:class{constructor({enabled:e}={enabled:!1}){this.enabled=!1,this.enabled=e}persistChannelConfig(e){return g(this,void 0,void 0,function*(){let t=JSON.stringify(e);lm(`[StorageManagerWeb: persistChannelConfig()] enabled=${this.enabled}`,e),localStorage.setItem(lq,t)})}getPersistedChannelConfig(){return g(this,void 0,void 0,function*(){let e;try{if(lm(`[StorageManagerWeb: getPersistedChannelConfig()] enabled=${this.enabled}`),e=localStorage.getItem(lq),lm("[StorageManagerWeb: getPersistedChannelConfig()]",e),!e)return;let t=JSON.parse(e);return lm("[StorageManagerWeb: getPersistedChannelConfig()] channelConfig",t),t}catch(e){return void console.error("[StorageManagerWeb: getPersistedChannelConfig()] Can't find existing channel config",e)}})}persistAccounts(e){return g(this,void 0,void 0,function*(){lm(`[StorageManagerWeb: persistAccounts()] enabled=${this.enabled}`,e);let t=JSON.stringify(e);localStorage.setItem(lV,t)})}getCachedAccounts(){return g(this,void 0,void 0,function*(){try{let e=localStorage.getItem(lV);return e?JSON.parse(e):[]}catch(e){throw console.error("[StorageManagerWeb: getCachedAccounts()] Error reading cached accounts",e),e}})}persistChainId(e){return g(this,void 0,void 0,function*(){lm(`[StorageManagerWeb: persistChainId()] enabled=${this.enabled}`,e),localStorage.setItem(lG,e)})}getCachedChainId(){return g(this,void 0,void 0,function*(){try{let e=localStorage.getItem(lG);return null!=e?e:void 0}catch(e){throw console.error("[StorageManagerWeb: getCachedChainId()] Error reading cached chainId",e),e}})}terminate(){return g(this,void 0,void 0,function*(){lm(`[StorageManagerWeb: terminate()] enabled=${this.enabled}`),localStorage.removeItem(lq)})}}}),cb=Object.defineProperty,cE=new WeakMap,cw=e=>cE.get(e),cS=(e,t)=>cE.set(t.$lazyInstance$=e,t),c_=(e,t)=>t in e,cC=(e,t)=>(0,console.error)(e,t),cx=new Map,ck=new Map,cA="slot-fb{display:contents}slot-fb[hidden]{display:none}",cM="undefined"!=typeof window?window:{},cI=cM.document||{head:{}},cT={$flags$:0,$resourcesUrl$:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,n,r)=>e.addEventListener(t,n,r),rel:(e,t,n,r)=>e.removeEventListener(t,n,r),ce:(e,t)=>new CustomEvent(e,t)},cR=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync}catch(e){}return!1})(),cP=!1,cO=[],cN=[],cL=e=>{for(let t=0;t<e.length;t++)try{e[t](performance.now())}catch(e){cC(e)}e.length=0},cD=()=>{cL(cO),cL(cN),(cP=cO.length>0)&&cT.raf(cD)},c$=e=>Promise.resolve(void 0).then(e),cB=e=>{cN.push(e),cP||(cP=!0,4&cT.$flags$?c$(cD):cT.raf(cD))},cK={},cj=e=>"object"==(e=typeof e)||"function"===e;function cU(e){var t,n,r;return null!=(r=null==(n=null==(t=e.head)?void 0:t.querySelector('meta[name="csp-nonce"]'))?void 0:n.getAttribute("content"))?r:void 0}((e,t)=>{for(var n in t)cb(e,n,{get:t[n],enumerable:!0})})({},{err:()=>cF,map:()=>cz,ok:()=>cH,unwrap:()=>cY,unwrapErr:()=>cZ});var cH=e=>({isOk:!0,isErr:!1,value:e}),cF=e=>({isOk:!1,isErr:!0,value:e});function cz(e,t){if(e.isOk){let n=t(e.value);return n instanceof Promise?n.then(e=>cH(e)):cH(n)}if(e.isErr)return cF(e.value);throw"should never get here"}var cq,cW,cV,cG,cY=e=>{if(e.isOk)return e.value;throw e.value},cZ=e=>{if(e.isErr)return e.value;throw e.value},cJ=(e,t,...n)=>{let r=null,i=!1,o=!1,a=[],s=t=>{for(let n=0;n<t.length;n++)Array.isArray(r=t[n])?s(r):null!=r&&"boolean"!=typeof r&&((i="function"!=typeof e&&!cj(r))&&(r=String(r)),i&&o?a[a.length-1].$text$+=r:a.push(i?cQ(null,r):r),o=i)};if(s(n),t){let e=t.className||t.class;e&&(t.class="object"!=typeof e?e:Object.keys(e).filter(t=>e[t]).join(" "))}if("function"==typeof e)return e(null===t?{}:t,a,c0);let l=cQ(e,null);return l.$attrs$=t,a.length>0&&(l.$children$=a),l},cQ=(e,t)=>({$flags$:0,$tag$:e,$text$:t,$elm$:null,$children$:null,$attrs$:null}),cX={},c0={forEach:(e,t)=>
6e.map(c1).forEach(t),map:(e,t)=>e.map(c1).map(t).map(c2)},c1=e=>({vattrs:e.$attrs$,vchildren:e.$children$,vkey:e.$key$,vname:e.$name$,vtag:e.$tag$,vtext:e.$text$}),c2=e=>{if("function"==typeof e.vtag){let t={...e.vattrs};return e.vkey&&(t.key=e.vkey),e.vname&&(t.name=e.vname),cJ(e.vtag,t,...e.vchildren||[])}let t=cQ(e.vtag,e.vtext);return t.$attrs$=e.vattrs,t.$children$=e.vchildren,t.$key$=e.vkey,t.$name$=e.vname,t},c3=e=>cw(e).$hostElement$,c5=(e,t,n)=>{let r=c3(e);return{emit:e=>c8(r,t,{bubbles:!!(4&n),composed:!!(2&n),cancelable:!!(1&n),detail:e})}},c8=(e,t,n)=>{let r=cT.ce(t,n);return e.dispatchEvent(r),r},c6=new WeakMap,c4=e=>{let t=e.$cmpMeta$,n=e.$hostElement$,r=t.$flags$,i=(t.$tagName$,()=>{}),o=((e,t,n)=>{var r;let i=c9(t),o=ck.get(i);if(e=11===e.nodeType?e:cI,o)if("string"==typeof o){e=e.head||e;let n,a=c6.get(e);if(a||c6.set(e,a=new Set),!a.has(i)){{(n=cI.createElement("style")).innerHTML=o;let i=null!=(r=cT.$nonce$)?r:cU(cI);if(null!=i&&n.setAttribute("nonce",i),!(1&t.$flags$))if("HEAD"===e.nodeName){let t=e.querySelectorAll("link[rel=preconnect]"),r=t.length>0?t[t.length-1].nextSibling:e.querySelector("style");e.insertBefore(n,r)}else if("host"in e)if(cR){let t=new CSSStyleSheet;t.replaceSync(o),e.adoptedStyleSheets=[t,...e.adoptedStyleSheets]}else{let t=e.querySelector("style");t?t.innerHTML=o+t.innerHTML:e.prepend(n)}else e.append(n);1&t.$flags$&&"HEAD"!==e.nodeName&&e.insertBefore(n,null)}4&t.$flags$&&(n.innerHTML+=cA),a&&a.add(i)}}else e.adoptedStyleSheets.includes(o)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,o]);return i})(n.shadowRoot?n.shadowRoot:n.getRootNode(),t);10&r&&2&r&&(n["s-sc"]=o,n.classList.add(o+"-h")),i()},c9=(e,t)=>"sc-"+e.$tagName$,c7=(e,t,n,r,i,o)=>{if(n!==r){let a=c_(e,t),s=t.toLowerCase();if("class"===t){let t=e.classList,i=dt(n),o=dt(r);t.remove(...i.filter(e=>e&&!o.includes(e))),t.add(...o.filter(e=>e&&!i.includes(e)))}else if("style"===t){for(let t in n)r&&null!=r[t]||(t.includes("-")?e.style.removeProperty(t):e.style[t]="");for(let t in r)n&&r[t]===n[t]||(t.includes("-")?e.style.setProperty(t,r[t]):e.style[t]=r[t])}else if(a||"o"!==t[0]||"n"!==t[1]){let s=cj(r);if((a||s&&null!==r)&&!i)try{if(e.tagName.includes("-"))e[t]=r;else{let i=null==r?"":r;"list"===t?a=!1:null!=n&&e[t]==i||("function"==typeof e.__lookupSetter__(t)?e[t]=i:e.setAttribute(t,i))}}catch(e){}null==r||!1===r?!1===r&&""!==e.getAttribute(t)||e.removeAttribute(t):(!a||4&o||i)&&!s&&(r=!0===r?"":r,e.setAttribute(t,r))}else if(t="-"===t[2]?t.slice(3):c_(cM,s)?s.slice(2):s[2]+t.slice(3),n||r){let i=t.endsWith(dn);t=t.replace(dr,""),n&&cT.rel(e,t,n,i),r&&cT.ael(e,t,r,i)}}},de=/\s/,dt=e=>e?e.split(de):[],dn="Capture",dr=RegExp(dn+"$"),di=(e,t,n)=>{let r=11===t.$elm$.nodeType&&t.$elm$.host?t.$elm$.host:t.$elm$,i=e&&e.$attrs$||cK,o=t.$attrs$||cK;for(let e of da(Object.keys(i)))e in o||c7(r,e,i[e],void 0,n,t.$flags$);for(let e of da(Object.keys(o)))c7(r,e,i[e],o[e],n,t.$flags$)};function da(e){return e.includes("ref")?[...e.filter(e=>"ref"!==e),"ref"]:e}var ds=!1,dl=!1,dc=(e,t,n,r)=>{let i=t.$children$[n],o,a,s=0;if(null!==i.$text$)o=i.$elm$=cI.createTextNode(i.$text$);else{if(dl||(dl="svg"===i.$tag$),o=i.$elm$=cI.createElementNS(dl?"http://www.w3.org/2000/svg":"http://www.w3.org/1999/xhtml",i.$tag$),dl&&"foreignObject"===i.$tag$&&(dl=!1),di(null,i,dl),o.getRootNode().querySelector("body"),i.$children$)for(s=0;s<i.$children$.length;++s)(a=dc(e,i,s))&&o.appendChild(a);"svg"===i.$tag$?dl=!1:"foreignObject"===o.tagName&&(dl=!0)}return o["s-hn"]=cG,o},dd=(e,t,n,r,i,o)=>{let a,s=e;for(s.shadowRoot&&s.tagName===cG&&(s=s.shadowRoot);i<=o;++i)r[i]&&(a=dc(null,n,i))&&(r[i].$elm$=a,dp(s,a,t))},du=(e,t,n)=>{for(let r=t;r<=n;++r){let t=e[r];if(t){let e=t.$elm$;e&&e.remove()}}},dh=(e,t,n=!1)=>e.$tag$===t.$tag$,df=(e,t,n=!1)=>{let r=t.$elm$=e.$elm$,i=e.$children$,o=t.$children$,a=t.$tag$,s=t.$text$;null===s?(di(e,t,dl="svg"===a||"foreignObject"!==a&&dl),null!==i&&null!==o?((e,t,n,r,i=!1)=>{let o,a=0,s=0,l=t.length-1,c=t[0],d=t[l],u=r.length-1,h=r[0],f=r[u];for(;a<=l&&s<=u;)null==c?c=t[++a]:null==d?d=t[--l]:null==h?h=r[++s]:null==f?f=r[--u]:dh(c,h,i)?(df(c,h,i),c=t[++a],h=r[++s]):dh(d,f,i)?(df(d,f,i),d=t[--l],f=r[--u]):dh(c,f,i)?(df(c,f,i),dp(e,c.$elm$,d.$elm$.nextSibling),c=t[++a],f=r[--u]):dh(d,h,i)?(df(d,h,i),dp(e,d.$elm$,c.$elm$),d=t[--l],h=r[++s]):(o=dc(t&&t[s],n,s),h=r[++s],o&&dp(c.$elm$.parentNode,o,c.$elm$));a>l?dd(e,null==r[u+1]?null:r[u+1].$elm$,n,r,s,u):s>u&&du(t,a,l)})(r,i,t,o,n):null!==o?(null!==e.$text$&&(r.textContent=""),dd(r,null,t,o,0,o.length-1)):n||null===i||du(i,0,i.length-1),dl&&"svg"===a&&(dl=!1)):e.$text$!==s&&(r.data=s)},dp=(e,t,n)=>null==e?void 0:e.insertBefore(t,n),dg=(e,t,n=!1)=>{let r=e.$hostElement$,i=e.$cmpMeta$,o=e.$vnode$||cQ(null,null),a=t&&t.$tag$===cX?t:cJ(null,null,t);if(cG=r.tagName,n&&a.$attrs$)for(let e of Object.keys(a.$attrs$))r.hasAttribute(e)&&!["key","ref","style","class"].includes(e)&&(a.$attrs$[e]=r[e]);a.$tag$=null,a.$flags$|=4,e.$vnode$=a,a.$elm$=o.$elm$=r.shadowRoot||r,r["s-sc"],i.$flags$,df(o,a,n)},dm=(e,t)=>
6{t&&!e.$onRenderResolve$&&t["s-p"]&&t["s-p"].push(new Promise(t=>e.$onRenderResolve$=t))},dy=(e,t)=>(e.$flags$|=16,4&e.$flags$)?void(e.$flags$|=512):(dm(e,e.$ancestorComponent$),cB(()=>dv(e,t))),dv=(e,t)=>{let n=e.$hostElement$,r=(e.$cmpMeta$.$tagName$,()=>{}),i=e.$lazyInstance$;if(!i)throw Error(`Can't render component <${n.tagName.toLowerCase()} /> with invalid Stencil runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://stenciljs.com/docs/custom-elements#externalruntime`);return r(),db(void 0,()=>dw(e,i,t))},db=(e,t)=>dE(e)?e.then(t).catch(e=>{console.error(e),t()}):t(),dE=e=>e instanceof Promise||e&&e.then&&"function"==typeof e.then,dw=async(e,t,n)=>{var r;let i=e.$hostElement$,o=(e.$cmpMeta$.$tagName$,()=>{}),a=i["s-rc"];n&&c4(e);let s=(e.$cmpMeta$.$tagName$,()=>{});dS(e,t,i,n),a&&(a.map(e=>e()),i["s-rc"]=void 0),s(),o();{let t=null!=(r=i["s-p"])?r:[],n=()=>d_(e);0===t.length?n():(Promise.all(t).then(n),e.$flags$|=4,t.length=0)}},dS=(e,t,n,r)=>{try{t=t.render(),e.$flags$&=-17,e.$flags$|=2,dg(e,t,r)}catch(t){cC(t,e.$hostElement$)}return null},d_=e=>{e.$cmpMeta$.$tagName$;let t=e.$hostElement$,n=()=>{},r=e.$lazyInstance$,i=e.$ancestorComponent$;64&e.$flags$?n():(e.$flags$|=64,dk(t),dx(r,"componentDidLoad"),n(),e.$onReadyResolve$(t),i||dC()),e.$onRenderResolve$&&(e.$onRenderResolve$(),e.$onRenderResolve$=void 0),512&e.$flags$&&c$(()=>dy(e,!1)),e.$flags$&=-517},dC=e=>{dk(cI.documentElement),c$(()=>c8(cM,"appload",{detail:{namespace:"sdk-install-modal-web"}}))},dx=(e,t,n)=>{if(e&&e[t])try{return e[t](n)}catch(e){cC(e)}},dk=e=>e.classList.add("hydrated"),dA=(e,t,n,r)=>{var i,o;let a=cw(e);if(!a)throw Error(`Couldn't find host element for "${r.$tagName$}" as it is unknown to this Stencil runtime. This usually happens when integrating a 3rd party Stencil component with another Stencil component or application. Please reach out to the maintainers of the 3rd party Stencil component or report this on the Stencil Discord server (https://chat.stenciljs.com) or comment on this similar [GitHub issue](https://github.com/ionic-team/stencil/issues/5457).`);let s=a.$hostElement$,l=a.$instanceValues$.get(t),c=a.$flags$,d=a.$lazyInstance$;i=n,o=r.$members$[t][0],n=null==i||cj(i)?i:4&o?"false"!==i&&(""===i||!!i):1&o?String(i):i;let u=Number.isNaN(l)&&Number.isNaN(n);if((!(8&c)||void 0===l)&&n!==l&&!u&&(a.$instanceValues$.set(t,n),d)){if(r.$watchers$&&128&c){let e=r.$watchers$[t];e&&e.map(e=>{try{d[e](n,l,t)}catch(e){cC(e,s)}})}2==(18&c)&&dy(a,!1)}},dM=(e,t,n)=>{var r,i;let o=e.prototype;if(t.$members$||t.$watchers$||e.watchers){e.watchers&&!t.$watchers$&&(t.$watchers$=e.watchers);let a=Object.entries(null!=(r=t.$members$)?r:{});if(a.map(([e,[r]])=>{(31&r||2&n&&32&r)&&Object.defineProperty(o,e,{get(){return cw(this).$instanceValues$.get(e)},set(n){dA(this,e,n,t)},configurable:!0,enumerable:!0})}),1&n){let n=new Map;o.attributeChangedCallback=function(e,r,i){cT.jmp(()=>{var a;let s=n.get(e);if(this.hasOwnProperty(s))i=this[s],delete this[s];else{if(o.hasOwnProperty(s)&&"number"==typeof this[s]&&this[s]==i)return;if(null==s){let n=cw(this),o=null==n?void 0:n.$flags$;if(o&&!(8&o)&&128&o&&i!==r){let o=n.$lazyInstance$,s=null==(a=t.$watchers$)?void 0:a[e];null==s||s.forEach(t=>{null!=o[t]&&o[t].call(o,i,r,e)})}return}}this[s]=(null!==i||"boolean"!=typeof this[s])&&i})},e.observedAttributes=Array.from(new Set([...Object.keys(null!=(i=t.$watchers$)?i:{}),...a.filter(([e,t])=>15&t[0]).map(([e,t])=>{let r=t[1]||e;return n.set(r,e),r})]))}}return e},dI=async(e,t,n,r)=>{let i;if(0==(32&t.$flags$)){if(t.$flags$|=32,n.$lazyBundleId$){let e=((e,t,n)=>{let r=e.$tagName$.replace(/-/g,"_"),i=e.$lazyBundleId$;if(!i)return;let o=cx.get(i);return o?o[r]:"mm-install-modal_3"===i?Promise.resolve().then(function(){return uo}).then(e=>(cx.set(i,e),e[r]),cC):import(`./${i}.entry.js`).then(e=>(cx.set(i,e),e[r]),cC)})(n);if(!(i=e&&"then"in e?await e:e))throw Error(`Constructor for "${n.$tagName$}#${t.$modeName$}" was not found`);i.isProxied||(n.$watchers$=i.watchers,dM(i,n,2),i.isProxied=!0);let r=(n.$tagName$,()=>{});t.$flags$|=8;try{new i(t)}catch(e){cC(e)}t.$flags$&=-9,t.$flags$|=128,r(),dT(t.$lazyInstance$)}else{i=e.constructor;let n=e.localName;customElements.whenDefined(n).then(()=>t.$flags$|=128)}if(i&&i.style){let e;"string"==typeof i.style&&(e=i.style);let t=c9(n);if(!ck.has(t)){let r=(n.$tagName$,()=>{});
6((e,t,n)=>{let r=ck.get(e);cR&&n?"string"==typeof(r=r||new CSSStyleSheet)?r=t:r.replaceSync(t):r=t,ck.set(e,r)})(t,e,!!(1&n.$flags$)),r()}}}let o=t.$ancestorComponent$,a=()=>dy(t,!0);o&&o["s-rc"]?o["s-rc"].push(a):a()},dT=e=>{dx(e,"connectedCallback")},dR=e=>{dx(e,"disconnectedCallback")},dP=(e,t={})=>{var n;let r=[],i=t.exclude||[],o=cM.customElements,a=cI.head,s=a.querySelector("meta[charset]"),l=cI.createElement("style"),c=[],d,u=!0;Object.assign(cT,t),cT.$resourcesUrl$=new URL(t.resourcesUrl||"./",cI.baseURI).href;let h=!1;if(e.map(e=>{e[1].map(t=>{var n;let a={$flags$:t[0],$tagName$:t[1],$members$:t[2],$listeners$:t[3]};4&a.$flags$&&(h=!0),a.$members$=t[2],a.$watchers$=null!=(n=t[4])?n:{};let s=a.$tagName$,l=class extends HTMLElement{constructor(e){if(super(e),this.hasRegisteredEventListeners=!1,((e,t)=>{let n={$flags$:0,$hostElement$:e,$cmpMeta$:t,$instanceValues$:new Map};n.$onReadyPromise$=new Promise(e=>n.$onReadyResolve$=e),e["s-p"]=[],e["s-rc"]=[],cE.set(e,n)})(e=this,a),1&a.$flags$)if(e.shadowRoot){if("open"!==e.shadowRoot.mode)throw Error(`Unable to re-use existing shadow root for ${a.$tagName$}! Mode is set to ${e.shadowRoot.mode} but Stencil only supports open shadow roots.`)}else e.attachShadow({mode:"open"})}connectedCallback(){cw(this),this.hasRegisteredEventListeners||(this.hasRegisteredEventListeners=!0),d&&(clearTimeout(d),d=null),u?c.push(this):cT.jmp(()=>(e=>{if(0==(1&cT.$flags$)){let t=cw(e),n=t.$cmpMeta$,r=(n.$tagName$,()=>{});if(1&t.$flags$)(null==t?void 0:t.$lazyInstance$)?dT(t.$lazyInstance$):(null==t?void 0:t.$onReadyPromise$)&&t.$onReadyPromise$.then(()=>dT(t.$lazyInstance$));else{t.$flags$|=1;{let n=e;for(;n=n.parentNode||n.host;)if(n["s-p"]){dm(t,t.$ancestorComponent$=n);break}}n.$members$&&Object.entries(n.$members$).map(([t,[n]])=>{if(31&n&&e.hasOwnProperty(t)){let n=e[t];delete e[t],e[t]=n}}),dI(e,t,n)}r()}})(this))}disconnectedCallback(){cT.jmp(()=>(async e=>{if(0==(1&cT.$flags$)){let t=cw(e);(null==t?void 0:t.$lazyInstance$)?dR(t.$lazyInstance$):(null==t?void 0:t.$onReadyPromise$)&&t.$onReadyPromise$.then(()=>dR(t.$lazyInstance$))}})(this))}componentOnReady(){return cw(this).$onReadyPromise$}};a.$lazyBundleId$=e[0],i.includes(s)||o.get(s)||(r.push(s),o.define(s,dM(l,a,1)))})}),r.length>0&&(h&&(l.textContent+=cA),l.textContent+=r.sort()+"{visibility:hidden}.hydrated{visibility:inherit}",l.innerHTML.length)){l.setAttribute("data-styles","");let e=null!=(n=cT.$nonce$)?n:cU(cI);null!=e&&l.setAttribute("nonce",e),a.insertBefore(l,s?s.nextSibling:a.firstChild)}u=!1,c.length?c.map(e=>e.connectedCallback()):cT.jmp(()=>d=setTimeout(dC,30))};!function(){if("undefined"!=typeof window&&void 0!==window.Reflect&&void 0!==window.customElements){var e=HTMLElement;window.HTMLElement=function(){return Reflect.construct(e,[],this.constructor)},HTMLElement.prototype=e.prototype,HTMLElement.prototype.constructor=HTMLElement,Object.setPrototypeOf(HTMLElement,e)}}();var dO=Object.freeze({__proto__:null,defineCustomElements:async(e,t)=>{if("undefined"!=typeof window)return await void 0,dP([["mm-install-modal_3",[[1,"mm-install-modal",{link:[1],sdkVersion:[1,"sdk-version"],preferDesktop:[4,"prefer-desktop"],tab:[32],isDefaultTab:[32],translationsLoaded:[32]},null,{preferDesktop:["updatePreferDesktop"]}],[1,"mm-pending-modal",{displayOTP:[4,"display-o-t-p"],sdkVersion:[1,"sdk-version"],otpCode:[1,"otp-code"],translationsLoaded:[32]}],[1,"mm-select-modal",{link:[1],sdkVersion:[1,"sdk-version"],preferDesktop:[4,"prefer-desktop"],tab:[32],isDefaultTab:[32],translationsLoaded:[32]},null,{preferDesktop:["updatePreferDesktop"]}]]]],t)},setNonce:e=>cT.$nonce$=e});let dN={fontFamily:"Roboto, sans-serif"},dL=({className:e},t)=>cJ("div",{style:dN,class:e},t),dD=({Icon:e,text:t})=>cJ("div",{class:"flexContainer",style:{padding:"6",flexDirection:"row"}},cJ("div",{class:"flexItem1"},cJ(e,null)),cJ("div",{class:"flexItem11"},cJ("span",{style:{lineHeight:"2",color:"black"}},t))),d$=()=>cJ("svg",{width:"20",height:"18",viewBox:"0 0 20 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},cJ("path",{d:"M20.0002 7.9702V10.0302C20.0002 10.5802 19.5602 11.0302 19.0002 11.0502H17.0402C15.9602 11.0502 14.9702 10.2602 14.8802 9.1802C14.8202 8.5502 15.0602 7.9602 15.4802 7.5502
6C15.8502 7.1702 16.3602 6.9502 16.9202 6.9502H19.0002C19.5602 6.9702 20.0002 7.4202 20.0002 7.9702Z",fill:"#037DD6"}),cJ("path",{d:"M18.47 12.55H17.04C15.14 12.55 13.54 11.12 13.38 9.3C13.29 8.26 13.67 7.22 14.43 6.48C15.07 5.82 15.96 5.45 16.92 5.45H18.47C18.76 5.45 19 5.21 18.97 4.92C18.75 2.49 17.14 0.83 14.75 0.55C14.51 0.51 14.26 0.5 14 0.5H5C4.72 0.5 4.45 0.52 4.19 0.56C1.64 0.88 0 2.78 0 5.5V12.5C0 15.26 2.24 17.5 5 17.5H14C16.8 17.5 18.73 15.75 18.97 13.08C19 12.79 18.76 12.55 18.47 12.55ZM11 6.75H5C4.59 6.75 4.25 6.41 4.25 6C4.25 5.59 4.59 5.25 5 5.25H11C11.41 5.25 11.75 5.59 11.75 6C11.75 6.41 11.41 6.75 11 6.75Z",fill:"#037DD6"})),dB=()=>cJ("svg",{width:"20",height:"18",viewBox:"0 0 20 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},cJ("path",{d:"M14.44 0.0999756C12.63 0.0999756 11.01 0.979976 10 2.32998C8.99 0.979976 7.37 0.0999756 5.56 0.0999756C2.49 0.0999756 0 2.59998 0 5.68998C0 6.87998 0.19 7.97998 0.52 8.99998C2.1 14 6.97 16.99 9.38 17.81C9.72 17.93 10.28 17.93 10.62 17.81C13.03 16.99 17.9 14 19.48 8.99998C19.81 7.97998 20 6.87998 20 5.68998C20 2.59998 17.51 0.0999756 14.44 0.0999756Z",fill:"#037DD6"})),dK=()=>cJ("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},cJ("path",{d:"M16.28 7.53V6.28C16.28 3.58 15.63 0 10 0C4.37 0 3.72 3.58 3.72 6.28V7.53C0.92 7.88 0 9.3 0 12.79V14.65C0 18.75 1.25 20 5.35 20H14.65C18.75 20 20 18.75 20 14.65V12.79C20 9.3 19.08 7.88 16.28 7.53ZM10 16.74C8.33 16.74 6.98 15.38 6.98 13.72C6.98 12.05 8.34 10.7 10 10.7C11.66 10.7 13.02 12.06 13.02 13.72C13.02 15.39 11.67 16.74 10 16.74ZM5.35 7.44C5.27 7.44 5.2 7.44 5.12 7.44V6.28C5.12 3.35 5.95 1.4 10 1.4C14.05 1.4 14.88 3.35 14.88 6.28V7.45C14.8 7.45 14.73 7.45 14.65 7.45H5.35V7.44Z",fill:"#037DD6"})),dj=()=>cJ("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},cJ("path",{d:"M16.4405 8.8999C20.0405 9.2099 21.5105 11.0599 21.5105 15.1099V15.2399C21.5105 19.7099 19.7205 21.4999 15.2505 21.4999H8.74047C4.27047 21.4999 2.48047 19.7099 2.48047 15.2399V15.1099C2.48047 11.0899 3.93047 9.2399 7.47047 8.9099",stroke:"white","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"}),cJ("path",{d:"M12 2V14.88",stroke:"white","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"}),cJ("path",{d:"M15.3504 12.6499L12.0004 15.9999L8.65039 12.6499",stroke:"white","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"}));function dU({version:e}){return cJ("div",{style:{textAlign:"center",color:"#BBC0C5",fontSize:"12"}},"SDK Version ",e?`v${e}`:"unknown")}let dH=()=>cJ("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},cJ("rect",{width:"16",height:"16",fill:"white"}),cJ("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M2.40554 2.40554C2.94627 1.86482 3.82296 1.86482 4.36369 2.40554L8 6.04186L11.6363 2.40554C12.177 1.86482 13.0537 1.86482 13.5945 2.40554C14.1352 2.94627 14.1352 3.82296 13.5945 4.36369L9.95814 8L13.5945 11.6363C14.1352 12.177 14.1352 13.0537 13.5945 13.5945C13.0537 14.1352 12.177 14.1352 11.6363 13.5945L8 9.95814L4.36369 13.5945C3.82296 14.1352 2.94627 14.1352 2.40554 13.5945C1.86482 13.0537 1.86482 12.177 2.40554 11.6363L6.04186 8L2.40554 4.36369C1.86482 3.82296 1.86482 2.94627 2.40554 2.40554Z",fill:"#BBC0C5"})),dF=()=>cJ("svg",{width:"120",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 127 63"},cJ("path",{fill:"currentColor",d:"M71.554 48.607v13.81h-7.072v-9.568l-8.059.945c-1.77.205-2.548.79-2.548 1.864 0 1.575 1.478 2.239 4.648 2.239 1.932 0 4.073-.29 5.963-.79l-3.66 5.225c-1.479.332-2.92.496-4.44.496-6.414 0-10.074-2.57-10.074-7.132 0-4.023 2.877-6.136 9.416-6.884l8.638-1.012c-.467-2.532-2.362-3.633-6.13-3.633-3.537 0-7.443.912-10.937 2.613l1.111-6.18c3.248-1.369 6.95-2.074 10.69-2.074 8.226 0 12.461 3.444 12.461 10.075l-.008.005ZM7.938 31.315.208 62.416h7.73l3.836-15.628 6.65 8.039h8.06l6.65-8.039 3.836 15.628h7.73l-7.73-31.105-14.518 17.388L7.934 31.311l.004.004ZM36.97.21 22.452 17.598 7.938.21.208 31.315h7.73l3.836-15.628 6.65 8.039h8.06l6.65-8.039 3.836 15.628h7.73L36.97.21Zm53.17 48.107-6.25-.912c-1.562-.247-2.178-.747-2.178-1.617 0-1.41 1.52-2.032 4.647-2.032 3.62 0 6.868.747 10.283 2.364l-.862-6.094c-2.757-.995-5.922-1.491-9.212-1.491-7.688 0-11.886 2.696-11.886 7.547 0 3.776 2.303 5.889 7.196 6.636l6.335.954c1.603.248 2.261.87 2.261 1.865 0 1.41-1.478 2.074-4.481 2.074-3.948 0-8.225-.953-11.72-2.654l.7 6.094c3.003 1.122 6.91 1.785 10.57 1.785 7.896 0 12.007-2.78 12.007-7.715 0-3.94-2.303-6.057-7.4-6.8l-.01-.004ZM100.3 34.09v28.325h7.071V34.091H100.3Zm15.334 15.595 9.833-10.744h-8.8l-9.296 11.114 9.912 12.356h8.925l-10.574-12.73v.004Zm-16.321-25.09c0 4.56 3.66 7.13 10.074 7.13 1.52 0 2.961-.167 4.44
6-.495l3.66-5.225c-1.89.496-4.031.79-5.963.79-3.166 0-4.648-.664-4.648-2.239 0-1.079.783-1.659 2.549-1.864l8.058-.945v9.567h7.072v-13.81c0-6.635-4.236-10.075-12.461-10.075-3.744 0-7.442.705-10.691 2.075l-1.112 6.178c3.495-1.701 7.401-2.613 10.937-2.613 3.769 0 5.664 1.1 6.13 3.633l-8.637 1.013c-6.539.747-9.417 2.86-9.417 6.883l.009-.004Zm-19.779-1.492c0 5.725 3.29 8.627 9.787 8.627 2.59 0 4.732-.416 6.785-1.37l.903-6.261c-1.974 1.2-3.99 1.822-6.005 1.822-3.044 0-4.402-1.243-4.402-4.023v-8.295h10.732V7.84H86.601V2.948l-13.448 7.174v3.482h6.372V23.1l.008.004Zm-6.95-2.612v1.411H53.47c.862 2.873 3.423 4.187 7.97 4.187 3.62 0 6.993-.747 9.992-2.196l-.862 6.056c-2.757 1.16-6.251 1.785-9.829 1.785-9.5 0-14.68-4.23-14.68-12.066 0-7.838 5.264-12.235 13.406-12.235s13.119 4.771 13.119 13.062l-.005-.004ZM53.378 17.09h12.086c-.637-2.751-2.732-4.188-6.08-4.188-3.349 0-5.335 1.399-6.006 4.188Z"}));function dz(e,t){return e.toString(2).padStart(t,"0")}function dq(e,t){let n=e%t;return n>=0?n:t+n}function dW(e,t){return Array(e).fill(t)}function dV(...e){let t=0;for(let n of e)t=Math.max(t,n.length);let n=[];for(let r=0;r<t;r++)for(let t of e)r>=t.length||n.push(t[r]);return new Uint8Array(n)}function dG(e,t,n){if(n<0||n+t.length>e.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==e[n+r])return!1;return!0}function dY(e){return{has:t=>e.includes(t),decode:t=>{if(!Array.isArray(t)||t.length&&"string"!=typeof t[0])throw Error("alphabet.decode input should be array of strings");return t.map(t=>{if("string"!=typeof t)throw Error(`alphabet.decode: not string element=${t}`);let n=e.indexOf(t);if(-1===n)throw Error(`Unknown letter: "${t}". Allowed: ${e}`);return n})},encode:t=>{if(!Array.isArray(t)||t.length&&"number"!=typeof t[0])throw Error("alphabet.encode input should be an array of numbers");return t.map(t=>{if(function(e){if(!Number.isSafeInteger(e))throw Error(`Wrong integer: ${e}`)}(t),t<0||t>=e.length)throw Error(`Digit index outside alphabet: ${t} (alphabet: ${e.length})`);return e[t]})}}}class dZ{static size(e,t){if("number"==typeof e&&(e={height:e,width:e}),!Number.isSafeInteger(e.height)&&e.height!==1/0)throw Error(`Bitmap: wrong height=${e.height} (${typeof e.height})`);if(!Number.isSafeInteger(e.width)&&e.width!==1/0)throw Error(`Bitmap: wrong width=${e.width} (${typeof e.width})`);return void 0!==t&&(e={width:Math.min(e.width,t.width),height:Math.min(e.height,t.height)}),e}static fromString(e){let t,n=(e=e.replace(/^\n+/g,"").replace(/\n+$/g,"")).split("\n"),r=n.length,i=Array(r);for(let e of n){let n=e.split("").map(e=>{if("X"===e)return!0;if(" "===e)return!1;if("?"!==e)throw Error(`Bitmap.fromString: unknown symbol=${e}`)});if(t&&n.length!==t)throw Error(`Bitmap.fromString different row sizes: width=${t} cur=${n.length}`);t=n.length,i.push(n)}return t||(t=0),new dZ({height:r,width:t},i)}constructor(e,t){let{height:n,width:r}=dZ.size(e);this.data=t||Array.from({length:n},()=>dW(r,void 0)),this.height=n,this.width=r}point(e){return this.data[e.y][e.x]}isInside(e){return 0<=e.x&&e.x<this.width&&0<=e.y&&e.y<this.height}size(e){if(!e)return{height:this.height,width:this.width};let{x:t,y:n}=this.xy(e);return{height:this.height-n,width:this.width-t}}xy(e){if("number"==typeof e&&(e={x:e,y:e}),!Number.isSafeInteger(e.x))throw Error(`Bitmap: wrong x=${e.x}`);if(!Number.isSafeInteger(e.y))throw Error(`Bitmap: wrong y=${e.y}`);return e.x=dq(e.x,this.width),e.y=dq(e.y,this.height),e}rect(e,t,n){let{x:r,y:i}=this.xy(e),{height:o,width:a}=dZ.size(t,this.size({x:r,y:i}));for(let e=0;e<o;e++)for(let t=0;t<a;t++)this.data[i+e][r+t]="function"==typeof n?n({x:t,y:e},this.data[i+e][r+t]):n;return this}rectRead(e,t,n){return this.rect(e,t,(e,t)=>(n(e,t),t))}hLine(e,t,n){return this.rect(e,{width:t,height:1},n)}vLine(e,t,n){return this.rect(e,{width:1,height:t},n)}border(e=2,t){let n=this.height+2*e,r=this.width+2*e,i=dW(e,t),o=Array.from({length:e},()=>dW(r,t));return new dZ({height:n,width:r},[...o,...this.data.map(e=>[...i,...e,...i]),...o])}embed(e,t){return this.rect(e,t.size(),({x:e,y:n})=>t.data[n][e])}rectSlice(e,t=this.size()){let n=new dZ(dZ.size(t,this.size(this.xy(e))));return this.rect(e,t,({x:e,y:t},r)=>n.data[t][e]=r),n}inverse(){let{height:e,width:t}=this;return new dZ({height:t,width:e}).rect({x:0,y:0},1/0,({x:e,y:t})=>this.data[e][t])}scale(e){if(!Number.isSafeInteger(e)||e>1024)throw Error(`Wrong scale factor: ${e}`);let{height:t,width:n}=this;return new dZ({height:e*t,width:e*n}).rect({x:0,y:0},1/0,({x:t,y:n})=>this.data[Math.floor(n/e)][Math.floor(t/e)])}clone(){return new dZ(this.size()).rect({x:0,y:0},this.size(),({x:e,y:t})=>this.data[t][e])}
6assertDrawn(){this.rectRead(0,1/0,(e,t)=>{if("boolean"!=typeof t)throw Error("Invalid color type="+typeof t)})}toString(){return this.data.map(e=>e.map(e=>void 0===e?"?":e?"X":" ").join("")).join("\n")}toASCII(){let{height:e,width:t,data:n}=this,r="";for(let i=0;i<e;i+=2){for(let o=0;o<t;o++){let t=n[i][o],a=i+1>=e||n[i+1][o];t||a?!t&&a?r+="▀":t&&!a?r+="▄":t&&a&&(r+=" "):r+="█"}r+="\n"}return r}toTerm(){let e="\x1b[0m",t=`�[1;47m  ${e}`,n=`�[40m  ${e}`;return this.data.map(e=>e.map(e=>e?n:t).join("")).join("\n")}toSVG(){let e=`<svg xmlns:svg="http://www.w3.org/2000/svg" viewBox="0 0 ${this.width} ${this.height}" version="1.1" xmlns="http://www.w3.org/2000/svg">`;return this.rectRead(0,1/0,({x:t,y:n},r)=>{r&&(e+=`<rect x="${t}" y="${n}" width="1" height="1" />`)}),e+="</svg>"}toGIF(){let e=e=>[255&e,e>>>8&255],t=[...e(this.width),...e(this.height)],n=[];this.rectRead(0,1/0,(e,t)=>n.push(+(!0===t)));let r=[71,73,70,56,55,97,...t,246,0,0,255,255,255,...dW(381,0),44,0,0,0,0,...t,0,7],i=Math.floor(n.length/126);for(let e=0;e<i;e++)r.push(127,128,...n.slice(126*e,126*(e+1)).map(e=>+e));return r.push(n.length%126+1,128,...n.slice(126*i).map(e=>+e)),r.push(1,129,0,59),new Uint8Array(r)}toImage(e=!1){let{height:t,width:n}=this.size(),r=new Uint8Array(t*n*(e?3:4)),i=0;for(let o=0;o<t;o++)for(let t=0;t<n;t++){let n=255*!this.data[o][t];r[i++]=n,r[i++]=n,r[i++]=n,e||(r[i++]=255)}return{height:t,width:n,data:r}}}let dJ=["low","medium","quartile","high"],dQ=["numeric","alphanumeric","byte","kanji","eci"],dX=[26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706],d0={low:[7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],medium:[10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],quartile:[13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],high:[17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]},d1={low:[1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],medium:[1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],quartile:[1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],high:[1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]},d2={size:{encode:e=>21+4*(e-1),decode:e=>(e-17)/4},sizeType:e=>Math.floor((e+7)/17),alignmentPatterns(e){if(1===e)return[];let t=d2.size.encode(e)-6-1,n=t-6,r=Math.ceil(n/28),i=Math.floor(n/r);i%2?i+=1:n%r*2>=r&&(i+=2);let o=[6];for(let e=1;e<r;e++)o.push(t-(r-e)*i);return o.push(t),o},ECCode:{low:1,medium:0,quartile:3,high:2},formatMask:21522,formatBits(e,t){let n=d2.ECCode[e]<<3|t,r=n;for(let e=0;e<10;e++)r=r<<1^1335*(r>>9);return(n<<10|r)^d2.formatMask},versionBits(e){let t=e;for(let e=0;e<12;e++)t=t<<1^7973*(t>>11);return e<<12|t},alphabet:{numeric:dY("0123456789"),alphanumerc:dY("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:")},lengthBits:(e,t)=>({numeric:[10,12,14],alphanumeric:[9,11,13],byte:[8,16,16],kanji:[8,10,12],eci:[0,0,0]})[t][d2.sizeType(e)],modeBits:{numeric:"0001",alphanumeric:"0010",byte:"0100",kanji:"1000",eci:"0111"},capacity(e,t){let n=dX[e-1],r=d0[t][e-1],i=d1[t][e-1],o=Math.floor(n/i)-r,a=i-n%i;return{words:r,numBlocks:i,shortBlocks:a,blockLen:o,capacity:8*(n-r*i),total:(r+o)*i+i-a}}},d3=[(e,t)=>(e+t)%2==0,(e,t)=>t%2==0,(e,t)=>e%3==0,(e,t)=>(e+t)%3==0,(e,t)=>(Math.floor(t/2)+Math.floor(e/3))%2==0,(e,t)=>e*t%2+e*t%3==0,(e,t)=>(e*t%2+e*t%3)%2==0,(e,t)=>((e+t)%2+e*t%3)%2==0],d5={tables:(e=>{let t=dW(256,0),n=dW(256,0);for(let e=0,r=1;e<256;e++)t[e]=r,n[r]=e,256&(r<<=1)&&(r^=285);return{exp:t,log:n}})(),exp:e=>d5.tables.exp[e],log(e){if(0===e)throw Error(`GF.log: wrong arg=${e}`);return d5.tables.log[e]%255},mul:(e,t)=>
60===e||0===t?0:d5.tables.exp[(d5.tables.log[e]+d5.tables.log[t])%255],add:(e,t)=>e^t,pow:(e,t)=>d5.tables.exp[d5.tables.log[e]*t%255],inv(e){if(0===e)throw Error(`GF.inverse: wrong arg=${e}`);return d5.tables.exp[255-d5.tables.log[e]]},polynomial(e){if(0==e.length)throw Error("GF.polymomial: wrong length");if(0!==e[0])return e;let t=0;for(;t<e.length-1&&0==e[t];t++);return e.slice(t)},monomial(e,t){if(e<0)throw Error(`GF.monomial: wrong degree=${e}`);if(0==t)return[0];let n=dW(e+1,0);return n[0]=t,d5.polynomial(n)},degree:e=>e.length-1,coefficient:(e,t)=>e[d5.degree(e)-t],mulPoly(e,t){if(0===e[0]||0===t[0])return[0];let n=dW(e.length+t.length-1,0);for(let r=0;r<e.length;r++)for(let i=0;i<t.length;i++)n[r+i]=d5.add(n[r+i],d5.mul(e[r],t[i]));return d5.polynomial(n)},mulPolyScalar(e,t){if(0==t)return[0];if(1==t)return e;let n=dW(e.length,0);for(let r=0;r<e.length;r++)n[r]=d5.mul(e[r],t);return d5.polynomial(n)},mulPolyMonomial(e,t,n){if(t<0)throw Error("GF.mulPolyMonomial: wrong degree");if(0==n)return[0];let r=dW(e.length+t,0);for(let t=0;t<e.length;t++)r[t]=d5.mul(e[t],n);return d5.polynomial(r)},addPoly(e,t){if(0===e[0])return t;if(0===t[0])return e;let n=e,r=t;n.length>r.length&&([n,r]=[r,n]);let i=dW(r.length,0),o=r.length-n.length,a=r.slice(0,o);for(let e=0;e<a.length;e++)i[e]=a[e];for(let e=o;e<r.length;e++)i[e]=d5.add(n[e-o],r[e]);return d5.polynomial(i)},remainderPoly(e,t){let n=Array.from(e);for(let r=0;r<e.length-t.length+1;r++){let e=n[r];if(0!==e)for(let i=1;i<t.length;i++)0!==t[i]&&(n[r+i]=d5.add(n[r+i],d5.mul(t[i],e)))}return n.slice(e.length-t.length+1,n.length)},divisorPoly(e){let t=[1];for(let n=0;n<e;n++)t=d5.mulPoly(t,[1,d5.pow(2,n)]);return t},evalPoly(e,t){if(0==t)return d5.coefficient(e,0);let n=e[0];for(let r=1;r<e.length;r++)n=d5.add(d5.mul(t,n),e[r]);return n},euclidian(e,t,n){d5.degree(e)<d5.degree(t)&&([e,t]=[t,e]);let r=e,i=t,o=[0],a=[1];for(;2*d5.degree(i)>=n;){let e=r,t=o;if(r=i,o=a,0===r[0])throw Error("rLast[0] === 0");i=e;let n=[0],s=d5.inv(r[0]);for(;d5.degree(i)>=d5.degree(r)&&0!==i[0];){let e=d5.degree(i)-d5.degree(r),t=d5.mul(i[0],s);n=d5.addPoly(n,d5.monomial(e,t)),i=d5.addPoly(i,d5.mulPolyMonomial(r,e,t))}if(n=d5.mulPoly(n,o),a=d5.addPoly(n,t),d5.degree(i)>=d5.degree(r))throw Error(`Division failed r: ${i}, rLast: ${r}`)}let s=d5.coefficient(a,0);if(0==s)throw Error("sigmaTilde(0) was zero");let l=d5.inv(s);return[d5.mulPolyScalar(a,l),d5.mulPolyScalar(i,l)]}};function d8(e,t,n,r){let i="",o=n.length;if("numeric"===r){let e=d2.alphabet.numeric.decode(n.split("")),t=e.length;for(let n=0;n<t-2;n+=3)i+=dz(100*e[n]+10*e[n+1]+e[n+2],10);t%3==1?i+=dz(e[t-1],4):t%3==2&&(i+=dz(10*e[t-2]+e[t-1],7))}else if("alphanumeric"===r){let e=d2.alphabet.alphanumerc.decode(n.split("")),t=e.length;for(let n=0;n<t-1;n+=2)i+=dz(45*e[n]+e[n+1],11);t%2==1&&(i+=dz(e[t-1],6))}else{if("byte"!==r)throw Error("encode: unsupported type");{let e=function(e){if("string"!=typeof e)throw Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}(n);o=e.length,i=Array.from(e).map(e=>dz(e,8)).join("")}}let{capacity:a}=d2.capacity(e,t),s=dz(o,d2.lengthBits(e,r)),l=d2.modeBits[r]+s+i;if(l.length>a)throw Error("Capacity overflow");(l+="0".repeat(Math.min(4,Math.max(0,a-l.length)))).length%8&&(l+="0".repeat(8-l.length%8));for(let e=0;l.length!==a;e++)l+="1110110000010001"[e%16];let c=Uint8Array.from(l.match(/(.{8})/g).map(e=>Number(`0b${e}`)));return(function(e,t){let{words:n,shortBlocks:r,numBlocks:i,blockLen:o,total:a}=d2.capacity(e,t),s={encode(e){let t=d5.divisorPoly(n),r=Array.from(e);return r.push(...t.slice(0,-1).fill(0)),Uint8Array.from(d5.remainderPoly(r,t))},decode(e){let t=e.slice(),r=d5.polynomial(Array.from(e)),i=dW(n,0),o=!1;for(let e=0;e<n;e++){let t=d5.evalPoly(r,d5.exp(e));i[i.length-1-e]=t,0!==t&&(o=!0)}if(!o)return t;i=d5.polynomial(i);let a=d5.monomial(n,1),[s,l]=d5.euclidian(a,i,n),c=dW(d5.degree(s),0),d=0;for(let e=1;e<256&&d<c.length;e++)0===d5.evalPoly(s,e)&&(c[d++]=d5.inv(e));if(d!==c.length)throw Error("RS.decode: wrong errors number");for(let e=0;e<c.length;e++){let n=t.length-1-d5.log(c[e]);if(n<0)throw Error("RS.decode: wrong error location");let r=d5.inv(c[e]),i=1;for(let t=0;t<c.length;t++)e!==t&&(i=d5.mul(i,d5.add(1,d5.mul(c[t],r))));t[n]=d5.add(t[n],d5.mul(d5.evalPoly(l,r),d5.inv(i)))}return t}};return{encode(e){let t=[],n=[];for(let a=0;a<i;a++){let i=o+(a<r?0:1);t.push(e.subarray(0,i)),n.push(s.encode(e.subarray(0,i))),e=e.subarray(i)}let a=dV(...t),l=dV(...n),c=new Uint8Array(a.length+l.length);return c.set(a),c.set(l,a.length),c},decode(e){if(e.length!==a)throw Error(`interleave.decode: len(data)=${e.length}, total=${a}`);let t=[];for(let e=0;e<i;e++){let i=e<r;t.push(new Uint8Array(n+o+ +!i))}let l=0;for(let n=0;n<o;n++)for(let r=0;r<i;r++)t[r][n]=e[l++];for(let n=r;n<i;n++)t[n][o]=e[l++];for(let a=o;a<o+n;a++)for(let n=0;n<i;n++){let i=n<r;t[n][a+ +!i]=e[l++]}let c=[];for(let e of t)c.push(...Array.from(s.decode(e)).slice(0,-n));return Uint8Array.from(c)}}})(e,t).encode(c)}function d6(e,t,n,r,i=!1){let o=function(e,t,n,r=!1){let i=d2.size.encode(e),o=new dZ(i+2),a=new dZ(3).rect(0,3,!0).border(1,!1).border(1,!0).border(1,!1);o=(o=o.embed(0,a).embed({x:-a.width,y:0},a).embed({x:0,y:-a.height},a)).rectSlice(1,i);let s=new dZ(1).rect(0,1,!0).border(1,!1).border(1,!0),l=d2.alignmentPatterns(e);for(let e of l)for(let t of l)void 0===o.data[e][t]&&o.embed({x:t-2,y:e-2},s);o=o.hLine({x:0,y:6},1/0,({x:e},t)=>void 0===t?e%2==0:t).vLine({x:6,y:0},1/0,({y:e},t)=>void 0===t?e%2==0:t);
6{let e=d2.formatBits(t,n),a=t=>!r&&1==(e>>t&1);for(let e=0;e<6;e++)o.data[e][8]=a(e);for(let e=6;e<8;e++)o.data[e+1][8]=a(e);for(let e=8;e<15;e++)o.data[i-15+e][8]=a(e);for(let e=0;e<8;e++)o.data[8][i-e-1]=a(e);for(let e=8;e<9;e++)o.data[8][15-e-1+1]=a(e);for(let e=9;e<15;e++)o.data[8][15-e-1]=a(e);o.data[i-8][8]=!r}if(e>=7){let t=d2.versionBits(e);for(let e=0;e<18;e+=1){let n=!r&&1==(t>>e&1),a=Math.floor(e/3),s=e%3+i-8-3;o.data[a][s]=n,o.data[s][a]=n}}return o}(e,t,r,i),a=0,s=8*n.length;if(function(e,t,n){let r=e.height,i=d3[t],o=-1,a=r-1;for(let t=r-1;t>0;t-=2){for(6==t&&(t=5);;a+=o){for(let r=0;r<2;r+=1){let o=t-r;void 0===e.data[a][o]&&n(o,a,i(o,a))}if(a+o<0||a+o>=r)break}o=-o}}(o,r,(e,t,r)=>{let i=!1;a<s&&(i=0!=(n[a>>>3]>>(7-a&7)&1),a++),o.data[t][e]=i!==r}),a!==s)throw Error("QR: bytes left after draw");return o}function d4(e,t="raw",n={}){let r=void 0!==n.ecc?n.ecc:"medium";if(!dJ.includes(r))throw Error(`Invalid error correction mode=${r}. Expected: ${dJ}`);let i=void 0!==n.encoding?n.encoding:function(e){let t="numeric";for(let n of e)if(!d2.alphabet.numeric.has(n)&&(t="alphanumeric",!d2.alphabet.alphanumerc.has(n)))return"byte";return t}(e);!function(e){if(!dQ.includes(e))throw Error(`Encoding: invalid mode=${e}. Expected: ${dQ}`);if("kanji"===e||"eci"===e)throw Error(`Encoding: ${e} is not supported (yet?).`)}(i),void 0!==n.mask&&function(e){if(![0,1,2,3,4,5,6,7].includes(e)||!d3[e])throw Error(`Invalid mask=${e}. Expected number [0..7]`)}(n.mask);let o,a=n.version,s=Error("Unknown error");if(void 0!==a)!function(e){if(!Number.isSafeInteger(e)||e<1||e>40)throw Error(`Invalid version=${e}. Expected number [1..40]`)}(a),o=d8(a,r,e,i);else for(let t=1;t<=40;t++)try{o=d8(t,r,e,i),a=t;break}catch(e){s=e}if(!a||!o)throw s;let l=function(e,t,n,r){if(void 0===r){let i,o,a=(o=1/0,{add(e,t){e>=o||(i=t,o=e)},get:()=>i,score:()=>o});for(let r=0;r<d3.length;r++)a.add(function(e){let t=e.inverse(),n=e=>{let t=0;for(let n,r=0,i=1;r<e.length;r++)n===e[r]&&(i++,r!==e.length-1)||(i>=5&&(t+=i-5+3),n=e[r],i=1);return t},r=0;e.data.forEach(e=>r+=n(e)),t.data.forEach(e=>r+=n(e));let i=0,o=e.data,a=e.width-1,s=e.height-1;for(let e=0;e<a;e++)for(let t=0;t<s;t++){let n=e+1,r=t+1;o[e][t]===o[n][t]&&o[n][t]===o[e][r]&&o[n][t]===o[n][r]&&(i+=3)}let l=e=>{let t=[!0,!1,!0,!0,!0,!1,!0],n=[!1,!1,!1,!1],r=[...t,...n],i=[...n,...t],o=0;for(let t=0;t<e.length;t++)dG(e,r,t)&&(o+=40),dG(e,i,t)&&(o+=40);return o},c=0;for(let t of e.data)c+=l(t);for(let e of t.data)c+=l(e);let d=0;e.rectRead(0,1/0,(e,t)=>d+=+!!t);let u=10*Math.floor(Math.abs(d/(e.height*e.width)*100-50)/5);return r+i+c+u}(d6(e,t,n,r,!0)),r);r=a.get()}if(void 0===r)throw Error("Cannot find mask");return d6(e,t,n,r)}(a,r,o,n.mask);l.assertDrawn();let c=void 0===n.border?2:n.border;if(!Number.isSafeInteger(c))throw Error("Wrong border type="+typeof c);if(l=l.border(c,!1),void 0!==n.scale&&(l=l.scale(n.scale)),"raw"===t)return l.data;if("ascii"===t)return l.toASCII();if("svg"===t)return l.toSVG();if("gif"===t)return l.toGIF();if("term"===t)return l.toTerm();throw Error(`Unknown output: ${t}`)}let d9={DESKTOP:"Desktop",MOBILE:"Mobile",META_MASK_MOBILE_APP:"MetaMask mobile app",SCAN_TO_CONNECT:"Scan to connect and sign with",CONNECT_WITH_EXTENSION:"Connect With MetaMask Extension",INSTALL_MODAL:{TRUSTED_BY_USERS:"Trusted by over 30 million users to buy, store, send and swap crypto securely",LEADING_CRYPTO_WALLET:"The leading crypto wallet & gateway to blockchain apps built on Ethereum Mainnet, Polygon, Optimism, and many other networks",CONTROL_DIGITAL_INTERACTIONS:"Puts you in control of your digital interactions by making power of cryptography more accessible",INSTALL_META_MASK_EXTENSION:"Install MetaMask Extension"},PENDING_MODAL:{OPEN_META_MASK_SELECT_CODE:"Please open the MetaMask wallet app and select the code on the screen OR disconnect",OPEN_META_MASK_CONTINUE:"Open the MetaMask app to continue with your session.",NUMBER_AFTER_OPEN_NOTICE:"If a number doesn't appear after opening MetaMask, please click disconnect and re-scan the QRCode.",DISCONNECT:"Disconnect"},SELECT_MODAL:{CRYPTO_TAKE_CONTROL_TEXT:"Take control of your crypto and explore the blockchain with the wallet trusted by over 30 million people worldwide"},META_MASK_MODAL:{ADDRESS_COPIED:"Address copied to clipboard!",DISCONNECT:"Disconnect",ACTIVE_NETWORK:"Active Network"}};class d7{constructor(e){var t;this.translations=d9,this.supportedLocales=["es","fr","he","it","pt","tr"],this.baseUrl=null!=(t=null==e?void 0:e.baseUrl)?t:"https://raw.githubusercontent.com/MetaMask/metamask-sdk/refs/heads/gh-pages/locales"}getBrowserLanguage(){if((navigator.languages||[navigator.language]).some(e=>e.toLowerCase().startsWith("en")))return"en";let e=navigator.language.toLowerCase().split("-")[0];return this.supportedLocales.includes(e)?e:"en"}async init(e){let t=this.getBrowserLanguage()||e.fallbackLng;await this.loadTranslations(t)}async loadTranslations(e){let t=e.split("-")[0];if("en"!==t&&this.supportedLocales.includes(t))try{let e=`${this.baseUrl}/${t}.json`,n=await fetch(e);if(!n.ok)throw Error(`HTTP error! status: ${n.status}`);this.translations=await n.json()}catch(e){console.warn(`❌ Failed to load ${t} translations, falling back to English:`,e),this.translations=d9}else this.translations=d9}t(e){return this.getNestedTranslation(e,this.translations)||e}getNestedTranslation(e,t){let n=e.split("."),r=t;for(let e of n){if("object"!=typeof r)return"";r=r[e]}return"string"==typeof r?r:""}}!function(e){e.SDK_MODAL_VIEWED="sdk_modal_viewed",e.SDK_MODAL_BUTTON_CLICKED="sdk_modal_button_clicked",e.SDK_MODAL_TOGGLE_CHANGED="sdk_modal_toggle_changed"}(i||(i={}));let ue=class{constructor(e){cS(this,e),this.close=c5(this,"close",7),this.startDesktopOnboarding=c5(this,"startDesktopOnboarding",7),this.trackAnalytics=c5(this,"trackA
6nalytics",7),this.link=void 0,this.sdkVersion=void 0,this.preferDesktop=void 0,this.tab=1,this.isDefaultTab=!0,this.translationsLoaded=!1,this.onClose=this.onClose.bind(this),this.onStartDesktopOnboardingHandler=this.onStartDesktopOnboardingHandler.bind(this),this.setTab=this.setTab.bind(this),this.render=this.render.bind(this),this.setTab(this.preferDesktop?1:2),this.i18nInstance=new d7}componentDidLoad(){this.trackAnalytics.emit({event:i.SDK_MODAL_VIEWED,params:{extensionInstalled:!1,tab:1===this.tab?"desktop":"mobile"}})}async connectedCallback(){await this.i18nInstance.init({fallbackLng:"en"}),this.translationsLoaded=!0}updatePreferDesktop(e){e?this.setTab(1):this.setTab(2)}onClose(e=!1){this.close.emit({shouldTerminate:e})}onStartDesktopOnboardingHandler(){this.trackAnalytics.emit({event:i.SDK_MODAL_BUTTON_CLICKED,params:{button_type:"install_extension",tab:"desktop"}}),this.startDesktopOnboarding.emit()}setTab(e,t=!1){t&&this.trackAnalytics.emit({event:i.SDK_MODAL_TOGGLE_CHANGED,params:{toggle:1===this.tab?"desktop_to_mobile":"mobile_to_desktop"}}),this.tab=e,this.isDefaultTab=!1}render(){if(!this.translationsLoaded)return null;let e=e=>this.i18nInstance.t(e),t=this.isDefaultTab?this.preferDesktop?1:2:this.tab,n=d4(this.link,"svg",{ecc:"medium",scale:2});return cJ(dL,{className:"install-model"},cJ("div",{class:"backdrop",onClick:()=>this.onClose(!0)}),cJ("div",{class:"modal"},cJ("div",{class:"closeButtonContainer"},cJ("div",{class:"right"},cJ("span",{class:"closeButton",onClick:()=>this.onClose(!0)},cJ(dH,null)))),cJ("div",{class:"logoContainer"},cJ(dF,null)),cJ("div",null,cJ("div",{class:"tabcontainer"},cJ("div",{class:"flexContainer"},cJ("div",{onClick:()=>this.setTab(1,!0),class:"tab flexItem "+(1===t?"tabactive":"")},e("DESKTOP")),cJ("div",{onClick:()=>this.setTab(2,!0),class:"tab flexItem "+(2===t?"tabactive":"")},e("MOBILE")))),cJ("div",{style:{display:1===t?"none":"block"}},cJ("div",{class:"flexContainer"},cJ("div",{class:"flexItem",style:{textAlign:"center",marginTop:"4"}},n&&cJ("div",{id:"sdk-mm-qrcode",class:"center",innerHTML:n}),cJ("div",{class:"connectMobileText"},e("SCAN_TO_CONNECT")," ",cJ("br",null),cJ("span",{class:"blue"},cJ("b",null,e("META_MASK_MOBILE_APP"))))))),cJ("div",{style:{display:2===t?"none":"block"}},cJ("div",{class:"item"},cJ(dD,{Icon:dB,text:e("INSTALL_MODAL.TRUSTED_BY_USERS")})),cJ("div",{class:"item"},cJ(dD,{Icon:d$,text:e("INSTALL_MODAL.LEADING_CRYPTO_WALLET")})),cJ("div",{class:"item"},cJ(dD,{Icon:dK,text:e("INSTALL_MODAL.CONTROL_DIGITAL_INTERACTIONS")})),cJ("button",{class:"button",onClick:()=>this.onStartDesktopOnboardingHandler()},cJ(dj,null),cJ("span",{class:"installExtensionText"},e("INSTALL_MODAL.INSTALL_META_MASK_EXTENSION"))))),cJ(dU,{version:this.sdkVersion})))}get el(){return c3(this)}static get watchers(){return{preferDesktop:["updatePreferDesktop"]}}};ue.style=
vendor: 3,083 bytes, line 6
6".flexContainer {\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    flex-direction: row;\n}\n\n.flexItem {\n    flex: 1;\n    justify-content: center;\n    align-items: center;\n}\n\n.flexItem11 {\n    flex: 11;\n    justify-content: center;\n    align-items: center;\n}\n\n.flexItem1 {\n    flex: 1;\n    justify-content: center;\n    align-items: center;\n}\n\n.tab {\n    padding: 8px;\n    cursor: pointer;\n    background-color: #F2F4F6;\n    font-size: 12px;\n    text-align: center;\n    color: #24292E;\n}\n\n.tabcontainer {\n    padding: 4px;\n    background-color: #F2F4F6;\n    border-radius: 8px;\n    margin-bottom: 30px;\n    margin-top: 30px;\n}\n\n.tabactive {\n    background-color: white;\n    -webkit-transition: background-color 300ms linear;\n    -ms-transition: background-color 300ms linear;\n    transition: background-color 300ms linear;\n    border-radius: 8px;\n}\n\n.item {\n    font-size: 12px;\n    margin-bottom: 16px;\n    border-radius: 8px;\n    padding: 10px;\n    border: 2px #F2F4F6 solid;\n    color: #24292E;\n}\n\n.extensionLabel {\n    font-style: normal;\n    font-weight: bold;\n    font-size: 14px;\n    text-align: cetner;\n    color: #24272A;\n}\n\n.notice {\n    font-size: 12px;\n    margin-left: 10px;\n    margin-right: 10px;\n    color: grey;\n}\n\n.button {\n    margin-top: 41.5px;\n    margin-bottom: 20px;\n    width: 100%;\n    display: flex;\n    flex-direction: row;\n    justify-content: center;\n    align-items: center;\n    padding: 12px 20px;\n    background: #037DD6;\n    border-radius: 32px;\n    color: white;\n    border: 0;\n    font-size: 14px;\n    cursor: pointer;\n}\n\n.backdrop {\n    visibility: visible;\n    position: fixed;\n    top: 0;\n    left: 0;\n    right: 0;\n    bottom: 0;\n    width: 100%;\n    z-index: 99998;\n    background: rgba(0, 0, 0, 0.87);\n    opacity: 0.3;\n}\n\n.modal {\n    visibility: visible;\n    position: fixed;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 99999;\n    background: white;\n    padding: 20px;\n    border-radius: 8px;\n    top: 50%;\n    max-width: 100%;\n    width: 460px;\n    min-width: 300px;\n    box-shadow: rgba(0, 0, 0, 0.2) 0px 11px 15px -7px, rgba(0, 0, 0, 0.14) 0px 24px 38px 3px, rgba(0, 0, 0, 0.12) 0px 9px 46px 8px;\n    -webkit-font-smoothing: antialiased;\n}\n\n.closeButton {\n    color: #BBC0C5;\n    cursor: pointer;\n}\n\n.logoContainer {\n    margin-left: 24px;\n    margin-right: 24px;\n    margin-top: 24px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n}\n\n.connectMobileText {\n    font-size: 14px;\n    color: black;\n    margin-top: 28px;\n    margin-bottom: 28px;\n    line-height: 2;\n}\n\n.blue {\n    color: #037DD6;\n    font-weight: 700;\n}\n\n.installExtensionText {\n    margin-left: 10px;\n}\n\n.center {\n    display: flex;\n    justify-content: center;\n    align-items: center;\n}\n\n.right {\n    display: flex;\n    align-items: center;\n    justify-content: right;\n}\n\n#sdk-mm-qrcode {\n    svg {\n        width: 50%;\n    }\n}";
6let ut=class{constructor(e){cS(this,e),this.close=c5(this,"close",7),this.disconnect=c5(this,"disconnect",7),this.updateOTPValue=c5(this,"updateOTPValue",7),this.displayOTP=void 0,this.sdkVersion=void 0,this.otpCode=void 0,this.translationsLoaded=!1,this.i18nInstance=new d7}async connectedCallback(){await this.i18nInstance.init({fallbackLng:"en"}),this.translationsLoaded=!0}onClose(){this.close.emit()}onDisconnect(){this.disconnect.emit()}onUpdateOTPValueHandler(e){this.updateOTPValue.emit({otpValue:e})}disconnectedCallback(){this.onClose()}render(){var e;if(!this.translationsLoaded)return null;let t=null==(e=this.displayOTP)||e,n=this.sdkVersion,r=e=>this.i18nInstance.t(e);return cJ(dL,{className:"pending-modal"},cJ("div",{class:"backdrop",onClick:()=>this.onClose()}),cJ("div",{class:"modal"},cJ("div",{class:"closeButtonContainer"},cJ("div",{class:"right"},cJ("span",{class:"closeButton",onClick:()=>this.onClose()},cJ(dH,null)))),cJ("div",{class:"logoContainer"},cJ(dF,null)),cJ("div",null,cJ("div",{class:"flexContainer",style:{flexDirection:"column",color:"black"}},cJ("div",{class:"flexItem",style:{textAlign:"center",marginTop:"30px",marginBottom:"30px",fontSize:"16px"}},r(t?"PENDING_MODAL.OPEN_META_MASK_SELECT_CODE":"PENDING_MODAL.OPEN_META_MASK_CONTINUE")),cJ("div",{id:"sdk-mm-otp-value",style:{padding:"10px",fontSize:"32px",display:this.otpCode?"block":"none"}},this.otpCode),t&&cJ("div",{class:"notice"},"* ",r("PENDING_MODAL.NUMBER_AFTER_OPEN_NOTICE"))),cJ("div",{style:{marginTop:"20px"}},cJ("button",{class:"button blue",style:{marginTop:"5px",color:"#0376C9",borderColor:"#0376C9",borderWidth:"1px",borderStyle:"solid",backgroundColor:"white"},onClick:()=>this.onDisconnect()},r("PENDING_MODAL.DISCONNECT")))),cJ(dU,{version:n})))}get el(){return c3(this)}};ut.style=
vendor: 3,083 bytes, line 6
6".flexContainer {\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    flex-direction: row;\n}\n\n.flexItem {\n    flex: 1;\n    justify-content: center;\n    align-items: center;\n}\n\n.flexItem11 {\n    flex: 11;\n    justify-content: center;\n    align-items: center;\n}\n\n.flexItem1 {\n    flex: 1;\n    justify-content: center;\n    align-items: center;\n}\n\n.tab {\n    padding: 8px;\n    cursor: pointer;\n    background-color: #F2F4F6;\n    font-size: 12px;\n    text-align: center;\n    color: #24292E;\n}\n\n.tabcontainer {\n    padding: 4px;\n    background-color: #F2F4F6;\n    border-radius: 8px;\n    margin-bottom: 30px;\n    margin-top: 30px;\n}\n\n.tabactive {\n    background-color: white;\n    -webkit-transition: background-color 300ms linear;\n    -ms-transition: background-color 300ms linear;\n    transition: background-color 300ms linear;\n    border-radius: 8px;\n}\n\n.item {\n    font-size: 12px;\n    margin-bottom: 16px;\n    border-radius: 8px;\n    padding: 10px;\n    border: 2px #F2F4F6 solid;\n    color: #24292E;\n}\n\n.extensionLabel {\n    font-style: normal;\n    font-weight: bold;\n    font-size: 14px;\n    text-align: cetner;\n    color: #24272A;\n}\n\n.notice {\n    font-size: 12px;\n    margin-left: 10px;\n    margin-right: 10px;\n    color: grey;\n}\n\n.button {\n    margin-top: 41.5px;\n    margin-bottom: 20px;\n    width: 100%;\n    display: flex;\n    flex-direction: row;\n    justify-content: center;\n    align-items: center;\n    padding: 12px 20px;\n    background: #037DD6;\n    border-radius: 32px;\n    color: white;\n    border: 0;\n    font-size: 14px;\n    cursor: pointer;\n}\n\n.backdrop {\n    visibility: visible;\n    position: fixed;\n    top: 0;\n    left: 0;\n    right: 0;\n    bottom: 0;\n    width: 100%;\n    z-index: 99998;\n    background: rgba(0, 0, 0, 0.87);\n    opacity: 0.3;\n}\n\n.modal {\n    visibility: visible;\n    position: fixed;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 99999;\n    background: white;\n    padding: 20px;\n    border-radius: 8px;\n    top: 50%;\n    max-width: 100%;\n    width: 460px;\n    min-width: 300px;\n    box-shadow: rgba(0, 0, 0, 0.2) 0px 11px 15px -7px, rgba(0, 0, 0, 0.14) 0px 24px 38px 3px, rgba(0, 0, 0, 0.12) 0px 9px 46px 8px;\n    -webkit-font-smoothing: antialiased;\n}\n\n.closeButton {\n    color: #BBC0C5;\n    cursor: pointer;\n}\n\n.logoContainer {\n    margin-left: 24px;\n    margin-right: 24px;\n    margin-top: 24px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n}\n\n.connectMobileText {\n    font-size: 14px;\n    color: black;\n    margin-top: 28px;\n    margin-bottom: 28px;\n    line-height: 2;\n}\n\n.blue {\n    color: #037DD6;\n    font-weight: 700;\n}\n\n.installExtensionText {\n    margin-left: 10px;\n}\n\n.center {\n    display: flex;\n    justify-content: center;\n    align-items: center;\n}\n\n.right {\n    display: flex;\n    align-items: center;\n    justify-content: right;\n}\n\n#sdk-mm-qrcode {\n    svg {\n        width: 50%;\n    }\n}";
6let un=()=>cJ("svg",{width:"21",height:"15",viewBox:"0 0 21 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},cJ("path",{d:"M14.1364 14.9851C13.5909 14.9851 13.2273 14.5851 13.2273 13.9851C13.2273 13.3851 13.5909 12.9851 14.1364 12.9851C16.6818 12.9851 18.6818 10.7851 18.6818 7.98508C18.6818 5.18508 16.6818 2.98508 14.1364 2.98508C11.5909 2.98508 9.59091 5.18508 9.59091 7.98508C9.59091 8.58508 9.22727 8.98508 8.68182 8.98508C8.13636 8.98508 7.77273 8.58508 7.77273 7.98508C7.77273 4.08508 10.5909 0.985077 14.1364 0.985077C17.6818 0.985077 20.5 4.08508 20.5 7.98508C20.5 11.8851 17.6818 14.9851 14.1364 14.9851ZM6.68182 14.7851C3.22727 14.7851 0.5 11.6851 0.5 7.98508C0.5 4.28508 3.22727 1.18508 6.68182 1.18508C7.22727 1.18508 7.59091 1.58508 7.59091 2.18508C7.59091 2.78508 7.22727 3.18508 6.68182 3.18508C4.22727 3.18508 2.31818 5.38508 2.31818 7.98508C2.31818 10.5851 4.22727 12.7851 6.68182 12.7851C9.13636 12.7851 11.0455 10.6851 11.0455 7.98508C11.0455 7.38508 11.4091 6.98508 11.9545 6.98508C12.5 6.98508 12.8636 7.38508 12.8636 7.98508C12.7727 11.6851 10.0455 14.7851 6.68182 14.7851Z",fill:"white"})),ur=()=>cJ("svg",{width:"400",height:"300",viewBox:"0 0 400 300",fill:"none",xmlns:"http://www.w3.org/2000/svg"},cJ("rect",{width:"400",height:"300",fill:"white"}),cJ("path",{d:"M300.116 242.46L250.485 227.681L213.057 250.055L186.944 250.045L149.493 227.681L99.8843 242.46L84.7939 191.518L99.8843 134.979L84.7939 87.1777L99.8843 27.9336L177.402 74.2466H222.598L300.116 27.9336L315.206 87.1777L300.116 134.979L315.206 191.518L300.116 242.46Z",fill:"#FF5C16"}),cJ("path",{d:"M99.8955 27.9336L177.414 74.2792L174.331 106.085L99.8955 27.9336Z",fill:"#FF5C16"}),cJ("path",{d:"M149.505 191.539L183.612 217.521L149.505 227.681V191.539Z",fill:"#FF5C16"}),cJ("path",{d:"M180.886 148.585L174.33 106.107L132.369 134.991L132.348 134.98V135.001L132.477 164.732L149.493 148.585H149.504H180.886Z",fill:"#FF5C16"}),cJ("path",{d:"M300.116 27.9336L222.598 74.2792L225.67 106.085L300.116 27.9336Z",fill:"#FF5C16"}),cJ("path",{d:"M250.508 191.539L216.4 217.521L250.508 227.681V191.539Z",fill:"#FF5C16"}),cJ("path",{d:"M267.652 135.001H267.663H267.652V134.98L267.641 134.991L225.68 106.107L219.125 148.585H250.507L267.533 164.732L267.652 135.001Z",fill:"#FF5C16"}),cJ("path",{d:"M149.493 227.681L99.8843 242.46L84.7939 191.54H149.493V227.681Z",fill:"#E34807"}),cJ("path",{d:"M180.875 148.574L190.351 209.98L177.219 175.838L132.456 164.732L149.483 148.574H180.864H180.875Z",fill:"#E34807"}),cJ("path",{d:"M250.507 227.681L300.116 242.46L315.206 191.54H250.507V227.681Z",fill:"#E34807"}),cJ("path",{d:"M219.126 148.574L209.649 209.98L222.782 175.838L267.545 164.732L250.507 148.574H219.126Z",fill:"#E34807"}),cJ("path",{d:"M84.7939 191.517L99.8843 134.979H132.337L132.456 164.721L177.219 175.826L190.351 209.969L183.601 217.488L149.493 191.506H84.7939V191.517Z",fill:"#FF8D5D"}),cJ("path",{d:"M315.206 191.517L300.116 134.979H267.664L267.545 164.721L222.782 175.826L209.649 209.969L216.4 217.488L250.507 191.506H315.206V191.517Z",fill:"#FF8D5D"}),cJ("path",{d:"M222.598 74.2466H200H177.402L174.33 106.053L190.351 209.936H209.649L225.681 106.053L222.598 74.2466Z",fill:"#FF8D5D"}),cJ("path",{d:"M99.8843 27.9336L84.7939 87.1777L99.8843 134.979H132.337L174.319 106.085L99.8843 27.9336Z",fill:"#661800"}),cJ("path",{d:"M171.496 160.906H156.795L148.79 168.752L177.229 175.804L171.496 160.896V160.906Z",fill:"#661800"}),cJ("path",{d:"M300.116 27.9336L315.206 87.1777L300.116 134.979H267.663L225.681 106.085L300.116 27.9336Z",fill:"#661800"}),cJ("path",{d:"M228.525 160.906H243.248L251.253 168.763L222.781 175.826L228.525 160.896V160.906Z",fill:"#661800"}),cJ("path",{d:"M213.046 229.789L216.399 217.51L209.649 209.991H190.34L183.59 217.51L186.943 229.789",fill:"#661800"}),cJ("path",{d:"M213.047 229.789V250.066H186.944V229.789H213.047Z",fill:"#C0C4CD"}),cJ("path",{d:"M149.504 227.66L186.965 250.056V229.779L183.611 217.5L149.504 227.66Z",fill:"#E7EBF6"}),cJ("path",{d:"M250.506 227.66L213.045 250.056V229.779L216.398 217.5L250.506 227.66Z",fill:"#E7EBF6"})),ui=class{constructor(e){cS(this,e),this.close=c5(this,"close",7),this.connectWithExtension=c5(this,"connectWithExtension",7),this.link=void 0,this.sdkVersion=void 0,this.preferDesktop=void 0,this.tab=1,this.isDefaultTab=!0,this.translationsLoaded=!1,this.i18nInstance=new d7,this.setTab(this.preferDesktop?1:2)}async connectedCallback(){await this.i18nInstance.init({fallbackLng:"en"}),this.translationsLoaded=!0}onClose(e=!1){this.close.emit({shouldTerminate:e})}
6connectWithExtensionHandler(){this.connectWithExtension.emit()}setTab(e){this.tab=e,this.isDefaultTab=!1}disconnectedCallback(){this.onClose()}updatePreferDesktop(e){e?this.setTab(1):this.setTab(2)}render(){if(!this.translationsLoaded)return null;let e=e=>this.i18nInstance.t(e),t=this.sdkVersion,n=this.isDefaultTab?this.preferDesktop?1:2:this.tab,r=d4(this.link,"svg",{ecc:"medium",scale:2});return cJ(dL,{className:"select-modal"},cJ("div",{class:"backdrop",onClick:()=>this.onClose(!0)}),cJ("div",{class:"modal"},cJ("div",{class:"closeButtonContainer"},cJ("div",{class:"right"},cJ("span",{class:"closeButton",onClick:()=>this.onClose(!0)},cJ(dH,null)))),cJ("div",{class:"logoContainer"},cJ(dF,null)),cJ("div",null,cJ("div",{class:"tabcontainer"},cJ("div",{class:"flexContainer"},cJ("div",{onClick:()=>this.setTab(1),class:"tab flexItem "+(1===n?"tabactive":"")},e("DESKTOP")),cJ("div",{onClick:()=>this.setTab(2),class:"tab flexItem "+(2===n?"tabactive":"")},e("MOBILE")))),cJ("div",{style:{display:1===n?"none":"block"}},cJ("div",{class:"flexContainer"},cJ("div",{class:"flexItem",style:{textAlign:"center",marginTop:"4"}},cJ("div",{class:"center",id:"sdk-mm-qrcode",innerHTML:r}),cJ("div",{class:"connectMobileText"},e("SCAN_TO_CONNECT"),cJ("br",null),cJ("span",{class:"blue"},cJ("b",null,e("META_MASK_MOBILE_APP"))))))),cJ("div",{style:{display:2===n?"none":"block"}},cJ("div",{style:{display:"flex",justifyContent:"center",height:"300",marginTop:"-20"}},cJ(ur,null)),cJ("div",{class:"extensionLabel"},e("SELECT_MODAL.CRYPTO_TAKE_CONTROL_TEXT")),cJ("button",{class:"button",onClick:()=>this.connectWithExtensionHandler()},cJ(un,null),cJ("span",{class:"installExtensionText"},e("CONNECT_WITH_EXTENSION"))))),cJ(dU,{version:t})))}get el(){return c3(this)}static get watchers(){return{preferDesktop:["updatePreferDesktop"]}}};ui.style=
vendor: 3,083 bytes, line 6
6".flexContainer {\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    flex-direction: row;\n}\n\n.flexItem {\n    flex: 1;\n    justify-content: center;\n    align-items: center;\n}\n\n.flexItem11 {\n    flex: 11;\n    justify-content: center;\n    align-items: center;\n}\n\n.flexItem1 {\n    flex: 1;\n    justify-content: center;\n    align-items: center;\n}\n\n.tab {\n    padding: 8px;\n    cursor: pointer;\n    background-color: #F2F4F6;\n    font-size: 12px;\n    text-align: center;\n    color: #24292E;\n}\n\n.tabcontainer {\n    padding: 4px;\n    background-color: #F2F4F6;\n    border-radius: 8px;\n    margin-bottom: 30px;\n    margin-top: 30px;\n}\n\n.tabactive {\n    background-color: white;\n    -webkit-transition: background-color 300ms linear;\n    -ms-transition: background-color 300ms linear;\n    transition: background-color 300ms linear;\n    border-radius: 8px;\n}\n\n.item {\n    font-size: 12px;\n    margin-bottom: 16px;\n    border-radius: 8px;\n    padding: 10px;\n    border: 2px #F2F4F6 solid;\n    color: #24292E;\n}\n\n.extensionLabel {\n    font-style: normal;\n    font-weight: bold;\n    font-size: 14px;\n    text-align: cetner;\n    color: #24272A;\n}\n\n.notice {\n    font-size: 12px;\n    margin-left: 10px;\n    margin-right: 10px;\n    color: grey;\n}\n\n.button {\n    margin-top: 41.5px;\n    margin-bottom: 20px;\n    width: 100%;\n    display: flex;\n    flex-direction: row;\n    justify-content: center;\n    align-items: center;\n    padding: 12px 20px;\n    background: #037DD6;\n    border-radius: 32px;\n    color: white;\n    border: 0;\n    font-size: 14px;\n    cursor: pointer;\n}\n\n.backdrop {\n    visibility: visible;\n    position: fixed;\n    top: 0;\n    left: 0;\n    right: 0;\n    bottom: 0;\n    width: 100%;\n    z-index: 99998;\n    background: rgba(0, 0, 0, 0.87);\n    opacity: 0.3;\n}\n\n.modal {\n    visibility: visible;\n    position: fixed;\n    left: 50%;\n    transform: translate(-50%, -50%);\n    z-index: 99999;\n    background: white;\n    padding: 20px;\n    border-radius: 8px;\n    top: 50%;\n    max-width: 100%;\n    width: 460px;\n    min-width: 300px;\n    box-shadow: rgba(0, 0, 0, 0.2) 0px 11px 15px -7px, rgba(0, 0, 0, 0.14) 0px 24px 38px 3px, rgba(0, 0, 0, 0.12) 0px 9px 46px 8px;\n    -webkit-font-smoothing: antialiased;\n}\n\n.closeButton {\n    color: #BBC0C5;\n    cursor: pointer;\n}\n\n.logoContainer {\n    margin-left: 24px;\n    margin-right: 24px;\n    margin-top: 24px;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n}\n\n.connectMobileText {\n    font-size: 14px;\n    color: black;\n    margin-top: 28px;\n    margin-bottom: 28px;\n    line-height: 2;\n}\n\n.blue {\n    color: #037DD6;\n    font-weight: 700;\n}\n\n.installExtensionText {\n    margin-left: 10px;\n}\n\n.center {\n    display: flex;\n    justify-content: center;\n    align-items: center;\n}\n\n.right {\n    display: flex;\n    align-items: center;\n    justify-content: right;\n}\n\n#sdk-mm-qrcode {\n    svg {\n        width: 50%;\n    }\n}";
6var uo=Object.freeze({__proto__:null,mm_install_modal:ue,mm_pending_modal:ut,mm_select_modal:ui})}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.