PageSourceSearch

https://playsout.com/_next/static/chunks/25106cdc.efc7d986786e984a.js

js playsout.com collected 2026-09-24 10:47:15 UTC 444,515 bytes, 6 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6769],{2230:(e,t,n)=>{let r;n.d(t,{default:()=>cQ});var i,o,a=n(55541),s=n.n(a),l=n(62207),c=n.n(l),d=n(98831),u=n(33175),h=n.n(u),f=n(16148),p=n(46154),g=n(12692);function m(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 y=void 0!==n.g?n.g:"u">typeof self?self:"u">typeof window?window:{},v=[],b=[],w="u">typeof Uint8Array?Uint8Array:Array,E=!1;function _(){E=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)v[t]=e[t],b[e.charCodeAt(t)]=t;b[45]=62,b[95]=63}function S(e){var t;E||_();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(v[(r=(e[o]<<16)+(e[o+1]<<8)+e[o+2])>>18&63]+v[r>>12&63]+v[r>>6&63]+v[63&r]);return i.join("")}(e,a,a+16383>s?s:a+16383));return 1===r?(i+=v[(t=e[n-1])>>2],i+=v[t<<4&63],i+="=="):2===r&&(i+=v[(t=(e[n-2]<<8)+e[n-1])>>10],i+=v[t>>4&63],i+=v[t<<2&63],i+="="),o.push(i),o.join("")}function x(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 k={}.toString,M=Array.isArray||function(e){return"[object Array]"==k.call(e)};O.TYPED_ARRAY_SUPPORT=void 0===y.TYPED_ARRAY_SUPPORT||y.TYPED_ARRAY_SUPPORT;var A=I();function I(){return O.TYPED_ARRAY_SUPPORT?0x7fffffff:0x3fffffff}function P(e,t){if(I()<t)throw RangeError("Invalid typed array length");return O.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=O.prototype:(null===e&&(e=new O(t)),e.length=t),e}function O(e,t,n){if(!(O.TYPED_ARRAY_SUPPORT||this instanceof O))return new O(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 L(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"u">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),O.TYPED_ARRAY_SUPPORT?(e=t).__proto__=O.prototype:e=N(e,t),e}(e,t,n,r):"string"==typeof t?function(e,t,n){if("string"==typeof n&&""!==n||(n="utf8"),!O.isEncoding(n))throw TypeError('"encoding" must be a valid string encoding');var r=0|B(t,n),i=(e=P(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|$(t.length);return 0===(e=P(e,r)).length||t.copy(e,0,0,r),e}if(t){if("u">typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(n=t.length)!=n?P(e,0):N(e,t);if("Buffer"===t.type&&M(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 T(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 L(e,t){if(T(t),e=P(e,t<0?0:0|$(t)),!O.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|$(t.length);e=P(e,n);for(var r=0;r<n;r+=1)e[r]=255&t[r];return e}function $(e){if(e>=I())throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+I().toString(16)+" bytes");return 0|e}function D(e){return!(null==e||!e._isBuffer)}function B(e,t){if(D(e))return e.length;if("u">
1typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(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 ee(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return et(e).length;default:if(r)return ee(e).length;t=(""+t).toLowerCase(),r=!0}}function K(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 z(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 j(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function U(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=O.from(t,r)),D(t))return 0===t.length?-1:H(e,t,n,r,i);if("number"==typeof t)return t&=255,O.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):H(e,[t],n,r,i);throw TypeError("val must be string, number or Buffer")}function H(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 F(e,t,n,r){return en(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function z(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<=q)return String.fromCharCode.apply(String,r);for(var f="",p=0;p<h;)f+=String.fromCharCode.apply(String,r.slice(p,p+=q));return f}O.poolSize=8192,O._augment=function(e){return e.__proto__=O.prototype,e},O.from=function(e,t,n){return R(null,e,t,n)},O.TYPED_ARRAY_SUPPORT&&(O.prototype.__proto__=Uint8Array.prototype,O.__proto__=Uint8Array,"u">typeof Symbol&&Symbol.species&&O[Symbol.species]),O.alloc=function(e,t,n){return T(e),e<=0?P(null,e):void 0!==t?"string"==typeof n?P(null,e).fill(t,n):P(null,e).fill(t):P(null,e)},O.allocUnsafe=function(e){return L(null,e)},O.allocUnsafeSlow=function(e){return L(null,e)},O.isBuffer=er,O.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)},O.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}},O.concat=function(e,t){if(!M(e))throw TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return O.alloc(0);if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var n,r=O.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var o=e[n];
vendor: 10,682 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},O.byteLength=B,O.prototype._isBuffer=!0,O.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)j(this,t,t+1);return this},O.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)j(this,t,t+3),j(this,t+1,t+2);return this},O.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)j(this,t,t+7),j(this,t+1,t+6),j(this,t+2,t+5),j(this,t+3,t+4);return this},O.prototype.toString=function(){var e=0|this.length;return 0===e?"":0==arguments.length?z(this,0,e):K.apply(this,arguments)},O.prototype.equals=function(e){if(!D(e))throw TypeError("Argument must be a Buffer");return this===e||0===O.compare(this,e)},O.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+">"},O.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)},O.prototype.includes=function(e,t,n){return -1!==this.indexOf(e,t,n)},O.prototype.indexOf=function(e,t,n){return U(this,e,t,n,!0)},O.prototype.lastIndexOf=function(e,t,n){return U(this,e,t,n,!1)},O.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,en(ee(e,this.length-i),this,i,o);case"ascii":case"latin1":case"binary":return F(this,e,t,n);case"base64":return a=t,s=n,en(et(e),this,a,s);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return l=t,c=n,en(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}},O.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var q=4096;function V(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 G(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 Y(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 Z(e,t,n,r,i,o){if(n+r>e.length||n<0)throw RangeError("Index out of range")}function J(e,t,n,r,i){return i||Z(e,0,n,4),C(e,t,n,r,23,4),n+4}function X(e,t,n,r,i){return i||Z(e,0,n,8),C(e,t,n,r,52,8),n+8}O.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),O.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=O.prototype;else{var i=t-e;n=new O(i,void 0);for(var o=0;o<i;++o)n[o]=this[o+e]}return n},O.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||V(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r},O.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||V(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},O.prototype.readUInt8=function(e,t){return t||V(e,1,this.length),this[e]},O.prototype.readUInt16LE=function(e,t){return t||V(e,2,this.length),this[e]|this[e+1]<<8},O.prototype.readUInt16BE=function(e,t){return t||V(e,2,this.length),this[e]<<8|this[e+1]},O.prototype.readUInt32LE=function(e,t){return t||V(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+0x1000000*this[e+3]},O.prototype.readUInt32BE=function(e,t){return t||V(e,4,this.length),0x1000000*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},O.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||V(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},O.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||V(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},O.prototype.readInt8=function(e,t){return t||V(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},O.prototype.readInt16LE=function(e,t){t||V(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?0xffff0000|n:n},O.prototype.readInt16BE=function(e,t){t||V(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?0xffff0000|n:n},O.prototype.readInt32LE=function(e,t){return t||V(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},O.prototype.readInt32BE=function(e,t){return t||V(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},O.prototype.readFloatLE=function(e,t){return t||V(e,4,this.length),x(this,e,!0,23,4)},O.prototype.readFloatBE=function(e,t){return t||V(e,4,this.length),x(this,e,!1,23,4)},O.prototype.readDoubleLE=function(e,t){return t||V(e,8,this.length),x(this,e,!0,52,8)},O.prototype.readDoubleBE=function(e,t){return t||V(e,8,this.length),x(this,e,!1,52,8)},O.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},O.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},O.prototype.writeUInt8=function(e,t,n){return e*=1,t|=0,n||W(this,e,t,1,255,0),O.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},O.prototype.writeUInt16LE=function(e,t,n){return e*=1,t|=0,n||W(this,e,t,2,65535,0),O.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):G(this,e,t,!0),t+2},O.prototype.writeUInt16BE=function(e,t,n){return e*=1,t|=0,n||W(this,e,t,2,65535,0),O.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):G(this,e,t,!1),t+2},O.prototype.writeUInt32LE=function(e,t,n){return e*=1,t|=0,n||W(this,e,t,4,0xffffffff,0),O.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):Y(this,e,t,!0),t+4},O.prototype.writeUInt32BE=function(e,t,n){return e*=1,t|=0,n||W(this,e,t,4,0xffffffff,0),O.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Y(this,e,t,!1),t+4},O.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},O.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},O.prototype.writeInt8=function(e,t,n){return e*=1,t|=0,n||W(this,e,t,1,127,-128),O.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},O.prototype.writeInt16LE=function(e,t,n){return e*=1,t|=0,n||W(this,e,t,2,32767,-32768),O.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):G(this,e,t,!0),t+2},O.prototype.writeInt16BE=function(e,t,n){return e*=1,t|=0,n||W(this,e,t,2,32767,-32768),O.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):G(this,e,t,!1),t+2},O.prototype.writeInt32LE=function(e,t,n){return e*=1,t|=0,n||W(this,e,t,4,0x7fffffff,-0x80000000),O.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):Y(this,e,t,!0),t+4},O.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),O.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Y(this,e,t,!1),t+4},O.prototype.writeFloatLE=function(e,t,n){return J(this,e,t,!0,n)},O.prototype.writeFloatBE=function(e,t,n){return J(this,e,t,!1,n)},O.prototype.writeDoubleLE=function(e,t,n){return X(this,e,t,!0,n)},O.prototype.writeDoubleBE=function(e,t,n){return X(this,e,t,!1,n)},O.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||!O.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},O.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&&!O.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:ee(new O(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 ee(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 et(e){return function(e){E||_();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 w(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=b[e.charCodeAt(t)]<<18|b[e.charCodeAt(t+1)]<<12|b[e.charCodeAt(t+2)]<<6|b[e.charCodeAt(t+3)],a[l++]=i>>16&255,a[l++]=i>>8&255,a[l++]=255&i;return 2===o?(i=b[e.charCodeAt(t)]<<2|b[e.charCodeAt(t+1)]>>4,a[l++]=255&i):1===o&&(i=b[e.charCodeAt(t)]<<10|b[e.charCodeAt(t+1)]<<4|b[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 en(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 er(e){return null!=e&&(!!e._isBuffer||ei(e)||"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&ei(e.slice(0,0)))}function ei(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var eo=Object.freeze({__proto__:null,Buffer:O,INSPECT_MAX_BYTES:50,SlowBuffer:function(e){return+e!=e&&(e=0),O.alloc(+e)},isBuffer:er,kMaxLength:A}),ea="u">typeof globalThis?globalThis:"u">typeof window?window:void 0!==n.g?n.g:"u">typeof self?self:{};function es(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function el(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 ec={},ed={},eu={};function eh(e){if(!Number.isSafeInteger(e)||e<0)throw Error(`positive integer expected, not ${e}`)}function ef(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 eg(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 em(e){if("function"!=typeof e||"function"!=typeof e.create)throw Error("hash must be wrapped by utils.wrapConstructor");eh(e.outputLen),eh(e.blockLen)}function ey(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 ev(e,t){eg(e);let n=t.outputLen;if(e.length<n)throw Error(`digestInto() expects output buffer of length at least ${n}`)}Object.defineProperty(eu,"__esModule",{value:!0}),eu.isBytes=ep,eu.number=eh,eu.bool=ef,eu.bytes=eg,eu.hash=em,eu.exists=ey,eu.output=ev,eu.default={number:eh,bool:ef,bytes:eg,hash:em,exists:ey,output:ev},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=o,e.hexToNumber=a,e.bytesToNumberBE=function(e){return a(r(e))},e.numberToBytesBE=function(e,t){return o(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=s,e.bytesToUtf8=function(e){return(new TextDecoder).decode(e)},e.toBytes=function(e){if("string"==typeof e)e=s(e);else{if(!(0,t.isBytes)(e))throw Error("Uint8Array expected, got "+typeof e);e=c(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=l,e.u64Lengths=function(t,n){let r=new Uint8Array(16),i=(0,e.createView)(r);return l(i,0,BigInt(n?n.length:0),!0),l(i,8,BigInt(t.length),!0),r},e.isAligned32=function(e){return e.byteOffset%4==0},e.copyBytes=c,e.clean=function(...e){for(let t=0;t<e.length;t++)e[t].fill(0)};let t=eu;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}function i(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:void 0}function o(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,o=0;t<n;t++,o+=2){let n=i(e.charCodeAt(o)),a=i(e.charCodeAt(o+1));if(void 0===n||void 0===a)throw Error('hex string expected, got non-hex character "'+(e[o]+e[o+1])+'" at index '+o);r[t]=16*n+a}return r}function a(e){if("string"!=typeof e)throw Error("hex string expected, got "+typeof e);return BigInt(""===e?"0":`0x${e}`)}function s(e){if("string"!=typeof e)throw Error("string expected, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}function l(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 c(e){return Uint8Array.from(e)}e.nextTick=async()=>{},e.Hash=class{},e.wrapCipher=(e,t)=>(Object.assign(t,e),t)}(ed);var eb={},ew={};Object.defineProperty(ew,"__esModule",{value:!0}),ew.AEAD_TAG_LENGTH=ew.XCHACHA20_NONCE_LENGTH=ew.CURVE25519_PUBLIC_KEY_SIZE=ew.ETH_PUBLIC_KEY_SIZE=ew.UNCOMPRESSED_PUBLIC_KEY_SIZE=ew.COMPRESSED_PUBLIC_KEY_SIZE=ew.SECRET_KEY_LENGTH=void 0,ew.SECRET_KEY_LENGTH=32,ew.COMPRESSED_PUBLIC_KEY_SIZE=33,ew.UNCOMPRESSED_PUBLIC_KEY_SIZE=65,ew.ETH_PUBLIC_KEY_SIZE=64,ew.CURVE25519_PUBLIC_KEY_SIZE=32,ew.XCHACHA20_NONCE_LENGTH=24,ew.AEAD_TAG_LENGTH=16,Object.defineProperty(eb,"__esModule",{value:!0}),eb.ephemeralKeySize=eb.symmetricNonceLength=eb.symmetricAlgorithm=eb.isHkdfKeyCompressed=eb.isEphemeralKeyCompressed=eb.ellipticCurve=eb.ECIES_CONFIG=void 0,eb.ECIES_CONFIG=new function(){this.ellipticCurve="secp256k1",this.isEphemeralKeyCompressed=!1,this.isHkdfKeyCompressed=!1,this.symmetricAlgorithm="aes-256-gcm",this.symmetricNonceLength=16},eb.ellipticCurve=function(){return eb.ECIES_CONFIG.ellipticCurve},eb.isEphemeralKeyCompressed=function(){return eb.ECIES_CONFIG.isEphemeralKeyCompressed},eb.isHkdfKeyCompressed=function(){return eb.ECIES_CONFIG.isHkdfKeyCompressed},eb.symmetricAlgorithm=function(){return eb.ECIES_CONFIG.symmetricAlgorithm},eb.symmetricNonceLength=function(){return eb.ECIES_CONFIG.symmetricNonceLength},eb.ephemeralKeySize=function(){var e={secp256k1:eb.ECIES_CONFIG.isEphemeralKeyCompressed?ew.COMPRESSED_PUBLIC_KEY_SIZE:ew.UNCOMPRESSED_PUBLIC_KEY_SIZE,x25519:ew.CURVE25519_PUBLIC_KEY_SIZE,ed25519:ew.CURVE25519_PUBLIC_KEY_SIZE};if(eb.ECIES_CONFIG.ellipticCurve in e)return e[eb.ECIES_CONFIG.ellipticCurve];throw Error("Not implemented")};var eE={},e_={},eS={},ex={},eC={},ek={};Object.defineProperty(ek,"__esModule",{value:!0}),ek.crypto=void 0,ek.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=eu,n=ed;function r(e=32){if(ek.crypto&&"function"==typeof ek.crypto.getRandomValues)return ek.crypto.getRandomValues(new Uint8Array(e));if(ek.crypto&&"function"==typeof ek.crypto.randomBytes)return ek.crypto.randomBytes(e);throw Error("crypto.getRandomValues must be defined")}function i(){if(ek.crypto&&"object"==typeof ek.crypto.subtle&&null!=ek.crypto.subtle)return ek.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="AES-CBC",a="AES-CTR",s="AES-GCM";function l(n){return(r,i,l)=>{(0,t.bytes)(r),(0,t.bytes)(i);let c={name:n,length:8*r.length},d=function(e,t,n){if(e===o)return{name:o,iv:t};if(e===a)return{name:a,counter:t,length:64};if(e===s)return n?{name:s,iv:t,additionalData:n}:{name:s,iv:t};throw Error("unknown aes block mode")}(n,i,l);return{encrypt:n=>((0,t.bytes)(n),e.utils.encrypt(r,c,d,n)),decrypt:n=>((0,t.bytes)(n),e.utils.decrypt(r,c,d,n))}}}e.cbc=l(o),e.ctr=l(a),e.gcm=l(s)}(eC);var eM={},eA={},eI={},eP={};function eO(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 eT(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}function eL(e,...t){if(!eT(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");eO(e.outputLen),eO(e.blockLen)}function e$(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){eL(e);let n=t.outputLen;if(e.length<n)throw Error(`digestInto() expects output buffer of length at least ${n}`)}Object.defineProperty(eP,"__esModule",{value:!0}),eP.isBytes=eT,eP.number=eO,eP.bool=eR,eP.bytes=eL,eP.hash=eN,eP.exists=e$,eP.output=eD,eP.default={number:eO,bool:eR,bytes:eL,hash:eN,exists:e$,output:eD};var eB={},eK={};Object.defineProperty(eK,"__esModule",{value:!0}),eK.crypto=void 0,eK.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,o=0;t<n;t++,o+=2){let n=i(e.charCodeAt(o)),a=i(e.charCodeAt(o+1));if(void 0===n||void 0===a)throw Error('hex string expected, got non-hex character "'+(e[o]+e[o+1])+'" at index '+o);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=o,e.toBytes=a,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]"!==s.call(t))throw Error("Options should be object or undefined");return Object.assign(e,t)},e.wrapConstructor=function(e){let t=t=>e().update(a(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(a(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(a(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=eK,n=eP;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"));function i(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:void 0}function o(e){if("string"!=typeof e)throw Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}function a(e){return"string"==typeof e&&(e=o(e)),(0,n.bytes)(e),e}e.nextTick=async()=>{},e.Hash=class{clone(){return this._cloneInto()}};let s={}.toString}(eB),Object.defineProperty(eI,"__esModule",{value:!0}),eI.HashMD=eI.Maj=eI.Chi=void 0;let ej=eB;eI.Chi=(e,t,n)=>e&t^~e&n,eI.Maj=(e,t,n)=>e&t^e&n^t&n,eI.HashMD=class extends ej.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,ej.createView)(this.buffer)}update(e){(0,eP.exists)(this);let{view:t,buffer:n,blockLen:r}=this,i=(e=(0,ej.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,ej.createView)(e);for(;r<=i-o;o+=r)this.process(t,o)}}return this.length+=e.length,this.roundClean(),this}digestInto(e){(0,eP.exists)(this),(0,eP.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,ej.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 eU={};Object.defineProperty(eU,"__esModule",{value:!0}),eU.add5L=eU.add5H=eU.add4H=eU.add4L=eU.add3H=eU.add3L=eU.rotlBL=eU.rotlBH=eU.rotlSL=eU.rotlSH=eU.rotr32L=eU.rotr32H=eU.rotrBL=eU.rotrBH=eU.rotrSL=eU.rotrSH=eU.shrSL=eU.shrSH=eU.toBig=void 0,eU.fromBig=ez,eU.split=eq,eU.add=e8;let eH=BigInt(0x100000000-1),eF=BigInt(32);function ez(e,t=!1){return t?{h:Number(e&eH),l:Number(e>>eF&eH)}:{h:0|Number(e>>eF&eH),l:0|Number(e&eH)}}
1function eq(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}=ez(e[i],t);[n[i],r[i]]=[o,a]}return[n,r]}let eV=(e,t)=>BigInt(e>>>0)<<eF|BigInt(t>>>0);eU.toBig=eV;let eW=(e,t,n)=>e>>>n;eU.shrSH=eW;let eG=(e,t,n)=>e<<32-n|t>>>n;eU.shrSL=eG;let eY=(e,t,n)=>e>>>n|t<<32-n;eU.rotrSH=eY;let eZ=(e,t,n)=>e<<32-n|t>>>n;eU.rotrSL=eZ;let eJ=(e,t,n)=>e<<64-n|t>>>n-32;eU.rotrBH=eJ;let eX=(e,t,n)=>e>>>n-32|t<<64-n;eU.rotrBL=eX;let eQ=(e,t)=>t;eU.rotr32H=eQ;let e0=(e,t)=>e;eU.rotr32L=e0;let e1=(e,t,n)=>e<<n|t>>>32-n;eU.rotlSH=e1;let e2=(e,t,n)=>t<<n|e>>>32-n;eU.rotlSL=e2;let e3=(e,t,n)=>t<<n-32|e>>>64-n;eU.rotlBH=e3;let e5=(e,t,n)=>e<<n-32|t>>>64-n;function e8(e,t,n,r){let i=(t>>>0)+(r>>>0);return{h:e+n+(i/0x100000000|0)|0,l:0|i}}eU.rotlBL=e5;let e6=(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0);eU.add3L=e6;let e4=(e,t,n,r)=>t+n+r+(e/0x100000000|0)|0;eU.add3H=e4;let e9=(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0);eU.add4L=e9;let e7=(e,t,n,r,i)=>t+n+r+i+(e/0x100000000|0)|0;eU.add4H=e7;let te=(e,t,n,r,i)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(i>>>0);eU.add5L=te;let tt=(e,t,n,r,i,o)=>t+n+r+i+o+(e/0x100000000|0)|0;eU.add5H=tt,eU.default={fromBig:ez,split:eq,toBig:eV,shrSH:eW,shrSL:eG,rotrSH:eY,rotrSL:eZ,rotrBH:eJ,rotrBL:eX,rotr32H:eQ,rotr32L:e0,rotlSH:e1,rotlSL:e2,rotlBH:e3,rotlBL:e5,add:e8,add3L:e6,add3H:e4,add4L:e9,add4H:e7,add5H:tt,add5L:te},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 tn=eI,[tr,ti]=eU.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))),to=new Uint32Array(80),ta=new Uint32Array(80);class ts extends tn.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)to[n]=e.getUint32(t),ta[n]=e.getUint32(t+=4);for(let e=16;e<80;e++){let t=0|to[e-15],n=0|ta[e-15],r=eU.default.rotrSH(t,n,1)^eU.default.rotrSH(t,n,8)^eU.default.shrSH(t,n,7),i=eU.default.rotrSL(t,n,1)^eU.default.rotrSL(t,n,8)^eU.default.shrSL(t,n,7),o=0|to[e-2],a=0|ta[e-2],s=eU.default.rotrSH(o,a,19)^eU.default.rotrBH(o,a,61)^eU.default.shrSH(o,a,6),l=eU.default.rotrSL(o,a,19)^eU.default.rotrBL(o,a,61)^eU.default.shrSL(o,a,6),c=eU.default.add4L(i,l,ta[e-7],ta[e-16]),d=eU.default.add4H(c,r,s,to[e-7],to[e-16]);to[e]=0|d,ta[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=eU.default.rotrSH(d,u,14)^eU.default.rotrSH(d,u,18)^eU.default.rotrBH(d,u,41),v=eU.default.rotrSL(d,u,14)^eU.default.rotrSL(d,u,18)^eU.default.rotrBL(d,u,41),b=d&h^~d&p,w=u&f^~u&g,E=eU.default.add5L(y,v,w,ti[e],ta[e]),_=eU.default.add5H(E,m,t,b,tr[e],to[e]),S=0|E,x=eU.default.rotrSH(n,r,28)^eU.default.rotrBH(n,r,34)^eU.default.rotrBH(n,r,39),C=eU.default.rotrSL(n,r,28)^eU.default.rotrBL(n,r,34)^eU.default.rotrBL(n,r,39),k=n&i^n&a^i&a,M=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}=eU.default.add(0|l,0|c,0|_,0|S)),l=0|a,c=0|s,a=0|i,s=0|o,i=0|n,o=0|r;let A=eU.default.add3L(S,C,M);n=eU.default.add3H(A,_,x,k),r=0|A}({h:n,l:r}=eU.default.add(0|this.Ah,0|this.Al,0|n,0|r)),({h:i,l:o}=eU.default.add(0|this.Bh,0|this.Bl,0|i,0|o)),({h:a,l:s}=eU.default.add(0|this.Ch,0|this.Cl,0|a,0|s)),({h:l,l:c}=eU.default.add(0|this.Dh,0|this.Dl,0|l,0|c)),({h:d,l:u}=eU.default.add(0|this.Eh,0|this.El,0|d,0|u)),({h:h,l:f}=eU.default.add(0|this.Fh,0|this.Fl,0|h,0|f)),({h:p,l:g}=eU.default.add(0|this.Gh,0|this.Gl,0|p,0|g)),({h:m,l:y}=eU.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(){to.fill(0),ta.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=ts;class tl extends ts{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=tl;class tc extends ts{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=tc;class td extends ts{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=td,eA.sha512=(0,eB.wrapConstructor)(()=>new ts),eA.sha512_224=(0,eB.wrapConstructor)(()=>new tl),eA.sha512_256=(0,eB.wrapConstructor)(()=>new tc),eA.sha384=(0,eB.wrapConstructor)(()=>new td);var tu={},th={},tf={},tp={};Object.defineProperty(tp,"__esModule",{value:!0}),tp.notImplemented=tp.bitMask=void 0,tp.isBytes=tv,tp.abytes=tb,tp.abool=function(e,t){if("boolean"!=typeof t)throw Error(`${e} must be valid boolean, got "${t}".`)},tp.bytesToHex=tE,tp.numberToHexUnpadded=t_,tp.hexToNumber=tS,tp.hexToBytes=tC,tp.bytesToNumberBE=function(e){return tS(tE(e))},tp.bytesToNumberLE=function(e){return tb(e),tS(tE(Uint8Array.from(e).reverse()))},tp.numberToBytesBE=tk,tp.numberToBytesLE=function(e,t){return tk(e,t).reverse()},tp.numberToVarBytesBE=function(e){return tC(t_(e))},tp.ensureBytes=function(e,t,n){let r;if("string"==typeof t)try{r=tC(t)}catch(n){throw Error(`${e} must be valid hex string, got "${t}". Cause: ${n}`)}else{if(!tv(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},tp.concatBytes=tM,tp.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},tp.utf8ToBytes=function(e){if("string"!=typeof e)throw Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))},tp.inRange=tI,tp.aInRange=function(e,t,n,r){if(!tI(t,n,r))throw Error(`expected valid ${e}: ${n} <= n < ${r}, got ${typeof t} ${t}`)},tp.bitLen=function(e){let t;for(t=0;e>tg;e>>=tm,t+=1);return t},tp.bitGet=function(e,t){return e>>BigInt(t)&tm}
1,tp.bitSet=function(e,t,n){return e|(n?tm:tg)<<BigInt(t)},tp.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=tP(e),i=tP(e),o=0,a=()=>{r.fill(1),i.fill(0),o=0},s=(...e)=>n(i,r,...e),l=(e=tP())=>{i=s(tO([0]),e),r=s(),0!==e.length&&(i=s(tO([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 tM(...n)};return(e,t)=>{let n;for(a(),l(e);!(n=t(c()));)l();return a(),n}},tp.validateObject=function(e,t,n={}){let r=(t,n,r)=>{let i=tR[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},tp.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 tg=BigInt(0),tm=BigInt(1),ty=BigInt(2);function tv(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}function tb(e){if(!tv(e))throw Error("Uint8Array expected")}let tw=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function tE(e){tb(e);let t="";for(let n=0;n<e.length;n++)t+=tw[e[n]];return t}function t_(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}`)}function tx(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:void 0}function tC(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=tx(e.charCodeAt(i)),o=tx(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 tC(e.toString(16).padStart(2*t,"0"))}function tM(...e){let t=0;for(let n=0;n<e.length;n++){let r=e[n];tb(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 tA=e=>"bigint"==typeof e&&tg<=e;function tI(e,t,n){return tA(e)&&tA(t)&&tA(n)&&t<=e&&e<n}tp.bitMask=e=>(ty<<BigInt(e-1))-tm;let tP=e=>new Uint8Array(e),tO=e=>Uint8Array.from(e),tR={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||tv(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)};tp.notImplemented=()=>{throw Error("not implemented")},Object.defineProperty(tf,"__esModule",{value:!0}),tf.isNegativeLE=void 0,tf.mod=tU,tf.pow=tH,tf.pow2=function(e,t,n){let r=e;for(;t-- >tL;)r*=r,r%=n;return r},tf.invert=tF,tf.tonelliShanks=tz,tf.FpSqrt=tq,tf.validateField=function(e){let t=tV.reduce((e,t)=>(e[t]="function",e),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"});return(0,tT.validateObject)(e,t)},tf.FpPow=tW,tf.FpInvertBatch=tG,tf.FpDiv=function(e,t,n){return e.mul(t,"bigint"==typeof n?tF(n,e.ORDER):e.inv(n))},tf.FpLegendre=tY,tf.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)}},tf.nLength=tZ,tf.Field=function(e,t,n=!1,r={}){if(e<=tL)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,tT.bitMask)(i),ZERO:tL,ONE:tN,create:t=>tU(t,e),isValid:t=>{if("bigint"!=typeof t)throw Error("Invalid field element: expected bigint, got "+typeof t);return tL<=t&&t<e},is0:e=>e===tL,isOdd:e=>(e&tN)===tN,neg:t=>tU(-t,e),eql:(e,t)=>
1e===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)=>tW(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,tT.numberToBytesLE)(e,o):(0,tT.numberToBytesBE)(e,o),fromBytes:e=>{if(e.length!==o)throw Error(`Fp.fromBytes: expected ${o}, got ${e.length}`);return n?(0,tT.bytesToNumberLE)(e):(0,tT.bytesToNumberBE)(e)}});return Object.freeze(s)},tf.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)},tf.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},tf.hashToPrivateScalar=function(e,t,n=!1){let r=(e=(0,tT.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,tT.bytesToNumberLE)(e):(0,tT.bytesToNumberBE)(e),t-tN)+tN},tf.getFieldBytesLength=tJ,tf.getMinHashLength=tX,tf.mapHashToField=function(e,t,n=!1){let r=e.length,i=tJ(t),o=tX(t);if(r<16||r<o||r>1024)throw Error(`expected ${o}-1024 bytes of input, got ${r}`);let a=tU(n?(0,tT.bytesToNumberBE)(e):(0,tT.bytesToNumberLE)(e),t-tN)+tN;return n?(0,tT.numberToBytesLE)(a,i):(0,tT.numberToBytesBE)(a,i)};let tT=tp,tL=BigInt(0),tN=BigInt(1),t$=BigInt(2),tD=BigInt(3),tB=BigInt(4),tK=BigInt(5),tj=BigInt(8);function tU(e,t){let n=e%t;return n>=tL?n:t+n}function tH(e,t,n){if(n<=tL||t<tL)throw Error("Expected power/modulo > 0");if(n===tN)return tL;let r=tN;for(;t>tL;)t&tN&&(r=r*e%n),e=e*e%n,t>>=tN;return r}function tF(e,t){if(e===tL||t<=tL)throw Error(`invert: expected positive integers, got n=${e} mod=${t}`);let n=tU(e,t),r=t,i=tL,o=tN;for(;n!==tL;){let e=r%n,t=i-r/n*o;r=n,n=e,i=o,o=t}if(r!==tN)throw Error("invert: does not exist");return tU(i,t)}function tz(e){let t,n,r,i=(e-tN)/t$;for(t=e-tN,n=0;t%t$===tL;t/=t$,n++);for(r=t$;r<e&&tH(r,i,e)!==e-tN;r++);if(1===n){let t=(e+tN)/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+tN)/t$;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,tN<<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===tD){let t=(e+tN)/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,t$),i=e.pow(r,t),o=e.mul(n,i),a=e.mul(e.mul(o,t$),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),tf.isNegativeLE=(e,t)=>(tU(e,t)&tN)===tN;let tV=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function tW(e,t,n){if(n<tL)throw Error("Expected power > 0");if(n===tL)return e.ONE;if(n===tN)return t;let r=e.ONE,i=t;for(;n>tL;)n&tN&&(r=e.mul(r,i)),i=e.sqr(i),n>>=tN;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-tN)/t$;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 tX(e){let t=tJ(e);return t+Math.ceil(t/2)}Object.defineProperty(th,"__esModule",{value:!0}),th.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;
1for(;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)}}},th.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},th.validateBasic=function(e){return(0,tQ.validateField)(e.Fp),(0,t0.validateObject)(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...(0,tQ.nLength)(e.n,e.nBitLength),...e,p:e.Fp.ORDER})};let tQ=tf,t0=tp,t1=BigInt(0),t2=BigInt(1),t3=new WeakMap,t5=new WeakMap;Object.defineProperty(tu,"__esModule",{value:!0}),tu.twistedEdwards=function(e){let t,n=(t=(0,t8.validateBasic)(e),t4.validateObject(e,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...t})),{Fp:r,n:i,prehash:o,hash:a,randomBytes:s,nByteLength:l,h:c}=n,d=nt<<BigInt(8*l)-ne,u=r.create,h=(0,t6.Field)(n.n,n.nBitLength),f=n.uvRatio||((e,t)=>{try{return{isValid:!0,value:r.sqrt(e*r.inv(t))}}catch(e){return{isValid:!1,value:t7}}}),p=n.adjustScalarBytes||(e=>e),g=n.domain||((e,t,n)=>{if((0,t9.abool)("phflag",n),t.length||n)throw Error("Contexts/pre-hash are not supported");return e});function m(e,t){t4.aInRange("coordinate "+e,t,t7,d)}function y(e){if(!(e instanceof w))throw Error("ExtendedPoint expected")}let v=(0,t9.memoized)((e,t)=>{let{ex:n,ey:i,ez:o}=e,a=e.is0();null==t&&(t=a?nn:r.inv(o));let s=u(n*t),l=u(i*t),c=u(o*t);if(a)return{x:t7,y:ne};if(c!==ne)throw Error("invZ was invalid");return{x:s,y:l}}),b=(0,t9.memoized)(e=>{let{a:t,d:r}=n;if(e.is0())throw Error("bad point: ZERO");let{ex:i,ey:o,ez:a,et:s}=e,l=u(i*i),c=u(o*o),d=u(a*a),h=u(d*d),f=u(l*t);if(u(d*u(f+c))!==u(h+u(r*u(l*c))))throw Error("bad point: equation left != right (1)");if(u(i*o)!==u(a*s))throw Error("bad point: equation left != right (2)");return!0});class w{constructor(e,t,n,r){this.ex=e,this.ey=t,this.ez=n,this.et=r,m("x",e),m("y",t),m("z",n),m("t",r),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(e){if(e instanceof w)throw Error("extended point not allowed");let{x:t,y:n}=e||{};return m("x",t),m("y",n),new w(t,n,ne,u(t*n))}static normalizeZ(e){let t=r.invertBatch(e.map(e=>e.ez));return e.map((e,n)=>e.toAffine(t[n])).map(w.fromAffine)}static msm(e,t){return(0,t8.pippenger)(w,h,e,t)}_setWindowSize(e){S.setWindowSize(this,e)}assertValidity(){b(this)}equals(e){y(e);let{ex:t,ey:n,ez:r}=this,{ex:i,ey:o,ez:a}=e,s=u(t*a),l=u(i*r),c=u(n*a),d=u(o*r);return s===l&&c===d}is0(){return this.equals(w.ZERO)}negate(){return new w(u(-this.ex),this.ey,this.ez,u(-this.et))}double(){let{a:e}=n,{ex:t,ey:r,ez:i}=this,o=u(t*t),a=u(r*r),s=u(nt*u(i*i)),l=u(e*o),c=t+r,d=u(u(c*c)-o-a),h=l+a,f=h-s,p=l-a,g=u(d*f),m=u(h*p),y=u(d*p);return new w(g,m,u(f*h),y)}add(e){y(e);let{a:t,d:r}=n,{ex:i,ey:o,ez:a,et:s}=this,{ex:l,ey:c,ez:d,et:h}=e;if(t===BigInt(-1)){let e=u((o-i)*(c+l)),t=u((o+i)*(c-l)),n=u(t-e);if(n===t7)return this.double();let r=u(a*nt*h),f=u(s*nt*d),p=f+r,g=t+e,m=f-r,y=u(p*n),v=u(g*m),b=u(p*m);return new w(y,v,u(n*g),b)}let f=u(i*l),p=u(o*c),g=u(s*r*h),m=u(a*d),v=u((i+o)*(l+c)-f-p),b=m-g,E=m+g,_=u(p-t*f),S=u(v*b),x=u(E*_),C=u(v*_);return new w(S,x,u(b*E),C)}subtract(e){return this.add(e.negate())}wNAF(e){return S.wNAFCached(this,e,w.normalizeZ)}multiply(e){t4.aInRange("scalar",e,ne,i);let{p:t,f:n}=this.wNAF(e);return w.normalizeZ([t,n])[0]}multiplyUnsafe(e){return t4.aInRange("scalar",e,t7,i),e===t7?_:this.equals(_)||e===ne?this:this.equals(E)?this.wNAF(e).p:S.unsafeLadder(this,e)}isSmallOrder(){return this.multiplyUnsafe(c).is0()}isTorsionFree(){return S.unsafeLadder(this,i).is0()}toAffine(e){return v(this,e)}clearCofactor(){let{h:e}=n;return e===ne?this:this.multiplyUnsafe(e)}static fromHex(e,t=!1){let{d:i,a:o}=n,a=r.BYTES;e=(0,t9.ensureBytes)("pointHex",e,a),(0,t9.abool)("zip215",t);let s=e.slice(),l=e[a-1];s[a-1]=-129&l;let c=t4.bytesToNumberLE(s),h=t?d:r.ORDER;t4.aInRange("pointHex.y",c,t7,h);let p=u(c*c),{isValid:g,value:m}=f(u(p-ne),u(i*p-o));
1if(!g)throw Error("Point.fromHex: invalid y coordinate");let y=(m&ne)===ne,v=0!=(128&l);if(!t&&m===t7&&v)throw Error("Point.fromHex: x=0 and x_0=1");return v!==y&&(m=u(-m)),w.fromAffine({x:m,y:c})}static fromPrivateKey(e){return k(e).point}toRawBytes(){let{x:e,y:t}=this.toAffine(),n=t4.numberToBytesLE(t,r.BYTES);return n[n.length-1]|=e&ne?128:0,n}toHex(){return t4.bytesToHex(this.toRawBytes())}}w.BASE=new w(n.Gx,n.Gy,ne,u(n.Gx*n.Gy)),w.ZERO=new w(t7,ne,ne,t7);let{BASE:E,ZERO:_}=w,S=(0,t8.wNAF)(w,8*l);function x(e){return(0,t6.mod)(e,i)}function C(e){return x(t4.bytesToNumberLE(e))}function k(e){e=(0,t9.ensureBytes)("private key",e,l);let t=(0,t9.ensureBytes)("hashed private key",a(e),2*l),n=p(t.slice(0,l)),r=t.slice(l,2*l),i=C(n),o=E.multiply(i),s=o.toRawBytes();return{head:n,prefix:r,scalar:i,point:o,pointBytes:s}}function M(e=new Uint8Array,...t){return C(a(g(t4.concatBytes(...t),(0,t9.ensureBytes)("context",e),!!o)))}return E._setWindowSize(8),{CURVE:n,getPublicKey:function(e){return k(e).pointBytes},sign:function(e,t,n={}){e=(0,t9.ensureBytes)("message",e),o&&(e=o(e));let{prefix:a,scalar:s,pointBytes:c}=k(t),d=M(n.context,a,e),u=E.multiply(d).toRawBytes(),h=x(d+M(n.context,u,c,e)*s);t4.aInRange("signature.s",h,t7,i);let f=t4.concatBytes(u,t4.numberToBytesLE(h,r.BYTES));return(0,t9.ensureBytes)("result",f,2*l)},verify:function(e,t,n,i=nr){let a,s,l,{context:c,zip215:d}=i,u=r.BYTES;e=(0,t9.ensureBytes)("signature",e,2*u),t=(0,t9.ensureBytes)("message",t),void 0!==d&&(0,t9.abool)("zip215",d),o&&(t=o(t));let h=t4.bytesToNumberLE(e.slice(u,2*u));try{a=w.fromHex(n,d),s=w.fromHex(e.slice(0,u),d),l=E.multiplyUnsafe(h)}catch(e){return!1}if(!d&&a.isSmallOrder())return!1;let f=M(c,s.toRawBytes(),a.toRawBytes(),t);return s.add(a.multiplyUnsafe(f)).subtract(l).clearCofactor().equals(w.ZERO)},ExtendedPoint:w,utils:{getExtendedPublicKey:k,randomPrivateKey:()=>s(r.BYTES),precompute:(e=8,t=w.BASE)=>(t._setWindowSize(e),t.multiply(BigInt(3)),t)}}};let t8=th,t6=tf,t4=tp,t9=tp,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=tp.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,tp.abytes)(e),(0,tp.abytes)(t),ns(n),t.length>255&&(t=r((0,tp.concatBytes)((0,tp.utf8ToBytes)("H2C-OVERSIZE-DST-"),t)));let{outputLen:i,blockLen:o}=r,a=Math.ceil(n/i);if(n>65535||a>255)throw Error("expand_message_xmd: invalid lenInBytes");let s=(0,tp.concatBytes)(t,na(t.length,1)),l=na(0,o),c=na(n,2),d=Array(a),u=r((0,tp.concatBytes)(l,e,c,na(0,1),s));d[0]=r((0,tp.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,tp.concatBytes)(...t))}return(0,tp.concatBytes)(...d).slice(0,n)}function nc(e,t,n,r,i){if((0,tp.abytes)(e),(0,tp.abytes)(t),ns(n),t.length>255){let e=Math.ceil(2*r/8);t=i.create({dkLen:e}).update((0,tp.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()}
1function nd(e,t,n){let r;(0,tp.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,tp.abytes)(e),ns(t);let d="string"==typeof c?(0,tp.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,tf.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,f=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),w=r(v*g),E=b+w,_=b-w;u=r(E*E),h=r(e*r(_*_)),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))}((h=(0,nf.ensureBytes)("u coordinate",t,o),32===a&&(h[31]&=127),(0,nf.bytesToNumberLE)(h)),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(f===np)throw Error("Invalid private or public key received");return u(f)}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=tf,nf=tp,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,tf.pow2)(c,o,t)*c%t,u=(0,tf.pow2)(d,i,t)*e%t,h=(0,tf.pow2)(u,s,t)*u%t,f=(0,tf.pow2)(h,n,t)*h%t,p=(0,tf.pow2)(f,r,t)*f%t,g=(0,tf.pow2)(p,a,t)*p%t,m=(0,tf.pow2)(g,l,t)*g%t,y=(0,tf.pow2)(m,l,t)*g%t,v=(0,tf.pow2)(y,n,t)*h%t;return{pow_p_5_8:(0,tf.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,tf.mod)(r*r*r,t),o=c(e*(0,tf.mod)(i*i*r,t)).pow_p_5_8,a=(0,tf.mod)(e*i*o,t),s=(0,tf.mod)(r*a*a,t),l=a,d=(0,tf.mod)(a*n,t),u=s===e,h=s===(0,tf.mod)(-e,t),f=s===(0,tf.mod)(-e*n,t);return u&&(a=l),(h||f)&&(a=d),(0,tf.isNegativeLE)(a,t)&&(a=(0,tf.mod)(-a,t)),{isValid:u||h,value:a}}e.ED25519_TORSION_SUBGROUP=["0100000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a","0000000000000000000000000000000000000000000000000000000000000080","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05","ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85","0000000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa"];let h=(0,tf.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:eB.randomBytes,adjustScalarBytes:d,uvRatio:u};function p(e,t,n){if(t.length>255)throw Error("Context is too big");return(0,eB.concatBytes)((0,eB.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,tu.twistedEdwards)(f),e.ed25519ctx=(0,tu.twistedEdwards)({...f,domain:p}),e.ed25519ph=(0,tu.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,tf.mod)((0,tf.pow2)(n,a,t)*r,t)},adjustScalarBytes:d,randomBytes:eB.randomBytes}),e.edwardsToMontgomery=g;let m=(h.ORDER+a)/l,y=h.pow(o,m),v=h.sqrt(h.neg(h.ONE)),b=(0,tf.FpSqrtEven)(h,h.neg(BigInt(486664))),w=(0,ni.createHasher)(e.ed25519.ExtendedPoint,e=>(function(e){let t,n,r,a,c,d,u,f,p,g,m,w,E,_,S,x,C,k,M,A,I,P,O,{xMn:R,xMd:T,yMn:L,yMd:N}=(t=(h.ORDER-s)/l,n=BigInt(486662),r=h.sqr(e),r=h.mul(r,o),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),p=h.sqr(u),d=h.sqr(p),p=h.mul(p,u),p=h.mul(p,f),d=h.mul(d,p),g=h.pow(d,t),g=h.mul(g,p),m=h.mul(g,v),d=h.sqr(g),d=h.mul(d,u),w=h.eql(d,f),E=h.cmov(m,g,w),_=h.mul(c,r),S=h.mul(g,e),S=h.mul(S,y),x=h.mul(S,v),C=h.mul(f,r),d=h.sqr(S),d=h.mul(d,u),k=h.eql(d,C),M=h.cmov(x,S,k),d=h.sqr(E),d=h.mul(d,u),A=h.eql(d,f),I=h.cmov(_,c,A),P=h.cmov(M,E,A),O=h.isOdd(P),{xMn:I,xMd:a,yMn:P=h.cmov(P,h.neg(P),A!==O),yMd:i}),$=h.mul(R,N);$=h.mul($,b);let D=h.mul(T,L),B=h.sub(R,T),K=h.add(R,T),j=h.mul(D,K),U=h.eql(j,h.ZERO);$=h.cmov($,h.ZERO,U),D=h.cmov(D,h.ONE,U),B=h.cmov(B,h.ONE,U),K=h.cmov(K,h.ONE,U);let H=h.invertBatch([D,K]);return{x:h.mul($,H[0]),y:h.mul(B,H[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 E(e){if(!(e instanceof I))throw Error("RistrettoPoint expected")}e.hashToCurve=w.hashToCurve,e.encodeToCurve=w.encodeToCurve;let _=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),S=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),x=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),C=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),k=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),M=t=>e.ed25519.CURVE.Fp.create((0,tp.bytesToNumberLE)(t)&k);function A(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)*x),c=BigInt(-1),d=a((c-r*s)*a(s+r)),{isValid:h,value:f}=u(l,d),p=a(f*t);(0,tf.isNegativeLE)(p,o)||(p=a(-p)),h||(f=p),h||(c=s);let g=a(c*(s-i)*C-d),m=f*f,y=a((f+f)*d),v=a(g*_),b=a(i-m),w=a(i+m);return new e.ed25519.ExtendedPoint(a(y*w),a(b*v),a(v*w),a(y*b))}class I{constructor(e){this.ep=e}static fromAffine(t){return new I(e.ed25519.ExtendedPoint.fromAffine(t))}static hashToCurve(e){let t=A(M((e=(0,tp.ensureBytes)("ristrettoHash",e,64)).slice(0,32))),n=A(M(e.slice(32,64)));return new I(t.add(n))}static fromHex(t){t=(0,tp.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,tp.equalBytes)((0,tp.numberToBytesLE)(c,32),t)||(0,tf.isNegativeLE)(c,a))throw Error(l);let d=s(c*c),h=s(i+n*d),f=s(i-n*d),p=s(h*h),g=s(f*f),m=s(n*o*p-g),{isValid:y,value:v}=u(i,s(m*g)),b=s(v*f),w=s(v*b*m),E=s((c+c)*b);(0,tf.isNegativeLE)(E,a)&&(E=s(-E));let _=s(h*w),S=s(E*_);if(!y||(0,tf.isNegativeLE)(S,a)||_===r)throw Error(l);return new I(new e.ed25519.ExtendedPoint(E,_,i,S))}toRawBytes(){let t,{ex:r,ey:o,ez:a,et:s}=this.ep,l=e.ed25519.CURVE.Fp.ORDER,c=e.ed25519.CURVE.Fp.create,d=c(c(a+o)*c(a-o)),h=c(r*o),f=c(h*h),{value:p}=u(i,c(d*f)),g=c(p*d),m=c(p*h),y=c(g*m*s);if((0,tf.isNegativeLE)(s*y,l)){let e=c(o*n),i=c(r*n);r=e,o=i,t=c(g*S)}else t=m;(0,tf.isNegativeLE)(r*y,l)&&(o=c(-o));let v=c((a-o)*t);return(0,tf.isNegativeLE)(v,l)&&(v=c(-v)),(0,tp.numberToBytesLE)(v,32)}toHex(){return(0,tp.bytesToHex)(this.toRawBytes())}toString(){return this.toHex()}equals(t){E(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 E(e),new I(this.ep.add(e.ep))}subtract(e){return E(e),new I(this.ep.subtract(e.ep))}multiply(e){return new I(this.ep.multiply(e))}multiplyUnsafe(e){return new I(this.ep.multiplyUnsafe(e))}double(){return new I(this.ep.double())}negate(){return new I(this.ep.negate())}}I.BASE||(I.BASE=new I(e.ed25519.ExtendedPoint.BASE)),I.ZERO||(I.ZERO=new I(e.ed25519.ExtendedPoint.ZERO)),e.RistrettoPoint=I,e.hashToRistretto255=(e,t)=>{let n=t.DST,r="string"==typeof n?(0,eB.utf8ToBytes)(n):n,i=(0,ni.expand_message_xmd)(e,r,64,eA.sha512);return I.hashToCurve(i)},e.hash_to_ristretto255=e.hashToRistretto255}(eM);var nm={},ny={};Object.defineProperty(ny,"__esModule",{value:!0}),ny.sha224=ny.sha256=ny.SHA256=void 0;let nv=eI,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]),nw=new Uint32Array([0x6a09e667,0xbb67ae85,0x3c6ef372,0xa54ff53a,0x510e527f,0x9b05688c,0x1f83d9ab,0x5be0cd19]),nE=new Uint32Array(64);class n_ extends nv.HashMD{constructor(){super(64,32,8,!1),this.A=0|nw[0],this.B=0|nw[1],this.C=0|nw[2],this.D=0|nw[3],this.E=0|nw[4],this.F=0|nw[5],this.G=0|nw[6],this.H=0|nw[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)nE[n]=e.getUint32(t,!1);for(let e=16;e<64;e++){let t=nE[e-15],n=nE[e-2],r=(0,eB.rotr)(t,7)^(0,eB.rotr)(t,18)^t>>>3,i=(0,eB.rotr)(n,17)^(0,eB.rotr)(n,19)^n>>>10;nE[e]=i+nE[e-7]+r+nE[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,eB.rotr)(a,6)^(0,eB.rotr)(a,11)^(0,eB.rotr)(a,25))+(0,nv.Chi)(a,s,l)+nb[e]+nE[e]|0,d=((0,eB.rotr)(n,2)^(0,eB.rotr)(n,13)^(0,eB.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(){nE.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}ny.SHA256=n_;class nS extends n_{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,eB.wrapConstructor)(()=>new n_),ny.sha224=(0,eB.wrapConstructor)(()=>new nS);var nx={},nC={};Object.defineProperty(nC,"__esModule",{value:!0}),nC.hmac=nC.HMAC=void 0;let nk=eB;class nM extends nk.Hash{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,(0,eP.hash)(e);const n=(0,nk.toBytes)(t);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;const r=this.blockLen,i=new Uint8Array(r);i.set(n.length>r?e.create().update(n).digest():n);for(let e=0;e<i.length;e++)i[e]^=54;this.iHash.update(i),this.oHash=e.create();for(let e=0;e<i.length;e++)i[e]^=106;this.oHash.update(i),i.fill(0)}update(e){return(0,eP.exists)(this),this.iHash.update(e),this}digestInto(e){(0,eP.exists)(this),(0,eP.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()}}nC.HMAC=nM,nC.hmac=(e,t,n)=>new nM(e,t).update(n).digest(),nC.hmac.create=(e,t)=>new nM(e,t);var nA={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DER=void 0,e.weierstrassPoints=f,e.weierstrass=function(a){let s,d=(s=(0,t.validateBasic)(a),r.validateObject(s,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...s})),{Fp:u,n:h}=d,p=u.BYTES+1,g=2*u.BYTES+1;function m(e){return n.mod(e,h)}function y(e){return n.invert(e,h)}let{ProjectivePoint:v,normPrivateKeyToScalar:b,weierstrassEquation:w,isWithinCurveOrder:E}=f({...d,toBytes(e,t,n){let o=t.toAffine(),a=u.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,u.toBytes(o.y))},fromBytes(e){let t=e.length,n=e[0],i=e.subarray(1);if(t!==p||2!==n&&3!==n){if(t===g&&4===n)return{x:u.fromBytes(i.subarray(0,u.BYTES)),y:u.fromBytes(i.subarray(u.BYTES,2*u.BYTES))};throw Error(`Point of length ${t}
1 was invalid. Expected ${p} compressed bytes or ${g} uncompressed bytes`)}{let e,t=r.bytesToNumberBE(i);if(!r.inRange(t,c,u.ORDER))throw Error("Point is not on curve");let o=w(t);try{e=u.sqrt(o)}catch(e){throw Error("Point is not on curve"+(e instanceof Error?": "+e.message:""))}return 1==(1&n)!=((e&c)===c)&&(e=u.neg(e)),{x:t,y:e}}}}),_=e=>r.bytesToHex(r.numberToBytesBE(e,d.nByteLength)),S=(e,t,n)=>r.bytesToNumberBE(e.slice(t,n));class x{constructor(e,t,n){this.r=e,this.s=t,this.recovery=n,this.assertValidity()}static fromCompact(e){let t=d.nByteLength;return new x(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 x(n,r)}assertValidity(){r.aInRange("r",this.r,c,h),r.aInRange("s",this.s,c,h)}addRecoveryBit(e){return new x(this.r,this.s,e)}recoverPublicKey(e){let{r:t,s:n,recovery:r}=this,o=M((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+d.n:t;if(a>=u.ORDER)throw Error("recovery id 2 or 3 invalid");let s=0==(1&r)?"02":"03",l=v.fromHex(s+_(a)),c=y(a),h=m(-o*c),f=m(n*c),p=v.BASE.multiplyAndAddUnsafe(l,h,f);if(!p)throw Error("point at infinify");return p.assertValidity(),p}hasHighS(){return this.s>h>>c}normalizeS(){return this.hasHighS()?new x(this.r,m(-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 _(this.r)+_(this.s)}}function C(e){let t=r.isBytes(e),n="string"==typeof e,i=(t||n)&&e.length;return t?i===p||i===g:n?i===2*p||i===2*g:e instanceof v}let k=d.bits2int||function(e){let t=r.bytesToNumberBE(e),n=8*e.length-d.nBitLength;return n>0?t>>BigInt(n):t},M=d.bits2int_modN||function(e){return m(k(e))},A=r.bitMask(d.nBitLength);function I(e){return r.aInRange(`num < 2^${d.nBitLength}`,e,l,A),r.numberToBytesBE(e,d.nByteLength)}let P={lowS:d.lowS,prehash:!1},O={lowS:d.lowS,prehash:!1};return v.BASE._setWindowSize(8),{CURVE:d,getPublicKey:function(e,t=!0){return v.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 v.fromHex(t).multiply(b(e)).toRawBytes(n)},sign:function(e,t,n=P){let{seed:a,k2sig:s}=function(e,t,n=P){if(["recovered","canonical"].some(e=>e in n))throw Error("sign() legacy options not supported");let{hash:a,randomBytes:s}=d,{lowS:f,prehash:p,extraEntropy:g}=n;null==f&&(f=!0),e=(0,i.ensureBytes)("msgHash",e),o(n),p&&(e=(0,i.ensureBytes)("prehashed msgHash",a(e)));let w=M(e),_=b(t),S=[I(_),I(w)];if(null!=g&&!1!==g){let e=!0===g?s(u.BYTES):g;S.push((0,i.ensureBytes)("extraEntropy",e))}return{seed:r.concatBytes(...S),k2sig:function(e){let t=k(e);if(!E(t))return;let n=y(t),r=v.BASE.multiply(t).toAffine(),i=m(r.x);if(i===l)return;let o=m(n*m(w+i*_));if(o===l)return;let a=2*(r.x!==i)|Number(r.y&c),s=o;return f&&o>h>>c&&(s=o>h>>c?m(-o):o,a^=1),new x(i,s,a)}}}(e,t,n);return r.createHmacDrbg(d.hash.outputLen,d.nByteLength,d.hmac)(a,s)},verify:function(t,n,a,s=O){let l,c;if(n=(0,i.ensureBytes)("msgHash",n),a=(0,i.ensureBytes)("publicKey",a),"strict"in s)throw Error("options.strict was renamed to lowS");o(s);let{lowS:u,prehash:h}=s;try{if("string"==typeof t||r.isBytes(t))try{l=x.fromDER(t)}catch(n){if(!(n instanceof e.DER.Err))throw n;l=x.fromCompact(t)}else{if("object"!=typeof t||"bigint"!=typeof t.r||"bigint"!=typeof t.s)throw Error("PARSE");{let{r:e,s:n}=t;l=new x(e,n)}}c=v.fromHex(a)}catch(e){if("PARSE"===e.message)throw Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(u&&l.hasHighS())return!1;h&&(n=d.hash(n));let{r:f,s:p}=l,g=M(n),b=y(p),w=m(g*b),E=m(f*b),_=v.BASE.multiplyAndAddUnsafe(c,w,E)?.toAffine();return!!_&&m(_.x)===f},ProjectivePoint:v,Signature:x,utils:{isValidPrivateKey(e){try{return b(e),!0}catch(e){return!1}},normPrivateKeyToScalar:b,randomPrivateKey:()=>{let e=n.getMinHashLength(d.n);return n.mapHashToField(d.randomBytes(e),d.n)},precompute:(e=8,t=v.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=th,n=tf,r=tp,i=tp;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};
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){w.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),w=a.add(t,n),E=a.add(i,s);w=a.mul(w,E),E=a.add(m,y),w=a.sub(w,E),E=a.add(t,r);let _=a.add(i,l);return E=a.mul(E,_),_=a.add(m,b),E=a.sub(E,_),_=a.add(n,r),c=a.add(s,l),_=a.mul(_,c),c=a.add(y,b),_=a.sub(_,c),h=a.mul(f,E),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),E=a.mul(p,E),y=a.add(y,b),b=a.sub(m,b),b=a.mul(f,b),E=a.add(E,b),m=a.mul(y,E),d=a.add(d,m),m=a.mul(_,E),c=a.mul(w,c),c=a.sub(c,m),m=a.mul(w,y),h=a.mul(_,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 w.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 w.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=w.constTimeNegate(r,c),u=w.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,w=(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}}(nA),Object.defineProperty(nx,"__esModule",{value:!0}),nx.getHash=nP,nx.createCurve=function(e,t){let n=t=>(0,nI.weierstrass)({...e,...nP(t)});return Object.freeze({...n(t),create:n})};let nI=nA;function nP(e){return{hash:e,hmac:(t,...n)=>(0,nC.hmac)(e,t,(0,eB.concatBytes)(...n)),randomBytes:eB.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,tf.pow2)(h,n,t)*h%t,p=(0,tf.pow2)(f,n,t)*h%t,g=(0,tf.pow2)(p,i,t)*u%t,m=(0,tf.pow2)(g,o,t)*g%t,y=(0,tf.pow2)(m,a,t)*m%t,v=(0,tf.pow2)(y,c,t)*y%t,b=(0,tf.pow2)(v,d,t)*v%t,w=(0,tf.pow2)(b,c,t)*y%t,E=(0,tf.pow2)(w,n,t)*h%t,_=(0,tf.pow2)(E,l,t)*m%t,S=(0,tf.pow2)(_,r,t)*u%t,x=(0,tf.pow2)(S,i,t);if(!s.eql(s.sqr(x),e))throw Error("Cannot find square root");return x}let s=(0,tf.Field)(t,void 0,void 0,{sqrt:a});e.secp256k1=(0,nx.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,tf.mod)(e-l*t-c*a,n),u=(0,tf.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,tp.concatBytes)(t,t),c[e]=n}return(0,ny.sha256)((0,tp.concatBytes)(n,...t))}let u=e=>e.toRawBytes(!0).slice(1),h=e=>(0,tp.numberToBytesBE)(e,32),f=e=>(0,tf.mod)(e,t),p=e=>(0,tf.mod)(e,n),g=e.secp256k1.ProjectivePoint;function m(t){let n=e.secp256k1.utils.normPrivateKeyToScalar(t),r=g.fromPrivateKey(n);return{scalar:r.hasEvenY()?n:p(-n),bytes:u(r)}}function y(e){(0,tp.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 v=tp.bytesToNumberBE;function b(...e){return p(v(d("BIP0340/challenge",...e)))}function w(e,i,o){let a=(0,tp.ensureBytes)("signature",e,64),s=(0,tp.ensureBytes)("message",i),l=(0,tp.ensureBytes)("publicKey",o,32);try{let e,i=y(v(l)),o=v(a.subarray(0,32));if(!(0,tp.inRange)(o,r,t))return!1;let c=v(a.subarray(32,64));if(!(0,tp.inRange)(c,r,n))return!1;let d=b(h(o),u(i),s),f=(e=p(-d),g.BASE.multiplyAndAddUnsafe(i,c,e));return!(!f||!f.hasEvenY()||f.toAffine().x!==o)}catch(e){return!1}}e.schnorr={getPublicKey:function(e){return m(e).bytes},sign:function(e,t,n=(0,eB.randomBytes)(32)){let r=(0,tp.ensureBytes)("message",e),{bytes:i,scalar:o}=m(t),a=h(o^v(d("BIP0340/aux",(0,tp.ensureBytes)("auxRand",n,32)))),s=p(v(d("BIP0340/nonce",a,i,r)));if(s===l)throw Error("sign failed: k is zero");let{bytes:c,scalar:u}=m(s),f=b(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:y,pointToBytes:u,numberToBytesBE:tp.numberToBytesBE,bytesToNumberBE:tp.bytesToNumberBE,taggedHash:d,mod:tf.mod}};let E=(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,nA.mapToCurveSimpleSWU)(s,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:s.create(BigInt("-11"))}),S=(0,ni.createHasher)(e.secp256k1.ProjectivePoint,e=>{let{x:t,y:n}=_(s.create(e[0]));return E(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=S.hashToCurve,e.encodeToCurve=S.encodeToCurve}(nm);var nO={};
1Object.defineProperty(nO,"__esModule",{value:!0}),nO.decodeHex=nO.remove0x=void 0,nO.remove0x=function(e){return e.startsWith("0x")||e.startsWith("0X")?e.slice(2):e},nO.decodeHex=function(e){return(0,ed.hexToBytes)((0,nO.remove0x)(e))},function(e){function t(e,t,n,r){if("secp256k1"===e)return t(nm.secp256k1);if("x25519"===e)return n(eM.x25519);if("ed25519"===e)return r(eM.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)(ew.SECRET_KEY_LENGTH);while(!(0,e.isValidPrivateKey)(t));return t},e.isValidPrivateKey=function(e){return t((0,eb.ellipticCurve)(),function(t){return t.utils.isValidPrivateKey(e)},function(){return!0},function(){return!0})},e.getPublicKey=function(e){return t((0,eb.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,eb.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,eb.ellipticCurve)(),function(t){return t.getSharedSecret(BigInt(1),e,n)},function(){return e},function(){return e})},e.hexToPublicKey=function(e){var r=(0,nO.decodeHex)(e);return t((0,eb.ellipticCurve)(),function(){return n(r)},function(){return r},function(){return r})};var n=function(e){if(e.length===ew.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()}}(ex);var nR={},nT={};function nL(e,t,n){return(0,eP.hash)(e),void 0===n&&(n=new Uint8Array(e.outputLen)),(0,nC.hmac)(e,(0,eB.toBytes)(n),(0,eB.toBytes)(t))}Object.defineProperty(nT,"__esModule",{value:!0}),nT.hkdf=void 0,nT.extract=nL,nT.expand=nD;let nN=new Uint8Array([0]),n$=new Uint8Array;function nD(e,t,n,r=32){if((0,eP.hash)(e),(0,eP.number)(r),r>255*e.outputLen)throw Error("Length should be <= 255*HashLen");let i=Math.ceil(r/e.outputLen);void 0===n&&(n=n$);let o=new Uint8Array(i*e.outputLen),a=nC.hmac.create(e,t),s=a._cloneInto(),l=new Uint8Array(a.outputLen);for(let t=0;t<i;t++)nN[0]=t+1,s.update(0===t?n$:l).update(n).update(nN).digestInto(l),o.set(l,e.outputLen*t),a._cloneInto(s);return a.destroy(),s.destroy(),l.fill(0),nN.fill(0),o.slice(0,r)}nT.hkdf=(e,t,n,r,i)=>nD(e,nL(e,t,n),r,i),Object.defineProperty(nR,"__esModule",{value:!0}),nR.getSharedKey=nR.deriveKey=void 0,nR.deriveKey=function(e,t,n){return(0,nT.hkdf)(ny.sha256,e,t,n,32)},nR.getSharedKey=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return(0,nR.deriveKey)(ed.concatBytes.apply(void 0,e))};var nB={},nK={},nj={},nU={};Object.defineProperty(nU,"__esModule",{value:!0}),nU.polyval=nU.ghash=void 0,nU._toGHASHKey=nq;let nH=new Uint8Array(16),nF=(0,ed.u32)(nH),nz=e=>(e>>>0&255)<<24|(e>>>8&255)<<16|(e>>>16&255)<<8|e>>>24&255;function nq(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 nV{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,ed.toBytes)(e),(0,eu.bytes)(e,16);const a=(0,ed.createView)(e);let s=a.getUint32(0,!1),l=a.getUint32(4,!1),c=a.getUint32(8,!1),d=a.getUint32(12,!1);const u=[];for(let e=0;e<128;e++)u.push({s0:nz(s),s1:nz(l),s2:nz(c),s3:nz(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)};const 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;const 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;const{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,ed.toBytes)(e),(0,eu.exists)(this);let t=(0,ed.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&&(nH.set(e.subarray(16*n)),this._updateBlock(nF[0],nF[1],nF[2],nF[3]),(0,ed.clean)(nF)),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,eu.exists)(this),(0,eu.output)(e,this),this.finished=!0;let{s0:t,s1:n,s2:r,s3:i}
1=this,o=(0,ed.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 nW extends nV{constructor(e,t){e=(0,ed.toBytes)(e);const n=nq((0,ed.copyBytes)(e));super(n,t),(0,ed.clean)(n)}update(e){e=(0,ed.toBytes)(e),(0,eu.exists)(this);let t=(0,ed.u32)(e),n=e.length%16,r=Math.floor(e.length/16);for(let e=0;e<r;e++)this._updateBlock(nz(t[4*e+3]),nz(t[4*e+2]),nz(t[4*e+1]),nz(t[4*e+0]));return n&&(nH.set(e.subarray(16*r)),this._updateBlock(nz(nF[3]),nz(nF[2]),nz(nF[1]),nz(nF[0])),(0,ed.clean)(nF)),this}digestInto(e){(0,eu.exists)(this),(0,eu.output)(e,this),this.finished=!0;let{s0:t,s1:n,s2:r,s3:i}=this,o=(0,ed.u32)(e);return o[0]=t,o[1]=n,o[2]=r,o[3]=i,e.reverse()}}function nG(e){let t=(t,n)=>e(n,t.length).update((0,ed.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}nU.ghash=nG((e,t)=>new nV(e,t)),nU.polyval=nG((e,t)=>new nW(e,t)),Object.defineProperty(nj,"__esModule",{value:!0}),nj.unsafe=nj.aeskwp=nj.aeskw=nj.siv=nj.gcm=nj.cfb=nj.cbc=nj.ecb=nj.ctr=void 0,nj.expandKeyLE=n4,nj.expandKeyDecLE=n9;let nY=new Uint8Array(16);function nZ(e){return e<<1^283&-(e>>7)}function nJ(e,t){let n=0;for(;t>0;t>>=1)n^=e&-(1&t),e=nZ(e);return n}let nX=(()=>{let e=new Uint8Array(256);for(let t=0,n=1;t<256;t++,n^=nZ(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,ed.clean)(e),t})(),nQ=nX.map((e,t)=>nX.indexOf(t)),n0=e=>e<<24|e>>>8,n1=e=>e<<8|e>>>24,n2=e=>e<<24&0xff000000|e<<8&0xff0000|e>>>8&65280|e>>>24&255;function n3(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(n1),i=r.map(n1),o=i.map(n1),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 n5=n3(nX,e=>nJ(e,3)<<24|e<<16|e<<8|nJ(e,2)),n8=n3(nQ,e=>nJ(e,11)<<24|nJ(e,13)<<16|nJ(e,9)<<8|nJ(e,14)),n6=(()=>{let e=new Uint8Array(16);for(let t=0,n=1;t<16;t++,n=nZ(n))e[t]=n;return e})();function n4(e){(0,eu.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}=n5,r=[];(0,ed.isAligned32)(e)||r.push(e=(0,ed.copyBytes)(e));let i=(0,ed.u32)(e),o=i.length,a=e=>re(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(n0(t))^n6[e/o-1]:o>6&&e%o==4&&(t=a(t)),s[e]=s[e-o]^t}return(0,ed.clean)(...r),s}function n9(e){let t=n4(e),n=t.slice(),r=t.length,{sbox2:i}=n5,{T0:o,T1:a,T2:s,T3:l}=n8;for(let e=0;e<r;e+=4)for(let i=0;i<4;i++)n[e+i]=t[r-e-4+i];(0,ed.clean)(t);for(let e=4;e<r-4;e++){let t=n[e],r=re(i,t,t,t,t);n[e]=o[255&r]^a[r>>>8&255]^s[r>>>16&255]^l[r>>>24]}return n}function n7(e,t,n,r,i,o){return e[n<<8&65280|r>>>8&255]^t[i>>>8&65280|o>>>24&255]}function re(e,t,n,r,i){return e[255&t|65280&n]|e[r>>>16&255|i>>>16&65280]<<16}function rt(e,t,n,r,i){let{sbox2:o,T01:a,T23:s}=n5,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++]^n7(a,s,t,n,r,i),c=e[l++]^n7(a,s,n,r,i,t),d=e[l++]^n7(a,s,r,i,t,n),u=e[l++]^n7(a,s,i,t,n,r);t=o,n=c,r=d,i=u}return{s0:e[l++]^re(o,t,n,r,i),s1:e[l++]^re(o,n,r,i,t),s2:e[l++]^re(o,r,i,t,n),s3:e[l++]^re(o,i,t,n,r)}}function rn(e,t,n,r,i){let{sbox2:o,T01:a,T23:s}=n8,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++]^n7(a,s,t,i,r,n),c=e[l++]^n7(a,s,n,t,i,r),d=e[l++]^n7(a,s,r,n,t,i),u=e[l++]^n7(a,s,i,r,n,t);t=o,n=c,r=d,i=u}return{s0:e[l++]^re(o,t,i,r,n),s1:e[l++]^re(o,n,t,i,r),s2:e[l++]^re(o,r,n,t,i),s3:e[l++]^re(o,i,r,n,t)}}function rr(e,t){if(void 0===t)return new Uint8Array(e);if((0,eu.bytes)(t),t.length<e)throw Error(`aes: wrong destination length, expected at least ${e}, got: ${t.length}`);if(!(0,ed.isAligned32)(t))throw Error("unaligned dst");return t}function ri(e,t,n,r){(0,eu.bytes)(t,16),(0,eu.bytes)(n);let i=n.length;r=rr(i,r);let o=(0,ed.u32)(t),{s0:a,s1:s,s2:l,s3:c}=rt(e,o[0],o[1],o[2],o[3]),d=(0,ed.u32)(n),u=(0,ed.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}=rt(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,ed.u8)(e);for(let e=h,o=0;e<i;e++,o++)r[e]=n[e]^t[o];(0,ed.clean)(e)}return r}function ro(e,t,n,r,i){(0,eu.bytes)(n,16),(0,eu.bytes)(r),i=rr(r.length,i);let o=(0,ed.u32)(n),a=(0,ed.createView)(n),s=(0,ed.u32)(r),l=(0,ed.u32)(i),c=12*!t,d=r.length,u=a.getUint32(c,t),{s0:h,s1:f,s2:p,s3:g}=rt(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}=rt(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,ed.u8)(e);for(let e=m,n=0;e<d;e++,n++)i[e]=r[e]^t[n];(0,ed.clean)(e)}return i}function ra(e){if((0,eu.bytes)(e),e.length%16!=0)throw Error("aes/(cbc-ecb).decrypt ciphertext should consist of blocks with size 16")}function rs(e,t,n){(0,eu.bytes)(e);let r=e.length,i=r%16;if(!t&&0!==i)throw Error("aec/(cbc-ecb): unpadded plaintext with disabled padding");(0,ed.isAligned32)(e)||(e=(0,ed.copyBytes)(e));let o=(0,ed.u32)(e);if(t){let e=16-i;e||(e=16),r+=e}let a=rr(r,n);return{b:o,o:(0,ed.u32)(a),out:a}}function rl(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 rc(e){let t=new Uint8Array(16),n=(0,ed.u32)(t);t.set(e);let r=16-e.length;for(let e=16-r;e<16;e++)t[e]=r;return n}function rd(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,ed.createView)(s);i&&(0,ed.setBigUint64)(l,0,BigInt(8*o),t),(0,ed.setBigUint64)(l,8,BigInt(8*r.length),t),a.update(s);let c=a.digest();return(0,ed.clean)(s),c}nj.ctr=(0,ed.wrapCipher)({blockSize:16,nonceLength:16},function(e,t){function n(n,r){if((0,eu.bytes)(n),void 0!==r&&((0,eu.bytes)(r),!(0,ed.isAligned32)(r)))throw Error("unaligned destination");let i=n4(e),o=(0,ed.copyBytes)(t),a=[i,o];(0,ed.isAligned32)(n)||a.push(n=(0,ed.copyBytes)(n));let s=ri(i,o,n,r);return(0,ed.clean)(...a),s}return(0,eu.bytes)(e),(0,eu.bytes)(t,16),{encrypt:(e,t)=>
1n(e,t),decrypt:(e,t)=>n(e,t)}}),nj.ecb=(0,ed.wrapCipher)({blockSize:16},function(e,t={}){(0,eu.bytes)(e);let n=!t.disablePadding;return{encrypt(t,r){let{b:i,o:o,out:a}=rs(t,n,r),s=n4(e),l=0;for(;l+4<=i.length;){let{s0:e,s1:t,s2:n,s3:r}=rt(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=rc(t.subarray(4*l)),{s0:n,s1:r,s2:i,s3:a}=rt(s,e[0],e[1],e[2],e[3]);o[l++]=n,o[l++]=r,o[l++]=i,o[l++]=a}return(0,ed.clean)(s),a},decrypt(t,r){ra(t);let i=n9(e),o=rr(t.length,r),a=[i];(0,ed.isAligned32)(t)||a.push(t=(0,ed.copyBytes)(t));let s=(0,ed.u32)(t),l=(0,ed.u32)(o);for(let e=0;e+4<=s.length;){let{s0:t,s1:n,s2:r,s3:o}=rn(i,s[e+0],s[e+1],s[e+2],s[e+3]);l[e++]=t,l[e++]=n,l[e++]=r,l[e++]=o}return(0,ed.clean)(...a),rl(o,n)}}}),nj.cbc=(0,ed.wrapCipher)({blockSize:16,nonceLength:16},function(e,t,n={}){(0,eu.bytes)(e),(0,eu.bytes)(t,16);let r=!n.disablePadding;return{encrypt(n,i){let o=n4(e),{b:a,o:s,out:l}=rs(n,r,i),c=t,d=[o];(0,ed.isAligned32)(c)||d.push(c=(0,ed.copyBytes)(c));let u=(0,ed.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}=rt(o,h,f,p,g)),s[m++]=h,s[m++]=f,s[m++]=p,s[m++]=g;if(r){let e=rc(n.subarray(4*m));h^=e[0],f^=e[1],p^=e[2],g^=e[3],({s0:h,s1:f,s2:p,s3:g}=rt(o,h,f,p,g)),s[m++]=h,s[m++]=f,s[m++]=p,s[m++]=g}return(0,ed.clean)(...d),l},decrypt(n,i){ra(n);let o=n9(e),a=t,s=[o];(0,ed.isAligned32)(a)||s.push(a=(0,ed.copyBytes)(a));let l=(0,ed.u32)(a),c=rr(n.length,i);(0,ed.isAligned32)(n)||s.push(n=(0,ed.copyBytes)(n));let d=(0,ed.u32)(n),u=(0,ed.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}=rn(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,ed.clean)(...s),rl(c,r)}}}),nj.cfb=(0,ed.wrapCipher)({blockSize:16,nonceLength:16},function(e,t){function n(n,r,i){(0,eu.bytes)(n);let o=n.length;i=rr(o,i);let a=n4(e),s=t,l=[a];(0,ed.isAligned32)(s)||l.push(s=(0,ed.copyBytes)(s)),(0,ed.isAligned32)(n)||l.push(n=(0,ed.copyBytes)(n));let c=(0,ed.u32)(n),d=(0,ed.u32)(i),u=r?d:c,h=(0,ed.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}=rt(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}=rt(a,f,p,g,m));let e=(0,ed.u8)(new Uint32Array([f,p,g,m]));for(let t=y,r=0;t<o;t++,r++)i[t]=n[t]^e[r];(0,ed.clean)(e)}return(0,ed.clean)(...l),i}return(0,eu.bytes)(e),(0,eu.bytes)(t,16),{encrypt:(e,t)=>n(e,!0,t),decrypt:(e,t)=>n(e,!1,t)}}),nj.gcm=(0,ed.wrapCipher)({blockSize:16,nonceLength:12,tagLength:16},function(e,t,n){if((0,eu.bytes)(e),(0,eu.bytes)(t),void 0!==n&&(0,eu.bytes)(n),t.length<8)throw Error("aes/gcm: invalid nonce length");function r(e,t,r){let i=rd(nU.ghash,!1,e,r,n);for(let e=0;e<t.length;e++)i[e]^=t[e];return i}function i(){let n=n4(e),r=nY.slice(),i=nY.slice();if(ro(n,!1,i,i,r),12===t.length)i.set(t);else{let e=nY.slice(),n=(0,ed.createView)(e);(0,ed.setBigUint64)(n,8,BigInt(8*t.length),!1);let o=nU.ghash.create(r).update(t).update(e);o.digestInto(i),o.destroy()}return{xk:n,authKey:r,counter:i,tagMask:ro(n,!1,i,nY)}}return{encrypt(e){(0,eu.bytes)(e);let{xk:t,authKey:n,counter:o,tagMask:a}=i(),s=new Uint8Array(e.length+16),l=[t,n,o,a];(0,ed.isAligned32)(e)||l.push(e=(0,ed.copyBytes)(e)),ro(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,ed.clean)(...l),s},decrypt(e){if((0,eu.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,ed.isAligned32)(e)||s.push(e=(0,ed.copyBytes)(e));let l=e.subarray(0,-16),c=e.subarray(-16),d=r(n,a,l);if(s.push(d),!(0,ed.equalBytes)(d,c))throw Error("aes/gcm: invalid ghash tag");let u=ro(t,!1,o,l);return(0,ed.clean)(...s),u}}});let ru=(e,t,n)=>r=>{if(!Number.isSafeInteger(r)||t>r||r>n)throw Error(`${e}: invalid value=${r}, must be [${t}..${n}]`)};function rh(e){return null!=e&&"object"==typeof e&&(e instanceof Uint32Array||"Uint32Array"===e.constructor.name)}function rf(e,t){if((0,eu.bytes)(t,16),!rh(e))throw Error("_encryptBlock accepts result of expandKeyLE");let n=(0,ed.u32)(t),{s0:r,s1:i,s2:o,s3:a}=rt(e,n[0],n[1],n[2],n[3]);return n[0]=r,n[1]=i,n[2]=o,n[3]=a,t}function rp(e,t){if((0,eu.bytes)(t,16),!rh(e))throw Error("_decryptBlock accepts result of expandKeyLE");let n=(0,ed.u32)(t),{s0:r,s1:i,s2:o,s3:a}=rn(e,n[0],n[1],n[2],n[3]);return n[0]=r,n[1]=i,n[2]=o,n[3]=a,t}nj.siv=(0,ed.wrapCipher)({blockSize:16,nonceLength:12,tagLength:16},function(e,t,n){let r=ru("AAD",0,0x1000000000),i=ru("plaintext",0,0x1000000000),o=ru("nonce",12,12),a=ru("ciphertext",16,0x1000000000+16);function s(){let n=n4(e),r=new Uint8Array(e.length),i=new Uint8Array(16),o=[n,r],a=t;(0,ed.isAligned32)(a)||o.push(a=(0,ed.copyBytes)(a));let s=(0,ed.u32)(a),l=0,c=s[0],d=s[1],u=s[2],h=0;for(let e of[i,r].map(ed.u32)){let t=(0,ed.u32)(e);for(let e=0;e<t.length;e+=2){let{s0:r,s1:i}=rt(n,l,c,d,u);t[e+0]=r,t[e+1]=i,l=++h}}let f={authKey:i,encKey:n4(r)};return(0,ed.clean)(...o),f}function l(e,r,i){let o=rd(nU.polyval,!0,r,i,n);for(let e=0;e<12;e++)o[e]^=t[e];o[15]&=127;let a=(0,ed.u32)(o),s=a[0],l=a[1],c=a[2],d=a[3];return{s0:s,s1:l,s2:c,s3:d}=rt(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,ed.copyBytes)(t);r[15]|=128;let i=ro(e,!0,r,n);return(0,ed.clean)(r),i}return(0,eu.bytes)(e,16,24,32),(0,eu.bytes)(t),o(t.length),void 0!==n&&((0,eu.bytes)(n),r(n.length)),{encrypt(e){(0,eu.bytes)(e),i(e.length);let{encKey:t,authKey:n}=s(),r=l(t,n,e),o=[t,n,r];(0,ed.isAligned32)(e)||o.push(e=(0,ed.copyBytes)(e));let a=new Uint8Array(e.length+16);return a.set(r,e.length),a.set(c(t,r,e)),(0,ed.clean)(...o),a},decrypt(e){(0,eu.bytes)(e),a(e.length);let t=e.subarray(-16),{encKey:n,authKey:r}=s(),i=[n,r];(0,ed.isAligned32)(e)||i.push(e=(0,ed.copyBytes)(e));let o=c(n,t,e.subarray(0,-16)),d=l(n,r,o);if(i.push(d),!(0,ed.equalBytes)(t,d))throw(0,ed.clean)(...i),Error("invalid polyval tag");return(0,ed.clean)(...i),o}}});let rg={encrypt(e,t){if(t.length>=0x100000000)throw Error("plaintext should be less than 4gb");let n=n4(e);if(16===t.length)rf(n,t);else{let e=(0,ed.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}=rt(n,r,i,e[t],e[t+1]);r=a,i=s^n2(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=n9(e),r=t.length/8-1;if(1===r)rp(n,t);else{let e=(0,ed.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}=rn(n,i,o^=n2(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)}},rm=new Uint8Array(8).fill(166);nj.aeskw=(0,ed.wrapCipher)({blockSize:8},e=>({encrypt(t){if((0,eu.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,ed.concatBytes)(rm,t);return rg.encrypt(e,n),n},decrypt(t){if((0,eu.bytes)(t),t.length%8!=0||t.length<24)throw Error("invalid ciphertext length");let n=(0,ed.copyBytes)(t);if(rg.decrypt(e,n),!(0,ed.equalBytes)(n.subarray(0,8),rm))throw Error("integrity check failed");return n.subarray(0,8).fill(0),n.subarray(8)}})),nj.aeskwp=(0,ed.wrapCipher)({blockSize:8},e=>({encrypt(t){if((0,eu.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,ed.u32)(n);return r[0]=0xa65959a6,r[1]=n2(t.length),rg.encrypt(e,n),n},decrypt(t){if((0,eu.bytes)(t),t.length<16)throw Error("invalid ciphertext length");let n=(0,ed.copyBytes)(t),r=(0,ed.u32)(n);rg.decrypt(e,n);let i=n2(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)}})),nj.unsafe={expandKeyLE:n4,expandKeyDecLE:n9,encrypt:rt,decrypt:rn,encryptBlock:rf,decryptBlock:rp,ctrCounter:ri,ctr32:ro},Object.defineProperty(nK,"__esModule",{value:!0}),nK.aes256cbc=nK.aes256gcm=void 0,nK.aes256gcm=function(e,t,n){return(0,nj.gcm)(e,t,n)},nK.aes256cbc=function(e,t,n){return(0,nj.cbc)(e,t)};var ry={},rv={},rb={};Object.defineProperty(rb,"__esModule",{value:!0}),rb.sigma=void 0,rb.rotl=function(e,t){return e<<t|e>>>32-t},rb.createCipher=function(e,t){let{allowShortKeys:n,extendNonceFn:r,counterLength:i,counterRight:o,rounds:a}=(0,rE.checkOpts)({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if("function"!=typeof e)throw Error("core must be a function");return(0,rw.number)(i),(0,rw.number)(a),(0,rw.bool)(o),(0,rw.bool)(n),(t,s,l,c,d=0)=>{(0,rw.bytes)(t),(0,rw.bytes)(s),(0,rw.bytes)(l);let u=l.length;if(void 0===c&&(c=new Uint8Array(u)),(0,rw.bytes)(c),(0,rw.number)(d),d<0||d>=rP)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,rE.copyBytes)(t)),p=rk;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=rC,h.push(f)}rM(s)||h.push(s=(0,rE.copyBytes)(s));let m=(0,rE.u32)(f);if(r){if(24!==s.length)throw Error("arx: extended nonce must be 24 bytes");r(p,m,(0,rE.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(rA),d=(0,rE.u32)(c),u=rM(i)&&rM(o),h=u?(0,rE.u32)(i):rO,f=u?(0,rE.u32)(o):rO;for(let p=0;p<l;a++){if(e(t,n,r,d,a,s),a>=rP)throw Error("arx: counter overflow");let g=Math.min(rA,l-p);if(u&&g===rA){let e=p/4;
1if(p%4!=0)throw Error("arx: invalid block position");for(let t,n=0;n<rI;n++)f[t=e+n]=h[t]^d[n];p+=rA}else{for(let e,t=0;t<g;t++)o[e=p+t]=i[e]^c[t];p+=g}}}(e,p,m,(0,rE.u32)(s),l,c,d,a),(0,rE.clean)(...h),c}};let rw=eu,rE=ed,r_=e=>Uint8Array.from(e.split("").map(e=>e.charCodeAt(0))),rS=r_("expand 16-byte k"),rx=r_("expand 32-byte k"),rC=(0,rE.u32)(rS),rk=(0,rE.u32)(rx);function rM(e){return e.byteOffset%4==0}rb.sigma=rk.slice();let rA=64,rI=16,rP=0x100000000-1,rO=new Uint32Array;var rR={};Object.defineProperty(rR,"__esModule",{value:!0}),rR.poly1305=void 0,rR.wrapConstructorWithKey=rN;let rT=(e,t)=>255&e[t++]|(255&e[t++])<<8;class rL{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,ed.toBytes)(e),(0,eu.bytes)(e,32);const t=rT(e,0),n=rT(e,2),r=rT(e,4),i=rT(e,6),o=rT(e,8),a=rT(e,10),s=rT(e,12),l=rT(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]=rT(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=rT(e,t+0),m=rT(e,t+2),y=rT(e,t+4),v=rT(e,t+6),b=rT(e,t+8),w=rT(e,t+10),E=rT(e,t+12),_=rT(e,t+14),S=r[0]+(8191&g),x=r[1]+(8191&(g>>>13|m<<3)),C=r[2]+(8191&(m>>>10|y<<6)),k=r[3]+(8191&(y>>>7|v<<9)),M=r[4]+(8191&(v>>>4|b<<12)),A=r[5]+(b>>>1&8191),I=r[6]+(8191&(b>>>14|w<<2)),P=r[7]+(8191&(w>>>11|E<<5)),O=r[8]+(8191&(E>>>8|_<<8)),R=r[9]+(_>>>5|2048*!n),T=0,L=0+S*o+5*p*x+5*f*C+5*h*k+5*u*M;T=L>>>13,L&=8191,L+=5*d*A+5*c*I+5*l*P+5*s*O+5*a*R,T+=L>>>13,L&=8191;let N=T+S*a+x*o+5*p*C+5*f*k+5*h*M;T=N>>>13,N&=8191,N+=5*u*A+5*d*I+5*c*P+5*l*O+5*s*R,T+=N>>>13,N&=8191;let $=T+S*s+x*a+C*o+5*p*k+5*f*M;T=$>>>13,$&=8191,$+=5*h*A+5*u*I+5*d*P+5*c*O+5*l*R,T+=$>>>13,$&=8191;let D=T+S*l+x*s+C*a+k*o+5*p*M;T=D>>>13,D&=8191,D+=5*f*A+5*h*I+5*u*P+5*d*O+5*c*R,T+=D>>>13,D&=8191;let B=T+S*c+x*l+C*s+k*a+M*o;T=B>>>13,B&=8191,B+=5*p*A+5*f*I+5*h*P+5*u*O+5*d*R,T+=B>>>13,B&=8191;let K=T+S*d+x*c+C*l+k*s+M*a;T=K>>>13,K&=8191,K+=A*o+5*p*I+5*f*P+5*h*O+5*u*R,T+=K>>>13,K&=8191;let j=T+S*u+x*d+C*c+k*l+M*s;T=j>>>13,j&=8191,j+=A*a+I*o+5*p*P+5*f*O+5*h*R,T+=j>>>13,j&=8191;let U=T+S*h+x*u+C*d+k*c+M*l;T=U>>>13,U&=8191,U+=A*s+I*a+P*o+5*p*O+5*f*R,T+=U>>>13,U&=8191;let H=T+S*f+x*h+C*u+k*d+M*c;T=H>>>13,H&=8191,H+=A*l+I*s+P*a+O*o+5*p*R,T+=H>>>13,H&=8191;let F=T+S*p+x*f+C*h+k*u+M*d;T=F>>>13,F&=8191,F+=A*c+I*l+P*s+O*a+R*o,T+=F>>>13,F&=8191,L=8191&(T=(T=(T<<2)+T|0)+L|0),T>>>=13,N+=T,r[0]=L,r[1]=N,r[2]=$,r[3]=D,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,ed.clean)(n)}update(e){(0,eu.exists)(this);let{buffer:t,blockLen:n}=this,r=(e=(0,ed.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,ed.clean)(this.h,this.r,this.buffer,this.pad)}digestInto(e){(0,eu.exists)(this),(0,eu.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 rN(e){let t=(t,n)=>e(n).update((0,ed.toBytes)(t)).digest(),n=e(new Uint8Array(32));return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=t=>e(t),t}rR.poly1305=rN(e=>new rL(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],w=r[1],E=r[2],_=s,S=l,x=c,C=d,k=u,M=h,A=f,I=p,P=g,O=m,R=y,T=v,L=o,N=b,$=w,D=E;for(let e=0;e<a;e+=2)_=_+k|0,P=P+(L=(0,rb.rotl)(L^_,16))|0,_=_+(k=(0,rb.rotl)(k^P,12))|0,P=P+(L=(0,rb.rotl)(L^_,8))|0,k=(0,rb.rotl)(k^P,7),S=S+M|0,O
1=O+(N=(0,rb.rotl)(N^S,16))|0,S=S+(M=(0,rb.rotl)(M^O,12))|0,O=O+(N=(0,rb.rotl)(N^S,8))|0,M=(0,rb.rotl)(M^O,7),x=x+A|0,R=R+($=(0,rb.rotl)($^x,16))|0,x=x+(A=(0,rb.rotl)(A^R,12))|0,R=R+($=(0,rb.rotl)($^x,8))|0,A=(0,rb.rotl)(A^R,7),C=C+I|0,T=T+(D=(0,rb.rotl)(D^C,16))|0,C=C+(I=(0,rb.rotl)(I^T,12))|0,T=T+(D=(0,rb.rotl)(D^C,8))|0,I=(0,rb.rotl)(I^T,7),_=_+M|0,R=R+(D=(0,rb.rotl)(D^_,16))|0,_=_+(M=(0,rb.rotl)(M^R,12))|0,R=R+(D=(0,rb.rotl)(D^_,8))|0,M=(0,rb.rotl)(M^R,7),S=S+A|0,T=T+(L=(0,rb.rotl)(L^S,16))|0,S=S+(A=(0,rb.rotl)(A^T,12))|0,T=T+(L=(0,rb.rotl)(L^S,8))|0,A=(0,rb.rotl)(A^T,7),x=x+I|0,P=P+(N=(0,rb.rotl)(N^x,16))|0,x=x+(I=(0,rb.rotl)(I^P,12))|0,P=P+(N=(0,rb.rotl)(N^x,8))|0,I=(0,rb.rotl)(I^P,7),C=C+k|0,O=O+($=(0,rb.rotl)($^C,16))|0,C=C+(k=(0,rb.rotl)(k^O,12))|0,O=O+($=(0,rb.rotl)($^C,8))|0,k=(0,rb.rotl)(k^O,7);let B=0;i[B++]=s+_|0,i[B++]=l+S|0,i[B++]=c+x|0,i[B++]=d+C|0,i[B++]=u+k|0,i[B++]=h+M|0,i[B++]=f+A|0,i[B++]=p+I|0,i[B++]=g+P|0,i[B++]=m+O|0,i[B++]=y+R|0,i[B++]=v+T|0,i[B++]=o+L|0,i[B++]=b+N|0,i[B++]=w+$|0,i[B++]=E+D|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,rb.rotl)(m^i,16))|0,i=i+(l=(0,rb.rotl)(l^h,12))|0,h=h+(m=(0,rb.rotl)(m^i,8))|0,l=(0,rb.rotl)(l^h,7),o=o+c|0,f=f+(y=(0,rb.rotl)(y^o,16))|0,o=o+(c=(0,rb.rotl)(c^f,12))|0,f=f+(y=(0,rb.rotl)(y^o,8))|0,c=(0,rb.rotl)(c^f,7),a=a+d|0,p=p+(v=(0,rb.rotl)(v^a,16))|0,a=a+(d=(0,rb.rotl)(d^p,12))|0,p=p+(v=(0,rb.rotl)(v^a,8))|0,d=(0,rb.rotl)(d^p,7),s=s+u|0,g=g+(b=(0,rb.rotl)(b^s,16))|0,s=s+(u=(0,rb.rotl)(u^g,12))|0,g=g+(b=(0,rb.rotl)(b^s,8))|0,u=(0,rb.rotl)(u^g,7),i=i+c|0,p=p+(b=(0,rb.rotl)(b^i,16))|0,i=i+(c=(0,rb.rotl)(c^p,12))|0,p=p+(b=(0,rb.rotl)(b^i,8))|0,c=(0,rb.rotl)(c^p,7),o=o+d|0,g=g+(m=(0,rb.rotl)(m^o,16))|0,o=o+(d=(0,rb.rotl)(d^g,12))|0,g=g+(m=(0,rb.rotl)(m^o,8))|0,d=(0,rb.rotl)(d^g,7),a=a+u|0,h=h+(y=(0,rb.rotl)(y^a,16))|0,a=a+(u=(0,rb.rotl)(u^h,12))|0,h=h+(y=(0,rb.rotl)(y^a,8))|0,u=(0,rb.rotl)(u^h,7),s=s+l|0,f=f+(v=(0,rb.rotl)(v^s,16))|0,s=s+(l=(0,rb.rotl)(l^f,12))|0,f=f+(v=(0,rb.rotl)(v^s,8))|0,l=(0,rb.rotl)(l^f,7);let w=0;r[w++]=i,r[w++]=o,r[w++]=a,r[w++]=s,r[w++]=m,r[w++]=y,r[w++]=v,r[w++]=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,rb.createCipher)(t,{counterRight:!1,counterLength:8,allowShortKeys:!0}),e.chacha20=(0,rb.createCipher)(t,{counterRight:!1,counterLength:4,allowShortKeys:!1}),e.xchacha20=(0,rb.createCipher)(t,{counterRight:!1,counterLength:8,extendNonceFn:n,allowShortKeys:!1}),e.chacha8=(0,rb.createCipher)(t,{counterRight:!1,counterLength:4,rounds:8}),e.chacha12=(0,rb.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=rR.poly1305.create(s);a&&i(l,a),i(l,r);let c=new Uint8Array(16),d=(0,ed.createView)(c);(0,ed.setBigUint64)(d,0,BigInt(a?a.length:0),!0),(0,ed.setBigUint64)(d,8,BigInt(r.length),!0),l.update(c);let u=l.digest();return(0,ed.clean)(s,c),u}e._poly1305_aead=e=>(t,n,r)=>((0,eu.bytes)(t,32),(0,eu.bytes)(n),{encrypt(i,o){let s=i.length,l=s+16;o?(0,eu.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,ed.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,eu.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,ed.equalBytes)(d,u))throw Error("invalid tag");return e(t,n,c,o,1),(0,ed.clean)(u),o}}),e.chacha20poly1305=(0,ed.wrapCipher)({blockSize:64,nonceLength:12,tagLength:16},(0,e._poly1305_aead)(e.chacha20)),e.xchacha20poly1305=(0,ed.wrapCipher)({blockSize:64,nonceLength:24,tagLength:16},(0,e._poly1305_aead)(e.xchacha20))}(rv),Object.defineProperty(ry,"__esModule",{value:!0}),ry.xchacha20=void 0,ry.xchacha20=function(e,t,n){return(0,rv.xchacha20poly1305)(e,t,n)},function(e){function t(e,t,n,r){var i=(0,eb.symmetricAlgorithm)();if("aes-256-gcm"===i)return e(nK.aes256gcm,t,n,(0,eb.symmetricNonceLength)(),ew.AEAD_TAG_LENGTH,r);if("xchacha20"===i)return e(ry.xchacha20,t,n,ew.XCHACHA20_NONCE_LENGTH,ew.AEAD_TAG_LENGTH,r);if("aes-256-cbc"===i)return e(nK.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
1(n);if(0===i)return(0,ed.concatBytes)(a,s);var l=s.length-i,c=s.subarray(0,l),d=s.subarray(l);return(0,ed.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,ed.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}(nB),i3=ea&&ea.__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]}),i5=ea&&ea.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i3(t,e,n)},Object.defineProperty(eS,"__esModule",{value:!0}),i5(ex,eS),i5(nR,eS),i5(nO,eS),i5(nB,eS);var r$={};Object.defineProperty(r$,"__esModule",{value:!0}),r$.PublicKey=void 0,r$.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 O.from((0,eS.convertPublicKeyFormat)(this.data,!1))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"compressed",{get:function(){return O.from(this.data)},enumerable:!1,configurable:!0}),e.prototype.toHex=function(e){return void 0===e&&(e=!0),(0,ed.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,ed.equalBytes)(this.data,e.data)},e}
1(),Object.defineProperty(e_,"__esModule",{value:!0}),e_.PrivateKey=void 0,e_.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 r$.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 O.from(this.data)},enumerable:!1,configurable:!0}),e.prototype.toHex=function(){return(0,ed.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,ed.equalBytes)(this.data,e.data)},e}(),Object.defineProperty(eE,"__esModule",{value:!0}),eE.PublicKey=eE.PrivateKey=void 0,Object.defineProperty(eE,"PrivateKey",{enumerable:!0,get:function(){return e_.PrivateKey}}),Object.defineProperty(eE,"PublicKey",{enumerable:!0,get:function(){return r$.PublicKey}}),Object.defineProperty(ec,"__esModule",{value:!0}),ec.utils=ec.PublicKey=ec.PrivateKey=ec.ECIES_CONFIG=void 0,ec.encrypt=function(e,t){var n=new i4.PrivateKey,r=e instanceof Uint8Array?new i4.PublicKey(e):i4.PublicKey.fromHex(e),i=n.encapsulate(r,(0,i6.isHkdfKeyCompressed)()),o=(0,i6.isEphemeralKeyCompressed)()?n.publicKey.compressed:n.publicKey.uncompressed,a=(0,i9.symEncrypt)(i,t);return O.from((0,i8.concatBytes)(o,a))},ec.decrypt=function(e,t){var n=e instanceof Uint8Array?new i4.PrivateKey(e):i4.PrivateKey.fromHex(e),r=(0,i6.ephemeralKeySize)(),i=new i4.PublicKey(t.subarray(0,r)),o=t.subarray(r),a=i.decapsulate(n,(0,i6.isHkdfKeyCompressed)());return O.from((0,i9.symDecrypt)(a,o))},i8=ed,i6=eb,i4=eE,i9=eS,Object.defineProperty(ec,"ECIES_CONFIG",{enumerable:!0,get:function(){return eb.ECIES_CONFIG}}),Object.defineProperty(ec,"PrivateKey",{enumerable:!0,get:function(){return eE.PrivateKey}}),Object.defineProperty(ec,"PublicKey",{enumerable:!0,get:function(){return eE.PublicKey}}),ec.utils={aesEncrypt:i9.aesEncrypt,aesDecrypt:i9.aesDecrypt,symEncrypt:i9.symEncrypt,symDecrypt:i9.symDecrypt,decodeHex:i9.decodeHex,getValidSecret:i9.getValidSecret,remove0x:i9.remove0x};let rD=c()("KeyExchange:Layer"),rB=c()("SocketService:Layer"),rK=c()("Ecies:Layer"),rj=c()("RemoteCommunication:Layer");rD.color="##95c44e",rB.color="#f638d7",rK.color="#465b9c",rj.color="#47a2be";let rU,rH=[],rF=[],rz=(e,t)=>m(void 0,void 0,void 0,function*(){rU=t,rF.push(e),(function(e){return m(this,void 0,void 0,function*(){let t;if(!rU||!e)return;t=rF,rF=rH,rH=t;let n=rU.endsWith("/")?`${rU}evt`:`${rU}/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);rj(`[sendBufferedEvents] Sending ${rH.length} analytics events to ${n}`);try{let e=yield s()(n,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:i}),t=yield e.text();rj(`[sendBufferedEvents] Response: ${t}`),rH.length=0}catch(e){}})})(e).catch(()=>{})});class rq{constructor(e){this.enabled=!0,(null==e?void 0:e.debug)&&c().enable("Ecies:Layer"),this.ecies=(null==e?void 0:e.privateKey)?ec.PrivateKey.fromHex(e.privateKey):new ec.PrivateKey,rK("[ECIES constructor()] initialized secret: ",this.ecies.toHex()),rK("[ECIES constructor()] initialized public: ",this.ecies.publicKey.toHex()),rK("[ECIES constructor()] init with",this)}generateECIES(){this.ecies=new ec.PrivateKey}getPublicKey(){return this.ecies.publicKey.toHex()}encrypt(e,t){let n=e;if(this.enabled)try{rK("[ECIES: encrypt()] using otherPublicKey",t);let r=O.from(e),i=ec.encrypt(t,r);n=O.from(i).toString("base64")}catch(n){throw rK("[ECIES: encrypt()] error encrypt:",n),rK("[ECIES: encrypt()] private: ",this.ecies.toHex()),rK("[ECIES: encrypt()] data: ",e),rK("[ECIES: encrypt()] otherkey: ",t),n}return n}decrypt(e){let t=e;if(this.enabled)try{rK("[ECIES: decrypt()] using privateKey",this.ecies.toHex());let n=O.from(e.toString(),"base64");t=ec.decrypt(this.ecies.toHex(),n).toString()}catch(t){throw rK("[ECIES: decrypt()] error decrypt",t),rK("[ECIES: decrypt()] private: ",this.ecies.toHex()),rK("[ECIES: decrypt()] encryptedData: ",e),t}return t}getKeyInfo(){return{private:this.ecies.toHex(),public:this.ecies.publicKey.toHex()}}toString(){rK("[ECIES: toString()]",this.getKeyInfo())}}var rV="0.33.1";let rW="https://metamask-sdk.api.cx.metamask.io/",rG=["websocket"],rY=["metamask_connectSign","metamask_connectWith","metamask_open","metamask_batch","personal_sign","wallet_requestPermissions","wallet_revokePermissions","wallet_watchAsset","eth_sendTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_signTransaction","eth_sign","personal_ecRecover"];function rZ(e){return rY.includes(e)}
1function rJ(e){let{context:t}=e;rj(`[RemoteCommunication: clean()] context=${t}`),e.channelConfig=void 0,e.ready=!1,e.originatorConnectStarted=!1}(oh=oa||(oa={})).DISCONNECTED="disconnected",oh.WAITING="waiting",oh.TIMEOUT="timeout",oh.LINKED="linked",oh.PAUSED="paused",oh.TERMINATED="terminated",(i7=os||(os={})).KEY_INFO="key_info",i7.SERVICE_STATUS="service_status",i7.PROVIDER_UPDATE="provider_update",i7.RPC_UPDATE="rpc_update",i7.KEYS_EXCHANGED="keys_exchanged",i7.JOIN_CHANNEL="join_channel",i7.PUBLIC_KEY="public_key",i7.CHANNEL_CREATED="channel_created",i7.CLIENTS_CONNECTED="clients_connected",i7.CLIENTS_DISCONNECTED="clients_disconnected",i7.CLIENTS_WAITING="clients_waiting",i7.CLIENTS_READY="clients_ready",i7.REJECTED="rejected",i7.WALLET_INIT="wallet_init",i7.CHANNEL_PERSISTENCE="channel_persistence",i7.CONFIG="config",i7.MESSAGE_ACK="ack",i7.SOCKET_DISCONNECTED="socket_disconnected",i7.SOCKET_RECONNECT="socket_reconnect",i7.OTP="otp",i7.SDK_RPC_CALL="sdk_rpc_call",i7.AUTHORIZED="authorized",i7.CONNECTION_STATUS="connection_status",i7.MESSAGE="message",i7.TERMINATE="terminate",(ol||(ol={})).KEY_EXCHANGE="key_exchange",(oe=oc||(oc={})).KEY_HANDSHAKE_START="key_handshake_start",oe.KEY_HANDSHAKE_CHECK="key_handshake_check",oe.KEY_HANDSHAKE_SYN="key_handshake_SYN",oe.KEY_HANDSHAKE_SYNACK="key_handshake_SYNACK",oe.KEY_HANDSHAKE_ACK="key_handshake_ACK",oe.KEY_HANDSHAKE_WALLET="key_handshake_wallet",oe.KEY_HANDSHAKE_NONE="none";class rX extends u.EventEmitter2{constructor({communicationLayer:e,otherPublicKey:t,context:n,ecies:r,logging:i}
1){super(),this.keysExchanged=!1,this.step=oc.KEY_HANDSHAKE_NONE,this.debug=!1,this.context=n,this.communicationLayer=e,(null==r?void 0:r.privateKey)&&t&&(rD(`[KeyExchange: constructor()] otherPubKey=${t} set keysExchanged to true!`,r),this.keysExchanged=!0),this.myECIES=new rq(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(ol.KEY_EXCHANGE,this.onKeyExchangeMessage.bind(this))}onKeyExchangeMessage(e){let{relayPersistence:t}=this.communicationLayer.remote.state;if(rD(`[KeyExchange: onKeyExchangeMessage()] context=${this.context} keysExchanged=${this.keysExchanged} relayPersistence=${t}`,e),t)return void rD("[KeyExchange: onKeyExchangeMessage()] Ignoring key exchange message because relay persistence is activated");let{message:n}=e;this.keysExchanged&&rD(`[KeyExchange: onKeyExchangeMessage()] context=${this.context} received handshake while already exchanged. step=${this.step} otherPubKey=${this.otherPublicKey}`),this.emit(os.KEY_INFO,n.type),n.type===oc.KEY_HANDSHAKE_SYN?(this.checkStep([oc.KEY_HANDSHAKE_NONE,oc.KEY_HANDSHAKE_ACK]),rD("[KeyExchange: onKeyExchangeMessage()] KEY_HANDSHAKE_SYN",n),n.pubkey&&this.setOtherPublicKey(n.pubkey),this.communicationLayer.sendMessage({type:oc.KEY_HANDSHAKE_SYNACK,pubkey:this.myPublicKey}).catch(e=>{rD("[KeyExchange: onKeyExchangeMessage()] Error sending KEY_HANDSHAKE_SYNACK",e)}),this.setStep(oc.KEY_HANDSHAKE_ACK)):n.type===oc.KEY_HANDSHAKE_SYNACK?(this.checkStep([oc.KEY_HANDSHAKE_SYNACK,oc.KEY_HANDSHAKE_ACK,oc.KEY_HANDSHAKE_NONE]),rD("[KeyExchange: onKeyExchangeMessage()] KEY_HANDSHAKE_SYNACK"),n.pubkey&&this.setOtherPublicKey(n.pubkey),this.communicationLayer.sendMessage({type:oc.KEY_HANDSHAKE_ACK}).catch(e=>{rD("[KeyExchange: onKeyExchangeMessage()] Error sending KEY_HANDSHAKE_ACK",e)}),this.keysExchanged=!0,this.setStep(oc.KEY_HANDSHAKE_ACK),this.emit(os.KEYS_EXCHANGED)):n.type===oc.KEY_HANDSHAKE_ACK&&(rD("[KeyExchange: onKeyExchangeMessage()] KEY_HANDSHAKE_ACK set keysExchanged to true!"),this.checkStep([oc.KEY_HANDSHAKE_ACK,oc.KEY_HANDSHAKE_NONE]),this.keysExchanged=!0,this.setStep(oc.KEY_HANDSHAKE_ACK),this.emit(os.KEYS_EXCHANGED))}resetKeys(e){this.clean(),this.myECIES=new rq(e)}clean(){rD(`[KeyExchange: clean()] context=${this.context} reset handshake state`),this.setStep(oc.KEY_HANDSHAKE_NONE),this.emit(os.KEY_INFO,this.step),this.keysExchanged=!1}start({isOriginator:e,force:t}){let{relayPersistence:n,protocolVersion:r}=this.communicationLayer.remote.state;n?rD("[KeyExchange: start()] Ignoring key exchange message because relay persistence is activated"):(rD(`[KeyExchange: start()] context=${this.context} protocolVersion=${r} isOriginator=${e} step=${this.step} force=${t} relayPersistence=${n} keysExchanged=${this.keysExchanged}`),e?!(this.keysExchanged||this.step!==oc.KEY_HANDSHAKE_NONE&&this.step!==oc.KEY_HANDSHAKE_SYNACK)||t?(rD(`[KeyExchange: start()] context=${this.context} -- start key exchange (force=${t}) -- step=${this.step}`,this.step),this.clean(),this.setStep(oc.KEY_HANDSHAKE_SYNACK),this.communicationLayer.sendMessage({type:oc.KEY_HANDSHAKE_SYN,pubkey:this.myPublicKey,v:2}).catch(e=>{rD("[KeyExchange: start()] Error sending KEY_HANDSHAKE_SYN",e)})):rD(`[KeyExchange: start()] context=${this.context} -- key exchange already ${this.keysExchanged?"done":"in progress"} -- aborted.`,this.step):this.keysExchanged&&!0!==t?rD("[KeyExchange: start()] don't send KEY_HANDSHAKE_START -- exchange already done."):r>=2?this.communicationLayer.sendMessage({type:oc.KEY_HANDSHAKE_SYNACK,pubkey:this.myPublicKey,v:2}).catch(e=>{rD("[KeyExchange: start()] Error sending KEY_HANDSHAKE_SYNACK",e)}):(this.communicationLayer.sendMessage({type:oc.KEY_HANDSHAKE_START}).catch(e=>{rD("[KeyExchange: start()] Error sending KEY_HANDSHAKE_START",e)}),this.clean()))}setStep(e){this.step=e,this.emit(os.KEY_INFO,e)}checkStep(e){e.length>0&&e.indexOf(this.step.toString())}setRelayPersistence({localKey:e,otherKey:t}){this.otherPublicKey=t,this.myECIES=new rq({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){rD("[KeyExchange: setOtherPubKey()]",e),this.otherPublicKey=e}encryptMessage(e){if(!this.otherPublicKey)throw Error("encryptMessage: Keys not exchanged - missing otherPubKey");
1return 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})}}(ot=od||(od={})).TERMINATE="terminate",ot.ANSWER="answer",ot.OFFER="offer",ot.CANDIDATE="candidate",ot.JSONRPC="jsonrpc",ot.WALLET_INFO="wallet_info",ot.WALLET_INIT="wallet_init",ot.ORIGINATOR_INFO="originator_info",ot.PAUSE="pause",ot.OTP="otp",ot.AUTHORIZED="authorized",ot.PING="ping",ot.READY="ready",(on=ou||(ou={})).REQUEST="sdk_connect_request_started",on.REQUEST_MOBILE="sdk_connect_request_started_mobile",on.RECONNECT="sdk_reconnect_request_started",on.CONNECTED="sdk_connection_established",on.CONNECTED_MOBILE="sdk_connection_established_mobile",on.AUTHORIZED="sdk_connection_authorized",on.REJECTED="sdk_connection_rejected",on.TERMINATED="sdk_connection_terminated",on.DISCONNECTED="sdk_disconnected",on.SDK_USE_EXTENSION="sdk_use_extension",on.SDK_RPC_REQUEST="sdk_rpc_request",on.SDK_RPC_REQUEST_RECEIVED="sdk_rpc_request_received",on.SDK_RPC_REQUEST_DONE="sdk_rpc_request_done",on.SDK_EXTENSION_UTILIZED="sdk_extension_utilized",on.SDK_USE_INAPP_BROWSER="sdk_use_inapp_browser";let rQ=(e,t,n)=>m(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 rB(`handleJoinChannelResults: Channel ${u} terminated`),void e.emit(os.TERMINATE);if(!n)return void rB(`handleJoinChannelResults: No result for channel ${u}`);let{persistence:f,walletKey:p,rejected:g}=n;if(rB(`handleJoinChannelResults: Channel ${u} persistence=${f} walletKey=${p} rejected=${g}`),g)return rB(`handleJoinChannelResults: Channel ${u} rejected`),yield e.remote.disconnect({terminate:!0}),e.remote.emit(os.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(os.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:oc.KEY_HANDSHAKE_ACK}).catch(e=>{}),null==(a=e.state.socket)||a.emit(od.PING,{id:u,clientType:h?"dapp":"wallet",context:"on_channel_reconnect",message:""}),yield null==n?void 0:n.persistChannelConfig(r),c.emitServiceStatusEvent(),c.setConnectionStatus(oa.LINKED)}f&&(e.emit(os.CHANNEL_PERSISTENCE),null==(s=e.state.keyExchange)||s.setKeysExchanged(!0),c.state.ready=!0,c.state.authorized=!0,c.emit(os.AUTHORIZED),rz(Object.assign(Object.assign({id:null!=u?u:"",event:h?ou.CONNECTED:ou.CONNECTED_MOBILE},e.remote.state.originatorInfo),{sdkVersion:e.remote.state.sdkVersion,commLayer:e.state.communicationLayerPreference,commLayerVersion:rV,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)=>m(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=>m(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 rB("[SocketService: reconnectSocket()] Reconnection already in progress, skipping",e),!1;if(!n)return rB("[SocketService: reconnectSocket()] socket is not defined",e),!1;if(!r)return!1;let{connected:s}=n;t.isReconnecting=!0,t.reconnectionAttempts=0,rB(`[SocketService: reconnectSocket()] connected=${s} trying to reconnect after socketio disconnection`,e);try{for(;3>t.reconnectionAttempts;){if(rB(`[SocketService: reconnectSocket()] Attempt ${t.reconnectionAttempts+1} of 3`,e),yield r0(200),n.connected)return rB("Socket already connected --- ping to retrieve messages"),n.emit(od.PING,{id:r,clientType:o?"dapp":"wallet",context:"on_channel_c
1onfig",message:""}),!0;t.resumed=!0,n.connect(),e.emit(os.SOCKET_RECONNECT);try{if(yield new Promise((t,a)=>{n.emit(os.JOIN_CHANNEL,{channelId:r,context:`${i}connect_again`,clientType:o?"dapp":"wallet"},(n,r)=>m(void 0,void 0,void 0,function*(){try{yield rQ(e,n,r),t()}catch(e){a(e)}}))}),yield r0(100),n.connected)return rB(`Reconnection successful on attempt ${t.reconnectionAttempts+1}`),!0}catch(e){rB(`Error during reconnection attempt ${t.reconnectionAttempts+1}:`,e)}t.reconnectionAttempts+=1,3>t.reconnectionAttempts&&(yield r0(200))}return rB("Failed to reconnect after 3 attempts"),!1}finally{t.isReconnecting=!1,t.reconnectionAttempts=0}});function r3(e,t){return m(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 rB(`[SocketService: encryptAndSendMessage()] context=${e.state.context}`,i),t.type===od.TERMINATE&&(e.state.manualDisconnect=!0),new Promise((t,n)=>{var r;null==(r=e.state.socket)||r.emit(os.MESSAGE,i,(e,r)=>{var i;e&&(rB(`[SocketService: encryptAndSendMessage()] error=${e}`),n(e)),rB("[encryptAndSendMessage] response",r),t(null!=(i=null==r?void 0:r.success)&&i)})})})}(or=of||(of={})).RPC_CHECK="rpcCheck",or.SKIPPED_RPC="skippedRpc";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:os.CLIENTS_CONNECTED,handler:function(e,t){return n=>m(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(rB(`[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(os.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||(rB(`[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)rB("[SocketService: handleClientsConnected()] 'clients_connected' skip sending originatorInfo on pause");else if(!e.state.isOriginator){let t=!f;rB(`[SocketService: handleClientsConnected()] context=${e.state.context} on 'clients_connected' / keysExchanged=${null==(c=e.state.keyExchange)?void 0:c.areKeysExchanged()} -- force=${t} -- backward compatibility`),rB(`[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:os.CHANNEL_CREATED,handler:function(e,t){return n=>{rB(`[SocketService: handleChannelCreated()] context=${e.state.context} on 'channel_created-${t}'`,n),e.emit(os.CHANNEL_CREATED,n)}}},{event:os.CLIENTS_DISCONNECTED,handler:function(e,t){return()=>{var n;e.state.clientsConnected=!1,rB(`[SocketService: handlesClientsDisconnected()] context=${e.state.context} on 'clients_disconnected-${t}'`),e.remote.state.relayPersistence?rB(`[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(os.CLIENTS_DISCONNECTED,t))}}},{event:os.CONFIG,handler:function(e,t){return n=>m(this,void 0,void 0,function*(){var r,i,o;rB(`[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&&(rB(`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:oc.KEY_HANDSHAKE_ACK}),yield e.remote.sendMessage({type:od.PING}),yield null==(i=e.remote.state.storageManager)?void 0:i.persist
1ChannelConfig(e.remote.state.channelConfig)),!0!==a||e.remote.state.channelConfig.relayPersistence||(rB(`Setting relay persistence ${a}`),e.remote.state.channelConfig.relayPersistence=a,e.remote.state.relayPersistence=!0,e.remote.emit(os.CHANNEL_PERSISTENCE),e.remote.state.authorized=!0,e.remote.state.ready=!0,e.remote.emit(os.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(os.CHANNEL_PERSISTENCE))})}},{event:os.MESSAGE,handler:function(e,t){return n=>{var r,i,o,a,s,l,c,u,h,f,p,g,m,y,v,b,w,E;let{ackId:_,message:S,error:x}=n,C=null!=(r=e.remote.state.relayPersistence)&&r;if(rB(`[SocketService handleMessage()]  relayPersistence=${C}  context=${e.state.context} on 'message' ${t} keysExchanged=${null==(i=e.state.keyExchange)?void 0:i.areKeysExchanged()}`,n),x)throw rB(`
2      [SocketService handleMessage()] context=${e.state.context}::on 'message' error=${x}`),Error(x);let k="string"==typeof S;if(!k&&(null==S?void 0:S.type)===oc.KEY_HANDSHAKE_START){if(C)return;return rB(`[SocketService handleMessage()] context=${e.state.context}::on 'message' received HANDSHAKE_START isOriginator=${e.state.isOriginator}`,S),void(null==(o=e.state.keyExchange)||o.start({isOriginator:null!=(a=e.state.isOriginator)&&a,force:!0}))}if(!k&&(null==(s=null==S?void 0:S.type)?void 0:s.startsWith("key_handshake"))){if(C)return;return rB(`[SocketService handleMessage()] context=${e.state.context}::on 'message' emit KEY_EXCHANGE`,S),void e.emit(ol.KEY_EXCHANGE,{message:S,context:e.state.context})}if(!k||(null==(l=e.state.keyExchange)?void 0:l.areKeysExchanged())){if(!k&&(null==S?void 0:S.type))return void e.emit(os.MESSAGE,S)}else{let t=!1;try{rB(`[SocketService handleMessage()] context=${e.state.context}::on 'message' trying to decrypt message`),null==(c=e.state.keyExchange)||c.decryptMessage(S),t=!0}catch(t){rB(`[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:oc.KEY_HANDSHAKE_START}).catch(e=>{}),void rB(`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(),S);rB("Invalid key exchange status detected --- updating it."),null==(u=e.state.keyExchange)||u.setKeysExchanged(!0)}if(!k)return void e.emit(os.MESSAGE,S);let M=null==(m=e.state.keyExchange)?void 0:m.decryptMessage(S),A=JSON.parse(null!=M?M:"{}");if(_&&(null==_?void 0:_.length)>0&&(rB(`[SocketService handleMessage()] context=${e.state.context}::on 'message' ackid=${_} channelId=${t}`),null==(y=e.state.socket)||y.emit(os.MESSAGE_ACK,{ackId:_,channelId:t,clientType:e.state.isOriginator?"dapp":"wallet"})),e.state.clientsPaused=(null==A?void 0:A.type)===od.PAUSE,e.state.isOriginator&&A.data){let t=A.data,n=e.state.rpcMethodTracker[t.id];if(n){let r=Date.now()-n.timestamp;rB(`[SocketService handleMessage()] context=${e.state.context}::on 'message' received answer for id=${t.id} method=${n.method} responseTime=${r}`,A),e.remote.state.analytics&&r5.includes(n.method.toLowerCase())&&rz(Object.assign(Object.assign({id:null!=(v=e.remote.state.channelId)?v:"",event:ou.SDK_RPC_REQUEST_DONE,sdkVersion:e.remote.state.sdkVersion,commLayerVersion:rV},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)&&d.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==(w=t.error)?void 0:w.code,message:null==(E=t.error)?void 0:E.message}:void 0,elapsedTime:r});e.state.rpcMethodTracker[t.id]=i,e.emit(os.RPC_UPDATE,i)}}e.emit(os.MESSAGE,{message:A})}}},{event:os.REJECTED,handler:function(e,t){return n=>m(this,void 0,void 0,function*(){var n;e.state.isOriginator&&!e.remote.state.ready?(rB(`[SocketService: handleChannelRejected()] context=${e.state.context} channelId=${t} isOriginator=${e.state.isOriginator} ready=${e.remote.state.ready}`,e.remote.state.originatorInfo),rz(Object.assign(Object.assign({id:t,event:ou.REJECTED},e.remote.state.originatorInfo),{sdkVersion:e.remote.state.sdkVersion,commLayer:e.state.communicationLayerPreference,commLayerVersion:rV,walletVersion:null==(n=e.remote.state.walletInfo)?void 0:n.version}),e.remote.state.communicationServerUrl).catch(e=>{}),d.analytics.track("sdk_connection_rejected",{transport_type:"websocket"}),yield e.remote.disconnect({terminate:!0}
2),e.remote.emit(os.REJECTED,{channelId:t}),e.remote.setConnectionStatus(oa.DISCONNECTED)):rB(`[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=>{rB(`[SocketService: handleClientsWaitingToJoin()] context=${e.state.context} on 'clients_waiting_to_join-${t}'`,n),e.emit(os.CLIENTS_WAITING,n)}}}],r6=[{event:os.KEY_INFO,handler:function(e){return t=>{rB("[SocketService: handleKeyInfo()] on 'KEY_INFO'",t),e.emit(os.KEY_INFO,t)}}},{event:os.KEYS_EXCHANGED,handler:function(e){return()=>{var t,n,r;rB(`[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(os.KEYS_EXCHANGED,{keysExchanged:null==(r=e.state.keyExchange)?void 0:r.areKeysExchanged(),isOriginator:e.state.isOriginator});let o={keyInfo:e.getKeyInfo()};e.emit(os.SERVICE_STATUS,o)}}}];function r4(e,t){rB(`[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=>{rB(`[SocketService: setupChannelListener()] context=${e.state.context} socket event=error`,t)}),null==n||n.io.on("reconnect",t=>{rB(`[SocketService: setupChannelListener()] context=${e.state.context} socket event=reconnect`,t),r2(e).catch(e=>{})}),null==n||n.io.on("reconnect_error",t=>{rB(`[SocketService: setupChannelListener()] context=${e.state.context} socket event=reconnect_error`,t)}),null==n||n.io.on("reconnect_failed",()=>{rB(`[SocketService: setupChannelListener()] context=${e.state.context} socket event=reconnect_failed`)})),null==n||n.on("disconnect",t=>(rB(`[SocketService: setupChannelListener()] on 'disconnect' -- MetaMaskSDK socket disconnected '${t}' begin recovery...`),(t=>{rB(`[SocketService: handleDisconnect()] on 'disconnect' manualDisconnect=${e.state.manualDisconnect}`,t),e.state.manualDisconnect||(e.emit(os.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 u.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;const{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)&&c().enable("SocketService:Layer"),this.state.communicationServerUrl=r,this.state.hasPlaintext=this.state.communicationServerUrl!==rW&&!0===(null==a?void 0:a.plaintext),rB(`[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;rB(`[SocketService: initSocket()] Socket IO url: ${i}`),this.state.socket=(0,g.io)(i,{autoConnect:!1,transports:rG,withCredentials:!0}),function(e){if("u">typeof window&&"u">typeof document&&(rB(`[SocketService: setupSocketFocusListener()] hasFocus=${document.hasFocus()}`,e),!e.state.focusListenerAdded)){let t=()=>{rB("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 rX(o)}resetKeys(){var e;return rB("[SocketService: resetKeys()] Resetting keys."),void(null==(e=this.state.keyExchange)||e.resetKeys())}createChannel(){return m(this,void 0,void 0,function*(){return function(e){return m(this,void 0,void 0,function*(){var t,n,r;if(rB(`[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,f.A)();e.state.channelId=i,r4(e,i),yield new Promise((t,n)=>{var r;null==(r=e.state.socket)||r.emit(os.JOIN_CHANNEL,{channelId:i,context:`${e.state.context}createChannel`,clientType:"dapp"},(r,i)=>m(this,void 0,void 0,function*(){try{yield rQ(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 m(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(os.JOIN_CHANNEL,{channelId:n,context:`${o.context}_connectToChannel`,clientType:s?"dapp":"wallet",publicKey:r&&!s?a:void 0},(n,r)=>m(this,void 0,void 0,function*(){yield rQ(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(os.MESSAGE,{id:this.state.channelId,context:this.state.context,message:{type:oc.KEY_HANDSHAKE_CHECK,pubkey:this.getKeyInfo().ecies.otherPubKey}})}getKeyExchange(){return this.state.keyExchange}sendMessage(e){return m(this,void 0,void 0,function*(){return function(e,t){return m(this,void 0,void 0,function*(){var n,r,i,o,a;let s,l;if(!e.state.channelId)throw rB("handleSendMessage: no channelId - Create a channel first"),Error("Create a channel first");
2if(rB(`[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 rB(`[SocketService: handleKeyHandshake()] context=${e.state.context}`,t),null==(o=e.state.socket)||o.emit(os.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 rB(`[SocketService: validateKeyExchange()] context=${e.state.context} ERROR keys not exchanged`,t),Error("Keys not exchanged BBB")}(e,t),s=null!=(a=null==t?void 0:t.method)?a:"",l=null==t?void 0:t.id,e.state.isOriginator&&l&&(e.state.rpcMethodTracker[l]={id:l,timestamp:Date.now(),method:s},e.emit(os.RPC_UPDATE,e.state.rpcMethodTracker[l]));let c=yield r3(e,t);return e.remote.state.analytics&&e.remote.state.isOriginator&&t.method&&r5.includes(t.method.toLowerCase())&&rz({id:null!=(i=e.remote.state.channelId)?i:"",event:ou.SDK_RPC_REQUEST,params:{method:t.method,from:"mobile"}},e.remote.state.communicationServerUrl).catch(e=>{}),e.remote.state.isOriginator&&t.method&&rZ(t.method)&&d.analytics.track("sdk_action_requested",{action:t.method}),(function(e,t){return m(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:of.RPC_CHECK,result:e})),o=m(this,void 0,void 0,function*(){let t,n=yield(t={instance:e,rpcId:r},m(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:of.SKIPPED_RPC,result:i}}),a=yield Promise.race([n,o]);if(a.type===of.RPC_CHECK){let e=a.result;rB(`[SocketService:handleRpcReplies()] id=${t.id} ${i} ( ${e.elapsedTime} ms)`,e.result)}else{if(a.type!==of.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(os.RPC_UPDATE,t);let n={data:Object.assign(Object.assign({},t),{jsonrpc:"2.0"}),name:"metamask-provider"};e.emit(os.MESSAGE,{message:n})}}}catch(e){throw e}})})(e,t).catch(e=>{}),c})}(this,e)})}ping(){return function(e){return m(this,void 0,void 0,function*(){var t,n;rB(`[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(od.PING,{id:e.state.channelId,context:"ping",clientType:e.remote.state.isOriginator?"dapp":"wallet",message:""})})}(this)}pause(){return function(e){return m(this,void 0,void 0,function*(){var t,n;rB(`[SocketService: pause()] context=${e.state.context}`),e.state.manualDisconnect=!0,(null==(t=e.state.keyExchange)?void 0:t.areKeysExchanged())&&(yield e.sendMessage({type:od.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 m(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(rB(`[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 rB("[SocketService: resume()] channelId is not defined"),Error("ChannelId is not defined");(null==r?void 0:r.connected)?(rB("[SocketService: resume()] already connected."),r.emit(od.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:od.READY}):null==a||a.start({isOriginator:!1}))):(null==r||r.connect(),rB(`[SocketService: resume()] after connecting socket --> connected=${null==r?void 0:r.connected}`),null==r||r.emit(os.JOIN_CHANNEL,{channelId:i,context:`${o}_resume`,clientType:l?"dapp":"wallet"},(t,n)=>m(this,void 0,void 0,function*(){try{yield rQ(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;rB(`[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()}}
2function r7({communicationLayerPreference:e,otherPublicKey:t,reconnect:n,ecies:r,communicationServerUrl:i=rW,instance:o}){var a,s,l,c,u,h,f,p,g,y,v;let{state:b}=o;if(rj("[initCommunicationLayer()] ",JSON.stringify(b,null,2)),e!==op.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 w="u">typeof document&&document.URL||"",E="u">typeof document&&document.title||"";(null==(a=b.dappMetadata)?void 0:a.url)&&(w=b.dappMetadata.url),(null==(s=b.dappMetadata)?void 0:s.name)&&(E=b.dappMetadata.name);let _=null!=(h=null!=(c=null==(l=b.dappMetadata)?void 0:l.name)?c:null==(u=b.dappMetadata)?void 0:u.url)?h:"N/A",S="u">typeof window&&void 0!==window.location&&null!=(f=window.location.hostname)?f:_,x={url:w,title:E,source:null==(p=b.dappMetadata)?void 0:p.source,dappId:S,anonId:b.anonId,icon:(null==(g=b.dappMetadata)?void 0:g.iconUrl)||(null==(y=b.dappMetadata)?void 0:y.base64Icon),platform:b.platformType,apiVersion:rV,connector:null==(v=b.dappMetadata)?void 0:v.connector};for(let[t,n]of(b.originatorInfo=x,Object.entries({[os.AUTHORIZED]:function(e){return()=>m(this,void 0,void 0,function*(){var t,n,r;let{state:i}=e;if(i.authorized)return;yield m(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(rj(`[RemoteCommunication: handleAuthorizedEvent()] HACK 'authorized' version=${null==(n=i.walletInfo)?void 0:n.version} compareValue=${o}`),1!==o)return;let a=i.platformType===og.MobileWeb||i.platformType===og.ReactNative||i.platformType===og.MetaMaskMobileWebview;rj(`[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(os.AUTHORIZED))})}(o),[os.MESSAGE]:e=>{let t=e;e.message&&(t=t.message),function(e,t){let{state:n}=t;if(rj(`[RemoteCommunication: onCommunicationLayerMessage()] context=${n.context} on 'message' typeof=${typeof e}`,e),t.state.ready=!0,n.isOriginator||e.type!==od.ORIGINATOR_INFO)if(n.isOriginator&&e.type===od.WALLET_INFO)!function(e,t){let{state:n}=e;n.walletInfo=t.walletInfo,n.paused=!1}(t,e);else{if(n.isOriginator&&e.type===od.WALLET_INIT)(function(e,t){return m(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(rj("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(os.WALLET_INIT,{accounts:o.accounts,chainId:o.chainId})}catch(e){}}})})(t,e).catch(e=>{rj(`[RemoteCommunication: onCommunicationLayerMessage()] error=${e}`)});else if(e.type===od.TERMINATE)(function(e){return m(this,void 0,void 0,function*(){let{state:t}=e;t.isOriginator&&(yield ie({options:{terminate:!0,sendMessage:!1},instance:e}),e.emit(os.TERMINATE))})})(t).catch(e=>{rj(`[RemoteCommunication: onCommunicationLayerMessage()] error=${e}`)});else if(e.type===od.PAUSE)!function(e){let{state:t}=e;t.paused=!0,e.setConnectionStatus(oa.PAUSED)}(t);else if(e.type===od.READY&&n.isOriginator)!function(e){let{state:t}=e;e.setConnectionStatus(oa.LINKED);let n=t.paused;t.paused=!1,e.emit(os.CLIENTS_READY,{isOriginator:t.isOriginator,walletInfo:t.walletInfo}),n&&(t.authorized=!0,e.emit(os.AUTHORIZED))}(t);else{if(e.type===od.OTP&&n.isOriginator)return function(e,t){var n;let{state:r}=e;e.emit(os.OTP,t.otpAnswer),1==="6.6".localeCompare((null==(n=r.walletInfo)?void 0:n.version)||"")&&e.emit(os.SDK_RPC_CALL,{method:"eth_requestAccounts",params:[]})}(t,e);e.type===od.AUTHORIZED&&n.isOriginator&&function(e){let{state:t}=e;t.authorized=!0,e.emit(os.AUTHORIZED)}(t)}t.emit(os.MESSAGE,e)}else!function(e,t){var n;let{state:r}=e;null==(n=r.communicationLayer)||n.sendMessage({type:od.WALLET_INFO,walletInfo:r.walletInfo}),r.originatorInfo=t.originatorInfo||t.originator,e.emit(os.CLIENTS_READY,{isOriginator:r.isOriginator,originatorInfo:r.originatorInfo}),r.paused=!1}(t,e)}(t,o)},[os.CHANNEL_PERSISTENCE]:function(e){return()=>m(this,void 0,void 0,function*(){var t,n,r,i,o,a,s;let{state:l}=e;rj(`[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(os.KEYS_EXCHANGED,{keysExchanged:!0,isOriginator:!0}),e.emit(os.AUTHORIZED),e.emit(os.CLIENTS_READY),e.emit(os.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}
2),yield null==(s=l.storageManager)?void 0:s.persistChannelConfig(l.channelConfig)}catch(e){}})}(o),[os.CLIENTS_CONNECTED]:()=>{var t,n,r,i;let{state:a}=o;rj(`[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&&rz(Object.assign(Object.assign({id:null!=(r=a.channelId)?r:"",event:a.reconnection?ou.RECONNECT:a.isOriginator?ou.REQUEST:ou.REQUEST_MOBILE},a.originatorInfo),{commLayer:e,sdkVersion:a.sdkVersion,walletVersion:null==(i=a.walletInfo)?void 0:i.version,commLayerVersion:rV}),a.communicationServerUrl).catch(e=>{}),a.isOriginator&&!a.reconnection&&d.analytics.track("sdk_connection_established",{transport_type:"websocket"}),a.clientsConnected=!0,a.originatorInfoSent=!1,o.emit(os.CLIENTS_CONNECTED)},[os.KEYS_EXCHANGED]:t=>{var n,r,i,a,s,l,c,d;let{state:u}=o;if(rj(`[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(oa.LINKED)}!function(e,t){var n,r,i,o,a,s,l,c;let{state:d}=e;rj(`[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()});null==(c=d.storageManager)||c.persistChannelConfig(u)}(o,new Date),u.analytics&&u.channelId&&rz(Object.assign(Object.assign({id:u.channelId,event:t.isOriginator?ou.CONNECTED:ou.CONNECTED_MOBILE},u.originatorInfo),{sdkVersion:u.sdkVersion,commLayer:e,commLayerVersion:rV,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:od.READY}),u.ready=!0,u.paused=!1),t.isOriginator&&!u.originatorInfoSent&&(null==(d=u.communicationLayer)||d.sendMessage({type:od.ORIGINATOR_INFO,originatorInfo:u.originatorInfo,originator:u.originatorInfo}),u.originatorInfoSent=!0)},[os.SOCKET_DISCONNECTED]:()=>{let{state:e}=o;rj("[RemoteCommunication: handleSocketDisconnectedEvent()] on 'socket_Disconnected' set ready to false"),e.ready=!1},[os.SOCKET_RECONNECT]:()=>{let{state:e}=o;rj("[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"})},[os.CLIENTS_DISCONNECTED]:e=>{let{state:t}=o;rj(`[RemoteCommunication: handleClientsDisconnectedEvent()] context=${t.context} on 'clients_disconnected' channelId=${e}`),t.relayPersistence||(t.clientsConnected=!1,t.ready=!1,t.authorized=!1),o.emit(os.CLIENTS_DISCONNECTED,t.channelId),o.setConnectionStatus(oa.DISCONNECTED)},[os.KEY_INFO]:()=>{},[os.CHANNEL_CREATED]:e=>{let{state:t}=o;rj(`[RemoteCommunication: handleChannelCreatedEvent()] context=${t.context} on 'channel_created' channelId=${e}`),o.emit(os.CHANNEL_CREATED,e)},[os.CLIENTS_WAITING]:e=>{var t;let{state:n}=o;if(rj(`[RemoteCommunication: handleClientsWaitingEvent()] context=${n.context} on 'clients_waiting' numberUsers=${e} ready=${n.ready} autoStarted=${n.originatorConnectStarted}`),o.setConnectionStatus(oa.WAITING),o.emit(os.CLIENTS_WAITING,e),n.originatorConnectStarted){rj(`[RemoteCommunication: handleClientsWaitingEvent()] on 'clients_w
2aiting' watch autoStarted=${n.originatorConnectStarted} timeout`,n.autoConnectOptions);let e=(null==(t=n.autoConnectOptions)?void 0:t.timeout)||3e3,r=setTimeout(()=>{rj(`[RemoteCommunication: handleClientsWaitingEvent()] setTimeout(${e}) terminate channelConfig`,n.autoConnectOptions),n.originatorConnectStarted=!1,n.ready||o.setConnectionStatus(oa.TIMEOUT),clearTimeout(r)},e)}},[os.RPC_UPDATE]:e=>{o.emit(os.RPC_UPDATE,e)}})))try{b.communicationLayer.on(t,n)}catch(e){}}function ie(e){return m(this,arguments,void 0,function*({options:e,instance:t}){let{state:n}=t;return rj(`[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&&rz({id:null!=(o=t.state.channelId)?o:"",event:ou.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:od.TERMINATE}).then(()=>{r(!0)}).catch(e=>{i(e)}):r(!0),n.authorized=!1,n.relayPersistence=!1,n.channelId=(0,f.A)(),e.channelId=n.channelId,n.channelConfig=void 0,n.originatorConnectStarted=!1,null==(c=n.communicationLayer)||c.disconnect(e),t.setConnectionStatus(oa.TERMINATED)):(null==(d=n.communicationLayer)||d.disconnect(e),t.setConnectionStatus(oa.DISCONNECTED),r(!0))})})}(op||(op={})).SOCKET="socket",(oi=og||(og={})).NonBrowser="nodejs",oi.MetaMaskMobileWebview="in-app-browser",oi.DesktopWeb="web-desktop",oi.MobileWeb="web-mobile",oi.ReactNative="react-native";class it extends u.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:oa.DISCONNECTED},this._options=e;const{anonId:t,platformType:n,communicationLayerPreference:r,otherPublicKey:i,reconnect:o,walletInfo:a,dappMetadata:s,protocolVersion:l,transports:d,context:u,relayPersistence:h,ecies:f,analytics:p=!1,storage:g,sdkVersion: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!=l?l: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(oa.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)&&c().enable("RemoteCommunication:Layer"),!0===(null==v?void 0:v.serviceLayer)&&c().enable("SocketService:Layer"),!0===(null==v?void 0:v.eciesLayer)&&c().enable("ECIES:Layer"),!0===(null==v?void 0:v.keyExchangeLayer)&&c().enable("KeyExchange:Layer"),this.state.logging=v,(null==g?void 0:g.storageManager)&&(this.state.storageManager=g.storageManager),rj(`[RemoteCommunication: constructor()] protocolVersion=${l} 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 m(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(oa.LINKED),yield this.connectToChannel
2({channelId:t.channelId})))}r7({communicationLayerPreference:op.SOCKET,otherPublicKey:this.state.otherPublicKey,reconnect:this._options.reconnect,ecies:this._options.ecies,communicationServerUrl:this.state.communicationServerUrl,instance:this})})}originatorSessionConnect(){return m(this,void 0,void 0,function*(){return yield function(e){return m(this,void 0,void 0,function*(){var t;let{state:n}=e;if(!n.storageManager)return void rj("[RemoteCommunication: originatorSessionConnect()] no storage manager defined - skip");let r=yield n.storageManager.getPersistedChannelConfig({});if(rj(`[RemoteCommunication: originatorSessionConnect()] autoStarted=${n.originatorConnectStarted} channelConfig`,r),null==(t=n.communicationLayer)?void 0:t.isConnected())return rj("[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;rj("[RemoteCommunication: autoConnect()] Session has expired")}n.originatorConnectStarted=!1})}(this)})}generateChannelIdConnect(){return m(this,void 0,void 0,function*(){return function(e){return m(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};rj("[RemoteCommunication: generateChannelId()]");let s=yield e.communicationLayer.createChannel();rj("[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)}connectToChannel({channelId:e,withKeyExchange:t,authorized:n}){return function(e){return m(this,arguments,void 0,function*({channelId:e,withKeyExchange:t,authorized:n,state:r}){var i,o,a;if(!(0,p.A)(e))throw rj(`[RemoteCommunication: connectToChannel()] context=${r.context} invalid channel channelId=${e}`),Error(`Invalid channel ${e}`);if(rj(`[RemoteCommunication: connectToChannel()] context=${r.context} channelId=${e} withKeyExchange=${t}`),null==(i=r.communicationLayer)?void 0:i.isConnected())return void rj(`[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});
2r.channelConfig=s,null==(a=r.storageManager)||a.persistChannelConfig(s)})}({channelId:e,authorized:n,withKeyExchange:t,state:this.state})}sendMessage(e){return m(this,void 0,void 0,function*(){let t=this.state.isOriginator&&e.method&&rZ(e.method);t&&d.analytics.track("sdk_action_requested",{action:e.method});try{return yield function(e,t){return m(this,void 0,void 0,function*(){var n,r;let{state:i}=e;rj(`[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||(rj(`[RemoteCommunication: sendMessage()] context=${i.context}  SKIP message waiting for MM mobile readiness.`),yield new Promise(t=>{e.once(os.CLIENTS_READY,t)}),rj(`[RemoteCommunication: sendMessage()] context=${i.context}  AFTER SKIP / READY -- sending pending message`));try{return yield function(e,t){return m(this,void 0,void 0,function*(){return new Promise(n=>{var r;let{state:i}=e;rj(`[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(os.AUTHORIZED,()=>{var e;rj(`[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&&d.analytics.track("sdk_action_failed",{action:e.method}),n}})}testStorage(){return m(this,void 0,void 0,function*(){return function(e){return m(this,void 0,void 0,function*(){var t;rj("[RemoteCommunication: testStorage()] res",(yield null==(t=e.storageManager)?void 0:t.getPersistedChannelConfig()))})}(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 m(this,void 0,void 0,function*(){var e;rj(`[RemoteCommunication: ping()] channel=${this.state.channelId}`),yield null==(e=this.state.communicationLayer)?void 0:e.ping()})}testLogger(){rj(`testLogger() channel=${this.state.channelId}`),rB(`testLogger() channel=${this.state.channelId}`),rK(`testLogger() channel=${this.state.channelId}`),rD(`testLogger() channel=${this.state.channelId}`)}keyCheck(){var e;rj(`[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(os.CONNECTION_STATUS,e),this.emitServiceStatusEvent({context:"setConnectionStatus"}))}emitServiceStatusEvent(e={}){this.emit(os.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 m(this,void 0,void 0,function*(){var e;rj(`[RemoteCommunication: pause()] channel=${this.state.channelId}`),yield null==(e=this.state.communicationLayer)?void 0:e.pause(),this.setConnectionStatus(oa.PAUSED)})}getVersion(){return rV}hasRelayPersistence(){var e;return null!=(e=this.state.relayPersistence)&&e}resume(){return m(this,void 0,void 0,function*(){return function(e){return m(this,void 0,void 0,function*(){var t;let{state:n}=e;rj(`[RemoteCommunication: resume()] channel=${n.channelId}`),yield null==(t=n.communicationLayer)?void 0:t.resume(),e.setConnectionStatus(oa.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();
2if(!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 m(this,arguments,void 0,function*({channelId:e,state:t}){var n,r,i;if(!(0,p.A)(e))throw rj(`[RemoteCommunication: connectToChannel()] context=${t.context} invalid channel channelId=${e}`),Error(`Invalid channel ${e}`);if(t.isOriginator)return void rj(`[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)||(rj(`[RemoteCommunication: reject()] context=${t.context} socket already connected`),null==o||o.connect()),rz(Object.assign(Object.assign({id:e,event:ou.REJECTED},t.originatorInfo),{sdkVersion:t.sdkVersion,commLayerVersion:rV,walletVersion:null==(i=t.walletInfo)?void 0:i.version}),t.communicationServerUrl).catch(e=>{}),yield new Promise((n,r)=>{null==o||o.emit(os.REJECTED,{channelId:e},(e,i)=>{rj(`[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 m(this,void 0,void 0,function*(){return ie({options:e,instance:this})})}}(oo=om||(om={})).RENEW="renew",oo.LINK="link";var ir=()=>"MetaMask: Disconnected from chain. Attempting to connect.",ii=()=>"MetaMask: Disconnected from MetaMask background. Page reload required.",io=()=>"MetaMask: Failed to send site metadata. This is an internal error, please report this bug.",ia=e=>`MetaMask: The MetaMask Ethereum provider does not support synchronous methods like ${e} without a callback parameter.`,is=()=>"Must provide a Node.js-style duplex stream.",il=()=>"MetaMask: Received invalid network parameters. Please report this bug.",ic=()=>"Expected a single, non-array, object argument.",id=()=>"'args.method' must be a non-empty string.",iu=()=>"'args.params' must be an object or array if provided.",ih=e=>`MetaMask: Connected to chain with ID "${e}".`,ip="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",ig="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",im="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",iy="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",iv="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",ib={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"},iw={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"},iE="MetaMask: 'ethereum._metamask' exposes non-standard, experimental methods. They may be removed or changed without warning.",i_=Math.floor(0xffffffff*Math.random()),iS=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},ix=(e,t,n)=>(iS(e,t,"read from private field"),n?n.call(e):t.get(e)),iC=(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)},ik=(e,t,n,r)=>(iS(e,t,"write to private field"),t.set(e,n),n),iM=(e,t,n)=>(iS(e,t,"access private method"),n),iA={"-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 iI(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}var iP=(e,t)=>
2Object.hasOwnProperty.call(e,t);class iO extends TypeError{constructor(e,t){let n;const{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 iR(e){return"object"==typeof e&&null!=e}function iT(e){return"symbol"==typeof e?e.toString():"string"==typeof e?JSON.stringify(e):`${e}`}function*iL(e,t,n,r){var i;for(let o of(iR(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: \`${iT(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*iN(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&&iR(t.schema)&&iR(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_valid",yield[r,void 0];for(let[c,d,u]of t.entries(e,s))for(let t of iN(d,u,{path:void 0===c?r:[...r,c],branch:void 0===c?i:[...i,d],c
2oerce: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):iR(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 i${constructor(e){const{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)=>iL(r(e,t),t,this,e):()=>[],this.refiner=i?(e,t)=>iL(i(e,t),t,this,e):()=>[]}assert(e,t){return iD(e,this,t)}create(e,t){return iB(e,this,t)}is(e){return iK(e,this)}mask(e,t){let n=ij(e,this,{coerce:!0,mask:!0,message:t});if(n[0])throw n[0];return n[1]}validate(e,t={}){return ij(e,this,t)}}function iD(e,t,n){let r=ij(e,t,{message:n});if(r[0])throw r[0]}function iB(e,t,n){let r=ij(e,t,{coerce:!0,message:n});if(r[0])throw r[0];return r[1]}function iK(e,t){return!ij(e,t)[0]}function ij(e,t,n={}){let r=iN(e,t,n),i=function(e){let{done:t,value:n}=e.next();return t?void 0:n}(r);return i[0]?[new iO(i[0],function*(){for(let e of r)e[0]&&(yield e[0])}),void 0]:[void 0,i[1]]}function iU(e,t){return new i$({type:e,schema:null,validator:t})}function iH(e){let t;return new i$({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 iF(e){return new i$({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: ${iT(e)}`})}function iz(e){let t=iT(e),n=typeof e;return new i$({type:"literal",schema:"string"===n||"number"===n||"boolean"===n?e:null,validator:n=>n===e||`Expected the literal \`${t}\`, but received: ${iT(n)}`})}function iq(){return iU("number",e=>"number"==typeof e&&!isNaN(e)||`Expected a number, but received: ${iT(e)}`)}function iV(e){let t=e?Object.keys(e):[],n=iU("never",()=>!1);return new i$({type:"object",schema:e||null,*entries(r){if(e&&iR(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=>iR(e)||`Expected an object, but received: ${iT(e)}`,coercer:e=>iR(e)?{...e}:e})}function iW(e){return new i$({...e,validator:(t,n)=>void 0===t||e.validator(t,n),refiner:(t,n)=>void 0===t||e.refiner(t,n)})}function iG(e,t){return new i$({type:"record",schema:null,*entries(n){if(iR(n))for(let r in n){let i=n[r];yield[r,r,e],yield[r,i,t]}},validator:e=>iR(e)||`Expected an object, but received: ${iT(e)}`})}function iY(){return iU("string",e=>"string"==typeof e||`Expected a string, but received: ${iT(e)}`)}function iZ(e){let t=e.map(e=>e.type).join(" | ");return new i$({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]=iN(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: ${iT(n)}`,...i]}})}var iJ=class extends Error{constructor(e){super(e.message),this.code="ERR_ASSERTION"}};function iX(){throw Error("setTimeout has not been defined")}function iQ(){throw Error("clearTimeout has not been defined")}var i0=iX,i1=iQ;function i2(e){if(i0===setTimeout)return setTimeout(e,0);if((i0===iX||!i0)&&setTimeout)return i0=setTimeout,setTimeout(e,0);try{return i0(e,0)}catch(t){try{return i0.call(null,e,0)}catch(t){return i0.call(this,e,0)}}}"function"==typeof y.setTimeout&&(i0=setTimeout),"function"==typeof y.clearTimeout&&(i1=clearTimeout);var i3,i5,i8,i6,i4,i9,i7,oe,ot,on,or,oi,oo,oa,os,ol,oc,od,ou,oh,of,op,og,om,oy,ov=[],ob=!1,ow=-1;function oE(){ob&&oy&&(ob=!1,oy.length?ov=oy.concat(ov):ow=-1,ov.length&&o_())}function o_(){if(!ob){var e=i2(oE);ob=!0;for(var t=ov.length;t;){for(oy=ov,ov=[];++ow<t;)oy&&oy[ow].run();ow=-1,t=ov.length}oy=null,ob=!1,function(e){if(i1===clearTimeout)return clearTimeout(e);if((i1===iQ||!i1)&&clearTimeout)return i1=clearTimeout,clearTimeout(e);try{i1(e)}catch(t){try{return i1.call(null,e)}catch(t){return i1.call(this,e)}}}(e)}}function oS(e,t){this.fun=e,this.array=t}function ox(){}oS.prototype.run=function(){this.fun.apply(null,this.array)};var oC=y.performance||{},ok=oC.now||oC.mozNow||oC.msNow||oC.oNow||oC.webkitNow||function(){return(new Date).getTime()},oM=new Date,oA={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];ov.push(new oS(e,t)),1!==ov.length||ob||i2(o_)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:ox,addListener:ox,once:ox,off:ox,removeListener:ox,removeAllListeners:ox,emit:ox,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*ok.call(oC),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-oM)/1e3}};function oI({path:e,branch:t}){let n=e[e.length-1];return iP(t[t.length-2],n)}function oP(e){return new i$({...e,type:`optional ${e.type}`,validator:(t,n)=>!oI(n)||e.validator(t,n),refiner:(t,n)=>!oI(n)||e.refiner(t,n)})}var oO,oR,oT=iZ([iz(null),iU("boolean",e=>"boolean"==typeof e),iU("finite number",e=>
2iK(e,iq())&&Number.isFinite(e)),iY(),iF(iH(()=>oT)),iG(iY(),iH(()=>oT))]),oL=(oO=iU("any",()=>!0),oR=e=>((function(e,t,n="Assertion failed",r=iJ){try{iD(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,oT),JSON.parse(JSON.stringify(e,(e,t)=>{if("__proto__"!==e&&"constructor"!==e)return t}))),new i$({...oT,coercer:(e,t)=>iK(e,oO)?oT.coercer(oR(e),t):oT.coercer(e,t)}));function oN(e){try{return iB(e,oL),!0}catch{return!1}}var o$=iz("2.0"),oD=new i$({...al=iZ([iq(),iY()]),validator:(e,t)=>null===e||al.validator(e,t),refiner:(e,t)=>null===e||al.refiner(e,t)}),oB=iV({code:iU("integer",e=>"number"==typeof e&&!isNaN(e)&&Number.isInteger(e)||`Expected an integer, but received: ${iT(e)}`),message:iY(),data:oP(oL),stack:oP(iY())}),oK=iZ([iG(iY(),oL),iF(oL)]),oj=iV({id:oD,jsonrpc:o$,method:iY(),params:oP(oK)}),oU=iV({jsonrpc:o$,method:iY(),params:oP(oK)});iV({id:oD,jsonrpc:o$,result:iW(iU("unknown",()=>!0)),error:iW(oB)}),iZ([iV({id:oD,jsonrpc:o$,result:oL}),iV({id:oD,jsonrpc:o$,error:oB})]);var oH={code:-32603,message:oF(-32603)};function oF(e,t="Unspecified error message. This is a bug, please report it."){if(Number.isInteger(e)){let t=e.toString();if(iP(iA,t))return iA[t].message;if(e>=-32099&&e<=-32e3)return"Unspecified server error."}return t}function oz(e,{fallbackError:t=oH,shouldIncludeStack:n=!0}={}){if(!iK(t,oB))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(iK(e,oB))return e;let n=oq(e);return{...t,data:{cause:n}}}(e,t);return n||delete r.stack,r}function oq(e){return Array.isArray(e)?e.map(e=>oN(e)?e:iI(e)?oV(e):null):iI(e)?oV(e):oN(e)?e:null}function oV(e){return Object.getOwnPropertyNames(e).reduce((t,n)=>{let r=e[n];return oN(r)&&(t[n]=r),t},{})}oX.default=oX,oX.stable=o1,oX.stableStringify=o1;var oW="[...]",oG="[Circular]",oY=[],oZ=[];function oJ(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function oX(e,t,n,r){var i;void 0===r&&(r=oJ()),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 oQ(oG,t,n,o);if(void 0!==s.depthLimit&&a>s.depthLimit||void 0!==s.edgesLimit&&r+1>s.edgesLimit)return void oQ(oW,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===oZ.length?JSON.stringify(e,t,n):JSON.stringify(e,o2(t),n)}catch(e){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==oY.length;){var o=oY.pop();4===o.length?Object.defineProperty(o[0],o[1],o[3]):o[0][o[1]]=o[2]}}return i}function oQ(e,t,n,r){var i=Object.getOwnPropertyDescriptor(r,n);void 0!==i.get?i.configurable?(Object.defineProperty(r,n,{value:e}),oY.push([r,n,t,i])):oZ.push([t,n,e]):(r[n]=e,oY.push([r,n,t]))}function o0(e,t){return e<t?-1:+(e>t)}function o1(e,t,n,r){void 0===r&&(r=oJ());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 oQ(oG,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 oQ(oW,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(o0);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;oY.push([o,n,t]),o[n]=c}i.pop()}}(e,"",0,[],void 0,0,r)||e;try{i=0===oZ.length?JSON.stringify(o,t,n):JSON.stringify(o,o2(t),n)}catch(e){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==oY.length;){var a=oY.pop();4===a.length?Object.defineProperty(a[0],a[1],a[3]):a[0][a[1]]=a[2]}}return i}function o2(e){return e=void 0!==e?e:function(e,t){return t},function(t,n){if(oZ.length>0)for(var r=0;r<oZ.length;r++){var i=oZ[r];if(i[1]===t&&i[0]===n){n=i[2],oZ.splice(r,1);break}}return e.call(this,t,n)}}
2var o3=es(oX),o5=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=oq(this.data.cause))),this.stack&&(e.stack=this.stack),e}toString(){return o3(this.serialize(),o8,2)}};function o8(e,t){if("[Circular]"!==t)return t}function o6(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 o5(e,n??oF(e),r)}var o4={};function o9(){}function o7(){o7.init.call(this)}function ae(e){return void 0===e._maxListeners?o7.defaultMaxListeners:e._maxListeners}function at(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 o9,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=ae(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 an(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 ar(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 ai(e,t){for(var n=Array(t);t--;)n[t]=e[t];return n}o9.prototype=Object.create(null),o7.EventEmitter=o7,o7.usingDomains=!1,o7.prototype.domain=void 0,o7.prototype._events=void 0,o7.prototype._maxListeners=void 0,o7.defaultMaxListeners=10,o7.init=function(){this.domain=null,o7.usingDomains&&(void 0).active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new o9,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o7.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},o7.prototype.getMaxListeners=function(){return ae(this)},o7.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=ai(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=ai(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=ai(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=ai(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=ai(e,i),a=0;a<i;++a)o[a].apply(n,r)}(n,d,this,i)}return!0},o7.prototype.addListener=function(e,t){return at(this,e,t,!1)},o7.prototype.on=o7.prototype.addListener,o7.prototype.prependListener=function(e,t){return at(this,e,t,!0)},o7.prototype.once=function(e,t){if("function"!=typeof t)throw TypeError('"listener" argument must be a function');return this.on(e,an(this,e,t)),this},o7.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw TypeError('"listener" argument must be a function');return this.prependListener(e,an(this,e,t)),this},o7.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 o9:(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 o9,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},o7.prototype.off=function(e,t){return this.removeListener(e,t)},o7.prototype.removeAllListeners=function(e){var t,n;if(!(n=this._events))return this;if(!n.removeListener)return 0==arguments.length?(this._events=new o9,this._eventsCount=0):n[e]&&(0==--this._eventsCount?this._events=new o9: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 o9,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},o7.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):[]},o7.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):ar.call(e,t)},o7.prototype.listenerCount=ar,o7.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};var ao=el(Object.freeze({__proto__:null,EventEmitter:o7,default:o7}));Object.defineProperty(o4,"__esModule",{value:!0});let aa=ao;function as(e,t,n){try{Reflect.apply(e,t,n)}catch(e){setTimeout(()=>{throw e})}}var al,ac,ad,au,ah,af,ap,ag,am,ay,av,ab,aw,aE,a_,aS,ax,aC,ak,aM,aA=o4.default=class extends aa.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)as(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)as(n[r],this,t)}return!0}},aI=class e extends aA{constructor({notificationHandler:e}={}){super(),iC(this,ah),iC(this,ap),iC(this,am),iC(this,ac,!1),iC(this,ad,void 0),iC(this,au,void 0),ik(this,ad,[]),ik(this,au,e)}destroy(){ix(this,ad).forEach(e=>{"destroy"in e&&"function"==typeof e.destroy&&e.destroy()}),ik(this,ad,[]),ik(this,ac,!0)}push(e){iM(this,ah,af).call(this),ix(this,ad).push(e)}handle(e,t){if(iM(this,ah,af).call(this),t&&"function"!=typeof t)throw Error('"callback" must be a function if provided.');return Array.isArray(e)?t?iM(this,ap,ag).call(this,e,t):iM(this,ap,ag).call(this,e):t?iM(this,am,ay).call(this,e,t):this._promiseHandle(e)}asMiddleware(){return iM(this,ah,af).call(this),async(t,n,r,i)=>{try{let[o,a,s]=await iM(e,aw,aE).call(e,t,n,ix(this,ad));return a?(await iM(e,ax,aC).call(e,s),i(o)):r(async t=>{try{await iM(e,ax,aC).call(e,s)}catch(e){return t(e)}return t()})}catch(e){return i(e)}}}async _promiseHandle(e){return new Promise((t,n)=>{iM(this,am,ay).call(this,e,(e,r)=>{e&&void 0===r?n(e):t(r)}).catch(n)})}};function aP(e){return JSON.stringify(e,null,2)}ac=new WeakMap,ad=new WeakMap,au=new WeakMap,ah=new WeakSet,af=function(){if(ix(this,ac))throw Error("This engine is destroyed and can no longer be used.")},ap=new WeakSet,ag=async function(e,t){try{if(0===e.length){let e=[{id:null,jsonrpc:"2.0",error:new o5(-32600,"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}},am=new WeakSet,ay=async function(e,t){if(!e||Array.isArray(e)||"object"!=typeof e){let n=new o5(-32600,"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 o5(-32600,"Must specify a string method. Received: "+typeof e.method,{request:e});
2return ix(this,au)&&!iK(e,oj)?t(null):t(n,{id:e.id??null,jsonrpc:"2.0",error:n})}if(ix(this,au)&&iK(e,oU)&&!iK(e,oj)){try{await ix(this,au).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 iM(aI,av,ab).call(aI,r,i,ix(this,ad))}catch(e){n=e}return n&&(delete i.result,i.error||(i.error=oz(n))),t(n,i)},av=new WeakSet,ab=async function(e,t,n){let[r,i,o]=await iM(aI,aw,aE).call(aI,e,t,n);if(iM(aI,ak,aM).call(aI,e,t,i),await iM(aI,ax,aC).call(aI,o),r)throw r},aw=new WeakSet,aE=async function(e,t,n){let r=[],i=null,o=!1;for(let a of n)if([i,o]=await iM(aI,a_,aS).call(aI,e,t,a,r),o)break;return[i,o,r.reverse()]},a_=new WeakSet,aS=async function(e,t,n,r){return new Promise(i=>{let o=e=>{let n=e||t.error;n&&(t.error=oz(n)),i([n,!0])};try{n(e,t,n=>{t.error?o(t.error):(n&&("function"!=typeof n&&o(new o5(-32603,`JsonRpcEngine: "next" return handlers must be functions. Received "${typeof n}" for request:
3${aP(e)}`,{request:e})),r.push(n)),i([null,!1]))},o)}catch(e){o(e)}})},ax=new WeakSet,aC=async function(e){for(let t of e)await new Promise((e,n)=>{t(t=>t?n(t):e())})},ak=new WeakSet,aM=function(e,t,n){if(!iP(t,"result")&&!iP(t,"error"))throw new o5(-32603,`JsonRpcEngine: Response has no error or result for request:
4${aP(e)}`,{request:e});if(!n)throw new o5(-32603,`JsonRpcEngine: Nothing ended request:
5${aP(e)}`,{request:e})},iC(aI,av),iC(aI,aw),iC(aI,a_),iC(aI,ax),iC(aI,ak);var aO=Object.freeze(["eth_subscription"]),aR=(e,t,n=!0)=>(r,i)=>{r||i.error?t(r||i.error):!n||Array.isArray(i)?e(i):e(i.result)},aT=e=>!!e&&"string"==typeof e&&e.startsWith("0x"),aL=()=>{};async function aN(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 a$(window)}}();e.handle({jsonrpc:"2.0",id:1,method:"metamask_sendDomainMetadata",params:t},aL)}catch(e){t.error({message:io(),originalError:e})}}async function a$(e){let{document:t}=e;for(let e of Array.from(t.querySelectorAll('head > link[rel~="icon"]')))if(e&&await aD(e.href))return e.href;return null}async function aD(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 aB=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},aK=(e,t,n)=>(aB(e,t,"read from private field"),n?n.call(e):t.get(e)),aj=(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)},aU=(e,t,n,r)=>(aB(e,t,"write to private field"),t.set(e,n),n);function aH(e,t,n){try{Reflect.apply(e,t,n)}catch(e){setTimeout(()=>{throw e})}}class aF extends o7{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)aH(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)aH(n[r],this,t)}return!0}}var az,aq,aV=es(function e(t,n){if(t===n)return!0;if(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}),aW=class e extends aF{constructor({logger:t=console,maxEventListeners:n=100,rpcMiddleware:r=[]}={}){super(),aj(this,az,void 0),aj(this,aq,void 0),this._log=t,this.setMaxListeners(n),this._state={...e._defaultState},aU(this,aq,null),aU(this,az,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);const i=new aI;
5r.forEach(e=>i.push(e)),this._rpcEngine=i}get chainId(){return aK(this,az)}get selectedAddress(){return aK(this,aq)}isConnected(){return this._state.isConnected}async request(e){if(!e||"object"!=typeof e||Array.isArray(e))throw o6(-32600,{message:ic(),data:e});let{method:t,params:n}=e;if("string"!=typeof t||0===t.length)throw o6(-32600,{message:id(),data:e});if(void 0!==n&&!Array.isArray(n)&&("object"!=typeof n||null===n))throw o6(-32600,{message:iu(),data:e});let r=null==n?{method:t}:{method:t,params:n};return new Promise((e,t)=>{this._rpcRequest(r,aR(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(ih(e)))}_handleDisconnect(e,t){if(this._state.isConnected||!this._state.isPermanentlyDisconnected&&!e){let n;this._state.isConnected=!1,e?(n=new o5(1013,t??ir()),this._log.debug(n)):(n=new o5(1011,t??ii()),this._log.error(n),aU(this,az,null),this._state.accounts=null,aU(this,aq,null),this._state.isUnlocked=!1,this._state.isPermanentlyDisconnected=!0),this.emit("disconnect",n)}}_handleChainChanged({chainId:e}={}){aT(e)?(this._handleConnect(e),e!==aK(this,az)&&(aU(this,az,e),this._state.initialized&&this.emit("chainChanged",aK(this,az)))):this._log.error(il(),{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(!aV(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,aK(this,aq)!==n[0]&&aU(this,aq,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 invalid isUnlocked parameter. Please report this bug.")}};az=new WeakMap,aq=new WeakMap,aW._defaultState={accounts:null,isConnected:!1,isUnlocked:!1,initialized:!1,isPermanentlyDisconnected:!1};var aG,aY=aW,aZ={exports:{}},aJ=ao.EventEmitter,aX=el(eo);aG="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 aQ=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},a0=/%[sdj%]/g;function a1(e){if(!ss(e)){for(var t=[],n=0;n<arguments.length;n++)t.push(a6(arguments[n]));return t.join(" ")}n=1;for(var r=arguments,i=r.length,o=String(e).replace(a0,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])si(a)||!su(a)?o+=" "+a:o+=" "+a6(a);return o}function a2(e,t){if(sc(y.process))return function(){return a2(e,t).apply(this,arguments)};if(!0===oA.noDeprecation)return e;var n=!1;return function(){if(!n){if(oA.throwDeprecation)throw Error(t);oA.traceDeprecation?console.trace(t):console.error(t),n=!0}return e.apply(this,arguments)}}var a3,a5={};function a8(e){return sc(a3)&&(a3=oA.env.NODE_DEBUG||""),a5[e=e.toUpperCase()]||(RegExp("\\b"+e+"\\b","i").test(a3)?a5[e]=function(){var t=a1.apply(null,arguments);console.error("%s %d: %s",e,0,t)}:a5[e]=function(){}),a5[e]}function a6(e,t){var n={seen:[],stylize:a9};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),sr(t)?n.showHidden=t:t&&sE(n,t),sc(n.showHidden)&&(n.showHidden=!1),sc(n.depth)&&(n.depth=2),sc(n.colors)&&(n.colors=!1),sc(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=a4),a7(n,e,n.depth)}function a4(e,t){var n=a6.styles[t];return n?"\x1b["+a6.colors[n][0]+"m"+e+"\x1b["+a6.colors[n][1]+"m":e}function a9(e,t){return e}function a7(e,t,n){if(e.customInspect&&t&&sp(t.inspect)&&t.inspect!==a6&&(!t.constructor||t.constructor.prototype!==t)){var r,i,o=t.inspect(n,e);return ss(o)||(o=a7(e,o,n)),o}var a=function(e,t){if(sc(t))return e.stylize("undefined","undefined");if(ss(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return sa(t)?e.stylize(""+t,"number"):sr(t)?e.stylize(""+t,"boolean"):si(t)?e.stylize("null","null"):void 0}(e,t);if(a)return a;var s=Object.keys(t),l=(d={}
5,s.forEach(function(e,t){d[e]=!0}),d);if(e.showHidden&&(s=Object.getOwnPropertyNames(t)),sf(t)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return se(t);if(0===s.length){if(sp(t)){var c=t.name?": "+t.name:"";return e.stylize("[Function"+c+"]","special")}if(sd(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(sh(t))return e.stylize(Date.prototype.toString.call(t),"date");if(sf(t))return se(t)}var d,u,h="",f=!1,p=["{","}"];return sn(t)&&(f=!0,p=["[","]"]),sp(t)&&(h=" [Function"+(t.name?": "+t.name:"")+"]"),sd(t)&&(h=" "+RegExp.prototype.toString.call(t)),sh(t)&&(h=" "+Date.prototype.toUTCString.call(t)),sf(t)&&(h=" "+se(t)),0!==s.length||f&&0!=t.length?n<0?sd(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)s_(t,String(a))?o.push(st(e,t,n,r,String(a),!0)):o.push("");return i.forEach(function(i){i.match(/^\d+$/)||o.push(st(e,t,n,r,i,!0))}),o}(e,t,n,l,s):s.map(function(r){return st(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 se(e){return"["+Error.prototype.toString.call(e)+"]"}function st(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("[Setter]","special")),s_(r,i)||(a="["+i+"]"),s||(0>e.seen.indexOf(l.value)?(s=si(n)?a7(e,l.value,null):a7(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")),sc(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 sn(e){return Array.isArray(e)}function sr(e){return"boolean"==typeof e}function si(e){return null===e}function so(e){return null==e}function sa(e){return"number"==typeof e}function ss(e){return"string"==typeof e}function sl(e){return"symbol"==typeof e}function sc(e){return void 0===e}function sd(e){return su(e)&&"[object RegExp]"===sy(e)}function su(e){return"object"==typeof e&&null!==e}function sh(e){return su(e)&&"[object Date]"===sy(e)}function sf(e){return su(e)&&("[object Error]"===sy(e)||e instanceof Error)}function sp(e){return"function"==typeof e}function sg(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e}function sm(e){return O.isBuffer(e)}function sy(e){return Object.prototype.toString.call(e)}function sv(e){return e<10?"0"+e.toString(10):e.toString(10)}a6.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]},a6.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};var sb=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function sw(){var e,t;console.log("%s - %s",(t=[sv((e=new Date).getHours()),sv(e.getMinutes()),sv(e.getSeconds())].join(":"),[e.getDate(),sb[e.getMonth()],t].join(" ")),a1.apply(null,arguments))}function sE(e,t){if(!t||!su(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}function s_(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var sS="u">typeof Symbol?Symbol("util.promisify.custom"):void 0;function sx(e){if("function"!=typeof e)throw TypeError('The "original" argument must be of type Function');if(sS&&e[sS]){var t;if("function"!=typeof(t=e[sS]))throw TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,sS,{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)),sS&&Object.defineProperty(t,sS,{value:t,enumerable:!1,writable:!1,
5configurable:!0}),Object.defineProperties(t,aQ(e))}function sC(e,t){if(!e){var n=Error("Promise was rejected with a falsy value");n.reason=e,e=n}return t(e)}function sk(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){oA.nextTick(o.bind(null,null,e))},function(e){oA.nextTick(sC.bind(null,e,o))})}return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),Object.defineProperties(t,aQ(e)),t}sx.custom=sS;var sM,sA,sI=el(Object.freeze({__proto__:null,_extend:sE,callbackify:sk,debuglog:a8,default:{inherits:aG,_extend:sE,log:sw,isBuffer:sm,isPrimitive:sg,isFunction:sp,isError:sf,isDate:sh,isObject:su,isRegExp:sd,isUndefined:sc,isSymbol:sl,isString:ss,isNumber:sa,isNullOrUndefined:so,isNull:si,isBoolean:sr,isArray:sn,inspect:a6,deprecate:a2,format:a1,debuglog:a8,promisify:sx,callbackify:sk},deprecate:a2,format:a1,inherits:aG,inspect:a6,isArray:sn,isBoolean:sr,isBuffer:sm,isDate:sh,isError:sf,isFunction:sp,isNull:si,isNullOrUndefined:so,isNumber:sa,isObject:su,isPrimitive:sg,isRegExp:sd,isString:ss,isSymbol:sl,isUndefined:sc,log:sw,promisify:sx}));function sP(e,t){sR(e,t),sO(e)}function sO(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function sR(e,t){e.emit("error",t)}var sT={destroy:function(e,t){var n=this,r=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return r||i?t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,oA.nextTick(sR,this,e)):oA.nextTick(sR,this,e)):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?n._writableState?n._writableState.errorEmitted?oA.nextTick(sO,n):(n._writableState.errorEmitted=!0,oA.nextTick(sP,n,e)):oA.nextTick(sP,n,e):t?(oA.nextTick(sO,n),t(e)):oA.nextTick(sO,n)})),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)}},sL={},sN={};function s$(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,sN[e]=r}function sD(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))}s$("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError),s$("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(sD(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(sD(t,"type"))}return o+". Received type ".concat(typeof n)},TypeError),s$("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),s$("ERR_METHOD_NOT_IMPLEMENT
5ED",function(e){return"The "+e+" method is not implemented"}),s$("ERR_STREAM_PREMATURE_CLOSE","Premature close"),s$("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),s$("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),s$("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),s$("ERR_STREAM_WRITE_AFTER_END","write after end"),s$("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),s$("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),s$("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),sL.codes=sN;var sB,sK,sj,sU,sH=sL.codes.ERR_INVALID_OPT_VALUE,sF=function(e,t,n,r){var i=null!=t.highWaterMark?t.highWaterMark:r?t[n]:null;if(null!=i){if(!isFinite(i)||Math.floor(i)!==i||i<0)throw new sH(r?n:"highWaterMark",i);return Math.floor(i)}return e.objectMode?16:16384},sz=el(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}})),sq=function(e,t){if(sV("noDeprecation"))return e;var n=!1;return function(){if(!n){if(sV("throwDeprecation"))throw Error(t);sV("traceDeprecation")?console.trace(t):console.warn(t),n=!0}return e.apply(this,arguments)}};function sV(e){try{if(!ea.localStorage)return!1}catch(e){return!1}var t=ea.localStorage[e];return null!=t&&"true"===String(t).toLowerCase()}function sW(){if(sK)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}}sK=1,sB=y,y.WritableState=m;var t,n,r=aX.Buffer,i=(void 0!==ea?ea:"u">typeof window?window:"u">typeof self?self:{}).Uint8Array||function(){},o=sL.codes,a=o.ERR_INVALID_ARG_TYPE,s=o.ERR_METHOD_NOT_IMPLEMENTED,l=o.ERR_MULTIPLE_CALLBACK,c=o.ERR_STREAM_CANNOT_PIPE,d=o.ERR_STREAM_DESTROYED,u=o.ERR_STREAM_NULL_VALUES,h=o.ERR_STREAM_WRITE_AFTER_END,f=o.ERR_UNKNOWN_ENCODING,p=sT.errorOrDestroy;function g(){}function m(n,r,i){t=t||sG(),n=n||{},"boolean"!=typeof i&&(i=r instanceof t),this.objectMode=!!n.objectMode,i&&(this.objectMode=this.objectMode||!!n.writableObjectMode),this.highWaterMark=sF(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 l;if(n.writing=!1,n.writecb=null,n.length-=n.writelen,n.writelen=0,t)--n.pendingcb,r?(oA.nextTick(i,t),oA.nextTick(S,e,n),e._writableState.errorEmitted=!0,p(e,t)):(i(t),e._writableState.errorEmitted=!0,p(e,t),S(e,n));else{var o=E(n)||e.destroyed;o||n.corked||n.bufferProcessing||!n.bufferedRequest||w(e,n),r?oA.nextTick(b,e,n,o,i):b(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 y(e){var r=this instanceof(t=t||sG());if(!r&&!n.call(y,this))return new y(e);this._writableState=new m(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)),aJ.call(this)}function v(e,t,n,r,i,o,a){t.writelen=r,t.writecb=a,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new d("write")):n?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function b(e,t,n,r){n||0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain")),t.pendingcb--,r(),S(e,t)}function w(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,v(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(v(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 E(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function _(e,t){e._final(function(n){t.pendingcb--,n&&p(e,n),t.prefinished=!0,e.emit("prefinish"),S(e,t)})}function S(e,t){var n=E(t);if(n&&(t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,oA.nextTick(_,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 sz(y,aJ),m.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(m.prototype,"buffer",{get:sq(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(n=Function.prototype[Symbol.hasInstance],Object.defineProperty(y,Symbol.hasInstance,{value:function(e){return!!n.call(this,e)||this===y&&e&&e._writableState instanceof m}})):n=function(e){return e instanceof this},y.prototype.pipe=function(){p(this,new c)},y.prototype.write=function(e,t,n){var o,s,l,c,d,f,m,y=this._writableState,b=!1,w=!y.objectMode&&(m=e,r.isBuffer(m)||m instanceof i);return w&&!r.isBuffer(e)&&(o=e,e=r.from(o)),"function"==typeof t&&(n=t,t=null),w?t="buffer":t||(t=y.defaultEncoding),"function"!=typeof n&&(n=g),y.ending?(s=n,p(this,l=new h),oA.nextTick(s,l)):(w||(c=e,d=n,null===c?f=new u:"string"==typeof c||y.objectMode||(f=new a("chunk",["string","Buffer"],c)),!f||(p(this,f),oA.nextTick(d,f),0)))&&(y.pendingcb++,b=function(e,t,n,i,o,a){if(!n){var s,l,c=(s=i,l=o,t.objectMode||!1===t.decodeStrings||"string"!=typeof s||(s=r.from(s,l)),s);i!==c&&(n=!0,o="buffer",i=c)}var d=t.objectMode?1:i.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:i,encoding:o,isBuf:n,callback:a,next:null},h?h.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else v(e,t,!1,d,i,o,a);return u}(this,y,w,e,t,n)),b},y.prototype.cork=function(){this._writableState.corked++},y.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||w(this,e))},y.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 f(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(y.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(y.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),y.prototype._write=function(e,t,n){n(new s("_write()"))},y.prototype._writev=null,y.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,S(this,i),r&&(i.finished?oA.nextTick(r):this.once("finish",r)),i.ended=!0,this.writable=!1),this},Object.defineProperty(y.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(y.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),y.prototype.destroy=sT.destroy,y.prototype._undestroy=sT.undestroy,y.prototype._destroy=function(e,t){t(e)},sB}function sG(){if(sU)return sj;sU=1;var e=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};sj=a;var t=le(),n=sW();sz(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||oA.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)}}),sj}var sY=O.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 sZ(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),function(e){if(e&&!sY(e))throw Error("Unknown encoding: "+e)}(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=sX;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=sQ;break;default:return void(this.write=sJ)}this.charBuffer=new O(6),this.charReceived=0,this.charLength=0}function sJ(e){return e.toString(this.encoding)}function sX(e){this.charReceived=e.length%2,this.charLength=2*!!this.charReceived}function sQ(e){this.charReceived=e.length%3,this.charLength=3*!!this.charReceived}sZ.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},sZ.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},sZ.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 s0=el(Object.freeze({__proto__:null,StringDecoder:sZ})),s1=sL.codes.ERR_STREAM_PREMATURE_CLOSE;function s2(){}var s3,s5,s8,s6,s4,s9,s7=function e(t,n,r){if("function"==typeof n)return e(t,null,n);n||(n={}),i=r||s2,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 s1),r.call(t,e)):s&&!c?(t._writableState&&t._writableState.ended||(e=new s1),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 le(){if(s9)return s4;s9=1,s4=y,y.ReadableState=m,ao.EventEmitter;var e=function(e,t){return e.listeners(t).length},t=aX.Buffer,n=(void 0!==ea?ea:"u">typeof window?window:"u">typeof self?self:{}).Uint8Array||function(){},r,i,o,a,s=sI&&sI.debuglog?sI.debuglog("stream"):function(){},l=function(){if(sA)return sM;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)}sA=1;var r=aX.Buffer,i=sI.inspect,o=i&&i.custom||"inspect";return sM=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];
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}()}(),c=sL.codes,d=c.ERR_INVALID_ARG_TYPE,u=c.ERR_STREAM_PUSH_AFTER_EOF,h=c.ERR_METHOD_NOT_IMPLEMENTED,f=c.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;sz(y,aJ);var p=sT.errorOrDestroy,g=["error","close","destroy","pause","resume"];function m(e,t,n){r=r||sG(),e=e||{},"boolean"!=typeof n&&(n=t instanceof r),this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=sF(this,e,"readableHighWaterMark",n),this.buffer=new l,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&&(i||(i=s0.StringDecoder),this.decoder=new i(e.encoding),this.encoding=e.encoding)}function y(e){if(r=r||sG(),!(this instanceof y))return new y(e);var t=this instanceof r;this._readableState=new m(e,this,t),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),aJ.call(this)}function v(e,r,i,o,a){s("readableAddChunk",r);var l,c,h,g,m,y=e._readableState;if(null===r)y.reading=!1,function(e,t){if(s("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?E(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,_(e)))}}(e,y);else{if(a||(l=y,c=r,t.isBuffer(c)||c instanceof n||"string"==typeof c||void 0===c||l.objectMode||(h=new d("chunk",["string","Buffer","Uint8Array"],c)),m=h),m)p(e,m);else if(y.objectMode||r&&r.length>0)if("string"==typeof r||y.objectMode||Object.getPrototypeOf(r)===t.prototype||(g=r,r=t.from(g)),o)y.endEmitted?p(e,new f):b(e,y,r,!0);else if(y.ended)p(e,new u);else{if(y.destroyed)return!1;y.reading=!1,y.decoder&&!i?(r=y.decoder.write(r),y.objectMode||0!==r.length?b(e,y,r,!1):S(e,y)):b(e,y,r,!1)}else o||(y.reading=!1,S(e,y))}return!y.ended&&(y.length<y.highWaterMark||0===y.length)}function b(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&&E(e)),S(e,t)}function w(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 E(e){var t=e._readableState;s("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(s("emitReadable",t.flowing),t.emittedReadable=!0,oA.nextTick(_,e))}function _(e){var t=e._readableState;s("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,A(e)}function S(e,t){t.readingMore||(t.readingMore=!0,oA.nextTick(x,e,t))}function x(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var n=t.length;if(s("maybeReadMore read 0"),e.read(0),n===t.length)break}t.readingMore=!1}function C(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 k(e){s("readable nexttick read 0"),e.read(0)}function M(e,t){s("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),A(e),t.flowing&&!t.reading&&e.read(0)}function A(e){var t=e._readableState;for(s("flow",t.flowing);t.flowing&&null!==e.read(););}function I(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 P(e){var t=e._readableState;s("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,oA.nextTick(O,t,e))}function O(e,t){if(s("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 R(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return -1}return Object.defineProperty(y.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),y.prototype.destroy=sT.destroy,y.prototype._undestroy=sT.undestroy,y.prototype._destroy=function(e,t){t(e)},y.prototype.push=function(e,n){var r,i=this._readableState;return i.objectMode?r=!0:"string"==typeof e&&((n=n||i.defaultEncoding)!==i.encoding&&(e=t.from(e,n),n=""),r=!0),v(this,e,n,!1,r)},y.prototype.unshift=function(e){return v(this,e,null,!0,!1)},y.prototype.isPaused=function(){return!1===this._readableState.flowing},y.prototype.setEncoding=function(e){i||(i=s0.StringDecoder);var t=new i(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},y.prototype.read=function(e){s("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 s("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?P(this):E(this),null;if(0===(e=w(e,t))&&t.ended)return 0===t.length&&P(this),null;var r,i=t.needReadable;return s("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&s("length less than watermark",i=!0),t.ended||t.reading?s("reading or ended",i=!1):i&&(s("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=w(n,t))),null===(r=e>0?I(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&&P(this)),null!==r&&this.emit("data",r),r},y.prototype._read=function(e){p(this,new h("_read()"))},y.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,s("pipe count=%d opts=%j",i.pipesCount,n);var o=n&&!1===n.end||t===oA.stdout||t===oA.stderr?g:a;function a(){s("onend"),t.end()}i.endEmitted?oA.nextTick(o):r.once("end",o),t.on("unpipe",function e(n,o){s("onunpipe"),n===r&&o&&!1===o.hasUnpiped&&(o.hasUnpiped=!0,s("cleanup"),t.removeListener("close",h),t.removeListener("finish",f),t.removeListener("drain",l),t.removeListener("error",u),t.removeListener("unpipe",e),r.removeListener("end",a),r.removeListener("end",g),r.removeListener("data",d),c=!0,i.awaitDrain&&(!t._writableState||t._writableState.needDrain)&&l())});var l=function(){var t=r._readableState;s("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&e(r,"data")&&(t.flowing=!0,A(r))};t.on("drain",l);var c=!1;function d(e){s("ondata");var n=t.write(e);s("dest.write",n),!1===n&&((1===i.pipesCount&&i.pipes===t||i.pipesCount>1&&-1!==R(i.pipes,t))&&!c&&(s("false write response, pause",i.awaitDrain),i.awaitDrain++),r.pause())}function u(n){s("onerror",n),g(),t.removeListener("error",u),0===e(t,"error")&&p(t,n)}function h(){t.removeListener("finish",f),g()}function f(){s("onfinish"),t.removeListener("close",h),g()}function g(){s("unpipe"),r.unpipe(t)}return r.on("data",d),function(e,t,n){if("function"==typeof e.prependListener)return e.prepe
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||(s("pipe resume"),r.resume()),t},y.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=R(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},y.prototype.on=function(e,t){var n=aJ.prototype.on.call(this,e,t),r=this._readableState;return"data"===e?(r.readableListening=this.listenerCount("readable")>0,!1!==r.flowing&&this.resume()):"readable"===e&&(r.endEmitted||r.readableListening||(r.readableListening=r.needReadable=!0,r.flowing=!1,r.emittedReadable=!1,s("on readable",r.length,r.reading),r.length?E(this):r.reading||oA.nextTick(k,this))),n},y.prototype.addListener=y.prototype.on,y.prototype.removeListener=function(e,t){var n=aJ.prototype.removeListener.call(this,e,t);return"readable"===e&&oA.nextTick(C,this),n},y.prototype.removeAllListeners=function(e){var t=aJ.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||oA.nextTick(C,this),t},y.prototype.resume=function(){var e=this._readableState;return e.flowing||(s("resume"),e.flowing=!e.readableListening,e.resumeScheduled||(e.resumeScheduled=!0,oA.nextTick(M,this,e))),e.paused=!1,this},y.prototype.pause=function(){return s("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(s("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},y.prototype.wrap=function(e){var t=this,n=this._readableState,r=!1;for(var i in e.on("end",function(){if(s("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){s("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<g.length;o++)e.on(g[o],this.emit.bind(this,g[o]));return this._read=function(t){s("wrapped _read",t),r&&(r=!1,e.resume())},this},"function"==typeof Symbol&&(y.prototype[Symbol.asyncIterator]=function(){return void 0===o&&(o=function(){if(s5)return s3;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}s5=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){oA.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){oA.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 s3=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,s7(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}}()),o(this)}),Object.defineProperty(y.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(y.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(y.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),y._fromList=I,Object.defineProperty(y.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(y.from=function(e,t){return void 0===a&&(a=s6?s8:(s6=1,s8=function(){throw Error("Readable.from is not available in the browser")})),a(y,e,t)}),s4}var lt=sL.codes,ln=lt.ERR_METHOD_NOT_IMPLEMENTED,lr=lt.ERR_MULTIPLE_CALLBACK,li=lt.ERR_TRANSFORM_ALREADY_TRANSFORMING,lo=lt.ERR_TRANSFORM_WITH_LENGTH_0,la=sG();function ls(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(null===r)return this.emit("error",new lr);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 ll(e){if(!(this instanceof ll))return new ll(e);la.call(this,e),this._transformState={afterTransform:ls.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",lc)}function lc(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?ld(this,null,null):this._flush(function(t,n){ld(e,t,n)})}function ld(e,t,n){if(t)return e.emit("error",t);if(null!=n&&e.push(n),e._writableState.length)throw new lo;if(e._transformState.transforming)throw new li;return e.push(null)}function lu(e){if(!(this instanceof lu))return new lu(e);ll.call(this,e)}sz(ll,la),ll.prototype.push=function(e,t){return this._transformState.needTransform=!1,la.prototype.push.call(this,e,t)},ll.prototype._transform=function(e,t,n){n(new ln("_transform()"))},ll.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)}},ll.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))},ll.prototype._destroy=function(e,t){la.prototype._destroy.call(this,e,function(e){t(e)})},sz(lu,ll),lu.prototype._transform=function(e,t,n){n(null,e)};var lh=sL.codes,lf=lh.ERR_MISSING_ARGS,lp=lh.ERR_STREAM_DESTROYED;function lg(e){if(e)throw e}function lm(e){e()}function ly(e,t){return e.pipe(t)}lN=aZ.exports,(lN=aZ.exports=le()).Stream=lN,lN.Readable=lN,lN.Writable=sW(),lN.Duplex=sG(),lN.Transform=ll,lN.PassThrough=lu,lN.finished=s7,lN.pipeline=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]?lg:r.pop():lg;if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new lf("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(lm),h||(a.forEach(lm),o(i))},c=!1,s=function(){c||(c=!0,l.apply(void 0,arguments))},d=!1,e.on("close",function(){d=!0}),void 0===lL&&(lL=s7),lL(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 lp("pipe"))}});return t.reduce(ly)};var lv=aZ.exports,lb={}
5,lw={exports:{}},lE=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 l_(e){var t=function(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))};return t.called=!1,t}function lS(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}lw.exports=lE(l_),lw.exports.strict=lE(lS),l_.proto=l_(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return l_(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return lS(this)},configurable:!0})});var lx=lw.exports,lC={};Object.defineProperty(lC,"__esModule",{value:!0}),lC.Substream=void 0;let lk=lv;class lM extends lk.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()}}lC.Substream=lM;var lA=ea&&ea.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(lb,"__esModule",{value:!0}),lb.ObjectMultiplex=void 0;let lI=lv,lP=lA(lx),lO=Symbol("IGNORE_SUBSTREAM");lb.ObjectMultiplex=class extends lI.Duplex{constructor(e={}){super(Object.assign(Object.assign({},e),{objectMode:!0})),this._substreams={}}createStream(e){var t;let n;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 r=new lC.Substream({parent:this,name:e});return this._substreams[e]=r,t=e=>r.destroy(e||void 0),n=(0,lP.default)(t),(0,lI.finished)(this,{readable:!1},n),(0,lI.finished)(this,{writable:!1},n),r}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]=lO}_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!==lO&&o.push(i):console.warn(`ObjectMultiplex - orphaned data for stream "${r}"`),n()}};var lR=es(lb.ObjectMultiplex);let lT=e=>null!==e&&"object"==typeof e&&"function"==typeof e.pipe;lT.writable=e=>lT(e)&&!1!==e.writable&&"function"==typeof e._write&&"object"==typeof e._writableState,lT.readable=e=>lT(e)&&!1!==e.readable&&"function"==typeof e._read&&"object"==typeof e._readableState,lT.duplex=e=>lT.writable(e)&&lT.readable(e),lT.transform=e=>lT.duplex(e)&&"function"==typeof e._transform;var lL,lN,l$,lD=class extends aY{constructor(e,{jsonRpcStreamName:t,logger:n=console,maxEventListeners:r=100,rpcMiddleware:i=[]}){if(super({logger:n,maxEventListeners:r,rpcMiddleware:i}),!lT.duplex(e))throw Error(is());this._handleStreamDisconnect=this._handleStreamDisconnect.bind(this);const o=new lR;lv.pipeline(e,o,e,this._handleStreamDisconnect.bind(this,"MetaMask")),this._jsonRpcConnection=function(e={}){let t={},n=new lv.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 aA;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"}),lv.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(ii()))})}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}={}){aT(e)&&t&&"string"==typeof t?"loading"===t?this._handleDisconnect(!0):super._handleChainChanged({chainId:e}):this._log.error(il(),{chainId:e,networkVersion:t})}},lB=class extends lD{constructor(e,{jsonRpcStreamName:t="metamask-provider",logger:n=console,maxEventListeners:r=100,shouldSendMetadata:i}={}){if(super(e,{jsonRpcStreamName:t,logger:n,maxEventListeners:r,rpcMiddleware:((e=console)=>{var t;let n;return[(e,t,n,r)=>{let i=e.id,o=i_=(i_+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=o6(-32600,{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()})}),(n={ethDecryptDeprecation:!1,ethGetEncryptionPublicKeyDeprecation:!1,walletWatchAssetNFTExperimental:!1},(t,r,i)=>{n.ethDecryptDeprecation||"eth_decrypt"!==t.method?n.ethGetEncryptionPublicKeyDeprecation||"eth_getEncryptionPublicKey"!==t.method?!n.walletWatchAssetNFTExperimental&&"wallet_watchAsset"===t.method&&["ERC721","ERC1155"].includes(t.params?.type||"")&&(e.warn(iw.walletWatchAssetNFTExperimental),n.walletWatchAssetNFTExperimental=!0):(e.warn(iw.ethGetEncryptionPublicKeyDeprecation),n.ethGetEncryptionPublicKeyDeprecation=!0):(e.warn(iw.ethDecryptDeprecation),n.ethDecryptDeprecation=!0),i()})]})(n)}),this._sentWarnings={chainId:!1,networkVersion:!1,selectedAddress:!1,enable:!1,experimentalMethods:!1,send:!1,events:{close:!1,data:!1,networkChanged:!1,notification:!1}},aj(this,l$,void 0),this._initializeStateAsync(),aU(this,l$,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)aN(this._rpcEngine,this._log);else{const e=()=>{aN(this._rpcEngine,this._log),window.removeEventListener("DOMContentLoaded",e)};window.addEventListener("DOMContentLoaded",e)}}get chainId(){return this._sentWarnings.chainId||(this._log.warn(ip),this._sentWarnings.chainId=!0),super.chainId}get networkVersion(){return this._sentWarnings.networkVersion||(this._log.warn(ig),this._sentWarnings.networkVersion=!0),aK(this,l$)}get selectedAddress(){return this._sentWarnings.selectedAddress||(this._log.warn(im),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),aK(this,l$)&&!e&&aU(this,l$,null)}_warnOfDeprecation(e){!1===this._sentWarnings?.events[e]&&(this._log.warn(ib[e]),this._sentWarnings.events[e]=!0)}async enable(){return this._sentWarnings.enable||(this._log.warn(iy),this._sentWarnings.enable=!0),new Promise((e,t)=>
6{try{this._rpcRequest({method:"eth_requestAccounts",params:[]},aR(e,t))}catch(e){t(e)}})}send(e,t){return this._sentWarnings.send||(this._log.warn(iv),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},aR(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,aL),t=!0;break;case"net_version":t=aK(this,l$)??null;break;default:throw Error(ia(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 o6(-32600,{message:"Batch requests must be made with an array of request objects.",data:e});return new Promise((t,n)=>{this._rpcRequest(e,aR(t,n))})}},{get:(e,t,...n)=>(this._sentWarnings.experimentalMethods||(this._log.warn(iE),this._sentWarnings.experimentalMethods=!0),Reflect.get(e,t,...n))})}_handleChainChanged({chainId:e,networkVersion:t}={}){super._handleChainChanged({chainId:e,networkVersion:t}),this._state.isConnected&&t!==aK(this,l$)&&(aU(this,l$,t),this._state.initialized&&this.emit("networkChanged",aK(this,l$)))}};l$=new WeakMap;let lK=c()("MM_SDK");lK.color="#FFAC1C";var lj={},lU={};Object.defineProperty(lU,"__esModule",{value:!0}),lU.EthereumProviderError=lU.EthereumRpcError=void 0;class lH 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 oX.default(this.serialize(),lF,2)}}function lF(e,t){if("[Circular]"!==t)return t}lU.EthereumRpcError=lH,lU.EthereumProviderError=class extends lH{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 lz={},lq={};Object.defineProperty(lq,"__esModule",{value:!0}),lq.errorValues=lq.errorCodes=void 0,lq.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}},lq.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."}}
6,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.serializeError=e.isValidCode=e.getMessageFromCode=e.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;let t=lq.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(lq.errorValues,n))return lq.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!!lq.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 lU.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}}(lz);var lV={};function lW(e,t){let[n,r]=lY(t);return new lU.EthereumRpcError(e,n||lz.getMessageFromCode(e),r)}function lG(e,t){let[n,r]=lY(t);return new lU.EthereumProviderError(e,n||lz.getMessageFromCode(e),r)}function lY(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[]}Object.defineProperty(lV,"__esModule",{value:!0}),lV.ethErrors=void 0,lV.ethErrors={rpc:{parse:e=>lW(lq.errorCodes.rpc.parse,e),invalidRequest:e=>lW(lq.errorCodes.rpc.invalidRequest,e),invalidParams:e=>lW(lq.errorCodes.rpc.invalidParams,e),methodNotFound:e=>lW(lq.errorCodes.rpc.methodNotFound,e),internal:e=>lW(lq.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 
6<= -32005');return lW(t,e)},invalidInput:e=>lW(lq.errorCodes.rpc.invalidInput,e),resourceNotFound:e=>lW(lq.errorCodes.rpc.resourceNotFound,e),resourceUnavailable:e=>lW(lq.errorCodes.rpc.resourceUnavailable,e),transactionRejected:e=>lW(lq.errorCodes.rpc.transactionRejected,e),methodNotSupported:e=>lW(lq.errorCodes.rpc.methodNotSupported,e),limitExceeded:e=>lW(lq.errorCodes.rpc.limitExceeded,e)},provider:{userRejectedRequest:e=>lG(lq.errorCodes.provider.userRejectedRequest,e),unauthorized:e=>lG(lq.errorCodes.provider.unauthorized,e),unsupportedMethod:e=>lG(lq.errorCodes.provider.unsupportedMethod,e),disconnected:e=>lG(lq.errorCodes.provider.disconnected,e),chainDisconnected:e=>lG(lq.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 lU.EthereumProviderError(t,n,r)}}},Object.defineProperty(lj,"__esModule",{value:!0}),lj.getMessageFromCode=lj.serializeError=lj.EthereumProviderError=lj.EthereumRpcError=lj.ethErrors=lj.errorCodes=void 0,Object.defineProperty(lj,"EthereumRpcError",{enumerable:!0,get:function(){return lU.EthereumRpcError}}),Object.defineProperty(lj,"EthereumProviderError",{enumerable:!0,get:function(){return lU.EthereumProviderError}}),Object.defineProperty(lj,"serializeError",{enumerable:!0,get:function(){return lz.serializeError}}),Object.defineProperty(lj,"getMessageFromCode",{enumerable:!0,get:function(){return lz.getMessageFromCode}}),Object.defineProperty(lj,"ethErrors",{enumerable:!0,get:function(){return lV.ethErrors}}),Object.defineProperty(lj,"errorCodes",{enumerable:!0,get:function(){return lq.errorCodes}});var lZ={exports:{}};lZ.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){"u">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";case 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];
6"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);
vendor: 5,727 bytes, line 6
6if(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"}
vendor: 7,801 bytes, line 6
6,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);
6return{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 lJ=es(lZ.exports);let lX="provider_update",lQ="connectWithResponse",l0="connection_status",l1="service_status";class l2{constructor({shouldSetOnWindow:e,connectionStream:t,shouldSe
6ndMetadata:n=!1,shouldShimWeb3:r,sdkInstance:i}){const o=new l8({connectionStream:t,shouldSendMetadata:n,shouldSetOnWindow:e,shouldShimWeb3:r,autoRequestAccounts:!1}),a=new Proxy(o,{deleteProperty:()=>!0});if(this.provider=a,this.sdkInstance=i,e&&"u">typeof window)try{window.ethereum=o,window.dispatchEvent(new Event("ethereum#initialized"))}catch(e){lK("[Ethereum] Unable to set global provider - window.ethereum may be read-only",e)}if(r&&"u">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){lK("[Ethereum] Unable to shim web3 - window.web3 may be read-only",e)}this.provider.on("display_uri",e=>{this.sdkInstance.emit("display_uri",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("initialized",e),lK("[Ethereum: constructor()] provider initialized",e)})}static init(e){var t;return lK("[Ethereum: init()] Initializing Ethereum service"),this.instance=new l2(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 l3{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){return function(e,t,n,r){let{state:i}=e;lK(`[PlatfformManager: openDeeplink()] universalLink --> ${t}`),lK(`[PlatfformManager: openDeeplink()] deepLink --> ${n}`);try{if(i.preferredOpenLink)return void i.preferredOpenLink(i.useDeeplink?n:t,r);if(lK(`[PlatfformManager: openDeeplink()] open link now useDeepLink=${i.useDeeplink} link=${i.useDeeplink?n:t}`),i.useDeeplink)"u">typeof window&&(window.location.href=n);else if("u">typeof document){let e=document.createElement("a");e.href=t,e.target="_self",e.rel="noreferrer noopener",e.click()}}catch(e){console.log("[PlatfformManager: openDeeplink()] can't open link",e)}}(this,e,t,n)}isReactNative(){var e;return this.isNotBrowser()&&"u">typeof window&&(null==window?void 0:window.navigator)&&"ReactNative"===(null==(e=window.navigator)?void 0:e.product)}isMetaMaskInstalled(){let e;return e=l2.getProvider()||(null==window?void 0:window.ethereum),lK(`[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=lJ.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"u">typeof window&&!!window.ReactNativeWebView&&!!navigator.userAgent.endsWith("MetaMaskMobile")}isMobileWeb(){return this.state.platformType===og.MobileWeb}static isNotBrowser(){var e;return"u"<typeof window||!(null==window?void 0:window.navigator)||void 0!==y&&"ReactNative"===(null==(e=null==y?void 0:y.navigator)?void 0:e.product)||"ReactNative"===(null==navigator?void 0:navigator.product)}isNotBrowser(){return l3.isNotBrowser()}static isBrowser(){return!this.isNotBrowser()}isBrowser(){return l3.isBrowser()}isNodeJS(){return this.isNotBrowser()&&!this.isReactNative()}isUseDeepLink(){return this.state.useDeeplink}getPlatformType(){return function(e){let{state:t}=e;return t.platformType?t.platformType:e.isReactNative()?og.ReactNative:e.isNotBrowser()?og.NonBrowser:e.isMetaMaskMobileWebView()?og.MetaMaskMobileWebview:e.isMobile()?og.MobileWeb:og.DesktopWeb}(this)}}let l5=e=>m(void 0,void 0,void 0,function*(){if(l3.isBrowser()){let{StorageManagerWeb:t}=yield Promise.resolve().then(function(){return c0});return new t(e)}return Promise.resolve({persistChannelConfig:()=>m(void 0,void 0,void 0,function*(){}),getPersistedChannelConfig:()=>m(void 0,void 0,void 0,function*(){}),persistAccounts:()=>m(void 0,void 0,void 0,function*(){}),getCachedAccounts:()=>m(void 0,void 0,void 0,function*(){return[]}
6),persistChainId:()=>m(void 0,void 0,void 0,function*(){}),getCachedChainId:()=>m(void 0,void 0,void 0,function*(){}),terminate:()=>m(void 0,void 0,void 0,function*(){})})});class l8 extends lB{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:""},lK(`[SDKProvider: constructor()] autoRequestAccounts=${n}`),this.state.autoRequestAccounts=n}forceInitializeState(){return m(this,void 0,void 0,function*(){return lK(`[SDKProvider: forceInitializeState()] autoRequestAccounts=${this.state.autoRequestAccounts}`),this._initializeStateAsync()})}_setConnected(){lK("[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())||"":(lK("[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;lK(`[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",lj.ethErrors.provider.disconnected()),n.providerStateRequested=!1}({terminate:e,instance:this})}_initializeStateAsync(){return m(this,void 0,void 0,function*(){return function(e){var t,n;return m(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)lK("[SDKProvider: initializeStateAsync()] initialization already in progress");else{let o;i.providerStateRequested=!0;let a=null,s=!1,l=!1,c=yield l5({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(lK(`[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{lK("[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 lK("[SDKProvider: _initializeState()]",e),t=super._initializeState.bind(this),lK("[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}){lK(`[SDKProvider: handleChainChanged()] chainId=${t} networkVersion=${n}`);let o=n;n||(lK("[SDKProvider: handleChainChanged()] forced network version to prevent provider error"),o="1"),t!==r&&(d.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 l6,l4="0.33.1";(db=l6||(l6={})).INPAGE="metamask-inpage",db.CONTENT_SCRIPT="metamask-contentscript",db.PROVIDER="metamask-provider";let l9="direct",l7="https://metamask.app.link/connect",ce="metamask://connect",ct=["io.metamask","io.metamask.flask"],cn=/(?:^[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,cr="metamask_getProviderState",ci="metamask_connectSign",co="metamask_connectWith",ca="metamask_batch",cs="personal_sign",cl="wallet_requestPermissions",cc="wallet_getPermissions",cd="eth_requestAccounts",cu="eth_accounts",ch="eth_chainId",cf="eth_sendTransaction",cp={[cd]:!0,[cf]:!0,eth_signTransaction:!0,eth_sign:!0,[cs]:!0,[cu]:!1,[ch]:!1,[cs]:!0,eth_signTypedData:!0,eth_signTypedData_v3:!0,eth_signTypedData_v4:!0,[cl]:!0,[cc]:!0,wallet_watchAsset:!0,wallet_addEthereumChain:!0,wallet_switchEthereumChain:!0,[ci]:!0,[co]:!0,personal_ecRecover:!0,[ca]:!0,metamask_open:!0}
6,cg=Object.keys(cp).filter(e=>!0===cp[e]).map(e=>e.toLowerCase()),cm=["eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sign"].map(e=>e.toLowerCase()),cy=".sdk-comm",cv="providerType",cb=".MMSDK_cached_address",cw=".MMSDK_cached_chainId",cE="chainChanged",c_="accountsChanged",cS="disconnect",cx="connect",cC="connected";(dw=d_||(d_={})).TERMINATE="terminate",dw.EXTENSION="extension",dw.INITIALIZED="initialized";let ck="u">typeof window&&window.localStorage;function cM(e){var t,n;return m(this,void 0,void 0,function*(){lK("[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"});lK(`[MetaMaskSDK: connectWithExtensionProvider()] accounts=${e}`)}catch(e){return void console.warn("[MetaMaskSDK: connectWithExtensionProvider()] can't request accounts error",e)}localStorage.setItem(cv,"extension"),e.extensionActive=!0,e.emit(lX,d_.EXTENSION),e.options.enableAnalytics&&(null==(n=e.analytics)||n.send({event:ou.SDK_USE_EXTENSION}))})}function cA(e){let t;if(void 0!==O)t=O.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 y||!("Buffer"in y))throw Error("Unable to base64 encode: No available method.");t=y.Buffer.from(e,"utf8").toString("base64")}return t}class cI extends lv.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(os.MESSAGE,this._onMessage)}_write(e,t,n){return m(this,void 0,void 0,function*(){return function(e,t,n){var r,i,o,a,s,l,c,d,u,h,f,p,g,y,v,b,w,E,_,S;return m(this,void 0,void 0,function*(){var m,x,C,k;let M,A,I,P=null==(r=e.state.remote)?void 0:r.isReady(),R=null==(i=e.state.remote)?void 0:i.isConnected(),T=null==(o=e.state.remote)?void 0:o.isPaused(),L=l2.getProvider(),N=null==(a=e.state.remote)?void 0:a.getChannelId(),$=null==(s=e.state.remote)?void 0:s.isAuthorized(),{deeplinkProtocol:D}=e.state,{method:B,data:K,triggeredInstaller:j}=(O.isBuffer(t)?(M=t.toJSON())._isBuffer=!0:M=t,A=null==(m=null==M?void 0:M.data)?void 0:m.method,I=!1,"object"==typeof(null==(x=null==M?void 0:M.data)?void 0:x.params)&&!0===(null==(k=null==(C=null==M?void 0:M.data)?void 0:C.params)?void 0:k.__triggeredInstaller)&&(I=!0,M.data.params=M.data.params.wrappedParams),{method:A,data:M,triggeredInstaller:I});if(lK(`[RCPMS: write()] method='${B}' isRemoteReady=${P} channelId=${N} isSocketConnected=${R} isRemotePaused=${T} providerConnected=${L.isConnected()}`,t),!N)return B!==cr&&lK(`[RCPMS: write()] ${B} --> channelId is undefined`),n(Error("disconnected"));lK(`[RCPMS: write()] remote.isPaused()=${null==(l=e.state.remote)?void 0:l.isPaused()} authorized=${$} ready=${P} socketConnected=${R}`,t);let U=null==(c=e.state.platformManager)?void 0:c.isSecure(),H=null!=(u=null==(d=e.state.platformManager)?void 0:d.isMobileWeb())&&u,F=null!=(f=null==(h=e.state.remote)?void 0:h.hasDeeplinkProtocol())&&f&&H&&$;try{if(!j){let t=JSON.stringify(null==K?void 0:K.data);if(t.length>1e6)return n(Error(`Message size ${t.length} exceeds maximum allowed size of 1000000 bytes`));null==(p=e.state.remote)||p.sendMessage(null==K?void 0:K.data).then(()=>{lK(`[RCPMS: _write()] ${B} sent successfully`)}).catch(e=>{lK("[RCPMS: _write()] error sending message",e)})}if(!U)return lK(`[RCPMS: _write()] unsecure platform for method ${B} -- return callback`),n();if(j)return lK("[RCPMS: _write()] prevent deeplink -- installation completed separately."),n();let t=null!=(v=null==(y=null==(g=e.state.remote)?void 0:g.getKeyInfo())?void 0:y.ecies.public)?v:"",r=encodeURI(`channelId=${N}&pubkey=${t}&comm=socket&t=d&v=2`);if(F){let t=JSON.stringify(null==K?void 0:K.data),i=null==(b=e.state.remote)?void 0:b.encrypt(t);if(!i)return lK("[RCPMS: _write()] error encrypting message"),n(Error("RemoteCommunicationPostMessageStream - disconnected"));r+=`&scheme=${D}&rpc=${cA(i)}`}if(!(null==(w=e.state.platformManager)?void 0:w.isMetaMaskInstalled()))return lK("[RCPMS: _write()] prevent deeplink until installation is completed."),n();cp[B]?(lK(`[RCPMS: _write()] redirect link for '${B}' socketConnected=${R} connect?${r}`),null==(E=e.state.platformManager)||E.openDeeplink(`${l7}?${r}`,`${ce}?${r}`,"_self")):(null==(_=e.state.remote)?void 0:_.isPaused())?(lK(`[RCPMS: _write()] MM is PAUSED! deeplink with connect! targetMethod=${B}`),null==(S=e.state.platformManager)||S.openDeeplink(`${l7}?redirect=true&${r}`,`${ce}?redirect=true&${r}`,"_self")):lK(`[RCPMS: _write()] method ${B} doesn't need redirect.`)}catch(e){return lK("[RCPMS: _write()] error sending message",e),n(Error("RemoteCommunicationPostMessageStream - disconnected"))}return n()})}(this,e,n)})}_read(){}_onMessage(e){try{if(lK("[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 lK("[RCPMS: onMessage()] ignore message without name",e);if((null==e?void 0:e.name)!==l6.PROVIDER)return void lK(`[RCPMS: onMessage()] ignore message with wrong name message=${e}`);if(O.isBuffer(e)){let t=O.from(e);this.push(t)}else this.push(e)}catch(e){lK(`[RCPMS: onMessage()] ignore message error err=${e}`)}}start(){}}let cP=1,cO=e=>new Promise(t=>{setTimeout(()=>{t(!0)},e)});class cR{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:l4},this.originatorInfo),{params:t});lK(`[Analytics: send()] event: ${e}`,n),rz(n,this.serverURL).catch(e=>{lK(`[Analytics: send()] error: ${e}`)})}}function cT(e){var t,n,r;let{dappMetadata:i}=e,o=function({url:e,name:t}){var n;let r=cA(e+t);if(!localStorage)return"";let i=null!=(n=localStorage.getItem(r))?n:"";if(!i){i=(0,f.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===og.DesktopWeb,l=a===og.MetaMaskMobileWebview,c="N/A";return s?c="extension":l&&(c="mobile"),{id:o,from:c}}let cL=(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?d.analytics.track("sdk_action_rejected",{action:e}):d.analytics.track("sdk_action_failed",{action:e})}else d.analytics.track("sdk_action_succeeded",{action:e})},cN=({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 m(this,void 0,void 0,function*(){lK("[wrapExtensionProvider()] Overwriting request method",e);let{method:o,params:a}=e,s=cg.includes(o.toLowerCase()),{id:l,from:c}=cT(t);if(s&&(null==(r=t.analytics)||r.send({event:ou.SDK_RPC_REQUEST,params:{method:o,from:c,id:l}})),rZ(o)&&d.analytics.track("sdk_action_requested",{action:o}),o===ca&&Array.isArray(a))return(({target:e,args:t,trackEvent:n,sdkInstance:r})=>m(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}=cT(r);for(let e of(n&&(null==(o=r.analytics)||o.send({event:ou.SDK_RPC_REQUEST_DONE,params:{method:t.method,from:l,id:s}})),a))cL(t.method,e,null);return a}))({target:n,args:e,trackEvent:s,sdkInstance:t});if(o.toLowerCase()===ci.toLowerCase()&&Array.isArray(a))return(({target:e,params:t})=>m(void 0,void 0,void 0,function*(){let n,r=null;try{let r=yield e.request({method:cd,params:[]});if(!r.length)throw Error("SDK state invalid -- undefined accounts");return n=yield e.request({method:cs,params:[t[0],r[0]]})}catch(e){throw r=e,e}finally{cL(cs,n,r)}}))({target:n,params:a});if(o.toLowerCase()===co.toLowerCase()&&Array.isArray(a))return(({target:e,params:t})=>m(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:cd,params:[]});if(!Array.isArray(t)||!t.length)throw Error("SDK state invalid -- undefined accounts");return(null==r?void 0:r.toLowerCase())===cs.toLowerCase()?o=yield e.request({method:r,params:[i[0],t[0]]}):(null==r?void 0:r.toLowerCase())===cf.toLowerCase()?o=yield e.request({method:r,params:[Object.assign(Object.assign({},i[0]),{from:t[0]})]}):cm.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{cL(r,o,a)}}))({target:n,params:a});let u,h=null;try{return u=yield n.request(e)}catch(e){throw h=e,e}
6finally{s&&(null==(i=t.analytics)||i.send({event:ou.SDK_RPC_REQUEST_DONE,params:{method:o,from:c,id:l}})),cL(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]})};(dE=dS||(dS={})).Announce="eip6963:announceProvider",dE.Request="eip6963:requestProvider";var c$="INSTALLED",cD="NOT_INSTALLED",cB="REGISTERED",cK="REGISTERING",cj="RELOADING",cU={CHROME:"https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn",FIREFOX:"https://addons.mozilla.org/firefox/addon/ether-metamask/",DEFAULT:"https://metamask.io"},cH="REGISTRATION_IN_PROGRESS",cF="FORWARDER_ID",cz=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()?c$:cD;var a=e._detectBrowser();this.downloadUrl=a?cU[a]:cU.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(cH)&&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 cj:return[3,1];case cD:return[3,2];case c$:return[3,3];case cK:return[3,5];case cB: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=cj,location.reload(),[3,8];case 3:return console.debug("Registering with MetaMask"),this.state=cK,[4,e._register()];case 4:return n.sent(),this.state=cB,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(cH,"true"),this._openDownloadPage(),this._openForwarder()},e.prototype.stopOnboarding=function(){"true"===sessionStorage.getItem(cH)&&(this.forwarderMode===e.FORWARDER_MODE.INJECT&&(console.debug("Removing forwarder"),e._removeForwarder()),sessionStorage.setItem(cH,"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",cF),t.insertBefore(n,t.children[0])},e._removeForwarder=function(){var e;
6null==(e=document.getElementById(cF))||e.remove()},e._detectBrowser=function(){var e=lJ.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 cq{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 m(this,void 0,void 0,function*(){lK("[MetamaskInstaller: startDesktopOnboarding() starting desktop onboarding"),window.ethereum&&(window.ethereum=void 0),(new cz).startOnboarding()})}()}redirectToProperInstall(){return m(this,void 0,void 0,function*(){return function(e){var t,n;return m(this,void 0,void 0,function*(){let{state:r}=e,i=null==(t=r.platformManager)?void 0:t.getPlatformType();if(lK(`[MetamaskInstaller: redirectToProperInstall()] platform=${i}`),i===og.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 m(this,void 0,void 0,function*(){return function(e){var t;return m(this,void 0,void 0,function*(){let{state:n}=e,r=null==(t=n.platformManager)?void 0:t.isMetaMaskInstalled();return lK(`[MetamaskInstaller: checkInstallation()] isInstalled=${r}`),!!r||(yield e.redirectToProperInstall())})}(this)})}start({wait:e=!1,connectWith:t}){return m(this,void 0,void 0,function*(){this.state.connectWith=t,lK(`[MetaMaskInstaller: start()] wait=${e}`,t),yield function(e,{wait:t=!1}){return m(this,void 0,void 0,function*(){return lK(`[MetamaskInstaller: startInstaller()] wait=${t}`),t&&(yield cO(1e3)),yield e.checkInstallation()})}(this,{wait:e})})}}class cV{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 m(this,void 0,void 0,function*(){if(!this.defined[e]){this.defined[e]=!0;try{let e=yield Promise.resolve().then(function(){return ur});console.log("loader",e),e.defineCustomElements()}catch(t){console.error(`Failed to load ${e} modal:`,t)}}})}renderInstallModal(e){var t;return m(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 m(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 m(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 cW=({link:e,debug:t,installer:n,terminate:r,connectWithExtension:i,preferDesktop:o,onAnalyticsEvent:a})=>{let s=null,l=null;lK("[UI: InstallModal-web: sdkWebInstallModal()] ################## Installing Modal #################"),lK(`[UI: InstallModal-web: sdkWebInstallModal()] link=${e}`),lK(`[UI: InstallModal-web: sdkWebInstallModal()] npx uri-scheme open "${e}" --ios`),lK(`[UI: InstallModal-web: sdkWebInstallModal()] npx uri-scheme open "${e}" --android`),lK(`[UI: InstallModal-web: sdkWebInstallModal()] adb shell am start -a android.intent.action.VIEW -d "${e}"`);let c=e=>{var t;lK("[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=>{(lK("[UI: InstallModal-web: sdkWebInstallModal()] installModal-web mounting install modal",l),l)?(l.style.display="block",null==s||s.updateQRCode(r)):(s=new cV({debug:t,sdkVersion:l4}),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}},cG=({onDisconnect:e,debug:t})=>{let n=null,r=null,i=()=>{lK("[UI: pendingModal-web: sdkWebPendingModal()] pendingModal-web unmount",n),(null==n?void 0:n.parentNode)&&n.parentNode.removeChild(n),n=null,r=null},o=e=>{lK("[UI: pendingModal-web: sdkWebPendingModal()] pendingModal-web updateOTPValue",e),r&&r.updateOTPValue(e)},a=({displayOTP:a}={displayOTP:!0})=>{lK("[UI: pendingModal-web: sdkWebPendingModal()] pendingModal-web mount",n),n?n.style.display="block":(r=new cV({debug:t,sdkVersion:l4}),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 cY(e,t){var n,r,i,o;e.connector||(lK("[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:l4,context:"dapp",ecies:t.ecies,storage:t.storage,logging:t.logging}),t.timer&&(lK("[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 cZ(e){e.listeners.forEach(({event:t,handler:n})=>{var r;null==(r=e.connector)||r.off(t,n)}),e.listeners=[]}function cJ(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&&(cZ(e),n(os.WALLET_INIT,({accounts:e,chainId:t})=>m(this,void 0,void 0,function*(){lK(`[RemoteConnection: setupListeners() => EventType.WALLET_INIT] 'wallet_init' accounts=${e} chainId=${t}`);let n=l2.getProvider();n._setConnected(),n._initializeState({accounts:e,chainId:t,isUnlocked:!1}),n.emit("chainChanged",t),n.emit("accountsChanged",e)})),n(os.AUTHORIZED,()=>m(this,void 0,void 0,function*(){var t,n,r,i;try{lK("[RemoteConnection: setupListeners() => EventType.AUTHORIZED] 'authorized' closing modals",e.pendingModal,e.installModal);let o=l2.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,lK("[RemoteConnection: setupListeners() => EventType.AUTHORIZED] 'authorized' provider.state",o.getState()),yield o.forceInitializeState()}catch(e){}})),n(os.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,l2.getProvider().handleDisconnect({terminate:!0}),cZ(e),lK("[RemoteConnection: setupListeners()] All listeners cleaned up")}))}class cX{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;const 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=cW),e.modals.otp||(e.modals.otp=cG)}startConnection(e){return m(this,void 0,void 0,function*(){return function(e,t,{initialCheck:n,connectWith:r}={}){var i,o,a,s,l,c,u,h,f,p,g,y,v,b,w,E,_,S,x;
6return m(this,void 0,void 0,function*(){try{if(cY(e,t),!e.connector)throw Error("no connector defined");cJ(e);let C=l2.getProvider();e.authorized=!1,C.emit("connecting");let k=yield null==(i=e.connector)?void 0:i.originatorSessionConnect();lK(`[RemoteConnection: startConnection()] after originatorSessionConnect initialCheck=${n}`,k);let M=null!=(o=null==k?void 0:k.channelId)?o:"",A=null!=(s=null==(a=e.connector.getKeyInfo())?void 0:a.ecies.public)?s:"",I=null!=(c=null==(l=e.connector.getKeyInfo())?void 0:l.ecies.private)?c:"";if(n&&!k)return Promise.resolve();if(!k&&!n){let t=yield e.connector.generateChannelIdConnect();M=null!=(u=t.channelId)?u:"",A=null!=(h=t.pubKey)?h:"",I=null!=(f=t.privKey)?f:"";let n=Date.now();null==(p=e.connector.state.storageManager)||p.persistChannelConfig({channelId:M,localKey:I,lastActive:n,validUntil:n+6048e5})}if(n&&(null==k?void 0:k.channelId))return(null==(g=e.connector)?void 0:g.isConnected())||(lK(`[RemoteConnection: startConnection()] reconnecting to channel initialCheck=${n}`,k),yield null==(y=e.connector)?void 0:y.connectToChannel({channelId:M})),Promise.resolve();!k||(null==(v=e.connector)?void 0:v.isConnected())||(lK("[RemoteConnection: startConnection()] reconnecting to channel",k),yield null==(b=e.connector)?void 0:b.connectToChannel({channelId:M}));let P=(null==(w=e.platformManager)?void 0:w.isSecure())?"":"&t=q",{iconUrl:O,name:R,url:T,scheme:L}=t.dappMetadata||{},N=null==(E=e.platformManager)?void 0:E.getPlatformType(),$="N/A";"u">typeof window&&window.location&&window.location.hostname?$=window.location.hostname:void 0!==R?$=R:void 0!==T&&($=T);let D={url:null!=T?T:"",title:null!=R?R:"",icon:O,scheme:null!=L?L:"",apiVersion:l4,dappId:$||T||"N/A",anonId:t.anonId,platform:null!=N?N:"",source:null!=(_=t._source)?_:""},B=cA(JSON.stringify(D)),K=`channelId=${M}&v=2&comm=${null!=(S=e.communicationLayerPreference)?S:""}&pubkey=${A}${P}&originatorInfo=${B}`;if(r){K+=`&rpc=${cA(JSON.stringify(r))}`;let t=e.connector.getRPCMethodTracker();t&&(t[`${r.id}`]=Object.assign(Object.assign({},r),{id:`${r.id}`,timestamp:Date.now()}))}let j=encodeURI(K),U=`${e.useDeeplink?ce:l7}?${K}`;if(e.qrcodeLink=U,e.developerMode&&lK(`[RemoteConnection: startConnection()] qrcodeLink=${j}`),C.emit("display_uri",U),d.analytics.track("sdk_connection_initiated",{transport_type:"websocket"}),null==(x=e.platformManager)?void 0:x.isSecure()){let t=setTimeout(()=>{d.analytics.track("sdk_connection_failed",{transport_type:"websocket"})},6e4);return yield function(e,t){var n,r;return m(this,void 0,void 0,function*(){let i=`${l7}?${t}`,o=`${ce}?${t}`;null==(r=null==(n=e.platformManager)?void 0:n.openDeeplink)||r.call(n,i,o,"_self")})}(e,j),new Promise((n,r)=>{var i,o,a;(null==(i=e.connector)?void 0:i.isAuthorized())?(clearTimeout(t),n()):(null==(o=e.connector)||o.once(os.AUTHORIZED,()=>{clearTimeout(t),n()}),null==(a=e.connector)||a.once(os.REJECTED,()=>{clearTimeout(t),r(os.REJECTED)}))})}return function(e,t,n){return m(this,void 0,void 0,function*(){let r=setTimeout(()=>{d.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"));lK("[RemoteConnection: connectWithModalInstaller()]",{state:e,options:t,linkParams:n});let d=`${e.useDeeplink?ce:l7}?${n}`;e.installModal=null==(s=(a=t.modals).install)?void 0:s.call(a,{link:d,preferDesktop:e.preferDesktop,installer:t.getMetaMaskInstaller(),terminate:()=>{lK("[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(os.PROVIDER_UPDATE,e=>m(this,void 0,void 0,function*(){(lK("[RemoteConnection: connectWithModalInstaller()] once provider_update -- resolving startConnection promise"),e===d_.TERMINATE)?(clearTimeout(r),o({code:4001,message:"User rejected the request."})):o(e)})),e.connector.once(os.AUTHORIZED,()=>{clearTimeout(r),i()}),e.connector.once(os.REJECTED,()=>{clearTimeout(r),o(os.REJECTED)}),e.connector.once(os.CLIENTS_READY,()=>m(this,void 0,void 0,function*(){lK("[RemoteConnection: connectWithModalInstaller()] once clients_ready -- resolving startConnection promise"),clearTimeout(r),i()}))})})}
6(e,t,j)}catch(e){throw console.error("[startConnection] error",e),e}})}(this.state,this.options,e)})}initRemoteCommunication({sdkInstance:e}){var t,n,r;return m(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}cY(this.state,this.options),yield null==(r=this.getConnector())?void 0:r.initFromDappStorage(),cJ(this.state,this.options)})}showActiveModal(){var e,t,n,r,i;(e=this.state).authorized?lK("[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()}getKeyInfo(){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;lK("[RemoteConnection: disconnect()]",e),(null==e?void 0:e.terminate)&&(l2.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,lK("[RemoteConnection: cleanupConnector()] cleaning up connector"),i.connector&&(cZ(i),i.connector.disconnect({terminate:!0}).catch(e=>{lK("[RemoteConnection: cleanupConnector()] error disconnecting connector",e)}))}}class cQ extends h(){constructor(e={storage:{enabled:!0},injectProvider:!0,forceInjectProvider:!1,enableAnalytics:!0,shouldShimWeb3:!0,useDeeplink:!0,extensionOnly:!0,headless:!1,dappMetadata:{name:"",url:"",iconUrl:""},_source:l9,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",c().disable();const i=!0===(null==(t=e.logging)?void 0:t.developerMode);if(((null==(n=e.logging)?void 0:n.sdk)||i)&&c().enable("MM_SDK"),lK("[MetaMaskSDK: constructor()]: begin."),this.setMaxListeners(50),!(null==(r=e.dappMetadata)?void 0:r.url)){if("u"<typeof window||"u"<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=l9),this.init().then(()=>{lK("[MetaMaskSDK: constructor()]: initialized successfully."),"u">typeof window&&(window.mmsdk=this)}).catch(e=>{console.error("[MetaMaskSDK: constructor()] error during initialization",e)})}init(){return m(this,void 0,void 0,function*(){return function(e){var t;return m(this,void 0,void 0,function*(){if("u">typeof window&&(null==(t=window.mmsdk)?void 0:t.isInitialized()))return lK("[MetaMaskSDK: initializeMetaMaskSDK()] already initialized"),Promise.resolve(window.mmsdk);if(e._initialized)return lK("[MetaMaskSDK: initializeMetaMaskSDK()] already initialized"),e.sdkInitPromise;if(e.sdkInitPromise)return lK("[MetaMaskSDK: initializeMetaMaskSDK()] already initializing"),e.sdkInitPromise;try{e.sdkInitPromise=function(e){var t,n,r,i,o,a,l,u,h,f,p;return m(this,void 0,void 0,function*(){let{options:g}=e;if(g.logging=null!=(t=g.logging)?t:{},g.communicationLayerPreference=null!=(n=g.communicationLayerPreference)?n:op.SOCKET,void 0!==g.enableDebug&&(c().enable("MM_SDK"),console.warn("enableDebug is removed. Please use enableAnalytics instead.")),g.enableAnalytics=null==(r=g.enableAnalytics)||r,g.injectProvider=null==(i=g.injectProvider)||i,g.shouldShimWeb3=null==(o=g.shouldShimWeb3)||o,g.extensionOnly=null==(a=g.extensionOnly)||a,g.useDeeplink=null==(l=g.useDeeplink)||l,g.storage=null!=(u=g.storage)?u:{enabled:!0},g.headless){c()("[MetaMaskSDK: performSDKInitialization()] headless mode enabled");let e=()=>{};g.modals={install:()=>({mount:e,unmount:e})},g.ui={installer:e}}let y=!0===(null==(h=g.logging)?void 0:h.developerMode);e.debug=(null==(f=g.logging)?void 0:f.sdk)||y,lK("[MetaMaskSDK: performSDKInitialization()] options",e.options);let v=Object.assign({},g.logging);y&&(v.sdk=!0,v.eciesLayer=!0,v.keyExchangeLayer=!0,v.remoteLayer=!0,v.serviceLayer=!0,v.plaintext=!0),yield function(e){var t;return m(this,void 0,void 0,function*(){let{options:n}=e;e.platformManager=new l3({useDeepLink:null!=(t=n.useDeeplink)&&t,preferredOpenLink:n.openDeeplink,debug:e.debug})})}(e),yield function(e){var t,n,r,i,o;return m(this,void 0,void 0,function*(){let{options:a}=e,s=null==(t=e.platformManager)?void 0:t.getPlatformType();e.analytics=new cR({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 m(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;d.analytics.setGlobalProperty("sdk_version",i),d.analytics.setGlobalProperty("dapp_id",o),d.analytics.setGlobalProperty("anon_id",a),d.analytics.setGlobalProperty("platform",s),d.analytics.setGlobalProperty("integration_type",l),d.analytics.enable(),d.analytics.track("sdk_initialized",{})})}(e),yield function(e){var t;return m(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 l5(n.storage))})}(e),yield function(e){return m(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=(()=>{let e;if("u"<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})();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 m(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}),yield m(void 0,void 0,void 0,function*(){let{options:t}=e,{readonlyRPCMap:n}=t;if(n)try{lK("[MetaMaskSDK: setupReadOnlyRPCProviders()] Setting up Readonly RPC Providers",n),e.setReadOnlyRPCCalls(!0)}catch(e){throw Error("Invalid Infura Settings")}});let{metamaskBrowserExtension:b,preferExtension:w,shouldReturn:E}=yield function(e){var t,n,r,i;return m(this,void 0,void 0,function*(){let{options:o}=e,a,s=!1,l=!1;if("u">typeof window&&window.ethereum&&!(null==(t=e.platformManager)?void 0:t.isMetaMaskMobileWebView())){s="extension"===localStorage.getItem(cv);try{a=yield function({mustBeMetaMask:e,sdkInstance:t}){return m(this,void 0,void 0,function*(){if("u"<typeof window)throw Error("window not available");try{let e=yield new Promise((e,t)=>
6{let n=setTimeout(()=>{t(Error("eip6963RequestProvider timed out"))},500);window.addEventListener(dS.Announce,t=>{let{detail:{info:r,provider:i}={}}=t,{name:o,rdns:a,uuid:s}=null!=r?r:{};cn.test(s)&&o.startsWith("MetaMask")&&ct.includes(a)&&(clearTimeout(n),e(i))}),window.dispatchEvent(new Event(dS.Request))});return cN({provider:e,sdkInstance:t})}catch(n){if(!e&&window.ethereum)return cN({provider:window.ethereum,sdkInstance:t});throw Error("Provider not found")}})}({mustBeMetaMask:!0,sdkInstance:e}),window.extension=a,a.on(cE,t=>{lK(`[MetaMaskSDK: setupExtensionPreferences()] PROPAGATE chainChanged chainId=${t}`),e.sdkProvider&&e.getMobileProvider().emit(cE,t)}),a.on(c_,t=>m(this,void 0,void 0,function*(){var n;lK(`[MetaMaskSDK: setupExtensionPreferences()] PROPAGATE accountsChanged accounts=${t}`);let r=!!e.sdkProvider,i=!!e.extensionActive;if(r&&e.getMobileProvider().emit(c_,t),i&&0===(null==t?void 0:t.length)&&0===(yield null==(n=e.getProvider())?void 0:n.request({method:cc,params:[]})).length)try{yield e.terminate()}catch(e){lK("[MetaMaskSDK: setupExtensionPreferences()] error terminating on permissions revoked",e)}})),a.on(cS,t=>{lK(`[MetaMaskSDK: setupExtensionPreferences()] PROPAGATE disconnect error=${t}`),e.sdkProvider&&e.getMobileProvider().emit(cS,t)}),a.on(cx,t=>{lK(`[MetaMaskSDK: setupExtensionPreferences()] PROPAGATE connect args=${t}`),e.sdkProvider&&e.getMobileProvider().emit(cx,t)}),a.on(cC,t=>{lK("[MetaMaskSDK: setupExtensionPreferences()] PROPAGATE connected",t),e.sdkProvider&&e.getMobileProvider().emit(cC,t)})}catch(e){window.extension=void 0}}else(null==(n=e.platformManager)?void 0:n.isMetaMaskMobileWebView())&&(null==(r=e.analytics)||r.send({event:ou.SDK_USE_INAPP_BROWSER}),e.activeProvider=cN({provider:window.ethereum,sdkInstance:e}),e._initialized=!0,l=!0);return a&&o.extensionOnly&&(lK("[MetaMaskSDK: setupExtensionPreferences()] EXTENSION ONLY --- prevent sdk initialization"),null==(i=e.analytics)||i.send({event:ou.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)lK("[MetaMaskSDK: performSDKInitialization()] shouldReturn=true --- prevent sdk initialization");else{yield function(e,t){var n,r,i,o,a;return m(this,void 0,void 0,function*(){let{options:s}=e,l=Object.assign({},s.logging);e.remoteConnection=new cX({anonId:yield e.getAnonId(),preferDesktop:null!=(n=s.preferDesktop)&&n,communicationLayerPreference:null!=(r=s.communicationLayerPreference)?r:op.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:()=>cM(e),modals:Object.assign(Object.assign({},s.modals),{onPendingModalDisconnect:e.terminate.bind(e)})}),yield e.remoteConnection.initRemoteCommunication({sdkInstance:e}),e.installer=new cq({remote:e.remoteConnection,preferDesktop:null!=(a=s.preferDesktop)&&a,platformManager:e.platformManager,debug:e.debug})})}(e,b),yield function(e){var t,n,r,i;return m(this,void 0,void 0,function*(){var o,a,l,c;let{options:d}=e,u={communicationLayerPreference:null!=(t=d.communicationLayerPreference)?t:op.SOCKET,platformManager:e.platformManager,sdk:e,checkInstallationOnAllCalls:d.checkInstallationOnAllCalls,injectProvider:null==(n=d.injectProvider)||n,shouldShimWeb3:null==(r=d.shouldShimWeb3)||r,extensionOnly:null==(i=d.extensionOnly)||i,installer:e.installer,remoteConnection:e.remoteConnection,debug:e.debug};e.activeProvider=yield(({checkInstallationOnAllCalls:e=!1,communicationLayerPreference:t,injectProvider:n,shouldShimWeb3:r,platformManager:i,installer:o,sdk:a,remoteConnection:l,debug:c})=>m(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 cI({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:l6.INPAGE,target:l6.CONTENT_SCRIPT,platformManager:i,communicationLayerPreference:t,remoteConnection:l}),f=i.getPlatformType(),p=a.options.dappMetadata,g=`Sdk/Javascript SdkVersion/${l4} Platform/${f} dApp/${null!=(d=p.url)?d:p.name} dAppTitle/${p.name}`,y=null,v=null,b=null==(u=a.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}`)}}lK(`[initializeMobileProvider] cachedAccountAddress: ${y}, cachedChainId: ${v}`);let w=!(!n||f===og.NonBrowser||f===og.ReactNative),E=l2.init({shouldSetOnWindow:w,connectionStream:h,shouldShimWeb3:r,sdkInstance:a}),_=!1,S=e=>{_=e},x=()=>_,C=(t,n,r,c)=>m(void 0,void 0,void 0,function*(){var d,u,h,f,p,w,E,C,k;let M=l2.getProvider();
6if(_){M.emit("display_uri",(null==l?void 0:l.state.qrcodeLink)||""),null==l||l.showActiveModal();let e=x();for(;e;){let t=x(),n=null==l?void 0:l.isAuthorized();e=t&&!n,lK(`[initializeMobileProvider: sendRequest()] waiting for initialization to complete - initializing: ${t} authorized: ${n}`),yield cO(1e3)}return lK("[initializeMobileProvider: sendRequest()] initial method completed -- prevent installation and call provider"),r(...n)}let A=i.isMetaMaskInstalled(),I=null==l?void 0:l.isConnected(),P=null,O=null,R=null;if(P=null!=(d=M.getSelectedAddress())?d:y,R=M.getChainId()||v,P&&b&&P!==y&&b.persistAccounts([P]).catch(e=>{console.error(`[initializeMobileProvider] failed to persist account: ${e}`)}),R&&(v=R,b&&b.persistChainId(R).catch(e=>{console.error(`[initializeMobileProvider] failed to persist chainId: ${e}`)})),lK("[initializeMobileProvider: sendRequest()]",{selectedAddress:P,chainId:R}),c&&lK(`[initializeMobileProvider: sendRequest()] method=${t} ongoing=${_} selectedAddress=${P} isInstalled=${A} checkInstallationOnAllCalls=${e} socketConnected=${I}`),P&&t.toLowerCase()===cu.toLowerCase())return[P];if(R&&t.toLowerCase()===ch.toLowerCase())return R;let T=!cp[t],L=null==(u=a.options.readonlyRPCMap)?void 0:u[R];if(L&&T)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})=>m(void 0,void 0,void 0,function*(){let i,o=JSON.stringify({jsonrpc:"2.0",method:t,params:r,id:cP+=1}),a={Accept:"application/json","Content-Type":"application/json"};e.includes("infura")&&(a["Metamask-Sdk-Info"]=n);try{i=yield s()(e,{method:"POST",headers:a,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:g,method:t,params:e||[]});return c&&lK(`initializeProvider::ReadOnlyRPCResponse ${r}`),r}catch(e){console.warn(`[initializeMobileProvider: sendRequest()] method=${t} readOnlyRPCRequest failed:`,e)}if((!A||A&&!I)&&t!==cr){let s=(null==(f=null==n?void 0:n[0])?void 0:f.params)||[];if(-1!==[cd,cl,ci,co].indexOf(t)||e){S(!0);let e=t===co,i=`${Date.now()}`;try{yield o.start({wait:!1,connectWith:e?{method:t,id:i,params:s}:void 0}),yield new Promise((e,t)=>{(null==l?void 0:l.isAuthorized())&&(lK("[initializeMobileProvider: sendRequest()] already authorized"),e(!0)),null==l||l.getConnector().once(os.AUTHORIZED,()=>{e(!0)}),a.once(os.PROVIDER_UPDATE,e=>{lK(`[initializeMobileProvider: sendRequest()] PROVIDER_UPDATE --- remote provider request interupted type=${e}`),e===d_.EXTENSION?t(os.PROVIDER_UPDATE):t(Error("Connection Terminated"))})})}catch(e){if(d_.EXTENSION===e){if(lK(`[initializeMobileProvider: sendRequest()] extension provider detect: re-create ${t} on the active provider`),t.toLowerCase()===ci.toLowerCase()){let e=yield null==(p=a.getProvider())?void 0:p.request({method:cd,params:[]});if(!e.length)throw Error("SDK state invalid -- undefined accounts");let t=yield null==(w=a.getProvider())?void 0:w.request({method:cs,params:[s[0],e[0]]});return a.emit(lQ,t),t}if(t.toLowerCase()===co.toLowerCase()){let[e]=s,t=yield(({method:e,sdk:t,params:n})=>m(void 0,void 0,void 0,function*(){var r,i,o,a;if(!t.isExtensionActive())throw Error("SDK state invalid -- extension is not active");lK("[MetaMaskProvider: extensionConnectWithOverwrite()] Overwriting request method",e,n);let s=yield null==(r=t.getProvider())?void 0:r.request({method:cd,params:[]});if(!s.length)throw Error("SDK state invalid -- undefined accounts");if((null==e?void 0:e.toLowerCase())===cs.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())===cf.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 cm.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:a,params:e.params});return a.emit(lQ,t),t}return lK(`[initializeMobileProvider: sendRequest()] sending '${t}' on active provider`,s),yield null==(E=a.getProvider())?void 0:E.request({method:t,params:s})}
6if(e===os.REJECTED)throw null==l||l.closeModal(),null==(C=a.getProvider())||C.handleDisconnect({terminate:!1}),Object.assign(Error("User rejected connection"),{code:4001});throw lK(`[initializeMobileProvider: sendRequest()] failed to start installer: ${e}`),e}finally{S(!1)}if(t===cd)return O=yield new Promise(e=>{let t=setInterval(()=>{let{accounts:n}=M.getState();n&&(clearInterval(t),e(n))},100)}),lK(`[initializeMobileProvider: sendRequest()] selectedAddress: ${P} --- SKIP rpc call`),O;if(t===co)try{let e,t,n=0,r=yield new Promise((r,o)=>{let s=null==l?void 0:l.getConnector().getRPCMethodTracker();lK(`TRACKER: method ${i}`,s),(null==s?void 0:s[i].result)?(lK("[initializeMobileProvider: sendRequest()] found result",null==s?void 0:s[i].result),r(null==s?void 0:s[i].result)):(null==s?void 0:s[i].error)&&(lK("[initializeMobileProvider: sendRequest()] found error",null==s?void 0:s[i].error),o(null==s?void 0:s[i].error)),t=()=>(({resolve:e,reject:t})=>{n+=1;let r=null==l?void 0:l.getConnector().getRPCMethodTracker(),o=null==r?void 0:r[i];return lK(`TRACKER: update method ${i}`,o),(null==o?void 0:o.result)?(lK("[initializeMobileProvider: sendRequest()] found result",o.result),a.emit(lQ,o.result),void e(o.result)):(null==o?void 0:o.error)?(lK("[initializeMobileProvider: sendRequest()] found error",o.error),void t(o.error)):n>=5?(lK("[initializeMobileProvider: sendRequest()] max message count reached without result"),void t(Error("Max message count reached without result"))):void lK("[initializeMobileProvider: sendRequest()] not found yet, need to wait for next update")})({resolve:r,reject:o}),e=null==l?void 0:l.getConnector().on(os.RPC_UPDATE,t)});return t&&(null==e||e.off(os.RPC_UPDATE,t)),lK("TRACKER: result",r),r}catch(e){throw lK("[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()&&cp[t])return r(...n);if(a.isExtensionActive())return lK(`[initializeMobileProvider: sendRequest()] EXTENSION active - redirect request '${t}' to it`,n,s),yield null==(k=a.getProvider())?void 0:k.request({method:t,params:s});throw lK(`[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(lK(`[initializeMobileProvider: sendRequest()] method=${t} rpcResponse`,e),t===cl){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},[]);lK("[initializeMobileProvider: sendRequest()] accountsToPersist:",t),t.length>0&&(M.handleAccountsChanged(t,!1),null==b||b.persistAccounts(t))}return e}catch(e){throw console.error("[initializeMobileProvider: sendRequest()] error:",e),e}}),{request:k}=E;E.request=(...e)=>m(void 0,void 0,void 0,function*(){return C(null==e?void 0:e[0].method,e,k,c)});let{send:M}=E;return E.send=(...e)=>m(void 0,void 0,void 0,function*(){return C(null==e?void 0:e[0],e,M,c)}),lK("[initializeMobileProvider: sendRequest()] metamaskStream.start()"),h.start(),E}))(u),null==(a=null==(o=e.remoteConnection)?void 0:o.getConnector())||a.on(l0,t=>{e.emit(l0,t)}),null==(c=null==(l=e.remoteConnection)?void 0:l.getConnector())||c.on(l1,t=>{e.emit(l1,t)})})}(e),yield function(e,t){var n,r;return m(this,void 0,void 0,function*(){let{options:i}=e;t?(lK("[MetaMaskSDK: handleAutoAndExtensionConnections()] preferExtension is detected -- connect with it."),null==(n=e.analytics)||n.send({event:ou.SDK_EXTENSION_UTILIZED}),cM(e).catch(e=>{console.warn("Can't connect with MetaMask extension...",e),localStorage.removeItem(cv)})):i.checkInstallationImmediately&&((null==(r=e.platformManager)?void 0:r.isDesktopWeb())?(lK("[MetaMaskSDK: handleAutoAndExtensionConnections()] checkInstallationImmediately"),e.connect().catch(e=>{lK(`[MetaMaskSDK: handleAutoAndExtensionConnections()] checkInstallationImmediately --- IGNORED --- error on autoconnect _err=${e}`)})):console.warn("[handleAutoAndExtensionConnections()] checkInstallationImmediately --- IGNORED --- only for web desktop")),e._initialized=!0})}(e,w);try{yield null==(p=e.remoteConnection)?void 0:p.startConnection({initialCheck:!0})}catch(e){console.error("[MetaMaskSDK: setupRemoteConnectionAndInstaller()] Error while checking installation",e)}e.emit(lX,d_.INITIALIZED)}})}(e),yield e.sdkInitPromise}catch(e){throw console.error(e),e}return e.sdkInitPromise})}(this)})}isExtensionActive(){return this.extensionActive}checkExtensionAvailability(){var e;return"u">typeof window&&!!(null==(e=window.ethereum)?void 0:e.isMetaMask)}connect(){return m(this,void 0,void 0,function*(){return function(e){return m(this,void 0,void 0,function*(){if(e._initialized||(lK("[MetaMaskSDK: connect()] provider not ready -- wait for init()"),yield e.init()),lK(`[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:cd,params:[]})})}(this)})}connectAndSign({msg:e}){return m(this,void 0,void 0,function*(){return function({instance:e,msg:t}){return m(this,void 0,void 0,function*(){if(e._initialized||(lK("[MetaMaskSDK: connectAndSign()] provider not ready -- wait for init()"),yield e.init()),lK(`[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!==O)t=O.from(e,"utf8").toString("hex");else if("u">typeof TextEncoder)t=Array.from((new TextEncoder).encode(e)).map(e=>e.toString(16).padStart(2,"0")).join("");else{if("object"!=typeof y||!("Buffer"in y))throw Error("Unable to convert string to hex: No available method.");t=y.Buffer.from(e,"utf8").toString("hex")}return`0x${t}`}(t);return e.activeProvider.request({method:co,params:[{method:cs,params:[n]}]})})}({instance:this,msg:e})})}connectWith(e){return m(this,void 0,void 0,function*(){return function({instance:e,rpc:t}){return m(this,void 0,void 0,function*(){if(e._initialized||(lK("[MetaMaskSDK: connectWith()] provider not ready -- wait for init()"),yield e.init()),lK(`[MetaMaskSDK: connectWith()] method: ${t.method} rpc=${t}`),!e.activeProvider)throw Error("SDK state invalid -- undefined provider");return e.activeProvider.request({method:co,params:[t]})})}({instance:this,rpc:e})})}resume(){return function(e){var t,n,r;return m(this,void 0,void 0,function*(){(null==(n=null==(t=e.remoteConnection)?void 0:t.getConnector())?void 0:n.isReady())?lK("[MetaMaskSDK: resume()] channel is ready"):(lK("[MetaMaskSDK: resume()] channel is not ready -- starting connection"),null==(r=e.remoteConnection)||r.startConnection())})}(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 m(this,void 0,void 0,function*(){if(!(null==(t=e.platformManager)?void 0:t.isMetaMaskMobileWebView())){if(ck&&(window.localStorage.removeItem(cv),window.localStorage.removeItem(cw),window.localStorage.removeItem(cb)),e.extensionActive){try{yield null==(n=e.activeProvider)?void 0:n.request({method:"wallet_revokePermissions",params:[{eth_accounts:{}}]})}catch(e){lK("[MetaMaskSDK: terminate()] error revoking permissions",e)}return e.options.extensionOnly?(e.emit(lX,d_.TERMINATE),void lK("[MetaMaskSDK: terminate()] extensionOnly --- prevent switching providers")):(e.activeProvider=e.sdkProvider,window.ethereum=e.activeProvider,e.extensionActive=!1,void e.emit(lX,d_.TERMINATE))}e.emit(lX,d_.TERMINATE),lK(`[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 l4}getDappId(){var e,t,n,r;return"u"<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 m(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,f.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,f.A)();return localStorage.setItem(e,n),n}catch(e){return console.error("[MetaMaskSDK: getBrowserAnonId()] LocalStorage access error:",e),(0,f.A)()}}getReactNativeAnonId(){return m(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,f.A)();return yield t.setItem(e,r),r}catch(e){return console.error("[MetaMaskSDK: getReactNativeAnonId()] Error accessing AsyncStorage:",e),(0,f.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 c0=Object.freeze({__proto__:null,StorageManagerWeb:class{constructor({enabled:e}={enabled:!1}){this.enabled=!1,this.enabled=e}persistChannelConfig(e){return m(this,void 0,void 0,function*(){let t=JSON.stringify(e);lK(`[StorageManagerWeb: persistChannelConfig()] enabled=${this.enabled}`,e),localStorage.setItem(cy,t)})}getPersistedChannelConfig(){return m(this,void 0,void 0,function*(){let e;try{if(lK(`[StorageManagerWeb: getPersistedChannelConfig()] enabled=${this.enabled}`),e=localStorage.getItem(cy),lK("[StorageManagerWeb: getPersistedChannelConfig()]",e),!e)return;let t=JSON.parse(e);return lK("[StorageManagerWeb: getPersistedChannelConfig()] channelConfig",t),t}catch(e){return void console.error("[StorageManagerWeb: getPersistedChannelConfig()] Can't find existing channel config",e)}})}persistAccounts(e){return m(this,void 0,void 0,function*(){lK(`[StorageManagerWeb: persistAccounts()] enabled=${this.enabled}`,e);let t=JSON.stringify(e);localStorage.setItem(cb,t)})}getCachedAccounts(){return m(this,void 0,void 0,function*(){try{let e=localStorage.getItem(cb);return e?JSON.parse(e):[]}catch(e){throw console.error("[StorageManagerWeb: getCachedAccounts()] Error reading cached accounts",e),e}})}persistChainId(e){return m(this,void 0,void 0,function*(){lK(`[StorageManagerWeb: persistChainId()] enabled=${this.enabled}`,e),localStorage.setItem(cw,e)})}getCachedChainId(){return m(this,void 0,void 0,function*(){try{let e=localStorage.getItem(cw);return null!=e?e:void 0}catch(e){throw console.error("[StorageManagerWeb: getCachedChainId()] Error reading cached chainId",e),e}})}terminate(){return m(this,void 0,void 0,function*(){lK(`[StorageManagerWeb: terminate()] enabled=${this.enabled}`),localStorage.removeItem(cy)})}}}),c1=Object.defineProperty,c2=new WeakMap,c3=(e,t)=>c2.set(t.$lazyInstance$=e,t),c5=(e,t)=>(0,console.error)(e,t),c8=new Map,c6=new Map,c4="slot-fb{display:contents}slot-fb[hidden]{display:none}",c9="u">typeof window?window:{},c7=c9.document||{head:{}},de={$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)},dt=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync}catch(e){}return!1})(),dn=!1,dr=[],di=[],da=e=>{for(let t=0;t<e.length;t++)try{e[t](performance.now())}catch(e){c5(e)}e.length=0},ds=()=>{da(dr),da(di),(dn=dr.length>0)&&de.raf(ds)},dl=e=>Promise.resolve(void 0).then(e),dc=e=>{di.push(e),dn||(dn=!0,4&de.$flags$?dl(ds):de.raf(ds))},dd={},du=e=>"object"==(e=typeof e)||"function"===e;function dh(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}var df={},dp={err:()=>dy,map:()=>dv,ok:()=>dm,unwrap:()=>dC,unwrapErr:()=>dk};for(var dg in dp)c1(df,dg,{get:dp[dg],enumerable:!0});var dm=e=>({isOk:!0,isErr:!1,value:e}
6),dy=e=>({isOk:!1,isErr:!0,value:e});function dv(e,t){if(e.isOk){let n=t(e.value);return n instanceof Promise?n.then(e=>dm(e)):dm(n)}if(e.isErr)return dy(e.value);throw"should never get here"}var db,dw,dE,d_,dS,dx,dC=e=>{if(e.isOk)return e.value;throw e.value},dk=e=>{if(e.isErr)return e.value;throw e.value},dM=(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&&!du(r))&&(r=String(r)),i&&o?a[a.length-1].$text$+=r:a.push(i?dA(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,dP);let l=dA(e,null);return l.$attrs$=t,a.length>0&&(l.$children$=a),l},dA=(e,t)=>({$flags$:0,$tag$:e,$text$:t,$elm$:null,$children$:null,$attrs$:null}),dI={},dP={forEach:(e,t)=>e.map(dO).forEach(t),map:(e,t)=>e.map(dO).map(t).map(dR)},dO=e=>({vattrs:e.$attrs$,vchildren:e.$children$,vkey:e.$key$,vname:e.$name$,vtag:e.$tag$,vtext:e.$text$}),dR=e=>{if("function"==typeof e.vtag){let t={...e.vattrs};return e.vkey&&(t.key=e.vkey),e.vname&&(t.name=e.vname),dM(e.vtag,t,...e.vchildren||[])}let t=dA(e.vtag,e.vtext);return t.$attrs$=e.vattrs,t.$children$=e.vchildren,t.$key$=e.vkey,t.$name$=e.vname,t},dT=e=>c2.get(e).$hostElement$,dL=(e,t,n)=>{let r=dT(e);return{emit:e=>
6dN(r,t,{bubbles:!!(4&n),composed:!!(2&n),cancelable:!!(1&n),detail:e})}},dN=(e,t,n)=>{let r=de.ce(t,n);return e.dispatchEvent(r),r},d$=new WeakMap,dD=(e,t,n,r,i,o)=>{if(n!==r){let a=t in e,s=t.toLowerCase();if("class"===t){let t=e.classList,i=dK(n),o=dK(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=du(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):s in c9?s.slice(2):s[2]+t.slice(3),n||r){let i=t.endsWith(dj);t=t.replace(dU,""),n&&de.rel(e,t,n,i),r&&de.ael(e,t,r,i)}}},dB=/\s/,dK=e=>e?e.split(dB):[],dj="Capture",dU=RegExp(dj+"$"),dH=(e,t,n)=>{let r=11===t.$elm$.nodeType&&t.$elm$.host?t.$elm$.host:t.$elm$,i=e&&e.$attrs$||dd,o=t.$attrs$||dd;for(let e of dF(Object.keys(i)))e in o||dD(r,e,i[e],void 0,n,t.$flags$);for(let e of dF(Object.keys(o)))dD(r,e,i[e],o[e],n,t.$flags$)};function dF(e){return e.includes("ref")?[...e.filter(e=>"ref"!==e),"ref"]:e}var dz=!1,dq=(e,t,n,r)=>{let i=t.$children$[n],o,a,s=0;if(null!==i.$text$)o=i.$elm$=c7.createTextNode(i.$text$);else{if(dz||(dz="svg"===i.$tag$),o=i.$elm$=c7.createElementNS(dz?"http://www.w3.org/2000/svg":"http://www.w3.org/1999/xhtml",i.$tag$),dz&&"foreignObject"===i.$tag$&&(dz=!1),dH(null,i,dz),o.getRootNode().querySelector("body"),i.$children$)for(s=0;s<i.$children$.length;++s)(a=dq(e,i,s))&&o.appendChild(a);"svg"===i.$tag$?dz=!1:"foreignObject"===o.tagName&&(dz=!0)}return o["s-hn"]=dx,o},dV=(e,t,n,r,i,o)=>{let a,s=e;for(s.shadowRoot&&s.tagName===dx&&(s=s.shadowRoot);i<=o;++i)r[i]&&(a=dq(null,n,i))&&(r[i].$elm$=a,dZ(s,a,t))},dW=(e,t,n)=>{for(let r=t;r<=n;++r){let t=e[r];if(t){let e=t.$elm$;e&&e.remove()}}},dG=(e,t,n=!1)=>e.$tag$===t.$tag$,dY=(e,t,n=!1)=>{let r=t.$elm$=e.$elm$,i=e.$children$,o=t.$children$,a=t.$tag$,s=t.$text$;null===s?(dH(e,t,dz="svg"===a||"foreignObject"!==a&&dz),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]:dG(c,h,i)?(dY(c,h,i),c=t[++a],h=r[++s]):dG(d,f,i)?(dY(d,f,i),d=t[--l],f=r[--u]):dG(c,f,i)?(dY(c,f,i),dZ(e,c.$elm$,d.$elm$.nextSibling),c=t[++a],f=r[--u]):dG(d,h,i)?(dY(d,h,i),dZ(e,d.$elm$,c.$elm$),d=t[--l],h=r[++s]):(o=dq(t&&t[s],n,s),h=r[++s],o&&dZ(c.$elm$.parentNode,o,c.$elm$));a>l?dV(e,null==r[u+1]?null:r[u+1].$elm$,n,r,s,u):s>u&&dW(t,a,l)})(r,i,t,o,n):null!==o?(null!==e.$text$&&(r.textContent=""),dV(r,null,t,o,0,o.length-1)):n||null===i||dW(i,0,i.length-1),dz&&"svg"===a&&(dz=!1)):e.$text$!==s&&(r.data=s)},dZ=(e,t,n)=>null==e?void 0:e.insertBefore(t,n),dJ=(e,t)=>{t&&!e.$onRenderResolve$&&t["s-p"]&&t["s-p"].push(new Promise(t=>e.$onRenderResolve$=t))},dX=(e,t)=>(e.$flags$|=16,4&e.$flags$)?void(e.$flags$|=512):(dJ(e,e.$ancestorComponent$),dc(()=>dQ(e,t))),dQ=(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(),d0(void 0,()=>d2(e,i,t))},d0=(e,t)=>d1(e)?e.then(t).catch(e=>{console.error(e),t()}):t(),d1=e=>e instanceof Promise||e&&e.then&&"function"==typeof e.then,d2=async(e,t,n)=>{var r;let i,o,a,s,l=e.$hostElement$,c=(e.$cmpMeta$.$tagName$,()=>{}),d=l["s-rc"];n&&(i=e.$cmpMeta$,o=e.$hostElement$,a=i.$flags$,i.$tagName$,s=((e,t)=>{var n;let r="sc-"+t.$tagName$,i=c6.get(r);if(e=11===e.nodeType?e:c7,i)if("string"==typeof i){e=e.head||e;let o,a=d$.get(e);if(a||d$.set(e,a=new Set),!a.has(r)){{(o=c7.createElement("style")).innerHTML=i;let r=null!=(n=de.$nonce$)?n:dh(c7);if(null!=r&&o.setAttribute("nonce",r),!(1&t.$flags$))if("HEAD"===e.n
6odeName){let t=e.querySelectorAll("link[rel=preconnect]"),n=t.length>0?t[t.length-1].nextSibling:e.querySelector("style");e.insertBefore(o,n)}else if("host"in e)if(dt){let t=new CSSStyleSheet;t.replaceSync(i),e.adoptedStyleSheets=[t,...e.adoptedStyleSheets]}else{let t=e.querySelector("style");t?t.innerHTML=i+t.innerHTML:e.prepend(o)}else e.append(o);1&t.$flags$&&"HEAD"!==e.nodeName&&e.insertBefore(o,null)}4&t.$flags$&&(o.innerHTML+=c4),a&&a.add(r)}}else e.adoptedStyleSheets.includes(i)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,i]);return r})(o.shadowRoot?o.shadowRoot:o.getRootNode(),i),10&a&&2&a&&(o["s-sc"]=s,o.classList.add(s+"-h")),(()=>{})());let u=(e.$cmpMeta$.$tagName$,()=>{});d3(e,t,l,n),d&&(d.map(e=>e()),l["s-rc"]=void 0),u(),c();{let t=null!=(r=l["s-p"])?r:[],n=()=>d5(e);0===t.length?n():(Promise.all(t).then(n),e.$flags$|=4,t.length=0)}},d3=(e,t,n,r)=>{try{t=t.render(),e.$flags$&=-17,e.$flags$|=2,((e,t,n=!1)=>{let r=e.$hostElement$,i=e.$cmpMeta$,o=e.$vnode$||dA(null,null),a=t&&t.$tag$===dI?t:dM(null,null,t);if(dx=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$,dY(o,a,n)})(e,t,r)}catch(t){c5(t,e.$hostElement$)}return null},d5=e=>{e.$cmpMeta$.$tagName$;let t=e.$hostElement$,n=()=>{},r=e.$lazyInstance$,i=e.$ancestorComponent$;64&e.$flags$?n():(e.$flags$|=64,d4(t),d6(r,"componentDidLoad"),n(),e.$onReadyResolve$(t),i||d8()),e.$onRenderResolve$&&(e.$onRenderResolve$(),e.$onRenderResolve$=void 0),512&e.$flags$&&dl(()=>dX(e,!1)),e.$flags$&=-517},d8=e=>{d4(c7.documentElement),dl(()=>dN(c9,"appload",{detail:{namespace:"sdk-install-modal-web"}}))},d6=(e,t,n)=>{if(e&&e[t])try{return e[t](n)}catch(e){c5(e)}},d4=e=>e.classList.add("hydrated"),d9=(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 c2.get(this).$instanceValues$.get(e)},set(n){((e,t,n,r)=>{var i,o;let a=c2.get(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||du(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){c5(e,s)}})}2==(18&c)&&dX(a,!1)}})(this,e,n,t)},configurable:!0,enumerable:!0})}),1&n){let n=new Map;o.attributeChangedCallback=function(e,r,i){de.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=c2.get(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},d7=async(e,t,n,r)=>{let i;if(0==(32&t.$flags$)){if(t.$flags$|=32,n.$lazyBundleId$){let e=(e=>{let t=e.$tagName$.replace(/-/g,"_"),n=e.$lazyBundleId$;if(!n)return;let r=c8.get(n);return r?r[t]:"mm-install-modal_3"===n?Promise.resolve().then(function(){return uK}).then(e=>(c8.set(n,e),e[t]),c5):import(`./${n}.entry.js`).then(e=>(c8.set(n,e),e[t]),c5)})(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,d9(i,n,2),i.isProxied=!0);let r=(n.$tagName$,()=>{});t.$flags$|=8;try{new i(t)}catch(e){c5(e)}t.$flags$&=-9,t.$flags$|=128,r(),ue(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="sc-"+n.$tagName$;if(!c6.has(t)){var o,a;let r,i=(n.$tagName$,()=>{});o=e,a=!!(1&n.$flags$),r=c6.get(t),dt&&a?"string"==typeof(r=r||new CSSStyleSheet)?r=o:r.replaceSync(o):r=o,c6.set(t,r),i()}}}let s=t.$ancestorComponent$,l=()=>dX(t,!0);s&&s["s-rc"]?s["s-rc"].push(l):l()},ue=e=>{d6(e,"connectedCallback")},ut=e=>{d6(e,"disconnectedCallback")};if("u">typeof window&&void 0!==window.Reflect&&void 0!==window.customElements){var un=HTMLElement;window.HTMLElement=function(){return Reflect.construct(un,[],this.constructor)},HTMLElement.prototype=un.prototype,HTMLElement.prototype.constructor=HTMLElement,Object.setPrototypeOf(HTMLElement,un)}var ur=Object.freeze({__proto__:null,defineCustomElements:async(e,t)=>{if("u">typeof window)return await void 0,((e,t={})=>{var n;let r=[],i=t.exclude||[],o=c9.customElements,a=c7.head,s=a.querySelector("meta[charset]"),l=c7.createElement("style"),c=[],d,u=!0;Object.assign(de,t),de.$resourcesUrl$=new URL(t.resourcesUrl||"./",c7.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=>
6n.$onReadyResolve$=e),e["s-p"]=[],e["s-rc"]=[],c2.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(){c2.get(this),this.hasRegisteredEventListeners||(this.hasRegisteredEventListeners=!0),d&&(clearTimeout(d),d=null),u?c.push(this):de.jmp(()=>(e=>{if(0==(1&de.$flags$)){let t=c2.get(e),n=t.$cmpMeta$,r=(n.$tagName$,()=>{});if(1&t.$flags$)(null==t?void 0:t.$lazyInstance$)?ue(t.$lazyInstance$):(null==t?void 0:t.$onReadyPromise$)&&t.$onReadyPromise$.then(()=>ue(t.$lazyInstance$));else{t.$flags$|=1;{let n=e;for(;n=n.parentNode||n.host;)if(n["s-p"]){dJ(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}}),d7(e,t,n)}r()}})(this))}disconnectedCallback(){de.jmp(()=>(async e=>{if(0==(1&de.$flags$)){let t=c2.get(e);(null==t?void 0:t.$lazyInstance$)?ut(t.$lazyInstance$):(null==t?void 0:t.$onReadyPromise$)&&t.$onReadyPromise$.then(()=>ut(t.$lazyInstance$))}})(this))}componentOnReady(){return c2.get(this).$onReadyPromise$}};a.$lazyBundleId$=e[0],i.includes(s)||o.get(s)||(r.push(s),o.define(s,d9(l,a,1)))})}),r.length>0&&(h&&(l.textContent+=c4),l.textContent+=r.sort()+"{visibility:hidden}.hydrated{visibility:inherit}",l.innerHTML.length)){l.setAttribute("data-styles","");let e=null!=(n=de.$nonce$)?n:dh(c7);null!=e&&l.setAttribute("nonce",e),a.insertBefore(l,s?s.nextSibling:a.firstChild)}u=!1,c.length?c.map(e=>e.connectedCallback()):de.jmp(()=>d=setTimeout(d8,30))})([["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=>de.$nonce$=e});let ui={fontFamily:"Roboto, sans-serif"},uo=({className:e},t)=>dM("div",{style:ui,class:e},t),ua=({Icon:e,text:t})=>dM("div",{class:"flexContainer",style:{padding:"6",flexDirection:"row"}},dM("div",{class:"flexItem1"},dM(e,null)),dM("div",{class:"flexItem11"},dM("span",{style:{lineHeight:"2",color:"black"}},t))),us=()=>dM("svg",{width:"20",height:"18",viewBox:"0 0 20 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},dM("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.5502C15.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"}),dM("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"})),ul=()=>dM("svg",{width:"20",height:"18",viewBox:"0 0 20 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},dM("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"})),uc=()=>dM("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},dM("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"})),ud=()=>dM("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},dM("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"}),dM("path",{d:"M12 2V14.88",stroke:"white","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"}),dM("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 uu({version:e}){return dM("div",{style:{textAlign:"center",color:"#BBC0C5",fontSize:"12"}},"SDK Version ",e?`v${e}`:"unknown")}let uh=()=>dM("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},dM("rect",{width:"16",height:"16",fill:"white"}),dM("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.40554
6C14.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"})),uf=()=>dM("svg",{width:"120",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 127 63"},dM("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-.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 up(e,t){return e.toString(2).padStart(t,"0")}function ug(e,t){let n=e%t;return n>=0?n:t+n}function um(e,t){return Array(e).fill(t)}function uy(...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 uv(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 ub(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 uw{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;
6if(" "===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 uw({height:r,width:t},i)}constructor(e,t){const{height:n,width:r}=uw.size(e);this.data=t||Array.from({length:n},()=>um(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=ug(e.x,this.width),e.y=ug(e.y,this.height),e}rect(e,t,n){let{x:r,y:i}=this.xy(e),{height:o,width:a}=uw.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=um(e,t),o=Array.from({length:e},()=>um(r,t));return new uw({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 uw(uw.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 uw({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 uw({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 uw(this.size()).rect({x:0,y:0},this.size(),({x:e,y:t})=>this.data[t][e])}assertDrawn(){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,...um(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 uE=["low","medium","quartile","high"],u_=["numeric","alphanumeric","byte","kanji","eci"],uS=[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],ux={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]},uC={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]},uk={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=uk.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=uk.ECCode[e]<<3|t,r=n;for(let e=0;e<10;e++)r=r<<1^1335*(r>>9);return(n<<10|r)^uk.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:ub("0123456789"),alphanumerc:ub("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][uk.sizeType(e)],modeBits:{numeric:"0001",alphanumeric:"0010",byte:"0100",kanji:"1000",eci:"0111"},capacity(e,t){let n=uS[e-1],r=ux[t][e-1],i=uC[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}}},uM=[(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],uA={tables:(()=>{let e=um(256,0),t=um(256,0);for(let n=0,r=1;n<256;n++)e[n]=r,t[r]=n,256&(r<<=1)&&(r^=285);return{exp:e,log:t}})(),exp:e=>uA.tables.exp[e],log(e){if(0===e)throw Error(`GF.log: wrong arg=${e}`);return uA.tables.log[e]%255},mul:(e,t)=>
60===e||0===t?0:uA.tables.exp[(uA.tables.log[e]+uA.tables.log[t])%255],add:(e,t)=>e^t,pow:(e,t)=>uA.tables.exp[uA.tables.log[e]*t%255],inv(e){if(0===e)throw Error(`GF.inverse: wrong arg=${e}`);return uA.tables.exp[255-uA.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=um(e+1,0);return n[0]=t,uA.polynomial(n)},degree:e=>e.length-1,coefficient:(e,t)=>e[uA.degree(e)-t],mulPoly(e,t){if(0===e[0]||0===t[0])return[0];let n=um(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]=uA.add(n[r+i],uA.mul(e[r],t[i]));return uA.polynomial(n)},mulPolyScalar(e,t){if(0==t)return[0];if(1==t)return e;let n=um(e.length,0);for(let r=0;r<e.length;r++)n[r]=uA.mul(e[r],t);return uA.polynomial(n)},mulPolyMonomial(e,t,n){if(t<0)throw Error("GF.mulPolyMonomial: wrong degree");if(0==n)return[0];let r=um(e.length+t,0);for(let t=0;t<e.length;t++)r[t]=uA.mul(e[t],n);return uA.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=um(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]=uA.add(n[e-o],r[e]);return uA.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]=uA.add(n[r+i],uA.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=uA.mulPoly(t,[1,uA.pow(2,n)]);return t},evalPoly(e,t){if(0==t)return uA.coefficient(e,0);let n=e[0];for(let r=1;r<e.length;r++)n=uA.add(uA.mul(t,n),e[r]);return n},euclidian(e,t,n){uA.degree(e)<uA.degree(t)&&([e,t]=[t,e]);let r=e,i=t,o=[0],a=[1];for(;2*uA.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=uA.inv(r[0]);for(;uA.degree(i)>=uA.degree(r)&&0!==i[0];){let e=uA.degree(i)-uA.degree(r),t=uA.mul(i[0],s);n=uA.addPoly(n,uA.monomial(e,t)),i=uA.addPoly(i,uA.mulPolyMonomial(r,e,t))}if(n=uA.mulPoly(n,o),a=uA.addPoly(n,t),uA.degree(i)>=uA.degree(r))throw Error(`Division failed r: ${i}, rLast: ${r}`)}let s=uA.coefficient(a,0);if(0==s)throw Error("sigmaTilde(0) was zero");let l=uA.inv(s);return[uA.mulPolyScalar(a,l),uA.mulPolyScalar(i,l)]}};function uI(e,t,n,r){let i="",o=n.length;if("numeric"===r){let e=uk.alphabet.numeric.decode(n.split("")),t=e.length;for(let n=0;n<t-2;n+=3)i+=up(100*e[n]+10*e[n+1]+e[n+2],10);t%3==1?i+=up(e[t-1],4):t%3==2&&(i+=up(10*e[t-2]+e[t-1],7))}else if("alphanumeric"===r){let e=uk.alphabet.alphanumerc.decode(n.split("")),t=e.length;for(let n=0;n<t-1;n+=2)i+=up(45*e[n]+e[n+1],11);t%2==1&&(i+=up(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=>up(e,8)).join("")}}let{capacity:a}=uk.capacity(e,t),s=up(o,uk.lengthBits(e,r)),l=uk.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}=uk.capacity(e,t),s={encode(e){let t=uA.divisorPoly(n),r=Array.from(e);return r.push(...t.slice(0,-1).fill(0)),Uint8Array.from(uA.remainderPoly(r,t))},decode(e){let t=e.slice(),r=uA.polynomial(Array.from(e)),i=um(n,0),o=!1;for(let e=0;e<n;e++){let t=uA.evalPoly(r,uA.exp(e));i[i.length-1-e]=t,0!==t&&(o=!0)}if(!o)return t;i=uA.polynomial(i);let a=uA.monomial(n,1),[s,l]=uA.euclidian(a,i,n),c=um(uA.degree(s),0),d=0;for(let e=1;e<256&&d<c.length;e++)0===uA.evalPoly(s,e)&&(c[d++]=uA.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-uA.log(c[e]);if(n<0)throw Error("RS.decode: wrong error location");let r=uA.inv(c[e]),i=1;for(let t=0;t<c.length;t++)e!==t&&(i=uA.mul(i,uA.add(1,uA.mul(c[t],r))));t[n]=uA.add(t[n],uA.mul(uA.evalPoly(l,r),uA.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=uy(...t),l=uy(...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 uP(e,t,n,r,i=!1){let o=function(e,t,n,r=!1){let i=uk.size.encode(e),o=new uw(i+2),a=new uw(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 uw(1).rect(0,1,!0).border(1,!1).border(1,!0),l=uk.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=uk.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=uk.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=uM[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 uO(e,t="raw",n={}){let r=void 0!==n.ecc?n.ecc:"medium";if(!uE.includes(r))throw Error(`Invalid error correction mode=${r}. Expected: ${uE}`);let i=void 0!==n.encoding?n.encoding:function(e){let t="numeric";for(let n of e)if(!uk.alphabet.numeric.has(n)&&(t="alphanumeric",!uk.alphabet.alphanumerc.has(n)))return"byte";return t}(e);!function(e){if(!u_.includes(e))throw Error(`Encoding: invalid mode=${e}. Expected: ${u_}`);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)||!uM[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=uI(a,r,e,i);else for(let t=1;t<=40;t++)try{o=uI(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<uM.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++)uv(e,r,t)&&(o+=40),uv(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}(uP(e,t,n,r,!0)),r);r=a.get()}if(void 0===r)throw Error("Cannot find mask");return uP(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 uR={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 uT{constructor(e){var t;this.translations=uR,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=uR}else this.translations=uR}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:""}}(i=o||(o={})).SDK_MODAL_VIEWED="sdk_modal_viewed",i.SDK_MODAL_BUTTON_CLICKED="sdk_modal_button_clicked",i.SDK_MODAL_TOGGLE_CHANGED="sdk_modal_toggle_changed";let uL=class{constructor(e){c3(this,e),this.close=dL(this,"close",7),this.startDesktopOnboarding=dL(this,"startDesktopOnboarding",7),this.trackAnalytics=dL(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 uT}componentDidLoad(){this.trackAnalytics.emit({event:o.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:o.SDK_MODAL_BUTTON_CLICKED,params:{button_type:"install_extension",tab:"desktop"}}),this.startDesktopOnboarding.emit()}setTab(e,t=!1){t&&this.trackAnalytics.emit({event:o.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=uO(this.link,"svg",{ecc:"medium",scale:2});return dM(uo,{className:"install-model"},dM("div",{class:"backdrop",onClick:()=>this.onClose(!0)}),dM("div",{class:"modal"},dM("div",{class:"closeButtonContainer"},dM("div",{class:"right"},dM("span",{class:"closeButton",onClick:()=>this.onClose(!0)},dM(uh,null)))),dM("div",{class:"logoContainer"},dM(uf,null)),dM("div",null,dM("div",{class:"tabcontainer"},dM("div",{class:"flexContainer"},dM("div",{onClick:()=>this.setTab(1,!0),class:"tab flexItem "+(1===t?"tabactive":"")},e("DESKTOP")),dM("div",{onClick:()=>this.setTab(2,!0),class:"tab flexItem "+(2===t?"tabactive":"")},e("MOBILE")))),dM("div",{style:{display:1===t?"none":"block"}},dM("div",{class:"flexContainer"},dM("div",{class:"flexItem",style:{textAlign:"center",marginTop:"4"}},n&&dM("div",{id:"sdk-mm-qrcode",class:"center",innerHTML:n}),dM("div",{class:"connectMobileText"},e("SCAN_TO_CONNECT")," ",dM("br",null),dM("span",{class:"blue"},dM("b",null,e("META_MASK_MOBILE_APP"))))))),dM("div",{style:{display:2===t?"none":"block"}},dM("div",{class:"item"},dM(ua,{Icon:ul,text:e("INSTALL_MODAL.TRUSTED_BY_USERS")})),dM("div",{class:"item"},dM(ua,{Icon:us,text:e("INSTALL_MODAL.LEADING_CRYPTO_WALLET")})),dM("div",{class:"item"},dM(ua,{Icon:uc,text:e("INSTALL_MODAL.CONTROL_DIGITAL_INTERACTIONS")})),dM("button",{class:"button",onClick:()=>this.onStartDesktopOnboardingHandler()},dM(ud,null),dM("span",{class:"installExtensionText"},e("INSTALL_MODAL.INSTALL_META_MASK_EXTENSION"))))),dM(uu,{version:this.sdkVersion})))}get el(){return dT(this)}static get watchers(){return{preferDesktop:["updatePreferDesktop"]}}};uL.style=".flexContainer {\n    display: flex;\n    justify-content: center;
6\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;
6\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;
6\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}";let uN=class{constructor(e){c3(this,e),this.close=dL(this,"close",7),this.disconnect=dL(this,"disconnect",7),this.updateOTPValue=dL(this,"updateOTPValue",7),this.displayOTP=void 0,this.sdkVersion=void 0,this.otpCode=void 0,this.translationsLoaded=!1,this.i18nInstance=new uT}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 dM(uo,{className:"pending-modal"},dM("div",{class:"backdrop",onClick:()=>this.onClose()}),dM("div",{class:"modal"},dM("div",{class:"closeButtonContainer"},dM("div",{class:"right"},dM("span",{class:"closeButton",onClick:()=>this.onClose()},dM(uh,null)))),dM("div",{class:"logoContainer"},dM(uf,null)),dM("div",null,dM("div",{class:"flexContainer",style:{flexDirection:"column",color:"black"}},dM("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")),dM("div",{id:"sdk-mm-otp-value",style:{padding:"10px",fontSize:"32px",display:this.otpCode?"block":"none"}},this.otpCode),t&&dM("div",{class:"notice"},"* ",r("PENDING_MODAL.NUMBER_AFTER_OPEN_NOTICE"))),dM("div",{style:{marginTop:"20px"}},dM("button",{class:"button blue",style:{marginTop:"5px",color:"#0376C9",borderColor:"#0376C9",borderWidth:"1px",borderStyle:"solid",backgroundColor:"white"},onClick:()=>this.onDisconnect()},r("PENDING_MODAL.DISCONNECT")))),dM(uu,{version:n})))}get el(){return dT(this)}};uN.style=".flexContainer {\n    display: flex;\n    justify-content: center;
6\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;
6\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;
6\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}";let u$=()=>dM("svg",{width:"21",height:"15",viewBox:"0 0 21 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},dM("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"})),uD=()=>dM("svg",{width:"400",height:"300",viewBox:"0 0 400 300",fill:"none",xmlns:"http://www.w3.org/2000/svg"},dM("rect",{width:"400",height:"300",fill:"white"}),dM("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"}),dM("path",{d:"M99.8955 27.9336L177.414 74.2792L174.331 106.085L99.8955 27.9336Z",fill:"#FF5C16"}),dM("path",{d:"M149.505 191.539L183.612 217.521L149.505 227.681V191.539Z",fill:"#FF5C16"}),dM("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"}),dM("path",{d:"M300.116 27.9336L222.598 74.2792L225.67 106.085L300.116 27.9336Z",fill:"#FF5C16"}),dM("path",{d:"M250.508 191.539L216.4 217.521L250.508 227.681V191.539Z",fill:"#FF5C16"}),dM("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"}),dM("path",{d:"M149.493 227.681L99.8843 242.46L84.7939 191.54H149.493V227.681Z",fill:"#E34807"}),dM("path",{d:"M180.875 148.574L190.351 209.98L177.219 175.838L132.456 164.732L149.483 148.574H180.864H180.875Z",fill:"#E34807"}),dM("path",{d:"M250.507 227.681L300.116 242.46L315.206 191.54H250.507V227.681Z",fill:"#E34807"}),dM("path",{d:"M219.126 148.574L209.649 209.98L222.782 175.838L267.545 164.732L250.507 148.574H219.126Z",fill:"#E34807"}),dM("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"}),dM("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"}),dM("path",{d:"M222.598 74.2466H200H177.402L174.33 106.053L190.351 209.936H209.649L225.681 106.053L222.598 74.2466Z",fill:"#FF8D5D"}),dM("path",{d:"M99.8843 27.9336L84.7939 87.1777L99.8843 134.979H132.337L174.319 106.085L99.8843 27.9336Z",fill:"#661800"}),dM("path",{d:"M171.496 160.906H156.795L148.79 168.752L177.229 175.804L171.496 160.896V160.906Z",fill:"#661800"}),dM("path",{d:"M300.116 27.9336L315.206 87.1777L300.116 134.979H267.663L225.681 106.085L300.116 27.9336Z",fill:"#661800"}),dM("path",{d:"M228.525 160.906H243.248L251.253 168.763L222.781 175.826L228.525 160.896V160.906Z",fill:"#661800"}),dM("path",{d:"M213.046 229.789L216.399 217.51L209.649 209.991H190.34L183.59 217.51L186.943 229.789",fill:"#661800"}),dM("path",{d:"M213.047 229.789V250.066H186.944V229.789H213.047Z",fill:"#C0C4CD"}),dM("path",{d:"M149.504 227.66L186.965 250.056V229.779L183.611 217.5L149.504 227.66Z",fill:"#E7EBF6"}),dM("path",{d:"M250.506 227.66L213.045 250.056V229.779L216.398 217.5L250.506 227.66Z",fill:"#E7EBF6"})),uB=class{constructor(e){c3(this,e),this.close=dL(this,"close",7),this.connectWithExtension=dL(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 uT,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=uO(this.link,"svg",{ecc:"medium",scale:2});return dM(uo,{className:"select-modal"},dM("div",{class:"backdrop",onClick:()=>this.onClose(!0)}),dM("div",{class:"modal"},dM("div",{class:"closeButtonContainer"},dM("div",{class:"right"},dM("span",{class:"closeButton",onClick:()=>this.onClose(!0)},dM(uh,null)))),dM("div",{class:"logoContainer"},dM(uf,null)),dM("div",null,dM("div",{class:"tabcontainer"},dM("div",{class:"flexContainer"},dM("div",{onClick:()=>this.setTab(1),class:"tab flexItem "+(1===n?"tabactive":"")},e("DESKTOP")),dM("div",{onClick:()=>this.setTab(2),class:"tab flexItem "+(2===n?"tabactive":"")},e("MOBILE")))),dM("div",{style:{display:1===n?"none":"block"}},dM("div",{class:"flexContainer"},dM("div",{class:"flexItem",style:{textAlign:"center",marginTop:"4"}},dM("div",{class:"center",id:"sdk-mm-qrcode",innerHTML:r}),dM("div",{class:"connectMobileText"},e("SCAN_TO_CONNECT"),dM("br",null),dM("span",{class:"blue"},dM("b",null,e("META_MASK_MOBILE_APP"))))))),dM("div",{style:{display:2===n?"none":"block"}},dM("div",{style:{display:"flex",justifyContent:"center",height:"300",marginTop:"-20"}},dM(uD,null)),dM("div",{class:"extensionLabel"},e("SELECT_MODAL.CRYPTO_TAKE_CONTROL_TEXT")),dM("button",{class:"button",onClick:()=>this.connectWithExtensionHandler()},dM(u$,null),dM("span",{class:"installExtensionText"},e("CONNECT_WITH_EXTENSION"))))),dM(uu,{version:t})))}get el(){return dT(this)}static get watchers(){return{preferDesktop:["updatePreferDesktop"]}}};uB.style=".flexContainer {\n    display: flex;\n    justify-content: center;
6\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;
6\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;
6\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}";var uK=Object.freeze({__proto__:null,mm_install_modal:uL,mm_pending_modal:uN,mm_select_modal:uB})}}]);

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.